1 |
Author: mpagano |
2 |
Date: 2013-05-19 19:19:44 +0000 (Sun, 19 May 2013) |
3 |
New Revision: 2379 |
4 |
|
5 |
Added: |
6 |
genpatches-2.6/trunk/3.9/1002_linux-3.9.3.patch |
7 |
Modified: |
8 |
genpatches-2.6/trunk/3.9/0000_README |
9 |
Log: |
10 |
Linux patch 3.9.3 |
11 |
|
12 |
Modified: genpatches-2.6/trunk/3.9/0000_README |
13 |
=================================================================== |
14 |
--- genpatches-2.6/trunk/3.9/0000_README 2013-05-14 17:25:20 UTC (rev 2378) |
15 |
+++ genpatches-2.6/trunk/3.9/0000_README 2013-05-19 19:19:44 UTC (rev 2379) |
16 |
@@ -47,6 +47,10 @@ |
17 |
From: http://www.kernel.org |
18 |
Desc: Linux 3.9.2 |
19 |
|
20 |
+Patch: 1002_linux-3.9.3.patch |
21 |
+From: http://www.kernel.org |
22 |
+Desc: Linux 3.9.3 |
23 |
+ |
24 |
Patch: 1700_enable-thinkpad-micled.patch |
25 |
From: https://bugs.gentoo.org/show_bug.cgi?id=449248 |
26 |
Desc: Enable mic mute led in thinkpads |
27 |
|
28 |
Added: genpatches-2.6/trunk/3.9/1002_linux-3.9.3.patch |
29 |
=================================================================== |
30 |
--- genpatches-2.6/trunk/3.9/1002_linux-3.9.3.patch (rev 0) |
31 |
+++ genpatches-2.6/trunk/3.9/1002_linux-3.9.3.patch 2013-05-19 19:19:44 UTC (rev 2379) |
32 |
@@ -0,0 +1,3755 @@ |
33 |
+diff --git a/Makefile b/Makefile |
34 |
+index 3e71511..01003d4 100644 |
35 |
+--- a/Makefile |
36 |
++++ b/Makefile |
37 |
+@@ -1,6 +1,6 @@ |
38 |
+ VERSION = 3 |
39 |
+ PATCHLEVEL = 9 |
40 |
+-SUBLEVEL = 2 |
41 |
++SUBLEVEL = 3 |
42 |
+ EXTRAVERSION = |
43 |
+ NAME = Unicycling Gorilla |
44 |
+ |
45 |
+diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h |
46 |
+index 7eb18c1..4f009c1 100644 |
47 |
+--- a/arch/arm/include/asm/cmpxchg.h |
48 |
++++ b/arch/arm/include/asm/cmpxchg.h |
49 |
+@@ -233,15 +233,15 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr, |
50 |
+ ((__typeof__(*(ptr)))atomic64_cmpxchg(container_of((ptr), \ |
51 |
+ atomic64_t, \ |
52 |
+ counter), \ |
53 |
+- (unsigned long)(o), \ |
54 |
+- (unsigned long)(n))) |
55 |
++ (unsigned long long)(o), \ |
56 |
++ (unsigned long long)(n))) |
57 |
+ |
58 |
+ #define cmpxchg64_local(ptr, o, n) \ |
59 |
+ ((__typeof__(*(ptr)))local64_cmpxchg(container_of((ptr), \ |
60 |
+ local64_t, \ |
61 |
+ a), \ |
62 |
+- (unsigned long)(o), \ |
63 |
+- (unsigned long)(n))) |
64 |
++ (unsigned long long)(o), \ |
65 |
++ (unsigned long long)(n))) |
66 |
+ |
67 |
+ #endif /* __LINUX_ARM_ARCH__ >= 6 */ |
68 |
+ |
69 |
+diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h b/arch/arm/mach-exynos/include/mach/regs-pmu.h |
70 |
+index 3f30aa1..57344b7 100644 |
71 |
+--- a/arch/arm/mach-exynos/include/mach/regs-pmu.h |
72 |
++++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h |
73 |
+@@ -344,6 +344,7 @@ |
74 |
+ #define EXYNOS5_FSYS_ARM_OPTION S5P_PMUREG(0x2208) |
75 |
+ #define EXYNOS5_ISP_ARM_OPTION S5P_PMUREG(0x2288) |
76 |
+ #define EXYNOS5_ARM_COMMON_OPTION S5P_PMUREG(0x2408) |
77 |
++#define EXYNOS5_ARM_L2_OPTION S5P_PMUREG(0x2608) |
78 |
+ #define EXYNOS5_TOP_PWR_OPTION S5P_PMUREG(0x2C48) |
79 |
+ #define EXYNOS5_TOP_PWR_SYSMEM_OPTION S5P_PMUREG(0x2CC8) |
80 |
+ #define EXYNOS5_JPEG_MEM_OPTION S5P_PMUREG(0x2F48) |
81 |
+diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c |
82 |
+index daebc1a..97d6885 100644 |
83 |
+--- a/arch/arm/mach-exynos/pmu.c |
84 |
++++ b/arch/arm/mach-exynos/pmu.c |
85 |
+@@ -228,6 +228,7 @@ static struct exynos_pmu_conf exynos5250_pmu_config[] = { |
86 |
+ { EXYNOS5_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, |
87 |
+ { EXYNOS5_ARM_COMMON_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, |
88 |
+ { EXYNOS5_ARM_L2_SYS_PWR_REG, { 0x3, 0x3, 0x3} }, |
89 |
++ { EXYNOS5_ARM_L2_OPTION, { 0x10, 0x10, 0x0 } }, |
90 |
+ { EXYNOS5_CMU_ACLKSTOP_SYS_PWR_REG, { 0x1, 0x0, 0x1} }, |
91 |
+ { EXYNOS5_CMU_SCLKSTOP_SYS_PWR_REG, { 0x1, 0x0, 0x1} }, |
92 |
+ { EXYNOS5_CMU_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, |
93 |
+@@ -353,11 +354,9 @@ static void exynos5_init_pmu(void) |
94 |
+ |
95 |
+ /* |
96 |
+ * SKIP_DEACTIVATE_ACEACP_IN_PWDN_BITFIELD Enable |
97 |
+- * MANUAL_L2RSTDISABLE_CONTROL_BITFIELD Enable |
98 |
+ */ |
99 |
+ tmp = __raw_readl(EXYNOS5_ARM_COMMON_OPTION); |
100 |
+- tmp |= (EXYNOS5_MANUAL_L2RSTDISABLE_CONTROL | |
101 |
+- EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN); |
102 |
++ tmp |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN; |
103 |
+ __raw_writel(tmp, EXYNOS5_ARM_COMMON_OPTION); |
104 |
+ |
105 |
+ /* |
106 |
+diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c |
107 |
+index 3a077df..9bc9f19 100644 |
108 |
+--- a/arch/arm/mach-omap2/board-rx51-peripherals.c |
109 |
++++ b/arch/arm/mach-omap2/board-rx51-peripherals.c |
110 |
+@@ -73,11 +73,11 @@ |
111 |
+ #define LIS302_IRQ1_GPIO 181 |
112 |
+ #define LIS302_IRQ2_GPIO 180 /* Not yet in use */ |
113 |
+ |
114 |
+-/* list all spi devices here */ |
115 |
++/* List all SPI devices here. Note that the list/probe order seems to matter! */ |
116 |
+ enum { |
117 |
+ RX51_SPI_WL1251, |
118 |
+- RX51_SPI_MIPID, /* LCD panel */ |
119 |
+ RX51_SPI_TSC2005, /* Touch Controller */ |
120 |
++ RX51_SPI_MIPID, /* LCD panel */ |
121 |
+ }; |
122 |
+ |
123 |
+ static struct wl12xx_platform_data wl1251_pdata; |
124 |
+diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile |
125 |
+index 113e282..1976900 100644 |
126 |
+--- a/arch/parisc/Makefile |
127 |
++++ b/arch/parisc/Makefile |
128 |
+@@ -23,26 +23,21 @@ NM = sh $(srctree)/arch/parisc/nm |
129 |
+ CHECKFLAGS += -D__hppa__=1 |
130 |
+ LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
131 |
+ |
132 |
+-MACHINE := $(shell uname -m) |
133 |
+-ifeq ($(MACHINE),parisc*) |
134 |
+-NATIVE := 1 |
135 |
+-endif |
136 |
+- |
137 |
+ ifdef CONFIG_64BIT |
138 |
+ UTS_MACHINE := parisc64 |
139 |
+ CHECKFLAGS += -D__LP64__=1 -m64 |
140 |
+-WIDTH := 64 |
141 |
++CC_ARCHES = hppa64 |
142 |
+ else # 32-bit |
143 |
+-WIDTH := |
144 |
++CC_ARCHES = hppa hppa2.0 hppa1.1 |
145 |
+ endif |
146 |
+ |
147 |
+-# attempt to help out folks who are cross-compiling |
148 |
+-ifeq ($(NATIVE),1) |
149 |
+-CROSS_COMPILE := hppa$(WIDTH)-linux- |
150 |
+-else |
151 |
+- ifeq ($(CROSS_COMPILE),) |
152 |
+- CROSS_COMPILE := hppa$(WIDTH)-linux-gnu- |
153 |
+- endif |
154 |
++ifneq ($(SUBARCH),$(UTS_MACHINE)) |
155 |
++ ifeq ($(CROSS_COMPILE),) |
156 |
++ CC_SUFFIXES = linux linux-gnu unknown-linux-gnu |
157 |
++ CROSS_COMPILE := $(call cc-cross-prefix, \ |
158 |
++ $(foreach a,$(CC_ARCHES), \ |
159 |
++ $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) |
160 |
++ endif |
161 |
+ endif |
162 |
+ |
163 |
+ OBJCOPY_FLAGS =-O binary -R .note -R .comment -S |
164 |
+diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S |
165 |
+index f33201b..897bce4 100644 |
166 |
+--- a/arch/parisc/kernel/entry.S |
167 |
++++ b/arch/parisc/kernel/entry.S |
168 |
+@@ -444,9 +444,41 @@ |
169 |
+ L2_ptep \pgd,\pte,\index,\va,\fault |
170 |
+ .endm |
171 |
+ |
172 |
++ /* Acquire pa_dbit_lock lock. */ |
173 |
++ .macro dbit_lock spc,tmp,tmp1 |
174 |
++#ifdef CONFIG_SMP |
175 |
++ cmpib,COND(=),n 0,\spc,2f |
176 |
++ load32 PA(pa_dbit_lock),\tmp |
177 |
++1: LDCW 0(\tmp),\tmp1 |
178 |
++ cmpib,COND(=) 0,\tmp1,1b |
179 |
++ nop |
180 |
++2: |
181 |
++#endif |
182 |
++ .endm |
183 |
++ |
184 |
++ /* Release pa_dbit_lock lock without reloading lock address. */ |
185 |
++ .macro dbit_unlock0 spc,tmp |
186 |
++#ifdef CONFIG_SMP |
187 |
++ or,COND(=) %r0,\spc,%r0 |
188 |
++ stw \spc,0(\tmp) |
189 |
++#endif |
190 |
++ .endm |
191 |
++ |
192 |
++ /* Release pa_dbit_lock lock. */ |
193 |
++ .macro dbit_unlock1 spc,tmp |
194 |
++#ifdef CONFIG_SMP |
195 |
++ load32 PA(pa_dbit_lock),\tmp |
196 |
++ dbit_unlock0 \spc,\tmp |
197 |
++#endif |
198 |
++ .endm |
199 |
++ |
200 |
+ /* Set the _PAGE_ACCESSED bit of the PTE. Be clever and |
201 |
+ * don't needlessly dirty the cache line if it was already set */ |
202 |
+- .macro update_ptep ptep,pte,tmp,tmp1 |
203 |
++ .macro update_ptep spc,ptep,pte,tmp,tmp1 |
204 |
++#ifdef CONFIG_SMP |
205 |
++ or,COND(=) %r0,\spc,%r0 |
206 |
++ LDREG 0(\ptep),\pte |
207 |
++#endif |
208 |
+ ldi _PAGE_ACCESSED,\tmp1 |
209 |
+ or \tmp1,\pte,\tmp |
210 |
+ and,COND(<>) \tmp1,\pte,%r0 |
211 |
+@@ -455,7 +487,11 @@ |
212 |
+ |
213 |
+ /* Set the dirty bit (and accessed bit). No need to be |
214 |
+ * clever, this is only used from the dirty fault */ |
215 |
+- .macro update_dirty ptep,pte,tmp |
216 |
++ .macro update_dirty spc,ptep,pte,tmp |
217 |
++#ifdef CONFIG_SMP |
218 |
++ or,COND(=) %r0,\spc,%r0 |
219 |
++ LDREG 0(\ptep),\pte |
220 |
++#endif |
221 |
+ ldi _PAGE_ACCESSED|_PAGE_DIRTY,\tmp |
222 |
+ or \tmp,\pte,\pte |
223 |
+ STREG \pte,0(\ptep) |
224 |
+@@ -825,11 +861,6 @@ ENTRY(syscall_exit_rfi) |
225 |
+ STREG %r19,PT_SR7(%r16) |
226 |
+ |
227 |
+ intr_return: |
228 |
+- /* NOTE: Need to enable interrupts incase we schedule. */ |
229 |
+- ssm PSW_SM_I, %r0 |
230 |
+- |
231 |
+-intr_check_resched: |
232 |
+- |
233 |
+ /* check for reschedule */ |
234 |
+ mfctl %cr30,%r1 |
235 |
+ LDREG TI_FLAGS(%r1),%r19 /* sched.h: TIF_NEED_RESCHED */ |
236 |
+@@ -856,6 +887,11 @@ intr_check_sig: |
237 |
+ LDREG PT_IASQ1(%r16), %r20 |
238 |
+ cmpib,COND(=),n 0,%r20,intr_restore /* backward */ |
239 |
+ |
240 |
++ /* NOTE: We need to enable interrupts if we have to deliver |
241 |
++ * signals. We used to do this earlier but it caused kernel |
242 |
++ * stack overflows. */ |
243 |
++ ssm PSW_SM_I, %r0 |
244 |
++ |
245 |
+ copy %r0, %r25 /* long in_syscall = 0 */ |
246 |
+ #ifdef CONFIG_64BIT |
247 |
+ ldo -16(%r30),%r29 /* Reference param save area */ |
248 |
+@@ -907,6 +943,10 @@ intr_do_resched: |
249 |
+ cmpib,COND(=) 0, %r20, intr_do_preempt |
250 |
+ nop |
251 |
+ |
252 |
++ /* NOTE: We need to enable interrupts if we schedule. We used |
253 |
++ * to do this earlier but it caused kernel stack overflows. */ |
254 |
++ ssm PSW_SM_I, %r0 |
255 |
++ |
256 |
+ #ifdef CONFIG_64BIT |
257 |
+ ldo -16(%r30),%r29 /* Reference param save area */ |
258 |
+ #endif |
259 |
+@@ -1099,11 +1139,13 @@ dtlb_miss_20w: |
260 |
+ |
261 |
+ L3_ptep ptp,pte,t0,va,dtlb_check_alias_20w |
262 |
+ |
263 |
+- update_ptep ptp,pte,t0,t1 |
264 |
++ dbit_lock spc,t0,t1 |
265 |
++ update_ptep spc,ptp,pte,t0,t1 |
266 |
+ |
267 |
+ make_insert_tlb spc,pte,prot |
268 |
+ |
269 |
+ idtlbt pte,prot |
270 |
++ dbit_unlock1 spc,t0 |
271 |
+ |
272 |
+ rfir |
273 |
+ nop |
274 |
+@@ -1123,11 +1165,13 @@ nadtlb_miss_20w: |
275 |
+ |
276 |
+ L3_ptep ptp,pte,t0,va,nadtlb_check_alias_20w |
277 |
+ |
278 |
+- update_ptep ptp,pte,t0,t1 |
279 |
++ dbit_lock spc,t0,t1 |
280 |
++ update_ptep spc,ptp,pte,t0,t1 |
281 |
+ |
282 |
+ make_insert_tlb spc,pte,prot |
283 |
+ |
284 |
+ idtlbt pte,prot |
285 |
++ dbit_unlock1 spc,t0 |
286 |
+ |
287 |
+ rfir |
288 |
+ nop |
289 |
+@@ -1149,7 +1193,8 @@ dtlb_miss_11: |
290 |
+ |
291 |
+ L2_ptep ptp,pte,t0,va,dtlb_check_alias_11 |
292 |
+ |
293 |
+- update_ptep ptp,pte,t0,t1 |
294 |
++ dbit_lock spc,t0,t1 |
295 |
++ update_ptep spc,ptp,pte,t0,t1 |
296 |
+ |
297 |
+ make_insert_tlb_11 spc,pte,prot |
298 |
+ |
299 |
+@@ -1160,6 +1205,7 @@ dtlb_miss_11: |
300 |
+ idtlbp prot,(%sr1,va) |
301 |
+ |
302 |
+ mtsp t0, %sr1 /* Restore sr1 */ |
303 |
++ dbit_unlock1 spc,t0 |
304 |
+ |
305 |
+ rfir |
306 |
+ nop |
307 |
+@@ -1180,7 +1226,8 @@ nadtlb_miss_11: |
308 |
+ |
309 |
+ L2_ptep ptp,pte,t0,va,nadtlb_check_alias_11 |
310 |
+ |
311 |
+- update_ptep ptp,pte,t0,t1 |
312 |
++ dbit_lock spc,t0,t1 |
313 |
++ update_ptep spc,ptp,pte,t0,t1 |
314 |
+ |
315 |
+ make_insert_tlb_11 spc,pte,prot |
316 |
+ |
317 |
+@@ -1192,6 +1239,7 @@ nadtlb_miss_11: |
318 |
+ idtlbp prot,(%sr1,va) |
319 |
+ |
320 |
+ mtsp t0, %sr1 /* Restore sr1 */ |
321 |
++ dbit_unlock1 spc,t0 |
322 |
+ |
323 |
+ rfir |
324 |
+ nop |
325 |
+@@ -1212,13 +1260,15 @@ dtlb_miss_20: |
326 |
+ |
327 |
+ L2_ptep ptp,pte,t0,va,dtlb_check_alias_20 |
328 |
+ |
329 |
+- update_ptep ptp,pte,t0,t1 |
330 |
++ dbit_lock spc,t0,t1 |
331 |
++ update_ptep spc,ptp,pte,t0,t1 |
332 |
+ |
333 |
+ make_insert_tlb spc,pte,prot |
334 |
+ |
335 |
+ f_extend pte,t0 |
336 |
+ |
337 |
+ idtlbt pte,prot |
338 |
++ dbit_unlock1 spc,t0 |
339 |
+ |
340 |
+ rfir |
341 |
+ nop |
342 |
+@@ -1238,13 +1288,15 @@ nadtlb_miss_20: |
343 |
+ |
344 |
+ L2_ptep ptp,pte,t0,va,nadtlb_check_alias_20 |
345 |
+ |
346 |
+- update_ptep ptp,pte,t0,t1 |
347 |
++ dbit_lock spc,t0,t1 |
348 |
++ update_ptep spc,ptp,pte,t0,t1 |
349 |
+ |
350 |
+ make_insert_tlb spc,pte,prot |
351 |
+ |
352 |
+ f_extend pte,t0 |
353 |
+ |
354 |
+ idtlbt pte,prot |
355 |
++ dbit_unlock1 spc,t0 |
356 |
+ |
357 |
+ rfir |
358 |
+ nop |
359 |
+@@ -1345,11 +1397,13 @@ itlb_miss_20w: |
360 |
+ |
361 |
+ L3_ptep ptp,pte,t0,va,itlb_fault |
362 |
+ |
363 |
+- update_ptep ptp,pte,t0,t1 |
364 |
++ dbit_lock spc,t0,t1 |
365 |
++ update_ptep spc,ptp,pte,t0,t1 |
366 |
+ |
367 |
+ make_insert_tlb spc,pte,prot |
368 |
+ |
369 |
+ iitlbt pte,prot |
370 |
++ dbit_unlock1 spc,t0 |
371 |
+ |
372 |
+ rfir |
373 |
+ nop |
374 |
+@@ -1367,11 +1421,13 @@ naitlb_miss_20w: |
375 |
+ |
376 |
+ L3_ptep ptp,pte,t0,va,naitlb_check_alias_20w |
377 |
+ |
378 |
+- update_ptep ptp,pte,t0,t1 |
379 |
++ dbit_lock spc,t0,t1 |
380 |
++ update_ptep spc,ptp,pte,t0,t1 |
381 |
+ |
382 |
+ make_insert_tlb spc,pte,prot |
383 |
+ |
384 |
+ iitlbt pte,prot |
385 |
++ dbit_unlock1 spc,t0 |
386 |
+ |
387 |
+ rfir |
388 |
+ nop |
389 |
+@@ -1393,7 +1449,8 @@ itlb_miss_11: |
390 |
+ |
391 |
+ L2_ptep ptp,pte,t0,va,itlb_fault |
392 |
+ |
393 |
+- update_ptep ptp,pte,t0,t1 |
394 |
++ dbit_lock spc,t0,t1 |
395 |
++ update_ptep spc,ptp,pte,t0,t1 |
396 |
+ |
397 |
+ make_insert_tlb_11 spc,pte,prot |
398 |
+ |
399 |
+@@ -1404,6 +1461,7 @@ itlb_miss_11: |
400 |
+ iitlbp prot,(%sr1,va) |
401 |
+ |
402 |
+ mtsp t0, %sr1 /* Restore sr1 */ |
403 |
++ dbit_unlock1 spc,t0 |
404 |
+ |
405 |
+ rfir |
406 |
+ nop |
407 |
+@@ -1415,7 +1473,8 @@ naitlb_miss_11: |
408 |
+ |
409 |
+ L2_ptep ptp,pte,t0,va,naitlb_check_alias_11 |
410 |
+ |
411 |
+- update_ptep ptp,pte,t0,t1 |
412 |
++ dbit_lock spc,t0,t1 |
413 |
++ update_ptep spc,ptp,pte,t0,t1 |
414 |
+ |
415 |
+ make_insert_tlb_11 spc,pte,prot |
416 |
+ |
417 |
+@@ -1426,6 +1485,7 @@ naitlb_miss_11: |
418 |
+ iitlbp prot,(%sr1,va) |
419 |
+ |
420 |
+ mtsp t0, %sr1 /* Restore sr1 */ |
421 |
++ dbit_unlock1 spc,t0 |
422 |
+ |
423 |
+ rfir |
424 |
+ nop |
425 |
+@@ -1447,13 +1507,15 @@ itlb_miss_20: |
426 |
+ |
427 |
+ L2_ptep ptp,pte,t0,va,itlb_fault |
428 |
+ |
429 |
+- update_ptep ptp,pte,t0,t1 |
430 |
++ dbit_lock spc,t0,t1 |
431 |
++ update_ptep spc,ptp,pte,t0,t1 |
432 |
+ |
433 |
+ make_insert_tlb spc,pte,prot |
434 |
+ |
435 |
+ f_extend pte,t0 |
436 |
+ |
437 |
+ iitlbt pte,prot |
438 |
++ dbit_unlock1 spc,t0 |
439 |
+ |
440 |
+ rfir |
441 |
+ nop |
442 |
+@@ -1465,13 +1527,15 @@ naitlb_miss_20: |
443 |
+ |
444 |
+ L2_ptep ptp,pte,t0,va,naitlb_check_alias_20 |
445 |
+ |
446 |
+- update_ptep ptp,pte,t0,t1 |
447 |
++ dbit_lock spc,t0,t1 |
448 |
++ update_ptep spc,ptp,pte,t0,t1 |
449 |
+ |
450 |
+ make_insert_tlb spc,pte,prot |
451 |
+ |
452 |
+ f_extend pte,t0 |
453 |
+ |
454 |
+ iitlbt pte,prot |
455 |
++ dbit_unlock1 spc,t0 |
456 |
+ |
457 |
+ rfir |
458 |
+ nop |
459 |
+@@ -1495,29 +1559,13 @@ dbit_trap_20w: |
460 |
+ |
461 |
+ L3_ptep ptp,pte,t0,va,dbit_fault |
462 |
+ |
463 |
+-#ifdef CONFIG_SMP |
464 |
+- cmpib,COND(=),n 0,spc,dbit_nolock_20w |
465 |
+- load32 PA(pa_dbit_lock),t0 |
466 |
+- |
467 |
+-dbit_spin_20w: |
468 |
+- LDCW 0(t0),t1 |
469 |
+- cmpib,COND(=) 0,t1,dbit_spin_20w |
470 |
+- nop |
471 |
+- |
472 |
+-dbit_nolock_20w: |
473 |
+-#endif |
474 |
+- update_dirty ptp,pte,t1 |
475 |
++ dbit_lock spc,t0,t1 |
476 |
++ update_dirty spc,ptp,pte,t1 |
477 |
+ |
478 |
+ make_insert_tlb spc,pte,prot |
479 |
+ |
480 |
+ idtlbt pte,prot |
481 |
+-#ifdef CONFIG_SMP |
482 |
+- cmpib,COND(=),n 0,spc,dbit_nounlock_20w |
483 |
+- ldi 1,t1 |
484 |
+- stw t1,0(t0) |
485 |
+- |
486 |
+-dbit_nounlock_20w: |
487 |
+-#endif |
488 |
++ dbit_unlock0 spc,t0 |
489 |
+ |
490 |
+ rfir |
491 |
+ nop |
492 |
+@@ -1531,18 +1579,8 @@ dbit_trap_11: |
493 |
+ |
494 |
+ L2_ptep ptp,pte,t0,va,dbit_fault |
495 |
+ |
496 |
+-#ifdef CONFIG_SMP |
497 |
+- cmpib,COND(=),n 0,spc,dbit_nolock_11 |
498 |
+- load32 PA(pa_dbit_lock),t0 |
499 |
+- |
500 |
+-dbit_spin_11: |
501 |
+- LDCW 0(t0),t1 |
502 |
+- cmpib,= 0,t1,dbit_spin_11 |
503 |
+- nop |
504 |
+- |
505 |
+-dbit_nolock_11: |
506 |
+-#endif |
507 |
+- update_dirty ptp,pte,t1 |
508 |
++ dbit_lock spc,t0,t1 |
509 |
++ update_dirty spc,ptp,pte,t1 |
510 |
+ |
511 |
+ make_insert_tlb_11 spc,pte,prot |
512 |
+ |
513 |
+@@ -1553,13 +1591,7 @@ dbit_nolock_11: |
514 |
+ idtlbp prot,(%sr1,va) |
515 |
+ |
516 |
+ mtsp t1, %sr1 /* Restore sr1 */ |
517 |
+-#ifdef CONFIG_SMP |
518 |
+- cmpib,COND(=),n 0,spc,dbit_nounlock_11 |
519 |
+- ldi 1,t1 |
520 |
+- stw t1,0(t0) |
521 |
+- |
522 |
+-dbit_nounlock_11: |
523 |
+-#endif |
524 |
++ dbit_unlock0 spc,t0 |
525 |
+ |
526 |
+ rfir |
527 |
+ nop |
528 |
+@@ -1571,32 +1603,15 @@ dbit_trap_20: |
529 |
+ |
530 |
+ L2_ptep ptp,pte,t0,va,dbit_fault |
531 |
+ |
532 |
+-#ifdef CONFIG_SMP |
533 |
+- cmpib,COND(=),n 0,spc,dbit_nolock_20 |
534 |
+- load32 PA(pa_dbit_lock),t0 |
535 |
+- |
536 |
+-dbit_spin_20: |
537 |
+- LDCW 0(t0),t1 |
538 |
+- cmpib,= 0,t1,dbit_spin_20 |
539 |
+- nop |
540 |
+- |
541 |
+-dbit_nolock_20: |
542 |
+-#endif |
543 |
+- update_dirty ptp,pte,t1 |
544 |
++ dbit_lock spc,t0,t1 |
545 |
++ update_dirty spc,ptp,pte,t1 |
546 |
+ |
547 |
+ make_insert_tlb spc,pte,prot |
548 |
+ |
549 |
+ f_extend pte,t1 |
550 |
+ |
551 |
+ idtlbt pte,prot |
552 |
+- |
553 |
+-#ifdef CONFIG_SMP |
554 |
+- cmpib,COND(=),n 0,spc,dbit_nounlock_20 |
555 |
+- ldi 1,t1 |
556 |
+- stw t1,0(t0) |
557 |
+- |
558 |
+-dbit_nounlock_20: |
559 |
+-#endif |
560 |
++ dbit_unlock0 spc,t0 |
561 |
+ |
562 |
+ rfir |
563 |
+ nop |
564 |
+@@ -1694,7 +1709,8 @@ ENTRY(sys_\name\()_wrapper) |
565 |
+ ldo TASK_REGS(%r1),%r1 |
566 |
+ reg_save %r1 |
567 |
+ mfctl %cr27, %r28 |
568 |
+- b sys_\name |
569 |
++ ldil L%sys_\name, %r31 |
570 |
++ be R%sys_\name(%sr4,%r31) |
571 |
+ STREG %r28, PT_CR27(%r1) |
572 |
+ ENDPROC(sys_\name\()_wrapper) |
573 |
+ .endm |
574 |
+diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h |
575 |
+index aef00c6..ee38f29 100644 |
576 |
+--- a/arch/powerpc/include/asm/rtas.h |
577 |
++++ b/arch/powerpc/include/asm/rtas.h |
578 |
+@@ -262,6 +262,8 @@ extern void rtas_progress(char *s, unsigned short hex); |
579 |
+ extern void rtas_initialize(void); |
580 |
+ extern int rtas_suspend_cpu(struct rtas_suspend_me_data *data); |
581 |
+ extern int rtas_suspend_last_cpu(struct rtas_suspend_me_data *data); |
582 |
++extern int rtas_online_cpus_mask(cpumask_var_t cpus); |
583 |
++extern int rtas_offline_cpus_mask(cpumask_var_t cpus); |
584 |
+ extern int rtas_ibm_suspend_me(struct rtas_args *); |
585 |
+ |
586 |
+ struct rtc_time; |
587 |
+diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c |
588 |
+index 466a290..611acdf 100644 |
589 |
+--- a/arch/powerpc/kernel/machine_kexec_64.c |
590 |
++++ b/arch/powerpc/kernel/machine_kexec_64.c |
591 |
+@@ -17,6 +17,7 @@ |
592 |
+ #include <linux/errno.h> |
593 |
+ #include <linux/kernel.h> |
594 |
+ #include <linux/cpu.h> |
595 |
++#include <linux/hardirq.h> |
596 |
+ |
597 |
+ #include <asm/page.h> |
598 |
+ #include <asm/current.h> |
599 |
+@@ -335,10 +336,13 @@ void default_machine_kexec(struct kimage *image) |
600 |
+ pr_debug("kexec: Starting switchover sequence.\n"); |
601 |
+ |
602 |
+ /* switch to a staticly allocated stack. Based on irq stack code. |
603 |
++ * We setup preempt_count to avoid using VMX in memcpy. |
604 |
+ * XXX: the task struct will likely be invalid once we do the copy! |
605 |
+ */ |
606 |
+ kexec_stack.thread_info.task = current_thread_info()->task; |
607 |
+ kexec_stack.thread_info.flags = 0; |
608 |
++ kexec_stack.thread_info.preempt_count = HARDIRQ_OFFSET; |
609 |
++ kexec_stack.thread_info.cpu = current_thread_info()->cpu; |
610 |
+ |
611 |
+ /* We need a static PACA, too; copy this CPU's PACA over and switch to |
612 |
+ * it. Also poison per_cpu_offset to catch anyone using non-static |
613 |
+diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c |
614 |
+index 1fd6e7b..52add6f 100644 |
615 |
+--- a/arch/powerpc/kernel/rtas.c |
616 |
++++ b/arch/powerpc/kernel/rtas.c |
617 |
+@@ -19,6 +19,7 @@ |
618 |
+ #include <linux/init.h> |
619 |
+ #include <linux/capability.h> |
620 |
+ #include <linux/delay.h> |
621 |
++#include <linux/cpu.h> |
622 |
+ #include <linux/smp.h> |
623 |
+ #include <linux/completion.h> |
624 |
+ #include <linux/cpumask.h> |
625 |
+@@ -807,6 +808,95 @@ static void rtas_percpu_suspend_me(void *info) |
626 |
+ __rtas_suspend_cpu((struct rtas_suspend_me_data *)info, 1); |
627 |
+ } |
628 |
+ |
629 |
++enum rtas_cpu_state { |
630 |
++ DOWN, |
631 |
++ UP, |
632 |
++}; |
633 |
++ |
634 |
++#ifndef CONFIG_SMP |
635 |
++static int rtas_cpu_state_change_mask(enum rtas_cpu_state state, |
636 |
++ cpumask_var_t cpus) |
637 |
++{ |
638 |
++ if (!cpumask_empty(cpus)) { |
639 |
++ cpumask_clear(cpus); |
640 |
++ return -EINVAL; |
641 |
++ } else |
642 |
++ return 0; |
643 |
++} |
644 |
++#else |
645 |
++/* On return cpumask will be altered to indicate CPUs changed. |
646 |
++ * CPUs with states changed will be set in the mask, |
647 |
++ * CPUs with status unchanged will be unset in the mask. */ |
648 |
++static int rtas_cpu_state_change_mask(enum rtas_cpu_state state, |
649 |
++ cpumask_var_t cpus) |
650 |
++{ |
651 |
++ int cpu; |
652 |
++ int cpuret = 0; |
653 |
++ int ret = 0; |
654 |
++ |
655 |
++ if (cpumask_empty(cpus)) |
656 |
++ return 0; |
657 |
++ |
658 |
++ for_each_cpu(cpu, cpus) { |
659 |
++ switch (state) { |
660 |
++ case DOWN: |
661 |
++ cpuret = cpu_down(cpu); |
662 |
++ break; |
663 |
++ case UP: |
664 |
++ cpuret = cpu_up(cpu); |
665 |
++ break; |
666 |
++ } |
667 |
++ if (cpuret) { |
668 |
++ pr_debug("%s: cpu_%s for cpu#%d returned %d.\n", |
669 |
++ __func__, |
670 |
++ ((state == UP) ? "up" : "down"), |
671 |
++ cpu, cpuret); |
672 |
++ if (!ret) |
673 |
++ ret = cpuret; |
674 |
++ if (state == UP) { |
675 |
++ /* clear bits for unchanged cpus, return */ |
676 |
++ cpumask_shift_right(cpus, cpus, cpu); |
677 |
++ cpumask_shift_left(cpus, cpus, cpu); |
678 |
++ break; |
679 |
++ } else { |
680 |
++ /* clear bit for unchanged cpu, continue */ |
681 |
++ cpumask_clear_cpu(cpu, cpus); |
682 |
++ } |
683 |
++ } |
684 |
++ } |
685 |
++ |
686 |
++ return ret; |
687 |
++} |
688 |
++#endif |
689 |
++ |
690 |
++int rtas_online_cpus_mask(cpumask_var_t cpus) |
691 |
++{ |
692 |
++ int ret; |
693 |
++ |
694 |
++ ret = rtas_cpu_state_change_mask(UP, cpus); |
695 |
++ |
696 |
++ if (ret) { |
697 |
++ cpumask_var_t tmp_mask; |
698 |
++ |
699 |
++ if (!alloc_cpumask_var(&tmp_mask, GFP_TEMPORARY)) |
700 |
++ return ret; |
701 |
++ |
702 |
++ /* Use tmp_mask to preserve cpus mask from first failure */ |
703 |
++ cpumask_copy(tmp_mask, cpus); |
704 |
++ rtas_offline_cpus_mask(tmp_mask); |
705 |
++ free_cpumask_var(tmp_mask); |
706 |
++ } |
707 |
++ |
708 |
++ return ret; |
709 |
++} |
710 |
++EXPORT_SYMBOL(rtas_online_cpus_mask); |
711 |
++ |
712 |
++int rtas_offline_cpus_mask(cpumask_var_t cpus) |
713 |
++{ |
714 |
++ return rtas_cpu_state_change_mask(DOWN, cpus); |
715 |
++} |
716 |
++EXPORT_SYMBOL(rtas_offline_cpus_mask); |
717 |
++ |
718 |
+ int rtas_ibm_suspend_me(struct rtas_args *args) |
719 |
+ { |
720 |
+ long state; |
721 |
+@@ -814,6 +904,8 @@ int rtas_ibm_suspend_me(struct rtas_args *args) |
722 |
+ unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; |
723 |
+ struct rtas_suspend_me_data data; |
724 |
+ DECLARE_COMPLETION_ONSTACK(done); |
725 |
++ cpumask_var_t offline_mask; |
726 |
++ int cpuret; |
727 |
+ |
728 |
+ if (!rtas_service_present("ibm,suspend-me")) |
729 |
+ return -ENOSYS; |
730 |
+@@ -837,11 +929,24 @@ int rtas_ibm_suspend_me(struct rtas_args *args) |
731 |
+ return 0; |
732 |
+ } |
733 |
+ |
734 |
++ if (!alloc_cpumask_var(&offline_mask, GFP_TEMPORARY)) |
735 |
++ return -ENOMEM; |
736 |
++ |
737 |
+ atomic_set(&data.working, 0); |
738 |
+ atomic_set(&data.done, 0); |
739 |
+ atomic_set(&data.error, 0); |
740 |
+ data.token = rtas_token("ibm,suspend-me"); |
741 |
+ data.complete = &done; |
742 |
++ |
743 |
++ /* All present CPUs must be online */ |
744 |
++ cpumask_andnot(offline_mask, cpu_present_mask, cpu_online_mask); |
745 |
++ cpuret = rtas_online_cpus_mask(offline_mask); |
746 |
++ if (cpuret) { |
747 |
++ pr_err("%s: Could not bring present CPUs online.\n", __func__); |
748 |
++ atomic_set(&data.error, cpuret); |
749 |
++ goto out; |
750 |
++ } |
751 |
++ |
752 |
+ stop_topology_update(); |
753 |
+ |
754 |
+ /* Call function on all CPUs. One of us will make the |
755 |
+@@ -857,6 +962,14 @@ int rtas_ibm_suspend_me(struct rtas_args *args) |
756 |
+ |
757 |
+ start_topology_update(); |
758 |
+ |
759 |
++ /* Take down CPUs not online prior to suspend */ |
760 |
++ cpuret = rtas_offline_cpus_mask(offline_mask); |
761 |
++ if (cpuret) |
762 |
++ pr_warn("%s: Could not restore CPUs to offline state.\n", |
763 |
++ __func__); |
764 |
++ |
765 |
++out: |
766 |
++ free_cpumask_var(offline_mask); |
767 |
+ return atomic_read(&data.error); |
768 |
+ } |
769 |
+ #else /* CONFIG_PPC_PSERIES */ |
770 |
+diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c |
771 |
+index 47226e0..5f997e7 100644 |
772 |
+--- a/arch/powerpc/platforms/pseries/suspend.c |
773 |
++++ b/arch/powerpc/platforms/pseries/suspend.c |
774 |
+@@ -16,6 +16,7 @@ |
775 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
776 |
+ */ |
777 |
+ |
778 |
++#include <linux/cpu.h> |
779 |
+ #include <linux/delay.h> |
780 |
+ #include <linux/suspend.h> |
781 |
+ #include <linux/stat.h> |
782 |
+@@ -126,11 +127,15 @@ static ssize_t store_hibernate(struct device *dev, |
783 |
+ struct device_attribute *attr, |
784 |
+ const char *buf, size_t count) |
785 |
+ { |
786 |
++ cpumask_var_t offline_mask; |
787 |
+ int rc; |
788 |
+ |
789 |
+ if (!capable(CAP_SYS_ADMIN)) |
790 |
+ return -EPERM; |
791 |
+ |
792 |
++ if (!alloc_cpumask_var(&offline_mask, GFP_TEMPORARY)) |
793 |
++ return -ENOMEM; |
794 |
++ |
795 |
+ stream_id = simple_strtoul(buf, NULL, 16); |
796 |
+ |
797 |
+ do { |
798 |
+@@ -140,15 +145,32 @@ static ssize_t store_hibernate(struct device *dev, |
799 |
+ } while (rc == -EAGAIN); |
800 |
+ |
801 |
+ if (!rc) { |
802 |
++ /* All present CPUs must be online */ |
803 |
++ cpumask_andnot(offline_mask, cpu_present_mask, |
804 |
++ cpu_online_mask); |
805 |
++ rc = rtas_online_cpus_mask(offline_mask); |
806 |
++ if (rc) { |
807 |
++ pr_err("%s: Could not bring present CPUs online.\n", |
808 |
++ __func__); |
809 |
++ goto out; |
810 |
++ } |
811 |
++ |
812 |
+ stop_topology_update(); |
813 |
+ rc = pm_suspend(PM_SUSPEND_MEM); |
814 |
+ start_topology_update(); |
815 |
++ |
816 |
++ /* Take down CPUs not online prior to suspend */ |
817 |
++ if (!rtas_offline_cpus_mask(offline_mask)) |
818 |
++ pr_warn("%s: Could not restore CPUs to offline " |
819 |
++ "state.\n", __func__); |
820 |
+ } |
821 |
+ |
822 |
+ stream_id = 0; |
823 |
+ |
824 |
+ if (!rc) |
825 |
+ rc = count; |
826 |
++out: |
827 |
++ free_cpumask_var(offline_mask); |
828 |
+ return rc; |
829 |
+ } |
830 |
+ |
831 |
+diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig |
832 |
+index 25877ae..41a2a0b 100644 |
833 |
+--- a/arch/tile/Kconfig |
834 |
++++ b/arch/tile/Kconfig |
835 |
+@@ -368,11 +368,17 @@ config HARDWALL |
836 |
+ config KERNEL_PL |
837 |
+ int "Processor protection level for kernel" |
838 |
+ range 1 2 |
839 |
+- default "1" |
840 |
++ default 2 if TILEGX |
841 |
++ default 1 if !TILEGX |
842 |
+ ---help--- |
843 |
+- This setting determines the processor protection level the |
844 |
+- kernel will be built to run at. Generally you should use |
845 |
+- the default value here. |
846 |
++ Since MDE 4.2, the Tilera hypervisor runs the kernel |
847 |
++ at PL2 by default. If running under an older hypervisor, |
848 |
++ or as a KVM guest, you must run at PL1. (The current |
849 |
++ hypervisor may also be recompiled with "make HV_PL=2" to |
850 |
++ allow it to run a kernel at PL1, but clients running at PL1 |
851 |
++ are not expected to be supported indefinitely.) |
852 |
++ |
853 |
++ If you're not sure, don't change the default. |
854 |
+ |
855 |
+ source "arch/tile/gxio/Kconfig" |
856 |
+ |
857 |
+diff --git a/arch/tile/include/hv/hypervisor.h b/arch/tile/include/hv/hypervisor.h |
858 |
+index ccd847e..837dca5 100644 |
859 |
+--- a/arch/tile/include/hv/hypervisor.h |
860 |
++++ b/arch/tile/include/hv/hypervisor.h |
861 |
+@@ -107,7 +107,22 @@ |
862 |
+ #define HV_DISPATCH_ENTRY_SIZE 32 |
863 |
+ |
864 |
+ /** Version of the hypervisor interface defined by this file */ |
865 |
+-#define _HV_VERSION 11 |
866 |
++#define _HV_VERSION 13 |
867 |
++ |
868 |
++/** Last version of the hypervisor interface with old hv_init() ABI. |
869 |
++ * |
870 |
++ * The change from version 12 to version 13 corresponds to launching |
871 |
++ * the client by default at PL2 instead of PL1 (corresponding to the |
872 |
++ * hv itself running at PL3 instead of PL2). To make this explicit, |
873 |
++ * the hv_init() API was also extended so the client can report its |
874 |
++ * desired PL, resulting in a more helpful failure diagnostic. If you |
875 |
++ * call hv_init() with _HV_VERSION_OLD_HV_INIT and omit the client_pl |
876 |
++ * argument, the hypervisor will assume client_pl = 1. |
877 |
++ * |
878 |
++ * Note that this is a deprecated solution and we do not expect to |
879 |
++ * support clients of the Tilera hypervisor running at PL1 indefinitely. |
880 |
++ */ |
881 |
++#define _HV_VERSION_OLD_HV_INIT 12 |
882 |
+ |
883 |
+ /* Index into hypervisor interface dispatch code blocks. |
884 |
+ * |
885 |
+@@ -377,7 +392,11 @@ typedef int HV_Errno; |
886 |
+ #ifndef __ASSEMBLER__ |
887 |
+ |
888 |
+ /** Pass HV_VERSION to hv_init to request this version of the interface. */ |
889 |
+-typedef enum { HV_VERSION = _HV_VERSION } HV_VersionNumber; |
890 |
++typedef enum { |
891 |
++ HV_VERSION = _HV_VERSION, |
892 |
++ HV_VERSION_OLD_HV_INIT = _HV_VERSION_OLD_HV_INIT, |
893 |
++ |
894 |
++} HV_VersionNumber; |
895 |
+ |
896 |
+ /** Initializes the hypervisor. |
897 |
+ * |
898 |
+@@ -385,9 +404,11 @@ typedef enum { HV_VERSION = _HV_VERSION } HV_VersionNumber; |
899 |
+ * that this program expects, typically HV_VERSION. |
900 |
+ * @param chip_num Architecture number of the chip the client was built for. |
901 |
+ * @param chip_rev_num Revision number of the chip the client was built for. |
902 |
++ * @param client_pl Privilege level the client is built for |
903 |
++ * (not required if interface_version_number == HV_VERSION_OLD_HV_INIT). |
904 |
+ */ |
905 |
+ void hv_init(HV_VersionNumber interface_version_number, |
906 |
+- int chip_num, int chip_rev_num); |
907 |
++ int chip_num, int chip_rev_num, int client_pl); |
908 |
+ |
909 |
+ |
910 |
+ /** Queries we can make for hv_sysconf(). |
911 |
+diff --git a/arch/tile/kernel/head_32.S b/arch/tile/kernel/head_32.S |
912 |
+index f71bfee..ac11530 100644 |
913 |
+--- a/arch/tile/kernel/head_32.S |
914 |
++++ b/arch/tile/kernel/head_32.S |
915 |
+@@ -38,7 +38,7 @@ ENTRY(_start) |
916 |
+ movei r2, TILE_CHIP_REV |
917 |
+ } |
918 |
+ { |
919 |
+- moveli r0, _HV_VERSION |
920 |
++ moveli r0, _HV_VERSION_OLD_HV_INIT |
921 |
+ jal hv_init |
922 |
+ } |
923 |
+ /* Get a reasonable default ASID in r0 */ |
924 |
+diff --git a/arch/tile/kernel/head_64.S b/arch/tile/kernel/head_64.S |
925 |
+index f9a2734..6093964 100644 |
926 |
+--- a/arch/tile/kernel/head_64.S |
927 |
++++ b/arch/tile/kernel/head_64.S |
928 |
+@@ -34,13 +34,19 @@ |
929 |
+ ENTRY(_start) |
930 |
+ /* Notify the hypervisor of what version of the API we want */ |
931 |
+ { |
932 |
++#if KERNEL_PL == 1 && _HV_VERSION == 13 |
933 |
++ /* Support older hypervisors by asking for API version 12. */ |
934 |
++ movei r0, _HV_VERSION_OLD_HV_INIT |
935 |
++#else |
936 |
++ movei r0, _HV_VERSION |
937 |
++#endif |
938 |
+ movei r1, TILE_CHIP |
939 |
+- movei r2, TILE_CHIP_REV |
940 |
+ } |
941 |
+ { |
942 |
+- moveli r0, _HV_VERSION |
943 |
+- jal hv_init |
944 |
++ movei r2, TILE_CHIP_REV |
945 |
++ movei r3, KERNEL_PL |
946 |
+ } |
947 |
++ jal hv_init |
948 |
+ /* Get a reasonable default ASID in r0 */ |
949 |
+ { |
950 |
+ move r0, zero |
951 |
+diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig |
952 |
+index 15b5cef..6ef2a37 100644 |
953 |
+--- a/arch/x86/Kconfig |
954 |
++++ b/arch/x86/Kconfig |
955 |
+@@ -107,7 +107,6 @@ config X86 |
956 |
+ select GENERIC_CLOCKEVENTS_BROADCAST if X86_64 || (X86_32 && X86_LOCAL_APIC) |
957 |
+ select GENERIC_TIME_VSYSCALL if X86_64 |
958 |
+ select KTIME_SCALAR if X86_32 |
959 |
+- select ALWAYS_USE_PERSISTENT_CLOCK |
960 |
+ select GENERIC_STRNCPY_FROM_USER |
961 |
+ select GENERIC_STRNLEN_USER |
962 |
+ select HAVE_CONTEXT_TRACKING if X86_64 |
963 |
+diff --git a/arch/x86/kernel/microcode_intel_early.c b/arch/x86/kernel/microcode_intel_early.c |
964 |
+index d893e8e..2e9e128 100644 |
965 |
+--- a/arch/x86/kernel/microcode_intel_early.c |
966 |
++++ b/arch/x86/kernel/microcode_intel_early.c |
967 |
+@@ -487,6 +487,7 @@ static inline void show_saved_mc(void) |
968 |
+ #endif |
969 |
+ |
970 |
+ #if defined(CONFIG_MICROCODE_INTEL_EARLY) && defined(CONFIG_HOTPLUG_CPU) |
971 |
++static DEFINE_MUTEX(x86_cpu_microcode_mutex); |
972 |
+ /* |
973 |
+ * Save this mc into mc_saved_data. So it will be loaded early when a CPU is |
974 |
+ * hot added or resumes. |
975 |
+@@ -507,7 +508,7 @@ int save_mc_for_early(u8 *mc) |
976 |
+ * Hold hotplug lock so mc_saved_data is not accessed by a CPU in |
977 |
+ * hotplug. |
978 |
+ */ |
979 |
+- cpu_hotplug_driver_lock(); |
980 |
++ mutex_lock(&x86_cpu_microcode_mutex); |
981 |
+ |
982 |
+ mc_saved_count_init = mc_saved_data.mc_saved_count; |
983 |
+ mc_saved_count = mc_saved_data.mc_saved_count; |
984 |
+@@ -544,7 +545,7 @@ int save_mc_for_early(u8 *mc) |
985 |
+ } |
986 |
+ |
987 |
+ out: |
988 |
+- cpu_hotplug_driver_unlock(); |
989 |
++ mutex_unlock(&x86_cpu_microcode_mutex); |
990 |
+ |
991 |
+ return ret; |
992 |
+ } |
993 |
+diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c |
994 |
+index a9c9d3e..59622c9 100644 |
995 |
+--- a/arch/x86/kvm/emulate.c |
996 |
++++ b/arch/x86/kvm/emulate.c |
997 |
+@@ -60,6 +60,7 @@ |
998 |
+ #define OpGS 25ull /* GS */ |
999 |
+ #define OpMem8 26ull /* 8-bit zero extended memory operand */ |
1000 |
+ #define OpImm64 27ull /* Sign extended 16/32/64-bit immediate */ |
1001 |
++#define OpXLat 28ull /* memory at BX/EBX/RBX + zero-extended AL */ |
1002 |
+ |
1003 |
+ #define OpBits 5 /* Width of operand field */ |
1004 |
+ #define OpMask ((1ull << OpBits) - 1) |
1005 |
+@@ -99,6 +100,7 @@ |
1006 |
+ #define SrcImmUByte (OpImmUByte << SrcShift) |
1007 |
+ #define SrcImmU (OpImmU << SrcShift) |
1008 |
+ #define SrcSI (OpSI << SrcShift) |
1009 |
++#define SrcXLat (OpXLat << SrcShift) |
1010 |
+ #define SrcImmFAddr (OpImmFAddr << SrcShift) |
1011 |
+ #define SrcMemFAddr (OpMemFAddr << SrcShift) |
1012 |
+ #define SrcAcc (OpAcc << SrcShift) |
1013 |
+@@ -532,6 +534,9 @@ FOP_SETCC(setle) |
1014 |
+ FOP_SETCC(setnle) |
1015 |
+ FOP_END; |
1016 |
+ |
1017 |
++FOP_START(salc) "pushf; sbb %al, %al; popf \n\t" FOP_RET |
1018 |
++FOP_END; |
1019 |
++ |
1020 |
+ #define __emulate_1op_rax_rdx(ctxt, _op, _suffix, _ex) \ |
1021 |
+ do { \ |
1022 |
+ unsigned long _tmp; \ |
1023 |
+@@ -2986,6 +2991,28 @@ static int em_das(struct x86_emulate_ctxt *ctxt) |
1024 |
+ return X86EMUL_CONTINUE; |
1025 |
+ } |
1026 |
+ |
1027 |
++static int em_aam(struct x86_emulate_ctxt *ctxt) |
1028 |
++{ |
1029 |
++ u8 al, ah; |
1030 |
++ |
1031 |
++ if (ctxt->src.val == 0) |
1032 |
++ return emulate_de(ctxt); |
1033 |
++ |
1034 |
++ al = ctxt->dst.val & 0xff; |
1035 |
++ ah = al / ctxt->src.val; |
1036 |
++ al %= ctxt->src.val; |
1037 |
++ |
1038 |
++ ctxt->dst.val = (ctxt->dst.val & 0xffff0000) | al | (ah << 8); |
1039 |
++ |
1040 |
++ /* Set PF, ZF, SF */ |
1041 |
++ ctxt->src.type = OP_IMM; |
1042 |
++ ctxt->src.val = 0; |
1043 |
++ ctxt->src.bytes = 1; |
1044 |
++ fastop(ctxt, em_or); |
1045 |
++ |
1046 |
++ return X86EMUL_CONTINUE; |
1047 |
++} |
1048 |
++ |
1049 |
+ static int em_aad(struct x86_emulate_ctxt *ctxt) |
1050 |
+ { |
1051 |
+ u8 al = ctxt->dst.val & 0xff; |
1052 |
+@@ -3926,7 +3953,10 @@ static const struct opcode opcode_table[256] = { |
1053 |
+ /* 0xD0 - 0xD7 */ |
1054 |
+ G(Src2One | ByteOp, group2), G(Src2One, group2), |
1055 |
+ G(Src2CL | ByteOp, group2), G(Src2CL, group2), |
1056 |
+- N, I(DstAcc | SrcImmByte | No64, em_aad), N, N, |
1057 |
++ I(DstAcc | SrcImmUByte | No64, em_aam), |
1058 |
++ I(DstAcc | SrcImmUByte | No64, em_aad), |
1059 |
++ F(DstAcc | ByteOp | No64, em_salc), |
1060 |
++ I(DstAcc | SrcXLat | ByteOp, em_mov), |
1061 |
+ /* 0xD8 - 0xDF */ |
1062 |
+ N, E(0, &escape_d9), N, E(0, &escape_db), N, E(0, &escape_dd), N, N, |
1063 |
+ /* 0xE0 - 0xE7 */ |
1064 |
+@@ -4188,6 +4218,16 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, |
1065 |
+ op->val = 0; |
1066 |
+ op->count = 1; |
1067 |
+ break; |
1068 |
++ case OpXLat: |
1069 |
++ op->type = OP_MEM; |
1070 |
++ op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; |
1071 |
++ op->addr.mem.ea = |
1072 |
++ register_address(ctxt, |
1073 |
++ reg_read(ctxt, VCPU_REGS_RBX) + |
1074 |
++ (reg_read(ctxt, VCPU_REGS_RAX) & 0xff)); |
1075 |
++ op->addr.mem.seg = seg_override(ctxt); |
1076 |
++ op->val = 0; |
1077 |
++ break; |
1078 |
+ case OpImmFAddr: |
1079 |
+ op->type = OP_IMM; |
1080 |
+ op->addr.mem.ea = ctxt->_eip; |
1081 |
+diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
1082 |
+index 6667042..0af1807 100644 |
1083 |
+--- a/arch/x86/kvm/vmx.c |
1084 |
++++ b/arch/x86/kvm/vmx.c |
1085 |
+@@ -5197,6 +5197,12 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) |
1086 |
+ return 0; |
1087 |
+ } |
1088 |
+ |
1089 |
++ if (vcpu->arch.halt_request) { |
1090 |
++ vcpu->arch.halt_request = 0; |
1091 |
++ ret = kvm_emulate_halt(vcpu); |
1092 |
++ goto out; |
1093 |
++ } |
1094 |
++ |
1095 |
+ if (signal_pending(current)) |
1096 |
+ goto out; |
1097 |
+ if (need_resched()) |
1098 |
+diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c |
1099 |
+index 2363127..cf95e19 100644 |
1100 |
+--- a/arch/x86/xen/enlighten.c |
1101 |
++++ b/arch/x86/xen/enlighten.c |
1102 |
+@@ -156,6 +156,21 @@ static void xen_vcpu_setup(int cpu) |
1103 |
+ |
1104 |
+ BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info); |
1105 |
+ |
1106 |
++ /* |
1107 |
++ * This path is called twice on PVHVM - first during bootup via |
1108 |
++ * smp_init -> xen_hvm_cpu_notify, and then if the VCPU is being |
1109 |
++ * hotplugged: cpu_up -> xen_hvm_cpu_notify. |
1110 |
++ * As we can only do the VCPUOP_register_vcpu_info once lets |
1111 |
++ * not over-write its result. |
1112 |
++ * |
1113 |
++ * For PV it is called during restore (xen_vcpu_restore) and bootup |
1114 |
++ * (xen_setup_vcpu_info_placement). The hotplug mechanism does not |
1115 |
++ * use this function. |
1116 |
++ */ |
1117 |
++ if (xen_hvm_domain()) { |
1118 |
++ if (per_cpu(xen_vcpu, cpu) == &per_cpu(xen_vcpu_info, cpu)) |
1119 |
++ return; |
1120 |
++ } |
1121 |
+ if (cpu < MAX_VIRT_CPUS) |
1122 |
+ per_cpu(xen_vcpu,cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; |
1123 |
+ |
1124 |
+diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c |
1125 |
+index ec7f569..c84ee95 100644 |
1126 |
+--- a/drivers/acpi/acpica/exfldio.c |
1127 |
++++ b/drivers/acpi/acpica/exfldio.c |
1128 |
+@@ -720,7 +720,19 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, |
1129 |
+ |
1130 |
+ if ((obj_desc->common_field.start_field_bit_offset == 0) && |
1131 |
+ (obj_desc->common_field.bit_length == access_bit_width)) { |
1132 |
+- status = acpi_ex_field_datum_io(obj_desc, 0, buffer, ACPI_READ); |
1133 |
++ if (buffer_length >= sizeof(u64)) { |
1134 |
++ status = |
1135 |
++ acpi_ex_field_datum_io(obj_desc, 0, buffer, |
1136 |
++ ACPI_READ); |
1137 |
++ } else { |
1138 |
++ /* Use raw_datum (u64) to handle buffers < 64 bits */ |
1139 |
++ |
1140 |
++ status = |
1141 |
++ acpi_ex_field_datum_io(obj_desc, 0, &raw_datum, |
1142 |
++ ACPI_READ); |
1143 |
++ ACPI_MEMCPY(buffer, &raw_datum, buffer_length); |
1144 |
++ } |
1145 |
++ |
1146 |
+ return_ACPI_STATUS(status); |
1147 |
+ } |
1148 |
+ |
1149 |
+diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c |
1150 |
+index d45b287..edc0081 100644 |
1151 |
+--- a/drivers/acpi/ec.c |
1152 |
++++ b/drivers/acpi/ec.c |
1153 |
+@@ -223,7 +223,7 @@ static int ec_check_sci_sync(struct acpi_ec *ec, u8 state) |
1154 |
+ static int ec_poll(struct acpi_ec *ec) |
1155 |
+ { |
1156 |
+ unsigned long flags; |
1157 |
+- int repeat = 2; /* number of command restarts */ |
1158 |
++ int repeat = 5; /* number of command restarts */ |
1159 |
+ while (repeat--) { |
1160 |
+ unsigned long delay = jiffies + |
1161 |
+ msecs_to_jiffies(ec_delay); |
1162 |
+@@ -241,8 +241,6 @@ static int ec_poll(struct acpi_ec *ec) |
1163 |
+ } |
1164 |
+ advance_transaction(ec, acpi_ec_read_status(ec)); |
1165 |
+ } while (time_before(jiffies, delay)); |
1166 |
+- if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) |
1167 |
+- break; |
1168 |
+ pr_debug(PREFIX "controller reset, restart transaction\n"); |
1169 |
+ spin_lock_irqsave(&ec->lock, flags); |
1170 |
+ start_transaction(ec); |
1171 |
+diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c |
1172 |
+index e98da67..54d03d4 100644 |
1173 |
+--- a/drivers/block/drbd/drbd_main.c |
1174 |
++++ b/drivers/block/drbd/drbd_main.c |
1175 |
+@@ -2795,6 +2795,7 @@ void drbd_free_bc(struct drbd_backing_dev *ldev) |
1176 |
+ blkdev_put(ldev->backing_bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL); |
1177 |
+ blkdev_put(ldev->md_bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL); |
1178 |
+ |
1179 |
++ kfree(ldev->disk_conf); |
1180 |
+ kfree(ldev); |
1181 |
+ } |
1182 |
+ |
1183 |
+diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c |
1184 |
+index a9eccfc..2f5fffd 100644 |
1185 |
+--- a/drivers/block/drbd/drbd_receiver.c |
1186 |
++++ b/drivers/block/drbd/drbd_receiver.c |
1187 |
+@@ -2661,7 +2661,6 @@ static int drbd_asb_recover_1p(struct drbd_conf *mdev) __must_hold(local) |
1188 |
+ if (hg == -1 && mdev->state.role == R_PRIMARY) { |
1189 |
+ enum drbd_state_rv rv2; |
1190 |
+ |
1191 |
+- drbd_set_role(mdev, R_SECONDARY, 0); |
1192 |
+ /* drbd_change_state() does not sleep while in SS_IN_TRANSIENT_STATE, |
1193 |
+ * we might be here in C_WF_REPORT_PARAMS which is transient. |
1194 |
+ * we do not need to wait for the after state change work either. */ |
1195 |
+@@ -4659,8 +4658,8 @@ static int drbd_do_features(struct drbd_tconn *tconn) |
1196 |
+ #if !defined(CONFIG_CRYPTO_HMAC) && !defined(CONFIG_CRYPTO_HMAC_MODULE) |
1197 |
+ static int drbd_do_auth(struct drbd_tconn *tconn) |
1198 |
+ { |
1199 |
+- dev_err(DEV, "This kernel was build without CONFIG_CRYPTO_HMAC.\n"); |
1200 |
+- dev_err(DEV, "You need to disable 'cram-hmac-alg' in drbd.conf.\n"); |
1201 |
++ conn_err(tconn, "This kernel was build without CONFIG_CRYPTO_HMAC.\n"); |
1202 |
++ conn_err(tconn, "You need to disable 'cram-hmac-alg' in drbd.conf.\n"); |
1203 |
+ return -1; |
1204 |
+ } |
1205 |
+ #else |
1206 |
+diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c |
1207 |
+index cdd4c09f..a22a7a5 100644 |
1208 |
+--- a/drivers/char/ipmi/ipmi_bt_sm.c |
1209 |
++++ b/drivers/char/ipmi/ipmi_bt_sm.c |
1210 |
+@@ -95,9 +95,9 @@ struct si_sm_data { |
1211 |
+ enum bt_states state; |
1212 |
+ unsigned char seq; /* BT sequence number */ |
1213 |
+ struct si_sm_io *io; |
1214 |
+- unsigned char write_data[IPMI_MAX_MSG_LENGTH]; |
1215 |
++ unsigned char write_data[IPMI_MAX_MSG_LENGTH + 2]; /* +2 for memcpy */ |
1216 |
+ int write_count; |
1217 |
+- unsigned char read_data[IPMI_MAX_MSG_LENGTH]; |
1218 |
++ unsigned char read_data[IPMI_MAX_MSG_LENGTH + 2]; /* +2 for memcpy */ |
1219 |
+ int read_count; |
1220 |
+ int truncated; |
1221 |
+ long timeout; /* microseconds countdown */ |
1222 |
+diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c |
1223 |
+index 9eb360f..d5a5f02 100644 |
1224 |
+--- a/drivers/char/ipmi/ipmi_devintf.c |
1225 |
++++ b/drivers/char/ipmi/ipmi_devintf.c |
1226 |
+@@ -837,13 +837,25 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd, |
1227 |
+ return ipmi_ioctl(filep, cmd, arg); |
1228 |
+ } |
1229 |
+ } |
1230 |
++ |
1231 |
++static long unlocked_compat_ipmi_ioctl(struct file *filep, unsigned int cmd, |
1232 |
++ unsigned long arg) |
1233 |
++{ |
1234 |
++ int ret; |
1235 |
++ |
1236 |
++ mutex_lock(&ipmi_mutex); |
1237 |
++ ret = compat_ipmi_ioctl(filep, cmd, arg); |
1238 |
++ mutex_unlock(&ipmi_mutex); |
1239 |
++ |
1240 |
++ return ret; |
1241 |
++} |
1242 |
+ #endif |
1243 |
+ |
1244 |
+ static const struct file_operations ipmi_fops = { |
1245 |
+ .owner = THIS_MODULE, |
1246 |
+ .unlocked_ioctl = ipmi_unlocked_ioctl, |
1247 |
+ #ifdef CONFIG_COMPAT |
1248 |
+- .compat_ioctl = compat_ipmi_ioctl, |
1249 |
++ .compat_ioctl = unlocked_compat_ipmi_ioctl, |
1250 |
+ #endif |
1251 |
+ .open = ipmi_open, |
1252 |
+ .release = ipmi_release, |
1253 |
+diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c |
1254 |
+index 6133ef5..d8a8c9b 100644 |
1255 |
+--- a/drivers/cpufreq/intel_pstate.c |
1256 |
++++ b/drivers/cpufreq/intel_pstate.c |
1257 |
+@@ -48,12 +48,7 @@ static inline int32_t div_fp(int32_t x, int32_t y) |
1258 |
+ } |
1259 |
+ |
1260 |
+ struct sample { |
1261 |
+- ktime_t start_time; |
1262 |
+- ktime_t end_time; |
1263 |
+ int core_pct_busy; |
1264 |
+- int pstate_pct_busy; |
1265 |
+- u64 duration_us; |
1266 |
+- u64 idletime_us; |
1267 |
+ u64 aperf; |
1268 |
+ u64 mperf; |
1269 |
+ int freq; |
1270 |
+@@ -91,8 +86,6 @@ struct cpudata { |
1271 |
+ int min_pstate_count; |
1272 |
+ int idle_mode; |
1273 |
+ |
1274 |
+- ktime_t prev_sample; |
1275 |
+- u64 prev_idle_time_us; |
1276 |
+ u64 prev_aperf; |
1277 |
+ u64 prev_mperf; |
1278 |
+ int sample_ptr; |
1279 |
+@@ -124,6 +117,8 @@ struct perf_limits { |
1280 |
+ int min_perf_pct; |
1281 |
+ int32_t max_perf; |
1282 |
+ int32_t min_perf; |
1283 |
++ int max_policy_pct; |
1284 |
++ int max_sysfs_pct; |
1285 |
+ }; |
1286 |
+ |
1287 |
+ static struct perf_limits limits = { |
1288 |
+@@ -132,6 +127,8 @@ static struct perf_limits limits = { |
1289 |
+ .max_perf = int_tofp(1), |
1290 |
+ .min_perf_pct = 0, |
1291 |
+ .min_perf = 0, |
1292 |
++ .max_policy_pct = 100, |
1293 |
++ .max_sysfs_pct = 100, |
1294 |
+ }; |
1295 |
+ |
1296 |
+ static inline void pid_reset(struct _pid *pid, int setpoint, int busy, |
1297 |
+@@ -302,7 +299,8 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, |
1298 |
+ if (ret != 1) |
1299 |
+ return -EINVAL; |
1300 |
+ |
1301 |
+- limits.max_perf_pct = clamp_t(int, input, 0 , 100); |
1302 |
++ limits.max_sysfs_pct = clamp_t(int, input, 0 , 100); |
1303 |
++ limits.max_perf_pct = min(limits.max_policy_pct, limits.max_sysfs_pct); |
1304 |
+ limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100)); |
1305 |
+ return count; |
1306 |
+ } |
1307 |
+@@ -450,48 +448,26 @@ static inline void intel_pstate_calc_busy(struct cpudata *cpu, |
1308 |
+ struct sample *sample) |
1309 |
+ { |
1310 |
+ u64 core_pct; |
1311 |
+- sample->pstate_pct_busy = 100 - div64_u64( |
1312 |
+- sample->idletime_us * 100, |
1313 |
+- sample->duration_us); |
1314 |
+ core_pct = div64_u64(sample->aperf * 100, sample->mperf); |
1315 |
+ sample->freq = cpu->pstate.max_pstate * core_pct * 1000; |
1316 |
+ |
1317 |
+- sample->core_pct_busy = div_s64((sample->pstate_pct_busy * core_pct), |
1318 |
+- 100); |
1319 |
++ sample->core_pct_busy = core_pct; |
1320 |
+ } |
1321 |
+ |
1322 |
+ static inline void intel_pstate_sample(struct cpudata *cpu) |
1323 |
+ { |
1324 |
+- ktime_t now; |
1325 |
+- u64 idle_time_us; |
1326 |
+ u64 aperf, mperf; |
1327 |
+ |
1328 |
+- now = ktime_get(); |
1329 |
+- idle_time_us = get_cpu_idle_time_us(cpu->cpu, NULL); |
1330 |
+- |
1331 |
+ rdmsrl(MSR_IA32_APERF, aperf); |
1332 |
+ rdmsrl(MSR_IA32_MPERF, mperf); |
1333 |
+- /* for the first sample, don't actually record a sample, just |
1334 |
+- * set the baseline */ |
1335 |
+- if (cpu->prev_idle_time_us > 0) { |
1336 |
+- cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT; |
1337 |
+- cpu->samples[cpu->sample_ptr].start_time = cpu->prev_sample; |
1338 |
+- cpu->samples[cpu->sample_ptr].end_time = now; |
1339 |
+- cpu->samples[cpu->sample_ptr].duration_us = |
1340 |
+- ktime_us_delta(now, cpu->prev_sample); |
1341 |
+- cpu->samples[cpu->sample_ptr].idletime_us = |
1342 |
+- idle_time_us - cpu->prev_idle_time_us; |
1343 |
+- |
1344 |
+- cpu->samples[cpu->sample_ptr].aperf = aperf; |
1345 |
+- cpu->samples[cpu->sample_ptr].mperf = mperf; |
1346 |
+- cpu->samples[cpu->sample_ptr].aperf -= cpu->prev_aperf; |
1347 |
+- cpu->samples[cpu->sample_ptr].mperf -= cpu->prev_mperf; |
1348 |
+- |
1349 |
+- intel_pstate_calc_busy(cpu, &cpu->samples[cpu->sample_ptr]); |
1350 |
+- } |
1351 |
++ cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT; |
1352 |
++ cpu->samples[cpu->sample_ptr].aperf = aperf; |
1353 |
++ cpu->samples[cpu->sample_ptr].mperf = mperf; |
1354 |
++ cpu->samples[cpu->sample_ptr].aperf -= cpu->prev_aperf; |
1355 |
++ cpu->samples[cpu->sample_ptr].mperf -= cpu->prev_mperf; |
1356 |
++ |
1357 |
++ intel_pstate_calc_busy(cpu, &cpu->samples[cpu->sample_ptr]); |
1358 |
+ |
1359 |
+- cpu->prev_sample = now; |
1360 |
+- cpu->prev_idle_time_us = idle_time_us; |
1361 |
+ cpu->prev_aperf = aperf; |
1362 |
+ cpu->prev_mperf = mperf; |
1363 |
+ } |
1364 |
+@@ -575,22 +551,16 @@ static void intel_pstate_timer_func(unsigned long __data) |
1365 |
+ struct cpudata *cpu = (struct cpudata *) __data; |
1366 |
+ |
1367 |
+ intel_pstate_sample(cpu); |
1368 |
++ intel_pstate_adjust_busy_pstate(cpu); |
1369 |
+ |
1370 |
+- if (!cpu->idle_mode) |
1371 |
+- intel_pstate_adjust_busy_pstate(cpu); |
1372 |
+- else |
1373 |
+- intel_pstate_adjust_idle_pstate(cpu); |
1374 |
+- |
1375 |
+-#if defined(XPERF_FIX) |
1376 |
+ if (cpu->pstate.current_pstate == cpu->pstate.min_pstate) { |
1377 |
+ cpu->min_pstate_count++; |
1378 |
+ if (!(cpu->min_pstate_count % 5)) { |
1379 |
+ intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate); |
1380 |
+- intel_pstate_idle_mode(cpu); |
1381 |
+ } |
1382 |
+ } else |
1383 |
+ cpu->min_pstate_count = 0; |
1384 |
+-#endif |
1385 |
++ |
1386 |
+ intel_pstate_set_sample_time(cpu); |
1387 |
+ } |
1388 |
+ |
1389 |
+@@ -670,8 +640,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) |
1390 |
+ limits.min_perf_pct = clamp_t(int, limits.min_perf_pct, 0 , 100); |
1391 |
+ limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100)); |
1392 |
+ |
1393 |
+- limits.max_perf_pct = policy->max * 100 / policy->cpuinfo.max_freq; |
1394 |
+- limits.max_perf_pct = clamp_t(int, limits.max_perf_pct, 0 , 100); |
1395 |
++ limits.max_policy_pct = policy->max * 100 / policy->cpuinfo.max_freq; |
1396 |
++ limits.max_policy_pct = clamp_t(int, limits.max_policy_pct, 0 , 100); |
1397 |
++ limits.max_perf_pct = min(limits.max_policy_pct, limits.max_sysfs_pct); |
1398 |
+ limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100)); |
1399 |
+ |
1400 |
+ if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) { |
1401 |
+diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c |
1402 |
+index 69d04d2..09c7ad1 100644 |
1403 |
+--- a/drivers/dma/of-dma.c |
1404 |
++++ b/drivers/dma/of-dma.c |
1405 |
+@@ -93,6 +93,7 @@ int of_dma_controller_register(struct device_node *np, |
1406 |
+ { |
1407 |
+ struct of_dma *ofdma; |
1408 |
+ int nbcells; |
1409 |
++ const __be32 *prop; |
1410 |
+ |
1411 |
+ if (!np || !of_dma_xlate) { |
1412 |
+ pr_err("%s: not enough information provided\n", __func__); |
1413 |
+@@ -103,8 +104,11 @@ int of_dma_controller_register(struct device_node *np, |
1414 |
+ if (!ofdma) |
1415 |
+ return -ENOMEM; |
1416 |
+ |
1417 |
+- nbcells = be32_to_cpup(of_get_property(np, "#dma-cells", NULL)); |
1418 |
+- if (!nbcells) { |
1419 |
++ prop = of_get_property(np, "#dma-cells", NULL); |
1420 |
++ if (prop) |
1421 |
++ nbcells = be32_to_cpup(prop); |
1422 |
++ |
1423 |
++ if (!prop || !nbcells) { |
1424 |
+ pr_err("%s: #dma-cells property is missing or invalid\n", |
1425 |
+ __func__); |
1426 |
+ kfree(ofdma); |
1427 |
+diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c |
1428 |
+index d01faeb..ce3dc3e 100644 |
1429 |
+--- a/drivers/dma/pch_dma.c |
1430 |
++++ b/drivers/dma/pch_dma.c |
1431 |
+@@ -476,7 +476,7 @@ static struct pch_dma_desc *pdc_desc_get(struct pch_dma_chan *pd_chan) |
1432 |
+ dev_dbg(chan2dev(&pd_chan->chan), "scanned %d descriptors\n", i); |
1433 |
+ |
1434 |
+ if (!ret) { |
1435 |
+- ret = pdc_alloc_desc(&pd_chan->chan, GFP_NOIO); |
1436 |
++ ret = pdc_alloc_desc(&pd_chan->chan, GFP_ATOMIC); |
1437 |
+ if (ret) { |
1438 |
+ spin_lock(&pd_chan->lock); |
1439 |
+ pd_chan->descs_allocated++; |
1440 |
+diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c |
1441 |
+index dd64a06..016c5d8 100644 |
1442 |
+--- a/drivers/gpu/drm/drm_crtc.c |
1443 |
++++ b/drivers/gpu/drm/drm_crtc.c |
1444 |
+@@ -78,6 +78,10 @@ void drm_warn_on_modeset_not_all_locked(struct drm_device *dev) |
1445 |
+ { |
1446 |
+ struct drm_crtc *crtc; |
1447 |
+ |
1448 |
++ /* Locking is currently fubar in the panic handler. */ |
1449 |
++ if (oops_in_progress) |
1450 |
++ return; |
1451 |
++ |
1452 |
+ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) |
1453 |
+ WARN_ON(!mutex_is_locked(&crtc->mutex)); |
1454 |
+ |
1455 |
+diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c |
1456 |
+index db1e2d6..07cf99c 100644 |
1457 |
+--- a/drivers/gpu/drm/drm_mm.c |
1458 |
++++ b/drivers/gpu/drm/drm_mm.c |
1459 |
+@@ -755,33 +755,35 @@ void drm_mm_debug_table(struct drm_mm *mm, const char *prefix) |
1460 |
+ EXPORT_SYMBOL(drm_mm_debug_table); |
1461 |
+ |
1462 |
+ #if defined(CONFIG_DEBUG_FS) |
1463 |
+-int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm) |
1464 |
++static unsigned long drm_mm_dump_hole(struct seq_file *m, struct drm_mm_node *entry) |
1465 |
+ { |
1466 |
+- struct drm_mm_node *entry; |
1467 |
+- unsigned long total_used = 0, total_free = 0, total = 0; |
1468 |
+ unsigned long hole_start, hole_end, hole_size; |
1469 |
+ |
1470 |
+- hole_start = drm_mm_hole_node_start(&mm->head_node); |
1471 |
+- hole_end = drm_mm_hole_node_end(&mm->head_node); |
1472 |
+- hole_size = hole_end - hole_start; |
1473 |
+- if (hole_size) |
1474 |
++ if (entry->hole_follows) { |
1475 |
++ hole_start = drm_mm_hole_node_start(entry); |
1476 |
++ hole_end = drm_mm_hole_node_end(entry); |
1477 |
++ hole_size = hole_end - hole_start; |
1478 |
+ seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n", |
1479 |
+ hole_start, hole_end, hole_size); |
1480 |
+- total_free += hole_size; |
1481 |
++ return hole_size; |
1482 |
++ } |
1483 |
++ |
1484 |
++ return 0; |
1485 |
++} |
1486 |
++ |
1487 |
++int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm) |
1488 |
++{ |
1489 |
++ struct drm_mm_node *entry; |
1490 |
++ unsigned long total_used = 0, total_free = 0, total = 0; |
1491 |
++ |
1492 |
++ total_free += drm_mm_dump_hole(m, &mm->head_node); |
1493 |
+ |
1494 |
+ drm_mm_for_each_node(entry, mm) { |
1495 |
+ seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: used\n", |
1496 |
+ entry->start, entry->start + entry->size, |
1497 |
+ entry->size); |
1498 |
+ total_used += entry->size; |
1499 |
+- if (entry->hole_follows) { |
1500 |
+- hole_start = drm_mm_hole_node_start(entry); |
1501 |
+- hole_end = drm_mm_hole_node_end(entry); |
1502 |
+- hole_size = hole_end - hole_start; |
1503 |
+- seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n", |
1504 |
+- hole_start, hole_end, hole_size); |
1505 |
+- total_free += hole_size; |
1506 |
+- } |
1507 |
++ total_free += drm_mm_dump_hole(m, entry); |
1508 |
+ } |
1509 |
+ total = total_free + total_used; |
1510 |
+ |
1511 |
+diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c |
1512 |
+index 981bdce..898832b 100644 |
1513 |
+--- a/drivers/gpu/drm/i915/intel_fb.c |
1514 |
++++ b/drivers/gpu/drm/i915/intel_fb.c |
1515 |
+@@ -261,10 +261,22 @@ void intel_fbdev_fini(struct drm_device *dev) |
1516 |
+ void intel_fbdev_set_suspend(struct drm_device *dev, int state) |
1517 |
+ { |
1518 |
+ drm_i915_private_t *dev_priv = dev->dev_private; |
1519 |
+- if (!dev_priv->fbdev) |
1520 |
++ struct intel_fbdev *ifbdev = dev_priv->fbdev; |
1521 |
++ struct fb_info *info; |
1522 |
++ |
1523 |
++ if (!ifbdev) |
1524 |
+ return; |
1525 |
+ |
1526 |
+- fb_set_suspend(dev_priv->fbdev->helper.fbdev, state); |
1527 |
++ info = ifbdev->helper.fbdev; |
1528 |
++ |
1529 |
++ /* On resume from hibernation: If the object is shmemfs backed, it has |
1530 |
++ * been restored from swap. If the object is stolen however, it will be |
1531 |
++ * full of whatever garbage was left in there. |
1532 |
++ */ |
1533 |
++ if (!state && ifbdev->ifb.obj->stolen) |
1534 |
++ memset_io(info->screen_base, 0, info->screen_size); |
1535 |
++ |
1536 |
++ fb_set_suspend(info, state); |
1537 |
+ } |
1538 |
+ |
1539 |
+ MODULE_LICENSE("GPL and additional rights"); |
1540 |
+diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c |
1541 |
+index 78d8e91..713dd70 100644 |
1542 |
+--- a/drivers/gpu/drm/mgag200/mgag200_mode.c |
1543 |
++++ b/drivers/gpu/drm/mgag200/mgag200_mode.c |
1544 |
+@@ -189,12 +189,12 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock) |
1545 |
+ WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
1546 |
+ tmp = RREG8(DAC_DATA); |
1547 |
+ tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS; |
1548 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL_CLK_DIS, tmp); |
1549 |
++ WREG8(DAC_DATA, tmp); |
1550 |
+ |
1551 |
+ WREG8(DAC_INDEX, MGA1064_REMHEADCTL); |
1552 |
+ tmp = RREG8(DAC_DATA); |
1553 |
+ tmp |= MGA1064_REMHEADCTL_CLKDIS; |
1554 |
+- WREG_DAC(MGA1064_REMHEADCTL, tmp); |
1555 |
++ WREG8(DAC_DATA, tmp); |
1556 |
+ |
1557 |
+ /* select PLL Set C */ |
1558 |
+ tmp = RREG8(MGAREG_MEM_MISC_READ); |
1559 |
+@@ -204,7 +204,7 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock) |
1560 |
+ WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
1561 |
+ tmp = RREG8(DAC_DATA); |
1562 |
+ tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN | 0x80; |
1563 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); |
1564 |
++ WREG8(DAC_DATA, tmp); |
1565 |
+ |
1566 |
+ udelay(500); |
1567 |
+ |
1568 |
+@@ -212,7 +212,7 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock) |
1569 |
+ WREG8(DAC_INDEX, MGA1064_VREF_CTL); |
1570 |
+ tmp = RREG8(DAC_DATA); |
1571 |
+ tmp &= ~0x04; |
1572 |
+- WREG_DAC(MGA1064_VREF_CTL, tmp); |
1573 |
++ WREG8(DAC_DATA, tmp); |
1574 |
+ |
1575 |
+ udelay(50); |
1576 |
+ |
1577 |
+@@ -236,13 +236,13 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock) |
1578 |
+ tmp = RREG8(DAC_DATA); |
1579 |
+ tmp &= ~MGA1064_PIX_CLK_CTL_SEL_MSK; |
1580 |
+ tmp |= MGA1064_PIX_CLK_CTL_SEL_PLL; |
1581 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); |
1582 |
++ WREG8(DAC_DATA, tmp); |
1583 |
+ |
1584 |
+ WREG8(DAC_INDEX, MGA1064_REMHEADCTL); |
1585 |
+ tmp = RREG8(DAC_DATA); |
1586 |
+ tmp &= ~MGA1064_REMHEADCTL_CLKSL_MSK; |
1587 |
+ tmp |= MGA1064_REMHEADCTL_CLKSL_PLL; |
1588 |
+- WREG_DAC(MGA1064_REMHEADCTL, tmp); |
1589 |
++ WREG8(DAC_DATA, tmp); |
1590 |
+ |
1591 |
+ /* reset dotclock rate bit */ |
1592 |
+ WREG8(MGAREG_SEQ_INDEX, 1); |
1593 |
+@@ -253,7 +253,7 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock) |
1594 |
+ WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
1595 |
+ tmp = RREG8(DAC_DATA); |
1596 |
+ tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS; |
1597 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); |
1598 |
++ WREG8(DAC_DATA, tmp); |
1599 |
+ |
1600 |
+ vcount = RREG8(MGAREG_VCOUNT); |
1601 |
+ |
1602 |
+@@ -318,7 +318,7 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock) |
1603 |
+ WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
1604 |
+ tmp = RREG8(DAC_DATA); |
1605 |
+ tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS; |
1606 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL_CLK_DIS, tmp); |
1607 |
++ WREG8(DAC_DATA, tmp); |
1608 |
+ |
1609 |
+ tmp = RREG8(MGAREG_MEM_MISC_READ); |
1610 |
+ tmp |= 0x3 << 2; |
1611 |
+@@ -326,12 +326,12 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock) |
1612 |
+ |
1613 |
+ WREG8(DAC_INDEX, MGA1064_PIX_PLL_STAT); |
1614 |
+ tmp = RREG8(DAC_DATA); |
1615 |
+- WREG_DAC(MGA1064_PIX_PLL_STAT, tmp & ~0x40); |
1616 |
++ WREG8(DAC_DATA, tmp & ~0x40); |
1617 |
+ |
1618 |
+ WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
1619 |
+ tmp = RREG8(DAC_DATA); |
1620 |
+ tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; |
1621 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); |
1622 |
++ WREG8(DAC_DATA, tmp); |
1623 |
+ |
1624 |
+ WREG_DAC(MGA1064_EV_PIX_PLLC_M, m); |
1625 |
+ WREG_DAC(MGA1064_EV_PIX_PLLC_N, n); |
1626 |
+@@ -342,7 +342,7 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock) |
1627 |
+ WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
1628 |
+ tmp = RREG8(DAC_DATA); |
1629 |
+ tmp &= ~MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; |
1630 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); |
1631 |
++ WREG8(DAC_DATA, tmp); |
1632 |
+ |
1633 |
+ udelay(500); |
1634 |
+ |
1635 |
+@@ -350,11 +350,11 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock) |
1636 |
+ tmp = RREG8(DAC_DATA); |
1637 |
+ tmp &= ~MGA1064_PIX_CLK_CTL_SEL_MSK; |
1638 |
+ tmp |= MGA1064_PIX_CLK_CTL_SEL_PLL; |
1639 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); |
1640 |
++ WREG8(DAC_DATA, tmp); |
1641 |
+ |
1642 |
+ WREG8(DAC_INDEX, MGA1064_PIX_PLL_STAT); |
1643 |
+ tmp = RREG8(DAC_DATA); |
1644 |
+- WREG_DAC(MGA1064_PIX_PLL_STAT, tmp | 0x40); |
1645 |
++ WREG8(DAC_DATA, tmp | 0x40); |
1646 |
+ |
1647 |
+ tmp = RREG8(MGAREG_MEM_MISC_READ); |
1648 |
+ tmp |= (0x3 << 2); |
1649 |
+@@ -363,7 +363,7 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock) |
1650 |
+ WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
1651 |
+ tmp = RREG8(DAC_DATA); |
1652 |
+ tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS; |
1653 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); |
1654 |
++ WREG8(DAC_DATA, tmp); |
1655 |
+ |
1656 |
+ return 0; |
1657 |
+ } |
1658 |
+@@ -416,7 +416,7 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) |
1659 |
+ WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
1660 |
+ tmp = RREG8(DAC_DATA); |
1661 |
+ tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS; |
1662 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL_CLK_DIS, tmp); |
1663 |
++ WREG8(DAC_DATA, tmp); |
1664 |
+ |
1665 |
+ tmp = RREG8(MGAREG_MEM_MISC_READ); |
1666 |
+ tmp |= 0x3 << 2; |
1667 |
+@@ -425,7 +425,7 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) |
1668 |
+ WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
1669 |
+ tmp = RREG8(DAC_DATA); |
1670 |
+ tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; |
1671 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); |
1672 |
++ WREG8(DAC_DATA, tmp); |
1673 |
+ |
1674 |
+ udelay(500); |
1675 |
+ |
1676 |
+@@ -439,13 +439,13 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) |
1677 |
+ tmp = RREG8(DAC_DATA); |
1678 |
+ tmp &= ~MGA1064_PIX_CLK_CTL_SEL_MSK; |
1679 |
+ tmp |= MGA1064_PIX_CLK_CTL_SEL_PLL; |
1680 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); |
1681 |
++ WREG8(DAC_DATA, tmp); |
1682 |
+ |
1683 |
+ WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
1684 |
+ tmp = RREG8(DAC_DATA); |
1685 |
+ tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS; |
1686 |
+ tmp &= ~MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; |
1687 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); |
1688 |
++ WREG8(DAC_DATA, tmp); |
1689 |
+ |
1690 |
+ vcount = RREG8(MGAREG_VCOUNT); |
1691 |
+ |
1692 |
+@@ -515,12 +515,12 @@ static int mga_g200er_set_plls(struct mga_device *mdev, long clock) |
1693 |
+ WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
1694 |
+ tmp = RREG8(DAC_DATA); |
1695 |
+ tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS; |
1696 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL_CLK_DIS, tmp); |
1697 |
++ WREG8(DAC_DATA, tmp); |
1698 |
+ |
1699 |
+ WREG8(DAC_INDEX, MGA1064_REMHEADCTL); |
1700 |
+ tmp = RREG8(DAC_DATA); |
1701 |
+ tmp |= MGA1064_REMHEADCTL_CLKDIS; |
1702 |
+- WREG_DAC(MGA1064_REMHEADCTL, tmp); |
1703 |
++ WREG8(DAC_DATA, tmp); |
1704 |
+ |
1705 |
+ tmp = RREG8(MGAREG_MEM_MISC_READ); |
1706 |
+ tmp |= (0x3<<2) | 0xc0; |
1707 |
+@@ -530,7 +530,7 @@ static int mga_g200er_set_plls(struct mga_device *mdev, long clock) |
1708 |
+ tmp = RREG8(DAC_DATA); |
1709 |
+ tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS; |
1710 |
+ tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; |
1711 |
+- WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); |
1712 |
++ WREG8(DAC_DATA, tmp); |
1713 |
+ |
1714 |
+ udelay(500); |
1715 |
+ |
1716 |
+@@ -657,12 +657,26 @@ static void mga_g200wb_commit(struct drm_crtc *crtc) |
1717 |
+ WREG_DAC(MGA1064_GEN_IO_DATA, tmp); |
1718 |
+ } |
1719 |
+ |
1720 |
+- |
1721 |
++/* |
1722 |
++ This is how the framebuffer base address is stored in g200 cards: |
1723 |
++ * Assume @offset is the gpu_addr variable of the framebuffer object |
1724 |
++ * Then addr is the number of _pixels_ (not bytes) from the start of |
1725 |
++ VRAM to the first pixel we want to display. (divided by 2 for 32bit |
1726 |
++ framebuffers) |
1727 |
++ * addr is stored in the CRTCEXT0, CRTCC and CRTCD registers |
1728 |
++ addr<20> -> CRTCEXT0<6> |
1729 |
++ addr<19-16> -> CRTCEXT0<3-0> |
1730 |
++ addr<15-8> -> CRTCC<7-0> |
1731 |
++ addr<7-0> -> CRTCD<7-0> |
1732 |
++ CRTCEXT0 has to be programmed last to trigger an update and make the |
1733 |
++ new addr variable take effect. |
1734 |
++ */ |
1735 |
+ void mga_set_start_address(struct drm_crtc *crtc, unsigned offset) |
1736 |
+ { |
1737 |
+ struct mga_device *mdev = crtc->dev->dev_private; |
1738 |
+ u32 addr; |
1739 |
+ int count; |
1740 |
++ u8 crtcext0; |
1741 |
+ |
1742 |
+ while (RREG8(0x1fda) & 0x08); |
1743 |
+ while (!(RREG8(0x1fda) & 0x08)); |
1744 |
+@@ -670,10 +684,17 @@ void mga_set_start_address(struct drm_crtc *crtc, unsigned offset) |
1745 |
+ count = RREG8(MGAREG_VCOUNT) + 2; |
1746 |
+ while (RREG8(MGAREG_VCOUNT) < count); |
1747 |
+ |
1748 |
+- addr = offset >> 2; |
1749 |
++ WREG8(MGAREG_CRTCEXT_INDEX, 0); |
1750 |
++ crtcext0 = RREG8(MGAREG_CRTCEXT_DATA); |
1751 |
++ crtcext0 &= 0xB0; |
1752 |
++ addr = offset / 8; |
1753 |
++ /* Can't store addresses any higher than that... |
1754 |
++ but we also don't have more than 16MB of memory, so it should be fine. */ |
1755 |
++ WARN_ON(addr > 0x1fffff); |
1756 |
++ crtcext0 |= (!!(addr & (1<<20)))<<6; |
1757 |
+ WREG_CRT(0x0d, (u8)(addr & 0xff)); |
1758 |
+ WREG_CRT(0x0c, (u8)(addr >> 8) & 0xff); |
1759 |
+- WREG_CRT(0xaf, (u8)(addr >> 16) & 0xf); |
1760 |
++ WREG_ECRT(0x0, ((u8)(addr >> 16) & 0xf) | crtcext0); |
1761 |
+ } |
1762 |
+ |
1763 |
+ |
1764 |
+diff --git a/drivers/gpu/drm/radeon/r300_cmdbuf.c b/drivers/gpu/drm/radeon/r300_cmdbuf.c |
1765 |
+index 865e2c9..60170ea 100644 |
1766 |
+--- a/drivers/gpu/drm/radeon/r300_cmdbuf.c |
1767 |
++++ b/drivers/gpu/drm/radeon/r300_cmdbuf.c |
1768 |
+@@ -75,7 +75,7 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, |
1769 |
+ OUT_RING(CP_PACKET0(R300_RE_CLIPRECT_TL_0, nr * 2 - 1)); |
1770 |
+ |
1771 |
+ for (i = 0; i < nr; ++i) { |
1772 |
+- if (DRM_COPY_FROM_USER_UNCHECKED |
1773 |
++ if (DRM_COPY_FROM_USER |
1774 |
+ (&box, &cmdbuf->boxes[n + i], sizeof(box))) { |
1775 |
+ DRM_ERROR("copy cliprect faulted\n"); |
1776 |
+ return -EFAULT; |
1777 |
+diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c |
1778 |
+index 66a7f0f..96cf439 100644 |
1779 |
+--- a/drivers/gpu/drm/radeon/radeon_drv.c |
1780 |
++++ b/drivers/gpu/drm/radeon/radeon_drv.c |
1781 |
+@@ -144,7 +144,7 @@ static inline void radeon_unregister_atpx_handler(void) {} |
1782 |
+ #endif |
1783 |
+ |
1784 |
+ int radeon_no_wb; |
1785 |
+-int radeon_modeset = 1; |
1786 |
++int radeon_modeset = -1; |
1787 |
+ int radeon_dynclks = -1; |
1788 |
+ int radeon_r4xx_atom = 0; |
1789 |
+ int radeon_agpmode = 0; |
1790 |
+@@ -449,6 +449,16 @@ static struct pci_driver radeon_kms_pci_driver = { |
1791 |
+ |
1792 |
+ static int __init radeon_init(void) |
1793 |
+ { |
1794 |
++#ifdef CONFIG_VGA_CONSOLE |
1795 |
++ if (vgacon_text_force() && radeon_modeset == -1) { |
1796 |
++ DRM_INFO("VGACON disable radeon kernel modesetting.\n"); |
1797 |
++ radeon_modeset = 0; |
1798 |
++ } |
1799 |
++#endif |
1800 |
++ /* set to modesetting by default if not nomodeset */ |
1801 |
++ if (radeon_modeset == -1) |
1802 |
++ radeon_modeset = 1; |
1803 |
++ |
1804 |
+ if (radeon_modeset == 1) { |
1805 |
+ DRM_INFO("radeon kernel modesetting enabled.\n"); |
1806 |
+ driver = &kms_driver; |
1807 |
+diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
1808 |
+index aa341d1..e6dbf09 100644 |
1809 |
+--- a/drivers/hid/hid-core.c |
1810 |
++++ b/drivers/hid/hid-core.c |
1811 |
+@@ -1702,6 +1702,7 @@ static const struct hid_device_id hid_have_special_driver[] = { |
1812 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) }, |
1813 |
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, |
1814 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, |
1815 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE) }, |
1816 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) }, |
1817 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, |
1818 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) }, |
1819 |
+diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c |
1820 |
+index c608313..0387e05 100644 |
1821 |
+--- a/drivers/md/dm-bufio.c |
1822 |
++++ b/drivers/md/dm-bufio.c |
1823 |
+@@ -319,6 +319,9 @@ static void __cache_size_refresh(void) |
1824 |
+ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask, |
1825 |
+ enum data_mode *data_mode) |
1826 |
+ { |
1827 |
++ unsigned noio_flag; |
1828 |
++ void *ptr; |
1829 |
++ |
1830 |
+ if (c->block_size <= DM_BUFIO_BLOCK_SIZE_SLAB_LIMIT) { |
1831 |
+ *data_mode = DATA_MODE_SLAB; |
1832 |
+ return kmem_cache_alloc(DM_BUFIO_CACHE(c), gfp_mask); |
1833 |
+@@ -332,7 +335,26 @@ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask, |
1834 |
+ } |
1835 |
+ |
1836 |
+ *data_mode = DATA_MODE_VMALLOC; |
1837 |
+- return __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL); |
1838 |
++ |
1839 |
++ /* |
1840 |
++ * __vmalloc allocates the data pages and auxiliary structures with |
1841 |
++ * gfp_flags that were specified, but pagetables are always allocated |
1842 |
++ * with GFP_KERNEL, no matter what was specified as gfp_mask. |
1843 |
++ * |
1844 |
++ * Consequently, we must set per-process flag PF_MEMALLOC_NOIO so that |
1845 |
++ * all allocations done by this process (including pagetables) are done |
1846 |
++ * as if GFP_NOIO was specified. |
1847 |
++ */ |
1848 |
++ |
1849 |
++ if (gfp_mask & __GFP_NORETRY) |
1850 |
++ noio_flag = memalloc_noio_save(); |
1851 |
++ |
1852 |
++ ptr = __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL); |
1853 |
++ |
1854 |
++ if (gfp_mask & __GFP_NORETRY) |
1855 |
++ memalloc_noio_restore(noio_flag); |
1856 |
++ |
1857 |
++ return ptr; |
1858 |
+ } |
1859 |
+ |
1860 |
+ /* |
1861 |
+diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c |
1862 |
+index 1074409..6feaba2 100644 |
1863 |
+--- a/drivers/md/dm-cache-target.c |
1864 |
++++ b/drivers/md/dm-cache-target.c |
1865 |
+@@ -1971,6 +1971,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) |
1866 |
+ atomic_set(&cache->nr_migrations, 0); |
1867 |
+ init_waitqueue_head(&cache->migration_wait); |
1868 |
+ |
1869 |
++ r = -ENOMEM; |
1870 |
+ cache->nr_dirty = 0; |
1871 |
+ cache->dirty_bitset = alloc_bitset(from_cblock(cache->cache_size)); |
1872 |
+ if (!cache->dirty_bitset) { |
1873 |
+diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c |
1874 |
+index c0e0702..c434e5a 100644 |
1875 |
+--- a/drivers/md/dm-snap.c |
1876 |
++++ b/drivers/md/dm-snap.c |
1877 |
+@@ -1121,6 +1121,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) |
1878 |
+ s->pending_pool = mempool_create_slab_pool(MIN_IOS, pending_cache); |
1879 |
+ if (!s->pending_pool) { |
1880 |
+ ti->error = "Could not allocate mempool for pending exceptions"; |
1881 |
++ r = -ENOMEM; |
1882 |
+ goto bad_pending_pool; |
1883 |
+ } |
1884 |
+ |
1885 |
+diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c |
1886 |
+index d8837d3..7b8b2b9 100644 |
1887 |
+--- a/drivers/md/dm-stripe.c |
1888 |
++++ b/drivers/md/dm-stripe.c |
1889 |
+@@ -94,7 +94,7 @@ static int get_stripe(struct dm_target *ti, struct stripe_c *sc, |
1890 |
+ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) |
1891 |
+ { |
1892 |
+ struct stripe_c *sc; |
1893 |
+- sector_t width; |
1894 |
++ sector_t width, tmp_len; |
1895 |
+ uint32_t stripes; |
1896 |
+ uint32_t chunk_size; |
1897 |
+ int r; |
1898 |
+@@ -116,15 +116,16 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) |
1899 |
+ } |
1900 |
+ |
1901 |
+ width = ti->len; |
1902 |
+- if (sector_div(width, chunk_size)) { |
1903 |
++ if (sector_div(width, stripes)) { |
1904 |
+ ti->error = "Target length not divisible by " |
1905 |
+- "chunk size"; |
1906 |
++ "number of stripes"; |
1907 |
+ return -EINVAL; |
1908 |
+ } |
1909 |
+ |
1910 |
+- if (sector_div(width, stripes)) { |
1911 |
++ tmp_len = width; |
1912 |
++ if (sector_div(tmp_len, chunk_size)) { |
1913 |
+ ti->error = "Target length not divisible by " |
1914 |
+- "number of stripes"; |
1915 |
++ "chunk size"; |
1916 |
+ return -EINVAL; |
1917 |
+ } |
1918 |
+ |
1919 |
+diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c |
1920 |
+index e50dad0..1ff252a 100644 |
1921 |
+--- a/drivers/md/dm-table.c |
1922 |
++++ b/drivers/md/dm-table.c |
1923 |
+@@ -1442,7 +1442,7 @@ static bool dm_table_supports_write_same(struct dm_table *t) |
1924 |
+ return false; |
1925 |
+ |
1926 |
+ if (!ti->type->iterate_devices || |
1927 |
+- !ti->type->iterate_devices(ti, device_not_write_same_capable, NULL)) |
1928 |
++ ti->type->iterate_devices(ti, device_not_write_same_capable, NULL)) |
1929 |
+ return false; |
1930 |
+ } |
1931 |
+ |
1932 |
+diff --git a/drivers/net/ethernet/3com/3c509.c b/drivers/net/ethernet/3com/3c509.c |
1933 |
+index f36ff99..adb4bf5 100644 |
1934 |
+--- a/drivers/net/ethernet/3com/3c509.c |
1935 |
++++ b/drivers/net/ethernet/3com/3c509.c |
1936 |
+@@ -306,6 +306,7 @@ static int el3_isa_match(struct device *pdev, unsigned int ndev) |
1937 |
+ if (!dev) |
1938 |
+ return -ENOMEM; |
1939 |
+ |
1940 |
++ SET_NETDEV_DEV(dev, pdev); |
1941 |
+ netdev_boot_setup_check(dev); |
1942 |
+ |
1943 |
+ if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509-isa")) { |
1944 |
+@@ -595,6 +596,7 @@ static int __init el3_eisa_probe (struct device *device) |
1945 |
+ return -ENOMEM; |
1946 |
+ } |
1947 |
+ |
1948 |
++ SET_NETDEV_DEV(dev, device); |
1949 |
+ netdev_boot_setup_check(dev); |
1950 |
+ |
1951 |
+ el3_dev_fill(dev, phys_addr, ioaddr, irq, if_port, EL3_EISA); |
1952 |
+diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c |
1953 |
+index 1928e20..072c6f1 100644 |
1954 |
+--- a/drivers/net/ethernet/3com/3c59x.c |
1955 |
++++ b/drivers/net/ethernet/3com/3c59x.c |
1956 |
+@@ -632,7 +632,6 @@ struct vortex_private { |
1957 |
+ pm_state_valid:1, /* pci_dev->saved_config_space has sane contents */ |
1958 |
+ open:1, |
1959 |
+ medialock:1, |
1960 |
+- must_free_region:1, /* Flag: if zero, Cardbus owns the I/O region */ |
1961 |
+ large_frames:1, /* accept large frames */ |
1962 |
+ handling_irq:1; /* private in_irq indicator */ |
1963 |
+ /* {get|set}_wol operations are already serialized by rtnl. |
1964 |
+@@ -951,7 +950,7 @@ static int vortex_eisa_remove(struct device *device) |
1965 |
+ |
1966 |
+ unregister_netdev(dev); |
1967 |
+ iowrite16(TotalReset|0x14, ioaddr + EL3_CMD); |
1968 |
+- release_region(dev->base_addr, VORTEX_TOTAL_SIZE); |
1969 |
++ release_region(edev->base_addr, VORTEX_TOTAL_SIZE); |
1970 |
+ |
1971 |
+ free_netdev(dev); |
1972 |
+ return 0; |
1973 |
+@@ -1012,6 +1011,12 @@ static int vortex_init_one(struct pci_dev *pdev, |
1974 |
+ if (rc < 0) |
1975 |
+ goto out; |
1976 |
+ |
1977 |
++ rc = pci_request_regions(pdev, DRV_NAME); |
1978 |
++ if (rc < 0) { |
1979 |
++ pci_disable_device(pdev); |
1980 |
++ goto out; |
1981 |
++ } |
1982 |
++ |
1983 |
+ unit = vortex_cards_found; |
1984 |
+ |
1985 |
+ if (global_use_mmio < 0 && (unit >= MAX_UNITS || use_mmio[unit] < 0)) { |
1986 |
+@@ -1027,6 +1032,7 @@ static int vortex_init_one(struct pci_dev *pdev, |
1987 |
+ if (!ioaddr) /* If mapping fails, fall-back to BAR 0... */ |
1988 |
+ ioaddr = pci_iomap(pdev, 0, 0); |
1989 |
+ if (!ioaddr) { |
1990 |
++ pci_release_regions(pdev); |
1991 |
+ pci_disable_device(pdev); |
1992 |
+ rc = -ENOMEM; |
1993 |
+ goto out; |
1994 |
+@@ -1036,6 +1042,7 @@ static int vortex_init_one(struct pci_dev *pdev, |
1995 |
+ ent->driver_data, unit); |
1996 |
+ if (rc < 0) { |
1997 |
+ pci_iounmap(pdev, ioaddr); |
1998 |
++ pci_release_regions(pdev); |
1999 |
+ pci_disable_device(pdev); |
2000 |
+ goto out; |
2001 |
+ } |
2002 |
+@@ -1178,11 +1185,6 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq, |
2003 |
+ |
2004 |
+ /* PCI-only startup logic */ |
2005 |
+ if (pdev) { |
2006 |
+- /* EISA resources already marked, so only PCI needs to do this here */ |
2007 |
+- /* Ignore return value, because Cardbus drivers already allocate for us */ |
2008 |
+- if (request_region(dev->base_addr, vci->io_size, print_name) != NULL) |
2009 |
+- vp->must_free_region = 1; |
2010 |
+- |
2011 |
+ /* enable bus-mastering if necessary */ |
2012 |
+ if (vci->flags & PCI_USES_MASTER) |
2013 |
+ pci_set_master(pdev); |
2014 |
+@@ -1220,7 +1222,7 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq, |
2015 |
+ &vp->rx_ring_dma); |
2016 |
+ retval = -ENOMEM; |
2017 |
+ if (!vp->rx_ring) |
2018 |
+- goto free_region; |
2019 |
++ goto free_device; |
2020 |
+ |
2021 |
+ vp->tx_ring = (struct boom_tx_desc *)(vp->rx_ring + RX_RING_SIZE); |
2022 |
+ vp->tx_ring_dma = vp->rx_ring_dma + sizeof(struct boom_rx_desc) * RX_RING_SIZE; |
2023 |
+@@ -1484,9 +1486,7 @@ free_ring: |
2024 |
+ + sizeof(struct boom_tx_desc) * TX_RING_SIZE, |
2025 |
+ vp->rx_ring, |
2026 |
+ vp->rx_ring_dma); |
2027 |
+-free_region: |
2028 |
+- if (vp->must_free_region) |
2029 |
+- release_region(dev->base_addr, vci->io_size); |
2030 |
++free_device: |
2031 |
+ free_netdev(dev); |
2032 |
+ pr_err(PFX "vortex_probe1 fails. Returns %d\n", retval); |
2033 |
+ out: |
2034 |
+@@ -3254,8 +3254,9 @@ static void vortex_remove_one(struct pci_dev *pdev) |
2035 |
+ + sizeof(struct boom_tx_desc) * TX_RING_SIZE, |
2036 |
+ vp->rx_ring, |
2037 |
+ vp->rx_ring_dma); |
2038 |
+- if (vp->must_free_region) |
2039 |
+- release_region(dev->base_addr, vp->io_size); |
2040 |
++ |
2041 |
++ pci_release_regions(pdev); |
2042 |
++ |
2043 |
+ free_netdev(dev); |
2044 |
+ } |
2045 |
+ |
2046 |
+diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c |
2047 |
+index 0095ce9..97dd8f18 100644 |
2048 |
+--- a/drivers/net/ethernet/sfc/mcdi.c |
2049 |
++++ b/drivers/net/ethernet/sfc/mcdi.c |
2050 |
+@@ -667,7 +667,7 @@ fail: |
2051 |
+ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, |
2052 |
+ u16 *fw_subtype_list, u32 *capabilities) |
2053 |
+ { |
2054 |
+- uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMIN]; |
2055 |
++ uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMAX]; |
2056 |
+ size_t outlen, offset, i; |
2057 |
+ int port_num = efx_port_num(efx); |
2058 |
+ int rc; |
2059 |
+diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c |
2060 |
+index 66e025a..f3c2d03 100644 |
2061 |
+--- a/drivers/net/ethernet/tile/tilegx.c |
2062 |
++++ b/drivers/net/ethernet/tile/tilegx.c |
2063 |
+@@ -930,7 +930,7 @@ static int tile_net_setup_interrupts(struct net_device *dev) |
2064 |
+ if (info->has_iqueue) { |
2065 |
+ gxio_mpipe_request_notif_ring_interrupt( |
2066 |
+ &context, cpu_x(cpu), cpu_y(cpu), |
2067 |
+- 1, ingress_irq, info->iqueue.ring); |
2068 |
++ KERNEL_PL, ingress_irq, info->iqueue.ring); |
2069 |
+ } |
2070 |
+ } |
2071 |
+ |
2072 |
+diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c |
2073 |
+index 73abbc1..011062e 100644 |
2074 |
+--- a/drivers/net/macvlan.c |
2075 |
++++ b/drivers/net/macvlan.c |
2076 |
+@@ -222,7 +222,8 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb) |
2077 |
+ } |
2078 |
+ |
2079 |
+ if (port->passthru) |
2080 |
+- vlan = list_first_entry(&port->vlans, struct macvlan_dev, list); |
2081 |
++ vlan = list_first_or_null_rcu(&port->vlans, |
2082 |
++ struct macvlan_dev, list); |
2083 |
+ else |
2084 |
+ vlan = macvlan_hash_lookup(port, eth->h_dest); |
2085 |
+ if (vlan == NULL) |
2086 |
+@@ -807,7 +808,7 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, |
2087 |
+ if (err < 0) |
2088 |
+ goto upper_dev_unlink; |
2089 |
+ |
2090 |
+- list_add_tail(&vlan->list, &port->vlans); |
2091 |
++ list_add_tail_rcu(&vlan->list, &port->vlans); |
2092 |
+ netif_stacked_transfer_operstate(lowerdev, dev); |
2093 |
+ |
2094 |
+ return 0; |
2095 |
+@@ -835,7 +836,7 @@ void macvlan_dellink(struct net_device *dev, struct list_head *head) |
2096 |
+ { |
2097 |
+ struct macvlan_dev *vlan = netdev_priv(dev); |
2098 |
+ |
2099 |
+- list_del(&vlan->list); |
2100 |
++ list_del_rcu(&vlan->list); |
2101 |
+ unregister_netdevice_queue(dev, head); |
2102 |
+ netdev_upper_dev_unlink(vlan->lowerdev, dev); |
2103 |
+ } |
2104 |
+diff --git a/drivers/net/tun.c b/drivers/net/tun.c |
2105 |
+index 729ed53..755fa9e 100644 |
2106 |
+--- a/drivers/net/tun.c |
2107 |
++++ b/drivers/net/tun.c |
2108 |
+@@ -1471,14 +1471,17 @@ static int tun_recvmsg(struct kiocb *iocb, struct socket *sock, |
2109 |
+ if (!tun) |
2110 |
+ return -EBADFD; |
2111 |
+ |
2112 |
+- if (flags & ~(MSG_DONTWAIT|MSG_TRUNC)) |
2113 |
+- return -EINVAL; |
2114 |
++ if (flags & ~(MSG_DONTWAIT|MSG_TRUNC)) { |
2115 |
++ ret = -EINVAL; |
2116 |
++ goto out; |
2117 |
++ } |
2118 |
+ ret = tun_do_read(tun, tfile, iocb, m->msg_iov, total_len, |
2119 |
+ flags & MSG_DONTWAIT); |
2120 |
+ if (ret > total_len) { |
2121 |
+ m->msg_flags |= MSG_TRUNC; |
2122 |
+ ret = flags & MSG_TRUNC ? ret : total_len; |
2123 |
+ } |
2124 |
++out: |
2125 |
+ tun_put(tun); |
2126 |
+ return ret; |
2127 |
+ } |
2128 |
+diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c |
2129 |
+index f7f623a..577c72d 100644 |
2130 |
+--- a/drivers/net/usb/asix_common.c |
2131 |
++++ b/drivers/net/usb/asix_common.c |
2132 |
+@@ -100,6 +100,9 @@ int asix_rx_fixup_internal(struct usbnet *dev, struct sk_buff *skb, |
2133 |
+ netdev_err(dev->net, "asix_rx_fixup() Bad RX Length %d\n", |
2134 |
+ rx->size); |
2135 |
+ kfree_skb(rx->ax_skb); |
2136 |
++ rx->ax_skb = NULL; |
2137 |
++ rx->size = 0U; |
2138 |
++ |
2139 |
+ return 0; |
2140 |
+ } |
2141 |
+ |
2142 |
+diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c |
2143 |
+index 988372d..e509c37 100644 |
2144 |
+--- a/drivers/net/wireless/ath/ath9k/main.c |
2145 |
++++ b/drivers/net/wireless/ath/ath9k/main.c |
2146 |
+@@ -1308,6 +1308,7 @@ static int ath9k_sta_add(struct ieee80211_hw *hw, |
2147 |
+ struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
2148 |
+ struct ath_node *an = (struct ath_node *) sta->drv_priv; |
2149 |
+ struct ieee80211_key_conf ps_key = { }; |
2150 |
++ int key; |
2151 |
+ |
2152 |
+ ath_node_attach(sc, sta, vif); |
2153 |
+ |
2154 |
+@@ -1315,7 +1316,9 @@ static int ath9k_sta_add(struct ieee80211_hw *hw, |
2155 |
+ vif->type != NL80211_IFTYPE_AP_VLAN) |
2156 |
+ return 0; |
2157 |
+ |
2158 |
+- an->ps_key = ath_key_config(common, vif, sta, &ps_key); |
2159 |
++ key = ath_key_config(common, vif, sta, &ps_key); |
2160 |
++ if (key > 0) |
2161 |
++ an->ps_key = key; |
2162 |
+ |
2163 |
+ return 0; |
2164 |
+ } |
2165 |
+@@ -1332,6 +1335,7 @@ static void ath9k_del_ps_key(struct ath_softc *sc, |
2166 |
+ return; |
2167 |
+ |
2168 |
+ ath_key_delete(common, &ps_key); |
2169 |
++ an->ps_key = 0; |
2170 |
+ } |
2171 |
+ |
2172 |
+ static int ath9k_sta_remove(struct ieee80211_hw *hw, |
2173 |
+diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c |
2174 |
+index 1221469..ee3d640 100644 |
2175 |
+--- a/drivers/net/wireless/b43/dma.c |
2176 |
++++ b/drivers/net/wireless/b43/dma.c |
2177 |
+@@ -1733,6 +1733,25 @@ drop_recycle_buffer: |
2178 |
+ sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize); |
2179 |
+ } |
2180 |
+ |
2181 |
++void b43_dma_handle_rx_overflow(struct b43_dmaring *ring) |
2182 |
++{ |
2183 |
++ int current_slot, previous_slot; |
2184 |
++ |
2185 |
++ B43_WARN_ON(ring->tx); |
2186 |
++ |
2187 |
++ /* Device has filled all buffers, drop all packets and let TCP |
2188 |
++ * decrease speed. |
2189 |
++ * Decrement RX index by one will let the device to see all slots |
2190 |
++ * as free again |
2191 |
++ */ |
2192 |
++ /* |
2193 |
++ *TODO: How to increase rx_drop in mac80211? |
2194 |
++ */ |
2195 |
++ current_slot = ring->ops->get_current_rxslot(ring); |
2196 |
++ previous_slot = prev_slot(ring, current_slot); |
2197 |
++ ring->ops->set_current_rxslot(ring, previous_slot); |
2198 |
++} |
2199 |
++ |
2200 |
+ void b43_dma_rx(struct b43_dmaring *ring) |
2201 |
+ { |
2202 |
+ const struct b43_dma_ops *ops = ring->ops; |
2203 |
+diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h |
2204 |
+index 9fdd198..df8c8cd 100644 |
2205 |
+--- a/drivers/net/wireless/b43/dma.h |
2206 |
++++ b/drivers/net/wireless/b43/dma.h |
2207 |
+@@ -9,7 +9,7 @@ |
2208 |
+ /* DMA-Interrupt reasons. */ |
2209 |
+ #define B43_DMAIRQ_FATALMASK ((1 << 10) | (1 << 11) | (1 << 12) \ |
2210 |
+ | (1 << 14) | (1 << 15)) |
2211 |
+-#define B43_DMAIRQ_NONFATALMASK (1 << 13) |
2212 |
++#define B43_DMAIRQ_RDESC_UFLOW (1 << 13) |
2213 |
+ #define B43_DMAIRQ_RX_DONE (1 << 16) |
2214 |
+ |
2215 |
+ /*** 32-bit DMA Engine. ***/ |
2216 |
+@@ -295,6 +295,8 @@ int b43_dma_tx(struct b43_wldev *dev, |
2217 |
+ void b43_dma_handle_txstatus(struct b43_wldev *dev, |
2218 |
+ const struct b43_txstatus *status); |
2219 |
+ |
2220 |
++void b43_dma_handle_rx_overflow(struct b43_dmaring *ring); |
2221 |
++ |
2222 |
+ void b43_dma_rx(struct b43_dmaring *ring); |
2223 |
+ |
2224 |
+ void b43_dma_direct_fifo_rx(struct b43_wldev *dev, |
2225 |
+diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c |
2226 |
+index 0568273..64b637a 100644 |
2227 |
+--- a/drivers/net/wireless/b43/main.c |
2228 |
++++ b/drivers/net/wireless/b43/main.c |
2229 |
+@@ -1895,30 +1895,18 @@ static void b43_do_interrupt_thread(struct b43_wldev *dev) |
2230 |
+ } |
2231 |
+ } |
2232 |
+ |
2233 |
+- if (unlikely(merged_dma_reason & (B43_DMAIRQ_FATALMASK | |
2234 |
+- B43_DMAIRQ_NONFATALMASK))) { |
2235 |
+- if (merged_dma_reason & B43_DMAIRQ_FATALMASK) { |
2236 |
+- b43err(dev->wl, "Fatal DMA error: " |
2237 |
+- "0x%08X, 0x%08X, 0x%08X, " |
2238 |
+- "0x%08X, 0x%08X, 0x%08X\n", |
2239 |
+- dma_reason[0], dma_reason[1], |
2240 |
+- dma_reason[2], dma_reason[3], |
2241 |
+- dma_reason[4], dma_reason[5]); |
2242 |
+- b43err(dev->wl, "This device does not support DMA " |
2243 |
++ if (unlikely(merged_dma_reason & (B43_DMAIRQ_FATALMASK))) { |
2244 |
++ b43err(dev->wl, |
2245 |
++ "Fatal DMA error: 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X\n", |
2246 |
++ dma_reason[0], dma_reason[1], |
2247 |
++ dma_reason[2], dma_reason[3], |
2248 |
++ dma_reason[4], dma_reason[5]); |
2249 |
++ b43err(dev->wl, "This device does not support DMA " |
2250 |
+ "on your system. It will now be switched to PIO.\n"); |
2251 |
+- /* Fall back to PIO transfers if we get fatal DMA errors! */ |
2252 |
+- dev->use_pio = true; |
2253 |
+- b43_controller_restart(dev, "DMA error"); |
2254 |
+- return; |
2255 |
+- } |
2256 |
+- if (merged_dma_reason & B43_DMAIRQ_NONFATALMASK) { |
2257 |
+- b43err(dev->wl, "DMA error: " |
2258 |
+- "0x%08X, 0x%08X, 0x%08X, " |
2259 |
+- "0x%08X, 0x%08X, 0x%08X\n", |
2260 |
+- dma_reason[0], dma_reason[1], |
2261 |
+- dma_reason[2], dma_reason[3], |
2262 |
+- dma_reason[4], dma_reason[5]); |
2263 |
+- } |
2264 |
++ /* Fall back to PIO transfers if we get fatal DMA errors! */ |
2265 |
++ dev->use_pio = true; |
2266 |
++ b43_controller_restart(dev, "DMA error"); |
2267 |
++ return; |
2268 |
+ } |
2269 |
+ |
2270 |
+ if (unlikely(reason & B43_IRQ_UCODE_DEBUG)) |
2271 |
+@@ -1937,6 +1925,11 @@ static void b43_do_interrupt_thread(struct b43_wldev *dev) |
2272 |
+ handle_irq_noise(dev); |
2273 |
+ |
2274 |
+ /* Check the DMA reason registers for received data. */ |
2275 |
++ if (dma_reason[0] & B43_DMAIRQ_RDESC_UFLOW) { |
2276 |
++ if (B43_DEBUG) |
2277 |
++ b43warn(dev->wl, "RX descriptor underrun\n"); |
2278 |
++ b43_dma_handle_rx_overflow(dev->dma.rx_ring); |
2279 |
++ } |
2280 |
+ if (dma_reason[0] & B43_DMAIRQ_RX_DONE) { |
2281 |
+ if (b43_using_pio_transfers(dev)) |
2282 |
+ b43_pio_rx(dev->pio.rx_queue); |
2283 |
+@@ -1994,7 +1987,7 @@ static irqreturn_t b43_do_interrupt(struct b43_wldev *dev) |
2284 |
+ return IRQ_NONE; |
2285 |
+ |
2286 |
+ dev->dma_reason[0] = b43_read32(dev, B43_MMIO_DMA0_REASON) |
2287 |
+- & 0x0001DC00; |
2288 |
++ & 0x0001FC00; |
2289 |
+ dev->dma_reason[1] = b43_read32(dev, B43_MMIO_DMA1_REASON) |
2290 |
+ & 0x0000DC00; |
2291 |
+ dev->dma_reason[2] = b43_read32(dev, B43_MMIO_DMA2_REASON) |
2292 |
+@@ -3126,7 +3119,7 @@ static int b43_chip_init(struct b43_wldev *dev) |
2293 |
+ b43_write32(dev, 0x018C, 0x02000000); |
2294 |
+ } |
2295 |
+ b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, 0x00004000); |
2296 |
+- b43_write32(dev, B43_MMIO_DMA0_IRQ_MASK, 0x0001DC00); |
2297 |
++ b43_write32(dev, B43_MMIO_DMA0_IRQ_MASK, 0x0001FC00); |
2298 |
+ b43_write32(dev, B43_MMIO_DMA1_IRQ_MASK, 0x0000DC00); |
2299 |
+ b43_write32(dev, B43_MMIO_DMA2_IRQ_MASK, 0x0000DC00); |
2300 |
+ b43_write32(dev, B43_MMIO_DMA3_IRQ_MASK, 0x0001DC00); |
2301 |
+diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c |
2302 |
+index 7941eb3..cbaa777 100644 |
2303 |
+--- a/drivers/net/wireless/iwlegacy/4965-mac.c |
2304 |
++++ b/drivers/net/wireless/iwlegacy/4965-mac.c |
2305 |
+@@ -5740,8 +5740,7 @@ il4965_mac_setup_register(struct il_priv *il, u32 max_probe_length) |
2306 |
+ hw->flags = |
2307 |
+ IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_AMPDU_AGGREGATION | |
2308 |
+ IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC | IEEE80211_HW_SPECTRUM_MGMT | |
2309 |
+- IEEE80211_HW_REPORTS_TX_ACK_STATUS | IEEE80211_HW_SUPPORTS_PS | |
2310 |
+- IEEE80211_HW_SUPPORTS_DYNAMIC_PS; |
2311 |
++ IEEE80211_HW_SUPPORTS_PS | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; |
2312 |
+ if (il->cfg->sku & IL_SKU_N) |
2313 |
+ hw->flags |= |
2314 |
+ IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | |
2315 |
+diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c |
2316 |
+index 8aaf56a..c13f6e9 100644 |
2317 |
+--- a/drivers/net/wireless/mwifiex/cfg80211.c |
2318 |
++++ b/drivers/net/wireless/mwifiex/cfg80211.c |
2319 |
+@@ -2280,9 +2280,6 @@ int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) |
2320 |
+ if (wdev->netdev->reg_state == NETREG_REGISTERED) |
2321 |
+ unregister_netdevice(wdev->netdev); |
2322 |
+ |
2323 |
+- if (wdev->netdev->reg_state == NETREG_UNREGISTERED) |
2324 |
+- free_netdev(wdev->netdev); |
2325 |
+- |
2326 |
+ /* Clear the priv in adapter */ |
2327 |
+ priv->netdev = NULL; |
2328 |
+ |
2329 |
+diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c |
2330 |
+index b5c8b96..aeade10 100644 |
2331 |
+--- a/drivers/net/wireless/mwifiex/cmdevt.c |
2332 |
++++ b/drivers/net/wireless/mwifiex/cmdevt.c |
2333 |
+@@ -1176,6 +1176,7 @@ mwifiex_process_hs_config(struct mwifiex_adapter *adapter) |
2334 |
+ adapter->if_ops.wakeup(adapter); |
2335 |
+ adapter->hs_activated = false; |
2336 |
+ adapter->is_hs_configured = false; |
2337 |
++ adapter->is_suspended = false; |
2338 |
+ mwifiex_hs_activated_event(mwifiex_get_priv(adapter, |
2339 |
+ MWIFIEX_BSS_ROLE_ANY), |
2340 |
+ false); |
2341 |
+diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c |
2342 |
+index 9c802ed..6d9bc63 100644 |
2343 |
+--- a/drivers/net/wireless/mwifiex/main.c |
2344 |
++++ b/drivers/net/wireless/mwifiex/main.c |
2345 |
+@@ -646,6 +646,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv, |
2346 |
+ struct net_device *dev) |
2347 |
+ { |
2348 |
+ dev->netdev_ops = &mwifiex_netdev_ops; |
2349 |
++ dev->destructor = free_netdev; |
2350 |
+ /* Initialize private structure */ |
2351 |
+ priv->current_key_index = 0; |
2352 |
+ priv->media_connected = false; |
2353 |
+diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c |
2354 |
+index 13100f8..fb420fe 100644 |
2355 |
+--- a/drivers/net/wireless/mwifiex/sta_ioctl.c |
2356 |
++++ b/drivers/net/wireless/mwifiex/sta_ioctl.c |
2357 |
+@@ -99,7 +99,7 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv, |
2358 |
+ } else { |
2359 |
+ /* Multicast */ |
2360 |
+ priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_PROMISCUOUS_ENABLE; |
2361 |
+- if (mcast_list->mode == MWIFIEX_MULTICAST_MODE) { |
2362 |
++ if (mcast_list->mode == MWIFIEX_ALL_MULTI_MODE) { |
2363 |
+ dev_dbg(priv->adapter->dev, |
2364 |
+ "info: Enabling All Multicast!\n"); |
2365 |
+ priv->curr_pkt_filter |= |
2366 |
+@@ -111,20 +111,11 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv, |
2367 |
+ dev_dbg(priv->adapter->dev, |
2368 |
+ "info: Set multicast list=%d\n", |
2369 |
+ mcast_list->num_multicast_addr); |
2370 |
+- /* Set multicast addresses to firmware */ |
2371 |
+- if (old_pkt_filter == priv->curr_pkt_filter) { |
2372 |
+- /* Send request to firmware */ |
2373 |
+- ret = mwifiex_send_cmd_async(priv, |
2374 |
+- HostCmd_CMD_MAC_MULTICAST_ADR, |
2375 |
+- HostCmd_ACT_GEN_SET, 0, |
2376 |
+- mcast_list); |
2377 |
+- } else { |
2378 |
+- /* Send request to firmware */ |
2379 |
+- ret = mwifiex_send_cmd_async(priv, |
2380 |
+- HostCmd_CMD_MAC_MULTICAST_ADR, |
2381 |
+- HostCmd_ACT_GEN_SET, 0, |
2382 |
+- mcast_list); |
2383 |
+- } |
2384 |
++ /* Send multicast addresses to firmware */ |
2385 |
++ ret = mwifiex_send_cmd_async(priv, |
2386 |
++ HostCmd_CMD_MAC_MULTICAST_ADR, |
2387 |
++ HostCmd_ACT_GEN_SET, 0, |
2388 |
++ mcast_list); |
2389 |
+ } |
2390 |
+ } |
2391 |
+ } |
2392 |
+diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c |
2393 |
+index e64a7a8..a8e43cf 100644 |
2394 |
+--- a/drivers/platform/x86/hp_accel.c |
2395 |
++++ b/drivers/platform/x86/hp_accel.c |
2396 |
+@@ -362,7 +362,8 @@ static int lis3lv02d_suspend(struct device *dev) |
2397 |
+ |
2398 |
+ static int lis3lv02d_resume(struct device *dev) |
2399 |
+ { |
2400 |
+- return lis3lv02d_poweron(&lis3_dev); |
2401 |
++ lis3lv02d_poweron(&lis3_dev); |
2402 |
++ return 0; |
2403 |
+ } |
2404 |
+ |
2405 |
+ static SIMPLE_DEV_PM_OPS(hp_accel_pm, lis3lv02d_suspend, lis3lv02d_resume); |
2406 |
+diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig |
2407 |
+index 79fbe38..9e95473 100644 |
2408 |
+--- a/drivers/rtc/Kconfig |
2409 |
++++ b/drivers/rtc/Kconfig |
2410 |
+@@ -20,7 +20,6 @@ if RTC_CLASS |
2411 |
+ config RTC_HCTOSYS |
2412 |
+ bool "Set system time from RTC on startup and resume" |
2413 |
+ default y |
2414 |
+- depends on !ALWAYS_USE_PERSISTENT_CLOCK |
2415 |
+ help |
2416 |
+ If you say yes here, the system time (wall clock) will be set using |
2417 |
+ the value read from a specified RTC device. This is useful to avoid |
2418 |
+@@ -29,7 +28,6 @@ config RTC_HCTOSYS |
2419 |
+ config RTC_SYSTOHC |
2420 |
+ bool "Set the RTC time based on NTP synchronization" |
2421 |
+ default y |
2422 |
+- depends on !ALWAYS_USE_PERSISTENT_CLOCK |
2423 |
+ help |
2424 |
+ If you say yes here, the system time (wall clock) will be stored |
2425 |
+ in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11 |
2426 |
+diff --git a/drivers/rtc/rtc-pcf2123.c b/drivers/rtc/rtc-pcf2123.c |
2427 |
+index 02b742a..6dd6b38 100644 |
2428 |
+--- a/drivers/rtc/rtc-pcf2123.c |
2429 |
++++ b/drivers/rtc/rtc-pcf2123.c |
2430 |
+@@ -265,6 +265,7 @@ static int pcf2123_probe(struct spi_device *spi) |
2431 |
+ |
2432 |
+ if (!(rxbuf[0] & 0x20)) { |
2433 |
+ dev_err(&spi->dev, "chip not found\n"); |
2434 |
++ ret = -ENODEV; |
2435 |
+ goto kfree_exit; |
2436 |
+ } |
2437 |
+ |
2438 |
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c |
2439 |
+index 7992635..82910cc 100644 |
2440 |
+--- a/drivers/scsi/sd.c |
2441 |
++++ b/drivers/scsi/sd.c |
2442 |
+@@ -142,6 +142,7 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr, |
2443 |
+ char *buffer_data; |
2444 |
+ struct scsi_mode_data data; |
2445 |
+ struct scsi_sense_hdr sshdr; |
2446 |
++ const char *temp = "temporary "; |
2447 |
+ int len; |
2448 |
+ |
2449 |
+ if (sdp->type != TYPE_DISK) |
2450 |
+@@ -150,6 +151,13 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr, |
2451 |
+ * it's not worth the risk */ |
2452 |
+ return -EINVAL; |
2453 |
+ |
2454 |
++ if (strncmp(buf, temp, sizeof(temp) - 1) == 0) { |
2455 |
++ buf += sizeof(temp) - 1; |
2456 |
++ sdkp->cache_override = 1; |
2457 |
++ } else { |
2458 |
++ sdkp->cache_override = 0; |
2459 |
++ } |
2460 |
++ |
2461 |
+ for (i = 0; i < ARRAY_SIZE(sd_cache_types); i++) { |
2462 |
+ len = strlen(sd_cache_types[i]); |
2463 |
+ if (strncmp(sd_cache_types[i], buf, len) == 0 && |
2464 |
+@@ -162,6 +170,13 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr, |
2465 |
+ return -EINVAL; |
2466 |
+ rcd = ct & 0x01 ? 1 : 0; |
2467 |
+ wce = ct & 0x02 ? 1 : 0; |
2468 |
++ |
2469 |
++ if (sdkp->cache_override) { |
2470 |
++ sdkp->WCE = wce; |
2471 |
++ sdkp->RCD = rcd; |
2472 |
++ return count; |
2473 |
++ } |
2474 |
++ |
2475 |
+ if (scsi_mode_sense(sdp, 0x08, 8, buffer, sizeof(buffer), SD_TIMEOUT, |
2476 |
+ SD_MAX_RETRIES, &data, NULL)) |
2477 |
+ return -EINVAL; |
2478 |
+@@ -2319,6 +2334,10 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) |
2479 |
+ int old_rcd = sdkp->RCD; |
2480 |
+ int old_dpofua = sdkp->DPOFUA; |
2481 |
+ |
2482 |
++ |
2483 |
++ if (sdkp->cache_override) |
2484 |
++ return; |
2485 |
++ |
2486 |
+ first_len = 4; |
2487 |
+ if (sdp->skip_ms_page_8) { |
2488 |
+ if (sdp->type == TYPE_RBC) |
2489 |
+@@ -2812,6 +2831,7 @@ static void sd_probe_async(void *data, async_cookie_t cookie) |
2490 |
+ sdkp->capacity = 0; |
2491 |
+ sdkp->media_present = 1; |
2492 |
+ sdkp->write_prot = 0; |
2493 |
++ sdkp->cache_override = 0; |
2494 |
+ sdkp->WCE = 0; |
2495 |
+ sdkp->RCD = 0; |
2496 |
+ sdkp->ATO = 0; |
2497 |
+diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h |
2498 |
+index 74a1e4c..2386aeb 100644 |
2499 |
+--- a/drivers/scsi/sd.h |
2500 |
++++ b/drivers/scsi/sd.h |
2501 |
+@@ -73,6 +73,7 @@ struct scsi_disk { |
2502 |
+ u8 protection_type;/* Data Integrity Field */ |
2503 |
+ u8 provisioning_mode; |
2504 |
+ unsigned ATO : 1; /* state of disk ATO bit */ |
2505 |
++ unsigned cache_override : 1; /* temp override of WCE,RCD */ |
2506 |
+ unsigned WCE : 1; /* state of disk WCE bit */ |
2507 |
+ unsigned RCD : 1; /* state of disk RCD bit, unused */ |
2508 |
+ unsigned DPOFUA : 1; /* state of disk DPOFUA bit */ |
2509 |
+diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c |
2510 |
+index 0b52a23..805f3d2 100644 |
2511 |
+--- a/drivers/target/iscsi/iscsi_target_erl1.c |
2512 |
++++ b/drivers/target/iscsi/iscsi_target_erl1.c |
2513 |
+@@ -819,7 +819,7 @@ static int iscsit_attach_ooo_cmdsn( |
2514 |
+ /* |
2515 |
+ * CmdSN is greater than the tail of the list. |
2516 |
+ */ |
2517 |
+- if (ooo_tail->cmdsn < ooo_cmdsn->cmdsn) |
2518 |
++ if (iscsi_sna_lt(ooo_tail->cmdsn, ooo_cmdsn->cmdsn)) |
2519 |
+ list_add_tail(&ooo_cmdsn->ooo_list, |
2520 |
+ &sess->sess_ooo_cmdsn_list); |
2521 |
+ else { |
2522 |
+@@ -829,11 +829,12 @@ static int iscsit_attach_ooo_cmdsn( |
2523 |
+ */ |
2524 |
+ list_for_each_entry(ooo_tmp, &sess->sess_ooo_cmdsn_list, |
2525 |
+ ooo_list) { |
2526 |
+- if (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn) |
2527 |
++ if (iscsi_sna_lt(ooo_tmp->cmdsn, ooo_cmdsn->cmdsn)) |
2528 |
+ continue; |
2529 |
+ |
2530 |
++ /* Insert before this entry */ |
2531 |
+ list_add(&ooo_cmdsn->ooo_list, |
2532 |
+- &ooo_tmp->ooo_list); |
2533 |
++ ooo_tmp->ooo_list.prev); |
2534 |
+ break; |
2535 |
+ } |
2536 |
+ } |
2537 |
+diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c |
2538 |
+index 17a6acb..ca4b219 100644 |
2539 |
+--- a/drivers/target/target_core_file.c |
2540 |
++++ b/drivers/target/target_core_file.c |
2541 |
+@@ -148,13 +148,8 @@ static int fd_configure_device(struct se_device *dev) |
2542 |
+ */ |
2543 |
+ inode = file->f_mapping->host; |
2544 |
+ if (S_ISBLK(inode->i_mode)) { |
2545 |
+- struct request_queue *q = bdev_get_queue(inode->i_bdev); |
2546 |
+ unsigned long long dev_size; |
2547 |
+ |
2548 |
+- dev->dev_attrib.hw_block_size = |
2549 |
+- bdev_logical_block_size(inode->i_bdev); |
2550 |
+- dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q); |
2551 |
+- |
2552 |
+ /* |
2553 |
+ * Determine the number of bytes from i_size_read() minus |
2554 |
+ * one (1) logical sector from underlying struct block_device |
2555 |
+@@ -173,13 +168,12 @@ static int fd_configure_device(struct se_device *dev) |
2556 |
+ " block_device\n"); |
2557 |
+ goto fail; |
2558 |
+ } |
2559 |
+- |
2560 |
+- dev->dev_attrib.hw_block_size = FD_BLOCKSIZE; |
2561 |
+- dev->dev_attrib.hw_max_sectors = FD_MAX_SECTORS; |
2562 |
+ } |
2563 |
+ |
2564 |
+ fd_dev->fd_block_size = dev->dev_attrib.hw_block_size; |
2565 |
+ |
2566 |
++ dev->dev_attrib.hw_block_size = FD_BLOCKSIZE; |
2567 |
++ dev->dev_attrib.hw_max_sectors = FD_MAX_SECTORS; |
2568 |
+ dev->dev_attrib.hw_queue_depth = FD_MAX_DEVICE_QUEUE_DEPTH; |
2569 |
+ |
2570 |
+ if (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE) { |
2571 |
+diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c |
2572 |
+index 8bcc514..e1af9d5 100644 |
2573 |
+--- a/drivers/target/target_core_iblock.c |
2574 |
++++ b/drivers/target/target_core_iblock.c |
2575 |
+@@ -679,6 +679,8 @@ iblock_execute_rw(struct se_cmd *cmd) |
2576 |
+ rw = WRITE_FUA; |
2577 |
+ else if (!(q->flush_flags & REQ_FLUSH)) |
2578 |
+ rw = WRITE_FUA; |
2579 |
++ else |
2580 |
++ rw = WRITE; |
2581 |
+ } else { |
2582 |
+ rw = WRITE; |
2583 |
+ } |
2584 |
+diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c |
2585 |
+index 3243ea7..0d46276 100644 |
2586 |
+--- a/drivers/target/target_core_transport.c |
2587 |
++++ b/drivers/target/target_core_transport.c |
2588 |
+@@ -2213,21 +2213,19 @@ static void target_release_cmd_kref(struct kref *kref) |
2589 |
+ { |
2590 |
+ struct se_cmd *se_cmd = container_of(kref, struct se_cmd, cmd_kref); |
2591 |
+ struct se_session *se_sess = se_cmd->se_sess; |
2592 |
+- unsigned long flags; |
2593 |
+ |
2594 |
+- spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); |
2595 |
+ if (list_empty(&se_cmd->se_cmd_list)) { |
2596 |
+- spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
2597 |
++ spin_unlock(&se_sess->sess_cmd_lock); |
2598 |
+ se_cmd->se_tfo->release_cmd(se_cmd); |
2599 |
+ return; |
2600 |
+ } |
2601 |
+ if (se_sess->sess_tearing_down && se_cmd->cmd_wait_set) { |
2602 |
+- spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
2603 |
++ spin_unlock(&se_sess->sess_cmd_lock); |
2604 |
+ complete(&se_cmd->cmd_wait_comp); |
2605 |
+ return; |
2606 |
+ } |
2607 |
+ list_del(&se_cmd->se_cmd_list); |
2608 |
+- spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
2609 |
++ spin_unlock(&se_sess->sess_cmd_lock); |
2610 |
+ |
2611 |
+ se_cmd->se_tfo->release_cmd(se_cmd); |
2612 |
+ } |
2613 |
+@@ -2238,7 +2236,8 @@ static void target_release_cmd_kref(struct kref *kref) |
2614 |
+ */ |
2615 |
+ int target_put_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd) |
2616 |
+ { |
2617 |
+- return kref_put(&se_cmd->cmd_kref, target_release_cmd_kref); |
2618 |
++ return kref_put_spinlock_irqsave(&se_cmd->cmd_kref, target_release_cmd_kref, |
2619 |
++ &se_sess->sess_cmd_lock); |
2620 |
+ } |
2621 |
+ EXPORT_SYMBOL(target_put_sess_cmd); |
2622 |
+ |
2623 |
+diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c |
2624 |
+index 08b48bb..faf4e18 100644 |
2625 |
+--- a/drivers/watchdog/watchdog_dev.c |
2626 |
++++ b/drivers/watchdog/watchdog_dev.c |
2627 |
+@@ -523,6 +523,7 @@ int watchdog_dev_register(struct watchdog_device *watchdog) |
2628 |
+ int err, devno; |
2629 |
+ |
2630 |
+ if (watchdog->id == 0) { |
2631 |
++ old_wdd = watchdog; |
2632 |
+ watchdog_miscdev.parent = watchdog->parent; |
2633 |
+ err = misc_register(&watchdog_miscdev); |
2634 |
+ if (err != 0) { |
2635 |
+@@ -531,9 +532,9 @@ int watchdog_dev_register(struct watchdog_device *watchdog) |
2636 |
+ if (err == -EBUSY) |
2637 |
+ pr_err("%s: a legacy watchdog module is probably present.\n", |
2638 |
+ watchdog->info->identity); |
2639 |
++ old_wdd = NULL; |
2640 |
+ return err; |
2641 |
+ } |
2642 |
+- old_wdd = watchdog; |
2643 |
+ } |
2644 |
+ |
2645 |
+ /* Fill in the data structures */ |
2646 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
2647 |
+index cf3025c..f3190ab 100644 |
2648 |
+--- a/fs/ext4/mballoc.c |
2649 |
++++ b/fs/ext4/mballoc.c |
2650 |
+@@ -1994,7 +1994,11 @@ repeat: |
2651 |
+ group = ac->ac_g_ex.fe_group; |
2652 |
+ |
2653 |
+ for (i = 0; i < ngroups; group++, i++) { |
2654 |
+- if (group == ngroups) |
2655 |
++ /* |
2656 |
++ * Artificially restricted ngroups for non-extent |
2657 |
++ * files makes group > ngroups possible on first loop. |
2658 |
++ */ |
2659 |
++ if (group >= ngroups) |
2660 |
+ group = 0; |
2661 |
+ |
2662 |
+ /* This now checks without needing the buddy page */ |
2663 |
+diff --git a/fs/namei.c b/fs/namei.c |
2664 |
+index 57ae9c8..85e40d1 100644 |
2665 |
+--- a/fs/namei.c |
2666 |
++++ b/fs/namei.c |
2667 |
+@@ -2740,7 +2740,7 @@ static int do_last(struct nameidata *nd, struct path *path, |
2668 |
+ if (error) |
2669 |
+ return error; |
2670 |
+ |
2671 |
+- audit_inode(name, dir, 0); |
2672 |
++ audit_inode(name, dir, LOOKUP_PARENT); |
2673 |
+ error = -EISDIR; |
2674 |
+ /* trailing slashes? */ |
2675 |
+ if (nd->last.name[nd->last.len]) |
2676 |
+diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c |
2677 |
+index 8288b08..d401d01 100644 |
2678 |
+--- a/fs/nfsd/nfs4proc.c |
2679 |
++++ b/fs/nfsd/nfs4proc.c |
2680 |
+@@ -271,6 +271,7 @@ static __be32 |
2681 |
+ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) |
2682 |
+ { |
2683 |
+ __be32 status; |
2684 |
++ int accmode = 0; |
2685 |
+ |
2686 |
+ /* We don't know the target directory, and therefore can not |
2687 |
+ * set the change info |
2688 |
+@@ -284,9 +285,19 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ |
2689 |
+ |
2690 |
+ open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) && |
2691 |
+ (open->op_iattr.ia_size == 0); |
2692 |
++ /* |
2693 |
++ * In the delegation case, the client is telling us about an |
2694 |
++ * open that it *already* performed locally, some time ago. We |
2695 |
++ * should let it succeed now if possible. |
2696 |
++ * |
2697 |
++ * In the case of a CLAIM_FH open, on the other hand, the client |
2698 |
++ * may be counting on us to enforce permissions (the Linux 4.1 |
2699 |
++ * client uses this for normal opens, for example). |
2700 |
++ */ |
2701 |
++ if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH) |
2702 |
++ accmode = NFSD_MAY_OWNER_OVERRIDE; |
2703 |
+ |
2704 |
+- status = do_open_permission(rqstp, current_fh, open, |
2705 |
+- NFSD_MAY_OWNER_OVERRIDE); |
2706 |
++ status = do_open_permission(rqstp, current_fh, open, accmode); |
2707 |
+ |
2708 |
+ return status; |
2709 |
+ } |
2710 |
+diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c |
2711 |
+index 899ca26..4e9a21d 100644 |
2712 |
+--- a/fs/nfsd/nfs4recover.c |
2713 |
++++ b/fs/nfsd/nfs4recover.c |
2714 |
+@@ -146,7 +146,7 @@ out_no_tfm: |
2715 |
+ * then disable recovery tracking. |
2716 |
+ */ |
2717 |
+ static void |
2718 |
+-legacy_recdir_name_error(int error) |
2719 |
++legacy_recdir_name_error(struct nfs4_client *clp, int error) |
2720 |
+ { |
2721 |
+ printk(KERN_ERR "NFSD: unable to generate recoverydir " |
2722 |
+ "name (%d).\n", error); |
2723 |
+@@ -159,9 +159,7 @@ legacy_recdir_name_error(int error) |
2724 |
+ if (error == -ENOENT) { |
2725 |
+ printk(KERN_ERR "NFSD: disabling legacy clientid tracking. " |
2726 |
+ "Reboot recovery will not function correctly!\n"); |
2727 |
+- |
2728 |
+- /* the argument is ignored by the legacy exit function */ |
2729 |
+- nfsd4_client_tracking_exit(NULL); |
2730 |
++ nfsd4_client_tracking_exit(clp->net); |
2731 |
+ } |
2732 |
+ } |
2733 |
+ |
2734 |
+@@ -184,7 +182,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp) |
2735 |
+ |
2736 |
+ status = nfs4_make_rec_clidname(dname, &clp->cl_name); |
2737 |
+ if (status) |
2738 |
+- return legacy_recdir_name_error(status); |
2739 |
++ return legacy_recdir_name_error(clp, status); |
2740 |
+ |
2741 |
+ status = nfs4_save_creds(&original_cred); |
2742 |
+ if (status < 0) |
2743 |
+@@ -341,7 +339,7 @@ nfsd4_remove_clid_dir(struct nfs4_client *clp) |
2744 |
+ |
2745 |
+ status = nfs4_make_rec_clidname(dname, &clp->cl_name); |
2746 |
+ if (status) |
2747 |
+- return legacy_recdir_name_error(status); |
2748 |
++ return legacy_recdir_name_error(clp, status); |
2749 |
+ |
2750 |
+ status = mnt_want_write_file(nn->rec_file); |
2751 |
+ if (status) |
2752 |
+@@ -601,7 +599,7 @@ nfsd4_check_legacy_client(struct nfs4_client *clp) |
2753 |
+ |
2754 |
+ status = nfs4_make_rec_clidname(dname, &clp->cl_name); |
2755 |
+ if (status) { |
2756 |
+- legacy_recdir_name_error(status); |
2757 |
++ legacy_recdir_name_error(clp, status); |
2758 |
+ return status; |
2759 |
+ } |
2760 |
+ |
2761 |
+diff --git a/include/linux/audit.h b/include/linux/audit.h |
2762 |
+index 5a6d718..b4086cf 100644 |
2763 |
+--- a/include/linux/audit.h |
2764 |
++++ b/include/linux/audit.h |
2765 |
+@@ -120,7 +120,7 @@ static inline void audit_syscall_entry(int arch, int major, unsigned long a0, |
2766 |
+ unsigned long a1, unsigned long a2, |
2767 |
+ unsigned long a3) |
2768 |
+ { |
2769 |
+- if (unlikely(!audit_dummy_context())) |
2770 |
++ if (unlikely(current->audit_context)) |
2771 |
+ __audit_syscall_entry(arch, major, a0, a1, a2, a3); |
2772 |
+ } |
2773 |
+ static inline void audit_syscall_exit(void *pt_regs) |
2774 |
+@@ -390,6 +390,11 @@ static inline void audit_ptrace(struct task_struct *t) |
2775 |
+ #define audit_signals 0 |
2776 |
+ #endif /* CONFIG_AUDITSYSCALL */ |
2777 |
+ |
2778 |
++static inline bool audit_loginuid_set(struct task_struct *tsk) |
2779 |
++{ |
2780 |
++ return uid_valid(audit_get_loginuid(tsk)); |
2781 |
++} |
2782 |
++ |
2783 |
+ #ifdef CONFIG_AUDIT |
2784 |
+ /* These are defined in audit.c */ |
2785 |
+ /* Public API */ |
2786 |
+diff --git a/include/linux/kref.h b/include/linux/kref.h |
2787 |
+index 4972e6e..7419c02 100644 |
2788 |
+--- a/include/linux/kref.h |
2789 |
++++ b/include/linux/kref.h |
2790 |
+@@ -19,6 +19,7 @@ |
2791 |
+ #include <linux/atomic.h> |
2792 |
+ #include <linux/kernel.h> |
2793 |
+ #include <linux/mutex.h> |
2794 |
++#include <linux/spinlock.h> |
2795 |
+ |
2796 |
+ struct kref { |
2797 |
+ atomic_t refcount; |
2798 |
+@@ -95,6 +96,38 @@ static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref) |
2799 |
+ return kref_sub(kref, 1, release); |
2800 |
+ } |
2801 |
+ |
2802 |
++/** |
2803 |
++ * kref_put_spinlock_irqsave - decrement refcount for object. |
2804 |
++ * @kref: object. |
2805 |
++ * @release: pointer to the function that will clean up the object when the |
2806 |
++ * last reference to the object is released. |
2807 |
++ * This pointer is required, and it is not acceptable to pass kfree |
2808 |
++ * in as this function. |
2809 |
++ * @lock: lock to take in release case |
2810 |
++ * |
2811 |
++ * Behaves identical to kref_put with one exception. If the reference count |
2812 |
++ * drops to zero, the lock will be taken atomically wrt dropping the reference |
2813 |
++ * count. The release function has to call spin_unlock() without _irqrestore. |
2814 |
++ */ |
2815 |
++static inline int kref_put_spinlock_irqsave(struct kref *kref, |
2816 |
++ void (*release)(struct kref *kref), |
2817 |
++ spinlock_t *lock) |
2818 |
++{ |
2819 |
++ unsigned long flags; |
2820 |
++ |
2821 |
++ WARN_ON(release == NULL); |
2822 |
++ if (atomic_add_unless(&kref->refcount, -1, 1)) |
2823 |
++ return 0; |
2824 |
++ spin_lock_irqsave(lock, flags); |
2825 |
++ if (atomic_dec_and_test(&kref->refcount)) { |
2826 |
++ release(kref); |
2827 |
++ local_irq_restore(flags); |
2828 |
++ return 1; |
2829 |
++ } |
2830 |
++ spin_unlock_irqrestore(lock, flags); |
2831 |
++ return 0; |
2832 |
++} |
2833 |
++ |
2834 |
+ static inline int kref_put_mutex(struct kref *kref, |
2835 |
+ void (*release)(struct kref *kref), |
2836 |
+ struct mutex *lock) |
2837 |
+diff --git a/include/linux/time.h b/include/linux/time.h |
2838 |
+index d4835df..afcdc4b 100644 |
2839 |
+--- a/include/linux/time.h |
2840 |
++++ b/include/linux/time.h |
2841 |
+@@ -117,14 +117,10 @@ static inline bool timespec_valid_strict(const struct timespec *ts) |
2842 |
+ |
2843 |
+ extern bool persistent_clock_exist; |
2844 |
+ |
2845 |
+-#ifdef ALWAYS_USE_PERSISTENT_CLOCK |
2846 |
+-#define has_persistent_clock() true |
2847 |
+-#else |
2848 |
+ static inline bool has_persistent_clock(void) |
2849 |
+ { |
2850 |
+ return persistent_clock_exist; |
2851 |
+ } |
2852 |
+-#endif |
2853 |
+ |
2854 |
+ extern void read_persistent_clock(struct timespec *ts); |
2855 |
+ extern void read_boot_clock(struct timespec *ts); |
2856 |
+diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h |
2857 |
+index 0a1dcc2..ab3d0ac 100644 |
2858 |
+--- a/include/net/inet_frag.h |
2859 |
++++ b/include/net/inet_frag.h |
2860 |
+@@ -135,14 +135,15 @@ static inline int sum_frag_mem_limit(struct netns_frags *nf) |
2861 |
+ static inline void inet_frag_lru_move(struct inet_frag_queue *q) |
2862 |
+ { |
2863 |
+ spin_lock(&q->net->lru_lock); |
2864 |
+- list_move_tail(&q->lru_list, &q->net->lru_list); |
2865 |
++ if (!list_empty(&q->lru_list)) |
2866 |
++ list_move_tail(&q->lru_list, &q->net->lru_list); |
2867 |
+ spin_unlock(&q->net->lru_lock); |
2868 |
+ } |
2869 |
+ |
2870 |
+ static inline void inet_frag_lru_del(struct inet_frag_queue *q) |
2871 |
+ { |
2872 |
+ spin_lock(&q->net->lru_lock); |
2873 |
+- list_del(&q->lru_list); |
2874 |
++ list_del_init(&q->lru_list); |
2875 |
+ spin_unlock(&q->net->lru_lock); |
2876 |
+ } |
2877 |
+ |
2878 |
+diff --git a/include/net/sock.h b/include/net/sock.h |
2879 |
+index 14f6e9d..0be480a 100644 |
2880 |
+--- a/include/net/sock.h |
2881 |
++++ b/include/net/sock.h |
2882 |
+@@ -865,6 +865,18 @@ struct inet_hashinfo; |
2883 |
+ struct raw_hashinfo; |
2884 |
+ struct module; |
2885 |
+ |
2886 |
++/* |
2887 |
++ * caches using SLAB_DESTROY_BY_RCU should let .next pointer from nulls nodes |
2888 |
++ * un-modified. Special care is taken when initializing object to zero. |
2889 |
++ */ |
2890 |
++static inline void sk_prot_clear_nulls(struct sock *sk, int size) |
2891 |
++{ |
2892 |
++ if (offsetof(struct sock, sk_node.next) != 0) |
2893 |
++ memset(sk, 0, offsetof(struct sock, sk_node.next)); |
2894 |
++ memset(&sk->sk_node.pprev, 0, |
2895 |
++ size - offsetof(struct sock, sk_node.pprev)); |
2896 |
++} |
2897 |
++ |
2898 |
+ /* Networking protocol blocks we attach to sockets. |
2899 |
+ * socket layer -> transport layer interface |
2900 |
+ * transport -> network interface is defined by struct inet_proto |
2901 |
+diff --git a/include/net/tcp.h b/include/net/tcp.h |
2902 |
+index cf0694d..a345480 100644 |
2903 |
+--- a/include/net/tcp.h |
2904 |
++++ b/include/net/tcp.h |
2905 |
+@@ -1049,6 +1049,7 @@ static inline bool tcp_prequeue(struct sock *sk, struct sk_buff *skb) |
2906 |
+ skb_queue_len(&tp->ucopy.prequeue) == 0) |
2907 |
+ return false; |
2908 |
+ |
2909 |
++ skb_dst_force(skb); |
2910 |
+ __skb_queue_tail(&tp->ucopy.prequeue, skb); |
2911 |
+ tp->ucopy.memory += skb->truesize; |
2912 |
+ if (tp->ucopy.memory > sk->sk_rcvbuf) { |
2913 |
+diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h |
2914 |
+index 9f096f1..9554a19 100644 |
2915 |
+--- a/include/uapi/linux/audit.h |
2916 |
++++ b/include/uapi/linux/audit.h |
2917 |
+@@ -246,6 +246,7 @@ |
2918 |
+ #define AUDIT_OBJ_TYPE 21 |
2919 |
+ #define AUDIT_OBJ_LEV_LOW 22 |
2920 |
+ #define AUDIT_OBJ_LEV_HIGH 23 |
2921 |
++#define AUDIT_LOGINUID_SET 24 |
2922 |
+ |
2923 |
+ /* These are ONLY useful when checking |
2924 |
+ * at syscall exit time (AUDIT_AT_EXIT). */ |
2925 |
+diff --git a/include/uapi/linux/if_cablemodem.h b/include/uapi/linux/if_cablemodem.h |
2926 |
+index 9ca1007..ee6b3c4 100644 |
2927 |
+--- a/include/uapi/linux/if_cablemodem.h |
2928 |
++++ b/include/uapi/linux/if_cablemodem.h |
2929 |
+@@ -12,11 +12,11 @@ |
2930 |
+ */ |
2931 |
+ |
2932 |
+ /* some useful defines for sb1000.c e cmconfig.c - fv */ |
2933 |
+-#define SIOCGCMSTATS SIOCDEVPRIVATE+0 /* get cable modem stats */ |
2934 |
+-#define SIOCGCMFIRMWARE SIOCDEVPRIVATE+1 /* get cm firmware version */ |
2935 |
+-#define SIOCGCMFREQUENCY SIOCDEVPRIVATE+2 /* get cable modem frequency */ |
2936 |
+-#define SIOCSCMFREQUENCY SIOCDEVPRIVATE+3 /* set cable modem frequency */ |
2937 |
+-#define SIOCGCMPIDS SIOCDEVPRIVATE+4 /* get cable modem PIDs */ |
2938 |
+-#define SIOCSCMPIDS SIOCDEVPRIVATE+5 /* set cable modem PIDs */ |
2939 |
++#define SIOCGCMSTATS (SIOCDEVPRIVATE+0) /* get cable modem stats */ |
2940 |
++#define SIOCGCMFIRMWARE (SIOCDEVPRIVATE+1) /* get cm firmware version */ |
2941 |
++#define SIOCGCMFREQUENCY (SIOCDEVPRIVATE+2) /* get cable modem frequency */ |
2942 |
++#define SIOCSCMFREQUENCY (SIOCDEVPRIVATE+3) /* set cable modem frequency */ |
2943 |
++#define SIOCGCMPIDS (SIOCDEVPRIVATE+4) /* get cable modem PIDs */ |
2944 |
++#define SIOCSCMPIDS (SIOCDEVPRIVATE+5) /* set cable modem PIDs */ |
2945 |
+ |
2946 |
+ #endif |
2947 |
+diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h |
2948 |
+index a5a8c88..c520203 100644 |
2949 |
+--- a/include/uapi/linux/virtio_net.h |
2950 |
++++ b/include/uapi/linux/virtio_net.h |
2951 |
+@@ -191,7 +191,7 @@ struct virtio_net_ctrl_mac { |
2952 |
+ * specified. |
2953 |
+ */ |
2954 |
+ struct virtio_net_ctrl_mq { |
2955 |
+- u16 virtqueue_pairs; |
2956 |
++ __u16 virtqueue_pairs; |
2957 |
+ }; |
2958 |
+ |
2959 |
+ #define VIRTIO_NET_CTRL_MQ 4 |
2960 |
+diff --git a/ipc/shm.c b/ipc/shm.c |
2961 |
+index 34af1fe..7e199fa 100644 |
2962 |
+--- a/ipc/shm.c |
2963 |
++++ b/ipc/shm.c |
2964 |
+@@ -493,7 +493,13 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) |
2965 |
+ if (shmflg & SHM_HUGETLB) { |
2966 |
+ struct hstate *hs = hstate_sizelog((shmflg >> SHM_HUGE_SHIFT) |
2967 |
+ & SHM_HUGE_MASK); |
2968 |
+- size_t hugesize = ALIGN(size, huge_page_size(hs)); |
2969 |
++ size_t hugesize; |
2970 |
++ |
2971 |
++ if (!hs) { |
2972 |
++ error = -EINVAL; |
2973 |
++ goto no_file; |
2974 |
++ } |
2975 |
++ hugesize = ALIGN(size, huge_page_size(hs)); |
2976 |
+ |
2977 |
+ /* hugetlb_file_setup applies strict accounting */ |
2978 |
+ if (shmflg & SHM_NORESERVE) |
2979 |
+diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c |
2980 |
+index f9fc54b..2bf508d 100644 |
2981 |
+--- a/kernel/auditfilter.c |
2982 |
++++ b/kernel/auditfilter.c |
2983 |
+@@ -345,6 +345,12 @@ static struct audit_entry *audit_rule_to_entry(struct audit_rule *rule) |
2984 |
+ f->uid = INVALID_UID; |
2985 |
+ f->gid = INVALID_GID; |
2986 |
+ |
2987 |
++ /* Support legacy tests for a valid loginuid */ |
2988 |
++ if ((f->type == AUDIT_LOGINUID) && (f->val == 4294967295U)) { |
2989 |
++ f->type = AUDIT_LOGINUID_SET; |
2990 |
++ f->val = 0; |
2991 |
++ } |
2992 |
++ |
2993 |
+ err = -EINVAL; |
2994 |
+ if (f->op == Audit_bad) |
2995 |
+ goto exit_free; |
2996 |
+@@ -352,6 +358,12 @@ static struct audit_entry *audit_rule_to_entry(struct audit_rule *rule) |
2997 |
+ switch(f->type) { |
2998 |
+ default: |
2999 |
+ goto exit_free; |
3000 |
++ case AUDIT_LOGINUID_SET: |
3001 |
++ if ((f->val != 0) && (f->val != 1)) |
3002 |
++ goto exit_free; |
3003 |
++ if (f->op != Audit_not_equal && f->op != Audit_equal) |
3004 |
++ goto exit_free; |
3005 |
++ break; |
3006 |
+ case AUDIT_UID: |
3007 |
+ case AUDIT_EUID: |
3008 |
+ case AUDIT_SUID: |
3009 |
+@@ -459,7 +471,20 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data, |
3010 |
+ f->gid = INVALID_GID; |
3011 |
+ f->lsm_str = NULL; |
3012 |
+ f->lsm_rule = NULL; |
3013 |
+- switch(f->type) { |
3014 |
++ |
3015 |
++ /* Support legacy tests for a valid loginuid */ |
3016 |
++ if ((f->type == AUDIT_LOGINUID) && (f->val == 4294967295U)) { |
3017 |
++ f->type = AUDIT_LOGINUID_SET; |
3018 |
++ f->val = 0; |
3019 |
++ } |
3020 |
++ |
3021 |
++ switch (f->type) { |
3022 |
++ case AUDIT_LOGINUID_SET: |
3023 |
++ if ((f->val != 0) && (f->val != 1)) |
3024 |
++ goto exit_free; |
3025 |
++ if (f->op != Audit_not_equal && f->op != Audit_equal) |
3026 |
++ goto exit_free; |
3027 |
++ break; |
3028 |
+ case AUDIT_UID: |
3029 |
+ case AUDIT_EUID: |
3030 |
+ case AUDIT_SUID: |
3031 |
+@@ -1378,6 +1403,10 @@ static int audit_filter_user_rules(struct audit_krule *rule, |
3032 |
+ result = audit_uid_comparator(audit_get_loginuid(current), |
3033 |
+ f->op, f->uid); |
3034 |
+ break; |
3035 |
++ case AUDIT_LOGINUID_SET: |
3036 |
++ result = audit_comparator(audit_loginuid_set(current), |
3037 |
++ f->op, f->val); |
3038 |
++ break; |
3039 |
+ case AUDIT_SUBJ_USER: |
3040 |
+ case AUDIT_SUBJ_ROLE: |
3041 |
+ case AUDIT_SUBJ_TYPE: |
3042 |
+diff --git a/kernel/auditsc.c b/kernel/auditsc.c |
3043 |
+index a371f85..c4b72b0 100644 |
3044 |
+--- a/kernel/auditsc.c |
3045 |
++++ b/kernel/auditsc.c |
3046 |
+@@ -742,6 +742,9 @@ static int audit_filter_rules(struct task_struct *tsk, |
3047 |
+ if (ctx) |
3048 |
+ result = audit_uid_comparator(tsk->loginuid, f->op, f->uid); |
3049 |
+ break; |
3050 |
++ case AUDIT_LOGINUID_SET: |
3051 |
++ result = audit_comparator(audit_loginuid_set(tsk), f->op, f->val); |
3052 |
++ break; |
3053 |
+ case AUDIT_SUBJ_USER: |
3054 |
+ case AUDIT_SUBJ_ROLE: |
3055 |
+ case AUDIT_SUBJ_TYPE: |
3056 |
+@@ -2309,7 +2312,7 @@ int audit_set_loginuid(kuid_t loginuid) |
3057 |
+ unsigned int sessionid; |
3058 |
+ |
3059 |
+ #ifdef CONFIG_AUDIT_LOGINUID_IMMUTABLE |
3060 |
+- if (uid_valid(task->loginuid)) |
3061 |
++ if (audit_loginuid_set(task)) |
3062 |
+ return -EPERM; |
3063 |
+ #else /* CONFIG_AUDIT_LOGINUID_IMMUTABLE */ |
3064 |
+ if (!capable(CAP_AUDIT_CONTROL)) |
3065 |
+diff --git a/kernel/kmod.c b/kernel/kmod.c |
3066 |
+index 56dd349..8985c87 100644 |
3067 |
+--- a/kernel/kmod.c |
3068 |
++++ b/kernel/kmod.c |
3069 |
+@@ -570,6 +570,11 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait) |
3070 |
+ int retval = 0; |
3071 |
+ |
3072 |
+ helper_lock(); |
3073 |
++ if (!sub_info->path) { |
3074 |
++ retval = -EINVAL; |
3075 |
++ goto out; |
3076 |
++ } |
3077 |
++ |
3078 |
+ if (sub_info->path[0] == '\0') |
3079 |
+ goto out; |
3080 |
+ |
3081 |
+diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c |
3082 |
+index e93cca9..6af50ad 100644 |
3083 |
+--- a/kernel/sched/cputime.c |
3084 |
++++ b/kernel/sched/cputime.c |
3085 |
+@@ -521,18 +521,49 @@ EXPORT_SYMBOL_GPL(vtime_account_irq_enter); |
3086 |
+ |
3087 |
+ #else /* !CONFIG_VIRT_CPU_ACCOUNTING */ |
3088 |
+ |
3089 |
+-static cputime_t scale_stime(cputime_t stime, cputime_t rtime, cputime_t total) |
3090 |
++/* |
3091 |
++ * Perform (stime * rtime) / total, but avoid multiplication overflow by |
3092 |
++ * loosing precision when the numbers are big. |
3093 |
++ */ |
3094 |
++static cputime_t scale_stime(u64 stime, u64 rtime, u64 total) |
3095 |
+ { |
3096 |
+- u64 temp = (__force u64) rtime; |
3097 |
++ u64 scaled; |
3098 |
+ |
3099 |
+- temp *= (__force u64) stime; |
3100 |
++ for (;;) { |
3101 |
++ /* Make sure "rtime" is the bigger of stime/rtime */ |
3102 |
++ if (stime > rtime) { |
3103 |
++ u64 tmp = rtime; rtime = stime; stime = tmp; |
3104 |
++ } |
3105 |
+ |
3106 |
+- if (sizeof(cputime_t) == 4) |
3107 |
+- temp = div_u64(temp, (__force u32) total); |
3108 |
+- else |
3109 |
+- temp = div64_u64(temp, (__force u64) total); |
3110 |
++ /* Make sure 'total' fits in 32 bits */ |
3111 |
++ if (total >> 32) |
3112 |
++ goto drop_precision; |
3113 |
++ |
3114 |
++ /* Does rtime (and thus stime) fit in 32 bits? */ |
3115 |
++ if (!(rtime >> 32)) |
3116 |
++ break; |
3117 |
+ |
3118 |
+- return (__force cputime_t) temp; |
3119 |
++ /* Can we just balance rtime/stime rather than dropping bits? */ |
3120 |
++ if (stime >> 31) |
3121 |
++ goto drop_precision; |
3122 |
++ |
3123 |
++ /* We can grow stime and shrink rtime and try to make them both fit */ |
3124 |
++ stime <<= 1; |
3125 |
++ rtime >>= 1; |
3126 |
++ continue; |
3127 |
++ |
3128 |
++drop_precision: |
3129 |
++ /* We drop from rtime, it has more bits than stime */ |
3130 |
++ rtime >>= 1; |
3131 |
++ total >>= 1; |
3132 |
++ } |
3133 |
++ |
3134 |
++ /* |
3135 |
++ * Make sure gcc understands that this is a 32x32->64 multiply, |
3136 |
++ * followed by a 64/32->64 divide. |
3137 |
++ */ |
3138 |
++ scaled = div_u64((u64) (u32) stime * (u64) (u32) rtime, (u32)total); |
3139 |
++ return (__force cputime_t) scaled; |
3140 |
+ } |
3141 |
+ |
3142 |
+ /* |
3143 |
+@@ -543,7 +574,7 @@ static void cputime_adjust(struct task_cputime *curr, |
3144 |
+ struct cputime *prev, |
3145 |
+ cputime_t *ut, cputime_t *st) |
3146 |
+ { |
3147 |
+- cputime_t rtime, stime, total; |
3148 |
++ cputime_t rtime, stime, utime, total; |
3149 |
+ |
3150 |
+ stime = curr->stime; |
3151 |
+ total = stime + curr->utime; |
3152 |
+@@ -560,10 +591,22 @@ static void cputime_adjust(struct task_cputime *curr, |
3153 |
+ */ |
3154 |
+ rtime = nsecs_to_cputime(curr->sum_exec_runtime); |
3155 |
+ |
3156 |
+- if (total) |
3157 |
+- stime = scale_stime(stime, rtime, total); |
3158 |
+- else |
3159 |
++ /* |
3160 |
++ * Update userspace visible utime/stime values only if actual execution |
3161 |
++ * time is bigger than already exported. Note that can happen, that we |
3162 |
++ * provided bigger values due to scaling inaccuracy on big numbers. |
3163 |
++ */ |
3164 |
++ if (prev->stime + prev->utime >= rtime) |
3165 |
++ goto out; |
3166 |
++ |
3167 |
++ if (total) { |
3168 |
++ stime = scale_stime((__force u64)stime, |
3169 |
++ (__force u64)rtime, (__force u64)total); |
3170 |
++ utime = rtime - stime; |
3171 |
++ } else { |
3172 |
+ stime = rtime; |
3173 |
++ utime = 0; |
3174 |
++ } |
3175 |
+ |
3176 |
+ /* |
3177 |
+ * If the tick based count grows faster than the scheduler one, |
3178 |
+@@ -571,8 +614,9 @@ static void cputime_adjust(struct task_cputime *curr, |
3179 |
+ * Let's enforce monotonicity. |
3180 |
+ */ |
3181 |
+ prev->stime = max(prev->stime, stime); |
3182 |
+- prev->utime = max(prev->utime, rtime - prev->stime); |
3183 |
++ prev->utime = max(prev->utime, utime); |
3184 |
+ |
3185 |
++out: |
3186 |
+ *ut = prev->utime; |
3187 |
+ *st = prev->stime; |
3188 |
+ } |
3189 |
+diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig |
3190 |
+index 24510d8..b696922 100644 |
3191 |
+--- a/kernel/time/Kconfig |
3192 |
++++ b/kernel/time/Kconfig |
3193 |
+@@ -12,11 +12,6 @@ config CLOCKSOURCE_WATCHDOG |
3194 |
+ config ARCH_CLOCKSOURCE_DATA |
3195 |
+ bool |
3196 |
+ |
3197 |
+-# Platforms has a persistent clock |
3198 |
+-config ALWAYS_USE_PERSISTENT_CLOCK |
3199 |
+- bool |
3200 |
+- default n |
3201 |
+- |
3202 |
+ # Timekeeping vsyscall support |
3203 |
+ config GENERIC_TIME_VSYSCALL |
3204 |
+ bool |
3205 |
+diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c |
3206 |
+index a19a399..e717ad9 100644 |
3207 |
+--- a/kernel/time/tick-sched.c |
3208 |
++++ b/kernel/time/tick-sched.c |
3209 |
+@@ -904,7 +904,7 @@ void tick_cancel_sched_timer(int cpu) |
3210 |
+ hrtimer_cancel(&ts->sched_timer); |
3211 |
+ # endif |
3212 |
+ |
3213 |
+- ts->nohz_mode = NOHZ_MODE_INACTIVE; |
3214 |
++ memset(ts, 0, sizeof(*ts)); |
3215 |
+ } |
3216 |
+ #endif |
3217 |
+ |
3218 |
+diff --git a/kernel/timer.c b/kernel/timer.c |
3219 |
+index dbf7a78..1b399c8 100644 |
3220 |
+--- a/kernel/timer.c |
3221 |
++++ b/kernel/timer.c |
3222 |
+@@ -1678,12 +1678,12 @@ static int __cpuinit init_timers_cpu(int cpu) |
3223 |
+ boot_done = 1; |
3224 |
+ base = &boot_tvec_bases; |
3225 |
+ } |
3226 |
++ spin_lock_init(&base->lock); |
3227 |
+ tvec_base_done[cpu] = 1; |
3228 |
+ } else { |
3229 |
+ base = per_cpu(tvec_bases, cpu); |
3230 |
+ } |
3231 |
+ |
3232 |
+- spin_lock_init(&base->lock); |
3233 |
+ |
3234 |
+ for (j = 0; j < TVN_SIZE; j++) { |
3235 |
+ INIT_LIST_HEAD(base->tv5.vec + j); |
3236 |
+diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c |
3237 |
+index e5b0ca8..5a8a53e 100644 |
3238 |
+--- a/kernel/trace/trace_events_filter.c |
3239 |
++++ b/kernel/trace/trace_events_filter.c |
3240 |
+@@ -777,7 +777,11 @@ static int filter_set_pred(struct event_filter *filter, |
3241 |
+ |
3242 |
+ static void __free_preds(struct event_filter *filter) |
3243 |
+ { |
3244 |
++ int i; |
3245 |
++ |
3246 |
+ if (filter->preds) { |
3247 |
++ for (i = 0; i < filter->n_preds; i++) |
3248 |
++ kfree(filter->preds[i].ops); |
3249 |
+ kfree(filter->preds); |
3250 |
+ filter->preds = NULL; |
3251 |
+ } |
3252 |
+diff --git a/mm/mmap.c b/mm/mmap.c |
3253 |
+index e17fc06..0dceed8 100644 |
3254 |
+--- a/mm/mmap.c |
3255 |
++++ b/mm/mmap.c |
3256 |
+@@ -1331,9 +1331,13 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, |
3257 |
+ len = ALIGN(len, huge_page_size(hstate_file(file))); |
3258 |
+ } else if (flags & MAP_HUGETLB) { |
3259 |
+ struct user_struct *user = NULL; |
3260 |
++ struct hstate *hs = hstate_sizelog((flags >> MAP_HUGE_SHIFT) & |
3261 |
++ SHM_HUGE_MASK); |
3262 |
+ |
3263 |
+- len = ALIGN(len, huge_page_size(hstate_sizelog( |
3264 |
+- (flags >> MAP_HUGE_SHIFT) & MAP_HUGE_MASK))); |
3265 |
++ if (!hs) |
3266 |
++ return -EINVAL; |
3267 |
++ |
3268 |
++ len = ALIGN(len, huge_page_size(hs)); |
3269 |
+ /* |
3270 |
+ * VM_NORESERVE is used because the reservations will be |
3271 |
+ * taken when vm_ops->mmap() is called |
3272 |
+diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c |
3273 |
+index 19cf81b..63bd98c 100644 |
3274 |
+--- a/net/8021q/vlan_dev.c |
3275 |
++++ b/net/8021q/vlan_dev.c |
3276 |
+@@ -627,7 +627,7 @@ static netdev_features_t vlan_dev_fix_features(struct net_device *dev, |
3277 |
+ netdev_features_t features) |
3278 |
+ { |
3279 |
+ struct net_device *real_dev = vlan_dev_priv(dev)->real_dev; |
3280 |
+- u32 old_features = features; |
3281 |
++ netdev_features_t old_features = features; |
3282 |
+ |
3283 |
+ features &= real_dev->vlan_features; |
3284 |
+ features |= NETIF_F_RXCSUM; |
3285 |
+diff --git a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c |
3286 |
+index c3530a8..950663d 100644 |
3287 |
+--- a/net/bridge/br_stp_timer.c |
3288 |
++++ b/net/bridge/br_stp_timer.c |
3289 |
+@@ -107,7 +107,7 @@ static void br_tcn_timer_expired(unsigned long arg) |
3290 |
+ |
3291 |
+ br_debug(br, "tcn timer expired\n"); |
3292 |
+ spin_lock(&br->lock); |
3293 |
+- if (br->dev->flags & IFF_UP) { |
3294 |
++ if (!br_is_root_bridge(br) && (br->dev->flags & IFF_UP)) { |
3295 |
+ br_transmit_tcn(br); |
3296 |
+ |
3297 |
+ mod_timer(&br->tcn_timer,jiffies + br->bridge_hello_time); |
3298 |
+diff --git a/net/core/dev.c b/net/core/dev.c |
3299 |
+index b24ab0e9..9a278e9 100644 |
3300 |
+--- a/net/core/dev.c |
3301 |
++++ b/net/core/dev.c |
3302 |
+@@ -2458,7 +2458,7 @@ EXPORT_SYMBOL(netif_skb_features); |
3303 |
+ * 2. skb is fragmented and the device does not support SG. |
3304 |
+ */ |
3305 |
+ static inline int skb_needs_linearize(struct sk_buff *skb, |
3306 |
+- int features) |
3307 |
++ netdev_features_t features) |
3308 |
+ { |
3309 |
+ return skb_is_nonlinear(skb) && |
3310 |
+ ((skb_has_frag_list(skb) && |
3311 |
+diff --git a/net/core/ethtool.c b/net/core/ethtool.c |
3312 |
+index 3e9b2c3..41f4bdf 100644 |
3313 |
+--- a/net/core/ethtool.c |
3314 |
++++ b/net/core/ethtool.c |
3315 |
+@@ -1416,7 +1416,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) |
3316 |
+ void __user *useraddr = ifr->ifr_data; |
3317 |
+ u32 ethcmd; |
3318 |
+ int rc; |
3319 |
+- u32 old_features; |
3320 |
++ netdev_features_t old_features; |
3321 |
+ |
3322 |
+ if (!dev || !netif_device_present(dev)) |
3323 |
+ return -ENODEV; |
3324 |
+diff --git a/net/core/sock.c b/net/core/sock.c |
3325 |
+index b261a79..1432266 100644 |
3326 |
+--- a/net/core/sock.c |
3327 |
++++ b/net/core/sock.c |
3328 |
+@@ -1209,18 +1209,6 @@ static void sock_copy(struct sock *nsk, const struct sock *osk) |
3329 |
+ #endif |
3330 |
+ } |
3331 |
+ |
3332 |
+-/* |
3333 |
+- * caches using SLAB_DESTROY_BY_RCU should let .next pointer from nulls nodes |
3334 |
+- * un-modified. Special care is taken when initializing object to zero. |
3335 |
+- */ |
3336 |
+-static inline void sk_prot_clear_nulls(struct sock *sk, int size) |
3337 |
+-{ |
3338 |
+- if (offsetof(struct sock, sk_node.next) != 0) |
3339 |
+- memset(sk, 0, offsetof(struct sock, sk_node.next)); |
3340 |
+- memset(&sk->sk_node.pprev, 0, |
3341 |
+- size - offsetof(struct sock, sk_node.pprev)); |
3342 |
+-} |
3343 |
+- |
3344 |
+ void sk_prot_clear_portaddr_nulls(struct sock *sk, int size) |
3345 |
+ { |
3346 |
+ unsigned long nulls1, nulls2; |
3347 |
+diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c |
3348 |
+index f4fd23d..3211914 100644 |
3349 |
+--- a/net/ipv4/inet_fragment.c |
3350 |
++++ b/net/ipv4/inet_fragment.c |
3351 |
+@@ -257,6 +257,7 @@ static struct inet_frag_queue *inet_frag_alloc(struct netns_frags *nf, |
3352 |
+ setup_timer(&q->timer, f->frag_expire, (unsigned long)q); |
3353 |
+ spin_lock_init(&q->lock); |
3354 |
+ atomic_set(&q->refcnt, 1); |
3355 |
++ INIT_LIST_HEAD(&q->lru_list); |
3356 |
+ |
3357 |
+ return q; |
3358 |
+ } |
3359 |
+diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c |
3360 |
+index b83a49c..2f672e7 100644 |
3361 |
+--- a/net/ipv4/tcp_minisocks.c |
3362 |
++++ b/net/ipv4/tcp_minisocks.c |
3363 |
+@@ -583,8 +583,13 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, |
3364 |
+ * |
3365 |
+ * Note that even if there is new data in the SYN packet |
3366 |
+ * they will be thrown away too. |
3367 |
++ * |
3368 |
++ * Reset timer after retransmitting SYNACK, similar to |
3369 |
++ * the idea of fast retransmit in recovery. |
3370 |
+ */ |
3371 |
+- inet_rtx_syn_ack(sk, req); |
3372 |
++ if (!inet_rtx_syn_ack(sk, req)) |
3373 |
++ req->expires = min(TCP_TIMEOUT_INIT << req->num_timeout, |
3374 |
++ TCP_RTO_MAX) + jiffies; |
3375 |
+ return NULL; |
3376 |
+ } |
3377 |
+ |
3378 |
+diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c |
3379 |
+index e4efffe..95d13c7 100644 |
3380 |
+--- a/net/ipv6/ip6_gre.c |
3381 |
++++ b/net/ipv6/ip6_gre.c |
3382 |
+@@ -1135,6 +1135,7 @@ static int ip6gre_tunnel_ioctl(struct net_device *dev, |
3383 |
+ } |
3384 |
+ if (t == NULL) |
3385 |
+ t = netdev_priv(dev); |
3386 |
++ memset(&p, 0, sizeof(p)); |
3387 |
+ ip6gre_tnl_parm_to_user(&p, &t->parms); |
3388 |
+ if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) |
3389 |
+ err = -EFAULT; |
3390 |
+@@ -1182,6 +1183,7 @@ static int ip6gre_tunnel_ioctl(struct net_device *dev, |
3391 |
+ if (t) { |
3392 |
+ err = 0; |
3393 |
+ |
3394 |
++ memset(&p, 0, sizeof(p)); |
3395 |
+ ip6gre_tnl_parm_to_user(&p, &t->parms); |
3396 |
+ if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) |
3397 |
+ err = -EFAULT; |
3398 |
+diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c |
3399 |
+index 46a5be8..0fce928 100644 |
3400 |
+--- a/net/ipv6/tcp_ipv6.c |
3401 |
++++ b/net/ipv6/tcp_ipv6.c |
3402 |
+@@ -1937,6 +1937,17 @@ void tcp6_proc_exit(struct net *net) |
3403 |
+ } |
3404 |
+ #endif |
3405 |
+ |
3406 |
++static void tcp_v6_clear_sk(struct sock *sk, int size) |
3407 |
++{ |
3408 |
++ struct inet_sock *inet = inet_sk(sk); |
3409 |
++ |
3410 |
++ /* we do not want to clear pinet6 field, because of RCU lookups */ |
3411 |
++ sk_prot_clear_nulls(sk, offsetof(struct inet_sock, pinet6)); |
3412 |
++ |
3413 |
++ size -= offsetof(struct inet_sock, pinet6) + sizeof(inet->pinet6); |
3414 |
++ memset(&inet->pinet6 + 1, 0, size); |
3415 |
++} |
3416 |
++ |
3417 |
+ struct proto tcpv6_prot = { |
3418 |
+ .name = "TCPv6", |
3419 |
+ .owner = THIS_MODULE, |
3420 |
+@@ -1980,6 +1991,7 @@ struct proto tcpv6_prot = { |
3421 |
+ #ifdef CONFIG_MEMCG_KMEM |
3422 |
+ .proto_cgroup = tcp_proto_cgroup, |
3423 |
+ #endif |
3424 |
++ .clear_sk = tcp_v6_clear_sk, |
3425 |
+ }; |
3426 |
+ |
3427 |
+ static const struct inet6_protocol tcpv6_protocol = { |
3428 |
+diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c |
3429 |
+index d8e5e85..27f0f8e 100644 |
3430 |
+--- a/net/ipv6/udp.c |
3431 |
++++ b/net/ipv6/udp.c |
3432 |
+@@ -1422,6 +1422,17 @@ void udp6_proc_exit(struct net *net) { |
3433 |
+ } |
3434 |
+ #endif /* CONFIG_PROC_FS */ |
3435 |
+ |
3436 |
++void udp_v6_clear_sk(struct sock *sk, int size) |
3437 |
++{ |
3438 |
++ struct inet_sock *inet = inet_sk(sk); |
3439 |
++ |
3440 |
++ /* we do not want to clear pinet6 field, because of RCU lookups */ |
3441 |
++ sk_prot_clear_portaddr_nulls(sk, offsetof(struct inet_sock, pinet6)); |
3442 |
++ |
3443 |
++ size -= offsetof(struct inet_sock, pinet6) + sizeof(inet->pinet6); |
3444 |
++ memset(&inet->pinet6 + 1, 0, size); |
3445 |
++} |
3446 |
++ |
3447 |
+ /* ------------------------------------------------------------------------ */ |
3448 |
+ |
3449 |
+ struct proto udpv6_prot = { |
3450 |
+@@ -1452,7 +1463,7 @@ struct proto udpv6_prot = { |
3451 |
+ .compat_setsockopt = compat_udpv6_setsockopt, |
3452 |
+ .compat_getsockopt = compat_udpv6_getsockopt, |
3453 |
+ #endif |
3454 |
+- .clear_sk = sk_prot_clear_portaddr_nulls, |
3455 |
++ .clear_sk = udp_v6_clear_sk, |
3456 |
+ }; |
3457 |
+ |
3458 |
+ static struct inet_protosw udpv6_protosw = { |
3459 |
+diff --git a/net/ipv6/udp_impl.h b/net/ipv6/udp_impl.h |
3460 |
+index d757104..4691ed5 100644 |
3461 |
+--- a/net/ipv6/udp_impl.h |
3462 |
++++ b/net/ipv6/udp_impl.h |
3463 |
+@@ -31,6 +31,8 @@ extern int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, |
3464 |
+ extern int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb); |
3465 |
+ extern void udpv6_destroy_sock(struct sock *sk); |
3466 |
+ |
3467 |
++extern void udp_v6_clear_sk(struct sock *sk, int size); |
3468 |
++ |
3469 |
+ #ifdef CONFIG_PROC_FS |
3470 |
+ extern int udp6_seq_show(struct seq_file *seq, void *v); |
3471 |
+ #endif |
3472 |
+diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c |
3473 |
+index 1d08e21..dfcc4be 100644 |
3474 |
+--- a/net/ipv6/udplite.c |
3475 |
++++ b/net/ipv6/udplite.c |
3476 |
+@@ -56,7 +56,7 @@ struct proto udplitev6_prot = { |
3477 |
+ .compat_setsockopt = compat_udpv6_setsockopt, |
3478 |
+ .compat_getsockopt = compat_udpv6_getsockopt, |
3479 |
+ #endif |
3480 |
+- .clear_sk = sk_prot_clear_portaddr_nulls, |
3481 |
++ .clear_sk = udp_v6_clear_sk, |
3482 |
+ }; |
3483 |
+ |
3484 |
+ static struct inet_protosw udplite6_protosw = { |
3485 |
+diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c |
3486 |
+index 4ef7bdb..23ed03d 100644 |
3487 |
+--- a/net/ipv6/xfrm6_policy.c |
3488 |
++++ b/net/ipv6/xfrm6_policy.c |
3489 |
+@@ -103,8 +103,10 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, |
3490 |
+ dev_hold(dev); |
3491 |
+ |
3492 |
+ xdst->u.rt6.rt6i_idev = in6_dev_get(dev); |
3493 |
+- if (!xdst->u.rt6.rt6i_idev) |
3494 |
++ if (!xdst->u.rt6.rt6i_idev) { |
3495 |
++ dev_put(dev); |
3496 |
+ return -ENODEV; |
3497 |
++ } |
3498 |
+ |
3499 |
+ rt6_transfer_peer(&xdst->u.rt6, rt); |
3500 |
+ |
3501 |
+diff --git a/net/mac802154/mac802154.h b/net/mac802154/mac802154.h |
3502 |
+index a4dcaf1..703c121 100644 |
3503 |
+--- a/net/mac802154/mac802154.h |
3504 |
++++ b/net/mac802154/mac802154.h |
3505 |
+@@ -90,7 +90,7 @@ struct mac802154_sub_if_data { |
3506 |
+ |
3507 |
+ #define MAC802154_MAX_XMIT_ATTEMPTS 3 |
3508 |
+ |
3509 |
+-#define MAC802154_CHAN_NONE (~(u8)0) /* No channel is assigned */ |
3510 |
++#define MAC802154_CHAN_NONE 0xff /* No channel is assigned */ |
3511 |
+ |
3512 |
+ extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced; |
3513 |
+ extern struct ieee802154_mlme_ops mac802154_mlme_wpan; |
3514 |
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
3515 |
+index 1d6793d..f83e172 100644 |
3516 |
+--- a/net/packet/af_packet.c |
3517 |
++++ b/net/packet/af_packet.c |
3518 |
+@@ -693,36 +693,33 @@ static void prb_open_block(struct tpacket_kbdq_core *pkc1, |
3519 |
+ |
3520 |
+ smp_rmb(); |
3521 |
+ |
3522 |
+- if (likely(TP_STATUS_KERNEL == BLOCK_STATUS(pbd1))) { |
3523 |
++ /* We could have just memset this but we will lose the |
3524 |
++ * flexibility of making the priv area sticky |
3525 |
++ */ |
3526 |
+ |
3527 |
+- /* We could have just memset this but we will lose the |
3528 |
+- * flexibility of making the priv area sticky |
3529 |
+- */ |
3530 |
+- BLOCK_SNUM(pbd1) = pkc1->knxt_seq_num++; |
3531 |
+- BLOCK_NUM_PKTS(pbd1) = 0; |
3532 |
+- BLOCK_LEN(pbd1) = BLK_PLUS_PRIV(pkc1->blk_sizeof_priv); |
3533 |
+- getnstimeofday(&ts); |
3534 |
+- h1->ts_first_pkt.ts_sec = ts.tv_sec; |
3535 |
+- h1->ts_first_pkt.ts_nsec = ts.tv_nsec; |
3536 |
+- pkc1->pkblk_start = (char *)pbd1; |
3537 |
+- pkc1->nxt_offset = pkc1->pkblk_start + BLK_PLUS_PRIV(pkc1->blk_sizeof_priv); |
3538 |
+- BLOCK_O2FP(pbd1) = (__u32)BLK_PLUS_PRIV(pkc1->blk_sizeof_priv); |
3539 |
+- BLOCK_O2PRIV(pbd1) = BLK_HDR_LEN; |
3540 |
+- pbd1->version = pkc1->version; |
3541 |
+- pkc1->prev = pkc1->nxt_offset; |
3542 |
+- pkc1->pkblk_end = pkc1->pkblk_start + pkc1->kblk_size; |
3543 |
+- prb_thaw_queue(pkc1); |
3544 |
+- _prb_refresh_rx_retire_blk_timer(pkc1); |
3545 |
++ BLOCK_SNUM(pbd1) = pkc1->knxt_seq_num++; |
3546 |
++ BLOCK_NUM_PKTS(pbd1) = 0; |
3547 |
++ BLOCK_LEN(pbd1) = BLK_PLUS_PRIV(pkc1->blk_sizeof_priv); |
3548 |
+ |
3549 |
+- smp_wmb(); |
3550 |
++ getnstimeofday(&ts); |
3551 |
+ |
3552 |
+- return; |
3553 |
+- } |
3554 |
++ h1->ts_first_pkt.ts_sec = ts.tv_sec; |
3555 |
++ h1->ts_first_pkt.ts_nsec = ts.tv_nsec; |
3556 |
+ |
3557 |
+- WARN(1, "ERROR block:%p is NOT FREE status:%d kactive_blk_num:%d\n", |
3558 |
+- pbd1, BLOCK_STATUS(pbd1), pkc1->kactive_blk_num); |
3559 |
+- dump_stack(); |
3560 |
+- BUG(); |
3561 |
++ pkc1->pkblk_start = (char *)pbd1; |
3562 |
++ pkc1->nxt_offset = pkc1->pkblk_start + BLK_PLUS_PRIV(pkc1->blk_sizeof_priv); |
3563 |
++ |
3564 |
++ BLOCK_O2FP(pbd1) = (__u32)BLK_PLUS_PRIV(pkc1->blk_sizeof_priv); |
3565 |
++ BLOCK_O2PRIV(pbd1) = BLK_HDR_LEN; |
3566 |
++ |
3567 |
++ pbd1->version = pkc1->version; |
3568 |
++ pkc1->prev = pkc1->nxt_offset; |
3569 |
++ pkc1->pkblk_end = pkc1->pkblk_start + pkc1->kblk_size; |
3570 |
++ |
3571 |
++ prb_thaw_queue(pkc1); |
3572 |
++ _prb_refresh_rx_retire_blk_timer(pkc1); |
3573 |
++ |
3574 |
++ smp_wmb(); |
3575 |
+ } |
3576 |
+ |
3577 |
+ /* |
3578 |
+@@ -813,10 +810,6 @@ static void prb_retire_current_block(struct tpacket_kbdq_core *pkc, |
3579 |
+ prb_close_block(pkc, pbd, po, status); |
3580 |
+ return; |
3581 |
+ } |
3582 |
+- |
3583 |
+- WARN(1, "ERROR-pbd[%d]:%p\n", pkc->kactive_blk_num, pbd); |
3584 |
+- dump_stack(); |
3585 |
+- BUG(); |
3586 |
+ } |
3587 |
+ |
3588 |
+ static int prb_curr_blk_in_use(struct tpacket_kbdq_core *pkc, |
3589 |
+diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c |
3590 |
+index e0f6de6..60d88b6 100644 |
3591 |
+--- a/net/sched/act_ipt.c |
3592 |
++++ b/net/sched/act_ipt.c |
3593 |
+@@ -8,7 +8,7 @@ |
3594 |
+ * as published by the Free Software Foundation; either version |
3595 |
+ * 2 of the License, or (at your option) any later version. |
3596 |
+ * |
3597 |
+- * Copyright: Jamal Hadi Salim (2002-4) |
3598 |
++ * Copyright: Jamal Hadi Salim (2002-13) |
3599 |
+ */ |
3600 |
+ |
3601 |
+ #include <linux/types.h> |
3602 |
+@@ -303,17 +303,44 @@ static struct tc_action_ops act_ipt_ops = { |
3603 |
+ .walk = tcf_generic_walker |
3604 |
+ }; |
3605 |
+ |
3606 |
+-MODULE_AUTHOR("Jamal Hadi Salim(2002-4)"); |
3607 |
++static struct tc_action_ops act_xt_ops = { |
3608 |
++ .kind = "xt", |
3609 |
++ .hinfo = &ipt_hash_info, |
3610 |
++ .type = TCA_ACT_IPT, |
3611 |
++ .capab = TCA_CAP_NONE, |
3612 |
++ .owner = THIS_MODULE, |
3613 |
++ .act = tcf_ipt, |
3614 |
++ .dump = tcf_ipt_dump, |
3615 |
++ .cleanup = tcf_ipt_cleanup, |
3616 |
++ .lookup = tcf_hash_search, |
3617 |
++ .init = tcf_ipt_init, |
3618 |
++ .walk = tcf_generic_walker |
3619 |
++}; |
3620 |
++ |
3621 |
++MODULE_AUTHOR("Jamal Hadi Salim(2002-13)"); |
3622 |
+ MODULE_DESCRIPTION("Iptables target actions"); |
3623 |
+ MODULE_LICENSE("GPL"); |
3624 |
++MODULE_ALIAS("act_xt"); |
3625 |
+ |
3626 |
+ static int __init ipt_init_module(void) |
3627 |
+ { |
3628 |
+- return tcf_register_action(&act_ipt_ops); |
3629 |
++ int ret1, ret2; |
3630 |
++ ret1 = tcf_register_action(&act_xt_ops); |
3631 |
++ if (ret1 < 0) |
3632 |
++ printk("Failed to load xt action\n"); |
3633 |
++ ret2 = tcf_register_action(&act_ipt_ops); |
3634 |
++ if (ret2 < 0) |
3635 |
++ printk("Failed to load ipt action\n"); |
3636 |
++ |
3637 |
++ if (ret1 < 0 && ret2 < 0) |
3638 |
++ return ret1; |
3639 |
++ else |
3640 |
++ return 0; |
3641 |
+ } |
3642 |
+ |
3643 |
+ static void __exit ipt_cleanup_module(void) |
3644 |
+ { |
3645 |
++ tcf_unregister_action(&act_xt_ops); |
3646 |
+ tcf_unregister_action(&act_ipt_ops); |
3647 |
+ } |
3648 |
+ |
3649 |
+diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c |
3650 |
+index 7f93e2a..2e330e8 100644 |
3651 |
+--- a/net/vmw_vsock/af_vsock.c |
3652 |
++++ b/net/vmw_vsock/af_vsock.c |
3653 |
+@@ -165,7 +165,7 @@ static struct list_head vsock_bind_table[VSOCK_HASH_SIZE + 1]; |
3654 |
+ static struct list_head vsock_connected_table[VSOCK_HASH_SIZE]; |
3655 |
+ static DEFINE_SPINLOCK(vsock_table_lock); |
3656 |
+ |
3657 |
+-static __init void vsock_init_tables(void) |
3658 |
++static void vsock_init_tables(void) |
3659 |
+ { |
3660 |
+ int i; |
3661 |
+ |
3662 |
+diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
3663 |
+index 4aba764..c414cdd 100644 |
3664 |
+--- a/sound/pci/hda/hda_codec.c |
3665 |
++++ b/sound/pci/hda/hda_codec.c |
3666 |
+@@ -681,6 +681,9 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex) |
3667 |
+ struct hda_bus_unsolicited *unsol; |
3668 |
+ unsigned int wp; |
3669 |
+ |
3670 |
++ if (!bus || !bus->workq) |
3671 |
++ return 0; |
3672 |
++ |
3673 |
+ trace_hda_unsol_event(bus, res, res_ex); |
3674 |
+ unsol = bus->unsol; |
3675 |
+ if (!unsol) |
3676 |
+@@ -1577,7 +1580,7 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, |
3677 |
+ "NID=0x%x, stream=0x%x, channel=%d, format=0x%x\n", |
3678 |
+ nid, stream_tag, channel_id, format); |
3679 |
+ p = get_hda_cvt_setup(codec, nid); |
3680 |
+- if (!p || p->active) |
3681 |
++ if (!p) |
3682 |
+ return; |
3683 |
+ |
3684 |
+ if (codec->pcm_format_first) |
3685 |
+@@ -1624,7 +1627,7 @@ void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid, |
3686 |
+ |
3687 |
+ snd_printdd("hda_codec_cleanup_stream: NID=0x%x\n", nid); |
3688 |
+ p = get_hda_cvt_setup(codec, nid); |
3689 |
+- if (p && p->active) { |
3690 |
++ if (p) { |
3691 |
+ /* here we just clear the active flag when do_now isn't set; |
3692 |
+ * actual clean-ups will be done later in |
3693 |
+ * purify_inactive_streams() called from snd_hda_codec_prpapre() |
3694 |
+diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c |
3695 |
+index 2a89d1ee..1e5a30f 100644 |
3696 |
+--- a/sound/pci/hda/patch_conexant.c |
3697 |
++++ b/sound/pci/hda/patch_conexant.c |
3698 |
+@@ -64,6 +64,7 @@ struct conexant_spec { |
3699 |
+ /* extra EAPD pins */ |
3700 |
+ unsigned int num_eapds; |
3701 |
+ hda_nid_t eapds[4]; |
3702 |
++ bool dynamic_eapd; |
3703 |
+ |
3704 |
+ #ifdef ENABLE_CXT_STATIC_QUIRKS |
3705 |
+ const struct snd_kcontrol_new *mixers[5]; |
3706 |
+@@ -3152,7 +3153,7 @@ static void cx_auto_parse_eapd(struct hda_codec *codec) |
3707 |
+ * thus it might control over all pins. |
3708 |
+ */ |
3709 |
+ if (spec->num_eapds > 2) |
3710 |
+- spec->gen.own_eapd_ctl = 1; |
3711 |
++ spec->dynamic_eapd = 1; |
3712 |
+ } |
3713 |
+ |
3714 |
+ static void cx_auto_turn_eapd(struct hda_codec *codec, int num_pins, |
3715 |
+@@ -3191,6 +3192,15 @@ static int cx_auto_build_controls(struct hda_codec *codec) |
3716 |
+ return 0; |
3717 |
+ } |
3718 |
+ |
3719 |
++static int cx_auto_init(struct hda_codec *codec) |
3720 |
++{ |
3721 |
++ struct conexant_spec *spec = codec->spec; |
3722 |
++ snd_hda_gen_init(codec); |
3723 |
++ if (!spec->dynamic_eapd) |
3724 |
++ cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, true); |
3725 |
++ return 0; |
3726 |
++} |
3727 |
++ |
3728 |
+ static void cx_auto_free(struct hda_codec *codec) |
3729 |
+ { |
3730 |
+ snd_hda_detach_beep_device(codec); |
3731 |
+@@ -3200,7 +3210,7 @@ static void cx_auto_free(struct hda_codec *codec) |
3732 |
+ static const struct hda_codec_ops cx_auto_patch_ops = { |
3733 |
+ .build_controls = cx_auto_build_controls, |
3734 |
+ .build_pcms = snd_hda_gen_build_pcms, |
3735 |
+- .init = snd_hda_gen_init, |
3736 |
++ .init = cx_auto_init, |
3737 |
+ .free = cx_auto_free, |
3738 |
+ .unsol_event = snd_hda_jack_unsol_event, |
3739 |
+ #ifdef CONFIG_PM |
3740 |
+@@ -3350,7 +3360,8 @@ static int patch_conexant_auto(struct hda_codec *codec) |
3741 |
+ |
3742 |
+ cx_auto_parse_beep(codec); |
3743 |
+ cx_auto_parse_eapd(codec); |
3744 |
+- if (spec->gen.own_eapd_ctl) |
3745 |
++ spec->gen.own_eapd_ctl = 1; |
3746 |
++ if (spec->dynamic_eapd) |
3747 |
+ spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook; |
3748 |
+ |
3749 |
+ switch (codec->vendor_id) { |
3750 |
+diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c |
3751 |
+index 41230ad..4a6f1da 100644 |
3752 |
+--- a/sound/soc/codecs/da7213.c |
3753 |
++++ b/sound/soc/codecs/da7213.c |
3754 |
+@@ -1488,17 +1488,17 @@ static int da7213_probe(struct snd_soc_codec *codec) |
3755 |
+ DA7213_DMIC_DATA_SEL_SHIFT); |
3756 |
+ break; |
3757 |
+ } |
3758 |
+- switch (pdata->dmic_data_sel) { |
3759 |
++ switch (pdata->dmic_samplephase) { |
3760 |
+ case DA7213_DMIC_SAMPLE_ON_CLKEDGE: |
3761 |
+ case DA7213_DMIC_SAMPLE_BETWEEN_CLKEDGE: |
3762 |
+- dmic_cfg |= (pdata->dmic_data_sel << |
3763 |
++ dmic_cfg |= (pdata->dmic_samplephase << |
3764 |
+ DA7213_DMIC_SAMPLEPHASE_SHIFT); |
3765 |
+ break; |
3766 |
+ } |
3767 |
+- switch (pdata->dmic_data_sel) { |
3768 |
++ switch (pdata->dmic_clk_rate) { |
3769 |
+ case DA7213_DMIC_CLK_3_0MHZ: |
3770 |
+ case DA7213_DMIC_CLK_1_5MHZ: |
3771 |
+- dmic_cfg |= (pdata->dmic_data_sel << |
3772 |
++ dmic_cfg |= (pdata->dmic_clk_rate << |
3773 |
+ DA7213_DMIC_CLK_RATE_SHIFT); |
3774 |
+ break; |
3775 |
+ } |
3776 |
+diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c |
3777 |
+index c9bd445..e5f96c9 100644 |
3778 |
+--- a/sound/soc/codecs/wm8994.c |
3779 |
++++ b/sound/soc/codecs/wm8994.c |
3780 |
+@@ -2841,6 +2841,7 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream, |
3781 |
+ default: |
3782 |
+ return 0; |
3783 |
+ } |
3784 |
++ break; |
3785 |
+ default: |
3786 |
+ return 0; |
3787 |
+ } |