1 |
commit: b00da6f810d31f1fb924713c20c3f3b103f03228 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Oct 27 13:36:07 2015 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Oct 27 13:36:07 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=b00da6f8 |
7 |
|
8 |
Linux patch 4.2.5 |
9 |
|
10 |
0000_README | 4 + |
11 |
1004_linux-4.2.5.patch | 1945 ++++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 1949 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index daafdd3..d40ecf2 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -59,6 +59,10 @@ Patch: 1003_linux-4.2.4.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.2.4 |
21 |
|
22 |
+Patch: 1004_linux-4.2.5.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.2.5 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1004_linux-4.2.5.patch b/1004_linux-4.2.5.patch |
31 |
new file mode 100644 |
32 |
index 0000000..b866faf |
33 |
--- /dev/null |
34 |
+++ b/1004_linux-4.2.5.patch |
35 |
@@ -0,0 +1,1945 @@ |
36 |
+diff --git a/Makefile b/Makefile |
37 |
+index a952801a6cd5..96076dcad18e 100644 |
38 |
+--- a/Makefile |
39 |
++++ b/Makefile |
40 |
+@@ -1,6 +1,6 @@ |
41 |
+ VERSION = 4 |
42 |
+ PATCHLEVEL = 2 |
43 |
+-SUBLEVEL = 4 |
44 |
++SUBLEVEL = 5 |
45 |
+ EXTRAVERSION = |
46 |
+ NAME = Hurr durr I'ma sheep |
47 |
+ |
48 |
+diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile |
49 |
+index 4418a5078833..c8643ac5db71 100644 |
50 |
+--- a/arch/arm/mach-ux500/Makefile |
51 |
++++ b/arch/arm/mach-ux500/Makefile |
52 |
+@@ -7,7 +7,7 @@ obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o |
53 |
+ obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o |
54 |
+ obj-$(CONFIG_MACH_MOP500) += board-mop500-regulators.o \ |
55 |
+ board-mop500-audio.o |
56 |
+-obj-$(CONFIG_SMP) += platsmp.o headsmp.o |
57 |
++obj-$(CONFIG_SMP) += platsmp.o |
58 |
+ obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
59 |
+ obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o |
60 |
+ |
61 |
+diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c |
62 |
+index 16913800bbf9..ba708ce08616 100644 |
63 |
+--- a/arch/arm/mach-ux500/cpu-db8500.c |
64 |
++++ b/arch/arm/mach-ux500/cpu-db8500.c |
65 |
+@@ -154,7 +154,6 @@ static const char * stericsson_dt_platform_compat[] = { |
66 |
+ }; |
67 |
+ |
68 |
+ DT_MACHINE_START(U8500_DT, "ST-Ericsson Ux5x0 platform (Device Tree Support)") |
69 |
+- .smp = smp_ops(ux500_smp_ops), |
70 |
+ .map_io = u8500_map_io, |
71 |
+ .init_irq = ux500_init_irq, |
72 |
+ /* we re-use nomadik timer here */ |
73 |
+diff --git a/arch/arm/mach-ux500/headsmp.S b/arch/arm/mach-ux500/headsmp.S |
74 |
+deleted file mode 100644 |
75 |
+index 9cdea049485d..000000000000 |
76 |
+--- a/arch/arm/mach-ux500/headsmp.S |
77 |
++++ /dev/null |
78 |
+@@ -1,37 +0,0 @@ |
79 |
+-/* |
80 |
+- * Copyright (c) 2009 ST-Ericsson |
81 |
+- * This file is based ARM Realview platform |
82 |
+- * Copyright (c) 2003 ARM Limited |
83 |
+- * All Rights Reserved |
84 |
+- * |
85 |
+- * This program is free software; you can redistribute it and/or modify |
86 |
+- * it under the terms of the GNU General Public License version 2 as |
87 |
+- * published by the Free Software Foundation. |
88 |
+- */ |
89 |
+-#include <linux/linkage.h> |
90 |
+-#include <linux/init.h> |
91 |
+- |
92 |
+-/* |
93 |
+- * U8500 specific entry point for secondary CPUs. |
94 |
+- */ |
95 |
+-ENTRY(u8500_secondary_startup) |
96 |
+- mrc p15, 0, r0, c0, c0, 5 |
97 |
+- and r0, r0, #15 |
98 |
+- adr r4, 1f |
99 |
+- ldmia r4, {r5, r6} |
100 |
+- sub r4, r4, r5 |
101 |
+- add r6, r6, r4 |
102 |
+-pen: ldr r7, [r6] |
103 |
+- cmp r7, r0 |
104 |
+- bne pen |
105 |
+- |
106 |
+- /* |
107 |
+- * we've been released from the holding pen: secondary_stack |
108 |
+- * should now contain the SVC stack for this core |
109 |
+- */ |
110 |
+- b secondary_startup |
111 |
+-ENDPROC(u8500_secondary_startup) |
112 |
+- |
113 |
+- .align 2 |
114 |
+-1: .long . |
115 |
+- .long pen_release |
116 |
+diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c |
117 |
+index 62b1de922bd8..70766b963758 100644 |
118 |
+--- a/arch/arm/mach-ux500/platsmp.c |
119 |
++++ b/arch/arm/mach-ux500/platsmp.c |
120 |
+@@ -28,135 +28,81 @@ |
121 |
+ #include "db8500-regs.h" |
122 |
+ #include "id.h" |
123 |
+ |
124 |
+-static void __iomem *scu_base; |
125 |
+-static void __iomem *backupram; |
126 |
+- |
127 |
+-/* This is called from headsmp.S to wakeup the secondary core */ |
128 |
+-extern void u8500_secondary_startup(void); |
129 |
+- |
130 |
+-/* |
131 |
+- * Write pen_release in a way that is guaranteed to be visible to all |
132 |
+- * observers, irrespective of whether they're taking part in coherency |
133 |
+- * or not. This is necessary for the hotplug code to work reliably. |
134 |
+- */ |
135 |
+-static void write_pen_release(int val) |
136 |
+-{ |
137 |
+- pen_release = val; |
138 |
+- smp_wmb(); |
139 |
+- sync_cache_w(&pen_release); |
140 |
+-} |
141 |
+- |
142 |
+-static DEFINE_SPINLOCK(boot_lock); |
143 |
+- |
144 |
+-static void ux500_secondary_init(unsigned int cpu) |
145 |
+-{ |
146 |
+- /* |
147 |
+- * let the primary processor know we're out of the |
148 |
+- * pen, then head off into the C entry point |
149 |
+- */ |
150 |
+- write_pen_release(-1); |
151 |
+- |
152 |
+- /* |
153 |
+- * Synchronise with the boot thread. |
154 |
+- */ |
155 |
+- spin_lock(&boot_lock); |
156 |
+- spin_unlock(&boot_lock); |
157 |
+-} |
158 |
++/* Magic triggers in backup RAM */ |
159 |
++#define UX500_CPU1_JUMPADDR_OFFSET 0x1FF4 |
160 |
++#define UX500_CPU1_WAKEMAGIC_OFFSET 0x1FF0 |
161 |
+ |
162 |
+-static int ux500_boot_secondary(unsigned int cpu, struct task_struct *idle) |
163 |
++static void wakeup_secondary(void) |
164 |
+ { |
165 |
+- unsigned long timeout; |
166 |
+- |
167 |
+- /* |
168 |
+- * set synchronisation state between this boot processor |
169 |
+- * and the secondary one |
170 |
+- */ |
171 |
+- spin_lock(&boot_lock); |
172 |
+- |
173 |
+- /* |
174 |
+- * The secondary processor is waiting to be released from |
175 |
+- * the holding pen - release it, then wait for it to flag |
176 |
+- * that it has been released by resetting pen_release. |
177 |
+- */ |
178 |
+- write_pen_release(cpu_logical_map(cpu)); |
179 |
+- |
180 |
+- arch_send_wakeup_ipi_mask(cpumask_of(cpu)); |
181 |
++ struct device_node *np; |
182 |
++ static void __iomem *backupram; |
183 |
+ |
184 |
+- timeout = jiffies + (1 * HZ); |
185 |
+- while (time_before(jiffies, timeout)) { |
186 |
+- if (pen_release == -1) |
187 |
+- break; |
188 |
++ np = of_find_compatible_node(NULL, NULL, "ste,dbx500-backupram"); |
189 |
++ if (!np) { |
190 |
++ pr_err("No backupram base address\n"); |
191 |
++ return; |
192 |
++ } |
193 |
++ backupram = of_iomap(np, 0); |
194 |
++ of_node_put(np); |
195 |
++ if (!backupram) { |
196 |
++ pr_err("No backupram remap\n"); |
197 |
++ return; |
198 |
+ } |
199 |
+ |
200 |
+ /* |
201 |
+- * now the secondary core is starting up let it run its |
202 |
+- * calibrations, then wait for it to finish |
203 |
+- */ |
204 |
+- spin_unlock(&boot_lock); |
205 |
+- |
206 |
+- return pen_release != -1 ? -ENOSYS : 0; |
207 |
+-} |
208 |
+- |
209 |
+-static void __init wakeup_secondary(void) |
210 |
+-{ |
211 |
+- /* |
212 |
+ * write the address of secondary startup into the backup ram register |
213 |
+ * at offset 0x1FF4, then write the magic number 0xA1FEED01 to the |
214 |
+ * backup ram register at offset 0x1FF0, which is what boot rom code |
215 |
+- * is waiting for. This would wake up the secondary core from WFE |
216 |
++ * is waiting for. This will wake up the secondary core from WFE. |
217 |
+ */ |
218 |
+-#define UX500_CPU1_JUMPADDR_OFFSET 0x1FF4 |
219 |
+- __raw_writel(virt_to_phys(u8500_secondary_startup), |
220 |
+- backupram + UX500_CPU1_JUMPADDR_OFFSET); |
221 |
+- |
222 |
+-#define UX500_CPU1_WAKEMAGIC_OFFSET 0x1FF0 |
223 |
+- __raw_writel(0xA1FEED01, |
224 |
+- backupram + UX500_CPU1_WAKEMAGIC_OFFSET); |
225 |
++ writel(virt_to_phys(secondary_startup), |
226 |
++ backupram + UX500_CPU1_JUMPADDR_OFFSET); |
227 |
++ writel(0xA1FEED01, |
228 |
++ backupram + UX500_CPU1_WAKEMAGIC_OFFSET); |
229 |
+ |
230 |
+ /* make sure write buffer is drained */ |
231 |
+ mb(); |
232 |
++ iounmap(backupram); |
233 |
+ } |
234 |
+ |
235 |
+-/* |
236 |
+- * Initialise the CPU possible map early - this describes the CPUs |
237 |
+- * which may be present or become present in the system. |
238 |
+- */ |
239 |
+-static void __init ux500_smp_init_cpus(void) |
240 |
++static void __init ux500_smp_prepare_cpus(unsigned int max_cpus) |
241 |
+ { |
242 |
+- unsigned int i, ncores; |
243 |
+ struct device_node *np; |
244 |
++ static void __iomem *scu_base; |
245 |
++ unsigned int ncores; |
246 |
++ int i; |
247 |
+ |
248 |
+ np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); |
249 |
++ if (!np) { |
250 |
++ pr_err("No SCU base address\n"); |
251 |
++ return; |
252 |
++ } |
253 |
+ scu_base = of_iomap(np, 0); |
254 |
+ of_node_put(np); |
255 |
+- if (!scu_base) |
256 |
++ if (!scu_base) { |
257 |
++ pr_err("No SCU remap\n"); |
258 |
+ return; |
259 |
+- backupram = ioremap(U8500_BACKUPRAM0_BASE, SZ_8K); |
260 |
+- ncores = scu_get_core_count(scu_base); |
261 |
+- |
262 |
+- /* sanity check */ |
263 |
+- if (ncores > nr_cpu_ids) { |
264 |
+- pr_warn("SMP: %u cores greater than maximum (%u), clipping\n", |
265 |
+- ncores, nr_cpu_ids); |
266 |
+- ncores = nr_cpu_ids; |
267 |
+ } |
268 |
+ |
269 |
++ scu_enable(scu_base); |
270 |
++ ncores = scu_get_core_count(scu_base); |
271 |
+ for (i = 0; i < ncores; i++) |
272 |
+ set_cpu_possible(i, true); |
273 |
++ iounmap(scu_base); |
274 |
+ } |
275 |
+ |
276 |
+-static void __init ux500_smp_prepare_cpus(unsigned int max_cpus) |
277 |
++static int ux500_boot_secondary(unsigned int cpu, struct task_struct *idle) |
278 |
+ { |
279 |
+- scu_enable(scu_base); |
280 |
+ wakeup_secondary(); |
281 |
++ arch_send_wakeup_ipi_mask(cpumask_of(cpu)); |
282 |
++ return 0; |
283 |
+ } |
284 |
+ |
285 |
+ struct smp_operations ux500_smp_ops __initdata = { |
286 |
+- .smp_init_cpus = ux500_smp_init_cpus, |
287 |
+ .smp_prepare_cpus = ux500_smp_prepare_cpus, |
288 |
+- .smp_secondary_init = ux500_secondary_init, |
289 |
+ .smp_boot_secondary = ux500_boot_secondary, |
290 |
+ #ifdef CONFIG_HOTPLUG_CPU |
291 |
+ .cpu_die = ux500_cpu_die, |
292 |
+ #endif |
293 |
+ }; |
294 |
++CPU_METHOD_OF_DECLARE(ux500_smp, "ste,dbx500-smp", &ux500_smp_ops); |
295 |
+diff --git a/arch/arm/mach-ux500/setup.h b/arch/arm/mach-ux500/setup.h |
296 |
+index 1fb6ad2789f1..65876eac0761 100644 |
297 |
+--- a/arch/arm/mach-ux500/setup.h |
298 |
++++ b/arch/arm/mach-ux500/setup.h |
299 |
+@@ -26,7 +26,6 @@ extern struct device *ux500_soc_device_init(const char *soc_id); |
300 |
+ |
301 |
+ extern void ux500_timer_init(void); |
302 |
+ |
303 |
+-extern struct smp_operations ux500_smp_ops; |
304 |
+ extern void ux500_cpu_die(unsigned int cpu); |
305 |
+ |
306 |
+ #endif /* __ASM_ARCH_SETUP_H */ |
307 |
+diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile |
308 |
+index 81151663ef38..3258174e6152 100644 |
309 |
+--- a/arch/arm64/Makefile |
310 |
++++ b/arch/arm64/Makefile |
311 |
+@@ -31,7 +31,7 @@ endif |
312 |
+ CHECKFLAGS += -D__aarch64__ |
313 |
+ |
314 |
+ ifeq ($(CONFIG_ARM64_ERRATUM_843419), y) |
315 |
+-CFLAGS_MODULE += -mcmodel=large |
316 |
++KBUILD_CFLAGS_MODULE += -mcmodel=large |
317 |
+ endif |
318 |
+ |
319 |
+ # Default value |
320 |
+diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h |
321 |
+index 56283f8a675c..cf7319422768 100644 |
322 |
+--- a/arch/arm64/include/asm/pgtable.h |
323 |
++++ b/arch/arm64/include/asm/pgtable.h |
324 |
+@@ -80,7 +80,7 @@ extern void __pgd_error(const char *file, int line, unsigned long val); |
325 |
+ #define PAGE_S2 __pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_NORMAL) | PTE_S2_RDONLY) |
326 |
+ #define PAGE_S2_DEVICE __pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_DEVICE_nGnRE) | PTE_S2_RDONLY | PTE_UXN) |
327 |
+ |
328 |
+-#define PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_TYPE_MASK) | PTE_PROT_NONE | PTE_PXN | PTE_UXN) |
329 |
++#define PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_VALID) | PTE_PROT_NONE | PTE_PXN | PTE_UXN) |
330 |
+ #define PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_WRITE) |
331 |
+ #define PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_WRITE) |
332 |
+ #define PAGE_COPY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN) |
333 |
+@@ -460,7 +460,7 @@ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long addr) |
334 |
+ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
335 |
+ { |
336 |
+ const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY | |
337 |
+- PTE_PROT_NONE | PTE_WRITE | PTE_TYPE_MASK; |
338 |
++ PTE_PROT_NONE | PTE_VALID | PTE_WRITE; |
339 |
+ pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); |
340 |
+ return pte; |
341 |
+ } |
342 |
+diff --git a/arch/sparc/crypto/aes_glue.c b/arch/sparc/crypto/aes_glue.c |
343 |
+index 2e48eb8813ff..c90930de76ba 100644 |
344 |
+--- a/arch/sparc/crypto/aes_glue.c |
345 |
++++ b/arch/sparc/crypto/aes_glue.c |
346 |
+@@ -433,6 +433,7 @@ static struct crypto_alg algs[] = { { |
347 |
+ .blkcipher = { |
348 |
+ .min_keysize = AES_MIN_KEY_SIZE, |
349 |
+ .max_keysize = AES_MAX_KEY_SIZE, |
350 |
++ .ivsize = AES_BLOCK_SIZE, |
351 |
+ .setkey = aes_set_key, |
352 |
+ .encrypt = cbc_encrypt, |
353 |
+ .decrypt = cbc_decrypt, |
354 |
+@@ -452,6 +453,7 @@ static struct crypto_alg algs[] = { { |
355 |
+ .blkcipher = { |
356 |
+ .min_keysize = AES_MIN_KEY_SIZE, |
357 |
+ .max_keysize = AES_MAX_KEY_SIZE, |
358 |
++ .ivsize = AES_BLOCK_SIZE, |
359 |
+ .setkey = aes_set_key, |
360 |
+ .encrypt = ctr_crypt, |
361 |
+ .decrypt = ctr_crypt, |
362 |
+diff --git a/arch/sparc/crypto/camellia_glue.c b/arch/sparc/crypto/camellia_glue.c |
363 |
+index 6bf2479a12fb..561a84d93cf6 100644 |
364 |
+--- a/arch/sparc/crypto/camellia_glue.c |
365 |
++++ b/arch/sparc/crypto/camellia_glue.c |
366 |
+@@ -274,6 +274,7 @@ static struct crypto_alg algs[] = { { |
367 |
+ .blkcipher = { |
368 |
+ .min_keysize = CAMELLIA_MIN_KEY_SIZE, |
369 |
+ .max_keysize = CAMELLIA_MAX_KEY_SIZE, |
370 |
++ .ivsize = CAMELLIA_BLOCK_SIZE, |
371 |
+ .setkey = camellia_set_key, |
372 |
+ .encrypt = cbc_encrypt, |
373 |
+ .decrypt = cbc_decrypt, |
374 |
+diff --git a/arch/sparc/crypto/des_glue.c b/arch/sparc/crypto/des_glue.c |
375 |
+index dd6a34fa6e19..61af794aa2d3 100644 |
376 |
+--- a/arch/sparc/crypto/des_glue.c |
377 |
++++ b/arch/sparc/crypto/des_glue.c |
378 |
+@@ -429,6 +429,7 @@ static struct crypto_alg algs[] = { { |
379 |
+ .blkcipher = { |
380 |
+ .min_keysize = DES_KEY_SIZE, |
381 |
+ .max_keysize = DES_KEY_SIZE, |
382 |
++ .ivsize = DES_BLOCK_SIZE, |
383 |
+ .setkey = des_set_key, |
384 |
+ .encrypt = cbc_encrypt, |
385 |
+ .decrypt = cbc_decrypt, |
386 |
+@@ -485,6 +486,7 @@ static struct crypto_alg algs[] = { { |
387 |
+ .blkcipher = { |
388 |
+ .min_keysize = DES3_EDE_KEY_SIZE, |
389 |
+ .max_keysize = DES3_EDE_KEY_SIZE, |
390 |
++ .ivsize = DES3_EDE_BLOCK_SIZE, |
391 |
+ .setkey = des3_ede_set_key, |
392 |
+ .encrypt = cbc3_encrypt, |
393 |
+ .decrypt = cbc3_decrypt, |
394 |
+diff --git a/arch/x86/crypto/camellia_aesni_avx_glue.c b/arch/x86/crypto/camellia_aesni_avx_glue.c |
395 |
+index 80a0e4389c9a..bacaa13acac5 100644 |
396 |
+--- a/arch/x86/crypto/camellia_aesni_avx_glue.c |
397 |
++++ b/arch/x86/crypto/camellia_aesni_avx_glue.c |
398 |
+@@ -554,6 +554,11 @@ static int __init camellia_aesni_init(void) |
399 |
+ { |
400 |
+ const char *feature_name; |
401 |
+ |
402 |
++ if (!cpu_has_avx || !cpu_has_aes || !cpu_has_osxsave) { |
403 |
++ pr_info("AVX or AES-NI instructions are not detected.\n"); |
404 |
++ return -ENODEV; |
405 |
++ } |
406 |
++ |
407 |
+ if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) { |
408 |
+ pr_info("CPU feature '%s' is not supported.\n", feature_name); |
409 |
+ return -ENODEV; |
410 |
+diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c |
411 |
+index e7a4fde5d631..2392541a96e6 100644 |
412 |
+--- a/arch/x86/kvm/emulate.c |
413 |
++++ b/arch/x86/kvm/emulate.c |
414 |
+@@ -2418,7 +2418,7 @@ static int rsm_load_state_64(struct x86_emulate_ctxt *ctxt, u64 smbase) |
415 |
+ u64 val, cr0, cr4; |
416 |
+ u32 base3; |
417 |
+ u16 selector; |
418 |
+- int i; |
419 |
++ int i, r; |
420 |
+ |
421 |
+ for (i = 0; i < 16; i++) |
422 |
+ *reg_write(ctxt, i) = GET_SMSTATE(u64, smbase, 0x7ff8 - i * 8); |
423 |
+@@ -2460,13 +2460,17 @@ static int rsm_load_state_64(struct x86_emulate_ctxt *ctxt, u64 smbase) |
424 |
+ dt.address = GET_SMSTATE(u64, smbase, 0x7e68); |
425 |
+ ctxt->ops->set_gdt(ctxt, &dt); |
426 |
+ |
427 |
++ r = rsm_enter_protected_mode(ctxt, cr0, cr4); |
428 |
++ if (r != X86EMUL_CONTINUE) |
429 |
++ return r; |
430 |
++ |
431 |
+ for (i = 0; i < 6; i++) { |
432 |
+- int r = rsm_load_seg_64(ctxt, smbase, i); |
433 |
++ r = rsm_load_seg_64(ctxt, smbase, i); |
434 |
+ if (r != X86EMUL_CONTINUE) |
435 |
+ return r; |
436 |
+ } |
437 |
+ |
438 |
+- return rsm_enter_protected_mode(ctxt, cr0, cr4); |
439 |
++ return X86EMUL_CONTINUE; |
440 |
+ } |
441 |
+ |
442 |
+ static int em_rsm(struct x86_emulate_ctxt *ctxt) |
443 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
444 |
+index 32c6e6ac5964..373328b71599 100644 |
445 |
+--- a/arch/x86/kvm/x86.c |
446 |
++++ b/arch/x86/kvm/x86.c |
447 |
+@@ -6706,6 +6706,12 @@ static inline int vcpu_block(struct kvm *kvm, struct kvm_vcpu *vcpu) |
448 |
+ return 1; |
449 |
+ } |
450 |
+ |
451 |
++static inline bool kvm_vcpu_running(struct kvm_vcpu *vcpu) |
452 |
++{ |
453 |
++ return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE && |
454 |
++ !vcpu->arch.apf.halted); |
455 |
++} |
456 |
++ |
457 |
+ static int vcpu_run(struct kvm_vcpu *vcpu) |
458 |
+ { |
459 |
+ int r; |
460 |
+@@ -6714,8 +6720,7 @@ static int vcpu_run(struct kvm_vcpu *vcpu) |
461 |
+ vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); |
462 |
+ |
463 |
+ for (;;) { |
464 |
+- if (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE && |
465 |
+- !vcpu->arch.apf.halted) |
466 |
++ if (kvm_vcpu_running(vcpu)) |
467 |
+ r = vcpu_enter_guest(vcpu); |
468 |
+ else |
469 |
+ r = vcpu_block(kvm, vcpu); |
470 |
+@@ -8011,19 +8016,36 @@ void kvm_arch_flush_shadow_memslot(struct kvm *kvm, |
471 |
+ kvm_mmu_invalidate_zap_all_pages(kvm); |
472 |
+ } |
473 |
+ |
474 |
++static inline bool kvm_vcpu_has_events(struct kvm_vcpu *vcpu) |
475 |
++{ |
476 |
++ if (!list_empty_careful(&vcpu->async_pf.done)) |
477 |
++ return true; |
478 |
++ |
479 |
++ if (kvm_apic_has_events(vcpu)) |
480 |
++ return true; |
481 |
++ |
482 |
++ if (vcpu->arch.pv.pv_unhalted) |
483 |
++ return true; |
484 |
++ |
485 |
++ if (atomic_read(&vcpu->arch.nmi_queued)) |
486 |
++ return true; |
487 |
++ |
488 |
++ if (test_bit(KVM_REQ_SMI, &vcpu->requests)) |
489 |
++ return true; |
490 |
++ |
491 |
++ if (kvm_arch_interrupt_allowed(vcpu) && |
492 |
++ kvm_cpu_has_interrupt(vcpu)) |
493 |
++ return true; |
494 |
++ |
495 |
++ return false; |
496 |
++} |
497 |
++ |
498 |
+ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) |
499 |
+ { |
500 |
+ if (is_guest_mode(vcpu) && kvm_x86_ops->check_nested_events) |
501 |
+ kvm_x86_ops->check_nested_events(vcpu, false); |
502 |
+ |
503 |
+- return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE && |
504 |
+- !vcpu->arch.apf.halted) |
505 |
+- || !list_empty_careful(&vcpu->async_pf.done) |
506 |
+- || kvm_apic_has_events(vcpu) |
507 |
+- || vcpu->arch.pv.pv_unhalted |
508 |
+- || atomic_read(&vcpu->arch.nmi_queued) || |
509 |
+- (kvm_arch_interrupt_allowed(vcpu) && |
510 |
+- kvm_cpu_has_interrupt(vcpu)); |
511 |
++ return kvm_vcpu_running(vcpu) || kvm_vcpu_has_events(vcpu); |
512 |
+ } |
513 |
+ |
514 |
+ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu) |
515 |
+diff --git a/crypto/ahash.c b/crypto/ahash.c |
516 |
+index 8acb886032ae..9c1dc8d6106a 100644 |
517 |
+--- a/crypto/ahash.c |
518 |
++++ b/crypto/ahash.c |
519 |
+@@ -544,7 +544,8 @@ static int ahash_prepare_alg(struct ahash_alg *alg) |
520 |
+ struct crypto_alg *base = &alg->halg.base; |
521 |
+ |
522 |
+ if (alg->halg.digestsize > PAGE_SIZE / 8 || |
523 |
+- alg->halg.statesize > PAGE_SIZE / 8) |
524 |
++ alg->halg.statesize > PAGE_SIZE / 8 || |
525 |
++ alg->halg.statesize == 0) |
526 |
+ return -EINVAL; |
527 |
+ |
528 |
+ base->cra_type = &crypto_ahash_type; |
529 |
+diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c |
530 |
+index bc67a93aa4f4..324bf35ec4dd 100644 |
531 |
+--- a/drivers/block/rbd.c |
532 |
++++ b/drivers/block/rbd.c |
533 |
+@@ -5201,7 +5201,6 @@ static int rbd_dev_probe_parent(struct rbd_device *rbd_dev) |
534 |
+ out_err: |
535 |
+ if (parent) { |
536 |
+ rbd_dev_unparent(rbd_dev); |
537 |
+- kfree(rbd_dev->header_name); |
538 |
+ rbd_dev_destroy(parent); |
539 |
+ } else { |
540 |
+ rbd_put_client(rbdc); |
541 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |
542 |
+index b16b9256883e..4c4035fdeb6f 100644 |
543 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |
544 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |
545 |
+@@ -76,8 +76,6 @@ static void amdgpu_flip_work_func(struct work_struct *__work) |
546 |
+ /* We borrow the event spin lock for protecting flip_status */ |
547 |
+ spin_lock_irqsave(&crtc->dev->event_lock, flags); |
548 |
+ |
549 |
+- /* set the proper interrupt */ |
550 |
+- amdgpu_irq_get(adev, &adev->pageflip_irq, work->crtc_id); |
551 |
+ /* do the flip (mmio) */ |
552 |
+ adev->mode_info.funcs->page_flip(adev, work->crtc_id, work->base); |
553 |
+ /* set the flip status */ |
554 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c |
555 |
+index 82e8d0730517..a1a35a5df8e7 100644 |
556 |
+--- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c |
557 |
++++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c |
558 |
+@@ -6185,6 +6185,11 @@ static int ci_dpm_late_init(void *handle) |
559 |
+ if (!amdgpu_dpm) |
560 |
+ return 0; |
561 |
+ |
562 |
++ /* init the sysfs and debugfs files late */ |
563 |
++ ret = amdgpu_pm_sysfs_init(adev); |
564 |
++ if (ret) |
565 |
++ return ret; |
566 |
++ |
567 |
+ ret = ci_set_temperature_range(adev); |
568 |
+ if (ret) |
569 |
+ return ret; |
570 |
+@@ -6232,9 +6237,6 @@ static int ci_dpm_sw_init(void *handle) |
571 |
+ adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps; |
572 |
+ if (amdgpu_dpm == 1) |
573 |
+ amdgpu_pm_print_power_states(adev); |
574 |
+- ret = amdgpu_pm_sysfs_init(adev); |
575 |
+- if (ret) |
576 |
+- goto dpm_failed; |
577 |
+ mutex_unlock(&adev->pm.mutex); |
578 |
+ DRM_INFO("amdgpu: dpm initialized\n"); |
579 |
+ |
580 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c |
581 |
+index 341c56681841..519fa515c4d8 100644 |
582 |
+--- a/drivers/gpu/drm/amd/amdgpu/cik.c |
583 |
++++ b/drivers/gpu/drm/amd/amdgpu/cik.c |
584 |
+@@ -1565,6 +1565,9 @@ static void cik_pcie_gen3_enable(struct amdgpu_device *adev) |
585 |
+ int ret, i; |
586 |
+ u16 tmp16; |
587 |
+ |
588 |
++ if (pci_is_root_bus(adev->pdev->bus)) |
589 |
++ return; |
590 |
++ |
591 |
+ if (amdgpu_pcie_gen2 == 0) |
592 |
+ return; |
593 |
+ |
594 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c |
595 |
+index ace870afc7d4..fd29c18fc14e 100644 |
596 |
+--- a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c |
597 |
++++ b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c |
598 |
+@@ -596,6 +596,12 @@ static int cz_dpm_late_init(void *handle) |
599 |
+ struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
600 |
+ |
601 |
+ if (amdgpu_dpm) { |
602 |
++ int ret; |
603 |
++ /* init the sysfs and debugfs files late */ |
604 |
++ ret = amdgpu_pm_sysfs_init(adev); |
605 |
++ if (ret) |
606 |
++ return ret; |
607 |
++ |
608 |
+ /* powerdown unused blocks for now */ |
609 |
+ cz_dpm_powergate_uvd(adev, true); |
610 |
+ cz_dpm_powergate_vce(adev, true); |
611 |
+@@ -632,10 +638,6 @@ static int cz_dpm_sw_init(void *handle) |
612 |
+ if (amdgpu_dpm == 1) |
613 |
+ amdgpu_pm_print_power_states(adev); |
614 |
+ |
615 |
+- ret = amdgpu_pm_sysfs_init(adev); |
616 |
+- if (ret) |
617 |
+- goto dpm_init_failed; |
618 |
+- |
619 |
+ mutex_unlock(&adev->pm.mutex); |
620 |
+ DRM_INFO("amdgpu: dpm initialized\n"); |
621 |
+ |
622 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c |
623 |
+index e774a437dd65..ef36467c7e34 100644 |
624 |
+--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c |
625 |
++++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c |
626 |
+@@ -233,6 +233,24 @@ static u32 dce_v10_0_vblank_get_counter(struct amdgpu_device *adev, int crtc) |
627 |
+ return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]); |
628 |
+ } |
629 |
+ |
630 |
++static void dce_v10_0_pageflip_interrupt_init(struct amdgpu_device *adev) |
631 |
++{ |
632 |
++ unsigned i; |
633 |
++ |
634 |
++ /* Enable pflip interrupts */ |
635 |
++ for (i = 0; i < adev->mode_info.num_crtc; i++) |
636 |
++ amdgpu_irq_get(adev, &adev->pageflip_irq, i); |
637 |
++} |
638 |
++ |
639 |
++static void dce_v10_0_pageflip_interrupt_fini(struct amdgpu_device *adev) |
640 |
++{ |
641 |
++ unsigned i; |
642 |
++ |
643 |
++ /* Disable pflip interrupts */ |
644 |
++ for (i = 0; i < adev->mode_info.num_crtc; i++) |
645 |
++ amdgpu_irq_put(adev, &adev->pageflip_irq, i); |
646 |
++} |
647 |
++ |
648 |
+ /** |
649 |
+ * dce_v10_0_page_flip - pageflip callback. |
650 |
+ * |
651 |
+@@ -2641,9 +2659,10 @@ static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode) |
652 |
+ dce_v10_0_vga_enable(crtc, true); |
653 |
+ amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); |
654 |
+ dce_v10_0_vga_enable(crtc, false); |
655 |
+- /* Make sure VBLANK interrupt is still enabled */ |
656 |
++ /* Make sure VBLANK and PFLIP interrupts are still enabled */ |
657 |
+ type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id); |
658 |
+ amdgpu_irq_update(adev, &adev->crtc_irq, type); |
659 |
++ amdgpu_irq_update(adev, &adev->pageflip_irq, type); |
660 |
+ drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); |
661 |
+ dce_v10_0_crtc_load_lut(crtc); |
662 |
+ break; |
663 |
+@@ -3002,6 +3021,8 @@ static int dce_v10_0_hw_init(void *handle) |
664 |
+ dce_v10_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); |
665 |
+ } |
666 |
+ |
667 |
++ dce_v10_0_pageflip_interrupt_init(adev); |
668 |
++ |
669 |
+ return 0; |
670 |
+ } |
671 |
+ |
672 |
+@@ -3016,6 +3037,8 @@ static int dce_v10_0_hw_fini(void *handle) |
673 |
+ dce_v10_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); |
674 |
+ } |
675 |
+ |
676 |
++ dce_v10_0_pageflip_interrupt_fini(adev); |
677 |
++ |
678 |
+ return 0; |
679 |
+ } |
680 |
+ |
681 |
+@@ -3027,6 +3050,8 @@ static int dce_v10_0_suspend(void *handle) |
682 |
+ |
683 |
+ dce_v10_0_hpd_fini(adev); |
684 |
+ |
685 |
++ dce_v10_0_pageflip_interrupt_fini(adev); |
686 |
++ |
687 |
+ return 0; |
688 |
+ } |
689 |
+ |
690 |
+@@ -3052,6 +3077,8 @@ static int dce_v10_0_resume(void *handle) |
691 |
+ /* initialize hpd */ |
692 |
+ dce_v10_0_hpd_init(adev); |
693 |
+ |
694 |
++ dce_v10_0_pageflip_interrupt_init(adev); |
695 |
++ |
696 |
+ return 0; |
697 |
+ } |
698 |
+ |
699 |
+@@ -3346,7 +3373,6 @@ static int dce_v10_0_pageflip_irq(struct amdgpu_device *adev, |
700 |
+ spin_unlock_irqrestore(&adev->ddev->event_lock, flags); |
701 |
+ |
702 |
+ drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id); |
703 |
+- amdgpu_irq_put(adev, &adev->pageflip_irq, crtc_id); |
704 |
+ queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work); |
705 |
+ |
706 |
+ return 0; |
707 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c |
708 |
+index c4a21a7afd68..329bca0f1331 100644 |
709 |
+--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c |
710 |
++++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c |
711 |
+@@ -233,6 +233,24 @@ static u32 dce_v11_0_vblank_get_counter(struct amdgpu_device *adev, int crtc) |
712 |
+ return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]); |
713 |
+ } |
714 |
+ |
715 |
++static void dce_v11_0_pageflip_interrupt_init(struct amdgpu_device *adev) |
716 |
++{ |
717 |
++ unsigned i; |
718 |
++ |
719 |
++ /* Enable pflip interrupts */ |
720 |
++ for (i = 0; i < adev->mode_info.num_crtc; i++) |
721 |
++ amdgpu_irq_get(adev, &adev->pageflip_irq, i); |
722 |
++} |
723 |
++ |
724 |
++static void dce_v11_0_pageflip_interrupt_fini(struct amdgpu_device *adev) |
725 |
++{ |
726 |
++ unsigned i; |
727 |
++ |
728 |
++ /* Disable pflip interrupts */ |
729 |
++ for (i = 0; i < adev->mode_info.num_crtc; i++) |
730 |
++ amdgpu_irq_put(adev, &adev->pageflip_irq, i); |
731 |
++} |
732 |
++ |
733 |
+ /** |
734 |
+ * dce_v11_0_page_flip - pageflip callback. |
735 |
+ * |
736 |
+@@ -2640,9 +2658,10 @@ static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode) |
737 |
+ dce_v11_0_vga_enable(crtc, true); |
738 |
+ amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); |
739 |
+ dce_v11_0_vga_enable(crtc, false); |
740 |
+- /* Make sure VBLANK interrupt is still enabled */ |
741 |
++ /* Make sure VBLANK and PFLIP interrupts are still enabled */ |
742 |
+ type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id); |
743 |
+ amdgpu_irq_update(adev, &adev->crtc_irq, type); |
744 |
++ amdgpu_irq_update(adev, &adev->pageflip_irq, type); |
745 |
+ drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); |
746 |
+ dce_v11_0_crtc_load_lut(crtc); |
747 |
+ break; |
748 |
+@@ -2888,7 +2907,7 @@ static int dce_v11_0_early_init(void *handle) |
749 |
+ |
750 |
+ switch (adev->asic_type) { |
751 |
+ case CHIP_CARRIZO: |
752 |
+- adev->mode_info.num_crtc = 4; |
753 |
++ adev->mode_info.num_crtc = 3; |
754 |
+ adev->mode_info.num_hpd = 6; |
755 |
+ adev->mode_info.num_dig = 9; |
756 |
+ break; |
757 |
+@@ -3000,6 +3019,8 @@ static int dce_v11_0_hw_init(void *handle) |
758 |
+ dce_v11_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); |
759 |
+ } |
760 |
+ |
761 |
++ dce_v11_0_pageflip_interrupt_init(adev); |
762 |
++ |
763 |
+ return 0; |
764 |
+ } |
765 |
+ |
766 |
+@@ -3014,6 +3035,8 @@ static int dce_v11_0_hw_fini(void *handle) |
767 |
+ dce_v11_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); |
768 |
+ } |
769 |
+ |
770 |
++ dce_v11_0_pageflip_interrupt_fini(adev); |
771 |
++ |
772 |
+ return 0; |
773 |
+ } |
774 |
+ |
775 |
+@@ -3025,6 +3048,8 @@ static int dce_v11_0_suspend(void *handle) |
776 |
+ |
777 |
+ dce_v11_0_hpd_fini(adev); |
778 |
+ |
779 |
++ dce_v11_0_pageflip_interrupt_fini(adev); |
780 |
++ |
781 |
+ return 0; |
782 |
+ } |
783 |
+ |
784 |
+@@ -3051,6 +3076,8 @@ static int dce_v11_0_resume(void *handle) |
785 |
+ /* initialize hpd */ |
786 |
+ dce_v11_0_hpd_init(adev); |
787 |
+ |
788 |
++ dce_v11_0_pageflip_interrupt_init(adev); |
789 |
++ |
790 |
+ return 0; |
791 |
+ } |
792 |
+ |
793 |
+@@ -3345,7 +3372,6 @@ static int dce_v11_0_pageflip_irq(struct amdgpu_device *adev, |
794 |
+ spin_unlock_irqrestore(&adev->ddev->event_lock, flags); |
795 |
+ |
796 |
+ drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id); |
797 |
+- amdgpu_irq_put(adev, &adev->pageflip_irq, crtc_id); |
798 |
+ queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work); |
799 |
+ |
800 |
+ return 0; |
801 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c |
802 |
+index cc050a329c49..937879ed86bc 100644 |
803 |
+--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c |
804 |
++++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c |
805 |
+@@ -204,6 +204,24 @@ static u32 dce_v8_0_vblank_get_counter(struct amdgpu_device *adev, int crtc) |
806 |
+ return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]); |
807 |
+ } |
808 |
+ |
809 |
++static void dce_v8_0_pageflip_interrupt_init(struct amdgpu_device *adev) |
810 |
++{ |
811 |
++ unsigned i; |
812 |
++ |
813 |
++ /* Enable pflip interrupts */ |
814 |
++ for (i = 0; i < adev->mode_info.num_crtc; i++) |
815 |
++ amdgpu_irq_get(adev, &adev->pageflip_irq, i); |
816 |
++} |
817 |
++ |
818 |
++static void dce_v8_0_pageflip_interrupt_fini(struct amdgpu_device *adev) |
819 |
++{ |
820 |
++ unsigned i; |
821 |
++ |
822 |
++ /* Disable pflip interrupts */ |
823 |
++ for (i = 0; i < adev->mode_info.num_crtc; i++) |
824 |
++ amdgpu_irq_put(adev, &adev->pageflip_irq, i); |
825 |
++} |
826 |
++ |
827 |
+ /** |
828 |
+ * dce_v8_0_page_flip - pageflip callback. |
829 |
+ * |
830 |
+@@ -2575,9 +2593,10 @@ static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode) |
831 |
+ dce_v8_0_vga_enable(crtc, true); |
832 |
+ amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); |
833 |
+ dce_v8_0_vga_enable(crtc, false); |
834 |
+- /* Make sure VBLANK interrupt is still enabled */ |
835 |
++ /* Make sure VBLANK and PFLIP interrupts are still enabled */ |
836 |
+ type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id); |
837 |
+ amdgpu_irq_update(adev, &adev->crtc_irq, type); |
838 |
++ amdgpu_irq_update(adev, &adev->pageflip_irq, type); |
839 |
+ drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); |
840 |
+ dce_v8_0_crtc_load_lut(crtc); |
841 |
+ break; |
842 |
+@@ -2933,6 +2952,8 @@ static int dce_v8_0_hw_init(void *handle) |
843 |
+ dce_v8_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); |
844 |
+ } |
845 |
+ |
846 |
++ dce_v8_0_pageflip_interrupt_init(adev); |
847 |
++ |
848 |
+ return 0; |
849 |
+ } |
850 |
+ |
851 |
+@@ -2947,6 +2968,8 @@ static int dce_v8_0_hw_fini(void *handle) |
852 |
+ dce_v8_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); |
853 |
+ } |
854 |
+ |
855 |
++ dce_v8_0_pageflip_interrupt_fini(adev); |
856 |
++ |
857 |
+ return 0; |
858 |
+ } |
859 |
+ |
860 |
+@@ -2958,6 +2981,8 @@ static int dce_v8_0_suspend(void *handle) |
861 |
+ |
862 |
+ dce_v8_0_hpd_fini(adev); |
863 |
+ |
864 |
++ dce_v8_0_pageflip_interrupt_fini(adev); |
865 |
++ |
866 |
+ return 0; |
867 |
+ } |
868 |
+ |
869 |
+@@ -2981,6 +3006,8 @@ static int dce_v8_0_resume(void *handle) |
870 |
+ /* initialize hpd */ |
871 |
+ dce_v8_0_hpd_init(adev); |
872 |
+ |
873 |
++ dce_v8_0_pageflip_interrupt_init(adev); |
874 |
++ |
875 |
+ return 0; |
876 |
+ } |
877 |
+ |
878 |
+@@ -3376,7 +3403,6 @@ static int dce_v8_0_pageflip_irq(struct amdgpu_device *adev, |
879 |
+ spin_unlock_irqrestore(&adev->ddev->event_lock, flags); |
880 |
+ |
881 |
+ drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id); |
882 |
+- amdgpu_irq_put(adev, &adev->pageflip_irq, crtc_id); |
883 |
+ queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work); |
884 |
+ |
885 |
+ return 0; |
886 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c |
887 |
+index 94ec04a9c4d5..9745ed3a9aef 100644 |
888 |
+--- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c |
889 |
++++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c |
890 |
+@@ -2995,6 +2995,12 @@ static int kv_dpm_late_init(void *handle) |
891 |
+ { |
892 |
+ /* powerdown unused blocks for now */ |
893 |
+ struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
894 |
++ int ret; |
895 |
++ |
896 |
++ /* init the sysfs and debugfs files late */ |
897 |
++ ret = amdgpu_pm_sysfs_init(adev); |
898 |
++ if (ret) |
899 |
++ return ret; |
900 |
+ |
901 |
+ kv_dpm_powergate_acp(adev, true); |
902 |
+ kv_dpm_powergate_samu(adev, true); |
903 |
+@@ -3038,9 +3044,6 @@ static int kv_dpm_sw_init(void *handle) |
904 |
+ adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps; |
905 |
+ if (amdgpu_dpm == 1) |
906 |
+ amdgpu_pm_print_power_states(adev); |
907 |
+- ret = amdgpu_pm_sysfs_init(adev); |
908 |
+- if (ret) |
909 |
+- goto dpm_failed; |
910 |
+ mutex_unlock(&adev->pm.mutex); |
911 |
+ DRM_INFO("amdgpu: dpm initialized\n"); |
912 |
+ |
913 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c |
914 |
+index 4f58a1e18de6..9ffa56cebdbc 100644 |
915 |
+--- a/drivers/gpu/drm/amd/amdgpu/vi.c |
916 |
++++ b/drivers/gpu/drm/amd/amdgpu/vi.c |
917 |
+@@ -968,6 +968,9 @@ static void vi_pcie_gen3_enable(struct amdgpu_device *adev) |
918 |
+ u32 mask; |
919 |
+ int ret; |
920 |
+ |
921 |
++ if (pci_is_root_bus(adev->pdev->bus)) |
922 |
++ return; |
923 |
++ |
924 |
+ if (amdgpu_pcie_gen2 == 0) |
925 |
+ return; |
926 |
+ |
927 |
+diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c |
928 |
+index 969e7898a7ed..27a2426c3daa 100644 |
929 |
+--- a/drivers/gpu/drm/drm_dp_mst_topology.c |
930 |
++++ b/drivers/gpu/drm/drm_dp_mst_topology.c |
931 |
+@@ -2789,12 +2789,13 @@ static int drm_dp_mst_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs |
932 |
+ if (msgs[num - 1].flags & I2C_M_RD) |
933 |
+ reading = true; |
934 |
+ |
935 |
+- if (!reading) { |
936 |
++ if (!reading || (num - 1 > DP_REMOTE_I2C_READ_MAX_TRANSACTIONS)) { |
937 |
+ DRM_DEBUG_KMS("Unsupported I2C transaction for MST device\n"); |
938 |
+ ret = -EIO; |
939 |
+ goto out; |
940 |
+ } |
941 |
+ |
942 |
++ memset(&msg, 0, sizeof(msg)); |
943 |
+ msg.req_type = DP_REMOTE_I2C_READ; |
944 |
+ msg.u.i2c_read.num_transactions = num - 1; |
945 |
+ msg.u.i2c_read.port_number = port->port_num; |
946 |
+diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c |
947 |
+index 0f6cd33b531f..684bd4a13843 100644 |
948 |
+--- a/drivers/gpu/drm/drm_sysfs.c |
949 |
++++ b/drivers/gpu/drm/drm_sysfs.c |
950 |
+@@ -235,18 +235,12 @@ static ssize_t dpms_show(struct device *device, |
951 |
+ char *buf) |
952 |
+ { |
953 |
+ struct drm_connector *connector = to_drm_connector(device); |
954 |
+- struct drm_device *dev = connector->dev; |
955 |
+- uint64_t dpms_status; |
956 |
+- int ret; |
957 |
++ int dpms; |
958 |
+ |
959 |
+- ret = drm_object_property_get_value(&connector->base, |
960 |
+- dev->mode_config.dpms_property, |
961 |
+- &dpms_status); |
962 |
+- if (ret) |
963 |
+- return 0; |
964 |
++ dpms = READ_ONCE(connector->dpms); |
965 |
+ |
966 |
+ return snprintf(buf, PAGE_SIZE, "%s\n", |
967 |
+- drm_get_dpms_name((int)dpms_status)); |
968 |
++ drm_get_dpms_name(dpms)); |
969 |
+ } |
970 |
+ |
971 |
+ static ssize_t enabled_show(struct device *device, |
972 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c |
973 |
+index 6751553abe4a..567791b27d6d 100644 |
974 |
+--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c |
975 |
++++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c |
976 |
+@@ -178,8 +178,30 @@ nouveau_fbcon_sync(struct fb_info *info) |
977 |
+ return 0; |
978 |
+ } |
979 |
+ |
980 |
++static int |
981 |
++nouveau_fbcon_open(struct fb_info *info, int user) |
982 |
++{ |
983 |
++ struct nouveau_fbdev *fbcon = info->par; |
984 |
++ struct nouveau_drm *drm = nouveau_drm(fbcon->dev); |
985 |
++ int ret = pm_runtime_get_sync(drm->dev->dev); |
986 |
++ if (ret < 0 && ret != -EACCES) |
987 |
++ return ret; |
988 |
++ return 0; |
989 |
++} |
990 |
++ |
991 |
++static int |
992 |
++nouveau_fbcon_release(struct fb_info *info, int user) |
993 |
++{ |
994 |
++ struct nouveau_fbdev *fbcon = info->par; |
995 |
++ struct nouveau_drm *drm = nouveau_drm(fbcon->dev); |
996 |
++ pm_runtime_put(drm->dev->dev); |
997 |
++ return 0; |
998 |
++} |
999 |
++ |
1000 |
+ static struct fb_ops nouveau_fbcon_ops = { |
1001 |
+ .owner = THIS_MODULE, |
1002 |
++ .fb_open = nouveau_fbcon_open, |
1003 |
++ .fb_release = nouveau_fbcon_release, |
1004 |
+ .fb_check_var = drm_fb_helper_check_var, |
1005 |
+ .fb_set_par = drm_fb_helper_set_par, |
1006 |
+ .fb_fillrect = nouveau_fbcon_fillrect, |
1007 |
+@@ -195,6 +217,8 @@ static struct fb_ops nouveau_fbcon_ops = { |
1008 |
+ |
1009 |
+ static struct fb_ops nouveau_fbcon_sw_ops = { |
1010 |
+ .owner = THIS_MODULE, |
1011 |
++ .fb_open = nouveau_fbcon_open, |
1012 |
++ .fb_release = nouveau_fbcon_release, |
1013 |
+ .fb_check_var = drm_fb_helper_check_var, |
1014 |
+ .fb_set_par = drm_fb_helper_set_par, |
1015 |
+ .fb_fillrect = cfb_fillrect, |
1016 |
+diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c |
1017 |
+index 6b6e57e8c2d6..847a902e7385 100644 |
1018 |
+--- a/drivers/gpu/drm/qxl/qxl_fb.c |
1019 |
++++ b/drivers/gpu/drm/qxl/qxl_fb.c |
1020 |
+@@ -144,14 +144,17 @@ static void qxl_dirty_update(struct qxl_fbdev *qfbdev, |
1021 |
+ |
1022 |
+ spin_lock_irqsave(&qfbdev->dirty.lock, flags); |
1023 |
+ |
1024 |
+- if (qfbdev->dirty.y1 < y) |
1025 |
+- y = qfbdev->dirty.y1; |
1026 |
+- if (qfbdev->dirty.y2 > y2) |
1027 |
+- y2 = qfbdev->dirty.y2; |
1028 |
+- if (qfbdev->dirty.x1 < x) |
1029 |
+- x = qfbdev->dirty.x1; |
1030 |
+- if (qfbdev->dirty.x2 > x2) |
1031 |
+- x2 = qfbdev->dirty.x2; |
1032 |
++ if ((qfbdev->dirty.y2 - qfbdev->dirty.y1) && |
1033 |
++ (qfbdev->dirty.x2 - qfbdev->dirty.x1)) { |
1034 |
++ if (qfbdev->dirty.y1 < y) |
1035 |
++ y = qfbdev->dirty.y1; |
1036 |
++ if (qfbdev->dirty.y2 > y2) |
1037 |
++ y2 = qfbdev->dirty.y2; |
1038 |
++ if (qfbdev->dirty.x1 < x) |
1039 |
++ x = qfbdev->dirty.x1; |
1040 |
++ if (qfbdev->dirty.x2 > x2) |
1041 |
++ x2 = qfbdev->dirty.x2; |
1042 |
++ } |
1043 |
+ |
1044 |
+ qfbdev->dirty.x1 = x; |
1045 |
+ qfbdev->dirty.x2 = x2; |
1046 |
+diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c |
1047 |
+index d2e9e9efc159..6743174acdbc 100644 |
1048 |
+--- a/drivers/gpu/drm/radeon/radeon_display.c |
1049 |
++++ b/drivers/gpu/drm/radeon/radeon_display.c |
1050 |
+@@ -1633,18 +1633,8 @@ int radeon_modeset_init(struct radeon_device *rdev) |
1051 |
+ radeon_fbdev_init(rdev); |
1052 |
+ drm_kms_helper_poll_init(rdev->ddev); |
1053 |
+ |
1054 |
+- if (rdev->pm.dpm_enabled) { |
1055 |
+- /* do dpm late init */ |
1056 |
+- ret = radeon_pm_late_init(rdev); |
1057 |
+- if (ret) { |
1058 |
+- rdev->pm.dpm_enabled = false; |
1059 |
+- DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n"); |
1060 |
+- } |
1061 |
+- /* set the dpm state for PX since there won't be |
1062 |
+- * a modeset to call this. |
1063 |
+- */ |
1064 |
+- radeon_pm_compute_clocks(rdev); |
1065 |
+- } |
1066 |
++ /* do pm late init */ |
1067 |
++ ret = radeon_pm_late_init(rdev); |
1068 |
+ |
1069 |
+ return 0; |
1070 |
+ } |
1071 |
+diff --git a/drivers/gpu/drm/radeon/radeon_dp_mst.c b/drivers/gpu/drm/radeon/radeon_dp_mst.c |
1072 |
+index 257b10be5cda..42986130cc63 100644 |
1073 |
+--- a/drivers/gpu/drm/radeon/radeon_dp_mst.c |
1074 |
++++ b/drivers/gpu/drm/radeon/radeon_dp_mst.c |
1075 |
+@@ -283,6 +283,7 @@ static struct drm_connector *radeon_dp_add_mst_connector(struct drm_dp_mst_topol |
1076 |
+ radeon_connector->mst_encoder = radeon_dp_create_fake_mst_encoder(master); |
1077 |
+ |
1078 |
+ drm_object_attach_property(&connector->base, dev->mode_config.path_property, 0); |
1079 |
++ drm_object_attach_property(&connector->base, dev->mode_config.tile_property, 0); |
1080 |
+ drm_mode_connector_set_path_property(connector, pathprop); |
1081 |
+ drm_reinit_primary_mode_group(dev); |
1082 |
+ |
1083 |
+diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c |
1084 |
+index c1ba83a8dd8c..948c33105801 100644 |
1085 |
+--- a/drivers/gpu/drm/radeon/radeon_pm.c |
1086 |
++++ b/drivers/gpu/drm/radeon/radeon_pm.c |
1087 |
+@@ -1331,14 +1331,6 @@ static int radeon_pm_init_old(struct radeon_device *rdev) |
1088 |
+ INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler); |
1089 |
+ |
1090 |
+ if (rdev->pm.num_power_states > 1) { |
1091 |
+- /* where's the best place to put these? */ |
1092 |
+- ret = device_create_file(rdev->dev, &dev_attr_power_profile); |
1093 |
+- if (ret) |
1094 |
+- DRM_ERROR("failed to create device file for power profile\n"); |
1095 |
+- ret = device_create_file(rdev->dev, &dev_attr_power_method); |
1096 |
+- if (ret) |
1097 |
+- DRM_ERROR("failed to create device file for power method\n"); |
1098 |
+- |
1099 |
+ if (radeon_debugfs_pm_init(rdev)) { |
1100 |
+ DRM_ERROR("Failed to register debugfs file for PM!\n"); |
1101 |
+ } |
1102 |
+@@ -1396,20 +1388,6 @@ static int radeon_pm_init_dpm(struct radeon_device *rdev) |
1103 |
+ goto dpm_failed; |
1104 |
+ rdev->pm.dpm_enabled = true; |
1105 |
+ |
1106 |
+- ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state); |
1107 |
+- if (ret) |
1108 |
+- DRM_ERROR("failed to create device file for dpm state\n"); |
1109 |
+- ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level); |
1110 |
+- if (ret) |
1111 |
+- DRM_ERROR("failed to create device file for dpm state\n"); |
1112 |
+- /* XXX: these are noops for dpm but are here for backwards compat */ |
1113 |
+- ret = device_create_file(rdev->dev, &dev_attr_power_profile); |
1114 |
+- if (ret) |
1115 |
+- DRM_ERROR("failed to create device file for power profile\n"); |
1116 |
+- ret = device_create_file(rdev->dev, &dev_attr_power_method); |
1117 |
+- if (ret) |
1118 |
+- DRM_ERROR("failed to create device file for power method\n"); |
1119 |
+- |
1120 |
+ if (radeon_debugfs_pm_init(rdev)) { |
1121 |
+ DRM_ERROR("Failed to register debugfs file for dpm!\n"); |
1122 |
+ } |
1123 |
+@@ -1550,9 +1528,44 @@ int radeon_pm_late_init(struct radeon_device *rdev) |
1124 |
+ int ret = 0; |
1125 |
+ |
1126 |
+ if (rdev->pm.pm_method == PM_METHOD_DPM) { |
1127 |
+- mutex_lock(&rdev->pm.mutex); |
1128 |
+- ret = radeon_dpm_late_enable(rdev); |
1129 |
+- mutex_unlock(&rdev->pm.mutex); |
1130 |
++ if (rdev->pm.dpm_enabled) { |
1131 |
++ ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state); |
1132 |
++ if (ret) |
1133 |
++ DRM_ERROR("failed to create device file for dpm state\n"); |
1134 |
++ ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level); |
1135 |
++ if (ret) |
1136 |
++ DRM_ERROR("failed to create device file for dpm state\n"); |
1137 |
++ /* XXX: these are noops for dpm but are here for backwards compat */ |
1138 |
++ ret = device_create_file(rdev->dev, &dev_attr_power_profile); |
1139 |
++ if (ret) |
1140 |
++ DRM_ERROR("failed to create device file for power profile\n"); |
1141 |
++ ret = device_create_file(rdev->dev, &dev_attr_power_method); |
1142 |
++ if (ret) |
1143 |
++ DRM_ERROR("failed to create device file for power method\n"); |
1144 |
++ |
1145 |
++ mutex_lock(&rdev->pm.mutex); |
1146 |
++ ret = radeon_dpm_late_enable(rdev); |
1147 |
++ mutex_unlock(&rdev->pm.mutex); |
1148 |
++ if (ret) { |
1149 |
++ rdev->pm.dpm_enabled = false; |
1150 |
++ DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n"); |
1151 |
++ } else { |
1152 |
++ /* set the dpm state for PX since there won't be |
1153 |
++ * a modeset to call this. |
1154 |
++ */ |
1155 |
++ radeon_pm_compute_clocks(rdev); |
1156 |
++ } |
1157 |
++ } |
1158 |
++ } else { |
1159 |
++ if (rdev->pm.num_power_states > 1) { |
1160 |
++ /* where's the best place to put these? */ |
1161 |
++ ret = device_create_file(rdev->dev, &dev_attr_power_profile); |
1162 |
++ if (ret) |
1163 |
++ DRM_ERROR("failed to create device file for power profile\n"); |
1164 |
++ ret = device_create_file(rdev->dev, &dev_attr_power_method); |
1165 |
++ if (ret) |
1166 |
++ DRM_ERROR("failed to create device file for power method\n"); |
1167 |
++ } |
1168 |
+ } |
1169 |
+ return ret; |
1170 |
+ } |
1171 |
+diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c |
1172 |
+index 3dd2de31a2f8..472b88285c75 100644 |
1173 |
+--- a/drivers/i2c/busses/i2c-designware-platdrv.c |
1174 |
++++ b/drivers/i2c/busses/i2c-designware-platdrv.c |
1175 |
+@@ -24,6 +24,7 @@ |
1176 |
+ #include <linux/kernel.h> |
1177 |
+ #include <linux/module.h> |
1178 |
+ #include <linux/delay.h> |
1179 |
++#include <linux/dmi.h> |
1180 |
+ #include <linux/i2c.h> |
1181 |
+ #include <linux/clk.h> |
1182 |
+ #include <linux/clk-provider.h> |
1183 |
+@@ -51,6 +52,22 @@ static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev) |
1184 |
+ } |
1185 |
+ |
1186 |
+ #ifdef CONFIG_ACPI |
1187 |
++/* |
1188 |
++ * The HCNT/LCNT information coming from ACPI should be the most accurate |
1189 |
++ * for given platform. However, some systems get it wrong. On such systems |
1190 |
++ * we get better results by calculating those based on the input clock. |
1191 |
++ */ |
1192 |
++static const struct dmi_system_id dw_i2c_no_acpi_params[] = { |
1193 |
++ { |
1194 |
++ .ident = "Dell Inspiron 7348", |
1195 |
++ .matches = { |
1196 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), |
1197 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7348"), |
1198 |
++ }, |
1199 |
++ }, |
1200 |
++ { } |
1201 |
++}; |
1202 |
++ |
1203 |
+ static void dw_i2c_acpi_params(struct platform_device *pdev, char method[], |
1204 |
+ u16 *hcnt, u16 *lcnt, u32 *sda_hold) |
1205 |
+ { |
1206 |
+@@ -58,6 +75,9 @@ static void dw_i2c_acpi_params(struct platform_device *pdev, char method[], |
1207 |
+ acpi_handle handle = ACPI_HANDLE(&pdev->dev); |
1208 |
+ union acpi_object *obj; |
1209 |
+ |
1210 |
++ if (dmi_check_system(dw_i2c_no_acpi_params)) |
1211 |
++ return; |
1212 |
++ |
1213 |
+ if (ACPI_FAILURE(acpi_evaluate_object(handle, method, NULL, &buf))) |
1214 |
+ return; |
1215 |
+ |
1216 |
+@@ -253,12 +273,6 @@ static int dw_i2c_probe(struct platform_device *pdev) |
1217 |
+ adap->dev.parent = &pdev->dev; |
1218 |
+ adap->dev.of_node = pdev->dev.of_node; |
1219 |
+ |
1220 |
+- r = i2c_add_numbered_adapter(adap); |
1221 |
+- if (r) { |
1222 |
+- dev_err(&pdev->dev, "failure adding adapter\n"); |
1223 |
+- return r; |
1224 |
+- } |
1225 |
+- |
1226 |
+ if (dev->pm_runtime_disabled) { |
1227 |
+ pm_runtime_forbid(&pdev->dev); |
1228 |
+ } else { |
1229 |
+@@ -268,6 +282,13 @@ static int dw_i2c_probe(struct platform_device *pdev) |
1230 |
+ pm_runtime_enable(&pdev->dev); |
1231 |
+ } |
1232 |
+ |
1233 |
++ r = i2c_add_numbered_adapter(adap); |
1234 |
++ if (r) { |
1235 |
++ dev_err(&pdev->dev, "failure adding adapter\n"); |
1236 |
++ pm_runtime_disable(&pdev->dev); |
1237 |
++ return r; |
1238 |
++ } |
1239 |
++ |
1240 |
+ return 0; |
1241 |
+ } |
1242 |
+ |
1243 |
+diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c |
1244 |
+index d8361dada584..d8b5a8fee1e6 100644 |
1245 |
+--- a/drivers/i2c/busses/i2c-rcar.c |
1246 |
++++ b/drivers/i2c/busses/i2c-rcar.c |
1247 |
+@@ -690,15 +690,16 @@ static int rcar_i2c_probe(struct platform_device *pdev) |
1248 |
+ return ret; |
1249 |
+ } |
1250 |
+ |
1251 |
++ pm_runtime_enable(dev); |
1252 |
++ platform_set_drvdata(pdev, priv); |
1253 |
++ |
1254 |
+ ret = i2c_add_numbered_adapter(adap); |
1255 |
+ if (ret < 0) { |
1256 |
+ dev_err(dev, "reg adap failed: %d\n", ret); |
1257 |
++ pm_runtime_disable(dev); |
1258 |
+ return ret; |
1259 |
+ } |
1260 |
+ |
1261 |
+- pm_runtime_enable(dev); |
1262 |
+- platform_set_drvdata(pdev, priv); |
1263 |
+- |
1264 |
+ dev_info(dev, "probed\n"); |
1265 |
+ |
1266 |
+ return 0; |
1267 |
+diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c |
1268 |
+index 50bfd8cef5f2..5df819610d52 100644 |
1269 |
+--- a/drivers/i2c/busses/i2c-s3c2410.c |
1270 |
++++ b/drivers/i2c/busses/i2c-s3c2410.c |
1271 |
+@@ -1243,17 +1243,19 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) |
1272 |
+ i2c->adap.nr = i2c->pdata->bus_num; |
1273 |
+ i2c->adap.dev.of_node = pdev->dev.of_node; |
1274 |
+ |
1275 |
++ platform_set_drvdata(pdev, i2c); |
1276 |
++ |
1277 |
++ pm_runtime_enable(&pdev->dev); |
1278 |
++ |
1279 |
+ ret = i2c_add_numbered_adapter(&i2c->adap); |
1280 |
+ if (ret < 0) { |
1281 |
+ dev_err(&pdev->dev, "failed to add bus to i2c core\n"); |
1282 |
++ pm_runtime_disable(&pdev->dev); |
1283 |
+ s3c24xx_i2c_deregister_cpufreq(i2c); |
1284 |
+ clk_unprepare(i2c->clk); |
1285 |
+ return ret; |
1286 |
+ } |
1287 |
+ |
1288 |
+- platform_set_drvdata(pdev, i2c); |
1289 |
+- |
1290 |
+- pm_runtime_enable(&pdev->dev); |
1291 |
+ pm_runtime_enable(&i2c->adap.dev); |
1292 |
+ |
1293 |
+ dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev)); |
1294 |
+diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c |
1295 |
+index 75aef240c2d1..493c38e08bd2 100644 |
1296 |
+--- a/drivers/md/dm-thin.c |
1297 |
++++ b/drivers/md/dm-thin.c |
1298 |
+@@ -3255,7 +3255,7 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) |
1299 |
+ metadata_low_callback, |
1300 |
+ pool); |
1301 |
+ if (r) |
1302 |
+- goto out_free_pt; |
1303 |
++ goto out_flags_changed; |
1304 |
+ |
1305 |
+ pt->callbacks.congested_fn = pool_is_congested; |
1306 |
+ dm_table_add_target_callbacks(ti->table, &pt->callbacks); |
1307 |
+diff --git a/drivers/mfd/max77843.c b/drivers/mfd/max77843.c |
1308 |
+index a354ac677ec7..1074a0d68680 100644 |
1309 |
+--- a/drivers/mfd/max77843.c |
1310 |
++++ b/drivers/mfd/max77843.c |
1311 |
+@@ -79,7 +79,7 @@ static int max77843_chg_init(struct max77843 *max77843) |
1312 |
+ if (!max77843->i2c_chg) { |
1313 |
+ dev_err(&max77843->i2c->dev, |
1314 |
+ "Cannot allocate I2C device for Charger\n"); |
1315 |
+- return PTR_ERR(max77843->i2c_chg); |
1316 |
++ return -ENODEV; |
1317 |
+ } |
1318 |
+ i2c_set_clientdata(max77843->i2c_chg, max77843); |
1319 |
+ |
1320 |
+diff --git a/drivers/net/ethernet/ibm/emac/core.h b/drivers/net/ethernet/ibm/emac/core.h |
1321 |
+index 28df37420da9..ac02c675c59c 100644 |
1322 |
+--- a/drivers/net/ethernet/ibm/emac/core.h |
1323 |
++++ b/drivers/net/ethernet/ibm/emac/core.h |
1324 |
+@@ -460,8 +460,8 @@ struct emac_ethtool_regs_subhdr { |
1325 |
+ u32 index; |
1326 |
+ }; |
1327 |
+ |
1328 |
+-#define EMAC_ETHTOOL_REGS_VER 0 |
1329 |
+-#define EMAC4_ETHTOOL_REGS_VER 1 |
1330 |
+-#define EMAC4SYNC_ETHTOOL_REGS_VER 2 |
1331 |
++#define EMAC_ETHTOOL_REGS_VER 3 |
1332 |
++#define EMAC4_ETHTOOL_REGS_VER 4 |
1333 |
++#define EMAC4SYNC_ETHTOOL_REGS_VER 5 |
1334 |
+ |
1335 |
+ #endif /* __IBM_NEWEMAC_CORE_H */ |
1336 |
+diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c |
1337 |
+index 3837ae344f63..2ed75060da50 100644 |
1338 |
+--- a/drivers/net/ppp/pppoe.c |
1339 |
++++ b/drivers/net/ppp/pppoe.c |
1340 |
+@@ -313,7 +313,6 @@ static void pppoe_flush_dev(struct net_device *dev) |
1341 |
+ if (po->pppoe_dev == dev && |
1342 |
+ sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { |
1343 |
+ pppox_unbind_sock(sk); |
1344 |
+- sk->sk_state = PPPOX_ZOMBIE; |
1345 |
+ sk->sk_state_change(sk); |
1346 |
+ po->pppoe_dev = NULL; |
1347 |
+ dev_put(dev); |
1348 |
+diff --git a/drivers/pinctrl/freescale/pinctrl-imx25.c b/drivers/pinctrl/freescale/pinctrl-imx25.c |
1349 |
+index faf635654312..293ed4381cc0 100644 |
1350 |
+--- a/drivers/pinctrl/freescale/pinctrl-imx25.c |
1351 |
++++ b/drivers/pinctrl/freescale/pinctrl-imx25.c |
1352 |
+@@ -26,7 +26,8 @@ |
1353 |
+ #include "pinctrl-imx.h" |
1354 |
+ |
1355 |
+ enum imx25_pads { |
1356 |
+- MX25_PAD_RESERVE0 = 1, |
1357 |
++ MX25_PAD_RESERVE0 = 0, |
1358 |
++ MX25_PAD_RESERVE1 = 1, |
1359 |
+ MX25_PAD_A10 = 2, |
1360 |
+ MX25_PAD_A13 = 3, |
1361 |
+ MX25_PAD_A14 = 4, |
1362 |
+@@ -169,6 +170,7 @@ enum imx25_pads { |
1363 |
+ /* Pad names for the pinmux subsystem */ |
1364 |
+ static const struct pinctrl_pin_desc imx25_pinctrl_pads[] = { |
1365 |
+ IMX_PINCTRL_PIN(MX25_PAD_RESERVE0), |
1366 |
++ IMX_PINCTRL_PIN(MX25_PAD_RESERVE1), |
1367 |
+ IMX_PINCTRL_PIN(MX25_PAD_A10), |
1368 |
+ IMX_PINCTRL_PIN(MX25_PAD_A13), |
1369 |
+ IMX_PINCTRL_PIN(MX25_PAD_A14), |
1370 |
+diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c |
1371 |
+index 802fabb30e15..34cbe3505dac 100644 |
1372 |
+--- a/fs/btrfs/backref.c |
1373 |
++++ b/fs/btrfs/backref.c |
1374 |
+@@ -1809,7 +1809,6 @@ static int iterate_inode_extrefs(u64 inum, struct btrfs_root *fs_root, |
1375 |
+ int found = 0; |
1376 |
+ struct extent_buffer *eb; |
1377 |
+ struct btrfs_inode_extref *extref; |
1378 |
+- struct extent_buffer *leaf; |
1379 |
+ u32 item_size; |
1380 |
+ u32 cur_offset; |
1381 |
+ unsigned long ptr; |
1382 |
+@@ -1837,9 +1836,8 @@ static int iterate_inode_extrefs(u64 inum, struct btrfs_root *fs_root, |
1383 |
+ btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); |
1384 |
+ btrfs_release_path(path); |
1385 |
+ |
1386 |
+- leaf = path->nodes[0]; |
1387 |
+- item_size = btrfs_item_size_nr(leaf, slot); |
1388 |
+- ptr = btrfs_item_ptr_offset(leaf, slot); |
1389 |
++ item_size = btrfs_item_size_nr(eb, slot); |
1390 |
++ ptr = btrfs_item_ptr_offset(eb, slot); |
1391 |
+ cur_offset = 0; |
1392 |
+ |
1393 |
+ while (cur_offset < item_size) { |
1394 |
+@@ -1853,7 +1851,7 @@ static int iterate_inode_extrefs(u64 inum, struct btrfs_root *fs_root, |
1395 |
+ if (ret) |
1396 |
+ break; |
1397 |
+ |
1398 |
+- cur_offset += btrfs_inode_extref_name_len(leaf, extref); |
1399 |
++ cur_offset += btrfs_inode_extref_name_len(eb, extref); |
1400 |
+ cur_offset += sizeof(*extref); |
1401 |
+ } |
1402 |
+ btrfs_tree_read_unlock_blocking(eb); |
1403 |
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c |
1404 |
+index 0770c91586ca..f490b6155091 100644 |
1405 |
+--- a/fs/btrfs/ioctl.c |
1406 |
++++ b/fs/btrfs/ioctl.c |
1407 |
+@@ -4647,6 +4647,11 @@ locked: |
1408 |
+ bctl->flags |= BTRFS_BALANCE_TYPE_MASK; |
1409 |
+ } |
1410 |
+ |
1411 |
++ if (bctl->flags & ~(BTRFS_BALANCE_ARGS_MASK | BTRFS_BALANCE_TYPE_MASK)) { |
1412 |
++ ret = -EINVAL; |
1413 |
++ goto out_bargs; |
1414 |
++ } |
1415 |
++ |
1416 |
+ do_balance: |
1417 |
+ /* |
1418 |
+ * Ownership of bctl and mutually_exclusive_operation_running |
1419 |
+diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h |
1420 |
+index 95842a909e7f..2ac5f8cd701a 100644 |
1421 |
+--- a/fs/btrfs/volumes.h |
1422 |
++++ b/fs/btrfs/volumes.h |
1423 |
+@@ -376,6 +376,14 @@ struct map_lookup { |
1424 |
+ #define BTRFS_BALANCE_ARGS_VRANGE (1ULL << 4) |
1425 |
+ #define BTRFS_BALANCE_ARGS_LIMIT (1ULL << 5) |
1426 |
+ |
1427 |
++#define BTRFS_BALANCE_ARGS_MASK \ |
1428 |
++ (BTRFS_BALANCE_ARGS_PROFILES | \ |
1429 |
++ BTRFS_BALANCE_ARGS_USAGE | \ |
1430 |
++ BTRFS_BALANCE_ARGS_DEVID | \ |
1431 |
++ BTRFS_BALANCE_ARGS_DRANGE | \ |
1432 |
++ BTRFS_BALANCE_ARGS_VRANGE | \ |
1433 |
++ BTRFS_BALANCE_ARGS_LIMIT) |
1434 |
++ |
1435 |
+ /* |
1436 |
+ * Profile changing flags. When SOFT is set we won't relocate chunk if |
1437 |
+ * it already has the target profile (even though it may be |
1438 |
+diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c |
1439 |
+index cdefaa331a07..c29d9421bd5e 100644 |
1440 |
+--- a/fs/nfsd/blocklayout.c |
1441 |
++++ b/fs/nfsd/blocklayout.c |
1442 |
+@@ -56,14 +56,6 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp, |
1443 |
+ u32 device_generation = 0; |
1444 |
+ int error; |
1445 |
+ |
1446 |
+- /* |
1447 |
+- * We do not attempt to support I/O smaller than the fs block size, |
1448 |
+- * or not aligned to it. |
1449 |
+- */ |
1450 |
+- if (args->lg_minlength < block_size) { |
1451 |
+- dprintk("pnfsd: I/O too small\n"); |
1452 |
+- goto out_layoutunavailable; |
1453 |
+- } |
1454 |
+ if (seg->offset & (block_size - 1)) { |
1455 |
+ dprintk("pnfsd: I/O misaligned\n"); |
1456 |
+ goto out_layoutunavailable; |
1457 |
+diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h |
1458 |
+index 86d0b25ed054..a89f505c856b 100644 |
1459 |
+--- a/include/drm/drm_dp_mst_helper.h |
1460 |
++++ b/include/drm/drm_dp_mst_helper.h |
1461 |
+@@ -253,6 +253,7 @@ struct drm_dp_remote_dpcd_write { |
1462 |
+ u8 *bytes; |
1463 |
+ }; |
1464 |
+ |
1465 |
++#define DP_REMOTE_I2C_READ_MAX_TRANSACTIONS 4 |
1466 |
+ struct drm_dp_remote_i2c_read { |
1467 |
+ u8 num_transactions; |
1468 |
+ u8 port_number; |
1469 |
+@@ -262,7 +263,7 @@ struct drm_dp_remote_i2c_read { |
1470 |
+ u8 *bytes; |
1471 |
+ u8 no_stop_bit; |
1472 |
+ u8 i2c_transaction_delay; |
1473 |
+- } transactions[4]; |
1474 |
++ } transactions[DP_REMOTE_I2C_READ_MAX_TRANSACTIONS]; |
1475 |
+ u8 read_i2c_device_id; |
1476 |
+ u8 num_bytes_read; |
1477 |
+ }; |
1478 |
+diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h |
1479 |
+index 9b88536487e6..275158803824 100644 |
1480 |
+--- a/include/linux/skbuff.h |
1481 |
++++ b/include/linux/skbuff.h |
1482 |
+@@ -2601,6 +2601,9 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb, |
1483 |
+ { |
1484 |
+ if (skb->ip_summed == CHECKSUM_COMPLETE) |
1485 |
+ skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); |
1486 |
++ else if (skb->ip_summed == CHECKSUM_PARTIAL && |
1487 |
++ skb_checksum_start_offset(skb) < 0) |
1488 |
++ skb->ip_summed = CHECKSUM_NONE; |
1489 |
+ } |
1490 |
+ |
1491 |
+ unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len); |
1492 |
+diff --git a/include/net/af_unix.h b/include/net/af_unix.h |
1493 |
+index 4a167b30a12f..cb1b9bbda332 100644 |
1494 |
+--- a/include/net/af_unix.h |
1495 |
++++ b/include/net/af_unix.h |
1496 |
+@@ -63,7 +63,11 @@ struct unix_sock { |
1497 |
+ #define UNIX_GC_MAYBE_CYCLE 1 |
1498 |
+ struct socket_wq peer_wq; |
1499 |
+ }; |
1500 |
+-#define unix_sk(__sk) ((struct unix_sock *)__sk) |
1501 |
++ |
1502 |
++static inline struct unix_sock *unix_sk(struct sock *sk) |
1503 |
++{ |
1504 |
++ return (struct unix_sock *)sk; |
1505 |
++} |
1506 |
+ |
1507 |
+ #define peer_wait peer_wq.wait |
1508 |
+ |
1509 |
+diff --git a/include/net/sock.h b/include/net/sock.h |
1510 |
+index f21f0708ec59..4ca4c3fe446f 100644 |
1511 |
+--- a/include/net/sock.h |
1512 |
++++ b/include/net/sock.h |
1513 |
+@@ -826,6 +826,14 @@ static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *s |
1514 |
+ if (sk_rcvqueues_full(sk, limit)) |
1515 |
+ return -ENOBUFS; |
1516 |
+ |
1517 |
++ /* |
1518 |
++ * If the skb was allocated from pfmemalloc reserves, only |
1519 |
++ * allow SOCK_MEMALLOC sockets to use it as this socket is |
1520 |
++ * helping free memory |
1521 |
++ */ |
1522 |
++ if (skb_pfmemalloc(skb) && !sock_flag(sk, SOCK_MEMALLOC)) |
1523 |
++ return -ENOMEM; |
1524 |
++ |
1525 |
+ __sk_add_backlog(sk, skb); |
1526 |
+ sk->sk_backlog.len += skb->truesize; |
1527 |
+ return 0; |
1528 |
+diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c |
1529 |
+index a20d4110e871..3688f1e07ebd 100644 |
1530 |
+--- a/kernel/time/timekeeping.c |
1531 |
++++ b/kernel/time/timekeeping.c |
1532 |
+@@ -1244,7 +1244,7 @@ void __init timekeeping_init(void) |
1533 |
+ set_normalized_timespec64(&tmp, -boot.tv_sec, -boot.tv_nsec); |
1534 |
+ tk_set_wall_to_mono(tk, tmp); |
1535 |
+ |
1536 |
+- timekeeping_update(tk, TK_MIRROR); |
1537 |
++ timekeeping_update(tk, TK_MIRROR | TK_CLOCK_WAS_SET); |
1538 |
+ |
1539 |
+ write_seqcount_end(&tk_core.seq); |
1540 |
+ raw_spin_unlock_irqrestore(&timekeeper_lock, flags); |
1541 |
+diff --git a/kernel/workqueue.c b/kernel/workqueue.c |
1542 |
+index a413acb59a07..1de0f5fabb98 100644 |
1543 |
+--- a/kernel/workqueue.c |
1544 |
++++ b/kernel/workqueue.c |
1545 |
+@@ -1458,13 +1458,13 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq, |
1546 |
+ timer_stats_timer_set_start_info(&dwork->timer); |
1547 |
+ |
1548 |
+ dwork->wq = wq; |
1549 |
++ /* timer isn't guaranteed to run in this cpu, record earlier */ |
1550 |
++ if (cpu == WORK_CPU_UNBOUND) |
1551 |
++ cpu = raw_smp_processor_id(); |
1552 |
+ dwork->cpu = cpu; |
1553 |
+ timer->expires = jiffies + delay; |
1554 |
+ |
1555 |
+- if (unlikely(cpu != WORK_CPU_UNBOUND)) |
1556 |
+- add_timer_on(timer, cpu); |
1557 |
+- else |
1558 |
+- add_timer(timer); |
1559 |
++ add_timer_on(timer, cpu); |
1560 |
+ } |
1561 |
+ |
1562 |
+ /** |
1563 |
+diff --git a/mm/memcontrol.c b/mm/memcontrol.c |
1564 |
+index 237d4686482d..03a6f7506cf3 100644 |
1565 |
+--- a/mm/memcontrol.c |
1566 |
++++ b/mm/memcontrol.c |
1567 |
+@@ -3687,6 +3687,7 @@ static int __mem_cgroup_usage_register_event(struct mem_cgroup *memcg, |
1568 |
+ ret = page_counter_memparse(args, "-1", &threshold); |
1569 |
+ if (ret) |
1570 |
+ return ret; |
1571 |
++ threshold <<= PAGE_SHIFT; |
1572 |
+ |
1573 |
+ mutex_lock(&memcg->thresholds_lock); |
1574 |
+ |
1575 |
+diff --git a/net/core/ethtool.c b/net/core/ethtool.c |
1576 |
+index b495ab1797fa..29edf74846fc 100644 |
1577 |
+--- a/net/core/ethtool.c |
1578 |
++++ b/net/core/ethtool.c |
1579 |
+@@ -1284,7 +1284,7 @@ static int ethtool_get_strings(struct net_device *dev, void __user *useraddr) |
1580 |
+ |
1581 |
+ gstrings.len = ret; |
1582 |
+ |
1583 |
+- data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER); |
1584 |
++ data = kcalloc(gstrings.len, ETH_GSTRING_LEN, GFP_USER); |
1585 |
+ if (!data) |
1586 |
+ return -ENOMEM; |
1587 |
+ |
1588 |
+diff --git a/net/core/filter.c b/net/core/filter.c |
1589 |
+index be3098fb65e4..8dcdd86b68dd 100644 |
1590 |
+--- a/net/core/filter.c |
1591 |
++++ b/net/core/filter.c |
1592 |
+@@ -1412,6 +1412,7 @@ static u64 bpf_clone_redirect(u64 r1, u64 ifindex, u64 flags, u64 r4, u64 r5) |
1593 |
+ return dev_forward_skb(dev, skb2); |
1594 |
+ |
1595 |
+ skb2->dev = dev; |
1596 |
++ skb_sender_cpu_clear(skb2); |
1597 |
+ return dev_queue_xmit(skb2); |
1598 |
+ } |
1599 |
+ |
1600 |
+@@ -1701,9 +1702,13 @@ int sk_get_filter(struct sock *sk, struct sock_filter __user *ubuf, |
1601 |
+ goto out; |
1602 |
+ |
1603 |
+ /* We're copying the filter that has been originally attached, |
1604 |
+- * so no conversion/decode needed anymore. |
1605 |
++ * so no conversion/decode needed anymore. eBPF programs that |
1606 |
++ * have no original program cannot be dumped through this. |
1607 |
+ */ |
1608 |
++ ret = -EACCES; |
1609 |
+ fprog = filter->prog->orig_prog; |
1610 |
++ if (!fprog) |
1611 |
++ goto out; |
1612 |
+ |
1613 |
+ ret = fprog->len; |
1614 |
+ if (!len) |
1615 |
+diff --git a/net/core/skbuff.c b/net/core/skbuff.c |
1616 |
+index 7b84330e5d30..7bfa18746681 100644 |
1617 |
+--- a/net/core/skbuff.c |
1618 |
++++ b/net/core/skbuff.c |
1619 |
+@@ -2958,11 +2958,12 @@ EXPORT_SYMBOL_GPL(skb_append_pagefrags); |
1620 |
+ */ |
1621 |
+ unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len) |
1622 |
+ { |
1623 |
++ unsigned char *data = skb->data; |
1624 |
++ |
1625 |
+ BUG_ON(len > skb->len); |
1626 |
+- skb->len -= len; |
1627 |
+- BUG_ON(skb->len < skb->data_len); |
1628 |
+- skb_postpull_rcsum(skb, skb->data, len); |
1629 |
+- return skb->data += len; |
1630 |
++ __skb_pull(skb, len); |
1631 |
++ skb_postpull_rcsum(skb, data, len); |
1632 |
++ return skb->data; |
1633 |
+ } |
1634 |
+ EXPORT_SYMBOL_GPL(skb_pull_rcsum); |
1635 |
+ |
1636 |
+diff --git a/net/dsa/slave.c b/net/dsa/slave.c |
1637 |
+index 35c47ddd04f0..25dbb91e1bc0 100644 |
1638 |
+--- a/net/dsa/slave.c |
1639 |
++++ b/net/dsa/slave.c |
1640 |
+@@ -348,12 +348,17 @@ static int dsa_slave_stp_update(struct net_device *dev, u8 state) |
1641 |
+ static int dsa_slave_port_attr_set(struct net_device *dev, |
1642 |
+ struct switchdev_attr *attr) |
1643 |
+ { |
1644 |
+- int ret = 0; |
1645 |
++ struct dsa_slave_priv *p = netdev_priv(dev); |
1646 |
++ struct dsa_switch *ds = p->parent; |
1647 |
++ int ret; |
1648 |
+ |
1649 |
+ switch (attr->id) { |
1650 |
+ case SWITCHDEV_ATTR_PORT_STP_STATE: |
1651 |
+- if (attr->trans == SWITCHDEV_TRANS_COMMIT) |
1652 |
+- ret = dsa_slave_stp_update(dev, attr->u.stp_state); |
1653 |
++ if (attr->trans == SWITCHDEV_TRANS_PREPARE) |
1654 |
++ ret = ds->drv->port_stp_update ? 0 : -EOPNOTSUPP; |
1655 |
++ else |
1656 |
++ ret = ds->drv->port_stp_update(ds, p->port, |
1657 |
++ attr->u.stp_state); |
1658 |
+ break; |
1659 |
+ default: |
1660 |
+ ret = -EOPNOTSUPP; |
1661 |
+diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c |
1662 |
+index 134957159c27..61b45a17fc73 100644 |
1663 |
+--- a/net/ipv4/inet_connection_sock.c |
1664 |
++++ b/net/ipv4/inet_connection_sock.c |
1665 |
+@@ -577,21 +577,22 @@ EXPORT_SYMBOL(inet_rtx_syn_ack); |
1666 |
+ static bool reqsk_queue_unlink(struct request_sock_queue *queue, |
1667 |
+ struct request_sock *req) |
1668 |
+ { |
1669 |
+- struct listen_sock *lopt = queue->listen_opt; |
1670 |
+ struct request_sock **prev; |
1671 |
++ struct listen_sock *lopt; |
1672 |
+ bool found = false; |
1673 |
+ |
1674 |
+ spin_lock(&queue->syn_wait_lock); |
1675 |
+- |
1676 |
+- for (prev = &lopt->syn_table[req->rsk_hash]; *prev != NULL; |
1677 |
+- prev = &(*prev)->dl_next) { |
1678 |
+- if (*prev == req) { |
1679 |
+- *prev = req->dl_next; |
1680 |
+- found = true; |
1681 |
+- break; |
1682 |
++ lopt = queue->listen_opt; |
1683 |
++ if (lopt) { |
1684 |
++ for (prev = &lopt->syn_table[req->rsk_hash]; *prev != NULL; |
1685 |
++ prev = &(*prev)->dl_next) { |
1686 |
++ if (*prev == req) { |
1687 |
++ *prev = req->dl_next; |
1688 |
++ found = true; |
1689 |
++ break; |
1690 |
++ } |
1691 |
+ } |
1692 |
+ } |
1693 |
+- |
1694 |
+ spin_unlock(&queue->syn_wait_lock); |
1695 |
+ if (timer_pending(&req->rsk_timer) && del_timer_sync(&req->rsk_timer)) |
1696 |
+ reqsk_put(req); |
1697 |
+@@ -685,20 +686,20 @@ void reqsk_queue_hash_req(struct request_sock_queue *queue, |
1698 |
+ req->num_timeout = 0; |
1699 |
+ req->sk = NULL; |
1700 |
+ |
1701 |
++ setup_timer(&req->rsk_timer, reqsk_timer_handler, (unsigned long)req); |
1702 |
++ mod_timer_pinned(&req->rsk_timer, jiffies + timeout); |
1703 |
++ req->rsk_hash = hash; |
1704 |
++ |
1705 |
+ /* before letting lookups find us, make sure all req fields |
1706 |
+ * are committed to memory and refcnt initialized. |
1707 |
+ */ |
1708 |
+ smp_wmb(); |
1709 |
+ atomic_set(&req->rsk_refcnt, 2); |
1710 |
+- setup_timer(&req->rsk_timer, reqsk_timer_handler, (unsigned long)req); |
1711 |
+- req->rsk_hash = hash; |
1712 |
+ |
1713 |
+ spin_lock(&queue->syn_wait_lock); |
1714 |
+ req->dl_next = lopt->syn_table[hash]; |
1715 |
+ lopt->syn_table[hash] = req; |
1716 |
+ spin_unlock(&queue->syn_wait_lock); |
1717 |
+- |
1718 |
+- mod_timer_pinned(&req->rsk_timer, jiffies + timeout); |
1719 |
+ } |
1720 |
+ EXPORT_SYMBOL(reqsk_queue_hash_req); |
1721 |
+ |
1722 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
1723 |
+index 00b64d402a57..dd6ebba5846c 100644 |
1724 |
+--- a/net/ipv6/route.c |
1725 |
++++ b/net/ipv6/route.c |
1726 |
+@@ -139,6 +139,9 @@ static void rt6_uncached_list_flush_dev(struct net *net, struct net_device *dev) |
1727 |
+ struct net_device *loopback_dev = net->loopback_dev; |
1728 |
+ int cpu; |
1729 |
+ |
1730 |
++ if (dev == loopback_dev) |
1731 |
++ return; |
1732 |
++ |
1733 |
+ for_each_possible_cpu(cpu) { |
1734 |
+ struct uncached_list *ul = per_cpu_ptr(&rt6_uncached_list, cpu); |
1735 |
+ struct rt6_info *rt; |
1736 |
+@@ -148,14 +151,12 @@ static void rt6_uncached_list_flush_dev(struct net *net, struct net_device *dev) |
1737 |
+ struct inet6_dev *rt_idev = rt->rt6i_idev; |
1738 |
+ struct net_device *rt_dev = rt->dst.dev; |
1739 |
+ |
1740 |
+- if (rt_idev && (rt_idev->dev == dev || !dev) && |
1741 |
+- rt_idev->dev != loopback_dev) { |
1742 |
++ if (rt_idev->dev == dev) { |
1743 |
+ rt->rt6i_idev = in6_dev_get(loopback_dev); |
1744 |
+ in6_dev_put(rt_idev); |
1745 |
+ } |
1746 |
+ |
1747 |
+- if (rt_dev && (rt_dev == dev || !dev) && |
1748 |
+- rt_dev != loopback_dev) { |
1749 |
++ if (rt_dev == dev) { |
1750 |
+ rt->dst.dev = loopback_dev; |
1751 |
+ dev_hold(rt->dst.dev); |
1752 |
+ dev_put(rt_dev); |
1753 |
+@@ -2577,7 +2578,8 @@ void rt6_ifdown(struct net *net, struct net_device *dev) |
1754 |
+ |
1755 |
+ fib6_clean_all(net, fib6_ifdown, &adn); |
1756 |
+ icmp6_clean_all(fib6_ifdown, &adn); |
1757 |
+- rt6_uncached_list_flush_dev(net, dev); |
1758 |
++ if (dev) |
1759 |
++ rt6_uncached_list_flush_dev(net, dev); |
1760 |
+ } |
1761 |
+ |
1762 |
+ struct rt6_mtu_change_arg { |
1763 |
+diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c |
1764 |
+index f6b090df3930..afca2eb4dfa7 100644 |
1765 |
+--- a/net/l2tp/l2tp_core.c |
1766 |
++++ b/net/l2tp/l2tp_core.c |
1767 |
+@@ -1319,7 +1319,7 @@ static void l2tp_tunnel_del_work(struct work_struct *work) |
1768 |
+ tunnel = container_of(work, struct l2tp_tunnel, del_work); |
1769 |
+ sk = l2tp_tunnel_sock_lookup(tunnel); |
1770 |
+ if (!sk) |
1771 |
+- return; |
1772 |
++ goto out; |
1773 |
+ |
1774 |
+ sock = sk->sk_socket; |
1775 |
+ |
1776 |
+@@ -1341,6 +1341,8 @@ static void l2tp_tunnel_del_work(struct work_struct *work) |
1777 |
+ } |
1778 |
+ |
1779 |
+ l2tp_tunnel_sock_put(sk); |
1780 |
++out: |
1781 |
++ l2tp_tunnel_dec_refcount(tunnel); |
1782 |
+ } |
1783 |
+ |
1784 |
+ /* Create a socket for the tunnel, if one isn't set up by |
1785 |
+@@ -1636,8 +1638,13 @@ EXPORT_SYMBOL_GPL(l2tp_tunnel_create); |
1786 |
+ */ |
1787 |
+ int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel) |
1788 |
+ { |
1789 |
++ l2tp_tunnel_inc_refcount(tunnel); |
1790 |
+ l2tp_tunnel_closeall(tunnel); |
1791 |
+- return (false == queue_work(l2tp_wq, &tunnel->del_work)); |
1792 |
++ if (false == queue_work(l2tp_wq, &tunnel->del_work)) { |
1793 |
++ l2tp_tunnel_dec_refcount(tunnel); |
1794 |
++ return 1; |
1795 |
++ } |
1796 |
++ return 0; |
1797 |
+ } |
1798 |
+ EXPORT_SYMBOL_GPL(l2tp_tunnel_delete); |
1799 |
+ |
1800 |
+diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c |
1801 |
+index 0857f7243797..a133d16eb053 100644 |
1802 |
+--- a/net/netlink/af_netlink.c |
1803 |
++++ b/net/netlink/af_netlink.c |
1804 |
+@@ -2750,6 +2750,7 @@ static int netlink_dump(struct sock *sk) |
1805 |
+ struct sk_buff *skb = NULL; |
1806 |
+ struct nlmsghdr *nlh; |
1807 |
+ int len, err = -ENOBUFS; |
1808 |
++ int alloc_min_size; |
1809 |
+ int alloc_size; |
1810 |
+ |
1811 |
+ mutex_lock(nlk->cb_mutex); |
1812 |
+@@ -2758,9 +2759,6 @@ static int netlink_dump(struct sock *sk) |
1813 |
+ goto errout_skb; |
1814 |
+ } |
1815 |
+ |
1816 |
+- cb = &nlk->cb; |
1817 |
+- alloc_size = max_t(int, cb->min_dump_alloc, NLMSG_GOODSIZE); |
1818 |
+- |
1819 |
+ if (!netlink_rx_is_mmaped(sk) && |
1820 |
+ atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf) |
1821 |
+ goto errout_skb; |
1822 |
+@@ -2770,23 +2768,35 @@ static int netlink_dump(struct sock *sk) |
1823 |
+ * to reduce number of system calls on dump operations, if user |
1824 |
+ * ever provided a big enough buffer. |
1825 |
+ */ |
1826 |
+- if (alloc_size < nlk->max_recvmsg_len) { |
1827 |
+- skb = netlink_alloc_skb(sk, |
1828 |
+- nlk->max_recvmsg_len, |
1829 |
+- nlk->portid, |
1830 |
++ cb = &nlk->cb; |
1831 |
++ alloc_min_size = max_t(int, cb->min_dump_alloc, NLMSG_GOODSIZE); |
1832 |
++ |
1833 |
++ if (alloc_min_size < nlk->max_recvmsg_len) { |
1834 |
++ alloc_size = nlk->max_recvmsg_len; |
1835 |
++ skb = netlink_alloc_skb(sk, alloc_size, nlk->portid, |
1836 |
+ GFP_KERNEL | |
1837 |
+ __GFP_NOWARN | |
1838 |
+ __GFP_NORETRY); |
1839 |
+- /* available room should be exact amount to avoid MSG_TRUNC */ |
1840 |
+- if (skb) |
1841 |
+- skb_reserve(skb, skb_tailroom(skb) - |
1842 |
+- nlk->max_recvmsg_len); |
1843 |
+ } |
1844 |
+- if (!skb) |
1845 |
++ if (!skb) { |
1846 |
++ alloc_size = alloc_min_size; |
1847 |
+ skb = netlink_alloc_skb(sk, alloc_size, nlk->portid, |
1848 |
+ GFP_KERNEL); |
1849 |
++ } |
1850 |
+ if (!skb) |
1851 |
+ goto errout_skb; |
1852 |
++ |
1853 |
++ /* Trim skb to allocated size. User is expected to provide buffer as |
1854 |
++ * large as max(min_dump_alloc, 16KiB (mac_recvmsg_len capped at |
1855 |
++ * netlink_recvmsg())). dump will pack as many smaller messages as |
1856 |
++ * could fit within the allocated skb. skb is typically allocated |
1857 |
++ * with larger space than required (could be as much as near 2x the |
1858 |
++ * requested size with align to next power of 2 approach). Allowing |
1859 |
++ * dump to use the excess space makes it difficult for a user to have a |
1860 |
++ * reasonable static buffer based on the expected largest dump of a |
1861 |
++ * single netdev. The outcome is MSG_TRUNC error. |
1862 |
++ */ |
1863 |
++ skb_reserve(skb, skb_tailroom(skb) - alloc_size); |
1864 |
+ netlink_skb_set_owner_r(skb, sk); |
1865 |
+ |
1866 |
+ len = cb->dump(skb, cb); |
1867 |
+diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c |
1868 |
+index b5c3bba87fc8..af08e6fc9860 100644 |
1869 |
+--- a/net/openvswitch/flow_table.c |
1870 |
++++ b/net/openvswitch/flow_table.c |
1871 |
+@@ -92,7 +92,8 @@ struct sw_flow *ovs_flow_alloc(void) |
1872 |
+ |
1873 |
+ /* Initialize the default stat node. */ |
1874 |
+ stats = kmem_cache_alloc_node(flow_stats_cache, |
1875 |
+- GFP_KERNEL | __GFP_ZERO, 0); |
1876 |
++ GFP_KERNEL | __GFP_ZERO, |
1877 |
++ node_online(0) ? 0 : NUMA_NO_NODE); |
1878 |
+ if (!stats) |
1879 |
+ goto err; |
1880 |
+ |
1881 |
+diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c |
1882 |
+index 268545050ddb..b1768198ad59 100644 |
1883 |
+--- a/net/sched/act_mirred.c |
1884 |
++++ b/net/sched/act_mirred.c |
1885 |
+@@ -168,6 +168,7 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a, |
1886 |
+ |
1887 |
+ skb2->skb_iif = skb->dev->ifindex; |
1888 |
+ skb2->dev = dev; |
1889 |
++ skb_sender_cpu_clear(skb2); |
1890 |
+ err = dev_queue_xmit(skb2); |
1891 |
+ |
1892 |
+ out: |
1893 |
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c |
1894 |
+index 2e1348bde325..96d886a866e9 100644 |
1895 |
+--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c |
1896 |
++++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c |
1897 |
+@@ -146,7 +146,8 @@ int rdma_read_chunk_lcl(struct svcxprt_rdma *xprt, |
1898 |
+ ctxt->read_hdr = head; |
1899 |
+ pages_needed = |
1900 |
+ min_t(int, pages_needed, rdma_read_max_sge(xprt, pages_needed)); |
1901 |
+- read = min_t(int, pages_needed << PAGE_SHIFT, rs_length); |
1902 |
++ read = min_t(int, (pages_needed << PAGE_SHIFT) - *page_offset, |
1903 |
++ rs_length); |
1904 |
+ |
1905 |
+ for (pno = 0; pno < pages_needed; pno++) { |
1906 |
+ int len = min_t(int, rs_length, PAGE_SIZE - pg_off); |
1907 |
+@@ -245,7 +246,8 @@ int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt, |
1908 |
+ ctxt->direction = DMA_FROM_DEVICE; |
1909 |
+ ctxt->frmr = frmr; |
1910 |
+ pages_needed = min_t(int, pages_needed, xprt->sc_frmr_pg_list_len); |
1911 |
+- read = min_t(int, pages_needed << PAGE_SHIFT, rs_length); |
1912 |
++ read = min_t(int, (pages_needed << PAGE_SHIFT) - *page_offset, |
1913 |
++ rs_length); |
1914 |
+ |
1915 |
+ frmr->kva = page_address(rqstp->rq_arg.pages[pg_no]); |
1916 |
+ frmr->direction = DMA_FROM_DEVICE; |
1917 |
+diff --git a/net/tipc/msg.h b/net/tipc/msg.h |
1918 |
+index 19c45fb66238..49f9a9648aa9 100644 |
1919 |
+--- a/net/tipc/msg.h |
1920 |
++++ b/net/tipc/msg.h |
1921 |
+@@ -357,7 +357,7 @@ static inline u32 msg_importance(struct tipc_msg *m) |
1922 |
+ if (likely((usr <= TIPC_CRITICAL_IMPORTANCE) && !msg_errcode(m))) |
1923 |
+ return usr; |
1924 |
+ if ((usr == MSG_FRAGMENTER) || (usr == MSG_BUNDLER)) |
1925 |
+- return msg_bits(m, 5, 13, 0x7); |
1926 |
++ return msg_bits(m, 9, 0, 0x7); |
1927 |
+ return TIPC_SYSTEM_IMPORTANCE; |
1928 |
+ } |
1929 |
+ |
1930 |
+@@ -366,7 +366,7 @@ static inline void msg_set_importance(struct tipc_msg *m, u32 i) |
1931 |
+ int usr = msg_user(m); |
1932 |
+ |
1933 |
+ if (likely((usr == MSG_FRAGMENTER) || (usr == MSG_BUNDLER))) |
1934 |
+- msg_set_bits(m, 5, 13, 0x7, i); |
1935 |
++ msg_set_bits(m, 9, 0, 0x7, i); |
1936 |
+ else if (i < TIPC_SYSTEM_IMPORTANCE) |
1937 |
+ msg_set_user(m, i); |
1938 |
+ else |
1939 |
+diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c |
1940 |
+index 03ee4d359f6a..94f658235fb4 100644 |
1941 |
+--- a/net/unix/af_unix.c |
1942 |
++++ b/net/unix/af_unix.c |
1943 |
+@@ -2064,6 +2064,11 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state) |
1944 |
+ goto out; |
1945 |
+ } |
1946 |
+ |
1947 |
++ if (flags & MSG_PEEK) |
1948 |
++ skip = sk_peek_offset(sk, flags); |
1949 |
++ else |
1950 |
++ skip = 0; |
1951 |
++ |
1952 |
+ do { |
1953 |
+ int chunk; |
1954 |
+ struct sk_buff *skb, *last; |
1955 |
+@@ -2112,7 +2117,6 @@ unlock: |
1956 |
+ break; |
1957 |
+ } |
1958 |
+ |
1959 |
+- skip = sk_peek_offset(sk, flags); |
1960 |
+ while (skip >= unix_skb_len(skb)) { |
1961 |
+ skip -= unix_skb_len(skb); |
1962 |
+ last = skb; |
1963 |
+@@ -2181,6 +2185,17 @@ unlock: |
1964 |
+ |
1965 |
+ sk_peek_offset_fwd(sk, chunk); |
1966 |
+ |
1967 |
++ if (UNIXCB(skb).fp) |
1968 |
++ break; |
1969 |
++ |
1970 |
++ skip = 0; |
1971 |
++ last = skb; |
1972 |
++ last_len = skb->len; |
1973 |
++ unix_state_lock(sk); |
1974 |
++ skb = skb_peek_next(skb, &sk->sk_receive_queue); |
1975 |
++ if (skb) |
1976 |
++ goto again; |
1977 |
++ unix_state_unlock(sk); |
1978 |
+ break; |
1979 |
+ } |
1980 |
+ } while (size); |