1 |
commit: d944130d7f18157ffd062622fe16340d4f456677 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Aug 22 23:28:53 2016 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Aug 22 23:28:53 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=d944130d |
7 |
|
8 |
Linux patch 4.1.31 |
9 |
|
10 |
0000_README | 4 + |
11 |
1030_linux-4.1.31.patch | 6882 +++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 6886 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index f04d74d..0ce7ab6 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -163,6 +163,10 @@ Patch: 1029_linux-4.1.30.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.1.30 |
21 |
|
22 |
+Patch: 1030_linux-4.1.31.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.1.31 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1030_linux-4.1.31.patch b/1030_linux-4.1.31.patch |
31 |
new file mode 100644 |
32 |
index 0000000..c3197a6 |
33 |
--- /dev/null |
34 |
+++ b/1030_linux-4.1.31.patch |
35 |
@@ -0,0 +1,6882 @@ |
36 |
+diff --git a/.mailmap b/.mailmap |
37 |
+index 6287004040e7..d4b4748bab36 100644 |
38 |
+--- a/.mailmap |
39 |
++++ b/.mailmap |
40 |
+@@ -80,6 +80,7 @@ Leonid I Ananiev <leonid.i.ananiev@×××××.com> |
41 |
+ Linas Vepstas <linas@××××××××××.com> |
42 |
+ Mark Brown <broonie@××××××××××.uk> |
43 |
+ Matthieu CASTET <castet.matthieu@××××.fr> |
44 |
++Mauro Carvalho Chehab <mchehab@××××××.org> <maurochehab@×××××.com> <mchehab@×××××××××.org> <mchehab@××××××.com> <m.chehab@×××××××.com> <mchehab@×××××××××××.com> <mchehab@××××××××××××.com> |
45 |
+ Mayuresh Janorkar <mayur@××.com> |
46 |
+ Michael Buesch <m@××××.ch> |
47 |
+ Michel Dänzer <michel@××××××××××××××××.com> |
48 |
+diff --git a/CREDITS b/CREDITS |
49 |
+index ec7e6c7fdd1b..a830a8622417 100644 |
50 |
+--- a/CREDITS |
51 |
++++ b/CREDITS |
52 |
+@@ -644,6 +644,7 @@ D: Configure, Menuconfig, xconfig |
53 |
+ |
54 |
+ N: Mauro Carvalho Chehab |
55 |
+ E: m.chehab@×××××××.org |
56 |
++E: mchehab@×××××××××××.com |
57 |
+ E: mchehab@×××××××××.org |
58 |
+ D: Media subsystem (V4L/DVB) drivers and core |
59 |
+ D: EDAC drivers and EDAC 3.0 core rework |
60 |
+diff --git a/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 b/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 |
61 |
+index 6708c5e264aa..33e96f740639 100644 |
62 |
+--- a/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 |
63 |
++++ b/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 |
64 |
+@@ -1,4 +1,4 @@ |
65 |
+-What /sys/bus/iio/devices/iio:deviceX/in_proximity_raw |
66 |
++What /sys/bus/iio/devices/iio:deviceX/in_proximity_input |
67 |
+ Date: March 2014 |
68 |
+ KernelVersion: 3.15 |
69 |
+ Contact: Matt Ranostay <mranostay@×××××.com> |
70 |
+diff --git a/Documentation/module-signing.txt b/Documentation/module-signing.txt |
71 |
+index c72702ec1ded..aacf1ce73b8a 100644 |
72 |
+--- a/Documentation/module-signing.txt |
73 |
++++ b/Documentation/module-signing.txt |
74 |
+@@ -239,3 +239,9 @@ Since the private key is used to sign modules, viruses and malware could use |
75 |
+ the private key to sign modules and compromise the operating system. The |
76 |
+ private key must be either destroyed or moved to a secure location and not kept |
77 |
+ in the root node of the kernel source tree. |
78 |
++ |
79 |
++If you use the same private key to sign modules for multiple kernel |
80 |
++configurations, you must ensure that the module version information is |
81 |
++sufficient to prevent loading a module into a different kernel. Either |
82 |
++set CONFIG_MODVERSIONS=y or ensure that each configuration has a different |
83 |
++kernel release string by changing EXTRAVERSION or CONFIG_LOCALVERSION. |
84 |
+diff --git a/MAINTAINERS b/MAINTAINERS |
85 |
+index a1d127a83a48..ecd0eb88f51a 100644 |
86 |
+--- a/MAINTAINERS |
87 |
++++ b/MAINTAINERS |
88 |
+@@ -1913,7 +1913,8 @@ F: include/net/ax25.h |
89 |
+ F: net/ax25/ |
90 |
+ |
91 |
+ AZ6007 DVB DRIVER |
92 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
93 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
94 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
95 |
+ L: linux-media@×××××××××××.org |
96 |
+ W: http://linuxtv.org |
97 |
+ T: git git://linuxtv.org/media_tree.git |
98 |
+@@ -2318,7 +2319,8 @@ F: Documentation/filesystems/btrfs.txt |
99 |
+ F: fs/btrfs/ |
100 |
+ |
101 |
+ BTTV VIDEO4LINUX DRIVER |
102 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
103 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
104 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
105 |
+ L: linux-media@×××××××××××.org |
106 |
+ W: http://linuxtv.org |
107 |
+ T: git git://linuxtv.org/media_tree.git |
108 |
+@@ -2882,7 +2884,8 @@ F: drivers/media/common/cx2341x* |
109 |
+ F: include/media/cx2341x* |
110 |
+ |
111 |
+ CX88 VIDEO4LINUX DRIVER |
112 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
113 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
114 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
115 |
+ L: linux-media@×××××××××××.org |
116 |
+ W: http://linuxtv.org |
117 |
+ T: git git://linuxtv.org/media_tree.git |
118 |
+@@ -3614,7 +3617,8 @@ F: fs/ecryptfs/ |
119 |
+ EDAC-CORE |
120 |
+ M: Doug Thompson <dougthompson@××××××××.com> |
121 |
+ M: Borislav Petkov <bp@××××××.de> |
122 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
123 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
124 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
125 |
+ L: linux-edac@×××××××××××.org |
126 |
+ W: bluesmoke.sourceforge.net |
127 |
+ T: git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git#for-next |
128 |
+@@ -3665,7 +3669,8 @@ S: Maintained |
129 |
+ F: drivers/edac/e7xxx_edac.c |
130 |
+ |
131 |
+ EDAC-GHES |
132 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
133 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
134 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
135 |
+ L: linux-edac@×××××××××××.org |
136 |
+ W: bluesmoke.sourceforge.net |
137 |
+ S: Maintained |
138 |
+@@ -3693,21 +3698,24 @@ S: Maintained |
139 |
+ F: drivers/edac/i5000_edac.c |
140 |
+ |
141 |
+ EDAC-I5400 |
142 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
143 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
144 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
145 |
+ L: linux-edac@×××××××××××.org |
146 |
+ W: bluesmoke.sourceforge.net |
147 |
+ S: Maintained |
148 |
+ F: drivers/edac/i5400_edac.c |
149 |
+ |
150 |
+ EDAC-I7300 |
151 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
152 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
153 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
154 |
+ L: linux-edac@×××××××××××.org |
155 |
+ W: bluesmoke.sourceforge.net |
156 |
+ S: Maintained |
157 |
+ F: drivers/edac/i7300_edac.c |
158 |
+ |
159 |
+ EDAC-I7CORE |
160 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
161 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
162 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
163 |
+ L: linux-edac@×××××××××××.org |
164 |
+ W: bluesmoke.sourceforge.net |
165 |
+ S: Maintained |
166 |
+@@ -3750,7 +3758,8 @@ S: Maintained |
167 |
+ F: drivers/edac/r82600_edac.c |
168 |
+ |
169 |
+ EDAC-SBRIDGE |
170 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
171 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
172 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
173 |
+ L: linux-edac@×××××××××××.org |
174 |
+ W: bluesmoke.sourceforge.net |
175 |
+ S: Maintained |
176 |
+@@ -3810,7 +3819,8 @@ S: Maintained |
177 |
+ F: drivers/net/ethernet/ibm/ehea/ |
178 |
+ |
179 |
+ EM28XX VIDEO4LINUX DRIVER |
180 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
181 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
182 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
183 |
+ L: linux-media@×××××××××××.org |
184 |
+ W: http://linuxtv.org |
185 |
+ T: git git://linuxtv.org/media_tree.git |
186 |
+@@ -6345,7 +6355,8 @@ S: Maintained |
187 |
+ F: drivers/media/radio/radio-maxiradio* |
188 |
+ |
189 |
+ MEDIA INPUT INFRASTRUCTURE (V4L/DVB) |
190 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
191 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
192 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
193 |
+ P: LinuxTV.org Project |
194 |
+ L: linux-media@×××××××××××.org |
195 |
+ W: http://linuxtv.org |
196 |
+@@ -8502,7 +8513,8 @@ S: Odd Fixes |
197 |
+ F: drivers/media/i2c/saa6588* |
198 |
+ |
199 |
+ SAA7134 VIDEO4LINUX DRIVER |
200 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
201 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
202 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
203 |
+ L: linux-media@×××××××××××.org |
204 |
+ W: http://linuxtv.org |
205 |
+ T: git git://linuxtv.org/media_tree.git |
206 |
+@@ -8947,7 +8959,8 @@ S: Maintained |
207 |
+ F: drivers/media/radio/si4713/radio-usb-si4713.c |
208 |
+ |
209 |
+ SIANO DVB DRIVER |
210 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
211 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
212 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
213 |
+ L: linux-media@×××××××××××.org |
214 |
+ W: http://linuxtv.org |
215 |
+ T: git git://linuxtv.org/media_tree.git |
216 |
+@@ -9695,7 +9708,8 @@ S: Maintained |
217 |
+ F: drivers/media/i2c/tda9840* |
218 |
+ |
219 |
+ TEA5761 TUNER DRIVER |
220 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
221 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
222 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
223 |
+ L: linux-media@×××××××××××.org |
224 |
+ W: http://linuxtv.org |
225 |
+ T: git git://linuxtv.org/media_tree.git |
226 |
+@@ -9703,7 +9717,8 @@ S: Odd fixes |
227 |
+ F: drivers/media/tuners/tea5761.* |
228 |
+ |
229 |
+ TEA5767 TUNER DRIVER |
230 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
231 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
232 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
233 |
+ L: linux-media@×××××××××××.org |
234 |
+ W: http://linuxtv.org |
235 |
+ T: git git://linuxtv.org/media_tree.git |
236 |
+@@ -10042,7 +10057,8 @@ F: include/linux/shmem_fs.h |
237 |
+ F: mm/shmem.c |
238 |
+ |
239 |
+ TM6000 VIDEO4LINUX DRIVER |
240 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
241 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
242 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
243 |
+ L: linux-media@×××××××××××.org |
244 |
+ W: http://linuxtv.org |
245 |
+ T: git git://linuxtv.org/media_tree.git |
246 |
+@@ -10900,7 +10916,8 @@ S: Maintained |
247 |
+ F: arch/x86/vdso/ |
248 |
+ |
249 |
+ XC2028/3028 TUNER DRIVER |
250 |
+-M: Mauro Carvalho Chehab <mchehab@×××××××××××.com> |
251 |
++M: Mauro Carvalho Chehab <mchehab@××××××××××××.com> |
252 |
++M: Mauro Carvalho Chehab <mchehab@××××××.org> |
253 |
+ L: linux-media@×××××××××××.org |
254 |
+ W: http://linuxtv.org |
255 |
+ T: git git://linuxtv.org/media_tree.git |
256 |
+diff --git a/Makefile b/Makefile |
257 |
+index 137679c0cc49..bea5ca2ca2b0 100644 |
258 |
+--- a/Makefile |
259 |
++++ b/Makefile |
260 |
+@@ -1,6 +1,6 @@ |
261 |
+ VERSION = 4 |
262 |
+ PATCHLEVEL = 1 |
263 |
+-SUBLEVEL = 30 |
264 |
++SUBLEVEL = 31 |
265 |
+ EXTRAVERSION = |
266 |
+ NAME = Series 4800 |
267 |
+ |
268 |
+diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h |
269 |
+index 9615fe1701c6..09c549826c5f 100644 |
270 |
+--- a/arch/arc/include/asm/pgtable.h |
271 |
++++ b/arch/arc/include/asm/pgtable.h |
272 |
+@@ -96,7 +96,7 @@ |
273 |
+ #define ___DEF (_PAGE_PRESENT | _PAGE_DEF_CACHEABLE) |
274 |
+ |
275 |
+ /* Set of bits not changed in pte_modify */ |
276 |
+-#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED) |
277 |
++#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED | _PAGE_SPECIAL) |
278 |
+ |
279 |
+ /* More Abbrevaited helpers */ |
280 |
+ #define PAGE_U_NONE __pgprot(___DEF) |
281 |
+diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts |
282 |
+index b67e5be618cf..28b6b0e46e63 100644 |
283 |
+--- a/arch/arm/boot/dts/sun4i-a10-a1000.dts |
284 |
++++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts |
285 |
+@@ -178,6 +178,7 @@ |
286 |
+ regulator-name = "emac-3v3"; |
287 |
+ regulator-min-microvolt = <3300000>; |
288 |
+ regulator-max-microvolt = <3300000>; |
289 |
++ startup-delay-us = <20000>; |
290 |
+ enable-active-high; |
291 |
+ gpio = <&pio 7 15 GPIO_ACTIVE_HIGH>; |
292 |
+ }; |
293 |
+diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts b/arch/arm/boot/dts/sun4i-a10-hackberry.dts |
294 |
+index d3f73ea25567..864acaa00c9e 100644 |
295 |
+--- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts |
296 |
++++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts |
297 |
+@@ -159,6 +159,7 @@ |
298 |
+ regulator-name = "emac-3v3"; |
299 |
+ regulator-min-microvolt = <3300000>; |
300 |
+ regulator-max-microvolt = <3300000>; |
301 |
++ startup-delay-us = <20000>; |
302 |
+ enable-active-high; |
303 |
+ gpio = <&pio 7 19 GPIO_ACTIVE_HIGH>; |
304 |
+ }; |
305 |
+diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h |
306 |
+index d4264bb0a409..7cc281d94769 100644 |
307 |
+--- a/arch/arm64/include/asm/ptrace.h |
308 |
++++ b/arch/arm64/include/asm/ptrace.h |
309 |
+@@ -58,6 +58,7 @@ |
310 |
+ #define COMPAT_PSR_Z_BIT 0x40000000 |
311 |
+ #define COMPAT_PSR_N_BIT 0x80000000 |
312 |
+ #define COMPAT_PSR_IT_MASK 0x0600fc00 /* If-Then execution state mask */ |
313 |
++#define COMPAT_PSR_GE_MASK 0x000f0000 |
314 |
+ |
315 |
+ #ifdef CONFIG_CPU_BIG_ENDIAN |
316 |
+ #define COMPAT_PSR_ENDSTATE COMPAT_PSR_E_BIT |
317 |
+@@ -116,6 +117,8 @@ struct pt_regs { |
318 |
+ }; |
319 |
+ u64 orig_x0; |
320 |
+ u64 syscallno; |
321 |
++ u64 orig_addr_limit; |
322 |
++ u64 unused; // maintain 16 byte alignment |
323 |
+ }; |
324 |
+ |
325 |
+ #define arch_has_single_step() (1) |
326 |
+@@ -151,35 +154,9 @@ static inline unsigned long regs_return_value(struct pt_regs *regs) |
327 |
+ return regs->regs[0]; |
328 |
+ } |
329 |
+ |
330 |
+-/* |
331 |
+- * Are the current registers suitable for user mode? (used to maintain |
332 |
+- * security in signal handlers) |
333 |
+- */ |
334 |
+-static inline int valid_user_regs(struct user_pt_regs *regs) |
335 |
+-{ |
336 |
+- if (user_mode(regs) && (regs->pstate & PSR_I_BIT) == 0) { |
337 |
+- regs->pstate &= ~(PSR_F_BIT | PSR_A_BIT); |
338 |
+- |
339 |
+- /* The T bit is reserved for AArch64 */ |
340 |
+- if (!(regs->pstate & PSR_MODE32_BIT)) |
341 |
+- regs->pstate &= ~COMPAT_PSR_T_BIT; |
342 |
+- |
343 |
+- return 1; |
344 |
+- } |
345 |
+- |
346 |
+- /* |
347 |
+- * Force PSR to something logical... |
348 |
+- */ |
349 |
+- regs->pstate &= PSR_f | PSR_s | (PSR_x & ~PSR_A_BIT) | \ |
350 |
+- COMPAT_PSR_T_BIT | PSR_MODE32_BIT; |
351 |
+- |
352 |
+- if (!(regs->pstate & PSR_MODE32_BIT)) { |
353 |
+- regs->pstate &= ~COMPAT_PSR_T_BIT; |
354 |
+- regs->pstate |= PSR_MODE_EL0t; |
355 |
+- } |
356 |
+- |
357 |
+- return 0; |
358 |
+-} |
359 |
++/* We must avoid circular header include via sched.h */ |
360 |
++struct task_struct; |
361 |
++int valid_user_regs(struct user_pt_regs *regs, struct task_struct *task); |
362 |
+ |
363 |
+ #define instruction_pointer(regs) ((unsigned long)(regs)->pc) |
364 |
+ |
365 |
+diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c |
366 |
+index da675cc5dfae..4106ac64f95e 100644 |
367 |
+--- a/arch/arm64/kernel/asm-offsets.c |
368 |
++++ b/arch/arm64/kernel/asm-offsets.c |
369 |
+@@ -58,6 +58,7 @@ int main(void) |
370 |
+ DEFINE(S_PC, offsetof(struct pt_regs, pc)); |
371 |
+ DEFINE(S_ORIG_X0, offsetof(struct pt_regs, orig_x0)); |
372 |
+ DEFINE(S_SYSCALLNO, offsetof(struct pt_regs, syscallno)); |
373 |
++ DEFINE(S_ORIG_ADDR_LIMIT, offsetof(struct pt_regs, orig_addr_limit)); |
374 |
+ DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs)); |
375 |
+ BLANK(); |
376 |
+ DEFINE(MM_CONTEXT_ID, offsetof(struct mm_struct, context.id)); |
377 |
+diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c |
378 |
+index 0d1d675f2cce..00ced919fa5a 100644 |
379 |
+--- a/arch/arm64/kernel/debug-monitors.c |
380 |
++++ b/arch/arm64/kernel/debug-monitors.c |
381 |
+@@ -150,7 +150,6 @@ static int debug_monitors_init(void) |
382 |
+ /* Clear the OS lock. */ |
383 |
+ on_each_cpu(clear_os_lock, NULL, 1); |
384 |
+ isb(); |
385 |
+- local_dbg_enable(); |
386 |
+ |
387 |
+ /* Register hotplug handler. */ |
388 |
+ __register_cpu_notifier(&os_lock_nb); |
389 |
+diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S |
390 |
+index bddd04d031db..05012cdb555f 100644 |
391 |
+--- a/arch/arm64/kernel/entry.S |
392 |
++++ b/arch/arm64/kernel/entry.S |
393 |
+@@ -27,6 +27,7 @@ |
394 |
+ #include <asm/cpufeature.h> |
395 |
+ #include <asm/errno.h> |
396 |
+ #include <asm/esr.h> |
397 |
++#include <asm/memory.h> |
398 |
+ #include <asm/thread_info.h> |
399 |
+ #include <asm/unistd.h> |
400 |
+ |
401 |
+@@ -93,7 +94,13 @@ |
402 |
+ disable_step_tsk x19, x20 // exceptions when scheduling. |
403 |
+ .else |
404 |
+ add x21, sp, #S_FRAME_SIZE |
405 |
+- .endif |
406 |
++ get_thread_info tsk |
407 |
++ /* Save the task's original addr_limit and set USER_DS (TASK_SIZE_64) */ |
408 |
++ ldr x20, [tsk, #TI_ADDR_LIMIT] |
409 |
++ str x20, [sp, #S_ORIG_ADDR_LIMIT] |
410 |
++ mov x20, #TASK_SIZE_64 |
411 |
++ str x20, [tsk, #TI_ADDR_LIMIT] |
412 |
++ .endif /* \el == 0 */ |
413 |
+ mrs x22, elr_el1 |
414 |
+ mrs x23, spsr_el1 |
415 |
+ stp lr, x21, [sp, #S_LR] |
416 |
+@@ -117,6 +124,12 @@ |
417 |
+ .endm |
418 |
+ |
419 |
+ .macro kernel_exit, el, ret = 0 |
420 |
++ .if \el != 0 |
421 |
++ /* Restore the task's original addr_limit. */ |
422 |
++ ldr x20, [sp, #S_ORIG_ADDR_LIMIT] |
423 |
++ str x20, [tsk, #TI_ADDR_LIMIT] |
424 |
++ .endif |
425 |
++ |
426 |
+ ldp x21, x22, [sp, #S_PC] // load ELR, SPSR |
427 |
+ .if \el == 0 |
428 |
+ ct_user_enter |
429 |
+diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c |
430 |
+index 608ac6aa497b..7038b9a3b42c 100644 |
431 |
+--- a/arch/arm64/kernel/ptrace.c |
432 |
++++ b/arch/arm64/kernel/ptrace.c |
433 |
+@@ -39,6 +39,7 @@ |
434 |
+ #include <linux/elf.h> |
435 |
+ |
436 |
+ #include <asm/compat.h> |
437 |
++#include <asm/cpufeature.h> |
438 |
+ #include <asm/debug-monitors.h> |
439 |
+ #include <asm/pgtable.h> |
440 |
+ #include <asm/syscall.h> |
441 |
+@@ -500,7 +501,7 @@ static int gpr_set(struct task_struct *target, const struct user_regset *regset, |
442 |
+ if (ret) |
443 |
+ return ret; |
444 |
+ |
445 |
+- if (!valid_user_regs(&newregs)) |
446 |
++ if (!valid_user_regs(&newregs, target)) |
447 |
+ return -EINVAL; |
448 |
+ |
449 |
+ task_pt_regs(target)->user_regs = newregs; |
450 |
+@@ -770,7 +771,7 @@ static int compat_gpr_set(struct task_struct *target, |
451 |
+ |
452 |
+ } |
453 |
+ |
454 |
+- if (valid_user_regs(&newregs.user_regs)) |
455 |
++ if (valid_user_regs(&newregs.user_regs, target)) |
456 |
+ *task_pt_regs(target) = newregs; |
457 |
+ else |
458 |
+ ret = -EINVAL; |
459 |
+@@ -1182,3 +1183,79 @@ asmlinkage void syscall_trace_exit(struct pt_regs *regs) |
460 |
+ if (test_thread_flag(TIF_SYSCALL_TRACE)) |
461 |
+ tracehook_report_syscall(regs, PTRACE_SYSCALL_EXIT); |
462 |
+ } |
463 |
++ |
464 |
++/* |
465 |
++ * Bits which are always architecturally RES0 per ARM DDI 0487A.h |
466 |
++ * Userspace cannot use these until they have an architectural meaning. |
467 |
++ * We also reserve IL for the kernel; SS is handled dynamically. |
468 |
++ */ |
469 |
++#define SPSR_EL1_AARCH64_RES0_BITS \ |
470 |
++ (GENMASK_ULL(63,32) | GENMASK_ULL(27, 22) | GENMASK_ULL(20, 10) | \ |
471 |
++ GENMASK_ULL(5, 5)) |
472 |
++#define SPSR_EL1_AARCH32_RES0_BITS \ |
473 |
++ (GENMASK_ULL(63,32) | GENMASK_ULL(24, 22) | GENMASK_ULL(20,20)) |
474 |
++ |
475 |
++static int valid_compat_regs(struct user_pt_regs *regs) |
476 |
++{ |
477 |
++ regs->pstate &= ~SPSR_EL1_AARCH32_RES0_BITS; |
478 |
++ |
479 |
++ if (!system_supports_mixed_endian_el0()) { |
480 |
++ if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) |
481 |
++ regs->pstate |= COMPAT_PSR_E_BIT; |
482 |
++ else |
483 |
++ regs->pstate &= ~COMPAT_PSR_E_BIT; |
484 |
++ } |
485 |
++ |
486 |
++ if (user_mode(regs) && (regs->pstate & PSR_MODE32_BIT) && |
487 |
++ (regs->pstate & COMPAT_PSR_A_BIT) == 0 && |
488 |
++ (regs->pstate & COMPAT_PSR_I_BIT) == 0 && |
489 |
++ (regs->pstate & COMPAT_PSR_F_BIT) == 0) { |
490 |
++ return 1; |
491 |
++ } |
492 |
++ |
493 |
++ /* |
494 |
++ * Force PSR to a valid 32-bit EL0t, preserving the same bits as |
495 |
++ * arch/arm. |
496 |
++ */ |
497 |
++ regs->pstate &= COMPAT_PSR_N_BIT | COMPAT_PSR_Z_BIT | |
498 |
++ COMPAT_PSR_C_BIT | COMPAT_PSR_V_BIT | |
499 |
++ COMPAT_PSR_Q_BIT | COMPAT_PSR_IT_MASK | |
500 |
++ COMPAT_PSR_GE_MASK | COMPAT_PSR_E_BIT | |
501 |
++ COMPAT_PSR_T_BIT; |
502 |
++ regs->pstate |= PSR_MODE32_BIT; |
503 |
++ |
504 |
++ return 0; |
505 |
++} |
506 |
++ |
507 |
++static int valid_native_regs(struct user_pt_regs *regs) |
508 |
++{ |
509 |
++ regs->pstate &= ~SPSR_EL1_AARCH64_RES0_BITS; |
510 |
++ |
511 |
++ if (user_mode(regs) && !(regs->pstate & PSR_MODE32_BIT) && |
512 |
++ (regs->pstate & PSR_D_BIT) == 0 && |
513 |
++ (regs->pstate & PSR_A_BIT) == 0 && |
514 |
++ (regs->pstate & PSR_I_BIT) == 0 && |
515 |
++ (regs->pstate & PSR_F_BIT) == 0) { |
516 |
++ return 1; |
517 |
++ } |
518 |
++ |
519 |
++ /* Force PSR to a valid 64-bit EL0t */ |
520 |
++ regs->pstate &= PSR_N_BIT | PSR_Z_BIT | PSR_C_BIT | PSR_V_BIT; |
521 |
++ |
522 |
++ return 0; |
523 |
++} |
524 |
++ |
525 |
++/* |
526 |
++ * Are the current registers suitable for user mode? (used to maintain |
527 |
++ * security in signal handlers) |
528 |
++ */ |
529 |
++int valid_user_regs(struct user_pt_regs *regs, struct task_struct *task) |
530 |
++{ |
531 |
++ if (!test_tsk_thread_flag(task, TIF_SINGLESTEP)) |
532 |
++ regs->pstate &= ~DBG_SPSR_SS; |
533 |
++ |
534 |
++ if (is_compat_thread(task_thread_info(task))) |
535 |
++ return valid_compat_regs(regs); |
536 |
++ else |
537 |
++ return valid_native_regs(regs); |
538 |
++} |
539 |
+diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c |
540 |
+index e18c48cb6db1..a8eafdbc7cb8 100644 |
541 |
+--- a/arch/arm64/kernel/signal.c |
542 |
++++ b/arch/arm64/kernel/signal.c |
543 |
+@@ -115,7 +115,7 @@ static int restore_sigframe(struct pt_regs *regs, |
544 |
+ */ |
545 |
+ regs->syscallno = ~0UL; |
546 |
+ |
547 |
+- err |= !valid_user_regs(®s->user_regs); |
548 |
++ err |= !valid_user_regs(®s->user_regs, current); |
549 |
+ |
550 |
+ if (err == 0) { |
551 |
+ struct fpsimd_context *fpsimd_ctx = |
552 |
+@@ -307,7 +307,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) |
553 |
+ /* |
554 |
+ * Check that the resulting registers are actually sane. |
555 |
+ */ |
556 |
+- ret |= !valid_user_regs(®s->user_regs); |
557 |
++ ret |= !valid_user_regs(®s->user_regs, current); |
558 |
+ |
559 |
+ /* |
560 |
+ * Fast forward the stepping logic so we step into the signal |
561 |
+diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c |
562 |
+index c58aee062590..bb3ba4aab30a 100644 |
563 |
+--- a/arch/arm64/kernel/signal32.c |
564 |
++++ b/arch/arm64/kernel/signal32.c |
565 |
+@@ -356,7 +356,7 @@ static int compat_restore_sigframe(struct pt_regs *regs, |
566 |
+ */ |
567 |
+ regs->syscallno = ~0UL; |
568 |
+ |
569 |
+- err |= !valid_user_regs(®s->user_regs); |
570 |
++ err |= !valid_user_regs(®s->user_regs, current); |
571 |
+ |
572 |
+ aux = (struct compat_aux_sigframe __user *) sf->uc.uc_regspace; |
573 |
+ if (err == 0) |
574 |
+diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c |
575 |
+index d3a202b85ba6..edf73a6e16a8 100644 |
576 |
+--- a/arch/arm64/kernel/smp.c |
577 |
++++ b/arch/arm64/kernel/smp.c |
578 |
+@@ -179,7 +179,6 @@ asmlinkage void secondary_start_kernel(void) |
579 |
+ set_cpu_online(cpu, true); |
580 |
+ complete(&cpu_running); |
581 |
+ |
582 |
+- local_dbg_enable(); |
583 |
+ local_irq_enable(); |
584 |
+ local_async_enable(); |
585 |
+ |
586 |
+diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S |
587 |
+index d253908a988d..262c8ec55790 100644 |
588 |
+--- a/arch/arm64/mm/proc.S |
589 |
++++ b/arch/arm64/mm/proc.S |
590 |
+@@ -205,6 +205,8 @@ ENTRY(__cpu_setup) |
591 |
+ msr cpacr_el1, x0 // Enable FP/ASIMD |
592 |
+ mov x0, #1 << 12 // Reset mdscr_el1 and disable |
593 |
+ msr mdscr_el1, x0 // access to the DCC from EL0 |
594 |
++ isb // Unmask debug exceptions now, |
595 |
++ enable_dbg // since this is per-cpu |
596 |
+ reset_pmuserenr_el0 x0 // Disable PMU access from EL0 |
597 |
+ /* |
598 |
+ * Memory region attributes for LPAE: |
599 |
+diff --git a/arch/metag/include/asm/cmpxchg_lnkget.h b/arch/metag/include/asm/cmpxchg_lnkget.h |
600 |
+index 0154e2807ebb..2369ad394876 100644 |
601 |
+--- a/arch/metag/include/asm/cmpxchg_lnkget.h |
602 |
++++ b/arch/metag/include/asm/cmpxchg_lnkget.h |
603 |
+@@ -73,7 +73,7 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old, |
604 |
+ " DCACHE [%2], %0\n" |
605 |
+ #endif |
606 |
+ "2:\n" |
607 |
+- : "=&d" (temp), "=&da" (retval) |
608 |
++ : "=&d" (temp), "=&d" (retval) |
609 |
+ : "da" (m), "bd" (old), "da" (new) |
610 |
+ : "cc" |
611 |
+ ); |
612 |
+diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c |
613 |
+index e5ed7ada1433..3a317e1ede71 100644 |
614 |
+--- a/arch/mips/kernel/csrc-r4k.c |
615 |
++++ b/arch/mips/kernel/csrc-r4k.c |
616 |
+@@ -23,7 +23,7 @@ static struct clocksource clocksource_mips = { |
617 |
+ .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
618 |
+ }; |
619 |
+ |
620 |
+-static u64 notrace r4k_read_sched_clock(void) |
621 |
++static u64 __maybe_unused notrace r4k_read_sched_clock(void) |
622 |
+ { |
623 |
+ return read_c0_count(); |
624 |
+ } |
625 |
+@@ -38,7 +38,9 @@ int __init init_r4k_clocksource(void) |
626 |
+ |
627 |
+ clocksource_register_hz(&clocksource_mips, mips_hpt_frequency); |
628 |
+ |
629 |
++#ifndef CONFIG_CPU_FREQ |
630 |
+ sched_clock_register(r4k_read_sched_clock, 32, mips_hpt_frequency); |
631 |
++#endif |
632 |
+ |
633 |
+ return 0; |
634 |
+ } |
635 |
+diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S |
636 |
+index 4b2010654c46..97fa4c7b9a5e 100644 |
637 |
+--- a/arch/mips/kernel/scall64-n32.S |
638 |
++++ b/arch/mips/kernel/scall64-n32.S |
639 |
+@@ -353,7 +353,7 @@ EXPORT(sysn32_call_table) |
640 |
+ PTR sys_ni_syscall /* available, was setaltroot */ |
641 |
+ PTR sys_add_key |
642 |
+ PTR sys_request_key |
643 |
+- PTR sys_keyctl /* 6245 */ |
644 |
++ PTR compat_sys_keyctl /* 6245 */ |
645 |
+ PTR sys_set_thread_area |
646 |
+ PTR sys_inotify_init |
647 |
+ PTR sys_inotify_add_watch |
648 |
+diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S |
649 |
+index d07b210fbeff..80e39776e377 100644 |
650 |
+--- a/arch/mips/kernel/scall64-o32.S |
651 |
++++ b/arch/mips/kernel/scall64-o32.S |
652 |
+@@ -492,7 +492,7 @@ EXPORT(sys32_call_table) |
653 |
+ PTR sys_ni_syscall /* available, was setaltroot */ |
654 |
+ PTR sys_add_key /* 4280 */ |
655 |
+ PTR sys_request_key |
656 |
+- PTR sys_keyctl |
657 |
++ PTR compat_sys_keyctl |
658 |
+ PTR sys_set_thread_area |
659 |
+ PTR sys_inotify_init |
660 |
+ PTR sys_inotify_add_watch /* 4285 */ |
661 |
+diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c |
662 |
+index dc10c77b7500..d6476d11212e 100644 |
663 |
+--- a/arch/mips/kvm/emulate.c |
664 |
++++ b/arch/mips/kvm/emulate.c |
665 |
+@@ -1629,8 +1629,14 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, |
666 |
+ |
667 |
+ preempt_disable(); |
668 |
+ if (KVM_GUEST_KSEGX(va) == KVM_GUEST_KSEG0) { |
669 |
+- if (kvm_mips_host_tlb_lookup(vcpu, va) < 0) |
670 |
+- kvm_mips_handle_kseg0_tlb_fault(va, vcpu); |
671 |
++ if (kvm_mips_host_tlb_lookup(vcpu, va) < 0 && |
672 |
++ kvm_mips_handle_kseg0_tlb_fault(va, vcpu)) { |
673 |
++ kvm_err("%s: handling mapped kseg0 tlb fault for %lx, vcpu: %p, ASID: %#lx\n", |
674 |
++ __func__, va, vcpu, read_c0_entryhi()); |
675 |
++ er = EMULATE_FAIL; |
676 |
++ preempt_enable(); |
677 |
++ goto done; |
678 |
++ } |
679 |
+ } else if ((KVM_GUEST_KSEGX(va) < KVM_GUEST_KSEG0) || |
680 |
+ KVM_GUEST_KSEGX(va) == KVM_GUEST_KSEG23) { |
681 |
+ int index; |
682 |
+@@ -1665,14 +1671,19 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, |
683 |
+ run, vcpu); |
684 |
+ preempt_enable(); |
685 |
+ goto dont_update_pc; |
686 |
+- } else { |
687 |
+- /* |
688 |
+- * We fault an entry from the guest tlb to the |
689 |
+- * shadow host TLB |
690 |
+- */ |
691 |
+- kvm_mips_handle_mapped_seg_tlb_fault(vcpu, tlb, |
692 |
+- NULL, |
693 |
+- NULL); |
694 |
++ } |
695 |
++ /* |
696 |
++ * We fault an entry from the guest tlb to the |
697 |
++ * shadow host TLB |
698 |
++ */ |
699 |
++ if (kvm_mips_handle_mapped_seg_tlb_fault(vcpu, tlb, |
700 |
++ NULL, NULL)) { |
701 |
++ kvm_err("%s: handling mapped seg tlb fault for %lx, index: %u, vcpu: %p, ASID: %#lx\n", |
702 |
++ __func__, va, index, vcpu, |
703 |
++ read_c0_entryhi()); |
704 |
++ er = EMULATE_FAIL; |
705 |
++ preempt_enable(); |
706 |
++ goto done; |
707 |
+ } |
708 |
+ } |
709 |
+ } else { |
710 |
+@@ -2633,8 +2644,13 @@ enum emulation_result kvm_mips_handle_tlbmiss(unsigned long cause, |
711 |
+ * OK we have a Guest TLB entry, now inject it into the |
712 |
+ * shadow host TLB |
713 |
+ */ |
714 |
+- kvm_mips_handle_mapped_seg_tlb_fault(vcpu, tlb, NULL, |
715 |
+- NULL); |
716 |
++ if (kvm_mips_handle_mapped_seg_tlb_fault(vcpu, tlb, |
717 |
++ NULL, NULL)) { |
718 |
++ kvm_err("%s: handling mapped seg tlb fault for %lx, index: %u, vcpu: %p, ASID: %#lx\n", |
719 |
++ __func__, va, index, vcpu, |
720 |
++ read_c0_entryhi()); |
721 |
++ er = EMULATE_FAIL; |
722 |
++ } |
723 |
+ } |
724 |
+ } |
725 |
+ |
726 |
+diff --git a/arch/mips/kvm/tlb.c b/arch/mips/kvm/tlb.c |
727 |
+index aed0ac2a4972..7a7ed9ca01bb 100644 |
728 |
+--- a/arch/mips/kvm/tlb.c |
729 |
++++ b/arch/mips/kvm/tlb.c |
730 |
+@@ -276,7 +276,7 @@ int kvm_mips_handle_kseg0_tlb_fault(unsigned long badvaddr, |
731 |
+ } |
732 |
+ |
733 |
+ gfn = (KVM_GUEST_CPHYSADDR(badvaddr) >> PAGE_SHIFT); |
734 |
+- if (gfn >= kvm->arch.guest_pmap_npages) { |
735 |
++ if ((gfn | 1) >= kvm->arch.guest_pmap_npages) { |
736 |
+ kvm_err("%s: Invalid gfn: %#llx, BadVaddr: %#lx\n", __func__, |
737 |
+ gfn, badvaddr); |
738 |
+ kvm_mips_dump_host_tlbs(); |
739 |
+@@ -361,25 +361,39 @@ int kvm_mips_handle_mapped_seg_tlb_fault(struct kvm_vcpu *vcpu, |
740 |
+ unsigned long entryhi = 0, entrylo0 = 0, entrylo1 = 0; |
741 |
+ struct kvm *kvm = vcpu->kvm; |
742 |
+ pfn_t pfn0, pfn1; |
743 |
+- |
744 |
+- if ((tlb->tlb_hi & VPN2_MASK) == 0) { |
745 |
+- pfn0 = 0; |
746 |
+- pfn1 = 0; |
747 |
+- } else { |
748 |
+- if (kvm_mips_map_page(kvm, mips3_tlbpfn_to_paddr(tlb->tlb_lo0) |
749 |
+- >> PAGE_SHIFT) < 0) |
750 |
+- return -1; |
751 |
+- |
752 |
+- if (kvm_mips_map_page(kvm, mips3_tlbpfn_to_paddr(tlb->tlb_lo1) |
753 |
+- >> PAGE_SHIFT) < 0) |
754 |
+- return -1; |
755 |
+- |
756 |
+- pfn0 = kvm->arch.guest_pmap[mips3_tlbpfn_to_paddr(tlb->tlb_lo0) |
757 |
+- >> PAGE_SHIFT]; |
758 |
+- pfn1 = kvm->arch.guest_pmap[mips3_tlbpfn_to_paddr(tlb->tlb_lo1) |
759 |
+- >> PAGE_SHIFT]; |
760 |
++ gfn_t gfn0, gfn1; |
761 |
++ long tlb_lo[2]; |
762 |
++ |
763 |
++ tlb_lo[0] = tlb->tlb_lo0; |
764 |
++ tlb_lo[1] = tlb->tlb_lo1; |
765 |
++ |
766 |
++ /* |
767 |
++ * The commpage address must not be mapped to anything else if the guest |
768 |
++ * TLB contains entries nearby, or commpage accesses will break. |
769 |
++ */ |
770 |
++ if (!((tlb->tlb_hi ^ KVM_GUEST_COMMPAGE_ADDR) & |
771 |
++ VPN2_MASK & (PAGE_MASK << 1))) |
772 |
++ tlb_lo[(KVM_GUEST_COMMPAGE_ADDR >> PAGE_SHIFT) & 1] = 0; |
773 |
++ |
774 |
++ gfn0 = mips3_tlbpfn_to_paddr(tlb_lo[0]) >> PAGE_SHIFT; |
775 |
++ gfn1 = mips3_tlbpfn_to_paddr(tlb_lo[1]) >> PAGE_SHIFT; |
776 |
++ if (gfn0 >= kvm->arch.guest_pmap_npages || |
777 |
++ gfn1 >= kvm->arch.guest_pmap_npages) { |
778 |
++ kvm_err("%s: Invalid gfn: [%#llx, %#llx], EHi: %#lx\n", |
779 |
++ __func__, gfn0, gfn1, tlb->tlb_hi); |
780 |
++ kvm_mips_dump_guest_tlbs(vcpu); |
781 |
++ return -1; |
782 |
+ } |
783 |
+ |
784 |
++ if (kvm_mips_map_page(kvm, gfn0) < 0) |
785 |
++ return -1; |
786 |
++ |
787 |
++ if (kvm_mips_map_page(kvm, gfn1) < 0) |
788 |
++ return -1; |
789 |
++ |
790 |
++ pfn0 = kvm->arch.guest_pmap[gfn0]; |
791 |
++ pfn1 = kvm->arch.guest_pmap[gfn1]; |
792 |
++ |
793 |
+ if (hpa0) |
794 |
+ *hpa0 = pfn0 << PAGE_SHIFT; |
795 |
+ |
796 |
+@@ -391,9 +405,9 @@ int kvm_mips_handle_mapped_seg_tlb_fault(struct kvm_vcpu *vcpu, |
797 |
+ kvm_mips_get_kernel_asid(vcpu) : |
798 |
+ kvm_mips_get_user_asid(vcpu)); |
799 |
+ entrylo0 = mips3_paddr_to_tlbpfn(pfn0 << PAGE_SHIFT) | (0x3 << 3) | |
800 |
+- (tlb->tlb_lo0 & MIPS3_PG_D) | (tlb->tlb_lo0 & MIPS3_PG_V); |
801 |
++ (tlb_lo[0] & MIPS3_PG_D) | (tlb_lo[0] & MIPS3_PG_V); |
802 |
+ entrylo1 = mips3_paddr_to_tlbpfn(pfn1 << PAGE_SHIFT) | (0x3 << 3) | |
803 |
+- (tlb->tlb_lo1 & MIPS3_PG_D) | (tlb->tlb_lo1 & MIPS3_PG_V); |
804 |
++ (tlb_lo[1] & MIPS3_PG_D) | (tlb_lo[1] & MIPS3_PG_V); |
805 |
+ |
806 |
+ kvm_debug("@ %#lx tlb_lo0: 0x%08lx tlb_lo1: 0x%08lx\n", vcpu->arch.pc, |
807 |
+ tlb->tlb_lo0, tlb->tlb_lo1); |
808 |
+@@ -794,10 +808,16 @@ uint32_t kvm_get_inst(uint32_t *opc, struct kvm_vcpu *vcpu) |
809 |
+ local_irq_restore(flags); |
810 |
+ return KVM_INVALID_INST; |
811 |
+ } |
812 |
+- kvm_mips_handle_mapped_seg_tlb_fault(vcpu, |
813 |
+- &vcpu->arch. |
814 |
+- guest_tlb[index], |
815 |
+- NULL, NULL); |
816 |
++ if (kvm_mips_handle_mapped_seg_tlb_fault(vcpu, |
817 |
++ &vcpu->arch.guest_tlb[index], |
818 |
++ NULL, NULL)) { |
819 |
++ kvm_err("%s: handling mapped seg tlb fault failed for %p, index: %u, vcpu: %p, ASID: %#lx\n", |
820 |
++ __func__, opc, index, vcpu, |
821 |
++ read_c0_entryhi()); |
822 |
++ kvm_mips_dump_guest_tlbs(vcpu); |
823 |
++ local_irq_restore(flags); |
824 |
++ return KVM_INVALID_INST; |
825 |
++ } |
826 |
+ inst = *(opc); |
827 |
+ } |
828 |
+ local_irq_restore(flags); |
829 |
+diff --git a/arch/mips/mm/uasm-mips.c b/arch/mips/mm/uasm-mips.c |
830 |
+index b4a837893562..5abe51cad899 100644 |
831 |
+--- a/arch/mips/mm/uasm-mips.c |
832 |
++++ b/arch/mips/mm/uasm-mips.c |
833 |
+@@ -65,7 +65,7 @@ static struct insn insn_table[] = { |
834 |
+ #ifndef CONFIG_CPU_MIPSR6 |
835 |
+ { insn_cache, M(cache_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
836 |
+ #else |
837 |
+- { insn_cache, M6(cache_op, 0, 0, 0, cache6_op), RS | RT | SIMM9 }, |
838 |
++ { insn_cache, M6(spec3_op, 0, 0, 0, cache6_op), RS | RT | SIMM9 }, |
839 |
+ #endif |
840 |
+ { insn_daddiu, M(daddiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
841 |
+ { insn_daddu, M(spec_op, 0, 0, 0, 0, daddu_op), RS | RT | RD }, |
842 |
+diff --git a/arch/powerpc/kernel/tm.S b/arch/powerpc/kernel/tm.S |
843 |
+index 5754b226da7e..521aef95e6b7 100644 |
844 |
+--- a/arch/powerpc/kernel/tm.S |
845 |
++++ b/arch/powerpc/kernel/tm.S |
846 |
+@@ -110,17 +110,11 @@ _GLOBAL(tm_reclaim) |
847 |
+ std r3, STK_PARAM(R3)(r1) |
848 |
+ SAVE_NVGPRS(r1) |
849 |
+ |
850 |
+- /* We need to setup MSR for VSX register save instructions. Here we |
851 |
+- * also clear the MSR RI since when we do the treclaim, we won't have a |
852 |
+- * valid kernel pointer for a while. We clear RI here as it avoids |
853 |
+- * adding another mtmsr closer to the treclaim. This makes the region |
854 |
+- * maked as non-recoverable wider than it needs to be but it saves on |
855 |
+- * inserting another mtmsrd later. |
856 |
+- */ |
857 |
++ /* We need to setup MSR for VSX register save instructions. */ |
858 |
+ mfmsr r14 |
859 |
+ mr r15, r14 |
860 |
+ ori r15, r15, MSR_FP |
861 |
+- li r16, MSR_RI |
862 |
++ li r16, 0 |
863 |
+ ori r16, r16, MSR_EE /* IRQs hard off */ |
864 |
+ andc r15, r15, r16 |
865 |
+ oris r15, r15, MSR_VEC@h |
866 |
+@@ -176,7 +170,17 @@ dont_backup_fp: |
867 |
+ 1: tdeqi r6, 0 |
868 |
+ EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,0 |
869 |
+ |
870 |
+- /* The moment we treclaim, ALL of our GPRs will switch |
871 |
++ /* Clear MSR RI since we are about to change r1, EE is already off. */ |
872 |
++ li r4, 0 |
873 |
++ mtmsrd r4, 1 |
874 |
++ |
875 |
++ /* |
876 |
++ * BE CAREFUL HERE: |
877 |
++ * At this point we can't take an SLB miss since we have MSR_RI |
878 |
++ * off. Load only to/from the stack/paca which are in SLB bolted regions |
879 |
++ * until we turn MSR RI back on. |
880 |
++ * |
881 |
++ * The moment we treclaim, ALL of our GPRs will switch |
882 |
+ * to user register state. (FPRs, CCR etc. also!) |
883 |
+ * Use an sprg and a tm_scratch in the PACA to shuffle. |
884 |
+ */ |
885 |
+@@ -197,6 +201,11 @@ dont_backup_fp: |
886 |
+ |
887 |
+ /* Store the PPR in r11 and reset to decent value */ |
888 |
+ std r11, GPR11(r1) /* Temporary stash */ |
889 |
++ |
890 |
++ /* Reset MSR RI so we can take SLB faults again */ |
891 |
++ li r11, MSR_RI |
892 |
++ mtmsrd r11, 1 |
893 |
++ |
894 |
+ mfspr r11, SPRN_PPR |
895 |
+ HMT_MEDIUM |
896 |
+ |
897 |
+@@ -329,8 +338,6 @@ _GLOBAL(__tm_recheckpoint) |
898 |
+ */ |
899 |
+ subi r7, r7, STACK_FRAME_OVERHEAD |
900 |
+ |
901 |
+- SET_SCRATCH0(r1) |
902 |
+- |
903 |
+ mfmsr r6 |
904 |
+ /* R4 = original MSR to indicate whether thread used FP/Vector etc. */ |
905 |
+ |
906 |
+@@ -397,11 +404,6 @@ restore_gprs: |
907 |
+ ld r5, THREAD_TM_DSCR(r3) |
908 |
+ ld r6, THREAD_TM_PPR(r3) |
909 |
+ |
910 |
+- /* Clear the MSR RI since we are about to change R1. EE is already off |
911 |
+- */ |
912 |
+- li r4, 0 |
913 |
+- mtmsrd r4, 1 |
914 |
+- |
915 |
+ REST_GPR(0, r7) /* GPR0 */ |
916 |
+ REST_2GPRS(2, r7) /* GPR2-3 */ |
917 |
+ REST_GPR(4, r7) /* GPR4 */ |
918 |
+@@ -439,10 +441,34 @@ restore_gprs: |
919 |
+ ld r6, _CCR(r7) |
920 |
+ mtcr r6 |
921 |
+ |
922 |
+- REST_GPR(1, r7) /* GPR1 */ |
923 |
+- REST_GPR(5, r7) /* GPR5-7 */ |
924 |
+ REST_GPR(6, r7) |
925 |
+- ld r7, GPR7(r7) |
926 |
++ |
927 |
++ /* |
928 |
++ * Store r1 and r5 on the stack so that we can access them |
929 |
++ * after we clear MSR RI. |
930 |
++ */ |
931 |
++ |
932 |
++ REST_GPR(5, r7) |
933 |
++ std r5, -8(r1) |
934 |
++ ld r5, GPR1(r7) |
935 |
++ std r5, -16(r1) |
936 |
++ |
937 |
++ REST_GPR(7, r7) |
938 |
++ |
939 |
++ /* Clear MSR RI since we are about to change r1. EE is already off */ |
940 |
++ li r5, 0 |
941 |
++ mtmsrd r5, 1 |
942 |
++ |
943 |
++ /* |
944 |
++ * BE CAREFUL HERE: |
945 |
++ * At this point we can't take an SLB miss since we have MSR_RI |
946 |
++ * off. Load only to/from the stack/paca which are in SLB bolted regions |
947 |
++ * until we turn MSR RI back on. |
948 |
++ */ |
949 |
++ |
950 |
++ SET_SCRATCH0(r1) |
951 |
++ ld r5, -8(r1) |
952 |
++ ld r1, -16(r1) |
953 |
+ |
954 |
+ /* Commit register state as checkpointed state: */ |
955 |
+ TRECHKPT |
956 |
+diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S |
957 |
+index a34e43eec658..11d82b91aa4f 100644 |
958 |
+--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S |
959 |
++++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S |
960 |
+@@ -570,112 +570,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) |
961 |
+ |
962 |
+ #ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
963 |
+ BEGIN_FTR_SECTION |
964 |
+- b skip_tm |
965 |
+-END_FTR_SECTION_IFCLR(CPU_FTR_TM) |
966 |
+- |
967 |
+- /* Turn on TM/FP/VSX/VMX so we can restore them. */ |
968 |
+- mfmsr r5 |
969 |
+- li r6, MSR_TM >> 32 |
970 |
+- sldi r6, r6, 32 |
971 |
+- or r5, r5, r6 |
972 |
+- ori r5, r5, MSR_FP |
973 |
+- oris r5, r5, (MSR_VEC | MSR_VSX)@h |
974 |
+- mtmsrd r5 |
975 |
+- |
976 |
+- /* |
977 |
+- * The user may change these outside of a transaction, so they must |
978 |
+- * always be context switched. |
979 |
+- */ |
980 |
+- ld r5, VCPU_TFHAR(r4) |
981 |
+- ld r6, VCPU_TFIAR(r4) |
982 |
+- ld r7, VCPU_TEXASR(r4) |
983 |
+- mtspr SPRN_TFHAR, r5 |
984 |
+- mtspr SPRN_TFIAR, r6 |
985 |
+- mtspr SPRN_TEXASR, r7 |
986 |
+- |
987 |
+- ld r5, VCPU_MSR(r4) |
988 |
+- rldicl. r5, r5, 64 - MSR_TS_S_LG, 62 |
989 |
+- beq skip_tm /* TM not active in guest */ |
990 |
+- |
991 |
+- /* Make sure the failure summary is set, otherwise we'll program check |
992 |
+- * when we trechkpt. It's possible that this might have been not set |
993 |
+- * on a kvmppc_set_one_reg() call but we shouldn't let this crash the |
994 |
+- * host. |
995 |
+- */ |
996 |
+- oris r7, r7, (TEXASR_FS)@h |
997 |
+- mtspr SPRN_TEXASR, r7 |
998 |
+- |
999 |
+- /* |
1000 |
+- * We need to load up the checkpointed state for the guest. |
1001 |
+- * We need to do this early as it will blow away any GPRs, VSRs and |
1002 |
+- * some SPRs. |
1003 |
+- */ |
1004 |
+- |
1005 |
+- mr r31, r4 |
1006 |
+- addi r3, r31, VCPU_FPRS_TM |
1007 |
+- bl load_fp_state |
1008 |
+- addi r3, r31, VCPU_VRS_TM |
1009 |
+- bl load_vr_state |
1010 |
+- mr r4, r31 |
1011 |
+- lwz r7, VCPU_VRSAVE_TM(r4) |
1012 |
+- mtspr SPRN_VRSAVE, r7 |
1013 |
+- |
1014 |
+- ld r5, VCPU_LR_TM(r4) |
1015 |
+- lwz r6, VCPU_CR_TM(r4) |
1016 |
+- ld r7, VCPU_CTR_TM(r4) |
1017 |
+- ld r8, VCPU_AMR_TM(r4) |
1018 |
+- ld r9, VCPU_TAR_TM(r4) |
1019 |
+- mtlr r5 |
1020 |
+- mtcr r6 |
1021 |
+- mtctr r7 |
1022 |
+- mtspr SPRN_AMR, r8 |
1023 |
+- mtspr SPRN_TAR, r9 |
1024 |
+- |
1025 |
+- /* |
1026 |
+- * Load up PPR and DSCR values but don't put them in the actual SPRs |
1027 |
+- * till the last moment to avoid running with userspace PPR and DSCR for |
1028 |
+- * too long. |
1029 |
+- */ |
1030 |
+- ld r29, VCPU_DSCR_TM(r4) |
1031 |
+- ld r30, VCPU_PPR_TM(r4) |
1032 |
+- |
1033 |
+- std r2, PACATMSCRATCH(r13) /* Save TOC */ |
1034 |
+- |
1035 |
+- /* Clear the MSR RI since r1, r13 are all going to be foobar. */ |
1036 |
+- li r5, 0 |
1037 |
+- mtmsrd r5, 1 |
1038 |
+- |
1039 |
+- /* Load GPRs r0-r28 */ |
1040 |
+- reg = 0 |
1041 |
+- .rept 29 |
1042 |
+- ld reg, VCPU_GPRS_TM(reg)(r31) |
1043 |
+- reg = reg + 1 |
1044 |
+- .endr |
1045 |
+- |
1046 |
+- mtspr SPRN_DSCR, r29 |
1047 |
+- mtspr SPRN_PPR, r30 |
1048 |
+- |
1049 |
+- /* Load final GPRs */ |
1050 |
+- ld 29, VCPU_GPRS_TM(29)(r31) |
1051 |
+- ld 30, VCPU_GPRS_TM(30)(r31) |
1052 |
+- ld 31, VCPU_GPRS_TM(31)(r31) |
1053 |
+- |
1054 |
+- /* TM checkpointed state is now setup. All GPRs are now volatile. */ |
1055 |
+- TRECHKPT |
1056 |
+- |
1057 |
+- /* Now let's get back the state we need. */ |
1058 |
+- HMT_MEDIUM |
1059 |
+- GET_PACA(r13) |
1060 |
+- ld r29, HSTATE_DSCR(r13) |
1061 |
+- mtspr SPRN_DSCR, r29 |
1062 |
+- ld r4, HSTATE_KVM_VCPU(r13) |
1063 |
+- ld r1, HSTATE_HOST_R1(r13) |
1064 |
+- ld r2, PACATMSCRATCH(r13) |
1065 |
+- |
1066 |
+- /* Set the MSR RI since we have our registers back. */ |
1067 |
+- li r5, MSR_RI |
1068 |
+- mtmsrd r5, 1 |
1069 |
+-skip_tm: |
1070 |
++ bl kvmppc_restore_tm |
1071 |
++END_FTR_SECTION_IFSET(CPU_FTR_TM) |
1072 |
+ #endif |
1073 |
+ |
1074 |
+ /* Load guest PMU registers */ |
1075 |
+@@ -756,12 +652,6 @@ BEGIN_FTR_SECTION |
1076 |
+ /* Skip next section on POWER7 */ |
1077 |
+ b 8f |
1078 |
+ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) |
1079 |
+- /* Turn on TM so we can access TFHAR/TFIAR/TEXASR */ |
1080 |
+- mfmsr r8 |
1081 |
+- li r0, 1 |
1082 |
+- rldimi r8, r0, MSR_TM_LG, 63-MSR_TM_LG |
1083 |
+- mtmsrd r8 |
1084 |
+- |
1085 |
+ /* Load up POWER8-specific registers */ |
1086 |
+ ld r5, VCPU_IAMR(r4) |
1087 |
+ lwz r6, VCPU_PSPB(r4) |
1088 |
+@@ -1339,106 +1229,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) |
1089 |
+ |
1090 |
+ #ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
1091 |
+ BEGIN_FTR_SECTION |
1092 |
+- b 2f |
1093 |
+-END_FTR_SECTION_IFCLR(CPU_FTR_TM) |
1094 |
+- /* Turn on TM. */ |
1095 |
+- mfmsr r8 |
1096 |
+- li r0, 1 |
1097 |
+- rldimi r8, r0, MSR_TM_LG, 63-MSR_TM_LG |
1098 |
+- mtmsrd r8 |
1099 |
+- |
1100 |
+- ld r5, VCPU_MSR(r9) |
1101 |
+- rldicl. r5, r5, 64 - MSR_TS_S_LG, 62 |
1102 |
+- beq 1f /* TM not active in guest. */ |
1103 |
+- |
1104 |
+- li r3, TM_CAUSE_KVM_RESCHED |
1105 |
+- |
1106 |
+- /* Clear the MSR RI since r1, r13 are all going to be foobar. */ |
1107 |
+- li r5, 0 |
1108 |
+- mtmsrd r5, 1 |
1109 |
+- |
1110 |
+- /* All GPRs are volatile at this point. */ |
1111 |
+- TRECLAIM(R3) |
1112 |
+- |
1113 |
+- /* Temporarily store r13 and r9 so we have some regs to play with */ |
1114 |
+- SET_SCRATCH0(r13) |
1115 |
+- GET_PACA(r13) |
1116 |
+- std r9, PACATMSCRATCH(r13) |
1117 |
+- ld r9, HSTATE_KVM_VCPU(r13) |
1118 |
+- |
1119 |
+- /* Get a few more GPRs free. */ |
1120 |
+- std r29, VCPU_GPRS_TM(29)(r9) |
1121 |
+- std r30, VCPU_GPRS_TM(30)(r9) |
1122 |
+- std r31, VCPU_GPRS_TM(31)(r9) |
1123 |
+- |
1124 |
+- /* Save away PPR and DSCR soon so don't run with user values. */ |
1125 |
+- mfspr r31, SPRN_PPR |
1126 |
+- HMT_MEDIUM |
1127 |
+- mfspr r30, SPRN_DSCR |
1128 |
+- ld r29, HSTATE_DSCR(r13) |
1129 |
+- mtspr SPRN_DSCR, r29 |
1130 |
+- |
1131 |
+- /* Save all but r9, r13 & r29-r31 */ |
1132 |
+- reg = 0 |
1133 |
+- .rept 29 |
1134 |
+- .if (reg != 9) && (reg != 13) |
1135 |
+- std reg, VCPU_GPRS_TM(reg)(r9) |
1136 |
+- .endif |
1137 |
+- reg = reg + 1 |
1138 |
+- .endr |
1139 |
+- /* ... now save r13 */ |
1140 |
+- GET_SCRATCH0(r4) |
1141 |
+- std r4, VCPU_GPRS_TM(13)(r9) |
1142 |
+- /* ... and save r9 */ |
1143 |
+- ld r4, PACATMSCRATCH(r13) |
1144 |
+- std r4, VCPU_GPRS_TM(9)(r9) |
1145 |
+- |
1146 |
+- /* Reload stack pointer and TOC. */ |
1147 |
+- ld r1, HSTATE_HOST_R1(r13) |
1148 |
+- ld r2, PACATOC(r13) |
1149 |
+- |
1150 |
+- /* Set MSR RI now we have r1 and r13 back. */ |
1151 |
+- li r5, MSR_RI |
1152 |
+- mtmsrd r5, 1 |
1153 |
+- |
1154 |
+- /* Save away checkpinted SPRs. */ |
1155 |
+- std r31, VCPU_PPR_TM(r9) |
1156 |
+- std r30, VCPU_DSCR_TM(r9) |
1157 |
+- mflr r5 |
1158 |
+- mfcr r6 |
1159 |
+- mfctr r7 |
1160 |
+- mfspr r8, SPRN_AMR |
1161 |
+- mfspr r10, SPRN_TAR |
1162 |
+- std r5, VCPU_LR_TM(r9) |
1163 |
+- stw r6, VCPU_CR_TM(r9) |
1164 |
+- std r7, VCPU_CTR_TM(r9) |
1165 |
+- std r8, VCPU_AMR_TM(r9) |
1166 |
+- std r10, VCPU_TAR_TM(r9) |
1167 |
+- |
1168 |
+- /* Restore r12 as trap number. */ |
1169 |
+- lwz r12, VCPU_TRAP(r9) |
1170 |
+- |
1171 |
+- /* Save FP/VSX. */ |
1172 |
+- addi r3, r9, VCPU_FPRS_TM |
1173 |
+- bl store_fp_state |
1174 |
+- addi r3, r9, VCPU_VRS_TM |
1175 |
+- bl store_vr_state |
1176 |
+- mfspr r6, SPRN_VRSAVE |
1177 |
+- stw r6, VCPU_VRSAVE_TM(r9) |
1178 |
+-1: |
1179 |
+- /* |
1180 |
+- * We need to save these SPRs after the treclaim so that the software |
1181 |
+- * error code is recorded correctly in the TEXASR. Also the user may |
1182 |
+- * change these outside of a transaction, so they must always be |
1183 |
+- * context switched. |
1184 |
+- */ |
1185 |
+- mfspr r5, SPRN_TFHAR |
1186 |
+- mfspr r6, SPRN_TFIAR |
1187 |
+- mfspr r7, SPRN_TEXASR |
1188 |
+- std r5, VCPU_TFHAR(r9) |
1189 |
+- std r6, VCPU_TFIAR(r9) |
1190 |
+- std r7, VCPU_TEXASR(r9) |
1191 |
+-2: |
1192 |
++ bl kvmppc_save_tm |
1193 |
++END_FTR_SECTION_IFSET(CPU_FTR_TM) |
1194 |
+ #endif |
1195 |
+ |
1196 |
+ /* Increment yield count if they have a VPA */ |
1197 |
+@@ -2139,6 +1931,13 @@ _GLOBAL(kvmppc_h_cede) /* r3 = vcpu pointer, r11 = msr, r13 = paca */ |
1198 |
+ /* save FP state */ |
1199 |
+ bl kvmppc_save_fp |
1200 |
+ |
1201 |
++#ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
1202 |
++BEGIN_FTR_SECTION |
1203 |
++ ld r9, HSTATE_KVM_VCPU(r13) |
1204 |
++ bl kvmppc_save_tm |
1205 |
++END_FTR_SECTION_IFSET(CPU_FTR_TM) |
1206 |
++#endif |
1207 |
++ |
1208 |
+ /* |
1209 |
+ * Set DEC to the smaller of DEC and HDEC, so that we wake |
1210 |
+ * no later than the end of our timeslice (HDEC interrupts |
1211 |
+@@ -2215,6 +2014,12 @@ kvm_end_cede: |
1212 |
+ bl kvmhv_accumulate_time |
1213 |
+ #endif |
1214 |
+ |
1215 |
++#ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
1216 |
++BEGIN_FTR_SECTION |
1217 |
++ bl kvmppc_restore_tm |
1218 |
++END_FTR_SECTION_IFSET(CPU_FTR_TM) |
1219 |
++#endif |
1220 |
++ |
1221 |
+ /* load up FP state */ |
1222 |
+ bl kvmppc_load_fp |
1223 |
+ |
1224 |
+@@ -2514,6 +2319,239 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) |
1225 |
+ mr r4,r31 |
1226 |
+ blr |
1227 |
+ |
1228 |
++#ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
1229 |
++/* |
1230 |
++ * Save transactional state and TM-related registers. |
1231 |
++ * Called with r9 pointing to the vcpu struct. |
1232 |
++ * This can modify all checkpointed registers, but |
1233 |
++ * restores r1, r2 and r9 (vcpu pointer) before exit. |
1234 |
++ */ |
1235 |
++kvmppc_save_tm: |
1236 |
++ mflr r0 |
1237 |
++ std r0, PPC_LR_STKOFF(r1) |
1238 |
++ |
1239 |
++ /* Turn on TM. */ |
1240 |
++ mfmsr r8 |
1241 |
++ li r0, 1 |
1242 |
++ rldimi r8, r0, MSR_TM_LG, 63-MSR_TM_LG |
1243 |
++ mtmsrd r8 |
1244 |
++ |
1245 |
++ ld r5, VCPU_MSR(r9) |
1246 |
++ rldicl. r5, r5, 64 - MSR_TS_S_LG, 62 |
1247 |
++ beq 1f /* TM not active in guest. */ |
1248 |
++ |
1249 |
++ std r1, HSTATE_HOST_R1(r13) |
1250 |
++ li r3, TM_CAUSE_KVM_RESCHED |
1251 |
++ |
1252 |
++ /* Clear the MSR RI since r1, r13 are all going to be foobar. */ |
1253 |
++ li r5, 0 |
1254 |
++ mtmsrd r5, 1 |
1255 |
++ |
1256 |
++ /* All GPRs are volatile at this point. */ |
1257 |
++ TRECLAIM(R3) |
1258 |
++ |
1259 |
++ /* Temporarily store r13 and r9 so we have some regs to play with */ |
1260 |
++ SET_SCRATCH0(r13) |
1261 |
++ GET_PACA(r13) |
1262 |
++ std r9, PACATMSCRATCH(r13) |
1263 |
++ ld r9, HSTATE_KVM_VCPU(r13) |
1264 |
++ |
1265 |
++ /* Get a few more GPRs free. */ |
1266 |
++ std r29, VCPU_GPRS_TM(29)(r9) |
1267 |
++ std r30, VCPU_GPRS_TM(30)(r9) |
1268 |
++ std r31, VCPU_GPRS_TM(31)(r9) |
1269 |
++ |
1270 |
++ /* Save away PPR and DSCR soon so don't run with user values. */ |
1271 |
++ mfspr r31, SPRN_PPR |
1272 |
++ HMT_MEDIUM |
1273 |
++ mfspr r30, SPRN_DSCR |
1274 |
++ ld r29, HSTATE_DSCR(r13) |
1275 |
++ mtspr SPRN_DSCR, r29 |
1276 |
++ |
1277 |
++ /* Save all but r9, r13 & r29-r31 */ |
1278 |
++ reg = 0 |
1279 |
++ .rept 29 |
1280 |
++ .if (reg != 9) && (reg != 13) |
1281 |
++ std reg, VCPU_GPRS_TM(reg)(r9) |
1282 |
++ .endif |
1283 |
++ reg = reg + 1 |
1284 |
++ .endr |
1285 |
++ /* ... now save r13 */ |
1286 |
++ GET_SCRATCH0(r4) |
1287 |
++ std r4, VCPU_GPRS_TM(13)(r9) |
1288 |
++ /* ... and save r9 */ |
1289 |
++ ld r4, PACATMSCRATCH(r13) |
1290 |
++ std r4, VCPU_GPRS_TM(9)(r9) |
1291 |
++ |
1292 |
++ /* Reload stack pointer and TOC. */ |
1293 |
++ ld r1, HSTATE_HOST_R1(r13) |
1294 |
++ ld r2, PACATOC(r13) |
1295 |
++ |
1296 |
++ /* Set MSR RI now we have r1 and r13 back. */ |
1297 |
++ li r5, MSR_RI |
1298 |
++ mtmsrd r5, 1 |
1299 |
++ |
1300 |
++ /* Save away checkpinted SPRs. */ |
1301 |
++ std r31, VCPU_PPR_TM(r9) |
1302 |
++ std r30, VCPU_DSCR_TM(r9) |
1303 |
++ mflr r5 |
1304 |
++ mfcr r6 |
1305 |
++ mfctr r7 |
1306 |
++ mfspr r8, SPRN_AMR |
1307 |
++ mfspr r10, SPRN_TAR |
1308 |
++ std r5, VCPU_LR_TM(r9) |
1309 |
++ stw r6, VCPU_CR_TM(r9) |
1310 |
++ std r7, VCPU_CTR_TM(r9) |
1311 |
++ std r8, VCPU_AMR_TM(r9) |
1312 |
++ std r10, VCPU_TAR_TM(r9) |
1313 |
++ |
1314 |
++ /* Restore r12 as trap number. */ |
1315 |
++ lwz r12, VCPU_TRAP(r9) |
1316 |
++ |
1317 |
++ /* Save FP/VSX. */ |
1318 |
++ addi r3, r9, VCPU_FPRS_TM |
1319 |
++ bl store_fp_state |
1320 |
++ addi r3, r9, VCPU_VRS_TM |
1321 |
++ bl store_vr_state |
1322 |
++ mfspr r6, SPRN_VRSAVE |
1323 |
++ stw r6, VCPU_VRSAVE_TM(r9) |
1324 |
++1: |
1325 |
++ /* |
1326 |
++ * We need to save these SPRs after the treclaim so that the software |
1327 |
++ * error code is recorded correctly in the TEXASR. Also the user may |
1328 |
++ * change these outside of a transaction, so they must always be |
1329 |
++ * context switched. |
1330 |
++ */ |
1331 |
++ mfspr r5, SPRN_TFHAR |
1332 |
++ mfspr r6, SPRN_TFIAR |
1333 |
++ mfspr r7, SPRN_TEXASR |
1334 |
++ std r5, VCPU_TFHAR(r9) |
1335 |
++ std r6, VCPU_TFIAR(r9) |
1336 |
++ std r7, VCPU_TEXASR(r9) |
1337 |
++ |
1338 |
++ ld r0, PPC_LR_STKOFF(r1) |
1339 |
++ mtlr r0 |
1340 |
++ blr |
1341 |
++ |
1342 |
++/* |
1343 |
++ * Restore transactional state and TM-related registers. |
1344 |
++ * Called with r4 pointing to the vcpu struct. |
1345 |
++ * This potentially modifies all checkpointed registers. |
1346 |
++ * It restores r1, r2, r4 from the PACA. |
1347 |
++ */ |
1348 |
++kvmppc_restore_tm: |
1349 |
++ mflr r0 |
1350 |
++ std r0, PPC_LR_STKOFF(r1) |
1351 |
++ |
1352 |
++ /* Turn on TM/FP/VSX/VMX so we can restore them. */ |
1353 |
++ mfmsr r5 |
1354 |
++ li r6, MSR_TM >> 32 |
1355 |
++ sldi r6, r6, 32 |
1356 |
++ or r5, r5, r6 |
1357 |
++ ori r5, r5, MSR_FP |
1358 |
++ oris r5, r5, (MSR_VEC | MSR_VSX)@h |
1359 |
++ mtmsrd r5 |
1360 |
++ |
1361 |
++ /* |
1362 |
++ * The user may change these outside of a transaction, so they must |
1363 |
++ * always be context switched. |
1364 |
++ */ |
1365 |
++ ld r5, VCPU_TFHAR(r4) |
1366 |
++ ld r6, VCPU_TFIAR(r4) |
1367 |
++ ld r7, VCPU_TEXASR(r4) |
1368 |
++ mtspr SPRN_TFHAR, r5 |
1369 |
++ mtspr SPRN_TFIAR, r6 |
1370 |
++ mtspr SPRN_TEXASR, r7 |
1371 |
++ |
1372 |
++ ld r5, VCPU_MSR(r4) |
1373 |
++ rldicl. r5, r5, 64 - MSR_TS_S_LG, 62 |
1374 |
++ beqlr /* TM not active in guest */ |
1375 |
++ std r1, HSTATE_HOST_R1(r13) |
1376 |
++ |
1377 |
++ /* Make sure the failure summary is set, otherwise we'll program check |
1378 |
++ * when we trechkpt. It's possible that this might have been not set |
1379 |
++ * on a kvmppc_set_one_reg() call but we shouldn't let this crash the |
1380 |
++ * host. |
1381 |
++ */ |
1382 |
++ oris r7, r7, (TEXASR_FS)@h |
1383 |
++ mtspr SPRN_TEXASR, r7 |
1384 |
++ |
1385 |
++ /* |
1386 |
++ * We need to load up the checkpointed state for the guest. |
1387 |
++ * We need to do this early as it will blow away any GPRs, VSRs and |
1388 |
++ * some SPRs. |
1389 |
++ */ |
1390 |
++ |
1391 |
++ mr r31, r4 |
1392 |
++ addi r3, r31, VCPU_FPRS_TM |
1393 |
++ bl load_fp_state |
1394 |
++ addi r3, r31, VCPU_VRS_TM |
1395 |
++ bl load_vr_state |
1396 |
++ mr r4, r31 |
1397 |
++ lwz r7, VCPU_VRSAVE_TM(r4) |
1398 |
++ mtspr SPRN_VRSAVE, r7 |
1399 |
++ |
1400 |
++ ld r5, VCPU_LR_TM(r4) |
1401 |
++ lwz r6, VCPU_CR_TM(r4) |
1402 |
++ ld r7, VCPU_CTR_TM(r4) |
1403 |
++ ld r8, VCPU_AMR_TM(r4) |
1404 |
++ ld r9, VCPU_TAR_TM(r4) |
1405 |
++ mtlr r5 |
1406 |
++ mtcr r6 |
1407 |
++ mtctr r7 |
1408 |
++ mtspr SPRN_AMR, r8 |
1409 |
++ mtspr SPRN_TAR, r9 |
1410 |
++ |
1411 |
++ /* |
1412 |
++ * Load up PPR and DSCR values but don't put them in the actual SPRs |
1413 |
++ * till the last moment to avoid running with userspace PPR and DSCR for |
1414 |
++ * too long. |
1415 |
++ */ |
1416 |
++ ld r29, VCPU_DSCR_TM(r4) |
1417 |
++ ld r30, VCPU_PPR_TM(r4) |
1418 |
++ |
1419 |
++ std r2, PACATMSCRATCH(r13) /* Save TOC */ |
1420 |
++ |
1421 |
++ /* Clear the MSR RI since r1, r13 are all going to be foobar. */ |
1422 |
++ li r5, 0 |
1423 |
++ mtmsrd r5, 1 |
1424 |
++ |
1425 |
++ /* Load GPRs r0-r28 */ |
1426 |
++ reg = 0 |
1427 |
++ .rept 29 |
1428 |
++ ld reg, VCPU_GPRS_TM(reg)(r31) |
1429 |
++ reg = reg + 1 |
1430 |
++ .endr |
1431 |
++ |
1432 |
++ mtspr SPRN_DSCR, r29 |
1433 |
++ mtspr SPRN_PPR, r30 |
1434 |
++ |
1435 |
++ /* Load final GPRs */ |
1436 |
++ ld 29, VCPU_GPRS_TM(29)(r31) |
1437 |
++ ld 30, VCPU_GPRS_TM(30)(r31) |
1438 |
++ ld 31, VCPU_GPRS_TM(31)(r31) |
1439 |
++ |
1440 |
++ /* TM checkpointed state is now setup. All GPRs are now volatile. */ |
1441 |
++ TRECHKPT |
1442 |
++ |
1443 |
++ /* Now let's get back the state we need. */ |
1444 |
++ HMT_MEDIUM |
1445 |
++ GET_PACA(r13) |
1446 |
++ ld r29, HSTATE_DSCR(r13) |
1447 |
++ mtspr SPRN_DSCR, r29 |
1448 |
++ ld r4, HSTATE_KVM_VCPU(r13) |
1449 |
++ ld r1, HSTATE_HOST_R1(r13) |
1450 |
++ ld r2, PACATMSCRATCH(r13) |
1451 |
++ |
1452 |
++ /* Set the MSR RI since we have our registers back. */ |
1453 |
++ li r5, MSR_RI |
1454 |
++ mtmsrd r5, 1 |
1455 |
++ |
1456 |
++ ld r0, PPC_LR_STKOFF(r1) |
1457 |
++ mtlr r0 |
1458 |
++ blr |
1459 |
++#endif |
1460 |
++ |
1461 |
+ /* |
1462 |
+ * We come here if we get any exception or interrupt while we are |
1463 |
+ * executing host real mode code while in guest MMU context. |
1464 |
+diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c |
1465 |
+index 61d5a17f45c0..e8b05e635595 100644 |
1466 |
+--- a/arch/powerpc/platforms/pseries/iommu.c |
1467 |
++++ b/arch/powerpc/platforms/pseries/iommu.c |
1468 |
+@@ -825,7 +825,8 @@ machine_arch_initcall(pseries, find_existing_ddw_windows); |
1469 |
+ static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail, |
1470 |
+ struct ddw_query_response *query) |
1471 |
+ { |
1472 |
+- struct eeh_dev *edev; |
1473 |
++ struct device_node *dn; |
1474 |
++ struct pci_dn *pdn; |
1475 |
+ u32 cfg_addr; |
1476 |
+ u64 buid; |
1477 |
+ int ret; |
1478 |
+@@ -836,11 +837,10 @@ static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail, |
1479 |
+ * Retrieve them from the pci device, not the node with the |
1480 |
+ * dma-window property |
1481 |
+ */ |
1482 |
+- edev = pci_dev_to_eeh_dev(dev); |
1483 |
+- cfg_addr = edev->config_addr; |
1484 |
+- if (edev->pe_config_addr) |
1485 |
+- cfg_addr = edev->pe_config_addr; |
1486 |
+- buid = edev->phb->buid; |
1487 |
++ dn = pci_device_to_OF_node(dev); |
1488 |
++ pdn = PCI_DN(dn); |
1489 |
++ buid = pdn->phb->buid; |
1490 |
++ cfg_addr = ((pdn->busno << 16) | (pdn->devfn << 8)); |
1491 |
+ |
1492 |
+ ret = rtas_call(ddw_avail[0], 3, 5, (u32 *)query, |
1493 |
+ cfg_addr, BUID_HI(buid), BUID_LO(buid)); |
1494 |
+@@ -854,7 +854,8 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail, |
1495 |
+ struct ddw_create_response *create, int page_shift, |
1496 |
+ int window_shift) |
1497 |
+ { |
1498 |
+- struct eeh_dev *edev; |
1499 |
++ struct device_node *dn; |
1500 |
++ struct pci_dn *pdn; |
1501 |
+ u32 cfg_addr; |
1502 |
+ u64 buid; |
1503 |
+ int ret; |
1504 |
+@@ -865,11 +866,10 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail, |
1505 |
+ * Retrieve them from the pci device, not the node with the |
1506 |
+ * dma-window property |
1507 |
+ */ |
1508 |
+- edev = pci_dev_to_eeh_dev(dev); |
1509 |
+- cfg_addr = edev->config_addr; |
1510 |
+- if (edev->pe_config_addr) |
1511 |
+- cfg_addr = edev->pe_config_addr; |
1512 |
+- buid = edev->phb->buid; |
1513 |
++ dn = pci_device_to_OF_node(dev); |
1514 |
++ pdn = PCI_DN(dn); |
1515 |
++ buid = pdn->phb->buid; |
1516 |
++ cfg_addr = ((pdn->busno << 16) | (pdn->devfn << 8)); |
1517 |
+ |
1518 |
+ do { |
1519 |
+ /* extra outputs are LIOBN and dma-addr (hi, lo) */ |
1520 |
+diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c |
1521 |
+index ebf82a99df45..9ac703cfdb21 100644 |
1522 |
+--- a/arch/s390/mm/pgtable.c |
1523 |
++++ b/arch/s390/mm/pgtable.c |
1524 |
+@@ -173,7 +173,7 @@ EXPORT_SYMBOL_GPL(gmap_alloc); |
1525 |
+ static void gmap_flush_tlb(struct gmap *gmap) |
1526 |
+ { |
1527 |
+ if (MACHINE_HAS_IDTE) |
1528 |
+- __tlb_flush_asce(gmap->mm, gmap->asce); |
1529 |
++ __tlb_flush_idte(gmap->asce); |
1530 |
+ else |
1531 |
+ __tlb_flush_global(); |
1532 |
+ } |
1533 |
+@@ -212,7 +212,7 @@ void gmap_free(struct gmap *gmap) |
1534 |
+ |
1535 |
+ /* Flush tlb. */ |
1536 |
+ if (MACHINE_HAS_IDTE) |
1537 |
+- __tlb_flush_asce(gmap->mm, gmap->asce); |
1538 |
++ __tlb_flush_idte(gmap->asce); |
1539 |
+ else |
1540 |
+ __tlb_flush_global(); |
1541 |
+ |
1542 |
+diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c |
1543 |
+index 22212615a137..185ebd2c0c3c 100644 |
1544 |
+--- a/arch/x86/kernel/cpu/perf_event_intel.c |
1545 |
++++ b/arch/x86/kernel/cpu/perf_event_intel.c |
1546 |
+@@ -3332,7 +3332,7 @@ __init int intel_pmu_init(void) |
1547 |
+ c->idxmsk64 |= (1ULL << x86_pmu.num_counters) - 1; |
1548 |
+ } |
1549 |
+ c->idxmsk64 &= |
1550 |
+- ~(~0UL << (INTEL_PMC_IDX_FIXED + x86_pmu.num_counters_fixed)); |
1551 |
++ ~(~0ULL << (INTEL_PMC_IDX_FIXED + x86_pmu.num_counters_fixed)); |
1552 |
+ c->weight = hweight64(c->idxmsk64); |
1553 |
+ } |
1554 |
+ } |
1555 |
+diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
1556 |
+index 1274fac7c28f..08f9d9230b94 100644 |
1557 |
+--- a/arch/x86/kvm/vmx.c |
1558 |
++++ b/arch/x86/kvm/vmx.c |
1559 |
+@@ -7770,6 +7770,7 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu) |
1560 |
+ if ((vectoring_info & VECTORING_INFO_VALID_MASK) && |
1561 |
+ (exit_reason != EXIT_REASON_EXCEPTION_NMI && |
1562 |
+ exit_reason != EXIT_REASON_EPT_VIOLATION && |
1563 |
++ exit_reason != EXIT_REASON_PML_FULL && |
1564 |
+ exit_reason != EXIT_REASON_TASK_SWITCH)) { |
1565 |
+ vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; |
1566 |
+ vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_DELIVERY_EV; |
1567 |
+@@ -8377,6 +8378,22 @@ static void vmx_load_vmcs01(struct kvm_vcpu *vcpu) |
1568 |
+ put_cpu(); |
1569 |
+ } |
1570 |
+ |
1571 |
++/* |
1572 |
++ * Ensure that the current vmcs of the logical processor is the |
1573 |
++ * vmcs01 of the vcpu before calling free_nested(). |
1574 |
++ */ |
1575 |
++static void vmx_free_vcpu_nested(struct kvm_vcpu *vcpu) |
1576 |
++{ |
1577 |
++ struct vcpu_vmx *vmx = to_vmx(vcpu); |
1578 |
++ int r; |
1579 |
++ |
1580 |
++ r = vcpu_load(vcpu); |
1581 |
++ BUG_ON(r); |
1582 |
++ vmx_load_vmcs01(vcpu); |
1583 |
++ free_nested(vmx); |
1584 |
++ vcpu_put(vcpu); |
1585 |
++} |
1586 |
++ |
1587 |
+ static void vmx_free_vcpu(struct kvm_vcpu *vcpu) |
1588 |
+ { |
1589 |
+ struct vcpu_vmx *vmx = to_vmx(vcpu); |
1590 |
+@@ -8385,8 +8402,7 @@ static void vmx_free_vcpu(struct kvm_vcpu *vcpu) |
1591 |
+ vmx_disable_pml(vmx); |
1592 |
+ free_vpid(vmx); |
1593 |
+ leave_guest_mode(vcpu); |
1594 |
+- vmx_load_vmcs01(vcpu); |
1595 |
+- free_nested(vmx); |
1596 |
++ vmx_free_vcpu_nested(vcpu); |
1597 |
+ free_loaded_vmcs(vmx->loaded_vmcs); |
1598 |
+ kfree(vmx->guest_msrs); |
1599 |
+ kvm_vcpu_uninit(vcpu); |
1600 |
+diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl |
1601 |
+index ef8187f9d28d..f3a443dad74c 100644 |
1602 |
+--- a/arch/x86/syscalls/syscall_32.tbl |
1603 |
++++ b/arch/x86/syscalls/syscall_32.tbl |
1604 |
+@@ -294,7 +294,7 @@ |
1605 |
+ # 285 sys_setaltroot |
1606 |
+ 286 i386 add_key sys_add_key |
1607 |
+ 287 i386 request_key sys_request_key |
1608 |
+-288 i386 keyctl sys_keyctl |
1609 |
++288 i386 keyctl sys_keyctl compat_sys_keyctl |
1610 |
+ 289 i386 ioprio_set sys_ioprio_set |
1611 |
+ 290 i386 ioprio_get sys_ioprio_get |
1612 |
+ 291 i386 inotify_init sys_inotify_init |
1613 |
+diff --git a/block/genhd.c b/block/genhd.c |
1614 |
+index ea982eadaf63..f5d12185d631 100644 |
1615 |
+--- a/block/genhd.c |
1616 |
++++ b/block/genhd.c |
1617 |
+@@ -828,6 +828,7 @@ static void disk_seqf_stop(struct seq_file *seqf, void *v) |
1618 |
+ if (iter) { |
1619 |
+ class_dev_iter_exit(iter); |
1620 |
+ kfree(iter); |
1621 |
++ seqf->private = NULL; |
1622 |
+ } |
1623 |
+ } |
1624 |
+ |
1625 |
+diff --git a/crypto/gcm.c b/crypto/gcm.c |
1626 |
+index 2e403f6138c1..ee3c29bd7ddb 100644 |
1627 |
+--- a/crypto/gcm.c |
1628 |
++++ b/crypto/gcm.c |
1629 |
+@@ -716,7 +716,9 @@ static struct crypto_instance *crypto_gcm_alloc_common(struct rtattr **tb, |
1630 |
+ |
1631 |
+ ghash_alg = crypto_find_alg(ghash_name, &crypto_ahash_type, |
1632 |
+ CRYPTO_ALG_TYPE_HASH, |
1633 |
+- CRYPTO_ALG_TYPE_AHASH_MASK); |
1634 |
++ CRYPTO_ALG_TYPE_AHASH_MASK | |
1635 |
++ crypto_requires_sync(algt->type, |
1636 |
++ algt->mask)); |
1637 |
+ if (IS_ERR(ghash_alg)) |
1638 |
+ return ERR_CAST(ghash_alg); |
1639 |
+ |
1640 |
+diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c |
1641 |
+index 3bd749c7bb70..46dcbbc4f32e 100644 |
1642 |
+--- a/crypto/scatterwalk.c |
1643 |
++++ b/crypto/scatterwalk.c |
1644 |
+@@ -68,7 +68,8 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out, |
1645 |
+ |
1646 |
+ void scatterwalk_done(struct scatter_walk *walk, int out, int more) |
1647 |
+ { |
1648 |
+- if (!(scatterwalk_pagelen(walk) & (PAGE_SIZE - 1)) || !more) |
1649 |
++ if (!more || walk->offset >= walk->sg->offset + walk->sg->length || |
1650 |
++ !(walk->offset & (PAGE_SIZE - 1))) |
1651 |
+ scatterwalk_pagedone(walk, out, more); |
1652 |
+ } |
1653 |
+ EXPORT_SYMBOL_GPL(scatterwalk_done); |
1654 |
+diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c |
1655 |
+index 0beaa52df66b..c31980079507 100644 |
1656 |
+--- a/drivers/bluetooth/ath3k.c |
1657 |
++++ b/drivers/bluetooth/ath3k.c |
1658 |
+@@ -122,6 +122,8 @@ static const struct usb_device_id ath3k_table[] = { |
1659 |
+ { USB_DEVICE(0x13d3, 0x3432) }, |
1660 |
+ { USB_DEVICE(0x13d3, 0x3472) }, |
1661 |
+ { USB_DEVICE(0x13d3, 0x3474) }, |
1662 |
++ { USB_DEVICE(0x13d3, 0x3487) }, |
1663 |
++ { USB_DEVICE(0x13d3, 0x3490) }, |
1664 |
+ |
1665 |
+ /* Atheros AR5BBU12 with sflash firmware */ |
1666 |
+ { USB_DEVICE(0x0489, 0xE02C) }, |
1667 |
+@@ -188,6 +190,8 @@ static const struct usb_device_id ath3k_blist_tbl[] = { |
1668 |
+ { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 }, |
1669 |
+ { USB_DEVICE(0x13d3, 0x3472), .driver_info = BTUSB_ATH3012 }, |
1670 |
+ { USB_DEVICE(0x13d3, 0x3474), .driver_info = BTUSB_ATH3012 }, |
1671 |
++ { USB_DEVICE(0x13d3, 0x3487), .driver_info = BTUSB_ATH3012 }, |
1672 |
++ { USB_DEVICE(0x13d3, 0x3490), .driver_info = BTUSB_ATH3012 }, |
1673 |
+ |
1674 |
+ /* Atheros AR5BBU22 with sflash firmware */ |
1675 |
+ { USB_DEVICE(0x0489, 0xE036), .driver_info = BTUSB_ATH3012 }, |
1676 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
1677 |
+index ac553f997a1c..81721ad6fcb0 100644 |
1678 |
+--- a/drivers/bluetooth/btusb.c |
1679 |
++++ b/drivers/bluetooth/btusb.c |
1680 |
+@@ -224,6 +224,8 @@ static const struct usb_device_id blacklist_table[] = { |
1681 |
+ { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 }, |
1682 |
+ { USB_DEVICE(0x13d3, 0x3472), .driver_info = BTUSB_ATH3012 }, |
1683 |
+ { USB_DEVICE(0x13d3, 0x3474), .driver_info = BTUSB_ATH3012 }, |
1684 |
++ { USB_DEVICE(0x13d3, 0x3487), .driver_info = BTUSB_ATH3012 }, |
1685 |
++ { USB_DEVICE(0x13d3, 0x3490), .driver_info = BTUSB_ATH3012 }, |
1686 |
+ |
1687 |
+ /* Atheros AR5BBU12 with sflash firmware */ |
1688 |
+ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, |
1689 |
+diff --git a/drivers/gpio/gpio-intel-mid.c b/drivers/gpio/gpio-intel-mid.c |
1690 |
+index aa28c65eb6b4..14945fd9d5e1 100644 |
1691 |
+--- a/drivers/gpio/gpio-intel-mid.c |
1692 |
++++ b/drivers/gpio/gpio-intel-mid.c |
1693 |
+@@ -17,7 +17,6 @@ |
1694 |
+ * Moorestown platform Langwell chip. |
1695 |
+ * Medfield platform Penwell chip. |
1696 |
+ * Clovertrail platform Cloverview chip. |
1697 |
+- * Merrifield platform Tangier chip. |
1698 |
+ */ |
1699 |
+ |
1700 |
+ #include <linux/module.h> |
1701 |
+@@ -64,10 +63,6 @@ enum GPIO_REG { |
1702 |
+ /* intel_mid gpio driver data */ |
1703 |
+ struct intel_mid_gpio_ddata { |
1704 |
+ u16 ngpio; /* number of gpio pins */ |
1705 |
+- u32 gplr_offset; /* offset of first GPLR register from base */ |
1706 |
+- u32 flis_base; /* base address of FLIS registers */ |
1707 |
+- u32 flis_len; /* length of FLIS registers */ |
1708 |
+- u32 (*get_flis_offset)(int gpio); |
1709 |
+ u32 chip_irq_type; /* chip interrupt type */ |
1710 |
+ }; |
1711 |
+ |
1712 |
+@@ -257,15 +252,6 @@ static const struct intel_mid_gpio_ddata gpio_cloverview_core = { |
1713 |
+ .chip_irq_type = INTEL_MID_IRQ_TYPE_EDGE, |
1714 |
+ }; |
1715 |
+ |
1716 |
+-static const struct intel_mid_gpio_ddata gpio_tangier = { |
1717 |
+- .ngpio = 192, |
1718 |
+- .gplr_offset = 4, |
1719 |
+- .flis_base = 0xff0c0000, |
1720 |
+- .flis_len = 0x8000, |
1721 |
+- .get_flis_offset = NULL, |
1722 |
+- .chip_irq_type = INTEL_MID_IRQ_TYPE_EDGE, |
1723 |
+-}; |
1724 |
+- |
1725 |
+ static const struct pci_device_id intel_gpio_ids[] = { |
1726 |
+ { |
1727 |
+ /* Lincroft */ |
1728 |
+@@ -292,11 +278,6 @@ static const struct pci_device_id intel_gpio_ids[] = { |
1729 |
+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x08f7), |
1730 |
+ .driver_data = (kernel_ulong_t)&gpio_cloverview_core, |
1731 |
+ }, |
1732 |
+- { |
1733 |
+- /* Tangier */ |
1734 |
+- PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x1199), |
1735 |
+- .driver_data = (kernel_ulong_t)&gpio_tangier, |
1736 |
+- }, |
1737 |
+ { 0 } |
1738 |
+ }; |
1739 |
+ MODULE_DEVICE_TABLE(pci, intel_gpio_ids); |
1740 |
+diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c |
1741 |
+index 16f7c4f2d8c8..6e2720ea7d45 100644 |
1742 |
+--- a/drivers/gpio/gpio-pca953x.c |
1743 |
++++ b/drivers/gpio/gpio-pca953x.c |
1744 |
+@@ -76,7 +76,7 @@ MODULE_DEVICE_TABLE(i2c, pca953x_id); |
1745 |
+ #define MAX_BANK 5 |
1746 |
+ #define BANK_SZ 8 |
1747 |
+ |
1748 |
+-#define NBANK(chip) (chip->gpio_chip.ngpio / BANK_SZ) |
1749 |
++#define NBANK(chip) DIV_ROUND_UP(chip->gpio_chip.ngpio, BANK_SZ) |
1750 |
+ |
1751 |
+ struct pca953x_chip { |
1752 |
+ unsigned gpio_start; |
1753 |
+diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
1754 |
+index 5250596a612e..56323732c748 100644 |
1755 |
+--- a/drivers/gpu/drm/i915/intel_display.c |
1756 |
++++ b/drivers/gpu/drm/i915/intel_display.c |
1757 |
+@@ -7129,14 +7129,12 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) |
1758 |
+ { |
1759 |
+ struct drm_i915_private *dev_priv = dev->dev_private; |
1760 |
+ struct intel_encoder *encoder; |
1761 |
+- int i; |
1762 |
+ u32 val, final; |
1763 |
+ bool has_lvds = false; |
1764 |
+ bool has_cpu_edp = false; |
1765 |
+ bool has_panel = false; |
1766 |
+ bool has_ck505 = false; |
1767 |
+ bool can_ssc = false; |
1768 |
+- bool using_ssc_source = false; |
1769 |
+ |
1770 |
+ /* We need to take the global config into account */ |
1771 |
+ for_each_intel_encoder(dev, encoder) { |
1772 |
+@@ -7163,22 +7161,8 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) |
1773 |
+ can_ssc = true; |
1774 |
+ } |
1775 |
+ |
1776 |
+- /* Check if any DPLLs are using the SSC source */ |
1777 |
+- for (i = 0; i < dev_priv->num_shared_dpll; i++) { |
1778 |
+- u32 temp = I915_READ(PCH_DPLL(i)); |
1779 |
+- |
1780 |
+- if (!(temp & DPLL_VCO_ENABLE)) |
1781 |
+- continue; |
1782 |
+- |
1783 |
+- if ((temp & PLL_REF_INPUT_MASK) == |
1784 |
+- PLLB_REF_INPUT_SPREADSPECTRUMIN) { |
1785 |
+- using_ssc_source = true; |
1786 |
+- break; |
1787 |
+- } |
1788 |
+- } |
1789 |
+- |
1790 |
+- DRM_DEBUG_KMS("has_panel %d has_lvds %d has_ck505 %d using_ssc_source %d\n", |
1791 |
+- has_panel, has_lvds, has_ck505, using_ssc_source); |
1792 |
++ DRM_DEBUG_KMS("has_panel %d has_lvds %d has_ck505 %d\n", |
1793 |
++ has_panel, has_lvds, has_ck505); |
1794 |
+ |
1795 |
+ /* Ironlake: try to setup display ref clock before DPLL |
1796 |
+ * enabling. This is only under driver's control after |
1797 |
+@@ -7215,9 +7199,9 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) |
1798 |
+ final |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD; |
1799 |
+ } else |
1800 |
+ final |= DREF_CPU_SOURCE_OUTPUT_DISABLE; |
1801 |
+- } else if (using_ssc_source) { |
1802 |
+- final |= DREF_SSC_SOURCE_ENABLE; |
1803 |
+- final |= DREF_SSC1_ENABLE; |
1804 |
++ } else { |
1805 |
++ final |= DREF_SSC_SOURCE_DISABLE; |
1806 |
++ final |= DREF_CPU_SOURCE_OUTPUT_DISABLE; |
1807 |
+ } |
1808 |
+ |
1809 |
+ if (final == val) |
1810 |
+@@ -7263,7 +7247,7 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) |
1811 |
+ POSTING_READ(PCH_DREF_CONTROL); |
1812 |
+ udelay(200); |
1813 |
+ } else { |
1814 |
+- DRM_DEBUG_KMS("Disabling CPU source output\n"); |
1815 |
++ DRM_DEBUG_KMS("Disabling SSC entirely\n"); |
1816 |
+ |
1817 |
+ val &= ~DREF_CPU_SOURCE_OUTPUT_MASK; |
1818 |
+ |
1819 |
+@@ -7274,20 +7258,16 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) |
1820 |
+ POSTING_READ(PCH_DREF_CONTROL); |
1821 |
+ udelay(200); |
1822 |
+ |
1823 |
+- if (!using_ssc_source) { |
1824 |
+- DRM_DEBUG_KMS("Disabling SSC source\n"); |
1825 |
+- |
1826 |
+- /* Turn off the SSC source */ |
1827 |
+- val &= ~DREF_SSC_SOURCE_MASK; |
1828 |
+- val |= DREF_SSC_SOURCE_DISABLE; |
1829 |
++ /* Turn off the SSC source */ |
1830 |
++ val &= ~DREF_SSC_SOURCE_MASK; |
1831 |
++ val |= DREF_SSC_SOURCE_DISABLE; |
1832 |
+ |
1833 |
+- /* Turn off SSC1 */ |
1834 |
+- val &= ~DREF_SSC1_ENABLE; |
1835 |
++ /* Turn off SSC1 */ |
1836 |
++ val &= ~DREF_SSC1_ENABLE; |
1837 |
+ |
1838 |
+- I915_WRITE(PCH_DREF_CONTROL, val); |
1839 |
+- POSTING_READ(PCH_DREF_CONTROL); |
1840 |
+- udelay(200); |
1841 |
+- } |
1842 |
++ I915_WRITE(PCH_DREF_CONTROL, val); |
1843 |
++ POSTING_READ(PCH_DREF_CONTROL); |
1844 |
++ udelay(200); |
1845 |
+ } |
1846 |
+ |
1847 |
+ BUG_ON(val != final); |
1848 |
+diff --git a/drivers/gpu/drm/nouveau/nv04_fbcon.c b/drivers/gpu/drm/nouveau/nv04_fbcon.c |
1849 |
+index 7a92d15d474e..1ff5ca37dd62 100644 |
1850 |
+--- a/drivers/gpu/drm/nouveau/nv04_fbcon.c |
1851 |
++++ b/drivers/gpu/drm/nouveau/nv04_fbcon.c |
1852 |
+@@ -107,11 +107,11 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) |
1853 |
+ ((image->dx + image->width) & 0xffff)); |
1854 |
+ OUT_RING(chan, bg); |
1855 |
+ OUT_RING(chan, fg); |
1856 |
+- OUT_RING(chan, (image->height << 16) | image->width); |
1857 |
++ OUT_RING(chan, (image->height << 16) | ALIGN(image->width, 8)); |
1858 |
+ OUT_RING(chan, (image->height << 16) | image->width); |
1859 |
+ OUT_RING(chan, (image->dy << 16) | (image->dx & 0xffff)); |
1860 |
+ |
1861 |
+- dsize = ALIGN(image->width * image->height, 32) >> 5; |
1862 |
++ dsize = ALIGN(ALIGN(image->width, 8) * image->height, 32) >> 5; |
1863 |
+ while (dsize) { |
1864 |
+ int iter_len = dsize > 128 ? 128 : dsize; |
1865 |
+ |
1866 |
+diff --git a/drivers/gpu/drm/nouveau/nv50_fbcon.c b/drivers/gpu/drm/nouveau/nv50_fbcon.c |
1867 |
+index cb2a71ada99e..8462f72e8819 100644 |
1868 |
+--- a/drivers/gpu/drm/nouveau/nv50_fbcon.c |
1869 |
++++ b/drivers/gpu/drm/nouveau/nv50_fbcon.c |
1870 |
+@@ -125,7 +125,7 @@ nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) |
1871 |
+ OUT_RING(chan, 0); |
1872 |
+ OUT_RING(chan, image->dy); |
1873 |
+ |
1874 |
+- dwords = ALIGN(image->width * image->height, 32) >> 5; |
1875 |
++ dwords = ALIGN(ALIGN(image->width, 8) * image->height, 32) >> 5; |
1876 |
+ while (dwords) { |
1877 |
+ int push = dwords > 2047 ? 2047 : dwords; |
1878 |
+ |
1879 |
+diff --git a/drivers/gpu/drm/nouveau/nvc0_fbcon.c b/drivers/gpu/drm/nouveau/nvc0_fbcon.c |
1880 |
+index 69f760e8c54f..90552420c217 100644 |
1881 |
+--- a/drivers/gpu/drm/nouveau/nvc0_fbcon.c |
1882 |
++++ b/drivers/gpu/drm/nouveau/nvc0_fbcon.c |
1883 |
+@@ -125,7 +125,7 @@ nvc0_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) |
1884 |
+ OUT_RING (chan, 0); |
1885 |
+ OUT_RING (chan, image->dy); |
1886 |
+ |
1887 |
+- dwords = ALIGN(image->width * image->height, 32) >> 5; |
1888 |
++ dwords = ALIGN(ALIGN(image->width, 8) * image->height, 32) >> 5; |
1889 |
+ while (dwords) { |
1890 |
+ int push = dwords > 2047 ? 2047 : dwords; |
1891 |
+ |
1892 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv30.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv30.c |
1893 |
+index dcc84eb54fb6..183d1701ae94 100644 |
1894 |
+--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv30.c |
1895 |
++++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv30.c |
1896 |
+@@ -88,8 +88,8 @@ nv30_gr_context_ctor(struct nvkm_object *parent, struct nvkm_object *engine, |
1897 |
+ nv_wo32(chan, i, 0x00040004); |
1898 |
+ for (i = 0x1f18; i <= 0x3088 ; i += 16) { |
1899 |
+ nv_wo32(chan, i + 0, 0x10700ff9); |
1900 |
+- nv_wo32(chan, i + 1, 0x0436086c); |
1901 |
+- nv_wo32(chan, i + 2, 0x000c001b); |
1902 |
++ nv_wo32(chan, i + 4, 0x0436086c); |
1903 |
++ nv_wo32(chan, i + 8, 0x000c001b); |
1904 |
+ } |
1905 |
+ for (i = 0x30b8; i < 0x30c8; i += 4) |
1906 |
+ nv_wo32(chan, i, 0x0000ffff); |
1907 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv34.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv34.c |
1908 |
+index 985b7f3306ae..720c97135e85 100644 |
1909 |
+--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv34.c |
1910 |
++++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv34.c |
1911 |
+@@ -86,8 +86,8 @@ nv34_gr_context_ctor(struct nvkm_object *parent, struct nvkm_object *engine, |
1912 |
+ nv_wo32(chan, i, 0x00040004); |
1913 |
+ for (i = 0x15ac; i <= 0x271c ; i += 16) { |
1914 |
+ nv_wo32(chan, i + 0, 0x10700ff9); |
1915 |
+- nv_wo32(chan, i + 1, 0x0436086c); |
1916 |
+- nv_wo32(chan, i + 2, 0x000c001b); |
1917 |
++ nv_wo32(chan, i + 4, 0x0436086c); |
1918 |
++ nv_wo32(chan, i + 8, 0x000c001b); |
1919 |
+ } |
1920 |
+ for (i = 0x274c; i < 0x275c; i += 4) |
1921 |
+ nv_wo32(chan, i, 0x0000ffff); |
1922 |
+diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c |
1923 |
+index 0b04b9282f56..d4ac8c837314 100644 |
1924 |
+--- a/drivers/gpu/drm/radeon/atombios_encoders.c |
1925 |
++++ b/drivers/gpu/drm/radeon/atombios_encoders.c |
1926 |
+@@ -120,6 +120,7 @@ atombios_set_backlight_level(struct radeon_encoder *radeon_encoder, u8 level) |
1927 |
+ case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: |
1928 |
+ case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: |
1929 |
+ case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: |
1930 |
++ case ENCODER_OBJECT_ID_INTERNAL_UNIPHY3: |
1931 |
+ if (dig->backlight_level == 0) |
1932 |
+ atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_LCD_BLOFF, 0, 0); |
1933 |
+ else { |
1934 |
+diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c |
1935 |
+index de9a2ffcf5f7..0c5b3eeff82d 100644 |
1936 |
+--- a/drivers/gpu/drm/radeon/radeon_atombios.c |
1937 |
++++ b/drivers/gpu/drm/radeon/radeon_atombios.c |
1938 |
+@@ -1155,7 +1155,7 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) |
1939 |
+ le16_to_cpu(firmware_info->info.usReferenceClock); |
1940 |
+ p1pll->reference_div = 0; |
1941 |
+ |
1942 |
+- if (crev < 2) |
1943 |
++ if ((frev < 2) && (crev < 2)) |
1944 |
+ p1pll->pll_out_min = |
1945 |
+ le16_to_cpu(firmware_info->info.usMinPixelClockPLL_Output); |
1946 |
+ else |
1947 |
+@@ -1164,7 +1164,7 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) |
1948 |
+ p1pll->pll_out_max = |
1949 |
+ le32_to_cpu(firmware_info->info.ulMaxPixelClockPLL_Output); |
1950 |
+ |
1951 |
+- if (crev >= 4) { |
1952 |
++ if (((frev < 2) && (crev >= 4)) || (frev >= 2)) { |
1953 |
+ p1pll->lcd_pll_out_min = |
1954 |
+ le16_to_cpu(firmware_info->info_14.usLcdMinPixelClockPLL_Output) * 100; |
1955 |
+ if (p1pll->lcd_pll_out_min == 0) |
1956 |
+diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c |
1957 |
+index 8bc7d0bbd3c8..868247c22de4 100644 |
1958 |
+--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c |
1959 |
++++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c |
1960 |
+@@ -10,6 +10,7 @@ |
1961 |
+ #include <linux/slab.h> |
1962 |
+ #include <linux/acpi.h> |
1963 |
+ #include <linux/pci.h> |
1964 |
++#include <linux/delay.h> |
1965 |
+ |
1966 |
+ #include "radeon_acpi.h" |
1967 |
+ |
1968 |
+@@ -255,6 +256,10 @@ static int radeon_atpx_set_discrete_state(struct radeon_atpx *atpx, u8 state) |
1969 |
+ if (!info) |
1970 |
+ return -EIO; |
1971 |
+ kfree(info); |
1972 |
++ |
1973 |
++ /* 200ms delay is required after off */ |
1974 |
++ if (state == 0) |
1975 |
++ msleep(200); |
1976 |
+ } |
1977 |
+ return 0; |
1978 |
+ } |
1979 |
+diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c |
1980 |
+index f5c96fb7e8d0..9f699e87320a 100644 |
1981 |
+--- a/drivers/gpu/drm/radeon/radeon_connectors.c |
1982 |
++++ b/drivers/gpu/drm/radeon/radeon_connectors.c |
1983 |
+@@ -2039,7 +2039,6 @@ radeon_add_atom_connector(struct drm_device *dev, |
1984 |
+ RADEON_OUTPUT_CSC_BYPASS); |
1985 |
+ /* no HPD on analog connectors */ |
1986 |
+ radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
1987 |
+- connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
1988 |
+ connector->interlace_allowed = true; |
1989 |
+ connector->doublescan_allowed = true; |
1990 |
+ break; |
1991 |
+@@ -2289,8 +2288,10 @@ radeon_add_atom_connector(struct drm_device *dev, |
1992 |
+ } |
1993 |
+ |
1994 |
+ if (radeon_connector->hpd.hpd == RADEON_HPD_NONE) { |
1995 |
+- if (i2c_bus->valid) |
1996 |
+- connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
1997 |
++ if (i2c_bus->valid) { |
1998 |
++ connector->polled = DRM_CONNECTOR_POLL_CONNECT | |
1999 |
++ DRM_CONNECTOR_POLL_DISCONNECT; |
2000 |
++ } |
2001 |
+ } else |
2002 |
+ connector->polled = DRM_CONNECTOR_POLL_HPD; |
2003 |
+ |
2004 |
+@@ -2366,7 +2367,6 @@ radeon_add_legacy_connector(struct drm_device *dev, |
2005 |
+ 1); |
2006 |
+ /* no HPD on analog connectors */ |
2007 |
+ radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
2008 |
+- connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
2009 |
+ connector->interlace_allowed = true; |
2010 |
+ connector->doublescan_allowed = true; |
2011 |
+ break; |
2012 |
+@@ -2451,10 +2451,13 @@ radeon_add_legacy_connector(struct drm_device *dev, |
2013 |
+ } |
2014 |
+ |
2015 |
+ if (radeon_connector->hpd.hpd == RADEON_HPD_NONE) { |
2016 |
+- if (i2c_bus->valid) |
2017 |
+- connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
2018 |
++ if (i2c_bus->valid) { |
2019 |
++ connector->polled = DRM_CONNECTOR_POLL_CONNECT | |
2020 |
++ DRM_CONNECTOR_POLL_DISCONNECT; |
2021 |
++ } |
2022 |
+ } else |
2023 |
+ connector->polled = DRM_CONNECTOR_POLL_HPD; |
2024 |
++ |
2025 |
+ connector->display_info.subpixel_order = subpixel_order; |
2026 |
+ drm_connector_register(connector); |
2027 |
+ } |
2028 |
+diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c |
2029 |
+index e094c572b86e..1a2032c2c1fb 100644 |
2030 |
+--- a/drivers/hid/uhid.c |
2031 |
++++ b/drivers/hid/uhid.c |
2032 |
+@@ -51,10 +51,26 @@ struct uhid_device { |
2033 |
+ u32 report_id; |
2034 |
+ u32 report_type; |
2035 |
+ struct uhid_event report_buf; |
2036 |
++ struct work_struct worker; |
2037 |
+ }; |
2038 |
+ |
2039 |
+ static struct miscdevice uhid_misc; |
2040 |
+ |
2041 |
++static void uhid_device_add_worker(struct work_struct *work) |
2042 |
++{ |
2043 |
++ struct uhid_device *uhid = container_of(work, struct uhid_device, worker); |
2044 |
++ int ret; |
2045 |
++ |
2046 |
++ ret = hid_add_device(uhid->hid); |
2047 |
++ if (ret) { |
2048 |
++ hid_err(uhid->hid, "Cannot register HID device: error %d\n", ret); |
2049 |
++ |
2050 |
++ hid_destroy_device(uhid->hid); |
2051 |
++ uhid->hid = NULL; |
2052 |
++ uhid->running = false; |
2053 |
++ } |
2054 |
++} |
2055 |
++ |
2056 |
+ static void uhid_queue(struct uhid_device *uhid, struct uhid_event *ev) |
2057 |
+ { |
2058 |
+ __u8 newhead; |
2059 |
+@@ -498,18 +514,14 @@ static int uhid_dev_create2(struct uhid_device *uhid, |
2060 |
+ uhid->hid = hid; |
2061 |
+ uhid->running = true; |
2062 |
+ |
2063 |
+- ret = hid_add_device(hid); |
2064 |
+- if (ret) { |
2065 |
+- hid_err(hid, "Cannot register HID device\n"); |
2066 |
+- goto err_hid; |
2067 |
+- } |
2068 |
++ /* Adding of a HID device is done through a worker, to allow HID drivers |
2069 |
++ * which use feature requests during .probe to work, without they would |
2070 |
++ * be blocked on devlock, which is held by uhid_char_write. |
2071 |
++ */ |
2072 |
++ schedule_work(&uhid->worker); |
2073 |
+ |
2074 |
+ return 0; |
2075 |
+ |
2076 |
+-err_hid: |
2077 |
+- hid_destroy_device(hid); |
2078 |
+- uhid->hid = NULL; |
2079 |
+- uhid->running = false; |
2080 |
+ err_free: |
2081 |
+ kfree(uhid->rd_data); |
2082 |
+ uhid->rd_data = NULL; |
2083 |
+@@ -550,6 +562,8 @@ static int uhid_dev_destroy(struct uhid_device *uhid) |
2084 |
+ uhid->running = false; |
2085 |
+ wake_up_interruptible(&uhid->report_wait); |
2086 |
+ |
2087 |
++ cancel_work_sync(&uhid->worker); |
2088 |
++ |
2089 |
+ hid_destroy_device(uhid->hid); |
2090 |
+ kfree(uhid->rd_data); |
2091 |
+ |
2092 |
+@@ -612,6 +626,7 @@ static int uhid_char_open(struct inode *inode, struct file *file) |
2093 |
+ init_waitqueue_head(&uhid->waitq); |
2094 |
+ init_waitqueue_head(&uhid->report_wait); |
2095 |
+ uhid->running = false; |
2096 |
++ INIT_WORK(&uhid->worker, uhid_device_add_worker); |
2097 |
+ |
2098 |
+ file->private_data = uhid; |
2099 |
+ nonseekable_open(inode, file); |
2100 |
+diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c |
2101 |
+index 98ba761cbb9c..d8738d4f8df3 100644 |
2102 |
+--- a/drivers/iio/accel/kxsd9.c |
2103 |
++++ b/drivers/iio/accel/kxsd9.c |
2104 |
+@@ -81,7 +81,7 @@ static int kxsd9_write_scale(struct iio_dev *indio_dev, int micro) |
2105 |
+ |
2106 |
+ mutex_lock(&st->buf_lock); |
2107 |
+ ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); |
2108 |
+- if (ret) |
2109 |
++ if (ret < 0) |
2110 |
+ goto error_ret; |
2111 |
+ st->tx[0] = KXSD9_WRITE(KXSD9_REG_CTRL_C); |
2112 |
+ st->tx[1] = (ret & ~KXSD9_FS_MASK) | i; |
2113 |
+@@ -163,7 +163,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev, |
2114 |
+ break; |
2115 |
+ case IIO_CHAN_INFO_SCALE: |
2116 |
+ ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); |
2117 |
+- if (ret) |
2118 |
++ if (ret < 0) |
2119 |
+ goto error_ret; |
2120 |
+ *val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK]; |
2121 |
+ ret = IIO_VAL_INT_PLUS_MICRO; |
2122 |
+diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c |
2123 |
+index 70f78c3062a7..8e2b9e70511d 100644 |
2124 |
+--- a/drivers/iio/adc/ad7266.c |
2125 |
++++ b/drivers/iio/adc/ad7266.c |
2126 |
+@@ -396,8 +396,8 @@ static int ad7266_probe(struct spi_device *spi) |
2127 |
+ |
2128 |
+ st = iio_priv(indio_dev); |
2129 |
+ |
2130 |
+- st->reg = devm_regulator_get(&spi->dev, "vref"); |
2131 |
+- if (!IS_ERR_OR_NULL(st->reg)) { |
2132 |
++ st->reg = devm_regulator_get_optional(&spi->dev, "vref"); |
2133 |
++ if (!IS_ERR(st->reg)) { |
2134 |
+ ret = regulator_enable(st->reg); |
2135 |
+ if (ret) |
2136 |
+ return ret; |
2137 |
+@@ -408,6 +408,9 @@ static int ad7266_probe(struct spi_device *spi) |
2138 |
+ |
2139 |
+ st->vref_mv = ret / 1000; |
2140 |
+ } else { |
2141 |
++ /* Any other error indicates that the regulator does exist */ |
2142 |
++ if (PTR_ERR(st->reg) != -ENODEV) |
2143 |
++ return PTR_ERR(st->reg); |
2144 |
+ /* Use internal reference */ |
2145 |
+ st->vref_mv = 2500; |
2146 |
+ } |
2147 |
+diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c |
2148 |
+index d31098e0c43f..ae824d40195a 100644 |
2149 |
+--- a/drivers/iio/industrialio-trigger.c |
2150 |
++++ b/drivers/iio/industrialio-trigger.c |
2151 |
+@@ -203,22 +203,35 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig, |
2152 |
+ |
2153 |
+ /* Prevent the module from being removed whilst attached to a trigger */ |
2154 |
+ __module_get(pf->indio_dev->info->driver_module); |
2155 |
++ |
2156 |
++ /* Get irq number */ |
2157 |
+ pf->irq = iio_trigger_get_irq(trig); |
2158 |
++ if (pf->irq < 0) |
2159 |
++ goto out_put_module; |
2160 |
++ |
2161 |
++ /* Request irq */ |
2162 |
+ ret = request_threaded_irq(pf->irq, pf->h, pf->thread, |
2163 |
+ pf->type, pf->name, |
2164 |
+ pf); |
2165 |
+- if (ret < 0) { |
2166 |
+- module_put(pf->indio_dev->info->driver_module); |
2167 |
+- return ret; |
2168 |
+- } |
2169 |
++ if (ret < 0) |
2170 |
++ goto out_put_irq; |
2171 |
+ |
2172 |
++ /* Enable trigger in driver */ |
2173 |
+ if (trig->ops && trig->ops->set_trigger_state && notinuse) { |
2174 |
+ ret = trig->ops->set_trigger_state(trig, true); |
2175 |
+ if (ret < 0) |
2176 |
+- module_put(pf->indio_dev->info->driver_module); |
2177 |
++ goto out_free_irq; |
2178 |
+ } |
2179 |
+ |
2180 |
+ return ret; |
2181 |
++ |
2182 |
++out_free_irq: |
2183 |
++ free_irq(pf->irq, pf); |
2184 |
++out_put_irq: |
2185 |
++ iio_trigger_put_irq(trig, pf->irq); |
2186 |
++out_put_module: |
2187 |
++ module_put(pf->indio_dev->info->driver_module); |
2188 |
++ return ret; |
2189 |
+ } |
2190 |
+ |
2191 |
+ static int iio_trigger_detach_poll_func(struct iio_trigger *trig, |
2192 |
+diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c |
2193 |
+index e881fa6291e9..1f7f844bc0b8 100644 |
2194 |
+--- a/drivers/iio/pressure/st_pressure_core.c |
2195 |
++++ b/drivers/iio/pressure/st_pressure_core.c |
2196 |
+@@ -28,15 +28,21 @@ |
2197 |
+ #include <linux/iio/common/st_sensors.h> |
2198 |
+ #include "st_pressure.h" |
2199 |
+ |
2200 |
++#define MCELSIUS_PER_CELSIUS 1000 |
2201 |
++ |
2202 |
++/* Default pressure sensitivity */ |
2203 |
+ #define ST_PRESS_LSB_PER_MBAR 4096UL |
2204 |
+ #define ST_PRESS_KPASCAL_NANO_SCALE (100000000UL / \ |
2205 |
+ ST_PRESS_LSB_PER_MBAR) |
2206 |
++ |
2207 |
++/* Default temperature sensitivity */ |
2208 |
+ #define ST_PRESS_LSB_PER_CELSIUS 480UL |
2209 |
+-#define ST_PRESS_CELSIUS_NANO_SCALE (1000000000UL / \ |
2210 |
+- ST_PRESS_LSB_PER_CELSIUS) |
2211 |
++#define ST_PRESS_MILLI_CELSIUS_OFFSET 42500UL |
2212 |
++ |
2213 |
+ #define ST_PRESS_NUMBER_DATA_CHANNELS 1 |
2214 |
+ |
2215 |
+ /* FULLSCALE */ |
2216 |
++#define ST_PRESS_FS_AVL_1100MB 1100 |
2217 |
+ #define ST_PRESS_FS_AVL_1260MB 1260 |
2218 |
+ |
2219 |
+ #define ST_PRESS_1_OUT_XL_ADDR 0x28 |
2220 |
+@@ -54,18 +60,20 @@ |
2221 |
+ #define ST_PRESS_LPS331AP_PW_MASK 0x80 |
2222 |
+ #define ST_PRESS_LPS331AP_FS_ADDR 0x23 |
2223 |
+ #define ST_PRESS_LPS331AP_FS_MASK 0x30 |
2224 |
+-#define ST_PRESS_LPS331AP_FS_AVL_1260_VAL 0x00 |
2225 |
+-#define ST_PRESS_LPS331AP_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE |
2226 |
+-#define ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN ST_PRESS_CELSIUS_NANO_SCALE |
2227 |
+ #define ST_PRESS_LPS331AP_BDU_ADDR 0x20 |
2228 |
+ #define ST_PRESS_LPS331AP_BDU_MASK 0x04 |
2229 |
+ #define ST_PRESS_LPS331AP_DRDY_IRQ_ADDR 0x22 |
2230 |
+ #define ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK 0x04 |
2231 |
+ #define ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK 0x20 |
2232 |
+ #define ST_PRESS_LPS331AP_MULTIREAD_BIT true |
2233 |
+-#define ST_PRESS_LPS331AP_TEMP_OFFSET 42500 |
2234 |
+ |
2235 |
+ /* CUSTOM VALUES FOR LPS001WP SENSOR */ |
2236 |
++ |
2237 |
++/* LPS001WP pressure resolution */ |
2238 |
++#define ST_PRESS_LPS001WP_LSB_PER_MBAR 16UL |
2239 |
++/* LPS001WP temperature resolution */ |
2240 |
++#define ST_PRESS_LPS001WP_LSB_PER_CELSIUS 64UL |
2241 |
++ |
2242 |
+ #define ST_PRESS_LPS001WP_WAI_EXP 0xba |
2243 |
+ #define ST_PRESS_LPS001WP_ODR_ADDR 0x20 |
2244 |
+ #define ST_PRESS_LPS001WP_ODR_MASK 0x30 |
2245 |
+@@ -74,6 +82,8 @@ |
2246 |
+ #define ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL 0x03 |
2247 |
+ #define ST_PRESS_LPS001WP_PW_ADDR 0x20 |
2248 |
+ #define ST_PRESS_LPS001WP_PW_MASK 0x40 |
2249 |
++#define ST_PRESS_LPS001WP_FS_AVL_PRESS_GAIN \ |
2250 |
++ (100000000UL / ST_PRESS_LPS001WP_LSB_PER_MBAR) |
2251 |
+ #define ST_PRESS_LPS001WP_BDU_ADDR 0x20 |
2252 |
+ #define ST_PRESS_LPS001WP_BDU_MASK 0x04 |
2253 |
+ #define ST_PRESS_LPS001WP_MULTIREAD_BIT true |
2254 |
+@@ -90,18 +100,12 @@ |
2255 |
+ #define ST_PRESS_LPS25H_ODR_AVL_25HZ_VAL 0x04 |
2256 |
+ #define ST_PRESS_LPS25H_PW_ADDR 0x20 |
2257 |
+ #define ST_PRESS_LPS25H_PW_MASK 0x80 |
2258 |
+-#define ST_PRESS_LPS25H_FS_ADDR 0x00 |
2259 |
+-#define ST_PRESS_LPS25H_FS_MASK 0x00 |
2260 |
+-#define ST_PRESS_LPS25H_FS_AVL_1260_VAL 0x00 |
2261 |
+-#define ST_PRESS_LPS25H_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE |
2262 |
+-#define ST_PRESS_LPS25H_FS_AVL_TEMP_GAIN ST_PRESS_CELSIUS_NANO_SCALE |
2263 |
+ #define ST_PRESS_LPS25H_BDU_ADDR 0x20 |
2264 |
+ #define ST_PRESS_LPS25H_BDU_MASK 0x04 |
2265 |
+ #define ST_PRESS_LPS25H_DRDY_IRQ_ADDR 0x23 |
2266 |
+ #define ST_PRESS_LPS25H_DRDY_IRQ_INT1_MASK 0x01 |
2267 |
+ #define ST_PRESS_LPS25H_DRDY_IRQ_INT2_MASK 0x10 |
2268 |
+ #define ST_PRESS_LPS25H_MULTIREAD_BIT true |
2269 |
+-#define ST_PRESS_LPS25H_TEMP_OFFSET 42500 |
2270 |
+ #define ST_PRESS_LPS25H_OUT_XL_ADDR 0x28 |
2271 |
+ #define ST_TEMP_LPS25H_OUT_L_ADDR 0x2b |
2272 |
+ |
2273 |
+@@ -153,7 +157,9 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { |
2274 |
+ .storagebits = 16, |
2275 |
+ .endianness = IIO_LE, |
2276 |
+ }, |
2277 |
+- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
2278 |
++ .info_mask_separate = |
2279 |
++ BIT(IIO_CHAN_INFO_RAW) | |
2280 |
++ BIT(IIO_CHAN_INFO_SCALE), |
2281 |
+ .modified = 0, |
2282 |
+ }, |
2283 |
+ { |
2284 |
+@@ -169,7 +175,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { |
2285 |
+ }, |
2286 |
+ .info_mask_separate = |
2287 |
+ BIT(IIO_CHAN_INFO_RAW) | |
2288 |
+- BIT(IIO_CHAN_INFO_OFFSET), |
2289 |
++ BIT(IIO_CHAN_INFO_SCALE), |
2290 |
+ .modified = 0, |
2291 |
+ }, |
2292 |
+ IIO_CHAN_SOFT_TIMESTAMP(1) |
2293 |
+@@ -203,11 +209,14 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { |
2294 |
+ .addr = ST_PRESS_LPS331AP_FS_ADDR, |
2295 |
+ .mask = ST_PRESS_LPS331AP_FS_MASK, |
2296 |
+ .fs_avl = { |
2297 |
++ /* |
2298 |
++ * Pressure and temperature sensitivity values |
2299 |
++ * as defined in table 3 of LPS331AP datasheet. |
2300 |
++ */ |
2301 |
+ [0] = { |
2302 |
+ .num = ST_PRESS_FS_AVL_1260MB, |
2303 |
+- .value = ST_PRESS_LPS331AP_FS_AVL_1260_VAL, |
2304 |
+- .gain = ST_PRESS_LPS331AP_FS_AVL_1260_GAIN, |
2305 |
+- .gain2 = ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN, |
2306 |
++ .gain = ST_PRESS_KPASCAL_NANO_SCALE, |
2307 |
++ .gain2 = ST_PRESS_LSB_PER_CELSIUS, |
2308 |
+ }, |
2309 |
+ }, |
2310 |
+ }, |
2311 |
+@@ -246,7 +255,17 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { |
2312 |
+ .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, |
2313 |
+ }, |
2314 |
+ .fs = { |
2315 |
+- .addr = 0, |
2316 |
++ .fs_avl = { |
2317 |
++ /* |
2318 |
++ * Pressure and temperature resolution values |
2319 |
++ * as defined in table 3 of LPS001WP datasheet. |
2320 |
++ */ |
2321 |
++ [0] = { |
2322 |
++ .num = ST_PRESS_FS_AVL_1100MB, |
2323 |
++ .gain = ST_PRESS_LPS001WP_FS_AVL_PRESS_GAIN, |
2324 |
++ .gain2 = ST_PRESS_LPS001WP_LSB_PER_CELSIUS, |
2325 |
++ }, |
2326 |
++ }, |
2327 |
+ }, |
2328 |
+ .bdu = { |
2329 |
+ .addr = ST_PRESS_LPS001WP_BDU_ADDR, |
2330 |
+@@ -282,14 +301,15 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { |
2331 |
+ .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, |
2332 |
+ }, |
2333 |
+ .fs = { |
2334 |
+- .addr = ST_PRESS_LPS25H_FS_ADDR, |
2335 |
+- .mask = ST_PRESS_LPS25H_FS_MASK, |
2336 |
+ .fs_avl = { |
2337 |
++ /* |
2338 |
++ * Pressure and temperature sensitivity values |
2339 |
++ * as defined in table 3 of LPS25H datasheet. |
2340 |
++ */ |
2341 |
+ [0] = { |
2342 |
+ .num = ST_PRESS_FS_AVL_1260MB, |
2343 |
+- .value = ST_PRESS_LPS25H_FS_AVL_1260_VAL, |
2344 |
+- .gain = ST_PRESS_LPS25H_FS_AVL_1260_GAIN, |
2345 |
+- .gain2 = ST_PRESS_LPS25H_FS_AVL_TEMP_GAIN, |
2346 |
++ .gain = ST_PRESS_KPASCAL_NANO_SCALE, |
2347 |
++ .gain2 = ST_PRESS_LSB_PER_CELSIUS, |
2348 |
+ }, |
2349 |
+ }, |
2350 |
+ }, |
2351 |
+@@ -343,26 +363,26 @@ static int st_press_read_raw(struct iio_dev *indio_dev, |
2352 |
+ |
2353 |
+ return IIO_VAL_INT; |
2354 |
+ case IIO_CHAN_INFO_SCALE: |
2355 |
+- *val = 0; |
2356 |
+- |
2357 |
+ switch (ch->type) { |
2358 |
+ case IIO_PRESSURE: |
2359 |
++ *val = 0; |
2360 |
+ *val2 = press_data->current_fullscale->gain; |
2361 |
+- break; |
2362 |
++ return IIO_VAL_INT_PLUS_NANO; |
2363 |
+ case IIO_TEMP: |
2364 |
++ *val = MCELSIUS_PER_CELSIUS; |
2365 |
+ *val2 = press_data->current_fullscale->gain2; |
2366 |
+- break; |
2367 |
++ return IIO_VAL_FRACTIONAL; |
2368 |
+ default: |
2369 |
+ err = -EINVAL; |
2370 |
+ goto read_error; |
2371 |
+ } |
2372 |
+ |
2373 |
+- return IIO_VAL_INT_PLUS_NANO; |
2374 |
+ case IIO_CHAN_INFO_OFFSET: |
2375 |
+ switch (ch->type) { |
2376 |
+ case IIO_TEMP: |
2377 |
+- *val = 425; |
2378 |
+- *val2 = 10; |
2379 |
++ *val = ST_PRESS_MILLI_CELSIUS_OFFSET * |
2380 |
++ press_data->current_fullscale->gain2; |
2381 |
++ *val2 = MCELSIUS_PER_CELSIUS; |
2382 |
+ break; |
2383 |
+ default: |
2384 |
+ err = -EINVAL; |
2385 |
+diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c |
2386 |
+index bc0d68efd455..c96ddaf00fa6 100644 |
2387 |
+--- a/drivers/iio/proximity/as3935.c |
2388 |
++++ b/drivers/iio/proximity/as3935.c |
2389 |
+@@ -64,6 +64,7 @@ struct as3935_state { |
2390 |
+ struct delayed_work work; |
2391 |
+ |
2392 |
+ u32 tune_cap; |
2393 |
++ u8 buffer[16]; /* 8-bit data + 56-bit padding + 64-bit timestamp */ |
2394 |
+ u8 buf[2] ____cacheline_aligned; |
2395 |
+ }; |
2396 |
+ |
2397 |
+@@ -72,7 +73,8 @@ static const struct iio_chan_spec as3935_channels[] = { |
2398 |
+ .type = IIO_PROXIMITY, |
2399 |
+ .info_mask_separate = |
2400 |
+ BIT(IIO_CHAN_INFO_RAW) | |
2401 |
+- BIT(IIO_CHAN_INFO_PROCESSED), |
2402 |
++ BIT(IIO_CHAN_INFO_PROCESSED) | |
2403 |
++ BIT(IIO_CHAN_INFO_SCALE), |
2404 |
+ .scan_index = 0, |
2405 |
+ .scan_type = { |
2406 |
+ .sign = 'u', |
2407 |
+@@ -181,7 +183,12 @@ static int as3935_read_raw(struct iio_dev *indio_dev, |
2408 |
+ /* storm out of range */ |
2409 |
+ if (*val == AS3935_DATA_MASK) |
2410 |
+ return -EINVAL; |
2411 |
+- *val *= 1000; |
2412 |
++ |
2413 |
++ if (m == IIO_CHAN_INFO_PROCESSED) |
2414 |
++ *val *= 1000; |
2415 |
++ break; |
2416 |
++ case IIO_CHAN_INFO_SCALE: |
2417 |
++ *val = 1000; |
2418 |
+ break; |
2419 |
+ default: |
2420 |
+ return -EINVAL; |
2421 |
+@@ -206,10 +213,10 @@ static irqreturn_t as3935_trigger_handler(int irq, void *private) |
2422 |
+ ret = as3935_read(st, AS3935_DATA, &val); |
2423 |
+ if (ret) |
2424 |
+ goto err_read; |
2425 |
+- val &= AS3935_DATA_MASK; |
2426 |
+- val *= 1000; |
2427 |
+ |
2428 |
+- iio_push_to_buffers_with_timestamp(indio_dev, &val, pf->timestamp); |
2429 |
++ st->buffer[0] = val & AS3935_DATA_MASK; |
2430 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &st->buffer, |
2431 |
++ pf->timestamp); |
2432 |
+ err_read: |
2433 |
+ iio_trigger_notify_done(indio_dev->trig); |
2434 |
+ |
2435 |
+diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c |
2436 |
+index cb5ece77fd7d..e7d7230a7e31 100644 |
2437 |
+--- a/drivers/input/serio/i8042.c |
2438 |
++++ b/drivers/input/serio/i8042.c |
2439 |
+@@ -1249,6 +1249,7 @@ static int __init i8042_create_kbd_port(void) |
2440 |
+ serio->start = i8042_start; |
2441 |
+ serio->stop = i8042_stop; |
2442 |
+ serio->close = i8042_port_close; |
2443 |
++ serio->ps2_cmd_mutex = &i8042_mutex; |
2444 |
+ serio->port_data = port; |
2445 |
+ serio->dev.parent = &i8042_platform_device->dev; |
2446 |
+ strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name)); |
2447 |
+@@ -1345,21 +1346,6 @@ static void i8042_unregister_ports(void) |
2448 |
+ } |
2449 |
+ } |
2450 |
+ |
2451 |
+-/* |
2452 |
+- * Checks whether port belongs to i8042 controller. |
2453 |
+- */ |
2454 |
+-bool i8042_check_port_owner(const struct serio *port) |
2455 |
+-{ |
2456 |
+- int i; |
2457 |
+- |
2458 |
+- for (i = 0; i < I8042_NUM_PORTS; i++) |
2459 |
+- if (i8042_ports[i].serio == port) |
2460 |
+- return true; |
2461 |
+- |
2462 |
+- return false; |
2463 |
+-} |
2464 |
+-EXPORT_SYMBOL(i8042_check_port_owner); |
2465 |
+- |
2466 |
+ static void i8042_free_irqs(void) |
2467 |
+ { |
2468 |
+ if (i8042_aux_irq_registered) |
2469 |
+diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c |
2470 |
+index 75516996db20..ded0c6f65c9f 100644 |
2471 |
+--- a/drivers/input/serio/libps2.c |
2472 |
++++ b/drivers/input/serio/libps2.c |
2473 |
+@@ -56,19 +56,17 @@ EXPORT_SYMBOL(ps2_sendbyte); |
2474 |
+ |
2475 |
+ void ps2_begin_command(struct ps2dev *ps2dev) |
2476 |
+ { |
2477 |
+- mutex_lock(&ps2dev->cmd_mutex); |
2478 |
++ struct mutex *m = ps2dev->serio->ps2_cmd_mutex ?: &ps2dev->cmd_mutex; |
2479 |
+ |
2480 |
+- if (i8042_check_port_owner(ps2dev->serio)) |
2481 |
+- i8042_lock_chip(); |
2482 |
++ mutex_lock(m); |
2483 |
+ } |
2484 |
+ EXPORT_SYMBOL(ps2_begin_command); |
2485 |
+ |
2486 |
+ void ps2_end_command(struct ps2dev *ps2dev) |
2487 |
+ { |
2488 |
+- if (i8042_check_port_owner(ps2dev->serio)) |
2489 |
+- i8042_unlock_chip(); |
2490 |
++ struct mutex *m = ps2dev->serio->ps2_cmd_mutex ?: &ps2dev->cmd_mutex; |
2491 |
+ |
2492 |
+- mutex_unlock(&ps2dev->cmd_mutex); |
2493 |
++ mutex_unlock(m); |
2494 |
+ } |
2495 |
+ EXPORT_SYMBOL(ps2_end_command); |
2496 |
+ |
2497 |
+diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c |
2498 |
+index b257e46876d3..0f5e1820c92d 100644 |
2499 |
+--- a/drivers/md/dm-flakey.c |
2500 |
++++ b/drivers/md/dm-flakey.c |
2501 |
+@@ -287,10 +287,16 @@ static int flakey_map(struct dm_target *ti, struct bio *bio) |
2502 |
+ pb->bio_submitted = true; |
2503 |
+ |
2504 |
+ /* |
2505 |
+- * Map reads as normal. |
2506 |
++ * Map reads as normal only if corrupt_bio_byte set. |
2507 |
+ */ |
2508 |
+- if (bio_data_dir(bio) == READ) |
2509 |
+- goto map_bio; |
2510 |
++ if (bio_data_dir(bio) == READ) { |
2511 |
++ /* If flags were specified, only corrupt those that match. */ |
2512 |
++ if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) && |
2513 |
++ all_corrupt_bio_flags_match(bio, fc)) |
2514 |
++ goto map_bio; |
2515 |
++ else |
2516 |
++ return -EIO; |
2517 |
++ } |
2518 |
+ |
2519 |
+ /* |
2520 |
+ * Drop writes? |
2521 |
+@@ -328,12 +334,13 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error) |
2522 |
+ |
2523 |
+ /* |
2524 |
+ * Corrupt successful READs while in down state. |
2525 |
+- * If flags were specified, only corrupt those that match. |
2526 |
+ */ |
2527 |
+- if (fc->corrupt_bio_byte && !error && pb->bio_submitted && |
2528 |
+- (bio_data_dir(bio) == READ) && (fc->corrupt_bio_rw == READ) && |
2529 |
+- all_corrupt_bio_flags_match(bio, fc)) |
2530 |
+- corrupt_bio_data(bio, fc); |
2531 |
++ if (!error && pb->bio_submitted && (bio_data_dir(bio) == READ)) { |
2532 |
++ if (fc->corrupt_bio_byte) |
2533 |
++ corrupt_bio_data(bio, fc); |
2534 |
++ else |
2535 |
++ return -EIO; |
2536 |
++ } |
2537 |
+ |
2538 |
+ return error; |
2539 |
+ } |
2540 |
+diff --git a/drivers/md/dm.c b/drivers/md/dm.c |
2541 |
+index 1f37781f7765..87de9a0848b7 100644 |
2542 |
+--- a/drivers/md/dm.c |
2543 |
++++ b/drivers/md/dm.c |
2544 |
+@@ -1200,8 +1200,14 @@ static void stop_queue(struct request_queue *q) |
2545 |
+ { |
2546 |
+ if (!q->mq_ops) |
2547 |
+ old_stop_queue(q); |
2548 |
+- else |
2549 |
++ else { |
2550 |
++ spin_lock_irq(q->queue_lock); |
2551 |
++ queue_flag_set(QUEUE_FLAG_STOPPED, q); |
2552 |
++ spin_unlock_irq(q->queue_lock); |
2553 |
++ |
2554 |
++ blk_mq_cancel_requeue_work(q); |
2555 |
+ blk_mq_stop_hw_queues(q); |
2556 |
++ } |
2557 |
+ } |
2558 |
+ |
2559 |
+ static void old_start_queue(struct request_queue *q) |
2560 |
+@@ -1218,8 +1224,10 @@ static void start_queue(struct request_queue *q) |
2561 |
+ { |
2562 |
+ if (!q->mq_ops) |
2563 |
+ old_start_queue(q); |
2564 |
+- else |
2565 |
++ else { |
2566 |
++ queue_flag_clear_unlocked(QUEUE_FLAG_STOPPED, q); |
2567 |
+ blk_mq_start_stopped_hw_queues(q, true); |
2568 |
++ } |
2569 |
+ } |
2570 |
+ |
2571 |
+ static void dm_done(struct request *clone, int error, bool mapped) |
2572 |
+@@ -2139,7 +2147,7 @@ static void dm_request_fn(struct request_queue *q) |
2573 |
+ goto out; |
2574 |
+ |
2575 |
+ delay_and_out: |
2576 |
+- blk_delay_queue(q, HZ / 100); |
2577 |
++ blk_delay_queue(q, 10); |
2578 |
+ out: |
2579 |
+ dm_put_live_table(md, srcu_idx); |
2580 |
+ } |
2581 |
+@@ -2731,6 +2739,17 @@ static int dm_mq_queue_rq(struct blk_mq_hw_ctx *hctx, |
2582 |
+ } |
2583 |
+ dm_put_live_table(md, srcu_idx); |
2584 |
+ |
2585 |
++ /* |
2586 |
++ * On suspend dm_stop_queue() handles stopping the blk-mq |
2587 |
++ * request_queue BUT: even though the hw_queues are marked |
2588 |
++ * BLK_MQ_S_STOPPED at that point there is still a race that |
2589 |
++ * is allowing block/blk-mq.c to call ->queue_rq against a |
2590 |
++ * hctx that it really shouldn't. The following check guards |
2591 |
++ * against this rarity (albeit _not_ race-free). |
2592 |
++ */ |
2593 |
++ if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state))) |
2594 |
++ return BLK_MQ_RQ_QUEUE_BUSY; |
2595 |
++ |
2596 |
+ if (ti->type->busy && ti->type->busy(ti)) |
2597 |
+ return BLK_MQ_RQ_QUEUE_BUSY; |
2598 |
+ |
2599 |
+@@ -3130,7 +3149,8 @@ static void unlock_fs(struct mapped_device *md) |
2600 |
+ * Caller must hold md->suspend_lock |
2601 |
+ */ |
2602 |
+ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, |
2603 |
+- unsigned suspend_flags, int interruptible) |
2604 |
++ unsigned suspend_flags, int interruptible, |
2605 |
++ int dmf_suspended_flag) |
2606 |
+ { |
2607 |
+ bool do_lockfs = suspend_flags & DM_SUSPEND_LOCKFS_FLAG; |
2608 |
+ bool noflush = suspend_flags & DM_SUSPEND_NOFLUSH_FLAG; |
2609 |
+@@ -3197,6 +3217,8 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, |
2610 |
+ * to finish. |
2611 |
+ */ |
2612 |
+ r = dm_wait_for_completion(md, interruptible); |
2613 |
++ if (!r) |
2614 |
++ set_bit(dmf_suspended_flag, &md->flags); |
2615 |
+ |
2616 |
+ if (noflush) |
2617 |
+ clear_bit(DMF_NOFLUSH_SUSPENDING, &md->flags); |
2618 |
+@@ -3258,12 +3280,10 @@ retry: |
2619 |
+ |
2620 |
+ map = rcu_dereference_protected(md->map, lockdep_is_held(&md->suspend_lock)); |
2621 |
+ |
2622 |
+- r = __dm_suspend(md, map, suspend_flags, TASK_INTERRUPTIBLE); |
2623 |
++ r = __dm_suspend(md, map, suspend_flags, TASK_INTERRUPTIBLE, DMF_SUSPENDED); |
2624 |
+ if (r) |
2625 |
+ goto out_unlock; |
2626 |
+ |
2627 |
+- set_bit(DMF_SUSPENDED, &md->flags); |
2628 |
+- |
2629 |
+ dm_table_postsuspend_targets(map); |
2630 |
+ |
2631 |
+ out_unlock: |
2632 |
+@@ -3357,9 +3377,8 @@ static void __dm_internal_suspend(struct mapped_device *md, unsigned suspend_fla |
2633 |
+ * would require changing .presuspend to return an error -- avoid this |
2634 |
+ * until there is a need for more elaborate variants of internal suspend. |
2635 |
+ */ |
2636 |
+- (void) __dm_suspend(md, map, suspend_flags, TASK_UNINTERRUPTIBLE); |
2637 |
+- |
2638 |
+- set_bit(DMF_SUSPENDED_INTERNALLY, &md->flags); |
2639 |
++ (void) __dm_suspend(md, map, suspend_flags, TASK_UNINTERRUPTIBLE, |
2640 |
++ DMF_SUSPENDED_INTERNALLY); |
2641 |
+ |
2642 |
+ dm_table_postsuspend_targets(map); |
2643 |
+ } |
2644 |
+diff --git a/drivers/media/dvb-core/dvb_ringbuffer.c b/drivers/media/dvb-core/dvb_ringbuffer.c |
2645 |
+index 1100e98a7b1d..7df7fb3738a0 100644 |
2646 |
+--- a/drivers/media/dvb-core/dvb_ringbuffer.c |
2647 |
++++ b/drivers/media/dvb-core/dvb_ringbuffer.c |
2648 |
+@@ -55,7 +55,13 @@ void dvb_ringbuffer_init(struct dvb_ringbuffer *rbuf, void *data, size_t len) |
2649 |
+ |
2650 |
+ int dvb_ringbuffer_empty(struct dvb_ringbuffer *rbuf) |
2651 |
+ { |
2652 |
+- return (rbuf->pread==rbuf->pwrite); |
2653 |
++ /* smp_load_acquire() to load write pointer on reader side |
2654 |
++ * this pairs with smp_store_release() in dvb_ringbuffer_write(), |
2655 |
++ * dvb_ringbuffer_write_user(), or dvb_ringbuffer_reset() |
2656 |
++ * |
2657 |
++ * for memory barriers also see Documentation/circular-buffers.txt |
2658 |
++ */ |
2659 |
++ return (rbuf->pread == smp_load_acquire(&rbuf->pwrite)); |
2660 |
+ } |
2661 |
+ |
2662 |
+ |
2663 |
+@@ -64,7 +70,12 @@ ssize_t dvb_ringbuffer_free(struct dvb_ringbuffer *rbuf) |
2664 |
+ { |
2665 |
+ ssize_t free; |
2666 |
+ |
2667 |
+- free = rbuf->pread - rbuf->pwrite; |
2668 |
++ /* ACCESS_ONCE() to load read pointer on writer side |
2669 |
++ * this pairs with smp_store_release() in dvb_ringbuffer_read(), |
2670 |
++ * dvb_ringbuffer_read_user(), dvb_ringbuffer_flush(), |
2671 |
++ * or dvb_ringbuffer_reset() |
2672 |
++ */ |
2673 |
++ free = ACCESS_ONCE(rbuf->pread) - rbuf->pwrite; |
2674 |
+ if (free <= 0) |
2675 |
+ free += rbuf->size; |
2676 |
+ return free-1; |
2677 |
+@@ -76,7 +87,11 @@ ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf) |
2678 |
+ { |
2679 |
+ ssize_t avail; |
2680 |
+ |
2681 |
+- avail = rbuf->pwrite - rbuf->pread; |
2682 |
++ /* smp_load_acquire() to load write pointer on reader side |
2683 |
++ * this pairs with smp_store_release() in dvb_ringbuffer_write(), |
2684 |
++ * dvb_ringbuffer_write_user(), or dvb_ringbuffer_reset() |
2685 |
++ */ |
2686 |
++ avail = smp_load_acquire(&rbuf->pwrite) - rbuf->pread; |
2687 |
+ if (avail < 0) |
2688 |
+ avail += rbuf->size; |
2689 |
+ return avail; |
2690 |
+@@ -86,14 +101,25 @@ ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf) |
2691 |
+ |
2692 |
+ void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf) |
2693 |
+ { |
2694 |
+- rbuf->pread = rbuf->pwrite; |
2695 |
++ /* dvb_ringbuffer_flush() counts as read operation |
2696 |
++ * smp_load_acquire() to load write pointer |
2697 |
++ * smp_store_release() to update read pointer, this ensures that the |
2698 |
++ * correct pointer is visible for subsequent dvb_ringbuffer_free() |
2699 |
++ * calls on other cpu cores |
2700 |
++ */ |
2701 |
++ smp_store_release(&rbuf->pread, smp_load_acquire(&rbuf->pwrite)); |
2702 |
+ rbuf->error = 0; |
2703 |
+ } |
2704 |
+ EXPORT_SYMBOL(dvb_ringbuffer_flush); |
2705 |
+ |
2706 |
+ void dvb_ringbuffer_reset(struct dvb_ringbuffer *rbuf) |
2707 |
+ { |
2708 |
+- rbuf->pread = rbuf->pwrite = 0; |
2709 |
++ /* dvb_ringbuffer_reset() counts as read and write operation |
2710 |
++ * smp_store_release() to update read pointer |
2711 |
++ */ |
2712 |
++ smp_store_release(&rbuf->pread, 0); |
2713 |
++ /* smp_store_release() to update write pointer */ |
2714 |
++ smp_store_release(&rbuf->pwrite, 0); |
2715 |
+ rbuf->error = 0; |
2716 |
+ } |
2717 |
+ |
2718 |
+@@ -119,12 +145,17 @@ ssize_t dvb_ringbuffer_read_user(struct dvb_ringbuffer *rbuf, u8 __user *buf, si |
2719 |
+ return -EFAULT; |
2720 |
+ buf += split; |
2721 |
+ todo -= split; |
2722 |
+- rbuf->pread = 0; |
2723 |
++ /* smp_store_release() for read pointer update to ensure |
2724 |
++ * that buf is not overwritten until read is complete, |
2725 |
++ * this pairs with ACCESS_ONCE() in dvb_ringbuffer_free() |
2726 |
++ */ |
2727 |
++ smp_store_release(&rbuf->pread, 0); |
2728 |
+ } |
2729 |
+ if (copy_to_user(buf, rbuf->data+rbuf->pread, todo)) |
2730 |
+ return -EFAULT; |
2731 |
+ |
2732 |
+- rbuf->pread = (rbuf->pread + todo) % rbuf->size; |
2733 |
++ /* smp_store_release() to update read pointer, see above */ |
2734 |
++ smp_store_release(&rbuf->pread, (rbuf->pread + todo) % rbuf->size); |
2735 |
+ |
2736 |
+ return len; |
2737 |
+ } |
2738 |
+@@ -139,11 +170,16 @@ void dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf, size_t len) |
2739 |
+ memcpy(buf, rbuf->data+rbuf->pread, split); |
2740 |
+ buf += split; |
2741 |
+ todo -= split; |
2742 |
+- rbuf->pread = 0; |
2743 |
++ /* smp_store_release() for read pointer update to ensure |
2744 |
++ * that buf is not overwritten until read is complete, |
2745 |
++ * this pairs with ACCESS_ONCE() in dvb_ringbuffer_free() |
2746 |
++ */ |
2747 |
++ smp_store_release(&rbuf->pread, 0); |
2748 |
+ } |
2749 |
+ memcpy(buf, rbuf->data+rbuf->pread, todo); |
2750 |
+ |
2751 |
+- rbuf->pread = (rbuf->pread + todo) % rbuf->size; |
2752 |
++ /* smp_store_release() to update read pointer, see above */ |
2753 |
++ smp_store_release(&rbuf->pread, (rbuf->pread + todo) % rbuf->size); |
2754 |
+ } |
2755 |
+ |
2756 |
+ |
2757 |
+@@ -158,10 +194,16 @@ ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, size_t |
2758 |
+ memcpy(rbuf->data+rbuf->pwrite, buf, split); |
2759 |
+ buf += split; |
2760 |
+ todo -= split; |
2761 |
+- rbuf->pwrite = 0; |
2762 |
++ /* smp_store_release() for write pointer update to ensure that |
2763 |
++ * written data is visible on other cpu cores before the pointer |
2764 |
++ * update, this pairs with smp_load_acquire() in |
2765 |
++ * dvb_ringbuffer_empty() or dvb_ringbuffer_avail() |
2766 |
++ */ |
2767 |
++ smp_store_release(&rbuf->pwrite, 0); |
2768 |
+ } |
2769 |
+ memcpy(rbuf->data+rbuf->pwrite, buf, todo); |
2770 |
+- rbuf->pwrite = (rbuf->pwrite + todo) % rbuf->size; |
2771 |
++ /* smp_store_release() for write pointer update, see above */ |
2772 |
++ smp_store_release(&rbuf->pwrite, (rbuf->pwrite + todo) % rbuf->size); |
2773 |
+ |
2774 |
+ return len; |
2775 |
+ } |
2776 |
+@@ -181,12 +223,18 @@ ssize_t dvb_ringbuffer_write_user(struct dvb_ringbuffer *rbuf, |
2777 |
+ return len - todo; |
2778 |
+ buf += split; |
2779 |
+ todo -= split; |
2780 |
+- rbuf->pwrite = 0; |
2781 |
++ /* smp_store_release() for write pointer update to ensure that |
2782 |
++ * written data is visible on other cpu cores before the pointer |
2783 |
++ * update, this pairs with smp_load_acquire() in |
2784 |
++ * dvb_ringbuffer_empty() or dvb_ringbuffer_avail() |
2785 |
++ */ |
2786 |
++ smp_store_release(&rbuf->pwrite, 0); |
2787 |
+ } |
2788 |
+ status = copy_from_user(rbuf->data+rbuf->pwrite, buf, todo); |
2789 |
+ if (status) |
2790 |
+ return len - todo; |
2791 |
+- rbuf->pwrite = (rbuf->pwrite + todo) % rbuf->size; |
2792 |
++ /* smp_store_release() for write pointer update, see above */ |
2793 |
++ smp_store_release(&rbuf->pwrite, (rbuf->pwrite + todo) % rbuf->size); |
2794 |
+ |
2795 |
+ return len; |
2796 |
+ } |
2797 |
+diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c |
2798 |
+index 8333fbc2fe96..835dbb8f5970 100644 |
2799 |
+--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c |
2800 |
++++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c |
2801 |
+@@ -1022,6 +1022,11 @@ static int match_child(struct device *dev, void *data) |
2802 |
+ return !strcmp(dev_name(dev), (char *)data); |
2803 |
+ } |
2804 |
+ |
2805 |
++static void s5p_mfc_memdev_release(struct device *dev) |
2806 |
++{ |
2807 |
++ dma_release_declared_memory(dev); |
2808 |
++} |
2809 |
++ |
2810 |
+ static void *mfc_get_drv_data(struct platform_device *pdev); |
2811 |
+ |
2812 |
+ static int s5p_mfc_alloc_memdevs(struct s5p_mfc_dev *dev) |
2813 |
+@@ -1034,6 +1039,9 @@ static int s5p_mfc_alloc_memdevs(struct s5p_mfc_dev *dev) |
2814 |
+ mfc_err("Not enough memory\n"); |
2815 |
+ return -ENOMEM; |
2816 |
+ } |
2817 |
++ |
2818 |
++ dev_set_name(dev->mem_dev_l, "%s", "s5p-mfc-l"); |
2819 |
++ dev->mem_dev_l->release = s5p_mfc_memdev_release; |
2820 |
+ device_initialize(dev->mem_dev_l); |
2821 |
+ of_property_read_u32_array(dev->plat_dev->dev.of_node, |
2822 |
+ "samsung,mfc-l", mem_info, 2); |
2823 |
+@@ -1051,6 +1059,9 @@ static int s5p_mfc_alloc_memdevs(struct s5p_mfc_dev *dev) |
2824 |
+ mfc_err("Not enough memory\n"); |
2825 |
+ return -ENOMEM; |
2826 |
+ } |
2827 |
++ |
2828 |
++ dev_set_name(dev->mem_dev_r, "%s", "s5p-mfc-r"); |
2829 |
++ dev->mem_dev_r->release = s5p_mfc_memdev_release; |
2830 |
+ device_initialize(dev->mem_dev_r); |
2831 |
+ of_property_read_u32_array(dev->plat_dev->dev.of_node, |
2832 |
+ "samsung,mfc-r", mem_info, 2); |
2833 |
+diff --git a/drivers/media/rc/ir-rc5-decoder.c b/drivers/media/rc/ir-rc5-decoder.c |
2834 |
+index 84fa6e9b59a1..67314c034cdb 100644 |
2835 |
+--- a/drivers/media/rc/ir-rc5-decoder.c |
2836 |
++++ b/drivers/media/rc/ir-rc5-decoder.c |
2837 |
+@@ -29,7 +29,7 @@ |
2838 |
+ #define RC5_BIT_START (1 * RC5_UNIT) |
2839 |
+ #define RC5_BIT_END (1 * RC5_UNIT) |
2840 |
+ #define RC5X_SPACE (4 * RC5_UNIT) |
2841 |
+-#define RC5_TRAILER (10 * RC5_UNIT) /* In reality, approx 100 */ |
2842 |
++#define RC5_TRAILER (6 * RC5_UNIT) /* In reality, approx 100 */ |
2843 |
+ |
2844 |
+ enum rc5_state { |
2845 |
+ STATE_INACTIVE, |
2846 |
+diff --git a/drivers/media/usb/usbtv/usbtv-audio.c b/drivers/media/usb/usbtv/usbtv-audio.c |
2847 |
+index 78c12d22dfbb..5dab02432e82 100644 |
2848 |
+--- a/drivers/media/usb/usbtv/usbtv-audio.c |
2849 |
++++ b/drivers/media/usb/usbtv/usbtv-audio.c |
2850 |
+@@ -278,6 +278,9 @@ static void snd_usbtv_trigger(struct work_struct *work) |
2851 |
+ { |
2852 |
+ struct usbtv *chip = container_of(work, struct usbtv, snd_trigger); |
2853 |
+ |
2854 |
++ if (!chip->snd) |
2855 |
++ return; |
2856 |
++ |
2857 |
+ if (atomic_read(&chip->snd_stream)) |
2858 |
+ usbtv_audio_start(chip); |
2859 |
+ else |
2860 |
+@@ -378,6 +381,8 @@ err: |
2861 |
+ |
2862 |
+ void usbtv_audio_free(struct usbtv *usbtv) |
2863 |
+ { |
2864 |
++ cancel_work_sync(&usbtv->snd_trigger); |
2865 |
++ |
2866 |
+ if (usbtv->snd && usbtv->udev) { |
2867 |
+ snd_card_free(usbtv->snd); |
2868 |
+ usbtv->snd = NULL; |
2869 |
+diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c |
2870 |
+index 12e324319573..798761f2252f 100644 |
2871 |
+--- a/drivers/mfd/qcom_rpm.c |
2872 |
++++ b/drivers/mfd/qcom_rpm.c |
2873 |
+@@ -34,7 +34,13 @@ struct qcom_rpm_resource { |
2874 |
+ struct qcom_rpm_data { |
2875 |
+ u32 version; |
2876 |
+ const struct qcom_rpm_resource *resource_table; |
2877 |
+- unsigned n_resources; |
2878 |
++ unsigned int n_resources; |
2879 |
++ unsigned int req_ctx_off; |
2880 |
++ unsigned int req_sel_off; |
2881 |
++ unsigned int ack_ctx_off; |
2882 |
++ unsigned int ack_sel_off; |
2883 |
++ unsigned int req_sel_size; |
2884 |
++ unsigned int ack_sel_size; |
2885 |
+ }; |
2886 |
+ |
2887 |
+ struct qcom_rpm { |
2888 |
+@@ -61,11 +67,7 @@ struct qcom_rpm { |
2889 |
+ |
2890 |
+ #define RPM_REQUEST_TIMEOUT (5 * HZ) |
2891 |
+ |
2892 |
+-#define RPM_REQUEST_CONTEXT 3 |
2893 |
+-#define RPM_REQ_SELECT 11 |
2894 |
+-#define RPM_ACK_CONTEXT 15 |
2895 |
+-#define RPM_ACK_SELECTOR 23 |
2896 |
+-#define RPM_SELECT_SIZE 7 |
2897 |
++#define RPM_MAX_SEL_SIZE 7 |
2898 |
+ |
2899 |
+ #define RPM_NOTIFICATION BIT(30) |
2900 |
+ #define RPM_REJECTED BIT(31) |
2901 |
+@@ -156,6 +158,12 @@ static const struct qcom_rpm_data apq8064_template = { |
2902 |
+ .version = 3, |
2903 |
+ .resource_table = apq8064_rpm_resource_table, |
2904 |
+ .n_resources = ARRAY_SIZE(apq8064_rpm_resource_table), |
2905 |
++ .req_ctx_off = 3, |
2906 |
++ .req_sel_off = 11, |
2907 |
++ .ack_ctx_off = 15, |
2908 |
++ .ack_sel_off = 23, |
2909 |
++ .req_sel_size = 4, |
2910 |
++ .ack_sel_size = 7, |
2911 |
+ }; |
2912 |
+ |
2913 |
+ static const struct qcom_rpm_resource msm8660_rpm_resource_table[] = { |
2914 |
+@@ -239,6 +247,12 @@ static const struct qcom_rpm_data msm8660_template = { |
2915 |
+ .version = 2, |
2916 |
+ .resource_table = msm8660_rpm_resource_table, |
2917 |
+ .n_resources = ARRAY_SIZE(msm8660_rpm_resource_table), |
2918 |
++ .req_ctx_off = 3, |
2919 |
++ .req_sel_off = 11, |
2920 |
++ .ack_ctx_off = 19, |
2921 |
++ .ack_sel_off = 27, |
2922 |
++ .req_sel_size = 7, |
2923 |
++ .ack_sel_size = 7, |
2924 |
+ }; |
2925 |
+ |
2926 |
+ static const struct qcom_rpm_resource msm8960_rpm_resource_table[] = { |
2927 |
+@@ -321,6 +335,12 @@ static const struct qcom_rpm_data msm8960_template = { |
2928 |
+ .version = 3, |
2929 |
+ .resource_table = msm8960_rpm_resource_table, |
2930 |
+ .n_resources = ARRAY_SIZE(msm8960_rpm_resource_table), |
2931 |
++ .req_ctx_off = 3, |
2932 |
++ .req_sel_off = 11, |
2933 |
++ .ack_ctx_off = 15, |
2934 |
++ .ack_sel_off = 23, |
2935 |
++ .req_sel_size = 4, |
2936 |
++ .ack_sel_size = 7, |
2937 |
+ }; |
2938 |
+ |
2939 |
+ static const struct qcom_rpm_resource ipq806x_rpm_resource_table[] = { |
2940 |
+@@ -361,6 +381,12 @@ static const struct qcom_rpm_data ipq806x_template = { |
2941 |
+ .version = 3, |
2942 |
+ .resource_table = ipq806x_rpm_resource_table, |
2943 |
+ .n_resources = ARRAY_SIZE(ipq806x_rpm_resource_table), |
2944 |
++ .req_ctx_off = 3, |
2945 |
++ .req_sel_off = 11, |
2946 |
++ .ack_ctx_off = 15, |
2947 |
++ .ack_sel_off = 23, |
2948 |
++ .req_sel_size = 4, |
2949 |
++ .ack_sel_size = 7, |
2950 |
+ }; |
2951 |
+ |
2952 |
+ static const struct of_device_id qcom_rpm_of_match[] = { |
2953 |
+@@ -379,7 +405,7 @@ int qcom_rpm_write(struct qcom_rpm *rpm, |
2954 |
+ { |
2955 |
+ const struct qcom_rpm_resource *res; |
2956 |
+ const struct qcom_rpm_data *data = rpm->data; |
2957 |
+- u32 sel_mask[RPM_SELECT_SIZE] = { 0 }; |
2958 |
++ u32 sel_mask[RPM_MAX_SEL_SIZE] = { 0 }; |
2959 |
+ int left; |
2960 |
+ int ret = 0; |
2961 |
+ int i; |
2962 |
+@@ -397,12 +423,12 @@ int qcom_rpm_write(struct qcom_rpm *rpm, |
2963 |
+ writel_relaxed(buf[i], RPM_REQ_REG(rpm, res->target_id + i)); |
2964 |
+ |
2965 |
+ bitmap_set((unsigned long *)sel_mask, res->select_id, 1); |
2966 |
+- for (i = 0; i < ARRAY_SIZE(sel_mask); i++) { |
2967 |
++ for (i = 0; i < rpm->data->req_sel_size; i++) { |
2968 |
+ writel_relaxed(sel_mask[i], |
2969 |
+- RPM_CTRL_REG(rpm, RPM_REQ_SELECT + i)); |
2970 |
++ RPM_CTRL_REG(rpm, rpm->data->req_sel_off + i)); |
2971 |
+ } |
2972 |
+ |
2973 |
+- writel_relaxed(BIT(state), RPM_CTRL_REG(rpm, RPM_REQUEST_CONTEXT)); |
2974 |
++ writel_relaxed(BIT(state), RPM_CTRL_REG(rpm, rpm->data->req_ctx_off)); |
2975 |
+ |
2976 |
+ reinit_completion(&rpm->ack); |
2977 |
+ regmap_write(rpm->ipc_regmap, rpm->ipc_offset, BIT(rpm->ipc_bit)); |
2978 |
+@@ -425,10 +451,11 @@ static irqreturn_t qcom_rpm_ack_interrupt(int irq, void *dev) |
2979 |
+ u32 ack; |
2980 |
+ int i; |
2981 |
+ |
2982 |
+- ack = readl_relaxed(RPM_CTRL_REG(rpm, RPM_ACK_CONTEXT)); |
2983 |
+- for (i = 0; i < RPM_SELECT_SIZE; i++) |
2984 |
+- writel_relaxed(0, RPM_CTRL_REG(rpm, RPM_ACK_SELECTOR + i)); |
2985 |
+- writel(0, RPM_CTRL_REG(rpm, RPM_ACK_CONTEXT)); |
2986 |
++ ack = readl_relaxed(RPM_CTRL_REG(rpm, rpm->data->ack_ctx_off)); |
2987 |
++ for (i = 0; i < rpm->data->ack_sel_size; i++) |
2988 |
++ writel_relaxed(0, |
2989 |
++ RPM_CTRL_REG(rpm, rpm->data->ack_sel_off + i)); |
2990 |
++ writel(0, RPM_CTRL_REG(rpm, rpm->data->ack_ctx_off)); |
2991 |
+ |
2992 |
+ if (ack & RPM_NOTIFICATION) { |
2993 |
+ dev_warn(rpm->dev, "ignoring notification!\n"); |
2994 |
+diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c |
2995 |
+index c2e1232cd45c..fa5cd51cba38 100644 |
2996 |
+--- a/drivers/mtd/nand/nand_base.c |
2997 |
++++ b/drivers/mtd/nand/nand_base.c |
2998 |
+@@ -2441,7 +2441,7 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to, |
2999 |
+ int cached = writelen > bytes && page != blockmask; |
3000 |
+ uint8_t *wbuf = buf; |
3001 |
+ int use_bufpoi; |
3002 |
+- int part_pagewr = (column || writelen < (mtd->writesize - 1)); |
3003 |
++ int part_pagewr = (column || writelen < mtd->writesize); |
3004 |
+ |
3005 |
+ if (part_pagewr) |
3006 |
+ use_bufpoi = 1; |
3007 |
+diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c |
3008 |
+index b7f824d5ee88..9fd4f7838080 100644 |
3009 |
+--- a/drivers/mtd/ubi/build.c |
3010 |
++++ b/drivers/mtd/ubi/build.c |
3011 |
+@@ -887,7 +887,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, |
3012 |
+ for (i = 0; i < UBI_MAX_DEVICES; i++) { |
3013 |
+ ubi = ubi_devices[i]; |
3014 |
+ if (ubi && mtd->index == ubi->mtd->index) { |
3015 |
+- ubi_err(ubi, "mtd%d is already attached to ubi%d", |
3016 |
++ pr_err("ubi: mtd%d is already attached to ubi%d", |
3017 |
+ mtd->index, i); |
3018 |
+ return -EEXIST; |
3019 |
+ } |
3020 |
+@@ -902,7 +902,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, |
3021 |
+ * no sense to attach emulated MTD devices, so we prohibit this. |
3022 |
+ */ |
3023 |
+ if (mtd->type == MTD_UBIVOLUME) { |
3024 |
+- ubi_err(ubi, "refuse attaching mtd%d - it is already emulated on top of UBI", |
3025 |
++ pr_err("ubi: refuse attaching mtd%d - it is already emulated on top of UBI", |
3026 |
+ mtd->index); |
3027 |
+ return -EINVAL; |
3028 |
+ } |
3029 |
+@@ -913,7 +913,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, |
3030 |
+ if (!ubi_devices[ubi_num]) |
3031 |
+ break; |
3032 |
+ if (ubi_num == UBI_MAX_DEVICES) { |
3033 |
+- ubi_err(ubi, "only %d UBI devices may be created", |
3034 |
++ pr_err("ubi: only %d UBI devices may be created", |
3035 |
+ UBI_MAX_DEVICES); |
3036 |
+ return -ENFILE; |
3037 |
+ } |
3038 |
+@@ -923,7 +923,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, |
3039 |
+ |
3040 |
+ /* Make sure ubi_num is not busy */ |
3041 |
+ if (ubi_devices[ubi_num]) { |
3042 |
+- ubi_err(ubi, "already exists"); |
3043 |
++ pr_err("ubi: ubi%i already exists", ubi_num); |
3044 |
+ return -EEXIST; |
3045 |
+ } |
3046 |
+ } |
3047 |
+@@ -1005,6 +1005,9 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, |
3048 |
+ goto out_detach; |
3049 |
+ } |
3050 |
+ |
3051 |
++ /* Make device "available" before it becomes accessible via sysfs */ |
3052 |
++ ubi_devices[ubi_num] = ubi; |
3053 |
++ |
3054 |
+ err = uif_init(ubi, &ref); |
3055 |
+ if (err) |
3056 |
+ goto out_detach; |
3057 |
+@@ -1049,7 +1052,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, |
3058 |
+ wake_up_process(ubi->bgt_thread); |
3059 |
+ spin_unlock(&ubi->wl_lock); |
3060 |
+ |
3061 |
+- ubi_devices[ubi_num] = ubi; |
3062 |
+ ubi_notify_all(ubi, UBI_VOLUME_ADDED, NULL); |
3063 |
+ return ubi_num; |
3064 |
+ |
3065 |
+@@ -1060,6 +1062,7 @@ out_uif: |
3066 |
+ ubi_assert(ref); |
3067 |
+ uif_close(ubi); |
3068 |
+ out_detach: |
3069 |
++ ubi_devices[ubi_num] = NULL; |
3070 |
+ ubi_wl_close(ubi); |
3071 |
+ ubi_free_internal_volumes(ubi); |
3072 |
+ vfree(ubi->vtbl); |
3073 |
+diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c |
3074 |
+index ff4d97848d1c..812ecf2d253a 100644 |
3075 |
+--- a/drivers/mtd/ubi/vmt.c |
3076 |
++++ b/drivers/mtd/ubi/vmt.c |
3077 |
+@@ -536,13 +536,6 @@ int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs) |
3078 |
+ spin_unlock(&ubi->volumes_lock); |
3079 |
+ } |
3080 |
+ |
3081 |
+- /* Change volume table record */ |
3082 |
+- vtbl_rec = ubi->vtbl[vol_id]; |
3083 |
+- vtbl_rec.reserved_pebs = cpu_to_be32(reserved_pebs); |
3084 |
+- err = ubi_change_vtbl_record(ubi, vol_id, &vtbl_rec); |
3085 |
+- if (err) |
3086 |
+- goto out_acc; |
3087 |
+- |
3088 |
+ if (pebs < 0) { |
3089 |
+ for (i = 0; i < -pebs; i++) { |
3090 |
+ err = ubi_eba_unmap_leb(ubi, vol, reserved_pebs + i); |
3091 |
+@@ -560,6 +553,24 @@ int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs) |
3092 |
+ spin_unlock(&ubi->volumes_lock); |
3093 |
+ } |
3094 |
+ |
3095 |
++ /* |
3096 |
++ * When we shrink a volume we have to flush all pending (erase) work. |
3097 |
++ * Otherwise it can happen that upon next attach UBI finds a LEB with |
3098 |
++ * lnum > highest_lnum and refuses to attach. |
3099 |
++ */ |
3100 |
++ if (pebs < 0) { |
3101 |
++ err = ubi_wl_flush(ubi, vol_id, UBI_ALL); |
3102 |
++ if (err) |
3103 |
++ goto out_acc; |
3104 |
++ } |
3105 |
++ |
3106 |
++ /* Change volume table record */ |
3107 |
++ vtbl_rec = ubi->vtbl[vol_id]; |
3108 |
++ vtbl_rec.reserved_pebs = cpu_to_be32(reserved_pebs); |
3109 |
++ err = ubi_change_vtbl_record(ubi, vol_id, &vtbl_rec); |
3110 |
++ if (err) |
3111 |
++ goto out_acc; |
3112 |
++ |
3113 |
+ vol->reserved_pebs = reserved_pebs; |
3114 |
+ if (vol->vol_type == UBI_DYNAMIC_VOLUME) { |
3115 |
+ vol->used_ebs = reserved_pebs; |
3116 |
+diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c |
3117 |
+index 5db25e46a962..5dbc1744eba5 100644 |
3118 |
+--- a/drivers/net/usb/cdc_ncm.c |
3119 |
++++ b/drivers/net/usb/cdc_ncm.c |
3120 |
+@@ -858,6 +858,13 @@ advance: |
3121 |
+ if (cdc_ncm_init(dev)) |
3122 |
+ goto error2; |
3123 |
+ |
3124 |
++ /* Some firmwares need a pause here or they will silently fail |
3125 |
++ * to set up the interface properly. This value was decided |
3126 |
++ * empirically on a Sierra Wireless MC7455 running 02.08.02.00 |
3127 |
++ * firmware. |
3128 |
++ */ |
3129 |
++ usleep_range(10000, 20000); |
3130 |
++ |
3131 |
+ /* configure data interface */ |
3132 |
+ temp = usb_set_interface(dev->udev, iface_no, data_altsetting); |
3133 |
+ if (temp) { |
3134 |
+diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c |
3135 |
+index 9faf69875fab..2babc39f66a7 100644 |
3136 |
+--- a/drivers/net/wireless/iwlwifi/pcie/drv.c |
3137 |
++++ b/drivers/net/wireless/iwlwifi/pcie/drv.c |
3138 |
+@@ -422,6 +422,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = { |
3139 |
+ /* 8000 Series */ |
3140 |
+ {IWL_PCI_DEVICE(0x24F3, 0x0010, iwl8260_2ac_cfg)}, |
3141 |
+ {IWL_PCI_DEVICE(0x24F3, 0x1010, iwl8260_2ac_cfg)}, |
3142 |
++ {IWL_PCI_DEVICE(0x24F3, 0x10B0, iwl8260_2ac_cfg)}, |
3143 |
+ {IWL_PCI_DEVICE(0x24F3, 0x0130, iwl8260_2ac_cfg)}, |
3144 |
+ {IWL_PCI_DEVICE(0x24F3, 0x1130, iwl8260_2ac_cfg)}, |
3145 |
+ {IWL_PCI_DEVICE(0x24F3, 0x0132, iwl8260_2ac_cfg)}, |
3146 |
+@@ -444,6 +445,8 @@ static const struct pci_device_id iwl_hw_card_ids[] = { |
3147 |
+ {IWL_PCI_DEVICE(0x24F4, 0xD030, iwl8260_2ac_cfg)}, |
3148 |
+ {IWL_PCI_DEVICE(0x24F3, 0xC050, iwl8260_2ac_cfg)}, |
3149 |
+ {IWL_PCI_DEVICE(0x24F3, 0xD050, iwl8260_2ac_cfg)}, |
3150 |
++ {IWL_PCI_DEVICE(0x24F3, 0xD0B0, iwl8260_2ac_cfg)}, |
3151 |
++ {IWL_PCI_DEVICE(0x24F3, 0xB0B0, iwl8260_2ac_cfg)}, |
3152 |
+ {IWL_PCI_DEVICE(0x24F3, 0x8010, iwl8260_2ac_cfg)}, |
3153 |
+ {IWL_PCI_DEVICE(0x24F3, 0x8110, iwl8260_2ac_cfg)}, |
3154 |
+ {IWL_PCI_DEVICE(0x24F3, 0x9010, iwl8260_2ac_cfg)}, |
3155 |
+diff --git a/drivers/of/base.c b/drivers/of/base.c |
3156 |
+index 5ed97246c2e7..20f0b00dda05 100644 |
3157 |
+--- a/drivers/of/base.c |
3158 |
++++ b/drivers/of/base.c |
3159 |
+@@ -112,6 +112,7 @@ static ssize_t of_node_property_read(struct file *filp, struct kobject *kobj, |
3160 |
+ return memory_read_from_buffer(buf, count, &offset, pp->value, pp->length); |
3161 |
+ } |
3162 |
+ |
3163 |
++/* always return newly allocated name, caller must free after use */ |
3164 |
+ static const char *safe_name(struct kobject *kobj, const char *orig_name) |
3165 |
+ { |
3166 |
+ const char *name = orig_name; |
3167 |
+@@ -126,9 +127,12 @@ static const char *safe_name(struct kobject *kobj, const char *orig_name) |
3168 |
+ name = kasprintf(GFP_KERNEL, "%s#%i", orig_name, ++i); |
3169 |
+ } |
3170 |
+ |
3171 |
+- if (name != orig_name) |
3172 |
++ if (name == orig_name) { |
3173 |
++ name = kstrdup(orig_name, GFP_KERNEL); |
3174 |
++ } else { |
3175 |
+ pr_warn("device-tree: Duplicate name in %s, renamed to \"%s\"\n", |
3176 |
+ kobject_name(kobj), name); |
3177 |
++ } |
3178 |
+ return name; |
3179 |
+ } |
3180 |
+ |
3181 |
+@@ -159,6 +163,7 @@ int __of_add_property_sysfs(struct device_node *np, struct property *pp) |
3182 |
+ int __of_attach_node_sysfs(struct device_node *np) |
3183 |
+ { |
3184 |
+ const char *name; |
3185 |
++ struct kobject *parent; |
3186 |
+ struct property *pp; |
3187 |
+ int rc; |
3188 |
+ |
3189 |
+@@ -171,15 +176,16 @@ int __of_attach_node_sysfs(struct device_node *np) |
3190 |
+ np->kobj.kset = of_kset; |
3191 |
+ if (!np->parent) { |
3192 |
+ /* Nodes without parents are new top level trees */ |
3193 |
+- rc = kobject_add(&np->kobj, NULL, "%s", |
3194 |
+- safe_name(&of_kset->kobj, "base")); |
3195 |
++ name = safe_name(&of_kset->kobj, "base"); |
3196 |
++ parent = NULL; |
3197 |
+ } else { |
3198 |
+ name = safe_name(&np->parent->kobj, kbasename(np->full_name)); |
3199 |
+- if (!name || !name[0]) |
3200 |
+- return -EINVAL; |
3201 |
+- |
3202 |
+- rc = kobject_add(&np->kobj, &np->parent->kobj, "%s", name); |
3203 |
++ parent = &np->parent->kobj; |
3204 |
+ } |
3205 |
++ if (!name) |
3206 |
++ return -ENOMEM; |
3207 |
++ rc = kobject_add(&np->kobj, parent, "%s", name); |
3208 |
++ kfree(name); |
3209 |
+ if (rc) |
3210 |
+ return rc; |
3211 |
+ |
3212 |
+@@ -1756,6 +1762,12 @@ int __of_remove_property(struct device_node *np, struct property *prop) |
3213 |
+ return 0; |
3214 |
+ } |
3215 |
+ |
3216 |
++void __of_sysfs_remove_bin_file(struct device_node *np, struct property *prop) |
3217 |
++{ |
3218 |
++ sysfs_remove_bin_file(&np->kobj, &prop->attr); |
3219 |
++ kfree(prop->attr.attr.name); |
3220 |
++} |
3221 |
++ |
3222 |
+ void __of_remove_property_sysfs(struct device_node *np, struct property *prop) |
3223 |
+ { |
3224 |
+ if (!IS_ENABLED(CONFIG_SYSFS)) |
3225 |
+@@ -1763,7 +1775,7 @@ void __of_remove_property_sysfs(struct device_node *np, struct property *prop) |
3226 |
+ |
3227 |
+ /* at early boot, bail here and defer setup to of_init() */ |
3228 |
+ if (of_kset && of_node_is_attached(np)) |
3229 |
+- sysfs_remove_bin_file(&np->kobj, &prop->attr); |
3230 |
++ __of_sysfs_remove_bin_file(np, prop); |
3231 |
+ } |
3232 |
+ |
3233 |
+ /** |
3234 |
+@@ -1833,7 +1845,7 @@ void __of_update_property_sysfs(struct device_node *np, struct property *newprop |
3235 |
+ return; |
3236 |
+ |
3237 |
+ if (oldprop) |
3238 |
+- sysfs_remove_bin_file(&np->kobj, &oldprop->attr); |
3239 |
++ __of_sysfs_remove_bin_file(np, oldprop); |
3240 |
+ __of_add_property_sysfs(np, newprop); |
3241 |
+ } |
3242 |
+ |
3243 |
+diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c |
3244 |
+index 53826b84e0ec..2d72ddcf534f 100644 |
3245 |
+--- a/drivers/of/dynamic.c |
3246 |
++++ b/drivers/of/dynamic.c |
3247 |
+@@ -55,7 +55,7 @@ void __of_detach_node_sysfs(struct device_node *np) |
3248 |
+ /* only remove properties if on sysfs */ |
3249 |
+ if (of_node_is_attached(np)) { |
3250 |
+ for_each_property_of_node(np, pp) |
3251 |
+- sysfs_remove_bin_file(&np->kobj, &pp->attr); |
3252 |
++ __of_sysfs_remove_bin_file(np, pp); |
3253 |
+ kobject_del(&np->kobj); |
3254 |
+ } |
3255 |
+ |
3256 |
+diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h |
3257 |
+index 8e882e706cd8..46ddbee22ce3 100644 |
3258 |
+--- a/drivers/of/of_private.h |
3259 |
++++ b/drivers/of/of_private.h |
3260 |
+@@ -81,6 +81,9 @@ extern int __of_attach_node_sysfs(struct device_node *np); |
3261 |
+ extern void __of_detach_node(struct device_node *np); |
3262 |
+ extern void __of_detach_node_sysfs(struct device_node *np); |
3263 |
+ |
3264 |
++extern void __of_sysfs_remove_bin_file(struct device_node *np, |
3265 |
++ struct property *prop); |
3266 |
++ |
3267 |
+ /* iterators for transactions, used for overlays */ |
3268 |
+ /* forward iterator */ |
3269 |
+ #define for_each_transaction_entry(_oft, _te) \ |
3270 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
3271 |
+index 4a6933f02cd0..ae12c0317645 100644 |
3272 |
+--- a/drivers/pci/quirks.c |
3273 |
++++ b/drivers/pci/quirks.c |
3274 |
+@@ -3108,13 +3108,15 @@ static void quirk_no_bus_reset(struct pci_dev *dev) |
3275 |
+ } |
3276 |
+ |
3277 |
+ /* |
3278 |
+- * Atheros AR93xx chips do not behave after a bus reset. The device will |
3279 |
+- * throw a Link Down error on AER-capable systems and regardless of AER, |
3280 |
+- * config space of the device is never accessible again and typically |
3281 |
+- * causes the system to hang or reset when access is attempted. |
3282 |
++ * Some Atheros AR9xxx and QCA988x chips do not behave after a bus reset. |
3283 |
++ * The device will throw a Link Down error on AER-capable systems and |
3284 |
++ * regardless of AER, config space of the device is never accessible again |
3285 |
++ * and typically causes the system to hang or reset when access is attempted. |
3286 |
+ * http://www.spinics.net/lists/linux-pci/msg34797.html |
3287 |
+ */ |
3288 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0030, quirk_no_bus_reset); |
3289 |
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0032, quirk_no_bus_reset); |
3290 |
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, quirk_no_bus_reset); |
3291 |
+ |
3292 |
+ static void quirk_no_pm_reset(struct pci_dev *dev) |
3293 |
+ { |
3294 |
+diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c |
3295 |
+index 732ff757a95f..688f6b08c70f 100644 |
3296 |
+--- a/drivers/pinctrl/intel/pinctrl-cherryview.c |
3297 |
++++ b/drivers/pinctrl/intel/pinctrl-cherryview.c |
3298 |
+@@ -160,7 +160,6 @@ struct chv_pin_context { |
3299 |
+ * @pctldev: Pointer to the pin controller device |
3300 |
+ * @chip: GPIO chip in this pin controller |
3301 |
+ * @regs: MMIO registers |
3302 |
+- * @lock: Lock to serialize register accesses |
3303 |
+ * @intr_lines: Stores mapping between 16 HW interrupt wires and GPIO |
3304 |
+ * offset (in GPIO number space) |
3305 |
+ * @community: Community this pinctrl instance represents |
3306 |
+@@ -174,7 +173,6 @@ struct chv_pinctrl { |
3307 |
+ struct pinctrl_dev *pctldev; |
3308 |
+ struct gpio_chip chip; |
3309 |
+ void __iomem *regs; |
3310 |
+- spinlock_t lock; |
3311 |
+ unsigned intr_lines[16]; |
3312 |
+ const struct chv_community *community; |
3313 |
+ u32 saved_intmask; |
3314 |
+@@ -659,6 +657,17 @@ static const struct chv_community *chv_communities[] = { |
3315 |
+ &southeast_community, |
3316 |
+ }; |
3317 |
+ |
3318 |
++/* |
3319 |
++ * Lock to serialize register accesses |
3320 |
++ * |
3321 |
++ * Due to a silicon issue, a shared lock must be used to prevent |
3322 |
++ * concurrent accesses across the 4 GPIO controllers. |
3323 |
++ * |
3324 |
++ * See Intel Atom Z8000 Processor Series Specification Update (Rev. 005), |
3325 |
++ * errata #CHT34, for further information. |
3326 |
++ */ |
3327 |
++static DEFINE_RAW_SPINLOCK(chv_lock); |
3328 |
++ |
3329 |
+ static void __iomem *chv_padreg(struct chv_pinctrl *pctrl, unsigned offset, |
3330 |
+ unsigned reg) |
3331 |
+ { |
3332 |
+@@ -720,13 +729,13 @@ static void chv_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, |
3333 |
+ u32 ctrl0, ctrl1; |
3334 |
+ bool locked; |
3335 |
+ |
3336 |
+- spin_lock_irqsave(&pctrl->lock, flags); |
3337 |
++ raw_spin_lock_irqsave(&chv_lock, flags); |
3338 |
+ |
3339 |
+ ctrl0 = readl(chv_padreg(pctrl, offset, CHV_PADCTRL0)); |
3340 |
+ ctrl1 = readl(chv_padreg(pctrl, offset, CHV_PADCTRL1)); |
3341 |
+ locked = chv_pad_locked(pctrl, offset); |
3342 |
+ |
3343 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3344 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3345 |
+ |
3346 |
+ if (ctrl0 & CHV_PADCTRL0_GPIOEN) { |
3347 |
+ seq_puts(s, "GPIO "); |
3348 |
+@@ -789,14 +798,14 @@ static int chv_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned function, |
3349 |
+ |
3350 |
+ grp = &pctrl->community->groups[group]; |
3351 |
+ |
3352 |
+- spin_lock_irqsave(&pctrl->lock, flags); |
3353 |
++ raw_spin_lock_irqsave(&chv_lock, flags); |
3354 |
+ |
3355 |
+ /* Check first that the pad is not locked */ |
3356 |
+ for (i = 0; i < grp->npins; i++) { |
3357 |
+ if (chv_pad_locked(pctrl, grp->pins[i])) { |
3358 |
+ dev_warn(pctrl->dev, "unable to set mode for locked pin %u\n", |
3359 |
+ grp->pins[i]); |
3360 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3361 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3362 |
+ return -EBUSY; |
3363 |
+ } |
3364 |
+ } |
3365 |
+@@ -839,7 +848,7 @@ static int chv_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned function, |
3366 |
+ pin, altfunc->mode, altfunc->invert_oe ? "" : "not "); |
3367 |
+ } |
3368 |
+ |
3369 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3370 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3371 |
+ |
3372 |
+ return 0; |
3373 |
+ } |
3374 |
+@@ -853,13 +862,13 @@ static int chv_gpio_request_enable(struct pinctrl_dev *pctldev, |
3375 |
+ void __iomem *reg; |
3376 |
+ u32 value; |
3377 |
+ |
3378 |
+- spin_lock_irqsave(&pctrl->lock, flags); |
3379 |
++ raw_spin_lock_irqsave(&chv_lock, flags); |
3380 |
+ |
3381 |
+ if (chv_pad_locked(pctrl, offset)) { |
3382 |
+ value = readl(chv_padreg(pctrl, offset, CHV_PADCTRL0)); |
3383 |
+ if (!(value & CHV_PADCTRL0_GPIOEN)) { |
3384 |
+ /* Locked so cannot enable */ |
3385 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3386 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3387 |
+ return -EBUSY; |
3388 |
+ } |
3389 |
+ } else { |
3390 |
+@@ -899,7 +908,7 @@ static int chv_gpio_request_enable(struct pinctrl_dev *pctldev, |
3391 |
+ chv_writel(value, reg); |
3392 |
+ } |
3393 |
+ |
3394 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3395 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3396 |
+ |
3397 |
+ return 0; |
3398 |
+ } |
3399 |
+@@ -913,13 +922,13 @@ static void chv_gpio_disable_free(struct pinctrl_dev *pctldev, |
3400 |
+ void __iomem *reg; |
3401 |
+ u32 value; |
3402 |
+ |
3403 |
+- spin_lock_irqsave(&pctrl->lock, flags); |
3404 |
++ raw_spin_lock_irqsave(&chv_lock, flags); |
3405 |
+ |
3406 |
+ reg = chv_padreg(pctrl, offset, CHV_PADCTRL0); |
3407 |
+ value = readl(reg) & ~CHV_PADCTRL0_GPIOEN; |
3408 |
+ chv_writel(value, reg); |
3409 |
+ |
3410 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3411 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3412 |
+ } |
3413 |
+ |
3414 |
+ static int chv_gpio_set_direction(struct pinctrl_dev *pctldev, |
3415 |
+@@ -931,7 +940,7 @@ static int chv_gpio_set_direction(struct pinctrl_dev *pctldev, |
3416 |
+ unsigned long flags; |
3417 |
+ u32 ctrl0; |
3418 |
+ |
3419 |
+- spin_lock_irqsave(&pctrl->lock, flags); |
3420 |
++ raw_spin_lock_irqsave(&chv_lock, flags); |
3421 |
+ |
3422 |
+ ctrl0 = readl(reg) & ~CHV_PADCTRL0_GPIOCFG_MASK; |
3423 |
+ if (input) |
3424 |
+@@ -940,7 +949,7 @@ static int chv_gpio_set_direction(struct pinctrl_dev *pctldev, |
3425 |
+ ctrl0 |= CHV_PADCTRL0_GPIOCFG_GPO << CHV_PADCTRL0_GPIOCFG_SHIFT; |
3426 |
+ chv_writel(ctrl0, reg); |
3427 |
+ |
3428 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3429 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3430 |
+ |
3431 |
+ return 0; |
3432 |
+ } |
3433 |
+@@ -965,10 +974,10 @@ static int chv_config_get(struct pinctrl_dev *pctldev, unsigned pin, |
3434 |
+ u16 arg = 0; |
3435 |
+ u32 term; |
3436 |
+ |
3437 |
+- spin_lock_irqsave(&pctrl->lock, flags); |
3438 |
++ raw_spin_lock_irqsave(&chv_lock, flags); |
3439 |
+ ctrl0 = readl(chv_padreg(pctrl, pin, CHV_PADCTRL0)); |
3440 |
+ ctrl1 = readl(chv_padreg(pctrl, pin, CHV_PADCTRL1)); |
3441 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3442 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3443 |
+ |
3444 |
+ term = (ctrl0 & CHV_PADCTRL0_TERM_MASK) >> CHV_PADCTRL0_TERM_SHIFT; |
3445 |
+ |
3446 |
+@@ -1042,7 +1051,7 @@ static int chv_config_set_pull(struct chv_pinctrl *pctrl, unsigned pin, |
3447 |
+ unsigned long flags; |
3448 |
+ u32 ctrl0, pull; |
3449 |
+ |
3450 |
+- spin_lock_irqsave(&pctrl->lock, flags); |
3451 |
++ raw_spin_lock_irqsave(&chv_lock, flags); |
3452 |
+ ctrl0 = readl(reg); |
3453 |
+ |
3454 |
+ switch (param) { |
3455 |
+@@ -1065,7 +1074,7 @@ static int chv_config_set_pull(struct chv_pinctrl *pctrl, unsigned pin, |
3456 |
+ pull = CHV_PADCTRL0_TERM_20K << CHV_PADCTRL0_TERM_SHIFT; |
3457 |
+ break; |
3458 |
+ default: |
3459 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3460 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3461 |
+ return -EINVAL; |
3462 |
+ } |
3463 |
+ |
3464 |
+@@ -1083,7 +1092,7 @@ static int chv_config_set_pull(struct chv_pinctrl *pctrl, unsigned pin, |
3465 |
+ pull = CHV_PADCTRL0_TERM_20K << CHV_PADCTRL0_TERM_SHIFT; |
3466 |
+ break; |
3467 |
+ default: |
3468 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3469 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3470 |
+ return -EINVAL; |
3471 |
+ } |
3472 |
+ |
3473 |
+@@ -1091,12 +1100,12 @@ static int chv_config_set_pull(struct chv_pinctrl *pctrl, unsigned pin, |
3474 |
+ break; |
3475 |
+ |
3476 |
+ default: |
3477 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3478 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3479 |
+ return -EINVAL; |
3480 |
+ } |
3481 |
+ |
3482 |
+ chv_writel(ctrl0, reg); |
3483 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3484 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3485 |
+ |
3486 |
+ return 0; |
3487 |
+ } |
3488 |
+@@ -1169,9 +1178,12 @@ static int chv_gpio_get(struct gpio_chip *chip, unsigned offset) |
3489 |
+ { |
3490 |
+ struct chv_pinctrl *pctrl = gpiochip_to_pinctrl(chip); |
3491 |
+ int pin = chv_gpio_offset_to_pin(pctrl, offset); |
3492 |
++ unsigned long flags; |
3493 |
+ u32 ctrl0, cfg; |
3494 |
+ |
3495 |
++ raw_spin_lock_irqsave(&chv_lock, flags); |
3496 |
+ ctrl0 = readl(chv_padreg(pctrl, pin, CHV_PADCTRL0)); |
3497 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3498 |
+ |
3499 |
+ cfg = ctrl0 & CHV_PADCTRL0_GPIOCFG_MASK; |
3500 |
+ cfg >>= CHV_PADCTRL0_GPIOCFG_SHIFT; |
3501 |
+@@ -1189,7 +1201,7 @@ static void chv_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
3502 |
+ void __iomem *reg; |
3503 |
+ u32 ctrl0; |
3504 |
+ |
3505 |
+- spin_lock_irqsave(&pctrl->lock, flags); |
3506 |
++ raw_spin_lock_irqsave(&chv_lock, flags); |
3507 |
+ |
3508 |
+ reg = chv_padreg(pctrl, pin, CHV_PADCTRL0); |
3509 |
+ ctrl0 = readl(reg); |
3510 |
+@@ -1201,7 +1213,7 @@ static void chv_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
3511 |
+ |
3512 |
+ chv_writel(ctrl0, reg); |
3513 |
+ |
3514 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3515 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3516 |
+ } |
3517 |
+ |
3518 |
+ static int chv_gpio_get_direction(struct gpio_chip *chip, unsigned offset) |
3519 |
+@@ -1209,8 +1221,11 @@ static int chv_gpio_get_direction(struct gpio_chip *chip, unsigned offset) |
3520 |
+ struct chv_pinctrl *pctrl = gpiochip_to_pinctrl(chip); |
3521 |
+ unsigned pin = chv_gpio_offset_to_pin(pctrl, offset); |
3522 |
+ u32 ctrl0, direction; |
3523 |
++ unsigned long flags; |
3524 |
+ |
3525 |
++ raw_spin_lock_irqsave(&chv_lock, flags); |
3526 |
+ ctrl0 = readl(chv_padreg(pctrl, pin, CHV_PADCTRL0)); |
3527 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3528 |
+ |
3529 |
+ direction = ctrl0 & CHV_PADCTRL0_GPIOCFG_MASK; |
3530 |
+ direction >>= CHV_PADCTRL0_GPIOCFG_SHIFT; |
3531 |
+@@ -1248,14 +1263,14 @@ static void chv_gpio_irq_ack(struct irq_data *d) |
3532 |
+ int pin = chv_gpio_offset_to_pin(pctrl, irqd_to_hwirq(d)); |
3533 |
+ u32 intr_line; |
3534 |
+ |
3535 |
+- spin_lock(&pctrl->lock); |
3536 |
++ raw_spin_lock(&chv_lock); |
3537 |
+ |
3538 |
+ intr_line = readl(chv_padreg(pctrl, pin, CHV_PADCTRL0)); |
3539 |
+ intr_line &= CHV_PADCTRL0_INTSEL_MASK; |
3540 |
+ intr_line >>= CHV_PADCTRL0_INTSEL_SHIFT; |
3541 |
+ chv_writel(BIT(intr_line), pctrl->regs + CHV_INTSTAT); |
3542 |
+ |
3543 |
+- spin_unlock(&pctrl->lock); |
3544 |
++ raw_spin_unlock(&chv_lock); |
3545 |
+ } |
3546 |
+ |
3547 |
+ static void chv_gpio_irq_mask_unmask(struct irq_data *d, bool mask) |
3548 |
+@@ -1266,7 +1281,7 @@ static void chv_gpio_irq_mask_unmask(struct irq_data *d, bool mask) |
3549 |
+ u32 value, intr_line; |
3550 |
+ unsigned long flags; |
3551 |
+ |
3552 |
+- spin_lock_irqsave(&pctrl->lock, flags); |
3553 |
++ raw_spin_lock_irqsave(&chv_lock, flags); |
3554 |
+ |
3555 |
+ intr_line = readl(chv_padreg(pctrl, pin, CHV_PADCTRL0)); |
3556 |
+ intr_line &= CHV_PADCTRL0_INTSEL_MASK; |
3557 |
+@@ -1279,7 +1294,7 @@ static void chv_gpio_irq_mask_unmask(struct irq_data *d, bool mask) |
3558 |
+ value |= BIT(intr_line); |
3559 |
+ chv_writel(value, pctrl->regs + CHV_INTMASK); |
3560 |
+ |
3561 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3562 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3563 |
+ } |
3564 |
+ |
3565 |
+ static void chv_gpio_irq_mask(struct irq_data *d) |
3566 |
+@@ -1313,6 +1328,7 @@ static unsigned chv_gpio_irq_startup(struct irq_data *d) |
3567 |
+ unsigned long flags; |
3568 |
+ u32 intsel, value; |
3569 |
+ |
3570 |
++ raw_spin_lock_irqsave(&chv_lock, flags); |
3571 |
+ intsel = readl(chv_padreg(pctrl, pin, CHV_PADCTRL0)); |
3572 |
+ intsel &= CHV_PADCTRL0_INTSEL_MASK; |
3573 |
+ intsel >>= CHV_PADCTRL0_INTSEL_SHIFT; |
3574 |
+@@ -1323,12 +1339,11 @@ static unsigned chv_gpio_irq_startup(struct irq_data *d) |
3575 |
+ else |
3576 |
+ handler = handle_edge_irq; |
3577 |
+ |
3578 |
+- spin_lock_irqsave(&pctrl->lock, flags); |
3579 |
+ if (!pctrl->intr_lines[intsel]) { |
3580 |
+ __irq_set_handler_locked(d->irq, handler); |
3581 |
+ pctrl->intr_lines[intsel] = offset; |
3582 |
+ } |
3583 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3584 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3585 |
+ } |
3586 |
+ |
3587 |
+ chv_gpio_irq_unmask(d); |
3588 |
+@@ -1344,7 +1359,7 @@ static int chv_gpio_irq_type(struct irq_data *d, unsigned type) |
3589 |
+ unsigned long flags; |
3590 |
+ u32 value; |
3591 |
+ |
3592 |
+- spin_lock_irqsave(&pctrl->lock, flags); |
3593 |
++ raw_spin_lock_irqsave(&chv_lock, flags); |
3594 |
+ |
3595 |
+ /* |
3596 |
+ * Pins which can be used as shared interrupt are configured in |
3597 |
+@@ -1393,7 +1408,7 @@ static int chv_gpio_irq_type(struct irq_data *d, unsigned type) |
3598 |
+ else if (type & IRQ_TYPE_LEVEL_MASK) |
3599 |
+ __irq_set_handler_locked(d->irq, handle_level_irq); |
3600 |
+ |
3601 |
+- spin_unlock_irqrestore(&pctrl->lock, flags); |
3602 |
++ raw_spin_unlock_irqrestore(&chv_lock, flags); |
3603 |
+ |
3604 |
+ return 0; |
3605 |
+ } |
3606 |
+@@ -1505,7 +1520,6 @@ static int chv_pinctrl_probe(struct platform_device *pdev) |
3607 |
+ if (i == ARRAY_SIZE(chv_communities)) |
3608 |
+ return -ENODEV; |
3609 |
+ |
3610 |
+- spin_lock_init(&pctrl->lock); |
3611 |
+ pctrl->dev = &pdev->dev; |
3612 |
+ |
3613 |
+ #ifdef CONFIG_PM_SLEEP |
3614 |
+diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c |
3615 |
+index fb4dd7b3ee71..af2046c87806 100644 |
3616 |
+--- a/drivers/platform/x86/hp-wmi.c |
3617 |
++++ b/drivers/platform/x86/hp-wmi.c |
3618 |
+@@ -723,6 +723,11 @@ static int __init hp_wmi_rfkill_setup(struct platform_device *device) |
3619 |
+ if (err) |
3620 |
+ return err; |
3621 |
+ |
3622 |
++ err = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, &wireless, |
3623 |
++ sizeof(wireless), 0); |
3624 |
++ if (err) |
3625 |
++ return err; |
3626 |
++ |
3627 |
+ if (wireless & 0x1) { |
3628 |
+ wifi_rfkill = rfkill_alloc("hp-wifi", &device->dev, |
3629 |
+ RFKILL_TYPE_WLAN, |
3630 |
+@@ -910,7 +915,7 @@ static int __init hp_wmi_bios_setup(struct platform_device *device) |
3631 |
+ gps_rfkill = NULL; |
3632 |
+ rfkill2_count = 0; |
3633 |
+ |
3634 |
+- if (hp_wmi_bios_2009_later() || hp_wmi_rfkill_setup(device)) |
3635 |
++ if (hp_wmi_rfkill_setup(device)) |
3636 |
+ hp_wmi_rfkill2_setup(device); |
3637 |
+ |
3638 |
+ err = device_create_file(&device->dev, &dev_attr_display); |
3639 |
+diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c |
3640 |
+index c5a2523b0185..463003d2529c 100644 |
3641 |
+--- a/drivers/rtc/rtc-s3c.c |
3642 |
++++ b/drivers/rtc/rtc-s3c.c |
3643 |
+@@ -149,12 +149,14 @@ static int s3c_rtc_setfreq(struct s3c_rtc *info, int freq) |
3644 |
+ if (!is_power_of_2(freq)) |
3645 |
+ return -EINVAL; |
3646 |
+ |
3647 |
++ s3c_rtc_enable_clk(info); |
3648 |
+ spin_lock_irq(&info->pie_lock); |
3649 |
+ |
3650 |
+ if (info->data->set_freq) |
3651 |
+ info->data->set_freq(info, freq); |
3652 |
+ |
3653 |
+ spin_unlock_irq(&info->pie_lock); |
3654 |
++ s3c_rtc_disable_clk(info); |
3655 |
+ |
3656 |
+ return 0; |
3657 |
+ } |
3658 |
+diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c |
3659 |
+index f089082c00e1..e6b77049c756 100644 |
3660 |
+--- a/drivers/spi/spi-pxa2xx.c |
3661 |
++++ b/drivers/spi/spi-pxa2xx.c |
3662 |
+@@ -477,7 +477,14 @@ static void reset_sccr1(struct driver_data *drv_data) |
3663 |
+ u32 sccr1_reg; |
3664 |
+ |
3665 |
+ sccr1_reg = pxa2xx_spi_read(drv_data, SSCR1) & ~drv_data->int_cr1; |
3666 |
+- sccr1_reg &= ~SSCR1_RFT; |
3667 |
++ switch (drv_data->ssp_type) { |
3668 |
++ case QUARK_X1000_SSP: |
3669 |
++ sccr1_reg &= ~QUARK_X1000_SSCR1_RFT; |
3670 |
++ break; |
3671 |
++ default: |
3672 |
++ sccr1_reg &= ~SSCR1_RFT; |
3673 |
++ break; |
3674 |
++ } |
3675 |
+ sccr1_reg |= chip->threshold; |
3676 |
+ pxa2xx_spi_write(drv_data, SSCR1, sccr1_reg); |
3677 |
+ } |
3678 |
+diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c |
3679 |
+index b614f272b5f4..851fcfa98068 100644 |
3680 |
+--- a/drivers/staging/iio/accel/sca3000_core.c |
3681 |
++++ b/drivers/staging/iio/accel/sca3000_core.c |
3682 |
+@@ -595,7 +595,7 @@ static ssize_t sca3000_read_frequency(struct device *dev, |
3683 |
+ goto error_ret_mut; |
3684 |
+ ret = sca3000_read_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL); |
3685 |
+ mutex_unlock(&st->lock); |
3686 |
+- if (ret) |
3687 |
++ if (ret < 0) |
3688 |
+ goto error_ret; |
3689 |
+ val = ret; |
3690 |
+ if (base_freq > 0) |
3691 |
+diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
3692 |
+index 6f50e9d958de..6fad3e9fd389 100644 |
3693 |
+--- a/drivers/target/iscsi/iscsi_target.c |
3694 |
++++ b/drivers/target/iscsi/iscsi_target.c |
3695 |
+@@ -500,7 +500,8 @@ static void iscsit_aborted_task(struct iscsi_conn *conn, struct iscsi_cmd *cmd) |
3696 |
+ bool scsi_cmd = (cmd->iscsi_opcode == ISCSI_OP_SCSI_CMD); |
3697 |
+ |
3698 |
+ spin_lock_bh(&conn->cmd_lock); |
3699 |
+- if (!list_empty(&cmd->i_conn_node)) |
3700 |
++ if (!list_empty(&cmd->i_conn_node) && |
3701 |
++ !(cmd->se_cmd.transport_state & CMD_T_FABRIC_STOP)) |
3702 |
+ list_del_init(&cmd->i_conn_node); |
3703 |
+ spin_unlock_bh(&conn->cmd_lock); |
3704 |
+ |
3705 |
+@@ -4215,6 +4216,7 @@ transport_err: |
3706 |
+ |
3707 |
+ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) |
3708 |
+ { |
3709 |
++ LIST_HEAD(tmp_list); |
3710 |
+ struct iscsi_cmd *cmd = NULL, *cmd_tmp = NULL; |
3711 |
+ struct iscsi_session *sess = conn->sess; |
3712 |
+ /* |
3713 |
+@@ -4223,18 +4225,26 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) |
3714 |
+ * has been reset -> returned sleeping pre-handler state. |
3715 |
+ */ |
3716 |
+ spin_lock_bh(&conn->cmd_lock); |
3717 |
+- list_for_each_entry_safe(cmd, cmd_tmp, &conn->conn_cmd_list, i_conn_node) { |
3718 |
++ list_splice_init(&conn->conn_cmd_list, &tmp_list); |
3719 |
+ |
3720 |
++ list_for_each_entry(cmd, &tmp_list, i_conn_node) { |
3721 |
++ struct se_cmd *se_cmd = &cmd->se_cmd; |
3722 |
++ |
3723 |
++ if (se_cmd->se_tfo != NULL) { |
3724 |
++ spin_lock(&se_cmd->t_state_lock); |
3725 |
++ se_cmd->transport_state |= CMD_T_FABRIC_STOP; |
3726 |
++ spin_unlock(&se_cmd->t_state_lock); |
3727 |
++ } |
3728 |
++ } |
3729 |
++ spin_unlock_bh(&conn->cmd_lock); |
3730 |
++ |
3731 |
++ list_for_each_entry_safe(cmd, cmd_tmp, &tmp_list, i_conn_node) { |
3732 |
+ list_del_init(&cmd->i_conn_node); |
3733 |
+- spin_unlock_bh(&conn->cmd_lock); |
3734 |
+ |
3735 |
+ iscsit_increment_maxcmdsn(cmd, sess); |
3736 |
+- |
3737 |
+ iscsit_free_cmd(cmd, true); |
3738 |
+ |
3739 |
+- spin_lock_bh(&conn->cmd_lock); |
3740 |
+ } |
3741 |
+- spin_unlock_bh(&conn->cmd_lock); |
3742 |
+ } |
3743 |
+ |
3744 |
+ static void iscsit_stop_timers_for_cmds( |
3745 |
+diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c |
3746 |
+index 39654e917cd8..e929205e28c6 100644 |
3747 |
+--- a/drivers/target/iscsi/iscsi_target_login.c |
3748 |
++++ b/drivers/target/iscsi/iscsi_target_login.c |
3749 |
+@@ -1415,8 +1415,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) |
3750 |
+ } |
3751 |
+ login->zero_tsih = zero_tsih; |
3752 |
+ |
3753 |
+- conn->sess->se_sess->sup_prot_ops = |
3754 |
+- conn->conn_transport->iscsit_get_sup_prot_ops(conn); |
3755 |
++ if (conn->sess) |
3756 |
++ conn->sess->se_sess->sup_prot_ops = |
3757 |
++ conn->conn_transport->iscsit_get_sup_prot_ops(conn); |
3758 |
+ |
3759 |
+ tpg = conn->tpg; |
3760 |
+ if (!tpg) { |
3761 |
+diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c |
3762 |
+index e8848e7fe5d4..7580abe7cb45 100644 |
3763 |
+--- a/drivers/target/target_core_transport.c |
3764 |
++++ b/drivers/target/target_core_transport.c |
3765 |
+@@ -2531,15 +2531,9 @@ static void target_release_cmd_kref(struct kref *kref) |
3766 |
+ struct se_session *se_sess = se_cmd->se_sess; |
3767 |
+ bool fabric_stop; |
3768 |
+ |
3769 |
+- if (list_empty(&se_cmd->se_cmd_list)) { |
3770 |
+- spin_unlock(&se_sess->sess_cmd_lock); |
3771 |
+- target_free_cmd_mem(se_cmd); |
3772 |
+- se_cmd->se_tfo->release_cmd(se_cmd); |
3773 |
+- return; |
3774 |
+- } |
3775 |
+- |
3776 |
+ spin_lock(&se_cmd->t_state_lock); |
3777 |
+- fabric_stop = (se_cmd->transport_state & CMD_T_FABRIC_STOP); |
3778 |
++ fabric_stop = (se_cmd->transport_state & CMD_T_FABRIC_STOP) && |
3779 |
++ (se_cmd->transport_state & CMD_T_ABORTED); |
3780 |
+ spin_unlock(&se_cmd->t_state_lock); |
3781 |
+ |
3782 |
+ if (se_cmd->cmd_wait_set || fabric_stop) { |
3783 |
+diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c |
3784 |
+index 85323ff75edf..baa888caa964 100644 |
3785 |
+--- a/drivers/tty/serial/atmel_serial.c |
3786 |
++++ b/drivers/tty/serial/atmel_serial.c |
3787 |
+@@ -88,37 +88,6 @@ static void atmel_stop_rx(struct uart_port *port); |
3788 |
+ |
3789 |
+ #define ATMEL_ISR_PASS_LIMIT 256 |
3790 |
+ |
3791 |
+-/* UART registers. CR is write-only, hence no GET macro */ |
3792 |
+-#define UART_PUT_CR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_CR) |
3793 |
+-#define UART_GET_MR(port) __raw_readl((port)->membase + ATMEL_US_MR) |
3794 |
+-#define UART_PUT_MR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_MR) |
3795 |
+-#define UART_PUT_IER(port,v) __raw_writel(v, (port)->membase + ATMEL_US_IER) |
3796 |
+-#define UART_PUT_IDR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_IDR) |
3797 |
+-#define UART_GET_IMR(port) __raw_readl((port)->membase + ATMEL_US_IMR) |
3798 |
+-#define UART_GET_CSR(port) __raw_readl((port)->membase + ATMEL_US_CSR) |
3799 |
+-#define UART_GET_CHAR(port) __raw_readl((port)->membase + ATMEL_US_RHR) |
3800 |
+-#define UART_PUT_CHAR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_THR) |
3801 |
+-#define UART_GET_BRGR(port) __raw_readl((port)->membase + ATMEL_US_BRGR) |
3802 |
+-#define UART_PUT_BRGR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_BRGR) |
3803 |
+-#define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR) |
3804 |
+-#define UART_PUT_TTGR(port, v) __raw_writel(v, (port)->membase + ATMEL_US_TTGR) |
3805 |
+-#define UART_GET_IP_NAME(port) __raw_readl((port)->membase + ATMEL_US_NAME) |
3806 |
+-#define UART_GET_IP_VERSION(port) __raw_readl((port)->membase + ATMEL_US_VERSION) |
3807 |
+- |
3808 |
+- /* PDC registers */ |
3809 |
+-#define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR) |
3810 |
+-#define UART_GET_PTSR(port) __raw_readl((port)->membase + ATMEL_PDC_PTSR) |
3811 |
+- |
3812 |
+-#define UART_PUT_RPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_RPR) |
3813 |
+-#define UART_GET_RPR(port) __raw_readl((port)->membase + ATMEL_PDC_RPR) |
3814 |
+-#define UART_PUT_RCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_RCR) |
3815 |
+-#define UART_PUT_RNPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_RNPR) |
3816 |
+-#define UART_PUT_RNCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_RNCR) |
3817 |
+- |
3818 |
+-#define UART_PUT_TPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TPR) |
3819 |
+-#define UART_PUT_TCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TCR) |
3820 |
+-#define UART_GET_TCR(port) __raw_readl((port)->membase + ATMEL_PDC_TCR) |
3821 |
+- |
3822 |
+ struct atmel_dma_buffer { |
3823 |
+ unsigned char *buf; |
3824 |
+ dma_addr_t dma_addr; |
3825 |
+@@ -211,6 +180,16 @@ to_atmel_uart_port(struct uart_port *uart) |
3826 |
+ return container_of(uart, struct atmel_uart_port, uart); |
3827 |
+ } |
3828 |
+ |
3829 |
++static inline u32 atmel_uart_readl(struct uart_port *port, u32 reg) |
3830 |
++{ |
3831 |
++ return __raw_readl(port->membase + reg); |
3832 |
++} |
3833 |
++ |
3834 |
++static inline void atmel_uart_writel(struct uart_port *port, u32 reg, u32 value) |
3835 |
++{ |
3836 |
++ __raw_writel(value, port->membase + reg); |
3837 |
++} |
3838 |
++ |
3839 |
+ #ifdef CONFIG_SERIAL_ATMEL_PDC |
3840 |
+ static bool atmel_use_pdc_rx(struct uart_port *port) |
3841 |
+ { |
3842 |
+@@ -256,7 +235,7 @@ static unsigned int atmel_get_lines_status(struct uart_port *port) |
3843 |
+ struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
3844 |
+ unsigned int status, ret = 0; |
3845 |
+ |
3846 |
+- status = UART_GET_CSR(port); |
3847 |
++ status = atmel_uart_readl(port, ATMEL_US_CSR); |
3848 |
+ |
3849 |
+ mctrl_gpio_get(atmel_port->gpios, &ret); |
3850 |
+ |
3851 |
+@@ -303,9 +282,9 @@ static int atmel_config_rs485(struct uart_port *port, |
3852 |
+ unsigned int mode; |
3853 |
+ |
3854 |
+ /* Disable interrupts */ |
3855 |
+- UART_PUT_IDR(port, atmel_port->tx_done_mask); |
3856 |
++ atmel_uart_writel(port, ATMEL_US_IDR, atmel_port->tx_done_mask); |
3857 |
+ |
3858 |
+- mode = UART_GET_MR(port); |
3859 |
++ mode = atmel_uart_readl(port, ATMEL_US_MR); |
3860 |
+ |
3861 |
+ /* Resetting serial mode to RS232 (0x0) */ |
3862 |
+ mode &= ~ATMEL_US_USMODE; |
3863 |
+@@ -315,7 +294,8 @@ static int atmel_config_rs485(struct uart_port *port, |
3864 |
+ if (rs485conf->flags & SER_RS485_ENABLED) { |
3865 |
+ dev_dbg(port->dev, "Setting UART to RS485\n"); |
3866 |
+ atmel_port->tx_done_mask = ATMEL_US_TXEMPTY; |
3867 |
+- UART_PUT_TTGR(port, rs485conf->delay_rts_after_send); |
3868 |
++ atmel_uart_writel(port, ATMEL_US_TTGR, |
3869 |
++ rs485conf->delay_rts_after_send); |
3870 |
+ mode |= ATMEL_US_USMODE_RS485; |
3871 |
+ } else { |
3872 |
+ dev_dbg(port->dev, "Setting UART to RS232\n"); |
3873 |
+@@ -325,10 +305,10 @@ static int atmel_config_rs485(struct uart_port *port, |
3874 |
+ else |
3875 |
+ atmel_port->tx_done_mask = ATMEL_US_TXRDY; |
3876 |
+ } |
3877 |
+- UART_PUT_MR(port, mode); |
3878 |
++ atmel_uart_writel(port, ATMEL_US_MR, mode); |
3879 |
+ |
3880 |
+ /* Enable interrupts */ |
3881 |
+- UART_PUT_IER(port, atmel_port->tx_done_mask); |
3882 |
++ atmel_uart_writel(port, ATMEL_US_IER, atmel_port->tx_done_mask); |
3883 |
+ |
3884 |
+ return 0; |
3885 |
+ } |
3886 |
+@@ -338,7 +318,9 @@ static int atmel_config_rs485(struct uart_port *port, |
3887 |
+ */ |
3888 |
+ static u_int atmel_tx_empty(struct uart_port *port) |
3889 |
+ { |
3890 |
+- return (UART_GET_CSR(port) & ATMEL_US_TXEMPTY) ? TIOCSER_TEMT : 0; |
3891 |
++ return (atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXEMPTY) ? |
3892 |
++ TIOCSER_TEMT : |
3893 |
++ 0; |
3894 |
+ } |
3895 |
+ |
3896 |
+ /* |
3897 |
+@@ -347,13 +329,14 @@ static u_int atmel_tx_empty(struct uart_port *port) |
3898 |
+ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl) |
3899 |
+ { |
3900 |
+ unsigned int control = 0; |
3901 |
+- unsigned int mode = UART_GET_MR(port); |
3902 |
++ unsigned int mode = atmel_uart_readl(port, ATMEL_US_MR); |
3903 |
+ unsigned int rts_paused, rts_ready; |
3904 |
+ struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
3905 |
+ |
3906 |
+ /* override mode to RS485 if needed, otherwise keep the current mode */ |
3907 |
+ if (port->rs485.flags & SER_RS485_ENABLED) { |
3908 |
+- UART_PUT_TTGR(port, port->rs485.delay_rts_after_send); |
3909 |
++ atmel_uart_writel(port, ATMEL_US_TTGR, |
3910 |
++ port->rs485.delay_rts_after_send); |
3911 |
+ mode &= ~ATMEL_US_USMODE; |
3912 |
+ mode |= ATMEL_US_USMODE_RS485; |
3913 |
+ } |
3914 |
+@@ -383,7 +366,7 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl) |
3915 |
+ else |
3916 |
+ control |= ATMEL_US_DTRDIS; |
3917 |
+ |
3918 |
+- UART_PUT_CR(port, control); |
3919 |
++ atmel_uart_writel(port, ATMEL_US_CR, control); |
3920 |
+ |
3921 |
+ mctrl_gpio_set(atmel_port->gpios, mctrl); |
3922 |
+ |
3923 |
+@@ -394,7 +377,7 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl) |
3924 |
+ else |
3925 |
+ mode |= ATMEL_US_CHMODE_NORMAL; |
3926 |
+ |
3927 |
+- UART_PUT_MR(port, mode); |
3928 |
++ atmel_uart_writel(port, ATMEL_US_MR, mode); |
3929 |
+ } |
3930 |
+ |
3931 |
+ /* |
3932 |
+@@ -405,7 +388,7 @@ static u_int atmel_get_mctrl(struct uart_port *port) |
3933 |
+ struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
3934 |
+ unsigned int ret = 0, status; |
3935 |
+ |
3936 |
+- status = UART_GET_CSR(port); |
3937 |
++ status = atmel_uart_readl(port, ATMEL_US_CSR); |
3938 |
+ |
3939 |
+ /* |
3940 |
+ * The control signals are active low. |
3941 |
+@@ -431,10 +414,10 @@ static void atmel_stop_tx(struct uart_port *port) |
3942 |
+ |
3943 |
+ if (atmel_use_pdc_tx(port)) { |
3944 |
+ /* disable PDC transmit */ |
3945 |
+- UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS); |
3946 |
++ atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTDIS); |
3947 |
+ } |
3948 |
+ /* Disable interrupts */ |
3949 |
+- UART_PUT_IDR(port, atmel_port->tx_done_mask); |
3950 |
++ atmel_uart_writel(port, ATMEL_US_IDR, atmel_port->tx_done_mask); |
3951 |
+ |
3952 |
+ if ((port->rs485.flags & SER_RS485_ENABLED) && |
3953 |
+ !(port->rs485.flags & SER_RS485_RX_DURING_TX)) |
3954 |
+@@ -448,21 +431,23 @@ static void atmel_start_tx(struct uart_port *port) |
3955 |
+ { |
3956 |
+ struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
3957 |
+ |
3958 |
+- if (atmel_use_pdc_tx(port)) { |
3959 |
+- if (UART_GET_PTSR(port) & ATMEL_PDC_TXTEN) |
3960 |
+- /* The transmitter is already running. Yes, we |
3961 |
+- really need this.*/ |
3962 |
+- return; |
3963 |
++ if (atmel_use_pdc_tx(port) && (atmel_uart_readl(port, ATMEL_PDC_PTSR) |
3964 |
++ & ATMEL_PDC_TXTEN)) |
3965 |
++ /* The transmitter is already running. Yes, we |
3966 |
++ really need this.*/ |
3967 |
++ return; |
3968 |
+ |
3969 |
++ if (atmel_use_pdc_tx(port) || atmel_use_dma_tx(port)) |
3970 |
+ if ((port->rs485.flags & SER_RS485_ENABLED) && |
3971 |
+ !(port->rs485.flags & SER_RS485_RX_DURING_TX)) |
3972 |
+ atmel_stop_rx(port); |
3973 |
+ |
3974 |
++ if (atmel_use_pdc_tx(port)) |
3975 |
+ /* re-enable PDC transmit */ |
3976 |
+- UART_PUT_PTCR(port, ATMEL_PDC_TXTEN); |
3977 |
+- } |
3978 |
++ atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTEN); |
3979 |
++ |
3980 |
+ /* Enable interrupts */ |
3981 |
+- UART_PUT_IER(port, atmel_port->tx_done_mask); |
3982 |
++ atmel_uart_writel(port, ATMEL_US_IER, atmel_port->tx_done_mask); |
3983 |
+ } |
3984 |
+ |
3985 |
+ /* |
3986 |
+@@ -470,17 +455,19 @@ static void atmel_start_tx(struct uart_port *port) |
3987 |
+ */ |
3988 |
+ static void atmel_start_rx(struct uart_port *port) |
3989 |
+ { |
3990 |
+- UART_PUT_CR(port, ATMEL_US_RSTSTA); /* reset status and receiver */ |
3991 |
++ /* reset status and receiver */ |
3992 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA); |
3993 |
+ |
3994 |
+- UART_PUT_CR(port, ATMEL_US_RXEN); |
3995 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RXEN); |
3996 |
+ |
3997 |
+ if (atmel_use_pdc_rx(port)) { |
3998 |
+ /* enable PDC controller */ |
3999 |
+- UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT | |
4000 |
+- port->read_status_mask); |
4001 |
+- UART_PUT_PTCR(port, ATMEL_PDC_RXTEN); |
4002 |
++ atmel_uart_writel(port, ATMEL_US_IER, |
4003 |
++ ATMEL_US_ENDRX | ATMEL_US_TIMEOUT | |
4004 |
++ port->read_status_mask); |
4005 |
++ atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_RXTEN); |
4006 |
+ } else { |
4007 |
+- UART_PUT_IER(port, ATMEL_US_RXRDY); |
4008 |
++ atmel_uart_writel(port, ATMEL_US_IER, ATMEL_US_RXRDY); |
4009 |
+ } |
4010 |
+ } |
4011 |
+ |
4012 |
+@@ -489,15 +476,16 @@ static void atmel_start_rx(struct uart_port *port) |
4013 |
+ */ |
4014 |
+ static void atmel_stop_rx(struct uart_port *port) |
4015 |
+ { |
4016 |
+- UART_PUT_CR(port, ATMEL_US_RXDIS); |
4017 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RXDIS); |
4018 |
+ |
4019 |
+ if (atmel_use_pdc_rx(port)) { |
4020 |
+ /* disable PDC receive */ |
4021 |
+- UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS); |
4022 |
+- UART_PUT_IDR(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT | |
4023 |
+- port->read_status_mask); |
4024 |
++ atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_RXTDIS); |
4025 |
++ atmel_uart_writel(port, ATMEL_US_IDR, |
4026 |
++ ATMEL_US_ENDRX | ATMEL_US_TIMEOUT | |
4027 |
++ port->read_status_mask); |
4028 |
+ } else { |
4029 |
+- UART_PUT_IDR(port, ATMEL_US_RXRDY); |
4030 |
++ atmel_uart_writel(port, ATMEL_US_IDR, ATMEL_US_RXRDY); |
4031 |
+ } |
4032 |
+ } |
4033 |
+ |
4034 |
+@@ -537,7 +525,7 @@ static void atmel_enable_ms(struct uart_port *port) |
4035 |
+ else |
4036 |
+ ier |= ATMEL_US_DCDIC; |
4037 |
+ |
4038 |
+- UART_PUT_IER(port, ier); |
4039 |
++ atmel_uart_writel(port, ATMEL_US_IER, ier); |
4040 |
+ } |
4041 |
+ |
4042 |
+ /* |
4043 |
+@@ -576,7 +564,7 @@ static void atmel_disable_ms(struct uart_port *port) |
4044 |
+ else |
4045 |
+ idr |= ATMEL_US_DCDIC; |
4046 |
+ |
4047 |
+- UART_PUT_IDR(port, idr); |
4048 |
++ atmel_uart_writel(port, ATMEL_US_IDR, idr); |
4049 |
+ } |
4050 |
+ |
4051 |
+ /* |
4052 |
+@@ -585,9 +573,11 @@ static void atmel_disable_ms(struct uart_port *port) |
4053 |
+ static void atmel_break_ctl(struct uart_port *port, int break_state) |
4054 |
+ { |
4055 |
+ if (break_state != 0) |
4056 |
+- UART_PUT_CR(port, ATMEL_US_STTBRK); /* start break */ |
4057 |
++ /* start break */ |
4058 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_STTBRK); |
4059 |
+ else |
4060 |
+- UART_PUT_CR(port, ATMEL_US_STPBRK); /* stop break */ |
4061 |
++ /* stop break */ |
4062 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_STPBRK); |
4063 |
+ } |
4064 |
+ |
4065 |
+ /* |
4066 |
+@@ -621,7 +611,7 @@ atmel_buffer_rx_char(struct uart_port *port, unsigned int status, |
4067 |
+ static void atmel_pdc_rxerr(struct uart_port *port, unsigned int status) |
4068 |
+ { |
4069 |
+ /* clear error */ |
4070 |
+- UART_PUT_CR(port, ATMEL_US_RSTSTA); |
4071 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA); |
4072 |
+ |
4073 |
+ if (status & ATMEL_US_RXBRK) { |
4074 |
+ /* ignore side-effect */ |
4075 |
+@@ -644,9 +634,9 @@ static void atmel_rx_chars(struct uart_port *port) |
4076 |
+ struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
4077 |
+ unsigned int status, ch; |
4078 |
+ |
4079 |
+- status = UART_GET_CSR(port); |
4080 |
++ status = atmel_uart_readl(port, ATMEL_US_CSR); |
4081 |
+ while (status & ATMEL_US_RXRDY) { |
4082 |
+- ch = UART_GET_CHAR(port); |
4083 |
++ ch = atmel_uart_readl(port, ATMEL_US_RHR); |
4084 |
+ |
4085 |
+ /* |
4086 |
+ * note that the error handling code is |
4087 |
+@@ -657,12 +647,13 @@ static void atmel_rx_chars(struct uart_port *port) |
4088 |
+ || atmel_port->break_active)) { |
4089 |
+ |
4090 |
+ /* clear error */ |
4091 |
+- UART_PUT_CR(port, ATMEL_US_RSTSTA); |
4092 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA); |
4093 |
+ |
4094 |
+ if (status & ATMEL_US_RXBRK |
4095 |
+ && !atmel_port->break_active) { |
4096 |
+ atmel_port->break_active = 1; |
4097 |
+- UART_PUT_IER(port, ATMEL_US_RXBRK); |
4098 |
++ atmel_uart_writel(port, ATMEL_US_IER, |
4099 |
++ ATMEL_US_RXBRK); |
4100 |
+ } else { |
4101 |
+ /* |
4102 |
+ * This is either the end-of-break |
4103 |
+@@ -671,14 +662,15 @@ static void atmel_rx_chars(struct uart_port *port) |
4104 |
+ * being set. In both cases, the next |
4105 |
+ * RXBRK will indicate start-of-break. |
4106 |
+ */ |
4107 |
+- UART_PUT_IDR(port, ATMEL_US_RXBRK); |
4108 |
++ atmel_uart_writel(port, ATMEL_US_IDR, |
4109 |
++ ATMEL_US_RXBRK); |
4110 |
+ status &= ~ATMEL_US_RXBRK; |
4111 |
+ atmel_port->break_active = 0; |
4112 |
+ } |
4113 |
+ } |
4114 |
+ |
4115 |
+ atmel_buffer_rx_char(port, status, ch); |
4116 |
+- status = UART_GET_CSR(port); |
4117 |
++ status = atmel_uart_readl(port, ATMEL_US_CSR); |
4118 |
+ } |
4119 |
+ |
4120 |
+ tasklet_schedule(&atmel_port->tasklet); |
4121 |
+@@ -693,16 +685,18 @@ static void atmel_tx_chars(struct uart_port *port) |
4122 |
+ struct circ_buf *xmit = &port->state->xmit; |
4123 |
+ struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
4124 |
+ |
4125 |
+- if (port->x_char && UART_GET_CSR(port) & atmel_port->tx_done_mask) { |
4126 |
+- UART_PUT_CHAR(port, port->x_char); |
4127 |
++ if (port->x_char && |
4128 |
++ (atmel_uart_readl(port, ATMEL_US_CSR) & atmel_port->tx_done_mask)) { |
4129 |
++ atmel_uart_writel(port, ATMEL_US_THR, port->x_char); |
4130 |
+ port->icount.tx++; |
4131 |
+ port->x_char = 0; |
4132 |
+ } |
4133 |
+ if (uart_circ_empty(xmit) || uart_tx_stopped(port)) |
4134 |
+ return; |
4135 |
+ |
4136 |
+- while (UART_GET_CSR(port) & atmel_port->tx_done_mask) { |
4137 |
+- UART_PUT_CHAR(port, xmit->buf[xmit->tail]); |
4138 |
++ while (atmel_uart_readl(port, ATMEL_US_CSR) & |
4139 |
++ atmel_port->tx_done_mask) { |
4140 |
++ atmel_uart_writel(port, ATMEL_US_THR, xmit->buf[xmit->tail]); |
4141 |
+ xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); |
4142 |
+ port->icount.tx++; |
4143 |
+ if (uart_circ_empty(xmit)) |
4144 |
+@@ -714,7 +708,8 @@ static void atmel_tx_chars(struct uart_port *port) |
4145 |
+ |
4146 |
+ if (!uart_circ_empty(xmit)) |
4147 |
+ /* Enable interrupts */ |
4148 |
+- UART_PUT_IER(port, atmel_port->tx_done_mask); |
4149 |
++ atmel_uart_writel(port, ATMEL_US_IER, |
4150 |
++ atmel_port->tx_done_mask); |
4151 |
+ } |
4152 |
+ |
4153 |
+ static void atmel_complete_tx_dma(void *arg) |
4154 |
+@@ -934,14 +929,14 @@ static void atmel_rx_from_dma(struct uart_port *port) |
4155 |
+ |
4156 |
+ |
4157 |
+ /* Reset the UART timeout early so that we don't miss one */ |
4158 |
+- UART_PUT_CR(port, ATMEL_US_STTTO); |
4159 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_STTTO); |
4160 |
+ dmastat = dmaengine_tx_status(chan, |
4161 |
+ atmel_port->cookie_rx, |
4162 |
+ &state); |
4163 |
+ /* Restart a new tasklet if DMA status is error */ |
4164 |
+ if (dmastat == DMA_ERROR) { |
4165 |
+ dev_dbg(port->dev, "Get residue error, restart tasklet\n"); |
4166 |
+- UART_PUT_IER(port, ATMEL_US_TIMEOUT); |
4167 |
++ atmel_uart_writel(port, ATMEL_US_IER, ATMEL_US_TIMEOUT); |
4168 |
+ tasklet_schedule(&atmel_port->tasklet); |
4169 |
+ return; |
4170 |
+ } |
4171 |
+@@ -1007,7 +1002,7 @@ static void atmel_rx_from_dma(struct uart_port *port) |
4172 |
+ tty_flip_buffer_push(tport); |
4173 |
+ spin_lock(&port->lock); |
4174 |
+ |
4175 |
+- UART_PUT_IER(port, ATMEL_US_TIMEOUT); |
4176 |
++ atmel_uart_writel(port, ATMEL_US_IER, ATMEL_US_TIMEOUT); |
4177 |
+ } |
4178 |
+ |
4179 |
+ static int atmel_prepare_rx_dma(struct uart_port *port) |
4180 |
+@@ -1117,8 +1112,8 @@ atmel_handle_receive(struct uart_port *port, unsigned int pending) |
4181 |
+ * the moment. |
4182 |
+ */ |
4183 |
+ if (pending & (ATMEL_US_ENDRX | ATMEL_US_TIMEOUT)) { |
4184 |
+- UART_PUT_IDR(port, (ATMEL_US_ENDRX |
4185 |
+- | ATMEL_US_TIMEOUT)); |
4186 |
++ atmel_uart_writel(port, ATMEL_US_IDR, |
4187 |
++ (ATMEL_US_ENDRX | ATMEL_US_TIMEOUT)); |
4188 |
+ tasklet_schedule(&atmel_port->tasklet); |
4189 |
+ } |
4190 |
+ |
4191 |
+@@ -1129,7 +1124,8 @@ atmel_handle_receive(struct uart_port *port, unsigned int pending) |
4192 |
+ |
4193 |
+ if (atmel_use_dma_rx(port)) { |
4194 |
+ if (pending & ATMEL_US_TIMEOUT) { |
4195 |
+- UART_PUT_IDR(port, ATMEL_US_TIMEOUT); |
4196 |
++ atmel_uart_writel(port, ATMEL_US_IDR, |
4197 |
++ ATMEL_US_TIMEOUT); |
4198 |
+ tasklet_schedule(&atmel_port->tasklet); |
4199 |
+ } |
4200 |
+ } |
4201 |
+@@ -1142,8 +1138,8 @@ atmel_handle_receive(struct uart_port *port, unsigned int pending) |
4202 |
+ * End of break detected. If it came along with a |
4203 |
+ * character, atmel_rx_chars will handle it. |
4204 |
+ */ |
4205 |
+- UART_PUT_CR(port, ATMEL_US_RSTSTA); |
4206 |
+- UART_PUT_IDR(port, ATMEL_US_RXBRK); |
4207 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA); |
4208 |
++ atmel_uart_writel(port, ATMEL_US_IDR, ATMEL_US_RXBRK); |
4209 |
+ atmel_port->break_active = 0; |
4210 |
+ } |
4211 |
+ } |
4212 |
+@@ -1158,7 +1154,8 @@ atmel_handle_transmit(struct uart_port *port, unsigned int pending) |
4213 |
+ |
4214 |
+ if (pending & atmel_port->tx_done_mask) { |
4215 |
+ /* Either PDC or interrupt transmission */ |
4216 |
+- UART_PUT_IDR(port, atmel_port->tx_done_mask); |
4217 |
++ atmel_uart_writel(port, ATMEL_US_IDR, |
4218 |
++ atmel_port->tx_done_mask); |
4219 |
+ tasklet_schedule(&atmel_port->tasklet); |
4220 |
+ } |
4221 |
+ } |
4222 |
+@@ -1193,7 +1190,7 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id) |
4223 |
+ |
4224 |
+ do { |
4225 |
+ status = atmel_get_lines_status(port); |
4226 |
+- mask = UART_GET_IMR(port); |
4227 |
++ mask = atmel_uart_readl(port, ATMEL_US_IMR); |
4228 |
+ pending = status & mask; |
4229 |
+ if (!gpio_handled) { |
4230 |
+ /* |
4231 |
+@@ -1219,7 +1216,7 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id) |
4232 |
+ if (atmel_port->suspended) { |
4233 |
+ atmel_port->pending |= pending; |
4234 |
+ atmel_port->pending_status = status; |
4235 |
+- UART_PUT_IDR(port, mask); |
4236 |
++ atmel_uart_writel(port, ATMEL_US_IDR, mask); |
4237 |
+ pm_system_wakeup(); |
4238 |
+ break; |
4239 |
+ } |
4240 |
+@@ -1256,7 +1253,7 @@ static void atmel_tx_pdc(struct uart_port *port) |
4241 |
+ int count; |
4242 |
+ |
4243 |
+ /* nothing left to transmit? */ |
4244 |
+- if (UART_GET_TCR(port)) |
4245 |
++ if (atmel_uart_readl(port, ATMEL_PDC_TCR)) |
4246 |
+ return; |
4247 |
+ |
4248 |
+ xmit->tail += pdc->ofs; |
4249 |
+@@ -1268,7 +1265,7 @@ static void atmel_tx_pdc(struct uart_port *port) |
4250 |
+ /* more to transmit - setup next transfer */ |
4251 |
+ |
4252 |
+ /* disable PDC transmit */ |
4253 |
+- UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS); |
4254 |
++ atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTDIS); |
4255 |
+ |
4256 |
+ if (!uart_circ_empty(xmit) && !uart_tx_stopped(port)) { |
4257 |
+ dma_sync_single_for_device(port->dev, |
4258 |
+@@ -1279,12 +1276,14 @@ static void atmel_tx_pdc(struct uart_port *port) |
4259 |
+ count = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); |
4260 |
+ pdc->ofs = count; |
4261 |
+ |
4262 |
+- UART_PUT_TPR(port, pdc->dma_addr + xmit->tail); |
4263 |
+- UART_PUT_TCR(port, count); |
4264 |
++ atmel_uart_writel(port, ATMEL_PDC_TPR, |
4265 |
++ pdc->dma_addr + xmit->tail); |
4266 |
++ atmel_uart_writel(port, ATMEL_PDC_TCR, count); |
4267 |
+ /* re-enable PDC transmit */ |
4268 |
+- UART_PUT_PTCR(port, ATMEL_PDC_TXTEN); |
4269 |
++ atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTEN); |
4270 |
+ /* Enable interrupts */ |
4271 |
+- UART_PUT_IER(port, atmel_port->tx_done_mask); |
4272 |
++ atmel_uart_writel(port, ATMEL_US_IER, |
4273 |
++ atmel_port->tx_done_mask); |
4274 |
+ } else { |
4275 |
+ if ((port->rs485.flags & SER_RS485_ENABLED) && |
4276 |
+ !(port->rs485.flags & SER_RS485_RX_DURING_TX)) { |
4277 |
+@@ -1410,10 +1409,10 @@ static void atmel_rx_from_pdc(struct uart_port *port) |
4278 |
+ |
4279 |
+ do { |
4280 |
+ /* Reset the UART timeout early so that we don't miss one */ |
4281 |
+- UART_PUT_CR(port, ATMEL_US_STTTO); |
4282 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_STTTO); |
4283 |
+ |
4284 |
+ pdc = &atmel_port->pdc_rx[rx_idx]; |
4285 |
+- head = UART_GET_RPR(port) - pdc->dma_addr; |
4286 |
++ head = atmel_uart_readl(port, ATMEL_PDC_RPR) - pdc->dma_addr; |
4287 |
+ tail = pdc->ofs; |
4288 |
+ |
4289 |
+ /* If the PDC has switched buffers, RPR won't contain |
4290 |
+@@ -1456,8 +1455,8 @@ static void atmel_rx_from_pdc(struct uart_port *port) |
4291 |
+ */ |
4292 |
+ if (head >= pdc->dma_size) { |
4293 |
+ pdc->ofs = 0; |
4294 |
+- UART_PUT_RNPR(port, pdc->dma_addr); |
4295 |
+- UART_PUT_RNCR(port, pdc->dma_size); |
4296 |
++ atmel_uart_writel(port, ATMEL_PDC_RNPR, pdc->dma_addr); |
4297 |
++ atmel_uart_writel(port, ATMEL_PDC_RNCR, pdc->dma_size); |
4298 |
+ |
4299 |
+ rx_idx = !rx_idx; |
4300 |
+ atmel_port->pdc_rx_idx = rx_idx; |
4301 |
+@@ -1472,7 +1471,8 @@ static void atmel_rx_from_pdc(struct uart_port *port) |
4302 |
+ tty_flip_buffer_push(tport); |
4303 |
+ spin_lock(&port->lock); |
4304 |
+ |
4305 |
+- UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT); |
4306 |
++ atmel_uart_writel(port, ATMEL_US_IER, |
4307 |
++ ATMEL_US_ENDRX | ATMEL_US_TIMEOUT); |
4308 |
+ } |
4309 |
+ |
4310 |
+ static int atmel_prepare_rx_pdc(struct uart_port *port) |
4311 |
+@@ -1505,11 +1505,12 @@ static int atmel_prepare_rx_pdc(struct uart_port *port) |
4312 |
+ |
4313 |
+ atmel_port->pdc_rx_idx = 0; |
4314 |
+ |
4315 |
+- UART_PUT_RPR(port, atmel_port->pdc_rx[0].dma_addr); |
4316 |
+- UART_PUT_RCR(port, PDC_BUFFER_SIZE); |
4317 |
++ atmel_uart_writel(port, ATMEL_PDC_RPR, atmel_port->pdc_rx[0].dma_addr); |
4318 |
++ atmel_uart_writel(port, ATMEL_PDC_RCR, PDC_BUFFER_SIZE); |
4319 |
+ |
4320 |
+- UART_PUT_RNPR(port, atmel_port->pdc_rx[1].dma_addr); |
4321 |
+- UART_PUT_RNCR(port, PDC_BUFFER_SIZE); |
4322 |
++ atmel_uart_writel(port, ATMEL_PDC_RNPR, |
4323 |
++ atmel_port->pdc_rx[1].dma_addr); |
4324 |
++ atmel_uart_writel(port, ATMEL_PDC_RNCR, PDC_BUFFER_SIZE); |
4325 |
+ |
4326 |
+ return 0; |
4327 |
+ } |
4328 |
+@@ -1666,7 +1667,7 @@ static void atmel_set_ops(struct uart_port *port) |
4329 |
+ static void atmel_get_ip_name(struct uart_port *port) |
4330 |
+ { |
4331 |
+ struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
4332 |
+- int name = UART_GET_IP_NAME(port); |
4333 |
++ int name = atmel_uart_readl(port, ATMEL_US_NAME); |
4334 |
+ u32 version; |
4335 |
+ int usart, uart; |
4336 |
+ /* usart and uart ascii */ |
4337 |
+@@ -1683,7 +1684,7 @@ static void atmel_get_ip_name(struct uart_port *port) |
4338 |
+ atmel_port->is_usart = false; |
4339 |
+ } else { |
4340 |
+ /* fallback for older SoCs: use version field */ |
4341 |
+- version = UART_GET_IP_VERSION(port); |
4342 |
++ version = atmel_uart_readl(port, ATMEL_US_VERSION); |
4343 |
+ switch (version) { |
4344 |
+ case 0x302: |
4345 |
+ case 0x10213: |
4346 |
+@@ -1755,7 +1756,7 @@ static int atmel_startup(struct uart_port *port) |
4347 |
+ * request_irq() is called we could get stuck trying to |
4348 |
+ * handle an unexpected interrupt |
4349 |
+ */ |
4350 |
+- UART_PUT_IDR(port, -1); |
4351 |
++ atmel_uart_writel(port, ATMEL_US_IDR, -1); |
4352 |
+ atmel_port->ms_irq_enabled = false; |
4353 |
+ |
4354 |
+ /* |
4355 |
+@@ -1803,9 +1804,9 @@ static int atmel_startup(struct uart_port *port) |
4356 |
+ /* |
4357 |
+ * Finally, enable the serial port |
4358 |
+ */ |
4359 |
+- UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); |
4360 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); |
4361 |
+ /* enable xmit & rcvr */ |
4362 |
+- UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN); |
4363 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN | ATMEL_US_RXEN); |
4364 |
+ |
4365 |
+ setup_timer(&atmel_port->uart_timer, |
4366 |
+ atmel_uart_timer_callback, |
4367 |
+@@ -1818,13 +1819,14 @@ static int atmel_startup(struct uart_port *port) |
4368 |
+ jiffies + uart_poll_timeout(port)); |
4369 |
+ /* set USART timeout */ |
4370 |
+ } else { |
4371 |
+- UART_PUT_RTOR(port, PDC_RX_TIMEOUT); |
4372 |
+- UART_PUT_CR(port, ATMEL_US_STTTO); |
4373 |
++ atmel_uart_writel(port, ATMEL_US_RTOR, PDC_RX_TIMEOUT); |
4374 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_STTTO); |
4375 |
+ |
4376 |
+- UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT); |
4377 |
++ atmel_uart_writel(port, ATMEL_US_IER, |
4378 |
++ ATMEL_US_ENDRX | ATMEL_US_TIMEOUT); |
4379 |
+ } |
4380 |
+ /* enable PDC controller */ |
4381 |
+- UART_PUT_PTCR(port, ATMEL_PDC_RXTEN); |
4382 |
++ atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_RXTEN); |
4383 |
+ } else if (atmel_use_dma_rx(port)) { |
4384 |
+ /* set UART timeout */ |
4385 |
+ if (!atmel_port->is_usart) { |
4386 |
+@@ -1832,14 +1834,15 @@ static int atmel_startup(struct uart_port *port) |
4387 |
+ jiffies + uart_poll_timeout(port)); |
4388 |
+ /* set USART timeout */ |
4389 |
+ } else { |
4390 |
+- UART_PUT_RTOR(port, PDC_RX_TIMEOUT); |
4391 |
+- UART_PUT_CR(port, ATMEL_US_STTTO); |
4392 |
++ atmel_uart_writel(port, ATMEL_US_RTOR, PDC_RX_TIMEOUT); |
4393 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_STTTO); |
4394 |
+ |
4395 |
+- UART_PUT_IER(port, ATMEL_US_TIMEOUT); |
4396 |
++ atmel_uart_writel(port, ATMEL_US_IER, |
4397 |
++ ATMEL_US_TIMEOUT); |
4398 |
+ } |
4399 |
+ } else { |
4400 |
+ /* enable receive only */ |
4401 |
+- UART_PUT_IER(port, ATMEL_US_RXRDY); |
4402 |
++ atmel_uart_writel(port, ATMEL_US_IER, ATMEL_US_RXRDY); |
4403 |
+ } |
4404 |
+ |
4405 |
+ return 0; |
4406 |
+@@ -1859,7 +1862,7 @@ static void atmel_flush_buffer(struct uart_port *port) |
4407 |
+ struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
4408 |
+ |
4409 |
+ if (atmel_use_pdc_tx(port)) { |
4410 |
+- UART_PUT_TCR(port, 0); |
4411 |
++ atmel_uart_writel(port, ATMEL_PDC_TCR, 0); |
4412 |
+ atmel_port->pdc_tx.ofs = 0; |
4413 |
+ } |
4414 |
+ } |
4415 |
+@@ -1891,8 +1894,8 @@ static void atmel_shutdown(struct uart_port *port) |
4416 |
+ atmel_stop_rx(port); |
4417 |
+ atmel_stop_tx(port); |
4418 |
+ |
4419 |
+- UART_PUT_CR(port, ATMEL_US_RSTSTA); |
4420 |
+- UART_PUT_IDR(port, -1); |
4421 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA); |
4422 |
++ atmel_uart_writel(port, ATMEL_US_IDR, -1); |
4423 |
+ |
4424 |
+ |
4425 |
+ /* |
4426 |
+@@ -1937,12 +1940,12 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state, |
4427 |
+ clk_prepare_enable(atmel_port->clk); |
4428 |
+ |
4429 |
+ /* re-enable interrupts if we disabled some on suspend */ |
4430 |
+- UART_PUT_IER(port, atmel_port->backup_imr); |
4431 |
++ atmel_uart_writel(port, ATMEL_US_IER, atmel_port->backup_imr); |
4432 |
+ break; |
4433 |
+ case 3: |
4434 |
+ /* Back up the interrupt mask and disable all interrupts */ |
4435 |
+- atmel_port->backup_imr = UART_GET_IMR(port); |
4436 |
+- UART_PUT_IDR(port, -1); |
4437 |
++ atmel_port->backup_imr = atmel_uart_readl(port, ATMEL_US_IMR); |
4438 |
++ atmel_uart_writel(port, ATMEL_US_IDR, -1); |
4439 |
+ |
4440 |
+ /* |
4441 |
+ * Disable the peripheral clock for this serial port. |
4442 |
+@@ -1965,7 +1968,7 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, |
4443 |
+ unsigned int old_mode, mode, imr, quot, baud; |
4444 |
+ |
4445 |
+ /* save the current mode register */ |
4446 |
+- mode = old_mode = UART_GET_MR(port); |
4447 |
++ mode = old_mode = atmel_uart_readl(port, ATMEL_US_MR); |
4448 |
+ |
4449 |
+ /* reset the mode, clock divisor, parity, stop bits and data size */ |
4450 |
+ mode &= ~(ATMEL_US_USCLKS | ATMEL_US_CHRL | ATMEL_US_NBSTOP | |
4451 |
+@@ -2024,7 +2027,7 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, |
4452 |
+ |
4453 |
+ if (atmel_use_pdc_rx(port)) |
4454 |
+ /* need to enable error interrupts */ |
4455 |
+- UART_PUT_IER(port, port->read_status_mask); |
4456 |
++ atmel_uart_writel(port, ATMEL_US_IER, port->read_status_mask); |
4457 |
+ |
4458 |
+ /* |
4459 |
+ * Characters to ignore |
4460 |
+@@ -2051,15 +2054,16 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, |
4461 |
+ * transmitter is empty if requested by the caller, so there's |
4462 |
+ * no need to wait for it here. |
4463 |
+ */ |
4464 |
+- imr = UART_GET_IMR(port); |
4465 |
+- UART_PUT_IDR(port, -1); |
4466 |
++ imr = atmel_uart_readl(port, ATMEL_US_IMR); |
4467 |
++ atmel_uart_writel(port, ATMEL_US_IDR, -1); |
4468 |
+ |
4469 |
+ /* disable receiver and transmitter */ |
4470 |
+- UART_PUT_CR(port, ATMEL_US_TXDIS | ATMEL_US_RXDIS); |
4471 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXDIS | ATMEL_US_RXDIS); |
4472 |
+ |
4473 |
+ /* mode */ |
4474 |
+ if (port->rs485.flags & SER_RS485_ENABLED) { |
4475 |
+- UART_PUT_TTGR(port, port->rs485.delay_rts_after_send); |
4476 |
++ atmel_uart_writel(port, ATMEL_US_TTGR, |
4477 |
++ port->rs485.delay_rts_after_send); |
4478 |
+ mode |= ATMEL_US_USMODE_RS485; |
4479 |
+ } else if (termios->c_cflag & CRTSCTS) { |
4480 |
+ /* RS232 with hardware handshake (RTS/CTS) */ |
4481 |
+@@ -2070,7 +2074,7 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, |
4482 |
+ } |
4483 |
+ |
4484 |
+ /* set the mode, clock divisor, parity, stop bits and data size */ |
4485 |
+- UART_PUT_MR(port, mode); |
4486 |
++ atmel_uart_writel(port, ATMEL_US_MR, mode); |
4487 |
+ |
4488 |
+ /* |
4489 |
+ * when switching the mode, set the RTS line state according to the |
4490 |
+@@ -2087,16 +2091,16 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, |
4491 |
+ rts_state = ATMEL_US_RTSEN; |
4492 |
+ } |
4493 |
+ |
4494 |
+- UART_PUT_CR(port, rts_state); |
4495 |
++ atmel_uart_writel(port, ATMEL_US_CR, rts_state); |
4496 |
+ } |
4497 |
+ |
4498 |
+ /* set the baud rate */ |
4499 |
+- UART_PUT_BRGR(port, quot); |
4500 |
+- UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); |
4501 |
+- UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN); |
4502 |
++ atmel_uart_writel(port, ATMEL_US_BRGR, quot); |
4503 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); |
4504 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN | ATMEL_US_RXEN); |
4505 |
+ |
4506 |
+ /* restore interrupts */ |
4507 |
+- UART_PUT_IER(port, imr); |
4508 |
++ atmel_uart_writel(port, ATMEL_US_IER, imr); |
4509 |
+ |
4510 |
+ /* CTS flow-control and modem-status interrupts */ |
4511 |
+ if (UART_ENABLE_MS(port, termios->c_cflag)) |
4512 |
+@@ -2207,18 +2211,18 @@ static int atmel_verify_port(struct uart_port *port, struct serial_struct *ser) |
4513 |
+ #ifdef CONFIG_CONSOLE_POLL |
4514 |
+ static int atmel_poll_get_char(struct uart_port *port) |
4515 |
+ { |
4516 |
+- while (!(UART_GET_CSR(port) & ATMEL_US_RXRDY)) |
4517 |
++ while (!(atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_RXRDY)) |
4518 |
+ cpu_relax(); |
4519 |
+ |
4520 |
+- return UART_GET_CHAR(port); |
4521 |
++ return atmel_uart_readl(port, ATMEL_US_RHR); |
4522 |
+ } |
4523 |
+ |
4524 |
+ static void atmel_poll_put_char(struct uart_port *port, unsigned char ch) |
4525 |
+ { |
4526 |
+- while (!(UART_GET_CSR(port) & ATMEL_US_TXRDY)) |
4527 |
++ while (!(atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY)) |
4528 |
+ cpu_relax(); |
4529 |
+ |
4530 |
+- UART_PUT_CHAR(port, ch); |
4531 |
++ atmel_uart_writel(port, ATMEL_US_THR, ch); |
4532 |
+ } |
4533 |
+ #endif |
4534 |
+ |
4535 |
+@@ -2323,9 +2327,9 @@ struct platform_device *atmel_default_console_device; /* the serial console devi |
4536 |
+ #ifdef CONFIG_SERIAL_ATMEL_CONSOLE |
4537 |
+ static void atmel_console_putchar(struct uart_port *port, int ch) |
4538 |
+ { |
4539 |
+- while (!(UART_GET_CSR(port) & ATMEL_US_TXRDY)) |
4540 |
++ while (!(atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY)) |
4541 |
+ cpu_relax(); |
4542 |
+- UART_PUT_CHAR(port, ch); |
4543 |
++ atmel_uart_writel(port, ATMEL_US_THR, ch); |
4544 |
+ } |
4545 |
+ |
4546 |
+ /* |
4547 |
+@@ -2341,12 +2345,13 @@ static void atmel_console_write(struct console *co, const char *s, u_int count) |
4548 |
+ /* |
4549 |
+ * First, save IMR and then disable interrupts |
4550 |
+ */ |
4551 |
+- imr = UART_GET_IMR(port); |
4552 |
+- UART_PUT_IDR(port, ATMEL_US_RXRDY | atmel_port->tx_done_mask); |
4553 |
++ imr = atmel_uart_readl(port, ATMEL_US_IMR); |
4554 |
++ atmel_uart_writel(port, ATMEL_US_IDR, |
4555 |
++ ATMEL_US_RXRDY | atmel_port->tx_done_mask); |
4556 |
+ |
4557 |
+ /* Store PDC transmit status and disable it */ |
4558 |
+- pdc_tx = UART_GET_PTSR(port) & ATMEL_PDC_TXTEN; |
4559 |
+- UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS); |
4560 |
++ pdc_tx = atmel_uart_readl(port, ATMEL_PDC_PTSR) & ATMEL_PDC_TXTEN; |
4561 |
++ atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTDIS); |
4562 |
+ |
4563 |
+ uart_console_write(port, s, count, atmel_console_putchar); |
4564 |
+ |
4565 |
+@@ -2355,15 +2360,15 @@ static void atmel_console_write(struct console *co, const char *s, u_int count) |
4566 |
+ * and restore IMR |
4567 |
+ */ |
4568 |
+ do { |
4569 |
+- status = UART_GET_CSR(port); |
4570 |
++ status = atmel_uart_readl(port, ATMEL_US_CSR); |
4571 |
+ } while (!(status & ATMEL_US_TXRDY)); |
4572 |
+ |
4573 |
+ /* Restore PDC transmit status */ |
4574 |
+ if (pdc_tx) |
4575 |
+- UART_PUT_PTCR(port, ATMEL_PDC_TXTEN); |
4576 |
++ atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTEN); |
4577 |
+ |
4578 |
+ /* set interrupts back the way they were */ |
4579 |
+- UART_PUT_IER(port, imr); |
4580 |
++ atmel_uart_writel(port, ATMEL_US_IER, imr); |
4581 |
+ } |
4582 |
+ |
4583 |
+ /* |
4584 |
+@@ -2379,17 +2384,17 @@ static void __init atmel_console_get_options(struct uart_port *port, int *baud, |
4585 |
+ * If the baud rate generator isn't running, the port wasn't |
4586 |
+ * initialized by the boot loader. |
4587 |
+ */ |
4588 |
+- quot = UART_GET_BRGR(port) & ATMEL_US_CD; |
4589 |
++ quot = atmel_uart_readl(port, ATMEL_US_BRGR) & ATMEL_US_CD; |
4590 |
+ if (!quot) |
4591 |
+ return; |
4592 |
+ |
4593 |
+- mr = UART_GET_MR(port) & ATMEL_US_CHRL; |
4594 |
++ mr = atmel_uart_readl(port, ATMEL_US_MR) & ATMEL_US_CHRL; |
4595 |
+ if (mr == ATMEL_US_CHRL_8) |
4596 |
+ *bits = 8; |
4597 |
+ else |
4598 |
+ *bits = 7; |
4599 |
+ |
4600 |
+- mr = UART_GET_MR(port) & ATMEL_US_PAR; |
4601 |
++ mr = atmel_uart_readl(port, ATMEL_US_MR) & ATMEL_US_PAR; |
4602 |
+ if (mr == ATMEL_US_PAR_EVEN) |
4603 |
+ *parity = 'e'; |
4604 |
+ else if (mr == ATMEL_US_PAR_ODD) |
4605 |
+@@ -2422,9 +2427,9 @@ static int __init atmel_console_setup(struct console *co, char *options) |
4606 |
+ if (ret) |
4607 |
+ return ret; |
4608 |
+ |
4609 |
+- UART_PUT_IDR(port, -1); |
4610 |
+- UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); |
4611 |
+- UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN); |
4612 |
++ atmel_uart_writel(port, ATMEL_US_IDR, -1); |
4613 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); |
4614 |
++ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN | ATMEL_US_RXEN); |
4615 |
+ |
4616 |
+ if (options) |
4617 |
+ uart_parse_options(options, &baud, &parity, &bits, &flow); |
4618 |
+@@ -2531,7 +2536,8 @@ static int atmel_serial_suspend(struct platform_device *pdev, |
4619 |
+ |
4620 |
+ if (atmel_is_console_port(port) && console_suspend_enabled) { |
4621 |
+ /* Drain the TX shifter */ |
4622 |
+- while (!(UART_GET_CSR(port) & ATMEL_US_TXEMPTY)) |
4623 |
++ while (!(atmel_uart_readl(port, ATMEL_US_CSR) & |
4624 |
++ ATMEL_US_TXEMPTY)) |
4625 |
+ cpu_relax(); |
4626 |
+ } |
4627 |
+ |
4628 |
+@@ -2683,8 +2689,9 @@ static int atmel_serial_probe(struct platform_device *pdev) |
4629 |
+ clk_prepare_enable(port->clk); |
4630 |
+ |
4631 |
+ if (rs485_enabled) { |
4632 |
+- UART_PUT_MR(&port->uart, ATMEL_US_USMODE_NORMAL); |
4633 |
+- UART_PUT_CR(&port->uart, ATMEL_US_RTSEN); |
4634 |
++ atmel_uart_writel(&port->uart, ATMEL_US_MR, |
4635 |
++ ATMEL_US_USMODE_NORMAL); |
4636 |
++ atmel_uart_writel(&port->uart, ATMEL_US_CR, ATMEL_US_RTSEN); |
4637 |
+ } |
4638 |
+ |
4639 |
+ /* |
4640 |
+diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c |
4641 |
+index e42cb6bdd31d..10f83076826d 100644 |
4642 |
+--- a/drivers/tty/serial/samsung.c |
4643 |
++++ b/drivers/tty/serial/samsung.c |
4644 |
+@@ -1701,7 +1701,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, |
4645 |
+ return -ENODEV; |
4646 |
+ |
4647 |
+ if (port->mapbase != 0) |
4648 |
+- return 0; |
4649 |
++ return -EINVAL; |
4650 |
+ |
4651 |
+ /* setup info for port */ |
4652 |
+ port->dev = &platdev->dev; |
4653 |
+@@ -1755,22 +1755,25 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, |
4654 |
+ ourport->dma = devm_kzalloc(port->dev, |
4655 |
+ sizeof(*ourport->dma), |
4656 |
+ GFP_KERNEL); |
4657 |
+- if (!ourport->dma) |
4658 |
+- return -ENOMEM; |
4659 |
++ if (!ourport->dma) { |
4660 |
++ ret = -ENOMEM; |
4661 |
++ goto err; |
4662 |
++ } |
4663 |
+ } |
4664 |
+ |
4665 |
+ ourport->clk = clk_get(&platdev->dev, "uart"); |
4666 |
+ if (IS_ERR(ourport->clk)) { |
4667 |
+ pr_err("%s: Controller clock not found\n", |
4668 |
+ dev_name(&platdev->dev)); |
4669 |
+- return PTR_ERR(ourport->clk); |
4670 |
++ ret = PTR_ERR(ourport->clk); |
4671 |
++ goto err; |
4672 |
+ } |
4673 |
+ |
4674 |
+ ret = clk_prepare_enable(ourport->clk); |
4675 |
+ if (ret) { |
4676 |
+ pr_err("uart: clock failed to prepare+enable: %d\n", ret); |
4677 |
+ clk_put(ourport->clk); |
4678 |
+- return ret; |
4679 |
++ goto err; |
4680 |
+ } |
4681 |
+ |
4682 |
+ /* Keep all interrupts masked and cleared */ |
4683 |
+@@ -1786,7 +1789,12 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, |
4684 |
+ |
4685 |
+ /* reset the fifos (and setup the uart) */ |
4686 |
+ s3c24xx_serial_resetport(port, cfg); |
4687 |
++ |
4688 |
+ return 0; |
4689 |
++ |
4690 |
++err: |
4691 |
++ port->mapbase = 0; |
4692 |
++ return ret; |
4693 |
+ } |
4694 |
+ |
4695 |
+ /* Device driver serial port probe */ |
4696 |
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
4697 |
+index f28b5375e2c8..d2e50a27140c 100644 |
4698 |
+--- a/drivers/usb/core/quirks.c |
4699 |
++++ b/drivers/usb/core/quirks.c |
4700 |
+@@ -128,6 +128,12 @@ static const struct usb_device_id usb_quirk_list[] = { |
4701 |
+ { USB_DEVICE(0x04f3, 0x016f), .driver_info = |
4702 |
+ USB_QUIRK_DEVICE_QUALIFIER }, |
4703 |
+ |
4704 |
++ { USB_DEVICE(0x04f3, 0x0381), .driver_info = |
4705 |
++ USB_QUIRK_NO_LPM }, |
4706 |
++ |
4707 |
++ { USB_DEVICE(0x04f3, 0x21b8), .driver_info = |
4708 |
++ USB_QUIRK_DEVICE_QUALIFIER }, |
4709 |
++ |
4710 |
+ /* Roland SC-8820 */ |
4711 |
+ { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, |
4712 |
+ |
4713 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
4714 |
+index b886226be241..f4c6e81df034 100644 |
4715 |
+--- a/drivers/usb/dwc3/gadget.c |
4716 |
++++ b/drivers/usb/dwc3/gadget.c |
4717 |
+@@ -1939,6 +1939,10 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep, |
4718 |
+ return 1; |
4719 |
+ } |
4720 |
+ |
4721 |
++ if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) |
4722 |
++ if ((event->status & DEPEVT_STATUS_IOC) && |
4723 |
++ (trb->ctrl & DWC3_TRB_CTRL_IOC)) |
4724 |
++ return 0; |
4725 |
+ return 1; |
4726 |
+ } |
4727 |
+ |
4728 |
+diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c |
4729 |
+index fe1d5fc7da2d..47d2c09e4f35 100644 |
4730 |
+--- a/drivers/usb/host/ohci-q.c |
4731 |
++++ b/drivers/usb/host/ohci-q.c |
4732 |
+@@ -183,7 +183,6 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) |
4733 |
+ { |
4734 |
+ int branch; |
4735 |
+ |
4736 |
+- ed->state = ED_OPER; |
4737 |
+ ed->ed_prev = NULL; |
4738 |
+ ed->ed_next = NULL; |
4739 |
+ ed->hwNextED = 0; |
4740 |
+@@ -259,6 +258,8 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) |
4741 |
+ /* the HC may not see the schedule updates yet, but if it does |
4742 |
+ * then they'll be properly ordered. |
4743 |
+ */ |
4744 |
++ |
4745 |
++ ed->state = ED_OPER; |
4746 |
+ return 0; |
4747 |
+ } |
4748 |
+ |
4749 |
+diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c |
4750 |
+index f1893e08e51a..db565f620f82 100644 |
4751 |
+--- a/drivers/usb/renesas_usbhs/fifo.c |
4752 |
++++ b/drivers/usb/renesas_usbhs/fifo.c |
4753 |
+@@ -808,20 +808,27 @@ static void xfer_work(struct work_struct *work) |
4754 |
+ { |
4755 |
+ struct usbhs_pkt *pkt = container_of(work, struct usbhs_pkt, work); |
4756 |
+ struct usbhs_pipe *pipe = pkt->pipe; |
4757 |
+- struct usbhs_fifo *fifo = usbhs_pipe_to_fifo(pipe); |
4758 |
++ struct usbhs_fifo *fifo; |
4759 |
+ struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); |
4760 |
+ struct dma_async_tx_descriptor *desc; |
4761 |
+- struct dma_chan *chan = usbhsf_dma_chan_get(fifo, pkt); |
4762 |
++ struct dma_chan *chan; |
4763 |
+ struct device *dev = usbhs_priv_to_dev(priv); |
4764 |
+ enum dma_transfer_direction dir; |
4765 |
++ unsigned long flags; |
4766 |
+ |
4767 |
++ usbhs_lock(priv, flags); |
4768 |
++ fifo = usbhs_pipe_to_fifo(pipe); |
4769 |
++ if (!fifo) |
4770 |
++ goto xfer_work_end; |
4771 |
++ |
4772 |
++ chan = usbhsf_dma_chan_get(fifo, pkt); |
4773 |
+ dir = usbhs_pipe_is_dir_in(pipe) ? DMA_DEV_TO_MEM : DMA_MEM_TO_DEV; |
4774 |
+ |
4775 |
+ desc = dmaengine_prep_slave_single(chan, pkt->dma + pkt->actual, |
4776 |
+ pkt->trans, dir, |
4777 |
+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
4778 |
+ if (!desc) |
4779 |
+- return; |
4780 |
++ goto xfer_work_end; |
4781 |
+ |
4782 |
+ desc->callback = usbhsf_dma_complete; |
4783 |
+ desc->callback_param = pipe; |
4784 |
+@@ -829,7 +836,7 @@ static void xfer_work(struct work_struct *work) |
4785 |
+ pkt->cookie = dmaengine_submit(desc); |
4786 |
+ if (pkt->cookie < 0) { |
4787 |
+ dev_err(dev, "Failed to submit dma descriptor\n"); |
4788 |
+- return; |
4789 |
++ goto xfer_work_end; |
4790 |
+ } |
4791 |
+ |
4792 |
+ dev_dbg(dev, " %s %d (%d/ %d)\n", |
4793 |
+@@ -840,6 +847,9 @@ static void xfer_work(struct work_struct *work) |
4794 |
+ usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->trans); |
4795 |
+ dma_async_issue_pending(chan); |
4796 |
+ usbhs_pipe_enable(pipe); |
4797 |
++ |
4798 |
++xfer_work_end: |
4799 |
++ usbhs_unlock(priv, flags); |
4800 |
+ } |
4801 |
+ |
4802 |
+ /* |
4803 |
+diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c |
4804 |
+index 046529656465..74af77a022a8 100644 |
4805 |
+--- a/drivers/usb/renesas_usbhs/mod_gadget.c |
4806 |
++++ b/drivers/usb/renesas_usbhs/mod_gadget.c |
4807 |
+@@ -582,6 +582,9 @@ static int usbhsg_ep_enable(struct usb_ep *ep, |
4808 |
+ struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv); |
4809 |
+ struct usbhs_pipe *pipe; |
4810 |
+ int ret = -EIO; |
4811 |
++ unsigned long flags; |
4812 |
++ |
4813 |
++ usbhs_lock(priv, flags); |
4814 |
+ |
4815 |
+ /* |
4816 |
+ * if it already have pipe, |
4817 |
+@@ -590,7 +593,8 @@ static int usbhsg_ep_enable(struct usb_ep *ep, |
4818 |
+ if (uep->pipe) { |
4819 |
+ usbhs_pipe_clear(uep->pipe); |
4820 |
+ usbhs_pipe_sequence_data0(uep->pipe); |
4821 |
+- return 0; |
4822 |
++ ret = 0; |
4823 |
++ goto usbhsg_ep_enable_end; |
4824 |
+ } |
4825 |
+ |
4826 |
+ pipe = usbhs_pipe_malloc(priv, |
4827 |
+@@ -618,6 +622,9 @@ static int usbhsg_ep_enable(struct usb_ep *ep, |
4828 |
+ ret = 0; |
4829 |
+ } |
4830 |
+ |
4831 |
++usbhsg_ep_enable_end: |
4832 |
++ usbhs_unlock(priv, flags); |
4833 |
++ |
4834 |
+ return ret; |
4835 |
+ } |
4836 |
+ |
4837 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
4838 |
+index f00919d579e0..2a7bf26c68e6 100644 |
4839 |
+--- a/drivers/usb/serial/option.c |
4840 |
++++ b/drivers/usb/serial/option.c |
4841 |
+@@ -276,6 +276,7 @@ static void option_instat_callback(struct urb *urb); |
4842 |
+ #define TELIT_PRODUCT_LE922_USBCFG5 0x1045 |
4843 |
+ #define TELIT_PRODUCT_LE920 0x1200 |
4844 |
+ #define TELIT_PRODUCT_LE910 0x1201 |
4845 |
++#define TELIT_PRODUCT_LE910_USBCFG4 0x1206 |
4846 |
+ |
4847 |
+ /* ZTE PRODUCTS */ |
4848 |
+ #define ZTE_VENDOR_ID 0x19d2 |
4849 |
+@@ -1210,6 +1211,8 @@ static const struct usb_device_id option_ids[] = { |
4850 |
+ .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 }, |
4851 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), |
4852 |
+ .driver_info = (kernel_ulong_t)&telit_le910_blacklist }, |
4853 |
++ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), |
4854 |
++ .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, |
4855 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), |
4856 |
+ .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, |
4857 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ |
4858 |
+diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c |
4859 |
+index 89bac470f04e..56f7e2521202 100644 |
4860 |
+--- a/drivers/virtio/virtio_balloon.c |
4861 |
++++ b/drivers/virtio/virtio_balloon.c |
4862 |
+@@ -73,7 +73,7 @@ struct virtio_balloon { |
4863 |
+ |
4864 |
+ /* The array of pfns we tell the Host about. */ |
4865 |
+ unsigned int num_pfns; |
4866 |
+- u32 pfns[VIRTIO_BALLOON_ARRAY_PFNS_MAX]; |
4867 |
++ __virtio32 pfns[VIRTIO_BALLOON_ARRAY_PFNS_MAX]; |
4868 |
+ |
4869 |
+ /* Memory statistics */ |
4870 |
+ int need_stats_update; |
4871 |
+@@ -125,14 +125,16 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) |
4872 |
+ wait_event(vb->acked, virtqueue_get_buf(vq, &len)); |
4873 |
+ } |
4874 |
+ |
4875 |
+-static void set_page_pfns(u32 pfns[], struct page *page) |
4876 |
++static void set_page_pfns(struct virtio_balloon *vb, |
4877 |
++ __virtio32 pfns[], struct page *page) |
4878 |
+ { |
4879 |
+ unsigned int i; |
4880 |
+ |
4881 |
+ /* Set balloon pfns pointing at this page. |
4882 |
+ * Note that the first pfn points at start of the page. */ |
4883 |
+ for (i = 0; i < VIRTIO_BALLOON_PAGES_PER_PAGE; i++) |
4884 |
+- pfns[i] = page_to_balloon_pfn(page) + i; |
4885 |
++ pfns[i] = cpu_to_virtio32(vb->vdev, |
4886 |
++ page_to_balloon_pfn(page) + i); |
4887 |
+ } |
4888 |
+ |
4889 |
+ static void fill_balloon(struct virtio_balloon *vb, size_t num) |
4890 |
+@@ -155,9 +157,11 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num) |
4891 |
+ msleep(200); |
4892 |
+ break; |
4893 |
+ } |
4894 |
+- set_page_pfns(vb->pfns + vb->num_pfns, page); |
4895 |
++ set_page_pfns(vb, vb->pfns + vb->num_pfns, page); |
4896 |
+ vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE; |
4897 |
+- adjust_managed_page_count(page, -1); |
4898 |
++ if (!virtio_has_feature(vb->vdev, |
4899 |
++ VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) |
4900 |
++ adjust_managed_page_count(page, -1); |
4901 |
+ } |
4902 |
+ |
4903 |
+ /* Did we get any? */ |
4904 |
+@@ -169,11 +173,15 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num) |
4905 |
+ static void release_pages_balloon(struct virtio_balloon *vb) |
4906 |
+ { |
4907 |
+ unsigned int i; |
4908 |
++ struct page *page; |
4909 |
+ |
4910 |
+ /* Find pfns pointing at start of each page, get pages and free them. */ |
4911 |
+ for (i = 0; i < vb->num_pfns; i += VIRTIO_BALLOON_PAGES_PER_PAGE) { |
4912 |
+- struct page *page = balloon_pfn_to_page(vb->pfns[i]); |
4913 |
+- adjust_managed_page_count(page, 1); |
4914 |
++ page = balloon_pfn_to_page(virtio32_to_cpu(vb->vdev, |
4915 |
++ vb->pfns[i])); |
4916 |
++ if (!virtio_has_feature(vb->vdev, |
4917 |
++ VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) |
4918 |
++ adjust_managed_page_count(page, 1); |
4919 |
+ put_page(page); /* balloon reference */ |
4920 |
+ } |
4921 |
+ } |
4922 |
+@@ -188,12 +196,14 @@ static unsigned leak_balloon(struct virtio_balloon *vb, size_t num) |
4923 |
+ num = min(num, ARRAY_SIZE(vb->pfns)); |
4924 |
+ |
4925 |
+ mutex_lock(&vb->balloon_lock); |
4926 |
++ /* We can't release more pages than taken */ |
4927 |
++ num = min(num, (size_t)vb->num_pages); |
4928 |
+ for (vb->num_pfns = 0; vb->num_pfns < num; |
4929 |
+ vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) { |
4930 |
+ page = balloon_page_dequeue(vb_dev_info); |
4931 |
+ if (!page) |
4932 |
+ break; |
4933 |
+- set_page_pfns(vb->pfns + vb->num_pfns, page); |
4934 |
++ set_page_pfns(vb, vb->pfns + vb->num_pfns, page); |
4935 |
+ vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE; |
4936 |
+ } |
4937 |
+ |
4938 |
+@@ -461,13 +471,13 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info, |
4939 |
+ __count_vm_event(BALLOON_MIGRATE); |
4940 |
+ spin_unlock_irqrestore(&vb_dev_info->pages_lock, flags); |
4941 |
+ vb->num_pfns = VIRTIO_BALLOON_PAGES_PER_PAGE; |
4942 |
+- set_page_pfns(vb->pfns, newpage); |
4943 |
++ set_page_pfns(vb, vb->pfns, newpage); |
4944 |
+ tell_host(vb, vb->inflate_vq); |
4945 |
+ |
4946 |
+ /* balloon's page migration 2nd step -- deflate "page" */ |
4947 |
+ balloon_page_delete(page); |
4948 |
+ vb->num_pfns = VIRTIO_BALLOON_PAGES_PER_PAGE; |
4949 |
+- set_page_pfns(vb->pfns, page); |
4950 |
++ set_page_pfns(vb, vb->pfns, page); |
4951 |
+ tell_host(vb, vb->deflate_vq); |
4952 |
+ |
4953 |
+ mutex_unlock(&vb->balloon_lock); |
4954 |
+diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h |
4955 |
+index 3182273a3407..1418daa03d95 100644 |
4956 |
+--- a/fs/cifs/cifs_fs_sb.h |
4957 |
++++ b/fs/cifs/cifs_fs_sb.h |
4958 |
+@@ -46,6 +46,9 @@ |
4959 |
+ #define CIFS_MOUNT_CIFS_BACKUPUID 0x200000 /* backup intent bit for a user */ |
4960 |
+ #define CIFS_MOUNT_CIFS_BACKUPGID 0x400000 /* backup intent bit for a group */ |
4961 |
+ #define CIFS_MOUNT_MAP_SFM_CHR 0x800000 /* SFM/MAC mapping for illegal chars */ |
4962 |
++#define CIFS_MOUNT_USE_PREFIX_PATH 0x1000000 /* make subpath with unaccessible |
4963 |
++ * root mountable |
4964 |
++ */ |
4965 |
+ |
4966 |
+ struct cifs_sb_info { |
4967 |
+ struct rb_root tlink_tree; |
4968 |
+@@ -67,5 +70,6 @@ struct cifs_sb_info { |
4969 |
+ struct backing_dev_info bdi; |
4970 |
+ struct delayed_work prune_tlinks; |
4971 |
+ struct rcu_head rcu; |
4972 |
++ char *prepath; |
4973 |
+ }; |
4974 |
+ #endif /* _CIFS_FS_SB_H */ |
4975 |
+diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c |
4976 |
+index e682b36a210f..4acbc390a7d6 100644 |
4977 |
+--- a/fs/cifs/cifsencrypt.c |
4978 |
++++ b/fs/cifs/cifsencrypt.c |
4979 |
+@@ -731,24 +731,26 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) |
4980 |
+ |
4981 |
+ memcpy(ses->auth_key.response + baselen, tiblob, tilen); |
4982 |
+ |
4983 |
++ mutex_lock(&ses->server->srv_mutex); |
4984 |
++ |
4985 |
+ rc = crypto_hmacmd5_alloc(ses->server); |
4986 |
+ if (rc) { |
4987 |
+ cifs_dbg(VFS, "could not crypto alloc hmacmd5 rc %d\n", rc); |
4988 |
+- goto setup_ntlmv2_rsp_ret; |
4989 |
++ goto unlock; |
4990 |
+ } |
4991 |
+ |
4992 |
+ /* calculate ntlmv2_hash */ |
4993 |
+ rc = calc_ntlmv2_hash(ses, ntlmv2_hash, nls_cp); |
4994 |
+ if (rc) { |
4995 |
+ cifs_dbg(VFS, "could not get v2 hash rc %d\n", rc); |
4996 |
+- goto setup_ntlmv2_rsp_ret; |
4997 |
++ goto unlock; |
4998 |
+ } |
4999 |
+ |
5000 |
+ /* calculate first part of the client response (CR1) */ |
5001 |
+ rc = CalcNTLMv2_response(ses, ntlmv2_hash); |
5002 |
+ if (rc) { |
5003 |
+ cifs_dbg(VFS, "Could not calculate CR1 rc: %d\n", rc); |
5004 |
+- goto setup_ntlmv2_rsp_ret; |
5005 |
++ goto unlock; |
5006 |
+ } |
5007 |
+ |
5008 |
+ /* now calculate the session key for NTLMv2 */ |
5009 |
+@@ -757,13 +759,13 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) |
5010 |
+ if (rc) { |
5011 |
+ cifs_dbg(VFS, "%s: Could not set NTLMV2 Hash as a key\n", |
5012 |
+ __func__); |
5013 |
+- goto setup_ntlmv2_rsp_ret; |
5014 |
++ goto unlock; |
5015 |
+ } |
5016 |
+ |
5017 |
+ rc = crypto_shash_init(&ses->server->secmech.sdeschmacmd5->shash); |
5018 |
+ if (rc) { |
5019 |
+ cifs_dbg(VFS, "%s: Could not init hmacmd5\n", __func__); |
5020 |
+- goto setup_ntlmv2_rsp_ret; |
5021 |
++ goto unlock; |
5022 |
+ } |
5023 |
+ |
5024 |
+ rc = crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, |
5025 |
+@@ -771,7 +773,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) |
5026 |
+ CIFS_HMAC_MD5_HASH_SIZE); |
5027 |
+ if (rc) { |
5028 |
+ cifs_dbg(VFS, "%s: Could not update with response\n", __func__); |
5029 |
+- goto setup_ntlmv2_rsp_ret; |
5030 |
++ goto unlock; |
5031 |
+ } |
5032 |
+ |
5033 |
+ rc = crypto_shash_final(&ses->server->secmech.sdeschmacmd5->shash, |
5034 |
+@@ -779,6 +781,8 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) |
5035 |
+ if (rc) |
5036 |
+ cifs_dbg(VFS, "%s: Could not generate md5 hash\n", __func__); |
5037 |
+ |
5038 |
++unlock: |
5039 |
++ mutex_unlock(&ses->server->srv_mutex); |
5040 |
+ setup_ntlmv2_rsp_ret: |
5041 |
+ kfree(tiblob); |
5042 |
+ |
5043 |
+diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c |
5044 |
+index fe24e22fc154..9f205a6159d3 100644 |
5045 |
+--- a/fs/cifs/cifsfs.c |
5046 |
++++ b/fs/cifs/cifsfs.c |
5047 |
+@@ -679,6 +679,14 @@ cifs_do_mount(struct file_system_type *fs_type, |
5048 |
+ goto out_cifs_sb; |
5049 |
+ } |
5050 |
+ |
5051 |
++ if (volume_info->prepath) { |
5052 |
++ cifs_sb->prepath = kstrdup(volume_info->prepath, GFP_KERNEL); |
5053 |
++ if (cifs_sb->prepath == NULL) { |
5054 |
++ root = ERR_PTR(-ENOMEM); |
5055 |
++ goto out_cifs_sb; |
5056 |
++ } |
5057 |
++ } |
5058 |
++ |
5059 |
+ cifs_setup_cifs_sb(volume_info, cifs_sb); |
5060 |
+ |
5061 |
+ rc = cifs_mount(cifs_sb, volume_info); |
5062 |
+@@ -717,7 +725,11 @@ cifs_do_mount(struct file_system_type *fs_type, |
5063 |
+ sb->s_flags |= MS_ACTIVE; |
5064 |
+ } |
5065 |
+ |
5066 |
+- root = cifs_get_root(volume_info, sb); |
5067 |
++ if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) |
5068 |
++ root = dget(sb->s_root); |
5069 |
++ else |
5070 |
++ root = cifs_get_root(volume_info, sb); |
5071 |
++ |
5072 |
+ if (IS_ERR(root)) |
5073 |
+ goto out_super; |
5074 |
+ |
5075 |
+diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c |
5076 |
+index 17998d19b166..cd9d50e4f5f4 100644 |
5077 |
+--- a/fs/cifs/connect.c |
5078 |
++++ b/fs/cifs/connect.c |
5079 |
+@@ -3436,6 +3436,44 @@ cifs_get_volume_info(char *mount_data, const char *devname) |
5080 |
+ return volume_info; |
5081 |
+ } |
5082 |
+ |
5083 |
++static int |
5084 |
++cifs_are_all_path_components_accessible(struct TCP_Server_Info *server, |
5085 |
++ unsigned int xid, |
5086 |
++ struct cifs_tcon *tcon, |
5087 |
++ struct cifs_sb_info *cifs_sb, |
5088 |
++ char *full_path) |
5089 |
++{ |
5090 |
++ int rc; |
5091 |
++ char *s; |
5092 |
++ char sep, tmp; |
5093 |
++ |
5094 |
++ sep = CIFS_DIR_SEP(cifs_sb); |
5095 |
++ s = full_path; |
5096 |
++ |
5097 |
++ rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, ""); |
5098 |
++ while (rc == 0) { |
5099 |
++ /* skip separators */ |
5100 |
++ while (*s == sep) |
5101 |
++ s++; |
5102 |
++ if (!*s) |
5103 |
++ break; |
5104 |
++ /* next separator */ |
5105 |
++ while (*s && *s != sep) |
5106 |
++ s++; |
5107 |
++ |
5108 |
++ /* |
5109 |
++ * temporarily null-terminate the path at the end of |
5110 |
++ * the current component |
5111 |
++ */ |
5112 |
++ tmp = *s; |
5113 |
++ *s = 0; |
5114 |
++ rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, |
5115 |
++ full_path); |
5116 |
++ *s = tmp; |
5117 |
++ } |
5118 |
++ return rc; |
5119 |
++} |
5120 |
++ |
5121 |
+ int |
5122 |
+ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) |
5123 |
+ { |
5124 |
+@@ -3562,6 +3600,16 @@ remote_path_check: |
5125 |
+ kfree(full_path); |
5126 |
+ goto mount_fail_check; |
5127 |
+ } |
5128 |
++ |
5129 |
++ rc = cifs_are_all_path_components_accessible(server, |
5130 |
++ xid, tcon, cifs_sb, |
5131 |
++ full_path); |
5132 |
++ if (rc != 0) { |
5133 |
++ cifs_dbg(VFS, "cannot query dirs between root and final path, " |
5134 |
++ "enabling CIFS_MOUNT_USE_PREFIX_PATH\n"); |
5135 |
++ cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH; |
5136 |
++ rc = 0; |
5137 |
++ } |
5138 |
+ kfree(full_path); |
5139 |
+ } |
5140 |
+ |
5141 |
+@@ -3831,6 +3879,7 @@ cifs_umount(struct cifs_sb_info *cifs_sb) |
5142 |
+ |
5143 |
+ bdi_destroy(&cifs_sb->bdi); |
5144 |
+ kfree(cifs_sb->mountdata); |
5145 |
++ kfree(cifs_sb->prepath); |
5146 |
+ call_rcu(&cifs_sb->rcu, delayed_free); |
5147 |
+ } |
5148 |
+ |
5149 |
+diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c |
5150 |
+index c3eb998a99bd..26a3b389a265 100644 |
5151 |
+--- a/fs/cifs/dir.c |
5152 |
++++ b/fs/cifs/dir.c |
5153 |
+@@ -84,6 +84,7 @@ build_path_from_dentry(struct dentry *direntry) |
5154 |
+ struct dentry *temp; |
5155 |
+ int namelen; |
5156 |
+ int dfsplen; |
5157 |
++ int pplen = 0; |
5158 |
+ char *full_path; |
5159 |
+ char dirsep; |
5160 |
+ struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb); |
5161 |
+@@ -95,8 +96,12 @@ build_path_from_dentry(struct dentry *direntry) |
5162 |
+ dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1); |
5163 |
+ else |
5164 |
+ dfsplen = 0; |
5165 |
++ |
5166 |
++ if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) |
5167 |
++ pplen = cifs_sb->prepath ? strlen(cifs_sb->prepath) + 1 : 0; |
5168 |
++ |
5169 |
+ cifs_bp_rename_retry: |
5170 |
+- namelen = dfsplen; |
5171 |
++ namelen = dfsplen + pplen; |
5172 |
+ seq = read_seqbegin(&rename_lock); |
5173 |
+ rcu_read_lock(); |
5174 |
+ for (temp = direntry; !IS_ROOT(temp);) { |
5175 |
+@@ -137,7 +142,7 @@ cifs_bp_rename_retry: |
5176 |
+ } |
5177 |
+ } |
5178 |
+ rcu_read_unlock(); |
5179 |
+- if (namelen != dfsplen || read_seqretry(&rename_lock, seq)) { |
5180 |
++ if (namelen != dfsplen + pplen || read_seqretry(&rename_lock, seq)) { |
5181 |
+ cifs_dbg(FYI, "did not end path lookup where expected. namelen=%ddfsplen=%d\n", |
5182 |
+ namelen, dfsplen); |
5183 |
+ /* presumably this is only possible if racing with a rename |
5184 |
+@@ -153,6 +158,17 @@ cifs_bp_rename_retry: |
5185 |
+ those safely to '/' if any are found in the middle of the prepath */ |
5186 |
+ /* BB test paths to Windows with '/' in the midst of prepath */ |
5187 |
+ |
5188 |
++ if (pplen) { |
5189 |
++ int i; |
5190 |
++ |
5191 |
++ cifs_dbg(FYI, "using cifs_sb prepath <%s>\n", cifs_sb->prepath); |
5192 |
++ memcpy(full_path+dfsplen+1, cifs_sb->prepath, pplen-1); |
5193 |
++ full_path[dfsplen] = '\\'; |
5194 |
++ for (i = 0; i < pplen-1; i++) |
5195 |
++ if (full_path[dfsplen+1+i] == '/') |
5196 |
++ full_path[dfsplen+1+i] = CIFS_DIR_SEP(cifs_sb); |
5197 |
++ } |
5198 |
++ |
5199 |
+ if (dfsplen) { |
5200 |
+ strncpy(full_path, tcon->treeName, dfsplen); |
5201 |
+ if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) { |
5202 |
+@@ -229,6 +245,13 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, |
5203 |
+ goto cifs_create_get_file_info; |
5204 |
+ } |
5205 |
+ |
5206 |
++ if (S_ISDIR(newinode->i_mode)) { |
5207 |
++ CIFSSMBClose(xid, tcon, fid->netfid); |
5208 |
++ iput(newinode); |
5209 |
++ rc = -EISDIR; |
5210 |
++ goto out; |
5211 |
++ } |
5212 |
++ |
5213 |
+ if (!S_ISREG(newinode->i_mode)) { |
5214 |
+ /* |
5215 |
+ * The server may allow us to open things like |
5216 |
+@@ -399,10 +422,14 @@ cifs_create_set_dentry: |
5217 |
+ if (rc != 0) { |
5218 |
+ cifs_dbg(FYI, "Create worked, get_inode_info failed rc = %d\n", |
5219 |
+ rc); |
5220 |
+- if (server->ops->close) |
5221 |
+- server->ops->close(xid, tcon, fid); |
5222 |
+- goto out; |
5223 |
++ goto out_err; |
5224 |
+ } |
5225 |
++ |
5226 |
++ if (S_ISDIR(newinode->i_mode)) { |
5227 |
++ rc = -EISDIR; |
5228 |
++ goto out_err; |
5229 |
++ } |
5230 |
++ |
5231 |
+ d_drop(direntry); |
5232 |
+ d_add(direntry, newinode); |
5233 |
+ |
5234 |
+@@ -410,6 +437,13 @@ out: |
5235 |
+ kfree(buf); |
5236 |
+ kfree(full_path); |
5237 |
+ return rc; |
5238 |
++ |
5239 |
++out_err: |
5240 |
++ if (server->ops->close) |
5241 |
++ server->ops->close(xid, tcon, fid); |
5242 |
++ if (newinode) |
5243 |
++ iput(newinode); |
5244 |
++ goto out; |
5245 |
+ } |
5246 |
+ |
5247 |
+ int |
5248 |
+diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c |
5249 |
+index 6b66dd5d1540..9fb3bc26a2ab 100644 |
5250 |
+--- a/fs/cifs/inode.c |
5251 |
++++ b/fs/cifs/inode.c |
5252 |
+@@ -982,10 +982,26 @@ struct inode *cifs_root_iget(struct super_block *sb) |
5253 |
+ struct inode *inode = NULL; |
5254 |
+ long rc; |
5255 |
+ struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); |
5256 |
++ char *path = NULL; |
5257 |
++ int len; |
5258 |
++ |
5259 |
++ if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) |
5260 |
++ && cifs_sb->prepath) { |
5261 |
++ len = strlen(cifs_sb->prepath); |
5262 |
++ path = kzalloc(len + 2 /* leading sep + null */, GFP_KERNEL); |
5263 |
++ if (path == NULL) |
5264 |
++ return ERR_PTR(-ENOMEM); |
5265 |
++ path[0] = '/'; |
5266 |
++ memcpy(path+1, cifs_sb->prepath, len); |
5267 |
++ } else { |
5268 |
++ path = kstrdup("", GFP_KERNEL); |
5269 |
++ if (path == NULL) |
5270 |
++ return ERR_PTR(-ENOMEM); |
5271 |
++ } |
5272 |
+ |
5273 |
+ xid = get_xid(); |
5274 |
+ if (tcon->unix_ext) { |
5275 |
+- rc = cifs_get_inode_info_unix(&inode, "", sb, xid); |
5276 |
++ rc = cifs_get_inode_info_unix(&inode, path, sb, xid); |
5277 |
+ /* some servers mistakenly claim POSIX support */ |
5278 |
+ if (rc != -EOPNOTSUPP) |
5279 |
+ goto iget_no_retry; |
5280 |
+@@ -993,7 +1009,8 @@ struct inode *cifs_root_iget(struct super_block *sb) |
5281 |
+ tcon->unix_ext = false; |
5282 |
+ } |
5283 |
+ |
5284 |
+- rc = cifs_get_inode_info(&inode, "", NULL, sb, xid, NULL); |
5285 |
++ convert_delimiter(path, CIFS_DIR_SEP(cifs_sb)); |
5286 |
++ rc = cifs_get_inode_info(&inode, path, NULL, sb, xid, NULL); |
5287 |
+ |
5288 |
+ iget_no_retry: |
5289 |
+ if (!inode) { |
5290 |
+@@ -1022,6 +1039,7 @@ iget_no_retry: |
5291 |
+ } |
5292 |
+ |
5293 |
+ out: |
5294 |
++ kfree(path); |
5295 |
+ /* can not call macro free_xid here since in a void func |
5296 |
+ * TODO: This is no longer true |
5297 |
+ */ |
5298 |
+diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c |
5299 |
+index 1678b9cb94c7..57aeae6116d6 100644 |
5300 |
+--- a/fs/cifs/smb2ops.c |
5301 |
++++ b/fs/cifs/smb2ops.c |
5302 |
+@@ -973,6 +973,9 @@ smb2_new_lease_key(struct cifs_fid *fid) |
5303 |
+ get_random_bytes(fid->lease_key, SMB2_LEASE_KEY_SIZE); |
5304 |
+ } |
5305 |
+ |
5306 |
++#define SMB2_SYMLINK_STRUCT_SIZE \ |
5307 |
++ (sizeof(struct smb2_err_rsp) - 1 + sizeof(struct smb2_symlink_err_rsp)) |
5308 |
++ |
5309 |
+ static int |
5310 |
+ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, |
5311 |
+ const char *full_path, char **target_path, |
5312 |
+@@ -985,7 +988,10 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, |
5313 |
+ struct cifs_fid fid; |
5314 |
+ struct smb2_err_rsp *err_buf = NULL; |
5315 |
+ struct smb2_symlink_err_rsp *symlink; |
5316 |
+- unsigned int sub_len, sub_offset; |
5317 |
++ unsigned int sub_len; |
5318 |
++ unsigned int sub_offset; |
5319 |
++ unsigned int print_len; |
5320 |
++ unsigned int print_offset; |
5321 |
+ |
5322 |
+ cifs_dbg(FYI, "%s: path: %s\n", __func__, full_path); |
5323 |
+ |
5324 |
+@@ -1006,11 +1012,33 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, |
5325 |
+ kfree(utf16_path); |
5326 |
+ return -ENOENT; |
5327 |
+ } |
5328 |
++ |
5329 |
++ if (le32_to_cpu(err_buf->ByteCount) < sizeof(struct smb2_symlink_err_rsp) || |
5330 |
++ get_rfc1002_length(err_buf) + 4 < SMB2_SYMLINK_STRUCT_SIZE) { |
5331 |
++ kfree(utf16_path); |
5332 |
++ return -ENOENT; |
5333 |
++ } |
5334 |
++ |
5335 |
+ /* open must fail on symlink - reset rc */ |
5336 |
+ rc = 0; |
5337 |
+ symlink = (struct smb2_symlink_err_rsp *)err_buf->ErrorData; |
5338 |
+ sub_len = le16_to_cpu(symlink->SubstituteNameLength); |
5339 |
+ sub_offset = le16_to_cpu(symlink->SubstituteNameOffset); |
5340 |
++ print_len = le16_to_cpu(symlink->PrintNameLength); |
5341 |
++ print_offset = le16_to_cpu(symlink->PrintNameOffset); |
5342 |
++ |
5343 |
++ if (get_rfc1002_length(err_buf) + 4 < |
5344 |
++ SMB2_SYMLINK_STRUCT_SIZE + sub_offset + sub_len) { |
5345 |
++ kfree(utf16_path); |
5346 |
++ return -ENOENT; |
5347 |
++ } |
5348 |
++ |
5349 |
++ if (get_rfc1002_length(err_buf) + 4 < |
5350 |
++ SMB2_SYMLINK_STRUCT_SIZE + print_offset + print_len) { |
5351 |
++ kfree(utf16_path); |
5352 |
++ return -ENOENT; |
5353 |
++ } |
5354 |
++ |
5355 |
+ *target_path = cifs_strndup_from_utf16( |
5356 |
+ (char *)symlink->PathBuffer + sub_offset, |
5357 |
+ sub_len, true, cifs_sb->local_nls); |
5358 |
+diff --git a/fs/dcache.c b/fs/dcache.c |
5359 |
+index 2c75b393d31a..660857431b1c 100644 |
5360 |
+--- a/fs/dcache.c |
5361 |
++++ b/fs/dcache.c |
5362 |
+@@ -578,7 +578,6 @@ static struct dentry *dentry_kill(struct dentry *dentry) |
5363 |
+ |
5364 |
+ failed: |
5365 |
+ spin_unlock(&dentry->d_lock); |
5366 |
+- cpu_relax(); |
5367 |
+ return dentry; /* try again with same dentry */ |
5368 |
+ } |
5369 |
+ |
5370 |
+@@ -752,6 +751,8 @@ void dput(struct dentry *dentry) |
5371 |
+ return; |
5372 |
+ |
5373 |
+ repeat: |
5374 |
++ might_sleep(); |
5375 |
++ |
5376 |
+ rcu_read_lock(); |
5377 |
+ if (likely(fast_dput(dentry))) { |
5378 |
+ rcu_read_unlock(); |
5379 |
+@@ -783,8 +784,10 @@ repeat: |
5380 |
+ |
5381 |
+ kill_it: |
5382 |
+ dentry = dentry_kill(dentry); |
5383 |
+- if (dentry) |
5384 |
++ if (dentry) { |
5385 |
++ cond_resched(); |
5386 |
+ goto repeat; |
5387 |
++ } |
5388 |
+ } |
5389 |
+ EXPORT_SYMBOL(dput); |
5390 |
+ |
5391 |
+diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c |
5392 |
+index 955bf49a7945..41117e51a2e9 100644 |
5393 |
+--- a/fs/ext4/balloc.c |
5394 |
++++ b/fs/ext4/balloc.c |
5395 |
+@@ -208,6 +208,9 @@ static int ext4_init_block_bitmap(struct super_block *sb, |
5396 |
+ memset(bh->b_data, 0, sb->s_blocksize); |
5397 |
+ |
5398 |
+ bit_max = ext4_num_base_meta_clusters(sb, block_group); |
5399 |
++ if ((bit_max >> 3) >= bh->b_size) |
5400 |
++ return -EIO; |
5401 |
++ |
5402 |
+ for (bit = 0; bit < bit_max; bit++) |
5403 |
+ ext4_set_bit(bit, bh->b_data); |
5404 |
+ |
5405 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
5406 |
+index ea12f565be24..a3276bf9ac00 100644 |
5407 |
+--- a/fs/ext4/extents.c |
5408 |
++++ b/fs/ext4/extents.c |
5409 |
+@@ -375,9 +375,13 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext) |
5410 |
+ ext4_fsblk_t block = ext4_ext_pblock(ext); |
5411 |
+ int len = ext4_ext_get_actual_len(ext); |
5412 |
+ ext4_lblk_t lblock = le32_to_cpu(ext->ee_block); |
5413 |
+- ext4_lblk_t last = lblock + len - 1; |
5414 |
+ |
5415 |
+- if (len == 0 || lblock > last) |
5416 |
++ /* |
5417 |
++ * We allow neither: |
5418 |
++ * - zero length |
5419 |
++ * - overflow/wrap-around |
5420 |
++ */ |
5421 |
++ if (lblock + len <= lblock) |
5422 |
+ return 0; |
5423 |
+ return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len); |
5424 |
+ } |
5425 |
+@@ -468,6 +472,10 @@ static int __ext4_ext_check(const char *function, unsigned int line, |
5426 |
+ error_msg = "invalid extent entries"; |
5427 |
+ goto corrupted; |
5428 |
+ } |
5429 |
++ if (unlikely(depth > 32)) { |
5430 |
++ error_msg = "too large eh_depth"; |
5431 |
++ goto corrupted; |
5432 |
++ } |
5433 |
+ /* Verify checksum on non-root extent tree nodes */ |
5434 |
+ if (ext_depth(inode) != depth && |
5435 |
+ !ext4_extent_block_csum_verify(inode, eh)) { |
5436 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
5437 |
+index ba12e2953aec..9b55c6f71bf2 100644 |
5438 |
+--- a/fs/ext4/inode.c |
5439 |
++++ b/fs/ext4/inode.c |
5440 |
+@@ -204,9 +204,9 @@ void ext4_evict_inode(struct inode *inode) |
5441 |
+ * Note that directories do not have this problem because they |
5442 |
+ * don't use page cache. |
5443 |
+ */ |
5444 |
+- if (ext4_should_journal_data(inode) && |
5445 |
+- (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) && |
5446 |
+- inode->i_ino != EXT4_JOURNAL_INO) { |
5447 |
++ if (inode->i_ino != EXT4_JOURNAL_INO && |
5448 |
++ ext4_should_journal_data(inode) && |
5449 |
++ (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) { |
5450 |
+ journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; |
5451 |
+ tid_t commit_tid = EXT4_I(inode)->i_datasync_tid; |
5452 |
+ |
5453 |
+@@ -2557,13 +2557,36 @@ retry: |
5454 |
+ done = true; |
5455 |
+ } |
5456 |
+ } |
5457 |
+- ext4_journal_stop(handle); |
5458 |
++ /* |
5459 |
++ * Caution: If the handle is synchronous, |
5460 |
++ * ext4_journal_stop() can wait for transaction commit |
5461 |
++ * to finish which may depend on writeback of pages to |
5462 |
++ * complete or on page lock to be released. In that |
5463 |
++ * case, we have to wait until after after we have |
5464 |
++ * submitted all the IO, released page locks we hold, |
5465 |
++ * and dropped io_end reference (for extent conversion |
5466 |
++ * to be able to complete) before stopping the handle. |
5467 |
++ */ |
5468 |
++ if (!ext4_handle_valid(handle) || handle->h_sync == 0) { |
5469 |
++ ext4_journal_stop(handle); |
5470 |
++ handle = NULL; |
5471 |
++ } |
5472 |
+ /* Submit prepared bio */ |
5473 |
+ ext4_io_submit(&mpd.io_submit); |
5474 |
+ /* Unlock pages we didn't use */ |
5475 |
+ mpage_release_unused_pages(&mpd, give_up_on_write); |
5476 |
+- /* Drop our io_end reference we got from init */ |
5477 |
+- ext4_put_io_end(mpd.io_submit.io_end); |
5478 |
++ /* |
5479 |
++ * Drop our io_end reference we got from init. We have |
5480 |
++ * to be careful and use deferred io_end finishing if |
5481 |
++ * we are still holding the transaction as we can |
5482 |
++ * release the last reference to io_end which may end |
5483 |
++ * up doing unwritten extent conversion. |
5484 |
++ */ |
5485 |
++ if (handle) { |
5486 |
++ ext4_put_io_end_defer(mpd.io_submit.io_end); |
5487 |
++ ext4_journal_stop(handle); |
5488 |
++ } else |
5489 |
++ ext4_put_io_end(mpd.io_submit.io_end); |
5490 |
+ |
5491 |
+ if (ret == -ENOSPC && sbi->s_journal) { |
5492 |
+ /* |
5493 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
5494 |
+index aedff7963468..f01dd19adb7b 100644 |
5495 |
+--- a/fs/ext4/super.c |
5496 |
++++ b/fs/ext4/super.c |
5497 |
+@@ -2229,6 +2229,16 @@ static void ext4_orphan_cleanup(struct super_block *sb, |
5498 |
+ while (es->s_last_orphan) { |
5499 |
+ struct inode *inode; |
5500 |
+ |
5501 |
++ /* |
5502 |
++ * We may have encountered an error during cleanup; if |
5503 |
++ * so, skip the rest. |
5504 |
++ */ |
5505 |
++ if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) { |
5506 |
++ jbd_debug(1, "Skipping orphan recovery on fs with errors.\n"); |
5507 |
++ es->s_last_orphan = 0; |
5508 |
++ break; |
5509 |
++ } |
5510 |
++ |
5511 |
+ inode = ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan)); |
5512 |
+ if (IS_ERR(inode)) { |
5513 |
+ es->s_last_orphan = 0; |
5514 |
+@@ -3711,6 +3721,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) |
5515 |
+ goto failed_mount; |
5516 |
+ } |
5517 |
+ |
5518 |
++ if (le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) > (blocksize / 4)) { |
5519 |
++ ext4_msg(sb, KERN_ERR, |
5520 |
++ "Number of reserved GDT blocks insanely large: %d", |
5521 |
++ le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks)); |
5522 |
++ goto failed_mount; |
5523 |
++ } |
5524 |
++ |
5525 |
+ if (sbi->s_mount_opt & EXT4_MOUNT_DAX) { |
5526 |
+ if (blocksize != PAGE_SIZE) { |
5527 |
+ ext4_msg(sb, KERN_ERR, |
5528 |
+diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
5529 |
+index 3227091c2a64..5cae35490b37 100644 |
5530 |
+--- a/fs/fuse/file.c |
5531 |
++++ b/fs/fuse/file.c |
5532 |
+@@ -417,6 +417,15 @@ static int fuse_flush(struct file *file, fl_owner_t id) |
5533 |
+ fuse_sync_writes(inode); |
5534 |
+ mutex_unlock(&inode->i_mutex); |
5535 |
+ |
5536 |
++ if (test_bit(AS_ENOSPC, &file->f_mapping->flags) && |
5537 |
++ test_and_clear_bit(AS_ENOSPC, &file->f_mapping->flags)) |
5538 |
++ err = -ENOSPC; |
5539 |
++ if (test_bit(AS_EIO, &file->f_mapping->flags) && |
5540 |
++ test_and_clear_bit(AS_EIO, &file->f_mapping->flags)) |
5541 |
++ err = -EIO; |
5542 |
++ if (err) |
5543 |
++ return err; |
5544 |
++ |
5545 |
+ req = fuse_get_req_nofail_nopages(fc, file); |
5546 |
+ memset(&inarg, 0, sizeof(inarg)); |
5547 |
+ inarg.fh = ff->fh; |
5548 |
+@@ -462,6 +471,21 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end, |
5549 |
+ goto out; |
5550 |
+ |
5551 |
+ fuse_sync_writes(inode); |
5552 |
++ |
5553 |
++ /* |
5554 |
++ * Due to implementation of fuse writeback |
5555 |
++ * filemap_write_and_wait_range() does not catch errors. |
5556 |
++ * We have to do this directly after fuse_sync_writes() |
5557 |
++ */ |
5558 |
++ if (test_bit(AS_ENOSPC, &file->f_mapping->flags) && |
5559 |
++ test_and_clear_bit(AS_ENOSPC, &file->f_mapping->flags)) |
5560 |
++ err = -ENOSPC; |
5561 |
++ if (test_bit(AS_EIO, &file->f_mapping->flags) && |
5562 |
++ test_and_clear_bit(AS_EIO, &file->f_mapping->flags)) |
5563 |
++ err = -EIO; |
5564 |
++ if (err) |
5565 |
++ goto out; |
5566 |
++ |
5567 |
+ err = sync_inode_metadata(inode, 1); |
5568 |
+ if (err) |
5569 |
+ goto out; |
5570 |
+diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c |
5571 |
+index 708d697113fc..846bb19d605a 100644 |
5572 |
+--- a/fs/fuse/inode.c |
5573 |
++++ b/fs/fuse/inode.c |
5574 |
+@@ -910,7 +910,7 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req) |
5575 |
+ arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_ATOMIC_O_TRUNC | |
5576 |
+ FUSE_EXPORT_SUPPORT | FUSE_BIG_WRITES | FUSE_DONT_MASK | |
5577 |
+ FUSE_SPLICE_WRITE | FUSE_SPLICE_MOVE | FUSE_SPLICE_READ | |
5578 |
+- FUSE_FLOCK_LOCKS | FUSE_IOCTL_DIR | FUSE_AUTO_INVAL_DATA | |
5579 |
++ FUSE_FLOCK_LOCKS | FUSE_HAS_IOCTL_DIR | FUSE_AUTO_INVAL_DATA | |
5580 |
+ FUSE_DO_READDIRPLUS | FUSE_READDIRPLUS_AUTO | FUSE_ASYNC_DIO | |
5581 |
+ FUSE_WRITEBACK_CACHE | FUSE_NO_OPEN_SUPPORT; |
5582 |
+ req->in.h.opcode = FUSE_INIT; |
5583 |
+diff --git a/fs/nfs/write.c b/fs/nfs/write.c |
5584 |
+index f98cd9adbc0d..51af4fff890f 100644 |
5585 |
+--- a/fs/nfs/write.c |
5586 |
++++ b/fs/nfs/write.c |
5587 |
+@@ -1241,6 +1241,9 @@ int nfs_updatepage(struct file *file, struct page *page, |
5588 |
+ dprintk("NFS: nfs_updatepage(%pD2 %d@%lld)\n", |
5589 |
+ file, count, (long long)(page_file_offset(page) + offset)); |
5590 |
+ |
5591 |
++ if (!count) |
5592 |
++ goto out; |
5593 |
++ |
5594 |
+ if (nfs_can_extend_write(file, page, inode)) { |
5595 |
+ count = max(count + offset, nfs_page_length(page)); |
5596 |
+ offset = 0; |
5597 |
+@@ -1251,7 +1254,7 @@ int nfs_updatepage(struct file *file, struct page *page, |
5598 |
+ nfs_set_pageerror(page); |
5599 |
+ else |
5600 |
+ __set_page_dirty_nobuffers(page); |
5601 |
+- |
5602 |
++out: |
5603 |
+ dprintk("NFS: nfs_updatepage returns %d (isize %lld)\n", |
5604 |
+ status, (long long)i_size_read(inode)); |
5605 |
+ return status; |
5606 |
+diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c |
5607 |
+index d54701f6dc78..076a9c096a6c 100644 |
5608 |
+--- a/fs/nfsd/nfs2acl.c |
5609 |
++++ b/fs/nfsd/nfs2acl.c |
5610 |
+@@ -104,22 +104,21 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp, |
5611 |
+ goto out; |
5612 |
+ |
5613 |
+ inode = d_inode(fh->fh_dentry); |
5614 |
+- if (!IS_POSIXACL(inode) || !inode->i_op->set_acl) { |
5615 |
+- error = -EOPNOTSUPP; |
5616 |
+- goto out_errno; |
5617 |
+- } |
5618 |
+ |
5619 |
+ error = fh_want_write(fh); |
5620 |
+ if (error) |
5621 |
+ goto out_errno; |
5622 |
+ |
5623 |
+- error = inode->i_op->set_acl(inode, argp->acl_access, ACL_TYPE_ACCESS); |
5624 |
++ fh_lock(fh); |
5625 |
++ |
5626 |
++ error = set_posix_acl(inode, ACL_TYPE_ACCESS, argp->acl_access); |
5627 |
+ if (error) |
5628 |
+- goto out_drop_write; |
5629 |
+- error = inode->i_op->set_acl(inode, argp->acl_default, |
5630 |
+- ACL_TYPE_DEFAULT); |
5631 |
++ goto out_drop_lock; |
5632 |
++ error = set_posix_acl(inode, ACL_TYPE_DEFAULT, argp->acl_default); |
5633 |
+ if (error) |
5634 |
+- goto out_drop_write; |
5635 |
++ goto out_drop_lock; |
5636 |
++ |
5637 |
++ fh_unlock(fh); |
5638 |
+ |
5639 |
+ fh_drop_write(fh); |
5640 |
+ |
5641 |
+@@ -131,7 +130,8 @@ out: |
5642 |
+ posix_acl_release(argp->acl_access); |
5643 |
+ posix_acl_release(argp->acl_default); |
5644 |
+ return nfserr; |
5645 |
+-out_drop_write: |
5646 |
++out_drop_lock: |
5647 |
++ fh_unlock(fh); |
5648 |
+ fh_drop_write(fh); |
5649 |
+ out_errno: |
5650 |
+ nfserr = nfserrno(error); |
5651 |
+diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c |
5652 |
+index 882b1a14bc3e..3911aa07a95c 100644 |
5653 |
+--- a/fs/nfsd/nfs3acl.c |
5654 |
++++ b/fs/nfsd/nfs3acl.c |
5655 |
+@@ -95,22 +95,20 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst * rqstp, |
5656 |
+ goto out; |
5657 |
+ |
5658 |
+ inode = d_inode(fh->fh_dentry); |
5659 |
+- if (!IS_POSIXACL(inode) || !inode->i_op->set_acl) { |
5660 |
+- error = -EOPNOTSUPP; |
5661 |
+- goto out_errno; |
5662 |
+- } |
5663 |
+ |
5664 |
+ error = fh_want_write(fh); |
5665 |
+ if (error) |
5666 |
+ goto out_errno; |
5667 |
+ |
5668 |
+- error = inode->i_op->set_acl(inode, argp->acl_access, ACL_TYPE_ACCESS); |
5669 |
++ fh_lock(fh); |
5670 |
++ |
5671 |
++ error = set_posix_acl(inode, ACL_TYPE_ACCESS, argp->acl_access); |
5672 |
+ if (error) |
5673 |
+- goto out_drop_write; |
5674 |
+- error = inode->i_op->set_acl(inode, argp->acl_default, |
5675 |
+- ACL_TYPE_DEFAULT); |
5676 |
++ goto out_drop_lock; |
5677 |
++ error = set_posix_acl(inode, ACL_TYPE_DEFAULT, argp->acl_default); |
5678 |
+ |
5679 |
+-out_drop_write: |
5680 |
++out_drop_lock: |
5681 |
++ fh_unlock(fh); |
5682 |
+ fh_drop_write(fh); |
5683 |
+ out_errno: |
5684 |
+ nfserr = nfserrno(error); |
5685 |
+diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c |
5686 |
+index 67242bf7c6cc..7de3b41b43b6 100644 |
5687 |
+--- a/fs/nfsd/nfs4acl.c |
5688 |
++++ b/fs/nfsd/nfs4acl.c |
5689 |
+@@ -782,9 +782,6 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp, |
5690 |
+ dentry = fhp->fh_dentry; |
5691 |
+ inode = d_inode(dentry); |
5692 |
+ |
5693 |
+- if (!inode->i_op->set_acl || !IS_POSIXACL(inode)) |
5694 |
+- return nfserr_attrnotsupp; |
5695 |
+- |
5696 |
+ if (S_ISDIR(inode->i_mode)) |
5697 |
+ flags = NFS4_ACL_DIR; |
5698 |
+ |
5699 |
+@@ -794,16 +791,19 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp, |
5700 |
+ if (host_error < 0) |
5701 |
+ goto out_nfserr; |
5702 |
+ |
5703 |
+- host_error = inode->i_op->set_acl(inode, pacl, ACL_TYPE_ACCESS); |
5704 |
++ fh_lock(fhp); |
5705 |
++ |
5706 |
++ host_error = set_posix_acl(inode, ACL_TYPE_ACCESS, pacl); |
5707 |
+ if (host_error < 0) |
5708 |
+- goto out_release; |
5709 |
++ goto out_drop_lock; |
5710 |
+ |
5711 |
+ if (S_ISDIR(inode->i_mode)) { |
5712 |
+- host_error = inode->i_op->set_acl(inode, dpacl, |
5713 |
+- ACL_TYPE_DEFAULT); |
5714 |
++ host_error = set_posix_acl(inode, ACL_TYPE_DEFAULT, dpacl); |
5715 |
+ } |
5716 |
+ |
5717 |
+-out_release: |
5718 |
++out_drop_lock: |
5719 |
++ fh_unlock(fhp); |
5720 |
++ |
5721 |
+ posix_acl_release(pacl); |
5722 |
+ posix_acl_release(dpacl); |
5723 |
+ out_nfserr: |
5724 |
+diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c |
5725 |
+index 977236a46aa2..ba5ef733951f 100644 |
5726 |
+--- a/fs/overlayfs/dir.c |
5727 |
++++ b/fs/overlayfs/dir.c |
5728 |
+@@ -590,21 +590,25 @@ static int ovl_remove_upper(struct dentry *dentry, bool is_dir) |
5729 |
+ { |
5730 |
+ struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent); |
5731 |
+ struct inode *dir = upperdir->d_inode; |
5732 |
+- struct dentry *upper = ovl_dentry_upper(dentry); |
5733 |
++ struct dentry *upper; |
5734 |
+ int err; |
5735 |
+ |
5736 |
+ mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); |
5737 |
++ upper = lookup_one_len(dentry->d_name.name, upperdir, |
5738 |
++ dentry->d_name.len); |
5739 |
++ err = PTR_ERR(upper); |
5740 |
++ if (IS_ERR(upper)) |
5741 |
++ goto out_unlock; |
5742 |
++ |
5743 |
+ err = -ESTALE; |
5744 |
+- if (upper->d_parent == upperdir) { |
5745 |
+- /* Don't let d_delete() think it can reset d_inode */ |
5746 |
+- dget(upper); |
5747 |
++ if (upper == ovl_dentry_upper(dentry)) { |
5748 |
+ if (is_dir) |
5749 |
+ err = vfs_rmdir(dir, upper); |
5750 |
+ else |
5751 |
+ err = vfs_unlink(dir, upper, NULL); |
5752 |
+- dput(upper); |
5753 |
+ ovl_dentry_version_inc(dentry->d_parent); |
5754 |
+ } |
5755 |
++ dput(upper); |
5756 |
+ |
5757 |
+ /* |
5758 |
+ * Keeping this dentry hashed would mean having to release |
5759 |
+@@ -614,6 +618,7 @@ static int ovl_remove_upper(struct dentry *dentry, bool is_dir) |
5760 |
+ */ |
5761 |
+ if (!err) |
5762 |
+ d_drop(dentry); |
5763 |
++out_unlock: |
5764 |
+ mutex_unlock(&dir->i_mutex); |
5765 |
+ |
5766 |
+ return err; |
5767 |
+@@ -834,29 +839,39 @@ static int ovl_rename2(struct inode *olddir, struct dentry *old, |
5768 |
+ |
5769 |
+ trap = lock_rename(new_upperdir, old_upperdir); |
5770 |
+ |
5771 |
+- olddentry = ovl_dentry_upper(old); |
5772 |
+- newdentry = ovl_dentry_upper(new); |
5773 |
+- if (newdentry) { |
5774 |
++ |
5775 |
++ olddentry = lookup_one_len(old->d_name.name, old_upperdir, |
5776 |
++ old->d_name.len); |
5777 |
++ err = PTR_ERR(olddentry); |
5778 |
++ if (IS_ERR(olddentry)) |
5779 |
++ goto out_unlock; |
5780 |
++ |
5781 |
++ err = -ESTALE; |
5782 |
++ if (olddentry != ovl_dentry_upper(old)) |
5783 |
++ goto out_dput_old; |
5784 |
++ |
5785 |
++ newdentry = lookup_one_len(new->d_name.name, new_upperdir, |
5786 |
++ new->d_name.len); |
5787 |
++ err = PTR_ERR(newdentry); |
5788 |
++ if (IS_ERR(newdentry)) |
5789 |
++ goto out_dput_old; |
5790 |
++ |
5791 |
++ err = -ESTALE; |
5792 |
++ if (ovl_dentry_upper(new)) { |
5793 |
+ if (opaquedir) { |
5794 |
+- newdentry = opaquedir; |
5795 |
+- opaquedir = NULL; |
5796 |
++ if (newdentry != opaquedir) |
5797 |
++ goto out_dput; |
5798 |
+ } else { |
5799 |
+- dget(newdentry); |
5800 |
++ if (newdentry != ovl_dentry_upper(new)) |
5801 |
++ goto out_dput; |
5802 |
+ } |
5803 |
+ } else { |
5804 |
+ new_create = true; |
5805 |
+- newdentry = lookup_one_len(new->d_name.name, new_upperdir, |
5806 |
+- new->d_name.len); |
5807 |
+- err = PTR_ERR(newdentry); |
5808 |
+- if (IS_ERR(newdentry)) |
5809 |
+- goto out_unlock; |
5810 |
++ if (!d_is_negative(newdentry) && |
5811 |
++ (!new_opaque || !ovl_is_whiteout(newdentry))) |
5812 |
++ goto out_dput; |
5813 |
+ } |
5814 |
+ |
5815 |
+- err = -ESTALE; |
5816 |
+- if (olddentry->d_parent != old_upperdir) |
5817 |
+- goto out_dput; |
5818 |
+- if (newdentry->d_parent != new_upperdir) |
5819 |
+- goto out_dput; |
5820 |
+ if (olddentry == trap) |
5821 |
+ goto out_dput; |
5822 |
+ if (newdentry == trap) |
5823 |
+@@ -919,6 +934,8 @@ static int ovl_rename2(struct inode *olddir, struct dentry *old, |
5824 |
+ |
5825 |
+ out_dput: |
5826 |
+ dput(newdentry); |
5827 |
++out_dput_old: |
5828 |
++ dput(olddentry); |
5829 |
+ out_unlock: |
5830 |
+ unlock_rename(new_upperdir, old_upperdir); |
5831 |
+ out_revert_creds: |
5832 |
+diff --git a/fs/posix_acl.c b/fs/posix_acl.c |
5833 |
+index 84bb65b83570..a9dafa83678c 100644 |
5834 |
+--- a/fs/posix_acl.c |
5835 |
++++ b/fs/posix_acl.c |
5836 |
+@@ -791,38 +791,42 @@ posix_acl_xattr_get(struct dentry *dentry, const char *name, |
5837 |
+ return error; |
5838 |
+ } |
5839 |
+ |
5840 |
+-static int |
5841 |
+-posix_acl_xattr_set(struct dentry *dentry, const char *name, |
5842 |
+- const void *value, size_t size, int flags, int type) |
5843 |
++int |
5844 |
++set_posix_acl(struct inode *inode, int type, struct posix_acl *acl) |
5845 |
+ { |
5846 |
+- struct inode *inode = d_backing_inode(dentry); |
5847 |
+- struct posix_acl *acl = NULL; |
5848 |
+- int ret; |
5849 |
+- |
5850 |
+ if (!IS_POSIXACL(inode)) |
5851 |
+ return -EOPNOTSUPP; |
5852 |
+ if (!inode->i_op->set_acl) |
5853 |
+ return -EOPNOTSUPP; |
5854 |
+ |
5855 |
+ if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode)) |
5856 |
+- return value ? -EACCES : 0; |
5857 |
++ return acl ? -EACCES : 0; |
5858 |
+ if (!inode_owner_or_capable(inode)) |
5859 |
+ return -EPERM; |
5860 |
+ |
5861 |
++ if (acl) { |
5862 |
++ int ret = posix_acl_valid(acl); |
5863 |
++ if (ret) |
5864 |
++ return ret; |
5865 |
++ } |
5866 |
++ return inode->i_op->set_acl(inode, acl, type); |
5867 |
++} |
5868 |
++EXPORT_SYMBOL(set_posix_acl); |
5869 |
++ |
5870 |
++static int |
5871 |
++posix_acl_xattr_set(struct dentry *dentry, const char *name, |
5872 |
++ const void *value, size_t size, int flags, int type) |
5873 |
++{ |
5874 |
++ struct inode *inode = d_backing_inode(dentry); |
5875 |
++ struct posix_acl *acl = NULL; |
5876 |
++ int ret; |
5877 |
++ |
5878 |
+ if (value) { |
5879 |
+ acl = posix_acl_from_xattr(&init_user_ns, value, size); |
5880 |
+ if (IS_ERR(acl)) |
5881 |
+ return PTR_ERR(acl); |
5882 |
+- |
5883 |
+- if (acl) { |
5884 |
+- ret = posix_acl_valid(acl); |
5885 |
+- if (ret) |
5886 |
+- goto out; |
5887 |
+- } |
5888 |
+ } |
5889 |
+- |
5890 |
+- ret = inode->i_op->set_acl(inode, acl, type); |
5891 |
+-out: |
5892 |
++ ret = set_posix_acl(inode, type, acl); |
5893 |
+ posix_acl_release(acl); |
5894 |
+ return ret; |
5895 |
+ } |
5896 |
+diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c |
5897 |
+index 6dee68d013ff..32287fb146db 100644 |
5898 |
+--- a/fs/proc/task_mmu.c |
5899 |
++++ b/fs/proc/task_mmu.c |
5900 |
+@@ -1257,7 +1257,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, |
5901 |
+ if (!pm.buffer) |
5902 |
+ goto out_task; |
5903 |
+ |
5904 |
+- mm = mm_access(task, PTRACE_MODE_READ); |
5905 |
++ mm = mm_access(task, PTRACE_MODE_READ_FSCREDS); |
5906 |
+ ret = PTR_ERR(mm); |
5907 |
+ if (!mm || IS_ERR(mm)) |
5908 |
+ goto out_free; |
5909 |
+diff --git a/include/linux/i8042.h b/include/linux/i8042.h |
5910 |
+index 0f9bafa17a02..d98780ca9604 100644 |
5911 |
+--- a/include/linux/i8042.h |
5912 |
++++ b/include/linux/i8042.h |
5913 |
+@@ -62,7 +62,6 @@ struct serio; |
5914 |
+ void i8042_lock_chip(void); |
5915 |
+ void i8042_unlock_chip(void); |
5916 |
+ int i8042_command(unsigned char *param, int command); |
5917 |
+-bool i8042_check_port_owner(const struct serio *); |
5918 |
+ int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str, |
5919 |
+ struct serio *serio)); |
5920 |
+ int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str, |
5921 |
+@@ -83,11 +82,6 @@ static inline int i8042_command(unsigned char *param, int command) |
5922 |
+ return -ENODEV; |
5923 |
+ } |
5924 |
+ |
5925 |
+-static inline bool i8042_check_port_owner(const struct serio *serio) |
5926 |
+-{ |
5927 |
+- return false; |
5928 |
+-} |
5929 |
+- |
5930 |
+ static inline int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str, |
5931 |
+ struct serio *serio)) |
5932 |
+ { |
5933 |
+diff --git a/include/linux/serio.h b/include/linux/serio.h |
5934 |
+index 9f779c7a2da4..27ae809edd70 100644 |
5935 |
+--- a/include/linux/serio.h |
5936 |
++++ b/include/linux/serio.h |
5937 |
+@@ -29,7 +29,8 @@ struct serio { |
5938 |
+ |
5939 |
+ struct serio_device_id id; |
5940 |
+ |
5941 |
+- spinlock_t lock; /* protects critical sections from port's interrupt handler */ |
5942 |
++ /* Protects critical sections from port's interrupt handler */ |
5943 |
++ spinlock_t lock; |
5944 |
+ |
5945 |
+ int (*write)(struct serio *, unsigned char); |
5946 |
+ int (*open)(struct serio *); |
5947 |
+@@ -38,16 +39,29 @@ struct serio { |
5948 |
+ void (*stop)(struct serio *); |
5949 |
+ |
5950 |
+ struct serio *parent; |
5951 |
+- struct list_head child_node; /* Entry in parent->children list */ |
5952 |
++ /* Entry in parent->children list */ |
5953 |
++ struct list_head child_node; |
5954 |
+ struct list_head children; |
5955 |
+- unsigned int depth; /* level of nesting in serio hierarchy */ |
5956 |
++ /* Level of nesting in serio hierarchy */ |
5957 |
++ unsigned int depth; |
5958 |
+ |
5959 |
+- struct serio_driver *drv; /* accessed from interrupt, must be protected by serio->lock and serio->sem */ |
5960 |
+- struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */ |
5961 |
++ /* |
5962 |
++ * serio->drv is accessed from interrupt handlers; when modifying |
5963 |
++ * caller should acquire serio->drv_mutex and serio->lock. |
5964 |
++ */ |
5965 |
++ struct serio_driver *drv; |
5966 |
++ /* Protects serio->drv so attributes can pin current driver */ |
5967 |
++ struct mutex drv_mutex; |
5968 |
+ |
5969 |
+ struct device dev; |
5970 |
+ |
5971 |
+ struct list_head node; |
5972 |
++ |
5973 |
++ /* |
5974 |
++ * For use by PS/2 layer when several ports share hardware and |
5975 |
++ * may get indigestion when exposed to concurrent access (i8042). |
5976 |
++ */ |
5977 |
++ struct mutex *ps2_cmd_mutex; |
5978 |
+ }; |
5979 |
+ #define to_serio_port(d) container_of(d, struct serio, dev) |
5980 |
+ |
5981 |
+diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h |
5982 |
+index 003dca933803..5664ca07c9c7 100644 |
5983 |
+--- a/include/trace/events/sunrpc.h |
5984 |
++++ b/include/trace/events/sunrpc.h |
5985 |
+@@ -529,20 +529,27 @@ TRACE_EVENT(svc_xprt_do_enqueue, |
5986 |
+ |
5987 |
+ TP_STRUCT__entry( |
5988 |
+ __field(struct svc_xprt *, xprt) |
5989 |
+- __field_struct(struct sockaddr_storage, ss) |
5990 |
+ __field(int, pid) |
5991 |
+ __field(unsigned long, flags) |
5992 |
++ __dynamic_array(unsigned char, addr, xprt != NULL ? |
5993 |
++ xprt->xpt_remotelen : 0) |
5994 |
+ ), |
5995 |
+ |
5996 |
+ TP_fast_assign( |
5997 |
+ __entry->xprt = xprt; |
5998 |
+- xprt ? memcpy(&__entry->ss, &xprt->xpt_remote, sizeof(__entry->ss)) : memset(&__entry->ss, 0, sizeof(__entry->ss)); |
5999 |
+ __entry->pid = rqst? rqst->rq_task->pid : 0; |
6000 |
+- __entry->flags = xprt ? xprt->xpt_flags : 0; |
6001 |
++ if (xprt) { |
6002 |
++ memcpy(__get_dynamic_array(addr), |
6003 |
++ &xprt->xpt_remote, |
6004 |
++ xprt->xpt_remotelen); |
6005 |
++ __entry->flags = xprt->xpt_flags; |
6006 |
++ } else |
6007 |
++ __entry->flags = 0; |
6008 |
+ ), |
6009 |
+ |
6010 |
+ TP_printk("xprt=0x%p addr=%pIScp pid=%d flags=%s", __entry->xprt, |
6011 |
+- (struct sockaddr *)&__entry->ss, |
6012 |
++ __get_dynamic_array_len(addr) != 0 ? |
6013 |
++ (struct sockaddr *)__get_dynamic_array(addr) : NULL, |
6014 |
+ __entry->pid, show_svc_xprt_flags(__entry->flags)) |
6015 |
+ ); |
6016 |
+ |
6017 |
+@@ -553,18 +560,25 @@ TRACE_EVENT(svc_xprt_dequeue, |
6018 |
+ |
6019 |
+ TP_STRUCT__entry( |
6020 |
+ __field(struct svc_xprt *, xprt) |
6021 |
+- __field_struct(struct sockaddr_storage, ss) |
6022 |
+ __field(unsigned long, flags) |
6023 |
++ __dynamic_array(unsigned char, addr, xprt != NULL ? |
6024 |
++ xprt->xpt_remotelen : 0) |
6025 |
+ ), |
6026 |
+ |
6027 |
+ TP_fast_assign( |
6028 |
+- __entry->xprt = xprt, |
6029 |
+- xprt ? memcpy(&__entry->ss, &xprt->xpt_remote, sizeof(__entry->ss)) : memset(&__entry->ss, 0, sizeof(__entry->ss)); |
6030 |
+- __entry->flags = xprt ? xprt->xpt_flags : 0; |
6031 |
++ __entry->xprt = xprt; |
6032 |
++ if (xprt) { |
6033 |
++ memcpy(__get_dynamic_array(addr), |
6034 |
++ &xprt->xpt_remote, |
6035 |
++ xprt->xpt_remotelen); |
6036 |
++ __entry->flags = xprt->xpt_flags; |
6037 |
++ } else |
6038 |
++ __entry->flags = 0; |
6039 |
+ ), |
6040 |
+ |
6041 |
+ TP_printk("xprt=0x%p addr=%pIScp flags=%s", __entry->xprt, |
6042 |
+- (struct sockaddr *)&__entry->ss, |
6043 |
++ __get_dynamic_array_len(addr) != 0 ? |
6044 |
++ (struct sockaddr *)__get_dynamic_array(addr) : NULL, |
6045 |
+ show_svc_xprt_flags(__entry->flags)) |
6046 |
+ ); |
6047 |
+ |
6048 |
+@@ -592,19 +606,26 @@ TRACE_EVENT(svc_handle_xprt, |
6049 |
+ TP_STRUCT__entry( |
6050 |
+ __field(struct svc_xprt *, xprt) |
6051 |
+ __field(int, len) |
6052 |
+- __field_struct(struct sockaddr_storage, ss) |
6053 |
+ __field(unsigned long, flags) |
6054 |
++ __dynamic_array(unsigned char, addr, xprt != NULL ? |
6055 |
++ xprt->xpt_remotelen : 0) |
6056 |
+ ), |
6057 |
+ |
6058 |
+ TP_fast_assign( |
6059 |
+ __entry->xprt = xprt; |
6060 |
+- xprt ? memcpy(&__entry->ss, &xprt->xpt_remote, sizeof(__entry->ss)) : memset(&__entry->ss, 0, sizeof(__entry->ss)); |
6061 |
+ __entry->len = len; |
6062 |
+- __entry->flags = xprt ? xprt->xpt_flags : 0; |
6063 |
++ if (xprt) { |
6064 |
++ memcpy(__get_dynamic_array(addr), |
6065 |
++ &xprt->xpt_remote, |
6066 |
++ xprt->xpt_remotelen); |
6067 |
++ __entry->flags = xprt->xpt_flags; |
6068 |
++ } else |
6069 |
++ __entry->flags = 0; |
6070 |
+ ), |
6071 |
+ |
6072 |
+ TP_printk("xprt=0x%p addr=%pIScp len=%d flags=%s", __entry->xprt, |
6073 |
+- (struct sockaddr *)&__entry->ss, |
6074 |
++ __get_dynamic_array_len(addr) != 0 ? |
6075 |
++ (struct sockaddr *)__get_dynamic_array(addr) : NULL, |
6076 |
+ __entry->len, show_svc_xprt_flags(__entry->flags)) |
6077 |
+ ); |
6078 |
+ #endif /* _TRACE_SUNRPC_H */ |
6079 |
+diff --git a/ipc/msg.c b/ipc/msg.c |
6080 |
+index 652540613d26..3b2b0f5149ab 100644 |
6081 |
+--- a/ipc/msg.c |
6082 |
++++ b/ipc/msg.c |
6083 |
+@@ -678,7 +678,7 @@ long do_msgsnd(int msqid, long mtype, void __user *mtext, |
6084 |
+ rcu_read_lock(); |
6085 |
+ ipc_lock_object(&msq->q_perm); |
6086 |
+ |
6087 |
+- ipc_rcu_putref(msq, ipc_rcu_free); |
6088 |
++ ipc_rcu_putref(msq, msg_rcu_free); |
6089 |
+ /* raced with RMID? */ |
6090 |
+ if (!ipc_valid_object(&msq->q_perm)) { |
6091 |
+ err = -EIDRM; |
6092 |
+diff --git a/ipc/sem.c b/ipc/sem.c |
6093 |
+index c50aa5755c62..534caee6bf33 100644 |
6094 |
+--- a/ipc/sem.c |
6095 |
++++ b/ipc/sem.c |
6096 |
+@@ -442,7 +442,7 @@ static inline struct sem_array *sem_obtain_object_check(struct ipc_namespace *ns |
6097 |
+ static inline void sem_lock_and_putref(struct sem_array *sma) |
6098 |
+ { |
6099 |
+ sem_lock(sma, NULL, -1); |
6100 |
+- ipc_rcu_putref(sma, ipc_rcu_free); |
6101 |
++ ipc_rcu_putref(sma, sem_rcu_free); |
6102 |
+ } |
6103 |
+ |
6104 |
+ static inline void sem_rmid(struct ipc_namespace *ns, struct sem_array *s) |
6105 |
+@@ -1385,7 +1385,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, |
6106 |
+ rcu_read_unlock(); |
6107 |
+ sem_io = ipc_alloc(sizeof(ushort)*nsems); |
6108 |
+ if (sem_io == NULL) { |
6109 |
+- ipc_rcu_putref(sma, ipc_rcu_free); |
6110 |
++ ipc_rcu_putref(sma, sem_rcu_free); |
6111 |
+ return -ENOMEM; |
6112 |
+ } |
6113 |
+ |
6114 |
+@@ -1419,20 +1419,20 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, |
6115 |
+ if (nsems > SEMMSL_FAST) { |
6116 |
+ sem_io = ipc_alloc(sizeof(ushort)*nsems); |
6117 |
+ if (sem_io == NULL) { |
6118 |
+- ipc_rcu_putref(sma, ipc_rcu_free); |
6119 |
++ ipc_rcu_putref(sma, sem_rcu_free); |
6120 |
+ return -ENOMEM; |
6121 |
+ } |
6122 |
+ } |
6123 |
+ |
6124 |
+ if (copy_from_user(sem_io, p, nsems*sizeof(ushort))) { |
6125 |
+- ipc_rcu_putref(sma, ipc_rcu_free); |
6126 |
++ ipc_rcu_putref(sma, sem_rcu_free); |
6127 |
+ err = -EFAULT; |
6128 |
+ goto out_free; |
6129 |
+ } |
6130 |
+ |
6131 |
+ for (i = 0; i < nsems; i++) { |
6132 |
+ if (sem_io[i] > SEMVMX) { |
6133 |
+- ipc_rcu_putref(sma, ipc_rcu_free); |
6134 |
++ ipc_rcu_putref(sma, sem_rcu_free); |
6135 |
+ err = -ERANGE; |
6136 |
+ goto out_free; |
6137 |
+ } |
6138 |
+@@ -1722,7 +1722,7 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid) |
6139 |
+ /* step 2: allocate new undo structure */ |
6140 |
+ new = kzalloc(sizeof(struct sem_undo) + sizeof(short)*nsems, GFP_KERNEL); |
6141 |
+ if (!new) { |
6142 |
+- ipc_rcu_putref(sma, ipc_rcu_free); |
6143 |
++ ipc_rcu_putref(sma, sem_rcu_free); |
6144 |
+ return ERR_PTR(-ENOMEM); |
6145 |
+ } |
6146 |
+ |
6147 |
+diff --git a/kernel/auditsc.c b/kernel/auditsc.c |
6148 |
+index 9fb9d1cb83ce..b1943039aab6 100644 |
6149 |
+--- a/kernel/auditsc.c |
6150 |
++++ b/kernel/auditsc.c |
6151 |
+@@ -73,6 +73,7 @@ |
6152 |
+ #include <linux/compat.h> |
6153 |
+ #include <linux/ctype.h> |
6154 |
+ #include <linux/string.h> |
6155 |
++#include <linux/uaccess.h> |
6156 |
+ #include <uapi/linux/limits.h> |
6157 |
+ |
6158 |
+ #include "audit.h" |
6159 |
+@@ -82,7 +83,8 @@ |
6160 |
+ #define AUDITSC_SUCCESS 1 |
6161 |
+ #define AUDITSC_FAILURE 2 |
6162 |
+ |
6163 |
+-/* no execve audit message should be longer than this (userspace limits) */ |
6164 |
++/* no execve audit message should be longer than this (userspace limits), |
6165 |
++ * see the note near the top of audit_log_execve_info() about this value */ |
6166 |
+ #define MAX_EXECVE_AUDIT_LEN 7500 |
6167 |
+ |
6168 |
+ /* max length to print of cmdline/proctitle value during audit */ |
6169 |
+@@ -987,185 +989,178 @@ static int audit_log_pid_context(struct audit_context *context, pid_t pid, |
6170 |
+ return rc; |
6171 |
+ } |
6172 |
+ |
6173 |
+-/* |
6174 |
+- * to_send and len_sent accounting are very loose estimates. We aren't |
6175 |
+- * really worried about a hard cap to MAX_EXECVE_AUDIT_LEN so much as being |
6176 |
+- * within about 500 bytes (next page boundary) |
6177 |
+- * |
6178 |
+- * why snprintf? an int is up to 12 digits long. if we just assumed when |
6179 |
+- * logging that a[%d]= was going to be 16 characters long we would be wasting |
6180 |
+- * space in every audit message. In one 7500 byte message we can log up to |
6181 |
+- * about 1000 min size arguments. That comes down to about 50% waste of space |
6182 |
+- * if we didn't do the snprintf to find out how long arg_num_len was. |
6183 |
+- */ |
6184 |
+-static int audit_log_single_execve_arg(struct audit_context *context, |
6185 |
+- struct audit_buffer **ab, |
6186 |
+- int arg_num, |
6187 |
+- size_t *len_sent, |
6188 |
+- const char __user *p, |
6189 |
+- char *buf) |
6190 |
++static void audit_log_execve_info(struct audit_context *context, |
6191 |
++ struct audit_buffer **ab) |
6192 |
+ { |
6193 |
+- char arg_num_len_buf[12]; |
6194 |
+- const char __user *tmp_p = p; |
6195 |
+- /* how many digits are in arg_num? 5 is the length of ' a=""' */ |
6196 |
+- size_t arg_num_len = snprintf(arg_num_len_buf, 12, "%d", arg_num) + 5; |
6197 |
+- size_t len, len_left, to_send; |
6198 |
+- size_t max_execve_audit_len = MAX_EXECVE_AUDIT_LEN; |
6199 |
+- unsigned int i, has_cntl = 0, too_long = 0; |
6200 |
+- int ret; |
6201 |
+- |
6202 |
+- /* strnlen_user includes the null we don't want to send */ |
6203 |
+- len_left = len = strnlen_user(p, MAX_ARG_STRLEN) - 1; |
6204 |
+- |
6205 |
+- /* |
6206 |
+- * We just created this mm, if we can't find the strings |
6207 |
+- * we just copied into it something is _very_ wrong. Similar |
6208 |
+- * for strings that are too long, we should not have created |
6209 |
+- * any. |
6210 |
+- */ |
6211 |
+- if (unlikely((len == -1) || len > MAX_ARG_STRLEN - 1)) { |
6212 |
+- WARN_ON(1); |
6213 |
+- send_sig(SIGKILL, current, 0); |
6214 |
+- return -1; |
6215 |
++ long len_max; |
6216 |
++ long len_rem; |
6217 |
++ long len_full; |
6218 |
++ long len_buf; |
6219 |
++ long len_abuf; |
6220 |
++ long len_tmp; |
6221 |
++ bool require_data; |
6222 |
++ bool encode; |
6223 |
++ unsigned int iter; |
6224 |
++ unsigned int arg; |
6225 |
++ char *buf_head; |
6226 |
++ char *buf; |
6227 |
++ const char __user *p = (const char __user *)current->mm->arg_start; |
6228 |
++ |
6229 |
++ /* NOTE: this buffer needs to be large enough to hold all the non-arg |
6230 |
++ * data we put in the audit record for this argument (see the |
6231 |
++ * code below) ... at this point in time 96 is plenty */ |
6232 |
++ char abuf[96]; |
6233 |
++ |
6234 |
++ /* NOTE: we set MAX_EXECVE_AUDIT_LEN to a rather arbitrary limit, the |
6235 |
++ * current value of 7500 is not as important as the fact that it |
6236 |
++ * is less than 8k, a setting of 7500 gives us plenty of wiggle |
6237 |
++ * room if we go over a little bit in the logging below */ |
6238 |
++ WARN_ON_ONCE(MAX_EXECVE_AUDIT_LEN > 7500); |
6239 |
++ len_max = MAX_EXECVE_AUDIT_LEN; |
6240 |
++ |
6241 |
++ /* scratch buffer to hold the userspace args */ |
6242 |
++ buf_head = kmalloc(MAX_EXECVE_AUDIT_LEN + 1, GFP_KERNEL); |
6243 |
++ if (!buf_head) { |
6244 |
++ audit_panic("out of memory for argv string"); |
6245 |
++ return; |
6246 |
+ } |
6247 |
++ buf = buf_head; |
6248 |
+ |
6249 |
+- /* walk the whole argument looking for non-ascii chars */ |
6250 |
++ audit_log_format(*ab, "argc=%d", context->execve.argc); |
6251 |
++ |
6252 |
++ len_rem = len_max; |
6253 |
++ len_buf = 0; |
6254 |
++ len_full = 0; |
6255 |
++ require_data = true; |
6256 |
++ encode = false; |
6257 |
++ iter = 0; |
6258 |
++ arg = 0; |
6259 |
+ do { |
6260 |
+- if (len_left > MAX_EXECVE_AUDIT_LEN) |
6261 |
+- to_send = MAX_EXECVE_AUDIT_LEN; |
6262 |
+- else |
6263 |
+- to_send = len_left; |
6264 |
+- ret = copy_from_user(buf, tmp_p, to_send); |
6265 |
+- /* |
6266 |
+- * There is no reason for this copy to be short. We just |
6267 |
+- * copied them here, and the mm hasn't been exposed to user- |
6268 |
+- * space yet. |
6269 |
+- */ |
6270 |
+- if (ret) { |
6271 |
+- WARN_ON(1); |
6272 |
+- send_sig(SIGKILL, current, 0); |
6273 |
+- return -1; |
6274 |
+- } |
6275 |
+- buf[to_send] = '\0'; |
6276 |
+- has_cntl = audit_string_contains_control(buf, to_send); |
6277 |
+- if (has_cntl) { |
6278 |
+- /* |
6279 |
+- * hex messages get logged as 2 bytes, so we can only |
6280 |
+- * send half as much in each message |
6281 |
+- */ |
6282 |
+- max_execve_audit_len = MAX_EXECVE_AUDIT_LEN / 2; |
6283 |
+- break; |
6284 |
+- } |
6285 |
+- len_left -= to_send; |
6286 |
+- tmp_p += to_send; |
6287 |
+- } while (len_left > 0); |
6288 |
+- |
6289 |
+- len_left = len; |
6290 |
+- |
6291 |
+- if (len > max_execve_audit_len) |
6292 |
+- too_long = 1; |
6293 |
+- |
6294 |
+- /* rewalk the argument actually logging the message */ |
6295 |
+- for (i = 0; len_left > 0; i++) { |
6296 |
+- int room_left; |
6297 |
+- |
6298 |
+- if (len_left > max_execve_audit_len) |
6299 |
+- to_send = max_execve_audit_len; |
6300 |
+- else |
6301 |
+- to_send = len_left; |
6302 |
+- |
6303 |
+- /* do we have space left to send this argument in this ab? */ |
6304 |
+- room_left = MAX_EXECVE_AUDIT_LEN - arg_num_len - *len_sent; |
6305 |
+- if (has_cntl) |
6306 |
+- room_left -= (to_send * 2); |
6307 |
+- else |
6308 |
+- room_left -= to_send; |
6309 |
+- if (room_left < 0) { |
6310 |
+- *len_sent = 0; |
6311 |
+- audit_log_end(*ab); |
6312 |
+- *ab = audit_log_start(context, GFP_KERNEL, AUDIT_EXECVE); |
6313 |
+- if (!*ab) |
6314 |
+- return 0; |
6315 |
+- } |
6316 |
++ /* NOTE: we don't ever want to trust this value for anything |
6317 |
++ * serious, but the audit record format insists we |
6318 |
++ * provide an argument length for really long arguments, |
6319 |
++ * e.g. > MAX_EXECVE_AUDIT_LEN, so we have no choice but |
6320 |
++ * to use strncpy_from_user() to obtain this value for |
6321 |
++ * recording in the log, although we don't use it |
6322 |
++ * anywhere here to avoid a double-fetch problem */ |
6323 |
++ if (len_full == 0) |
6324 |
++ len_full = strnlen_user(p, MAX_ARG_STRLEN) - 1; |
6325 |
++ |
6326 |
++ /* read more data from userspace */ |
6327 |
++ if (require_data) { |
6328 |
++ /* can we make more room in the buffer? */ |
6329 |
++ if (buf != buf_head) { |
6330 |
++ memmove(buf_head, buf, len_buf); |
6331 |
++ buf = buf_head; |
6332 |
++ } |
6333 |
++ |
6334 |
++ /* fetch as much as we can of the argument */ |
6335 |
++ len_tmp = strncpy_from_user(&buf_head[len_buf], p, |
6336 |
++ len_max - len_buf); |
6337 |
++ if (len_tmp == -EFAULT) { |
6338 |
++ /* unable to copy from userspace */ |
6339 |
++ send_sig(SIGKILL, current, 0); |
6340 |
++ goto out; |
6341 |
++ } else if (len_tmp == (len_max - len_buf)) { |
6342 |
++ /* buffer is not large enough */ |
6343 |
++ require_data = true; |
6344 |
++ /* NOTE: if we are going to span multiple |
6345 |
++ * buffers force the encoding so we stand |
6346 |
++ * a chance at a sane len_full value and |
6347 |
++ * consistent record encoding */ |
6348 |
++ encode = true; |
6349 |
++ len_full = len_full * 2; |
6350 |
++ p += len_tmp; |
6351 |
++ } else { |
6352 |
++ require_data = false; |
6353 |
++ if (!encode) |
6354 |
++ encode = audit_string_contains_control( |
6355 |
++ buf, len_tmp); |
6356 |
++ /* try to use a trusted value for len_full */ |
6357 |
++ if (len_full < len_max) |
6358 |
++ len_full = (encode ? |
6359 |
++ len_tmp * 2 : len_tmp); |
6360 |
++ p += len_tmp + 1; |
6361 |
++ } |
6362 |
++ len_buf += len_tmp; |
6363 |
++ buf_head[len_buf] = '\0'; |
6364 |
+ |
6365 |
+- /* |
6366 |
+- * first record needs to say how long the original string was |
6367 |
+- * so we can be sure nothing was lost. |
6368 |
+- */ |
6369 |
+- if ((i == 0) && (too_long)) |
6370 |
+- audit_log_format(*ab, " a%d_len=%zu", arg_num, |
6371 |
+- has_cntl ? 2*len : len); |
6372 |
+- |
6373 |
+- /* |
6374 |
+- * normally arguments are small enough to fit and we already |
6375 |
+- * filled buf above when we checked for control characters |
6376 |
+- * so don't bother with another copy_from_user |
6377 |
+- */ |
6378 |
+- if (len >= max_execve_audit_len) |
6379 |
+- ret = copy_from_user(buf, p, to_send); |
6380 |
+- else |
6381 |
+- ret = 0; |
6382 |
+- if (ret) { |
6383 |
+- WARN_ON(1); |
6384 |
+- send_sig(SIGKILL, current, 0); |
6385 |
+- return -1; |
6386 |
++ /* length of the buffer in the audit record? */ |
6387 |
++ len_abuf = (encode ? len_buf * 2 : len_buf + 2); |
6388 |
+ } |
6389 |
+- buf[to_send] = '\0'; |
6390 |
+- |
6391 |
+- /* actually log it */ |
6392 |
+- audit_log_format(*ab, " a%d", arg_num); |
6393 |
+- if (too_long) |
6394 |
+- audit_log_format(*ab, "[%d]", i); |
6395 |
+- audit_log_format(*ab, "="); |
6396 |
+- if (has_cntl) |
6397 |
+- audit_log_n_hex(*ab, buf, to_send); |
6398 |
+- else |
6399 |
+- audit_log_string(*ab, buf); |
6400 |
+- |
6401 |
+- p += to_send; |
6402 |
+- len_left -= to_send; |
6403 |
+- *len_sent += arg_num_len; |
6404 |
+- if (has_cntl) |
6405 |
+- *len_sent += to_send * 2; |
6406 |
+- else |
6407 |
+- *len_sent += to_send; |
6408 |
+- } |
6409 |
+- /* include the null we didn't log */ |
6410 |
+- return len + 1; |
6411 |
+-} |
6412 |
+ |
6413 |
+-static void audit_log_execve_info(struct audit_context *context, |
6414 |
+- struct audit_buffer **ab) |
6415 |
+-{ |
6416 |
+- int i, len; |
6417 |
+- size_t len_sent = 0; |
6418 |
+- const char __user *p; |
6419 |
+- char *buf; |
6420 |
++ /* write as much as we can to the audit log */ |
6421 |
++ if (len_buf > 0) { |
6422 |
++ /* NOTE: some magic numbers here - basically if we |
6423 |
++ * can't fit a reasonable amount of data into the |
6424 |
++ * existing audit buffer, flush it and start with |
6425 |
++ * a new buffer */ |
6426 |
++ if ((sizeof(abuf) + 8) > len_rem) { |
6427 |
++ len_rem = len_max; |
6428 |
++ audit_log_end(*ab); |
6429 |
++ *ab = audit_log_start(context, |
6430 |
++ GFP_KERNEL, AUDIT_EXECVE); |
6431 |
++ if (!*ab) |
6432 |
++ goto out; |
6433 |
++ } |
6434 |
+ |
6435 |
+- p = (const char __user *)current->mm->arg_start; |
6436 |
++ /* create the non-arg portion of the arg record */ |
6437 |
++ len_tmp = 0; |
6438 |
++ if (require_data || (iter > 0) || |
6439 |
++ ((len_abuf + sizeof(abuf)) > len_rem)) { |
6440 |
++ if (iter == 0) { |
6441 |
++ len_tmp += snprintf(&abuf[len_tmp], |
6442 |
++ sizeof(abuf) - len_tmp, |
6443 |
++ " a%d_len=%lu", |
6444 |
++ arg, len_full); |
6445 |
++ } |
6446 |
++ len_tmp += snprintf(&abuf[len_tmp], |
6447 |
++ sizeof(abuf) - len_tmp, |
6448 |
++ " a%d[%d]=", arg, iter++); |
6449 |
++ } else |
6450 |
++ len_tmp += snprintf(&abuf[len_tmp], |
6451 |
++ sizeof(abuf) - len_tmp, |
6452 |
++ " a%d=", arg); |
6453 |
++ WARN_ON(len_tmp >= sizeof(abuf)); |
6454 |
++ abuf[sizeof(abuf) - 1] = '\0'; |
6455 |
++ |
6456 |
++ /* log the arg in the audit record */ |
6457 |
++ audit_log_format(*ab, "%s", abuf); |
6458 |
++ len_rem -= len_tmp; |
6459 |
++ len_tmp = len_buf; |
6460 |
++ if (encode) { |
6461 |
++ if (len_abuf > len_rem) |
6462 |
++ len_tmp = len_rem / 2; /* encoding */ |
6463 |
++ audit_log_n_hex(*ab, buf, len_tmp); |
6464 |
++ len_rem -= len_tmp * 2; |
6465 |
++ len_abuf -= len_tmp * 2; |
6466 |
++ } else { |
6467 |
++ if (len_abuf > len_rem) |
6468 |
++ len_tmp = len_rem - 2; /* quotes */ |
6469 |
++ audit_log_n_string(*ab, buf, len_tmp); |
6470 |
++ len_rem -= len_tmp + 2; |
6471 |
++ /* don't subtract the "2" because we still need |
6472 |
++ * to add quotes to the remaining string */ |
6473 |
++ len_abuf -= len_tmp; |
6474 |
++ } |
6475 |
++ len_buf -= len_tmp; |
6476 |
++ buf += len_tmp; |
6477 |
++ } |
6478 |
+ |
6479 |
+- audit_log_format(*ab, "argc=%d", context->execve.argc); |
6480 |
++ /* ready to move to the next argument? */ |
6481 |
++ if ((len_buf == 0) && !require_data) { |
6482 |
++ arg++; |
6483 |
++ iter = 0; |
6484 |
++ len_full = 0; |
6485 |
++ require_data = true; |
6486 |
++ encode = false; |
6487 |
++ } |
6488 |
++ } while (arg < context->execve.argc); |
6489 |
+ |
6490 |
+- /* |
6491 |
+- * we need some kernel buffer to hold the userspace args. Just |
6492 |
+- * allocate one big one rather than allocating one of the right size |
6493 |
+- * for every single argument inside audit_log_single_execve_arg() |
6494 |
+- * should be <8k allocation so should be pretty safe. |
6495 |
+- */ |
6496 |
+- buf = kmalloc(MAX_EXECVE_AUDIT_LEN + 1, GFP_KERNEL); |
6497 |
+- if (!buf) { |
6498 |
+- audit_panic("out of memory for argv string"); |
6499 |
+- return; |
6500 |
+- } |
6501 |
++ /* NOTE: the caller handles the final audit_log_end() call */ |
6502 |
+ |
6503 |
+- for (i = 0; i < context->execve.argc; i++) { |
6504 |
+- len = audit_log_single_execve_arg(context, ab, i, |
6505 |
+- &len_sent, p, buf); |
6506 |
+- if (len <= 0) |
6507 |
+- break; |
6508 |
+- p += len; |
6509 |
+- } |
6510 |
+- kfree(buf); |
6511 |
++out: |
6512 |
++ kfree(buf_head); |
6513 |
+ } |
6514 |
+ |
6515 |
+ static void show_special(struct audit_context *context, int *call_panic) |
6516 |
+diff --git a/kernel/module.c b/kernel/module.c |
6517 |
+index be8971d817ed..6920d1080cdd 100644 |
6518 |
+--- a/kernel/module.c |
6519 |
++++ b/kernel/module.c |
6520 |
+@@ -2451,13 +2451,18 @@ static inline void kmemleak_load_module(const struct module *mod, |
6521 |
+ #endif |
6522 |
+ |
6523 |
+ #ifdef CONFIG_MODULE_SIG |
6524 |
+-static int module_sig_check(struct load_info *info) |
6525 |
++static int module_sig_check(struct load_info *info, int flags) |
6526 |
+ { |
6527 |
+ int err = -ENOKEY; |
6528 |
+ const unsigned long markerlen = sizeof(MODULE_SIG_STRING) - 1; |
6529 |
+ const void *mod = info->hdr; |
6530 |
+ |
6531 |
+- if (info->len > markerlen && |
6532 |
++ /* |
6533 |
++ * Require flags == 0, as a module with version information |
6534 |
++ * removed is no longer the module that was signed |
6535 |
++ */ |
6536 |
++ if (flags == 0 && |
6537 |
++ info->len > markerlen && |
6538 |
+ memcmp(mod + info->len - markerlen, MODULE_SIG_STRING, markerlen) == 0) { |
6539 |
+ /* We truncate the module to discard the signature */ |
6540 |
+ info->len -= markerlen; |
6541 |
+@@ -2476,7 +2481,7 @@ static int module_sig_check(struct load_info *info) |
6542 |
+ return err; |
6543 |
+ } |
6544 |
+ #else /* !CONFIG_MODULE_SIG */ |
6545 |
+-static int module_sig_check(struct load_info *info) |
6546 |
++static int module_sig_check(struct load_info *info, int flags) |
6547 |
+ { |
6548 |
+ return 0; |
6549 |
+ } |
6550 |
+@@ -3277,7 +3282,7 @@ static int load_module(struct load_info *info, const char __user *uargs, |
6551 |
+ long err; |
6552 |
+ char *after_dashes; |
6553 |
+ |
6554 |
+- err = module_sig_check(info); |
6555 |
++ err = module_sig_check(info, flags); |
6556 |
+ if (err) |
6557 |
+ goto free_copy; |
6558 |
+ |
6559 |
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
6560 |
+index 9d724c0383d2..88b472bec71d 100644 |
6561 |
+--- a/mm/hugetlb.c |
6562 |
++++ b/mm/hugetlb.c |
6563 |
+@@ -1756,6 +1756,10 @@ static unsigned long set_max_huge_pages(struct hstate *h, unsigned long count, |
6564 |
+ * and reducing the surplus. |
6565 |
+ */ |
6566 |
+ spin_unlock(&hugetlb_lock); |
6567 |
++ |
6568 |
++ /* yield cpu to avoid soft lockup */ |
6569 |
++ cond_resched(); |
6570 |
++ |
6571 |
+ if (hstate_is_gigantic(h)) |
6572 |
+ ret = alloc_fresh_gigantic_page(h, nodes_allowed); |
6573 |
+ else |
6574 |
+diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c |
6575 |
+index a7278f05eafb..289c96d3e47d 100644 |
6576 |
+--- a/net/bluetooth/l2cap_sock.c |
6577 |
++++ b/net/bluetooth/l2cap_sock.c |
6578 |
+@@ -927,7 +927,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, |
6579 |
+ break; |
6580 |
+ } |
6581 |
+ |
6582 |
+- if (get_user(opt, (u32 __user *) optval)) { |
6583 |
++ if (get_user(opt, (u16 __user *) optval)) { |
6584 |
+ err = -EFAULT; |
6585 |
+ break; |
6586 |
+ } |
6587 |
+diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c |
6588 |
+index 9a1edcde4ba5..eca46d3d3ff3 100644 |
6589 |
+--- a/net/irda/af_irda.c |
6590 |
++++ b/net/irda/af_irda.c |
6591 |
+@@ -1024,8 +1024,11 @@ static int irda_connect(struct socket *sock, struct sockaddr *uaddr, |
6592 |
+ } |
6593 |
+ |
6594 |
+ /* Check if we have opened a local TSAP */ |
6595 |
+- if (!self->tsap) |
6596 |
+- irda_open_tsap(self, LSAP_ANY, addr->sir_name); |
6597 |
++ if (!self->tsap) { |
6598 |
++ err = irda_open_tsap(self, LSAP_ANY, addr->sir_name); |
6599 |
++ if (err) |
6600 |
++ goto out; |
6601 |
++ } |
6602 |
+ |
6603 |
+ /* Move to connecting socket, start sending Connect Requests */ |
6604 |
+ sock->state = SS_CONNECTING; |
6605 |
+diff --git a/net/netfilter/nf_nat_redirect.c b/net/netfilter/nf_nat_redirect.c |
6606 |
+index 97b75f9bfbcd..d43869879fcf 100644 |
6607 |
+--- a/net/netfilter/nf_nat_redirect.c |
6608 |
++++ b/net/netfilter/nf_nat_redirect.c |
6609 |
+@@ -55,7 +55,7 @@ nf_nat_redirect_ipv4(struct sk_buff *skb, |
6610 |
+ |
6611 |
+ rcu_read_lock(); |
6612 |
+ indev = __in_dev_get_rcu(skb->dev); |
6613 |
+- if (indev != NULL) { |
6614 |
++ if (indev && indev->ifa_list) { |
6615 |
+ ifa = indev->ifa_list; |
6616 |
+ newdst = ifa->ifa_local; |
6617 |
+ } |
6618 |
+diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c |
6619 |
+index 28cddc85b700..bfa2b6d5b5cf 100644 |
6620 |
+--- a/net/netlabel/netlabel_kapi.c |
6621 |
++++ b/net/netlabel/netlabel_kapi.c |
6622 |
+@@ -824,7 +824,11 @@ socket_setattr_return: |
6623 |
+ */ |
6624 |
+ void netlbl_sock_delattr(struct sock *sk) |
6625 |
+ { |
6626 |
+- cipso_v4_sock_delattr(sk); |
6627 |
++ switch (sk->sk_family) { |
6628 |
++ case AF_INET: |
6629 |
++ cipso_v4_sock_delattr(sk); |
6630 |
++ break; |
6631 |
++ } |
6632 |
+ } |
6633 |
+ |
6634 |
+ /** |
6635 |
+@@ -987,7 +991,11 @@ req_setattr_return: |
6636 |
+ */ |
6637 |
+ void netlbl_req_delattr(struct request_sock *req) |
6638 |
+ { |
6639 |
+- cipso_v4_req_delattr(req); |
6640 |
++ switch (req->rsk_ops->family) { |
6641 |
++ case AF_INET: |
6642 |
++ cipso_v4_req_delattr(req); |
6643 |
++ break; |
6644 |
++ } |
6645 |
+ } |
6646 |
+ |
6647 |
+ /** |
6648 |
+diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c |
6649 |
+index e00bcd129336..5dffe37f300e 100644 |
6650 |
+--- a/scripts/recordmcount.c |
6651 |
++++ b/scripts/recordmcount.c |
6652 |
+@@ -33,10 +33,17 @@ |
6653 |
+ #include <string.h> |
6654 |
+ #include <unistd.h> |
6655 |
+ |
6656 |
++/* |
6657 |
++ * glibc synced up and added the metag number but didn't add the relocations. |
6658 |
++ * Work around this in a crude manner for now. |
6659 |
++ */ |
6660 |
+ #ifndef EM_METAG |
6661 |
+-/* Remove this when these make it to the standard system elf.h. */ |
6662 |
+ #define EM_METAG 174 |
6663 |
++#endif |
6664 |
++#ifndef R_METAG_ADDR32 |
6665 |
+ #define R_METAG_ADDR32 2 |
6666 |
++#endif |
6667 |
++#ifndef R_METAG_NONE |
6668 |
+ #define R_METAG_NONE 3 |
6669 |
+ #endif |
6670 |
+ |
6671 |
+diff --git a/sound/core/timer.c b/sound/core/timer.c |
6672 |
+index 7e3020c1e9d3..43e785a79eb3 100644 |
6673 |
+--- a/sound/core/timer.c |
6674 |
++++ b/sound/core/timer.c |
6675 |
+@@ -1247,6 +1247,7 @@ static void snd_timer_user_ccallback(struct snd_timer_instance *timeri, |
6676 |
+ tu->tstamp = *tstamp; |
6677 |
+ if ((tu->filter & (1 << event)) == 0 || !tu->tread) |
6678 |
+ return; |
6679 |
++ memset(&r1, 0, sizeof(r1)); |
6680 |
+ r1.event = event; |
6681 |
+ r1.tstamp = *tstamp; |
6682 |
+ r1.val = resolution; |
6683 |
+@@ -1281,6 +1282,7 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri, |
6684 |
+ } |
6685 |
+ if ((tu->filter & (1 << SNDRV_TIMER_EVENT_RESOLUTION)) && |
6686 |
+ tu->last_resolution != resolution) { |
6687 |
++ memset(&r1, 0, sizeof(r1)); |
6688 |
+ r1.event = SNDRV_TIMER_EVENT_RESOLUTION; |
6689 |
+ r1.tstamp = tstamp; |
6690 |
+ r1.val = resolution; |
6691 |
+@@ -1746,6 +1748,7 @@ static int snd_timer_user_params(struct file *file, |
6692 |
+ if (tu->timeri->flags & SNDRV_TIMER_IFLG_EARLY_EVENT) { |
6693 |
+ if (tu->tread) { |
6694 |
+ struct snd_timer_tread tread; |
6695 |
++ memset(&tread, 0, sizeof(tread)); |
6696 |
+ tread.event = SNDRV_TIMER_EVENT_EARLY; |
6697 |
+ tread.tstamp.tv_sec = 0; |
6698 |
+ tread.tstamp.tv_nsec = 0; |
6699 |
+diff --git a/sound/hda/array.c b/sound/hda/array.c |
6700 |
+index 516795baa7db..5dfa610e4471 100644 |
6701 |
+--- a/sound/hda/array.c |
6702 |
++++ b/sound/hda/array.c |
6703 |
+@@ -21,13 +21,15 @@ void *snd_array_new(struct snd_array *array) |
6704 |
+ return NULL; |
6705 |
+ if (array->used >= array->alloced) { |
6706 |
+ int num = array->alloced + array->alloc_align; |
6707 |
++ int oldsize = array->alloced * array->elem_size; |
6708 |
+ int size = (num + 1) * array->elem_size; |
6709 |
+ void *nlist; |
6710 |
+ if (snd_BUG_ON(num >= 4096)) |
6711 |
+ return NULL; |
6712 |
+- nlist = krealloc(array->list, size, GFP_KERNEL | __GFP_ZERO); |
6713 |
++ nlist = krealloc(array->list, size, GFP_KERNEL); |
6714 |
+ if (!nlist) |
6715 |
+ return NULL; |
6716 |
++ memset(nlist + oldsize, 0, size - oldsize); |
6717 |
+ array->list = nlist; |
6718 |
+ array->alloced = num; |
6719 |
+ } |
6720 |
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
6721 |
+index f24a69db0dd8..c8506496826a 100644 |
6722 |
+--- a/sound/pci/hda/hda_intel.c |
6723 |
++++ b/sound/pci/hda/hda_intel.c |
6724 |
+@@ -2114,6 +2114,8 @@ static const struct pci_device_id azx_ids[] = { |
6725 |
+ { PCI_DEVICE(0x1022, 0x780d), |
6726 |
+ .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB }, |
6727 |
+ /* ATI HDMI */ |
6728 |
++ { PCI_DEVICE(0x1002, 0x0002), |
6729 |
++ .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
6730 |
+ { PCI_DEVICE(0x1002, 0x1308), |
6731 |
+ .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
6732 |
+ { PCI_DEVICE(0x1002, 0x157a), |
6733 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
6734 |
+index b3234321aa4b..429697a93a71 100644 |
6735 |
+--- a/sound/pci/hda/patch_realtek.c |
6736 |
++++ b/sound/pci/hda/patch_realtek.c |
6737 |
+@@ -4584,6 +4584,71 @@ static void alc290_fixup_mono_speakers(struct hda_codec *codec, |
6738 |
+ } |
6739 |
+ } |
6740 |
+ |
6741 |
++static void alc298_fixup_speaker_volume(struct hda_codec *codec, |
6742 |
++ const struct hda_fixup *fix, int action) |
6743 |
++{ |
6744 |
++ if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
6745 |
++ /* The speaker is routed to the Node 0x06 by a mistake, as a result |
6746 |
++ we can't adjust the speaker's volume since this node does not has |
6747 |
++ Amp-out capability. we change the speaker's route to: |
6748 |
++ Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 ( |
6749 |
++ Pin Complex), since Node 0x02 has Amp-out caps, we can adjust |
6750 |
++ speaker's volume now. */ |
6751 |
++ |
6752 |
++ hda_nid_t conn1[1] = { 0x0c }; |
6753 |
++ snd_hda_override_conn_list(codec, 0x17, 1, conn1); |
6754 |
++ } |
6755 |
++} |
6756 |
++ |
6757 |
++/* Hook to update amp GPIO4 for automute */ |
6758 |
++static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, |
6759 |
++ struct hda_jack_callback *jack) |
6760 |
++{ |
6761 |
++ struct alc_spec *spec = codec->spec; |
6762 |
++ |
6763 |
++ snd_hda_gen_hp_automute(codec, jack); |
6764 |
++ /* mute_led_polarity is set to 0, so we pass inverted value here */ |
6765 |
++ alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present); |
6766 |
++} |
6767 |
++ |
6768 |
++/* Manage GPIOs for HP EliteBook Folio 9480m. |
6769 |
++ * |
6770 |
++ * GPIO4 is the headphone amplifier power control |
6771 |
++ * GPIO3 is the audio output mute indicator LED |
6772 |
++ */ |
6773 |
++ |
6774 |
++static void alc280_fixup_hp_9480m(struct hda_codec *codec, |
6775 |
++ const struct hda_fixup *fix, |
6776 |
++ int action) |
6777 |
++{ |
6778 |
++ struct alc_spec *spec = codec->spec; |
6779 |
++ static const struct hda_verb gpio_init[] = { |
6780 |
++ { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 }, |
6781 |
++ { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 }, |
6782 |
++ {} |
6783 |
++ }; |
6784 |
++ |
6785 |
++ if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
6786 |
++ /* Set the hooks to turn the headphone amp on/off |
6787 |
++ * as needed |
6788 |
++ */ |
6789 |
++ spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; |
6790 |
++ spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook; |
6791 |
++ |
6792 |
++ /* The GPIOs are currently off */ |
6793 |
++ spec->gpio_led = 0; |
6794 |
++ |
6795 |
++ /* GPIO3 is connected to the output mute LED, |
6796 |
++ * high is on, low is off |
6797 |
++ */ |
6798 |
++ spec->mute_led_polarity = 0; |
6799 |
++ spec->gpio_mute_led_mask = 0x08; |
6800 |
++ |
6801 |
++ /* Initialize GPIO configuration */ |
6802 |
++ snd_hda_add_verbs(codec, gpio_init); |
6803 |
++ } |
6804 |
++} |
6805 |
++ |
6806 |
+ /* for hda_fixup_thinkpad_acpi() */ |
6807 |
+ #include "thinkpad_helper.c" |
6808 |
+ |
6809 |
+@@ -4665,6 +4730,7 @@ enum { |
6810 |
+ ALC286_FIXUP_HP_GPIO_LED, |
6811 |
+ ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, |
6812 |
+ ALC280_FIXUP_HP_DOCK_PINS, |
6813 |
++ ALC280_FIXUP_HP_9480M, |
6814 |
+ ALC288_FIXUP_DELL_HEADSET_MODE, |
6815 |
+ ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, |
6816 |
+ ALC288_FIXUP_DELL_XPS_13_GPIO6, |
6817 |
+@@ -4683,6 +4749,7 @@ enum { |
6818 |
+ ALC280_FIXUP_HP_HEADSET_MIC, |
6819 |
+ ALC221_FIXUP_HP_FRONT_MIC, |
6820 |
+ ALC292_FIXUP_TPT460, |
6821 |
++ ALC298_FIXUP_SPK_VOLUME, |
6822 |
+ }; |
6823 |
+ |
6824 |
+ static const struct hda_fixup alc269_fixups[] = { |
6825 |
+@@ -5199,6 +5266,10 @@ static const struct hda_fixup alc269_fixups[] = { |
6826 |
+ .chained = true, |
6827 |
+ .chain_id = ALC280_FIXUP_HP_GPIO4 |
6828 |
+ }, |
6829 |
++ [ALC280_FIXUP_HP_9480M] = { |
6830 |
++ .type = HDA_FIXUP_FUNC, |
6831 |
++ .v.func = alc280_fixup_hp_9480m, |
6832 |
++ }, |
6833 |
+ [ALC288_FIXUP_DELL_HEADSET_MODE] = { |
6834 |
+ .type = HDA_FIXUP_FUNC, |
6835 |
+ .v.func = alc_fixup_headset_mode_dell_alc288, |
6836 |
+@@ -5334,6 +5405,12 @@ static const struct hda_fixup alc269_fixups[] = { |
6837 |
+ .chained = true, |
6838 |
+ .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE, |
6839 |
+ }, |
6840 |
++ [ALC298_FIXUP_SPK_VOLUME] = { |
6841 |
++ .type = HDA_FIXUP_FUNC, |
6842 |
++ .v.func = alc298_fixup_speaker_volume, |
6843 |
++ .chained = true, |
6844 |
++ .chain_id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, |
6845 |
++ }, |
6846 |
+ }; |
6847 |
+ |
6848 |
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
6849 |
+@@ -5380,6 +5457,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
6850 |
+ SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), |
6851 |
+ SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE), |
6852 |
+ SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), |
6853 |
++ SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME), |
6854 |
+ SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
6855 |
+ SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
6856 |
+ SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), |
6857 |
+@@ -5407,6 +5485,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
6858 |
+ SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
6859 |
+ SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
6860 |
+ SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
6861 |
++ SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M), |
6862 |
+ SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
6863 |
+ SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
6864 |
+ /* ALC290 */ |
6865 |
+@@ -5700,6 +5779,32 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { |
6866 |
+ {0x1e, 0x411111f0}, |
6867 |
+ {0x21, 0x0221103f}), |
6868 |
+ SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
6869 |
++ {0x12, 0x40000000}, |
6870 |
++ {0x14, 0x90170130}, |
6871 |
++ {0x1b, 0x02011020}, |
6872 |
++ {0x21, 0x0221103f}), |
6873 |
++ SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
6874 |
++ {0x14, 0x90170150}, |
6875 |
++ {0x17, 0x411111f0}, |
6876 |
++ {0x18, 0x411111f0}, |
6877 |
++ {0x19, 0x411111f0}, |
6878 |
++ {0x1a, 0x411111f0}, |
6879 |
++ {0x1b, 0x02011020}, |
6880 |
++ {0x1d, 0x4054c029}, |
6881 |
++ {0x1e, 0x411111f0}, |
6882 |
++ {0x21, 0x0221105f}), |
6883 |
++ SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
6884 |
++ {0x12, 0x40000000}, |
6885 |
++ {0x14, 0x90170110}, |
6886 |
++ {0x17, 0x411111f0}, |
6887 |
++ {0x18, 0x411111f0}, |
6888 |
++ {0x19, 0x411111f0}, |
6889 |
++ {0x1a, 0x411111f0}, |
6890 |
++ {0x1b, 0x01014020}, |
6891 |
++ {0x1d, 0x4054c029}, |
6892 |
++ {0x1e, 0x411111f0}, |
6893 |
++ {0x21, 0x0221101f}), |
6894 |
++ SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
6895 |
+ {0x12, 0x90a60160}, |
6896 |
+ {0x14, 0x90170120}, |
6897 |
+ {0x17, 0x90170140}, |
6898 |
+diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c |
6899 |
+index d93deb5ce4f2..f9746f29f870 100644 |
6900 |
+--- a/virt/kvm/kvm_main.c |
6901 |
++++ b/virt/kvm/kvm_main.c |
6902 |
+@@ -134,6 +134,7 @@ int vcpu_load(struct kvm_vcpu *vcpu) |
6903 |
+ put_cpu(); |
6904 |
+ return 0; |
6905 |
+ } |
6906 |
++EXPORT_SYMBOL_GPL(vcpu_load); |
6907 |
+ |
6908 |
+ void vcpu_put(struct kvm_vcpu *vcpu) |
6909 |
+ { |
6910 |
+@@ -143,6 +144,7 @@ void vcpu_put(struct kvm_vcpu *vcpu) |
6911 |
+ preempt_enable(); |
6912 |
+ mutex_unlock(&vcpu->mutex); |
6913 |
+ } |
6914 |
++EXPORT_SYMBOL_GPL(vcpu_put); |
6915 |
+ |
6916 |
+ static void ack_flush(void *_completed) |
6917 |
+ { |