1 |
Author: mpagano |
2 |
Date: 2014-06-07 23:56:08 +0000 (Sat, 07 Jun 2014) |
3 |
New Revision: 2815 |
4 |
|
5 |
Added: |
6 |
genpatches-2.6/trunk/3.14/1005_linux-3.14.6.patch |
7 |
Removed: |
8 |
genpatches-2.6/trunk/3.14/1501-futex-add-another-early-deadlock-detection-check.patch |
9 |
genpatches-2.6/trunk/3.14/1502-futex-prevent-attaching-to-kernel-threads.patch |
10 |
genpatches-2.6/trunk/3.14/1503-futex-prevent-requeue-pi-on-same-futex-patch-futex-forbid-uaddr-uaddr2-in-futex_requeue-requeue_pi-1.patch |
11 |
genpatches-2.6/trunk/3.14/1504-futex-validate-atomic-acquisition-in-futex_lock_pi_atomic.patch |
12 |
genpatches-2.6/trunk/3.14/1505-futex-always-cleanup-owner-tid-in-unlock_pi.patch |
13 |
genpatches-2.6/trunk/3.14/1506-futex-make-lookup_pi_state-more-robust.patch |
14 |
Modified: |
15 |
genpatches-2.6/trunk/3.14/0000_README |
16 |
Log: |
17 |
Linux patch 3.14.6. Removal of redundant patches. |
18 |
|
19 |
Modified: genpatches-2.6/trunk/3.14/0000_README |
20 |
=================================================================== |
21 |
--- genpatches-2.6/trunk/3.14/0000_README 2014-06-06 20:06:46 UTC (rev 2814) |
22 |
+++ genpatches-2.6/trunk/3.14/0000_README 2014-06-07 23:56:08 UTC (rev 2815) |
23 |
@@ -62,34 +62,14 @@ |
24 |
From: http://www.kernel.org |
25 |
Desc: Linux 3.14.5 |
26 |
|
27 |
+Patch: 1005_linux-3.14.6.patch |
28 |
+From: http://www.kernel.org |
29 |
+Desc: Linux 3.14.6 |
30 |
+ |
31 |
Patch: 1500_XATTR_USER_PREFIX.patch |
32 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
33 |
Desc: Support for namespace user.pax.* on tmpfs. |
34 |
|
35 |
-Patch: 1501-futex-add-another-early-deadlock-detection-check.patch |
36 |
-From: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=866293ee54227584ffcb4a42f69c1f365974ba7f |
37 |
-Desc: CVE-2014-3153 |
38 |
- |
39 |
-Patch: 1502-futex-prevent-attaching-to-kernel-threads.patch |
40 |
-From: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=f0d71b3dcb8332f7971b5f2363632573e6d9486a |
41 |
-Desc: CVE-2014-3153 |
42 |
- |
43 |
-Patch: 1503-futex-prevent-requeue-pi-on-same-futex-patch-futex-forbid-uaddr-uaddr2-in-futex_requeue-requeue_pi-1.patch |
44 |
-From: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e9c243a5a6de0be8e584c604d353412584b592f8 |
45 |
-Desc: CVE-2014-3153 |
46 |
- |
47 |
-Patch: 1504-futex-validate-atomic-acquisition-in-futex_lock_pi_atomic.patch |
48 |
-From: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b3eaa9fc5cd0a4d74b18f6b8dc617aeaf1873270 |
49 |
-Desc: CVE-2014-3153 |
50 |
- |
51 |
-Patch: 1505-futex-always-cleanup-owner-tid-in-unlock_pi.patch |
52 |
-From: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=13fbca4c6ecd96ec1a1cfa2e4f2ce191fe928a5e |
53 |
-Desc: CVE-2014-3153 |
54 |
- |
55 |
-Patch: 1506-futex-make-lookup_pi_state-more-robust.patch |
56 |
-From: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=54a217887a7b658e2650c3feff22756ab80c7339 |
57 |
-Desc: CVE-2014-3153 |
58 |
- |
59 |
Patch: 1700_enable-thinkpad-micled.patch |
60 |
From: https://bugs.gentoo.org/show_bug.cgi?id=449248 |
61 |
Desc: Enable mic mute led in thinkpads |
62 |
|
63 |
Added: genpatches-2.6/trunk/3.14/1005_linux-3.14.6.patch |
64 |
=================================================================== |
65 |
--- genpatches-2.6/trunk/3.14/1005_linux-3.14.6.patch (rev 0) |
66 |
+++ genpatches-2.6/trunk/3.14/1005_linux-3.14.6.patch 2014-06-07 23:56:08 UTC (rev 2815) |
67 |
@@ -0,0 +1,9578 @@ |
68 |
+diff --git a/Documentation/devicetree/bindings/dma/ti-edma.txt b/Documentation/devicetree/bindings/dma/ti-edma.txt |
69 |
+index 9fbbdb783a72..68ff2137bae7 100644 |
70 |
+--- a/Documentation/devicetree/bindings/dma/ti-edma.txt |
71 |
++++ b/Documentation/devicetree/bindings/dma/ti-edma.txt |
72 |
+@@ -29,6 +29,6 @@ edma: edma@49000000 { |
73 |
+ dma-channels = <64>; |
74 |
+ ti,edma-regions = <4>; |
75 |
+ ti,edma-slots = <256>; |
76 |
+- ti,edma-xbar-event-map = <1 12 |
77 |
+- 2 13>; |
78 |
++ ti,edma-xbar-event-map = /bits/ 16 <1 12 |
79 |
++ 2 13>; |
80 |
+ }; |
81 |
+diff --git a/Documentation/i2c/busses/i2c-i801 b/Documentation/i2c/busses/i2c-i801 |
82 |
+index aaaf069306a3..adf5e33e8312 100644 |
83 |
+--- a/Documentation/i2c/busses/i2c-i801 |
84 |
++++ b/Documentation/i2c/busses/i2c-i801 |
85 |
+@@ -26,6 +26,7 @@ Supported adapters: |
86 |
+ * Intel Wellsburg (PCH) |
87 |
+ * Intel Coleto Creek (PCH) |
88 |
+ * Intel Wildcat Point-LP (PCH) |
89 |
++ * Intel BayTrail (SOC) |
90 |
+ Datasheets: Publicly available at the Intel website |
91 |
+ |
92 |
+ On Intel Patsburg and later chipsets, both the normal host SMBus controller |
93 |
+diff --git a/Documentation/input/elantech.txt b/Documentation/input/elantech.txt |
94 |
+index 5602eb71ad5d..e1ae127ed099 100644 |
95 |
+--- a/Documentation/input/elantech.txt |
96 |
++++ b/Documentation/input/elantech.txt |
97 |
+@@ -504,9 +504,12 @@ byte 5: |
98 |
+ * reg_10 |
99 |
+ |
100 |
+ bit 7 6 5 4 3 2 1 0 |
101 |
+- 0 0 0 0 0 0 0 A |
102 |
++ 0 0 0 0 R F T A |
103 |
+ |
104 |
+ A: 1 = enable absolute tracking |
105 |
++ T: 1 = enable two finger mode auto correct |
106 |
++ F: 1 = disable ABS Position Filter |
107 |
++ R: 1 = enable real hardware resolution |
108 |
+ |
109 |
+ 6.2 Native absolute mode 6 byte packet format |
110 |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
111 |
+diff --git a/Documentation/ja_JP/HOWTO b/Documentation/ja_JP/HOWTO |
112 |
+index 0091a8215ac1..b61885c35ce1 100644 |
113 |
+--- a/Documentation/ja_JP/HOWTO |
114 |
++++ b/Documentation/ja_JP/HOWTO |
115 |
+@@ -315,7 +315,7 @@ Andrew Morton が Linux-kernel メーリングリストにカーネルリリー |
116 |
+ もし、3.x.y カーネルが存在しない場合には、番号が一番大きい 3.x が |
117 |
+ 最新の安定版カーネルです。 |
118 |
+ |
119 |
+-3.x.y は "stable" チーム <stable@××××××.org> でメンテされており、必 |
120 |
++3.x.y は "stable" チーム <stable@×××××××××××.org> でメンテされており、必 |
121 |
+ 要に応じてリリースされます。通常のリリース期間は 2週間毎ですが、差し迫っ |
122 |
+ た問題がなければもう少し長くなることもあります。セキュリティ関連の問題 |
123 |
+ の場合はこれに対してだいたいの場合、すぐにリリースがされます。 |
124 |
+diff --git a/Documentation/ja_JP/stable_kernel_rules.txt b/Documentation/ja_JP/stable_kernel_rules.txt |
125 |
+index 14265837c4ce..9dbda9b5d21e 100644 |
126 |
+--- a/Documentation/ja_JP/stable_kernel_rules.txt |
127 |
++++ b/Documentation/ja_JP/stable_kernel_rules.txt |
128 |
+@@ -50,16 +50,16 @@ linux-2.6.29/Documentation/stable_kernel_rules.txt |
129 |
+ |
130 |
+ -stable ツリーにパッチを送付する手続き- |
131 |
+ |
132 |
+- - 上記の規則に従っているかを確認した後に、stable@××××××.org にパッチ |
133 |
++ - 上記の規則に従っているかを確認した後に、stable@×××××××××××.org にパッチ |
134 |
+ を送る。 |
135 |
+ - 送信者はパッチがキューに受け付けられた際には ACK を、却下された場合 |
136 |
+ には NAK を受け取る。この反応は開発者たちのスケジュールによって、数 |
137 |
+ 日かかる場合がある。 |
138 |
+ - もし受け取られたら、パッチは他の開発者たちと関連するサブシステムの |
139 |
+ メンテナーによるレビューのために -stable キューに追加される。 |
140 |
+- - パッチに stable@××××××.org のアドレスが付加されているときには、それ |
141 |
++ - パッチに stable@×××××××××××.org のアドレスが付加されているときには、それ |
142 |
+ が Linus のツリーに入る時に自動的に stable チームに email される。 |
143 |
+- - セキュリティパッチはこのエイリアス (stable@××××××.org) に送られるべ |
144 |
++ - セキュリティパッチはこのエイリアス (stable@×××××××××××.org) に送られるべ |
145 |
+ きではなく、代わりに security@××××××.org のアドレスに送られる。 |
146 |
+ |
147 |
+ レビューサイクル- |
148 |
+diff --git a/Documentation/zh_CN/HOWTO b/Documentation/zh_CN/HOWTO |
149 |
+index 6c914aa87e71..54ea24ff63c7 100644 |
150 |
+--- a/Documentation/zh_CN/HOWTO |
151 |
++++ b/Documentation/zh_CN/HOWTO |
152 |
+@@ -237,7 +237,7 @@ kernel.org网站的pub/linux/kernel/v2.6/目录下找到它。它的开发遵循 |
153 |
+ 如果没有2.6.x.y版本内核存在,那么最新的2.6.x版本内核就相当于是当前的稳定 |
154 |
+ 版内核。 |
155 |
+ |
156 |
+-2.6.x.y版本由“稳定版”小组(邮件地址<stable@××××××.org>)维护,一般隔周发 |
157 |
++2.6.x.y版本由“稳定版”小组(邮件地址<stable@×××××××××××.org>)维护,一般隔周发 |
158 |
+ 布新版本。 |
159 |
+ |
160 |
+ 内核源码中的Documentation/stable_kernel_rules.txt文件具体描述了可被稳定 |
161 |
+diff --git a/Documentation/zh_CN/stable_kernel_rules.txt b/Documentation/zh_CN/stable_kernel_rules.txt |
162 |
+index b5b9b0ab02fd..26ea5ed7cd9c 100644 |
163 |
+--- a/Documentation/zh_CN/stable_kernel_rules.txt |
164 |
++++ b/Documentation/zh_CN/stable_kernel_rules.txt |
165 |
+@@ -42,7 +42,7 @@ Documentation/stable_kernel_rules.txt 的中文翻译 |
166 |
+ |
167 |
+ 向稳定版代码树提交补丁的过程: |
168 |
+ |
169 |
+- - 在确认了补丁符合以上的规则后,将补丁发送到stable@××××××.org。 |
170 |
++ - 在确认了补丁符合以上的规则后,将补丁发送到stable@×××××××××××.org。 |
171 |
+ - 如果补丁被接受到队列里,发送者会收到一个ACK回复,如果没有被接受,收 |
172 |
+ 到的是NAK回复。回复需要几天的时间,这取决于开发者的时间安排。 |
173 |
+ - 被接受的补丁会被加到稳定版本队列里,等待其他开发者的审查。 |
174 |
+diff --git a/Makefile b/Makefile |
175 |
+index fa77b0bed2a2..0d499e6896cd 100644 |
176 |
+--- a/Makefile |
177 |
++++ b/Makefile |
178 |
+@@ -1,6 +1,6 @@ |
179 |
+ VERSION = 3 |
180 |
+ PATCHLEVEL = 14 |
181 |
+-SUBLEVEL = 5 |
182 |
++SUBLEVEL = 6 |
183 |
+ EXTRAVERSION = |
184 |
+ NAME = Remembering Coco |
185 |
+ |
186 |
+diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi |
187 |
+index 79087ccf64bc..ab01d0f98d1a 100644 |
188 |
+--- a/arch/arm/boot/dts/am33xx.dtsi |
189 |
++++ b/arch/arm/boot/dts/am33xx.dtsi |
190 |
+@@ -140,7 +140,7 @@ |
191 |
+ compatible = "ti,edma3"; |
192 |
+ ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; |
193 |
+ reg = <0x49000000 0x10000>, |
194 |
+- <0x44e10f90 0x10>; |
195 |
++ <0x44e10f90 0x40>; |
196 |
+ interrupts = <12 13 14>; |
197 |
+ #dma-cells = <1>; |
198 |
+ dma-channels = <64>; |
199 |
+diff --git a/arch/arm/boot/dts/armada-xp-db.dts b/arch/arm/boot/dts/armada-xp-db.dts |
200 |
+index bcf6d79a57ec..8c2fe44e4dfe 100644 |
201 |
+--- a/arch/arm/boot/dts/armada-xp-db.dts |
202 |
++++ b/arch/arm/boot/dts/armada-xp-db.dts |
203 |
+@@ -40,7 +40,7 @@ |
204 |
+ /* Device Bus parameters are required */ |
205 |
+ |
206 |
+ /* Read parameters */ |
207 |
+- devbus,bus-width = <8>; |
208 |
++ devbus,bus-width = <16>; |
209 |
+ devbus,turn-off-ps = <60000>; |
210 |
+ devbus,badr-skew-ps = <0>; |
211 |
+ devbus,acc-first-ps = <124000>; |
212 |
+diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts |
213 |
+index 274e2ad5f51c..df5c34284dbd 100644 |
214 |
+--- a/arch/arm/boot/dts/armada-xp-gp.dts |
215 |
++++ b/arch/arm/boot/dts/armada-xp-gp.dts |
216 |
+@@ -49,7 +49,7 @@ |
217 |
+ /* Device Bus parameters are required */ |
218 |
+ |
219 |
+ /* Read parameters */ |
220 |
+- devbus,bus-width = <8>; |
221 |
++ devbus,bus-width = <16>; |
222 |
+ devbus,turn-off-ps = <60000>; |
223 |
+ devbus,badr-skew-ps = <0>; |
224 |
+ devbus,acc-first-ps = <124000>; |
225 |
+diff --git a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts |
226 |
+index 99bcf76e6953..b33e10ea2ea0 100644 |
227 |
+--- a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts |
228 |
++++ b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts |
229 |
+@@ -37,7 +37,7 @@ |
230 |
+ /* Device Bus parameters are required */ |
231 |
+ |
232 |
+ /* Read parameters */ |
233 |
+- devbus,bus-width = <8>; |
234 |
++ devbus,bus-width = <16>; |
235 |
+ devbus,turn-off-ps = <60000>; |
236 |
+ devbus,badr-skew-ps = <0>; |
237 |
+ devbus,acc-first-ps = <124000>; |
238 |
+diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi |
239 |
+index 4307e80b2d2e..dc72353de0b3 100644 |
240 |
+--- a/arch/arm/boot/dts/imx53.dtsi |
241 |
++++ b/arch/arm/boot/dts/imx53.dtsi |
242 |
+@@ -87,7 +87,7 @@ |
243 |
+ ipu: ipu@18000000 { |
244 |
+ #crtc-cells = <1>; |
245 |
+ compatible = "fsl,imx53-ipu"; |
246 |
+- reg = <0x18000000 0x080000000>; |
247 |
++ reg = <0x18000000 0x08000000>; |
248 |
+ interrupts = <11 10>; |
249 |
+ clocks = <&clks 59>, <&clks 110>, <&clks 61>; |
250 |
+ clock-names = "bus", "di0", "di1"; |
251 |
+diff --git a/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts b/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts |
252 |
+index dc86429756d7..4651672bda89 100644 |
253 |
+--- a/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts |
254 |
++++ b/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts |
255 |
+@@ -30,6 +30,16 @@ |
256 |
+ bootargs = "console=ttyS0,115200n8 earlyprintk"; |
257 |
+ }; |
258 |
+ |
259 |
++ mbus { |
260 |
++ pcie-controller { |
261 |
++ status = "okay"; |
262 |
++ |
263 |
++ pcie@1,0 { |
264 |
++ status = "okay"; |
265 |
++ }; |
266 |
++ }; |
267 |
++ }; |
268 |
++ |
269 |
+ ocp@f1000000 { |
270 |
+ pinctrl@10000 { |
271 |
+ pmx_usb_led: pmx-usb-led { |
272 |
+@@ -73,14 +83,6 @@ |
273 |
+ ehci@50000 { |
274 |
+ status = "okay"; |
275 |
+ }; |
276 |
+- |
277 |
+- pcie-controller { |
278 |
+- status = "okay"; |
279 |
+- |
280 |
+- pcie@1,0 { |
281 |
+- status = "okay"; |
282 |
+- }; |
283 |
+- }; |
284 |
+ }; |
285 |
+ |
286 |
+ gpio-leds { |
287 |
+diff --git a/arch/arm/boot/dts/kirkwood-nsa310-common.dtsi b/arch/arm/boot/dts/kirkwood-nsa310-common.dtsi |
288 |
+index aa78c2d11fe7..e2cc85cc3b87 100644 |
289 |
+--- a/arch/arm/boot/dts/kirkwood-nsa310-common.dtsi |
290 |
++++ b/arch/arm/boot/dts/kirkwood-nsa310-common.dtsi |
291 |
+@@ -4,6 +4,16 @@ |
292 |
+ / { |
293 |
+ model = "ZyXEL NSA310"; |
294 |
+ |
295 |
++ mbus { |
296 |
++ pcie-controller { |
297 |
++ status = "okay"; |
298 |
++ |
299 |
++ pcie@1,0 { |
300 |
++ status = "okay"; |
301 |
++ }; |
302 |
++ }; |
303 |
++ }; |
304 |
++ |
305 |
+ ocp@f1000000 { |
306 |
+ pinctrl: pinctrl@10000 { |
307 |
+ |
308 |
+@@ -26,14 +36,6 @@ |
309 |
+ status = "okay"; |
310 |
+ nr-ports = <2>; |
311 |
+ }; |
312 |
+- |
313 |
+- pcie-controller { |
314 |
+- status = "okay"; |
315 |
+- |
316 |
+- pcie@1,0 { |
317 |
+- status = "okay"; |
318 |
+- }; |
319 |
+- }; |
320 |
+ }; |
321 |
+ |
322 |
+ gpio_poweroff { |
323 |
+diff --git a/arch/arm/boot/dts/ste-ccu8540.dts b/arch/arm/boot/dts/ste-ccu8540.dts |
324 |
+index 7f3baf51a3a9..32dd55e5f4e6 100644 |
325 |
+--- a/arch/arm/boot/dts/ste-ccu8540.dts |
326 |
++++ b/arch/arm/boot/dts/ste-ccu8540.dts |
327 |
+@@ -18,6 +18,7 @@ |
328 |
+ compatible = "st-ericsson,ccu8540", "st-ericsson,u8540"; |
329 |
+ |
330 |
+ memory@0 { |
331 |
++ device_type = "memory"; |
332 |
+ reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>; |
333 |
+ }; |
334 |
+ |
335 |
+diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c |
336 |
+index 41bca32409fc..5339009b3c0c 100644 |
337 |
+--- a/arch/arm/common/edma.c |
338 |
++++ b/arch/arm/common/edma.c |
339 |
+@@ -1423,55 +1423,38 @@ EXPORT_SYMBOL(edma_clear_event); |
340 |
+ |
341 |
+ #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DMADEVICES) |
342 |
+ |
343 |
+-static int edma_of_read_u32_to_s16_array(const struct device_node *np, |
344 |
+- const char *propname, s16 *out_values, |
345 |
+- size_t sz) |
346 |
++static int edma_xbar_event_map(struct device *dev, struct device_node *node, |
347 |
++ struct edma_soc_info *pdata, size_t sz) |
348 |
+ { |
349 |
+- int ret; |
350 |
+- |
351 |
+- ret = of_property_read_u16_array(np, propname, out_values, sz); |
352 |
+- if (ret) |
353 |
+- return ret; |
354 |
+- |
355 |
+- /* Terminate it */ |
356 |
+- *out_values++ = -1; |
357 |
+- *out_values++ = -1; |
358 |
+- |
359 |
+- return 0; |
360 |
+-} |
361 |
+- |
362 |
+-static int edma_xbar_event_map(struct device *dev, |
363 |
+- struct device_node *node, |
364 |
+- struct edma_soc_info *pdata, int len) |
365 |
+-{ |
366 |
+- int ret, i; |
367 |
++ const char pname[] = "ti,edma-xbar-event-map"; |
368 |
+ struct resource res; |
369 |
+ void __iomem *xbar; |
370 |
+- const s16 (*xbar_chans)[2]; |
371 |
++ s16 (*xbar_chans)[2]; |
372 |
++ size_t nelm = sz / sizeof(s16); |
373 |
+ u32 shift, offset, mux; |
374 |
++ int ret, i; |
375 |
+ |
376 |
+- xbar_chans = devm_kzalloc(dev, |
377 |
+- len/sizeof(s16) + 2*sizeof(s16), |
378 |
+- GFP_KERNEL); |
379 |
++ xbar_chans = devm_kzalloc(dev, (nelm + 2) * sizeof(s16), GFP_KERNEL); |
380 |
+ if (!xbar_chans) |
381 |
+ return -ENOMEM; |
382 |
+ |
383 |
+ ret = of_address_to_resource(node, 1, &res); |
384 |
+ if (ret) |
385 |
+- return -EIO; |
386 |
++ return -ENOMEM; |
387 |
+ |
388 |
+ xbar = devm_ioremap(dev, res.start, resource_size(&res)); |
389 |
+ if (!xbar) |
390 |
+ return -ENOMEM; |
391 |
+ |
392 |
+- ret = edma_of_read_u32_to_s16_array(node, |
393 |
+- "ti,edma-xbar-event-map", |
394 |
+- (s16 *)xbar_chans, |
395 |
+- len/sizeof(u32)); |
396 |
++ ret = of_property_read_u16_array(node, pname, (u16 *)xbar_chans, nelm); |
397 |
+ if (ret) |
398 |
+ return -EIO; |
399 |
+ |
400 |
+- for (i = 0; xbar_chans[i][0] != -1; i++) { |
401 |
++ /* Invalidate last entry for the other user of this mess */ |
402 |
++ nelm >>= 1; |
403 |
++ xbar_chans[nelm][0] = xbar_chans[nelm][1] = -1; |
404 |
++ |
405 |
++ for (i = 0; i < nelm; i++) { |
406 |
+ shift = (xbar_chans[i][1] & 0x03) << 3; |
407 |
+ offset = xbar_chans[i][1] & 0xfffffffc; |
408 |
+ mux = readl(xbar + offset); |
409 |
+@@ -1480,8 +1463,7 @@ static int edma_xbar_event_map(struct device *dev, |
410 |
+ writel(mux, (xbar + offset)); |
411 |
+ } |
412 |
+ |
413 |
+- pdata->xbar_chans = xbar_chans; |
414 |
+- |
415 |
++ pdata->xbar_chans = (const s16 (*)[2]) xbar_chans; |
416 |
+ return 0; |
417 |
+ } |
418 |
+ |
419 |
+diff --git a/arch/arm/kernel/crash_dump.c b/arch/arm/kernel/crash_dump.c |
420 |
+index 90c50d4b43f7..5d1286d51154 100644 |
421 |
+--- a/arch/arm/kernel/crash_dump.c |
422 |
++++ b/arch/arm/kernel/crash_dump.c |
423 |
+@@ -39,7 +39,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, |
424 |
+ if (!csize) |
425 |
+ return 0; |
426 |
+ |
427 |
+- vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE); |
428 |
++ vaddr = ioremap(__pfn_to_phys(pfn), PAGE_SIZE); |
429 |
+ if (!vaddr) |
430 |
+ return -ENOMEM; |
431 |
+ |
432 |
+diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.c b/arch/arm/mach-mvebu/mvebu-soc-id.c |
433 |
+index f3b325f6cbd4..0e1547a186b0 100644 |
434 |
+--- a/arch/arm/mach-mvebu/mvebu-soc-id.c |
435 |
++++ b/arch/arm/mach-mvebu/mvebu-soc-id.c |
436 |
+@@ -107,7 +107,18 @@ static int __init mvebu_soc_id_init(void) |
437 |
+ iounmap(pci_base); |
438 |
+ |
439 |
+ res_ioremap: |
440 |
+- clk_disable_unprepare(clk); |
441 |
++ /* |
442 |
++ * If the PCIe unit is actually enabled and we have PCI |
443 |
++ * support in the kernel, we intentionally do not release the |
444 |
++ * reference to the clock. We want to keep it running since |
445 |
++ * the bootloader does some PCIe link configuration that the |
446 |
++ * kernel is for now unable to do, and gating the clock would |
447 |
++ * make us loose this precious configuration. |
448 |
++ */ |
449 |
++ if (!of_device_is_available(child) || !IS_ENABLED(CONFIG_PCI_MVEBU)) { |
450 |
++ clk_disable_unprepare(clk); |
451 |
++ clk_put(clk); |
452 |
++ } |
453 |
+ |
454 |
+ clk_err: |
455 |
+ of_node_put(child); |
456 |
+diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h |
457 |
+index f565f9944af2..7548db2bfb8a 100644 |
458 |
+--- a/arch/arm/mach-orion5x/common.h |
459 |
++++ b/arch/arm/mach-orion5x/common.h |
460 |
+@@ -21,7 +21,7 @@ struct mv_sata_platform_data; |
461 |
+ #define ORION_MBUS_DEVBUS_BOOT_ATTR 0x0f |
462 |
+ #define ORION_MBUS_DEVBUS_TARGET(cs) 0x01 |
463 |
+ #define ORION_MBUS_DEVBUS_ATTR(cs) (~(1 << cs)) |
464 |
+-#define ORION_MBUS_SRAM_TARGET 0x00 |
465 |
++#define ORION_MBUS_SRAM_TARGET 0x09 |
466 |
+ #define ORION_MBUS_SRAM_ATTR 0x00 |
467 |
+ |
468 |
+ /* |
469 |
+diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c |
470 |
+index 473e5dbf8f39..0f08dfd69ebc 100644 |
471 |
+--- a/arch/arm64/kernel/irq.c |
472 |
++++ b/arch/arm64/kernel/irq.c |
473 |
+@@ -97,11 +97,15 @@ static bool migrate_one_irq(struct irq_desc *desc) |
474 |
+ if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity)) |
475 |
+ return false; |
476 |
+ |
477 |
+- if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { |
478 |
+- affinity = cpu_online_mask; |
479 |
++ if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) |
480 |
+ ret = true; |
481 |
+- } |
482 |
+ |
483 |
++ /* |
484 |
++ * when using forced irq_set_affinity we must ensure that the cpu |
485 |
++ * being offlined is not present in the affinity mask, it may be |
486 |
++ * selected as the target CPU otherwise |
487 |
++ */ |
488 |
++ affinity = cpu_online_mask; |
489 |
+ c = irq_data_get_irq_chip(d); |
490 |
+ if (!c->irq_set_affinity) |
491 |
+ pr_debug("IRQ%u: unable to set affinity\n", d->irq); |
492 |
+diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c |
493 |
+index 5e9aec358306..31eb959e9aa8 100644 |
494 |
+--- a/arch/arm64/mm/hugetlbpage.c |
495 |
++++ b/arch/arm64/mm/hugetlbpage.c |
496 |
+@@ -51,7 +51,11 @@ int pmd_huge(pmd_t pmd) |
497 |
+ |
498 |
+ int pud_huge(pud_t pud) |
499 |
+ { |
500 |
++#ifndef __PAGETABLE_PMD_FOLDED |
501 |
+ return !(pud_val(pud) & PUD_TABLE_BIT); |
502 |
++#else |
503 |
++ return 0; |
504 |
++#endif |
505 |
+ } |
506 |
+ |
507 |
+ int pmd_huge_support(void) |
508 |
+diff --git a/arch/metag/include/asm/barrier.h b/arch/metag/include/asm/barrier.h |
509 |
+index 5d6b4b407dda..2d6f0de77325 100644 |
510 |
+--- a/arch/metag/include/asm/barrier.h |
511 |
++++ b/arch/metag/include/asm/barrier.h |
512 |
+@@ -15,6 +15,7 @@ static inline void wr_fence(void) |
513 |
+ volatile int *flushptr = (volatile int *) LINSYSEVENT_WR_FENCE; |
514 |
+ barrier(); |
515 |
+ *flushptr = 0; |
516 |
++ barrier(); |
517 |
+ } |
518 |
+ |
519 |
+ #else /* CONFIG_METAG_META21 */ |
520 |
+@@ -35,6 +36,7 @@ static inline void wr_fence(void) |
521 |
+ *flushptr = 0; |
522 |
+ *flushptr = 0; |
523 |
+ *flushptr = 0; |
524 |
++ barrier(); |
525 |
+ } |
526 |
+ |
527 |
+ #endif /* !CONFIG_METAG_META21 */ |
528 |
+@@ -68,6 +70,7 @@ static inline void fence(void) |
529 |
+ volatile int *flushptr = (volatile int *) LINSYSEVENT_WR_ATOMIC_UNLOCK; |
530 |
+ barrier(); |
531 |
+ *flushptr = 0; |
532 |
++ barrier(); |
533 |
+ } |
534 |
+ #define smp_mb() fence() |
535 |
+ #define smp_rmb() fence() |
536 |
+diff --git a/arch/metag/include/asm/processor.h b/arch/metag/include/asm/processor.h |
537 |
+index f16477d1f571..3be8581af495 100644 |
538 |
+--- a/arch/metag/include/asm/processor.h |
539 |
++++ b/arch/metag/include/asm/processor.h |
540 |
+@@ -22,6 +22,8 @@ |
541 |
+ /* Add an extra page of padding at the top of the stack for the guard page. */ |
542 |
+ #define STACK_TOP (TASK_SIZE - PAGE_SIZE) |
543 |
+ #define STACK_TOP_MAX STACK_TOP |
544 |
++/* Maximum virtual space for stack */ |
545 |
++#define STACK_SIZE_MAX (1 << 28) /* 256 MB */ |
546 |
+ |
547 |
+ /* This decides where the kernel will search for a free chunk of vm |
548 |
+ * space during mmap's. |
549 |
+diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c |
550 |
+index c2bb4f896ce7..3aa5b46b2d40 100644 |
551 |
+--- a/arch/mips/cavium-octeon/octeon-irq.c |
552 |
++++ b/arch/mips/cavium-octeon/octeon-irq.c |
553 |
+@@ -635,7 +635,7 @@ static void octeon_irq_cpu_offline_ciu(struct irq_data *data) |
554 |
+ cpumask_clear(&new_affinity); |
555 |
+ cpumask_set_cpu(cpumask_first(cpu_online_mask), &new_affinity); |
556 |
+ } |
557 |
+- __irq_set_affinity_locked(data, &new_affinity); |
558 |
++ irq_set_affinity_locked(data, &new_affinity, false); |
559 |
+ } |
560 |
+ |
561 |
+ static int octeon_irq_ciu_set_affinity(struct irq_data *data, |
562 |
+diff --git a/arch/mips/lantiq/dts/easy50712.dts b/arch/mips/lantiq/dts/easy50712.dts |
563 |
+index fac1f5b178eb..143b8a37b5e4 100644 |
564 |
+--- a/arch/mips/lantiq/dts/easy50712.dts |
565 |
++++ b/arch/mips/lantiq/dts/easy50712.dts |
566 |
+@@ -8,6 +8,7 @@ |
567 |
+ }; |
568 |
+ |
569 |
+ memory@0 { |
570 |
++ device_type = "memory"; |
571 |
+ reg = <0x0 0x2000000>; |
572 |
+ }; |
573 |
+ |
574 |
+diff --git a/arch/mips/loongson/lemote-2f/clock.c b/arch/mips/loongson/lemote-2f/clock.c |
575 |
+index aed32b88576c..7d8c9cce3009 100644 |
576 |
+--- a/arch/mips/loongson/lemote-2f/clock.c |
577 |
++++ b/arch/mips/loongson/lemote-2f/clock.c |
578 |
+@@ -91,6 +91,7 @@ EXPORT_SYMBOL(clk_put); |
579 |
+ |
580 |
+ int clk_set_rate(struct clk *clk, unsigned long rate) |
581 |
+ { |
582 |
++ unsigned int rate_khz = rate / 1000; |
583 |
+ int ret = 0; |
584 |
+ int regval; |
585 |
+ int i; |
586 |
+@@ -111,10 +112,10 @@ int clk_set_rate(struct clk *clk, unsigned long rate) |
587 |
+ if (loongson2_clockmod_table[i].frequency == |
588 |
+ CPUFREQ_ENTRY_INVALID) |
589 |
+ continue; |
590 |
+- if (rate == loongson2_clockmod_table[i].frequency) |
591 |
++ if (rate_khz == loongson2_clockmod_table[i].frequency) |
592 |
+ break; |
593 |
+ } |
594 |
+- if (rate != loongson2_clockmod_table[i].frequency) |
595 |
++ if (rate_khz != loongson2_clockmod_table[i].frequency) |
596 |
+ return -ENOTSUPP; |
597 |
+ |
598 |
+ clk->rate = rate; |
599 |
+diff --git a/arch/mips/ralink/dts/mt7620a_eval.dts b/arch/mips/ralink/dts/mt7620a_eval.dts |
600 |
+index 35eb874ab7f1..709f58132f5c 100644 |
601 |
+--- a/arch/mips/ralink/dts/mt7620a_eval.dts |
602 |
++++ b/arch/mips/ralink/dts/mt7620a_eval.dts |
603 |
+@@ -7,6 +7,7 @@ |
604 |
+ model = "Ralink MT7620A evaluation board"; |
605 |
+ |
606 |
+ memory@0 { |
607 |
++ device_type = "memory"; |
608 |
+ reg = <0x0 0x2000000>; |
609 |
+ }; |
610 |
+ |
611 |
+diff --git a/arch/mips/ralink/dts/rt2880_eval.dts b/arch/mips/ralink/dts/rt2880_eval.dts |
612 |
+index 322d7002595b..0a685db093d4 100644 |
613 |
+--- a/arch/mips/ralink/dts/rt2880_eval.dts |
614 |
++++ b/arch/mips/ralink/dts/rt2880_eval.dts |
615 |
+@@ -7,6 +7,7 @@ |
616 |
+ model = "Ralink RT2880 evaluation board"; |
617 |
+ |
618 |
+ memory@0 { |
619 |
++ device_type = "memory"; |
620 |
+ reg = <0x8000000 0x2000000>; |
621 |
+ }; |
622 |
+ |
623 |
+diff --git a/arch/mips/ralink/dts/rt3052_eval.dts b/arch/mips/ralink/dts/rt3052_eval.dts |
624 |
+index 0ac73ea28198..ec9e9a035541 100644 |
625 |
+--- a/arch/mips/ralink/dts/rt3052_eval.dts |
626 |
++++ b/arch/mips/ralink/dts/rt3052_eval.dts |
627 |
+@@ -7,6 +7,7 @@ |
628 |
+ model = "Ralink RT3052 evaluation board"; |
629 |
+ |
630 |
+ memory@0 { |
631 |
++ device_type = "memory"; |
632 |
+ reg = <0x0 0x2000000>; |
633 |
+ }; |
634 |
+ |
635 |
+diff --git a/arch/mips/ralink/dts/rt3883_eval.dts b/arch/mips/ralink/dts/rt3883_eval.dts |
636 |
+index 2fa6b330bf4f..e8df21a5d10d 100644 |
637 |
+--- a/arch/mips/ralink/dts/rt3883_eval.dts |
638 |
++++ b/arch/mips/ralink/dts/rt3883_eval.dts |
639 |
+@@ -7,6 +7,7 @@ |
640 |
+ model = "Ralink RT3883 evaluation board"; |
641 |
+ |
642 |
+ memory@0 { |
643 |
++ device_type = "memory"; |
644 |
+ reg = <0x0 0x2000000>; |
645 |
+ }; |
646 |
+ |
647 |
+diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig |
648 |
+index bb2a8ec440e7..a8f4a70c0742 100644 |
649 |
+--- a/arch/parisc/Kconfig |
650 |
++++ b/arch/parisc/Kconfig |
651 |
+@@ -22,6 +22,7 @@ config PARISC |
652 |
+ select GENERIC_SMP_IDLE_THREAD |
653 |
+ select GENERIC_STRNCPY_FROM_USER |
654 |
+ select SYSCTL_ARCH_UNALIGN_ALLOW |
655 |
++ select SYSCTL_EXCEPTION_TRACE |
656 |
+ select HAVE_MOD_ARCH_SPECIFIC |
657 |
+ select VIRT_TO_BUS |
658 |
+ select MODULES_USE_ELF_RELA |
659 |
+diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h |
660 |
+index 198a86feb574..86522ef09d52 100644 |
661 |
+--- a/arch/parisc/include/asm/processor.h |
662 |
++++ b/arch/parisc/include/asm/processor.h |
663 |
+@@ -55,6 +55,8 @@ |
664 |
+ #define STACK_TOP TASK_SIZE |
665 |
+ #define STACK_TOP_MAX DEFAULT_TASK_SIZE |
666 |
+ |
667 |
++#define STACK_SIZE_MAX (1 << 30) /* 1 GB */ |
668 |
++ |
669 |
+ #endif |
670 |
+ |
671 |
+ #ifndef __ASSEMBLY__ |
672 |
+diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S |
673 |
+index a63bb179f79a..838786011037 100644 |
674 |
+--- a/arch/parisc/kernel/syscall.S |
675 |
++++ b/arch/parisc/kernel/syscall.S |
676 |
+@@ -589,10 +589,13 @@ cas_nocontend: |
677 |
+ # endif |
678 |
+ /* ENABLE_LWS_DEBUG */ |
679 |
+ |
680 |
++ rsm PSW_SM_I, %r0 /* Disable interrupts */ |
681 |
++ /* COW breaks can cause contention on UP systems */ |
682 |
+ LDCW 0(%sr2,%r20), %r28 /* Try to acquire the lock */ |
683 |
+ cmpb,<>,n %r0, %r28, cas_action /* Did we get it? */ |
684 |
+ cas_wouldblock: |
685 |
+ ldo 2(%r0), %r28 /* 2nd case */ |
686 |
++ ssm PSW_SM_I, %r0 |
687 |
+ b lws_exit /* Contended... */ |
688 |
+ ldo -EAGAIN(%r0), %r21 /* Spin in userspace */ |
689 |
+ |
690 |
+@@ -619,15 +622,17 @@ cas_action: |
691 |
+ stw %r1, 4(%sr2,%r20) |
692 |
+ #endif |
693 |
+ /* The load and store could fail */ |
694 |
+-1: ldw 0(%sr3,%r26), %r28 |
695 |
++1: ldw,ma 0(%sr3,%r26), %r28 |
696 |
+ sub,<> %r28, %r25, %r0 |
697 |
+-2: stw %r24, 0(%sr3,%r26) |
698 |
++2: stw,ma %r24, 0(%sr3,%r26) |
699 |
+ /* Free lock */ |
700 |
+- stw %r20, 0(%sr2,%r20) |
701 |
++ stw,ma %r20, 0(%sr2,%r20) |
702 |
+ #if ENABLE_LWS_DEBUG |
703 |
+ /* Clear thread register indicator */ |
704 |
+ stw %r0, 4(%sr2,%r20) |
705 |
+ #endif |
706 |
++ /* Enable interrupts */ |
707 |
++ ssm PSW_SM_I, %r0 |
708 |
+ /* Return to userspace, set no error */ |
709 |
+ b lws_exit |
710 |
+ copy %r0, %r21 |
711 |
+@@ -639,6 +644,7 @@ cas_action: |
712 |
+ #if ENABLE_LWS_DEBUG |
713 |
+ stw %r0, 4(%sr2,%r20) |
714 |
+ #endif |
715 |
++ ssm PSW_SM_I, %r0 |
716 |
+ b lws_exit |
717 |
+ ldo -EFAULT(%r0),%r21 /* set errno */ |
718 |
+ nop |
719 |
+diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c |
720 |
+index 1cd1d0c83b6d..47ee620d15d2 100644 |
721 |
+--- a/arch/parisc/kernel/traps.c |
722 |
++++ b/arch/parisc/kernel/traps.c |
723 |
+@@ -25,6 +25,7 @@ |
724 |
+ #include <linux/interrupt.h> |
725 |
+ #include <linux/console.h> |
726 |
+ #include <linux/bug.h> |
727 |
++#include <linux/ratelimit.h> |
728 |
+ |
729 |
+ #include <asm/assembly.h> |
730 |
+ #include <asm/uaccess.h> |
731 |
+@@ -42,9 +43,6 @@ |
732 |
+ |
733 |
+ #include "../math-emu/math-emu.h" /* for handle_fpe() */ |
734 |
+ |
735 |
+-#define PRINT_USER_FAULTS /* (turn this on if you want user faults to be */ |
736 |
+- /* dumped to the console via printk) */ |
737 |
+- |
738 |
+ #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
739 |
+ DEFINE_SPINLOCK(pa_dbit_lock); |
740 |
+ #endif |
741 |
+@@ -160,6 +158,17 @@ void show_regs(struct pt_regs *regs) |
742 |
+ } |
743 |
+ } |
744 |
+ |
745 |
++static DEFINE_RATELIMIT_STATE(_hppa_rs, |
746 |
++ DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); |
747 |
++ |
748 |
++#define parisc_printk_ratelimited(critical, regs, fmt, ...) { \ |
749 |
++ if ((critical || show_unhandled_signals) && __ratelimit(&_hppa_rs)) { \ |
750 |
++ printk(fmt, ##__VA_ARGS__); \ |
751 |
++ show_regs(regs); \ |
752 |
++ } \ |
753 |
++} |
754 |
++ |
755 |
++ |
756 |
+ static void do_show_stack(struct unwind_frame_info *info) |
757 |
+ { |
758 |
+ int i = 1; |
759 |
+@@ -229,12 +238,10 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err) |
760 |
+ if (err == 0) |
761 |
+ return; /* STFU */ |
762 |
+ |
763 |
+- printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n", |
764 |
++ parisc_printk_ratelimited(1, regs, |
765 |
++ KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n", |
766 |
+ current->comm, task_pid_nr(current), str, err, regs->iaoq[0]); |
767 |
+-#ifdef PRINT_USER_FAULTS |
768 |
+- /* XXX for debugging only */ |
769 |
+- show_regs(regs); |
770 |
+-#endif |
771 |
++ |
772 |
+ return; |
773 |
+ } |
774 |
+ |
775 |
+@@ -321,14 +328,11 @@ static void handle_break(struct pt_regs *regs) |
776 |
+ (tt == BUG_TRAP_TYPE_NONE) ? 9 : 0); |
777 |
+ } |
778 |
+ |
779 |
+-#ifdef PRINT_USER_FAULTS |
780 |
+- if (unlikely(iir != GDB_BREAK_INSN)) { |
781 |
+- printk(KERN_DEBUG "break %d,%d: pid=%d command='%s'\n", |
782 |
++ if (unlikely(iir != GDB_BREAK_INSN)) |
783 |
++ parisc_printk_ratelimited(0, regs, |
784 |
++ KERN_DEBUG "break %d,%d: pid=%d command='%s'\n", |
785 |
+ iir & 31, (iir>>13) & ((1<<13)-1), |
786 |
+ task_pid_nr(current), current->comm); |
787 |
+- show_regs(regs); |
788 |
+- } |
789 |
+-#endif |
790 |
+ |
791 |
+ /* send standard GDB signal */ |
792 |
+ handle_gdb_break(regs, TRAP_BRKPT); |
793 |
+@@ -758,11 +762,9 @@ void notrace handle_interruption(int code, struct pt_regs *regs) |
794 |
+ |
795 |
+ default: |
796 |
+ if (user_mode(regs)) { |
797 |
+-#ifdef PRINT_USER_FAULTS |
798 |
+- printk(KERN_DEBUG "\nhandle_interruption() pid=%d command='%s'\n", |
799 |
+- task_pid_nr(current), current->comm); |
800 |
+- show_regs(regs); |
801 |
+-#endif |
802 |
++ parisc_printk_ratelimited(0, regs, KERN_DEBUG |
803 |
++ "handle_interruption() pid=%d command='%s'\n", |
804 |
++ task_pid_nr(current), current->comm); |
805 |
+ /* SIGBUS, for lack of a better one. */ |
806 |
+ si.si_signo = SIGBUS; |
807 |
+ si.si_code = BUS_OBJERR; |
808 |
+@@ -779,16 +781,10 @@ void notrace handle_interruption(int code, struct pt_regs *regs) |
809 |
+ |
810 |
+ if (user_mode(regs)) { |
811 |
+ if ((fault_space >> SPACEID_SHIFT) != (regs->sr[7] >> SPACEID_SHIFT)) { |
812 |
+-#ifdef PRINT_USER_FAULTS |
813 |
+- if (fault_space == 0) |
814 |
+- printk(KERN_DEBUG "User Fault on Kernel Space "); |
815 |
+- else |
816 |
+- printk(KERN_DEBUG "User Fault (long pointer) (fault %d) ", |
817 |
+- code); |
818 |
+- printk(KERN_CONT "pid=%d command='%s'\n", |
819 |
+- task_pid_nr(current), current->comm); |
820 |
+- show_regs(regs); |
821 |
+-#endif |
822 |
++ parisc_printk_ratelimited(0, regs, KERN_DEBUG |
823 |
++ "User fault %d on space 0x%08lx, pid=%d command='%s'\n", |
824 |
++ code, fault_space, |
825 |
++ task_pid_nr(current), current->comm); |
826 |
+ si.si_signo = SIGSEGV; |
827 |
+ si.si_errno = 0; |
828 |
+ si.si_code = SEGV_MAPERR; |
829 |
+diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c |
830 |
+index 9d08c71a967e..d72197f0ddb8 100644 |
831 |
+--- a/arch/parisc/mm/fault.c |
832 |
++++ b/arch/parisc/mm/fault.c |
833 |
+@@ -19,10 +19,6 @@ |
834 |
+ #include <asm/uaccess.h> |
835 |
+ #include <asm/traps.h> |
836 |
+ |
837 |
+-#define PRINT_USER_FAULTS /* (turn this on if you want user faults to be */ |
838 |
+- /* dumped to the console via printk) */ |
839 |
+- |
840 |
+- |
841 |
+ /* Various important other fields */ |
842 |
+ #define bit22set(x) (x & 0x00000200) |
843 |
+ #define bits23_25set(x) (x & 0x000001c0) |
844 |
+@@ -34,6 +30,8 @@ |
845 |
+ |
846 |
+ DEFINE_PER_CPU(struct exception_data, exception_data); |
847 |
+ |
848 |
++int show_unhandled_signals = 1; |
849 |
++ |
850 |
+ /* |
851 |
+ * parisc_acctyp(unsigned int inst) -- |
852 |
+ * Given a PA-RISC memory access instruction, determine if the |
853 |
+@@ -173,6 +171,32 @@ int fixup_exception(struct pt_regs *regs) |
854 |
+ return 0; |
855 |
+ } |
856 |
+ |
857 |
++/* |
858 |
++ * Print out info about fatal segfaults, if the show_unhandled_signals |
859 |
++ * sysctl is set: |
860 |
++ */ |
861 |
++static inline void |
862 |
++show_signal_msg(struct pt_regs *regs, unsigned long code, |
863 |
++ unsigned long address, struct task_struct *tsk, |
864 |
++ struct vm_area_struct *vma) |
865 |
++{ |
866 |
++ if (!unhandled_signal(tsk, SIGSEGV)) |
867 |
++ return; |
868 |
++ |
869 |
++ if (!printk_ratelimit()) |
870 |
++ return; |
871 |
++ |
872 |
++ pr_warn("\n"); |
873 |
++ pr_warn("do_page_fault() command='%s' type=%lu address=0x%08lx", |
874 |
++ tsk->comm, code, address); |
875 |
++ print_vma_addr(KERN_CONT " in ", regs->iaoq[0]); |
876 |
++ if (vma) |
877 |
++ pr_warn(" vm_start = 0x%08lx, vm_end = 0x%08lx\n", |
878 |
++ vma->vm_start, vma->vm_end); |
879 |
++ |
880 |
++ show_regs(regs); |
881 |
++} |
882 |
++ |
883 |
+ void do_page_fault(struct pt_regs *regs, unsigned long code, |
884 |
+ unsigned long address) |
885 |
+ { |
886 |
+@@ -270,16 +294,8 @@ bad_area: |
887 |
+ if (user_mode(regs)) { |
888 |
+ struct siginfo si; |
889 |
+ |
890 |
+-#ifdef PRINT_USER_FAULTS |
891 |
+- printk(KERN_DEBUG "\n"); |
892 |
+- printk(KERN_DEBUG "do_page_fault() pid=%d command='%s' type=%lu address=0x%08lx\n", |
893 |
+- task_pid_nr(tsk), tsk->comm, code, address); |
894 |
+- if (vma) { |
895 |
+- printk(KERN_DEBUG "vm_start = 0x%08lx, vm_end = 0x%08lx\n", |
896 |
+- vma->vm_start, vma->vm_end); |
897 |
+- } |
898 |
+- show_regs(regs); |
899 |
+-#endif |
900 |
++ show_signal_msg(regs, code, address, tsk, vma); |
901 |
++ |
902 |
+ switch (code) { |
903 |
+ case 15: /* Data TLB miss fault/Data page fault */ |
904 |
+ /* send SIGSEGV when outside of vma */ |
905 |
+diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile |
906 |
+index 0f4344e6fbca..8289e2b241a2 100644 |
907 |
+--- a/arch/powerpc/Makefile |
908 |
++++ b/arch/powerpc/Makefile |
909 |
+@@ -149,7 +149,9 @@ endif |
910 |
+ |
911 |
+ CFLAGS-$(CONFIG_TUNE_CELL) += $(call cc-option,-mtune=cell) |
912 |
+ |
913 |
+-KBUILD_CPPFLAGS += -Iarch/$(ARCH) |
914 |
++asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1) |
915 |
++ |
916 |
++KBUILD_CPPFLAGS += -Iarch/$(ARCH) $(asinstr) |
917 |
+ KBUILD_AFLAGS += -Iarch/$(ARCH) |
918 |
+ KBUILD_CFLAGS += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y) |
919 |
+ CPP = $(CC) -E $(KBUILD_CFLAGS) |
920 |
+diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h |
921 |
+index 6586a40a46ce..cded7c1278ef 100644 |
922 |
+--- a/arch/powerpc/include/asm/ppc_asm.h |
923 |
++++ b/arch/powerpc/include/asm/ppc_asm.h |
924 |
+@@ -318,11 +318,16 @@ n: |
925 |
+ addi reg,reg,(name - 0b)@l; |
926 |
+ |
927 |
+ #ifdef __powerpc64__ |
928 |
++#ifdef HAVE_AS_ATHIGH |
929 |
++#define __AS_ATHIGH high |
930 |
++#else |
931 |
++#define __AS_ATHIGH h |
932 |
++#endif |
933 |
+ #define LOAD_REG_IMMEDIATE(reg,expr) \ |
934 |
+ lis reg,(expr)@highest; \ |
935 |
+ ori reg,reg,(expr)@higher; \ |
936 |
+ rldicr reg,reg,32,31; \ |
937 |
+- oris reg,reg,(expr)@h; \ |
938 |
++ oris reg,reg,(expr)@__AS_ATHIGH; \ |
939 |
+ ori reg,reg,(expr)@l; |
940 |
+ |
941 |
+ #define LOAD_REG_ADDR(reg,name) \ |
942 |
+diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c |
943 |
+index 59d229a2a3e0..879b3aacac32 100644 |
944 |
+--- a/arch/powerpc/kernel/machine_kexec_64.c |
945 |
++++ b/arch/powerpc/kernel/machine_kexec_64.c |
946 |
+@@ -237,7 +237,7 @@ static void wake_offline_cpus(void) |
947 |
+ if (!cpu_online(cpu)) { |
948 |
+ printk(KERN_INFO "kexec: Waking offline cpu %d.\n", |
949 |
+ cpu); |
950 |
+- cpu_up(cpu); |
951 |
++ WARN_ON(cpu_up(cpu)); |
952 |
+ } |
953 |
+ } |
954 |
+ } |
955 |
+diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c |
956 |
+index b3dab20acf34..57d4bada19bd 100644 |
957 |
+--- a/arch/powerpc/kernel/time.c |
958 |
++++ b/arch/powerpc/kernel/time.c |
959 |
+@@ -805,9 +805,6 @@ static void __init clocksource_init(void) |
960 |
+ static int decrementer_set_next_event(unsigned long evt, |
961 |
+ struct clock_event_device *dev) |
962 |
+ { |
963 |
+- /* Don't adjust the decrementer if some irq work is pending */ |
964 |
+- if (test_irq_work_pending()) |
965 |
+- return 0; |
966 |
+ __get_cpu_var(decrementers_next_tb) = get_tb_or_rtc() + evt; |
967 |
+ set_dec(evt); |
968 |
+ |
969 |
+diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c |
970 |
+index 253fefe3d1a0..5b51079f3e3b 100644 |
971 |
+--- a/arch/powerpc/platforms/powernv/eeh-ioda.c |
972 |
++++ b/arch/powerpc/platforms/powernv/eeh-ioda.c |
973 |
+@@ -549,7 +549,8 @@ static int ioda_eeh_reset(struct eeh_pe *pe, int option) |
974 |
+ ret = ioda_eeh_phb_reset(hose, option); |
975 |
+ } else { |
976 |
+ bus = eeh_pe_bus_get(pe); |
977 |
+- if (pci_is_root_bus(bus)) |
978 |
++ if (pci_is_root_bus(bus) || |
979 |
++ pci_is_root_bus(bus->parent)) |
980 |
+ ret = ioda_eeh_root_reset(hose, option); |
981 |
+ else |
982 |
+ ret = ioda_eeh_bridge_reset(hose, bus->self, option); |
983 |
+diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c |
984 |
+index cf3c0089bef2..23223cd63e54 100644 |
985 |
+--- a/arch/s390/crypto/aes_s390.c |
986 |
++++ b/arch/s390/crypto/aes_s390.c |
987 |
+@@ -820,6 +820,9 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func, |
988 |
+ else |
989 |
+ memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE); |
990 |
+ spin_unlock(&ctrblk_lock); |
991 |
++ } else { |
992 |
++ if (!nbytes) |
993 |
++ memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE); |
994 |
+ } |
995 |
+ /* |
996 |
+ * final block may be < AES_BLOCK_SIZE, copy only nbytes |
997 |
+diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c |
998 |
+index 0a5aac8a9412..7acb77f7ef1a 100644 |
999 |
+--- a/arch/s390/crypto/des_s390.c |
1000 |
++++ b/arch/s390/crypto/des_s390.c |
1001 |
+@@ -429,6 +429,9 @@ static int ctr_desall_crypt(struct blkcipher_desc *desc, long func, |
1002 |
+ else |
1003 |
+ memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE); |
1004 |
+ spin_unlock(&ctrblk_lock); |
1005 |
++ } else { |
1006 |
++ if (!nbytes) |
1007 |
++ memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE); |
1008 |
+ } |
1009 |
+ /* final block may be < DES_BLOCK_SIZE, copy only nbytes */ |
1010 |
+ if (nbytes) { |
1011 |
+diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h |
1012 |
+index a8091216963b..68c05398bba9 100644 |
1013 |
+--- a/arch/x86/include/asm/hugetlb.h |
1014 |
++++ b/arch/x86/include/asm/hugetlb.h |
1015 |
+@@ -52,6 +52,7 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, |
1016 |
+ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, |
1017 |
+ unsigned long addr, pte_t *ptep) |
1018 |
+ { |
1019 |
++ ptep_clear_flush(vma, addr, ptep); |
1020 |
+ } |
1021 |
+ |
1022 |
+ static inline int huge_pte_none(pte_t pte) |
1023 |
+diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c |
1024 |
+index af1d14a9ebda..dcbbaa165bde 100644 |
1025 |
+--- a/arch/x86/kernel/ldt.c |
1026 |
++++ b/arch/x86/kernel/ldt.c |
1027 |
+@@ -20,6 +20,8 @@ |
1028 |
+ #include <asm/mmu_context.h> |
1029 |
+ #include <asm/syscalls.h> |
1030 |
+ |
1031 |
++int sysctl_ldt16 = 0; |
1032 |
++ |
1033 |
+ #ifdef CONFIG_SMP |
1034 |
+ static void flush_ldt(void *current_mm) |
1035 |
+ { |
1036 |
+@@ -234,7 +236,7 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode) |
1037 |
+ * IRET leaking the high bits of the kernel stack address. |
1038 |
+ */ |
1039 |
+ #ifdef CONFIG_X86_64 |
1040 |
+- if (!ldt_info.seg_32bit) { |
1041 |
++ if (!ldt_info.seg_32bit && !sysctl_ldt16) { |
1042 |
+ error = -EINVAL; |
1043 |
+ goto out_unlock; |
1044 |
+ } |
1045 |
+diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c |
1046 |
+index d6bfb876cfb0..f1d633a43f8e 100644 |
1047 |
+--- a/arch/x86/vdso/vdso32-setup.c |
1048 |
++++ b/arch/x86/vdso/vdso32-setup.c |
1049 |
+@@ -41,6 +41,7 @@ enum { |
1050 |
+ #ifdef CONFIG_X86_64 |
1051 |
+ #define vdso_enabled sysctl_vsyscall32 |
1052 |
+ #define arch_setup_additional_pages syscall32_setup_pages |
1053 |
++extern int sysctl_ldt16; |
1054 |
+ #endif |
1055 |
+ |
1056 |
+ /* |
1057 |
+@@ -380,6 +381,13 @@ static struct ctl_table abi_table2[] = { |
1058 |
+ .mode = 0644, |
1059 |
+ .proc_handler = proc_dointvec |
1060 |
+ }, |
1061 |
++ { |
1062 |
++ .procname = "ldt16", |
1063 |
++ .data = &sysctl_ldt16, |
1064 |
++ .maxlen = sizeof(int), |
1065 |
++ .mode = 0644, |
1066 |
++ .proc_handler = proc_dointvec |
1067 |
++ }, |
1068 |
+ {} |
1069 |
+ }; |
1070 |
+ |
1071 |
+diff --git a/crypto/crypto_wq.c b/crypto/crypto_wq.c |
1072 |
+index adad92a44ba2..2f1b8d12952a 100644 |
1073 |
+--- a/crypto/crypto_wq.c |
1074 |
++++ b/crypto/crypto_wq.c |
1075 |
+@@ -33,7 +33,7 @@ static void __exit crypto_wq_exit(void) |
1076 |
+ destroy_workqueue(kcrypto_wq); |
1077 |
+ } |
1078 |
+ |
1079 |
+-module_init(crypto_wq_init); |
1080 |
++subsys_initcall(crypto_wq_init); |
1081 |
+ module_exit(crypto_wq_exit); |
1082 |
+ |
1083 |
+ MODULE_LICENSE("GPL"); |
1084 |
+diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig |
1085 |
+index 4770de5707b9..561bf25ac9f9 100644 |
1086 |
+--- a/drivers/acpi/Kconfig |
1087 |
++++ b/drivers/acpi/Kconfig |
1088 |
+@@ -56,6 +56,23 @@ config ACPI_PROCFS |
1089 |
+ |
1090 |
+ Say N to delete /proc/acpi/ files that have moved to /sys/ |
1091 |
+ |
1092 |
++config ACPI_PROCFS_POWER |
1093 |
++ bool "Deprecated power /proc/acpi directories" |
1094 |
++ depends on PROC_FS |
1095 |
++ help |
1096 |
++ For backwards compatibility, this option allows |
1097 |
++ deprecated power /proc/acpi/ directories to exist, even when |
1098 |
++ they have been replaced by functions in /sys. |
1099 |
++ The deprecated directories (and their replacements) include: |
1100 |
++ /proc/acpi/battery/* (/sys/class/power_supply/*) |
1101 |
++ /proc/acpi/ac_adapter/* (sys/class/power_supply/*) |
1102 |
++ This option has no effect on /proc/acpi/ directories |
1103 |
++ and functions, which do not yet exist in /sys |
1104 |
++ This option, together with the proc directories, will be |
1105 |
++ deleted in 2.6.39. |
1106 |
++ |
1107 |
++ Say N to delete power /proc/acpi/ directories that have moved to /sys/ |
1108 |
++ |
1109 |
+ config ACPI_EC_DEBUGFS |
1110 |
+ tristate "EC read/write access through /sys/kernel/debug/ec" |
1111 |
+ default n |
1112 |
+diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile |
1113 |
+index 0331f91d56e6..bce34afadcd0 100644 |
1114 |
+--- a/drivers/acpi/Makefile |
1115 |
++++ b/drivers/acpi/Makefile |
1116 |
+@@ -47,6 +47,7 @@ acpi-y += sysfs.o |
1117 |
+ acpi-$(CONFIG_X86) += acpi_cmos_rtc.o |
1118 |
+ acpi-$(CONFIG_DEBUG_FS) += debugfs.o |
1119 |
+ acpi-$(CONFIG_ACPI_NUMA) += numa.o |
1120 |
++acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o |
1121 |
+ ifdef CONFIG_ACPI_VIDEO |
1122 |
+ acpi-y += video_detect.o |
1123 |
+ endif |
1124 |
+diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c |
1125 |
+index 6f190bc2b8b7..7c1f8452918a 100644 |
1126 |
+--- a/drivers/acpi/ac.c |
1127 |
++++ b/drivers/acpi/ac.c |
1128 |
+@@ -51,11 +51,39 @@ MODULE_AUTHOR("Paul Diefenbaugh"); |
1129 |
+ MODULE_DESCRIPTION("ACPI AC Adapter Driver"); |
1130 |
+ MODULE_LICENSE("GPL"); |
1131 |
+ |
1132 |
++static int acpi_ac_add(struct acpi_device *device); |
1133 |
++static int acpi_ac_remove(struct acpi_device *device); |
1134 |
++static void acpi_ac_notify(struct acpi_device *device, u32 event); |
1135 |
++ |
1136 |
++static const struct acpi_device_id ac_device_ids[] = { |
1137 |
++ {"ACPI0003", 0}, |
1138 |
++ {"", 0}, |
1139 |
++}; |
1140 |
++MODULE_DEVICE_TABLE(acpi, ac_device_ids); |
1141 |
++ |
1142 |
++#ifdef CONFIG_PM_SLEEP |
1143 |
++static int acpi_ac_resume(struct device *dev); |
1144 |
++#endif |
1145 |
++static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); |
1146 |
++ |
1147 |
+ static int ac_sleep_before_get_state_ms; |
1148 |
+ |
1149 |
++static struct acpi_driver acpi_ac_driver = { |
1150 |
++ .name = "ac", |
1151 |
++ .class = ACPI_AC_CLASS, |
1152 |
++ .ids = ac_device_ids, |
1153 |
++ .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, |
1154 |
++ .ops = { |
1155 |
++ .add = acpi_ac_add, |
1156 |
++ .remove = acpi_ac_remove, |
1157 |
++ .notify = acpi_ac_notify, |
1158 |
++ }, |
1159 |
++ .drv.pm = &acpi_ac_pm, |
1160 |
++}; |
1161 |
++ |
1162 |
+ struct acpi_ac { |
1163 |
+ struct power_supply charger; |
1164 |
+- struct platform_device *pdev; |
1165 |
++ struct acpi_device * device; |
1166 |
+ unsigned long long state; |
1167 |
+ }; |
1168 |
+ |
1169 |
+@@ -67,10 +95,12 @@ struct acpi_ac { |
1170 |
+ |
1171 |
+ static int acpi_ac_get_state(struct acpi_ac *ac) |
1172 |
+ { |
1173 |
+- acpi_status status; |
1174 |
+- acpi_handle handle = ACPI_HANDLE(&ac->pdev->dev); |
1175 |
++ acpi_status status = AE_OK; |
1176 |
++ |
1177 |
++ if (!ac) |
1178 |
++ return -EINVAL; |
1179 |
+ |
1180 |
+- status = acpi_evaluate_integer(handle, "_PSR", NULL, |
1181 |
++ status = acpi_evaluate_integer(ac->device->handle, "_PSR", NULL, |
1182 |
+ &ac->state); |
1183 |
+ if (ACPI_FAILURE(status)) { |
1184 |
+ ACPI_EXCEPTION((AE_INFO, status, |
1185 |
+@@ -115,10 +145,9 @@ static enum power_supply_property ac_props[] = { |
1186 |
+ Driver Model |
1187 |
+ -------------------------------------------------------------------------- */ |
1188 |
+ |
1189 |
+-static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data) |
1190 |
++static void acpi_ac_notify(struct acpi_device *device, u32 event) |
1191 |
+ { |
1192 |
+- struct acpi_ac *ac = data; |
1193 |
+- struct acpi_device *adev; |
1194 |
++ struct acpi_ac *ac = acpi_driver_data(device); |
1195 |
+ |
1196 |
+ if (!ac) |
1197 |
+ return; |
1198 |
+@@ -141,11 +170,10 @@ static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data) |
1199 |
+ msleep(ac_sleep_before_get_state_ms); |
1200 |
+ |
1201 |
+ acpi_ac_get_state(ac); |
1202 |
+- adev = ACPI_COMPANION(&ac->pdev->dev); |
1203 |
+- acpi_bus_generate_netlink_event(adev->pnp.device_class, |
1204 |
+- dev_name(&ac->pdev->dev), |
1205 |
+- event, (u32) ac->state); |
1206 |
+- acpi_notifier_call_chain(adev, event, (u32) ac->state); |
1207 |
++ acpi_bus_generate_netlink_event(device->pnp.device_class, |
1208 |
++ dev_name(&device->dev), event, |
1209 |
++ (u32) ac->state); |
1210 |
++ acpi_notifier_call_chain(device, event, (u32) ac->state); |
1211 |
+ kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); |
1212 |
+ } |
1213 |
+ |
1214 |
+@@ -170,49 +198,39 @@ static struct dmi_system_id ac_dmi_table[] = { |
1215 |
+ {}, |
1216 |
+ }; |
1217 |
+ |
1218 |
+-static int acpi_ac_probe(struct platform_device *pdev) |
1219 |
++static int acpi_ac_add(struct acpi_device *device) |
1220 |
+ { |
1221 |
+ int result = 0; |
1222 |
+ struct acpi_ac *ac = NULL; |
1223 |
+- struct acpi_device *adev; |
1224 |
+ |
1225 |
+- if (!pdev) |
1226 |
+- return -EINVAL; |
1227 |
+ |
1228 |
+- adev = ACPI_COMPANION(&pdev->dev); |
1229 |
+- if (!adev) |
1230 |
+- return -ENODEV; |
1231 |
++ if (!device) |
1232 |
++ return -EINVAL; |
1233 |
+ |
1234 |
+ ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL); |
1235 |
+ if (!ac) |
1236 |
+ return -ENOMEM; |
1237 |
+ |
1238 |
+- strcpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME); |
1239 |
+- strcpy(acpi_device_class(adev), ACPI_AC_CLASS); |
1240 |
+- ac->pdev = pdev; |
1241 |
+- platform_set_drvdata(pdev, ac); |
1242 |
++ ac->device = device; |
1243 |
++ strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME); |
1244 |
++ strcpy(acpi_device_class(device), ACPI_AC_CLASS); |
1245 |
++ device->driver_data = ac; |
1246 |
+ |
1247 |
+ result = acpi_ac_get_state(ac); |
1248 |
+ if (result) |
1249 |
+ goto end; |
1250 |
+ |
1251 |
+- ac->charger.name = acpi_device_bid(adev); |
1252 |
++ ac->charger.name = acpi_device_bid(device); |
1253 |
+ ac->charger.type = POWER_SUPPLY_TYPE_MAINS; |
1254 |
+ ac->charger.properties = ac_props; |
1255 |
+ ac->charger.num_properties = ARRAY_SIZE(ac_props); |
1256 |
+ ac->charger.get_property = get_ac_property; |
1257 |
+- result = power_supply_register(&pdev->dev, &ac->charger); |
1258 |
++ result = power_supply_register(&ac->device->dev, &ac->charger); |
1259 |
+ if (result) |
1260 |
+ goto end; |
1261 |
+ |
1262 |
+- result = acpi_install_notify_handler(ACPI_HANDLE(&pdev->dev), |
1263 |
+- ACPI_ALL_NOTIFY, acpi_ac_notify_handler, ac); |
1264 |
+- if (result) { |
1265 |
+- power_supply_unregister(&ac->charger); |
1266 |
+- goto end; |
1267 |
+- } |
1268 |
+ printk(KERN_INFO PREFIX "%s [%s] (%s)\n", |
1269 |
+- acpi_device_name(adev), acpi_device_bid(adev), |
1270 |
++ acpi_device_name(device), acpi_device_bid(device), |
1271 |
+ ac->state ? "on-line" : "off-line"); |
1272 |
+ |
1273 |
+ end: |
1274 |
+@@ -232,7 +250,7 @@ static int acpi_ac_resume(struct device *dev) |
1275 |
+ if (!dev) |
1276 |
+ return -EINVAL; |
1277 |
+ |
1278 |
+- ac = platform_get_drvdata(to_platform_device(dev)); |
1279 |
++ ac = acpi_driver_data(to_acpi_device(dev)); |
1280 |
+ if (!ac) |
1281 |
+ return -EINVAL; |
1282 |
+ |
1283 |
+@@ -246,19 +264,17 @@ static int acpi_ac_resume(struct device *dev) |
1284 |
+ #else |
1285 |
+ #define acpi_ac_resume NULL |
1286 |
+ #endif |
1287 |
+-static SIMPLE_DEV_PM_OPS(acpi_ac_pm_ops, NULL, acpi_ac_resume); |
1288 |
+ |
1289 |
+-static int acpi_ac_remove(struct platform_device *pdev) |
1290 |
++static int acpi_ac_remove(struct acpi_device *device) |
1291 |
+ { |
1292 |
+- struct acpi_ac *ac; |
1293 |
++ struct acpi_ac *ac = NULL; |
1294 |
++ |
1295 |
+ |
1296 |
+- if (!pdev) |
1297 |
++ if (!device || !acpi_driver_data(device)) |
1298 |
+ return -EINVAL; |
1299 |
+ |
1300 |
+- acpi_remove_notify_handler(ACPI_HANDLE(&pdev->dev), |
1301 |
+- ACPI_ALL_NOTIFY, acpi_ac_notify_handler); |
1302 |
++ ac = acpi_driver_data(device); |
1303 |
+ |
1304 |
+- ac = platform_get_drvdata(pdev); |
1305 |
+ if (ac->charger.dev) |
1306 |
+ power_supply_unregister(&ac->charger); |
1307 |
+ |
1308 |
+@@ -267,23 +283,6 @@ static int acpi_ac_remove(struct platform_device *pdev) |
1309 |
+ return 0; |
1310 |
+ } |
1311 |
+ |
1312 |
+-static const struct acpi_device_id acpi_ac_match[] = { |
1313 |
+- { "ACPI0003", 0 }, |
1314 |
+- { } |
1315 |
+-}; |
1316 |
+-MODULE_DEVICE_TABLE(acpi, acpi_ac_match); |
1317 |
+- |
1318 |
+-static struct platform_driver acpi_ac_driver = { |
1319 |
+- .probe = acpi_ac_probe, |
1320 |
+- .remove = acpi_ac_remove, |
1321 |
+- .driver = { |
1322 |
+- .name = "acpi-ac", |
1323 |
+- .owner = THIS_MODULE, |
1324 |
+- .pm = &acpi_ac_pm_ops, |
1325 |
+- .acpi_match_table = ACPI_PTR(acpi_ac_match), |
1326 |
+- }, |
1327 |
+-}; |
1328 |
+- |
1329 |
+ static int __init acpi_ac_init(void) |
1330 |
+ { |
1331 |
+ int result; |
1332 |
+@@ -291,7 +290,7 @@ static int __init acpi_ac_init(void) |
1333 |
+ if (acpi_disabled) |
1334 |
+ return -ENODEV; |
1335 |
+ |
1336 |
+- result = platform_driver_register(&acpi_ac_driver); |
1337 |
++ result = acpi_bus_register_driver(&acpi_ac_driver); |
1338 |
+ if (result < 0) |
1339 |
+ return -ENODEV; |
1340 |
+ |
1341 |
+@@ -300,7 +299,7 @@ static int __init acpi_ac_init(void) |
1342 |
+ |
1343 |
+ static void __exit acpi_ac_exit(void) |
1344 |
+ { |
1345 |
+- platform_driver_unregister(&acpi_ac_driver); |
1346 |
++ acpi_bus_unregister_driver(&acpi_ac_driver); |
1347 |
+ } |
1348 |
+ module_init(acpi_ac_init); |
1349 |
+ module_exit(acpi_ac_exit); |
1350 |
+diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c |
1351 |
+index dbfe49e5fd63..1d4950388fa1 100644 |
1352 |
+--- a/drivers/acpi/acpi_platform.c |
1353 |
++++ b/drivers/acpi/acpi_platform.c |
1354 |
+@@ -29,7 +29,6 @@ ACPI_MODULE_NAME("platform"); |
1355 |
+ static const struct acpi_device_id acpi_platform_device_ids[] = { |
1356 |
+ |
1357 |
+ { "PNP0D40" }, |
1358 |
+- { "ACPI0003" }, |
1359 |
+ { "VPC2004" }, |
1360 |
+ { "BCM4752" }, |
1361 |
+ |
1362 |
+diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c |
1363 |
+index b06f5f55ada9..52c81c49cc7d 100644 |
1364 |
+--- a/drivers/acpi/acpi_processor.c |
1365 |
++++ b/drivers/acpi/acpi_processor.c |
1366 |
+@@ -405,7 +405,6 @@ static int acpi_processor_add(struct acpi_device *device, |
1367 |
+ goto err; |
1368 |
+ |
1369 |
+ pr->dev = dev; |
1370 |
+- dev->offline = pr->flags.need_hotplug_init; |
1371 |
+ |
1372 |
+ /* Trigger the processor driver's .probe() if present. */ |
1373 |
+ if (device_attach(dev) >= 0) |
1374 |
+diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h |
1375 |
+index 4ed1aa384df2..514f34033f96 100644 |
1376 |
+--- a/drivers/acpi/acpica/acglobal.h |
1377 |
++++ b/drivers/acpi/acpica/acglobal.h |
1378 |
+@@ -132,9 +132,9 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_do_not_use_xsdt, FALSE); |
1379 |
+ * address. Although ACPICA adheres to the ACPI specification which |
1380 |
+ * requires the use of the corresponding 64-bit address if it is non-zero, |
1381 |
+ * some machines have been found to have a corrupted non-zero 64-bit |
1382 |
+- * address. Default is FALSE, do not favor the 32-bit addresses. |
1383 |
++ * address. Default is TRUE, favor the 32-bit addresses. |
1384 |
+ */ |
1385 |
+-u8 ACPI_INIT_GLOBAL(acpi_gbl_use32_bit_fadt_addresses, FALSE); |
1386 |
++u8 ACPI_INIT_GLOBAL(acpi_gbl_use32_bit_fadt_addresses, TRUE); |
1387 |
+ |
1388 |
+ /* |
1389 |
+ * Optionally truncate I/O addresses to 16 bits. Provides compatibility |
1390 |
+diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c |
1391 |
+index 6412d3c301cb..1bc879ec83d4 100644 |
1392 |
+--- a/drivers/acpi/acpica/tbutils.c |
1393 |
++++ b/drivers/acpi/acpica/tbutils.c |
1394 |
+@@ -461,6 +461,7 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) |
1395 |
+ u32 table_count; |
1396 |
+ struct acpi_table_header *table; |
1397 |
+ acpi_physical_address address; |
1398 |
++ acpi_physical_address rsdt_address; |
1399 |
+ u32 length; |
1400 |
+ u8 *table_entry; |
1401 |
+ acpi_status status; |
1402 |
+@@ -488,11 +489,14 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) |
1403 |
+ * as per the ACPI specification. |
1404 |
+ */ |
1405 |
+ address = (acpi_physical_address) rsdp->xsdt_physical_address; |
1406 |
++ rsdt_address = |
1407 |
++ (acpi_physical_address) rsdp->rsdt_physical_address; |
1408 |
+ table_entry_size = ACPI_XSDT_ENTRY_SIZE; |
1409 |
+ } else { |
1410 |
+ /* Root table is an RSDT (32-bit physical addresses) */ |
1411 |
+ |
1412 |
+ address = (acpi_physical_address) rsdp->rsdt_physical_address; |
1413 |
++ rsdt_address = address; |
1414 |
+ table_entry_size = ACPI_RSDT_ENTRY_SIZE; |
1415 |
+ } |
1416 |
+ |
1417 |
+@@ -515,8 +519,7 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) |
1418 |
+ |
1419 |
+ /* Fall back to the RSDT */ |
1420 |
+ |
1421 |
+- address = |
1422 |
+- (acpi_physical_address) rsdp->rsdt_physical_address; |
1423 |
++ address = rsdt_address; |
1424 |
+ table_entry_size = ACPI_RSDT_ENTRY_SIZE; |
1425 |
+ } |
1426 |
+ } |
1427 |
+diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c |
1428 |
+index 797a6938d051..efa71d66e8b0 100644 |
1429 |
+--- a/drivers/acpi/battery.c |
1430 |
++++ b/drivers/acpi/battery.c |
1431 |
+@@ -36,6 +36,12 @@ |
1432 |
+ #include <linux/suspend.h> |
1433 |
+ #include <asm/unaligned.h> |
1434 |
+ |
1435 |
++#ifdef CONFIG_ACPI_PROCFS_POWER |
1436 |
++#include <linux/proc_fs.h> |
1437 |
++#include <linux/seq_file.h> |
1438 |
++#include <asm/uaccess.h> |
1439 |
++#endif |
1440 |
++ |
1441 |
+ #include <linux/acpi.h> |
1442 |
+ #include <linux/power_supply.h> |
1443 |
+ |
1444 |
+@@ -66,6 +72,19 @@ static unsigned int cache_time = 1000; |
1445 |
+ module_param(cache_time, uint, 0644); |
1446 |
+ MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); |
1447 |
+ |
1448 |
++#ifdef CONFIG_ACPI_PROCFS_POWER |
1449 |
++extern struct proc_dir_entry *acpi_lock_battery_dir(void); |
1450 |
++extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); |
1451 |
++ |
1452 |
++enum acpi_battery_files { |
1453 |
++ info_tag = 0, |
1454 |
++ state_tag, |
1455 |
++ alarm_tag, |
1456 |
++ ACPI_BATTERY_NUMFILES, |
1457 |
++}; |
1458 |
++ |
1459 |
++#endif |
1460 |
++ |
1461 |
+ static const struct acpi_device_id battery_device_ids[] = { |
1462 |
+ {"PNP0C0A", 0}, |
1463 |
+ {"", 0}, |
1464 |
+@@ -301,6 +320,14 @@ static enum power_supply_property energy_battery_props[] = { |
1465 |
+ POWER_SUPPLY_PROP_SERIAL_NUMBER, |
1466 |
+ }; |
1467 |
+ |
1468 |
++#ifdef CONFIG_ACPI_PROCFS_POWER |
1469 |
++inline char *acpi_battery_units(struct acpi_battery *battery) |
1470 |
++{ |
1471 |
++ return (battery->power_unit == ACPI_BATTERY_POWER_UNIT_MA) ? |
1472 |
++ "mA" : "mW"; |
1473 |
++} |
1474 |
++#endif |
1475 |
++ |
1476 |
+ /* -------------------------------------------------------------------------- |
1477 |
+ Battery Management |
1478 |
+ -------------------------------------------------------------------------- */ |
1479 |
+@@ -719,6 +746,279 @@ static void acpi_battery_refresh(struct acpi_battery *battery) |
1480 |
+ } |
1481 |
+ |
1482 |
+ /* -------------------------------------------------------------------------- |
1483 |
++ FS Interface (/proc) |
1484 |
++ -------------------------------------------------------------------------- */ |
1485 |
++ |
1486 |
++#ifdef CONFIG_ACPI_PROCFS_POWER |
1487 |
++static struct proc_dir_entry *acpi_battery_dir; |
1488 |
++ |
1489 |
++static int acpi_battery_print_info(struct seq_file *seq, int result) |
1490 |
++{ |
1491 |
++ struct acpi_battery *battery = seq->private; |
1492 |
++ |
1493 |
++ if (result) |
1494 |
++ goto end; |
1495 |
++ |
1496 |
++ seq_printf(seq, "present: %s\n", |
1497 |
++ acpi_battery_present(battery) ? "yes" : "no"); |
1498 |
++ if (!acpi_battery_present(battery)) |
1499 |
++ goto end; |
1500 |
++ if (battery->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN) |
1501 |
++ seq_printf(seq, "design capacity: unknown\n"); |
1502 |
++ else |
1503 |
++ seq_printf(seq, "design capacity: %d %sh\n", |
1504 |
++ battery->design_capacity, |
1505 |
++ acpi_battery_units(battery)); |
1506 |
++ |
1507 |
++ if (battery->full_charge_capacity == ACPI_BATTERY_VALUE_UNKNOWN) |
1508 |
++ seq_printf(seq, "last full capacity: unknown\n"); |
1509 |
++ else |
1510 |
++ seq_printf(seq, "last full capacity: %d %sh\n", |
1511 |
++ battery->full_charge_capacity, |
1512 |
++ acpi_battery_units(battery)); |
1513 |
++ |
1514 |
++ seq_printf(seq, "battery technology: %srechargeable\n", |
1515 |
++ (!battery->technology)?"non-":""); |
1516 |
++ |
1517 |
++ if (battery->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN) |
1518 |
++ seq_printf(seq, "design voltage: unknown\n"); |
1519 |
++ else |
1520 |
++ seq_printf(seq, "design voltage: %d mV\n", |
1521 |
++ battery->design_voltage); |
1522 |
++ seq_printf(seq, "design capacity warning: %d %sh\n", |
1523 |
++ battery->design_capacity_warning, |
1524 |
++ acpi_battery_units(battery)); |
1525 |
++ seq_printf(seq, "design capacity low: %d %sh\n", |
1526 |
++ battery->design_capacity_low, |
1527 |
++ acpi_battery_units(battery)); |
1528 |
++ seq_printf(seq, "cycle count: %i\n", battery->cycle_count); |
1529 |
++ seq_printf(seq, "capacity granularity 1: %d %sh\n", |
1530 |
++ battery->capacity_granularity_1, |
1531 |
++ acpi_battery_units(battery)); |
1532 |
++ seq_printf(seq, "capacity granularity 2: %d %sh\n", |
1533 |
++ battery->capacity_granularity_2, |
1534 |
++ acpi_battery_units(battery)); |
1535 |
++ seq_printf(seq, "model number: %s\n", battery->model_number); |
1536 |
++ seq_printf(seq, "serial number: %s\n", battery->serial_number); |
1537 |
++ seq_printf(seq, "battery type: %s\n", battery->type); |
1538 |
++ seq_printf(seq, "OEM info: %s\n", battery->oem_info); |
1539 |
++ end: |
1540 |
++ if (result) |
1541 |
++ seq_printf(seq, "ERROR: Unable to read battery info\n"); |
1542 |
++ return result; |
1543 |
++} |
1544 |
++ |
1545 |
++static int acpi_battery_print_state(struct seq_file *seq, int result) |
1546 |
++{ |
1547 |
++ struct acpi_battery *battery = seq->private; |
1548 |
++ |
1549 |
++ if (result) |
1550 |
++ goto end; |
1551 |
++ |
1552 |
++ seq_printf(seq, "present: %s\n", |
1553 |
++ acpi_battery_present(battery) ? "yes" : "no"); |
1554 |
++ if (!acpi_battery_present(battery)) |
1555 |
++ goto end; |
1556 |
++ |
1557 |
++ seq_printf(seq, "capacity state: %s\n", |
1558 |
++ (battery->state & 0x04) ? "critical" : "ok"); |
1559 |
++ if ((battery->state & 0x01) && (battery->state & 0x02)) |
1560 |
++ seq_printf(seq, |
1561 |
++ "charging state: charging/discharging\n"); |
1562 |
++ else if (battery->state & 0x01) |
1563 |
++ seq_printf(seq, "charging state: discharging\n"); |
1564 |
++ else if (battery->state & 0x02) |
1565 |
++ seq_printf(seq, "charging state: charging\n"); |
1566 |
++ else |
1567 |
++ seq_printf(seq, "charging state: charged\n"); |
1568 |
++ |
1569 |
++ if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN) |
1570 |
++ seq_printf(seq, "present rate: unknown\n"); |
1571 |
++ else |
1572 |
++ seq_printf(seq, "present rate: %d %s\n", |
1573 |
++ battery->rate_now, acpi_battery_units(battery)); |
1574 |
++ |
1575 |
++ if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN) |
1576 |
++ seq_printf(seq, "remaining capacity: unknown\n"); |
1577 |
++ else |
1578 |
++ seq_printf(seq, "remaining capacity: %d %sh\n", |
1579 |
++ battery->capacity_now, acpi_battery_units(battery)); |
1580 |
++ if (battery->voltage_now == ACPI_BATTERY_VALUE_UNKNOWN) |
1581 |
++ seq_printf(seq, "present voltage: unknown\n"); |
1582 |
++ else |
1583 |
++ seq_printf(seq, "present voltage: %d mV\n", |
1584 |
++ battery->voltage_now); |
1585 |
++ end: |
1586 |
++ if (result) |
1587 |
++ seq_printf(seq, "ERROR: Unable to read battery state\n"); |
1588 |
++ |
1589 |
++ return result; |
1590 |
++} |
1591 |
++ |
1592 |
++static int acpi_battery_print_alarm(struct seq_file *seq, int result) |
1593 |
++{ |
1594 |
++ struct acpi_battery *battery = seq->private; |
1595 |
++ |
1596 |
++ if (result) |
1597 |
++ goto end; |
1598 |
++ |
1599 |
++ if (!acpi_battery_present(battery)) { |
1600 |
++ seq_printf(seq, "present: no\n"); |
1601 |
++ goto end; |
1602 |
++ } |
1603 |
++ seq_printf(seq, "alarm: "); |
1604 |
++ if (!battery->alarm) |
1605 |
++ seq_printf(seq, "unsupported\n"); |
1606 |
++ else |
1607 |
++ seq_printf(seq, "%u %sh\n", battery->alarm, |
1608 |
++ acpi_battery_units(battery)); |
1609 |
++ end: |
1610 |
++ if (result) |
1611 |
++ seq_printf(seq, "ERROR: Unable to read battery alarm\n"); |
1612 |
++ return result; |
1613 |
++} |
1614 |
++ |
1615 |
++static ssize_t acpi_battery_write_alarm(struct file *file, |
1616 |
++ const char __user * buffer, |
1617 |
++ size_t count, loff_t * ppos) |
1618 |
++{ |
1619 |
++ int result = 0; |
1620 |
++ char alarm_string[12] = { '\0' }; |
1621 |
++ struct seq_file *m = file->private_data; |
1622 |
++ struct acpi_battery *battery = m->private; |
1623 |
++ |
1624 |
++ if (!battery || (count > sizeof(alarm_string) - 1)) |
1625 |
++ return -EINVAL; |
1626 |
++ if (!acpi_battery_present(battery)) { |
1627 |
++ result = -ENODEV; |
1628 |
++ goto end; |
1629 |
++ } |
1630 |
++ if (copy_from_user(alarm_string, buffer, count)) { |
1631 |
++ result = -EFAULT; |
1632 |
++ goto end; |
1633 |
++ } |
1634 |
++ alarm_string[count] = '\0'; |
1635 |
++ battery->alarm = simple_strtol(alarm_string, NULL, 0); |
1636 |
++ result = acpi_battery_set_alarm(battery); |
1637 |
++ end: |
1638 |
++ if (!result) |
1639 |
++ return count; |
1640 |
++ return result; |
1641 |
++} |
1642 |
++ |
1643 |
++typedef int(*print_func)(struct seq_file *seq, int result); |
1644 |
++ |
1645 |
++static print_func acpi_print_funcs[ACPI_BATTERY_NUMFILES] = { |
1646 |
++ acpi_battery_print_info, |
1647 |
++ acpi_battery_print_state, |
1648 |
++ acpi_battery_print_alarm, |
1649 |
++}; |
1650 |
++ |
1651 |
++static int acpi_battery_read(int fid, struct seq_file *seq) |
1652 |
++{ |
1653 |
++ struct acpi_battery *battery = seq->private; |
1654 |
++ int result = acpi_battery_update(battery); |
1655 |
++ return acpi_print_funcs[fid](seq, result); |
1656 |
++} |
1657 |
++ |
1658 |
++#define DECLARE_FILE_FUNCTIONS(_name) \ |
1659 |
++static int acpi_battery_read_##_name(struct seq_file *seq, void *offset) \ |
1660 |
++{ \ |
1661 |
++ return acpi_battery_read(_name##_tag, seq); \ |
1662 |
++} \ |
1663 |
++static int acpi_battery_##_name##_open_fs(struct inode *inode, struct file *file) \ |
1664 |
++{ \ |
1665 |
++ return single_open(file, acpi_battery_read_##_name, PDE_DATA(inode)); \ |
1666 |
++} |
1667 |
++ |
1668 |
++DECLARE_FILE_FUNCTIONS(info); |
1669 |
++DECLARE_FILE_FUNCTIONS(state); |
1670 |
++DECLARE_FILE_FUNCTIONS(alarm); |
1671 |
++ |
1672 |
++#undef DECLARE_FILE_FUNCTIONS |
1673 |
++ |
1674 |
++#define FILE_DESCRIPTION_RO(_name) \ |
1675 |
++ { \ |
1676 |
++ .name = __stringify(_name), \ |
1677 |
++ .mode = S_IRUGO, \ |
1678 |
++ .ops = { \ |
1679 |
++ .open = acpi_battery_##_name##_open_fs, \ |
1680 |
++ .read = seq_read, \ |
1681 |
++ .llseek = seq_lseek, \ |
1682 |
++ .release = single_release, \ |
1683 |
++ .owner = THIS_MODULE, \ |
1684 |
++ }, \ |
1685 |
++ } |
1686 |
++ |
1687 |
++#define FILE_DESCRIPTION_RW(_name) \ |
1688 |
++ { \ |
1689 |
++ .name = __stringify(_name), \ |
1690 |
++ .mode = S_IFREG | S_IRUGO | S_IWUSR, \ |
1691 |
++ .ops = { \ |
1692 |
++ .open = acpi_battery_##_name##_open_fs, \ |
1693 |
++ .read = seq_read, \ |
1694 |
++ .llseek = seq_lseek, \ |
1695 |
++ .write = acpi_battery_write_##_name, \ |
1696 |
++ .release = single_release, \ |
1697 |
++ .owner = THIS_MODULE, \ |
1698 |
++ }, \ |
1699 |
++ } |
1700 |
++ |
1701 |
++static const struct battery_file { |
1702 |
++ struct file_operations ops; |
1703 |
++ umode_t mode; |
1704 |
++ const char *name; |
1705 |
++} acpi_battery_file[] = { |
1706 |
++ FILE_DESCRIPTION_RO(info), |
1707 |
++ FILE_DESCRIPTION_RO(state), |
1708 |
++ FILE_DESCRIPTION_RW(alarm), |
1709 |
++}; |
1710 |
++ |
1711 |
++#undef FILE_DESCRIPTION_RO |
1712 |
++#undef FILE_DESCRIPTION_RW |
1713 |
++ |
1714 |
++static int acpi_battery_add_fs(struct acpi_device *device) |
1715 |
++{ |
1716 |
++ struct proc_dir_entry *entry = NULL; |
1717 |
++ int i; |
1718 |
++ |
1719 |
++ printk(KERN_WARNING PREFIX "Deprecated procfs I/F for battery is loaded," |
1720 |
++ " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n"); |
1721 |
++ if (!acpi_device_dir(device)) { |
1722 |
++ acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), |
1723 |
++ acpi_battery_dir); |
1724 |
++ if (!acpi_device_dir(device)) |
1725 |
++ return -ENODEV; |
1726 |
++ } |
1727 |
++ |
1728 |
++ for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) { |
1729 |
++ entry = proc_create_data(acpi_battery_file[i].name, |
1730 |
++ acpi_battery_file[i].mode, |
1731 |
++ acpi_device_dir(device), |
1732 |
++ &acpi_battery_file[i].ops, |
1733 |
++ acpi_driver_data(device)); |
1734 |
++ if (!entry) |
1735 |
++ return -ENODEV; |
1736 |
++ } |
1737 |
++ return 0; |
1738 |
++} |
1739 |
++ |
1740 |
++static void acpi_battery_remove_fs(struct acpi_device *device) |
1741 |
++{ |
1742 |
++ int i; |
1743 |
++ if (!acpi_device_dir(device)) |
1744 |
++ return; |
1745 |
++ for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) |
1746 |
++ remove_proc_entry(acpi_battery_file[i].name, |
1747 |
++ acpi_device_dir(device)); |
1748 |
++ |
1749 |
++ remove_proc_entry(acpi_device_bid(device), acpi_battery_dir); |
1750 |
++ acpi_device_dir(device) = NULL; |
1751 |
++} |
1752 |
++ |
1753 |
++#endif |
1754 |
++ |
1755 |
++/* -------------------------------------------------------------------------- |
1756 |
+ Driver Interface |
1757 |
+ -------------------------------------------------------------------------- */ |
1758 |
+ |
1759 |
+@@ -791,6 +1091,15 @@ static int acpi_battery_add(struct acpi_device *device) |
1760 |
+ result = acpi_battery_update(battery); |
1761 |
+ if (result) |
1762 |
+ goto fail; |
1763 |
++#ifdef CONFIG_ACPI_PROCFS_POWER |
1764 |
++ result = acpi_battery_add_fs(device); |
1765 |
++#endif |
1766 |
++ if (result) { |
1767 |
++#ifdef CONFIG_ACPI_PROCFS_POWER |
1768 |
++ acpi_battery_remove_fs(device); |
1769 |
++#endif |
1770 |
++ goto fail; |
1771 |
++ } |
1772 |
+ |
1773 |
+ printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n", |
1774 |
+ ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device), |
1775 |
+@@ -817,6 +1126,9 @@ static int acpi_battery_remove(struct acpi_device *device) |
1776 |
+ return -EINVAL; |
1777 |
+ battery = acpi_driver_data(device); |
1778 |
+ unregister_pm_notifier(&battery->pm_nb); |
1779 |
++#ifdef CONFIG_ACPI_PROCFS_POWER |
1780 |
++ acpi_battery_remove_fs(device); |
1781 |
++#endif |
1782 |
+ sysfs_remove_battery(battery); |
1783 |
+ mutex_destroy(&battery->lock); |
1784 |
+ mutex_destroy(&battery->sysfs_lock); |
1785 |
+@@ -867,7 +1179,19 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) |
1786 |
+ |
1787 |
+ if (dmi_check_system(bat_dmi_table)) |
1788 |
+ battery_bix_broken_package = 1; |
1789 |
+- acpi_bus_register_driver(&acpi_battery_driver); |
1790 |
++ |
1791 |
++#ifdef CONFIG_ACPI_PROCFS_POWER |
1792 |
++ acpi_battery_dir = acpi_lock_battery_dir(); |
1793 |
++ if (!acpi_battery_dir) |
1794 |
++ return; |
1795 |
++#endif |
1796 |
++ if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { |
1797 |
++#ifdef CONFIG_ACPI_PROCFS_POWER |
1798 |
++ acpi_unlock_battery_dir(acpi_battery_dir); |
1799 |
++#endif |
1800 |
++ return; |
1801 |
++ } |
1802 |
++ return; |
1803 |
+ } |
1804 |
+ |
1805 |
+ static int __init acpi_battery_init(void) |
1806 |
+@@ -879,6 +1203,9 @@ static int __init acpi_battery_init(void) |
1807 |
+ static void __exit acpi_battery_exit(void) |
1808 |
+ { |
1809 |
+ acpi_bus_unregister_driver(&acpi_battery_driver); |
1810 |
++#ifdef CONFIG_ACPI_PROCFS_POWER |
1811 |
++ acpi_unlock_battery_dir(acpi_battery_dir); |
1812 |
++#endif |
1813 |
+ } |
1814 |
+ |
1815 |
+ module_init(acpi_battery_init); |
1816 |
+diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c |
1817 |
+index afec4526c48a..3d8413d02a97 100644 |
1818 |
+--- a/drivers/acpi/blacklist.c |
1819 |
++++ b/drivers/acpi/blacklist.c |
1820 |
+@@ -314,6 +314,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { |
1821 |
+ DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"), |
1822 |
+ }, |
1823 |
+ }, |
1824 |
++ { |
1825 |
++ .callback = dmi_disable_osi_win8, |
1826 |
++ .ident = "Dell Inspiron 7737", |
1827 |
++ .matches = { |
1828 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), |
1829 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7737"), |
1830 |
++ }, |
1831 |
++ }, |
1832 |
+ |
1833 |
+ /* |
1834 |
+ * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. |
1835 |
+@@ -374,6 +382,19 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { |
1836 |
+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T500"), |
1837 |
+ }, |
1838 |
+ }, |
1839 |
++ /* |
1840 |
++ * Without this this EEEpc exports a non working WMI interface, with |
1841 |
++ * this it exports a working "good old" eeepc_laptop interface, fixing |
1842 |
++ * both brightness control, and rfkill not working. |
1843 |
++ */ |
1844 |
++ { |
1845 |
++ .callback = dmi_enable_osi_linux, |
1846 |
++ .ident = "Asus EEE PC 1015PX", |
1847 |
++ .matches = { |
1848 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."), |
1849 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "1015PX"), |
1850 |
++ }, |
1851 |
++ }, |
1852 |
+ {} |
1853 |
+ }; |
1854 |
+ |
1855 |
+diff --git a/drivers/acpi/cm_sbs.c b/drivers/acpi/cm_sbs.c |
1856 |
+new file mode 100644 |
1857 |
+index 000000000000..6c9ee68e46fb |
1858 |
+--- /dev/null |
1859 |
++++ b/drivers/acpi/cm_sbs.c |
1860 |
+@@ -0,0 +1,105 @@ |
1861 |
++/* |
1862 |
++ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1863 |
++ * |
1864 |
++ * This program is free software; you can redistribute it and/or modify |
1865 |
++ * it under the terms of the GNU General Public License as published by |
1866 |
++ * the Free Software Foundation; either version 2 of the License, or (at |
1867 |
++ * your option) any later version. |
1868 |
++ * |
1869 |
++ * This program is distributed in the hope that it will be useful, but |
1870 |
++ * WITHOUT ANY WARRANTY; without even the implied warranty of |
1871 |
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1872 |
++ * General Public License for more details. |
1873 |
++ * |
1874 |
++ * You should have received a copy of the GNU General Public License along |
1875 |
++ * with this program; if not, write to the Free Software Foundation, Inc., |
1876 |
++ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
1877 |
++ * |
1878 |
++ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1879 |
++ */ |
1880 |
++ |
1881 |
++#include <linux/kernel.h> |
1882 |
++#include <linux/module.h> |
1883 |
++#include <linux/init.h> |
1884 |
++#include <linux/acpi.h> |
1885 |
++#include <linux/types.h> |
1886 |
++#include <linux/proc_fs.h> |
1887 |
++#include <linux/seq_file.h> |
1888 |
++#include <acpi/acpi_bus.h> |
1889 |
++#include <acpi/acpi_drivers.h> |
1890 |
++ |
1891 |
++#define PREFIX "ACPI: " |
1892 |
++ |
1893 |
++ACPI_MODULE_NAME("cm_sbs"); |
1894 |
++#define ACPI_AC_CLASS "ac_adapter" |
1895 |
++#define ACPI_BATTERY_CLASS "battery" |
1896 |
++#define _COMPONENT ACPI_SBS_COMPONENT |
1897 |
++static struct proc_dir_entry *acpi_ac_dir; |
1898 |
++static struct proc_dir_entry *acpi_battery_dir; |
1899 |
++ |
1900 |
++static DEFINE_MUTEX(cm_sbs_mutex); |
1901 |
++ |
1902 |
++static int lock_ac_dir_cnt; |
1903 |
++static int lock_battery_dir_cnt; |
1904 |
++ |
1905 |
++struct proc_dir_entry *acpi_lock_ac_dir(void) |
1906 |
++{ |
1907 |
++ mutex_lock(&cm_sbs_mutex); |
1908 |
++ if (!acpi_ac_dir) |
1909 |
++ acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir); |
1910 |
++ if (acpi_ac_dir) { |
1911 |
++ lock_ac_dir_cnt++; |
1912 |
++ } else { |
1913 |
++ printk(KERN_ERR PREFIX |
1914 |
++ "Cannot create %s\n", ACPI_AC_CLASS); |
1915 |
++ } |
1916 |
++ mutex_unlock(&cm_sbs_mutex); |
1917 |
++ return acpi_ac_dir; |
1918 |
++} |
1919 |
++EXPORT_SYMBOL(acpi_lock_ac_dir); |
1920 |
++ |
1921 |
++void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir_param) |
1922 |
++{ |
1923 |
++ mutex_lock(&cm_sbs_mutex); |
1924 |
++ if (acpi_ac_dir_param) |
1925 |
++ lock_ac_dir_cnt--; |
1926 |
++ if (lock_ac_dir_cnt == 0 && acpi_ac_dir_param && acpi_ac_dir) { |
1927 |
++ remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); |
1928 |
++ acpi_ac_dir = NULL; |
1929 |
++ } |
1930 |
++ mutex_unlock(&cm_sbs_mutex); |
1931 |
++} |
1932 |
++EXPORT_SYMBOL(acpi_unlock_ac_dir); |
1933 |
++ |
1934 |
++struct proc_dir_entry *acpi_lock_battery_dir(void) |
1935 |
++{ |
1936 |
++ mutex_lock(&cm_sbs_mutex); |
1937 |
++ if (!acpi_battery_dir) { |
1938 |
++ acpi_battery_dir = |
1939 |
++ proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir); |
1940 |
++ } |
1941 |
++ if (acpi_battery_dir) { |
1942 |
++ lock_battery_dir_cnt++; |
1943 |
++ } else { |
1944 |
++ printk(KERN_ERR PREFIX |
1945 |
++ "Cannot create %s\n", ACPI_BATTERY_CLASS); |
1946 |
++ } |
1947 |
++ mutex_unlock(&cm_sbs_mutex); |
1948 |
++ return acpi_battery_dir; |
1949 |
++} |
1950 |
++EXPORT_SYMBOL(acpi_lock_battery_dir); |
1951 |
++ |
1952 |
++void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir_param) |
1953 |
++{ |
1954 |
++ mutex_lock(&cm_sbs_mutex); |
1955 |
++ if (acpi_battery_dir_param) |
1956 |
++ lock_battery_dir_cnt--; |
1957 |
++ if (lock_battery_dir_cnt == 0 && acpi_battery_dir_param |
1958 |
++ && acpi_battery_dir) { |
1959 |
++ remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); |
1960 |
++ acpi_battery_dir = NULL; |
1961 |
++ } |
1962 |
++ mutex_unlock(&cm_sbs_mutex); |
1963 |
++ return; |
1964 |
++} |
1965 |
++EXPORT_SYMBOL(acpi_unlock_battery_dir); |
1966 |
+diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c |
1967 |
+index d7d32c28829b..ad11ba4a412d 100644 |
1968 |
+--- a/drivers/acpi/ec.c |
1969 |
++++ b/drivers/acpi/ec.c |
1970 |
+@@ -206,13 +206,13 @@ unlock: |
1971 |
+ spin_unlock_irqrestore(&ec->lock, flags); |
1972 |
+ } |
1973 |
+ |
1974 |
+-static int acpi_ec_sync_query(struct acpi_ec *ec); |
1975 |
++static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data); |
1976 |
+ |
1977 |
+ static int ec_check_sci_sync(struct acpi_ec *ec, u8 state) |
1978 |
+ { |
1979 |
+ if (state & ACPI_EC_FLAG_SCI) { |
1980 |
+ if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) |
1981 |
+- return acpi_ec_sync_query(ec); |
1982 |
++ return acpi_ec_sync_query(ec, NULL); |
1983 |
+ } |
1984 |
+ return 0; |
1985 |
+ } |
1986 |
+@@ -443,10 +443,8 @@ acpi_handle ec_get_handle(void) |
1987 |
+ |
1988 |
+ EXPORT_SYMBOL(ec_get_handle); |
1989 |
+ |
1990 |
+-static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 *data); |
1991 |
+- |
1992 |
+ /* |
1993 |
+- * Clears stale _Q events that might have accumulated in the EC. |
1994 |
++ * Process _Q events that might have accumulated in the EC. |
1995 |
+ * Run with locked ec mutex. |
1996 |
+ */ |
1997 |
+ static void acpi_ec_clear(struct acpi_ec *ec) |
1998 |
+@@ -455,7 +453,7 @@ static void acpi_ec_clear(struct acpi_ec *ec) |
1999 |
+ u8 value = 0; |
2000 |
+ |
2001 |
+ for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) { |
2002 |
+- status = acpi_ec_query_unlocked(ec, &value); |
2003 |
++ status = acpi_ec_sync_query(ec, &value); |
2004 |
+ if (status || !value) |
2005 |
+ break; |
2006 |
+ } |
2007 |
+@@ -582,13 +580,18 @@ static void acpi_ec_run(void *cxt) |
2008 |
+ kfree(handler); |
2009 |
+ } |
2010 |
+ |
2011 |
+-static int acpi_ec_sync_query(struct acpi_ec *ec) |
2012 |
++static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data) |
2013 |
+ { |
2014 |
+ u8 value = 0; |
2015 |
+ int status; |
2016 |
+ struct acpi_ec_query_handler *handler, *copy; |
2017 |
+- if ((status = acpi_ec_query_unlocked(ec, &value))) |
2018 |
++ |
2019 |
++ status = acpi_ec_query_unlocked(ec, &value); |
2020 |
++ if (data) |
2021 |
++ *data = value; |
2022 |
++ if (status) |
2023 |
+ return status; |
2024 |
++ |
2025 |
+ list_for_each_entry(handler, &ec->list, node) { |
2026 |
+ if (value == handler->query_bit) { |
2027 |
+ /* have custom handler for this bit */ |
2028 |
+@@ -612,7 +615,7 @@ static void acpi_ec_gpe_query(void *ec_cxt) |
2029 |
+ if (!ec) |
2030 |
+ return; |
2031 |
+ mutex_lock(&ec->mutex); |
2032 |
+- acpi_ec_sync_query(ec); |
2033 |
++ acpi_ec_sync_query(ec, NULL); |
2034 |
+ mutex_unlock(&ec->mutex); |
2035 |
+ } |
2036 |
+ |
2037 |
+diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c |
2038 |
+index b6ba88ed31ae..bb0b90461a6b 100644 |
2039 |
+--- a/drivers/acpi/video.c |
2040 |
++++ b/drivers/acpi/video.c |
2041 |
+@@ -459,10 +459,10 @@ static struct dmi_system_id video_dmi_table[] __initdata = { |
2042 |
+ }, |
2043 |
+ { |
2044 |
+ .callback = video_set_use_native_backlight, |
2045 |
+- .ident = "ThinkPad T430s", |
2046 |
++ .ident = "ThinkPad T430 and T430s", |
2047 |
+ .matches = { |
2048 |
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
2049 |
+- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430s"), |
2050 |
++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430"), |
2051 |
+ }, |
2052 |
+ }, |
2053 |
+ { |
2054 |
+@@ -474,7 +474,7 @@ static struct dmi_system_id video_dmi_table[] __initdata = { |
2055 |
+ }, |
2056 |
+ }, |
2057 |
+ { |
2058 |
+- .callback = video_set_use_native_backlight, |
2059 |
++ .callback = video_set_use_native_backlight, |
2060 |
+ .ident = "ThinkPad X1 Carbon", |
2061 |
+ .matches = { |
2062 |
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
2063 |
+@@ -494,7 +494,7 @@ static struct dmi_system_id video_dmi_table[] __initdata = { |
2064 |
+ .ident = "Dell Inspiron 7520", |
2065 |
+ .matches = { |
2066 |
+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), |
2067 |
+- DMI_MATCH(DMI_PRODUCT_VERSION, "Inspiron 7520"), |
2068 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7520"), |
2069 |
+ }, |
2070 |
+ }, |
2071 |
+ { |
2072 |
+@@ -507,6 +507,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = { |
2073 |
+ }, |
2074 |
+ { |
2075 |
+ .callback = video_set_use_native_backlight, |
2076 |
++ .ident = "Acer Aspire 5742G", |
2077 |
++ .matches = { |
2078 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
2079 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5742G"), |
2080 |
++ }, |
2081 |
++ }, |
2082 |
++ { |
2083 |
++ .callback = video_set_use_native_backlight, |
2084 |
+ .ident = "Acer Aspire V5-431", |
2085 |
+ .matches = { |
2086 |
+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
2087 |
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
2088 |
+index 0a79c540169c..bb26636f10c8 100644 |
2089 |
+--- a/drivers/ata/libata-core.c |
2090 |
++++ b/drivers/ata/libata-core.c |
2091 |
+@@ -6329,6 +6329,8 @@ int ata_host_activate(struct ata_host *host, int irq, |
2092 |
+ static void ata_port_detach(struct ata_port *ap) |
2093 |
+ { |
2094 |
+ unsigned long flags; |
2095 |
++ struct ata_link *link; |
2096 |
++ struct ata_device *dev; |
2097 |
+ |
2098 |
+ if (!ap->ops->error_handler) |
2099 |
+ goto skip_eh; |
2100 |
+@@ -6348,6 +6350,13 @@ static void ata_port_detach(struct ata_port *ap) |
2101 |
+ cancel_delayed_work_sync(&ap->hotplug_task); |
2102 |
+ |
2103 |
+ skip_eh: |
2104 |
++ /* clean up zpodd on port removal */ |
2105 |
++ ata_for_each_link(link, ap, HOST_FIRST) { |
2106 |
++ ata_for_each_dev(dev, link, ALL) { |
2107 |
++ if (zpodd_dev_enabled(dev)) |
2108 |
++ zpodd_exit(dev); |
2109 |
++ } |
2110 |
++ } |
2111 |
+ if (ap->pmp_link) { |
2112 |
+ int i; |
2113 |
+ for (i = 0; i < SATA_PMP_MAX_PORTS; i++) |
2114 |
+diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c |
2115 |
+index d63ee8f41a4f..e3a49df958a3 100644 |
2116 |
+--- a/drivers/ata/pata_at91.c |
2117 |
++++ b/drivers/ata/pata_at91.c |
2118 |
+@@ -408,12 +408,13 @@ static int pata_at91_probe(struct platform_device *pdev) |
2119 |
+ |
2120 |
+ host->private_data = info; |
2121 |
+ |
2122 |
+- return ata_host_activate(host, gpio_is_valid(irq) ? gpio_to_irq(irq) : 0, |
2123 |
+- gpio_is_valid(irq) ? ata_sff_interrupt : NULL, |
2124 |
+- irq_flags, &pata_at91_sht); |
2125 |
++ ret = ata_host_activate(host, gpio_is_valid(irq) ? gpio_to_irq(irq) : 0, |
2126 |
++ gpio_is_valid(irq) ? ata_sff_interrupt : NULL, |
2127 |
++ irq_flags, &pata_at91_sht); |
2128 |
++ if (ret) |
2129 |
++ goto err_put; |
2130 |
+ |
2131 |
+- if (!ret) |
2132 |
+- return 0; |
2133 |
++ return 0; |
2134 |
+ |
2135 |
+ err_put: |
2136 |
+ clk_put(info->mck); |
2137 |
+diff --git a/drivers/base/dd.c b/drivers/base/dd.c |
2138 |
+index 06051767393f..8a8d611f2021 100644 |
2139 |
+--- a/drivers/base/dd.c |
2140 |
++++ b/drivers/base/dd.c |
2141 |
+@@ -52,6 +52,7 @@ static DEFINE_MUTEX(deferred_probe_mutex); |
2142 |
+ static LIST_HEAD(deferred_probe_pending_list); |
2143 |
+ static LIST_HEAD(deferred_probe_active_list); |
2144 |
+ static struct workqueue_struct *deferred_wq; |
2145 |
++static atomic_t deferred_trigger_count = ATOMIC_INIT(0); |
2146 |
+ |
2147 |
+ /** |
2148 |
+ * deferred_probe_work_func() - Retry probing devices in the active list. |
2149 |
+@@ -135,6 +136,17 @@ static bool driver_deferred_probe_enable = false; |
2150 |
+ * This functions moves all devices from the pending list to the active |
2151 |
+ * list and schedules the deferred probe workqueue to process them. It |
2152 |
+ * should be called anytime a driver is successfully bound to a device. |
2153 |
++ * |
2154 |
++ * Note, there is a race condition in multi-threaded probe. In the case where |
2155 |
++ * more than one device is probing at the same time, it is possible for one |
2156 |
++ * probe to complete successfully while another is about to defer. If the second |
2157 |
++ * depends on the first, then it will get put on the pending list after the |
2158 |
++ * trigger event has already occured and will be stuck there. |
2159 |
++ * |
2160 |
++ * The atomic 'deferred_trigger_count' is used to determine if a successful |
2161 |
++ * trigger has occurred in the midst of probing a driver. If the trigger count |
2162 |
++ * changes in the midst of a probe, then deferred processing should be triggered |
2163 |
++ * again. |
2164 |
+ */ |
2165 |
+ static void driver_deferred_probe_trigger(void) |
2166 |
+ { |
2167 |
+@@ -147,6 +159,7 @@ static void driver_deferred_probe_trigger(void) |
2168 |
+ * into the active list so they can be retried by the workqueue |
2169 |
+ */ |
2170 |
+ mutex_lock(&deferred_probe_mutex); |
2171 |
++ atomic_inc(&deferred_trigger_count); |
2172 |
+ list_splice_tail_init(&deferred_probe_pending_list, |
2173 |
+ &deferred_probe_active_list); |
2174 |
+ mutex_unlock(&deferred_probe_mutex); |
2175 |
+@@ -265,6 +278,7 @@ static DECLARE_WAIT_QUEUE_HEAD(probe_waitqueue); |
2176 |
+ static int really_probe(struct device *dev, struct device_driver *drv) |
2177 |
+ { |
2178 |
+ int ret = 0; |
2179 |
++ int local_trigger_count = atomic_read(&deferred_trigger_count); |
2180 |
+ |
2181 |
+ atomic_inc(&probe_count); |
2182 |
+ pr_debug("bus: '%s': %s: probing driver %s with device %s\n", |
2183 |
+@@ -310,6 +324,9 @@ probe_failed: |
2184 |
+ /* Driver requested deferred probing */ |
2185 |
+ dev_info(dev, "Driver %s requests probe deferral\n", drv->name); |
2186 |
+ driver_deferred_probe_add(dev); |
2187 |
++ /* Did a trigger occur while probing? Need to re-trigger if yes */ |
2188 |
++ if (local_trigger_count != atomic_read(&deferred_trigger_count)) |
2189 |
++ driver_deferred_probe_trigger(); |
2190 |
+ } else if (ret != -ENODEV && ret != -ENXIO) { |
2191 |
+ /* driver matched but the probe failed */ |
2192 |
+ printk(KERN_WARNING |
2193 |
+diff --git a/drivers/base/platform.c b/drivers/base/platform.c |
2194 |
+index bc78848dd59a..3c51eb0bd659 100644 |
2195 |
+--- a/drivers/base/platform.c |
2196 |
++++ b/drivers/base/platform.c |
2197 |
+@@ -13,6 +13,7 @@ |
2198 |
+ #include <linux/string.h> |
2199 |
+ #include <linux/platform_device.h> |
2200 |
+ #include <linux/of_device.h> |
2201 |
++#include <linux/of_irq.h> |
2202 |
+ #include <linux/module.h> |
2203 |
+ #include <linux/init.h> |
2204 |
+ #include <linux/dma-mapping.h> |
2205 |
+@@ -87,7 +88,11 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) |
2206 |
+ return -ENXIO; |
2207 |
+ return dev->archdata.irqs[num]; |
2208 |
+ #else |
2209 |
+- struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num); |
2210 |
++ struct resource *r; |
2211 |
++ if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) |
2212 |
++ return of_irq_get(dev->dev.of_node, num); |
2213 |
++ |
2214 |
++ r = platform_get_resource(dev, IORESOURCE_IRQ, num); |
2215 |
+ |
2216 |
+ return r ? r->start : -ENXIO; |
2217 |
+ #endif |
2218 |
+diff --git a/drivers/base/topology.c b/drivers/base/topology.c |
2219 |
+index 94ffee378f10..37a5661ca5f9 100644 |
2220 |
+--- a/drivers/base/topology.c |
2221 |
++++ b/drivers/base/topology.c |
2222 |
+@@ -40,8 +40,7 @@ |
2223 |
+ static ssize_t show_##name(struct device *dev, \ |
2224 |
+ struct device_attribute *attr, char *buf) \ |
2225 |
+ { \ |
2226 |
+- unsigned int cpu = dev->id; \ |
2227 |
+- return sprintf(buf, "%d\n", topology_##name(cpu)); \ |
2228 |
++ return sprintf(buf, "%d\n", topology_##name(dev->id)); \ |
2229 |
+ } |
2230 |
+ |
2231 |
+ #if defined(topology_thread_cpumask) || defined(topology_core_cpumask) || \ |
2232 |
+diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c |
2233 |
+index 106d1d8e16ad..b11949c5b029 100644 |
2234 |
+--- a/drivers/bluetooth/ath3k.c |
2235 |
++++ b/drivers/bluetooth/ath3k.c |
2236 |
+@@ -82,6 +82,7 @@ static const struct usb_device_id ath3k_table[] = { |
2237 |
+ { USB_DEVICE(0x04CA, 0x3004) }, |
2238 |
+ { USB_DEVICE(0x04CA, 0x3005) }, |
2239 |
+ { USB_DEVICE(0x04CA, 0x3006) }, |
2240 |
++ { USB_DEVICE(0x04CA, 0x3007) }, |
2241 |
+ { USB_DEVICE(0x04CA, 0x3008) }, |
2242 |
+ { USB_DEVICE(0x04CA, 0x300b) }, |
2243 |
+ { USB_DEVICE(0x13d3, 0x3362) }, |
2244 |
+@@ -127,6 +128,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { |
2245 |
+ { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, |
2246 |
+ { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
2247 |
+ { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, |
2248 |
++ { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, |
2249 |
+ { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
2250 |
+ { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, |
2251 |
+ { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
2252 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
2253 |
+index baeaaed299e4..1c7b5040d921 100644 |
2254 |
+--- a/drivers/bluetooth/btusb.c |
2255 |
++++ b/drivers/bluetooth/btusb.c |
2256 |
+@@ -149,6 +149,7 @@ static const struct usb_device_id blacklist_table[] = { |
2257 |
+ { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, |
2258 |
+ { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
2259 |
+ { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, |
2260 |
++ { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, |
2261 |
+ { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
2262 |
+ { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, |
2263 |
+ { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
2264 |
+@@ -1478,10 +1479,8 @@ static int btusb_probe(struct usb_interface *intf, |
2265 |
+ if (id->driver_info & BTUSB_BCM92035) |
2266 |
+ hdev->setup = btusb_setup_bcm92035; |
2267 |
+ |
2268 |
+- if (id->driver_info & BTUSB_INTEL) { |
2269 |
+- usb_enable_autosuspend(data->udev); |
2270 |
++ if (id->driver_info & BTUSB_INTEL) |
2271 |
+ hdev->setup = btusb_setup_intel; |
2272 |
+- } |
2273 |
+ |
2274 |
+ /* Interface numbers are hardcoded in the specification */ |
2275 |
+ data->isoc = usb_ifnum_to_if(data->udev, 1); |
2276 |
+diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c |
2277 |
+index 725c46162bbd..372ae72cce34 100644 |
2278 |
+--- a/drivers/bus/mvebu-mbus.c |
2279 |
++++ b/drivers/bus/mvebu-mbus.c |
2280 |
+@@ -222,12 +222,6 @@ static int mvebu_mbus_window_conflicts(struct mvebu_mbus_state *mbus, |
2281 |
+ */ |
2282 |
+ if ((u64)base < wend && end > wbase) |
2283 |
+ return 0; |
2284 |
+- |
2285 |
+- /* |
2286 |
+- * Check if target/attribute conflicts |
2287 |
+- */ |
2288 |
+- if (target == wtarget && attr == wattr) |
2289 |
+- return 0; |
2290 |
+ } |
2291 |
+ |
2292 |
+ return 1; |
2293 |
+diff --git a/drivers/char/ipmi/ipmi_kcs_sm.c b/drivers/char/ipmi/ipmi_kcs_sm.c |
2294 |
+index 6a4bdc18955a..8c25f596808a 100644 |
2295 |
+--- a/drivers/char/ipmi/ipmi_kcs_sm.c |
2296 |
++++ b/drivers/char/ipmi/ipmi_kcs_sm.c |
2297 |
+@@ -251,8 +251,9 @@ static inline int check_obf(struct si_sm_data *kcs, unsigned char status, |
2298 |
+ if (!GET_STATUS_OBF(status)) { |
2299 |
+ kcs->obf_timeout -= time; |
2300 |
+ if (kcs->obf_timeout < 0) { |
2301 |
+- start_error_recovery(kcs, "OBF not ready in time"); |
2302 |
+- return 1; |
2303 |
++ kcs->obf_timeout = OBF_RETRY_TIMEOUT; |
2304 |
++ start_error_recovery(kcs, "OBF not ready in time"); |
2305 |
++ return 1; |
2306 |
+ } |
2307 |
+ return 0; |
2308 |
+ } |
2309 |
+diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c |
2310 |
+index 03f41896d090..8b4fa2c4e661 100644 |
2311 |
+--- a/drivers/char/ipmi/ipmi_si_intf.c |
2312 |
++++ b/drivers/char/ipmi/ipmi_si_intf.c |
2313 |
+@@ -249,6 +249,9 @@ struct smi_info { |
2314 |
+ /* The timer for this si. */ |
2315 |
+ struct timer_list si_timer; |
2316 |
+ |
2317 |
++ /* This flag is set, if the timer is running (timer_pending() isn't enough) */ |
2318 |
++ bool timer_running; |
2319 |
++ |
2320 |
+ /* The time (in jiffies) the last timeout occurred at. */ |
2321 |
+ unsigned long last_timeout_jiffies; |
2322 |
+ |
2323 |
+@@ -435,6 +438,13 @@ static void start_clear_flags(struct smi_info *smi_info) |
2324 |
+ smi_info->si_state = SI_CLEARING_FLAGS; |
2325 |
+ } |
2326 |
+ |
2327 |
++static void smi_mod_timer(struct smi_info *smi_info, unsigned long new_val) |
2328 |
++{ |
2329 |
++ smi_info->last_timeout_jiffies = jiffies; |
2330 |
++ mod_timer(&smi_info->si_timer, new_val); |
2331 |
++ smi_info->timer_running = true; |
2332 |
++} |
2333 |
++ |
2334 |
+ /* |
2335 |
+ * When we have a situtaion where we run out of memory and cannot |
2336 |
+ * allocate messages, we just leave them in the BMC and run the system |
2337 |
+@@ -447,8 +457,7 @@ static inline void disable_si_irq(struct smi_info *smi_info) |
2338 |
+ start_disable_irq(smi_info); |
2339 |
+ smi_info->interrupt_disabled = 1; |
2340 |
+ if (!atomic_read(&smi_info->stop_operation)) |
2341 |
+- mod_timer(&smi_info->si_timer, |
2342 |
+- jiffies + SI_TIMEOUT_JIFFIES); |
2343 |
++ smi_mod_timer(smi_info, jiffies + SI_TIMEOUT_JIFFIES); |
2344 |
+ } |
2345 |
+ } |
2346 |
+ |
2347 |
+@@ -908,15 +917,7 @@ static void sender(void *send_info, |
2348 |
+ list_add_tail(&msg->link, &smi_info->xmit_msgs); |
2349 |
+ |
2350 |
+ if (smi_info->si_state == SI_NORMAL && smi_info->curr_msg == NULL) { |
2351 |
+- /* |
2352 |
+- * last_timeout_jiffies is updated here to avoid |
2353 |
+- * smi_timeout() handler passing very large time_diff |
2354 |
+- * value to smi_event_handler() that causes |
2355 |
+- * the send command to abort. |
2356 |
+- */ |
2357 |
+- smi_info->last_timeout_jiffies = jiffies; |
2358 |
+- |
2359 |
+- mod_timer(&smi_info->si_timer, jiffies + SI_TIMEOUT_JIFFIES); |
2360 |
++ smi_mod_timer(smi_info, jiffies + SI_TIMEOUT_JIFFIES); |
2361 |
+ |
2362 |
+ if (smi_info->thread) |
2363 |
+ wake_up_process(smi_info->thread); |
2364 |
+@@ -1005,6 +1006,17 @@ static int ipmi_thread(void *data) |
2365 |
+ |
2366 |
+ spin_lock_irqsave(&(smi_info->si_lock), flags); |
2367 |
+ smi_result = smi_event_handler(smi_info, 0); |
2368 |
++ |
2369 |
++ /* |
2370 |
++ * If the driver is doing something, there is a possible |
2371 |
++ * race with the timer. If the timer handler see idle, |
2372 |
++ * and the thread here sees something else, the timer |
2373 |
++ * handler won't restart the timer even though it is |
2374 |
++ * required. So start it here if necessary. |
2375 |
++ */ |
2376 |
++ if (smi_result != SI_SM_IDLE && !smi_info->timer_running) |
2377 |
++ smi_mod_timer(smi_info, jiffies + SI_TIMEOUT_JIFFIES); |
2378 |
++ |
2379 |
+ spin_unlock_irqrestore(&(smi_info->si_lock), flags); |
2380 |
+ busy_wait = ipmi_thread_busy_wait(smi_result, smi_info, |
2381 |
+ &busy_until); |
2382 |
+@@ -1074,10 +1086,6 @@ static void smi_timeout(unsigned long data) |
2383 |
+ * SI_USEC_PER_JIFFY); |
2384 |
+ smi_result = smi_event_handler(smi_info, time_diff); |
2385 |
+ |
2386 |
+- spin_unlock_irqrestore(&(smi_info->si_lock), flags); |
2387 |
+- |
2388 |
+- smi_info->last_timeout_jiffies = jiffies_now; |
2389 |
+- |
2390 |
+ if ((smi_info->irq) && (!smi_info->interrupt_disabled)) { |
2391 |
+ /* Running with interrupts, only do long timeouts. */ |
2392 |
+ timeout = jiffies + SI_TIMEOUT_JIFFIES; |
2393 |
+@@ -1099,7 +1107,10 @@ static void smi_timeout(unsigned long data) |
2394 |
+ |
2395 |
+ do_mod_timer: |
2396 |
+ if (smi_result != SI_SM_IDLE) |
2397 |
+- mod_timer(&(smi_info->si_timer), timeout); |
2398 |
++ smi_mod_timer(smi_info, timeout); |
2399 |
++ else |
2400 |
++ smi_info->timer_running = false; |
2401 |
++ spin_unlock_irqrestore(&(smi_info->si_lock), flags); |
2402 |
+ } |
2403 |
+ |
2404 |
+ static irqreturn_t si_irq_handler(int irq, void *data) |
2405 |
+@@ -1147,8 +1158,7 @@ static int smi_start_processing(void *send_info, |
2406 |
+ |
2407 |
+ /* Set up the timer that drives the interface. */ |
2408 |
+ setup_timer(&new_smi->si_timer, smi_timeout, (long)new_smi); |
2409 |
+- new_smi->last_timeout_jiffies = jiffies; |
2410 |
+- mod_timer(&new_smi->si_timer, jiffies + SI_TIMEOUT_JIFFIES); |
2411 |
++ smi_mod_timer(new_smi, jiffies + SI_TIMEOUT_JIFFIES); |
2412 |
+ |
2413 |
+ /* |
2414 |
+ * Check if the user forcefully enabled the daemon. |
2415 |
+diff --git a/drivers/char/tpm/tpm_ppi.c b/drivers/char/tpm/tpm_ppi.c |
2416 |
+index b3ea223585bd..61dcc8011ec7 100644 |
2417 |
+--- a/drivers/char/tpm/tpm_ppi.c |
2418 |
++++ b/drivers/char/tpm/tpm_ppi.c |
2419 |
+@@ -328,13 +328,11 @@ int tpm_add_ppi(struct kobject *parent) |
2420 |
+ /* Cache TPM ACPI handle and version string */ |
2421 |
+ acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, |
2422 |
+ ppi_callback, NULL, NULL, &tpm_ppi_handle); |
2423 |
+- if (tpm_ppi_handle == NULL) |
2424 |
+- return -ENODEV; |
2425 |
+- |
2426 |
+- return sysfs_create_group(parent, &ppi_attr_grp); |
2427 |
++ return tpm_ppi_handle ? sysfs_create_group(parent, &ppi_attr_grp) : 0; |
2428 |
+ } |
2429 |
+ |
2430 |
+ void tpm_remove_ppi(struct kobject *parent) |
2431 |
+ { |
2432 |
+- sysfs_remove_group(parent, &ppi_attr_grp); |
2433 |
++ if (tpm_ppi_handle) |
2434 |
++ sysfs_remove_group(parent, &ppi_attr_grp); |
2435 |
+ } |
2436 |
+diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c |
2437 |
+index c42e608af6bb..b94a311e5ab6 100644 |
2438 |
+--- a/drivers/clk/clk.c |
2439 |
++++ b/drivers/clk/clk.c |
2440 |
+@@ -1977,9 +1977,28 @@ struct clk *__clk_register(struct device *dev, struct clk_hw *hw) |
2441 |
+ } |
2442 |
+ EXPORT_SYMBOL_GPL(__clk_register); |
2443 |
+ |
2444 |
+-static int _clk_register(struct device *dev, struct clk_hw *hw, struct clk *clk) |
2445 |
++/** |
2446 |
++ * clk_register - allocate a new clock, register it and return an opaque cookie |
2447 |
++ * @dev: device that is registering this clock |
2448 |
++ * @hw: link to hardware-specific clock data |
2449 |
++ * |
2450 |
++ * clk_register is the primary interface for populating the clock tree with new |
2451 |
++ * clock nodes. It returns a pointer to the newly allocated struct clk which |
2452 |
++ * cannot be dereferenced by driver code but may be used in conjuction with the |
2453 |
++ * rest of the clock API. In the event of an error clk_register will return an |
2454 |
++ * error code; drivers must test for an error code after calling clk_register. |
2455 |
++ */ |
2456 |
++struct clk *clk_register(struct device *dev, struct clk_hw *hw) |
2457 |
+ { |
2458 |
+ int i, ret; |
2459 |
++ struct clk *clk; |
2460 |
++ |
2461 |
++ clk = kzalloc(sizeof(*clk), GFP_KERNEL); |
2462 |
++ if (!clk) { |
2463 |
++ pr_err("%s: could not allocate clk\n", __func__); |
2464 |
++ ret = -ENOMEM; |
2465 |
++ goto fail_out; |
2466 |
++ } |
2467 |
+ |
2468 |
+ clk->name = kstrdup(hw->init->name, GFP_KERNEL); |
2469 |
+ if (!clk->name) { |
2470 |
+@@ -2019,7 +2038,7 @@ static int _clk_register(struct device *dev, struct clk_hw *hw, struct clk *clk) |
2471 |
+ |
2472 |
+ ret = __clk_init(dev, clk); |
2473 |
+ if (!ret) |
2474 |
+- return 0; |
2475 |
++ return clk; |
2476 |
+ |
2477 |
+ fail_parent_names_copy: |
2478 |
+ while (--i >= 0) |
2479 |
+@@ -2028,36 +2047,6 @@ fail_parent_names_copy: |
2480 |
+ fail_parent_names: |
2481 |
+ kfree(clk->name); |
2482 |
+ fail_name: |
2483 |
+- return ret; |
2484 |
+-} |
2485 |
+- |
2486 |
+-/** |
2487 |
+- * clk_register - allocate a new clock, register it and return an opaque cookie |
2488 |
+- * @dev: device that is registering this clock |
2489 |
+- * @hw: link to hardware-specific clock data |
2490 |
+- * |
2491 |
+- * clk_register is the primary interface for populating the clock tree with new |
2492 |
+- * clock nodes. It returns a pointer to the newly allocated struct clk which |
2493 |
+- * cannot be dereferenced by driver code but may be used in conjuction with the |
2494 |
+- * rest of the clock API. In the event of an error clk_register will return an |
2495 |
+- * error code; drivers must test for an error code after calling clk_register. |
2496 |
+- */ |
2497 |
+-struct clk *clk_register(struct device *dev, struct clk_hw *hw) |
2498 |
+-{ |
2499 |
+- int ret; |
2500 |
+- struct clk *clk; |
2501 |
+- |
2502 |
+- clk = kzalloc(sizeof(*clk), GFP_KERNEL); |
2503 |
+- if (!clk) { |
2504 |
+- pr_err("%s: could not allocate clk\n", __func__); |
2505 |
+- ret = -ENOMEM; |
2506 |
+- goto fail_out; |
2507 |
+- } |
2508 |
+- |
2509 |
+- ret = _clk_register(dev, hw, clk); |
2510 |
+- if (!ret) |
2511 |
+- return clk; |
2512 |
+- |
2513 |
+ kfree(clk); |
2514 |
+ fail_out: |
2515 |
+ return ERR_PTR(ret); |
2516 |
+@@ -2144,9 +2133,10 @@ void clk_unregister(struct clk *clk) |
2517 |
+ |
2518 |
+ if (!hlist_empty(&clk->children)) { |
2519 |
+ struct clk *child; |
2520 |
++ struct hlist_node *t; |
2521 |
+ |
2522 |
+ /* Reparent all children to the orphan list. */ |
2523 |
+- hlist_for_each_entry(child, &clk->children, child_node) |
2524 |
++ hlist_for_each_entry_safe(child, t, &clk->children, child_node) |
2525 |
+ clk_set_parent(child, NULL); |
2526 |
+ } |
2527 |
+ |
2528 |
+@@ -2166,7 +2156,7 @@ EXPORT_SYMBOL_GPL(clk_unregister); |
2529 |
+ |
2530 |
+ static void devm_clk_release(struct device *dev, void *res) |
2531 |
+ { |
2532 |
+- clk_unregister(res); |
2533 |
++ clk_unregister(*(struct clk **)res); |
2534 |
+ } |
2535 |
+ |
2536 |
+ /** |
2537 |
+@@ -2181,18 +2171,18 @@ static void devm_clk_release(struct device *dev, void *res) |
2538 |
+ struct clk *devm_clk_register(struct device *dev, struct clk_hw *hw) |
2539 |
+ { |
2540 |
+ struct clk *clk; |
2541 |
+- int ret; |
2542 |
++ struct clk **clkp; |
2543 |
+ |
2544 |
+- clk = devres_alloc(devm_clk_release, sizeof(*clk), GFP_KERNEL); |
2545 |
+- if (!clk) |
2546 |
++ clkp = devres_alloc(devm_clk_release, sizeof(*clkp), GFP_KERNEL); |
2547 |
++ if (!clkp) |
2548 |
+ return ERR_PTR(-ENOMEM); |
2549 |
+ |
2550 |
+- ret = _clk_register(dev, hw, clk); |
2551 |
+- if (!ret) { |
2552 |
+- devres_add(dev, clk); |
2553 |
++ clk = clk_register(dev, hw); |
2554 |
++ if (!IS_ERR(clk)) { |
2555 |
++ *clkp = clk; |
2556 |
++ devres_add(dev, clkp); |
2557 |
+ } else { |
2558 |
+- devres_free(clk); |
2559 |
+- clk = ERR_PTR(ret); |
2560 |
++ devres_free(clkp); |
2561 |
+ } |
2562 |
+ |
2563 |
+ return clk; |
2564 |
+diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c |
2565 |
+index 0d20241e0770..e1769addf435 100644 |
2566 |
+--- a/drivers/clk/tegra/clk-pll.c |
2567 |
++++ b/drivers/clk/tegra/clk-pll.c |
2568 |
+@@ -1718,7 +1718,7 @@ struct clk *tegra_clk_register_plle_tegra114(const char *name, |
2569 |
+ "pll_re_vco"); |
2570 |
+ } else { |
2571 |
+ val_aux &= ~(PLLE_AUX_PLLRE_SEL | PLLE_AUX_PLLP_SEL); |
2572 |
+- pll_writel(val, pll_params->aux_reg, pll); |
2573 |
++ pll_writel(val_aux, pll_params->aux_reg, pll); |
2574 |
+ } |
2575 |
+ |
2576 |
+ clk = _tegra_clk_register_pll(pll, name, parent_name, flags, |
2577 |
+diff --git a/drivers/clk/versatile/clk-vexpress-osc.c b/drivers/clk/versatile/clk-vexpress-osc.c |
2578 |
+index 2dc8b41a339d..a535c7bf8574 100644 |
2579 |
+--- a/drivers/clk/versatile/clk-vexpress-osc.c |
2580 |
++++ b/drivers/clk/versatile/clk-vexpress-osc.c |
2581 |
+@@ -102,7 +102,7 @@ void __init vexpress_osc_of_setup(struct device_node *node) |
2582 |
+ |
2583 |
+ osc = kzalloc(sizeof(*osc), GFP_KERNEL); |
2584 |
+ if (!osc) |
2585 |
+- goto error; |
2586 |
++ return; |
2587 |
+ |
2588 |
+ osc->func = vexpress_config_func_get_by_node(node); |
2589 |
+ if (!osc->func) { |
2590 |
+diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c |
2591 |
+index 48f76bc05da0..e252939b9ee1 100644 |
2592 |
+--- a/drivers/clocksource/exynos_mct.c |
2593 |
++++ b/drivers/clocksource/exynos_mct.c |
2594 |
+@@ -418,8 +418,6 @@ static int exynos4_local_timer_setup(struct clock_event_device *evt) |
2595 |
+ evt->set_mode = exynos4_tick_set_mode; |
2596 |
+ evt->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; |
2597 |
+ evt->rating = 450; |
2598 |
+- clockevents_config_and_register(evt, clk_rate / (TICK_BASE_CNT + 1), |
2599 |
+- 0xf, 0x7fffffff); |
2600 |
+ |
2601 |
+ exynos4_mct_write(TICK_BASE_CNT, mevt->base + MCT_L_TCNTB_OFFSET); |
2602 |
+ |
2603 |
+@@ -432,9 +430,12 @@ static int exynos4_local_timer_setup(struct clock_event_device *evt) |
2604 |
+ evt->irq); |
2605 |
+ return -EIO; |
2606 |
+ } |
2607 |
++ irq_force_affinity(mct_irqs[MCT_L0_IRQ + cpu], cpumask_of(cpu)); |
2608 |
+ } else { |
2609 |
+ enable_percpu_irq(mct_irqs[MCT_L0_IRQ], 0); |
2610 |
+ } |
2611 |
++ clockevents_config_and_register(evt, clk_rate / (TICK_BASE_CNT + 1), |
2612 |
++ 0xf, 0x7fffffff); |
2613 |
+ |
2614 |
+ return 0; |
2615 |
+ } |
2616 |
+@@ -452,7 +453,6 @@ static int exynos4_mct_cpu_notify(struct notifier_block *self, |
2617 |
+ unsigned long action, void *hcpu) |
2618 |
+ { |
2619 |
+ struct mct_clock_event_device *mevt; |
2620 |
+- unsigned int cpu; |
2621 |
+ |
2622 |
+ /* |
2623 |
+ * Grab cpu pointer in each case to avoid spurious |
2624 |
+@@ -463,12 +463,6 @@ static int exynos4_mct_cpu_notify(struct notifier_block *self, |
2625 |
+ mevt = this_cpu_ptr(&percpu_mct_tick); |
2626 |
+ exynos4_local_timer_setup(&mevt->evt); |
2627 |
+ break; |
2628 |
+- case CPU_ONLINE: |
2629 |
+- cpu = (unsigned long)hcpu; |
2630 |
+- if (mct_int_type == MCT_INT_SPI) |
2631 |
+- irq_set_affinity(mct_irqs[MCT_L0_IRQ + cpu], |
2632 |
+- cpumask_of(cpu)); |
2633 |
+- break; |
2634 |
+ case CPU_DYING: |
2635 |
+ mevt = this_cpu_ptr(&percpu_mct_tick); |
2636 |
+ exynos4_local_timer_stop(&mevt->evt); |
2637 |
+diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c |
2638 |
+index 2cd36b9297f3..9ac378380677 100644 |
2639 |
+--- a/drivers/cpufreq/intel_pstate.c |
2640 |
++++ b/drivers/cpufreq/intel_pstate.c |
2641 |
+@@ -37,6 +37,7 @@ |
2642 |
+ #define BYT_RATIOS 0x66a |
2643 |
+ #define BYT_VIDS 0x66b |
2644 |
+ #define BYT_TURBO_RATIOS 0x66c |
2645 |
++#define BYT_TURBO_VIDS 0x66d |
2646 |
+ |
2647 |
+ |
2648 |
+ #define FRAC_BITS 6 |
2649 |
+@@ -70,8 +71,9 @@ struct pstate_data { |
2650 |
+ }; |
2651 |
+ |
2652 |
+ struct vid_data { |
2653 |
+- int32_t min; |
2654 |
+- int32_t max; |
2655 |
++ int min; |
2656 |
++ int max; |
2657 |
++ int turbo; |
2658 |
+ int32_t ratio; |
2659 |
+ }; |
2660 |
+ |
2661 |
+@@ -360,14 +362,14 @@ static int byt_get_min_pstate(void) |
2662 |
+ { |
2663 |
+ u64 value; |
2664 |
+ rdmsrl(BYT_RATIOS, value); |
2665 |
+- return (value >> 8) & 0xFF; |
2666 |
++ return (value >> 8) & 0x3F; |
2667 |
+ } |
2668 |
+ |
2669 |
+ static int byt_get_max_pstate(void) |
2670 |
+ { |
2671 |
+ u64 value; |
2672 |
+ rdmsrl(BYT_RATIOS, value); |
2673 |
+- return (value >> 16) & 0xFF; |
2674 |
++ return (value >> 16) & 0x3F; |
2675 |
+ } |
2676 |
+ |
2677 |
+ static int byt_get_turbo_pstate(void) |
2678 |
+@@ -394,6 +396,9 @@ static void byt_set_pstate(struct cpudata *cpudata, int pstate) |
2679 |
+ vid_fp = clamp_t(int32_t, vid_fp, cpudata->vid.min, cpudata->vid.max); |
2680 |
+ vid = fp_toint(vid_fp); |
2681 |
+ |
2682 |
++ if (pstate > cpudata->pstate.max_pstate) |
2683 |
++ vid = cpudata->vid.turbo; |
2684 |
++ |
2685 |
+ val |= vid; |
2686 |
+ |
2687 |
+ wrmsrl(MSR_IA32_PERF_CTL, val); |
2688 |
+@@ -403,13 +408,17 @@ static void byt_get_vid(struct cpudata *cpudata) |
2689 |
+ { |
2690 |
+ u64 value; |
2691 |
+ |
2692 |
++ |
2693 |
+ rdmsrl(BYT_VIDS, value); |
2694 |
+- cpudata->vid.min = int_tofp((value >> 8) & 0x7f); |
2695 |
+- cpudata->vid.max = int_tofp((value >> 16) & 0x7f); |
2696 |
++ cpudata->vid.min = int_tofp((value >> 8) & 0x3f); |
2697 |
++ cpudata->vid.max = int_tofp((value >> 16) & 0x3f); |
2698 |
+ cpudata->vid.ratio = div_fp( |
2699 |
+ cpudata->vid.max - cpudata->vid.min, |
2700 |
+ int_tofp(cpudata->pstate.max_pstate - |
2701 |
+ cpudata->pstate.min_pstate)); |
2702 |
++ |
2703 |
++ rdmsrl(BYT_TURBO_VIDS, value); |
2704 |
++ cpudata->vid.turbo = value & 0x7f; |
2705 |
+ } |
2706 |
+ |
2707 |
+ |
2708 |
+@@ -546,12 +555,7 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) |
2709 |
+ |
2710 |
+ if (pstate_funcs.get_vid) |
2711 |
+ pstate_funcs.get_vid(cpu); |
2712 |
+- |
2713 |
+- /* |
2714 |
+- * goto max pstate so we don't slow up boot if we are built-in if we are |
2715 |
+- * a module we will take care of it during normal operation |
2716 |
+- */ |
2717 |
+- intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate); |
2718 |
++ intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate); |
2719 |
+ } |
2720 |
+ |
2721 |
+ static inline void intel_pstate_calc_busy(struct cpudata *cpu, |
2722 |
+@@ -697,11 +701,6 @@ static int intel_pstate_init_cpu(unsigned int cpunum) |
2723 |
+ cpu = all_cpu_data[cpunum]; |
2724 |
+ |
2725 |
+ intel_pstate_get_cpu_pstates(cpu); |
2726 |
+- if (!cpu->pstate.current_pstate) { |
2727 |
+- all_cpu_data[cpunum] = NULL; |
2728 |
+- kfree(cpu); |
2729 |
+- return -ENODATA; |
2730 |
+- } |
2731 |
+ |
2732 |
+ cpu->cpu = cpunum; |
2733 |
+ |
2734 |
+@@ -712,7 +711,6 @@ static int intel_pstate_init_cpu(unsigned int cpunum) |
2735 |
+ cpu->timer.expires = jiffies + HZ/100; |
2736 |
+ intel_pstate_busy_pid_reset(cpu); |
2737 |
+ intel_pstate_sample(cpu); |
2738 |
+- intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate); |
2739 |
+ |
2740 |
+ add_timer_on(&cpu->timer, cpunum); |
2741 |
+ |
2742 |
+diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c |
2743 |
+index 8dead6fb28e8..7231967f51b4 100644 |
2744 |
+--- a/drivers/cpufreq/loongson2_cpufreq.c |
2745 |
++++ b/drivers/cpufreq/loongson2_cpufreq.c |
2746 |
+@@ -62,7 +62,7 @@ static int loongson2_cpufreq_target(struct cpufreq_policy *policy, |
2747 |
+ set_cpus_allowed_ptr(current, &cpus_allowed); |
2748 |
+ |
2749 |
+ /* setting the cpu frequency */ |
2750 |
+- clk_set_rate(policy->clk, freq); |
2751 |
++ clk_set_rate(policy->clk, freq * 1000); |
2752 |
+ |
2753 |
+ return 0; |
2754 |
+ } |
2755 |
+@@ -92,7 +92,7 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) |
2756 |
+ i++) |
2757 |
+ loongson2_clockmod_table[i].frequency = (rate * i) / 8; |
2758 |
+ |
2759 |
+- ret = clk_set_rate(cpuclk, rate); |
2760 |
++ ret = clk_set_rate(cpuclk, rate * 1000); |
2761 |
+ if (ret) { |
2762 |
+ clk_put(cpuclk); |
2763 |
+ return ret; |
2764 |
+diff --git a/drivers/crypto/caam/error.c b/drivers/crypto/caam/error.c |
2765 |
+index 9f25f5296029..0eabd81e1a90 100644 |
2766 |
+--- a/drivers/crypto/caam/error.c |
2767 |
++++ b/drivers/crypto/caam/error.c |
2768 |
+@@ -16,9 +16,13 @@ |
2769 |
+ char *tmp; \ |
2770 |
+ \ |
2771 |
+ tmp = kmalloc(sizeof(format) + max_alloc, GFP_ATOMIC); \ |
2772 |
+- sprintf(tmp, format, param); \ |
2773 |
+- strcat(str, tmp); \ |
2774 |
+- kfree(tmp); \ |
2775 |
++ if (likely(tmp)) { \ |
2776 |
++ sprintf(tmp, format, param); \ |
2777 |
++ strcat(str, tmp); \ |
2778 |
++ kfree(tmp); \ |
2779 |
++ } else { \ |
2780 |
++ strcat(str, "kmalloc failure in SPRINTFCAT"); \ |
2781 |
++ } \ |
2782 |
+ } |
2783 |
+ |
2784 |
+ static void report_jump_idx(u32 status, char *outstr) |
2785 |
+diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c |
2786 |
+index ed610b497518..a4068e2d2b5d 100644 |
2787 |
+--- a/drivers/dma/dmaengine.c |
2788 |
++++ b/drivers/dma/dmaengine.c |
2789 |
+@@ -1014,6 +1014,7 @@ static void dmaengine_unmap(struct kref *kref) |
2790 |
+ dma_unmap_page(dev, unmap->addr[i], unmap->len, |
2791 |
+ DMA_BIDIRECTIONAL); |
2792 |
+ } |
2793 |
++ cnt = unmap->map_cnt; |
2794 |
+ mempool_free(unmap, __get_unmap_pool(cnt)->pool); |
2795 |
+ } |
2796 |
+ |
2797 |
+@@ -1079,6 +1080,7 @@ dmaengine_get_unmap_data(struct device *dev, int nr, gfp_t flags) |
2798 |
+ memset(unmap, 0, sizeof(*unmap)); |
2799 |
+ kref_init(&unmap->kref); |
2800 |
+ unmap->dev = dev; |
2801 |
++ unmap->map_cnt = nr; |
2802 |
+ |
2803 |
+ return unmap; |
2804 |
+ } |
2805 |
+diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c |
2806 |
+index 13ac3f240e79..01a200cd0189 100644 |
2807 |
+--- a/drivers/dma/dw/core.c |
2808 |
++++ b/drivers/dma/dw/core.c |
2809 |
+@@ -1545,11 +1545,6 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata) |
2810 |
+ /* Disable BLOCK interrupts as well */ |
2811 |
+ channel_clear_bit(dw, MASK.BLOCK, dw->all_chan_mask); |
2812 |
+ |
2813 |
+- err = devm_request_irq(chip->dev, chip->irq, dw_dma_interrupt, |
2814 |
+- IRQF_SHARED, "dw_dmac", dw); |
2815 |
+- if (err) |
2816 |
+- return err; |
2817 |
+- |
2818 |
+ /* Create a pool of consistent memory blocks for hardware descriptors */ |
2819 |
+ dw->desc_pool = dmam_pool_create("dw_dmac_desc_pool", chip->dev, |
2820 |
+ sizeof(struct dw_desc), 4, 0); |
2821 |
+@@ -1560,6 +1555,11 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata) |
2822 |
+ |
2823 |
+ tasklet_init(&dw->tasklet, dw_dma_tasklet, (unsigned long)dw); |
2824 |
+ |
2825 |
++ err = request_irq(chip->irq, dw_dma_interrupt, IRQF_SHARED, |
2826 |
++ "dw_dmac", dw); |
2827 |
++ if (err) |
2828 |
++ return err; |
2829 |
++ |
2830 |
+ INIT_LIST_HEAD(&dw->dma.channels); |
2831 |
+ for (i = 0; i < nr_channels; i++) { |
2832 |
+ struct dw_dma_chan *dwc = &dw->chan[i]; |
2833 |
+@@ -1664,6 +1664,7 @@ int dw_dma_remove(struct dw_dma_chip *chip) |
2834 |
+ dw_dma_off(dw); |
2835 |
+ dma_async_device_unregister(&dw->dma); |
2836 |
+ |
2837 |
++ free_irq(chip->irq, dw); |
2838 |
+ tasklet_kill(&dw->tasklet); |
2839 |
+ |
2840 |
+ list_for_each_entry_safe(dwc, _dwc, &dw->dma.channels, |
2841 |
+diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c |
2842 |
+index 766b68ed505c..394cbc5c93e3 100644 |
2843 |
+--- a/drivers/dma/mv_xor.c |
2844 |
++++ b/drivers/dma/mv_xor.c |
2845 |
+@@ -191,12 +191,10 @@ static void mv_set_mode(struct mv_xor_chan *chan, |
2846 |
+ |
2847 |
+ static void mv_chan_activate(struct mv_xor_chan *chan) |
2848 |
+ { |
2849 |
+- u32 activation; |
2850 |
+- |
2851 |
+ dev_dbg(mv_chan_to_devp(chan), " activate chan.\n"); |
2852 |
+- activation = readl_relaxed(XOR_ACTIVATION(chan)); |
2853 |
+- activation |= 0x1; |
2854 |
+- writel_relaxed(activation, XOR_ACTIVATION(chan)); |
2855 |
++ |
2856 |
++ /* writel ensures all descriptors are flushed before activation */ |
2857 |
++ writel(BIT(0), XOR_ACTIVATION(chan)); |
2858 |
+ } |
2859 |
+ |
2860 |
+ static char mv_chan_is_busy(struct mv_xor_chan *chan) |
2861 |
+diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c |
2862 |
+index ec7bb0fc71bc..9debd6e74439 100644 |
2863 |
+--- a/drivers/gpu/drm/i915/i915_drv.c |
2864 |
++++ b/drivers/gpu/drm/i915/i915_drv.c |
2865 |
+@@ -614,15 +614,20 @@ static void intel_resume_hotplug(struct drm_device *dev) |
2866 |
+ drm_helper_hpd_irq_event(dev); |
2867 |
+ } |
2868 |
+ |
2869 |
++static int i915_drm_thaw_early(struct drm_device *dev) |
2870 |
++{ |
2871 |
++ intel_uncore_early_sanitize(dev); |
2872 |
++ intel_uncore_sanitize(dev); |
2873 |
++ intel_power_domains_init_hw(dev); |
2874 |
++ |
2875 |
++ return 0; |
2876 |
++} |
2877 |
++ |
2878 |
+ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings) |
2879 |
+ { |
2880 |
+ struct drm_i915_private *dev_priv = dev->dev_private; |
2881 |
+ int error = 0; |
2882 |
+ |
2883 |
+- intel_uncore_early_sanitize(dev); |
2884 |
+- |
2885 |
+- intel_uncore_sanitize(dev); |
2886 |
+- |
2887 |
+ if (drm_core_check_feature(dev, DRIVER_MODESET) && |
2888 |
+ restore_gtt_mappings) { |
2889 |
+ mutex_lock(&dev->struct_mutex); |
2890 |
+@@ -630,8 +635,6 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings) |
2891 |
+ mutex_unlock(&dev->struct_mutex); |
2892 |
+ } |
2893 |
+ |
2894 |
+- intel_power_domains_init_hw(dev); |
2895 |
+- |
2896 |
+ i915_restore_state(dev); |
2897 |
+ intel_opregion_setup(dev); |
2898 |
+ |
2899 |
+@@ -700,19 +703,33 @@ static int i915_drm_thaw(struct drm_device *dev) |
2900 |
+ return __i915_drm_thaw(dev, true); |
2901 |
+ } |
2902 |
+ |
2903 |
+-int i915_resume(struct drm_device *dev) |
2904 |
++static int i915_resume_early(struct drm_device *dev) |
2905 |
+ { |
2906 |
+- struct drm_i915_private *dev_priv = dev->dev_private; |
2907 |
+- int ret; |
2908 |
+- |
2909 |
+ if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
2910 |
+ return 0; |
2911 |
+ |
2912 |
++ /* |
2913 |
++ * We have a resume ordering issue with the snd-hda driver also |
2914 |
++ * requiring our device to be power up. Due to the lack of a |
2915 |
++ * parent/child relationship we currently solve this with an early |
2916 |
++ * resume hook. |
2917 |
++ * |
2918 |
++ * FIXME: This should be solved with a special hdmi sink device or |
2919 |
++ * similar so that power domains can be employed. |
2920 |
++ */ |
2921 |
+ if (pci_enable_device(dev->pdev)) |
2922 |
+ return -EIO; |
2923 |
+ |
2924 |
+ pci_set_master(dev->pdev); |
2925 |
+ |
2926 |
++ return i915_drm_thaw_early(dev); |
2927 |
++} |
2928 |
++ |
2929 |
++int i915_resume(struct drm_device *dev) |
2930 |
++{ |
2931 |
++ struct drm_i915_private *dev_priv = dev->dev_private; |
2932 |
++ int ret; |
2933 |
++ |
2934 |
+ /* |
2935 |
+ * Platforms with opregion should have sane BIOS, older ones (gen3 and |
2936 |
+ * earlier) need to restore the GTT mappings since the BIOS might clear |
2937 |
+@@ -726,6 +743,14 @@ int i915_resume(struct drm_device *dev) |
2938 |
+ return 0; |
2939 |
+ } |
2940 |
+ |
2941 |
++static int i915_resume_legacy(struct drm_device *dev) |
2942 |
++{ |
2943 |
++ i915_resume_early(dev); |
2944 |
++ i915_resume(dev); |
2945 |
++ |
2946 |
++ return 0; |
2947 |
++} |
2948 |
++ |
2949 |
+ /** |
2950 |
+ * i915_reset - reset chip after a hang |
2951 |
+ * @dev: drm device to reset |
2952 |
+@@ -846,7 +871,6 @@ static int i915_pm_suspend(struct device *dev) |
2953 |
+ { |
2954 |
+ struct pci_dev *pdev = to_pci_dev(dev); |
2955 |
+ struct drm_device *drm_dev = pci_get_drvdata(pdev); |
2956 |
+- int error; |
2957 |
+ |
2958 |
+ if (!drm_dev || !drm_dev->dev_private) { |
2959 |
+ dev_err(dev, "DRM not initialized, aborting suspend.\n"); |
2960 |
+@@ -856,9 +880,25 @@ static int i915_pm_suspend(struct device *dev) |
2961 |
+ if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
2962 |
+ return 0; |
2963 |
+ |
2964 |
+- error = i915_drm_freeze(drm_dev); |
2965 |
+- if (error) |
2966 |
+- return error; |
2967 |
++ return i915_drm_freeze(drm_dev); |
2968 |
++} |
2969 |
++ |
2970 |
++static int i915_pm_suspend_late(struct device *dev) |
2971 |
++{ |
2972 |
++ struct pci_dev *pdev = to_pci_dev(dev); |
2973 |
++ struct drm_device *drm_dev = pci_get_drvdata(pdev); |
2974 |
++ |
2975 |
++ /* |
2976 |
++ * We have a suspedn ordering issue with the snd-hda driver also |
2977 |
++ * requiring our device to be power up. Due to the lack of a |
2978 |
++ * parent/child relationship we currently solve this with an late |
2979 |
++ * suspend hook. |
2980 |
++ * |
2981 |
++ * FIXME: This should be solved with a special hdmi sink device or |
2982 |
++ * similar so that power domains can be employed. |
2983 |
++ */ |
2984 |
++ if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
2985 |
++ return 0; |
2986 |
+ |
2987 |
+ pci_disable_device(pdev); |
2988 |
+ pci_set_power_state(pdev, PCI_D3hot); |
2989 |
+@@ -866,6 +906,14 @@ static int i915_pm_suspend(struct device *dev) |
2990 |
+ return 0; |
2991 |
+ } |
2992 |
+ |
2993 |
++static int i915_pm_resume_early(struct device *dev) |
2994 |
++{ |
2995 |
++ struct pci_dev *pdev = to_pci_dev(dev); |
2996 |
++ struct drm_device *drm_dev = pci_get_drvdata(pdev); |
2997 |
++ |
2998 |
++ return i915_resume_early(drm_dev); |
2999 |
++} |
3000 |
++ |
3001 |
+ static int i915_pm_resume(struct device *dev) |
3002 |
+ { |
3003 |
+ struct pci_dev *pdev = to_pci_dev(dev); |
3004 |
+@@ -887,6 +935,14 @@ static int i915_pm_freeze(struct device *dev) |
3005 |
+ return i915_drm_freeze(drm_dev); |
3006 |
+ } |
3007 |
+ |
3008 |
++static int i915_pm_thaw_early(struct device *dev) |
3009 |
++{ |
3010 |
++ struct pci_dev *pdev = to_pci_dev(dev); |
3011 |
++ struct drm_device *drm_dev = pci_get_drvdata(pdev); |
3012 |
++ |
3013 |
++ return i915_drm_thaw_early(drm_dev); |
3014 |
++} |
3015 |
++ |
3016 |
+ static int i915_pm_thaw(struct device *dev) |
3017 |
+ { |
3018 |
+ struct pci_dev *pdev = to_pci_dev(dev); |
3019 |
+@@ -948,10 +1004,14 @@ static int i915_runtime_resume(struct device *device) |
3020 |
+ |
3021 |
+ static const struct dev_pm_ops i915_pm_ops = { |
3022 |
+ .suspend = i915_pm_suspend, |
3023 |
++ .suspend_late = i915_pm_suspend_late, |
3024 |
++ .resume_early = i915_pm_resume_early, |
3025 |
+ .resume = i915_pm_resume, |
3026 |
+ .freeze = i915_pm_freeze, |
3027 |
++ .thaw_early = i915_pm_thaw_early, |
3028 |
+ .thaw = i915_pm_thaw, |
3029 |
+ .poweroff = i915_pm_poweroff, |
3030 |
++ .restore_early = i915_pm_resume_early, |
3031 |
+ .restore = i915_pm_resume, |
3032 |
+ .runtime_suspend = i915_runtime_suspend, |
3033 |
+ .runtime_resume = i915_runtime_resume, |
3034 |
+@@ -994,7 +1054,7 @@ static struct drm_driver driver = { |
3035 |
+ |
3036 |
+ /* Used in place of i915_pm_ops for non-DRIVER_MODESET */ |
3037 |
+ .suspend = i915_suspend, |
3038 |
+- .resume = i915_resume, |
3039 |
++ .resume = i915_resume_legacy, |
3040 |
+ |
3041 |
+ .device_is_agp = i915_driver_device_is_agp, |
3042 |
+ .master_create = i915_master_create, |
3043 |
+diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c |
3044 |
+index 00c836154725..3ecb332e7cfa 100644 |
3045 |
+--- a/drivers/gpu/drm/i915/i915_gem.c |
3046 |
++++ b/drivers/gpu/drm/i915/i915_gem.c |
3047 |
+@@ -3529,7 +3529,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj, |
3048 |
+ { |
3049 |
+ struct drm_device *dev = obj->base.dev; |
3050 |
+ drm_i915_private_t *dev_priv = dev->dev_private; |
3051 |
+- struct i915_vma *vma; |
3052 |
++ struct i915_vma *vma, *next; |
3053 |
+ int ret; |
3054 |
+ |
3055 |
+ if (obj->cache_level == cache_level) |
3056 |
+@@ -3540,7 +3540,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj, |
3057 |
+ return -EBUSY; |
3058 |
+ } |
3059 |
+ |
3060 |
+- list_for_each_entry(vma, &obj->vma_list, vma_link) { |
3061 |
++ list_for_each_entry_safe(vma, next, &obj->vma_list, vma_link) { |
3062 |
+ if (!i915_gem_valid_gtt_space(dev, &vma->node, cache_level)) { |
3063 |
+ ret = i915_vma_unbind(vma); |
3064 |
+ if (ret) |
3065 |
+diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c |
3066 |
+index d554169ac592..40504504c9e2 100644 |
3067 |
+--- a/drivers/gpu/drm/i915/i915_irq.c |
3068 |
++++ b/drivers/gpu/drm/i915/i915_irq.c |
3069 |
+@@ -1252,10 +1252,20 @@ static inline void intel_hpd_irq_handler(struct drm_device *dev, |
3070 |
+ spin_lock(&dev_priv->irq_lock); |
3071 |
+ for (i = 1; i < HPD_NUM_PINS; i++) { |
3072 |
+ |
3073 |
+- WARN_ONCE(hpd[i] & hotplug_trigger && |
3074 |
+- dev_priv->hpd_stats[i].hpd_mark == HPD_DISABLED, |
3075 |
+- "Received HPD interrupt (0x%08x) on pin %d (0x%08x) although disabled\n", |
3076 |
+- hotplug_trigger, i, hpd[i]); |
3077 |
++ if (hpd[i] & hotplug_trigger && |
3078 |
++ dev_priv->hpd_stats[i].hpd_mark == HPD_DISABLED) { |
3079 |
++ /* |
3080 |
++ * On GMCH platforms the interrupt mask bits only |
3081 |
++ * prevent irq generation, not the setting of the |
3082 |
++ * hotplug bits itself. So only WARN about unexpected |
3083 |
++ * interrupts on saner platforms. |
3084 |
++ */ |
3085 |
++ WARN_ONCE(INTEL_INFO(dev)->gen >= 5 && !IS_VALLEYVIEW(dev), |
3086 |
++ "Received HPD interrupt (0x%08x) on pin %d (0x%08x) although disabled\n", |
3087 |
++ hotplug_trigger, i, hpd[i]); |
3088 |
++ |
3089 |
++ continue; |
3090 |
++ } |
3091 |
+ |
3092 |
+ if (!(hpd[i] & hotplug_trigger) || |
3093 |
+ dev_priv->hpd_stats[i].hpd_mark != HPD_ENABLED) |
3094 |
+diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
3095 |
+index 963639d9049b..9d4d837506d0 100644 |
3096 |
+--- a/drivers/gpu/drm/i915/intel_display.c |
3097 |
++++ b/drivers/gpu/drm/i915/intel_display.c |
3098 |
+@@ -9354,11 +9354,22 @@ intel_pipe_config_compare(struct drm_device *dev, |
3099 |
+ PIPE_CONF_CHECK_I(pipe_src_w); |
3100 |
+ PIPE_CONF_CHECK_I(pipe_src_h); |
3101 |
+ |
3102 |
+- PIPE_CONF_CHECK_I(gmch_pfit.control); |
3103 |
+- /* pfit ratios are autocomputed by the hw on gen4+ */ |
3104 |
+- if (INTEL_INFO(dev)->gen < 4) |
3105 |
+- PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios); |
3106 |
+- PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits); |
3107 |
++ /* |
3108 |
++ * FIXME: BIOS likes to set up a cloned config with lvds+external |
3109 |
++ * screen. Since we don't yet re-compute the pipe config when moving |
3110 |
++ * just the lvds port away to another pipe the sw tracking won't match. |
3111 |
++ * |
3112 |
++ * Proper atomic modesets with recomputed global state will fix this. |
3113 |
++ * Until then just don't check gmch state for inherited modes. |
3114 |
++ */ |
3115 |
++ if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_INHERITED_MODE)) { |
3116 |
++ PIPE_CONF_CHECK_I(gmch_pfit.control); |
3117 |
++ /* pfit ratios are autocomputed by the hw on gen4+ */ |
3118 |
++ if (INTEL_INFO(dev)->gen < 4) |
3119 |
++ PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios); |
3120 |
++ PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits); |
3121 |
++ } |
3122 |
++ |
3123 |
+ PIPE_CONF_CHECK_I(pch_pfit.enabled); |
3124 |
+ if (current_config->pch_pfit.enabled) { |
3125 |
+ PIPE_CONF_CHECK_I(pch_pfit.pos); |
3126 |
+@@ -10851,6 +10862,9 @@ static struct intel_quirk intel_quirks[] = { |
3127 |
+ /* Acer Aspire 4736Z */ |
3128 |
+ { 0x2a42, 0x1025, 0x0260, quirk_invert_brightness }, |
3129 |
+ |
3130 |
++ /* Acer Aspire 5336 */ |
3131 |
++ { 0x2a42, 0x1025, 0x048a, quirk_invert_brightness }, |
3132 |
++ |
3133 |
+ /* Dell XPS13 HD Sandy Bridge */ |
3134 |
+ { 0x0116, 0x1028, 0x052e, quirk_no_pcm_pwm_enable }, |
3135 |
+ /* Dell XPS13 HD and XPS13 FHD Ivy Bridge */ |
3136 |
+@@ -10978,15 +10992,6 @@ void intel_modeset_init(struct drm_device *dev) |
3137 |
+ intel_disable_fbc(dev); |
3138 |
+ } |
3139 |
+ |
3140 |
+-static void |
3141 |
+-intel_connector_break_all_links(struct intel_connector *connector) |
3142 |
+-{ |
3143 |
+- connector->base.dpms = DRM_MODE_DPMS_OFF; |
3144 |
+- connector->base.encoder = NULL; |
3145 |
+- connector->encoder->connectors_active = false; |
3146 |
+- connector->encoder->base.crtc = NULL; |
3147 |
+-} |
3148 |
+- |
3149 |
+ static void intel_enable_pipe_a(struct drm_device *dev) |
3150 |
+ { |
3151 |
+ struct intel_connector *connector; |
3152 |
+@@ -11068,8 +11073,17 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc) |
3153 |
+ if (connector->encoder->base.crtc != &crtc->base) |
3154 |
+ continue; |
3155 |
+ |
3156 |
+- intel_connector_break_all_links(connector); |
3157 |
++ connector->base.dpms = DRM_MODE_DPMS_OFF; |
3158 |
++ connector->base.encoder = NULL; |
3159 |
+ } |
3160 |
++ /* multiple connectors may have the same encoder: |
3161 |
++ * handle them and break crtc link separately */ |
3162 |
++ list_for_each_entry(connector, &dev->mode_config.connector_list, |
3163 |
++ base.head) |
3164 |
++ if (connector->encoder->base.crtc == &crtc->base) { |
3165 |
++ connector->encoder->base.crtc = NULL; |
3166 |
++ connector->encoder->connectors_active = false; |
3167 |
++ } |
3168 |
+ |
3169 |
+ WARN_ON(crtc->active); |
3170 |
+ crtc->base.enabled = false; |
3171 |
+@@ -11140,6 +11154,8 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder) |
3172 |
+ drm_get_encoder_name(&encoder->base)); |
3173 |
+ encoder->disable(encoder); |
3174 |
+ } |
3175 |
++ encoder->base.crtc = NULL; |
3176 |
++ encoder->connectors_active = false; |
3177 |
+ |
3178 |
+ /* Inconsistent output/port/pipe state happens presumably due to |
3179 |
+ * a bug in one of the get_hw_state functions. Or someplace else |
3180 |
+@@ -11150,8 +11166,8 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder) |
3181 |
+ base.head) { |
3182 |
+ if (connector->encoder != encoder) |
3183 |
+ continue; |
3184 |
+- |
3185 |
+- intel_connector_break_all_links(connector); |
3186 |
++ connector->base.dpms = DRM_MODE_DPMS_OFF; |
3187 |
++ connector->base.encoder = NULL; |
3188 |
+ } |
3189 |
+ } |
3190 |
+ /* Enabled encoders without active connectors will be fixed in |
3191 |
+@@ -11193,6 +11209,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) |
3192 |
+ base.head) { |
3193 |
+ memset(&crtc->config, 0, sizeof(crtc->config)); |
3194 |
+ |
3195 |
++ crtc->config.quirks |= PIPE_CONFIG_QUIRK_INHERITED_MODE; |
3196 |
++ |
3197 |
+ crtc->active = dev_priv->display.get_pipe_config(crtc, |
3198 |
+ &crtc->config); |
3199 |
+ |
3200 |
+diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h |
3201 |
+index fbfaaba5cc3b..00de120531ac 100644 |
3202 |
+--- a/drivers/gpu/drm/i915/intel_drv.h |
3203 |
++++ b/drivers/gpu/drm/i915/intel_drv.h |
3204 |
+@@ -219,7 +219,8 @@ struct intel_crtc_config { |
3205 |
+ * tracked with quirk flags so that fastboot and state checker can act |
3206 |
+ * accordingly. |
3207 |
+ */ |
3208 |
+-#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */ |
3209 |
++#define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */ |
3210 |
++#define PIPE_CONFIG_QUIRK_INHERITED_MODE (1<<1) /* mode inherited from firmware */ |
3211 |
+ unsigned long quirks; |
3212 |
+ |
3213 |
+ /* User requested mode, only valid as a starting point to |
3214 |
+diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c |
3215 |
+index ee3181ebcc92..ca5d23d17d20 100644 |
3216 |
+--- a/drivers/gpu/drm/i915/intel_hdmi.c |
3217 |
++++ b/drivers/gpu/drm/i915/intel_hdmi.c |
3218 |
+@@ -841,11 +841,11 @@ static void intel_disable_hdmi(struct intel_encoder *encoder) |
3219 |
+ } |
3220 |
+ } |
3221 |
+ |
3222 |
+-static int hdmi_portclock_limit(struct intel_hdmi *hdmi) |
3223 |
++static int hdmi_portclock_limit(struct intel_hdmi *hdmi, bool respect_dvi_limit) |
3224 |
+ { |
3225 |
+ struct drm_device *dev = intel_hdmi_to_dev(hdmi); |
3226 |
+ |
3227 |
+- if (!hdmi->has_hdmi_sink || IS_G4X(dev)) |
3228 |
++ if ((respect_dvi_limit && !hdmi->has_hdmi_sink) || IS_G4X(dev)) |
3229 |
+ return 165000; |
3230 |
+ else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8) |
3231 |
+ return 300000; |
3232 |
+@@ -857,7 +857,8 @@ static enum drm_mode_status |
3233 |
+ intel_hdmi_mode_valid(struct drm_connector *connector, |
3234 |
+ struct drm_display_mode *mode) |
3235 |
+ { |
3236 |
+- if (mode->clock > hdmi_portclock_limit(intel_attached_hdmi(connector))) |
3237 |
++ if (mode->clock > hdmi_portclock_limit(intel_attached_hdmi(connector), |
3238 |
++ true)) |
3239 |
+ return MODE_CLOCK_HIGH; |
3240 |
+ if (mode->clock < 20000) |
3241 |
+ return MODE_CLOCK_LOW; |
3242 |
+@@ -875,7 +876,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, |
3243 |
+ struct drm_device *dev = encoder->base.dev; |
3244 |
+ struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; |
3245 |
+ int clock_12bpc = pipe_config->adjusted_mode.crtc_clock * 3 / 2; |
3246 |
+- int portclock_limit = hdmi_portclock_limit(intel_hdmi); |
3247 |
++ int portclock_limit = hdmi_portclock_limit(intel_hdmi, false); |
3248 |
+ int desired_bpp; |
3249 |
+ |
3250 |
+ if (intel_hdmi->color_range_auto) { |
3251 |
+diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c |
3252 |
+index 9f1d7a9300e8..19a4f0535b63 100644 |
3253 |
+--- a/drivers/gpu/drm/i915/intel_panel.c |
3254 |
++++ b/drivers/gpu/drm/i915/intel_panel.c |
3255 |
+@@ -501,6 +501,7 @@ void intel_panel_set_backlight(struct intel_connector *connector, u32 level, |
3256 |
+ enum pipe pipe = intel_get_pipe_from_connector(connector); |
3257 |
+ u32 freq; |
3258 |
+ unsigned long flags; |
3259 |
++ u64 n; |
3260 |
+ |
3261 |
+ if (!panel->backlight.present || pipe == INVALID_PIPE) |
3262 |
+ return; |
3263 |
+@@ -511,10 +512,9 @@ void intel_panel_set_backlight(struct intel_connector *connector, u32 level, |
3264 |
+ |
3265 |
+ /* scale to hardware max, but be careful to not overflow */ |
3266 |
+ freq = panel->backlight.max; |
3267 |
+- if (freq < max) |
3268 |
+- level = level * freq / max; |
3269 |
+- else |
3270 |
+- level = freq / max * level; |
3271 |
++ n = (u64)level * freq; |
3272 |
++ do_div(n, max); |
3273 |
++ level = n; |
3274 |
+ |
3275 |
+ panel->backlight.level = level; |
3276 |
+ if (panel->backlight.device) |
3277 |
+diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c |
3278 |
+index e1fc35a72656..bd1b00344dac 100644 |
3279 |
+--- a/drivers/gpu/drm/i915/intel_pm.c |
3280 |
++++ b/drivers/gpu/drm/i915/intel_pm.c |
3281 |
+@@ -1539,6 +1539,16 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc) |
3282 |
+ |
3283 |
+ DRM_DEBUG_KMS("FIFO watermarks - A: %d, B: %d\n", planea_wm, planeb_wm); |
3284 |
+ |
3285 |
++ if (IS_I915GM(dev) && enabled) { |
3286 |
++ struct intel_framebuffer *fb; |
3287 |
++ |
3288 |
++ fb = to_intel_framebuffer(enabled->fb); |
3289 |
++ |
3290 |
++ /* self-refresh seems busted with untiled */ |
3291 |
++ if (fb->obj->tiling_mode == I915_TILING_NONE) |
3292 |
++ enabled = NULL; |
3293 |
++ } |
3294 |
++ |
3295 |
+ /* |
3296 |
+ * Overlay gets an aggressive default since video jitter is bad. |
3297 |
+ */ |
3298 |
+diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c |
3299 |
+index 87df68f5f504..c8796316d242 100644 |
3300 |
+--- a/drivers/gpu/drm/i915/intel_uncore.c |
3301 |
++++ b/drivers/gpu/drm/i915/intel_uncore.c |
3302 |
+@@ -177,6 +177,8 @@ static void vlv_force_wake_reset(struct drm_i915_private *dev_priv) |
3303 |
+ { |
3304 |
+ __raw_i915_write32(dev_priv, FORCEWAKE_VLV, |
3305 |
+ _MASKED_BIT_DISABLE(0xffff)); |
3306 |
++ __raw_i915_write32(dev_priv, FORCEWAKE_MEDIA_VLV, |
3307 |
++ _MASKED_BIT_DISABLE(0xffff)); |
3308 |
+ /* something from same cacheline, but !FORCEWAKE_VLV */ |
3309 |
+ __raw_posting_read(dev_priv, FORCEWAKE_ACK_VLV); |
3310 |
+ } |
3311 |
+diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c b/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c |
3312 |
+index 95f6129eeede..29d4c417a5b3 100644 |
3313 |
+--- a/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c |
3314 |
++++ b/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c |
3315 |
+@@ -54,8 +54,10 @@ nouveau_fan_update(struct nouveau_fan *fan, bool immediate, int target) |
3316 |
+ |
3317 |
+ /* check that we're not already at the target duty cycle */ |
3318 |
+ duty = fan->get(therm); |
3319 |
+- if (duty == target) |
3320 |
+- goto done; |
3321 |
++ if (duty == target) { |
3322 |
++ spin_unlock_irqrestore(&fan->lock, flags); |
3323 |
++ return 0; |
3324 |
++ } |
3325 |
+ |
3326 |
+ /* smooth out the fanspeed increase/decrease */ |
3327 |
+ if (!immediate && duty >= 0) { |
3328 |
+@@ -73,8 +75,15 @@ nouveau_fan_update(struct nouveau_fan *fan, bool immediate, int target) |
3329 |
+ |
3330 |
+ nv_debug(therm, "FAN update: %d\n", duty); |
3331 |
+ ret = fan->set(therm, duty); |
3332 |
+- if (ret) |
3333 |
+- goto done; |
3334 |
++ if (ret) { |
3335 |
++ spin_unlock_irqrestore(&fan->lock, flags); |
3336 |
++ return ret; |
3337 |
++ } |
3338 |
++ |
3339 |
++ /* fan speed updated, drop the fan lock before grabbing the |
3340 |
++ * alarm-scheduling lock and risking a deadlock |
3341 |
++ */ |
3342 |
++ spin_unlock_irqrestore(&fan->lock, flags); |
3343 |
+ |
3344 |
+ /* schedule next fan update, if not at target speed already */ |
3345 |
+ if (list_empty(&fan->alarm.head) && target != duty) { |
3346 |
+@@ -92,8 +101,6 @@ nouveau_fan_update(struct nouveau_fan *fan, bool immediate, int target) |
3347 |
+ ptimer->alarm(ptimer, delay * 1000 * 1000, &fan->alarm); |
3348 |
+ } |
3349 |
+ |
3350 |
+-done: |
3351 |
+- spin_unlock_irqrestore(&fan->lock, flags); |
3352 |
+ return ret; |
3353 |
+ } |
3354 |
+ |
3355 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c |
3356 |
+index 83face3f608f..279206997e5c 100644 |
3357 |
+--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c |
3358 |
++++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c |
3359 |
+@@ -389,9 +389,6 @@ bool nouveau_acpi_rom_supported(struct pci_dev *pdev) |
3360 |
+ acpi_status status; |
3361 |
+ acpi_handle dhandle, rom_handle; |
3362 |
+ |
3363 |
+- if (!nouveau_dsm_priv.dsm_detected && !nouveau_dsm_priv.optimus_detected) |
3364 |
+- return false; |
3365 |
+- |
3366 |
+ dhandle = ACPI_HANDLE(&pdev->dev); |
3367 |
+ if (!dhandle) |
3368 |
+ return false; |
3369 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c |
3370 |
+index 24011596af43..5524a3705224 100644 |
3371 |
+--- a/drivers/gpu/drm/nouveau/nouveau_display.c |
3372 |
++++ b/drivers/gpu/drm/nouveau/nouveau_display.c |
3373 |
+@@ -762,9 +762,9 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, |
3374 |
+ } |
3375 |
+ |
3376 |
+ ret = nouveau_page_flip_emit(chan, old_bo, new_bo, s, &fence); |
3377 |
+- mutex_unlock(&chan->cli->mutex); |
3378 |
+ if (ret) |
3379 |
+ goto fail_unreserve; |
3380 |
++ mutex_unlock(&chan->cli->mutex); |
3381 |
+ |
3382 |
+ /* Update the crtc struct and cleanup */ |
3383 |
+ crtc->fb = fb; |
3384 |
+diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c |
3385 |
+index 8d49104ca6c2..9241e96f8502 100644 |
3386 |
+--- a/drivers/gpu/drm/radeon/ci_dpm.c |
3387 |
++++ b/drivers/gpu/drm/radeon/ci_dpm.c |
3388 |
+@@ -21,8 +21,10 @@ |
3389 |
+ * |
3390 |
+ */ |
3391 |
+ |
3392 |
++#include <linux/firmware.h> |
3393 |
+ #include "drmP.h" |
3394 |
+ #include "radeon.h" |
3395 |
++#include "radeon_ucode.h" |
3396 |
+ #include "cikd.h" |
3397 |
+ #include "r600_dpm.h" |
3398 |
+ #include "ci_dpm.h" |
3399 |
+@@ -5106,6 +5108,12 @@ int ci_dpm_init(struct radeon_device *rdev) |
3400 |
+ pi->mclk_dpm_key_disabled = 0; |
3401 |
+ pi->pcie_dpm_key_disabled = 0; |
3402 |
+ |
3403 |
++ /* mclk dpm is unstable on some R7 260X cards with the old mc ucode */ |
3404 |
++ if ((rdev->pdev->device == 0x6658) && |
3405 |
++ (rdev->mc_fw->size == (BONAIRE_MC_UCODE_SIZE * 4))) { |
3406 |
++ pi->mclk_dpm_key_disabled = 1; |
3407 |
++ } |
3408 |
++ |
3409 |
+ pi->caps_sclk_ds = true; |
3410 |
+ |
3411 |
+ pi->mclk_strobe_mode_threshold = 40000; |
3412 |
+diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c |
3413 |
+index 986f9e7364ca..270f68a6b724 100644 |
3414 |
+--- a/drivers/gpu/drm/radeon/cik.c |
3415 |
++++ b/drivers/gpu/drm/radeon/cik.c |
3416 |
+@@ -38,6 +38,7 @@ MODULE_FIRMWARE("radeon/BONAIRE_me.bin"); |
3417 |
+ MODULE_FIRMWARE("radeon/BONAIRE_ce.bin"); |
3418 |
+ MODULE_FIRMWARE("radeon/BONAIRE_mec.bin"); |
3419 |
+ MODULE_FIRMWARE("radeon/BONAIRE_mc.bin"); |
3420 |
++MODULE_FIRMWARE("radeon/BONAIRE_mc2.bin"); |
3421 |
+ MODULE_FIRMWARE("radeon/BONAIRE_rlc.bin"); |
3422 |
+ MODULE_FIRMWARE("radeon/BONAIRE_sdma.bin"); |
3423 |
+ MODULE_FIRMWARE("radeon/BONAIRE_smc.bin"); |
3424 |
+@@ -46,6 +47,7 @@ MODULE_FIRMWARE("radeon/HAWAII_me.bin"); |
3425 |
+ MODULE_FIRMWARE("radeon/HAWAII_ce.bin"); |
3426 |
+ MODULE_FIRMWARE("radeon/HAWAII_mec.bin"); |
3427 |
+ MODULE_FIRMWARE("radeon/HAWAII_mc.bin"); |
3428 |
++MODULE_FIRMWARE("radeon/HAWAII_mc2.bin"); |
3429 |
+ MODULE_FIRMWARE("radeon/HAWAII_rlc.bin"); |
3430 |
+ MODULE_FIRMWARE("radeon/HAWAII_sdma.bin"); |
3431 |
+ MODULE_FIRMWARE("radeon/HAWAII_smc.bin"); |
3432 |
+@@ -1702,20 +1704,20 @@ int ci_mc_load_microcode(struct radeon_device *rdev) |
3433 |
+ const __be32 *fw_data; |
3434 |
+ u32 running, blackout = 0; |
3435 |
+ u32 *io_mc_regs; |
3436 |
+- int i, ucode_size, regs_size; |
3437 |
++ int i, regs_size, ucode_size; |
3438 |
+ |
3439 |
+ if (!rdev->mc_fw) |
3440 |
+ return -EINVAL; |
3441 |
+ |
3442 |
++ ucode_size = rdev->mc_fw->size / 4; |
3443 |
++ |
3444 |
+ switch (rdev->family) { |
3445 |
+ case CHIP_BONAIRE: |
3446 |
+ io_mc_regs = (u32 *)&bonaire_io_mc_regs; |
3447 |
+- ucode_size = CIK_MC_UCODE_SIZE; |
3448 |
+ regs_size = BONAIRE_IO_MC_REGS_SIZE; |
3449 |
+ break; |
3450 |
+ case CHIP_HAWAII: |
3451 |
+ io_mc_regs = (u32 *)&hawaii_io_mc_regs; |
3452 |
+- ucode_size = HAWAII_MC_UCODE_SIZE; |
3453 |
+ regs_size = HAWAII_IO_MC_REGS_SIZE; |
3454 |
+ break; |
3455 |
+ default: |
3456 |
+@@ -1782,7 +1784,7 @@ static int cik_init_microcode(struct radeon_device *rdev) |
3457 |
+ const char *chip_name; |
3458 |
+ size_t pfp_req_size, me_req_size, ce_req_size, |
3459 |
+ mec_req_size, rlc_req_size, mc_req_size = 0, |
3460 |
+- sdma_req_size, smc_req_size = 0; |
3461 |
++ sdma_req_size, smc_req_size = 0, mc2_req_size = 0; |
3462 |
+ char fw_name[30]; |
3463 |
+ int err; |
3464 |
+ |
3465 |
+@@ -1796,7 +1798,8 @@ static int cik_init_microcode(struct radeon_device *rdev) |
3466 |
+ ce_req_size = CIK_CE_UCODE_SIZE * 4; |
3467 |
+ mec_req_size = CIK_MEC_UCODE_SIZE * 4; |
3468 |
+ rlc_req_size = BONAIRE_RLC_UCODE_SIZE * 4; |
3469 |
+- mc_req_size = CIK_MC_UCODE_SIZE * 4; |
3470 |
++ mc_req_size = BONAIRE_MC_UCODE_SIZE * 4; |
3471 |
++ mc2_req_size = BONAIRE_MC2_UCODE_SIZE * 4; |
3472 |
+ sdma_req_size = CIK_SDMA_UCODE_SIZE * 4; |
3473 |
+ smc_req_size = ALIGN(BONAIRE_SMC_UCODE_SIZE, 4); |
3474 |
+ break; |
3475 |
+@@ -1808,6 +1811,7 @@ static int cik_init_microcode(struct radeon_device *rdev) |
3476 |
+ mec_req_size = CIK_MEC_UCODE_SIZE * 4; |
3477 |
+ rlc_req_size = BONAIRE_RLC_UCODE_SIZE * 4; |
3478 |
+ mc_req_size = HAWAII_MC_UCODE_SIZE * 4; |
3479 |
++ mc2_req_size = HAWAII_MC2_UCODE_SIZE * 4; |
3480 |
+ sdma_req_size = CIK_SDMA_UCODE_SIZE * 4; |
3481 |
+ smc_req_size = ALIGN(HAWAII_SMC_UCODE_SIZE, 4); |
3482 |
+ break; |
3483 |
+@@ -1903,16 +1907,22 @@ static int cik_init_microcode(struct radeon_device *rdev) |
3484 |
+ |
3485 |
+ /* No SMC, MC ucode on APUs */ |
3486 |
+ if (!(rdev->flags & RADEON_IS_IGP)) { |
3487 |
+- snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); |
3488 |
++ snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc2.bin", chip_name); |
3489 |
+ err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); |
3490 |
+- if (err) |
3491 |
+- goto out; |
3492 |
+- if (rdev->mc_fw->size != mc_req_size) { |
3493 |
++ if (err) { |
3494 |
++ snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); |
3495 |
++ err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); |
3496 |
++ if (err) |
3497 |
++ goto out; |
3498 |
++ } |
3499 |
++ if ((rdev->mc_fw->size != mc_req_size) && |
3500 |
++ (rdev->mc_fw->size != mc2_req_size)){ |
3501 |
+ printk(KERN_ERR |
3502 |
+ "cik_mc: Bogus length %zu in firmware \"%s\"\n", |
3503 |
+ rdev->mc_fw->size, fw_name); |
3504 |
+ err = -EINVAL; |
3505 |
+ } |
3506 |
++ DRM_INFO("%s: %zu bytes\n", fw_name, rdev->mc_fw->size); |
3507 |
+ |
3508 |
+ snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); |
3509 |
+ err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); |
3510 |
+@@ -6662,6 +6672,19 @@ static void cik_disable_interrupt_state(struct radeon_device *rdev) |
3511 |
+ WREG32(LB_INTERRUPT_MASK + EVERGREEN_CRTC4_REGISTER_OFFSET, 0); |
3512 |
+ WREG32(LB_INTERRUPT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); |
3513 |
+ } |
3514 |
++ /* pflip */ |
3515 |
++ if (rdev->num_crtc >= 2) { |
3516 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); |
3517 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); |
3518 |
++ } |
3519 |
++ if (rdev->num_crtc >= 4) { |
3520 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, 0); |
3521 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, 0); |
3522 |
++ } |
3523 |
++ if (rdev->num_crtc >= 6) { |
3524 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, 0); |
3525 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); |
3526 |
++ } |
3527 |
+ |
3528 |
+ /* dac hotplug */ |
3529 |
+ WREG32(DAC_AUTODETECT_INT_CONTROL, 0); |
3530 |
+@@ -7018,6 +7041,25 @@ int cik_irq_set(struct radeon_device *rdev) |
3531 |
+ WREG32(LB_INTERRUPT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, crtc6); |
3532 |
+ } |
3533 |
+ |
3534 |
++ if (rdev->num_crtc >= 2) { |
3535 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, |
3536 |
++ GRPH_PFLIP_INT_MASK); |
3537 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, |
3538 |
++ GRPH_PFLIP_INT_MASK); |
3539 |
++ } |
3540 |
++ if (rdev->num_crtc >= 4) { |
3541 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, |
3542 |
++ GRPH_PFLIP_INT_MASK); |
3543 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, |
3544 |
++ GRPH_PFLIP_INT_MASK); |
3545 |
++ } |
3546 |
++ if (rdev->num_crtc >= 6) { |
3547 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, |
3548 |
++ GRPH_PFLIP_INT_MASK); |
3549 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, |
3550 |
++ GRPH_PFLIP_INT_MASK); |
3551 |
++ } |
3552 |
++ |
3553 |
+ WREG32(DC_HPD1_INT_CONTROL, hpd1); |
3554 |
+ WREG32(DC_HPD2_INT_CONTROL, hpd2); |
3555 |
+ WREG32(DC_HPD3_INT_CONTROL, hpd3); |
3556 |
+@@ -7054,6 +7096,29 @@ static inline void cik_irq_ack(struct radeon_device *rdev) |
3557 |
+ rdev->irq.stat_regs.cik.disp_int_cont5 = RREG32(DISP_INTERRUPT_STATUS_CONTINUE5); |
3558 |
+ rdev->irq.stat_regs.cik.disp_int_cont6 = RREG32(DISP_INTERRUPT_STATUS_CONTINUE6); |
3559 |
+ |
3560 |
++ rdev->irq.stat_regs.cik.d1grph_int = RREG32(GRPH_INT_STATUS + |
3561 |
++ EVERGREEN_CRTC0_REGISTER_OFFSET); |
3562 |
++ rdev->irq.stat_regs.cik.d2grph_int = RREG32(GRPH_INT_STATUS + |
3563 |
++ EVERGREEN_CRTC1_REGISTER_OFFSET); |
3564 |
++ if (rdev->num_crtc >= 4) { |
3565 |
++ rdev->irq.stat_regs.cik.d3grph_int = RREG32(GRPH_INT_STATUS + |
3566 |
++ EVERGREEN_CRTC2_REGISTER_OFFSET); |
3567 |
++ rdev->irq.stat_regs.cik.d4grph_int = RREG32(GRPH_INT_STATUS + |
3568 |
++ EVERGREEN_CRTC3_REGISTER_OFFSET); |
3569 |
++ } |
3570 |
++ if (rdev->num_crtc >= 6) { |
3571 |
++ rdev->irq.stat_regs.cik.d5grph_int = RREG32(GRPH_INT_STATUS + |
3572 |
++ EVERGREEN_CRTC4_REGISTER_OFFSET); |
3573 |
++ rdev->irq.stat_regs.cik.d6grph_int = RREG32(GRPH_INT_STATUS + |
3574 |
++ EVERGREEN_CRTC5_REGISTER_OFFSET); |
3575 |
++ } |
3576 |
++ |
3577 |
++ if (rdev->irq.stat_regs.cik.d1grph_int & GRPH_PFLIP_INT_OCCURRED) |
3578 |
++ WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC0_REGISTER_OFFSET, |
3579 |
++ GRPH_PFLIP_INT_CLEAR); |
3580 |
++ if (rdev->irq.stat_regs.cik.d2grph_int & GRPH_PFLIP_INT_OCCURRED) |
3581 |
++ WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC1_REGISTER_OFFSET, |
3582 |
++ GRPH_PFLIP_INT_CLEAR); |
3583 |
+ if (rdev->irq.stat_regs.cik.disp_int & LB_D1_VBLANK_INTERRUPT) |
3584 |
+ WREG32(LB_VBLANK_STATUS + EVERGREEN_CRTC0_REGISTER_OFFSET, VBLANK_ACK); |
3585 |
+ if (rdev->irq.stat_regs.cik.disp_int & LB_D1_VLINE_INTERRUPT) |
3586 |
+@@ -7064,6 +7129,12 @@ static inline void cik_irq_ack(struct radeon_device *rdev) |
3587 |
+ WREG32(LB_VLINE_STATUS + EVERGREEN_CRTC1_REGISTER_OFFSET, VLINE_ACK); |
3588 |
+ |
3589 |
+ if (rdev->num_crtc >= 4) { |
3590 |
++ if (rdev->irq.stat_regs.cik.d3grph_int & GRPH_PFLIP_INT_OCCURRED) |
3591 |
++ WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC2_REGISTER_OFFSET, |
3592 |
++ GRPH_PFLIP_INT_CLEAR); |
3593 |
++ if (rdev->irq.stat_regs.cik.d4grph_int & GRPH_PFLIP_INT_OCCURRED) |
3594 |
++ WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC3_REGISTER_OFFSET, |
3595 |
++ GRPH_PFLIP_INT_CLEAR); |
3596 |
+ if (rdev->irq.stat_regs.cik.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT) |
3597 |
+ WREG32(LB_VBLANK_STATUS + EVERGREEN_CRTC2_REGISTER_OFFSET, VBLANK_ACK); |
3598 |
+ if (rdev->irq.stat_regs.cik.disp_int_cont2 & LB_D3_VLINE_INTERRUPT) |
3599 |
+@@ -7075,6 +7146,12 @@ static inline void cik_irq_ack(struct radeon_device *rdev) |
3600 |
+ } |
3601 |
+ |
3602 |
+ if (rdev->num_crtc >= 6) { |
3603 |
++ if (rdev->irq.stat_regs.cik.d5grph_int & GRPH_PFLIP_INT_OCCURRED) |
3604 |
++ WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC4_REGISTER_OFFSET, |
3605 |
++ GRPH_PFLIP_INT_CLEAR); |
3606 |
++ if (rdev->irq.stat_regs.cik.d6grph_int & GRPH_PFLIP_INT_OCCURRED) |
3607 |
++ WREG32(GRPH_INT_STATUS + EVERGREEN_CRTC5_REGISTER_OFFSET, |
3608 |
++ GRPH_PFLIP_INT_CLEAR); |
3609 |
+ if (rdev->irq.stat_regs.cik.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT) |
3610 |
+ WREG32(LB_VBLANK_STATUS + EVERGREEN_CRTC4_REGISTER_OFFSET, VBLANK_ACK); |
3611 |
+ if (rdev->irq.stat_regs.cik.disp_int_cont4 & LB_D5_VLINE_INTERRUPT) |
3612 |
+@@ -7426,6 +7503,15 @@ restart_ih: |
3613 |
+ break; |
3614 |
+ } |
3615 |
+ break; |
3616 |
++ case 8: /* D1 page flip */ |
3617 |
++ case 10: /* D2 page flip */ |
3618 |
++ case 12: /* D3 page flip */ |
3619 |
++ case 14: /* D4 page flip */ |
3620 |
++ case 16: /* D5 page flip */ |
3621 |
++ case 18: /* D6 page flip */ |
3622 |
++ DRM_DEBUG("IH: D%d flip\n", ((src_id - 8) >> 1) + 1); |
3623 |
++ radeon_crtc_handle_flip(rdev, (src_id - 8) >> 1); |
3624 |
++ break; |
3625 |
+ case 42: /* HPD hotplug */ |
3626 |
+ switch (src_data) { |
3627 |
+ case 0: |
3628 |
+diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c |
3629 |
+index 94626ea90fa5..aac8f487e6df 100644 |
3630 |
+--- a/drivers/gpu/drm/radeon/cik_sdma.c |
3631 |
++++ b/drivers/gpu/drm/radeon/cik_sdma.c |
3632 |
+@@ -599,7 +599,7 @@ int cik_sdma_ring_test(struct radeon_device *rdev, |
3633 |
+ tmp = 0xCAFEDEAD; |
3634 |
+ writel(tmp, ptr); |
3635 |
+ |
3636 |
+- r = radeon_ring_lock(rdev, ring, 4); |
3637 |
++ r = radeon_ring_lock(rdev, ring, 5); |
3638 |
+ if (r) { |
3639 |
+ DRM_ERROR("radeon: dma failed to lock ring %d (%d).\n", ring->idx, r); |
3640 |
+ return r; |
3641 |
+diff --git a/drivers/gpu/drm/radeon/cikd.h b/drivers/gpu/drm/radeon/cikd.h |
3642 |
+index 98bae9d7b74d..d1b2c71b192a 100644 |
3643 |
+--- a/drivers/gpu/drm/radeon/cikd.h |
3644 |
++++ b/drivers/gpu/drm/radeon/cikd.h |
3645 |
+@@ -882,6 +882,15 @@ |
3646 |
+ # define DC_HPD6_RX_INTERRUPT (1 << 18) |
3647 |
+ #define DISP_INTERRUPT_STATUS_CONTINUE6 0x6780 |
3648 |
+ |
3649 |
++/* 0x6858, 0x7458, 0x10058, 0x10c58, 0x11858, 0x12458 */ |
3650 |
++#define GRPH_INT_STATUS 0x6858 |
3651 |
++# define GRPH_PFLIP_INT_OCCURRED (1 << 0) |
3652 |
++# define GRPH_PFLIP_INT_CLEAR (1 << 8) |
3653 |
++/* 0x685c, 0x745c, 0x1005c, 0x10c5c, 0x1185c, 0x1245c */ |
3654 |
++#define GRPH_INT_CONTROL 0x685c |
3655 |
++# define GRPH_PFLIP_INT_MASK (1 << 0) |
3656 |
++# define GRPH_PFLIP_INT_TYPE (1 << 8) |
3657 |
++ |
3658 |
+ #define DAC_AUTODETECT_INT_CONTROL 0x67c8 |
3659 |
+ |
3660 |
+ #define DC_HPD1_INT_STATUS 0x601c |
3661 |
+diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c |
3662 |
+index 94e858751994..0a65dc7e93e7 100644 |
3663 |
+--- a/drivers/gpu/drm/radeon/dce6_afmt.c |
3664 |
++++ b/drivers/gpu/drm/radeon/dce6_afmt.c |
3665 |
+@@ -309,11 +309,17 @@ int dce6_audio_init(struct radeon_device *rdev) |
3666 |
+ |
3667 |
+ rdev->audio.enabled = true; |
3668 |
+ |
3669 |
+- if (ASIC_IS_DCE8(rdev)) |
3670 |
++ if (ASIC_IS_DCE81(rdev)) /* KV: 4 streams, 7 endpoints */ |
3671 |
++ rdev->audio.num_pins = 7; |
3672 |
++ else if (ASIC_IS_DCE83(rdev)) /* KB: 2 streams, 3 endpoints */ |
3673 |
++ rdev->audio.num_pins = 3; |
3674 |
++ else if (ASIC_IS_DCE8(rdev)) /* BN/HW: 6 streams, 7 endpoints */ |
3675 |
++ rdev->audio.num_pins = 7; |
3676 |
++ else if (ASIC_IS_DCE61(rdev)) /* TN: 4 streams, 6 endpoints */ |
3677 |
+ rdev->audio.num_pins = 6; |
3678 |
+- else if (ASIC_IS_DCE61(rdev)) |
3679 |
+- rdev->audio.num_pins = 4; |
3680 |
+- else |
3681 |
++ else if (ASIC_IS_DCE64(rdev)) /* OL: 2 streams, 2 endpoints */ |
3682 |
++ rdev->audio.num_pins = 2; |
3683 |
++ else /* SI: 6 streams, 6 endpoints */ |
3684 |
+ rdev->audio.num_pins = 6; |
3685 |
+ |
3686 |
+ for (i = 0; i < rdev->audio.num_pins; i++) { |
3687 |
+diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c |
3688 |
+index 27b0ff16082e..971d9339ce80 100644 |
3689 |
+--- a/drivers/gpu/drm/radeon/evergreen.c |
3690 |
++++ b/drivers/gpu/drm/radeon/evergreen.c |
3691 |
+@@ -4375,7 +4375,6 @@ int evergreen_irq_set(struct radeon_device *rdev) |
3692 |
+ u32 crtc1 = 0, crtc2 = 0, crtc3 = 0, crtc4 = 0, crtc5 = 0, crtc6 = 0; |
3693 |
+ u32 hpd1, hpd2, hpd3, hpd4, hpd5, hpd6; |
3694 |
+ u32 grbm_int_cntl = 0; |
3695 |
+- u32 grph1 = 0, grph2 = 0, grph3 = 0, grph4 = 0, grph5 = 0, grph6 = 0; |
3696 |
+ u32 afmt1 = 0, afmt2 = 0, afmt3 = 0, afmt4 = 0, afmt5 = 0, afmt6 = 0; |
3697 |
+ u32 dma_cntl, dma_cntl1 = 0; |
3698 |
+ u32 thermal_int = 0; |
3699 |
+@@ -4558,15 +4557,21 @@ int evergreen_irq_set(struct radeon_device *rdev) |
3700 |
+ WREG32(INT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, crtc6); |
3701 |
+ } |
3702 |
+ |
3703 |
+- WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, grph1); |
3704 |
+- WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, grph2); |
3705 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, |
3706 |
++ GRPH_PFLIP_INT_MASK); |
3707 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, |
3708 |
++ GRPH_PFLIP_INT_MASK); |
3709 |
+ if (rdev->num_crtc >= 4) { |
3710 |
+- WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, grph3); |
3711 |
+- WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, grph4); |
3712 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, |
3713 |
++ GRPH_PFLIP_INT_MASK); |
3714 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, |
3715 |
++ GRPH_PFLIP_INT_MASK); |
3716 |
+ } |
3717 |
+ if (rdev->num_crtc >= 6) { |
3718 |
+- WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, grph5); |
3719 |
+- WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, grph6); |
3720 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, |
3721 |
++ GRPH_PFLIP_INT_MASK); |
3722 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, |
3723 |
++ GRPH_PFLIP_INT_MASK); |
3724 |
+ } |
3725 |
+ |
3726 |
+ WREG32(DC_HPD1_INT_CONTROL, hpd1); |
3727 |
+@@ -4955,6 +4960,15 @@ restart_ih: |
3728 |
+ break; |
3729 |
+ } |
3730 |
+ break; |
3731 |
++ case 8: /* D1 page flip */ |
3732 |
++ case 10: /* D2 page flip */ |
3733 |
++ case 12: /* D3 page flip */ |
3734 |
++ case 14: /* D4 page flip */ |
3735 |
++ case 16: /* D5 page flip */ |
3736 |
++ case 18: /* D6 page flip */ |
3737 |
++ DRM_DEBUG("IH: D%d flip\n", ((src_id - 8) >> 1) + 1); |
3738 |
++ radeon_crtc_handle_flip(rdev, (src_id - 8) >> 1); |
3739 |
++ break; |
3740 |
+ case 42: /* HPD hotplug */ |
3741 |
+ switch (src_data) { |
3742 |
+ case 0: |
3743 |
+diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c |
3744 |
+index 647ef4079217..f28ab840cc23 100644 |
3745 |
+--- a/drivers/gpu/drm/radeon/r600.c |
3746 |
++++ b/drivers/gpu/drm/radeon/r600.c |
3747 |
+@@ -3509,7 +3509,6 @@ int r600_irq_set(struct radeon_device *rdev) |
3748 |
+ u32 hpd1, hpd2, hpd3, hpd4 = 0, hpd5 = 0, hpd6 = 0; |
3749 |
+ u32 grbm_int_cntl = 0; |
3750 |
+ u32 hdmi0, hdmi1; |
3751 |
+- u32 d1grph = 0, d2grph = 0; |
3752 |
+ u32 dma_cntl; |
3753 |
+ u32 thermal_int = 0; |
3754 |
+ |
3755 |
+@@ -3618,8 +3617,8 @@ int r600_irq_set(struct radeon_device *rdev) |
3756 |
+ WREG32(CP_INT_CNTL, cp_int_cntl); |
3757 |
+ WREG32(DMA_CNTL, dma_cntl); |
3758 |
+ WREG32(DxMODE_INT_MASK, mode_int); |
3759 |
+- WREG32(D1GRPH_INTERRUPT_CONTROL, d1grph); |
3760 |
+- WREG32(D2GRPH_INTERRUPT_CONTROL, d2grph); |
3761 |
++ WREG32(D1GRPH_INTERRUPT_CONTROL, DxGRPH_PFLIP_INT_MASK); |
3762 |
++ WREG32(D2GRPH_INTERRUPT_CONTROL, DxGRPH_PFLIP_INT_MASK); |
3763 |
+ WREG32(GRBM_INT_CNTL, grbm_int_cntl); |
3764 |
+ if (ASIC_IS_DCE3(rdev)) { |
3765 |
+ WREG32(DC_HPD1_INT_CONTROL, hpd1); |
3766 |
+@@ -3922,6 +3921,14 @@ restart_ih: |
3767 |
+ break; |
3768 |
+ } |
3769 |
+ break; |
3770 |
++ case 9: /* D1 pflip */ |
3771 |
++ DRM_DEBUG("IH: D1 flip\n"); |
3772 |
++ radeon_crtc_handle_flip(rdev, 0); |
3773 |
++ break; |
3774 |
++ case 11: /* D2 pflip */ |
3775 |
++ DRM_DEBUG("IH: D2 flip\n"); |
3776 |
++ radeon_crtc_handle_flip(rdev, 1); |
3777 |
++ break; |
3778 |
+ case 19: /* HPD/DAC hotplug */ |
3779 |
+ switch (src_data) { |
3780 |
+ case 0: |
3781 |
+diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c |
3782 |
+index e4cc9b314ce9..813db8de52b7 100644 |
3783 |
+--- a/drivers/gpu/drm/radeon/r600_dpm.c |
3784 |
++++ b/drivers/gpu/drm/radeon/r600_dpm.c |
3785 |
+@@ -158,16 +158,18 @@ u32 r600_dpm_get_vblank_time(struct radeon_device *rdev) |
3786 |
+ u32 line_time_us, vblank_lines; |
3787 |
+ u32 vblank_time_us = 0xffffffff; /* if the displays are off, vblank time is max */ |
3788 |
+ |
3789 |
+- list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
3790 |
+- radeon_crtc = to_radeon_crtc(crtc); |
3791 |
+- if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { |
3792 |
+- line_time_us = (radeon_crtc->hw_mode.crtc_htotal * 1000) / |
3793 |
+- radeon_crtc->hw_mode.clock; |
3794 |
+- vblank_lines = radeon_crtc->hw_mode.crtc_vblank_end - |
3795 |
+- radeon_crtc->hw_mode.crtc_vdisplay + |
3796 |
+- (radeon_crtc->v_border * 2); |
3797 |
+- vblank_time_us = vblank_lines * line_time_us; |
3798 |
+- break; |
3799 |
++ if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { |
3800 |
++ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
3801 |
++ radeon_crtc = to_radeon_crtc(crtc); |
3802 |
++ if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { |
3803 |
++ line_time_us = (radeon_crtc->hw_mode.crtc_htotal * 1000) / |
3804 |
++ radeon_crtc->hw_mode.clock; |
3805 |
++ vblank_lines = radeon_crtc->hw_mode.crtc_vblank_end - |
3806 |
++ radeon_crtc->hw_mode.crtc_vdisplay + |
3807 |
++ (radeon_crtc->v_border * 2); |
3808 |
++ vblank_time_us = vblank_lines * line_time_us; |
3809 |
++ break; |
3810 |
++ } |
3811 |
+ } |
3812 |
+ } |
3813 |
+ |
3814 |
+@@ -181,14 +183,15 @@ u32 r600_dpm_get_vrefresh(struct radeon_device *rdev) |
3815 |
+ struct radeon_crtc *radeon_crtc; |
3816 |
+ u32 vrefresh = 0; |
3817 |
+ |
3818 |
+- list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
3819 |
+- radeon_crtc = to_radeon_crtc(crtc); |
3820 |
+- if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { |
3821 |
+- vrefresh = radeon_crtc->hw_mode.vrefresh; |
3822 |
+- break; |
3823 |
++ if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { |
3824 |
++ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
3825 |
++ radeon_crtc = to_radeon_crtc(crtc); |
3826 |
++ if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { |
3827 |
++ vrefresh = radeon_crtc->hw_mode.vrefresh; |
3828 |
++ break; |
3829 |
++ } |
3830 |
+ } |
3831 |
+ } |
3832 |
+- |
3833 |
+ return vrefresh; |
3834 |
+ } |
3835 |
+ |
3836 |
+diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h |
3837 |
+index e887d027b6d0..08e86f90c9a4 100644 |
3838 |
+--- a/drivers/gpu/drm/radeon/radeon.h |
3839 |
++++ b/drivers/gpu/drm/radeon/radeon.h |
3840 |
+@@ -733,6 +733,12 @@ struct cik_irq_stat_regs { |
3841 |
+ u32 disp_int_cont4; |
3842 |
+ u32 disp_int_cont5; |
3843 |
+ u32 disp_int_cont6; |
3844 |
++ u32 d1grph_int; |
3845 |
++ u32 d2grph_int; |
3846 |
++ u32 d3grph_int; |
3847 |
++ u32 d4grph_int; |
3848 |
++ u32 d5grph_int; |
3849 |
++ u32 d6grph_int; |
3850 |
+ }; |
3851 |
+ |
3852 |
+ union radeon_irq_stat_regs { |
3853 |
+@@ -742,7 +748,7 @@ union radeon_irq_stat_regs { |
3854 |
+ struct cik_irq_stat_regs cik; |
3855 |
+ }; |
3856 |
+ |
3857 |
+-#define RADEON_MAX_HPD_PINS 6 |
3858 |
++#define RADEON_MAX_HPD_PINS 7 |
3859 |
+ #define RADEON_MAX_CRTCS 6 |
3860 |
+ #define RADEON_MAX_AFMT_BLOCKS 7 |
3861 |
+ |
3862 |
+@@ -2242,6 +2248,7 @@ struct radeon_device { |
3863 |
+ bool have_disp_power_ref; |
3864 |
+ }; |
3865 |
+ |
3866 |
++bool radeon_is_px(struct drm_device *dev); |
3867 |
+ int radeon_device_init(struct radeon_device *rdev, |
3868 |
+ struct drm_device *ddev, |
3869 |
+ struct pci_dev *pdev, |
3870 |
+@@ -2552,6 +2559,9 @@ void r100_pll_errata_after_index(struct radeon_device *rdev); |
3871 |
+ #define ASIC_IS_DCE64(rdev) ((rdev->family == CHIP_OLAND)) |
3872 |
+ #define ASIC_IS_NODCE(rdev) ((rdev->family == CHIP_HAINAN)) |
3873 |
+ #define ASIC_IS_DCE8(rdev) ((rdev->family >= CHIP_BONAIRE)) |
3874 |
++#define ASIC_IS_DCE81(rdev) ((rdev->family == CHIP_KAVERI)) |
3875 |
++#define ASIC_IS_DCE82(rdev) ((rdev->family == CHIP_BONAIRE)) |
3876 |
++#define ASIC_IS_DCE83(rdev) ((rdev->family == CHIP_KABINI)) |
3877 |
+ |
3878 |
+ #define ASIC_IS_LOMBOK(rdev) ((rdev->ddev->pdev->device == 0x6849) || \ |
3879 |
+ (rdev->ddev->pdev->device == 0x6850) || \ |
3880 |
+diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c |
3881 |
+index fa9a9c02751e..a9fb0d016d38 100644 |
3882 |
+--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c |
3883 |
++++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c |
3884 |
+@@ -59,7 +59,7 @@ struct atpx_mux { |
3885 |
+ u16 mux; |
3886 |
+ } __packed; |
3887 |
+ |
3888 |
+-bool radeon_is_px(void) { |
3889 |
++bool radeon_has_atpx(void) { |
3890 |
+ return radeon_atpx_priv.atpx_detected; |
3891 |
+ } |
3892 |
+ |
3893 |
+@@ -528,6 +528,13 @@ static bool radeon_atpx_detect(void) |
3894 |
+ has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true); |
3895 |
+ } |
3896 |
+ |
3897 |
++ /* some newer PX laptops mark the dGPU as a non-VGA display device */ |
3898 |
++ while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) { |
3899 |
++ vga_count++; |
3900 |
++ |
3901 |
++ has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true); |
3902 |
++ } |
3903 |
++ |
3904 |
+ if (has_atpx && vga_count == 2) { |
3905 |
+ acpi_get_name(radeon_atpx_priv.atpx.handle, ACPI_FULL_PATHNAME, &buffer); |
3906 |
+ printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n", |
3907 |
+diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c |
3908 |
+index 044bc98fb459..7f370b309590 100644 |
3909 |
+--- a/drivers/gpu/drm/radeon/radeon_device.c |
3910 |
++++ b/drivers/gpu/drm/radeon/radeon_device.c |
3911 |
+@@ -102,11 +102,14 @@ static const char radeon_family_name[][16] = { |
3912 |
+ "LAST", |
3913 |
+ }; |
3914 |
+ |
3915 |
+-#if defined(CONFIG_VGA_SWITCHEROO) |
3916 |
+-bool radeon_is_px(void); |
3917 |
+-#else |
3918 |
+-static inline bool radeon_is_px(void) { return false; } |
3919 |
+-#endif |
3920 |
++bool radeon_is_px(struct drm_device *dev) |
3921 |
++{ |
3922 |
++ struct radeon_device *rdev = dev->dev_private; |
3923 |
++ |
3924 |
++ if (rdev->flags & RADEON_IS_PX) |
3925 |
++ return true; |
3926 |
++ return false; |
3927 |
++} |
3928 |
+ |
3929 |
+ /** |
3930 |
+ * radeon_program_register_sequence - program an array of registers. |
3931 |
+@@ -1082,7 +1085,7 @@ static void radeon_switcheroo_set_state(struct pci_dev *pdev, enum vga_switchero |
3932 |
+ { |
3933 |
+ struct drm_device *dev = pci_get_drvdata(pdev); |
3934 |
+ |
3935 |
+- if (radeon_is_px() && state == VGA_SWITCHEROO_OFF) |
3936 |
++ if (radeon_is_px(dev) && state == VGA_SWITCHEROO_OFF) |
3937 |
+ return; |
3938 |
+ |
3939 |
+ if (state == VGA_SWITCHEROO_ON) { |
3940 |
+@@ -1303,9 +1306,7 @@ int radeon_device_init(struct radeon_device *rdev, |
3941 |
+ * ignore it */ |
3942 |
+ vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode); |
3943 |
+ |
3944 |
+- if (radeon_runtime_pm == 1) |
3945 |
+- runtime = true; |
3946 |
+- if ((radeon_runtime_pm == -1) && radeon_is_px()) |
3947 |
++ if (rdev->flags & RADEON_IS_PX) |
3948 |
+ runtime = true; |
3949 |
+ vga_switcheroo_register_client(rdev->pdev, &radeon_switcheroo_ops, runtime); |
3950 |
+ if (runtime) |
3951 |
+diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c |
3952 |
+index 6e6f82c53fef..df6d0079d0af 100644 |
3953 |
+--- a/drivers/gpu/drm/radeon/radeon_display.c |
3954 |
++++ b/drivers/gpu/drm/radeon/radeon_display.c |
3955 |
+@@ -282,6 +282,10 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id) |
3956 |
+ u32 update_pending; |
3957 |
+ int vpos, hpos; |
3958 |
+ |
3959 |
++ /* can happen during initialization */ |
3960 |
++ if (radeon_crtc == NULL) |
3961 |
++ return; |
3962 |
++ |
3963 |
+ spin_lock_irqsave(&rdev->ddev->event_lock, flags); |
3964 |
+ work = radeon_crtc->unpin_work; |
3965 |
+ if (work == NULL || |
3966 |
+diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c |
3967 |
+index f633c2782170..9c0056f0a68a 100644 |
3968 |
+--- a/drivers/gpu/drm/radeon/radeon_drv.c |
3969 |
++++ b/drivers/gpu/drm/radeon/radeon_drv.c |
3970 |
+@@ -113,6 +113,7 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, |
3971 |
+ unsigned int flags, |
3972 |
+ int *vpos, int *hpos, ktime_t *stime, |
3973 |
+ ktime_t *etime); |
3974 |
++extern bool radeon_is_px(struct drm_device *dev); |
3975 |
+ extern const struct drm_ioctl_desc radeon_ioctls_kms[]; |
3976 |
+ extern int radeon_max_kms_ioctl; |
3977 |
+ int radeon_mmap(struct file *filp, struct vm_area_struct *vma); |
3978 |
+@@ -142,11 +143,9 @@ void radeon_debugfs_cleanup(struct drm_minor *minor); |
3979 |
+ #if defined(CONFIG_VGA_SWITCHEROO) |
3980 |
+ void radeon_register_atpx_handler(void); |
3981 |
+ void radeon_unregister_atpx_handler(void); |
3982 |
+-bool radeon_is_px(void); |
3983 |
+ #else |
3984 |
+ static inline void radeon_register_atpx_handler(void) {} |
3985 |
+ static inline void radeon_unregister_atpx_handler(void) {} |
3986 |
+-static inline bool radeon_is_px(void) { return false; } |
3987 |
+ #endif |
3988 |
+ |
3989 |
+ int radeon_no_wb; |
3990 |
+@@ -403,12 +402,7 @@ static int radeon_pmops_runtime_suspend(struct device *dev) |
3991 |
+ struct drm_device *drm_dev = pci_get_drvdata(pdev); |
3992 |
+ int ret; |
3993 |
+ |
3994 |
+- if (radeon_runtime_pm == 0) { |
3995 |
+- pm_runtime_forbid(dev); |
3996 |
+- return -EBUSY; |
3997 |
+- } |
3998 |
+- |
3999 |
+- if (radeon_runtime_pm == -1 && !radeon_is_px()) { |
4000 |
++ if (!radeon_is_px(drm_dev)) { |
4001 |
+ pm_runtime_forbid(dev); |
4002 |
+ return -EBUSY; |
4003 |
+ } |
4004 |
+@@ -432,10 +426,7 @@ static int radeon_pmops_runtime_resume(struct device *dev) |
4005 |
+ struct drm_device *drm_dev = pci_get_drvdata(pdev); |
4006 |
+ int ret; |
4007 |
+ |
4008 |
+- if (radeon_runtime_pm == 0) |
4009 |
+- return -EINVAL; |
4010 |
+- |
4011 |
+- if (radeon_runtime_pm == -1 && !radeon_is_px()) |
4012 |
++ if (!radeon_is_px(drm_dev)) |
4013 |
+ return -EINVAL; |
4014 |
+ |
4015 |
+ drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; |
4016 |
+@@ -460,14 +451,7 @@ static int radeon_pmops_runtime_idle(struct device *dev) |
4017 |
+ struct drm_device *drm_dev = pci_get_drvdata(pdev); |
4018 |
+ struct drm_crtc *crtc; |
4019 |
+ |
4020 |
+- if (radeon_runtime_pm == 0) { |
4021 |
+- pm_runtime_forbid(dev); |
4022 |
+- return -EBUSY; |
4023 |
+- } |
4024 |
+- |
4025 |
+- /* are we PX enabled? */ |
4026 |
+- if (radeon_runtime_pm == -1 && !radeon_is_px()) { |
4027 |
+- DRM_DEBUG_DRIVER("failing to power off - not px\n"); |
4028 |
++ if (!radeon_is_px(drm_dev)) { |
4029 |
+ pm_runtime_forbid(dev); |
4030 |
+ return -EBUSY; |
4031 |
+ } |
4032 |
+diff --git a/drivers/gpu/drm/radeon/radeon_family.h b/drivers/gpu/drm/radeon/radeon_family.h |
4033 |
+index 614ad549297f..9da5da4ffd17 100644 |
4034 |
+--- a/drivers/gpu/drm/radeon/radeon_family.h |
4035 |
++++ b/drivers/gpu/drm/radeon/radeon_family.h |
4036 |
+@@ -115,6 +115,7 @@ enum radeon_chip_flags { |
4037 |
+ RADEON_NEW_MEMMAP = 0x00400000UL, |
4038 |
+ RADEON_IS_PCI = 0x00800000UL, |
4039 |
+ RADEON_IS_IGPGART = 0x01000000UL, |
4040 |
++ RADEON_IS_PX = 0x02000000UL, |
4041 |
+ }; |
4042 |
+ |
4043 |
+ #endif |
4044 |
+diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c |
4045 |
+index 66ed3ea71440..ea34a31d3bc8 100644 |
4046 |
+--- a/drivers/gpu/drm/radeon/radeon_kms.c |
4047 |
++++ b/drivers/gpu/drm/radeon/radeon_kms.c |
4048 |
+@@ -35,9 +35,9 @@ |
4049 |
+ #include <linux/pm_runtime.h> |
4050 |
+ |
4051 |
+ #if defined(CONFIG_VGA_SWITCHEROO) |
4052 |
+-bool radeon_is_px(void); |
4053 |
++bool radeon_has_atpx(void); |
4054 |
+ #else |
4055 |
+-static inline bool radeon_is_px(void) { return false; } |
4056 |
++static inline bool radeon_has_atpx(void) { return false; } |
4057 |
+ #endif |
4058 |
+ |
4059 |
+ /** |
4060 |
+@@ -107,6 +107,11 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) |
4061 |
+ flags |= RADEON_IS_PCI; |
4062 |
+ } |
4063 |
+ |
4064 |
++ if ((radeon_runtime_pm != 0) && |
4065 |
++ radeon_has_atpx() && |
4066 |
++ ((flags & RADEON_IS_IGP) == 0)) |
4067 |
++ flags |= RADEON_IS_PX; |
4068 |
++ |
4069 |
+ /* radeon_device_init should report only fatal error |
4070 |
+ * like memory allocation failure or iomapping failure, |
4071 |
+ * or memory manager initialization failure, it must |
4072 |
+@@ -137,8 +142,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) |
4073 |
+ "Error during ACPI methods call\n"); |
4074 |
+ } |
4075 |
+ |
4076 |
+- if ((radeon_runtime_pm == 1) || |
4077 |
+- ((radeon_runtime_pm == -1) && radeon_is_px())) { |
4078 |
++ if (radeon_is_px(dev)) { |
4079 |
+ pm_runtime_use_autosuspend(dev->dev); |
4080 |
+ pm_runtime_set_autosuspend_delay(dev->dev, 5000); |
4081 |
+ pm_runtime_set_active(dev->dev); |
4082 |
+diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c |
4083 |
+index 8e8153e471c2..a957024eae24 100644 |
4084 |
+--- a/drivers/gpu/drm/radeon/radeon_pm.c |
4085 |
++++ b/drivers/gpu/drm/radeon/radeon_pm.c |
4086 |
+@@ -603,7 +603,6 @@ static const struct attribute_group *hwmon_groups[] = { |
4087 |
+ static int radeon_hwmon_init(struct radeon_device *rdev) |
4088 |
+ { |
4089 |
+ int err = 0; |
4090 |
+- struct device *hwmon_dev; |
4091 |
+ |
4092 |
+ switch (rdev->pm.int_thermal_type) { |
4093 |
+ case THERMAL_TYPE_RV6XX: |
4094 |
+@@ -616,11 +615,11 @@ static int radeon_hwmon_init(struct radeon_device *rdev) |
4095 |
+ case THERMAL_TYPE_KV: |
4096 |
+ if (rdev->asic->pm.get_temperature == NULL) |
4097 |
+ return err; |
4098 |
+- hwmon_dev = hwmon_device_register_with_groups(rdev->dev, |
4099 |
+- "radeon", rdev, |
4100 |
+- hwmon_groups); |
4101 |
+- if (IS_ERR(hwmon_dev)) { |
4102 |
+- err = PTR_ERR(hwmon_dev); |
4103 |
++ rdev->pm.int_hwmon_dev = hwmon_device_register_with_groups(rdev->dev, |
4104 |
++ "radeon", rdev, |
4105 |
++ hwmon_groups); |
4106 |
++ if (IS_ERR(rdev->pm.int_hwmon_dev)) { |
4107 |
++ err = PTR_ERR(rdev->pm.int_hwmon_dev); |
4108 |
+ dev_err(rdev->dev, |
4109 |
+ "Unable to register hwmon device: %d\n", err); |
4110 |
+ } |
4111 |
+@@ -632,6 +631,12 @@ static int radeon_hwmon_init(struct radeon_device *rdev) |
4112 |
+ return err; |
4113 |
+ } |
4114 |
+ |
4115 |
++static void radeon_hwmon_fini(struct radeon_device *rdev) |
4116 |
++{ |
4117 |
++ if (rdev->pm.int_hwmon_dev) |
4118 |
++ hwmon_device_unregister(rdev->pm.int_hwmon_dev); |
4119 |
++} |
4120 |
++ |
4121 |
+ static void radeon_dpm_thermal_work_handler(struct work_struct *work) |
4122 |
+ { |
4123 |
+ struct radeon_device *rdev = |
4124 |
+@@ -1235,6 +1240,7 @@ int radeon_pm_init(struct radeon_device *rdev) |
4125 |
+ case CHIP_RV670: |
4126 |
+ case CHIP_RS780: |
4127 |
+ case CHIP_RS880: |
4128 |
++ case CHIP_RV770: |
4129 |
+ case CHIP_BARTS: |
4130 |
+ case CHIP_TURKS: |
4131 |
+ case CHIP_CAICOS: |
4132 |
+@@ -1251,7 +1257,6 @@ int radeon_pm_init(struct radeon_device *rdev) |
4133 |
+ else |
4134 |
+ rdev->pm.pm_method = PM_METHOD_PROFILE; |
4135 |
+ break; |
4136 |
+- case CHIP_RV770: |
4137 |
+ case CHIP_RV730: |
4138 |
+ case CHIP_RV710: |
4139 |
+ case CHIP_RV740: |
4140 |
+@@ -1331,6 +1336,8 @@ static void radeon_pm_fini_old(struct radeon_device *rdev) |
4141 |
+ device_remove_file(rdev->dev, &dev_attr_power_method); |
4142 |
+ } |
4143 |
+ |
4144 |
++ radeon_hwmon_fini(rdev); |
4145 |
++ |
4146 |
+ if (rdev->pm.power_state) |
4147 |
+ kfree(rdev->pm.power_state); |
4148 |
+ } |
4149 |
+@@ -1350,6 +1357,8 @@ static void radeon_pm_fini_dpm(struct radeon_device *rdev) |
4150 |
+ } |
4151 |
+ radeon_dpm_fini(rdev); |
4152 |
+ |
4153 |
++ radeon_hwmon_fini(rdev); |
4154 |
++ |
4155 |
+ if (rdev->pm.power_state) |
4156 |
+ kfree(rdev->pm.power_state); |
4157 |
+ } |
4158 |
+@@ -1375,12 +1384,14 @@ static void radeon_pm_compute_clocks_old(struct radeon_device *rdev) |
4159 |
+ |
4160 |
+ rdev->pm.active_crtcs = 0; |
4161 |
+ rdev->pm.active_crtc_count = 0; |
4162 |
+- list_for_each_entry(crtc, |
4163 |
+- &ddev->mode_config.crtc_list, head) { |
4164 |
+- radeon_crtc = to_radeon_crtc(crtc); |
4165 |
+- if (radeon_crtc->enabled) { |
4166 |
+- rdev->pm.active_crtcs |= (1 << radeon_crtc->crtc_id); |
4167 |
+- rdev->pm.active_crtc_count++; |
4168 |
++ if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { |
4169 |
++ list_for_each_entry(crtc, |
4170 |
++ &ddev->mode_config.crtc_list, head) { |
4171 |
++ radeon_crtc = to_radeon_crtc(crtc); |
4172 |
++ if (radeon_crtc->enabled) { |
4173 |
++ rdev->pm.active_crtcs |= (1 << radeon_crtc->crtc_id); |
4174 |
++ rdev->pm.active_crtc_count++; |
4175 |
++ } |
4176 |
+ } |
4177 |
+ } |
4178 |
+ |
4179 |
+@@ -1447,12 +1458,14 @@ static void radeon_pm_compute_clocks_dpm(struct radeon_device *rdev) |
4180 |
+ /* update active crtc counts */ |
4181 |
+ rdev->pm.dpm.new_active_crtcs = 0; |
4182 |
+ rdev->pm.dpm.new_active_crtc_count = 0; |
4183 |
+- list_for_each_entry(crtc, |
4184 |
+- &ddev->mode_config.crtc_list, head) { |
4185 |
+- radeon_crtc = to_radeon_crtc(crtc); |
4186 |
+- if (crtc->enabled) { |
4187 |
+- rdev->pm.dpm.new_active_crtcs |= (1 << radeon_crtc->crtc_id); |
4188 |
+- rdev->pm.dpm.new_active_crtc_count++; |
4189 |
++ if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { |
4190 |
++ list_for_each_entry(crtc, |
4191 |
++ &ddev->mode_config.crtc_list, head) { |
4192 |
++ radeon_crtc = to_radeon_crtc(crtc); |
4193 |
++ if (crtc->enabled) { |
4194 |
++ rdev->pm.dpm.new_active_crtcs |= (1 << radeon_crtc->crtc_id); |
4195 |
++ rdev->pm.dpm.new_active_crtc_count++; |
4196 |
++ } |
4197 |
+ } |
4198 |
+ } |
4199 |
+ |
4200 |
+diff --git a/drivers/gpu/drm/radeon/radeon_ucode.h b/drivers/gpu/drm/radeon/radeon_ucode.h |
4201 |
+index a77cd274dfc3..58d12938c0b8 100644 |
4202 |
+--- a/drivers/gpu/drm/radeon/radeon_ucode.h |
4203 |
++++ b/drivers/gpu/drm/radeon/radeon_ucode.h |
4204 |
+@@ -57,9 +57,14 @@ |
4205 |
+ #define BTC_MC_UCODE_SIZE 6024 |
4206 |
+ #define CAYMAN_MC_UCODE_SIZE 6037 |
4207 |
+ #define SI_MC_UCODE_SIZE 7769 |
4208 |
++#define TAHITI_MC_UCODE_SIZE 7808 |
4209 |
++#define PITCAIRN_MC_UCODE_SIZE 7775 |
4210 |
++#define VERDE_MC_UCODE_SIZE 7875 |
4211 |
+ #define OLAND_MC_UCODE_SIZE 7863 |
4212 |
+-#define CIK_MC_UCODE_SIZE 7866 |
4213 |
++#define BONAIRE_MC_UCODE_SIZE 7866 |
4214 |
++#define BONAIRE_MC2_UCODE_SIZE 7948 |
4215 |
+ #define HAWAII_MC_UCODE_SIZE 7933 |
4216 |
++#define HAWAII_MC2_UCODE_SIZE 8091 |
4217 |
+ |
4218 |
+ /* SDMA */ |
4219 |
+ #define CIK_SDMA_UCODE_SIZE 1050 |
4220 |
+diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c |
4221 |
+index 3e6804b2b2ef..414e07928693 100644 |
4222 |
+--- a/drivers/gpu/drm/radeon/radeon_uvd.c |
4223 |
++++ b/drivers/gpu/drm/radeon/radeon_uvd.c |
4224 |
+@@ -465,6 +465,10 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, |
4225 |
+ cmd = radeon_get_ib_value(p, p->idx) >> 1; |
4226 |
+ |
4227 |
+ if (cmd < 0x4) { |
4228 |
++ if (end <= start) { |
4229 |
++ DRM_ERROR("invalid reloc offset %X!\n", offset); |
4230 |
++ return -EINVAL; |
4231 |
++ } |
4232 |
+ if ((end - start) < buf_sizes[cmd]) { |
4233 |
+ DRM_ERROR("buffer (%d) to small (%d / %d)!\n", cmd, |
4234 |
+ (unsigned)(end - start), buf_sizes[cmd]); |
4235 |
+diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c |
4236 |
+index 9a124d0608b3..cb7508dc94f3 100644 |
4237 |
+--- a/drivers/gpu/drm/radeon/si.c |
4238 |
++++ b/drivers/gpu/drm/radeon/si.c |
4239 |
+@@ -39,30 +39,35 @@ MODULE_FIRMWARE("radeon/TAHITI_pfp.bin"); |
4240 |
+ MODULE_FIRMWARE("radeon/TAHITI_me.bin"); |
4241 |
+ MODULE_FIRMWARE("radeon/TAHITI_ce.bin"); |
4242 |
+ MODULE_FIRMWARE("radeon/TAHITI_mc.bin"); |
4243 |
++MODULE_FIRMWARE("radeon/TAHITI_mc2.bin"); |
4244 |
+ MODULE_FIRMWARE("radeon/TAHITI_rlc.bin"); |
4245 |
+ MODULE_FIRMWARE("radeon/TAHITI_smc.bin"); |
4246 |
+ MODULE_FIRMWARE("radeon/PITCAIRN_pfp.bin"); |
4247 |
+ MODULE_FIRMWARE("radeon/PITCAIRN_me.bin"); |
4248 |
+ MODULE_FIRMWARE("radeon/PITCAIRN_ce.bin"); |
4249 |
+ MODULE_FIRMWARE("radeon/PITCAIRN_mc.bin"); |
4250 |
++MODULE_FIRMWARE("radeon/PITCAIRN_mc2.bin"); |
4251 |
+ MODULE_FIRMWARE("radeon/PITCAIRN_rlc.bin"); |
4252 |
+ MODULE_FIRMWARE("radeon/PITCAIRN_smc.bin"); |
4253 |
+ MODULE_FIRMWARE("radeon/VERDE_pfp.bin"); |
4254 |
+ MODULE_FIRMWARE("radeon/VERDE_me.bin"); |
4255 |
+ MODULE_FIRMWARE("radeon/VERDE_ce.bin"); |
4256 |
+ MODULE_FIRMWARE("radeon/VERDE_mc.bin"); |
4257 |
++MODULE_FIRMWARE("radeon/VERDE_mc2.bin"); |
4258 |
+ MODULE_FIRMWARE("radeon/VERDE_rlc.bin"); |
4259 |
+ MODULE_FIRMWARE("radeon/VERDE_smc.bin"); |
4260 |
+ MODULE_FIRMWARE("radeon/OLAND_pfp.bin"); |
4261 |
+ MODULE_FIRMWARE("radeon/OLAND_me.bin"); |
4262 |
+ MODULE_FIRMWARE("radeon/OLAND_ce.bin"); |
4263 |
+ MODULE_FIRMWARE("radeon/OLAND_mc.bin"); |
4264 |
++MODULE_FIRMWARE("radeon/OLAND_mc2.bin"); |
4265 |
+ MODULE_FIRMWARE("radeon/OLAND_rlc.bin"); |
4266 |
+ MODULE_FIRMWARE("radeon/OLAND_smc.bin"); |
4267 |
+ MODULE_FIRMWARE("radeon/HAINAN_pfp.bin"); |
4268 |
+ MODULE_FIRMWARE("radeon/HAINAN_me.bin"); |
4269 |
+ MODULE_FIRMWARE("radeon/HAINAN_ce.bin"); |
4270 |
+ MODULE_FIRMWARE("radeon/HAINAN_mc.bin"); |
4271 |
++MODULE_FIRMWARE("radeon/HAINAN_mc2.bin"); |
4272 |
+ MODULE_FIRMWARE("radeon/HAINAN_rlc.bin"); |
4273 |
+ MODULE_FIRMWARE("radeon/HAINAN_smc.bin"); |
4274 |
+ |
4275 |
+@@ -1467,36 +1472,33 @@ int si_mc_load_microcode(struct radeon_device *rdev) |
4276 |
+ const __be32 *fw_data; |
4277 |
+ u32 running, blackout = 0; |
4278 |
+ u32 *io_mc_regs; |
4279 |
+- int i, ucode_size, regs_size; |
4280 |
++ int i, regs_size, ucode_size; |
4281 |
+ |
4282 |
+ if (!rdev->mc_fw) |
4283 |
+ return -EINVAL; |
4284 |
+ |
4285 |
++ ucode_size = rdev->mc_fw->size / 4; |
4286 |
++ |
4287 |
+ switch (rdev->family) { |
4288 |
+ case CHIP_TAHITI: |
4289 |
+ io_mc_regs = (u32 *)&tahiti_io_mc_regs; |
4290 |
+- ucode_size = SI_MC_UCODE_SIZE; |
4291 |
+ regs_size = TAHITI_IO_MC_REGS_SIZE; |
4292 |
+ break; |
4293 |
+ case CHIP_PITCAIRN: |
4294 |
+ io_mc_regs = (u32 *)&pitcairn_io_mc_regs; |
4295 |
+- ucode_size = SI_MC_UCODE_SIZE; |
4296 |
+ regs_size = TAHITI_IO_MC_REGS_SIZE; |
4297 |
+ break; |
4298 |
+ case CHIP_VERDE: |
4299 |
+ default: |
4300 |
+ io_mc_regs = (u32 *)&verde_io_mc_regs; |
4301 |
+- ucode_size = SI_MC_UCODE_SIZE; |
4302 |
+ regs_size = TAHITI_IO_MC_REGS_SIZE; |
4303 |
+ break; |
4304 |
+ case CHIP_OLAND: |
4305 |
+ io_mc_regs = (u32 *)&oland_io_mc_regs; |
4306 |
+- ucode_size = OLAND_MC_UCODE_SIZE; |
4307 |
+ regs_size = TAHITI_IO_MC_REGS_SIZE; |
4308 |
+ break; |
4309 |
+ case CHIP_HAINAN: |
4310 |
+ io_mc_regs = (u32 *)&hainan_io_mc_regs; |
4311 |
+- ucode_size = OLAND_MC_UCODE_SIZE; |
4312 |
+ regs_size = TAHITI_IO_MC_REGS_SIZE; |
4313 |
+ break; |
4314 |
+ } |
4315 |
+@@ -1552,7 +1554,7 @@ static int si_init_microcode(struct radeon_device *rdev) |
4316 |
+ const char *chip_name; |
4317 |
+ const char *rlc_chip_name; |
4318 |
+ size_t pfp_req_size, me_req_size, ce_req_size, rlc_req_size, mc_req_size; |
4319 |
+- size_t smc_req_size; |
4320 |
++ size_t smc_req_size, mc2_req_size; |
4321 |
+ char fw_name[30]; |
4322 |
+ int err; |
4323 |
+ |
4324 |
+@@ -1567,6 +1569,7 @@ static int si_init_microcode(struct radeon_device *rdev) |
4325 |
+ ce_req_size = SI_CE_UCODE_SIZE * 4; |
4326 |
+ rlc_req_size = SI_RLC_UCODE_SIZE * 4; |
4327 |
+ mc_req_size = SI_MC_UCODE_SIZE * 4; |
4328 |
++ mc2_req_size = TAHITI_MC_UCODE_SIZE * 4; |
4329 |
+ smc_req_size = ALIGN(TAHITI_SMC_UCODE_SIZE, 4); |
4330 |
+ break; |
4331 |
+ case CHIP_PITCAIRN: |
4332 |
+@@ -1577,6 +1580,7 @@ static int si_init_microcode(struct radeon_device *rdev) |
4333 |
+ ce_req_size = SI_CE_UCODE_SIZE * 4; |
4334 |
+ rlc_req_size = SI_RLC_UCODE_SIZE * 4; |
4335 |
+ mc_req_size = SI_MC_UCODE_SIZE * 4; |
4336 |
++ mc2_req_size = PITCAIRN_MC_UCODE_SIZE * 4; |
4337 |
+ smc_req_size = ALIGN(PITCAIRN_SMC_UCODE_SIZE, 4); |
4338 |
+ break; |
4339 |
+ case CHIP_VERDE: |
4340 |
+@@ -1587,6 +1591,7 @@ static int si_init_microcode(struct radeon_device *rdev) |
4341 |
+ ce_req_size = SI_CE_UCODE_SIZE * 4; |
4342 |
+ rlc_req_size = SI_RLC_UCODE_SIZE * 4; |
4343 |
+ mc_req_size = SI_MC_UCODE_SIZE * 4; |
4344 |
++ mc2_req_size = VERDE_MC_UCODE_SIZE * 4; |
4345 |
+ smc_req_size = ALIGN(VERDE_SMC_UCODE_SIZE, 4); |
4346 |
+ break; |
4347 |
+ case CHIP_OLAND: |
4348 |
+@@ -1596,7 +1601,7 @@ static int si_init_microcode(struct radeon_device *rdev) |
4349 |
+ me_req_size = SI_PM4_UCODE_SIZE * 4; |
4350 |
+ ce_req_size = SI_CE_UCODE_SIZE * 4; |
4351 |
+ rlc_req_size = SI_RLC_UCODE_SIZE * 4; |
4352 |
+- mc_req_size = OLAND_MC_UCODE_SIZE * 4; |
4353 |
++ mc_req_size = mc2_req_size = OLAND_MC_UCODE_SIZE * 4; |
4354 |
+ smc_req_size = ALIGN(OLAND_SMC_UCODE_SIZE, 4); |
4355 |
+ break; |
4356 |
+ case CHIP_HAINAN: |
4357 |
+@@ -1606,7 +1611,7 @@ static int si_init_microcode(struct radeon_device *rdev) |
4358 |
+ me_req_size = SI_PM4_UCODE_SIZE * 4; |
4359 |
+ ce_req_size = SI_CE_UCODE_SIZE * 4; |
4360 |
+ rlc_req_size = SI_RLC_UCODE_SIZE * 4; |
4361 |
+- mc_req_size = OLAND_MC_UCODE_SIZE * 4; |
4362 |
++ mc_req_size = mc2_req_size = OLAND_MC_UCODE_SIZE * 4; |
4363 |
+ smc_req_size = ALIGN(HAINAN_SMC_UCODE_SIZE, 4); |
4364 |
+ break; |
4365 |
+ default: BUG(); |
4366 |
+@@ -1659,16 +1664,22 @@ static int si_init_microcode(struct radeon_device *rdev) |
4367 |
+ err = -EINVAL; |
4368 |
+ } |
4369 |
+ |
4370 |
+- snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); |
4371 |
++ snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc2.bin", chip_name); |
4372 |
+ err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); |
4373 |
+- if (err) |
4374 |
+- goto out; |
4375 |
+- if (rdev->mc_fw->size != mc_req_size) { |
4376 |
++ if (err) { |
4377 |
++ snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); |
4378 |
++ err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); |
4379 |
++ if (err) |
4380 |
++ goto out; |
4381 |
++ } |
4382 |
++ if ((rdev->mc_fw->size != mc_req_size) && |
4383 |
++ (rdev->mc_fw->size != mc2_req_size)) { |
4384 |
+ printk(KERN_ERR |
4385 |
+ "si_mc: Bogus length %zu in firmware \"%s\"\n", |
4386 |
+ rdev->mc_fw->size, fw_name); |
4387 |
+ err = -EINVAL; |
4388 |
+ } |
4389 |
++ DRM_INFO("%s: %zu bytes\n", fw_name, rdev->mc_fw->size); |
4390 |
+ |
4391 |
+ snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); |
4392 |
+ err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); |
4393 |
+@@ -5777,7 +5788,6 @@ int si_irq_set(struct radeon_device *rdev) |
4394 |
+ u32 crtc1 = 0, crtc2 = 0, crtc3 = 0, crtc4 = 0, crtc5 = 0, crtc6 = 0; |
4395 |
+ u32 hpd1 = 0, hpd2 = 0, hpd3 = 0, hpd4 = 0, hpd5 = 0, hpd6 = 0; |
4396 |
+ u32 grbm_int_cntl = 0; |
4397 |
+- u32 grph1 = 0, grph2 = 0, grph3 = 0, grph4 = 0, grph5 = 0, grph6 = 0; |
4398 |
+ u32 dma_cntl, dma_cntl1; |
4399 |
+ u32 thermal_int = 0; |
4400 |
+ |
4401 |
+@@ -5916,16 +5926,22 @@ int si_irq_set(struct radeon_device *rdev) |
4402 |
+ } |
4403 |
+ |
4404 |
+ if (rdev->num_crtc >= 2) { |
4405 |
+- WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, grph1); |
4406 |
+- WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, grph2); |
4407 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, |
4408 |
++ GRPH_PFLIP_INT_MASK); |
4409 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, |
4410 |
++ GRPH_PFLIP_INT_MASK); |
4411 |
+ } |
4412 |
+ if (rdev->num_crtc >= 4) { |
4413 |
+- WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, grph3); |
4414 |
+- WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, grph4); |
4415 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, |
4416 |
++ GRPH_PFLIP_INT_MASK); |
4417 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, |
4418 |
++ GRPH_PFLIP_INT_MASK); |
4419 |
+ } |
4420 |
+ if (rdev->num_crtc >= 6) { |
4421 |
+- WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, grph5); |
4422 |
+- WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, grph6); |
4423 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, |
4424 |
++ GRPH_PFLIP_INT_MASK); |
4425 |
++ WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, |
4426 |
++ GRPH_PFLIP_INT_MASK); |
4427 |
+ } |
4428 |
+ |
4429 |
+ if (!ASIC_IS_NODCE(rdev)) { |
4430 |
+@@ -6289,6 +6305,15 @@ restart_ih: |
4431 |
+ break; |
4432 |
+ } |
4433 |
+ break; |
4434 |
++ case 8: /* D1 page flip */ |
4435 |
++ case 10: /* D2 page flip */ |
4436 |
++ case 12: /* D3 page flip */ |
4437 |
++ case 14: /* D4 page flip */ |
4438 |
++ case 16: /* D5 page flip */ |
4439 |
++ case 18: /* D6 page flip */ |
4440 |
++ DRM_DEBUG("IH: D%d flip\n", ((src_id - 8) >> 1) + 1); |
4441 |
++ radeon_crtc_handle_flip(rdev, (src_id - 8) >> 1); |
4442 |
++ break; |
4443 |
+ case 42: /* HPD hotplug */ |
4444 |
+ switch (src_data) { |
4445 |
+ case 0: |
4446 |
+diff --git a/drivers/gpu/drm/radeon/uvd_v1_0.c b/drivers/gpu/drm/radeon/uvd_v1_0.c |
4447 |
+index d4a68af1a279..c310a0aeebb9 100644 |
4448 |
+--- a/drivers/gpu/drm/radeon/uvd_v1_0.c |
4449 |
++++ b/drivers/gpu/drm/radeon/uvd_v1_0.c |
4450 |
+@@ -83,7 +83,10 @@ int uvd_v1_0_init(struct radeon_device *rdev) |
4451 |
+ int r; |
4452 |
+ |
4453 |
+ /* raise clocks while booting up the VCPU */ |
4454 |
+- radeon_set_uvd_clocks(rdev, 53300, 40000); |
4455 |
++ if (rdev->family < CHIP_RV740) |
4456 |
++ radeon_set_uvd_clocks(rdev, 10000, 10000); |
4457 |
++ else |
4458 |
++ radeon_set_uvd_clocks(rdev, 53300, 40000); |
4459 |
+ |
4460 |
+ r = uvd_v1_0_start(rdev); |
4461 |
+ if (r) |
4462 |
+@@ -407,7 +410,10 @@ int uvd_v1_0_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) |
4463 |
+ struct radeon_fence *fence = NULL; |
4464 |
+ int r; |
4465 |
+ |
4466 |
+- r = radeon_set_uvd_clocks(rdev, 53300, 40000); |
4467 |
++ if (rdev->family < CHIP_RV740) |
4468 |
++ r = radeon_set_uvd_clocks(rdev, 10000, 10000); |
4469 |
++ else |
4470 |
++ r = radeon_set_uvd_clocks(rdev, 53300, 40000); |
4471 |
+ if (r) { |
4472 |
+ DRM_ERROR("radeon: failed to raise UVD clocks (%d).\n", r); |
4473 |
+ return r; |
4474 |
+diff --git a/drivers/gpu/host1x/hw/intr_hw.c b/drivers/gpu/host1x/hw/intr_hw.c |
4475 |
+index db9017adfe2b..498b37e39058 100644 |
4476 |
+--- a/drivers/gpu/host1x/hw/intr_hw.c |
4477 |
++++ b/drivers/gpu/host1x/hw/intr_hw.c |
4478 |
+@@ -47,7 +47,7 @@ static irqreturn_t syncpt_thresh_isr(int irq, void *dev_id) |
4479 |
+ unsigned long reg; |
4480 |
+ int i, id; |
4481 |
+ |
4482 |
+- for (i = 0; i <= BIT_WORD(host->info->nb_pts); i++) { |
4483 |
++ for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); i++) { |
4484 |
+ reg = host1x_sync_readl(host, |
4485 |
+ HOST1X_SYNC_SYNCPT_THRESH_CPU0_INT_STATUS(i)); |
4486 |
+ for_each_set_bit(id, ®, BITS_PER_LONG) { |
4487 |
+@@ -64,7 +64,7 @@ static void _host1x_intr_disable_all_syncpt_intrs(struct host1x *host) |
4488 |
+ { |
4489 |
+ u32 i; |
4490 |
+ |
4491 |
+- for (i = 0; i <= BIT_WORD(host->info->nb_pts); ++i) { |
4492 |
++ for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); ++i) { |
4493 |
+ host1x_sync_writel(host, 0xffffffffu, |
4494 |
+ HOST1X_SYNC_SYNCPT_THRESH_INT_DISABLE(i)); |
4495 |
+ host1x_sync_writel(host, 0xffffffffu, |
4496 |
+diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c |
4497 |
+index bbb0b0d463f7..15993103c1a2 100644 |
4498 |
+--- a/drivers/hwmon/coretemp.c |
4499 |
++++ b/drivers/hwmon/coretemp.c |
4500 |
+@@ -369,12 +369,12 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) |
4501 |
+ if (cpu_has_tjmax(c)) |
4502 |
+ dev_warn(dev, "Unable to read TjMax from CPU %u\n", id); |
4503 |
+ } else { |
4504 |
+- val = (eax >> 16) & 0x7f; |
4505 |
++ val = (eax >> 16) & 0xff; |
4506 |
+ /* |
4507 |
+ * If the TjMax is not plausible, an assumption |
4508 |
+ * will be used |
4509 |
+ */ |
4510 |
+- if (val >= 85) { |
4511 |
++ if (val) { |
4512 |
+ dev_dbg(dev, "TjMax is %d degrees C\n", val); |
4513 |
+ return val * 1000; |
4514 |
+ } |
4515 |
+diff --git a/drivers/hwmon/emc1403.c b/drivers/hwmon/emc1403.c |
4516 |
+index 90ec1173b8a1..01723f04fe45 100644 |
4517 |
+--- a/drivers/hwmon/emc1403.c |
4518 |
++++ b/drivers/hwmon/emc1403.c |
4519 |
+@@ -163,7 +163,7 @@ static ssize_t store_hyst(struct device *dev, |
4520 |
+ if (retval < 0) |
4521 |
+ goto fail; |
4522 |
+ |
4523 |
+- hyst = val - retval * 1000; |
4524 |
++ hyst = retval * 1000 - val; |
4525 |
+ hyst = DIV_ROUND_CLOSEST(hyst, 1000); |
4526 |
+ if (hyst < 0 || hyst > 255) { |
4527 |
+ retval = -ERANGE; |
4528 |
+@@ -330,7 +330,7 @@ static int emc1403_detect(struct i2c_client *client, |
4529 |
+ } |
4530 |
+ |
4531 |
+ id = i2c_smbus_read_byte_data(client, THERMAL_REVISION_REG); |
4532 |
+- if (id != 0x01) |
4533 |
++ if (id < 0x01 || id > 0x04) |
4534 |
+ return -ENODEV; |
4535 |
+ |
4536 |
+ return 0; |
4537 |
+@@ -355,9 +355,9 @@ static int emc1403_probe(struct i2c_client *client, |
4538 |
+ if (id->driver_data) |
4539 |
+ data->groups[1] = &emc1404_group; |
4540 |
+ |
4541 |
+- hwmon_dev = hwmon_device_register_with_groups(&client->dev, |
4542 |
+- client->name, data, |
4543 |
+- data->groups); |
4544 |
++ hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev, |
4545 |
++ client->name, data, |
4546 |
++ data->groups); |
4547 |
+ if (IS_ERR(hwmon_dev)) |
4548 |
+ return PTR_ERR(hwmon_dev); |
4549 |
+ |
4550 |
+diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig |
4551 |
+index de17c5593d97..c5eec0290b37 100644 |
4552 |
+--- a/drivers/i2c/busses/Kconfig |
4553 |
++++ b/drivers/i2c/busses/Kconfig |
4554 |
+@@ -110,6 +110,7 @@ config I2C_I801 |
4555 |
+ Wellsburg (PCH) |
4556 |
+ Coleto Creek (PCH) |
4557 |
+ Wildcat Point-LP (PCH) |
4558 |
++ BayTrail (SOC) |
4559 |
+ |
4560 |
+ This driver can also be built as a module. If so, the module |
4561 |
+ will be called i2c-i801. |
4562 |
+diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c |
4563 |
+index 14c4b30d4ccc..d95b93016b0d 100644 |
4564 |
+--- a/drivers/i2c/busses/i2c-designware-core.c |
4565 |
++++ b/drivers/i2c/busses/i2c-designware-core.c |
4566 |
+@@ -417,6 +417,9 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev) |
4567 |
+ */ |
4568 |
+ dw_writel(dev, msgs[dev->msg_write_idx].addr | ic_tar, DW_IC_TAR); |
4569 |
+ |
4570 |
++ /* enforce disabled interrupts (due to HW issues) */ |
4571 |
++ i2c_dw_disable_int(dev); |
4572 |
++ |
4573 |
+ /* Enable the adapter */ |
4574 |
+ __i2c_dw_enable(dev, true); |
4575 |
+ |
4576 |
+diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c |
4577 |
+index 349c2d35e792..899f55937ca6 100644 |
4578 |
+--- a/drivers/i2c/busses/i2c-i801.c |
4579 |
++++ b/drivers/i2c/busses/i2c-i801.c |
4580 |
+@@ -60,6 +60,7 @@ |
4581 |
+ Wellsburg (PCH) MS 0x8d7f 32 hard yes yes yes |
4582 |
+ Coleto Creek (PCH) 0x23b0 32 hard yes yes yes |
4583 |
+ Wildcat Point-LP (PCH) 0x9ca2 32 hard yes yes yes |
4584 |
++ BayTrail (SOC) 0x0f12 32 hard yes yes yes |
4585 |
+ |
4586 |
+ Features supported by this driver: |
4587 |
+ Software PEC no |
4588 |
+@@ -161,6 +162,7 @@ |
4589 |
+ STATUS_ERROR_FLAGS) |
4590 |
+ |
4591 |
+ /* Older devices have their ID defined in <linux/pci_ids.h> */ |
4592 |
++#define PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS 0x0f12 |
4593 |
+ #define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22 |
4594 |
+ #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 |
4595 |
+ /* Patsburg also has three 'Integrated Device Function' SMBus controllers */ |
4596 |
+@@ -822,6 +824,7 @@ static DEFINE_PCI_DEVICE_TABLE(i801_ids) = { |
4597 |
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS2) }, |
4598 |
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_COLETOCREEK_SMBUS) }, |
4599 |
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_SMBUS) }, |
4600 |
++ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS) }, |
4601 |
+ { 0, } |
4602 |
+ }; |
4603 |
+ |
4604 |
+diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c |
4605 |
+index 0282d4d42805..d3c5d6216575 100644 |
4606 |
+--- a/drivers/i2c/busses/i2c-rcar.c |
4607 |
++++ b/drivers/i2c/busses/i2c-rcar.c |
4608 |
+@@ -561,6 +561,12 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, |
4609 |
+ |
4610 |
+ ret = -EINVAL; |
4611 |
+ for (i = 0; i < num; i++) { |
4612 |
++ /* This HW can't send STOP after address phase */ |
4613 |
++ if (msgs[i].len == 0) { |
4614 |
++ ret = -EOPNOTSUPP; |
4615 |
++ break; |
4616 |
++ } |
4617 |
++ |
4618 |
+ /*-------------- spin lock -----------------*/ |
4619 |
+ spin_lock_irqsave(&priv->lock, flags); |
4620 |
+ |
4621 |
+@@ -625,7 +631,8 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, |
4622 |
+ |
4623 |
+ static u32 rcar_i2c_func(struct i2c_adapter *adap) |
4624 |
+ { |
4625 |
+- return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; |
4626 |
++ /* This HW can't do SMBUS_QUICK and NOSTART */ |
4627 |
++ return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK); |
4628 |
+ } |
4629 |
+ |
4630 |
+ static const struct i2c_algorithm rcar_i2c_algo = { |
4631 |
+diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c |
4632 |
+index 684d21e71e4a..93ec37649346 100644 |
4633 |
+--- a/drivers/i2c/busses/i2c-s3c2410.c |
4634 |
++++ b/drivers/i2c/busses/i2c-s3c2410.c |
4635 |
+@@ -1247,10 +1247,10 @@ static int s3c24xx_i2c_resume(struct device *dev) |
4636 |
+ struct platform_device *pdev = to_platform_device(dev); |
4637 |
+ struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); |
4638 |
+ |
4639 |
+- i2c->suspended = 0; |
4640 |
+ clk_prepare_enable(i2c->clk); |
4641 |
+ s3c24xx_i2c_init(i2c); |
4642 |
+ clk_disable_unprepare(i2c->clk); |
4643 |
++ i2c->suspended = 0; |
4644 |
+ |
4645 |
+ return 0; |
4646 |
+ } |
4647 |
+diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c |
4648 |
+index df7f1e1157ae..27a91768cc72 100644 |
4649 |
+--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c |
4650 |
++++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c |
4651 |
+@@ -661,6 +661,7 @@ static int inv_mpu_probe(struct i2c_client *client, |
4652 |
+ { |
4653 |
+ struct inv_mpu6050_state *st; |
4654 |
+ struct iio_dev *indio_dev; |
4655 |
++ struct inv_mpu6050_platform_data *pdata; |
4656 |
+ int result; |
4657 |
+ |
4658 |
+ if (!i2c_check_functionality(client->adapter, |
4659 |
+@@ -673,8 +674,10 @@ static int inv_mpu_probe(struct i2c_client *client, |
4660 |
+ |
4661 |
+ st = iio_priv(indio_dev); |
4662 |
+ st->client = client; |
4663 |
+- st->plat_data = *(struct inv_mpu6050_platform_data |
4664 |
+- *)dev_get_platdata(&client->dev); |
4665 |
++ pdata = (struct inv_mpu6050_platform_data |
4666 |
++ *)dev_get_platdata(&client->dev); |
4667 |
++ if (pdata) |
4668 |
++ st->plat_data = *pdata; |
4669 |
+ /* power is turned on inside check chip type*/ |
4670 |
+ result = inv_check_and_setup_chip(st, id); |
4671 |
+ if (result) |
4672 |
+diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c |
4673 |
+index f596b413a35b..51766b3bc678 100644 |
4674 |
+--- a/drivers/infiniband/ulp/isert/ib_isert.c |
4675 |
++++ b/drivers/infiniband/ulp/isert/ib_isert.c |
4676 |
+@@ -28,6 +28,7 @@ |
4677 |
+ #include <target/target_core_base.h> |
4678 |
+ #include <target/target_core_fabric.h> |
4679 |
+ #include <target/iscsi/iscsi_transport.h> |
4680 |
++#include <linux/semaphore.h> |
4681 |
+ |
4682 |
+ #include "isert_proto.h" |
4683 |
+ #include "ib_isert.h" |
4684 |
+@@ -582,11 +583,11 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) |
4685 |
+ goto out_conn_dev; |
4686 |
+ |
4687 |
+ mutex_lock(&isert_np->np_accept_mutex); |
4688 |
+- list_add_tail(&isert_np->np_accept_list, &isert_conn->conn_accept_node); |
4689 |
++ list_add_tail(&isert_conn->conn_accept_node, &isert_np->np_accept_list); |
4690 |
+ mutex_unlock(&isert_np->np_accept_mutex); |
4691 |
+ |
4692 |
+- pr_debug("isert_connect_request() waking up np_accept_wq: %p\n", np); |
4693 |
+- wake_up(&isert_np->np_accept_wq); |
4694 |
++ pr_debug("isert_connect_request() up np_sem np: %p\n", np); |
4695 |
++ up(&isert_np->np_sem); |
4696 |
+ return 0; |
4697 |
+ |
4698 |
+ out_conn_dev: |
4699 |
+@@ -2569,7 +2570,7 @@ isert_setup_np(struct iscsi_np *np, |
4700 |
+ pr_err("Unable to allocate struct isert_np\n"); |
4701 |
+ return -ENOMEM; |
4702 |
+ } |
4703 |
+- init_waitqueue_head(&isert_np->np_accept_wq); |
4704 |
++ sema_init(&isert_np->np_sem, 0); |
4705 |
+ mutex_init(&isert_np->np_accept_mutex); |
4706 |
+ INIT_LIST_HEAD(&isert_np->np_accept_list); |
4707 |
+ init_completion(&isert_np->np_login_comp); |
4708 |
+@@ -2618,18 +2619,6 @@ out: |
4709 |
+ } |
4710 |
+ |
4711 |
+ static int |
4712 |
+-isert_check_accept_queue(struct isert_np *isert_np) |
4713 |
+-{ |
4714 |
+- int empty; |
4715 |
+- |
4716 |
+- mutex_lock(&isert_np->np_accept_mutex); |
4717 |
+- empty = list_empty(&isert_np->np_accept_list); |
4718 |
+- mutex_unlock(&isert_np->np_accept_mutex); |
4719 |
+- |
4720 |
+- return empty; |
4721 |
+-} |
4722 |
+- |
4723 |
+-static int |
4724 |
+ isert_rdma_accept(struct isert_conn *isert_conn) |
4725 |
+ { |
4726 |
+ struct rdma_cm_id *cm_id = isert_conn->conn_cm_id; |
4727 |
+@@ -2721,16 +2710,14 @@ isert_accept_np(struct iscsi_np *np, struct iscsi_conn *conn) |
4728 |
+ int max_accept = 0, ret; |
4729 |
+ |
4730 |
+ accept_wait: |
4731 |
+- ret = wait_event_interruptible(isert_np->np_accept_wq, |
4732 |
+- !isert_check_accept_queue(isert_np) || |
4733 |
+- np->np_thread_state == ISCSI_NP_THREAD_RESET); |
4734 |
++ ret = down_interruptible(&isert_np->np_sem); |
4735 |
+ if (max_accept > 5) |
4736 |
+ return -ENODEV; |
4737 |
+ |
4738 |
+ spin_lock_bh(&np->np_thread_lock); |
4739 |
+ if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { |
4740 |
+ spin_unlock_bh(&np->np_thread_lock); |
4741 |
+- pr_err("ISCSI_NP_THREAD_RESET for isert_accept_np\n"); |
4742 |
++ pr_debug("ISCSI_NP_THREAD_RESET for isert_accept_np\n"); |
4743 |
+ return -ENODEV; |
4744 |
+ } |
4745 |
+ spin_unlock_bh(&np->np_thread_lock); |
4746 |
+diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h |
4747 |
+index f6ae7f5dd408..c3578f6091d2 100644 |
4748 |
+--- a/drivers/infiniband/ulp/isert/ib_isert.h |
4749 |
++++ b/drivers/infiniband/ulp/isert/ib_isert.h |
4750 |
+@@ -158,7 +158,7 @@ struct isert_device { |
4751 |
+ }; |
4752 |
+ |
4753 |
+ struct isert_np { |
4754 |
+- wait_queue_head_t np_accept_wq; |
4755 |
++ struct semaphore np_sem; |
4756 |
+ struct rdma_cm_id *np_cm_id; |
4757 |
+ struct mutex np_accept_mutex; |
4758 |
+ struct list_head np_accept_list; |
4759 |
+diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c |
4760 |
+index 2626773ff29b..2dd1d0dd4f7d 100644 |
4761 |
+--- a/drivers/input/keyboard/atkbd.c |
4762 |
++++ b/drivers/input/keyboard/atkbd.c |
4763 |
+@@ -243,6 +243,12 @@ static void (*atkbd_platform_fixup)(struct atkbd *, const void *data); |
4764 |
+ static void *atkbd_platform_fixup_data; |
4765 |
+ static unsigned int (*atkbd_platform_scancode_fixup)(struct atkbd *, unsigned int); |
4766 |
+ |
4767 |
++/* |
4768 |
++ * Certain keyboards to not like ATKBD_CMD_RESET_DIS and stop responding |
4769 |
++ * to many commands until full reset (ATKBD_CMD_RESET_BAT) is performed. |
4770 |
++ */ |
4771 |
++static bool atkbd_skip_deactivate; |
4772 |
++ |
4773 |
+ static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, |
4774 |
+ ssize_t (*handler)(struct atkbd *, char *)); |
4775 |
+ static ssize_t atkbd_attr_set_helper(struct device *dev, const char *buf, size_t count, |
4776 |
+@@ -768,7 +774,8 @@ static int atkbd_probe(struct atkbd *atkbd) |
4777 |
+ * Make sure nothing is coming from the keyboard and disturbs our |
4778 |
+ * internal state. |
4779 |
+ */ |
4780 |
+- atkbd_deactivate(atkbd); |
4781 |
++ if (!atkbd_skip_deactivate) |
4782 |
++ atkbd_deactivate(atkbd); |
4783 |
+ |
4784 |
+ return 0; |
4785 |
+ } |
4786 |
+@@ -1638,6 +1645,12 @@ static int __init atkbd_setup_scancode_fixup(const struct dmi_system_id *id) |
4787 |
+ return 1; |
4788 |
+ } |
4789 |
+ |
4790 |
++static int __init atkbd_deactivate_fixup(const struct dmi_system_id *id) |
4791 |
++{ |
4792 |
++ atkbd_skip_deactivate = true; |
4793 |
++ return 1; |
4794 |
++} |
4795 |
++ |
4796 |
+ static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = { |
4797 |
+ { |
4798 |
+ .matches = { |
4799 |
+@@ -1775,6 +1788,20 @@ static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = { |
4800 |
+ .callback = atkbd_setup_scancode_fixup, |
4801 |
+ .driver_data = atkbd_oqo_01plus_scancode_fixup, |
4802 |
+ }, |
4803 |
++ { |
4804 |
++ .matches = { |
4805 |
++ DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), |
4806 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "LW25-B7HV"), |
4807 |
++ }, |
4808 |
++ .callback = atkbd_deactivate_fixup, |
4809 |
++ }, |
4810 |
++ { |
4811 |
++ .matches = { |
4812 |
++ DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), |
4813 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "P1-J273B"), |
4814 |
++ }, |
4815 |
++ .callback = atkbd_deactivate_fixup, |
4816 |
++ }, |
4817 |
+ { } |
4818 |
+ }; |
4819 |
+ |
4820 |
+diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c |
4821 |
+index ef1cf52f8bb9..230cdcf8e6fe 100644 |
4822 |
+--- a/drivers/input/mouse/elantech.c |
4823 |
++++ b/drivers/input/mouse/elantech.c |
4824 |
+@@ -11,6 +11,7 @@ |
4825 |
+ */ |
4826 |
+ |
4827 |
+ #include <linux/delay.h> |
4828 |
++#include <linux/dmi.h> |
4829 |
+ #include <linux/slab.h> |
4830 |
+ #include <linux/module.h> |
4831 |
+ #include <linux/input.h> |
4832 |
+@@ -831,7 +832,11 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse) |
4833 |
+ break; |
4834 |
+ |
4835 |
+ case 3: |
4836 |
+- etd->reg_10 = 0x0b; |
4837 |
++ if (etd->set_hw_resolution) |
4838 |
++ etd->reg_10 = 0x0b; |
4839 |
++ else |
4840 |
++ etd->reg_10 = 0x03; |
4841 |
++ |
4842 |
+ if (elantech_write_reg(psmouse, 0x10, etd->reg_10)) |
4843 |
+ rc = -1; |
4844 |
+ |
4845 |
+@@ -1331,6 +1336,22 @@ static int elantech_reconnect(struct psmouse *psmouse) |
4846 |
+ } |
4847 |
+ |
4848 |
+ /* |
4849 |
++ * Some hw_version 3 models go into error state when we try to set bit 3 of r10 |
4850 |
++ */ |
4851 |
++static const struct dmi_system_id no_hw_res_dmi_table[] = { |
4852 |
++#if defined(CONFIG_DMI) && defined(CONFIG_X86) |
4853 |
++ { |
4854 |
++ /* Gigabyte U2442 */ |
4855 |
++ .matches = { |
4856 |
++ DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"), |
4857 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "U2442"), |
4858 |
++ }, |
4859 |
++ }, |
4860 |
++#endif |
4861 |
++ { } |
4862 |
++}; |
4863 |
++ |
4864 |
++/* |
4865 |
+ * determine hardware version and set some properties according to it. |
4866 |
+ */ |
4867 |
+ static int elantech_set_properties(struct elantech_data *etd) |
4868 |
+@@ -1389,6 +1410,9 @@ static int elantech_set_properties(struct elantech_data *etd) |
4869 |
+ */ |
4870 |
+ etd->crc_enabled = ((etd->fw_version & 0x4000) == 0x4000); |
4871 |
+ |
4872 |
++ /* Enable real hardware resolution on hw_version 3 ? */ |
4873 |
++ etd->set_hw_resolution = !dmi_check_system(no_hw_res_dmi_table); |
4874 |
++ |
4875 |
+ return 0; |
4876 |
+ } |
4877 |
+ |
4878 |
+diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h |
4879 |
+index 036a04abaef7..9e0e2a1f340d 100644 |
4880 |
+--- a/drivers/input/mouse/elantech.h |
4881 |
++++ b/drivers/input/mouse/elantech.h |
4882 |
+@@ -130,6 +130,7 @@ struct elantech_data { |
4883 |
+ bool jumpy_cursor; |
4884 |
+ bool reports_pressure; |
4885 |
+ bool crc_enabled; |
4886 |
++ bool set_hw_resolution; |
4887 |
+ unsigned char hw_version; |
4888 |
+ unsigned int fw_version; |
4889 |
+ unsigned int single_finger_reports; |
4890 |
+diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c |
4891 |
+index 3c511c4adaca..c5ec703c727e 100644 |
4892 |
+--- a/drivers/input/mouse/synaptics.c |
4893 |
++++ b/drivers/input/mouse/synaptics.c |
4894 |
+@@ -117,6 +117,81 @@ void synaptics_reset(struct psmouse *psmouse) |
4895 |
+ } |
4896 |
+ |
4897 |
+ #ifdef CONFIG_MOUSE_PS2_SYNAPTICS |
4898 |
++struct min_max_quirk { |
4899 |
++ const char * const *pnp_ids; |
4900 |
++ int x_min, x_max, y_min, y_max; |
4901 |
++}; |
4902 |
++ |
4903 |
++static const struct min_max_quirk min_max_pnpid_table[] = { |
4904 |
++ { |
4905 |
++ (const char * const []){"LEN0033", NULL}, |
4906 |
++ 1024, 5052, 2258, 4832 |
4907 |
++ }, |
4908 |
++ { |
4909 |
++ (const char * const []){"LEN0035", "LEN0042", NULL}, |
4910 |
++ 1232, 5710, 1156, 4696 |
4911 |
++ }, |
4912 |
++ { |
4913 |
++ (const char * const []){"LEN0034", "LEN0036", "LEN2004", NULL}, |
4914 |
++ 1024, 5112, 2024, 4832 |
4915 |
++ }, |
4916 |
++ { |
4917 |
++ (const char * const []){"LEN2001", NULL}, |
4918 |
++ 1024, 5022, 2508, 4832 |
4919 |
++ }, |
4920 |
++ { } |
4921 |
++}; |
4922 |
++ |
4923 |
++/* This list has been kindly provided by Synaptics. */ |
4924 |
++static const char * const topbuttonpad_pnp_ids[] = { |
4925 |
++ "LEN0017", |
4926 |
++ "LEN0018", |
4927 |
++ "LEN0019", |
4928 |
++ "LEN0023", |
4929 |
++ "LEN002A", |
4930 |
++ "LEN002B", |
4931 |
++ "LEN002C", |
4932 |
++ "LEN002D", |
4933 |
++ "LEN002E", |
4934 |
++ "LEN0033", /* Helix */ |
4935 |
++ "LEN0034", /* T431s, L440, L540, T540, W540, X1 Carbon 2nd */ |
4936 |
++ "LEN0035", /* X240 */ |
4937 |
++ "LEN0036", /* T440 */ |
4938 |
++ "LEN0037", |
4939 |
++ "LEN0038", |
4940 |
++ "LEN0041", |
4941 |
++ "LEN0042", /* Yoga */ |
4942 |
++ "LEN0045", |
4943 |
++ "LEN0046", |
4944 |
++ "LEN0047", |
4945 |
++ "LEN0048", |
4946 |
++ "LEN0049", |
4947 |
++ "LEN2000", |
4948 |
++ "LEN2001", /* Edge E431 */ |
4949 |
++ "LEN2002", |
4950 |
++ "LEN2003", |
4951 |
++ "LEN2004", /* L440 */ |
4952 |
++ "LEN2005", |
4953 |
++ "LEN2006", |
4954 |
++ "LEN2007", |
4955 |
++ "LEN2008", |
4956 |
++ "LEN2009", |
4957 |
++ "LEN200A", |
4958 |
++ "LEN200B", |
4959 |
++ NULL |
4960 |
++}; |
4961 |
++ |
4962 |
++static bool matches_pnp_id(struct psmouse *psmouse, const char * const ids[]) |
4963 |
++{ |
4964 |
++ int i; |
4965 |
++ |
4966 |
++ if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4)) |
4967 |
++ for (i = 0; ids[i]; i++) |
4968 |
++ if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i])) |
4969 |
++ return true; |
4970 |
++ |
4971 |
++ return false; |
4972 |
++} |
4973 |
+ |
4974 |
+ /***************************************************************************** |
4975 |
+ * Synaptics communications functions |
4976 |
+@@ -266,20 +341,20 @@ static int synaptics_identify(struct psmouse *psmouse) |
4977 |
+ * Resolution is left zero if touchpad does not support the query |
4978 |
+ */ |
4979 |
+ |
4980 |
+-static const int *quirk_min_max; |
4981 |
+- |
4982 |
+ static int synaptics_resolution(struct psmouse *psmouse) |
4983 |
+ { |
4984 |
+ struct synaptics_data *priv = psmouse->private; |
4985 |
+ unsigned char resp[3]; |
4986 |
++ int i; |
4987 |
+ |
4988 |
+- if (quirk_min_max) { |
4989 |
+- priv->x_min = quirk_min_max[0]; |
4990 |
+- priv->x_max = quirk_min_max[1]; |
4991 |
+- priv->y_min = quirk_min_max[2]; |
4992 |
+- priv->y_max = quirk_min_max[3]; |
4993 |
+- return 0; |
4994 |
+- } |
4995 |
++ for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) |
4996 |
++ if (matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) { |
4997 |
++ priv->x_min = min_max_pnpid_table[i].x_min; |
4998 |
++ priv->x_max = min_max_pnpid_table[i].x_max; |
4999 |
++ priv->y_min = min_max_pnpid_table[i].y_min; |
5000 |
++ priv->y_max = min_max_pnpid_table[i].y_max; |
5001 |
++ return 0; |
5002 |
++ } |
5003 |
+ |
5004 |
+ if (SYN_ID_MAJOR(priv->identity) < 4) |
5005 |
+ return 0; |
5006 |
+@@ -1255,8 +1330,10 @@ static void set_abs_position_params(struct input_dev *dev, |
5007 |
+ input_abs_set_res(dev, y_code, priv->y_res); |
5008 |
+ } |
5009 |
+ |
5010 |
+-static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) |
5011 |
++static void set_input_params(struct psmouse *psmouse, |
5012 |
++ struct synaptics_data *priv) |
5013 |
+ { |
5014 |
++ struct input_dev *dev = psmouse->dev; |
5015 |
+ int i; |
5016 |
+ |
5017 |
+ /* Things that apply to both modes */ |
5018 |
+@@ -1325,6 +1402,8 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) |
5019 |
+ |
5020 |
+ if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { |
5021 |
+ __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); |
5022 |
++ if (matches_pnp_id(psmouse, topbuttonpad_pnp_ids)) |
5023 |
++ __set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit); |
5024 |
+ /* Clickpads report only left button */ |
5025 |
+ __clear_bit(BTN_RIGHT, dev->keybit); |
5026 |
+ __clear_bit(BTN_MIDDLE, dev->keybit); |
5027 |
+@@ -1496,104 +1575,10 @@ static const struct dmi_system_id olpc_dmi_table[] __initconst = { |
5028 |
+ { } |
5029 |
+ }; |
5030 |
+ |
5031 |
+-static const struct dmi_system_id min_max_dmi_table[] __initconst = { |
5032 |
+-#if defined(CONFIG_DMI) |
5033 |
+- { |
5034 |
+- /* Lenovo ThinkPad Helix */ |
5035 |
+- .matches = { |
5036 |
+- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
5037 |
+- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix"), |
5038 |
+- }, |
5039 |
+- .driver_data = (int []){1024, 5052, 2258, 4832}, |
5040 |
+- }, |
5041 |
+- { |
5042 |
+- /* Lenovo ThinkPad X240 */ |
5043 |
+- .matches = { |
5044 |
+- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
5045 |
+- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X240"), |
5046 |
+- }, |
5047 |
+- .driver_data = (int []){1232, 5710, 1156, 4696}, |
5048 |
+- }, |
5049 |
+- { |
5050 |
+- /* Lenovo ThinkPad Edge E431 */ |
5051 |
+- .matches = { |
5052 |
+- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
5053 |
+- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Edge E431"), |
5054 |
+- }, |
5055 |
+- .driver_data = (int []){1024, 5022, 2508, 4832}, |
5056 |
+- }, |
5057 |
+- { |
5058 |
+- /* Lenovo ThinkPad T431s */ |
5059 |
+- .matches = { |
5060 |
+- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
5061 |
+- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T431"), |
5062 |
+- }, |
5063 |
+- .driver_data = (int []){1024, 5112, 2024, 4832}, |
5064 |
+- }, |
5065 |
+- { |
5066 |
+- /* Lenovo ThinkPad T440s */ |
5067 |
+- .matches = { |
5068 |
+- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
5069 |
+- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T440"), |
5070 |
+- }, |
5071 |
+- .driver_data = (int []){1024, 5112, 2024, 4832}, |
5072 |
+- }, |
5073 |
+- { |
5074 |
+- /* Lenovo ThinkPad L440 */ |
5075 |
+- .matches = { |
5076 |
+- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
5077 |
+- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L440"), |
5078 |
+- }, |
5079 |
+- .driver_data = (int []){1024, 5112, 2024, 4832}, |
5080 |
+- }, |
5081 |
+- { |
5082 |
+- /* Lenovo ThinkPad T540p */ |
5083 |
+- .matches = { |
5084 |
+- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
5085 |
+- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T540"), |
5086 |
+- }, |
5087 |
+- .driver_data = (int []){1024, 5056, 2058, 4832}, |
5088 |
+- }, |
5089 |
+- { |
5090 |
+- /* Lenovo ThinkPad L540 */ |
5091 |
+- .matches = { |
5092 |
+- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
5093 |
+- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L540"), |
5094 |
+- }, |
5095 |
+- .driver_data = (int []){1024, 5112, 2024, 4832}, |
5096 |
+- }, |
5097 |
+- { |
5098 |
+- /* Lenovo Yoga S1 */ |
5099 |
+- .matches = { |
5100 |
+- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
5101 |
+- DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, |
5102 |
+- "ThinkPad S1 Yoga"), |
5103 |
+- }, |
5104 |
+- .driver_data = (int []){1232, 5710, 1156, 4696}, |
5105 |
+- }, |
5106 |
+- { |
5107 |
+- /* Lenovo ThinkPad X1 Carbon Haswell (3rd generation) */ |
5108 |
+- .matches = { |
5109 |
+- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
5110 |
+- DMI_MATCH(DMI_PRODUCT_VERSION, |
5111 |
+- "ThinkPad X1 Carbon 2nd"), |
5112 |
+- }, |
5113 |
+- .driver_data = (int []){1024, 5112, 2024, 4832}, |
5114 |
+- }, |
5115 |
+-#endif |
5116 |
+- { } |
5117 |
+-}; |
5118 |
+- |
5119 |
+ void __init synaptics_module_init(void) |
5120 |
+ { |
5121 |
+- const struct dmi_system_id *min_max_dmi; |
5122 |
+- |
5123 |
+ impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table); |
5124 |
+ broken_olpc_ec = dmi_check_system(olpc_dmi_table); |
5125 |
+- |
5126 |
+- min_max_dmi = dmi_first_match(min_max_dmi_table); |
5127 |
+- if (min_max_dmi) |
5128 |
+- quirk_min_max = min_max_dmi->driver_data; |
5129 |
+ } |
5130 |
+ |
5131 |
+ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode) |
5132 |
+@@ -1643,7 +1628,7 @@ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode) |
5133 |
+ priv->capabilities, priv->ext_cap, priv->ext_cap_0c, |
5134 |
+ priv->board_id, priv->firmware_id); |
5135 |
+ |
5136 |
+- set_input_params(psmouse->dev, priv); |
5137 |
++ set_input_params(psmouse, priv); |
5138 |
+ |
5139 |
+ /* |
5140 |
+ * Encode touchpad model so that it can be used to set |
5141 |
+diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h |
5142 |
+index 0ec9abbe31fe..381b20d4c561 100644 |
5143 |
+--- a/drivers/input/serio/i8042-x86ia64io.h |
5144 |
++++ b/drivers/input/serio/i8042-x86ia64io.h |
5145 |
+@@ -702,6 +702,17 @@ static int i8042_pnp_aux_irq; |
5146 |
+ static char i8042_pnp_kbd_name[32]; |
5147 |
+ static char i8042_pnp_aux_name[32]; |
5148 |
+ |
5149 |
++static void i8042_pnp_id_to_string(struct pnp_id *id, char *dst, int dst_size) |
5150 |
++{ |
5151 |
++ strlcpy(dst, "PNP:", dst_size); |
5152 |
++ |
5153 |
++ while (id) { |
5154 |
++ strlcat(dst, " ", dst_size); |
5155 |
++ strlcat(dst, id->id, dst_size); |
5156 |
++ id = id->next; |
5157 |
++ } |
5158 |
++} |
5159 |
++ |
5160 |
+ static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did) |
5161 |
+ { |
5162 |
+ if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1) |
5163 |
+@@ -718,6 +729,8 @@ static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id * |
5164 |
+ strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name)); |
5165 |
+ strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name)); |
5166 |
+ } |
5167 |
++ i8042_pnp_id_to_string(dev->id, i8042_kbd_firmware_id, |
5168 |
++ sizeof(i8042_kbd_firmware_id)); |
5169 |
+ |
5170 |
+ /* Keyboard ports are always supposed to be wakeup-enabled */ |
5171 |
+ device_set_wakeup_enable(&dev->dev, true); |
5172 |
+@@ -742,6 +755,8 @@ static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id * |
5173 |
+ strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name)); |
5174 |
+ strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name)); |
5175 |
+ } |
5176 |
++ i8042_pnp_id_to_string(dev->id, i8042_aux_firmware_id, |
5177 |
++ sizeof(i8042_aux_firmware_id)); |
5178 |
+ |
5179 |
+ i8042_pnp_aux_devices++; |
5180 |
+ return 0; |
5181 |
+diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c |
5182 |
+index 020053fa5aaa..3807c3e971cc 100644 |
5183 |
+--- a/drivers/input/serio/i8042.c |
5184 |
++++ b/drivers/input/serio/i8042.c |
5185 |
+@@ -87,6 +87,8 @@ MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off"); |
5186 |
+ #endif |
5187 |
+ |
5188 |
+ static bool i8042_bypass_aux_irq_test; |
5189 |
++static char i8042_kbd_firmware_id[128]; |
5190 |
++static char i8042_aux_firmware_id[128]; |
5191 |
+ |
5192 |
+ #include "i8042.h" |
5193 |
+ |
5194 |
+@@ -1218,6 +1220,8 @@ static int __init i8042_create_kbd_port(void) |
5195 |
+ serio->dev.parent = &i8042_platform_device->dev; |
5196 |
+ strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name)); |
5197 |
+ strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys)); |
5198 |
++ strlcpy(serio->firmware_id, i8042_kbd_firmware_id, |
5199 |
++ sizeof(serio->firmware_id)); |
5200 |
+ |
5201 |
+ port->serio = serio; |
5202 |
+ port->irq = I8042_KBD_IRQ; |
5203 |
+@@ -1244,6 +1248,8 @@ static int __init i8042_create_aux_port(int idx) |
5204 |
+ if (idx < 0) { |
5205 |
+ strlcpy(serio->name, "i8042 AUX port", sizeof(serio->name)); |
5206 |
+ strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys)); |
5207 |
++ strlcpy(serio->firmware_id, i8042_aux_firmware_id, |
5208 |
++ sizeof(serio->firmware_id)); |
5209 |
+ serio->close = i8042_port_close; |
5210 |
+ } else { |
5211 |
+ snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx); |
5212 |
+diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c |
5213 |
+index 8f4c4ab04bc2..b29134de983b 100644 |
5214 |
+--- a/drivers/input/serio/serio.c |
5215 |
++++ b/drivers/input/serio/serio.c |
5216 |
+@@ -451,6 +451,13 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute * |
5217 |
+ return retval; |
5218 |
+ } |
5219 |
+ |
5220 |
++static ssize_t firmware_id_show(struct device *dev, struct device_attribute *attr, char *buf) |
5221 |
++{ |
5222 |
++ struct serio *serio = to_serio_port(dev); |
5223 |
++ |
5224 |
++ return sprintf(buf, "%s\n", serio->firmware_id); |
5225 |
++} |
5226 |
++ |
5227 |
+ static DEVICE_ATTR_RO(type); |
5228 |
+ static DEVICE_ATTR_RO(proto); |
5229 |
+ static DEVICE_ATTR_RO(id); |
5230 |
+@@ -473,12 +480,14 @@ static DEVICE_ATTR_RO(modalias); |
5231 |
+ static DEVICE_ATTR_WO(drvctl); |
5232 |
+ static DEVICE_ATTR(description, S_IRUGO, serio_show_description, NULL); |
5233 |
+ static DEVICE_ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode); |
5234 |
++static DEVICE_ATTR_RO(firmware_id); |
5235 |
+ |
5236 |
+ static struct attribute *serio_device_attrs[] = { |
5237 |
+ &dev_attr_modalias.attr, |
5238 |
+ &dev_attr_description.attr, |
5239 |
+ &dev_attr_drvctl.attr, |
5240 |
+ &dev_attr_bind_mode.attr, |
5241 |
++ &dev_attr_firmware_id.attr, |
5242 |
+ NULL |
5243 |
+ }; |
5244 |
+ |
5245 |
+@@ -921,9 +930,14 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env) |
5246 |
+ SERIO_ADD_UEVENT_VAR("SERIO_PROTO=%02x", serio->id.proto); |
5247 |
+ SERIO_ADD_UEVENT_VAR("SERIO_ID=%02x", serio->id.id); |
5248 |
+ SERIO_ADD_UEVENT_VAR("SERIO_EXTRA=%02x", serio->id.extra); |
5249 |
++ |
5250 |
+ SERIO_ADD_UEVENT_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X", |
5251 |
+ serio->id.type, serio->id.proto, serio->id.id, serio->id.extra); |
5252 |
+ |
5253 |
++ if (serio->firmware_id[0]) |
5254 |
++ SERIO_ADD_UEVENT_VAR("SERIO_FIRMWARE_ID=%s", |
5255 |
++ serio->firmware_id); |
5256 |
++ |
5257 |
+ return 0; |
5258 |
+ } |
5259 |
+ #undef SERIO_ADD_UEVENT_VAR |
5260 |
+diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c |
5261 |
+index faf0da4bb3a2..71776ff5aedc 100644 |
5262 |
+--- a/drivers/iommu/amd_iommu.c |
5263 |
++++ b/drivers/iommu/amd_iommu.c |
5264 |
+@@ -3999,7 +3999,7 @@ static struct irq_remap_table *get_irq_table(u16 devid, bool ioapic) |
5265 |
+ iommu_flush_dte(iommu, devid); |
5266 |
+ if (devid != alias) { |
5267 |
+ irq_lookup_table[alias] = table; |
5268 |
+- set_dte_irq_entry(devid, table); |
5269 |
++ set_dte_irq_entry(alias, table); |
5270 |
+ iommu_flush_dte(iommu, alias); |
5271 |
+ } |
5272 |
+ |
5273 |
+diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c |
5274 |
+index 540956465ed2..939eb0d8fbf1 100644 |
5275 |
+--- a/drivers/irqchip/irq-armada-370-xp.c |
5276 |
++++ b/drivers/irqchip/irq-armada-370-xp.c |
5277 |
+@@ -130,8 +130,7 @@ static int armada_370_xp_setup_msi_irq(struct msi_chip *chip, |
5278 |
+ struct msi_desc *desc) |
5279 |
+ { |
5280 |
+ struct msi_msg msg; |
5281 |
+- irq_hw_number_t hwirq; |
5282 |
+- int virq; |
5283 |
++ int virq, hwirq; |
5284 |
+ |
5285 |
+ hwirq = armada_370_xp_alloc_msi(); |
5286 |
+ if (hwirq < 0) |
5287 |
+@@ -157,8 +156,19 @@ static void armada_370_xp_teardown_msi_irq(struct msi_chip *chip, |
5288 |
+ unsigned int irq) |
5289 |
+ { |
5290 |
+ struct irq_data *d = irq_get_irq_data(irq); |
5291 |
++ unsigned long hwirq = d->hwirq; |
5292 |
++ |
5293 |
+ irq_dispose_mapping(irq); |
5294 |
+- armada_370_xp_free_msi(d->hwirq); |
5295 |
++ armada_370_xp_free_msi(hwirq); |
5296 |
++} |
5297 |
++ |
5298 |
++static int armada_370_xp_check_msi_device(struct msi_chip *chip, struct pci_dev *dev, |
5299 |
++ int nvec, int type) |
5300 |
++{ |
5301 |
++ /* We support MSI, but not MSI-X */ |
5302 |
++ if (type == PCI_CAP_ID_MSI) |
5303 |
++ return 0; |
5304 |
++ return -EINVAL; |
5305 |
+ } |
5306 |
+ |
5307 |
+ static struct irq_chip armada_370_xp_msi_irq_chip = { |
5308 |
+@@ -199,6 +209,7 @@ static int armada_370_xp_msi_init(struct device_node *node, |
5309 |
+ |
5310 |
+ msi_chip->setup_irq = armada_370_xp_setup_msi_irq; |
5311 |
+ msi_chip->teardown_irq = armada_370_xp_teardown_msi_irq; |
5312 |
++ msi_chip->check_device = armada_370_xp_check_msi_device; |
5313 |
+ msi_chip->of_node = node; |
5314 |
+ |
5315 |
+ armada_370_xp_msi_domain = |
5316 |
+diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c |
5317 |
+index 341c6016812d..ac2d41bd71a0 100644 |
5318 |
+--- a/drivers/irqchip/irq-gic.c |
5319 |
++++ b/drivers/irqchip/irq-gic.c |
5320 |
+@@ -246,10 +246,14 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val, |
5321 |
+ bool force) |
5322 |
+ { |
5323 |
+ void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + (gic_irq(d) & ~3); |
5324 |
+- unsigned int shift = (gic_irq(d) % 4) * 8; |
5325 |
+- unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask); |
5326 |
++ unsigned int cpu, shift = (gic_irq(d) % 4) * 8; |
5327 |
+ u32 val, mask, bit; |
5328 |
+ |
5329 |
++ if (!force) |
5330 |
++ cpu = cpumask_any_and(mask_val, cpu_online_mask); |
5331 |
++ else |
5332 |
++ cpu = cpumask_first(mask_val); |
5333 |
++ |
5334 |
+ if (cpu >= NR_GIC_CPU_IF || cpu >= nr_cpu_ids) |
5335 |
+ return -EINVAL; |
5336 |
+ |
5337 |
+diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c |
5338 |
+index 605047428b5a..a7b369fc3554 100644 |
5339 |
+--- a/drivers/leds/leds-pwm.c |
5340 |
++++ b/drivers/leds/leds-pwm.c |
5341 |
+@@ -84,6 +84,15 @@ static inline size_t sizeof_pwm_leds_priv(int num_leds) |
5342 |
+ (sizeof(struct led_pwm_data) * num_leds); |
5343 |
+ } |
5344 |
+ |
5345 |
++static void led_pwm_cleanup(struct led_pwm_priv *priv) |
5346 |
++{ |
5347 |
++ while (priv->num_leds--) { |
5348 |
++ led_classdev_unregister(&priv->leds[priv->num_leds].cdev); |
5349 |
++ if (priv->leds[priv->num_leds].can_sleep) |
5350 |
++ cancel_work_sync(&priv->leds[priv->num_leds].work); |
5351 |
++ } |
5352 |
++} |
5353 |
++ |
5354 |
+ static int led_pwm_create_of(struct platform_device *pdev, |
5355 |
+ struct led_pwm_priv *priv) |
5356 |
+ { |
5357 |
+@@ -131,8 +140,7 @@ static int led_pwm_create_of(struct platform_device *pdev, |
5358 |
+ |
5359 |
+ return 0; |
5360 |
+ err: |
5361 |
+- while (priv->num_leds--) |
5362 |
+- led_classdev_unregister(&priv->leds[priv->num_leds].cdev); |
5363 |
++ led_pwm_cleanup(priv); |
5364 |
+ |
5365 |
+ return ret; |
5366 |
+ } |
5367 |
+@@ -200,8 +208,8 @@ static int led_pwm_probe(struct platform_device *pdev) |
5368 |
+ return 0; |
5369 |
+ |
5370 |
+ err: |
5371 |
+- while (i--) |
5372 |
+- led_classdev_unregister(&priv->leds[i].cdev); |
5373 |
++ priv->num_leds = i; |
5374 |
++ led_pwm_cleanup(priv); |
5375 |
+ |
5376 |
+ return ret; |
5377 |
+ } |
5378 |
+@@ -209,13 +217,8 @@ err: |
5379 |
+ static int led_pwm_remove(struct platform_device *pdev) |
5380 |
+ { |
5381 |
+ struct led_pwm_priv *priv = platform_get_drvdata(pdev); |
5382 |
+- int i; |
5383 |
+ |
5384 |
+- for (i = 0; i < priv->num_leds; i++) { |
5385 |
+- led_classdev_unregister(&priv->leds[i].cdev); |
5386 |
+- if (priv->leds[i].can_sleep) |
5387 |
+- cancel_work_sync(&priv->leds[i].work); |
5388 |
+- } |
5389 |
++ led_pwm_cleanup(priv); |
5390 |
+ |
5391 |
+ return 0; |
5392 |
+ } |
5393 |
+diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c |
5394 |
+index b82b58f0bb85..9306e0bcb564 100644 |
5395 |
+--- a/drivers/md/dm-cache-target.c |
5396 |
++++ b/drivers/md/dm-cache-target.c |
5397 |
+@@ -2506,6 +2506,7 @@ static int cache_map(struct dm_target *ti, struct bio *bio) |
5398 |
+ |
5399 |
+ } else { |
5400 |
+ inc_hit_counter(cache, bio); |
5401 |
++ pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); |
5402 |
+ |
5403 |
+ if (bio_data_dir(bio) == WRITE && writethrough_mode(&cache->features) && |
5404 |
+ !is_dirty(cache, lookup_result.cblock)) |
5405 |
+diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c |
5406 |
+index 784695d22fde..53b213226c01 100644 |
5407 |
+--- a/drivers/md/dm-crypt.c |
5408 |
++++ b/drivers/md/dm-crypt.c |
5409 |
+@@ -19,7 +19,6 @@ |
5410 |
+ #include <linux/crypto.h> |
5411 |
+ #include <linux/workqueue.h> |
5412 |
+ #include <linux/backing-dev.h> |
5413 |
+-#include <linux/percpu.h> |
5414 |
+ #include <linux/atomic.h> |
5415 |
+ #include <linux/scatterlist.h> |
5416 |
+ #include <asm/page.h> |
5417 |
+@@ -43,6 +42,7 @@ struct convert_context { |
5418 |
+ struct bvec_iter iter_out; |
5419 |
+ sector_t cc_sector; |
5420 |
+ atomic_t cc_pending; |
5421 |
++ struct ablkcipher_request *req; |
5422 |
+ }; |
5423 |
+ |
5424 |
+ /* |
5425 |
+@@ -111,15 +111,7 @@ struct iv_tcw_private { |
5426 |
+ enum flags { DM_CRYPT_SUSPENDED, DM_CRYPT_KEY_VALID }; |
5427 |
+ |
5428 |
+ /* |
5429 |
+- * Duplicated per-CPU state for cipher. |
5430 |
+- */ |
5431 |
+-struct crypt_cpu { |
5432 |
+- struct ablkcipher_request *req; |
5433 |
+-}; |
5434 |
+- |
5435 |
+-/* |
5436 |
+- * The fields in here must be read only after initialization, |
5437 |
+- * changing state should be in crypt_cpu. |
5438 |
++ * The fields in here must be read only after initialization. |
5439 |
+ */ |
5440 |
+ struct crypt_config { |
5441 |
+ struct dm_dev *dev; |
5442 |
+@@ -150,12 +142,6 @@ struct crypt_config { |
5443 |
+ sector_t iv_offset; |
5444 |
+ unsigned int iv_size; |
5445 |
+ |
5446 |
+- /* |
5447 |
+- * Duplicated per cpu state. Access through |
5448 |
+- * per_cpu_ptr() only. |
5449 |
+- */ |
5450 |
+- struct crypt_cpu __percpu *cpu; |
5451 |
+- |
5452 |
+ /* ESSIV: struct crypto_cipher *essiv_tfm */ |
5453 |
+ void *iv_private; |
5454 |
+ struct crypto_ablkcipher **tfms; |
5455 |
+@@ -192,11 +178,6 @@ static void clone_init(struct dm_crypt_io *, struct bio *); |
5456 |
+ static void kcryptd_queue_crypt(struct dm_crypt_io *io); |
5457 |
+ static u8 *iv_of_dmreq(struct crypt_config *cc, struct dm_crypt_request *dmreq); |
5458 |
+ |
5459 |
+-static struct crypt_cpu *this_crypt_config(struct crypt_config *cc) |
5460 |
+-{ |
5461 |
+- return this_cpu_ptr(cc->cpu); |
5462 |
+-} |
5463 |
+- |
5464 |
+ /* |
5465 |
+ * Use this to access cipher attributes that are the same for each CPU. |
5466 |
+ */ |
5467 |
+@@ -903,16 +884,15 @@ static void kcryptd_async_done(struct crypto_async_request *async_req, |
5468 |
+ static void crypt_alloc_req(struct crypt_config *cc, |
5469 |
+ struct convert_context *ctx) |
5470 |
+ { |
5471 |
+- struct crypt_cpu *this_cc = this_crypt_config(cc); |
5472 |
+ unsigned key_index = ctx->cc_sector & (cc->tfms_count - 1); |
5473 |
+ |
5474 |
+- if (!this_cc->req) |
5475 |
+- this_cc->req = mempool_alloc(cc->req_pool, GFP_NOIO); |
5476 |
++ if (!ctx->req) |
5477 |
++ ctx->req = mempool_alloc(cc->req_pool, GFP_NOIO); |
5478 |
+ |
5479 |
+- ablkcipher_request_set_tfm(this_cc->req, cc->tfms[key_index]); |
5480 |
+- ablkcipher_request_set_callback(this_cc->req, |
5481 |
++ ablkcipher_request_set_tfm(ctx->req, cc->tfms[key_index]); |
5482 |
++ ablkcipher_request_set_callback(ctx->req, |
5483 |
+ CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP, |
5484 |
+- kcryptd_async_done, dmreq_of_req(cc, this_cc->req)); |
5485 |
++ kcryptd_async_done, dmreq_of_req(cc, ctx->req)); |
5486 |
+ } |
5487 |
+ |
5488 |
+ /* |
5489 |
+@@ -921,7 +901,6 @@ static void crypt_alloc_req(struct crypt_config *cc, |
5490 |
+ static int crypt_convert(struct crypt_config *cc, |
5491 |
+ struct convert_context *ctx) |
5492 |
+ { |
5493 |
+- struct crypt_cpu *this_cc = this_crypt_config(cc); |
5494 |
+ int r; |
5495 |
+ |
5496 |
+ atomic_set(&ctx->cc_pending, 1); |
5497 |
+@@ -932,7 +911,7 @@ static int crypt_convert(struct crypt_config *cc, |
5498 |
+ |
5499 |
+ atomic_inc(&ctx->cc_pending); |
5500 |
+ |
5501 |
+- r = crypt_convert_block(cc, ctx, this_cc->req); |
5502 |
++ r = crypt_convert_block(cc, ctx, ctx->req); |
5503 |
+ |
5504 |
+ switch (r) { |
5505 |
+ /* async */ |
5506 |
+@@ -941,7 +920,7 @@ static int crypt_convert(struct crypt_config *cc, |
5507 |
+ reinit_completion(&ctx->restart); |
5508 |
+ /* fall through*/ |
5509 |
+ case -EINPROGRESS: |
5510 |
+- this_cc->req = NULL; |
5511 |
++ ctx->req = NULL; |
5512 |
+ ctx->cc_sector++; |
5513 |
+ continue; |
5514 |
+ |
5515 |
+@@ -1040,6 +1019,7 @@ static struct dm_crypt_io *crypt_io_alloc(struct crypt_config *cc, |
5516 |
+ io->sector = sector; |
5517 |
+ io->error = 0; |
5518 |
+ io->base_io = NULL; |
5519 |
++ io->ctx.req = NULL; |
5520 |
+ atomic_set(&io->io_pending, 0); |
5521 |
+ |
5522 |
+ return io; |
5523 |
+@@ -1065,6 +1045,8 @@ static void crypt_dec_pending(struct dm_crypt_io *io) |
5524 |
+ if (!atomic_dec_and_test(&io->io_pending)) |
5525 |
+ return; |
5526 |
+ |
5527 |
++ if (io->ctx.req) |
5528 |
++ mempool_free(io->ctx.req, cc->req_pool); |
5529 |
+ mempool_free(io, cc->io_pool); |
5530 |
+ |
5531 |
+ if (likely(!base_io)) |
5532 |
+@@ -1492,8 +1474,6 @@ static int crypt_wipe_key(struct crypt_config *cc) |
5533 |
+ static void crypt_dtr(struct dm_target *ti) |
5534 |
+ { |
5535 |
+ struct crypt_config *cc = ti->private; |
5536 |
+- struct crypt_cpu *cpu_cc; |
5537 |
+- int cpu; |
5538 |
+ |
5539 |
+ ti->private = NULL; |
5540 |
+ |
5541 |
+@@ -1505,13 +1485,6 @@ static void crypt_dtr(struct dm_target *ti) |
5542 |
+ if (cc->crypt_queue) |
5543 |
+ destroy_workqueue(cc->crypt_queue); |
5544 |
+ |
5545 |
+- if (cc->cpu) |
5546 |
+- for_each_possible_cpu(cpu) { |
5547 |
+- cpu_cc = per_cpu_ptr(cc->cpu, cpu); |
5548 |
+- if (cpu_cc->req) |
5549 |
+- mempool_free(cpu_cc->req, cc->req_pool); |
5550 |
+- } |
5551 |
+- |
5552 |
+ crypt_free_tfms(cc); |
5553 |
+ |
5554 |
+ if (cc->bs) |
5555 |
+@@ -1530,9 +1503,6 @@ static void crypt_dtr(struct dm_target *ti) |
5556 |
+ if (cc->dev) |
5557 |
+ dm_put_device(ti, cc->dev); |
5558 |
+ |
5559 |
+- if (cc->cpu) |
5560 |
+- free_percpu(cc->cpu); |
5561 |
+- |
5562 |
+ kzfree(cc->cipher); |
5563 |
+ kzfree(cc->cipher_string); |
5564 |
+ |
5565 |
+@@ -1588,13 +1558,6 @@ static int crypt_ctr_cipher(struct dm_target *ti, |
5566 |
+ if (tmp) |
5567 |
+ DMWARN("Ignoring unexpected additional cipher options"); |
5568 |
+ |
5569 |
+- cc->cpu = __alloc_percpu(sizeof(*(cc->cpu)), |
5570 |
+- __alignof__(struct crypt_cpu)); |
5571 |
+- if (!cc->cpu) { |
5572 |
+- ti->error = "Cannot allocate per cpu state"; |
5573 |
+- goto bad_mem; |
5574 |
+- } |
5575 |
+- |
5576 |
+ /* |
5577 |
+ * For compatibility with the original dm-crypt mapping format, if |
5578 |
+ * only the cipher name is supplied, use cbc-plain. |
5579 |
+diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c |
5580 |
+index 60cc50685c14..fa602b56b648 100644 |
5581 |
+--- a/drivers/md/dm-thin.c |
5582 |
++++ b/drivers/md/dm-thin.c |
5583 |
+@@ -25,6 +25,7 @@ |
5584 |
+ #define MAPPING_POOL_SIZE 1024 |
5585 |
+ #define PRISON_CELLS 1024 |
5586 |
+ #define COMMIT_PERIOD HZ |
5587 |
++#define NO_SPACE_TIMEOUT (HZ * 60) |
5588 |
+ |
5589 |
+ DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(snapshot_copy_throttle, |
5590 |
+ "A percentage of time allocated for copy on write"); |
5591 |
+@@ -173,6 +174,7 @@ struct pool { |
5592 |
+ struct workqueue_struct *wq; |
5593 |
+ struct work_struct worker; |
5594 |
+ struct delayed_work waker; |
5595 |
++ struct delayed_work no_space_timeout; |
5596 |
+ |
5597 |
+ unsigned long last_commit_jiffies; |
5598 |
+ unsigned ref_count; |
5599 |
+@@ -920,7 +922,7 @@ static int commit(struct pool *pool) |
5600 |
+ { |
5601 |
+ int r; |
5602 |
+ |
5603 |
+- if (get_pool_mode(pool) != PM_WRITE) |
5604 |
++ if (get_pool_mode(pool) >= PM_READ_ONLY) |
5605 |
+ return -EINVAL; |
5606 |
+ |
5607 |
+ r = dm_pool_commit_metadata(pool->pmd); |
5608 |
+@@ -1449,6 +1451,20 @@ static void do_waker(struct work_struct *ws) |
5609 |
+ queue_delayed_work(pool->wq, &pool->waker, COMMIT_PERIOD); |
5610 |
+ } |
5611 |
+ |
5612 |
++/* |
5613 |
++ * We're holding onto IO to allow userland time to react. After the |
5614 |
++ * timeout either the pool will have been resized (and thus back in |
5615 |
++ * PM_WRITE mode), or we degrade to PM_READ_ONLY and start erroring IO. |
5616 |
++ */ |
5617 |
++static void do_no_space_timeout(struct work_struct *ws) |
5618 |
++{ |
5619 |
++ struct pool *pool = container_of(to_delayed_work(ws), struct pool, |
5620 |
++ no_space_timeout); |
5621 |
++ |
5622 |
++ if (get_pool_mode(pool) == PM_OUT_OF_DATA_SPACE && !pool->pf.error_if_no_space) |
5623 |
++ set_pool_mode(pool, PM_READ_ONLY); |
5624 |
++} |
5625 |
++ |
5626 |
+ /*----------------------------------------------------------------*/ |
5627 |
+ |
5628 |
+ struct noflush_work { |
5629 |
+@@ -1574,6 +1590,9 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) |
5630 |
+ pool->process_discard = process_discard; |
5631 |
+ pool->process_prepared_mapping = process_prepared_mapping; |
5632 |
+ pool->process_prepared_discard = process_prepared_discard_passdown; |
5633 |
++ |
5634 |
++ if (!pool->pf.error_if_no_space) |
5635 |
++ queue_delayed_work(pool->wq, &pool->no_space_timeout, NO_SPACE_TIMEOUT); |
5636 |
+ break; |
5637 |
+ |
5638 |
+ case PM_WRITE: |
5639 |
+@@ -1956,6 +1975,7 @@ static struct pool *pool_create(struct mapped_device *pool_md, |
5640 |
+ |
5641 |
+ INIT_WORK(&pool->worker, do_worker); |
5642 |
+ INIT_DELAYED_WORK(&pool->waker, do_waker); |
5643 |
++ INIT_DELAYED_WORK(&pool->no_space_timeout, do_no_space_timeout); |
5644 |
+ spin_lock_init(&pool->lock); |
5645 |
+ bio_list_init(&pool->deferred_bios); |
5646 |
+ bio_list_init(&pool->deferred_flush_bios); |
5647 |
+@@ -2519,6 +2539,7 @@ static void pool_postsuspend(struct dm_target *ti) |
5648 |
+ struct pool *pool = pt->pool; |
5649 |
+ |
5650 |
+ cancel_delayed_work(&pool->waker); |
5651 |
++ cancel_delayed_work(&pool->no_space_timeout); |
5652 |
+ flush_workqueue(pool->wq); |
5653 |
+ (void) commit(pool); |
5654 |
+ } |
5655 |
+diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c |
5656 |
+index 796007a5e0e1..7a7bab8947ae 100644 |
5657 |
+--- a/drivers/md/dm-verity.c |
5658 |
++++ b/drivers/md/dm-verity.c |
5659 |
+@@ -330,15 +330,17 @@ test_block_hash: |
5660 |
+ return r; |
5661 |
+ } |
5662 |
+ } |
5663 |
+- |
5664 |
+ todo = 1 << v->data_dev_block_bits; |
5665 |
+- while (io->iter.bi_size) { |
5666 |
++ do { |
5667 |
+ u8 *page; |
5668 |
++ unsigned len; |
5669 |
+ struct bio_vec bv = bio_iter_iovec(bio, io->iter); |
5670 |
+ |
5671 |
+ page = kmap_atomic(bv.bv_page); |
5672 |
+- r = crypto_shash_update(desc, page + bv.bv_offset, |
5673 |
+- bv.bv_len); |
5674 |
++ len = bv.bv_len; |
5675 |
++ if (likely(len >= todo)) |
5676 |
++ len = todo; |
5677 |
++ r = crypto_shash_update(desc, page + bv.bv_offset, len); |
5678 |
+ kunmap_atomic(page); |
5679 |
+ |
5680 |
+ if (r < 0) { |
5681 |
+@@ -346,8 +348,9 @@ test_block_hash: |
5682 |
+ return r; |
5683 |
+ } |
5684 |
+ |
5685 |
+- bio_advance_iter(bio, &io->iter, bv.bv_len); |
5686 |
+- } |
5687 |
++ bio_advance_iter(bio, &io->iter, len); |
5688 |
++ todo -= len; |
5689 |
++ } while (todo); |
5690 |
+ |
5691 |
+ if (!v->version) { |
5692 |
+ r = crypto_shash_update(desc, v->salt, v->salt_size); |
5693 |
+diff --git a/drivers/md/md.c b/drivers/md/md.c |
5694 |
+index 4ad5cc4e63e8..51c431c3a411 100644 |
5695 |
+--- a/drivers/md/md.c |
5696 |
++++ b/drivers/md/md.c |
5697 |
+@@ -8530,7 +8530,8 @@ static int md_notify_reboot(struct notifier_block *this, |
5698 |
+ if (mddev_trylock(mddev)) { |
5699 |
+ if (mddev->pers) |
5700 |
+ __md_stop_writes(mddev); |
5701 |
+- mddev->safemode = 2; |
5702 |
++ if (mddev->persistent) |
5703 |
++ mddev->safemode = 2; |
5704 |
+ mddev_unlock(mddev); |
5705 |
+ } |
5706 |
+ need_delay = 1; |
5707 |
+diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c |
5708 |
+index 33fc408e5eac..cb882aae9e20 100644 |
5709 |
+--- a/drivers/md/raid10.c |
5710 |
++++ b/drivers/md/raid10.c |
5711 |
+@@ -1172,6 +1172,13 @@ static void __make_request(struct mddev *mddev, struct bio *bio) |
5712 |
+ int max_sectors; |
5713 |
+ int sectors; |
5714 |
+ |
5715 |
++ /* |
5716 |
++ * Register the new request and wait if the reconstruction |
5717 |
++ * thread has put up a bar for new requests. |
5718 |
++ * Continue immediately if no resync is active currently. |
5719 |
++ */ |
5720 |
++ wait_barrier(conf); |
5721 |
++ |
5722 |
+ sectors = bio_sectors(bio); |
5723 |
+ while (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) && |
5724 |
+ bio->bi_iter.bi_sector < conf->reshape_progress && |
5725 |
+@@ -1552,12 +1559,6 @@ static void make_request(struct mddev *mddev, struct bio *bio) |
5726 |
+ |
5727 |
+ md_write_start(mddev, bio); |
5728 |
+ |
5729 |
+- /* |
5730 |
+- * Register the new request and wait if the reconstruction |
5731 |
+- * thread has put up a bar for new requests. |
5732 |
+- * Continue immediately if no resync is active currently. |
5733 |
+- */ |
5734 |
+- wait_barrier(conf); |
5735 |
+ |
5736 |
+ do { |
5737 |
+ |
5738 |
+diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c |
5739 |
+index e8a1ce204036..cdd7c1b7259b 100644 |
5740 |
+--- a/drivers/media/i2c/ov7670.c |
5741 |
++++ b/drivers/media/i2c/ov7670.c |
5742 |
+@@ -1109,7 +1109,7 @@ static int ov7670_enum_framesizes(struct v4l2_subdev *sd, |
5743 |
+ * windows that fall outside that. |
5744 |
+ */ |
5745 |
+ for (i = 0; i < n_win_sizes; i++) { |
5746 |
+- struct ov7670_win_size *win = &info->devtype->win_sizes[index]; |
5747 |
++ struct ov7670_win_size *win = &info->devtype->win_sizes[i]; |
5748 |
+ if (info->min_width && win->width < info->min_width) |
5749 |
+ continue; |
5750 |
+ if (info->min_height && win->height < info->min_height) |
5751 |
+diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c |
5752 |
+index d5a7a135f75d..703560fa5e73 100644 |
5753 |
+--- a/drivers/media/media-device.c |
5754 |
++++ b/drivers/media/media-device.c |
5755 |
+@@ -93,6 +93,7 @@ static long media_device_enum_entities(struct media_device *mdev, |
5756 |
+ struct media_entity *ent; |
5757 |
+ struct media_entity_desc u_ent; |
5758 |
+ |
5759 |
++ memset(&u_ent, 0, sizeof(u_ent)); |
5760 |
+ if (copy_from_user(&u_ent.id, &uent->id, sizeof(u_ent.id))) |
5761 |
+ return -EFAULT; |
5762 |
+ |
5763 |
+diff --git a/drivers/media/tuners/fc2580.c b/drivers/media/tuners/fc2580.c |
5764 |
+index 3aecaf465094..f0c9c42867de 100644 |
5765 |
+--- a/drivers/media/tuners/fc2580.c |
5766 |
++++ b/drivers/media/tuners/fc2580.c |
5767 |
+@@ -195,7 +195,7 @@ static int fc2580_set_params(struct dvb_frontend *fe) |
5768 |
+ |
5769 |
+ f_ref = 2UL * priv->cfg->clock / r_val; |
5770 |
+ n_val = div_u64_rem(f_vco, f_ref, &k_val); |
5771 |
+- k_val_reg = 1UL * k_val * (1 << 20) / f_ref; |
5772 |
++ k_val_reg = div_u64(1ULL * k_val * (1 << 20), f_ref); |
5773 |
+ |
5774 |
+ ret = fc2580_wr_reg(priv, 0x18, r18_val | ((k_val_reg >> 16) & 0xff)); |
5775 |
+ if (ret < 0) |
5776 |
+@@ -348,8 +348,8 @@ static int fc2580_set_params(struct dvb_frontend *fe) |
5777 |
+ if (ret < 0) |
5778 |
+ goto err; |
5779 |
+ |
5780 |
+- ret = fc2580_wr_reg(priv, 0x37, 1UL * priv->cfg->clock * \ |
5781 |
+- fc2580_if_filter_lut[i].mul / 1000000000); |
5782 |
++ ret = fc2580_wr_reg(priv, 0x37, div_u64(1ULL * priv->cfg->clock * |
5783 |
++ fc2580_if_filter_lut[i].mul, 1000000000)); |
5784 |
+ if (ret < 0) |
5785 |
+ goto err; |
5786 |
+ |
5787 |
+diff --git a/drivers/media/tuners/fc2580_priv.h b/drivers/media/tuners/fc2580_priv.h |
5788 |
+index be38a9e637e0..646c99452136 100644 |
5789 |
+--- a/drivers/media/tuners/fc2580_priv.h |
5790 |
++++ b/drivers/media/tuners/fc2580_priv.h |
5791 |
+@@ -22,6 +22,7 @@ |
5792 |
+ #define FC2580_PRIV_H |
5793 |
+ |
5794 |
+ #include "fc2580.h" |
5795 |
++#include <linux/math64.h> |
5796 |
+ |
5797 |
+ struct fc2580_reg_val { |
5798 |
+ u8 reg; |
5799 |
+diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c |
5800 |
+index b63a5e584aa0..fca336b65351 100644 |
5801 |
+--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c |
5802 |
++++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c |
5803 |
+@@ -178,6 +178,9 @@ struct v4l2_create_buffers32 { |
5804 |
+ |
5805 |
+ static int __get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up) |
5806 |
+ { |
5807 |
++ if (get_user(kp->type, &up->type)) |
5808 |
++ return -EFAULT; |
5809 |
++ |
5810 |
+ switch (kp->type) { |
5811 |
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
5812 |
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT: |
5813 |
+@@ -204,17 +207,16 @@ static int __get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __us |
5814 |
+ |
5815 |
+ static int get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up) |
5816 |
+ { |
5817 |
+- if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_format32)) || |
5818 |
+- get_user(kp->type, &up->type)) |
5819 |
+- return -EFAULT; |
5820 |
++ if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_format32))) |
5821 |
++ return -EFAULT; |
5822 |
+ return __get_v4l2_format32(kp, up); |
5823 |
+ } |
5824 |
+ |
5825 |
+ static int get_v4l2_create32(struct v4l2_create_buffers *kp, struct v4l2_create_buffers32 __user *up) |
5826 |
+ { |
5827 |
+ if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_create_buffers32)) || |
5828 |
+- copy_from_user(kp, up, offsetof(struct v4l2_create_buffers32, format.fmt))) |
5829 |
+- return -EFAULT; |
5830 |
++ copy_from_user(kp, up, offsetof(struct v4l2_create_buffers32, format))) |
5831 |
++ return -EFAULT; |
5832 |
+ return __get_v4l2_format32(&kp->format, &up->format); |
5833 |
+ } |
5834 |
+ |
5835 |
+diff --git a/drivers/memory/mvebu-devbus.c b/drivers/memory/mvebu-devbus.c |
5836 |
+index 110c03627051..b59a17fb7c3e 100644 |
5837 |
+--- a/drivers/memory/mvebu-devbus.c |
5838 |
++++ b/drivers/memory/mvebu-devbus.c |
5839 |
+@@ -108,8 +108,19 @@ static int devbus_set_timing_params(struct devbus *devbus, |
5840 |
+ node->full_name); |
5841 |
+ return err; |
5842 |
+ } |
5843 |
+- /* Convert bit width to byte width */ |
5844 |
+- r.bus_width /= 8; |
5845 |
++ |
5846 |
++ /* |
5847 |
++ * The bus width is encoded into the register as 0 for 8 bits, |
5848 |
++ * and 1 for 16 bits, so we do the necessary conversion here. |
5849 |
++ */ |
5850 |
++ if (r.bus_width == 8) |
5851 |
++ r.bus_width = 0; |
5852 |
++ else if (r.bus_width == 16) |
5853 |
++ r.bus_width = 1; |
5854 |
++ else { |
5855 |
++ dev_err(devbus->dev, "invalid bus width %d\n", r.bus_width); |
5856 |
++ return -EINVAL; |
5857 |
++ } |
5858 |
+ |
5859 |
+ err = get_timing_param_ps(devbus, node, "devbus,badr-skew-ps", |
5860 |
+ &r.badr_skew); |
5861 |
+diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
5862 |
+index 6d91933c4cdd..0af6e060e238 100644 |
5863 |
+--- a/drivers/net/ethernet/intel/e1000e/netdev.c |
5864 |
++++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
5865 |
+@@ -2976,11 +2976,21 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) |
5866 |
+ u32 rctl, rfctl; |
5867 |
+ u32 pages = 0; |
5868 |
+ |
5869 |
+- /* Workaround Si errata on PCHx - configure jumbo frame flow */ |
5870 |
+- if ((hw->mac.type >= e1000_pch2lan) && |
5871 |
+- (adapter->netdev->mtu > ETH_DATA_LEN) && |
5872 |
+- e1000_lv_jumbo_workaround_ich8lan(hw, true)) |
5873 |
+- e_dbg("failed to enable jumbo frame workaround mode\n"); |
5874 |
++ /* Workaround Si errata on PCHx - configure jumbo frame flow. |
5875 |
++ * If jumbo frames not set, program related MAC/PHY registers |
5876 |
++ * to h/w defaults |
5877 |
++ */ |
5878 |
++ if (hw->mac.type >= e1000_pch2lan) { |
5879 |
++ s32 ret_val; |
5880 |
++ |
5881 |
++ if (adapter->netdev->mtu > ETH_DATA_LEN) |
5882 |
++ ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, true); |
5883 |
++ else |
5884 |
++ ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, false); |
5885 |
++ |
5886 |
++ if (ret_val) |
5887 |
++ e_dbg("failed to enable|disable jumbo frame workaround mode\n"); |
5888 |
++ } |
5889 |
+ |
5890 |
+ /* Program MC offset vector base */ |
5891 |
+ rctl = er32(RCTL); |
5892 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
5893 |
+index b9d1c1c8ca5a..178506a201d5 100644 |
5894 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
5895 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
5896 |
+@@ -1776,7 +1776,7 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, u16 vf_id, u32 v_opcode, |
5897 |
+ u32 v_retval, u8 *msg, u16 msglen) |
5898 |
+ { |
5899 |
+ struct i40e_hw *hw = &pf->hw; |
5900 |
+- int local_vf_id = vf_id - hw->func_caps.vf_base_id; |
5901 |
++ unsigned int local_vf_id = vf_id - hw->func_caps.vf_base_id; |
5902 |
+ struct i40e_vf *vf; |
5903 |
+ int ret; |
5904 |
+ |
5905 |
+diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c |
5906 |
+index 46d31a49f5ea..d9c7eb279141 100644 |
5907 |
+--- a/drivers/net/ethernet/intel/igb/igb_main.c |
5908 |
++++ b/drivers/net/ethernet/intel/igb/igb_main.c |
5909 |
+@@ -1014,6 +1014,12 @@ static void igb_reset_q_vector(struct igb_adapter *adapter, int v_idx) |
5910 |
+ { |
5911 |
+ struct igb_q_vector *q_vector = adapter->q_vector[v_idx]; |
5912 |
+ |
5913 |
++ /* Coming from igb_set_interrupt_capability, the vectors are not yet |
5914 |
++ * allocated. So, q_vector is NULL so we should stop here. |
5915 |
++ */ |
5916 |
++ if (!q_vector) |
5917 |
++ return; |
5918 |
++ |
5919 |
+ if (q_vector->tx.ring) |
5920 |
+ adapter->tx_ring[q_vector->tx.ring->queue_index] = NULL; |
5921 |
+ |
5922 |
+@@ -1121,6 +1127,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix) |
5923 |
+ |
5924 |
+ /* If we can't do MSI-X, try MSI */ |
5925 |
+ msi_only: |
5926 |
++ adapter->flags &= ~IGB_FLAG_HAS_MSIX; |
5927 |
+ #ifdef CONFIG_PCI_IOV |
5928 |
+ /* disable SR-IOV for non MSI-X configurations */ |
5929 |
+ if (adapter->vf_data) { |
5930 |
+diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c |
5931 |
+index 925034b80e9c..93598cd7ee6a 100644 |
5932 |
+--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c |
5933 |
++++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c |
5934 |
+@@ -426,6 +426,12 @@ static int brcms_ops_start(struct ieee80211_hw *hw) |
5935 |
+ bool blocked; |
5936 |
+ int err; |
5937 |
+ |
5938 |
++ if (!wl->ucode.bcm43xx_bomminor) { |
5939 |
++ err = brcms_request_fw(wl, wl->wlc->hw->d11core); |
5940 |
++ if (err) |
5941 |
++ return -ENOENT; |
5942 |
++ } |
5943 |
++ |
5944 |
+ ieee80211_wake_queues(hw); |
5945 |
+ spin_lock_bh(&wl->lock); |
5946 |
+ blocked = brcms_rfkill_set_hw_state(wl); |
5947 |
+@@ -433,14 +439,6 @@ static int brcms_ops_start(struct ieee80211_hw *hw) |
5948 |
+ if (!blocked) |
5949 |
+ wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); |
5950 |
+ |
5951 |
+- if (!wl->ucode.bcm43xx_bomminor) { |
5952 |
+- err = brcms_request_fw(wl, wl->wlc->hw->d11core); |
5953 |
+- if (err) { |
5954 |
+- brcms_remove(wl->wlc->hw->d11core); |
5955 |
+- return -ENOENT; |
5956 |
+- } |
5957 |
+- } |
5958 |
+- |
5959 |
+ spin_lock_bh(&wl->lock); |
5960 |
+ /* avoid acknowledging frames before a non-monitor device is added */ |
5961 |
+ wl->mute_tx = true; |
5962 |
+diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c |
5963 |
+index 2a59da2ff87a..e1d546665ae8 100644 |
5964 |
+--- a/drivers/net/wireless/iwlwifi/iwl-7000.c |
5965 |
++++ b/drivers/net/wireless/iwlwifi/iwl-7000.c |
5966 |
+@@ -67,8 +67,8 @@ |
5967 |
+ #include "iwl-agn-hw.h" |
5968 |
+ |
5969 |
+ /* Highest firmware API version supported */ |
5970 |
+-#define IWL7260_UCODE_API_MAX 8 |
5971 |
+-#define IWL3160_UCODE_API_MAX 8 |
5972 |
++#define IWL7260_UCODE_API_MAX 9 |
5973 |
++#define IWL3160_UCODE_API_MAX 9 |
5974 |
+ |
5975 |
+ /* Oldest version we won't warn about */ |
5976 |
+ #define IWL7260_UCODE_API_OK 7 |
5977 |
+@@ -223,3 +223,4 @@ const struct iwl_cfg iwl7265_n_cfg = { |
5978 |
+ |
5979 |
+ MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
5980 |
+ MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); |
5981 |
++MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
5982 |
+diff --git a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c |
5983 |
+index 18a895a949d4..6b22681068a7 100644 |
5984 |
+--- a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c |
5985 |
++++ b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c |
5986 |
+@@ -188,7 +188,7 @@ static const __le32 iwl_combined_lookup[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = { |
5987 |
+ cpu_to_le32(0xcc00aaaa), |
5988 |
+ cpu_to_le32(0x0000aaaa), |
5989 |
+ cpu_to_le32(0xc0004000), |
5990 |
+- cpu_to_le32(0x00000000), |
5991 |
++ cpu_to_le32(0x00004000), |
5992 |
+ cpu_to_le32(0xf0005000), |
5993 |
+ cpu_to_le32(0xf0005000), |
5994 |
+ }, |
5995 |
+@@ -211,16 +211,16 @@ static const __le32 iwl_combined_lookup[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = { |
5996 |
+ /* Tx Tx disabled */ |
5997 |
+ cpu_to_le32(0xaaaaaaaa), |
5998 |
+ cpu_to_le32(0xaaaaaaaa), |
5999 |
+- cpu_to_le32(0xaaaaaaaa), |
6000 |
++ cpu_to_le32(0xeeaaaaaa), |
6001 |
+ cpu_to_le32(0xaaaaaaaa), |
6002 |
+ cpu_to_le32(0xcc00ff28), |
6003 |
+ cpu_to_le32(0x0000aaaa), |
6004 |
+ cpu_to_le32(0xcc00aaaa), |
6005 |
+ cpu_to_le32(0x0000aaaa), |
6006 |
+- cpu_to_le32(0xC0004000), |
6007 |
+- cpu_to_le32(0xC0004000), |
6008 |
+- cpu_to_le32(0xF0005000), |
6009 |
+- cpu_to_le32(0xF0005000), |
6010 |
++ cpu_to_le32(0xc0004000), |
6011 |
++ cpu_to_le32(0xc0004000), |
6012 |
++ cpu_to_le32(0xf0005000), |
6013 |
++ cpu_to_le32(0xf0005000), |
6014 |
+ }, |
6015 |
+ }; |
6016 |
+ |
6017 |
+diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c |
6018 |
+index 9a856e5031f1..d06414ef15c5 100644 |
6019 |
+--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c |
6020 |
++++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c |
6021 |
+@@ -606,7 +606,7 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, |
6022 |
+ if (ret) |
6023 |
+ goto out_remove_mac; |
6024 |
+ |
6025 |
+- if (!mvm->bf_allowed_vif && |
6026 |
++ if (!mvm->bf_allowed_vif && false && |
6027 |
+ vif->type == NL80211_IFTYPE_STATION && !vif->p2p && |
6028 |
+ mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BF_UPDATED){ |
6029 |
+ mvm->bf_allowed_vif = mvmvif; |
6030 |
+@@ -796,7 +796,7 @@ static void iwl_mvm_mc_iface_iterator(void *_data, u8 *mac, |
6031 |
+ memcpy(cmd->bssid, vif->bss_conf.bssid, ETH_ALEN); |
6032 |
+ len = roundup(sizeof(*cmd) + cmd->count * ETH_ALEN, 4); |
6033 |
+ |
6034 |
+- ret = iwl_mvm_send_cmd_pdu(mvm, MCAST_FILTER_CMD, CMD_SYNC, len, cmd); |
6035 |
++ ret = iwl_mvm_send_cmd_pdu(mvm, MCAST_FILTER_CMD, CMD_ASYNC, len, cmd); |
6036 |
+ if (ret) |
6037 |
+ IWL_ERR(mvm, "mcast filter cmd error. ret=%d\n", ret); |
6038 |
+ } |
6039 |
+@@ -812,7 +812,7 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) |
6040 |
+ if (WARN_ON_ONCE(!mvm->mcast_filter_cmd)) |
6041 |
+ return; |
6042 |
+ |
6043 |
+- ieee80211_iterate_active_interfaces( |
6044 |
++ ieee80211_iterate_active_interfaces_atomic( |
6045 |
+ mvm->hw, IEEE80211_IFACE_ITER_NORMAL, |
6046 |
+ iwl_mvm_mc_iface_iterator, &iter_data); |
6047 |
+ } |
6048 |
+@@ -971,6 +971,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, |
6049 |
+ */ |
6050 |
+ iwl_mvm_remove_time_event(mvm, mvmvif, |
6051 |
+ &mvmvif->time_event_data); |
6052 |
++ iwl_mvm_sf_update(mvm, vif, false); |
6053 |
+ } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | |
6054 |
+ BSS_CHANGED_QOS)) { |
6055 |
+ ret = iwl_mvm_power_update_mode(mvm, vif); |
6056 |
+diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c |
6057 |
+index 5bc871513505..03179d0b08c2 100644 |
6058 |
+--- a/drivers/net/wireless/iwlwifi/mvm/rs.c |
6059 |
++++ b/drivers/net/wireless/iwlwifi/mvm/rs.c |
6060 |
+@@ -59,7 +59,7 @@ |
6061 |
+ /* max allowed rate miss before sync LQ cmd */ |
6062 |
+ #define IWL_MISSED_RATE_MAX 15 |
6063 |
+ #define RS_STAY_IN_COLUMN_TIMEOUT (5*HZ) |
6064 |
+- |
6065 |
++#define RS_IDLE_TIMEOUT (5*HZ) |
6066 |
+ |
6067 |
+ static u8 rs_ht_to_legacy[] = { |
6068 |
+ [IWL_RATE_MCS_0_INDEX] = IWL_RATE_6M_INDEX, |
6069 |
+@@ -142,7 +142,7 @@ enum rs_column_mode { |
6070 |
+ RS_MIMO2, |
6071 |
+ }; |
6072 |
+ |
6073 |
+-#define MAX_NEXT_COLUMNS 5 |
6074 |
++#define MAX_NEXT_COLUMNS 7 |
6075 |
+ #define MAX_COLUMN_CHECKS 3 |
6076 |
+ |
6077 |
+ typedef bool (*allow_column_func_t) (struct iwl_mvm *mvm, |
6078 |
+@@ -212,8 +212,10 @@ static const struct rs_tx_column rs_tx_columns[] = { |
6079 |
+ RS_COLUMN_LEGACY_ANT_B, |
6080 |
+ RS_COLUMN_SISO_ANT_A, |
6081 |
+ RS_COLUMN_SISO_ANT_B, |
6082 |
+- RS_COLUMN_MIMO2, |
6083 |
+- RS_COLUMN_MIMO2_SGI, |
6084 |
++ RS_COLUMN_INVALID, |
6085 |
++ RS_COLUMN_INVALID, |
6086 |
++ RS_COLUMN_INVALID, |
6087 |
++ RS_COLUMN_INVALID, |
6088 |
+ }, |
6089 |
+ }, |
6090 |
+ [RS_COLUMN_LEGACY_ANT_B] = { |
6091 |
+@@ -223,8 +225,10 @@ static const struct rs_tx_column rs_tx_columns[] = { |
6092 |
+ RS_COLUMN_LEGACY_ANT_A, |
6093 |
+ RS_COLUMN_SISO_ANT_A, |
6094 |
+ RS_COLUMN_SISO_ANT_B, |
6095 |
+- RS_COLUMN_MIMO2, |
6096 |
+- RS_COLUMN_MIMO2_SGI, |
6097 |
++ RS_COLUMN_INVALID, |
6098 |
++ RS_COLUMN_INVALID, |
6099 |
++ RS_COLUMN_INVALID, |
6100 |
++ RS_COLUMN_INVALID, |
6101 |
+ }, |
6102 |
+ }, |
6103 |
+ [RS_COLUMN_SISO_ANT_A] = { |
6104 |
+@@ -235,7 +239,9 @@ static const struct rs_tx_column rs_tx_columns[] = { |
6105 |
+ RS_COLUMN_MIMO2, |
6106 |
+ RS_COLUMN_SISO_ANT_A_SGI, |
6107 |
+ RS_COLUMN_SISO_ANT_B_SGI, |
6108 |
+- RS_COLUMN_MIMO2_SGI, |
6109 |
++ RS_COLUMN_LEGACY_ANT_A, |
6110 |
++ RS_COLUMN_LEGACY_ANT_B, |
6111 |
++ RS_COLUMN_INVALID, |
6112 |
+ }, |
6113 |
+ .checks = { |
6114 |
+ rs_siso_allow, |
6115 |
+@@ -249,7 +255,9 @@ static const struct rs_tx_column rs_tx_columns[] = { |
6116 |
+ RS_COLUMN_MIMO2, |
6117 |
+ RS_COLUMN_SISO_ANT_B_SGI, |
6118 |
+ RS_COLUMN_SISO_ANT_A_SGI, |
6119 |
+- RS_COLUMN_MIMO2_SGI, |
6120 |
++ RS_COLUMN_LEGACY_ANT_A, |
6121 |
++ RS_COLUMN_LEGACY_ANT_B, |
6122 |
++ RS_COLUMN_INVALID, |
6123 |
+ }, |
6124 |
+ .checks = { |
6125 |
+ rs_siso_allow, |
6126 |
+@@ -265,6 +273,8 @@ static const struct rs_tx_column rs_tx_columns[] = { |
6127 |
+ RS_COLUMN_SISO_ANT_A, |
6128 |
+ RS_COLUMN_SISO_ANT_B, |
6129 |
+ RS_COLUMN_MIMO2, |
6130 |
++ RS_COLUMN_LEGACY_ANT_A, |
6131 |
++ RS_COLUMN_LEGACY_ANT_B, |
6132 |
+ }, |
6133 |
+ .checks = { |
6134 |
+ rs_siso_allow, |
6135 |
+@@ -281,6 +291,8 @@ static const struct rs_tx_column rs_tx_columns[] = { |
6136 |
+ RS_COLUMN_SISO_ANT_B, |
6137 |
+ RS_COLUMN_SISO_ANT_A, |
6138 |
+ RS_COLUMN_MIMO2, |
6139 |
++ RS_COLUMN_LEGACY_ANT_A, |
6140 |
++ RS_COLUMN_LEGACY_ANT_B, |
6141 |
+ }, |
6142 |
+ .checks = { |
6143 |
+ rs_siso_allow, |
6144 |
+@@ -296,6 +308,8 @@ static const struct rs_tx_column rs_tx_columns[] = { |
6145 |
+ RS_COLUMN_SISO_ANT_A_SGI, |
6146 |
+ RS_COLUMN_SISO_ANT_B_SGI, |
6147 |
+ RS_COLUMN_MIMO2_SGI, |
6148 |
++ RS_COLUMN_LEGACY_ANT_A, |
6149 |
++ RS_COLUMN_LEGACY_ANT_B, |
6150 |
+ }, |
6151 |
+ .checks = { |
6152 |
+ rs_mimo_allow, |
6153 |
+@@ -311,6 +325,8 @@ static const struct rs_tx_column rs_tx_columns[] = { |
6154 |
+ RS_COLUMN_SISO_ANT_A, |
6155 |
+ RS_COLUMN_SISO_ANT_B, |
6156 |
+ RS_COLUMN_MIMO2, |
6157 |
++ RS_COLUMN_LEGACY_ANT_A, |
6158 |
++ RS_COLUMN_LEGACY_ANT_B, |
6159 |
+ }, |
6160 |
+ .checks = { |
6161 |
+ rs_mimo_allow, |
6162 |
+@@ -503,6 +519,16 @@ static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window) |
6163 |
+ window->average_tpt = IWL_INVALID_VALUE; |
6164 |
+ } |
6165 |
+ |
6166 |
++static void rs_rate_scale_clear_tbl_windows(struct iwl_mvm *mvm, |
6167 |
++ struct iwl_scale_tbl_info *tbl) |
6168 |
++{ |
6169 |
++ int i; |
6170 |
++ |
6171 |
++ IWL_DEBUG_RATE(mvm, "Clearing up window stats\n"); |
6172 |
++ for (i = 0; i < IWL_RATE_COUNT; i++) |
6173 |
++ rs_rate_scale_clear_window(&tbl->win[i]); |
6174 |
++} |
6175 |
++ |
6176 |
+ static inline u8 rs_is_valid_ant(u8 valid_antenna, u8 ant_type) |
6177 |
+ { |
6178 |
+ return (ant_type & valid_antenna) == ant_type; |
6179 |
+@@ -975,6 +1001,13 @@ static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband, |
6180 |
+ return; |
6181 |
+ } |
6182 |
+ |
6183 |
++#ifdef CPTCFG_MAC80211_DEBUGFS |
6184 |
++ /* Disable last tx check if we are debugging with fixed rate */ |
6185 |
++ if (lq_sta->dbg_fixed_rate) { |
6186 |
++ IWL_DEBUG_RATE(mvm, "Fixed rate. avoid rate scaling\n"); |
6187 |
++ return; |
6188 |
++ } |
6189 |
++#endif |
6190 |
+ if (!ieee80211_is_data(hdr->frame_control) || |
6191 |
+ info->flags & IEEE80211_TX_CTL_NO_ACK) |
6192 |
+ return; |
6193 |
+@@ -1017,6 +1050,18 @@ static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband, |
6194 |
+ mac_index++; |
6195 |
+ } |
6196 |
+ |
6197 |
++ if (time_after(jiffies, |
6198 |
++ (unsigned long)(lq_sta->last_tx + RS_IDLE_TIMEOUT))) { |
6199 |
++ int tid; |
6200 |
++ IWL_DEBUG_RATE(mvm, "Tx idle for too long. reinit rs\n"); |
6201 |
++ for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++) |
6202 |
++ ieee80211_stop_tx_ba_session(sta, tid); |
6203 |
++ |
6204 |
++ iwl_mvm_rs_rate_init(mvm, sta, sband->band, false); |
6205 |
++ return; |
6206 |
++ } |
6207 |
++ lq_sta->last_tx = jiffies; |
6208 |
++ |
6209 |
+ /* Here we actually compare this rate to the latest LQ command */ |
6210 |
+ if ((mac_index < 0) || |
6211 |
+ (rate.sgi != !!(mac_flags & IEEE80211_TX_RC_SHORT_GI)) || |
6212 |
+@@ -1362,7 +1407,6 @@ static u32 rs_bw_from_sta_bw(struct ieee80211_sta *sta) |
6213 |
+ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) |
6214 |
+ { |
6215 |
+ struct iwl_scale_tbl_info *tbl; |
6216 |
+- int i; |
6217 |
+ int active_tbl; |
6218 |
+ int flush_interval_passed = 0; |
6219 |
+ struct iwl_mvm *mvm; |
6220 |
+@@ -1423,9 +1467,7 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) |
6221 |
+ |
6222 |
+ IWL_DEBUG_RATE(mvm, |
6223 |
+ "LQ: stay in table clear win\n"); |
6224 |
+- for (i = 0; i < IWL_RATE_COUNT; i++) |
6225 |
+- rs_rate_scale_clear_window( |
6226 |
+- &(tbl->win[i])); |
6227 |
++ rs_rate_scale_clear_tbl_windows(mvm, tbl); |
6228 |
+ } |
6229 |
+ } |
6230 |
+ |
6231 |
+@@ -1433,9 +1475,7 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) |
6232 |
+ * bitmaps and stats in active table (this will become the new |
6233 |
+ * "search" table). */ |
6234 |
+ if (lq_sta->rs_state == RS_STATE_SEARCH_CYCLE_STARTED) { |
6235 |
+- IWL_DEBUG_RATE(mvm, "Clearing up window stats\n"); |
6236 |
+- for (i = 0; i < IWL_RATE_COUNT; i++) |
6237 |
+- rs_rate_scale_clear_window(&(tbl->win[i])); |
6238 |
++ rs_rate_scale_clear_tbl_windows(mvm, tbl); |
6239 |
+ } |
6240 |
+ } |
6241 |
+ } |
6242 |
+@@ -1628,85 +1668,76 @@ static enum rs_action rs_get_rate_action(struct iwl_mvm *mvm, |
6243 |
+ { |
6244 |
+ enum rs_action action = RS_ACTION_STAY; |
6245 |
+ |
6246 |
+- /* Too many failures, decrease rate */ |
6247 |
+ if ((sr <= RS_SR_FORCE_DECREASE) || (current_tpt == 0)) { |
6248 |
+ IWL_DEBUG_RATE(mvm, |
6249 |
+- "decrease rate because of low SR\n"); |
6250 |
+- action = RS_ACTION_DOWNSCALE; |
6251 |
+- /* No throughput measured yet for adjacent rates; try increase. */ |
6252 |
+- } else if ((low_tpt == IWL_INVALID_VALUE) && |
6253 |
+- (high_tpt == IWL_INVALID_VALUE)) { |
6254 |
+- if (high != IWL_RATE_INVALID && sr >= IWL_RATE_INCREASE_TH) { |
6255 |
+- IWL_DEBUG_RATE(mvm, |
6256 |
+- "Good SR and no high rate measurement. " |
6257 |
+- "Increase rate\n"); |
6258 |
+- action = RS_ACTION_UPSCALE; |
6259 |
+- } else if (low != IWL_RATE_INVALID) { |
6260 |
+- IWL_DEBUG_RATE(mvm, |
6261 |
+- "Remain in current rate\n"); |
6262 |
+- action = RS_ACTION_STAY; |
6263 |
+- } |
6264 |
++ "Decrease rate because of low SR\n"); |
6265 |
++ return RS_ACTION_DOWNSCALE; |
6266 |
+ } |
6267 |
+ |
6268 |
+- /* Both adjacent throughputs are measured, but neither one has better |
6269 |
+- * throughput; we're using the best rate, don't change it! |
6270 |
+- */ |
6271 |
+- else if ((low_tpt != IWL_INVALID_VALUE) && |
6272 |
+- (high_tpt != IWL_INVALID_VALUE) && |
6273 |
+- (low_tpt < current_tpt) && |
6274 |
+- (high_tpt < current_tpt)) { |
6275 |
++ if ((low_tpt == IWL_INVALID_VALUE) && |
6276 |
++ (high_tpt == IWL_INVALID_VALUE) && |
6277 |
++ (high != IWL_RATE_INVALID)) { |
6278 |
+ IWL_DEBUG_RATE(mvm, |
6279 |
+- "Both high and low are worse. " |
6280 |
+- "Maintain rate\n"); |
6281 |
+- action = RS_ACTION_STAY; |
6282 |
++ "No data about high/low rates. Increase rate\n"); |
6283 |
++ return RS_ACTION_UPSCALE; |
6284 |
+ } |
6285 |
+ |
6286 |
+- /* At least one adjacent rate's throughput is measured, |
6287 |
+- * and may have better performance. |
6288 |
+- */ |
6289 |
+- else { |
6290 |
+- /* Higher adjacent rate's throughput is measured */ |
6291 |
+- if (high_tpt != IWL_INVALID_VALUE) { |
6292 |
+- /* Higher rate has better throughput */ |
6293 |
+- if (high_tpt > current_tpt && |
6294 |
+- sr >= IWL_RATE_INCREASE_TH) { |
6295 |
+- IWL_DEBUG_RATE(mvm, |
6296 |
+- "Higher rate is better and good " |
6297 |
+- "SR. Increate rate\n"); |
6298 |
+- action = RS_ACTION_UPSCALE; |
6299 |
+- } else { |
6300 |
+- IWL_DEBUG_RATE(mvm, |
6301 |
+- "Higher rate isn't better OR " |
6302 |
+- "no good SR. Maintain rate\n"); |
6303 |
+- action = RS_ACTION_STAY; |
6304 |
+- } |
6305 |
++ if ((high_tpt == IWL_INVALID_VALUE) && |
6306 |
++ (high != IWL_RATE_INVALID) && |
6307 |
++ (low_tpt != IWL_INVALID_VALUE) && |
6308 |
++ (low_tpt < current_tpt)) { |
6309 |
++ IWL_DEBUG_RATE(mvm, |
6310 |
++ "No data about high rate and low rate is worse. Increase rate\n"); |
6311 |
++ return RS_ACTION_UPSCALE; |
6312 |
++ } |
6313 |
+ |
6314 |
+- /* Lower adjacent rate's throughput is measured */ |
6315 |
+- } else if (low_tpt != IWL_INVALID_VALUE) { |
6316 |
+- /* Lower rate has better throughput */ |
6317 |
+- if (low_tpt > current_tpt) { |
6318 |
+- IWL_DEBUG_RATE(mvm, |
6319 |
+- "Lower rate is better. " |
6320 |
+- "Decrease rate\n"); |
6321 |
+- action = RS_ACTION_DOWNSCALE; |
6322 |
+- } else if (sr >= IWL_RATE_INCREASE_TH) { |
6323 |
+- IWL_DEBUG_RATE(mvm, |
6324 |
+- "Lower rate isn't better and " |
6325 |
+- "good SR. Increase rate\n"); |
6326 |
+- action = RS_ACTION_UPSCALE; |
6327 |
+- } |
6328 |
+- } |
6329 |
++ if ((high_tpt != IWL_INVALID_VALUE) && |
6330 |
++ (high_tpt > current_tpt)) { |
6331 |
++ IWL_DEBUG_RATE(mvm, |
6332 |
++ "Higher rate is better. Increate rate\n"); |
6333 |
++ return RS_ACTION_UPSCALE; |
6334 |
+ } |
6335 |
+ |
6336 |
+- /* Sanity check; asked for decrease, but success rate or throughput |
6337 |
+- * has been good at old rate. Don't change it. |
6338 |
+- */ |
6339 |
+- if ((action == RS_ACTION_DOWNSCALE) && (low != IWL_RATE_INVALID) && |
6340 |
+- ((sr > IWL_RATE_HIGH_TH) || |
6341 |
+- (current_tpt > (100 * tbl->expected_tpt[low])))) { |
6342 |
++ if ((low_tpt != IWL_INVALID_VALUE) && |
6343 |
++ (high_tpt != IWL_INVALID_VALUE) && |
6344 |
++ (low_tpt < current_tpt) && |
6345 |
++ (high_tpt < current_tpt)) { |
6346 |
++ IWL_DEBUG_RATE(mvm, |
6347 |
++ "Both high and low are worse. Maintain rate\n"); |
6348 |
++ return RS_ACTION_STAY; |
6349 |
++ } |
6350 |
++ |
6351 |
++ if ((low_tpt != IWL_INVALID_VALUE) && |
6352 |
++ (low_tpt > current_tpt)) { |
6353 |
+ IWL_DEBUG_RATE(mvm, |
6354 |
+- "Sanity check failed. Maintain rate\n"); |
6355 |
+- action = RS_ACTION_STAY; |
6356 |
++ "Lower rate is better\n"); |
6357 |
++ action = RS_ACTION_DOWNSCALE; |
6358 |
++ goto out; |
6359 |
++ } |
6360 |
++ |
6361 |
++ if ((low_tpt == IWL_INVALID_VALUE) && |
6362 |
++ (low != IWL_RATE_INVALID)) { |
6363 |
++ IWL_DEBUG_RATE(mvm, |
6364 |
++ "No data about lower rate\n"); |
6365 |
++ action = RS_ACTION_DOWNSCALE; |
6366 |
++ goto out; |
6367 |
++ } |
6368 |
++ |
6369 |
++ IWL_DEBUG_RATE(mvm, "Maintain rate\n"); |
6370 |
++ |
6371 |
++out: |
6372 |
++ if ((action == RS_ACTION_DOWNSCALE) && (low != IWL_RATE_INVALID)) { |
6373 |
++ if (sr >= RS_SR_NO_DECREASE) { |
6374 |
++ IWL_DEBUG_RATE(mvm, |
6375 |
++ "SR is above NO DECREASE. Avoid downscale\n"); |
6376 |
++ action = RS_ACTION_STAY; |
6377 |
++ } else if (current_tpt > (100 * tbl->expected_tpt[low])) { |
6378 |
++ IWL_DEBUG_RATE(mvm, |
6379 |
++ "Current TPT is higher than max expected in low rate. Avoid downscale\n"); |
6380 |
++ action = RS_ACTION_STAY; |
6381 |
++ } else { |
6382 |
++ IWL_DEBUG_RATE(mvm, "Decrease rate\n"); |
6383 |
++ } |
6384 |
+ } |
6385 |
+ |
6386 |
+ return action; |
6387 |
+@@ -1725,7 +1756,6 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm, |
6388 |
+ int low = IWL_RATE_INVALID; |
6389 |
+ int high = IWL_RATE_INVALID; |
6390 |
+ int index; |
6391 |
+- int i; |
6392 |
+ struct iwl_rate_scale_data *window = NULL; |
6393 |
+ int current_tpt = IWL_INVALID_VALUE; |
6394 |
+ int low_tpt = IWL_INVALID_VALUE; |
6395 |
+@@ -1781,6 +1811,7 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm, |
6396 |
+ "Aggregation changed: prev %d current %d. Update expected TPT table\n", |
6397 |
+ prev_agg, lq_sta->is_agg); |
6398 |
+ rs_set_expected_tpt_table(lq_sta, tbl); |
6399 |
++ rs_rate_scale_clear_tbl_windows(mvm, tbl); |
6400 |
+ } |
6401 |
+ |
6402 |
+ /* current tx rate */ |
6403 |
+@@ -2010,8 +2041,7 @@ lq_update: |
6404 |
+ if (lq_sta->search_better_tbl) { |
6405 |
+ /* Access the "search" table, clear its history. */ |
6406 |
+ tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); |
6407 |
+- for (i = 0; i < IWL_RATE_COUNT; i++) |
6408 |
+- rs_rate_scale_clear_window(&(tbl->win[i])); |
6409 |
++ rs_rate_scale_clear_tbl_windows(mvm, tbl); |
6410 |
+ |
6411 |
+ /* Use new "search" start rate */ |
6412 |
+ index = tbl->rate.index; |
6413 |
+@@ -2032,8 +2062,18 @@ lq_update: |
6414 |
+ * stay with best antenna legacy modulation for a while |
6415 |
+ * before next round of mode comparisons. */ |
6416 |
+ tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); |
6417 |
+- if (is_legacy(&tbl1->rate) && !sta->ht_cap.ht_supported) { |
6418 |
++ if (is_legacy(&tbl1->rate)) { |
6419 |
+ IWL_DEBUG_RATE(mvm, "LQ: STAY in legacy table\n"); |
6420 |
++ |
6421 |
++ if (tid != IWL_MAX_TID_COUNT) { |
6422 |
++ tid_data = &sta_priv->tid_data[tid]; |
6423 |
++ if (tid_data->state != IWL_AGG_OFF) { |
6424 |
++ IWL_DEBUG_RATE(mvm, |
6425 |
++ "Stop aggregation on tid %d\n", |
6426 |
++ tid); |
6427 |
++ ieee80211_stop_tx_ba_session(sta, tid); |
6428 |
++ } |
6429 |
++ } |
6430 |
+ rs_set_stay_in_table(mvm, 1, lq_sta); |
6431 |
+ } else { |
6432 |
+ /* If we're in an HT mode, and all 3 mode switch actions |
6433 |
+@@ -2265,10 +2305,10 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
6434 |
+ lq_sta->lq.sta_id = sta_priv->sta_id; |
6435 |
+ |
6436 |
+ for (j = 0; j < LQ_SIZE; j++) |
6437 |
+- for (i = 0; i < IWL_RATE_COUNT; i++) |
6438 |
+- rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); |
6439 |
++ rs_rate_scale_clear_tbl_windows(mvm, &lq_sta->lq_info[j]); |
6440 |
+ |
6441 |
+ lq_sta->flush_timer = 0; |
6442 |
++ lq_sta->last_tx = jiffies; |
6443 |
+ |
6444 |
+ IWL_DEBUG_RATE(mvm, |
6445 |
+ "LQ: *** rate scale station global init for station %d ***\n", |
6446 |
+@@ -2469,6 +2509,7 @@ static void rs_build_rates_table(struct iwl_mvm *mvm, |
6447 |
+ if (is_siso(&rate)) { |
6448 |
+ num_rates = RS_SECONDARY_SISO_NUM_RATES; |
6449 |
+ num_retries = RS_SECONDARY_SISO_RETRIES; |
6450 |
++ lq_cmd->mimo_delim = index; |
6451 |
+ } else if (is_legacy(&rate)) { |
6452 |
+ num_rates = RS_SECONDARY_LEGACY_NUM_RATES; |
6453 |
+ num_retries = RS_LEGACY_RETRIES_PER_RATE; |
6454 |
+diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.h b/drivers/net/wireless/iwlwifi/mvm/rs.h |
6455 |
+index 7bc6404f6986..f23b68b8eeff 100644 |
6456 |
+--- a/drivers/net/wireless/iwlwifi/mvm/rs.h |
6457 |
++++ b/drivers/net/wireless/iwlwifi/mvm/rs.h |
6458 |
+@@ -156,6 +156,7 @@ enum { |
6459 |
+ #define IWL_RATE_HIGH_TH 10880 /* 85% */ |
6460 |
+ #define IWL_RATE_INCREASE_TH 6400 /* 50% */ |
6461 |
+ #define RS_SR_FORCE_DECREASE 1920 /* 15% */ |
6462 |
++#define RS_SR_NO_DECREASE 10880 /* 85% */ |
6463 |
+ |
6464 |
+ #define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */ |
6465 |
+ #define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000) |
6466 |
+@@ -310,6 +311,7 @@ struct iwl_lq_sta { |
6467 |
+ u32 visited_columns; /* Bitmask marking which Tx columns were |
6468 |
+ * explored during a search cycle |
6469 |
+ */ |
6470 |
++ u64 last_tx; |
6471 |
+ bool is_vht; |
6472 |
+ enum ieee80211_band band; |
6473 |
+ |
6474 |
+diff --git a/drivers/net/wireless/iwlwifi/mvm/sf.c b/drivers/net/wireless/iwlwifi/mvm/sf.c |
6475 |
+index 8401627c0030..88809b2d1654 100644 |
6476 |
+--- a/drivers/net/wireless/iwlwifi/mvm/sf.c |
6477 |
++++ b/drivers/net/wireless/iwlwifi/mvm/sf.c |
6478 |
+@@ -274,7 +274,8 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *changed_vif, |
6479 |
+ return -EINVAL; |
6480 |
+ if (changed_vif->type != NL80211_IFTYPE_STATION) { |
6481 |
+ new_state = SF_UNINIT; |
6482 |
+- } else if (changed_vif->bss_conf.assoc) { |
6483 |
++ } else if (changed_vif->bss_conf.assoc && |
6484 |
++ changed_vif->bss_conf.dtim_period) { |
6485 |
+ mvmvif = iwl_mvm_vif_from_mac80211(changed_vif); |
6486 |
+ sta_id = mvmvif->ap_sta_id; |
6487 |
+ new_state = SF_FULL_ON; |
6488 |
+diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c |
6489 |
+index 3872ead75488..43e27a174430 100644 |
6490 |
+--- a/drivers/net/wireless/iwlwifi/pcie/drv.c |
6491 |
++++ b/drivers/net/wireless/iwlwifi/pcie/drv.c |
6492 |
+@@ -372,12 +372,14 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { |
6493 |
+ {IWL_PCI_DEVICE(0x095A, 0x500A, iwl7265_2n_cfg)}, |
6494 |
+ {IWL_PCI_DEVICE(0x095B, 0x5200, iwl7265_2n_cfg)}, |
6495 |
+ {IWL_PCI_DEVICE(0x095A, 0x5002, iwl7265_n_cfg)}, |
6496 |
++ {IWL_PCI_DEVICE(0x095A, 0x5102, iwl7265_n_cfg)}, |
6497 |
+ {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, |
6498 |
+ {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, |
6499 |
+ {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)}, |
6500 |
+ {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, |
6501 |
+ {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, |
6502 |
+ {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, |
6503 |
++ {IWL_PCI_DEVICE(0x095A, 0x9200, iwl7265_2ac_cfg)}, |
6504 |
+ {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)}, |
6505 |
+ {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)}, |
6506 |
+ {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)}, |
6507 |
+diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c |
6508 |
+index f9507807b486..8d42fd9b0811 100644 |
6509 |
+--- a/drivers/net/wireless/iwlwifi/pcie/trans.c |
6510 |
++++ b/drivers/net/wireless/iwlwifi/pcie/trans.c |
6511 |
+@@ -1563,6 +1563,10 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, |
6512 |
+ * PCI Tx retries from interfering with C3 CPU state */ |
6513 |
+ pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); |
6514 |
+ |
6515 |
++ trans->dev = &pdev->dev; |
6516 |
++ trans_pcie->pci_dev = pdev; |
6517 |
++ iwl_disable_interrupts(trans); |
6518 |
++ |
6519 |
+ err = pci_enable_msi(pdev); |
6520 |
+ if (err) { |
6521 |
+ dev_err(&pdev->dev, "pci_enable_msi failed(0X%x)\n", err); |
6522 |
+@@ -1574,8 +1578,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, |
6523 |
+ } |
6524 |
+ } |
6525 |
+ |
6526 |
+- trans->dev = &pdev->dev; |
6527 |
+- trans_pcie->pci_dev = pdev; |
6528 |
+ trans->hw_rev = iwl_read32(trans, CSR_HW_REV); |
6529 |
+ trans->hw_id = (pdev->device << 16) + pdev->subsystem_device; |
6530 |
+ snprintf(trans->hw_id_str, sizeof(trans->hw_id_str), |
6531 |
+@@ -1601,8 +1603,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, |
6532 |
+ goto out_pci_disable_msi; |
6533 |
+ } |
6534 |
+ |
6535 |
+- trans_pcie->inta_mask = CSR_INI_SET_MASK; |
6536 |
+- |
6537 |
+ if (iwl_pcie_alloc_ict(trans)) |
6538 |
+ goto out_free_cmd_pool; |
6539 |
+ |
6540 |
+@@ -1614,6 +1614,8 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, |
6541 |
+ goto out_free_ict; |
6542 |
+ } |
6543 |
+ |
6544 |
++ trans_pcie->inta_mask = CSR_INI_SET_MASK; |
6545 |
++ |
6546 |
+ return trans; |
6547 |
+ |
6548 |
+ out_free_ict: |
6549 |
+diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c |
6550 |
+index ddeb5a709aa3..a87ee9b6585a 100644 |
6551 |
+--- a/drivers/net/wireless/rt2x00/rt2x00mac.c |
6552 |
++++ b/drivers/net/wireless/rt2x00/rt2x00mac.c |
6553 |
+@@ -621,20 +621,18 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, |
6554 |
+ bss_conf->bssid); |
6555 |
+ |
6556 |
+ /* |
6557 |
+- * Update the beacon. This is only required on USB devices. PCI |
6558 |
+- * devices fetch beacons periodically. |
6559 |
+- */ |
6560 |
+- if (changes & BSS_CHANGED_BEACON && rt2x00_is_usb(rt2x00dev)) |
6561 |
+- rt2x00queue_update_beacon(rt2x00dev, vif); |
6562 |
+- |
6563 |
+- /* |
6564 |
+ * Start/stop beaconing. |
6565 |
+ */ |
6566 |
+ if (changes & BSS_CHANGED_BEACON_ENABLED) { |
6567 |
+ if (!bss_conf->enable_beacon && intf->enable_beacon) { |
6568 |
+- rt2x00queue_clear_beacon(rt2x00dev, vif); |
6569 |
+ rt2x00dev->intf_beaconing--; |
6570 |
+ intf->enable_beacon = false; |
6571 |
++ /* |
6572 |
++ * Clear beacon in the H/W for this vif. This is needed |
6573 |
++ * to disable beaconing on this particular interface |
6574 |
++ * and keep it running on other interfaces. |
6575 |
++ */ |
6576 |
++ rt2x00queue_clear_beacon(rt2x00dev, vif); |
6577 |
+ |
6578 |
+ if (rt2x00dev->intf_beaconing == 0) { |
6579 |
+ /* |
6580 |
+@@ -645,11 +643,15 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, |
6581 |
+ rt2x00queue_stop_queue(rt2x00dev->bcn); |
6582 |
+ mutex_unlock(&intf->beacon_skb_mutex); |
6583 |
+ } |
6584 |
+- |
6585 |
+- |
6586 |
+ } else if (bss_conf->enable_beacon && !intf->enable_beacon) { |
6587 |
+ rt2x00dev->intf_beaconing++; |
6588 |
+ intf->enable_beacon = true; |
6589 |
++ /* |
6590 |
++ * Upload beacon to the H/W. This is only required on |
6591 |
++ * USB devices. PCI devices fetch beacons periodically. |
6592 |
++ */ |
6593 |
++ if (rt2x00_is_usb(rt2x00dev)) |
6594 |
++ rt2x00queue_update_beacon(rt2x00dev, vif); |
6595 |
+ |
6596 |
+ if (rt2x00dev->intf_beaconing == 1) { |
6597 |
+ /* |
6598 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c |
6599 |
+index cd17c642e746..472e592b32ec 100644 |
6600 |
+--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c |
6601 |
++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c |
6602 |
+@@ -1001,7 +1001,7 @@ int rtl92cu_hw_init(struct ieee80211_hw *hw) |
6603 |
+ err = _rtl92cu_init_mac(hw); |
6604 |
+ if (err) { |
6605 |
+ RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "init mac failed!\n"); |
6606 |
+- return err; |
6607 |
++ goto exit; |
6608 |
+ } |
6609 |
+ err = rtl92c_download_fw(hw); |
6610 |
+ if (err) { |
6611 |
+diff --git a/drivers/of/irq.c b/drivers/of/irq.c |
6612 |
+index 9bcf2cf19357..ca0189308d72 100644 |
6613 |
+--- a/drivers/of/irq.c |
6614 |
++++ b/drivers/of/irq.c |
6615 |
+@@ -380,6 +380,32 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) |
6616 |
+ EXPORT_SYMBOL_GPL(of_irq_to_resource); |
6617 |
+ |
6618 |
+ /** |
6619 |
++ * of_irq_get - Decode a node's IRQ and return it as a Linux irq number |
6620 |
++ * @dev: pointer to device tree node |
6621 |
++ * @index: zero-based index of the irq |
6622 |
++ * |
6623 |
++ * Returns Linux irq number on success, or -EPROBE_DEFER if the irq domain |
6624 |
++ * is not yet created. |
6625 |
++ * |
6626 |
++ */ |
6627 |
++int of_irq_get(struct device_node *dev, int index) |
6628 |
++{ |
6629 |
++ int rc; |
6630 |
++ struct of_phandle_args oirq; |
6631 |
++ struct irq_domain *domain; |
6632 |
++ |
6633 |
++ rc = of_irq_parse_one(dev, index, &oirq); |
6634 |
++ if (rc) |
6635 |
++ return rc; |
6636 |
++ |
6637 |
++ domain = irq_find_host(oirq.np); |
6638 |
++ if (!domain) |
6639 |
++ return -EPROBE_DEFER; |
6640 |
++ |
6641 |
++ return irq_create_of_mapping(&oirq); |
6642 |
++} |
6643 |
++ |
6644 |
++/** |
6645 |
+ * of_irq_count - Count the number of IRQs a node uses |
6646 |
+ * @dev: pointer to device tree node |
6647 |
+ */ |
6648 |
+diff --git a/drivers/of/platform.c b/drivers/of/platform.c |
6649 |
+index 404d1daebefa..bd47fbc53dc9 100644 |
6650 |
+--- a/drivers/of/platform.c |
6651 |
++++ b/drivers/of/platform.c |
6652 |
+@@ -168,7 +168,9 @@ struct platform_device *of_device_alloc(struct device_node *np, |
6653 |
+ rc = of_address_to_resource(np, i, res); |
6654 |
+ WARN_ON(rc); |
6655 |
+ } |
6656 |
+- WARN_ON(of_irq_to_resource_table(np, res, num_irq) != num_irq); |
6657 |
++ if (of_irq_to_resource_table(np, res, num_irq) != num_irq) |
6658 |
++ pr_debug("not all legacy IRQ resources mapped for %s\n", |
6659 |
++ np->name); |
6660 |
+ } |
6661 |
+ |
6662 |
+ dev->dev.of_node = of_node_get(np); |
6663 |
+diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c |
6664 |
+index 05e352889868..483d9ad89705 100644 |
6665 |
+--- a/drivers/pci/host/pci-mvebu.c |
6666 |
++++ b/drivers/pci/host/pci-mvebu.c |
6667 |
+@@ -291,6 +291,58 @@ static int mvebu_pcie_hw_wr_conf(struct mvebu_pcie_port *port, |
6668 |
+ return PCIBIOS_SUCCESSFUL; |
6669 |
+ } |
6670 |
+ |
6671 |
++/* |
6672 |
++ * Remove windows, starting from the largest ones to the smallest |
6673 |
++ * ones. |
6674 |
++ */ |
6675 |
++static void mvebu_pcie_del_windows(struct mvebu_pcie_port *port, |
6676 |
++ phys_addr_t base, size_t size) |
6677 |
++{ |
6678 |
++ while (size) { |
6679 |
++ size_t sz = 1 << (fls(size) - 1); |
6680 |
++ |
6681 |
++ mvebu_mbus_del_window(base, sz); |
6682 |
++ base += sz; |
6683 |
++ size -= sz; |
6684 |
++ } |
6685 |
++} |
6686 |
++ |
6687 |
++/* |
6688 |
++ * MBus windows can only have a power of two size, but PCI BARs do not |
6689 |
++ * have this constraint. Therefore, we have to split the PCI BAR into |
6690 |
++ * areas each having a power of two size. We start from the largest |
6691 |
++ * one (i.e highest order bit set in the size). |
6692 |
++ */ |
6693 |
++static void mvebu_pcie_add_windows(struct mvebu_pcie_port *port, |
6694 |
++ unsigned int target, unsigned int attribute, |
6695 |
++ phys_addr_t base, size_t size, |
6696 |
++ phys_addr_t remap) |
6697 |
++{ |
6698 |
++ size_t size_mapped = 0; |
6699 |
++ |
6700 |
++ while (size) { |
6701 |
++ size_t sz = 1 << (fls(size) - 1); |
6702 |
++ int ret; |
6703 |
++ |
6704 |
++ ret = mvebu_mbus_add_window_remap_by_id(target, attribute, base, |
6705 |
++ sz, remap); |
6706 |
++ if (ret) { |
6707 |
++ dev_err(&port->pcie->pdev->dev, |
6708 |
++ "Could not create MBus window at 0x%x, size 0x%x: %d\n", |
6709 |
++ base, sz, ret); |
6710 |
++ mvebu_pcie_del_windows(port, base - size_mapped, |
6711 |
++ size_mapped); |
6712 |
++ return; |
6713 |
++ } |
6714 |
++ |
6715 |
++ size -= sz; |
6716 |
++ size_mapped += sz; |
6717 |
++ base += sz; |
6718 |
++ if (remap != MVEBU_MBUS_NO_REMAP) |
6719 |
++ remap += sz; |
6720 |
++ } |
6721 |
++} |
6722 |
++ |
6723 |
+ static void mvebu_pcie_handle_iobase_change(struct mvebu_pcie_port *port) |
6724 |
+ { |
6725 |
+ phys_addr_t iobase; |
6726 |
+@@ -302,8 +354,8 @@ static void mvebu_pcie_handle_iobase_change(struct mvebu_pcie_port *port) |
6727 |
+ |
6728 |
+ /* If a window was configured, remove it */ |
6729 |
+ if (port->iowin_base) { |
6730 |
+- mvebu_mbus_del_window(port->iowin_base, |
6731 |
+- port->iowin_size); |
6732 |
++ mvebu_pcie_del_windows(port, port->iowin_base, |
6733 |
++ port->iowin_size); |
6734 |
+ port->iowin_base = 0; |
6735 |
+ port->iowin_size = 0; |
6736 |
+ } |
6737 |
+@@ -329,11 +381,11 @@ static void mvebu_pcie_handle_iobase_change(struct mvebu_pcie_port *port) |
6738 |
+ port->iowin_base = port->pcie->io.start + iobase; |
6739 |
+ port->iowin_size = ((0xFFF | ((port->bridge.iolimit & 0xF0) << 8) | |
6740 |
+ (port->bridge.iolimitupper << 16)) - |
6741 |
+- iobase); |
6742 |
++ iobase) + 1; |
6743 |
+ |
6744 |
+- mvebu_mbus_add_window_remap_by_id(port->io_target, port->io_attr, |
6745 |
+- port->iowin_base, port->iowin_size, |
6746 |
+- iobase); |
6747 |
++ mvebu_pcie_add_windows(port, port->io_target, port->io_attr, |
6748 |
++ port->iowin_base, port->iowin_size, |
6749 |
++ iobase); |
6750 |
+ } |
6751 |
+ |
6752 |
+ static void mvebu_pcie_handle_membase_change(struct mvebu_pcie_port *port) |
6753 |
+@@ -344,8 +396,8 @@ static void mvebu_pcie_handle_membase_change(struct mvebu_pcie_port *port) |
6754 |
+ |
6755 |
+ /* If a window was configured, remove it */ |
6756 |
+ if (port->memwin_base) { |
6757 |
+- mvebu_mbus_del_window(port->memwin_base, |
6758 |
+- port->memwin_size); |
6759 |
++ mvebu_pcie_del_windows(port, port->memwin_base, |
6760 |
++ port->memwin_size); |
6761 |
+ port->memwin_base = 0; |
6762 |
+ port->memwin_size = 0; |
6763 |
+ } |
6764 |
+@@ -362,10 +414,11 @@ static void mvebu_pcie_handle_membase_change(struct mvebu_pcie_port *port) |
6765 |
+ port->memwin_base = ((port->bridge.membase & 0xFFF0) << 16); |
6766 |
+ port->memwin_size = |
6767 |
+ (((port->bridge.memlimit & 0xFFF0) << 16) | 0xFFFFF) - |
6768 |
+- port->memwin_base; |
6769 |
++ port->memwin_base + 1; |
6770 |
+ |
6771 |
+- mvebu_mbus_add_window_by_id(port->mem_target, port->mem_attr, |
6772 |
+- port->memwin_base, port->memwin_size); |
6773 |
++ mvebu_pcie_add_windows(port, port->mem_target, port->mem_attr, |
6774 |
++ port->memwin_base, port->memwin_size, |
6775 |
++ MVEBU_MBUS_NO_REMAP); |
6776 |
+ } |
6777 |
+ |
6778 |
+ /* |
6779 |
+@@ -721,14 +774,21 @@ static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev, |
6780 |
+ |
6781 |
+ /* |
6782 |
+ * On the PCI-to-PCI bridge side, the I/O windows must have at |
6783 |
+- * least a 64 KB size and be aligned on their size, and the |
6784 |
+- * memory windows must have at least a 1 MB size and be |
6785 |
+- * aligned on their size |
6786 |
++ * least a 64 KB size and the memory windows must have at |
6787 |
++ * least a 1 MB size. Moreover, MBus windows need to have a |
6788 |
++ * base address aligned on their size, and their size must be |
6789 |
++ * a power of two. This means that if the BAR doesn't have a |
6790 |
++ * power of two size, several MBus windows will actually be |
6791 |
++ * created. We need to ensure that the biggest MBus window |
6792 |
++ * (which will be the first one) is aligned on its size, which |
6793 |
++ * explains the rounddown_pow_of_two() being done here. |
6794 |
+ */ |
6795 |
+ if (res->flags & IORESOURCE_IO) |
6796 |
+- return round_up(start, max_t(resource_size_t, SZ_64K, size)); |
6797 |
++ return round_up(start, max_t(resource_size_t, SZ_64K, |
6798 |
++ rounddown_pow_of_two(size))); |
6799 |
+ else if (res->flags & IORESOURCE_MEM) |
6800 |
+- return round_up(start, max_t(resource_size_t, SZ_1M, size)); |
6801 |
++ return round_up(start, max_t(resource_size_t, SZ_1M, |
6802 |
++ rounddown_pow_of_two(size))); |
6803 |
+ else |
6804 |
+ return start; |
6805 |
+ } |
6806 |
+diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c |
6807 |
+index 58499277903a..6efc2ec5e4db 100644 |
6808 |
+--- a/drivers/pci/hotplug/shpchp_ctrl.c |
6809 |
++++ b/drivers/pci/hotplug/shpchp_ctrl.c |
6810 |
+@@ -282,8 +282,8 @@ static int board_added(struct slot *p_slot) |
6811 |
+ return WRONG_BUS_FREQUENCY; |
6812 |
+ } |
6813 |
+ |
6814 |
+- bsp = ctrl->pci_dev->bus->cur_bus_speed; |
6815 |
+- msp = ctrl->pci_dev->bus->max_bus_speed; |
6816 |
++ bsp = ctrl->pci_dev->subordinate->cur_bus_speed; |
6817 |
++ msp = ctrl->pci_dev->subordinate->max_bus_speed; |
6818 |
+ |
6819 |
+ /* Check if there are other slots or devices on the same bus */ |
6820 |
+ if (!list_empty(&ctrl->pci_dev->subordinate->devices)) |
6821 |
+diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c |
6822 |
+index fdbc294821e6..33bb970980d2 100644 |
6823 |
+--- a/drivers/pci/pci.c |
6824 |
++++ b/drivers/pci/pci.c |
6825 |
+@@ -3043,7 +3043,8 @@ int pci_wait_for_pending_transaction(struct pci_dev *dev) |
6826 |
+ if (!pci_is_pcie(dev)) |
6827 |
+ return 1; |
6828 |
+ |
6829 |
+- return pci_wait_for_pending(dev, PCI_EXP_DEVSTA, PCI_EXP_DEVSTA_TRPND); |
6830 |
++ return pci_wait_for_pending(dev, pci_pcie_cap(dev) + PCI_EXP_DEVSTA, |
6831 |
++ PCI_EXP_DEVSTA_TRPND); |
6832 |
+ } |
6833 |
+ EXPORT_SYMBOL(pci_wait_for_pending_transaction); |
6834 |
+ |
6835 |
+@@ -3085,7 +3086,7 @@ static int pci_af_flr(struct pci_dev *dev, int probe) |
6836 |
+ return 0; |
6837 |
+ |
6838 |
+ /* Wait for Transaction Pending bit clean */ |
6839 |
+- if (pci_wait_for_pending(dev, PCI_AF_STATUS, PCI_AF_STATUS_TP)) |
6840 |
++ if (pci_wait_for_pending(dev, pos + PCI_AF_STATUS, PCI_AF_STATUS_TP)) |
6841 |
+ goto clear; |
6842 |
+ |
6843 |
+ dev_err(&dev->dev, "transaction is not cleared; " |
6844 |
+diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c |
6845 |
+index 9f611cbbc294..c31aa07b3ba5 100644 |
6846 |
+--- a/drivers/pnp/pnpacpi/core.c |
6847 |
++++ b/drivers/pnp/pnpacpi/core.c |
6848 |
+@@ -83,8 +83,7 @@ static int pnpacpi_set_resources(struct pnp_dev *dev) |
6849 |
+ { |
6850 |
+ struct acpi_device *acpi_dev; |
6851 |
+ acpi_handle handle; |
6852 |
+- struct acpi_buffer buffer; |
6853 |
+- int ret; |
6854 |
++ int ret = 0; |
6855 |
+ |
6856 |
+ pnp_dbg(&dev->dev, "set resources\n"); |
6857 |
+ |
6858 |
+@@ -97,19 +96,26 @@ static int pnpacpi_set_resources(struct pnp_dev *dev) |
6859 |
+ if (WARN_ON_ONCE(acpi_dev != dev->data)) |
6860 |
+ dev->data = acpi_dev; |
6861 |
+ |
6862 |
+- ret = pnpacpi_build_resource_template(dev, &buffer); |
6863 |
+- if (ret) |
6864 |
+- return ret; |
6865 |
+- ret = pnpacpi_encode_resources(dev, &buffer); |
6866 |
+- if (ret) { |
6867 |
++ if (acpi_has_method(handle, METHOD_NAME__SRS)) { |
6868 |
++ struct acpi_buffer buffer; |
6869 |
++ |
6870 |
++ ret = pnpacpi_build_resource_template(dev, &buffer); |
6871 |
++ if (ret) |
6872 |
++ return ret; |
6873 |
++ |
6874 |
++ ret = pnpacpi_encode_resources(dev, &buffer); |
6875 |
++ if (!ret) { |
6876 |
++ acpi_status status; |
6877 |
++ |
6878 |
++ status = acpi_set_current_resources(handle, &buffer); |
6879 |
++ if (ACPI_FAILURE(status)) |
6880 |
++ ret = -EIO; |
6881 |
++ } |
6882 |
+ kfree(buffer.pointer); |
6883 |
+- return ret; |
6884 |
+ } |
6885 |
+- if (ACPI_FAILURE(acpi_set_current_resources(handle, &buffer))) |
6886 |
+- ret = -EINVAL; |
6887 |
+- else if (acpi_bus_power_manageable(handle)) |
6888 |
++ if (!ret && acpi_bus_power_manageable(handle)) |
6889 |
+ ret = acpi_bus_set_power(handle, ACPI_STATE_D0); |
6890 |
+- kfree(buffer.pointer); |
6891 |
++ |
6892 |
+ return ret; |
6893 |
+ } |
6894 |
+ |
6895 |
+@@ -117,7 +123,7 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev) |
6896 |
+ { |
6897 |
+ struct acpi_device *acpi_dev; |
6898 |
+ acpi_handle handle; |
6899 |
+- int ret; |
6900 |
++ acpi_status status; |
6901 |
+ |
6902 |
+ dev_dbg(&dev->dev, "disable resources\n"); |
6903 |
+ |
6904 |
+@@ -128,13 +134,15 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev) |
6905 |
+ } |
6906 |
+ |
6907 |
+ /* acpi_unregister_gsi(pnp_irq(dev, 0)); */ |
6908 |
+- ret = 0; |
6909 |
+ if (acpi_bus_power_manageable(handle)) |
6910 |
+ acpi_bus_set_power(handle, ACPI_STATE_D3_COLD); |
6911 |
+- /* continue even if acpi_bus_set_power() fails */ |
6912 |
+- if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DIS", NULL, NULL))) |
6913 |
+- ret = -ENODEV; |
6914 |
+- return ret; |
6915 |
++ |
6916 |
++ /* continue even if acpi_bus_set_power() fails */ |
6917 |
++ status = acpi_evaluate_object(handle, "_DIS", NULL, NULL); |
6918 |
++ if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) |
6919 |
++ return -ENODEV; |
6920 |
++ |
6921 |
++ return 0; |
6922 |
+ } |
6923 |
+ |
6924 |
+ #ifdef CONFIG_ACPI_SLEEP |
6925 |
+diff --git a/drivers/rtc/rtc-hym8563.c b/drivers/rtc/rtc-hym8563.c |
6926 |
+index bd628a6f981d..e5f13c4310fe 100644 |
6927 |
+--- a/drivers/rtc/rtc-hym8563.c |
6928 |
++++ b/drivers/rtc/rtc-hym8563.c |
6929 |
+@@ -569,6 +569,9 @@ static int hym8563_probe(struct i2c_client *client, |
6930 |
+ if (IS_ERR(hym8563->rtc)) |
6931 |
+ return PTR_ERR(hym8563->rtc); |
6932 |
+ |
6933 |
++ /* the hym8563 alarm only supports a minute accuracy */ |
6934 |
++ hym8563->rtc->uie_unsupported = 1; |
6935 |
++ |
6936 |
+ #ifdef CONFIG_COMMON_CLK |
6937 |
+ hym8563_clkout_register_clk(hym8563); |
6938 |
+ #endif |
6939 |
+diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c |
6940 |
+index d0b28bba38be..fbf3b22efe5a 100644 |
6941 |
+--- a/drivers/spi/spi.c |
6942 |
++++ b/drivers/spi/spi.c |
6943 |
+@@ -1568,7 +1568,7 @@ EXPORT_SYMBOL_GPL(spi_busnum_to_master); |
6944 |
+ */ |
6945 |
+ int spi_setup(struct spi_device *spi) |
6946 |
+ { |
6947 |
+- unsigned bad_bits; |
6948 |
++ unsigned bad_bits, ugly_bits; |
6949 |
+ int status = 0; |
6950 |
+ |
6951 |
+ /* check mode to prevent that DUAL and QUAD set at the same time |
6952 |
+@@ -1588,6 +1588,15 @@ int spi_setup(struct spi_device *spi) |
6953 |
+ * that aren't supported with their current master |
6954 |
+ */ |
6955 |
+ bad_bits = spi->mode & ~spi->master->mode_bits; |
6956 |
++ ugly_bits = bad_bits & |
6957 |
++ (SPI_TX_DUAL | SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD); |
6958 |
++ if (ugly_bits) { |
6959 |
++ dev_warn(&spi->dev, |
6960 |
++ "setup: ignoring unsupported mode bits %x\n", |
6961 |
++ ugly_bits); |
6962 |
++ spi->mode &= ~ugly_bits; |
6963 |
++ bad_bits &= ~ugly_bits; |
6964 |
++ } |
6965 |
+ if (bad_bits) { |
6966 |
+ dev_err(&spi->dev, "setup: unsupported mode bits %x\n", |
6967 |
+ bad_bits); |
6968 |
+diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
6969 |
+index 7e5469a80fe3..86b92d95ac10 100644 |
6970 |
+--- a/drivers/target/iscsi/iscsi_target.c |
6971 |
++++ b/drivers/target/iscsi/iscsi_target.c |
6972 |
+@@ -1564,7 +1564,9 @@ int iscsit_process_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd, |
6973 |
+ * Initiator is expecting a NopIN ping reply.. |
6974 |
+ */ |
6975 |
+ if (hdr->itt != RESERVED_ITT) { |
6976 |
+- BUG_ON(!cmd); |
6977 |
++ if (!cmd) |
6978 |
++ return iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR, |
6979 |
++ (unsigned char *)hdr); |
6980 |
+ |
6981 |
+ spin_lock_bh(&conn->cmd_lock); |
6982 |
+ list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); |
6983 |
+diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c |
6984 |
+index 65001e133670..26416c15d65c 100644 |
6985 |
+--- a/drivers/target/target_core_device.c |
6986 |
++++ b/drivers/target/target_core_device.c |
6987 |
+@@ -798,10 +798,10 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) |
6988 |
+ pr_err("emulate_write_cache not supported for pSCSI\n"); |
6989 |
+ return -EINVAL; |
6990 |
+ } |
6991 |
+- if (dev->transport->get_write_cache) { |
6992 |
+- pr_warn("emulate_write_cache cannot be changed when underlying" |
6993 |
+- " HW reports WriteCacheEnabled, ignoring request\n"); |
6994 |
+- return 0; |
6995 |
++ if (flag && |
6996 |
++ dev->transport->get_write_cache) { |
6997 |
++ pr_err("emulate_write_cache not supported for this device\n"); |
6998 |
++ return -EINVAL; |
6999 |
+ } |
7000 |
+ |
7001 |
+ dev->dev_attrib.emulate_write_cache = flag; |
7002 |
+@@ -936,6 +936,10 @@ int se_dev_set_pi_prot_type(struct se_device *dev, int flag) |
7003 |
+ return 0; |
7004 |
+ } |
7005 |
+ if (!dev->transport->init_prot || !dev->transport->free_prot) { |
7006 |
++ /* 0 is only allowed value for non-supporting backends */ |
7007 |
++ if (flag == 0) |
7008 |
++ return 0; |
7009 |
++ |
7010 |
+ pr_err("DIF protection not supported by backend: %s\n", |
7011 |
+ dev->transport->name); |
7012 |
+ return -ENOSYS; |
7013 |
+diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c |
7014 |
+index 2956250b7225..98b48d400a3a 100644 |
7015 |
+--- a/drivers/target/target_core_transport.c |
7016 |
++++ b/drivers/target/target_core_transport.c |
7017 |
+@@ -1102,6 +1102,7 @@ void transport_init_se_cmd( |
7018 |
+ init_completion(&cmd->cmd_wait_comp); |
7019 |
+ init_completion(&cmd->task_stop_comp); |
7020 |
+ spin_lock_init(&cmd->t_state_lock); |
7021 |
++ kref_init(&cmd->cmd_kref); |
7022 |
+ cmd->transport_state = CMD_T_DEV_ACTIVE; |
7023 |
+ |
7024 |
+ cmd->se_tfo = tfo; |
7025 |
+@@ -2292,7 +2293,6 @@ int target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd, |
7026 |
+ unsigned long flags; |
7027 |
+ int ret = 0; |
7028 |
+ |
7029 |
+- kref_init(&se_cmd->cmd_kref); |
7030 |
+ /* |
7031 |
+ * Add a second kref if the fabric caller is expecting to handle |
7032 |
+ * fabric acknowledgement that requires two target_put_sess_cmd() |
7033 |
+diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c |
7034 |
+index 8b2c1aaf81de..d22cdc77e9d4 100644 |
7035 |
+--- a/drivers/target/tcm_fc/tfc_cmd.c |
7036 |
++++ b/drivers/target/tcm_fc/tfc_cmd.c |
7037 |
+@@ -90,18 +90,18 @@ static void ft_free_cmd(struct ft_cmd *cmd) |
7038 |
+ { |
7039 |
+ struct fc_frame *fp; |
7040 |
+ struct fc_lport *lport; |
7041 |
+- struct se_session *se_sess; |
7042 |
++ struct ft_sess *sess; |
7043 |
+ |
7044 |
+ if (!cmd) |
7045 |
+ return; |
7046 |
+- se_sess = cmd->sess->se_sess; |
7047 |
++ sess = cmd->sess; |
7048 |
+ fp = cmd->req_frame; |
7049 |
+ lport = fr_dev(fp); |
7050 |
+ if (fr_seq(fp)) |
7051 |
+ lport->tt.seq_release(fr_seq(fp)); |
7052 |
+ fc_frame_free(fp); |
7053 |
+- percpu_ida_free(&se_sess->sess_tag_pool, cmd->se_cmd.map_tag); |
7054 |
+- ft_sess_put(cmd->sess); /* undo get from lookup at recv */ |
7055 |
++ percpu_ida_free(&sess->se_sess->sess_tag_pool, cmd->se_cmd.map_tag); |
7056 |
++ ft_sess_put(sess); /* undo get from lookup at recv */ |
7057 |
+ } |
7058 |
+ |
7059 |
+ void ft_release_cmd(struct se_cmd *se_cmd) |
7060 |
+diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c |
7061 |
+index 2798a23a0834..29a7f632b354 100644 |
7062 |
+--- a/drivers/tty/serial/8250/8250_core.c |
7063 |
++++ b/drivers/tty/serial/8250/8250_core.c |
7064 |
+@@ -1520,7 +1520,7 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir) |
7065 |
+ status = serial8250_rx_chars(up, status); |
7066 |
+ } |
7067 |
+ serial8250_modem_status(up); |
7068 |
+- if (status & UART_LSR_THRE) |
7069 |
++ if (!up->dma && (status & UART_LSR_THRE)) |
7070 |
+ serial8250_tx_chars(up); |
7071 |
+ |
7072 |
+ spin_unlock_irqrestore(&port->lock, flags); |
7073 |
+diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c |
7074 |
+index 7046769608d4..ab9096dc3849 100644 |
7075 |
+--- a/drivers/tty/serial/8250/8250_dma.c |
7076 |
++++ b/drivers/tty/serial/8250/8250_dma.c |
7077 |
+@@ -20,12 +20,15 @@ static void __dma_tx_complete(void *param) |
7078 |
+ struct uart_8250_port *p = param; |
7079 |
+ struct uart_8250_dma *dma = p->dma; |
7080 |
+ struct circ_buf *xmit = &p->port.state->xmit; |
7081 |
+- |
7082 |
+- dma->tx_running = 0; |
7083 |
++ unsigned long flags; |
7084 |
+ |
7085 |
+ dma_sync_single_for_cpu(dma->txchan->device->dev, dma->tx_addr, |
7086 |
+ UART_XMIT_SIZE, DMA_TO_DEVICE); |
7087 |
+ |
7088 |
++ spin_lock_irqsave(&p->port.lock, flags); |
7089 |
++ |
7090 |
++ dma->tx_running = 0; |
7091 |
++ |
7092 |
+ xmit->tail += dma->tx_size; |
7093 |
+ xmit->tail &= UART_XMIT_SIZE - 1; |
7094 |
+ p->port.icount.tx += dma->tx_size; |
7095 |
+@@ -35,6 +38,8 @@ static void __dma_tx_complete(void *param) |
7096 |
+ |
7097 |
+ if (!uart_circ_empty(xmit) && !uart_tx_stopped(&p->port)) |
7098 |
+ serial8250_tx_dma(p); |
7099 |
++ |
7100 |
++ spin_unlock_irqrestore(&p->port.lock, flags); |
7101 |
+ } |
7102 |
+ |
7103 |
+ static void __dma_rx_complete(void *param) |
7104 |
+diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c |
7105 |
+index cea8c20a1425..1926925a52a9 100644 |
7106 |
+--- a/drivers/usb/gadget/at91_udc.c |
7107 |
++++ b/drivers/usb/gadget/at91_udc.c |
7108 |
+@@ -1709,16 +1709,6 @@ static int at91udc_probe(struct platform_device *pdev) |
7109 |
+ return -ENODEV; |
7110 |
+ } |
7111 |
+ |
7112 |
+- if (pdev->num_resources != 2) { |
7113 |
+- DBG("invalid num_resources\n"); |
7114 |
+- return -ENODEV; |
7115 |
+- } |
7116 |
+- if ((pdev->resource[0].flags != IORESOURCE_MEM) |
7117 |
+- || (pdev->resource[1].flags != IORESOURCE_IRQ)) { |
7118 |
+- DBG("invalid resource type\n"); |
7119 |
+- return -ENODEV; |
7120 |
+- } |
7121 |
+- |
7122 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
7123 |
+ if (!res) |
7124 |
+ return -ENXIO; |
7125 |
+diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c |
7126 |
+index 6f2c8d3899d2..cf2734b532a7 100644 |
7127 |
+--- a/drivers/usb/host/ehci-fsl.c |
7128 |
++++ b/drivers/usb/host/ehci-fsl.c |
7129 |
+@@ -248,7 +248,8 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd, |
7130 |
+ break; |
7131 |
+ } |
7132 |
+ |
7133 |
+- if (pdata->have_sysif_regs && pdata->controller_ver && |
7134 |
++ if (pdata->have_sysif_regs && |
7135 |
++ pdata->controller_ver > FSL_USB_VER_1_6 && |
7136 |
+ (phy_mode == FSL_USB2_PHY_ULPI)) { |
7137 |
+ /* check PHY_CLK_VALID to get phy clk valid */ |
7138 |
+ if (!(spin_event_timeout(in_be32(non_ehci + FSL_SOC_USB_CTRL) & |
7139 |
+diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c |
7140 |
+index c81c8721cc5a..cd871b895013 100644 |
7141 |
+--- a/drivers/usb/host/ohci-hub.c |
7142 |
++++ b/drivers/usb/host/ohci-hub.c |
7143 |
+@@ -90,6 +90,24 @@ __acquires(ohci->lock) |
7144 |
+ dl_done_list (ohci); |
7145 |
+ finish_unlinks (ohci, ohci_frame_no(ohci)); |
7146 |
+ |
7147 |
++ /* |
7148 |
++ * Some controllers don't handle "global" suspend properly if |
7149 |
++ * there are unsuspended ports. For these controllers, put all |
7150 |
++ * the enabled ports into suspend before suspending the root hub. |
7151 |
++ */ |
7152 |
++ if (ohci->flags & OHCI_QUIRK_GLOBAL_SUSPEND) { |
7153 |
++ __hc32 __iomem *portstat = ohci->regs->roothub.portstatus; |
7154 |
++ int i; |
7155 |
++ unsigned temp; |
7156 |
++ |
7157 |
++ for (i = 0; i < ohci->num_ports; (++i, ++portstat)) { |
7158 |
++ temp = ohci_readl(ohci, portstat); |
7159 |
++ if ((temp & (RH_PS_PES | RH_PS_PSS)) == |
7160 |
++ RH_PS_PES) |
7161 |
++ ohci_writel(ohci, RH_PS_PSS, portstat); |
7162 |
++ } |
7163 |
++ } |
7164 |
++ |
7165 |
+ /* maybe resume can wake root hub */ |
7166 |
+ if (ohci_to_hcd(ohci)->self.root_hub->do_remote_wakeup || autostop) { |
7167 |
+ ohci->hc_control |= OHCI_CTRL_RWE; |
7168 |
+diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c |
7169 |
+index 90879e9ccbec..bb1509675727 100644 |
7170 |
+--- a/drivers/usb/host/ohci-pci.c |
7171 |
++++ b/drivers/usb/host/ohci-pci.c |
7172 |
+@@ -160,6 +160,7 @@ static int ohci_quirk_amd700(struct usb_hcd *hcd) |
7173 |
+ ohci_dbg(ohci, "enabled AMD prefetch quirk\n"); |
7174 |
+ } |
7175 |
+ |
7176 |
++ ohci->flags |= OHCI_QUIRK_GLOBAL_SUSPEND; |
7177 |
+ return 0; |
7178 |
+ } |
7179 |
+ |
7180 |
+diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h |
7181 |
+index 9250cada13f0..4550ce05af7f 100644 |
7182 |
+--- a/drivers/usb/host/ohci.h |
7183 |
++++ b/drivers/usb/host/ohci.h |
7184 |
+@@ -405,6 +405,8 @@ struct ohci_hcd { |
7185 |
+ #define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */ |
7186 |
+ #define OHCI_QUIRK_AMD_PLL 0x200 /* AMD PLL quirk*/ |
7187 |
+ #define OHCI_QUIRK_AMD_PREFETCH 0x400 /* pre-fetch for ISO transfer */ |
7188 |
++#define OHCI_QUIRK_GLOBAL_SUSPEND 0x800 /* must suspend ports */ |
7189 |
++ |
7190 |
+ // there are also chip quirks/bugs in init logic |
7191 |
+ |
7192 |
+ struct work_struct nec_work; /* Worker for NEC quirk */ |
7193 |
+diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c |
7194 |
+index 7ed681a714a5..6c0a542e8ec1 100644 |
7195 |
+--- a/drivers/usb/serial/qcserial.c |
7196 |
++++ b/drivers/usb/serial/qcserial.c |
7197 |
+@@ -151,6 +151,21 @@ static const struct usb_device_id id_table[] = { |
7198 |
+ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 0)}, /* Netgear AirCard 340U Device Management */ |
7199 |
+ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 2)}, /* Netgear AirCard 340U NMEA */ |
7200 |
+ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 3)}, /* Netgear AirCard 340U Modem */ |
7201 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a2, 0)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card Device Management */ |
7202 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a2, 2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card NMEA */ |
7203 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a2, 3)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card Modem */ |
7204 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a3, 0)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card Device Management */ |
7205 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a3, 2)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card NMEA */ |
7206 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a3, 3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card Modem */ |
7207 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a4, 0)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card Device Management */ |
7208 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a4, 2)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card NMEA */ |
7209 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a4, 3)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card Modem */ |
7210 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a8, 0)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card Device Management */ |
7211 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a8, 2)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card NMEA */ |
7212 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a8, 3)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card Modem */ |
7213 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a9, 0)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card Device Management */ |
7214 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a9, 2)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card NMEA */ |
7215 |
++ {USB_DEVICE_INTERFACE_NUMBER(0x413c, 0x81a9, 3)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card Modem */ |
7216 |
+ |
7217 |
+ { } /* Terminating entry */ |
7218 |
+ }; |
7219 |
+diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c |
7220 |
+index 4ef2a80728f7..008d805c3d21 100644 |
7221 |
+--- a/drivers/usb/storage/shuttle_usbat.c |
7222 |
++++ b/drivers/usb/storage/shuttle_usbat.c |
7223 |
+@@ -1851,7 +1851,7 @@ static int usbat_probe(struct usb_interface *intf, |
7224 |
+ us->transport_name = "Shuttle USBAT"; |
7225 |
+ us->transport = usbat_flash_transport; |
7226 |
+ us->transport_reset = usb_stor_CB_reset; |
7227 |
+- us->max_lun = 1; |
7228 |
++ us->max_lun = 0; |
7229 |
+ |
7230 |
+ result = usb_stor_probe2(us); |
7231 |
+ return result; |
7232 |
+diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
7233 |
+index adbeb255616a..042c83b01046 100644 |
7234 |
+--- a/drivers/usb/storage/unusual_devs.h |
7235 |
++++ b/drivers/usb/storage/unusual_devs.h |
7236 |
+@@ -234,6 +234,20 @@ UNUSUAL_DEV( 0x0421, 0x0495, 0x0370, 0x0370, |
7237 |
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
7238 |
+ US_FL_MAX_SECTORS_64 ), |
7239 |
+ |
7240 |
++/* Reported by Daniele Forsi <dforsi@×××××.com> */ |
7241 |
++UNUSUAL_DEV( 0x0421, 0x04b9, 0x0350, 0x0350, |
7242 |
++ "Nokia", |
7243 |
++ "5300", |
7244 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
7245 |
++ US_FL_MAX_SECTORS_64 ), |
7246 |
++ |
7247 |
++/* Patch submitted by Victor A. Santos <victoraur.santos@×××××.com> */ |
7248 |
++UNUSUAL_DEV( 0x0421, 0x05af, 0x0742, 0x0742, |
7249 |
++ "Nokia", |
7250 |
++ "305", |
7251 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
7252 |
++ US_FL_MAX_SECTORS_64), |
7253 |
++ |
7254 |
+ /* Patch submitted by Mikhail Zolotaryov <lebon@×××××××××.ua> */ |
7255 |
+ UNUSUAL_DEV( 0x0421, 0x06aa, 0x1110, 0x1110, |
7256 |
+ "Nokia", |
7257 |
+diff --git a/fs/affs/super.c b/fs/affs/super.c |
7258 |
+index d098731b82ff..9a5b19dc899d 100644 |
7259 |
+--- a/fs/affs/super.c |
7260 |
++++ b/fs/affs/super.c |
7261 |
+@@ -336,8 +336,6 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) |
7262 |
+ &blocksize,&sbi->s_prefix, |
7263 |
+ sbi->s_volume, &mount_flags)) { |
7264 |
+ printk(KERN_ERR "AFFS: Error parsing options\n"); |
7265 |
+- kfree(sbi->s_prefix); |
7266 |
+- kfree(sbi); |
7267 |
+ return -EINVAL; |
7268 |
+ } |
7269 |
+ /* N.B. after this point s_prefix must be released */ |
7270 |
+diff --git a/fs/aio.c b/fs/aio.c |
7271 |
+index 12a3de0ee6da..04cd7686555d 100644 |
7272 |
+--- a/fs/aio.c |
7273 |
++++ b/fs/aio.c |
7274 |
+@@ -1299,10 +1299,8 @@ rw_common: |
7275 |
+ &iovec, compat) |
7276 |
+ : aio_setup_single_vector(req, rw, buf, &nr_segs, |
7277 |
+ iovec); |
7278 |
+- if (ret) |
7279 |
+- return ret; |
7280 |
+- |
7281 |
+- ret = rw_verify_area(rw, file, &req->ki_pos, req->ki_nbytes); |
7282 |
++ if (!ret) |
7283 |
++ ret = rw_verify_area(rw, file, &req->ki_pos, req->ki_nbytes); |
7284 |
+ if (ret < 0) { |
7285 |
+ if (iovec != &inline_vec) |
7286 |
+ kfree(iovec); |
7287 |
+diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c |
7288 |
+index 2caf36ac3e93..cc87c1abac97 100644 |
7289 |
+--- a/fs/autofs4/root.c |
7290 |
++++ b/fs/autofs4/root.c |
7291 |
+@@ -179,7 +179,7 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry) |
7292 |
+ spin_lock(&active->d_lock); |
7293 |
+ |
7294 |
+ /* Already gone? */ |
7295 |
+- if (!d_count(active)) |
7296 |
++ if ((int) d_count(active) <= 0) |
7297 |
+ goto next; |
7298 |
+ |
7299 |
+ qstr = &active->d_name; |
7300 |
+@@ -230,7 +230,7 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry) |
7301 |
+ |
7302 |
+ spin_lock(&expiring->d_lock); |
7303 |
+ |
7304 |
+- /* Bad luck, we've already been dentry_iput */ |
7305 |
++ /* We've already been dentry_iput or unlinked */ |
7306 |
+ if (!expiring->d_inode) |
7307 |
+ goto next; |
7308 |
+ |
7309 |
+diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c |
7310 |
+index 45eda6d7a40c..5e0982aa7000 100644 |
7311 |
+--- a/fs/ceph/dir.c |
7312 |
++++ b/fs/ceph/dir.c |
7313 |
+@@ -446,7 +446,6 @@ more: |
7314 |
+ if (atomic_read(&ci->i_release_count) == fi->dir_release_count) { |
7315 |
+ dout(" marking %p complete\n", inode); |
7316 |
+ __ceph_dir_set_complete(ci, fi->dir_release_count); |
7317 |
+- ci->i_max_offset = ctx->pos; |
7318 |
+ } |
7319 |
+ spin_unlock(&ci->i_ceph_lock); |
7320 |
+ |
7321 |
+@@ -932,14 +931,16 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry, |
7322 |
+ * to do it here. |
7323 |
+ */ |
7324 |
+ |
7325 |
+- /* d_move screws up d_subdirs order */ |
7326 |
+- ceph_dir_clear_complete(new_dir); |
7327 |
+- |
7328 |
+ d_move(old_dentry, new_dentry); |
7329 |
+ |
7330 |
+ /* ensure target dentry is invalidated, despite |
7331 |
+ rehashing bug in vfs_rename_dir */ |
7332 |
+ ceph_invalidate_dentry_lease(new_dentry); |
7333 |
++ |
7334 |
++ /* d_move screws up sibling dentries' offsets */ |
7335 |
++ ceph_dir_clear_complete(old_dir); |
7336 |
++ ceph_dir_clear_complete(new_dir); |
7337 |
++ |
7338 |
+ } |
7339 |
+ ceph_mdsc_put_request(req); |
7340 |
+ return err; |
7341 |
+diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c |
7342 |
+index 32d519d8a2e2..6471f9c83428 100644 |
7343 |
+--- a/fs/ceph/inode.c |
7344 |
++++ b/fs/ceph/inode.c |
7345 |
+@@ -752,7 +752,6 @@ static int fill_inode(struct inode *inode, |
7346 |
+ !__ceph_dir_is_complete(ci)) { |
7347 |
+ dout(" marking %p complete (empty)\n", inode); |
7348 |
+ __ceph_dir_set_complete(ci, atomic_read(&ci->i_release_count)); |
7349 |
+- ci->i_max_offset = 2; |
7350 |
+ } |
7351 |
+ no_change: |
7352 |
+ spin_unlock(&ci->i_ceph_lock); |
7353 |
+@@ -890,41 +889,6 @@ out_unlock: |
7354 |
+ } |
7355 |
+ |
7356 |
+ /* |
7357 |
+- * Set dentry's directory position based on the current dir's max, and |
7358 |
+- * order it in d_subdirs, so that dcache_readdir behaves. |
7359 |
+- * |
7360 |
+- * Always called under directory's i_mutex. |
7361 |
+- */ |
7362 |
+-static void ceph_set_dentry_offset(struct dentry *dn) |
7363 |
+-{ |
7364 |
+- struct dentry *dir = dn->d_parent; |
7365 |
+- struct inode *inode = dir->d_inode; |
7366 |
+- struct ceph_inode_info *ci; |
7367 |
+- struct ceph_dentry_info *di; |
7368 |
+- |
7369 |
+- BUG_ON(!inode); |
7370 |
+- |
7371 |
+- ci = ceph_inode(inode); |
7372 |
+- di = ceph_dentry(dn); |
7373 |
+- |
7374 |
+- spin_lock(&ci->i_ceph_lock); |
7375 |
+- if (!__ceph_dir_is_complete(ci)) { |
7376 |
+- spin_unlock(&ci->i_ceph_lock); |
7377 |
+- return; |
7378 |
+- } |
7379 |
+- di->offset = ceph_inode(inode)->i_max_offset++; |
7380 |
+- spin_unlock(&ci->i_ceph_lock); |
7381 |
+- |
7382 |
+- spin_lock(&dir->d_lock); |
7383 |
+- spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); |
7384 |
+- list_move(&dn->d_u.d_child, &dir->d_subdirs); |
7385 |
+- dout("set_dentry_offset %p %lld (%p %p)\n", dn, di->offset, |
7386 |
+- dn->d_u.d_child.prev, dn->d_u.d_child.next); |
7387 |
+- spin_unlock(&dn->d_lock); |
7388 |
+- spin_unlock(&dir->d_lock); |
7389 |
+-} |
7390 |
+- |
7391 |
+-/* |
7392 |
+ * splice a dentry to an inode. |
7393 |
+ * caller must hold directory i_mutex for this to be safe. |
7394 |
+ * |
7395 |
+@@ -933,7 +897,7 @@ static void ceph_set_dentry_offset(struct dentry *dn) |
7396 |
+ * the caller) if we fail. |
7397 |
+ */ |
7398 |
+ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, |
7399 |
+- bool *prehash, bool set_offset) |
7400 |
++ bool *prehash) |
7401 |
+ { |
7402 |
+ struct dentry *realdn; |
7403 |
+ |
7404 |
+@@ -965,8 +929,6 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, |
7405 |
+ } |
7406 |
+ if ((!prehash || *prehash) && d_unhashed(dn)) |
7407 |
+ d_rehash(dn); |
7408 |
+- if (set_offset) |
7409 |
+- ceph_set_dentry_offset(dn); |
7410 |
+ out: |
7411 |
+ return dn; |
7412 |
+ } |
7413 |
+@@ -987,7 +949,6 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, |
7414 |
+ { |
7415 |
+ struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info; |
7416 |
+ struct inode *in = NULL; |
7417 |
+- struct ceph_mds_reply_inode *ininfo; |
7418 |
+ struct ceph_vino vino; |
7419 |
+ struct ceph_fs_client *fsc = ceph_sb_to_client(sb); |
7420 |
+ int err = 0; |
7421 |
+@@ -1112,6 +1073,9 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, |
7422 |
+ |
7423 |
+ /* rename? */ |
7424 |
+ if (req->r_old_dentry && req->r_op == CEPH_MDS_OP_RENAME) { |
7425 |
++ struct inode *olddir = req->r_old_dentry_dir; |
7426 |
++ BUG_ON(!olddir); |
7427 |
++ |
7428 |
+ dout(" src %p '%.*s' dst %p '%.*s'\n", |
7429 |
+ req->r_old_dentry, |
7430 |
+ req->r_old_dentry->d_name.len, |
7431 |
+@@ -1131,13 +1095,10 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, |
7432 |
+ rehashing bug in vfs_rename_dir */ |
7433 |
+ ceph_invalidate_dentry_lease(dn); |
7434 |
+ |
7435 |
+- /* |
7436 |
+- * d_move() puts the renamed dentry at the end of |
7437 |
+- * d_subdirs. We need to assign it an appropriate |
7438 |
+- * directory offset so we can behave when dir is |
7439 |
+- * complete. |
7440 |
+- */ |
7441 |
+- ceph_set_dentry_offset(req->r_old_dentry); |
7442 |
++ /* d_move screws up sibling dentries' offsets */ |
7443 |
++ ceph_dir_clear_complete(dir); |
7444 |
++ ceph_dir_clear_complete(olddir); |
7445 |
++ |
7446 |
+ dout("dn %p gets new offset %lld\n", req->r_old_dentry, |
7447 |
+ ceph_dentry(req->r_old_dentry)->offset); |
7448 |
+ |
7449 |
+@@ -1164,8 +1125,9 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, |
7450 |
+ |
7451 |
+ /* attach proper inode */ |
7452 |
+ if (!dn->d_inode) { |
7453 |
++ ceph_dir_clear_complete(dir); |
7454 |
+ ihold(in); |
7455 |
+- dn = splice_dentry(dn, in, &have_lease, true); |
7456 |
++ dn = splice_dentry(dn, in, &have_lease); |
7457 |
+ if (IS_ERR(dn)) { |
7458 |
+ err = PTR_ERR(dn); |
7459 |
+ goto done; |
7460 |
+@@ -1186,17 +1148,16 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, |
7461 |
+ (req->r_op == CEPH_MDS_OP_LOOKUPSNAP || |
7462 |
+ req->r_op == CEPH_MDS_OP_MKSNAP)) { |
7463 |
+ struct dentry *dn = req->r_dentry; |
7464 |
++ struct inode *dir = req->r_locked_dir; |
7465 |
+ |
7466 |
+ /* fill out a snapdir LOOKUPSNAP dentry */ |
7467 |
+ BUG_ON(!dn); |
7468 |
+- BUG_ON(!req->r_locked_dir); |
7469 |
+- BUG_ON(ceph_snap(req->r_locked_dir) != CEPH_SNAPDIR); |
7470 |
+- ininfo = rinfo->targeti.in; |
7471 |
+- vino.ino = le64_to_cpu(ininfo->ino); |
7472 |
+- vino.snap = le64_to_cpu(ininfo->snapid); |
7473 |
++ BUG_ON(!dir); |
7474 |
++ BUG_ON(ceph_snap(dir) != CEPH_SNAPDIR); |
7475 |
+ dout(" linking snapped dir %p to dn %p\n", in, dn); |
7476 |
++ ceph_dir_clear_complete(dir); |
7477 |
+ ihold(in); |
7478 |
+- dn = splice_dentry(dn, in, NULL, true); |
7479 |
++ dn = splice_dentry(dn, in, NULL); |
7480 |
+ if (IS_ERR(dn)) { |
7481 |
+ err = PTR_ERR(dn); |
7482 |
+ goto done; |
7483 |
+@@ -1358,7 +1319,7 @@ retry_lookup: |
7484 |
+ } |
7485 |
+ |
7486 |
+ if (!dn->d_inode) { |
7487 |
+- dn = splice_dentry(dn, in, NULL, false); |
7488 |
++ dn = splice_dentry(dn, in, NULL); |
7489 |
+ if (IS_ERR(dn)) { |
7490 |
+ err = PTR_ERR(dn); |
7491 |
+ dn = NULL; |
7492 |
+diff --git a/fs/ceph/super.h b/fs/ceph/super.h |
7493 |
+index d8801a95b685..df2caa84b94f 100644 |
7494 |
+--- a/fs/ceph/super.h |
7495 |
++++ b/fs/ceph/super.h |
7496 |
+@@ -266,7 +266,6 @@ struct ceph_inode_info { |
7497 |
+ struct timespec i_rctime; |
7498 |
+ u64 i_rbytes, i_rfiles, i_rsubdirs; |
7499 |
+ u64 i_files, i_subdirs; |
7500 |
+- u64 i_max_offset; /* largest readdir offset, set with complete dir */ |
7501 |
+ |
7502 |
+ struct rb_root i_fragtree; |
7503 |
+ struct mutex i_fragtree_mutex; |
7504 |
+diff --git a/fs/coredump.c b/fs/coredump.c |
7505 |
+index e3ad709a4232..0b2528fb640e 100644 |
7506 |
+--- a/fs/coredump.c |
7507 |
++++ b/fs/coredump.c |
7508 |
+@@ -73,10 +73,15 @@ static int expand_corename(struct core_name *cn, int size) |
7509 |
+ static int cn_vprintf(struct core_name *cn, const char *fmt, va_list arg) |
7510 |
+ { |
7511 |
+ int free, need; |
7512 |
++ va_list arg_copy; |
7513 |
+ |
7514 |
+ again: |
7515 |
+ free = cn->size - cn->used; |
7516 |
+- need = vsnprintf(cn->corename + cn->used, free, fmt, arg); |
7517 |
++ |
7518 |
++ va_copy(arg_copy, arg); |
7519 |
++ need = vsnprintf(cn->corename + cn->used, free, fmt, arg_copy); |
7520 |
++ va_end(arg_copy); |
7521 |
++ |
7522 |
+ if (need < free) { |
7523 |
+ cn->used += need; |
7524 |
+ return 0; |
7525 |
+diff --git a/fs/dcache.c b/fs/dcache.c |
7526 |
+index ca02c13a84aa..7f3b4004c6c3 100644 |
7527 |
+--- a/fs/dcache.c |
7528 |
++++ b/fs/dcache.c |
7529 |
+@@ -1647,8 +1647,7 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode) |
7530 |
+ unsigned add_flags = d_flags_for_inode(inode); |
7531 |
+ |
7532 |
+ spin_lock(&dentry->d_lock); |
7533 |
+- dentry->d_flags &= ~DCACHE_ENTRY_TYPE; |
7534 |
+- dentry->d_flags |= add_flags; |
7535 |
++ __d_set_type(dentry, add_flags); |
7536 |
+ if (inode) |
7537 |
+ hlist_add_head(&dentry->d_alias, &inode->i_dentry); |
7538 |
+ dentry->d_inode = inode; |
7539 |
+diff --git a/fs/exec.c b/fs/exec.c |
7540 |
+index 3d78fccdd723..31e46b1b358b 100644 |
7541 |
+--- a/fs/exec.c |
7542 |
++++ b/fs/exec.c |
7543 |
+@@ -654,10 +654,10 @@ int setup_arg_pages(struct linux_binprm *bprm, |
7544 |
+ unsigned long rlim_stack; |
7545 |
+ |
7546 |
+ #ifdef CONFIG_STACK_GROWSUP |
7547 |
+- /* Limit stack size to 1GB */ |
7548 |
++ /* Limit stack size */ |
7549 |
+ stack_base = rlimit_max(RLIMIT_STACK); |
7550 |
+- if (stack_base > (1 << 30)) |
7551 |
+- stack_base = 1 << 30; |
7552 |
++ if (stack_base > STACK_SIZE_MAX) |
7553 |
++ stack_base = STACK_SIZE_MAX; |
7554 |
+ |
7555 |
+ /* Make sure we didn't let the argument array grow too large. */ |
7556 |
+ if (vma->vm_end - vma->vm_start > stack_base) |
7557 |
+diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c |
7558 |
+index dbf397bfdff2..d29640b49be3 100644 |
7559 |
+--- a/fs/kernfs/file.c |
7560 |
++++ b/fs/kernfs/file.c |
7561 |
+@@ -476,6 +476,8 @@ static int kernfs_fop_mmap(struct file *file, struct vm_area_struct *vma) |
7562 |
+ |
7563 |
+ ops = kernfs_ops(of->kn); |
7564 |
+ rc = ops->mmap(of, vma); |
7565 |
++ if (rc) |
7566 |
++ goto out_put; |
7567 |
+ |
7568 |
+ /* |
7569 |
+ * PowerPC's pci_mmap of legacy_mem uses shmem_zero_setup() |
7570 |
+diff --git a/fs/namei.c b/fs/namei.c |
7571 |
+index 4b491b431990..4a3c105cf703 100644 |
7572 |
+--- a/fs/namei.c |
7573 |
++++ b/fs/namei.c |
7574 |
+@@ -1537,7 +1537,7 @@ static inline int walk_component(struct nameidata *nd, struct path *path, |
7575 |
+ inode = path->dentry->d_inode; |
7576 |
+ } |
7577 |
+ err = -ENOENT; |
7578 |
+- if (!inode) |
7579 |
++ if (!inode || d_is_negative(path->dentry)) |
7580 |
+ goto out_path_put; |
7581 |
+ |
7582 |
+ if (should_follow_link(path->dentry, follow)) { |
7583 |
+@@ -2240,7 +2240,7 @@ mountpoint_last(struct nameidata *nd, struct path *path) |
7584 |
+ mutex_unlock(&dir->d_inode->i_mutex); |
7585 |
+ |
7586 |
+ done: |
7587 |
+- if (!dentry->d_inode) { |
7588 |
++ if (!dentry->d_inode || d_is_negative(dentry)) { |
7589 |
+ error = -ENOENT; |
7590 |
+ dput(dentry); |
7591 |
+ goto out; |
7592 |
+@@ -2982,7 +2982,7 @@ retry_lookup: |
7593 |
+ finish_lookup: |
7594 |
+ /* we _can_ be in RCU mode here */ |
7595 |
+ error = -ENOENT; |
7596 |
+- if (d_is_negative(path->dentry)) { |
7597 |
++ if (!inode || d_is_negative(path->dentry)) { |
7598 |
+ path_to_nameidata(path, nd); |
7599 |
+ goto out; |
7600 |
+ } |
7601 |
+diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c |
7602 |
+index d190e33d0ec2..dea8c60954ba 100644 |
7603 |
+--- a/fs/nfsd/nfs4acl.c |
7604 |
++++ b/fs/nfsd/nfs4acl.c |
7605 |
+@@ -402,8 +402,10 @@ sort_pacl(struct posix_acl *pacl) |
7606 |
+ * by uid/gid. */ |
7607 |
+ int i, j; |
7608 |
+ |
7609 |
+- if (pacl->a_count <= 4) |
7610 |
+- return; /* no users or groups */ |
7611 |
++ /* no users or groups */ |
7612 |
++ if (!pacl || pacl->a_count <= 4) |
7613 |
++ return; |
7614 |
++ |
7615 |
+ i = 1; |
7616 |
+ while (pacl->a_entries[i].e_tag == ACL_USER) |
7617 |
+ i++; |
7618 |
+@@ -530,13 +532,12 @@ posix_state_to_acl(struct posix_acl_state *state, unsigned int flags) |
7619 |
+ |
7620 |
+ /* |
7621 |
+ * ACLs with no ACEs are treated differently in the inheritable |
7622 |
+- * and effective cases: when there are no inheritable ACEs, we |
7623 |
+- * set a zero-length default posix acl: |
7624 |
++ * and effective cases: when there are no inheritable ACEs, |
7625 |
++ * calls ->set_acl with a NULL ACL structure. |
7626 |
+ */ |
7627 |
+- if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT)) { |
7628 |
+- pacl = posix_acl_alloc(0, GFP_KERNEL); |
7629 |
+- return pacl ? pacl : ERR_PTR(-ENOMEM); |
7630 |
+- } |
7631 |
++ if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT)) |
7632 |
++ return NULL; |
7633 |
++ |
7634 |
+ /* |
7635 |
+ * When there are no effective ACEs, the following will end |
7636 |
+ * up setting a 3-element effective posix ACL with all |
7637 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
7638 |
+index 7415eac36501..1693fd93fa58 100644 |
7639 |
+--- a/fs/nfsd/nfs4state.c |
7640 |
++++ b/fs/nfsd/nfs4state.c |
7641 |
+@@ -1078,6 +1078,18 @@ static struct nfs4_client *alloc_client(struct xdr_netobj name) |
7642 |
+ return NULL; |
7643 |
+ } |
7644 |
+ clp->cl_name.len = name.len; |
7645 |
++ INIT_LIST_HEAD(&clp->cl_sessions); |
7646 |
++ idr_init(&clp->cl_stateids); |
7647 |
++ atomic_set(&clp->cl_refcount, 0); |
7648 |
++ clp->cl_cb_state = NFSD4_CB_UNKNOWN; |
7649 |
++ INIT_LIST_HEAD(&clp->cl_idhash); |
7650 |
++ INIT_LIST_HEAD(&clp->cl_openowners); |
7651 |
++ INIT_LIST_HEAD(&clp->cl_delegations); |
7652 |
++ INIT_LIST_HEAD(&clp->cl_lru); |
7653 |
++ INIT_LIST_HEAD(&clp->cl_callbacks); |
7654 |
++ INIT_LIST_HEAD(&clp->cl_revoked); |
7655 |
++ spin_lock_init(&clp->cl_lock); |
7656 |
++ rpc_init_wait_queue(&clp->cl_cb_waitq, "Backchannel slot table"); |
7657 |
+ return clp; |
7658 |
+ } |
7659 |
+ |
7660 |
+@@ -1095,6 +1107,7 @@ free_client(struct nfs4_client *clp) |
7661 |
+ WARN_ON_ONCE(atomic_read(&ses->se_ref)); |
7662 |
+ free_session(ses); |
7663 |
+ } |
7664 |
++ rpc_destroy_wait_queue(&clp->cl_cb_waitq); |
7665 |
+ free_svc_cred(&clp->cl_cred); |
7666 |
+ kfree(clp->cl_name.data); |
7667 |
+ idr_destroy(&clp->cl_stateids); |
7668 |
+@@ -1347,7 +1360,6 @@ static struct nfs4_client *create_client(struct xdr_netobj name, |
7669 |
+ if (clp == NULL) |
7670 |
+ return NULL; |
7671 |
+ |
7672 |
+- INIT_LIST_HEAD(&clp->cl_sessions); |
7673 |
+ ret = copy_cred(&clp->cl_cred, &rqstp->rq_cred); |
7674 |
+ if (ret) { |
7675 |
+ spin_lock(&nn->client_lock); |
7676 |
+@@ -1355,20 +1367,9 @@ static struct nfs4_client *create_client(struct xdr_netobj name, |
7677 |
+ spin_unlock(&nn->client_lock); |
7678 |
+ return NULL; |
7679 |
+ } |
7680 |
+- idr_init(&clp->cl_stateids); |
7681 |
+- atomic_set(&clp->cl_refcount, 0); |
7682 |
+- clp->cl_cb_state = NFSD4_CB_UNKNOWN; |
7683 |
+- INIT_LIST_HEAD(&clp->cl_idhash); |
7684 |
+- INIT_LIST_HEAD(&clp->cl_openowners); |
7685 |
+- INIT_LIST_HEAD(&clp->cl_delegations); |
7686 |
+- INIT_LIST_HEAD(&clp->cl_lru); |
7687 |
+- INIT_LIST_HEAD(&clp->cl_callbacks); |
7688 |
+- INIT_LIST_HEAD(&clp->cl_revoked); |
7689 |
+- spin_lock_init(&clp->cl_lock); |
7690 |
+ nfsd4_init_callback(&clp->cl_cb_null); |
7691 |
+ clp->cl_time = get_seconds(); |
7692 |
+ clear_bit(0, &clp->cl_cb_slot_busy); |
7693 |
+- rpc_init_wait_queue(&clp->cl_cb_waitq, "Backchannel slot table"); |
7694 |
+ copy_verf(clp, verf); |
7695 |
+ rpc_copy_addr((struct sockaddr *) &clp->cl_addr, sa); |
7696 |
+ gen_confirm(clp); |
7697 |
+@@ -3713,9 +3714,16 @@ out: |
7698 |
+ static __be32 |
7699 |
+ nfsd4_free_lock_stateid(struct nfs4_ol_stateid *stp) |
7700 |
+ { |
7701 |
+- if (check_for_locks(stp->st_file, lockowner(stp->st_stateowner))) |
7702 |
++ struct nfs4_lockowner *lo = lockowner(stp->st_stateowner); |
7703 |
++ |
7704 |
++ if (check_for_locks(stp->st_file, lo)) |
7705 |
+ return nfserr_locks_held; |
7706 |
+- release_lock_stateid(stp); |
7707 |
++ /* |
7708 |
++ * Currently there's a 1-1 lock stateid<->lockowner |
7709 |
++ * correspondance, and we have to delete the lockowner when we |
7710 |
++ * delete the lock stateid: |
7711 |
++ */ |
7712 |
++ unhash_lockowner(lo); |
7713 |
+ return nfs_ok; |
7714 |
+ } |
7715 |
+ |
7716 |
+@@ -4155,6 +4163,10 @@ static bool same_lockowner_ino(struct nfs4_lockowner *lo, struct inode *inode, c |
7717 |
+ |
7718 |
+ if (!same_owner_str(&lo->lo_owner, owner, clid)) |
7719 |
+ return false; |
7720 |
++ if (list_empty(&lo->lo_owner.so_stateids)) { |
7721 |
++ WARN_ON_ONCE(1); |
7722 |
++ return false; |
7723 |
++ } |
7724 |
+ lst = list_first_entry(&lo->lo_owner.so_stateids, |
7725 |
+ struct nfs4_ol_stateid, st_perstateowner); |
7726 |
+ return lst->st_file->fi_inode == inode; |
7727 |
+diff --git a/fs/posix_acl.c b/fs/posix_acl.c |
7728 |
+index 9e363e41dacc..0855f772cd41 100644 |
7729 |
+--- a/fs/posix_acl.c |
7730 |
++++ b/fs/posix_acl.c |
7731 |
+@@ -246,6 +246,12 @@ posix_acl_equiv_mode(const struct posix_acl *acl, umode_t *mode_p) |
7732 |
+ umode_t mode = 0; |
7733 |
+ int not_equiv = 0; |
7734 |
+ |
7735 |
++ /* |
7736 |
++ * A null ACL can always be presented as mode bits. |
7737 |
++ */ |
7738 |
++ if (!acl) |
7739 |
++ return 0; |
7740 |
++ |
7741 |
+ FOREACH_ACL_ENTRY(pa, acl, pe) { |
7742 |
+ switch (pa->e_tag) { |
7743 |
+ case ACL_USER_OBJ: |
7744 |
+diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c |
7745 |
+index 810cf6e613e5..5fd2bf18e27d 100644 |
7746 |
+--- a/fs/sysfs/file.c |
7747 |
++++ b/fs/sysfs/file.c |
7748 |
+@@ -47,12 +47,13 @@ static int sysfs_kf_seq_show(struct seq_file *sf, void *v) |
7749 |
+ ssize_t count; |
7750 |
+ char *buf; |
7751 |
+ |
7752 |
+- /* acquire buffer and ensure that it's >= PAGE_SIZE */ |
7753 |
++ /* acquire buffer and ensure that it's >= PAGE_SIZE and clear */ |
7754 |
+ count = seq_get_buf(sf, &buf); |
7755 |
+ if (count < PAGE_SIZE) { |
7756 |
+ seq_commit(sf, -1); |
7757 |
+ return 0; |
7758 |
+ } |
7759 |
++ memset(buf, 0, PAGE_SIZE); |
7760 |
+ |
7761 |
+ /* |
7762 |
+ * Invoke show(). Control may reach here via seq file lseek even |
7763 |
+diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h |
7764 |
+index c5c92d59e531..0a5f55272672 100644 |
7765 |
+--- a/include/linux/dmaengine.h |
7766 |
++++ b/include/linux/dmaengine.h |
7767 |
+@@ -433,6 +433,7 @@ typedef bool (*dma_filter_fn)(struct dma_chan *chan, void *filter_param); |
7768 |
+ typedef void (*dma_async_tx_callback)(void *dma_async_param); |
7769 |
+ |
7770 |
+ struct dmaengine_unmap_data { |
7771 |
++ u8 map_cnt; |
7772 |
+ u8 to_cnt; |
7773 |
+ u8 from_cnt; |
7774 |
+ u8 bidi_cnt; |
7775 |
+diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h |
7776 |
+index f4233b195dab..2068dff8a2cc 100644 |
7777 |
+--- a/include/linux/ftrace.h |
7778 |
++++ b/include/linux/ftrace.h |
7779 |
+@@ -524,6 +524,7 @@ static inline int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_a |
7780 |
+ extern int ftrace_arch_read_dyn_info(char *buf, int size); |
7781 |
+ |
7782 |
+ extern int skip_trace(unsigned long ip); |
7783 |
++extern void ftrace_module_init(struct module *mod); |
7784 |
+ |
7785 |
+ extern void ftrace_disable_daemon(void); |
7786 |
+ extern void ftrace_enable_daemon(void); |
7787 |
+@@ -533,6 +534,7 @@ static inline int ftrace_force_update(void) { return 0; } |
7788 |
+ static inline void ftrace_disable_daemon(void) { } |
7789 |
+ static inline void ftrace_enable_daemon(void) { } |
7790 |
+ static inline void ftrace_release_mod(struct module *mod) {} |
7791 |
++static inline void ftrace_module_init(struct module *mod) {} |
7792 |
+ static inline __init int register_ftrace_command(struct ftrace_func_command *cmd) |
7793 |
+ { |
7794 |
+ return -EINVAL; |
7795 |
+diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h |
7796 |
+index a2678d35b5a2..203c43d3e1b8 100644 |
7797 |
+--- a/include/linux/interrupt.h |
7798 |
++++ b/include/linux/interrupt.h |
7799 |
+@@ -202,7 +202,40 @@ static inline int check_wakeup_irqs(void) { return 0; } |
7800 |
+ |
7801 |
+ extern cpumask_var_t irq_default_affinity; |
7802 |
+ |
7803 |
+-extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask); |
7804 |
++/* Internal implementation. Use the helpers below */ |
7805 |
++extern int __irq_set_affinity(unsigned int irq, const struct cpumask *cpumask, |
7806 |
++ bool force); |
7807 |
++ |
7808 |
++/** |
7809 |
++ * irq_set_affinity - Set the irq affinity of a given irq |
7810 |
++ * @irq: Interrupt to set affinity |
7811 |
++ * @mask: cpumask |
7812 |
++ * |
7813 |
++ * Fails if cpumask does not contain an online CPU |
7814 |
++ */ |
7815 |
++static inline int |
7816 |
++irq_set_affinity(unsigned int irq, const struct cpumask *cpumask) |
7817 |
++{ |
7818 |
++ return __irq_set_affinity(irq, cpumask, false); |
7819 |
++} |
7820 |
++ |
7821 |
++/** |
7822 |
++ * irq_force_affinity - Force the irq affinity of a given irq |
7823 |
++ * @irq: Interrupt to set affinity |
7824 |
++ * @mask: cpumask |
7825 |
++ * |
7826 |
++ * Same as irq_set_affinity, but without checking the mask against |
7827 |
++ * online cpus. |
7828 |
++ * |
7829 |
++ * Solely for low level cpu hotplug code, where we need to make per |
7830 |
++ * cpu interrupts affine before the cpu becomes online. |
7831 |
++ */ |
7832 |
++static inline int |
7833 |
++irq_force_affinity(unsigned int irq, const struct cpumask *cpumask) |
7834 |
++{ |
7835 |
++ return __irq_set_affinity(irq, cpumask, true); |
7836 |
++} |
7837 |
++ |
7838 |
+ extern int irq_can_set_affinity(unsigned int irq); |
7839 |
+ extern int irq_select_affinity(unsigned int irq); |
7840 |
+ |
7841 |
+@@ -238,6 +271,11 @@ static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) |
7842 |
+ return -EINVAL; |
7843 |
+ } |
7844 |
+ |
7845 |
++static inline int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask) |
7846 |
++{ |
7847 |
++ return 0; |
7848 |
++} |
7849 |
++ |
7850 |
+ static inline int irq_can_set_affinity(unsigned int irq) |
7851 |
+ { |
7852 |
+ return 0; |
7853 |
+diff --git a/include/linux/irq.h b/include/linux/irq.h |
7854 |
+index 7dc10036eff5..ef1ac9feff56 100644 |
7855 |
+--- a/include/linux/irq.h |
7856 |
++++ b/include/linux/irq.h |
7857 |
+@@ -385,7 +385,8 @@ extern void remove_percpu_irq(unsigned int irq, struct irqaction *act); |
7858 |
+ |
7859 |
+ extern void irq_cpu_online(void); |
7860 |
+ extern void irq_cpu_offline(void); |
7861 |
+-extern int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *cpumask); |
7862 |
++extern int irq_set_affinity_locked(struct irq_data *data, |
7863 |
++ const struct cpumask *cpumask, bool force); |
7864 |
+ |
7865 |
+ #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ) |
7866 |
+ void irq_move_irq(struct irq_data *data); |
7867 |
+diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h |
7868 |
+index 3f23b4472c31..6404253d810d 100644 |
7869 |
+--- a/include/linux/of_irq.h |
7870 |
++++ b/include/linux/of_irq.h |
7871 |
+@@ -44,11 +44,16 @@ extern void of_irq_init(const struct of_device_id *matches); |
7872 |
+ |
7873 |
+ #ifdef CONFIG_OF_IRQ |
7874 |
+ extern int of_irq_count(struct device_node *dev); |
7875 |
++extern int of_irq_get(struct device_node *dev, int index); |
7876 |
+ #else |
7877 |
+ static inline int of_irq_count(struct device_node *dev) |
7878 |
+ { |
7879 |
+ return 0; |
7880 |
+ } |
7881 |
++static inline int of_irq_get(struct device_node *dev, int index) |
7882 |
++{ |
7883 |
++ return 0; |
7884 |
++} |
7885 |
+ #endif |
7886 |
+ |
7887 |
+ #if defined(CONFIG_OF) |
7888 |
+diff --git a/include/linux/serio.h b/include/linux/serio.h |
7889 |
+index 36aac733840a..9f779c7a2da4 100644 |
7890 |
+--- a/include/linux/serio.h |
7891 |
++++ b/include/linux/serio.h |
7892 |
+@@ -23,6 +23,7 @@ struct serio { |
7893 |
+ |
7894 |
+ char name[32]; |
7895 |
+ char phys[32]; |
7896 |
++ char firmware_id[128]; |
7897 |
+ |
7898 |
+ bool manual_bind; |
7899 |
+ |
7900 |
+diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h |
7901 |
+index b1f84b05c67e..37123eb1f093 100644 |
7902 |
+--- a/include/net/cfg80211.h |
7903 |
++++ b/include/net/cfg80211.h |
7904 |
+@@ -3637,6 +3637,18 @@ void cfg80211_sched_scan_results(struct wiphy *wiphy); |
7905 |
+ void cfg80211_sched_scan_stopped(struct wiphy *wiphy); |
7906 |
+ |
7907 |
+ /** |
7908 |
++ * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped |
7909 |
++ * |
7910 |
++ * @wiphy: the wiphy on which the scheduled scan stopped |
7911 |
++ * |
7912 |
++ * The driver can call this function to inform cfg80211 that the |
7913 |
++ * scheduled scan had to be stopped, for whatever reason. The driver |
7914 |
++ * is then called back via the sched_scan_stop operation when done. |
7915 |
++ * This function should be called with rtnl locked. |
7916 |
++ */ |
7917 |
++void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy); |
7918 |
++ |
7919 |
++/** |
7920 |
+ * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame |
7921 |
+ * |
7922 |
+ * @wiphy: the wiphy reporting the BSS |
7923 |
+diff --git a/include/trace/events/module.h b/include/trace/events/module.h |
7924 |
+index 161932737416..ca298c7157ae 100644 |
7925 |
+--- a/include/trace/events/module.h |
7926 |
++++ b/include/trace/events/module.h |
7927 |
+@@ -78,7 +78,7 @@ DECLARE_EVENT_CLASS(module_refcnt, |
7928 |
+ |
7929 |
+ TP_fast_assign( |
7930 |
+ __entry->ip = ip; |
7931 |
+- __entry->refcnt = __this_cpu_read(mod->refptr->incs) + __this_cpu_read(mod->refptr->decs); |
7932 |
++ __entry->refcnt = __this_cpu_read(mod->refptr->incs) - __this_cpu_read(mod->refptr->decs); |
7933 |
+ __assign_str(name, mod->name); |
7934 |
+ ), |
7935 |
+ |
7936 |
+diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h |
7937 |
+index 5e1ab552cbed..c28de1afd684 100644 |
7938 |
+--- a/include/uapi/drm/tegra_drm.h |
7939 |
++++ b/include/uapi/drm/tegra_drm.h |
7940 |
+@@ -114,7 +114,6 @@ struct drm_tegra_submit { |
7941 |
+ __u32 num_waitchks; |
7942 |
+ __u32 waitchk_mask; |
7943 |
+ __u32 timeout; |
7944 |
+- __u32 pad; |
7945 |
+ __u64 syncpts; |
7946 |
+ __u64 cmdbufs; |
7947 |
+ __u64 relocs; |
7948 |
+diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h |
7949 |
+index bd24470d24a2..f4849525519c 100644 |
7950 |
+--- a/include/uapi/linux/input.h |
7951 |
++++ b/include/uapi/linux/input.h |
7952 |
+@@ -164,6 +164,7 @@ struct input_keymap_entry { |
7953 |
+ #define INPUT_PROP_DIRECT 0x01 /* direct input devices */ |
7954 |
+ #define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */ |
7955 |
+ #define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ |
7956 |
++#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ |
7957 |
+ |
7958 |
+ #define INPUT_PROP_MAX 0x1f |
7959 |
+ #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) |
7960 |
+diff --git a/kernel/futex.c b/kernel/futex.c |
7961 |
+index 6801b3751a95..e3087afb7429 100644 |
7962 |
+--- a/kernel/futex.c |
7963 |
++++ b/kernel/futex.c |
7964 |
+@@ -729,6 +729,55 @@ void exit_pi_state_list(struct task_struct *curr) |
7965 |
+ raw_spin_unlock_irq(&curr->pi_lock); |
7966 |
+ } |
7967 |
+ |
7968 |
++/* |
7969 |
++ * We need to check the following states: |
7970 |
++ * |
7971 |
++ * Waiter | pi_state | pi->owner | uTID | uODIED | ? |
7972 |
++ * |
7973 |
++ * [1] NULL | --- | --- | 0 | 0/1 | Valid |
7974 |
++ * [2] NULL | --- | --- | >0 | 0/1 | Valid |
7975 |
++ * |
7976 |
++ * [3] Found | NULL | -- | Any | 0/1 | Invalid |
7977 |
++ * |
7978 |
++ * [4] Found | Found | NULL | 0 | 1 | Valid |
7979 |
++ * [5] Found | Found | NULL | >0 | 1 | Invalid |
7980 |
++ * |
7981 |
++ * [6] Found | Found | task | 0 | 1 | Valid |
7982 |
++ * |
7983 |
++ * [7] Found | Found | NULL | Any | 0 | Invalid |
7984 |
++ * |
7985 |
++ * [8] Found | Found | task | ==taskTID | 0/1 | Valid |
7986 |
++ * [9] Found | Found | task | 0 | 0 | Invalid |
7987 |
++ * [10] Found | Found | task | !=taskTID | 0/1 | Invalid |
7988 |
++ * |
7989 |
++ * [1] Indicates that the kernel can acquire the futex atomically. We |
7990 |
++ * came came here due to a stale FUTEX_WAITERS/FUTEX_OWNER_DIED bit. |
7991 |
++ * |
7992 |
++ * [2] Valid, if TID does not belong to a kernel thread. If no matching |
7993 |
++ * thread is found then it indicates that the owner TID has died. |
7994 |
++ * |
7995 |
++ * [3] Invalid. The waiter is queued on a non PI futex |
7996 |
++ * |
7997 |
++ * [4] Valid state after exit_robust_list(), which sets the user space |
7998 |
++ * value to FUTEX_WAITERS | FUTEX_OWNER_DIED. |
7999 |
++ * |
8000 |
++ * [5] The user space value got manipulated between exit_robust_list() |
8001 |
++ * and exit_pi_state_list() |
8002 |
++ * |
8003 |
++ * [6] Valid state after exit_pi_state_list() which sets the new owner in |
8004 |
++ * the pi_state but cannot access the user space value. |
8005 |
++ * |
8006 |
++ * [7] pi_state->owner can only be NULL when the OWNER_DIED bit is set. |
8007 |
++ * |
8008 |
++ * [8] Owner and user space value match |
8009 |
++ * |
8010 |
++ * [9] There is no transient state which sets the user space TID to 0 |
8011 |
++ * except exit_robust_list(), but this is indicated by the |
8012 |
++ * FUTEX_OWNER_DIED bit. See [4] |
8013 |
++ * |
8014 |
++ * [10] There is no transient state which leaves owner and user space |
8015 |
++ * TID out of sync. |
8016 |
++ */ |
8017 |
+ static int |
8018 |
+ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb, |
8019 |
+ union futex_key *key, struct futex_pi_state **ps) |
8020 |
+@@ -741,12 +790,13 @@ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb, |
8021 |
+ plist_for_each_entry_safe(this, next, &hb->chain, list) { |
8022 |
+ if (match_futex(&this->key, key)) { |
8023 |
+ /* |
8024 |
+- * Another waiter already exists - bump up |
8025 |
+- * the refcount and return its pi_state: |
8026 |
++ * Sanity check the waiter before increasing |
8027 |
++ * the refcount and attaching to it. |
8028 |
+ */ |
8029 |
+ pi_state = this->pi_state; |
8030 |
+ /* |
8031 |
+- * Userspace might have messed up non-PI and PI futexes |
8032 |
++ * Userspace might have messed up non-PI and |
8033 |
++ * PI futexes [3] |
8034 |
+ */ |
8035 |
+ if (unlikely(!pi_state)) |
8036 |
+ return -EINVAL; |
8037 |
+@@ -754,34 +804,70 @@ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb, |
8038 |
+ WARN_ON(!atomic_read(&pi_state->refcount)); |
8039 |
+ |
8040 |
+ /* |
8041 |
+- * When pi_state->owner is NULL then the owner died |
8042 |
+- * and another waiter is on the fly. pi_state->owner |
8043 |
+- * is fixed up by the task which acquires |
8044 |
+- * pi_state->rt_mutex. |
8045 |
+- * |
8046 |
+- * We do not check for pid == 0 which can happen when |
8047 |
+- * the owner died and robust_list_exit() cleared the |
8048 |
+- * TID. |
8049 |
++ * Handle the owner died case: |
8050 |
+ */ |
8051 |
+- if (pid && pi_state->owner) { |
8052 |
++ if (uval & FUTEX_OWNER_DIED) { |
8053 |
++ /* |
8054 |
++ * exit_pi_state_list sets owner to NULL and |
8055 |
++ * wakes the topmost waiter. The task which |
8056 |
++ * acquires the pi_state->rt_mutex will fixup |
8057 |
++ * owner. |
8058 |
++ */ |
8059 |
++ if (!pi_state->owner) { |
8060 |
++ /* |
8061 |
++ * No pi state owner, but the user |
8062 |
++ * space TID is not 0. Inconsistent |
8063 |
++ * state. [5] |
8064 |
++ */ |
8065 |
++ if (pid) |
8066 |
++ return -EINVAL; |
8067 |
++ /* |
8068 |
++ * Take a ref on the state and |
8069 |
++ * return. [4] |
8070 |
++ */ |
8071 |
++ goto out_state; |
8072 |
++ } |
8073 |
++ |
8074 |
+ /* |
8075 |
+- * Bail out if user space manipulated the |
8076 |
+- * futex value. |
8077 |
++ * If TID is 0, then either the dying owner |
8078 |
++ * has not yet executed exit_pi_state_list() |
8079 |
++ * or some waiter acquired the rtmutex in the |
8080 |
++ * pi state, but did not yet fixup the TID in |
8081 |
++ * user space. |
8082 |
++ * |
8083 |
++ * Take a ref on the state and return. [6] |
8084 |
+ */ |
8085 |
+- if (pid != task_pid_vnr(pi_state->owner)) |
8086 |
++ if (!pid) |
8087 |
++ goto out_state; |
8088 |
++ } else { |
8089 |
++ /* |
8090 |
++ * If the owner died bit is not set, |
8091 |
++ * then the pi_state must have an |
8092 |
++ * owner. [7] |
8093 |
++ */ |
8094 |
++ if (!pi_state->owner) |
8095 |
+ return -EINVAL; |
8096 |
+ } |
8097 |
+ |
8098 |
++ /* |
8099 |
++ * Bail out if user space manipulated the |
8100 |
++ * futex value. If pi state exists then the |
8101 |
++ * owner TID must be the same as the user |
8102 |
++ * space TID. [9/10] |
8103 |
++ */ |
8104 |
++ if (pid != task_pid_vnr(pi_state->owner)) |
8105 |
++ return -EINVAL; |
8106 |
++ |
8107 |
++ out_state: |
8108 |
+ atomic_inc(&pi_state->refcount); |
8109 |
+ *ps = pi_state; |
8110 |
+- |
8111 |
+ return 0; |
8112 |
+ } |
8113 |
+ } |
8114 |
+ |
8115 |
+ /* |
8116 |
+ * We are the first waiter - try to look up the real owner and attach |
8117 |
+- * the new pi_state to it, but bail out when TID = 0 |
8118 |
++ * the new pi_state to it, but bail out when TID = 0 [1] |
8119 |
+ */ |
8120 |
+ if (!pid) |
8121 |
+ return -ESRCH; |
8122 |
+@@ -789,6 +875,11 @@ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb, |
8123 |
+ if (!p) |
8124 |
+ return -ESRCH; |
8125 |
+ |
8126 |
++ if (!p->mm) { |
8127 |
++ put_task_struct(p); |
8128 |
++ return -EPERM; |
8129 |
++ } |
8130 |
++ |
8131 |
+ /* |
8132 |
+ * We need to look at the task state flags to figure out, |
8133 |
+ * whether the task is exiting. To protect against the do_exit |
8134 |
+@@ -809,6 +900,9 @@ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb, |
8135 |
+ return ret; |
8136 |
+ } |
8137 |
+ |
8138 |
++ /* |
8139 |
++ * No existing pi state. First waiter. [2] |
8140 |
++ */ |
8141 |
+ pi_state = alloc_pi_state(); |
8142 |
+ |
8143 |
+ /* |
8144 |
+@@ -880,10 +974,18 @@ retry: |
8145 |
+ return -EDEADLK; |
8146 |
+ |
8147 |
+ /* |
8148 |
+- * Surprise - we got the lock. Just return to userspace: |
8149 |
++ * Surprise - we got the lock, but we do not trust user space at all. |
8150 |
+ */ |
8151 |
+- if (unlikely(!curval)) |
8152 |
+- return 1; |
8153 |
++ if (unlikely(!curval)) { |
8154 |
++ /* |
8155 |
++ * We verify whether there is kernel state for this |
8156 |
++ * futex. If not, we can safely assume, that the 0 -> |
8157 |
++ * TID transition is correct. If state exists, we do |
8158 |
++ * not bother to fixup the user space state as it was |
8159 |
++ * corrupted already. |
8160 |
++ */ |
8161 |
++ return futex_top_waiter(hb, key) ? -EINVAL : 1; |
8162 |
++ } |
8163 |
+ |
8164 |
+ uval = curval; |
8165 |
+ |
8166 |
+@@ -1014,6 +1116,7 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this) |
8167 |
+ struct task_struct *new_owner; |
8168 |
+ struct futex_pi_state *pi_state = this->pi_state; |
8169 |
+ u32 uninitialized_var(curval), newval; |
8170 |
++ int ret = 0; |
8171 |
+ |
8172 |
+ if (!pi_state) |
8173 |
+ return -EINVAL; |
8174 |
+@@ -1037,23 +1140,19 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this) |
8175 |
+ new_owner = this->task; |
8176 |
+ |
8177 |
+ /* |
8178 |
+- * We pass it to the next owner. (The WAITERS bit is always |
8179 |
+- * kept enabled while there is PI state around. We must also |
8180 |
+- * preserve the owner died bit.) |
8181 |
++ * We pass it to the next owner. The WAITERS bit is always |
8182 |
++ * kept enabled while there is PI state around. We cleanup the |
8183 |
++ * owner died bit, because we are the owner. |
8184 |
+ */ |
8185 |
+- if (!(uval & FUTEX_OWNER_DIED)) { |
8186 |
+- int ret = 0; |
8187 |
++ newval = FUTEX_WAITERS | task_pid_vnr(new_owner); |
8188 |
+ |
8189 |
+- newval = FUTEX_WAITERS | task_pid_vnr(new_owner); |
8190 |
+- |
8191 |
+- if (cmpxchg_futex_value_locked(&curval, uaddr, uval, newval)) |
8192 |
+- ret = -EFAULT; |
8193 |
+- else if (curval != uval) |
8194 |
+- ret = -EINVAL; |
8195 |
+- if (ret) { |
8196 |
+- raw_spin_unlock(&pi_state->pi_mutex.wait_lock); |
8197 |
+- return ret; |
8198 |
+- } |
8199 |
++ if (cmpxchg_futex_value_locked(&curval, uaddr, uval, newval)) |
8200 |
++ ret = -EFAULT; |
8201 |
++ else if (curval != uval) |
8202 |
++ ret = -EINVAL; |
8203 |
++ if (ret) { |
8204 |
++ raw_spin_unlock(&pi_state->pi_mutex.wait_lock); |
8205 |
++ return ret; |
8206 |
+ } |
8207 |
+ |
8208 |
+ raw_spin_lock_irq(&pi_state->owner->pi_lock); |
8209 |
+@@ -1333,7 +1432,7 @@ void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key, |
8210 |
+ * |
8211 |
+ * Return: |
8212 |
+ * 0 - failed to acquire the lock atomically; |
8213 |
+- * 1 - acquired the lock; |
8214 |
++ * >0 - acquired the lock, return value is vpid of the top_waiter |
8215 |
+ * <0 - error |
8216 |
+ */ |
8217 |
+ static int futex_proxy_trylock_atomic(u32 __user *pifutex, |
8218 |
+@@ -1344,7 +1443,7 @@ static int futex_proxy_trylock_atomic(u32 __user *pifutex, |
8219 |
+ { |
8220 |
+ struct futex_q *top_waiter = NULL; |
8221 |
+ u32 curval; |
8222 |
+- int ret; |
8223 |
++ int ret, vpid; |
8224 |
+ |
8225 |
+ if (get_futex_value_locked(&curval, pifutex)) |
8226 |
+ return -EFAULT; |
8227 |
+@@ -1372,11 +1471,13 @@ static int futex_proxy_trylock_atomic(u32 __user *pifutex, |
8228 |
+ * the contended case or if set_waiters is 1. The pi_state is returned |
8229 |
+ * in ps in contended cases. |
8230 |
+ */ |
8231 |
++ vpid = task_pid_vnr(top_waiter->task); |
8232 |
+ ret = futex_lock_pi_atomic(pifutex, hb2, key2, ps, top_waiter->task, |
8233 |
+ set_waiters); |
8234 |
+- if (ret == 1) |
8235 |
++ if (ret == 1) { |
8236 |
+ requeue_pi_wake_futex(top_waiter, key2, hb2); |
8237 |
+- |
8238 |
++ return vpid; |
8239 |
++ } |
8240 |
+ return ret; |
8241 |
+ } |
8242 |
+ |
8243 |
+@@ -1407,10 +1508,16 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, |
8244 |
+ struct futex_pi_state *pi_state = NULL; |
8245 |
+ struct futex_hash_bucket *hb1, *hb2; |
8246 |
+ struct futex_q *this, *next; |
8247 |
+- u32 curval2; |
8248 |
+ |
8249 |
+ if (requeue_pi) { |
8250 |
+ /* |
8251 |
++ * Requeue PI only works on two distinct uaddrs. This |
8252 |
++ * check is only valid for private futexes. See below. |
8253 |
++ */ |
8254 |
++ if (uaddr1 == uaddr2) |
8255 |
++ return -EINVAL; |
8256 |
++ |
8257 |
++ /* |
8258 |
+ * requeue_pi requires a pi_state, try to allocate it now |
8259 |
+ * without any locks in case it fails. |
8260 |
+ */ |
8261 |
+@@ -1448,6 +1555,15 @@ retry: |
8262 |
+ if (unlikely(ret != 0)) |
8263 |
+ goto out_put_key1; |
8264 |
+ |
8265 |
++ /* |
8266 |
++ * The check above which compares uaddrs is not sufficient for |
8267 |
++ * shared futexes. We need to compare the keys: |
8268 |
++ */ |
8269 |
++ if (requeue_pi && match_futex(&key1, &key2)) { |
8270 |
++ ret = -EINVAL; |
8271 |
++ goto out_put_keys; |
8272 |
++ } |
8273 |
++ |
8274 |
+ hb1 = hash_futex(&key1); |
8275 |
+ hb2 = hash_futex(&key2); |
8276 |
+ |
8277 |
+@@ -1495,16 +1611,25 @@ retry_private: |
8278 |
+ * At this point the top_waiter has either taken uaddr2 or is |
8279 |
+ * waiting on it. If the former, then the pi_state will not |
8280 |
+ * exist yet, look it up one more time to ensure we have a |
8281 |
+- * reference to it. |
8282 |
++ * reference to it. If the lock was taken, ret contains the |
8283 |
++ * vpid of the top waiter task. |
8284 |
+ */ |
8285 |
+- if (ret == 1) { |
8286 |
++ if (ret > 0) { |
8287 |
+ WARN_ON(pi_state); |
8288 |
+ drop_count++; |
8289 |
+ task_count++; |
8290 |
+- ret = get_futex_value_locked(&curval2, uaddr2); |
8291 |
+- if (!ret) |
8292 |
+- ret = lookup_pi_state(curval2, hb2, &key2, |
8293 |
+- &pi_state); |
8294 |
++ /* |
8295 |
++ * If we acquired the lock, then the user |
8296 |
++ * space value of uaddr2 should be vpid. It |
8297 |
++ * cannot be changed by the top waiter as it |
8298 |
++ * is blocked on hb2 lock if it tries to do |
8299 |
++ * so. If something fiddled with it behind our |
8300 |
++ * back the pi state lookup might unearth |
8301 |
++ * it. So we rather use the known value than |
8302 |
++ * rereading and handing potential crap to |
8303 |
++ * lookup_pi_state. |
8304 |
++ */ |
8305 |
++ ret = lookup_pi_state(ret, hb2, &key2, &pi_state); |
8306 |
+ } |
8307 |
+ |
8308 |
+ switch (ret) { |
8309 |
+@@ -2287,9 +2412,10 @@ retry: |
8310 |
+ /* |
8311 |
+ * To avoid races, try to do the TID -> 0 atomic transition |
8312 |
+ * again. If it succeeds then we can return without waking |
8313 |
+- * anyone else up: |
8314 |
++ * anyone else up. We only try this if neither the waiters nor |
8315 |
++ * the owner died bit are set. |
8316 |
+ */ |
8317 |
+- if (!(uval & FUTEX_OWNER_DIED) && |
8318 |
++ if (!(uval & ~FUTEX_TID_MASK) && |
8319 |
+ cmpxchg_futex_value_locked(&uval, uaddr, vpid, 0)) |
8320 |
+ goto pi_faulted; |
8321 |
+ /* |
8322 |
+@@ -2319,11 +2445,9 @@ retry: |
8323 |
+ /* |
8324 |
+ * No waiters - kernel unlocks the futex: |
8325 |
+ */ |
8326 |
+- if (!(uval & FUTEX_OWNER_DIED)) { |
8327 |
+- ret = unlock_futex_pi(uaddr, uval); |
8328 |
+- if (ret == -EFAULT) |
8329 |
+- goto pi_faulted; |
8330 |
+- } |
8331 |
++ ret = unlock_futex_pi(uaddr, uval); |
8332 |
++ if (ret == -EFAULT) |
8333 |
++ goto pi_faulted; |
8334 |
+ |
8335 |
+ out_unlock: |
8336 |
+ spin_unlock(&hb->lock); |
8337 |
+@@ -2485,6 +2609,15 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, |
8338 |
+ if (ret) |
8339 |
+ goto out_key2; |
8340 |
+ |
8341 |
++ /* |
8342 |
++ * The check above which compares uaddrs is not sufficient for |
8343 |
++ * shared futexes. We need to compare the keys: |
8344 |
++ */ |
8345 |
++ if (match_futex(&q.key, &key2)) { |
8346 |
++ ret = -EINVAL; |
8347 |
++ goto out_put_keys; |
8348 |
++ } |
8349 |
++ |
8350 |
+ /* Queue the futex_q, drop the hb lock, wait for wakeup. */ |
8351 |
+ futex_wait_queue_me(hb, &q, to); |
8352 |
+ |
8353 |
+diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c |
8354 |
+index 09094361dce5..04d03745fb98 100644 |
8355 |
+--- a/kernel/hrtimer.c |
8356 |
++++ b/kernel/hrtimer.c |
8357 |
+@@ -247,6 +247,11 @@ again: |
8358 |
+ goto again; |
8359 |
+ } |
8360 |
+ timer->base = new_base; |
8361 |
++ } else { |
8362 |
++ if (cpu != this_cpu && hrtimer_check_target(timer, new_base)) { |
8363 |
++ cpu = this_cpu; |
8364 |
++ goto again; |
8365 |
++ } |
8366 |
+ } |
8367 |
+ return new_base; |
8368 |
+ } |
8369 |
+@@ -582,6 +587,23 @@ hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base, int skip_equal) |
8370 |
+ |
8371 |
+ cpu_base->expires_next.tv64 = expires_next.tv64; |
8372 |
+ |
8373 |
++ /* |
8374 |
++ * If a hang was detected in the last timer interrupt then we |
8375 |
++ * leave the hang delay active in the hardware. We want the |
8376 |
++ * system to make progress. That also prevents the following |
8377 |
++ * scenario: |
8378 |
++ * T1 expires 50ms from now |
8379 |
++ * T2 expires 5s from now |
8380 |
++ * |
8381 |
++ * T1 is removed, so this code is called and would reprogram |
8382 |
++ * the hardware to 5s from now. Any hrtimer_start after that |
8383 |
++ * will not reprogram the hardware due to hang_detected being |
8384 |
++ * set. So we'd effectivly block all timers until the T2 event |
8385 |
++ * fires. |
8386 |
++ */ |
8387 |
++ if (cpu_base->hang_detected) |
8388 |
++ return; |
8389 |
++ |
8390 |
+ if (cpu_base->expires_next.tv64 != KTIME_MAX) |
8391 |
+ tick_program_event(cpu_base->expires_next, 1); |
8392 |
+ } |
8393 |
+@@ -981,11 +1003,8 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, |
8394 |
+ /* Remove an active timer from the queue: */ |
8395 |
+ ret = remove_hrtimer(timer, base); |
8396 |
+ |
8397 |
+- /* Switch the timer base, if necessary: */ |
8398 |
+- new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED); |
8399 |
+- |
8400 |
+ if (mode & HRTIMER_MODE_REL) { |
8401 |
+- tim = ktime_add_safe(tim, new_base->get_time()); |
8402 |
++ tim = ktime_add_safe(tim, base->get_time()); |
8403 |
+ /* |
8404 |
+ * CONFIG_TIME_LOW_RES is a temporary way for architectures |
8405 |
+ * to signal that they simply return xtime in |
8406 |
+@@ -1000,6 +1019,9 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, |
8407 |
+ |
8408 |
+ hrtimer_set_expires_range_ns(timer, tim, delta_ns); |
8409 |
+ |
8410 |
++ /* Switch the timer base, if necessary: */ |
8411 |
++ new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED); |
8412 |
++ |
8413 |
+ timer_stats_hrtimer_set_start_info(timer); |
8414 |
+ |
8415 |
+ leftmost = enqueue_hrtimer(timer, new_base); |
8416 |
+diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c |
8417 |
+index d3bf660cb57f..66a1b46d5677 100644 |
8418 |
+--- a/kernel/irq/manage.c |
8419 |
++++ b/kernel/irq/manage.c |
8420 |
+@@ -150,7 +150,7 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask, |
8421 |
+ struct irq_chip *chip = irq_data_get_irq_chip(data); |
8422 |
+ int ret; |
8423 |
+ |
8424 |
+- ret = chip->irq_set_affinity(data, mask, false); |
8425 |
++ ret = chip->irq_set_affinity(data, mask, force); |
8426 |
+ switch (ret) { |
8427 |
+ case IRQ_SET_MASK_OK: |
8428 |
+ cpumask_copy(data->affinity, mask); |
8429 |
+@@ -162,7 +162,8 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask, |
8430 |
+ return ret; |
8431 |
+ } |
8432 |
+ |
8433 |
+-int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask) |
8434 |
++int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask, |
8435 |
++ bool force) |
8436 |
+ { |
8437 |
+ struct irq_chip *chip = irq_data_get_irq_chip(data); |
8438 |
+ struct irq_desc *desc = irq_data_to_desc(data); |
8439 |
+@@ -172,7 +173,7 @@ int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask) |
8440 |
+ return -EINVAL; |
8441 |
+ |
8442 |
+ if (irq_can_move_pcntxt(data)) { |
8443 |
+- ret = irq_do_set_affinity(data, mask, false); |
8444 |
++ ret = irq_do_set_affinity(data, mask, force); |
8445 |
+ } else { |
8446 |
+ irqd_set_move_pending(data); |
8447 |
+ irq_copy_pending(desc, mask); |
8448 |
+@@ -187,13 +188,7 @@ int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask) |
8449 |
+ return ret; |
8450 |
+ } |
8451 |
+ |
8452 |
+-/** |
8453 |
+- * irq_set_affinity - Set the irq affinity of a given irq |
8454 |
+- * @irq: Interrupt to set affinity |
8455 |
+- * @mask: cpumask |
8456 |
+- * |
8457 |
+- */ |
8458 |
+-int irq_set_affinity(unsigned int irq, const struct cpumask *mask) |
8459 |
++int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force) |
8460 |
+ { |
8461 |
+ struct irq_desc *desc = irq_to_desc(irq); |
8462 |
+ unsigned long flags; |
8463 |
+@@ -203,7 +198,7 @@ int irq_set_affinity(unsigned int irq, const struct cpumask *mask) |
8464 |
+ return -EINVAL; |
8465 |
+ |
8466 |
+ raw_spin_lock_irqsave(&desc->lock, flags); |
8467 |
+- ret = __irq_set_affinity_locked(irq_desc_get_irq_data(desc), mask); |
8468 |
++ ret = irq_set_affinity_locked(irq_desc_get_irq_data(desc), mask, force); |
8469 |
+ raw_spin_unlock_irqrestore(&desc->lock, flags); |
8470 |
+ return ret; |
8471 |
+ } |
8472 |
+diff --git a/kernel/kexec.c b/kernel/kexec.c |
8473 |
+index 60bafbed06ab..18ff0b91d6d2 100644 |
8474 |
+--- a/kernel/kexec.c |
8475 |
++++ b/kernel/kexec.c |
8476 |
+@@ -1682,6 +1682,14 @@ int kernel_kexec(void) |
8477 |
+ kexec_in_progress = true; |
8478 |
+ kernel_restart_prepare(NULL); |
8479 |
+ migrate_to_reboot_cpu(); |
8480 |
++ |
8481 |
++ /* |
8482 |
++ * migrate_to_reboot_cpu() disables CPU hotplug assuming that |
8483 |
++ * no further code needs to use CPU hotplug (which is true in |
8484 |
++ * the reboot case). However, the kexec path depends on using |
8485 |
++ * CPU hotplug again; so re-enable it here. |
8486 |
++ */ |
8487 |
++ cpu_hotplug_enable(); |
8488 |
+ printk(KERN_EMERG "Starting new kernel\n"); |
8489 |
+ machine_shutdown(); |
8490 |
+ } |
8491 |
+diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c |
8492 |
+index 2e960a2bab81..0339f515531a 100644 |
8493 |
+--- a/kernel/locking/rtmutex.c |
8494 |
++++ b/kernel/locking/rtmutex.c |
8495 |
+@@ -331,9 +331,16 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, |
8496 |
+ * top_waiter can be NULL, when we are in the deboosting |
8497 |
+ * mode! |
8498 |
+ */ |
8499 |
+- if (top_waiter && (!task_has_pi_waiters(task) || |
8500 |
+- top_waiter != task_top_pi_waiter(task))) |
8501 |
+- goto out_unlock_pi; |
8502 |
++ if (top_waiter) { |
8503 |
++ if (!task_has_pi_waiters(task)) |
8504 |
++ goto out_unlock_pi; |
8505 |
++ /* |
8506 |
++ * If deadlock detection is off, we stop here if we |
8507 |
++ * are not the top pi waiter of the task. |
8508 |
++ */ |
8509 |
++ if (!detect_deadlock && top_waiter != task_top_pi_waiter(task)) |
8510 |
++ goto out_unlock_pi; |
8511 |
++ } |
8512 |
+ |
8513 |
+ /* |
8514 |
+ * When deadlock detection is off then we check, if further |
8515 |
+@@ -349,7 +356,12 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, |
8516 |
+ goto retry; |
8517 |
+ } |
8518 |
+ |
8519 |
+- /* Deadlock detection */ |
8520 |
++ /* |
8521 |
++ * Deadlock detection. If the lock is the same as the original |
8522 |
++ * lock which caused us to walk the lock chain or if the |
8523 |
++ * current lock is owned by the task which initiated the chain |
8524 |
++ * walk, we detected a deadlock. |
8525 |
++ */ |
8526 |
+ if (lock == orig_lock || rt_mutex_owner(lock) == top_task) { |
8527 |
+ debug_rt_mutex_deadlock(deadlock_detect, orig_waiter, lock); |
8528 |
+ raw_spin_unlock(&lock->wait_lock); |
8529 |
+@@ -515,6 +527,18 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, |
8530 |
+ unsigned long flags; |
8531 |
+ int chain_walk = 0, res; |
8532 |
+ |
8533 |
++ /* |
8534 |
++ * Early deadlock detection. We really don't want the task to |
8535 |
++ * enqueue on itself just to untangle the mess later. It's not |
8536 |
++ * only an optimization. We drop the locks, so another waiter |
8537 |
++ * can come in before the chain walk detects the deadlock. So |
8538 |
++ * the other will detect the deadlock and return -EDEADLOCK, |
8539 |
++ * which is wrong, as the other waiter is not in a deadlock |
8540 |
++ * situation. |
8541 |
++ */ |
8542 |
++ if (detect_deadlock && owner == task) |
8543 |
++ return -EDEADLK; |
8544 |
++ |
8545 |
+ raw_spin_lock_irqsave(&task->pi_lock, flags); |
8546 |
+ __rt_mutex_adjust_prio(task); |
8547 |
+ waiter->task = task; |
8548 |
+diff --git a/kernel/module.c b/kernel/module.c |
8549 |
+index d24fcf29cb64..6716a1fa618b 100644 |
8550 |
+--- a/kernel/module.c |
8551 |
++++ b/kernel/module.c |
8552 |
+@@ -815,9 +815,6 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user, |
8553 |
+ return -EFAULT; |
8554 |
+ name[MODULE_NAME_LEN-1] = '\0'; |
8555 |
+ |
8556 |
+- if (!(flags & O_NONBLOCK)) |
8557 |
+- pr_warn("waiting module removal not supported: please upgrade\n"); |
8558 |
+- |
8559 |
+ if (mutex_lock_interruptible(&module_mutex) != 0) |
8560 |
+ return -EINTR; |
8561 |
+ |
8562 |
+@@ -3265,6 +3262,9 @@ static int load_module(struct load_info *info, const char __user *uargs, |
8563 |
+ |
8564 |
+ dynamic_debug_setup(info->debug, info->num_debug); |
8565 |
+ |
8566 |
++ /* Ftrace init must be called in the MODULE_STATE_UNFORMED state */ |
8567 |
++ ftrace_module_init(mod); |
8568 |
++ |
8569 |
+ /* Finally it's fully formed, ready to start executing. */ |
8570 |
+ err = complete_formation(mod, info); |
8571 |
+ if (err) |
8572 |
+diff --git a/kernel/timer.c b/kernel/timer.c |
8573 |
+index accfd241b9e5..38f0d40fca13 100644 |
8574 |
+--- a/kernel/timer.c |
8575 |
++++ b/kernel/timer.c |
8576 |
+@@ -822,7 +822,7 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires) |
8577 |
+ |
8578 |
+ bit = find_last_bit(&mask, BITS_PER_LONG); |
8579 |
+ |
8580 |
+- mask = (1 << bit) - 1; |
8581 |
++ mask = (1UL << bit) - 1; |
8582 |
+ |
8583 |
+ expires_limit = expires_limit & ~(mask); |
8584 |
+ |
8585 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
8586 |
+index cd7f76d1eb86..868633e61b43 100644 |
8587 |
+--- a/kernel/trace/ftrace.c |
8588 |
++++ b/kernel/trace/ftrace.c |
8589 |
+@@ -4315,16 +4315,11 @@ static void ftrace_init_module(struct module *mod, |
8590 |
+ ftrace_process_locs(mod, start, end); |
8591 |
+ } |
8592 |
+ |
8593 |
+-static int ftrace_module_notify_enter(struct notifier_block *self, |
8594 |
+- unsigned long val, void *data) |
8595 |
++void ftrace_module_init(struct module *mod) |
8596 |
+ { |
8597 |
+- struct module *mod = data; |
8598 |
+- |
8599 |
+- if (val == MODULE_STATE_COMING) |
8600 |
+- ftrace_init_module(mod, mod->ftrace_callsites, |
8601 |
+- mod->ftrace_callsites + |
8602 |
+- mod->num_ftrace_callsites); |
8603 |
+- return 0; |
8604 |
++ ftrace_init_module(mod, mod->ftrace_callsites, |
8605 |
++ mod->ftrace_callsites + |
8606 |
++ mod->num_ftrace_callsites); |
8607 |
+ } |
8608 |
+ |
8609 |
+ static int ftrace_module_notify_exit(struct notifier_block *self, |
8610 |
+@@ -4338,11 +4333,6 @@ static int ftrace_module_notify_exit(struct notifier_block *self, |
8611 |
+ return 0; |
8612 |
+ } |
8613 |
+ #else |
8614 |
+-static int ftrace_module_notify_enter(struct notifier_block *self, |
8615 |
+- unsigned long val, void *data) |
8616 |
+-{ |
8617 |
+- return 0; |
8618 |
+-} |
8619 |
+ static int ftrace_module_notify_exit(struct notifier_block *self, |
8620 |
+ unsigned long val, void *data) |
8621 |
+ { |
8622 |
+@@ -4350,11 +4340,6 @@ static int ftrace_module_notify_exit(struct notifier_block *self, |
8623 |
+ } |
8624 |
+ #endif /* CONFIG_MODULES */ |
8625 |
+ |
8626 |
+-struct notifier_block ftrace_module_enter_nb = { |
8627 |
+- .notifier_call = ftrace_module_notify_enter, |
8628 |
+- .priority = INT_MAX, /* Run before anything that can use kprobes */ |
8629 |
+-}; |
8630 |
+- |
8631 |
+ struct notifier_block ftrace_module_exit_nb = { |
8632 |
+ .notifier_call = ftrace_module_notify_exit, |
8633 |
+ .priority = INT_MIN, /* Run after anything that can remove kprobes */ |
8634 |
+@@ -4391,10 +4376,6 @@ void __init ftrace_init(void) |
8635 |
+ __start_mcount_loc, |
8636 |
+ __stop_mcount_loc); |
8637 |
+ |
8638 |
+- ret = register_module_notifier(&ftrace_module_enter_nb); |
8639 |
+- if (ret) |
8640 |
+- pr_warning("Failed to register trace ftrace module enter notifier\n"); |
8641 |
+- |
8642 |
+ ret = register_module_notifier(&ftrace_module_exit_nb); |
8643 |
+ if (ret) |
8644 |
+ pr_warning("Failed to register trace ftrace module exit notifier\n"); |
8645 |
+diff --git a/kernel/workqueue.c b/kernel/workqueue.c |
8646 |
+index 193e977a10ea..b6a394108e3b 100644 |
8647 |
+--- a/kernel/workqueue.c |
8648 |
++++ b/kernel/workqueue.c |
8649 |
+@@ -1909,6 +1909,12 @@ static void send_mayday(struct work_struct *work) |
8650 |
+ |
8651 |
+ /* mayday mayday mayday */ |
8652 |
+ if (list_empty(&pwq->mayday_node)) { |
8653 |
++ /* |
8654 |
++ * If @pwq is for an unbound wq, its base ref may be put at |
8655 |
++ * any time due to an attribute change. Pin @pwq until the |
8656 |
++ * rescuer is done with it. |
8657 |
++ */ |
8658 |
++ get_pwq(pwq); |
8659 |
+ list_add_tail(&pwq->mayday_node, &wq->maydays); |
8660 |
+ wake_up_process(wq->rescuer->task); |
8661 |
+ } |
8662 |
+@@ -2391,6 +2397,7 @@ static int rescuer_thread(void *__rescuer) |
8663 |
+ struct worker *rescuer = __rescuer; |
8664 |
+ struct workqueue_struct *wq = rescuer->rescue_wq; |
8665 |
+ struct list_head *scheduled = &rescuer->scheduled; |
8666 |
++ bool should_stop; |
8667 |
+ |
8668 |
+ set_user_nice(current, RESCUER_NICE_LEVEL); |
8669 |
+ |
8670 |
+@@ -2402,11 +2409,15 @@ static int rescuer_thread(void *__rescuer) |
8671 |
+ repeat: |
8672 |
+ set_current_state(TASK_INTERRUPTIBLE); |
8673 |
+ |
8674 |
+- if (kthread_should_stop()) { |
8675 |
+- __set_current_state(TASK_RUNNING); |
8676 |
+- rescuer->task->flags &= ~PF_WQ_WORKER; |
8677 |
+- return 0; |
8678 |
+- } |
8679 |
++ /* |
8680 |
++ * By the time the rescuer is requested to stop, the workqueue |
8681 |
++ * shouldn't have any work pending, but @wq->maydays may still have |
8682 |
++ * pwq(s) queued. This can happen by non-rescuer workers consuming |
8683 |
++ * all the work items before the rescuer got to them. Go through |
8684 |
++ * @wq->maydays processing before acting on should_stop so that the |
8685 |
++ * list is always empty on exit. |
8686 |
++ */ |
8687 |
++ should_stop = kthread_should_stop(); |
8688 |
+ |
8689 |
+ /* see whether any pwq is asking for help */ |
8690 |
+ spin_lock_irq(&wq_mayday_lock); |
8691 |
+@@ -2438,6 +2449,12 @@ repeat: |
8692 |
+ process_scheduled_works(rescuer); |
8693 |
+ |
8694 |
+ /* |
8695 |
++ * Put the reference grabbed by send_mayday(). @pool won't |
8696 |
++ * go away while we're holding its lock. |
8697 |
++ */ |
8698 |
++ put_pwq(pwq); |
8699 |
++ |
8700 |
++ /* |
8701 |
+ * Leave this pool. If keep_working() is %true, notify a |
8702 |
+ * regular worker; otherwise, we end up with 0 concurrency |
8703 |
+ * and stalling the execution. |
8704 |
+@@ -2452,6 +2469,12 @@ repeat: |
8705 |
+ |
8706 |
+ spin_unlock_irq(&wq_mayday_lock); |
8707 |
+ |
8708 |
++ if (should_stop) { |
8709 |
++ __set_current_state(TASK_RUNNING); |
8710 |
++ rescuer->task->flags &= ~PF_WQ_WORKER; |
8711 |
++ return 0; |
8712 |
++ } |
8713 |
++ |
8714 |
+ /* rescuers should never participate in concurrency management */ |
8715 |
+ WARN_ON_ONCE(!(rescuer->flags & WORKER_NOT_RUNNING)); |
8716 |
+ schedule(); |
8717 |
+@@ -4093,7 +4116,8 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu, |
8718 |
+ if (!pwq) { |
8719 |
+ pr_warning("workqueue: allocation failed while updating NUMA affinity of \"%s\"\n", |
8720 |
+ wq->name); |
8721 |
+- goto out_unlock; |
8722 |
++ mutex_lock(&wq->mutex); |
8723 |
++ goto use_dfl_pwq; |
8724 |
+ } |
8725 |
+ |
8726 |
+ /* |
8727 |
+diff --git a/mm/compaction.c b/mm/compaction.c |
8728 |
+index 918577595ea8..5f702ef0a65f 100644 |
8729 |
+--- a/mm/compaction.c |
8730 |
++++ b/mm/compaction.c |
8731 |
+@@ -666,16 +666,20 @@ static void isolate_freepages(struct zone *zone, |
8732 |
+ struct compact_control *cc) |
8733 |
+ { |
8734 |
+ struct page *page; |
8735 |
+- unsigned long high_pfn, low_pfn, pfn, z_end_pfn, end_pfn; |
8736 |
++ unsigned long high_pfn, low_pfn, pfn, z_end_pfn; |
8737 |
+ int nr_freepages = cc->nr_freepages; |
8738 |
+ struct list_head *freelist = &cc->freepages; |
8739 |
+ |
8740 |
+ /* |
8741 |
+ * Initialise the free scanner. The starting point is where we last |
8742 |
+- * scanned from (or the end of the zone if starting). The low point |
8743 |
+- * is the end of the pageblock the migration scanner is using. |
8744 |
++ * successfully isolated from, zone-cached value, or the end of the |
8745 |
++ * zone when isolating for the first time. We need this aligned to |
8746 |
++ * the pageblock boundary, because we do pfn -= pageblock_nr_pages |
8747 |
++ * in the for loop. |
8748 |
++ * The low boundary is the end of the pageblock the migration scanner |
8749 |
++ * is using. |
8750 |
+ */ |
8751 |
+- pfn = cc->free_pfn; |
8752 |
++ pfn = cc->free_pfn & ~(pageblock_nr_pages-1); |
8753 |
+ low_pfn = ALIGN(cc->migrate_pfn + 1, pageblock_nr_pages); |
8754 |
+ |
8755 |
+ /* |
8756 |
+@@ -695,6 +699,7 @@ static void isolate_freepages(struct zone *zone, |
8757 |
+ for (; pfn >= low_pfn && cc->nr_migratepages > nr_freepages; |
8758 |
+ pfn -= pageblock_nr_pages) { |
8759 |
+ unsigned long isolated; |
8760 |
++ unsigned long end_pfn; |
8761 |
+ |
8762 |
+ /* |
8763 |
+ * This can iterate a massively long zone without finding any |
8764 |
+@@ -729,13 +734,10 @@ static void isolate_freepages(struct zone *zone, |
8765 |
+ isolated = 0; |
8766 |
+ |
8767 |
+ /* |
8768 |
+- * As pfn may not start aligned, pfn+pageblock_nr_page |
8769 |
+- * may cross a MAX_ORDER_NR_PAGES boundary and miss |
8770 |
+- * a pfn_valid check. Ensure isolate_freepages_block() |
8771 |
+- * only scans within a pageblock |
8772 |
++ * Take care when isolating in last pageblock of a zone which |
8773 |
++ * ends in the middle of a pageblock. |
8774 |
+ */ |
8775 |
+- end_pfn = ALIGN(pfn + 1, pageblock_nr_pages); |
8776 |
+- end_pfn = min(end_pfn, z_end_pfn); |
8777 |
++ end_pfn = min(pfn + pageblock_nr_pages, z_end_pfn); |
8778 |
+ isolated = isolate_freepages_block(cc, pfn, end_pfn, |
8779 |
+ freelist, false); |
8780 |
+ nr_freepages += isolated; |
8781 |
+diff --git a/mm/memory-failure.c b/mm/memory-failure.c |
8782 |
+index 90002ea43638..66586bb44c62 100644 |
8783 |
+--- a/mm/memory-failure.c |
8784 |
++++ b/mm/memory-failure.c |
8785 |
+@@ -1085,15 +1085,16 @@ int memory_failure(unsigned long pfn, int trapno, int flags) |
8786 |
+ return 0; |
8787 |
+ } else if (PageHuge(hpage)) { |
8788 |
+ /* |
8789 |
+- * Check "just unpoisoned", "filter hit", and |
8790 |
+- * "race with other subpage." |
8791 |
++ * Check "filter hit" and "race with other subpage." |
8792 |
+ */ |
8793 |
+ lock_page(hpage); |
8794 |
+- if (!PageHWPoison(hpage) |
8795 |
+- || (hwpoison_filter(p) && TestClearPageHWPoison(p)) |
8796 |
+- || (p != hpage && TestSetPageHWPoison(hpage))) { |
8797 |
+- atomic_long_sub(nr_pages, &num_poisoned_pages); |
8798 |
+- return 0; |
8799 |
++ if (PageHWPoison(hpage)) { |
8800 |
++ if ((hwpoison_filter(p) && TestClearPageHWPoison(p)) |
8801 |
++ || (p != hpage && TestSetPageHWPoison(hpage))) { |
8802 |
++ atomic_long_sub(nr_pages, &num_poisoned_pages); |
8803 |
++ unlock_page(hpage); |
8804 |
++ return 0; |
8805 |
++ } |
8806 |
+ } |
8807 |
+ set_page_hwpoison_huge_page(hpage); |
8808 |
+ res = dequeue_hwpoisoned_huge_page(hpage); |
8809 |
+diff --git a/mm/memory.c b/mm/memory.c |
8810 |
+index 22dfa617bddb..49e930f9ed46 100644 |
8811 |
+--- a/mm/memory.c |
8812 |
++++ b/mm/memory.c |
8813 |
+@@ -1929,12 +1929,17 @@ int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, |
8814 |
+ unsigned long address, unsigned int fault_flags) |
8815 |
+ { |
8816 |
+ struct vm_area_struct *vma; |
8817 |
++ vm_flags_t vm_flags; |
8818 |
+ int ret; |
8819 |
+ |
8820 |
+ vma = find_extend_vma(mm, address); |
8821 |
+ if (!vma || address < vma->vm_start) |
8822 |
+ return -EFAULT; |
8823 |
+ |
8824 |
++ vm_flags = (fault_flags & FAULT_FLAG_WRITE) ? VM_WRITE : VM_READ; |
8825 |
++ if (!(vm_flags & vma->vm_flags)) |
8826 |
++ return -EFAULT; |
8827 |
++ |
8828 |
+ ret = handle_mm_fault(mm, vma, address, fault_flags); |
8829 |
+ if (ret & VM_FAULT_ERROR) { |
8830 |
+ if (ret & VM_FAULT_OOM) |
8831 |
+diff --git a/mm/mremap.c b/mm/mremap.c |
8832 |
+index 0843feb66f3d..05f1180e9f21 100644 |
8833 |
+--- a/mm/mremap.c |
8834 |
++++ b/mm/mremap.c |
8835 |
+@@ -194,10 +194,17 @@ unsigned long move_page_tables(struct vm_area_struct *vma, |
8836 |
+ break; |
8837 |
+ if (pmd_trans_huge(*old_pmd)) { |
8838 |
+ int err = 0; |
8839 |
+- if (extent == HPAGE_PMD_SIZE) |
8840 |
++ if (extent == HPAGE_PMD_SIZE) { |
8841 |
++ VM_BUG_ON(vma->vm_file || !vma->anon_vma); |
8842 |
++ /* See comment in move_ptes() */ |
8843 |
++ if (need_rmap_locks) |
8844 |
++ anon_vma_lock_write(vma->anon_vma); |
8845 |
+ err = move_huge_pmd(vma, new_vma, old_addr, |
8846 |
+ new_addr, old_end, |
8847 |
+ old_pmd, new_pmd); |
8848 |
++ if (need_rmap_locks) |
8849 |
++ anon_vma_unlock_write(vma->anon_vma); |
8850 |
++ } |
8851 |
+ if (err > 0) { |
8852 |
+ need_flush = true; |
8853 |
+ continue; |
8854 |
+diff --git a/mm/page-writeback.c b/mm/page-writeback.c |
8855 |
+index 7106cb1aca8e..8f6daa62206d 100644 |
8856 |
+--- a/mm/page-writeback.c |
8857 |
++++ b/mm/page-writeback.c |
8858 |
+@@ -593,14 +593,14 @@ unsigned long bdi_dirty_limit(struct backing_dev_info *bdi, unsigned long dirty) |
8859 |
+ * (5) the closer to setpoint, the smaller |df/dx| (and the reverse) |
8860 |
+ * => fast response on large errors; small oscillation near setpoint |
8861 |
+ */ |
8862 |
+-static inline long long pos_ratio_polynom(unsigned long setpoint, |
8863 |
++static long long pos_ratio_polynom(unsigned long setpoint, |
8864 |
+ unsigned long dirty, |
8865 |
+ unsigned long limit) |
8866 |
+ { |
8867 |
+ long long pos_ratio; |
8868 |
+ long x; |
8869 |
+ |
8870 |
+- x = div_s64(((s64)setpoint - (s64)dirty) << RATELIMIT_CALC_SHIFT, |
8871 |
++ x = div64_s64(((s64)setpoint - (s64)dirty) << RATELIMIT_CALC_SHIFT, |
8872 |
+ limit - setpoint + 1); |
8873 |
+ pos_ratio = x; |
8874 |
+ pos_ratio = pos_ratio * x >> RATELIMIT_CALC_SHIFT; |
8875 |
+@@ -842,7 +842,7 @@ static unsigned long bdi_position_ratio(struct backing_dev_info *bdi, |
8876 |
+ x_intercept = bdi_setpoint + span; |
8877 |
+ |
8878 |
+ if (bdi_dirty < x_intercept - span / 4) { |
8879 |
+- pos_ratio = div_u64(pos_ratio * (x_intercept - bdi_dirty), |
8880 |
++ pos_ratio = div64_u64(pos_ratio * (x_intercept - bdi_dirty), |
8881 |
+ x_intercept - bdi_setpoint + 1); |
8882 |
+ } else |
8883 |
+ pos_ratio /= 4; |
8884 |
+diff --git a/mm/percpu.c b/mm/percpu.c |
8885 |
+index 036cfe07050f..a2a54a85f691 100644 |
8886 |
+--- a/mm/percpu.c |
8887 |
++++ b/mm/percpu.c |
8888 |
+@@ -612,7 +612,7 @@ static struct pcpu_chunk *pcpu_alloc_chunk(void) |
8889 |
+ chunk->map = pcpu_mem_zalloc(PCPU_DFL_MAP_ALLOC * |
8890 |
+ sizeof(chunk->map[0])); |
8891 |
+ if (!chunk->map) { |
8892 |
+- kfree(chunk); |
8893 |
++ pcpu_mem_free(chunk, pcpu_chunk_struct_size); |
8894 |
+ return NULL; |
8895 |
+ } |
8896 |
+ |
8897 |
+diff --git a/mm/vmscan.c b/mm/vmscan.c |
8898 |
+index a9c74b409681..30a4b096ff6e 100644 |
8899 |
+--- a/mm/vmscan.c |
8900 |
++++ b/mm/vmscan.c |
8901 |
+@@ -1916,6 +1916,24 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, |
8902 |
+ } |
8903 |
+ |
8904 |
+ /* |
8905 |
++ * Prevent the reclaimer from falling into the cache trap: as |
8906 |
++ * cache pages start out inactive, every cache fault will tip |
8907 |
++ * the scan balance towards the file LRU. And as the file LRU |
8908 |
++ * shrinks, so does the window for rotation from references. |
8909 |
++ * This means we have a runaway feedback loop where a tiny |
8910 |
++ * thrashing file LRU becomes infinitely more attractive than |
8911 |
++ * anon pages. Try to detect this based on file LRU size. |
8912 |
++ */ |
8913 |
++ if (global_reclaim(sc)) { |
8914 |
++ unsigned long free = zone_page_state(zone, NR_FREE_PAGES); |
8915 |
++ |
8916 |
++ if (unlikely(file + free <= high_wmark_pages(zone))) { |
8917 |
++ scan_balance = SCAN_ANON; |
8918 |
++ goto out; |
8919 |
++ } |
8920 |
++ } |
8921 |
++ |
8922 |
++ /* |
8923 |
+ * There is enough inactive page cache, do not reclaim |
8924 |
+ * anything from the anonymous working set right now. |
8925 |
+ */ |
8926 |
+diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c |
8927 |
+index ba5366c320da..9a6bc9df5e81 100644 |
8928 |
+--- a/net/bluetooth/hci_conn.c |
8929 |
++++ b/net/bluetooth/hci_conn.c |
8930 |
+@@ -752,14 +752,17 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) |
8931 |
+ if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) { |
8932 |
+ struct hci_cp_auth_requested cp; |
8933 |
+ |
8934 |
+- /* encrypt must be pending if auth is also pending */ |
8935 |
+- set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); |
8936 |
+- |
8937 |
+ cp.handle = cpu_to_le16(conn->handle); |
8938 |
+ hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED, |
8939 |
+ sizeof(cp), &cp); |
8940 |
++ |
8941 |
++ /* If we're already encrypted set the REAUTH_PEND flag, |
8942 |
++ * otherwise set the ENCRYPT_PEND. |
8943 |
++ */ |
8944 |
+ if (conn->key_type != 0xff) |
8945 |
+ set_bit(HCI_CONN_REAUTH_PEND, &conn->flags); |
8946 |
++ else |
8947 |
++ set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); |
8948 |
+ } |
8949 |
+ |
8950 |
+ return 0; |
8951 |
+diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
8952 |
+index 60828cf02eb8..66ada7794ed0 100644 |
8953 |
+--- a/net/bluetooth/hci_event.c |
8954 |
++++ b/net/bluetooth/hci_event.c |
8955 |
+@@ -3006,6 +3006,12 @@ static void hci_key_refresh_complete_evt(struct hci_dev *hdev, |
8956 |
+ if (!conn) |
8957 |
+ goto unlock; |
8958 |
+ |
8959 |
++ /* For BR/EDR the necessary steps are taken through the |
8960 |
++ * auth_complete event. |
8961 |
++ */ |
8962 |
++ if (conn->type != LE_LINK) |
8963 |
++ goto unlock; |
8964 |
++ |
8965 |
+ if (!ev->status) |
8966 |
+ conn->sec_level = conn->pending_sec_level; |
8967 |
+ |
8968 |
+diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c |
8969 |
+index 30efc5c18622..988721a629eb 100644 |
8970 |
+--- a/net/ceph/messenger.c |
8971 |
++++ b/net/ceph/messenger.c |
8972 |
+@@ -557,7 +557,7 @@ static int ceph_tcp_sendmsg(struct socket *sock, struct kvec *iov, |
8973 |
+ return r; |
8974 |
+ } |
8975 |
+ |
8976 |
+-static int ceph_tcp_sendpage(struct socket *sock, struct page *page, |
8977 |
++static int __ceph_tcp_sendpage(struct socket *sock, struct page *page, |
8978 |
+ int offset, size_t size, bool more) |
8979 |
+ { |
8980 |
+ int flags = MSG_DONTWAIT | MSG_NOSIGNAL | (more ? MSG_MORE : MSG_EOR); |
8981 |
+@@ -570,6 +570,24 @@ static int ceph_tcp_sendpage(struct socket *sock, struct page *page, |
8982 |
+ return ret; |
8983 |
+ } |
8984 |
+ |
8985 |
++static int ceph_tcp_sendpage(struct socket *sock, struct page *page, |
8986 |
++ int offset, size_t size, bool more) |
8987 |
++{ |
8988 |
++ int ret; |
8989 |
++ struct kvec iov; |
8990 |
++ |
8991 |
++ /* sendpage cannot properly handle pages with page_count == 0, |
8992 |
++ * we need to fallback to sendmsg if that's the case */ |
8993 |
++ if (page_count(page) >= 1) |
8994 |
++ return __ceph_tcp_sendpage(sock, page, offset, size, more); |
8995 |
++ |
8996 |
++ iov.iov_base = kmap(page) + offset; |
8997 |
++ iov.iov_len = size; |
8998 |
++ ret = ceph_tcp_sendmsg(sock, &iov, 1, size, more); |
8999 |
++ kunmap(page); |
9000 |
++ |
9001 |
++ return ret; |
9002 |
++} |
9003 |
+ |
9004 |
+ /* |
9005 |
+ * Shutdown/close the socket for the given connection. |
9006 |
+diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h |
9007 |
+index 6bd498470138..b127902361f4 100644 |
9008 |
+--- a/net/mac80211/ieee80211_i.h |
9009 |
++++ b/net/mac80211/ieee80211_i.h |
9010 |
+@@ -317,6 +317,7 @@ struct ieee80211_roc_work { |
9011 |
+ |
9012 |
+ bool started, abort, hw_begun, notified; |
9013 |
+ bool to_be_freed; |
9014 |
++ bool on_channel; |
9015 |
+ |
9016 |
+ unsigned long hw_start_time; |
9017 |
+ |
9018 |
+diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
9019 |
+index 47059ac44e24..e6a84cb1a5e4 100644 |
9020 |
+--- a/net/mac80211/mlme.c |
9021 |
++++ b/net/mac80211/mlme.c |
9022 |
+@@ -3511,18 +3511,24 @@ void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata) |
9023 |
+ |
9024 |
+ sdata_lock(sdata); |
9025 |
+ |
9026 |
+- if (ifmgd->auth_data) { |
9027 |
++ if (ifmgd->auth_data || ifmgd->assoc_data) { |
9028 |
++ const u8 *bssid = ifmgd->auth_data ? |
9029 |
++ ifmgd->auth_data->bss->bssid : |
9030 |
++ ifmgd->assoc_data->bss->bssid; |
9031 |
++ |
9032 |
+ /* |
9033 |
+- * If we are trying to authenticate while suspending, cfg80211 |
9034 |
+- * won't know and won't actually abort those attempts, thus we |
9035 |
+- * need to do that ourselves. |
9036 |
++ * If we are trying to authenticate / associate while suspending, |
9037 |
++ * cfg80211 won't know and won't actually abort those attempts, |
9038 |
++ * thus we need to do that ourselves. |
9039 |
+ */ |
9040 |
+- ieee80211_send_deauth_disassoc(sdata, |
9041 |
+- ifmgd->auth_data->bss->bssid, |
9042 |
++ ieee80211_send_deauth_disassoc(sdata, bssid, |
9043 |
+ IEEE80211_STYPE_DEAUTH, |
9044 |
+ WLAN_REASON_DEAUTH_LEAVING, |
9045 |
+ false, frame_buf); |
9046 |
+- ieee80211_destroy_auth_data(sdata, false); |
9047 |
++ if (ifmgd->assoc_data) |
9048 |
++ ieee80211_destroy_assoc_data(sdata, false); |
9049 |
++ if (ifmgd->auth_data) |
9050 |
++ ieee80211_destroy_auth_data(sdata, false); |
9051 |
+ cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, |
9052 |
+ IEEE80211_DEAUTH_FRAME_LEN); |
9053 |
+ } |
9054 |
+diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c |
9055 |
+index 6fb38558a5e6..7a17decd27f9 100644 |
9056 |
+--- a/net/mac80211/offchannel.c |
9057 |
++++ b/net/mac80211/offchannel.c |
9058 |
+@@ -333,7 +333,7 @@ void ieee80211_sw_roc_work(struct work_struct *work) |
9059 |
+ container_of(work, struct ieee80211_roc_work, work.work); |
9060 |
+ struct ieee80211_sub_if_data *sdata = roc->sdata; |
9061 |
+ struct ieee80211_local *local = sdata->local; |
9062 |
+- bool started; |
9063 |
++ bool started, on_channel; |
9064 |
+ |
9065 |
+ mutex_lock(&local->mtx); |
9066 |
+ |
9067 |
+@@ -354,14 +354,26 @@ void ieee80211_sw_roc_work(struct work_struct *work) |
9068 |
+ if (!roc->started) { |
9069 |
+ struct ieee80211_roc_work *dep; |
9070 |
+ |
9071 |
+- /* start this ROC */ |
9072 |
+- ieee80211_offchannel_stop_vifs(local); |
9073 |
++ WARN_ON(local->use_chanctx); |
9074 |
++ |
9075 |
++ /* If actually operating on the desired channel (with at least |
9076 |
++ * 20 MHz channel width) don't stop all the operations but still |
9077 |
++ * treat it as though the ROC operation started properly, so |
9078 |
++ * other ROC operations won't interfere with this one. |
9079 |
++ */ |
9080 |
++ roc->on_channel = roc->chan == local->_oper_chandef.chan && |
9081 |
++ local->_oper_chandef.width != NL80211_CHAN_WIDTH_5 && |
9082 |
++ local->_oper_chandef.width != NL80211_CHAN_WIDTH_10; |
9083 |
+ |
9084 |
+- /* switch channel etc */ |
9085 |
++ /* start this ROC */ |
9086 |
+ ieee80211_recalc_idle(local); |
9087 |
+ |
9088 |
+- local->tmp_channel = roc->chan; |
9089 |
+- ieee80211_hw_config(local, 0); |
9090 |
++ if (!roc->on_channel) { |
9091 |
++ ieee80211_offchannel_stop_vifs(local); |
9092 |
++ |
9093 |
++ local->tmp_channel = roc->chan; |
9094 |
++ ieee80211_hw_config(local, 0); |
9095 |
++ } |
9096 |
+ |
9097 |
+ /* tell userspace or send frame */ |
9098 |
+ ieee80211_handle_roc_started(roc); |
9099 |
+@@ -380,9 +392,10 @@ void ieee80211_sw_roc_work(struct work_struct *work) |
9100 |
+ finish: |
9101 |
+ list_del(&roc->list); |
9102 |
+ started = roc->started; |
9103 |
++ on_channel = roc->on_channel; |
9104 |
+ ieee80211_roc_notify_destroy(roc, !roc->abort); |
9105 |
+ |
9106 |
+- if (started) { |
9107 |
++ if (started && !on_channel) { |
9108 |
+ ieee80211_flush_queues(local, NULL); |
9109 |
+ |
9110 |
+ local->tmp_channel = NULL; |
9111 |
+diff --git a/net/mac80211/util.c b/net/mac80211/util.c |
9112 |
+index b8700d417a9c..642762518213 100644 |
9113 |
+--- a/net/mac80211/util.c |
9114 |
++++ b/net/mac80211/util.c |
9115 |
+@@ -1754,7 +1754,7 @@ int ieee80211_reconfig(struct ieee80211_local *local) |
9116 |
+ mutex_unlock(&local->mtx); |
9117 |
+ |
9118 |
+ if (sched_scan_stopped) |
9119 |
+- cfg80211_sched_scan_stopped(local->hw.wiphy); |
9120 |
++ cfg80211_sched_scan_stopped_rtnl(local->hw.wiphy); |
9121 |
+ |
9122 |
+ /* |
9123 |
+ * If this is for hw restart things are still running. |
9124 |
+diff --git a/net/wireless/reg.c b/net/wireless/reg.c |
9125 |
+index f0541370e68e..338794ea44d1 100644 |
9126 |
+--- a/net/wireless/reg.c |
9127 |
++++ b/net/wireless/reg.c |
9128 |
+@@ -1683,17 +1683,9 @@ static void reg_process_hint(struct regulatory_request *reg_request) |
9129 |
+ struct wiphy *wiphy = NULL; |
9130 |
+ enum reg_request_treatment treatment; |
9131 |
+ |
9132 |
+- if (WARN_ON(!reg_request->alpha2)) |
9133 |
+- return; |
9134 |
+- |
9135 |
+ if (reg_request->wiphy_idx != WIPHY_IDX_INVALID) |
9136 |
+ wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx); |
9137 |
+ |
9138 |
+- if (reg_request->initiator == NL80211_REGDOM_SET_BY_DRIVER && !wiphy) { |
9139 |
+- kfree(reg_request); |
9140 |
+- return; |
9141 |
+- } |
9142 |
+- |
9143 |
+ switch (reg_request->initiator) { |
9144 |
+ case NL80211_REGDOM_SET_BY_CORE: |
9145 |
+ reg_process_hint_core(reg_request); |
9146 |
+@@ -1706,20 +1698,29 @@ static void reg_process_hint(struct regulatory_request *reg_request) |
9147 |
+ schedule_delayed_work(®_timeout, msecs_to_jiffies(3142)); |
9148 |
+ return; |
9149 |
+ case NL80211_REGDOM_SET_BY_DRIVER: |
9150 |
++ if (!wiphy) |
9151 |
++ goto out_free; |
9152 |
+ treatment = reg_process_hint_driver(wiphy, reg_request); |
9153 |
+ break; |
9154 |
+ case NL80211_REGDOM_SET_BY_COUNTRY_IE: |
9155 |
++ if (!wiphy) |
9156 |
++ goto out_free; |
9157 |
+ treatment = reg_process_hint_country_ie(wiphy, reg_request); |
9158 |
+ break; |
9159 |
+ default: |
9160 |
+ WARN(1, "invalid initiator %d\n", reg_request->initiator); |
9161 |
+- return; |
9162 |
++ goto out_free; |
9163 |
+ } |
9164 |
+ |
9165 |
+ /* This is required so that the orig_* parameters are saved */ |
9166 |
+ if (treatment == REG_REQ_ALREADY_SET && wiphy && |
9167 |
+ wiphy->regulatory_flags & REGULATORY_STRICT_REG) |
9168 |
+ wiphy_update_regulatory(wiphy, reg_request->initiator); |
9169 |
++ |
9170 |
++ return; |
9171 |
++ |
9172 |
++out_free: |
9173 |
++ kfree(reg_request); |
9174 |
+ } |
9175 |
+ |
9176 |
+ /* |
9177 |
+diff --git a/net/wireless/scan.c b/net/wireless/scan.c |
9178 |
+index d1ed4aebbbb7..38d6dd553770 100644 |
9179 |
+--- a/net/wireless/scan.c |
9180 |
++++ b/net/wireless/scan.c |
9181 |
+@@ -284,14 +284,22 @@ void cfg80211_sched_scan_results(struct wiphy *wiphy) |
9182 |
+ } |
9183 |
+ EXPORT_SYMBOL(cfg80211_sched_scan_results); |
9184 |
+ |
9185 |
+-void cfg80211_sched_scan_stopped(struct wiphy *wiphy) |
9186 |
++void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy) |
9187 |
+ { |
9188 |
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
9189 |
+ |
9190 |
++ ASSERT_RTNL(); |
9191 |
++ |
9192 |
+ trace_cfg80211_sched_scan_stopped(wiphy); |
9193 |
+ |
9194 |
+- rtnl_lock(); |
9195 |
+ __cfg80211_stop_sched_scan(rdev, true); |
9196 |
++} |
9197 |
++EXPORT_SYMBOL(cfg80211_sched_scan_stopped_rtnl); |
9198 |
++ |
9199 |
++void cfg80211_sched_scan_stopped(struct wiphy *wiphy) |
9200 |
++{ |
9201 |
++ rtnl_lock(); |
9202 |
++ cfg80211_sched_scan_stopped_rtnl(wiphy); |
9203 |
+ rtnl_unlock(); |
9204 |
+ } |
9205 |
+ EXPORT_SYMBOL(cfg80211_sched_scan_stopped); |
9206 |
+diff --git a/net/wireless/sme.c b/net/wireless/sme.c |
9207 |
+index f04d4c32e96e..760722f9126b 100644 |
9208 |
+--- a/net/wireless/sme.c |
9209 |
++++ b/net/wireless/sme.c |
9210 |
+@@ -235,7 +235,6 @@ void cfg80211_conn_work(struct work_struct *work) |
9211 |
+ NULL, 0, NULL, 0, |
9212 |
+ WLAN_STATUS_UNSPECIFIED_FAILURE, |
9213 |
+ false, NULL); |
9214 |
+- cfg80211_sme_free(wdev); |
9215 |
+ } |
9216 |
+ wdev_unlock(wdev); |
9217 |
+ } |
9218 |
+@@ -649,6 +648,7 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, |
9219 |
+ cfg80211_unhold_bss(bss_from_pub(bss)); |
9220 |
+ cfg80211_put_bss(wdev->wiphy, bss); |
9221 |
+ } |
9222 |
++ cfg80211_sme_free(wdev); |
9223 |
+ return; |
9224 |
+ } |
9225 |
+ |
9226 |
+diff --git a/security/device_cgroup.c b/security/device_cgroup.c |
9227 |
+index d3b6d2cd3a06..6e4e6eb732fe 100644 |
9228 |
+--- a/security/device_cgroup.c |
9229 |
++++ b/security/device_cgroup.c |
9230 |
+@@ -308,57 +308,139 @@ static int devcgroup_seq_show(struct seq_file *m, void *v) |
9231 |
+ } |
9232 |
+ |
9233 |
+ /** |
9234 |
+- * may_access - verifies if a new exception is part of what is allowed |
9235 |
+- * by a dev cgroup based on the default policy + |
9236 |
+- * exceptions. This is used to make sure a child cgroup |
9237 |
+- * won't have more privileges than its parent or to |
9238 |
+- * verify if a certain access is allowed. |
9239 |
+- * @dev_cgroup: dev cgroup to be tested against |
9240 |
+- * @refex: new exception |
9241 |
+- * @behavior: behavior of the exception |
9242 |
++ * match_exception - iterates the exception list trying to match a rule |
9243 |
++ * based on type, major, minor and access type. It is |
9244 |
++ * considered a match if an exception is found that |
9245 |
++ * will contain the entire range of provided parameters. |
9246 |
++ * @exceptions: list of exceptions |
9247 |
++ * @type: device type (DEV_BLOCK or DEV_CHAR) |
9248 |
++ * @major: device file major number, ~0 to match all |
9249 |
++ * @minor: device file minor number, ~0 to match all |
9250 |
++ * @access: permission mask (ACC_READ, ACC_WRITE, ACC_MKNOD) |
9251 |
++ * |
9252 |
++ * returns: true in case it matches an exception completely |
9253 |
+ */ |
9254 |
+-static bool may_access(struct dev_cgroup *dev_cgroup, |
9255 |
+- struct dev_exception_item *refex, |
9256 |
+- enum devcg_behavior behavior) |
9257 |
++static bool match_exception(struct list_head *exceptions, short type, |
9258 |
++ u32 major, u32 minor, short access) |
9259 |
+ { |
9260 |
+ struct dev_exception_item *ex; |
9261 |
+- bool match = false; |
9262 |
+ |
9263 |
+- rcu_lockdep_assert(rcu_read_lock_held() || |
9264 |
+- lockdep_is_held(&devcgroup_mutex), |
9265 |
+- "device_cgroup::may_access() called without proper synchronization"); |
9266 |
++ list_for_each_entry_rcu(ex, exceptions, list) { |
9267 |
++ if ((type & DEV_BLOCK) && !(ex->type & DEV_BLOCK)) |
9268 |
++ continue; |
9269 |
++ if ((type & DEV_CHAR) && !(ex->type & DEV_CHAR)) |
9270 |
++ continue; |
9271 |
++ if (ex->major != ~0 && ex->major != major) |
9272 |
++ continue; |
9273 |
++ if (ex->minor != ~0 && ex->minor != minor) |
9274 |
++ continue; |
9275 |
++ /* provided access cannot have more than the exception rule */ |
9276 |
++ if (access & (~ex->access)) |
9277 |
++ continue; |
9278 |
++ return true; |
9279 |
++ } |
9280 |
++ return false; |
9281 |
++} |
9282 |
++ |
9283 |
++/** |
9284 |
++ * match_exception_partial - iterates the exception list trying to match a rule |
9285 |
++ * based on type, major, minor and access type. It is |
9286 |
++ * considered a match if an exception's range is |
9287 |
++ * found to contain *any* of the devices specified by |
9288 |
++ * provided parameters. This is used to make sure no |
9289 |
++ * extra access is being granted that is forbidden by |
9290 |
++ * any of the exception list. |
9291 |
++ * @exceptions: list of exceptions |
9292 |
++ * @type: device type (DEV_BLOCK or DEV_CHAR) |
9293 |
++ * @major: device file major number, ~0 to match all |
9294 |
++ * @minor: device file minor number, ~0 to match all |
9295 |
++ * @access: permission mask (ACC_READ, ACC_WRITE, ACC_MKNOD) |
9296 |
++ * |
9297 |
++ * returns: true in case the provided range mat matches an exception completely |
9298 |
++ */ |
9299 |
++static bool match_exception_partial(struct list_head *exceptions, short type, |
9300 |
++ u32 major, u32 minor, short access) |
9301 |
++{ |
9302 |
++ struct dev_exception_item *ex; |
9303 |
+ |
9304 |
+- list_for_each_entry_rcu(ex, &dev_cgroup->exceptions, list) { |
9305 |
+- if ((refex->type & DEV_BLOCK) && !(ex->type & DEV_BLOCK)) |
9306 |
++ list_for_each_entry_rcu(ex, exceptions, list) { |
9307 |
++ if ((type & DEV_BLOCK) && !(ex->type & DEV_BLOCK)) |
9308 |
+ continue; |
9309 |
+- if ((refex->type & DEV_CHAR) && !(ex->type & DEV_CHAR)) |
9310 |
++ if ((type & DEV_CHAR) && !(ex->type & DEV_CHAR)) |
9311 |
+ continue; |
9312 |
+- if (ex->major != ~0 && ex->major != refex->major) |
9313 |
++ /* |
9314 |
++ * We must be sure that both the exception and the provided |
9315 |
++ * range aren't masking all devices |
9316 |
++ */ |
9317 |
++ if (ex->major != ~0 && major != ~0 && ex->major != major) |
9318 |
+ continue; |
9319 |
+- if (ex->minor != ~0 && ex->minor != refex->minor) |
9320 |
++ if (ex->minor != ~0 && minor != ~0 && ex->minor != minor) |
9321 |
+ continue; |
9322 |
+- if (refex->access & (~ex->access)) |
9323 |
++ /* |
9324 |
++ * In order to make sure the provided range isn't matching |
9325 |
++ * an exception, all its access bits shouldn't match the |
9326 |
++ * exception's access bits |
9327 |
++ */ |
9328 |
++ if (!(access & ex->access)) |
9329 |
+ continue; |
9330 |
+- match = true; |
9331 |
+- break; |
9332 |
++ return true; |
9333 |
+ } |
9334 |
++ return false; |
9335 |
++} |
9336 |
++ |
9337 |
++/** |
9338 |
++ * verify_new_ex - verifies if a new exception is part of what is allowed |
9339 |
++ * by a dev cgroup based on the default policy + |
9340 |
++ * exceptions. This is used to make sure a child cgroup |
9341 |
++ * won't have more privileges than its parent |
9342 |
++ * @dev_cgroup: dev cgroup to be tested against |
9343 |
++ * @refex: new exception |
9344 |
++ * @behavior: behavior of the exception's dev_cgroup |
9345 |
++ */ |
9346 |
++static bool verify_new_ex(struct dev_cgroup *dev_cgroup, |
9347 |
++ struct dev_exception_item *refex, |
9348 |
++ enum devcg_behavior behavior) |
9349 |
++{ |
9350 |
++ bool match = false; |
9351 |
++ |
9352 |
++ rcu_lockdep_assert(rcu_read_lock_held() || |
9353 |
++ lockdep_is_held(&devcgroup_mutex), |
9354 |
++ "device_cgroup:verify_new_ex called without proper synchronization"); |
9355 |
+ |
9356 |
+ if (dev_cgroup->behavior == DEVCG_DEFAULT_ALLOW) { |
9357 |
+ if (behavior == DEVCG_DEFAULT_ALLOW) { |
9358 |
+- /* the exception will deny access to certain devices */ |
9359 |
++ /* |
9360 |
++ * new exception in the child doesn't matter, only |
9361 |
++ * adding extra restrictions |
9362 |
++ */ |
9363 |
+ return true; |
9364 |
+ } else { |
9365 |
+- /* the exception will allow access to certain devices */ |
9366 |
++ /* |
9367 |
++ * new exception in the child will add more devices |
9368 |
++ * that can be acessed, so it can't match any of |
9369 |
++ * parent's exceptions, even slightly |
9370 |
++ */ |
9371 |
++ match = match_exception_partial(&dev_cgroup->exceptions, |
9372 |
++ refex->type, |
9373 |
++ refex->major, |
9374 |
++ refex->minor, |
9375 |
++ refex->access); |
9376 |
++ |
9377 |
+ if (match) |
9378 |
+- /* |
9379 |
+- * a new exception allowing access shouldn't |
9380 |
+- * match an parent's exception |
9381 |
+- */ |
9382 |
+ return false; |
9383 |
+ return true; |
9384 |
+ } |
9385 |
+ } else { |
9386 |
+- /* only behavior == DEVCG_DEFAULT_DENY allowed here */ |
9387 |
++ /* |
9388 |
++ * Only behavior == DEVCG_DEFAULT_DENY allowed here, therefore |
9389 |
++ * the new exception will add access to more devices and must |
9390 |
++ * be contained completely in an parent's exception to be |
9391 |
++ * allowed |
9392 |
++ */ |
9393 |
++ match = match_exception(&dev_cgroup->exceptions, refex->type, |
9394 |
++ refex->major, refex->minor, |
9395 |
++ refex->access); |
9396 |
++ |
9397 |
+ if (match) |
9398 |
+ /* parent has an exception that matches the proposed */ |
9399 |
+ return true; |
9400 |
+@@ -380,7 +462,38 @@ static int parent_has_perm(struct dev_cgroup *childcg, |
9401 |
+ |
9402 |
+ if (!parent) |
9403 |
+ return 1; |
9404 |
+- return may_access(parent, ex, childcg->behavior); |
9405 |
++ return verify_new_ex(parent, ex, childcg->behavior); |
9406 |
++} |
9407 |
++ |
9408 |
++/** |
9409 |
++ * parent_allows_removal - verify if it's ok to remove an exception |
9410 |
++ * @childcg: child cgroup from where the exception will be removed |
9411 |
++ * @ex: exception being removed |
9412 |
++ * |
9413 |
++ * When removing an exception in cgroups with default ALLOW policy, it must |
9414 |
++ * be checked if removing it will give the child cgroup more access than the |
9415 |
++ * parent. |
9416 |
++ * |
9417 |
++ * Return: true if it's ok to remove exception, false otherwise |
9418 |
++ */ |
9419 |
++static bool parent_allows_removal(struct dev_cgroup *childcg, |
9420 |
++ struct dev_exception_item *ex) |
9421 |
++{ |
9422 |
++ struct dev_cgroup *parent = css_to_devcgroup(css_parent(&childcg->css)); |
9423 |
++ |
9424 |
++ if (!parent) |
9425 |
++ return true; |
9426 |
++ |
9427 |
++ /* It's always allowed to remove access to devices */ |
9428 |
++ if (childcg->behavior == DEVCG_DEFAULT_DENY) |
9429 |
++ return true; |
9430 |
++ |
9431 |
++ /* |
9432 |
++ * Make sure you're not removing part or a whole exception existing in |
9433 |
++ * the parent cgroup |
9434 |
++ */ |
9435 |
++ return !match_exception_partial(&parent->exceptions, ex->type, |
9436 |
++ ex->major, ex->minor, ex->access); |
9437 |
+ } |
9438 |
+ |
9439 |
+ /** |
9440 |
+@@ -618,17 +731,21 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, |
9441 |
+ |
9442 |
+ switch (filetype) { |
9443 |
+ case DEVCG_ALLOW: |
9444 |
+- if (!parent_has_perm(devcgroup, &ex)) |
9445 |
+- return -EPERM; |
9446 |
+ /* |
9447 |
+ * If the default policy is to allow by default, try to remove |
9448 |
+ * an matching exception instead. And be silent about it: we |
9449 |
+ * don't want to break compatibility |
9450 |
+ */ |
9451 |
+ if (devcgroup->behavior == DEVCG_DEFAULT_ALLOW) { |
9452 |
++ /* Check if the parent allows removing it first */ |
9453 |
++ if (!parent_allows_removal(devcgroup, &ex)) |
9454 |
++ return -EPERM; |
9455 |
+ dev_exception_rm(devcgroup, &ex); |
9456 |
+- return 0; |
9457 |
++ break; |
9458 |
+ } |
9459 |
++ |
9460 |
++ if (!parent_has_perm(devcgroup, &ex)) |
9461 |
++ return -EPERM; |
9462 |
+ rc = dev_exception_add(devcgroup, &ex); |
9463 |
+ break; |
9464 |
+ case DEVCG_DENY: |
9465 |
+@@ -708,18 +825,18 @@ static int __devcgroup_check_permission(short type, u32 major, u32 minor, |
9466 |
+ short access) |
9467 |
+ { |
9468 |
+ struct dev_cgroup *dev_cgroup; |
9469 |
+- struct dev_exception_item ex; |
9470 |
+- int rc; |
9471 |
+- |
9472 |
+- memset(&ex, 0, sizeof(ex)); |
9473 |
+- ex.type = type; |
9474 |
+- ex.major = major; |
9475 |
+- ex.minor = minor; |
9476 |
+- ex.access = access; |
9477 |
++ bool rc; |
9478 |
+ |
9479 |
+ rcu_read_lock(); |
9480 |
+ dev_cgroup = task_devcgroup(current); |
9481 |
+- rc = may_access(dev_cgroup, &ex, dev_cgroup->behavior); |
9482 |
++ if (dev_cgroup->behavior == DEVCG_DEFAULT_ALLOW) |
9483 |
++ /* Can't match any of the exceptions, even partially */ |
9484 |
++ rc = !match_exception_partial(&dev_cgroup->exceptions, |
9485 |
++ type, major, minor, access); |
9486 |
++ else |
9487 |
++ /* Need to match completely one exception to be allowed */ |
9488 |
++ rc = match_exception(&dev_cgroup->exceptions, type, major, |
9489 |
++ minor, access); |
9490 |
+ rcu_read_unlock(); |
9491 |
+ |
9492 |
+ if (!rc) |
9493 |
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
9494 |
+index a8dec9e9e876..22f7883fcb9a 100644 |
9495 |
+--- a/sound/pci/hda/hda_intel.c |
9496 |
++++ b/sound/pci/hda/hda_intel.c |
9497 |
+@@ -3988,6 +3988,9 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { |
9498 |
+ /* Lynx Point */ |
9499 |
+ { PCI_DEVICE(0x8086, 0x8c20), |
9500 |
+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, |
9501 |
++ /* 9 Series */ |
9502 |
++ { PCI_DEVICE(0x8086, 0x8ca0), |
9503 |
++ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, |
9504 |
+ /* Wellsburg */ |
9505 |
+ { PCI_DEVICE(0x8086, 0x8d20), |
9506 |
+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, |
9507 |
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
9508 |
+index 5ef95034d041..ce5b339d9333 100644 |
9509 |
+--- a/sound/pci/hda/patch_hdmi.c |
9510 |
++++ b/sound/pci/hda/patch_hdmi.c |
9511 |
+@@ -1123,8 +1123,10 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, |
9512 |
+ AMP_OUT_UNMUTE); |
9513 |
+ |
9514 |
+ eld = &per_pin->sink_eld; |
9515 |
+- if (!eld->monitor_present) |
9516 |
++ if (!eld->monitor_present) { |
9517 |
++ hdmi_set_channel_count(codec, per_pin->cvt_nid, channels); |
9518 |
+ return; |
9519 |
++ } |
9520 |
+ |
9521 |
+ if (!non_pcm && per_pin->chmap_set) |
9522 |
+ ca = hdmi_manual_channel_allocation(channels, per_pin->chmap); |
9523 |
+diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c |
9524 |
+index 97db3b45b411..799348e9cdd0 100644 |
9525 |
+--- a/sound/soc/codecs/wm8962.c |
9526 |
++++ b/sound/soc/codecs/wm8962.c |
9527 |
+@@ -154,6 +154,7 @@ static struct reg_default wm8962_reg[] = { |
9528 |
+ { 40, 0x0000 }, /* R40 - SPKOUTL volume */ |
9529 |
+ { 41, 0x0000 }, /* R41 - SPKOUTR volume */ |
9530 |
+ |
9531 |
++ { 49, 0x0010 }, /* R49 - Class D Control 1 */ |
9532 |
+ { 51, 0x0003 }, /* R51 - Class D Control 2 */ |
9533 |
+ |
9534 |
+ { 56, 0x0506 }, /* R56 - Clocking 4 */ |
9535 |
+@@ -795,7 +796,6 @@ static bool wm8962_volatile_register(struct device *dev, unsigned int reg) |
9536 |
+ case WM8962_ALC2: |
9537 |
+ case WM8962_THERMAL_SHUTDOWN_STATUS: |
9538 |
+ case WM8962_ADDITIONAL_CONTROL_4: |
9539 |
+- case WM8962_CLASS_D_CONTROL_1: |
9540 |
+ case WM8962_DC_SERVO_6: |
9541 |
+ case WM8962_INTERRUPT_STATUS_1: |
9542 |
+ case WM8962_INTERRUPT_STATUS_2: |
9543 |
+@@ -2922,13 +2922,22 @@ static int wm8962_set_fll(struct snd_soc_codec *codec, int fll_id, int source, |
9544 |
+ static int wm8962_mute(struct snd_soc_dai *dai, int mute) |
9545 |
+ { |
9546 |
+ struct snd_soc_codec *codec = dai->codec; |
9547 |
+- int val; |
9548 |
++ int val, ret; |
9549 |
+ |
9550 |
+ if (mute) |
9551 |
+- val = WM8962_DAC_MUTE; |
9552 |
++ val = WM8962_DAC_MUTE | WM8962_DAC_MUTE_ALT; |
9553 |
+ else |
9554 |
+ val = 0; |
9555 |
+ |
9556 |
++ /** |
9557 |
++ * The DAC mute bit is mirrored in two registers, update both to keep |
9558 |
++ * the register cache consistent. |
9559 |
++ */ |
9560 |
++ ret = snd_soc_update_bits(codec, WM8962_CLASS_D_CONTROL_1, |
9561 |
++ WM8962_DAC_MUTE_ALT, val); |
9562 |
++ if (ret < 0) |
9563 |
++ return ret; |
9564 |
++ |
9565 |
+ return snd_soc_update_bits(codec, WM8962_ADC_DAC_CONTROL_1, |
9566 |
+ WM8962_DAC_MUTE, val); |
9567 |
+ } |
9568 |
+diff --git a/sound/soc/codecs/wm8962.h b/sound/soc/codecs/wm8962.h |
9569 |
+index a1a5d5294c19..910aafd09d21 100644 |
9570 |
+--- a/sound/soc/codecs/wm8962.h |
9571 |
++++ b/sound/soc/codecs/wm8962.h |
9572 |
+@@ -1954,6 +1954,10 @@ |
9573 |
+ #define WM8962_SPKOUTL_ENA_MASK 0x0040 /* SPKOUTL_ENA */ |
9574 |
+ #define WM8962_SPKOUTL_ENA_SHIFT 6 /* SPKOUTL_ENA */ |
9575 |
+ #define WM8962_SPKOUTL_ENA_WIDTH 1 /* SPKOUTL_ENA */ |
9576 |
++#define WM8962_DAC_MUTE_ALT 0x0010 /* DAC_MUTE */ |
9577 |
++#define WM8962_DAC_MUTE_ALT_MASK 0x0010 /* DAC_MUTE */ |
9578 |
++#define WM8962_DAC_MUTE_ALT_SHIFT 4 /* DAC_MUTE */ |
9579 |
++#define WM8962_DAC_MUTE_ALT_WIDTH 1 /* DAC_MUTE */ |
9580 |
+ #define WM8962_SPKOUTL_PGA_MUTE 0x0002 /* SPKOUTL_PGA_MUTE */ |
9581 |
+ #define WM8962_SPKOUTL_PGA_MUTE_MASK 0x0002 /* SPKOUTL_PGA_MUTE */ |
9582 |
+ #define WM8962_SPKOUTL_PGA_MUTE_SHIFT 1 /* SPKOUTL_PGA_MUTE */ |
9583 |
+diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c |
9584 |
+index 910223782c5c..c1369c3ad643 100644 |
9585 |
+--- a/sound/soc/soc-dapm.c |
9586 |
++++ b/sound/soc/soc-dapm.c |
9587 |
+@@ -3649,8 +3649,11 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card) |
9588 |
+ cpu_dai = rtd->cpu_dai; |
9589 |
+ codec_dai = rtd->codec_dai; |
9590 |
+ |
9591 |
+- /* dynamic FE links have no fixed DAI mapping */ |
9592 |
+- if (rtd->dai_link->dynamic) |
9593 |
++ /* |
9594 |
++ * dynamic FE links have no fixed DAI mapping. |
9595 |
++ * CODEC<->CODEC links have no direct connection. |
9596 |
++ */ |
9597 |
++ if (rtd->dai_link->dynamic || rtd->dai_link->params) |
9598 |
+ continue; |
9599 |
+ |
9600 |
+ /* there is no point in connecting BE DAI links with dummies */ |
9601 |
+diff --git a/sound/usb/card.h b/sound/usb/card.h |
9602 |
+index 9867ab866857..97acb906acc2 100644 |
9603 |
+--- a/sound/usb/card.h |
9604 |
++++ b/sound/usb/card.h |
9605 |
+@@ -92,6 +92,7 @@ struct snd_usb_endpoint { |
9606 |
+ unsigned int curframesize; /* current packet size in frames (for capture) */ |
9607 |
+ unsigned int syncmaxsize; /* sync endpoint packet size */ |
9608 |
+ unsigned int fill_max:1; /* fill max packet size always */ |
9609 |
++ unsigned int udh01_fb_quirk:1; /* corrupted feedback data */ |
9610 |
+ unsigned int datainterval; /* log_2 of data packet interval */ |
9611 |
+ unsigned int syncinterval; /* P for adaptive mode, 0 otherwise */ |
9612 |
+ unsigned char silence_value; |
9613 |
+diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c |
9614 |
+index 83aabea259d7..814430fec6a2 100644 |
9615 |
+--- a/sound/usb/endpoint.c |
9616 |
++++ b/sound/usb/endpoint.c |
9617 |
+@@ -469,6 +469,10 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip, |
9618 |
+ ep->syncinterval = 3; |
9619 |
+ |
9620 |
+ ep->syncmaxsize = le16_to_cpu(get_endpoint(alts, 1)->wMaxPacketSize); |
9621 |
++ |
9622 |
++ if (chip->usb_id == USB_ID(0x0644, 0x8038) /* TEAC UD-H01 */ && |
9623 |
++ ep->syncmaxsize == 4) |
9624 |
++ ep->udh01_fb_quirk = 1; |
9625 |
+ } |
9626 |
+ |
9627 |
+ list_add_tail(&ep->list, &chip->ep_list); |
9628 |
+@@ -1099,7 +1103,16 @@ void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep, |
9629 |
+ if (f == 0) |
9630 |
+ return; |
9631 |
+ |
9632 |
+- if (unlikely(ep->freqshift == INT_MIN)) { |
9633 |
++ if (unlikely(sender->udh01_fb_quirk)) { |
9634 |
++ /* |
9635 |
++ * The TEAC UD-H01 firmware sometimes changes the feedback value |
9636 |
++ * by +/- 0x1.0000. |
9637 |
++ */ |
9638 |
++ if (f < ep->freqn - 0x8000) |
9639 |
++ f += 0x10000; |
9640 |
++ else if (f > ep->freqn + 0x8000) |
9641 |
++ f -= 0x10000; |
9642 |
++ } else if (unlikely(ep->freqshift == INT_MIN)) { |
9643 |
+ /* |
9644 |
+ * The first time we see a feedback value, determine its format |
9645 |
+ * by shifting it left or right until it matches the nominal |
9646 |
|
9647 |
Deleted: genpatches-2.6/trunk/3.14/1501-futex-add-another-early-deadlock-detection-check.patch |
9648 |
=================================================================== |
9649 |
--- genpatches-2.6/trunk/3.14/1501-futex-add-another-early-deadlock-detection-check.patch 2014-06-06 20:06:46 UTC (rev 2814) |
9650 |
+++ genpatches-2.6/trunk/3.14/1501-futex-add-another-early-deadlock-detection-check.patch 2014-06-07 23:56:08 UTC (rev 2815) |
9651 |
@@ -1,160 +0,0 @@ |
9652 |
-From: Thomas Gleixner <tglx@××××××××××.de> |
9653 |
-Date: Mon, 12 May 2014 20:45:34 +0000 |
9654 |
-Subject: futex: Add another early deadlock detection check |
9655 |
-Git-commit: 866293ee54227584ffcb4a42f69c1f365974ba7f |
9656 |
- |
9657 |
-Dave Jones trinity syscall fuzzer exposed an issue in the deadlock |
9658 |
-detection code of rtmutex: |
9659 |
- http://lkml.kernel.org/r/20140429151655.GA14277@××××××.com |
9660 |
- |
9661 |
-That underlying issue has been fixed with a patch to the rtmutex code, |
9662 |
-but the futex code must not call into rtmutex in that case because |
9663 |
- - it can detect that issue early |
9664 |
- - it avoids a different and more complex fixup for backing out |
9665 |
- |
9666 |
-If the user space variable got manipulated to 0x80000000 which means |
9667 |
-no lock holder, but the waiters bit set and an active pi_state in the |
9668 |
-kernel is found we can figure out the recursive locking issue by |
9669 |
-looking at the pi_state owner. If that is the current task, then we |
9670 |
-can safely return -EDEADLK. |
9671 |
- |
9672 |
-The check should have been added in commit 59fa62451 (futex: Handle |
9673 |
-futex_pi OWNER_DIED take over correctly) already, but I did not see |
9674 |
-the above issue caused by user space manipulation back then. |
9675 |
- |
9676 |
-Signed-off-by: Thomas Gleixner <tglx@××××××××××.de> |
9677 |
-Cc: Dave Jones <davej@××××××.com> |
9678 |
-Cc: Linus Torvalds <torvalds@××××××××××××××××.org> |
9679 |
-Cc: Peter Zijlstra <peterz@×××××××××.org> |
9680 |
-Cc: Darren Hart <darren@××××××.com> |
9681 |
-Cc: Davidlohr Bueso <davidlohr@××.com> |
9682 |
-Cc: Steven Rostedt <rostedt@×××××××.org> |
9683 |
-Cc: Clark Williams <williams@××××××.com> |
9684 |
-Cc: Paul McKenney <paulmck@××××××××××××××.com> |
9685 |
-Cc: Lai Jiangshan <laijs@××××××××××.com> |
9686 |
-Cc: Roland McGrath <roland@×××××××××.com> |
9687 |
-Cc: Carlos ODonell <carlos@××××××.com> |
9688 |
-Cc: Jakub Jelinek <jakub@××××××.com> |
9689 |
-Cc: Michael Kerrisk <mtk.manpages@×××××.com> |
9690 |
-Cc: Sebastian Andrzej Siewior <bigeasy@××××××××××.de> |
9691 |
-Link: http://lkml.kernel.org/r/20140512201701.097349971@××××××××××.de |
9692 |
-Signed-off-by: Thomas Gleixner <tglx@××××××××××.de> |
9693 |
-Cc: stable@×××××××××××.org |
9694 |
---- |
9695 |
- kernel/futex.c | 47 ++++++++++++++++++++++++++++++++++------------- |
9696 |
- 1 file changed, 34 insertions(+), 13 deletions(-) |
9697 |
- |
9698 |
-Index: linux-3.12/kernel/futex.c |
9699 |
-=================================================================== |
9700 |
---- linux-3.12.orig/kernel/futex.c |
9701 |
-+++ linux-3.12/kernel/futex.c |
9702 |
-@@ -596,7 +596,8 @@ void exit_pi_state_list(struct task_stru |
9703 |
- |
9704 |
- static int |
9705 |
- lookup_pi_state(u32 uval, struct futex_hash_bucket *hb, |
9706 |
-- union futex_key *key, struct futex_pi_state **ps) |
9707 |
-+ union futex_key *key, struct futex_pi_state **ps, |
9708 |
-+ struct task_struct *task) |
9709 |
- { |
9710 |
- struct futex_pi_state *pi_state = NULL; |
9711 |
- struct futex_q *this, *next; |
9712 |
-@@ -640,6 +641,16 @@ lookup_pi_state(u32 uval, struct futex_h |
9713 |
- return -EINVAL; |
9714 |
- } |
9715 |
- |
9716 |
-+ /* |
9717 |
-+ * Protect against a corrupted uval. If uval |
9718 |
-+ * is 0x80000000 then pid is 0 and the waiter |
9719 |
-+ * bit is set. So the deadlock check in the |
9720 |
-+ * calling code has failed and we did not fall |
9721 |
-+ * into the check above due to !pid. |
9722 |
-+ */ |
9723 |
-+ if (task && pi_state->owner == task) |
9724 |
-+ return -EDEADLK; |
9725 |
-+ |
9726 |
- atomic_inc(&pi_state->refcount); |
9727 |
- *ps = pi_state; |
9728 |
- |
9729 |
-@@ -789,7 +800,7 @@ retry: |
9730 |
- * We dont have the lock. Look up the PI state (or create it if |
9731 |
- * we are the first waiter): |
9732 |
- */ |
9733 |
-- ret = lookup_pi_state(uval, hb, key, ps); |
9734 |
-+ ret = lookup_pi_state(uval, hb, key, ps, task); |
9735 |
- |
9736 |
- if (unlikely(ret)) { |
9737 |
- switch (ret) { |
9738 |
-@@ -1199,7 +1210,7 @@ void requeue_pi_wake_futex(struct futex_ |
9739 |
- * |
9740 |
- * Return: |
9741 |
- * 0 - failed to acquire the lock atomically; |
9742 |
-- * 1 - acquired the lock; |
9743 |
-+ * >0 - acquired the lock, return value is vpid of the top_waiter |
9744 |
- * <0 - error |
9745 |
- */ |
9746 |
- static int futex_proxy_trylock_atomic(u32 __user *pifutex, |
9747 |
-@@ -1210,7 +1221,7 @@ static int futex_proxy_trylock_atomic(u3 |
9748 |
- { |
9749 |
- struct futex_q *top_waiter = NULL; |
9750 |
- u32 curval; |
9751 |
-- int ret; |
9752 |
-+ int ret, vpid; |
9753 |
- |
9754 |
- if (get_futex_value_locked(&curval, pifutex)) |
9755 |
- return -EFAULT; |
9756 |
-@@ -1238,11 +1249,13 @@ static int futex_proxy_trylock_atomic(u3 |
9757 |
- * the contended case or if set_waiters is 1. The pi_state is returned |
9758 |
- * in ps in contended cases. |
9759 |
- */ |
9760 |
-+ vpid = task_pid_vnr(top_waiter->task); |
9761 |
- ret = futex_lock_pi_atomic(pifutex, hb2, key2, ps, top_waiter->task, |
9762 |
- set_waiters); |
9763 |
-- if (ret == 1) |
9764 |
-+ if (ret == 1) { |
9765 |
- requeue_pi_wake_futex(top_waiter, key2, hb2); |
9766 |
-- |
9767 |
-+ return vpid; |
9768 |
-+ } |
9769 |
- return ret; |
9770 |
- } |
9771 |
- |
9772 |
-@@ -1274,7 +1287,6 @@ static int futex_requeue(u32 __user *uad |
9773 |
- struct futex_hash_bucket *hb1, *hb2; |
9774 |
- struct plist_head *head1; |
9775 |
- struct futex_q *this, *next; |
9776 |
-- u32 curval2; |
9777 |
- |
9778 |
- if (requeue_pi) { |
9779 |
- /* |
9780 |
-@@ -1360,16 +1372,25 @@ retry_private: |
9781 |
- * At this point the top_waiter has either taken uaddr2 or is |
9782 |
- * waiting on it. If the former, then the pi_state will not |
9783 |
- * exist yet, look it up one more time to ensure we have a |
9784 |
-- * reference to it. |
9785 |
-+ * reference to it. If the lock was taken, ret contains the |
9786 |
-+ * vpid of the top waiter task. |
9787 |
- */ |
9788 |
-- if (ret == 1) { |
9789 |
-+ if (ret > 0) { |
9790 |
- WARN_ON(pi_state); |
9791 |
- drop_count++; |
9792 |
- task_count++; |
9793 |
-- ret = get_futex_value_locked(&curval2, uaddr2); |
9794 |
-- if (!ret) |
9795 |
-- ret = lookup_pi_state(curval2, hb2, &key2, |
9796 |
-- &pi_state); |
9797 |
-+ /* |
9798 |
-+ * If we acquired the lock, then the user |
9799 |
-+ * space value of uaddr2 should be vpid. It |
9800 |
-+ * cannot be changed by the top waiter as it |
9801 |
-+ * is blocked on hb2 lock if it tries to do |
9802 |
-+ * so. If something fiddled with it behind our |
9803 |
-+ * back the pi state lookup might unearth |
9804 |
-+ * it. So we rather use the known value than |
9805 |
-+ * rereading and handing potential crap to |
9806 |
-+ * lookup_pi_state. |
9807 |
-+ */ |
9808 |
-+ ret = lookup_pi_state(ret, hb2, &key2, &pi_state, NULL); |
9809 |
- } |
9810 |
- |
9811 |
- switch (ret) { |
9812 |
|
9813 |
Deleted: genpatches-2.6/trunk/3.14/1502-futex-prevent-attaching-to-kernel-threads.patch |
9814 |
=================================================================== |
9815 |
--- genpatches-2.6/trunk/3.14/1502-futex-prevent-attaching-to-kernel-threads.patch 2014-06-06 20:06:46 UTC (rev 2814) |
9816 |
+++ genpatches-2.6/trunk/3.14/1502-futex-prevent-attaching-to-kernel-threads.patch 2014-06-07 23:56:08 UTC (rev 2815) |
9817 |
@@ -1,52 +0,0 @@ |
9818 |
-From: Thomas Gleixner <tglx@××××××××××.de> |
9819 |
-Date: Mon, 12 May 2014 20:45:35 +0000 |
9820 |
-Subject: futex: Prevent attaching to kernel threads |
9821 |
-Git-commit: f0d71b3dcb8332f7971b5f2363632573e6d9486a |
9822 |
- |
9823 |
-We happily allow userspace to declare a random kernel thread to be the |
9824 |
-owner of a user space PI futex. |
9825 |
- |
9826 |
-Found while analysing the fallout of Dave Jones syscall fuzzer. |
9827 |
- |
9828 |
-We also should validate the thread group for private futexes and find |
9829 |
-some fast way to validate whether the "alleged" owner has RW access on |
9830 |
-the file which backs the SHM, but that's a separate issue. |
9831 |
- |
9832 |
-Signed-off-by: Thomas Gleixner <tglx@××××××××××.de> |
9833 |
-Cc: Dave Jones <davej@××××××.com> |
9834 |
-Cc: Linus Torvalds <torvalds@××××××××××××××××.org> |
9835 |
-Cc: Peter Zijlstra <peterz@×××××××××.org> |
9836 |
-Cc: Darren Hart <darren@××××××.com> |
9837 |
-Cc: Davidlohr Bueso <davidlohr@××.com> |
9838 |
-Cc: Steven Rostedt <rostedt@×××××××.org> |
9839 |
-Cc: Clark Williams <williams@××××××.com> |
9840 |
-Cc: Paul McKenney <paulmck@××××××××××××××.com> |
9841 |
-Cc: Lai Jiangshan <laijs@××××××××××.com> |
9842 |
-Cc: Roland McGrath <roland@×××××××××.com> |
9843 |
-Cc: Carlos ODonell <carlos@××××××.com> |
9844 |
-Cc: Jakub Jelinek <jakub@××××××.com> |
9845 |
-Cc: Michael Kerrisk <mtk.manpages@×××××.com> |
9846 |
-Cc: Sebastian Andrzej Siewior <bigeasy@××××××××××.de> |
9847 |
-Link: http://lkml.kernel.org/r/20140512201701.194824402@××××××××××.de |
9848 |
-Signed-off-by: Thomas Gleixner <tglx@××××××××××.de> |
9849 |
-Cc: stable@×××××××××××.org |
9850 |
---- |
9851 |
- kernel/futex.c | 5 +++++ |
9852 |
- 1 file changed, 5 insertions(+) |
9853 |
- |
9854 |
-Index: linux-3.12/kernel/futex.c |
9855 |
-=================================================================== |
9856 |
---- linux-3.12.orig/kernel/futex.c |
9857 |
-+++ linux-3.12/kernel/futex.c |
9858 |
-@@ -668,6 +668,11 @@ lookup_pi_state(u32 uval, struct futex_h |
9859 |
- if (!p) |
9860 |
- return -ESRCH; |
9861 |
- |
9862 |
-+ if (!p->mm) { |
9863 |
-+ put_task_struct(p); |
9864 |
-+ return -EPERM; |
9865 |
-+ } |
9866 |
-+ |
9867 |
- /* |
9868 |
- * We need to look at the task state flags to figure out, |
9869 |
- * whether the task is exiting. To protect against the do_exit |
9870 |
|
9871 |
Deleted: genpatches-2.6/trunk/3.14/1503-futex-prevent-requeue-pi-on-same-futex-patch-futex-forbid-uaddr-uaddr2-in-futex_requeue-requeue_pi-1.patch |
9872 |
=================================================================== |
9873 |
--- genpatches-2.6/trunk/3.14/1503-futex-prevent-requeue-pi-on-same-futex-patch-futex-forbid-uaddr-uaddr2-in-futex_requeue-requeue_pi-1.patch 2014-06-06 20:06:46 UTC (rev 2814) |
9874 |
+++ genpatches-2.6/trunk/3.14/1503-futex-prevent-requeue-pi-on-same-futex-patch-futex-forbid-uaddr-uaddr2-in-futex_requeue-requeue_pi-1.patch 2014-06-07 23:56:08 UTC (rev 2815) |
9875 |
@@ -1,81 +0,0 @@ |
9876 |
-From: Thomas Gleixner <tglx@××××××××××.de> |
9877 |
-Date: Tue, 3 Jun 2014 12:27:06 +0000 |
9878 |
-Subject: futex-prevent-requeue-pi-on-same-futex.patch futex: Forbid uaddr == |
9879 |
- uaddr2 in futex_requeue(..., requeue_pi=1) |
9880 |
-Git-commit: e9c243a5a6de0be8e584c604d353412584b592f8 |
9881 |
- |
9882 |
-If uaddr == uaddr2, then we have broken the rule of only requeueing from |
9883 |
-a non-pi futex to a pi futex with this call. If we attempt this, then |
9884 |
-dangling pointers may be left for rt_waiter resulting in an exploitable |
9885 |
-condition. |
9886 |
- |
9887 |
-This change brings futex_requeue() in line with futex_wait_requeue_pi() |
9888 |
-which performs the same check as per commit 6f7b0a2a5c0f ("futex: Forbid |
9889 |
-uaddr == uaddr2 in futex_wait_requeue_pi()") |
9890 |
- |
9891 |
-[ tglx: Compare the resulting keys as well, as uaddrs might be |
9892 |
- different depending on the mapping ] |
9893 |
- |
9894 |
-Fixes CVE-2014-3153. |
9895 |
- |
9896 |
-Reported-by: Pinkie Pie |
9897 |
-Signed-off-by: Will Drewry <wad@××××××××.org> |
9898 |
-Signed-off-by: Kees Cook <keescook@××××××××.org> |
9899 |
-Cc: stable@×××××××××××.org |
9900 |
-Signed-off-by: Thomas Gleixner <tglx@××××××××××.de> |
9901 |
-Reviewed-by: Darren Hart <dvhart@×××××××××××.com> |
9902 |
-Signed-off-by: Linus Torvalds <torvalds@××××××××××××××××.org> |
9903 |
---- |
9904 |
- kernel/futex.c | 25 +++++++++++++++++++++++++ |
9905 |
- 1 file changed, 25 insertions(+) |
9906 |
- |
9907 |
-Index: linux-3.12/kernel/futex.c |
9908 |
-=================================================================== |
9909 |
---- linux-3.12.orig/kernel/futex.c |
9910 |
-+++ linux-3.12/kernel/futex.c |
9911 |
-@@ -1295,6 +1295,13 @@ static int futex_requeue(u32 __user *uad |
9912 |
- |
9913 |
- if (requeue_pi) { |
9914 |
- /* |
9915 |
-+ * Requeue PI only works on two distinct uaddrs. This |
9916 |
-+ * check is only valid for private futexes. See below. |
9917 |
-+ */ |
9918 |
-+ if (uaddr1 == uaddr2) |
9919 |
-+ return -EINVAL; |
9920 |
-+ |
9921 |
-+ /* |
9922 |
- * requeue_pi requires a pi_state, try to allocate it now |
9923 |
- * without any locks in case it fails. |
9924 |
- */ |
9925 |
-@@ -1332,6 +1339,15 @@ retry: |
9926 |
- if (unlikely(ret != 0)) |
9927 |
- goto out_put_key1; |
9928 |
- |
9929 |
-+ /* |
9930 |
-+ * The check above which compares uaddrs is not sufficient for |
9931 |
-+ * shared futexes. We need to compare the keys: |
9932 |
-+ */ |
9933 |
-+ if (requeue_pi && match_futex(&key1, &key2)) { |
9934 |
-+ ret = -EINVAL; |
9935 |
-+ goto out_put_keys; |
9936 |
-+ } |
9937 |
-+ |
9938 |
- hb1 = hash_futex(&key1); |
9939 |
- hb2 = hash_futex(&key2); |
9940 |
- |
9941 |
-@@ -2362,6 +2378,15 @@ static int futex_wait_requeue_pi(u32 __u |
9942 |
- if (ret) |
9943 |
- goto out_key2; |
9944 |
- |
9945 |
-+ /* |
9946 |
-+ * The check above which compares uaddrs is not sufficient for |
9947 |
-+ * shared futexes. We need to compare the keys: |
9948 |
-+ */ |
9949 |
-+ if (match_futex(&q.key, &key2)) { |
9950 |
-+ ret = -EINVAL; |
9951 |
-+ goto out_put_keys; |
9952 |
-+ } |
9953 |
-+ |
9954 |
- /* Queue the futex_q, drop the hb lock, wait for wakeup. */ |
9955 |
- futex_wait_queue_me(hb, &q, to); |
9956 |
- |
9957 |
|
9958 |
Deleted: genpatches-2.6/trunk/3.14/1504-futex-validate-atomic-acquisition-in-futex_lock_pi_atomic.patch |
9959 |
=================================================================== |
9960 |
--- genpatches-2.6/trunk/3.14/1504-futex-validate-atomic-acquisition-in-futex_lock_pi_atomic.patch 2014-06-06 20:06:46 UTC (rev 2814) |
9961 |
+++ genpatches-2.6/trunk/3.14/1504-futex-validate-atomic-acquisition-in-futex_lock_pi_atomic.patch 2014-06-07 23:56:08 UTC (rev 2815) |
9962 |
@@ -1,53 +0,0 @@ |
9963 |
-From: Thomas Gleixner <tglx@××××××××××.de> |
9964 |
-Date: Tue, 3 Jun 2014 12:27:06 +0000 |
9965 |
-Subject: futex: Validate atomic acquisition in futex_lock_pi_atomic() |
9966 |
-Git-commit: b3eaa9fc5cd0a4d74b18f6b8dc617aeaf1873270 |
9967 |
- |
9968 |
-We need to protect the atomic acquisition in the kernel against rogue |
9969 |
-user space which sets the user space futex to 0, so the kernel side |
9970 |
-acquisition succeeds while there is existing state in the kernel |
9971 |
-associated to the real owner. |
9972 |
- |
9973 |
-Verify whether the futex has waiters associated with kernel state. If |
9974 |
-it has, return -EINVAL. The state is corrupted already, so no point in |
9975 |
-cleaning it up. Subsequent calls will fail as well. Not our problem. |
9976 |
- |
9977 |
-[ tglx: Use futex_top_waiter() and explain why we do not need to try |
9978 |
- restoring the already corrupted user space state. ] |
9979 |
- |
9980 |
-Signed-off-by: Darren Hart <dvhart@×××××××××××.com> |
9981 |
-Cc: Kees Cook <keescook@××××××××.org> |
9982 |
-Cc: Will Drewry <wad@××××××××.org> |
9983 |
-Cc: stable@×××××××××××.org |
9984 |
-Signed-off-by: Thomas Gleixner <tglx@××××××××××.de> |
9985 |
-Signed-off-by: Linus Torvalds <torvalds@××××××××××××××××.org> |
9986 |
---- |
9987 |
- kernel/futex.c | 14 +++++++++++--- |
9988 |
- 1 file changed, 11 insertions(+), 3 deletions(-) |
9989 |
- |
9990 |
-Index: linux-3.12/kernel/futex.c |
9991 |
-=================================================================== |
9992 |
---- linux-3.12.orig/kernel/futex.c |
9993 |
-+++ linux-3.12/kernel/futex.c |
9994 |
-@@ -764,10 +764,18 @@ retry: |
9995 |
- return -EDEADLK; |
9996 |
- |
9997 |
- /* |
9998 |
-- * Surprise - we got the lock. Just return to userspace: |
9999 |
-+ * Surprise - we got the lock, but we do not trust user space at all. |
10000 |
- */ |
10001 |
-- if (unlikely(!curval)) |
10002 |
-- return 1; |
10003 |
-+ if (unlikely(!curval)) { |
10004 |
-+ /* |
10005 |
-+ * We verify whether there is kernel state for this |
10006 |
-+ * futex. If not, we can safely assume, that the 0 -> |
10007 |
-+ * TID transition is correct. If state exists, we do |
10008 |
-+ * not bother to fixup the user space state as it was |
10009 |
-+ * corrupted already. |
10010 |
-+ */ |
10011 |
-+ return futex_top_waiter(hb, key) ? -EINVAL : 1; |
10012 |
-+ } |
10013 |
- |
10014 |
- uval = curval; |
10015 |
- |
10016 |
|
10017 |
Deleted: genpatches-2.6/trunk/3.14/1505-futex-always-cleanup-owner-tid-in-unlock_pi.patch |
10018 |
=================================================================== |
10019 |
--- genpatches-2.6/trunk/3.14/1505-futex-always-cleanup-owner-tid-in-unlock_pi.patch 2014-06-06 20:06:46 UTC (rev 2814) |
10020 |
+++ genpatches-2.6/trunk/3.14/1505-futex-always-cleanup-owner-tid-in-unlock_pi.patch 2014-06-07 23:56:08 UTC (rev 2815) |
10021 |
@@ -1,99 +0,0 @@ |
10022 |
-From: Thomas Gleixner <tglx@××××××××××.de> |
10023 |
-Date: Tue, 3 Jun 2014 12:27:07 +0000 |
10024 |
-Subject: futex: Always cleanup owner tid in unlock_pi |
10025 |
-Git-commit: 13fbca4c6ecd96ec1a1cfa2e4f2ce191fe928a5e |
10026 |
- |
10027 |
-If the owner died bit is set at futex_unlock_pi, we currently do not |
10028 |
-cleanup the user space futex. So the owner TID of the current owner |
10029 |
-(the unlocker) persists. That's observable inconsistant state, |
10030 |
-especially when the ownership of the pi state got transferred. |
10031 |
- |
10032 |
-Clean it up unconditionally. |
10033 |
- |
10034 |
-Signed-off-by: Thomas Gleixner <tglx@××××××××××.de> |
10035 |
-Cc: Kees Cook <keescook@××××××××.org> |
10036 |
-Cc: Will Drewry <wad@××××××××.org> |
10037 |
-Cc: Darren Hart <dvhart@×××××××××××.com> |
10038 |
-Cc: stable@×××××××××××.org |
10039 |
-Signed-off-by: Linus Torvalds <torvalds@××××××××××××××××.org> |
10040 |
---- |
10041 |
- kernel/futex.c | 40 ++++++++++++++++++---------------------- |
10042 |
- 1 file changed, 18 insertions(+), 22 deletions(-) |
10043 |
- |
10044 |
-Index: linux-3.12/kernel/futex.c |
10045 |
-=================================================================== |
10046 |
---- linux-3.12.orig/kernel/futex.c |
10047 |
-+++ linux-3.12/kernel/futex.c |
10048 |
-@@ -905,6 +905,7 @@ static int wake_futex_pi(u32 __user *uad |
10049 |
- struct task_struct *new_owner; |
10050 |
- struct futex_pi_state *pi_state = this->pi_state; |
10051 |
- u32 uninitialized_var(curval), newval; |
10052 |
-+ int ret = 0; |
10053 |
- |
10054 |
- if (!pi_state) |
10055 |
- return -EINVAL; |
10056 |
-@@ -928,23 +929,19 @@ static int wake_futex_pi(u32 __user *uad |
10057 |
- new_owner = this->task; |
10058 |
- |
10059 |
- /* |
10060 |
-- * We pass it to the next owner. (The WAITERS bit is always |
10061 |
-- * kept enabled while there is PI state around. We must also |
10062 |
-- * preserve the owner died bit.) |
10063 |
-- */ |
10064 |
-- if (!(uval & FUTEX_OWNER_DIED)) { |
10065 |
-- int ret = 0; |
10066 |
-- |
10067 |
-- newval = FUTEX_WAITERS | task_pid_vnr(new_owner); |
10068 |
-- |
10069 |
-- if (cmpxchg_futex_value_locked(&curval, uaddr, uval, newval)) |
10070 |
-- ret = -EFAULT; |
10071 |
-- else if (curval != uval) |
10072 |
-- ret = -EINVAL; |
10073 |
-- if (ret) { |
10074 |
-- raw_spin_unlock(&pi_state->pi_mutex.wait_lock); |
10075 |
-- return ret; |
10076 |
-- } |
10077 |
-+ * We pass it to the next owner. The WAITERS bit is always |
10078 |
-+ * kept enabled while there is PI state around. We cleanup the |
10079 |
-+ * owner died bit, because we are the owner. |
10080 |
-+ */ |
10081 |
-+ newval = FUTEX_WAITERS | task_pid_vnr(new_owner); |
10082 |
-+ |
10083 |
-+ if (cmpxchg_futex_value_locked(&curval, uaddr, uval, newval)) |
10084 |
-+ ret = -EFAULT; |
10085 |
-+ else if (curval != uval) |
10086 |
-+ ret = -EINVAL; |
10087 |
-+ if (ret) { |
10088 |
-+ raw_spin_unlock(&pi_state->pi_mutex.wait_lock); |
10089 |
-+ return ret; |
10090 |
- } |
10091 |
- |
10092 |
- raw_spin_lock_irq(&pi_state->owner->pi_lock); |
10093 |
-@@ -2189,9 +2186,10 @@ retry: |
10094 |
- /* |
10095 |
- * To avoid races, try to do the TID -> 0 atomic transition |
10096 |
- * again. If it succeeds then we can return without waking |
10097 |
-- * anyone else up: |
10098 |
-+ * anyone else up. We only try this if neither the waiters nor |
10099 |
-+ * the owner died bit are set. |
10100 |
- */ |
10101 |
-- if (!(uval & FUTEX_OWNER_DIED) && |
10102 |
-+ if (!(uval & ~FUTEX_TID_MASK) && |
10103 |
- cmpxchg_futex_value_locked(&uval, uaddr, vpid, 0)) |
10104 |
- goto pi_faulted; |
10105 |
- /* |
10106 |
-@@ -2223,11 +2221,9 @@ retry: |
10107 |
- /* |
10108 |
- * No waiters - kernel unlocks the futex: |
10109 |
- */ |
10110 |
-- if (!(uval & FUTEX_OWNER_DIED)) { |
10111 |
-- ret = unlock_futex_pi(uaddr, uval); |
10112 |
-- if (ret == -EFAULT) |
10113 |
-- goto pi_faulted; |
10114 |
-- } |
10115 |
-+ ret = unlock_futex_pi(uaddr, uval); |
10116 |
-+ if (ret == -EFAULT) |
10117 |
-+ goto pi_faulted; |
10118 |
- |
10119 |
- out_unlock: |
10120 |
- spin_unlock(&hb->lock); |
10121 |
|
10122 |
Deleted: genpatches-2.6/trunk/3.14/1506-futex-make-lookup_pi_state-more-robust.patch |
10123 |
=================================================================== |
10124 |
(Binary files differ) |