Magellan Linux

Contents of /trunk/kernel-magellan/patches-4.19/0104-4.19.5-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3257 - (show annotations) (download)
Thu Nov 29 10:28:58 2018 UTC (5 years, 5 months ago) by niro
File size: 148369 byte(s)
-linux-4.19.5
1 diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
2 index 92eb1f42240d..fa4eec22816d 100644
3 --- a/Documentation/admin-guide/kernel-parameters.txt
4 +++ b/Documentation/admin-guide/kernel-parameters.txt
5 @@ -1063,7 +1063,7 @@
6 earlyprintk=serial[,0x...[,baudrate]]
7 earlyprintk=ttySn[,baudrate]
8 earlyprintk=dbgp[debugController#]
9 - earlyprintk=pciserial,bus:device.function[,baudrate]
10 + earlyprintk=pciserial[,force],bus:device.function[,baudrate]
11 earlyprintk=xdbc[xhciController#]
12
13 earlyprintk is useful when the kernel crashes before
14 @@ -1095,6 +1095,10 @@
15
16 The sclp output can only be used on s390.
17
18 + The optional "force" to "pciserial" enables use of a
19 + PCI device even when its classcode is not of the
20 + UART class.
21 +
22 edac_report= [HW,EDAC] Control how to report EDAC event
23 Format: {"on" | "off" | "force"}
24 on: enable EDAC to report H/W event. May be overridden
25 @@ -4683,6 +4687,8 @@
26 prevent spurious wakeup);
27 n = USB_QUIRK_DELAY_CTRL_MSG (Device needs a
28 pause after every control message);
29 + o = USB_QUIRK_HUB_SLOW_RESET (Hub needs extra
30 + delay after resetting its port);
31 Example: quirks=0781:5580:bk,0a5c:5834:gij
32
33 usbhid.mousepoll=
34 diff --git a/Documentation/x86/x86_64/mm.txt b/Documentation/x86/x86_64/mm.txt
35 index 5432a96d31ff..05ef53d83a41 100644
36 --- a/Documentation/x86/x86_64/mm.txt
37 +++ b/Documentation/x86/x86_64/mm.txt
38 @@ -4,8 +4,9 @@ Virtual memory map with 4 level page tables:
39 0000000000000000 - 00007fffffffffff (=47 bits) user space, different per mm
40 hole caused by [47:63] sign extension
41 ffff800000000000 - ffff87ffffffffff (=43 bits) guard hole, reserved for hypervisor
42 -ffff880000000000 - ffffc7ffffffffff (=64 TB) direct mapping of all phys. memory
43 -ffffc80000000000 - ffffc8ffffffffff (=40 bits) hole
44 +ffff880000000000 - ffff887fffffffff (=39 bits) LDT remap for PTI
45 +ffff888000000000 - ffffc87fffffffff (=64 TB) direct mapping of all phys. memory
46 +ffffc88000000000 - ffffc8ffffffffff (=39 bits) hole
47 ffffc90000000000 - ffffe8ffffffffff (=45 bits) vmalloc/ioremap space
48 ffffe90000000000 - ffffe9ffffffffff (=40 bits) hole
49 ffffea0000000000 - ffffeaffffffffff (=40 bits) virtual memory map (1TB)
50 @@ -30,8 +31,9 @@ Virtual memory map with 5 level page tables:
51 0000000000000000 - 00ffffffffffffff (=56 bits) user space, different per mm
52 hole caused by [56:63] sign extension
53 ff00000000000000 - ff0fffffffffffff (=52 bits) guard hole, reserved for hypervisor
54 -ff10000000000000 - ff8fffffffffffff (=55 bits) direct mapping of all phys. memory
55 -ff90000000000000 - ff9fffffffffffff (=52 bits) LDT remap for PTI
56 +ff10000000000000 - ff10ffffffffffff (=48 bits) LDT remap for PTI
57 +ff11000000000000 - ff90ffffffffffff (=55 bits) direct mapping of all phys. memory
58 +ff91000000000000 - ff9fffffffffffff (=3840 TB) hole
59 ffa0000000000000 - ffd1ffffffffffff (=54 bits) vmalloc/ioremap space (12800 TB)
60 ffd2000000000000 - ffd3ffffffffffff (=49 bits) hole
61 ffd4000000000000 - ffd5ffffffffffff (=49 bits) virtual memory map (512TB)
62 diff --git a/Makefile b/Makefile
63 index 1f3c7adeea63..a07830185bdf 100644
64 --- a/Makefile
65 +++ b/Makefile
66 @@ -1,7 +1,7 @@
67 # SPDX-License-Identifier: GPL-2.0
68 VERSION = 4
69 PATCHLEVEL = 19
70 -SUBLEVEL = 4
71 +SUBLEVEL = 5
72 EXTRAVERSION =
73 NAME = "People's Front"
74
75 diff --git a/arch/arm/boot/dts/imx53-ppd.dts b/arch/arm/boot/dts/imx53-ppd.dts
76 index cdb90bee7b4a..f202396e3f2a 100644
77 --- a/arch/arm/boot/dts/imx53-ppd.dts
78 +++ b/arch/arm/boot/dts/imx53-ppd.dts
79 @@ -55,7 +55,7 @@
80 };
81
82 chosen {
83 - stdout-path = "&uart1:115200n8";
84 + stdout-path = "serial0:115200n8";
85 };
86
87 memory@70000000 {
88 diff --git a/arch/arm/boot/dts/imx6sll.dtsi b/arch/arm/boot/dts/imx6sll.dtsi
89 index 000e6136a9d6..3e6ffaf5f104 100644
90 --- a/arch/arm/boot/dts/imx6sll.dtsi
91 +++ b/arch/arm/boot/dts/imx6sll.dtsi
92 @@ -709,7 +709,7 @@
93 i2c1: i2c@21a0000 {
94 #address-cells = <1>;
95 #size-cells = <0>;
96 - compatible = "fs,imx6sll-i2c", "fsl,imx21-i2c";
97 + compatible = "fsl,imx6sll-i2c", "fsl,imx21-i2c";
98 reg = <0x021a0000 0x4000>;
99 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
100 clocks = <&clks IMX6SLL_CLK_I2C1>;
101 diff --git a/arch/arm/boot/dts/vf610m4-colibri.dts b/arch/arm/boot/dts/vf610m4-colibri.dts
102 index 41ec66a96990..ca6249558760 100644
103 --- a/arch/arm/boot/dts/vf610m4-colibri.dts
104 +++ b/arch/arm/boot/dts/vf610m4-colibri.dts
105 @@ -50,8 +50,8 @@
106 compatible = "fsl,vf610m4";
107
108 chosen {
109 - bootargs = "console=ttyLP2,115200 clk_ignore_unused init=/linuxrc rw";
110 - stdout-path = "&uart2";
111 + bootargs = "clk_ignore_unused init=/linuxrc rw";
112 + stdout-path = "serial2:115200";
113 };
114
115 memory@8c000000 {
116 diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
117 index fb9d08ad7659..c87eed77de2c 100644
118 --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
119 +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
120 @@ -662,7 +662,7 @@
121 clock-names = "fck", "brg_int", "scif_clk";
122 dmas = <&dmac1 0x35>, <&dmac1 0x34>,
123 <&dmac2 0x35>, <&dmac2 0x34>;
124 - dma-names = "tx", "rx";
125 + dma-names = "tx", "rx", "tx", "rx";
126 power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
127 resets = <&cpg 518>;
128 status = "disabled";
129 diff --git a/arch/arm64/boot/dts/renesas/r8a77980-condor.dts b/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
130 index 9f25c407dfd7..e830b6162375 100644
131 --- a/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
132 +++ b/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
133 @@ -15,7 +15,7 @@
134
135 aliases {
136 serial0 = &scif0;
137 - ethernet0 = &avb;
138 + ethernet0 = &gether;
139 };
140
141 chosen {
142 @@ -47,23 +47,6 @@
143 };
144 };
145
146 -&avb {
147 - pinctrl-0 = <&avb_pins>;
148 - pinctrl-names = "default";
149 -
150 - phy-mode = "rgmii-id";
151 - phy-handle = <&phy0>;
152 - renesas,no-ether-link;
153 - status = "okay";
154 -
155 - phy0: ethernet-phy@0 {
156 - rxc-skew-ps = <1500>;
157 - reg = <0>;
158 - interrupt-parent = <&gpio1>;
159 - interrupts = <17 IRQ_TYPE_LEVEL_LOW>;
160 - };
161 -};
162 -
163 &canfd {
164 pinctrl-0 = <&canfd0_pins>;
165 pinctrl-names = "default";
166 @@ -82,6 +65,23 @@
167 clock-frequency = <32768>;
168 };
169
170 +&gether {
171 + pinctrl-0 = <&gether_pins>;
172 + pinctrl-names = "default";
173 +
174 + phy-mode = "rgmii-id";
175 + phy-handle = <&phy0>;
176 + renesas,no-ether-link;
177 + status = "okay";
178 +
179 + phy0: ethernet-phy@0 {
180 + rxc-skew-ps = <1500>;
181 + reg = <0>;
182 + interrupt-parent = <&gpio4>;
183 + interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
184 + };
185 +};
186 +
187 &i2c0 {
188 pinctrl-0 = <&i2c0_pins>;
189 pinctrl-names = "default";
190 @@ -118,16 +118,17 @@
191 };
192
193 &pfc {
194 - avb_pins: avb {
195 - groups = "avb_mdio", "avb_rgmii";
196 - function = "avb";
197 - };
198 -
199 canfd0_pins: canfd0 {
200 groups = "canfd0_data_a";
201 function = "canfd0";
202 };
203
204 + gether_pins: gether {
205 + groups = "gether_mdio_a", "gether_rgmii",
206 + "gether_txcrefclk", "gether_txcrefclk_mega";
207 + function = "gether";
208 + };
209 +
210 i2c0_pins: i2c0 {
211 groups = "i2c0";
212 function = "i2c0";
213 diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h
214 index 9234013e759e..21a81b59a0cc 100644
215 --- a/arch/arm64/include/asm/percpu.h
216 +++ b/arch/arm64/include/asm/percpu.h
217 @@ -96,6 +96,7 @@ static inline unsigned long __percpu_##op(void *ptr, \
218 : [val] "Ir" (val)); \
219 break; \
220 default: \
221 + ret = 0; \
222 BUILD_BUG(); \
223 } \
224 \
225 @@ -125,6 +126,7 @@ static inline unsigned long __percpu_read(void *ptr, int size)
226 ret = READ_ONCE(*(u64 *)ptr);
227 break;
228 default:
229 + ret = 0;
230 BUILD_BUG();
231 }
232
233 @@ -194,6 +196,7 @@ static inline unsigned long __percpu_xchg(void *ptr, unsigned long val,
234 : [val] "r" (val));
235 break;
236 default:
237 + ret = 0;
238 BUILD_BUG();
239 }
240
241 diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c
242 index e78c3ef04d95..b5a367d4bba6 100644
243 --- a/arch/arm64/kernel/probes/kprobes.c
244 +++ b/arch/arm64/kernel/probes/kprobes.c
245 @@ -23,7 +23,9 @@
246 #include <linux/slab.h>
247 #include <linux/stop_machine.h>
248 #include <linux/sched/debug.h>
249 +#include <linux/set_memory.h>
250 #include <linux/stringify.h>
251 +#include <linux/vmalloc.h>
252 #include <asm/traps.h>
253 #include <asm/ptrace.h>
254 #include <asm/cacheflush.h>
255 @@ -42,10 +44,21 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
256 static void __kprobes
257 post_kprobe_handler(struct kprobe_ctlblk *, struct pt_regs *);
258
259 +static int __kprobes patch_text(kprobe_opcode_t *addr, u32 opcode)
260 +{
261 + void *addrs[1];
262 + u32 insns[1];
263 +
264 + addrs[0] = addr;
265 + insns[0] = opcode;
266 +
267 + return aarch64_insn_patch_text(addrs, insns, 1);
268 +}
269 +
270 static void __kprobes arch_prepare_ss_slot(struct kprobe *p)
271 {
272 /* prepare insn slot */
273 - p->ainsn.api.insn[0] = cpu_to_le32(p->opcode);
274 + patch_text(p->ainsn.api.insn, p->opcode);
275
276 flush_icache_range((uintptr_t) (p->ainsn.api.insn),
277 (uintptr_t) (p->ainsn.api.insn) +
278 @@ -118,15 +131,15 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
279 return 0;
280 }
281
282 -static int __kprobes patch_text(kprobe_opcode_t *addr, u32 opcode)
283 +void *alloc_insn_page(void)
284 {
285 - void *addrs[1];
286 - u32 insns[1];
287 + void *page;
288
289 - addrs[0] = (void *)addr;
290 - insns[0] = (u32)opcode;
291 + page = vmalloc_exec(PAGE_SIZE);
292 + if (page)
293 + set_memory_ro((unsigned long)page, 1);
294
295 - return aarch64_insn_patch_text(addrs, insns, 1);
296 + return page;
297 }
298
299 /* arm kprobe: install breakpoint in text */
300 diff --git a/arch/mips/configs/cavium_octeon_defconfig b/arch/mips/configs/cavium_octeon_defconfig
301 index 490b12af103c..c52d0efacd14 100644
302 --- a/arch/mips/configs/cavium_octeon_defconfig
303 +++ b/arch/mips/configs/cavium_octeon_defconfig
304 @@ -140,6 +140,7 @@ CONFIG_RTC_CLASS=y
305 CONFIG_RTC_DRV_DS1307=y
306 CONFIG_STAGING=y
307 CONFIG_OCTEON_ETHERNET=y
308 +CONFIG_OCTEON_USB=y
309 # CONFIG_IOMMU_SUPPORT is not set
310 CONFIG_RAS=y
311 CONFIG_EXT4_FS=y
312 diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
313 index 473cfc84e412..8c3e3e3c8be1 100644
314 --- a/arch/riscv/include/asm/uaccess.h
315 +++ b/arch/riscv/include/asm/uaccess.h
316 @@ -400,13 +400,13 @@ extern unsigned long __must_check __asm_copy_from_user(void *to,
317 static inline unsigned long
318 raw_copy_from_user(void *to, const void __user *from, unsigned long n)
319 {
320 - return __asm_copy_to_user(to, from, n);
321 + return __asm_copy_from_user(to, from, n);
322 }
323
324 static inline unsigned long
325 raw_copy_to_user(void __user *to, const void *from, unsigned long n)
326 {
327 - return __asm_copy_from_user(to, from, n);
328 + return __asm_copy_to_user(to, from, n);
329 }
330
331 extern long strncpy_from_user(char *dest, const char __user *src, long count);
332 diff --git a/arch/s390/boot/compressed/Makefile b/arch/s390/boot/compressed/Makefile
333 index 04609478d18b..b375c6c5ae7b 100644
334 --- a/arch/s390/boot/compressed/Makefile
335 +++ b/arch/s390/boot/compressed/Makefile
336 @@ -20,7 +20,7 @@ KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR)
337 OBJECTS := $(addprefix $(obj)/,$(obj-y))
338
339 LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T
340 -$(obj)/vmlinux: $(obj)/vmlinux.lds $(objtree)/arch/s390/boot/startup.a $(OBJECTS)
341 +$(obj)/vmlinux: $(obj)/vmlinux.lds $(objtree)/arch/s390/boot/startup.a $(OBJECTS) FORCE
342 $(call if_changed,ld)
343
344 # extract required uncompressed vmlinux symbols and adjust them to reflect offsets inside vmlinux.bin
345 @@ -51,17 +51,17 @@ suffix-$(CONFIG_KERNEL_LZMA) := .lzma
346 suffix-$(CONFIG_KERNEL_LZO) := .lzo
347 suffix-$(CONFIG_KERNEL_XZ) := .xz
348
349 -$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y)
350 +$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
351 $(call if_changed,gzip)
352 -$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y)
353 +$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
354 $(call if_changed,bzip2)
355 -$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y)
356 +$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE
357 $(call if_changed,lz4)
358 -$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y)
359 +$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
360 $(call if_changed,lzma)
361 -$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y)
362 +$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
363 $(call if_changed,lzo)
364 -$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y)
365 +$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
366 $(call if_changed,xzkern)
367
368 LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
369 diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
370 index 0717ee76885d..f1ab9420ccfb 100644
371 --- a/arch/s390/include/asm/mmu_context.h
372 +++ b/arch/s390/include/asm/mmu_context.h
373 @@ -45,8 +45,6 @@ static inline int init_new_context(struct task_struct *tsk,
374 mm->context.asce_limit = STACK_TOP_MAX;
375 mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
376 _ASCE_USER_BITS | _ASCE_TYPE_REGION3;
377 - /* pgd_alloc() did not account this pud */
378 - mm_inc_nr_puds(mm);
379 break;
380 case -PAGE_SIZE:
381 /* forked 5-level task, set new asce with new_mm->pgd */
382 @@ -62,9 +60,6 @@ static inline int init_new_context(struct task_struct *tsk,
383 /* forked 2-level compat task, set new asce with new mm->pgd */
384 mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
385 _ASCE_USER_BITS | _ASCE_TYPE_SEGMENT;
386 - /* pgd_alloc() did not account this pmd */
387 - mm_inc_nr_pmds(mm);
388 - mm_inc_nr_puds(mm);
389 }
390 crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm));
391 return 0;
392 diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h
393 index f0f9bcf94c03..5ee733720a57 100644
394 --- a/arch/s390/include/asm/pgalloc.h
395 +++ b/arch/s390/include/asm/pgalloc.h
396 @@ -36,11 +36,11 @@ static inline void crst_table_init(unsigned long *crst, unsigned long entry)
397
398 static inline unsigned long pgd_entry_type(struct mm_struct *mm)
399 {
400 - if (mm->context.asce_limit <= _REGION3_SIZE)
401 + if (mm_pmd_folded(mm))
402 return _SEGMENT_ENTRY_EMPTY;
403 - if (mm->context.asce_limit <= _REGION2_SIZE)
404 + if (mm_pud_folded(mm))
405 return _REGION3_ENTRY_EMPTY;
406 - if (mm->context.asce_limit <= _REGION1_SIZE)
407 + if (mm_p4d_folded(mm))
408 return _REGION2_ENTRY_EMPTY;
409 return _REGION1_ENTRY_EMPTY;
410 }
411 diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
412 index 0e7cb0dc9c33..de05466ce50c 100644
413 --- a/arch/s390/include/asm/pgtable.h
414 +++ b/arch/s390/include/asm/pgtable.h
415 @@ -485,6 +485,24 @@ static inline int is_module_addr(void *addr)
416 _REGION_ENTRY_PROTECT | \
417 _REGION_ENTRY_NOEXEC)
418
419 +static inline bool mm_p4d_folded(struct mm_struct *mm)
420 +{
421 + return mm->context.asce_limit <= _REGION1_SIZE;
422 +}
423 +#define mm_p4d_folded(mm) mm_p4d_folded(mm)
424 +
425 +static inline bool mm_pud_folded(struct mm_struct *mm)
426 +{
427 + return mm->context.asce_limit <= _REGION2_SIZE;
428 +}
429 +#define mm_pud_folded(mm) mm_pud_folded(mm)
430 +
431 +static inline bool mm_pmd_folded(struct mm_struct *mm)
432 +{
433 + return mm->context.asce_limit <= _REGION3_SIZE;
434 +}
435 +#define mm_pmd_folded(mm) mm_pmd_folded(mm)
436 +
437 static inline int mm_has_pgste(struct mm_struct *mm)
438 {
439 #ifdef CONFIG_PGSTE
440 diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h
441 index 457b7ba0fbb6..b31c779cf581 100644
442 --- a/arch/s390/include/asm/tlb.h
443 +++ b/arch/s390/include/asm/tlb.h
444 @@ -136,7 +136,7 @@ static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
445 static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
446 unsigned long address)
447 {
448 - if (tlb->mm->context.asce_limit <= _REGION3_SIZE)
449 + if (mm_pmd_folded(tlb->mm))
450 return;
451 pgtable_pmd_page_dtor(virt_to_page(pmd));
452 tlb_remove_table(tlb, pmd);
453 @@ -152,7 +152,7 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
454 static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d,
455 unsigned long address)
456 {
457 - if (tlb->mm->context.asce_limit <= _REGION1_SIZE)
458 + if (mm_p4d_folded(tlb->mm))
459 return;
460 tlb_remove_table(tlb, p4d);
461 }
462 @@ -167,7 +167,7 @@ static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d,
463 static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
464 unsigned long address)
465 {
466 - if (tlb->mm->context.asce_limit <= _REGION2_SIZE)
467 + if (mm_pud_folded(tlb->mm))
468 return;
469 tlb_remove_table(tlb, pud);
470 }
471 diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
472 index cc085e2d2ce9..74091fd3101e 100644
473 --- a/arch/s390/kernel/perf_cpum_cf.c
474 +++ b/arch/s390/kernel/perf_cpum_cf.c
475 @@ -373,7 +373,7 @@ static int __hw_perf_event_init(struct perf_event *event)
476 return -ENOENT;
477
478 if (ev > PERF_CPUM_CF_MAX_CTR)
479 - return -EINVAL;
480 + return -ENOENT;
481
482 /* Obtain the counter set to which the specified counter belongs */
483 set = get_counter_set(ev);
484 diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile
485 index c5c856f320bc..04dd3e2c3bd9 100644
486 --- a/arch/s390/kernel/vdso32/Makefile
487 +++ b/arch/s390/kernel/vdso32/Makefile
488 @@ -36,7 +36,7 @@ UBSAN_SANITIZE := n
489 $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so
490
491 # link rule for the .so file, .lds has to be first
492 -$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32)
493 +$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) FORCE
494 $(call if_changed,vdso32ld)
495
496 # strip rule for the .so file
497 @@ -45,12 +45,12 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE
498 $(call if_changed,objcopy)
499
500 # assembly rules for the .S files
501 -$(obj-vdso32): %.o: %.S
502 +$(obj-vdso32): %.o: %.S FORCE
503 $(call if_changed_dep,vdso32as)
504
505 # actual build commands
506 quiet_cmd_vdso32ld = VDSO32L $@
507 - cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $^ -o $@
508 + cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@
509 quiet_cmd_vdso32as = VDSO32A $@
510 cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $<
511
512 diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
513 index 15b1ceafc4c1..ddebc26cd949 100644
514 --- a/arch/s390/kernel/vdso64/Makefile
515 +++ b/arch/s390/kernel/vdso64/Makefile
516 @@ -36,7 +36,7 @@ UBSAN_SANITIZE := n
517 $(obj)/vdso64_wrapper.o : $(obj)/vdso64.so
518
519 # link rule for the .so file, .lds has to be first
520 -$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64)
521 +$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) FORCE
522 $(call if_changed,vdso64ld)
523
524 # strip rule for the .so file
525 @@ -45,12 +45,12 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE
526 $(call if_changed,objcopy)
527
528 # assembly rules for the .S files
529 -$(obj-vdso64): %.o: %.S
530 +$(obj-vdso64): %.o: %.S FORCE
531 $(call if_changed_dep,vdso64as)
532
533 # actual build commands
534 quiet_cmd_vdso64ld = VDSO64L $@
535 - cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@
536 + cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@
537 quiet_cmd_vdso64as = VDSO64A $@
538 cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $<
539
540 diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c
541 index 76d89ee8b428..814f26520aa2 100644
542 --- a/arch/s390/mm/pgalloc.c
543 +++ b/arch/s390/mm/pgalloc.c
544 @@ -101,6 +101,7 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long end)
545 mm->context.asce_limit = _REGION1_SIZE;
546 mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
547 _ASCE_USER_BITS | _ASCE_TYPE_REGION2;
548 + mm_inc_nr_puds(mm);
549 } else {
550 crst_table_init(table, _REGION1_ENTRY_EMPTY);
551 pgd_populate(mm, (pgd_t *) table, (p4d_t *) pgd);
552 diff --git a/arch/s390/numa/numa.c b/arch/s390/numa/numa.c
553 index 5bd374491f94..6c151b42e65d 100644
554 --- a/arch/s390/numa/numa.c
555 +++ b/arch/s390/numa/numa.c
556 @@ -54,6 +54,7 @@ int __node_distance(int a, int b)
557 {
558 return mode->distance ? mode->distance(a, b) : 0;
559 }
560 +EXPORT_SYMBOL(__node_distance);
561
562 int numa_debug_enabled;
563
564 diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
565 index c94c3bd70ccd..df4a985716eb 100644
566 --- a/arch/um/os-Linux/skas/process.c
567 +++ b/arch/um/os-Linux/skas/process.c
568 @@ -610,6 +610,11 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
569 fatal_sigsegv();
570 }
571 longjmp(*switch_buf, 1);
572 +
573 + /* unreachable */
574 + printk(UM_KERN_ERR "impossible long jump!");
575 + fatal_sigsegv();
576 + return 0;
577 }
578
579 void initial_thread_cb_skas(void (*proc)(void *), void *arg)
580 diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
581 index 6afac386a434..b99d497e342d 100644
582 --- a/arch/x86/include/asm/page_64_types.h
583 +++ b/arch/x86/include/asm/page_64_types.h
584 @@ -33,12 +33,14 @@
585
586 /*
587 * Set __PAGE_OFFSET to the most negative possible address +
588 - * PGDIR_SIZE*16 (pgd slot 272). The gap is to allow a space for a
589 - * hypervisor to fit. Choosing 16 slots here is arbitrary, but it's
590 - * what Xen requires.
591 + * PGDIR_SIZE*17 (pgd slot 273).
592 + *
593 + * The gap is to allow a space for LDT remap for PTI (1 pgd slot) and space for
594 + * a hypervisor (16 slots). Choosing 16 slots for a hypervisor is arbitrary,
595 + * but it's what Xen requires.
596 */
597 -#define __PAGE_OFFSET_BASE_L5 _AC(0xff10000000000000, UL)
598 -#define __PAGE_OFFSET_BASE_L4 _AC(0xffff880000000000, UL)
599 +#define __PAGE_OFFSET_BASE_L5 _AC(0xff11000000000000, UL)
600 +#define __PAGE_OFFSET_BASE_L4 _AC(0xffff888000000000, UL)
601
602 #ifdef CONFIG_DYNAMIC_MEMORY_LAYOUT
603 #define __PAGE_OFFSET page_offset_base
604 diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h
605 index 04edd2d58211..84bd9bdc1987 100644
606 --- a/arch/x86/include/asm/pgtable_64_types.h
607 +++ b/arch/x86/include/asm/pgtable_64_types.h
608 @@ -111,9 +111,7 @@ extern unsigned int ptrs_per_p4d;
609 */
610 #define MAXMEM (1UL << MAX_PHYSMEM_BITS)
611
612 -#define LDT_PGD_ENTRY_L4 -3UL
613 -#define LDT_PGD_ENTRY_L5 -112UL
614 -#define LDT_PGD_ENTRY (pgtable_l5_enabled() ? LDT_PGD_ENTRY_L5 : LDT_PGD_ENTRY_L4)
615 +#define LDT_PGD_ENTRY -240UL
616 #define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT)
617 #define LDT_END_ADDR (LDT_BASE_ADDR + PGDIR_SIZE)
618
619 diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
620 index 5e801c8c8ce7..374a52fa5296 100644
621 --- a/arch/x86/kernel/early_printk.c
622 +++ b/arch/x86/kernel/early_printk.c
623 @@ -213,8 +213,9 @@ static unsigned int mem32_serial_in(unsigned long addr, int offset)
624 * early_pci_serial_init()
625 *
626 * This function is invoked when the early_printk param starts with "pciserial"
627 - * The rest of the param should be ",B:D.F,baud" where B, D & F describe the
628 - * location of a PCI device that must be a UART device.
629 + * The rest of the param should be "[force],B:D.F,baud", where B, D & F describe
630 + * the location of a PCI device that must be a UART device. "force" is optional
631 + * and overrides the use of an UART device with a wrong PCI class code.
632 */
633 static __init void early_pci_serial_init(char *s)
634 {
635 @@ -224,17 +225,23 @@ static __init void early_pci_serial_init(char *s)
636 u32 classcode, bar0;
637 u16 cmdreg;
638 char *e;
639 + int force = 0;
640
641 -
642 - /*
643 - * First, part the param to get the BDF values
644 - */
645 if (*s == ',')
646 ++s;
647
648 if (*s == 0)
649 return;
650
651 + /* Force the use of an UART device with wrong class code */
652 + if (!strncmp(s, "force,", 6)) {
653 + force = 1;
654 + s += 6;
655 + }
656 +
657 + /*
658 + * Part the param to get the BDF values
659 + */
660 bus = (u8)simple_strtoul(s, &e, 16);
661 s = e;
662 if (*s != ':')
663 @@ -253,7 +260,7 @@ static __init void early_pci_serial_init(char *s)
664 s++;
665
666 /*
667 - * Second, find the device from the BDF
668 + * Find the device from the BDF
669 */
670 cmdreg = read_pci_config(bus, slot, func, PCI_COMMAND);
671 classcode = read_pci_config(bus, slot, func, PCI_CLASS_REVISION);
672 @@ -264,8 +271,10 @@ static __init void early_pci_serial_init(char *s)
673 */
674 if (((classcode >> 16 != PCI_CLASS_COMMUNICATION_MODEM) &&
675 (classcode >> 16 != PCI_CLASS_COMMUNICATION_SERIAL)) ||
676 - (((classcode >> 8) & 0xff) != 0x02)) /* 16550 I/F at BAR0 */
677 - return;
678 + (((classcode >> 8) & 0xff) != 0x02)) /* 16550 I/F at BAR0 */ {
679 + if (!force)
680 + return;
681 + }
682
683 /*
684 * Determine if it is IO or memory mapped
685 @@ -289,7 +298,7 @@ static __init void early_pci_serial_init(char *s)
686 }
687
688 /*
689 - * Lastly, initialize the hardware
690 + * Initialize the hardware
691 */
692 if (*s) {
693 if (strcmp(s, "nocfg") == 0)
694 diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
695 index 733e6ace0fa4..65590eee6289 100644
696 --- a/arch/x86/kernel/ldt.c
697 +++ b/arch/x86/kernel/ldt.c
698 @@ -199,14 +199,6 @@ static void sanity_check_ldt_mapping(struct mm_struct *mm)
699 /*
700 * If PTI is enabled, this maps the LDT into the kernelmode and
701 * usermode tables for the given mm.
702 - *
703 - * There is no corresponding unmap function. Even if the LDT is freed, we
704 - * leave the PTEs around until the slot is reused or the mm is destroyed.
705 - * This is harmless: the LDT is always in ordinary memory, and no one will
706 - * access the freed slot.
707 - *
708 - * If we wanted to unmap freed LDTs, we'd also need to do a flush to make
709 - * it useful, and the flush would slow down modify_ldt().
710 */
711 static int
712 map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)
713 @@ -214,8 +206,7 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)
714 unsigned long va;
715 bool is_vmalloc;
716 spinlock_t *ptl;
717 - pgd_t *pgd;
718 - int i;
719 + int i, nr_pages;
720
721 if (!static_cpu_has(X86_FEATURE_PTI))
722 return 0;
723 @@ -229,16 +220,11 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)
724 /* Check if the current mappings are sane */
725 sanity_check_ldt_mapping(mm);
726
727 - /*
728 - * Did we already have the top level entry allocated? We can't
729 - * use pgd_none() for this because it doens't do anything on
730 - * 4-level page table kernels.
731 - */
732 - pgd = pgd_offset(mm, LDT_BASE_ADDR);
733 -
734 is_vmalloc = is_vmalloc_addr(ldt->entries);
735
736 - for (i = 0; i * PAGE_SIZE < ldt->nr_entries * LDT_ENTRY_SIZE; i++) {
737 + nr_pages = DIV_ROUND_UP(ldt->nr_entries * LDT_ENTRY_SIZE, PAGE_SIZE);
738 +
739 + for (i = 0; i < nr_pages; i++) {
740 unsigned long offset = i << PAGE_SHIFT;
741 const void *src = (char *)ldt->entries + offset;
742 unsigned long pfn;
743 @@ -272,13 +258,39 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)
744 /* Propagate LDT mapping to the user page-table */
745 map_ldt_struct_to_user(mm);
746
747 - va = (unsigned long)ldt_slot_va(slot);
748 - flush_tlb_mm_range(mm, va, va + LDT_SLOT_STRIDE, 0);
749 -
750 ldt->slot = slot;
751 return 0;
752 }
753
754 +static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt)
755 +{
756 + unsigned long va;
757 + int i, nr_pages;
758 +
759 + if (!ldt)
760 + return;
761 +
762 + /* LDT map/unmap is only required for PTI */
763 + if (!static_cpu_has(X86_FEATURE_PTI))
764 + return;
765 +
766 + nr_pages = DIV_ROUND_UP(ldt->nr_entries * LDT_ENTRY_SIZE, PAGE_SIZE);
767 +
768 + for (i = 0; i < nr_pages; i++) {
769 + unsigned long offset = i << PAGE_SHIFT;
770 + spinlock_t *ptl;
771 + pte_t *ptep;
772 +
773 + va = (unsigned long)ldt_slot_va(ldt->slot) + offset;
774 + ptep = get_locked_pte(mm, va, &ptl);
775 + pte_clear(mm, va, ptep);
776 + pte_unmap_unlock(ptep, ptl);
777 + }
778 +
779 + va = (unsigned long)ldt_slot_va(ldt->slot);
780 + flush_tlb_mm_range(mm, va, va + nr_pages * PAGE_SIZE, 0);
781 +}
782 +
783 #else /* !CONFIG_PAGE_TABLE_ISOLATION */
784
785 static int
786 @@ -286,6 +298,10 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)
787 {
788 return 0;
789 }
790 +
791 +static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt)
792 +{
793 +}
794 #endif /* CONFIG_PAGE_TABLE_ISOLATION */
795
796 static void free_ldt_pgtables(struct mm_struct *mm)
797 @@ -524,6 +540,7 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
798 }
799
800 install_ldt(mm, new_ldt);
801 + unmap_ldt_struct(mm, old_ldt);
802 free_ldt_struct(old_ldt);
803 error = 0;
804
805 diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c
806 index dd461c0167ef..2c84c6ad8b50 100644
807 --- a/arch/x86/xen/mmu_pv.c
808 +++ b/arch/x86/xen/mmu_pv.c
809 @@ -1897,7 +1897,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
810 init_top_pgt[0] = __pgd(0);
811
812 /* Pre-constructed entries are in pfn, so convert to mfn */
813 - /* L4[272] -> level3_ident_pgt */
814 + /* L4[273] -> level3_ident_pgt */
815 /* L4[511] -> level3_kernel_pgt */
816 convert_pfn_mfn(init_top_pgt);
817
818 @@ -1917,8 +1917,8 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
819 addr[0] = (unsigned long)pgd;
820 addr[1] = (unsigned long)l3;
821 addr[2] = (unsigned long)l2;
822 - /* Graft it onto L4[272][0]. Note that we creating an aliasing problem:
823 - * Both L4[272][0] and L4[511][510] have entries that point to the same
824 + /* Graft it onto L4[273][0]. Note that we creating an aliasing problem:
825 + * Both L4[273][0] and L4[511][510] have entries that point to the same
826 * L2 (PMD) tables. Meaning that if you modify it in __va space
827 * it will be also modified in the __ka space! (But if you just
828 * modify the PMD table to point to other PTE's or none, then you
829 diff --git a/block/bio.c b/block/bio.c
830 index 0093bed81c0e..41173710430c 100644
831 --- a/block/bio.c
832 +++ b/block/bio.c
833 @@ -1261,6 +1261,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
834 if (ret)
835 goto cleanup;
836 } else {
837 + zero_fill_bio(bio);
838 iov_iter_advance(iter, bio->bi_iter.bi_size);
839 }
840
841 diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
842 index eaa60c94205a..1f32caa87686 100644
843 --- a/drivers/acpi/acpi_platform.c
844 +++ b/drivers/acpi/acpi_platform.c
845 @@ -30,6 +30,7 @@ static const struct acpi_device_id forbidden_id_list[] = {
846 {"PNP0200", 0}, /* AT DMA Controller */
847 {"ACPI0009", 0}, /* IOxAPIC */
848 {"ACPI000A", 0}, /* IOAPIC */
849 + {"SMB0001", 0}, /* ACPI SMBUS virtual device */
850 {"", 0},
851 };
852
853 diff --git a/drivers/block/brd.c b/drivers/block/brd.c
854 index df8103dd40ac..c18586fccb6f 100644
855 --- a/drivers/block/brd.c
856 +++ b/drivers/block/brd.c
857 @@ -396,15 +396,14 @@ static struct brd_device *brd_alloc(int i)
858 disk->first_minor = i * max_part;
859 disk->fops = &brd_fops;
860 disk->private_data = brd;
861 - disk->queue = brd->brd_queue;
862 disk->flags = GENHD_FL_EXT_DEVT;
863 sprintf(disk->disk_name, "ram%d", i);
864 set_capacity(disk, rd_size * 2);
865 - disk->queue->backing_dev_info->capabilities |= BDI_CAP_SYNCHRONOUS_IO;
866 + brd->brd_queue->backing_dev_info->capabilities |= BDI_CAP_SYNCHRONOUS_IO;
867
868 /* Tell the block layer that this is not a rotational device */
869 - blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
870 - blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue);
871 + blk_queue_flag_set(QUEUE_FLAG_NONROT, brd->brd_queue);
872 + blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, brd->brd_queue);
873
874 return brd;
875
876 @@ -436,6 +435,7 @@ static struct brd_device *brd_init_one(int i, bool *new)
877
878 brd = brd_alloc(i);
879 if (brd) {
880 + brd->brd_disk->queue = brd->brd_queue;
881 add_disk(brd->brd_disk);
882 list_add_tail(&brd->brd_list, &brd_devices);
883 }
884 @@ -503,8 +503,14 @@ static int __init brd_init(void)
885
886 /* point of no return */
887
888 - list_for_each_entry(brd, &brd_devices, brd_list)
889 + list_for_each_entry(brd, &brd_devices, brd_list) {
890 + /*
891 + * associate with queue just before adding disk for
892 + * avoiding to mess up failure path
893 + */
894 + brd->brd_disk->queue = brd->brd_queue;
895 add_disk(brd->brd_disk);
896 + }
897
898 blk_register_region(MKDEV(RAMDISK_MAJOR, 0), 1UL << MINORBITS,
899 THIS_MODULE, brd_probe, NULL, NULL);
900 diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
901 index 20724abd38bd..7df6b5b1e7ee 100644
902 --- a/drivers/clk/clk-fixed-factor.c
903 +++ b/drivers/clk/clk-fixed-factor.c
904 @@ -210,6 +210,7 @@ static int of_fixed_factor_clk_remove(struct platform_device *pdev)
905 {
906 struct clk *clk = platform_get_drvdata(pdev);
907
908 + of_clk_del_provider(pdev->dev.of_node);
909 clk_unregister_fixed_factor(clk);
910
911 return 0;
912 diff --git a/drivers/clk/clk-fixed-rate.c b/drivers/clk/clk-fixed-rate.c
913 index b5c46b3f8764..6d6475c32ee5 100644
914 --- a/drivers/clk/clk-fixed-rate.c
915 +++ b/drivers/clk/clk-fixed-rate.c
916 @@ -200,6 +200,7 @@ static int of_fixed_clk_remove(struct platform_device *pdev)
917 {
918 struct clk *clk = platform_get_drvdata(pdev);
919
920 + of_clk_del_provider(pdev->dev.of_node);
921 clk_unregister_fixed_rate(clk);
922
923 return 0;
924 diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c
925 index 8cf74fc423e6..02229d051d77 100644
926 --- a/drivers/clk/meson/axg.c
927 +++ b/drivers/clk/meson/axg.c
928 @@ -96,7 +96,6 @@ static struct clk_regmap axg_sys_pll = {
929 .ops = &meson_clk_pll_ro_ops,
930 .parent_names = (const char *[]){ "xtal" },
931 .num_parents = 1,
932 - .flags = CLK_GET_RATE_NOCACHE,
933 },
934 };
935
936 @@ -713,12 +712,14 @@ static struct clk_regmap axg_pcie_mux = {
937 .offset = HHI_PCIE_PLL_CNTL6,
938 .mask = 0x1,
939 .shift = 2,
940 + /* skip the parent mpll3, reserved for debug */
941 + .table = (u32[]){ 1 },
942 },
943 .hw.init = &(struct clk_init_data){
944 .name = "pcie_mux",
945 .ops = &clk_regmap_mux_ops,
946 - .parent_names = (const char *[]){ "mpll3", "pcie_pll" },
947 - .num_parents = 2,
948 + .parent_names = (const char *[]){ "pcie_pll" },
949 + .num_parents = 1,
950 .flags = CLK_SET_RATE_PARENT,
951 },
952 };
953 diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c
954 index 6435d86118f1..6628ffa31383 100644
955 --- a/drivers/clk/meson/gxbb.c
956 +++ b/drivers/clk/meson/gxbb.c
957 @@ -213,7 +213,6 @@ static struct clk_regmap gxbb_fixed_pll = {
958 .ops = &meson_clk_pll_ro_ops,
959 .parent_names = (const char *[]){ "xtal" },
960 .num_parents = 1,
961 - .flags = CLK_GET_RATE_NOCACHE,
962 },
963 };
964
965 @@ -276,6 +275,10 @@ static struct clk_regmap gxbb_hdmi_pll = {
966 .ops = &meson_clk_pll_ro_ops,
967 .parent_names = (const char *[]){ "hdmi_pll_pre_mult" },
968 .num_parents = 1,
969 + /*
970 + * Display directly handle hdmi pll registers ATM, we need
971 + * NOCACHE to keep our view of the clock as accurate as possible
972 + */
973 .flags = CLK_GET_RATE_NOCACHE,
974 },
975 };
976 @@ -334,6 +337,10 @@ static struct clk_regmap gxl_hdmi_pll = {
977 .ops = &meson_clk_pll_ro_ops,
978 .parent_names = (const char *[]){ "xtal" },
979 .num_parents = 1,
980 + /*
981 + * Display directly handle hdmi pll registers ATM, we need
982 + * NOCACHE to keep our view of the clock as accurate as possible
983 + */
984 .flags = CLK_GET_RATE_NOCACHE,
985 },
986 };
987 @@ -371,7 +378,6 @@ static struct clk_regmap gxbb_sys_pll = {
988 .ops = &meson_clk_pll_ro_ops,
989 .parent_names = (const char *[]){ "xtal" },
990 .num_parents = 1,
991 - .flags = CLK_GET_RATE_NOCACHE,
992 },
993 };
994
995 @@ -418,7 +424,6 @@ static struct clk_regmap gxbb_gp0_pll = {
996 .ops = &meson_clk_pll_ops,
997 .parent_names = (const char *[]){ "xtal" },
998 .num_parents = 1,
999 - .flags = CLK_GET_RATE_NOCACHE,
1000 },
1001 };
1002
1003 @@ -472,7 +477,6 @@ static struct clk_regmap gxl_gp0_pll = {
1004 .ops = &meson_clk_pll_ops,
1005 .parent_names = (const char *[]){ "xtal" },
1006 .num_parents = 1,
1007 - .flags = CLK_GET_RATE_NOCACHE,
1008 },
1009 };
1010
1011 diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c
1012 index 7447d96a265f..74697e145dde 100644
1013 --- a/drivers/clk/meson/meson8b.c
1014 +++ b/drivers/clk/meson/meson8b.c
1015 @@ -132,7 +132,6 @@ static struct clk_regmap meson8b_fixed_pll = {
1016 .ops = &meson_clk_pll_ro_ops,
1017 .parent_names = (const char *[]){ "xtal" },
1018 .num_parents = 1,
1019 - .flags = CLK_GET_RATE_NOCACHE,
1020 },
1021 };
1022
1023 @@ -169,7 +168,6 @@ static struct clk_regmap meson8b_vid_pll = {
1024 .ops = &meson_clk_pll_ro_ops,
1025 .parent_names = (const char *[]){ "xtal" },
1026 .num_parents = 1,
1027 - .flags = CLK_GET_RATE_NOCACHE,
1028 },
1029 };
1030
1031 @@ -207,7 +205,6 @@ static struct clk_regmap meson8b_sys_pll = {
1032 .ops = &meson_clk_pll_ro_ops,
1033 .parent_names = (const char *[]){ "xtal" },
1034 .num_parents = 1,
1035 - .flags = CLK_GET_RATE_NOCACHE,
1036 },
1037 };
1038
1039 diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c
1040 index a0b6ecdc63dd..6d2b56891559 100644
1041 --- a/drivers/clk/renesas/r9a06g032-clocks.c
1042 +++ b/drivers/clk/renesas/r9a06g032-clocks.c
1043 @@ -539,7 +539,8 @@ r9a06g032_div_round_rate(struct clk_hw *hw,
1044 * several uarts attached to this divider, and changing this impacts
1045 * everyone.
1046 */
1047 - if (clk->index == R9A06G032_DIV_UART) {
1048 + if (clk->index == R9A06G032_DIV_UART ||
1049 + clk->index == R9A06G032_DIV_P2_PG) {
1050 pr_devel("%s div uart hack!\n", __func__);
1051 return clk_get_rate(hw->clk);
1052 }
1053 diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c
1054 index 95e1bf69449b..d4f77c4eb277 100644
1055 --- a/drivers/clk/samsung/clk-exynos5420.c
1056 +++ b/drivers/clk/samsung/clk-exynos5420.c
1057 @@ -281,6 +281,7 @@ static const struct samsung_clk_reg_dump exynos5420_set_clksrc[] = {
1058 { .offset = GATE_BUS_TOP, .value = 0xffffffff, },
1059 { .offset = GATE_BUS_DISP1, .value = 0xffffffff, },
1060 { .offset = GATE_IP_PERIC, .value = 0xffffffff, },
1061 + { .offset = GATE_IP_PERIS, .value = 0xffffffff, },
1062 };
1063
1064 static int exynos5420_clk_suspend(void)
1065 diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
1066 index 7d22e1af2247..27e0979b3158 100644
1067 --- a/drivers/clk/ti/clk.c
1068 +++ b/drivers/clk/ti/clk.c
1069 @@ -129,7 +129,7 @@ int ti_clk_setup_ll_ops(struct ti_clk_ll_ops *ops)
1070 void __init ti_dt_clocks_register(struct ti_dt_clk oclks[])
1071 {
1072 struct ti_dt_clk *c;
1073 - struct device_node *node;
1074 + struct device_node *node, *parent;
1075 struct clk *clk;
1076 struct of_phandle_args clkspec;
1077 char buf[64];
1078 @@ -164,8 +164,12 @@ void __init ti_dt_clocks_register(struct ti_dt_clk oclks[])
1079 continue;
1080
1081 node = of_find_node_by_name(NULL, buf);
1082 - if (num_args)
1083 - node = of_find_node_by_name(node, "clk");
1084 + if (num_args) {
1085 + parent = node;
1086 + node = of_get_child_by_name(parent, "clk");
1087 + of_node_put(parent);
1088 + }
1089 +
1090 clkspec.np = node;
1091 clkspec.args_count = num_args;
1092 for (i = 0; i < num_args; i++) {
1093 @@ -173,11 +177,12 @@ void __init ti_dt_clocks_register(struct ti_dt_clk oclks[])
1094 if (ret) {
1095 pr_warn("Bad tag in %s at %d: %s\n",
1096 c->node_name, i, tags[i]);
1097 + of_node_put(node);
1098 return;
1099 }
1100 }
1101 clk = of_clk_get_from_provider(&clkspec);
1102 -
1103 + of_node_put(node);
1104 if (!IS_ERR(clk)) {
1105 c->lk.clk = clk;
1106 clkdev_add(&c->lk);
1107 diff --git a/drivers/gnss/serial.c b/drivers/gnss/serial.c
1108 index b01ba4438501..31e891f00175 100644
1109 --- a/drivers/gnss/serial.c
1110 +++ b/drivers/gnss/serial.c
1111 @@ -13,6 +13,7 @@
1112 #include <linux/of.h>
1113 #include <linux/pm.h>
1114 #include <linux/pm_runtime.h>
1115 +#include <linux/sched.h>
1116 #include <linux/serdev.h>
1117 #include <linux/slab.h>
1118
1119 @@ -63,7 +64,7 @@ static int gnss_serial_write_raw(struct gnss_device *gdev,
1120 int ret;
1121
1122 /* write is only buffered synchronously */
1123 - ret = serdev_device_write(serdev, buf, count, 0);
1124 + ret = serdev_device_write(serdev, buf, count, MAX_SCHEDULE_TIMEOUT);
1125 if (ret < 0)
1126 return ret;
1127
1128 diff --git a/drivers/gnss/sirf.c b/drivers/gnss/sirf.c
1129 index 79cb98950013..71d014edd167 100644
1130 --- a/drivers/gnss/sirf.c
1131 +++ b/drivers/gnss/sirf.c
1132 @@ -16,6 +16,7 @@
1133 #include <linux/pm.h>
1134 #include <linux/pm_runtime.h>
1135 #include <linux/regulator/consumer.h>
1136 +#include <linux/sched.h>
1137 #include <linux/serdev.h>
1138 #include <linux/slab.h>
1139 #include <linux/wait.h>
1140 @@ -83,7 +84,7 @@ static int sirf_write_raw(struct gnss_device *gdev, const unsigned char *buf,
1141 int ret;
1142
1143 /* write is only buffered synchronously */
1144 - ret = serdev_device_write(serdev, buf, count, 0);
1145 + ret = serdev_device_write(serdev, buf, count, MAX_SCHEDULE_TIMEOUT);
1146 if (ret < 0)
1147 return ret;
1148
1149 diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
1150 index 6903fe6c894b..ef5c6af4d964 100644
1151 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
1152 +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
1153 @@ -3167,7 +3167,7 @@ void dm_drm_plane_destroy_state(struct drm_plane *plane,
1154 static const struct drm_plane_funcs dm_plane_funcs = {
1155 .update_plane = drm_atomic_helper_update_plane,
1156 .disable_plane = drm_atomic_helper_disable_plane,
1157 - .destroy = drm_plane_cleanup,
1158 + .destroy = drm_primary_helper_destroy,
1159 .reset = dm_drm_plane_reset,
1160 .atomic_duplicate_state = dm_drm_plane_duplicate_state,
1161 .atomic_destroy_state = dm_drm_plane_destroy_state,
1162 diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
1163 index a29dc35954c9..aba2c5c1d2f8 100644
1164 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
1165 +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
1166 @@ -173,8 +173,6 @@ struct amdgpu_dm_connector {
1167 struct mutex hpd_lock;
1168
1169 bool fake_enable;
1170 -
1171 - bool mst_connected;
1172 };
1173
1174 #define to_amdgpu_dm_connector(x) container_of(x, struct amdgpu_dm_connector, base)
1175 diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
1176 index 9a300732ba37..4cc45a1d21db 100644
1177 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
1178 +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
1179 @@ -317,12 +317,7 @@ dm_dp_create_fake_mst_encoder(struct amdgpu_dm_connector *connector)
1180 struct amdgpu_device *adev = dev->dev_private;
1181 struct amdgpu_encoder *amdgpu_encoder;
1182 struct drm_encoder *encoder;
1183 - const struct drm_connector_helper_funcs *connector_funcs =
1184 - connector->base.helper_private;
1185 - struct drm_encoder *enc_master =
1186 - connector_funcs->best_encoder(&connector->base);
1187
1188 - DRM_DEBUG_KMS("enc master is %p\n", enc_master);
1189 amdgpu_encoder = kzalloc(sizeof(*amdgpu_encoder), GFP_KERNEL);
1190 if (!amdgpu_encoder)
1191 return NULL;
1192 @@ -352,25 +347,6 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
1193 struct amdgpu_device *adev = dev->dev_private;
1194 struct amdgpu_dm_connector *aconnector;
1195 struct drm_connector *connector;
1196 - struct drm_connector_list_iter conn_iter;
1197 -
1198 - drm_connector_list_iter_begin(dev, &conn_iter);
1199 - drm_for_each_connector_iter(connector, &conn_iter) {
1200 - aconnector = to_amdgpu_dm_connector(connector);
1201 - if (aconnector->mst_port == master
1202 - && !aconnector->port) {
1203 - DRM_INFO("DM_MST: reusing connector: %p [id: %d] [master: %p]\n",
1204 - aconnector, connector->base.id, aconnector->mst_port);
1205 -
1206 - aconnector->port = port;
1207 - drm_connector_set_path_property(connector, pathprop);
1208 -
1209 - drm_connector_list_iter_end(&conn_iter);
1210 - aconnector->mst_connected = true;
1211 - return &aconnector->base;
1212 - }
1213 - }
1214 - drm_connector_list_iter_end(&conn_iter);
1215
1216 aconnector = kzalloc(sizeof(*aconnector), GFP_KERNEL);
1217 if (!aconnector)
1218 @@ -419,8 +395,6 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
1219 */
1220 amdgpu_dm_connector_funcs_reset(connector);
1221
1222 - aconnector->mst_connected = true;
1223 -
1224 DRM_INFO("DM_MST: added connector: %p [id: %d] [master: %p]\n",
1225 aconnector, connector->base.id, aconnector->mst_port);
1226
1227 @@ -432,6 +406,9 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
1228 static void dm_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
1229 struct drm_connector *connector)
1230 {
1231 + struct amdgpu_dm_connector *master = container_of(mgr, struct amdgpu_dm_connector, mst_mgr);
1232 + struct drm_device *dev = master->base.dev;
1233 + struct amdgpu_device *adev = dev->dev_private;
1234 struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
1235
1236 DRM_INFO("DM_MST: Disabling connector: %p [id: %d] [master: %p]\n",
1237 @@ -445,7 +422,10 @@ static void dm_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
1238 aconnector->dc_sink = NULL;
1239 }
1240
1241 - aconnector->mst_connected = false;
1242 + drm_connector_unregister(connector);
1243 + if (adev->mode_info.rfbdev)
1244 + drm_fb_helper_remove_one_connector(&adev->mode_info.rfbdev->helper, connector);
1245 + drm_connector_put(connector);
1246 }
1247
1248 static void dm_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr)
1249 @@ -456,18 +436,10 @@ static void dm_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr)
1250 drm_kms_helper_hotplug_event(dev);
1251 }
1252
1253 -static void dm_dp_mst_link_status_reset(struct drm_connector *connector)
1254 -{
1255 - mutex_lock(&connector->dev->mode_config.mutex);
1256 - drm_connector_set_link_status_property(connector, DRM_MODE_LINK_STATUS_BAD);
1257 - mutex_unlock(&connector->dev->mode_config.mutex);
1258 -}
1259 -
1260 static void dm_dp_mst_register_connector(struct drm_connector *connector)
1261 {
1262 struct drm_device *dev = connector->dev;
1263 struct amdgpu_device *adev = dev->dev_private;
1264 - struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
1265
1266 if (adev->mode_info.rfbdev)
1267 drm_fb_helper_add_one_connector(&adev->mode_info.rfbdev->helper, connector);
1268 @@ -475,9 +447,6 @@ static void dm_dp_mst_register_connector(struct drm_connector *connector)
1269 DRM_ERROR("adev->mode_info.rfbdev is NULL\n");
1270
1271 drm_connector_register(connector);
1272 -
1273 - if (aconnector->mst_connected)
1274 - dm_dp_mst_link_status_reset(connector);
1275 }
1276
1277 static const struct drm_dp_mst_topology_cbs dm_mst_cbs = {
1278 diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
1279 index ff0bfc65a8c1..b506e3622b08 100644
1280 --- a/drivers/gpu/drm/drm_edid.c
1281 +++ b/drivers/gpu/drm/drm_edid.c
1282 @@ -122,6 +122,9 @@ static const struct edid_quirk {
1283 /* SDC panel of Lenovo B50-80 reports 8 bpc, but is a 6 bpc panel */
1284 { "SDC", 0x3652, EDID_QUIRK_FORCE_6BPC },
1285
1286 + /* BOE model 0x0771 reports 8 bpc, but is a 6 bpc panel */
1287 + { "BOE", 0x0771, EDID_QUIRK_FORCE_6BPC },
1288 +
1289 /* Belinea 10 15 55 */
1290 { "MAX", 1516, EDID_QUIRK_PREFER_LARGE_60 },
1291 { "MAX", 0x77e, EDID_QUIRK_PREFER_LARGE_60 },
1292 diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
1293 index 94529aa82339..aef487dd8731 100644
1294 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
1295 +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
1296 @@ -164,13 +164,6 @@ static u32 decon_get_frame_count(struct decon_context *ctx, bool end)
1297 return frm;
1298 }
1299
1300 -static u32 decon_get_vblank_counter(struct exynos_drm_crtc *crtc)
1301 -{
1302 - struct decon_context *ctx = crtc->ctx;
1303 -
1304 - return decon_get_frame_count(ctx, false);
1305 -}
1306 -
1307 static void decon_setup_trigger(struct decon_context *ctx)
1308 {
1309 if (!ctx->crtc->i80_mode && !(ctx->out_type & I80_HW_TRG))
1310 @@ -536,7 +529,6 @@ static const struct exynos_drm_crtc_ops decon_crtc_ops = {
1311 .disable = decon_disable,
1312 .enable_vblank = decon_enable_vblank,
1313 .disable_vblank = decon_disable_vblank,
1314 - .get_vblank_counter = decon_get_vblank_counter,
1315 .atomic_begin = decon_atomic_begin,
1316 .update_plane = decon_update_plane,
1317 .disable_plane = decon_disable_plane,
1318 @@ -554,7 +546,6 @@ static int decon_bind(struct device *dev, struct device *master, void *data)
1319 int ret;
1320
1321 ctx->drm_dev = drm_dev;
1322 - drm_dev->max_vblank_count = 0xffffffff;
1323
1324 for (win = ctx->first_win; win < WINDOWS_NR; win++) {
1325 ctx->configs[win].pixel_formats = decon_formats;
1326 diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
1327 index eea90251808f..2696289ecc78 100644
1328 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
1329 +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
1330 @@ -162,16 +162,6 @@ static void exynos_drm_crtc_disable_vblank(struct drm_crtc *crtc)
1331 exynos_crtc->ops->disable_vblank(exynos_crtc);
1332 }
1333
1334 -static u32 exynos_drm_crtc_get_vblank_counter(struct drm_crtc *crtc)
1335 -{
1336 - struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
1337 -
1338 - if (exynos_crtc->ops->get_vblank_counter)
1339 - return exynos_crtc->ops->get_vblank_counter(exynos_crtc);
1340 -
1341 - return 0;
1342 -}
1343 -
1344 static const struct drm_crtc_funcs exynos_crtc_funcs = {
1345 .set_config = drm_atomic_helper_set_config,
1346 .page_flip = drm_atomic_helper_page_flip,
1347 @@ -181,7 +171,6 @@ static const struct drm_crtc_funcs exynos_crtc_funcs = {
1348 .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
1349 .enable_vblank = exynos_drm_crtc_enable_vblank,
1350 .disable_vblank = exynos_drm_crtc_disable_vblank,
1351 - .get_vblank_counter = exynos_drm_crtc_get_vblank_counter,
1352 };
1353
1354 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
1355 diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
1356 index c737c4bd2c19..630f1edc5de2 100644
1357 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
1358 +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
1359 @@ -133,7 +133,6 @@ struct exynos_drm_crtc_ops {
1360 void (*disable)(struct exynos_drm_crtc *crtc);
1361 int (*enable_vblank)(struct exynos_drm_crtc *crtc);
1362 void (*disable_vblank)(struct exynos_drm_crtc *crtc);
1363 - u32 (*get_vblank_counter)(struct exynos_drm_crtc *crtc);
1364 enum drm_mode_status (*mode_valid)(struct exynos_drm_crtc *crtc,
1365 const struct drm_display_mode *mode);
1366 bool (*mode_fixup)(struct exynos_drm_crtc *crtc,
1367 diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
1368 index 4aca5344863d..d6c25bea4382 100644
1369 --- a/drivers/gpu/drm/i915/i915_drv.h
1370 +++ b/drivers/gpu/drm/i915/i915_drv.h
1371 @@ -2248,7 +2248,7 @@ static inline struct scatterlist *__sg_next(struct scatterlist *sg)
1372 #define for_each_sgt_dma(__dmap, __iter, __sgt) \
1373 for ((__iter) = __sgt_iter((__sgt)->sgl, true); \
1374 ((__dmap) = (__iter).dma + (__iter).curr); \
1375 - (((__iter).curr += PAGE_SIZE) >= (__iter).max) ? \
1376 + (((__iter).curr += I915_GTT_PAGE_SIZE) >= (__iter).max) ? \
1377 (__iter) = __sgt_iter(__sg_next((__iter).sgp), true), 0 : 0)
1378
1379 /**
1380 diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
1381 index 294a143b85f5..5f57f4e1fbc8 100644
1382 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
1383 +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
1384 @@ -1058,7 +1058,7 @@ gen8_ppgtt_insert_pte_entries(struct i915_hw_ppgtt *ppgtt,
1385 do {
1386 vaddr[idx->pte] = pte_encode | iter->dma;
1387
1388 - iter->dma += PAGE_SIZE;
1389 + iter->dma += I915_GTT_PAGE_SIZE;
1390 if (iter->dma >= iter->max) {
1391 iter->sg = __sg_next(iter->sg);
1392 if (!iter->sg) {
1393 @@ -1770,7 +1770,7 @@ static void gen6_dump_ppgtt(struct i915_hw_ppgtt *base, struct seq_file *m)
1394
1395 seq_printf(m, "\t\t(%03d, %04d) %08llx: ",
1396 pde, pte,
1397 - (pde * GEN6_PTES + pte) * PAGE_SIZE);
1398 + (pde * GEN6_PTES + pte) * I915_GTT_PAGE_SIZE);
1399 for (i = 0; i < 4; i++) {
1400 if (vaddr[pte + i] != scratch_pte)
1401 seq_printf(m, " %08x", vaddr[pte + i]);
1402 @@ -1910,7 +1910,7 @@ static void gen6_ppgtt_insert_entries(struct i915_address_space *vm,
1403 do {
1404 vaddr[act_pte] = pte_encode | GEN6_PTE_ADDR_ENCODE(iter.dma);
1405
1406 - iter.dma += PAGE_SIZE;
1407 + iter.dma += I915_GTT_PAGE_SIZE;
1408 if (iter.dma == iter.max) {
1409 iter.sg = __sg_next(iter.sg);
1410 if (!iter.sg)
1411 @@ -2048,7 +2048,7 @@ static int pd_vma_bind(struct i915_vma *vma,
1412 {
1413 struct i915_ggtt *ggtt = i915_vm_to_ggtt(vma->vm);
1414 struct gen6_hw_ppgtt *ppgtt = vma->private;
1415 - u32 ggtt_offset = i915_ggtt_offset(vma) / PAGE_SIZE;
1416 + u32 ggtt_offset = i915_ggtt_offset(vma) / I915_GTT_PAGE_SIZE;
1417 struct i915_page_table *pt;
1418 unsigned int pde;
1419
1420 @@ -2174,7 +2174,7 @@ static struct i915_hw_ppgtt *gen6_ppgtt_create(struct drm_i915_private *i915)
1421 ppgtt->base.vm.i915 = i915;
1422 ppgtt->base.vm.dma = &i915->drm.pdev->dev;
1423
1424 - ppgtt->base.vm.total = I915_PDES * GEN6_PTES * PAGE_SIZE;
1425 + ppgtt->base.vm.total = I915_PDES * GEN6_PTES * I915_GTT_PAGE_SIZE;
1426
1427 i915_address_space_init(&ppgtt->base.vm, i915);
1428
1429 @@ -3031,7 +3031,7 @@ static unsigned int gen8_get_total_gtt_size(u16 bdw_gmch_ctl)
1430 bdw_gmch_ctl = 1 << bdw_gmch_ctl;
1431
1432 #ifdef CONFIG_X86_32
1433 - /* Limit 32b platforms to a 2GB GGTT: 4 << 20 / pte size * PAGE_SIZE */
1434 + /* Limit 32b platforms to a 2GB GGTT: 4 << 20 / pte size * I915_GTT_PAGE_SIZE */
1435 if (bdw_gmch_ctl > 4)
1436 bdw_gmch_ctl = 4;
1437 #endif
1438 @@ -3729,9 +3729,9 @@ rotate_pages(const dma_addr_t *in, unsigned int offset,
1439 * the entries so the sg list can be happily traversed.
1440 * The only thing we need are DMA addresses.
1441 */
1442 - sg_set_page(sg, NULL, PAGE_SIZE, 0);
1443 + sg_set_page(sg, NULL, I915_GTT_PAGE_SIZE, 0);
1444 sg_dma_address(sg) = in[offset + src_idx];
1445 - sg_dma_len(sg) = PAGE_SIZE;
1446 + sg_dma_len(sg) = I915_GTT_PAGE_SIZE;
1447 sg = sg_next(sg);
1448 src_idx -= stride;
1449 }
1450 @@ -3744,7 +3744,7 @@ static noinline struct sg_table *
1451 intel_rotate_pages(struct intel_rotation_info *rot_info,
1452 struct drm_i915_gem_object *obj)
1453 {
1454 - const unsigned long n_pages = obj->base.size / PAGE_SIZE;
1455 + const unsigned long n_pages = obj->base.size / I915_GTT_PAGE_SIZE;
1456 unsigned int size = intel_rotation_info_size(rot_info);
1457 struct sgt_iter sgt_iter;
1458 dma_addr_t dma_addr;
1459 diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c
1460 index aec253b44156..3cd7229b6e54 100644
1461 --- a/drivers/hid/hid-alps.c
1462 +++ b/drivers/hid/hid-alps.c
1463 @@ -660,6 +660,20 @@ exit:
1464 return ret;
1465 }
1466
1467 +static int alps_sp_open(struct input_dev *dev)
1468 +{
1469 + struct hid_device *hid = input_get_drvdata(dev);
1470 +
1471 + return hid_hw_open(hid);
1472 +}
1473 +
1474 +static void alps_sp_close(struct input_dev *dev)
1475 +{
1476 + struct hid_device *hid = input_get_drvdata(dev);
1477 +
1478 + hid_hw_close(hid);
1479 +}
1480 +
1481 static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
1482 {
1483 struct alps_dev *data = hid_get_drvdata(hdev);
1484 @@ -733,6 +747,10 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
1485 input2->id.version = input->id.version;
1486 input2->dev.parent = input->dev.parent;
1487
1488 + input_set_drvdata(input2, hdev);
1489 + input2->open = alps_sp_open;
1490 + input2->close = alps_sp_close;
1491 +
1492 __set_bit(EV_KEY, input2->evbit);
1493 data->sp_btn_cnt = (data->sp_btn_info & 0x0F);
1494 for (i = 0; i < data->sp_btn_cnt; i++)
1495 diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
1496 index bc49909aba8e..501c05cbec7e 100644
1497 --- a/drivers/hid/hid-ids.h
1498 +++ b/drivers/hid/hid-ids.h
1499 @@ -799,6 +799,7 @@
1500 #define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7
1501 #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9
1502 #define USB_DEVICE_ID_MS_POWER_COVER 0x07da
1503 +#define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb
1504
1505 #define USB_VENDOR_ID_MOJO 0x8282
1506 #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201
1507 @@ -921,6 +922,9 @@
1508 #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3003 0x3003
1509 #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008 0x3008
1510
1511 +#define I2C_VENDOR_ID_RAYDIUM 0x2386
1512 +#define I2C_PRODUCT_ID_RAYDIUM_4B33 0x4b33
1513 +
1514 #define USB_VENDOR_ID_RAZER 0x1532
1515 #define USB_DEVICE_ID_RAZER_BLADE_14 0x011D
1516
1517 @@ -1195,6 +1199,8 @@
1518 #define USB_DEVICE_ID_PRIMAX_MOUSE_4D22 0x4d22
1519 #define USB_DEVICE_ID_PRIMAX_KEYBOARD 0x4e05
1520 #define USB_DEVICE_ID_PRIMAX_REZEL 0x4e72
1521 +#define USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4D0F 0x4d0f
1522 +#define USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4E22 0x4e22
1523
1524
1525 #define USB_VENDOR_ID_RISO_KAGAKU 0x1294 /* Riso Kagaku Corp. */
1526 diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
1527 index 249d49b6b16c..0a0605a7e481 100644
1528 --- a/drivers/hid/hid-quirks.c
1529 +++ b/drivers/hid/hid-quirks.c
1530 @@ -106,7 +106,7 @@ static const struct hid_device_id hid_quirks[] = {
1531 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C05A), HID_QUIRK_ALWAYS_POLL },
1532 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C06A), HID_QUIRK_ALWAYS_POLL },
1533 { HID_USB_DEVICE(USB_VENDOR_ID_MCS, USB_DEVICE_ID_MCS_GAMEPADBLOCK), HID_QUIRK_MULTI_INPUT },
1534 - { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS), HID_QUIRK_NOGET },
1535 + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PIXART_MOUSE), HID_QUIRK_ALWAYS_POLL },
1536 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER), HID_QUIRK_NO_INIT_REPORTS },
1537 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE_PRO_2), HID_QUIRK_NO_INIT_REPORTS },
1538 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2), HID_QUIRK_NO_INIT_REPORTS },
1539 @@ -129,6 +129,8 @@ static const struct hid_device_id hid_quirks[] = {
1540 { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN), HID_QUIRK_NO_INIT_REPORTS },
1541 { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL },
1542 { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_MOUSE_4D22), HID_QUIRK_ALWAYS_POLL },
1543 + { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4D0F), HID_QUIRK_ALWAYS_POLL },
1544 + { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4E22), HID_QUIRK_ALWAYS_POLL },
1545 { HID_USB_DEVICE(USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS), HID_QUIRK_NOGET },
1546 { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001), HID_QUIRK_NOGET },
1547 { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3003), HID_QUIRK_NOGET },
1548 diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
1549 index 4e3592e7a3f7..88daa388e1f6 100644
1550 --- a/drivers/hid/i2c-hid/i2c-hid.c
1551 +++ b/drivers/hid/i2c-hid/i2c-hid.c
1552 @@ -48,6 +48,7 @@
1553 #define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0)
1554 #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1)
1555 #define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2)
1556 +#define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3)
1557
1558 /* flags */
1559 #define I2C_HID_STARTED 0
1560 @@ -157,6 +158,8 @@ struct i2c_hid {
1561
1562 bool irq_wake_enabled;
1563 struct mutex reset_lock;
1564 +
1565 + unsigned long sleep_delay;
1566 };
1567
1568 static const struct i2c_hid_quirks {
1569 @@ -171,6 +174,8 @@ static const struct i2c_hid_quirks {
1570 { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288,
1571 I2C_HID_QUIRK_NO_IRQ_AFTER_RESET |
1572 I2C_HID_QUIRK_NO_RUNTIME_PM },
1573 + { I2C_VENDOR_ID_RAYDIUM, I2C_PRODUCT_ID_RAYDIUM_4B33,
1574 + I2C_HID_QUIRK_DELAY_AFTER_SLEEP },
1575 { 0, 0 }
1576 };
1577
1578 @@ -386,6 +391,7 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state)
1579 {
1580 struct i2c_hid *ihid = i2c_get_clientdata(client);
1581 int ret;
1582 + unsigned long now, delay;
1583
1584 i2c_hid_dbg(ihid, "%s\n", __func__);
1585
1586 @@ -403,9 +409,22 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state)
1587 goto set_pwr_exit;
1588 }
1589
1590 + if (ihid->quirks & I2C_HID_QUIRK_DELAY_AFTER_SLEEP &&
1591 + power_state == I2C_HID_PWR_ON) {
1592 + now = jiffies;
1593 + if (time_after(ihid->sleep_delay, now)) {
1594 + delay = jiffies_to_usecs(ihid->sleep_delay - now);
1595 + usleep_range(delay, delay + 1);
1596 + }
1597 + }
1598 +
1599 ret = __i2c_hid_command(client, &hid_set_power_cmd, power_state,
1600 0, NULL, 0, NULL, 0);
1601
1602 + if (ihid->quirks & I2C_HID_QUIRK_DELAY_AFTER_SLEEP &&
1603 + power_state == I2C_HID_PWR_SLEEP)
1604 + ihid->sleep_delay = jiffies + msecs_to_jiffies(20);
1605 +
1606 if (ret)
1607 dev_err(&client->dev, "failed to change power setting.\n");
1608
1609 diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
1610 index 3c5507313606..051639c09f72 100644
1611 --- a/drivers/hid/uhid.c
1612 +++ b/drivers/hid/uhid.c
1613 @@ -12,6 +12,7 @@
1614
1615 #include <linux/atomic.h>
1616 #include <linux/compat.h>
1617 +#include <linux/cred.h>
1618 #include <linux/device.h>
1619 #include <linux/fs.h>
1620 #include <linux/hid.h>
1621 @@ -722,6 +723,17 @@ static ssize_t uhid_char_write(struct file *file, const char __user *buffer,
1622
1623 switch (uhid->input_buf.type) {
1624 case UHID_CREATE:
1625 + /*
1626 + * 'struct uhid_create_req' contains a __user pointer which is
1627 + * copied from, so it's unsafe to allow this with elevated
1628 + * privileges (e.g. from a setuid binary) or via kernel_write().
1629 + */
1630 + if (file->f_cred != current_cred() || uaccess_kernel()) {
1631 + pr_err_once("UHID_CREATE from different security context by process %d (%s), this is not allowed.\n",
1632 + task_tgid_vnr(current), current->comm);
1633 + ret = -EACCES;
1634 + goto unlock;
1635 + }
1636 ret = uhid_dev_create(uhid, &uhid->input_buf);
1637 break;
1638 case UHID_CREATE2:
1639 diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c
1640 index 83472808c816..64d05edff130 100644
1641 --- a/drivers/hwmon/ibmpowernv.c
1642 +++ b/drivers/hwmon/ibmpowernv.c
1643 @@ -181,7 +181,7 @@ static ssize_t show_label(struct device *dev, struct device_attribute *devattr,
1644 return sprintf(buf, "%s\n", sdata->label);
1645 }
1646
1647 -static int __init get_logical_cpu(int hwcpu)
1648 +static int get_logical_cpu(int hwcpu)
1649 {
1650 int cpu;
1651
1652 @@ -192,9 +192,8 @@ static int __init get_logical_cpu(int hwcpu)
1653 return -ENOENT;
1654 }
1655
1656 -static void __init make_sensor_label(struct device_node *np,
1657 - struct sensor_data *sdata,
1658 - const char *label)
1659 +static void make_sensor_label(struct device_node *np,
1660 + struct sensor_data *sdata, const char *label)
1661 {
1662 u32 id;
1663 size_t n;
1664 diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
1665 index 451d4ae50e66..ac4b09642f63 100644
1666 --- a/drivers/i2c/busses/Kconfig
1667 +++ b/drivers/i2c/busses/Kconfig
1668 @@ -751,7 +751,7 @@ config I2C_OCORES
1669
1670 config I2C_OMAP
1671 tristate "OMAP I2C adapter"
1672 - depends on ARCH_OMAP
1673 + depends on ARCH_OMAP || ARCH_K3
1674 default y if MACH_OMAP_H3 || MACH_OMAP_OSK
1675 help
1676 If you say yes to this option, support will be included for the
1677 diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
1678 index 9f2eb02481d3..d7329177b0ea 100644
1679 --- a/drivers/i2c/busses/i2c-qcom-geni.c
1680 +++ b/drivers/i2c/busses/i2c-qcom-geni.c
1681 @@ -590,18 +590,19 @@ static int geni_i2c_probe(struct platform_device *pdev)
1682
1683 dev_dbg(&pdev->dev, "i2c fifo/se-dma mode. fifo depth:%d\n", tx_depth);
1684
1685 - ret = i2c_add_adapter(&gi2c->adap);
1686 - if (ret) {
1687 - dev_err(&pdev->dev, "Error adding i2c adapter %d\n", ret);
1688 - return ret;
1689 - }
1690 -
1691 gi2c->suspended = 1;
1692 pm_runtime_set_suspended(gi2c->se.dev);
1693 pm_runtime_set_autosuspend_delay(gi2c->se.dev, I2C_AUTO_SUSPEND_DELAY);
1694 pm_runtime_use_autosuspend(gi2c->se.dev);
1695 pm_runtime_enable(gi2c->se.dev);
1696
1697 + ret = i2c_add_adapter(&gi2c->adap);
1698 + if (ret) {
1699 + dev_err(&pdev->dev, "Error adding i2c adapter %d\n", ret);
1700 + pm_runtime_disable(gi2c->se.dev);
1701 + return ret;
1702 + }
1703 +
1704 return 0;
1705 }
1706
1707 @@ -609,8 +610,8 @@ static int geni_i2c_remove(struct platform_device *pdev)
1708 {
1709 struct geni_i2c_dev *gi2c = platform_get_drvdata(pdev);
1710
1711 - pm_runtime_disable(gi2c->se.dev);
1712 i2c_del_adapter(&gi2c->adap);
1713 + pm_runtime_disable(gi2c->se.dev);
1714 return 0;
1715 }
1716
1717 diff --git a/drivers/media/v4l2-core/v4l2-event.c b/drivers/media/v4l2-core/v4l2-event.c
1718 index a3ef1f50a4b3..481e3c65cf97 100644
1719 --- a/drivers/media/v4l2-core/v4l2-event.c
1720 +++ b/drivers/media/v4l2-core/v4l2-event.c
1721 @@ -193,6 +193,22 @@ int v4l2_event_pending(struct v4l2_fh *fh)
1722 }
1723 EXPORT_SYMBOL_GPL(v4l2_event_pending);
1724
1725 +static void __v4l2_event_unsubscribe(struct v4l2_subscribed_event *sev)
1726 +{
1727 + struct v4l2_fh *fh = sev->fh;
1728 + unsigned int i;
1729 +
1730 + lockdep_assert_held(&fh->subscribe_lock);
1731 + assert_spin_locked(&fh->vdev->fh_lock);
1732 +
1733 + /* Remove any pending events for this subscription */
1734 + for (i = 0; i < sev->in_use; i++) {
1735 + list_del(&sev->events[sev_pos(sev, i)].list);
1736 + fh->navailable--;
1737 + }
1738 + list_del(&sev->list);
1739 +}
1740 +
1741 int v4l2_event_subscribe(struct v4l2_fh *fh,
1742 const struct v4l2_event_subscription *sub, unsigned elems,
1743 const struct v4l2_subscribed_event_ops *ops)
1744 @@ -224,27 +240,23 @@ int v4l2_event_subscribe(struct v4l2_fh *fh,
1745
1746 spin_lock_irqsave(&fh->vdev->fh_lock, flags);
1747 found_ev = v4l2_event_subscribed(fh, sub->type, sub->id);
1748 + if (!found_ev)
1749 + list_add(&sev->list, &fh->subscribed);
1750 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
1751
1752 if (found_ev) {
1753 /* Already listening */
1754 kvfree(sev);
1755 - goto out_unlock;
1756 - }
1757 -
1758 - if (sev->ops && sev->ops->add) {
1759 + } else if (sev->ops && sev->ops->add) {
1760 ret = sev->ops->add(sev, elems);
1761 if (ret) {
1762 + spin_lock_irqsave(&fh->vdev->fh_lock, flags);
1763 + __v4l2_event_unsubscribe(sev);
1764 + spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
1765 kvfree(sev);
1766 - goto out_unlock;
1767 }
1768 }
1769
1770 - spin_lock_irqsave(&fh->vdev->fh_lock, flags);
1771 - list_add(&sev->list, &fh->subscribed);
1772 - spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
1773 -
1774 -out_unlock:
1775 mutex_unlock(&fh->subscribe_lock);
1776
1777 return ret;
1778 @@ -279,7 +291,6 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh,
1779 {
1780 struct v4l2_subscribed_event *sev;
1781 unsigned long flags;
1782 - int i;
1783
1784 if (sub->type == V4L2_EVENT_ALL) {
1785 v4l2_event_unsubscribe_all(fh);
1786 @@ -291,14 +302,8 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh,
1787 spin_lock_irqsave(&fh->vdev->fh_lock, flags);
1788
1789 sev = v4l2_event_subscribed(fh, sub->type, sub->id);
1790 - if (sev != NULL) {
1791 - /* Remove any pending events for this subscription */
1792 - for (i = 0; i < sev->in_use; i++) {
1793 - list_del(&sev->events[sev_pos(sev, i)].list);
1794 - fh->navailable--;
1795 - }
1796 - list_del(&sev->list);
1797 - }
1798 + if (sev != NULL)
1799 + __v4l2_event_unsubscribe(sev);
1800
1801 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
1802
1803 diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
1804 index b2a0340f277e..d8e3cc2dc747 100644
1805 --- a/drivers/misc/atmel-ssc.c
1806 +++ b/drivers/misc/atmel-ssc.c
1807 @@ -132,7 +132,7 @@ static const struct of_device_id atmel_ssc_dt_ids[] = {
1808 MODULE_DEVICE_TABLE(of, atmel_ssc_dt_ids);
1809 #endif
1810
1811 -static inline const struct atmel_ssc_platform_data * __init
1812 +static inline const struct atmel_ssc_platform_data *
1813 atmel_ssc_get_driver_data(struct platform_device *pdev)
1814 {
1815 if (pdev->dev.of_node) {
1816 diff --git a/drivers/misc/sgi-gru/grukdump.c b/drivers/misc/sgi-gru/grukdump.c
1817 index 313da3150262..1540a7785e14 100644
1818 --- a/drivers/misc/sgi-gru/grukdump.c
1819 +++ b/drivers/misc/sgi-gru/grukdump.c
1820 @@ -27,6 +27,9 @@
1821 #include <linux/delay.h>
1822 #include <linux/bitops.h>
1823 #include <asm/uv/uv_hub.h>
1824 +
1825 +#include <linux/nospec.h>
1826 +
1827 #include "gru.h"
1828 #include "grutables.h"
1829 #include "gruhandles.h"
1830 @@ -196,6 +199,7 @@ int gru_dump_chiplet_request(unsigned long arg)
1831 /* Currently, only dump by gid is implemented */
1832 if (req.gid >= gru_max_gids)
1833 return -EINVAL;
1834 + req.gid = array_index_nospec(req.gid, gru_max_gids);
1835
1836 gru = GID_TO_GRU(req.gid);
1837 ubuf = req.buf;
1838 diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
1839 index a594fb1e9a99..32e95af486a2 100644
1840 --- a/drivers/mtd/nand/raw/atmel/nand-controller.c
1841 +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
1842 @@ -2061,8 +2061,7 @@ atmel_hsmc_nand_controller_legacy_init(struct atmel_hsmc_nand_controller *nc)
1843 int ret;
1844
1845 nand_np = dev->of_node;
1846 - nfc_np = of_find_compatible_node(dev->of_node, NULL,
1847 - "atmel,sama5d3-nfc");
1848 + nfc_np = of_get_compatible_child(dev->of_node, "atmel,sama5d3-nfc");
1849 if (!nfc_np) {
1850 dev_err(dev, "Could not find device node for sama5d3-nfc\n");
1851 return -ENODEV;
1852 @@ -2476,15 +2475,19 @@ static int atmel_nand_controller_probe(struct platform_device *pdev)
1853 }
1854
1855 if (caps->legacy_of_bindings) {
1856 + struct device_node *nfc_node;
1857 u32 ale_offs = 21;
1858
1859 /*
1860 * If we are parsing legacy DT props and the DT contains a
1861 * valid NFC node, forward the request to the sama5 logic.
1862 */
1863 - if (of_find_compatible_node(pdev->dev.of_node, NULL,
1864 - "atmel,sama5d3-nfc"))
1865 + nfc_node = of_get_compatible_child(pdev->dev.of_node,
1866 + "atmel,sama5d3-nfc");
1867 + if (nfc_node) {
1868 caps = &atmel_sama5_nand_caps;
1869 + of_node_put(nfc_node);
1870 + }
1871
1872 /*
1873 * Even if the compatible says we are dealing with an
1874 diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
1875 index b939a4c10b84..c89c7d4900d7 100644
1876 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
1877 +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
1878 @@ -528,7 +528,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
1879 context = &priv->tx_contexts[i];
1880
1881 context->echo_index = i;
1882 - can_put_echo_skb(skb, netdev, context->echo_index);
1883 ++priv->active_tx_contexts;
1884 if (priv->active_tx_contexts >= (int)dev->max_tx_urbs)
1885 netif_stop_queue(netdev);
1886 @@ -553,7 +552,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
1887 dev_kfree_skb(skb);
1888 spin_lock_irqsave(&priv->tx_contexts_lock, flags);
1889
1890 - can_free_echo_skb(netdev, context->echo_index);
1891 context->echo_index = dev->max_tx_urbs;
1892 --priv->active_tx_contexts;
1893 netif_wake_queue(netdev);
1894 @@ -564,6 +562,8 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
1895
1896 context->priv = priv;
1897
1898 + can_put_echo_skb(skb, netdev, context->echo_index);
1899 +
1900 usb_fill_bulk_urb(urb, dev->udev,
1901 usb_sndbulkpipe(dev->udev,
1902 dev->bulk_out->bEndpointAddress),
1903 diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
1904 index c084bae5ec0a..5fc0be564274 100644
1905 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
1906 +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
1907 @@ -1019,6 +1019,11 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_priv *priv,
1908 new_state : CAN_STATE_ERROR_ACTIVE;
1909
1910 can_change_state(netdev, cf, tx_state, rx_state);
1911 +
1912 + if (priv->can.restart_ms &&
1913 + old_state >= CAN_STATE_BUS_OFF &&
1914 + new_state < CAN_STATE_BUS_OFF)
1915 + cf->can_id |= CAN_ERR_RESTARTED;
1916 }
1917
1918 if (new_state == CAN_STATE_BUS_OFF) {
1919 @@ -1028,11 +1033,6 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_priv *priv,
1920
1921 can_bus_off(netdev);
1922 }
1923 -
1924 - if (priv->can.restart_ms &&
1925 - old_state >= CAN_STATE_BUS_OFF &&
1926 - new_state < CAN_STATE_BUS_OFF)
1927 - cf->can_id |= CAN_ERR_RESTARTED;
1928 }
1929
1930 if (!skb) {
1931 diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
1932 index 26dc6782b475..4f34808f1e06 100644
1933 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
1934 +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
1935 @@ -590,7 +590,7 @@ int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev)
1936 }
1937 }
1938
1939 - if (i > 0 && i < AQ_HW_MULTICAST_ADDRESS_MAX) {
1940 + if (i > 0 && i <= AQ_HW_MULTICAST_ADDRESS_MAX) {
1941 packet_filter |= IFF_MULTICAST;
1942 self->mc_list.count = i;
1943 self->aq_hw_ops->hw_multicast_list_set(self->aq_hw,
1944 diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
1945 index d1e1a0ba8615..7134d0d4cdf7 100644
1946 --- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
1947 +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
1948 @@ -172,6 +172,27 @@ bool aq_ring_tx_clean(struct aq_ring_s *self)
1949 return !!budget;
1950 }
1951
1952 +static void aq_rx_checksum(struct aq_ring_s *self,
1953 + struct aq_ring_buff_s *buff,
1954 + struct sk_buff *skb)
1955 +{
1956 + if (!(self->aq_nic->ndev->features & NETIF_F_RXCSUM))
1957 + return;
1958 +
1959 + if (unlikely(buff->is_cso_err)) {
1960 + ++self->stats.rx.errors;
1961 + skb->ip_summed = CHECKSUM_NONE;
1962 + return;
1963 + }
1964 + if (buff->is_ip_cso) {
1965 + __skb_incr_checksum_unnecessary(skb);
1966 + if (buff->is_udp_cso || buff->is_tcp_cso)
1967 + __skb_incr_checksum_unnecessary(skb);
1968 + } else {
1969 + skb->ip_summed = CHECKSUM_NONE;
1970 + }
1971 +}
1972 +
1973 #define AQ_SKB_ALIGN SKB_DATA_ALIGN(sizeof(struct skb_shared_info))
1974 int aq_ring_rx_clean(struct aq_ring_s *self,
1975 struct napi_struct *napi,
1976 @@ -267,18 +288,8 @@ int aq_ring_rx_clean(struct aq_ring_s *self,
1977 }
1978
1979 skb->protocol = eth_type_trans(skb, ndev);
1980 - if (unlikely(buff->is_cso_err)) {
1981 - ++self->stats.rx.errors;
1982 - skb->ip_summed = CHECKSUM_NONE;
1983 - } else {
1984 - if (buff->is_ip_cso) {
1985 - __skb_incr_checksum_unnecessary(skb);
1986 - if (buff->is_udp_cso || buff->is_tcp_cso)
1987 - __skb_incr_checksum_unnecessary(skb);
1988 - } else {
1989 - skb->ip_summed = CHECKSUM_NONE;
1990 - }
1991 - }
1992 +
1993 + aq_rx_checksum(self, buff, skb);
1994
1995 skb_set_hash(skb, buff->rss_hash,
1996 buff->is_hash_l4 ? PKT_HASH_TYPE_L4 :
1997 diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
1998 index 1d44a386e7d3..88705dee5b95 100644
1999 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
2000 +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
2001 @@ -655,9 +655,9 @@ static int hw_atl_b0_hw_ring_rx_receive(struct aq_hw_s *self,
2002 struct hw_atl_rxd_wb_s *rxd_wb = (struct hw_atl_rxd_wb_s *)
2003 &ring->dx_ring[ring->hw_head * HW_ATL_B0_RXD_SIZE];
2004
2005 - unsigned int is_err = 1U;
2006 unsigned int is_rx_check_sum_enabled = 0U;
2007 unsigned int pkt_type = 0U;
2008 + u8 rx_stat = 0U;
2009
2010 if (!(rxd_wb->status & 0x1U)) { /* RxD is not done */
2011 break;
2012 @@ -665,35 +665,35 @@ static int hw_atl_b0_hw_ring_rx_receive(struct aq_hw_s *self,
2013
2014 buff = &ring->buff_ring[ring->hw_head];
2015
2016 - is_err = (0x0000003CU & rxd_wb->status);
2017 + rx_stat = (0x0000003CU & rxd_wb->status) >> 2;
2018
2019 is_rx_check_sum_enabled = (rxd_wb->type) & (0x3U << 19);
2020 - is_err &= ~0x20U; /* exclude validity bit */
2021
2022 pkt_type = 0xFFU & (rxd_wb->type >> 4);
2023
2024 - if (is_rx_check_sum_enabled) {
2025 - if (0x0U == (pkt_type & 0x3U))
2026 - buff->is_ip_cso = (is_err & 0x08U) ? 0U : 1U;
2027 + if (is_rx_check_sum_enabled & BIT(0) &&
2028 + (0x0U == (pkt_type & 0x3U)))
2029 + buff->is_ip_cso = (rx_stat & BIT(1)) ? 0U : 1U;
2030
2031 + if (is_rx_check_sum_enabled & BIT(1)) {
2032 if (0x4U == (pkt_type & 0x1CU))
2033 - buff->is_udp_cso = buff->is_cso_err ? 0U : 1U;
2034 + buff->is_udp_cso = (rx_stat & BIT(2)) ? 0U :
2035 + !!(rx_stat & BIT(3));
2036 else if (0x0U == (pkt_type & 0x1CU))
2037 - buff->is_tcp_cso = buff->is_cso_err ? 0U : 1U;
2038 -
2039 - /* Checksum offload workaround for small packets */
2040 - if (rxd_wb->pkt_len <= 60) {
2041 - buff->is_ip_cso = 0U;
2042 - buff->is_cso_err = 0U;
2043 - }
2044 + buff->is_tcp_cso = (rx_stat & BIT(2)) ? 0U :
2045 + !!(rx_stat & BIT(3));
2046 + }
2047 + buff->is_cso_err = !!(rx_stat & 0x6);
2048 + /* Checksum offload workaround for small packets */
2049 + if (unlikely(rxd_wb->pkt_len <= 60)) {
2050 + buff->is_ip_cso = 0U;
2051 + buff->is_cso_err = 0U;
2052 }
2053 -
2054 - is_err &= ~0x18U;
2055
2056 dma_unmap_page(ndev, buff->pa, buff->len, DMA_FROM_DEVICE);
2057
2058 - if (is_err || rxd_wb->type & 0x1000U) {
2059 - /* status error or DMA error */
2060 + if ((rx_stat & BIT(0)) || rxd_wb->type & 0x1000U) {
2061 + /* MAC error or DMA error */
2062 buff->is_error = 1U;
2063 } else {
2064 if (self->aq_nic_cfg->is_rss) {
2065 @@ -915,6 +915,12 @@ static int hw_atl_b0_hw_interrupt_moderation_set(struct aq_hw_s *self)
2066 static int hw_atl_b0_hw_stop(struct aq_hw_s *self)
2067 {
2068 hw_atl_b0_hw_irq_disable(self, HW_ATL_B0_INT_MASK);
2069 +
2070 + /* Invalidate Descriptor Cache to prevent writing to the cached
2071 + * descriptors and to the data pointer of those descriptors
2072 + */
2073 + hw_atl_rdm_rx_dma_desc_cache_init_set(self, 1);
2074 +
2075 return aq_hw_err_from_flags(self);
2076 }
2077
2078 diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c
2079 index 10ba035dadb1..10ec5dc88e24 100644
2080 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c
2081 +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c
2082 @@ -619,6 +619,14 @@ void hw_atl_rpb_rx_flow_ctl_mode_set(struct aq_hw_s *aq_hw, u32 rx_flow_ctl_mode
2083 HW_ATL_RPB_RX_FC_MODE_SHIFT, rx_flow_ctl_mode);
2084 }
2085
2086 +void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init)
2087 +{
2088 + aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR,
2089 + HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK,
2090 + HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT,
2091 + init);
2092 +}
2093 +
2094 void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw,
2095 u32 rx_pkt_buff_size_per_tc, u32 buffer)
2096 {
2097 diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h
2098 index dfb426f2dc2c..b3bf64b48b93 100644
2099 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h
2100 +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h
2101 @@ -325,6 +325,9 @@ void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw,
2102 u32 rx_pkt_buff_size_per_tc,
2103 u32 buffer);
2104
2105 +/* set rdm rx dma descriptor cache init */
2106 +void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init);
2107 +
2108 /* set rx xoff enable (per tc) */
2109 void hw_atl_rpb_rx_xoff_en_per_tc_set(struct aq_hw_s *aq_hw, u32 rx_xoff_en_per_tc,
2110 u32 buffer);
2111 diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h
2112 index e0cf70120f1d..e2ecdb1c5a5c 100644
2113 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h
2114 +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h
2115 @@ -293,6 +293,24 @@
2116 /* default value of bitfield desc{d}_reset */
2117 #define HW_ATL_RDM_DESCDRESET_DEFAULT 0x0
2118
2119 +/* rdm_desc_init_i bitfield definitions
2120 + * preprocessor definitions for the bitfield rdm_desc_init_i.
2121 + * port="pif_rdm_desc_init_i"
2122 + */
2123 +
2124 +/* register address for bitfield rdm_desc_init_i */
2125 +#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR 0x00005a00
2126 +/* bitmask for bitfield rdm_desc_init_i */
2127 +#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK 0xffffffff
2128 +/* inverted bitmask for bitfield rdm_desc_init_i */
2129 +#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSKN 0x00000000
2130 +/* lower bit position of bitfield rdm_desc_init_i */
2131 +#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT 0
2132 +/* width of bitfield rdm_desc_init_i */
2133 +#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_WIDTH 32
2134 +/* default value of bitfield rdm_desc_init_i */
2135 +#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_DEFAULT 0x0
2136 +
2137 /* rx int_desc_wrb_en bitfield definitions
2138 * preprocessor definitions for the bitfield "int_desc_wrb_en".
2139 * port="pif_rdm_int_desc_wrb_en_i"
2140 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
2141 index ac13cb2b168e..68026a5ad7e7 100644
2142 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
2143 +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
2144 @@ -304,6 +304,10 @@ int hclge_cmd_queue_init(struct hclge_dev *hdev)
2145 {
2146 int ret;
2147
2148 + /* Setup the lock for command queue */
2149 + spin_lock_init(&hdev->hw.cmq.csq.lock);
2150 + spin_lock_init(&hdev->hw.cmq.crq.lock);
2151 +
2152 /* Setup the queue entries for use cmd queue */
2153 hdev->hw.cmq.csq.desc_num = HCLGE_NIC_CMQ_DESC_NUM;
2154 hdev->hw.cmq.crq.desc_num = HCLGE_NIC_CMQ_DESC_NUM;
2155 @@ -337,18 +341,20 @@ int hclge_cmd_init(struct hclge_dev *hdev)
2156 u32 version;
2157 int ret;
2158
2159 + spin_lock_bh(&hdev->hw.cmq.csq.lock);
2160 + spin_lock_bh(&hdev->hw.cmq.crq.lock);
2161 +
2162 hdev->hw.cmq.csq.next_to_clean = 0;
2163 hdev->hw.cmq.csq.next_to_use = 0;
2164 hdev->hw.cmq.crq.next_to_clean = 0;
2165 hdev->hw.cmq.crq.next_to_use = 0;
2166
2167 - /* Setup the lock for command queue */
2168 - spin_lock_init(&hdev->hw.cmq.csq.lock);
2169 - spin_lock_init(&hdev->hw.cmq.crq.lock);
2170 -
2171 hclge_cmd_init_regs(&hdev->hw);
2172 clear_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state);
2173
2174 + spin_unlock_bh(&hdev->hw.cmq.crq.lock);
2175 + spin_unlock_bh(&hdev->hw.cmq.csq.lock);
2176 +
2177 ret = hclge_cmd_query_firmware_version(&hdev->hw, &version);
2178 if (ret) {
2179 dev_err(&hdev->pdev->dev,
2180 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
2181 index db763450e5e3..340baf6a470c 100644
2182 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
2183 +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
2184 @@ -2804,14 +2804,17 @@ static void hclge_reset(struct hclge_dev *hdev)
2185 handle = &hdev->vport[0].nic;
2186 rtnl_lock();
2187 hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
2188 + rtnl_unlock();
2189
2190 if (!hclge_reset_wait(hdev)) {
2191 + rtnl_lock();
2192 hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT);
2193 hclge_reset_ae_dev(hdev->ae_dev);
2194 hclge_notify_client(hdev, HNAE3_INIT_CLIENT);
2195
2196 hclge_clear_reset_cause(hdev);
2197 } else {
2198 + rtnl_lock();
2199 /* schedule again to check pending resets later */
2200 set_bit(hdev->reset_type, &hdev->reset_pending);
2201 hclge_reset_task_schedule(hdev);
2202 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
2203 index f34851c91eb3..e08e82020402 100644
2204 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
2205 +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
2206 @@ -458,6 +458,12 @@ void hclge_mbx_handler(struct hclge_dev *hdev)
2207
2208 /* handle all the mailbox requests in the queue */
2209 while (!hclge_cmd_crq_empty(&hdev->hw)) {
2210 + if (test_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state)) {
2211 + dev_warn(&hdev->pdev->dev,
2212 + "command queue needs re-initializing\n");
2213 + return;
2214 + }
2215 +
2216 desc = &crq->desc[crq->next_to_use];
2217 req = (struct hclge_mbx_vf_to_pf_cmd *)desc->data;
2218
2219 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
2220 index 5db70a1451c5..48235dc2dd56 100644
2221 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
2222 +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
2223 @@ -1167,14 +1167,14 @@ static int hclge_pfc_setup_hw(struct hclge_dev *hdev)
2224 */
2225 static int hclge_bp_setup_hw(struct hclge_dev *hdev, u8 tc)
2226 {
2227 - struct hclge_vport *vport = hdev->vport;
2228 - u32 i, k, qs_bitmap;
2229 - int ret;
2230 + int i;
2231
2232 for (i = 0; i < HCLGE_BP_GRP_NUM; i++) {
2233 - qs_bitmap = 0;
2234 + u32 qs_bitmap = 0;
2235 + int k, ret;
2236
2237 for (k = 0; k < hdev->num_alloc_vport; k++) {
2238 + struct hclge_vport *vport = &hdev->vport[k];
2239 u16 qs_id = vport->qs_offset + tc;
2240 u8 grp, sub_grp;
2241
2242 @@ -1184,8 +1184,6 @@ static int hclge_bp_setup_hw(struct hclge_dev *hdev, u8 tc)
2243 HCLGE_BP_SUB_GRP_ID_S);
2244 if (i == grp)
2245 qs_bitmap |= (1 << sub_grp);
2246 -
2247 - vport++;
2248 }
2249
2250 ret = hclge_tm_qs_bp_cfg(hdev, tc, i, qs_bitmap);
2251 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
2252 index 320043e87fc6..5570fb5dc2eb 100644
2253 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
2254 +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
2255 @@ -1065,6 +1065,8 @@ static int hclgevf_reset(struct hclgevf_dev *hdev)
2256 /* bring down the nic to stop any ongoing TX/RX */
2257 hclgevf_notify_client(hdev, HNAE3_DOWN_CLIENT);
2258
2259 + rtnl_unlock();
2260 +
2261 /* check if VF could successfully fetch the hardware reset completion
2262 * status from the hardware
2263 */
2264 @@ -1076,12 +1078,15 @@ static int hclgevf_reset(struct hclgevf_dev *hdev)
2265 ret);
2266
2267 dev_warn(&hdev->pdev->dev, "VF reset failed, disabling VF!\n");
2268 + rtnl_lock();
2269 hclgevf_notify_client(hdev, HNAE3_UNINIT_CLIENT);
2270
2271 rtnl_unlock();
2272 return ret;
2273 }
2274
2275 + rtnl_lock();
2276 +
2277 /* now, re-initialize the nic client and ae device*/
2278 ret = hclgevf_reset_stack(hdev);
2279 if (ret)
2280 diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
2281 index ac685ad4d877..6eccfa82ca94 100644
2282 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
2283 +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
2284 @@ -11926,6 +11926,8 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
2285 NETIF_F_GSO_GRE |
2286 NETIF_F_GSO_GRE_CSUM |
2287 NETIF_F_GSO_PARTIAL |
2288 + NETIF_F_GSO_IPXIP4 |
2289 + NETIF_F_GSO_IPXIP6 |
2290 NETIF_F_GSO_UDP_TUNNEL |
2291 NETIF_F_GSO_UDP_TUNNEL_CSUM |
2292 NETIF_F_SCTP_CRC |
2293 diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
2294 index 9d6754f65a1a..4c5c87b158f5 100644
2295 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
2296 +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
2297 @@ -797,10 +797,15 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)
2298 }
2299
2300 if (!test_bit(__ICE_DOWN, pf->state)) {
2301 - /* Give it a little more time to try to come back */
2302 + /* Give it a little more time to try to come back. If still
2303 + * down, restart autoneg link or reinitialize the interface.
2304 + */
2305 msleep(75);
2306 if (!test_bit(__ICE_DOWN, pf->state))
2307 return ice_nway_reset(netdev);
2308 +
2309 + ice_down(vsi);
2310 + ice_up(vsi);
2311 }
2312
2313 return err;
2314 diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c
2315 index 6481e3d86374..0c95c8f83432 100644
2316 --- a/drivers/net/ethernet/intel/ice/ice_txrx.c
2317 +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c
2318 @@ -1519,7 +1519,7 @@ int ice_tso(struct ice_tx_buf *first, struct ice_tx_offload_params *off)
2319
2320 /* update gso_segs and bytecount */
2321 first->gso_segs = skb_shinfo(skb)->gso_segs;
2322 - first->bytecount = (first->gso_segs - 1) * off->header_len;
2323 + first->bytecount += (first->gso_segs - 1) * off->header_len;
2324
2325 cd_tso_len = skb->len - off->header_len;
2326 cd_mss = skb_shinfo(skb)->gso_size;
2327 diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h
2328 index 97c366e0ca59..ba11b5898833 100644
2329 --- a/drivers/net/ethernet/intel/ice/ice_type.h
2330 +++ b/drivers/net/ethernet/intel/ice/ice_type.h
2331 @@ -83,12 +83,12 @@ struct ice_link_status {
2332 u64 phy_type_low;
2333 u16 max_frame_size;
2334 u16 link_speed;
2335 + u16 req_speeds;
2336 u8 lse_ena; /* Link Status Event notification */
2337 u8 link_info;
2338 u8 an_info;
2339 u8 ext_info;
2340 u8 pacing;
2341 - u8 req_speeds;
2342 /* Refer to #define from module_type[ICE_MODULE_TYPE_TOTAL_BYTE] of
2343 * ice_aqc_get_phy_caps structure
2344 */
2345 diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
2346 index 3c6f01c41b78..eea63a99f29c 100644
2347 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
2348 +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
2349 @@ -721,8 +721,10 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)
2350 ixgbe_set_vmvir(adapter, vfinfo->pf_vlan,
2351 adapter->default_up, vf);
2352
2353 - if (vfinfo->spoofchk_enabled)
2354 + if (vfinfo->spoofchk_enabled) {
2355 hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf);
2356 + hw->mac.ops.set_mac_anti_spoofing(hw, true, vf);
2357 + }
2358 }
2359
2360 /* reset multicast table array for vf */
2361 diff --git a/drivers/net/ethernet/qlogic/qed/qed_fcoe.c b/drivers/net/ethernet/qlogic/qed/qed_fcoe.c
2362 index cc1b373c0ace..46dc93d3b9b5 100644
2363 --- a/drivers/net/ethernet/qlogic/qed/qed_fcoe.c
2364 +++ b/drivers/net/ethernet/qlogic/qed/qed_fcoe.c
2365 @@ -147,7 +147,8 @@ qed_sp_fcoe_func_start(struct qed_hwfn *p_hwfn,
2366 "Cannot satisfy CQ amount. CQs requested %d, CQs available %d. Aborting function start\n",
2367 fcoe_pf_params->num_cqs,
2368 p_hwfn->hw_info.feat_num[QED_FCOE_CQ]);
2369 - return -EINVAL;
2370 + rc = -EINVAL;
2371 + goto err;
2372 }
2373
2374 p_data->mtu = cpu_to_le16(fcoe_pf_params->mtu);
2375 @@ -156,14 +157,14 @@ qed_sp_fcoe_func_start(struct qed_hwfn *p_hwfn,
2376
2377 rc = qed_cxt_acquire_cid(p_hwfn, PROTOCOLID_FCOE, &dummy_cid);
2378 if (rc)
2379 - return rc;
2380 + goto err;
2381
2382 cxt_info.iid = dummy_cid;
2383 rc = qed_cxt_get_cid_info(p_hwfn, &cxt_info);
2384 if (rc) {
2385 DP_NOTICE(p_hwfn, "Cannot find context info for dummy cid=%d\n",
2386 dummy_cid);
2387 - return rc;
2388 + goto err;
2389 }
2390 p_cxt = cxt_info.p_cxt;
2391 SET_FIELD(p_cxt->tstorm_ag_context.flags3,
2392 @@ -240,6 +241,10 @@ qed_sp_fcoe_func_start(struct qed_hwfn *p_hwfn,
2393 rc = qed_spq_post(p_hwfn, p_ent, NULL);
2394
2395 return rc;
2396 +
2397 +err:
2398 + qed_sp_destroy_request(p_hwfn, p_ent);
2399 + return rc;
2400 }
2401
2402 static int
2403 diff --git a/drivers/net/ethernet/qlogic/qed/qed_iscsi.c b/drivers/net/ethernet/qlogic/qed/qed_iscsi.c
2404 index 1135387bd99d..4f8a685d1a55 100644
2405 --- a/drivers/net/ethernet/qlogic/qed/qed_iscsi.c
2406 +++ b/drivers/net/ethernet/qlogic/qed/qed_iscsi.c
2407 @@ -200,6 +200,7 @@ qed_sp_iscsi_func_start(struct qed_hwfn *p_hwfn,
2408 "Cannot satisfy CQ amount. Queues requested %d, CQs available %d. Aborting function start\n",
2409 p_params->num_queues,
2410 p_hwfn->hw_info.feat_num[QED_ISCSI_CQ]);
2411 + qed_sp_destroy_request(p_hwfn, p_ent);
2412 return -EINVAL;
2413 }
2414
2415 diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c
2416 index 82a1bd1f8a8c..67c02ea93906 100644
2417 --- a/drivers/net/ethernet/qlogic/qed/qed_l2.c
2418 +++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c
2419 @@ -740,8 +740,7 @@ int qed_sp_vport_update(struct qed_hwfn *p_hwfn,
2420
2421 rc = qed_sp_vport_update_rss(p_hwfn, p_ramrod, p_rss_params);
2422 if (rc) {
2423 - /* Return spq entry which is taken in qed_sp_init_request()*/
2424 - qed_spq_return_entry(p_hwfn, p_ent);
2425 + qed_sp_destroy_request(p_hwfn, p_ent);
2426 return rc;
2427 }
2428
2429 @@ -1355,6 +1354,7 @@ qed_filter_ucast_common(struct qed_hwfn *p_hwfn,
2430 DP_NOTICE(p_hwfn,
2431 "%d is not supported yet\n",
2432 p_filter_cmd->opcode);
2433 + qed_sp_destroy_request(p_hwfn, *pp_ent);
2434 return -EINVAL;
2435 }
2436
2437 @@ -2056,13 +2056,13 @@ qed_configure_rfs_ntuple_filter(struct qed_hwfn *p_hwfn,
2438 } else {
2439 rc = qed_fw_vport(p_hwfn, p_params->vport_id, &abs_vport_id);
2440 if (rc)
2441 - return rc;
2442 + goto err;
2443
2444 if (p_params->qid != QED_RFS_NTUPLE_QID_RSS) {
2445 rc = qed_fw_l2_queue(p_hwfn, p_params->qid,
2446 &abs_rx_q_id);
2447 if (rc)
2448 - return rc;
2449 + goto err;
2450
2451 p_ramrod->rx_qid_valid = 1;
2452 p_ramrod->rx_qid = cpu_to_le16(abs_rx_q_id);
2453 @@ -2083,6 +2083,10 @@ qed_configure_rfs_ntuple_filter(struct qed_hwfn *p_hwfn,
2454 (u64)p_params->addr, p_params->length);
2455
2456 return qed_spq_post(p_hwfn, p_ent, NULL);
2457 +
2458 +err:
2459 + qed_sp_destroy_request(p_hwfn, p_ent);
2460 + return rc;
2461 }
2462
2463 int qed_get_rxq_coalesce(struct qed_hwfn *p_hwfn,
2464 diff --git a/drivers/net/ethernet/qlogic/qed/qed_rdma.c b/drivers/net/ethernet/qlogic/qed/qed_rdma.c
2465 index c71391b9c757..62113438c880 100644
2466 --- a/drivers/net/ethernet/qlogic/qed/qed_rdma.c
2467 +++ b/drivers/net/ethernet/qlogic/qed/qed_rdma.c
2468 @@ -1514,6 +1514,7 @@ qed_rdma_register_tid(void *rdma_cxt,
2469 default:
2470 rc = -EINVAL;
2471 DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "rc = %d\n", rc);
2472 + qed_sp_destroy_request(p_hwfn, p_ent);
2473 return rc;
2474 }
2475 SET_FIELD(p_ramrod->flags1,
2476 diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c
2477 index f9167d1354bb..e49fada85410 100644
2478 --- a/drivers/net/ethernet/qlogic/qed/qed_roce.c
2479 +++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c
2480 @@ -745,6 +745,7 @@ static int qed_roce_sp_destroy_qp_responder(struct qed_hwfn *p_hwfn,
2481 DP_NOTICE(p_hwfn,
2482 "qed destroy responder failed: cannot allocate memory (ramrod). rc = %d\n",
2483 rc);
2484 + qed_sp_destroy_request(p_hwfn, p_ent);
2485 return rc;
2486 }
2487
2488 diff --git a/drivers/net/ethernet/qlogic/qed/qed_sp.h b/drivers/net/ethernet/qlogic/qed/qed_sp.h
2489 index e95431f6acd4..3157c0d99441 100644
2490 --- a/drivers/net/ethernet/qlogic/qed/qed_sp.h
2491 +++ b/drivers/net/ethernet/qlogic/qed/qed_sp.h
2492 @@ -167,6 +167,9 @@ struct qed_spq_entry {
2493 enum spq_mode comp_mode;
2494 struct qed_spq_comp_cb comp_cb;
2495 struct qed_spq_comp_done comp_done; /* SPQ_MODE_EBLOCK */
2496 +
2497 + /* Posted entry for unlimited list entry in EBLOCK mode */
2498 + struct qed_spq_entry *post_ent;
2499 };
2500
2501 struct qed_eq {
2502 @@ -396,6 +399,17 @@ struct qed_sp_init_data {
2503 struct qed_spq_comp_cb *p_comp_data;
2504 };
2505
2506 +/**
2507 + * @brief Returns a SPQ entry to the pool / frees the entry if allocated.
2508 + * Should be called on in error flows after initializing the SPQ entry
2509 + * and before posting it.
2510 + *
2511 + * @param p_hwfn
2512 + * @param p_ent
2513 + */
2514 +void qed_sp_destroy_request(struct qed_hwfn *p_hwfn,
2515 + struct qed_spq_entry *p_ent);
2516 +
2517 int qed_sp_init_request(struct qed_hwfn *p_hwfn,
2518 struct qed_spq_entry **pp_ent,
2519 u8 cmd,
2520 diff --git a/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c b/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c
2521 index 77b6248ad3b9..888274fa208b 100644
2522 --- a/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c
2523 +++ b/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c
2524 @@ -47,6 +47,19 @@
2525 #include "qed_sp.h"
2526 #include "qed_sriov.h"
2527
2528 +void qed_sp_destroy_request(struct qed_hwfn *p_hwfn,
2529 + struct qed_spq_entry *p_ent)
2530 +{
2531 + /* qed_spq_get_entry() can either get an entry from the free_pool,
2532 + * or, if no entries are left, allocate a new entry and add it to
2533 + * the unlimited_pending list.
2534 + */
2535 + if (p_ent->queue == &p_hwfn->p_spq->unlimited_pending)
2536 + kfree(p_ent);
2537 + else
2538 + qed_spq_return_entry(p_hwfn, p_ent);
2539 +}
2540 +
2541 int qed_sp_init_request(struct qed_hwfn *p_hwfn,
2542 struct qed_spq_entry **pp_ent,
2543 u8 cmd, u8 protocol, struct qed_sp_init_data *p_data)
2544 @@ -80,7 +93,7 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn,
2545
2546 case QED_SPQ_MODE_BLOCK:
2547 if (!p_data->p_comp_data)
2548 - return -EINVAL;
2549 + goto err;
2550
2551 p_ent->comp_cb.cookie = p_data->p_comp_data->cookie;
2552 break;
2553 @@ -95,7 +108,7 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn,
2554 default:
2555 DP_NOTICE(p_hwfn, "Unknown SPQE completion mode %d\n",
2556 p_ent->comp_mode);
2557 - return -EINVAL;
2558 + goto err;
2559 }
2560
2561 DP_VERBOSE(p_hwfn, QED_MSG_SPQ,
2562 @@ -109,6 +122,11 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn,
2563 memset(&p_ent->ramrod, 0, sizeof(p_ent->ramrod));
2564
2565 return 0;
2566 +
2567 +err:
2568 + qed_sp_destroy_request(p_hwfn, p_ent);
2569 +
2570 + return -EINVAL;
2571 }
2572
2573 static enum tunnel_clss qed_tunn_clss_to_fw_clss(u8 type)
2574 diff --git a/drivers/net/ethernet/qlogic/qed/qed_spq.c b/drivers/net/ethernet/qlogic/qed/qed_spq.c
2575 index 1673fc90027f..7106ad17afe2 100644
2576 --- a/drivers/net/ethernet/qlogic/qed/qed_spq.c
2577 +++ b/drivers/net/ethernet/qlogic/qed/qed_spq.c
2578 @@ -142,6 +142,7 @@ static int qed_spq_block(struct qed_hwfn *p_hwfn,
2579
2580 DP_INFO(p_hwfn, "Ramrod is stuck, requesting MCP drain\n");
2581 rc = qed_mcp_drain(p_hwfn, p_ptt);
2582 + qed_ptt_release(p_hwfn, p_ptt);
2583 if (rc) {
2584 DP_NOTICE(p_hwfn, "MCP drain failed\n");
2585 goto err;
2586 @@ -150,18 +151,15 @@ static int qed_spq_block(struct qed_hwfn *p_hwfn,
2587 /* Retry after drain */
2588 rc = __qed_spq_block(p_hwfn, p_ent, p_fw_ret, true);
2589 if (!rc)
2590 - goto out;
2591 + return 0;
2592
2593 comp_done = (struct qed_spq_comp_done *)p_ent->comp_cb.cookie;
2594 - if (comp_done->done == 1)
2595 + if (comp_done->done == 1) {
2596 if (p_fw_ret)
2597 *p_fw_ret = comp_done->fw_return_code;
2598 -out:
2599 - qed_ptt_release(p_hwfn, p_ptt);
2600 - return 0;
2601 -
2602 + return 0;
2603 + }
2604 err:
2605 - qed_ptt_release(p_hwfn, p_ptt);
2606 DP_NOTICE(p_hwfn,
2607 "Ramrod is stuck [CID %08x cmd %02x protocol %02x echo %04x]\n",
2608 le32_to_cpu(p_ent->elem.hdr.cid),
2609 @@ -685,6 +683,8 @@ static int qed_spq_add_entry(struct qed_hwfn *p_hwfn,
2610 /* EBLOCK responsible to free the allocated p_ent */
2611 if (p_ent->comp_mode != QED_SPQ_MODE_EBLOCK)
2612 kfree(p_ent);
2613 + else
2614 + p_ent->post_ent = p_en2;
2615
2616 p_ent = p_en2;
2617 }
2618 @@ -768,6 +768,25 @@ static int qed_spq_pend_post(struct qed_hwfn *p_hwfn)
2619 SPQ_HIGH_PRI_RESERVE_DEFAULT);
2620 }
2621
2622 +/* Avoid overriding of SPQ entries when getting out-of-order completions, by
2623 + * marking the completions in a bitmap and increasing the chain consumer only
2624 + * for the first successive completed entries.
2625 + */
2626 +static void qed_spq_comp_bmap_update(struct qed_hwfn *p_hwfn, __le16 echo)
2627 +{
2628 + u16 pos = le16_to_cpu(echo) % SPQ_RING_SIZE;
2629 + struct qed_spq *p_spq = p_hwfn->p_spq;
2630 +
2631 + __set_bit(pos, p_spq->p_comp_bitmap);
2632 + while (test_bit(p_spq->comp_bitmap_idx,
2633 + p_spq->p_comp_bitmap)) {
2634 + __clear_bit(p_spq->comp_bitmap_idx,
2635 + p_spq->p_comp_bitmap);
2636 + p_spq->comp_bitmap_idx++;
2637 + qed_chain_return_produced(&p_spq->chain);
2638 + }
2639 +}
2640 +
2641 int qed_spq_post(struct qed_hwfn *p_hwfn,
2642 struct qed_spq_entry *p_ent, u8 *fw_return_code)
2643 {
2644 @@ -825,11 +844,12 @@ int qed_spq_post(struct qed_hwfn *p_hwfn,
2645 p_ent->queue == &p_spq->unlimited_pending);
2646
2647 if (p_ent->queue == &p_spq->unlimited_pending) {
2648 - /* This is an allocated p_ent which does not need to
2649 - * return to pool.
2650 - */
2651 + struct qed_spq_entry *p_post_ent = p_ent->post_ent;
2652 +
2653 kfree(p_ent);
2654 - return rc;
2655 +
2656 + /* Return the entry which was actually posted */
2657 + p_ent = p_post_ent;
2658 }
2659
2660 if (rc)
2661 @@ -843,7 +863,7 @@ int qed_spq_post(struct qed_hwfn *p_hwfn,
2662 spq_post_fail2:
2663 spin_lock_bh(&p_spq->lock);
2664 list_del(&p_ent->list);
2665 - qed_chain_return_produced(&p_spq->chain);
2666 + qed_spq_comp_bmap_update(p_hwfn, p_ent->elem.hdr.echo);
2667
2668 spq_post_fail:
2669 /* return to the free pool */
2670 @@ -875,25 +895,8 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn,
2671 spin_lock_bh(&p_spq->lock);
2672 list_for_each_entry_safe(p_ent, tmp, &p_spq->completion_pending, list) {
2673 if (p_ent->elem.hdr.echo == echo) {
2674 - u16 pos = le16_to_cpu(echo) % SPQ_RING_SIZE;
2675 -
2676 list_del(&p_ent->list);
2677 -
2678 - /* Avoid overriding of SPQ entries when getting
2679 - * out-of-order completions, by marking the completions
2680 - * in a bitmap and increasing the chain consumer only
2681 - * for the first successive completed entries.
2682 - */
2683 - __set_bit(pos, p_spq->p_comp_bitmap);
2684 -
2685 - while (test_bit(p_spq->comp_bitmap_idx,
2686 - p_spq->p_comp_bitmap)) {
2687 - __clear_bit(p_spq->comp_bitmap_idx,
2688 - p_spq->p_comp_bitmap);
2689 - p_spq->comp_bitmap_idx++;
2690 - qed_chain_return_produced(&p_spq->chain);
2691 - }
2692 -
2693 + qed_spq_comp_bmap_update(p_hwfn, echo);
2694 p_spq->comp_count++;
2695 found = p_ent;
2696 break;
2697 @@ -932,11 +935,9 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn,
2698 QED_MSG_SPQ,
2699 "Got a completion without a callback function\n");
2700
2701 - if ((found->comp_mode != QED_SPQ_MODE_EBLOCK) ||
2702 - (found->queue == &p_spq->unlimited_pending))
2703 + if (found->comp_mode != QED_SPQ_MODE_EBLOCK)
2704 /* EBLOCK is responsible for returning its own entry into the
2705 - * free list, unless it originally added the entry into the
2706 - * unlimited pending list.
2707 + * free list.
2708 */
2709 qed_spq_return_entry(p_hwfn, found);
2710
2711 diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c
2712 index 9b08a9d9e151..ca6290fa0f30 100644
2713 --- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c
2714 +++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c
2715 @@ -101,6 +101,7 @@ static int qed_sp_vf_start(struct qed_hwfn *p_hwfn, struct qed_vf_info *p_vf)
2716 default:
2717 DP_NOTICE(p_hwfn, "Unknown VF personality %d\n",
2718 p_hwfn->hw_info.personality);
2719 + qed_sp_destroy_request(p_hwfn, p_ent);
2720 return -EINVAL;
2721 }
2722
2723 diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
2724 index b1b305f8f414..272b9ca66314 100644
2725 --- a/drivers/net/ethernet/stmicro/stmmac/common.h
2726 +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
2727 @@ -365,7 +365,8 @@ struct dma_features {
2728
2729 /* GMAC TX FIFO is 8K, Rx FIFO is 16K */
2730 #define BUF_SIZE_16KiB 16384
2731 -#define BUF_SIZE_8KiB 8192
2732 +/* RX Buffer size must be < 8191 and multiple of 4/8/16 bytes */
2733 +#define BUF_SIZE_8KiB 8188
2734 #define BUF_SIZE_4KiB 4096
2735 #define BUF_SIZE_2KiB 2048
2736
2737 diff --git a/drivers/net/ethernet/stmicro/stmmac/descs_com.h b/drivers/net/ethernet/stmicro/stmmac/descs_com.h
2738 index ca9d7e48034c..40d6356a7e73 100644
2739 --- a/drivers/net/ethernet/stmicro/stmmac/descs_com.h
2740 +++ b/drivers/net/ethernet/stmicro/stmmac/descs_com.h
2741 @@ -31,7 +31,7 @@
2742 /* Enhanced descriptors */
2743 static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end)
2744 {
2745 - p->des1 |= cpu_to_le32(((BUF_SIZE_8KiB - 1)
2746 + p->des1 |= cpu_to_le32((BUF_SIZE_8KiB
2747 << ERDES1_BUFFER2_SIZE_SHIFT)
2748 & ERDES1_BUFFER2_SIZE_MASK);
2749
2750 diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
2751 index 77914c89d749..5ef91a790f9d 100644
2752 --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
2753 +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
2754 @@ -262,7 +262,7 @@ static void enh_desc_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
2755 int mode, int end)
2756 {
2757 p->des0 |= cpu_to_le32(RDES0_OWN);
2758 - p->des1 |= cpu_to_le32((BUF_SIZE_8KiB - 1) & ERDES1_BUFFER1_SIZE_MASK);
2759 + p->des1 |= cpu_to_le32(BUF_SIZE_8KiB & ERDES1_BUFFER1_SIZE_MASK);
2760
2761 if (mode == STMMAC_CHAIN_MODE)
2762 ehn_desc_rx_set_on_chain(p);
2763 diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
2764 index a7ffc73fffe8..bc83ced94e1b 100644
2765 --- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
2766 +++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
2767 @@ -140,7 +140,7 @@ static void clean_desc3(void *priv_ptr, struct dma_desc *p)
2768 static int set_16kib_bfsize(int mtu)
2769 {
2770 int ret = 0;
2771 - if (unlikely(mtu >= BUF_SIZE_8KiB))
2772 + if (unlikely(mtu > BUF_SIZE_8KiB))
2773 ret = BUF_SIZE_16KiB;
2774 return ret;
2775 }
2776 diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
2777 index 5da7bfbe907f..14e8c575f6c3 100644
2778 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
2779 +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
2780 @@ -757,10 +757,10 @@ __mt76x0_phy_set_channel(struct mt76x0_dev *dev,
2781 /* Vendor driver don't do it */
2782 /* mt76x0_phy_set_tx_power(dev, channel, rf_bw_band); */
2783
2784 + mt76x0_vco_cal(dev, channel);
2785 if (scan)
2786 - mt76x0_vco_cal(dev, channel);
2787 + mt76x0_mcu_calibrate(dev, MCU_CAL_RXDCOC, 1);
2788
2789 - mt76x0_mcu_calibrate(dev, MCU_CAL_RXDCOC, 1);
2790 mt76x0_phy_set_chan_pwr(dev, channel);
2791
2792 dev->mt76.chandef = *chandef;
2793 diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
2794 index 6bb9908bf46f..0ba301f7e8b4 100644
2795 --- a/drivers/nvme/host/core.c
2796 +++ b/drivers/nvme/host/core.c
2797 @@ -1519,8 +1519,10 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
2798 if (ns->ndev)
2799 nvme_nvm_update_nvm_info(ns);
2800 #ifdef CONFIG_NVME_MULTIPATH
2801 - if (ns->head->disk)
2802 + if (ns->head->disk) {
2803 nvme_update_disk_info(ns->head->disk, ns, id);
2804 + blk_queue_stack_limits(ns->head->disk->queue, ns->queue);
2805 + }
2806 #endif
2807 }
2808
2809 diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
2810 index b71c9ad1bf45..c27af277e14e 100644
2811 --- a/drivers/nvme/host/multipath.c
2812 +++ b/drivers/nvme/host/multipath.c
2813 @@ -257,6 +257,7 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
2814 blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
2815 /* set to a default value for 512 until disk is validated */
2816 blk_queue_logical_block_size(q, 512);
2817 + blk_set_stacking_limits(&q->limits);
2818
2819 /* we need to propagate up the VMC settings */
2820 if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)
2821 diff --git a/drivers/of/device.c b/drivers/of/device.c
2822 index 5957cd4fa262..40b9051a7fce 100644
2823 --- a/drivers/of/device.c
2824 +++ b/drivers/of/device.c
2825 @@ -149,9 +149,11 @@ int of_dma_configure(struct device *dev, struct device_node *np, bool force_dma)
2826 * set by the driver.
2827 */
2828 mask = DMA_BIT_MASK(ilog2(dma_addr + size - 1) + 1);
2829 - dev->bus_dma_mask = mask;
2830 dev->coherent_dma_mask &= mask;
2831 *dev->dma_mask &= mask;
2832 + /* ...but only set bus mask if we found valid dma-ranges earlier */
2833 + if (!ret)
2834 + dev->bus_dma_mask = mask;
2835
2836 coherent = of_dma_is_coherent(np);
2837 dev_dbg(dev, "device is%sdma coherent\n",
2838 diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
2839 index ea22591ee66f..53dfe67807e3 100644
2840 --- a/drivers/platform/x86/acerhdf.c
2841 +++ b/drivers/platform/x86/acerhdf.c
2842 @@ -233,6 +233,7 @@ static const struct bios_settings bios_tbl[] = {
2843 {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x9e, 0x00}, 0},
2844 {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x9e, 0x00}, 0},
2845 {"Gateway", "LT31", "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0},
2846 + {"Gateway", "LT31", "v1.3307", 0x55, 0x58, {0x9e, 0x00}, 0},
2847 /* Packard Bell */
2848 {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00}, 0},
2849 {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00}, 0},
2850 diff --git a/drivers/platform/x86/intel_telemetry_debugfs.c b/drivers/platform/x86/intel_telemetry_debugfs.c
2851 index ffd0474b0531..1423fa8710fd 100644
2852 --- a/drivers/platform/x86/intel_telemetry_debugfs.c
2853 +++ b/drivers/platform/x86/intel_telemetry_debugfs.c
2854 @@ -951,12 +951,16 @@ static int __init telemetry_debugfs_init(void)
2855 debugfs_conf = (struct telemetry_debugfs_conf *)id->driver_data;
2856
2857 err = telemetry_pltconfig_valid();
2858 - if (err < 0)
2859 + if (err < 0) {
2860 + pr_info("Invalid pltconfig, ensure IPC1 device is enabled in BIOS\n");
2861 return -ENODEV;
2862 + }
2863
2864 err = telemetry_debugfs_check_evts();
2865 - if (err < 0)
2866 + if (err < 0) {
2867 + pr_info("telemetry_debugfs_check_evts failed\n");
2868 return -EINVAL;
2869 + }
2870
2871 register_pm_notifier(&pm_notifier);
2872
2873 diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
2874 index 34e0d476c5c6..970654fcc48d 100644
2875 --- a/drivers/s390/net/qeth_core.h
2876 +++ b/drivers/s390/net/qeth_core.h
2877 @@ -826,6 +826,11 @@ struct qeth_trap_id {
2878 /*some helper functions*/
2879 #define QETH_CARD_IFNAME(card) (((card)->dev)? (card)->dev->name : "")
2880
2881 +static inline bool qeth_netdev_is_registered(struct net_device *dev)
2882 +{
2883 + return dev->netdev_ops != NULL;
2884 +}
2885 +
2886 static inline void qeth_scrub_qdio_buffer(struct qdio_buffer *buf,
2887 unsigned int elements)
2888 {
2889 diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
2890 index b5e38531733f..76b2fba5fba2 100644
2891 --- a/drivers/s390/net/qeth_l2_main.c
2892 +++ b/drivers/s390/net/qeth_l2_main.c
2893 @@ -854,7 +854,8 @@ static void qeth_l2_remove_device(struct ccwgroup_device *cgdev)
2894
2895 if (cgdev->state == CCWGROUP_ONLINE)
2896 qeth_l2_set_offline(cgdev);
2897 - unregister_netdev(card->dev);
2898 + if (qeth_netdev_is_registered(card->dev))
2899 + unregister_netdev(card->dev);
2900 }
2901
2902 static const struct ethtool_ops qeth_l2_ethtool_ops = {
2903 @@ -894,7 +895,7 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
2904 {
2905 int rc;
2906
2907 - if (card->dev->netdev_ops)
2908 + if (qeth_netdev_is_registered(card->dev))
2909 return 0;
2910
2911 card->dev->priv_flags |= IFF_UNICAST_FLT;
2912 diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
2913 index ada258c01a08..b7f6a8384543 100644
2914 --- a/drivers/s390/net/qeth_l3_main.c
2915 +++ b/drivers/s390/net/qeth_l3_main.c
2916 @@ -279,9 +279,6 @@ static void qeth_l3_clear_ip_htable(struct qeth_card *card, int recover)
2917
2918 QETH_CARD_TEXT(card, 4, "clearip");
2919
2920 - if (recover && card->options.sniffer)
2921 - return;
2922 -
2923 spin_lock_bh(&card->ip_lock);
2924
2925 hash_for_each_safe(card->ip_htable, i, tmp, addr, hnode) {
2926 @@ -664,6 +661,8 @@ static int qeth_l3_register_addr_entry(struct qeth_card *card,
2927 int rc = 0;
2928 int cnt = 3;
2929
2930 + if (card->options.sniffer)
2931 + return 0;
2932
2933 if (addr->proto == QETH_PROT_IPV4) {
2934 QETH_CARD_TEXT(card, 2, "setaddr4");
2935 @@ -698,6 +697,9 @@ static int qeth_l3_deregister_addr_entry(struct qeth_card *card,
2936 {
2937 int rc = 0;
2938
2939 + if (card->options.sniffer)
2940 + return 0;
2941 +
2942 if (addr->proto == QETH_PROT_IPV4) {
2943 QETH_CARD_TEXT(card, 2, "deladdr4");
2944 QETH_CARD_HEX(card, 3, &addr->u.a4.addr, sizeof(int));
2945 @@ -2512,7 +2514,7 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
2946 {
2947 int rc;
2948
2949 - if (card->dev->netdev_ops)
2950 + if (qeth_netdev_is_registered(card->dev))
2951 return 0;
2952
2953 if (card->info.type == QETH_CARD_TYPE_OSD ||
2954 @@ -2609,7 +2611,8 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev)
2955 if (cgdev->state == CCWGROUP_ONLINE)
2956 qeth_l3_set_offline(cgdev);
2957
2958 - unregister_netdev(card->dev);
2959 + if (qeth_netdev_is_registered(card->dev))
2960 + unregister_netdev(card->dev);
2961 qeth_l3_clear_ip_htable(card, 0);
2962 qeth_l3_clear_ipato_list(card);
2963 }
2964 diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
2965 index 3649b83ef863..effba6ce0caa 100644
2966 --- a/drivers/tty/serial/sh-sci.c
2967 +++ b/drivers/tty/serial/sh-sci.c
2968 @@ -1614,10 +1614,10 @@ static void sci_request_dma(struct uart_port *port)
2969 hrtimer_init(&s->rx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
2970 s->rx_timer.function = rx_timer_fn;
2971
2972 + s->chan_rx_saved = s->chan_rx = chan;
2973 +
2974 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB)
2975 sci_submit_rx(s);
2976 -
2977 - s->chan_rx_saved = s->chan_rx = chan;
2978 }
2979 }
2980
2981 diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
2982 index 9916edda5271..2762148c169d 100644
2983 --- a/drivers/uio/uio.c
2984 +++ b/drivers/uio/uio.c
2985 @@ -959,6 +959,8 @@ int __uio_register_device(struct module *owner,
2986 if (ret)
2987 goto err_uio_dev_add_attributes;
2988
2989 + info->uio_dev = idev;
2990 +
2991 if (info->irq && (info->irq != UIO_IRQ_CUSTOM)) {
2992 /*
2993 * Note that we deliberately don't use devm_request_irq
2994 @@ -970,11 +972,12 @@ int __uio_register_device(struct module *owner,
2995 */
2996 ret = request_irq(info->irq, uio_interrupt,
2997 info->irq_flags, info->name, idev);
2998 - if (ret)
2999 + if (ret) {
3000 + info->uio_dev = NULL;
3001 goto err_request_irq;
3002 + }
3003 }
3004
3005 - info->uio_dev = idev;
3006 return 0;
3007
3008 err_request_irq:
3009 diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
3010 index 9ede35cecb12..40c64c7ab5e4 100644
3011 --- a/drivers/usb/class/cdc-acm.c
3012 +++ b/drivers/usb/class/cdc-acm.c
3013 @@ -1711,6 +1711,9 @@ static const struct usb_device_id acm_ids[] = {
3014 { USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */
3015 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
3016 },
3017 + { USB_DEVICE(0x0572, 0x1349), /* Hiro (Conexant) USB MODEM H50228 */
3018 + .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
3019 + },
3020 { USB_DEVICE(0x20df, 0x0001), /* Simtec Electronics Entropy Key */
3021 .driver_info = QUIRK_CONTROL_LINE_STATE, },
3022 { USB_DEVICE(0x2184, 0x001c) }, /* GW Instek AFG-2225 */
3023 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
3024 index 462ce49f683a..6e0823790bee 100644
3025 --- a/drivers/usb/core/hub.c
3026 +++ b/drivers/usb/core/hub.c
3027 @@ -2791,6 +2791,7 @@ static int hub_port_reset(struct usb_hub *hub, int port1,
3028 int i, status;
3029 u16 portchange, portstatus;
3030 struct usb_port *port_dev = hub->ports[port1 - 1];
3031 + int reset_recovery_time;
3032
3033 if (!hub_is_superspeed(hub->hdev)) {
3034 if (warm) {
3035 @@ -2882,11 +2883,18 @@ static int hub_port_reset(struct usb_hub *hub, int port1,
3036
3037 done:
3038 if (status == 0) {
3039 - /* TRSTRCY = 10 ms; plus some extra */
3040 if (port_dev->quirks & USB_PORT_QUIRK_FAST_ENUM)
3041 usleep_range(10000, 12000);
3042 - else
3043 - msleep(10 + 40);
3044 + else {
3045 + /* TRSTRCY = 10 ms; plus some extra */
3046 + reset_recovery_time = 10 + 40;
3047 +
3048 + /* Hub needs extra delay after resetting its port. */
3049 + if (hub->hdev->quirks & USB_QUIRK_HUB_SLOW_RESET)
3050 + reset_recovery_time += 100;
3051 +
3052 + msleep(reset_recovery_time);
3053 + }
3054
3055 if (udev) {
3056 struct usb_hcd *hcd = bus_to_hcd(udev->bus);
3057 diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
3058 index 178d6c6063c0..f9ff03e6af93 100644
3059 --- a/drivers/usb/core/quirks.c
3060 +++ b/drivers/usb/core/quirks.c
3061 @@ -128,6 +128,9 @@ static int quirks_param_set(const char *val, const struct kernel_param *kp)
3062 case 'n':
3063 flags |= USB_QUIRK_DELAY_CTRL_MSG;
3064 break;
3065 + case 'o':
3066 + flags |= USB_QUIRK_HUB_SLOW_RESET;
3067 + break;
3068 /* Ignore unrecognized flag characters */
3069 }
3070 }
3071 @@ -380,6 +383,9 @@ static const struct usb_device_id usb_quirk_list[] = {
3072 { USB_DEVICE(0x1a0a, 0x0200), .driver_info =
3073 USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL },
3074
3075 + /* Terminus Technology Inc. Hub */
3076 + { USB_DEVICE(0x1a40, 0x0101), .driver_info = USB_QUIRK_HUB_SLOW_RESET },
3077 +
3078 /* Corsair K70 RGB */
3079 { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT },
3080
3081 @@ -391,6 +397,9 @@ static const struct usb_device_id usb_quirk_list[] = {
3082 { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT |
3083 USB_QUIRK_DELAY_CTRL_MSG },
3084
3085 + /* Corsair K70 LUX RGB */
3086 + { USB_DEVICE(0x1b1c, 0x1b33), .driver_info = USB_QUIRK_DELAY_INIT },
3087 +
3088 /* Corsair K70 LUX */
3089 { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT },
3090
3091 @@ -411,6 +420,11 @@ static const struct usb_device_id usb_quirk_list[] = {
3092 { USB_DEVICE(0x2040, 0x7200), .driver_info =
3093 USB_QUIRK_CONFIG_INTF_STRINGS },
3094
3095 + /* Raydium Touchscreen */
3096 + { USB_DEVICE(0x2386, 0x3114), .driver_info = USB_QUIRK_NO_LPM },
3097 +
3098 + { USB_DEVICE(0x2386, 0x3119), .driver_info = USB_QUIRK_NO_LPM },
3099 +
3100 /* DJI CineSSD */
3101 { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
3102
3103 diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
3104 index d746c26a8055..6a0c60badfa0 100644
3105 --- a/drivers/usb/misc/appledisplay.c
3106 +++ b/drivers/usb/misc/appledisplay.c
3107 @@ -50,6 +50,7 @@ static const struct usb_device_id appledisplay_table[] = {
3108 { APPLEDISPLAY_DEVICE(0x9219) },
3109 { APPLEDISPLAY_DEVICE(0x921c) },
3110 { APPLEDISPLAY_DEVICE(0x921d) },
3111 + { APPLEDISPLAY_DEVICE(0x9222) },
3112 { APPLEDISPLAY_DEVICE(0x9236) },
3113
3114 /* Terminating entry */
3115 diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
3116 index 84575baceebc..97341fa75458 100644
3117 --- a/drivers/xen/grant-table.c
3118 +++ b/drivers/xen/grant-table.c
3119 @@ -914,7 +914,7 @@ int gnttab_dma_free_pages(struct gnttab_dma_alloc_args *args)
3120
3121 ret = xenmem_reservation_increase(args->nr_pages, args->frames);
3122 if (ret != args->nr_pages) {
3123 - pr_debug("Failed to decrease reservation for DMA buffer\n");
3124 + pr_debug("Failed to increase reservation for DMA buffer\n");
3125 ret = -EFAULT;
3126 } else {
3127 ret = 0;
3128 diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c
3129 index 77a83790a31f..2543f24d23f8 100644
3130 --- a/fs/afs/rxrpc.c
3131 +++ b/fs/afs/rxrpc.c
3132 @@ -500,7 +500,6 @@ static void afs_deliver_to_call(struct afs_call *call)
3133 case -EINPROGRESS:
3134 case -EAGAIN:
3135 goto out;
3136 - case -EIO:
3137 case -ECONNABORTED:
3138 ASSERTCMP(state, ==, AFS_CALL_COMPLETE);
3139 goto done;
3140 @@ -509,6 +508,10 @@ static void afs_deliver_to_call(struct afs_call *call)
3141 rxrpc_kernel_abort_call(call->net->socket, call->rxcall,
3142 abort_code, ret, "KIV");
3143 goto local_abort;
3144 + case -EIO:
3145 + pr_err("kAFS: Call %u in bad state %u\n",
3146 + call->debug_id, state);
3147 + /* Fall through */
3148 case -ENODATA:
3149 case -EBADMSG:
3150 case -EMSGSIZE:
3151 diff --git a/fs/ceph/quota.c b/fs/ceph/quota.c
3152 index 32d4f13784ba..03f4d24db8fe 100644
3153 --- a/fs/ceph/quota.c
3154 +++ b/fs/ceph/quota.c
3155 @@ -237,7 +237,8 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
3156 ceph_put_snap_realm(mdsc, realm);
3157 realm = next;
3158 }
3159 - ceph_put_snap_realm(mdsc, realm);
3160 + if (realm)
3161 + ceph_put_snap_realm(mdsc, realm);
3162 up_read(&mdsc->snap_rwsem);
3163
3164 return exceeded;
3165 diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
3166 index 7065426b3280..fb32f3d6925e 100644
3167 --- a/fs/cifs/cifsfs.c
3168 +++ b/fs/cifs/cifsfs.c
3169 @@ -981,8 +981,8 @@ static int cifs_clone_file_range(struct file *src_file, loff_t off,
3170 struct inode *src_inode = file_inode(src_file);
3171 struct inode *target_inode = file_inode(dst_file);
3172 struct cifsFileInfo *smb_file_src = src_file->private_data;
3173 - struct cifsFileInfo *smb_file_target = dst_file->private_data;
3174 - struct cifs_tcon *target_tcon = tlink_tcon(smb_file_target->tlink);
3175 + struct cifsFileInfo *smb_file_target;
3176 + struct cifs_tcon *target_tcon;
3177 unsigned int xid;
3178 int rc;
3179
3180 @@ -996,6 +996,9 @@ static int cifs_clone_file_range(struct file *src_file, loff_t off,
3181 goto out;
3182 }
3183
3184 + smb_file_target = dst_file->private_data;
3185 + target_tcon = tlink_tcon(smb_file_target->tlink);
3186 +
3187 /*
3188 * Note: cifs case is easier than btrfs since server responsible for
3189 * checks for proper open modes and file type and if it wants
3190 diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
3191 index 89985a0a6819..812da3e56a22 100644
3192 --- a/fs/cifs/smb2ops.c
3193 +++ b/fs/cifs/smb2ops.c
3194 @@ -686,6 +686,7 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size,
3195 int rc = 0;
3196 unsigned int ea_name_len = ea_name ? strlen(ea_name) : 0;
3197 char *name, *value;
3198 + size_t buf_size = dst_size;
3199 size_t name_len, value_len, user_name_len;
3200
3201 while (src_size > 0) {
3202 @@ -721,9 +722,10 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size,
3203 /* 'user.' plus a terminating null */
3204 user_name_len = 5 + 1 + name_len;
3205
3206 - rc += user_name_len;
3207 -
3208 - if (dst_size >= user_name_len) {
3209 + if (buf_size == 0) {
3210 + /* skip copy - calc size only */
3211 + rc += user_name_len;
3212 + } else if (dst_size >= user_name_len) {
3213 dst_size -= user_name_len;
3214 memcpy(dst, "user.", 5);
3215 dst += 5;
3216 @@ -731,8 +733,7 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size,
3217 dst += name_len;
3218 *dst = 0;
3219 ++dst;
3220 - } else if (dst_size == 0) {
3221 - /* skip copy - calc size only */
3222 + rc += user_name_len;
3223 } else {
3224 /* stop before overrun buffer */
3225 rc = -ERANGE;
3226 diff --git a/fs/exofs/super.c b/fs/exofs/super.c
3227 index 41cf2fbee50d..7d61e3fa378c 100644
3228 --- a/fs/exofs/super.c
3229 +++ b/fs/exofs/super.c
3230 @@ -101,6 +101,7 @@ static int parse_options(char *options, struct exofs_mountopt *opts)
3231 token = match_token(p, tokens, args);
3232 switch (token) {
3233 case Opt_name:
3234 + kfree(opts->dev_name);
3235 opts->dev_name = match_strdup(&args[0]);
3236 if (unlikely(!opts->dev_name)) {
3237 EXOFS_ERR("Error allocating dev_name");
3238 @@ -866,8 +867,10 @@ static struct dentry *exofs_mount(struct file_system_type *type,
3239 int ret;
3240
3241 ret = parse_options(data, &opts);
3242 - if (ret)
3243 + if (ret) {
3244 + kfree(opts.dev_name);
3245 return ERR_PTR(ret);
3246 + }
3247
3248 if (!opts.dev_name)
3249 opts.dev_name = dev_name;
3250 diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c
3251 index 9a8772465a90..da25c49203cc 100644
3252 --- a/fs/hfs/brec.c
3253 +++ b/fs/hfs/brec.c
3254 @@ -425,6 +425,10 @@ skip:
3255 if (new_node) {
3256 __be32 cnid;
3257
3258 + if (!new_node->parent) {
3259 + hfs_btree_inc_height(tree);
3260 + new_node->parent = tree->root;
3261 + }
3262 fd->bnode = hfs_bnode_find(tree, new_node->parent);
3263 /* create index key and entry */
3264 hfs_bnode_read_key(new_node, fd->search_key, 14);
3265 diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c
3266 index ed8eacb34452..aa17a392b414 100644
3267 --- a/fs/hfsplus/brec.c
3268 +++ b/fs/hfsplus/brec.c
3269 @@ -429,6 +429,10 @@ skip:
3270 if (new_node) {
3271 __be32 cnid;
3272
3273 + if (!new_node->parent) {
3274 + hfs_btree_inc_height(tree);
3275 + new_node->parent = tree->root;
3276 + }
3277 fd->bnode = hfs_bnode_find(tree, new_node->parent);
3278 /* create index key and entry */
3279 hfs_bnode_read_key(new_node, fd->search_key, 14);
3280 diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
3281 index 48cdfc81fe10..32d8986c26fb 100644
3282 --- a/fs/reiserfs/xattr.c
3283 +++ b/fs/reiserfs/xattr.c
3284 @@ -185,6 +185,7 @@ struct reiserfs_dentry_buf {
3285 struct dir_context ctx;
3286 struct dentry *xadir;
3287 int count;
3288 + int err;
3289 struct dentry *dentries[8];
3290 };
3291
3292 @@ -207,6 +208,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen,
3293
3294 dentry = lookup_one_len(name, dbuf->xadir, namelen);
3295 if (IS_ERR(dentry)) {
3296 + dbuf->err = PTR_ERR(dentry);
3297 return PTR_ERR(dentry);
3298 } else if (d_really_is_negative(dentry)) {
3299 /* A directory entry exists, but no file? */
3300 @@ -215,6 +217,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen,
3301 "not found for file %pd.\n",
3302 dentry, dbuf->xadir);
3303 dput(dentry);
3304 + dbuf->err = -EIO;
3305 return -EIO;
3306 }
3307
3308 @@ -262,6 +265,10 @@ static int reiserfs_for_each_xattr(struct inode *inode,
3309 err = reiserfs_readdir_inode(d_inode(dir), &buf.ctx);
3310 if (err)
3311 break;
3312 + if (buf.err) {
3313 + err = buf.err;
3314 + break;
3315 + }
3316 if (!buf.count)
3317 break;
3318 for (i = 0; !err && i < buf.count && buf.dentries[i]; i++) {
3319 diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
3320 index 78b86dea2f29..7f53ece2c039 100644
3321 --- a/include/linux/mtd/nand.h
3322 +++ b/include/linux/mtd/nand.h
3323 @@ -568,7 +568,7 @@ static inline void nanddev_pos_next_eraseblock(struct nand_device *nand,
3324 }
3325
3326 /**
3327 - * nanddev_pos_next_eraseblock() - Move a position to the next page
3328 + * nanddev_pos_next_page() - Move a position to the next page
3329 * @nand: NAND device
3330 * @pos: the position to update
3331 *
3332 diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
3333 index 34fc80f3eb90..1d100efe74ec 100644
3334 --- a/include/linux/netfilter/ipset/ip_set.h
3335 +++ b/include/linux/netfilter/ipset/ip_set.h
3336 @@ -314,7 +314,7 @@ enum {
3337 extern ip_set_id_t ip_set_get_byname(struct net *net,
3338 const char *name, struct ip_set **set);
3339 extern void ip_set_put_byindex(struct net *net, ip_set_id_t index);
3340 -extern const char *ip_set_name_byindex(struct net *net, ip_set_id_t index);
3341 +extern void ip_set_name_byindex(struct net *net, ip_set_id_t index, char *name);
3342 extern ip_set_id_t ip_set_nfnl_get_byindex(struct net *net, ip_set_id_t index);
3343 extern void ip_set_nfnl_put(struct net *net, ip_set_id_t index);
3344
3345 diff --git a/include/linux/netfilter/ipset/ip_set_comment.h b/include/linux/netfilter/ipset/ip_set_comment.h
3346 index 8e2bab1e8e90..70877f8de7e9 100644
3347 --- a/include/linux/netfilter/ipset/ip_set_comment.h
3348 +++ b/include/linux/netfilter/ipset/ip_set_comment.h
3349 @@ -43,11 +43,11 @@ ip_set_init_comment(struct ip_set *set, struct ip_set_comment *comment,
3350 rcu_assign_pointer(comment->c, c);
3351 }
3352
3353 -/* Used only when dumping a set, protected by rcu_read_lock_bh() */
3354 +/* Used only when dumping a set, protected by rcu_read_lock() */
3355 static inline int
3356 ip_set_put_comment(struct sk_buff *skb, const struct ip_set_comment *comment)
3357 {
3358 - struct ip_set_comment_rcu *c = rcu_dereference_bh(comment->c);
3359 + struct ip_set_comment_rcu *c = rcu_dereference(comment->c);
3360
3361 if (!c)
3362 return 0;
3363 diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
3364 index b7a99ce56bc9..a1be64c9940f 100644
3365 --- a/include/linux/usb/quirks.h
3366 +++ b/include/linux/usb/quirks.h
3367 @@ -66,4 +66,7 @@
3368 /* Device needs a pause after every control message. */
3369 #define USB_QUIRK_DELAY_CTRL_MSG BIT(13)
3370
3371 +/* Hub needs extra delay after resetting its port. */
3372 +#define USB_QUIRK_HUB_SLOW_RESET BIT(14)
3373 +
3374 #endif /* __LINUX_USB_QUIRKS_H */
3375 diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
3376 index e23290ffdc77..325ec6ef0a76 100644
3377 --- a/include/uapi/linux/netfilter/nf_tables.h
3378 +++ b/include/uapi/linux/netfilter/nf_tables.h
3379 @@ -1581,8 +1581,8 @@ enum nft_ng_attributes {
3380 NFTA_NG_MODULUS,
3381 NFTA_NG_TYPE,
3382 NFTA_NG_OFFSET,
3383 - NFTA_NG_SET_NAME,
3384 - NFTA_NG_SET_ID,
3385 + NFTA_NG_SET_NAME, /* deprecated */
3386 + NFTA_NG_SET_ID, /* deprecated */
3387 __NFTA_NG_MAX
3388 };
3389 #define NFTA_NG_MAX (__NFTA_NG_MAX - 1)
3390 diff --git a/include/uapi/linux/netfilter_bridge.h b/include/uapi/linux/netfilter_bridge.h
3391 index 156ccd089df1..1610fdbab98d 100644
3392 --- a/include/uapi/linux/netfilter_bridge.h
3393 +++ b/include/uapi/linux/netfilter_bridge.h
3394 @@ -11,6 +11,10 @@
3395 #include <linux/if_vlan.h>
3396 #include <linux/if_pppox.h>
3397
3398 +#ifndef __KERNEL__
3399 +#include <limits.h> /* for INT_MIN, INT_MAX */
3400 +#endif
3401 +
3402 /* Bridge Hooks */
3403 /* After promisc drops, checksum checks. */
3404 #define NF_BR_PRE_ROUTING 0
3405 diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
3406 index 675eb6d36e47..382c09dddf93 100644
3407 --- a/kernel/bpf/syscall.c
3408 +++ b/kernel/bpf/syscall.c
3409 @@ -1974,6 +1974,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog,
3410 info.jited_prog_len = 0;
3411 info.xlated_prog_len = 0;
3412 info.nr_jited_ksyms = 0;
3413 + info.nr_jited_func_lens = 0;
3414 goto done;
3415 }
3416
3417 diff --git a/kernel/sched/core.c b/kernel/sched/core.c
3418 index ad97f3ba5ec5..35551110d277 100644
3419 --- a/kernel/sched/core.c
3420 +++ b/kernel/sched/core.c
3421 @@ -5854,11 +5854,14 @@ void __init sched_init_smp(void)
3422 /*
3423 * There's no userspace yet to cause hotplug operations; hence all the
3424 * CPU masks are stable and all blatant races in the below code cannot
3425 - * happen.
3426 + * happen. The hotplug lock is nevertheless taken to satisfy lockdep,
3427 + * but there won't be any contention on it.
3428 */
3429 + cpus_read_lock();
3430 mutex_lock(&sched_domains_mutex);
3431 sched_init_domains(cpu_active_mask);
3432 mutex_unlock(&sched_domains_mutex);
3433 + cpus_read_unlock();
3434
3435 /* Move init over to a non-isolated CPU */
3436 if (set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_DOMAIN)) < 0)
3437 diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile
3438 index 5d73f5cb4d8a..79777645cac9 100644
3439 --- a/lib/raid6/test/Makefile
3440 +++ b/lib/raid6/test/Makefile
3441 @@ -27,7 +27,7 @@ ifeq ($(ARCH),arm)
3442 CFLAGS += -I../../../arch/arm/include -mfpu=neon
3443 HAS_NEON = yes
3444 endif
3445 -ifeq ($(ARCH),arm64)
3446 +ifeq ($(ARCH),aarch64)
3447 CFLAGS += -I../../../arch/arm64/include
3448 HAS_NEON = yes
3449 endif
3450 @@ -41,7 +41,7 @@ ifeq ($(IS_X86),yes)
3451 gcc -c -x assembler - >&/dev/null && \
3452 rm ./-.o && echo -DCONFIG_AS_AVX512=1)
3453 else ifeq ($(HAS_NEON),yes)
3454 - OBJS += neon.o neon1.o neon2.o neon4.o neon8.o
3455 + OBJS += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o
3456 CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1
3457 else
3458 HAS_ALTIVEC := $(shell printf '\#include <altivec.h>\nvector int a;\n' |\
3459 diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
3460 index 0a187196aeed..9a1c27c61de8 100644
3461 --- a/net/ceph/messenger.c
3462 +++ b/net/ceph/messenger.c
3463 @@ -593,9 +593,15 @@ static int ceph_tcp_sendpage(struct socket *sock, struct page *page,
3464 struct bio_vec bvec;
3465 int ret;
3466
3467 - /* sendpage cannot properly handle pages with page_count == 0,
3468 - * we need to fallback to sendmsg if that's the case */
3469 - if (page_count(page) >= 1)
3470 + /*
3471 + * sendpage cannot properly handle pages with page_count == 0,
3472 + * we need to fall back to sendmsg if that's the case.
3473 + *
3474 + * Same goes for slab pages: skb_can_coalesce() allows
3475 + * coalescing neighboring slab objects into a single frag which
3476 + * triggers one of hardened usercopy checks.
3477 + */
3478 + if (page_count(page) >= 1 && !PageSlab(page))
3479 return __ceph_tcp_sendpage(sock, page, offset, size, more);
3480
3481 bvec.bv_page = page;
3482 diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
3483 index 8f68a518d9db..f76bd4d15704 100644
3484 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c
3485 +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
3486 @@ -587,11 +587,16 @@ int nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user)
3487 */
3488 ret = -EINPROGRESS;
3489 if (fq->q.flags == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) &&
3490 - fq->q.meat == fq->q.len &&
3491 - nf_ct_frag6_reasm(fq, skb, dev))
3492 - ret = 0;
3493 - else
3494 + fq->q.meat == fq->q.len) {
3495 + unsigned long orefdst = skb->_skb_refdst;
3496 +
3497 + skb->_skb_refdst = 0UL;
3498 + if (nf_ct_frag6_reasm(fq, skb, dev))
3499 + ret = 0;
3500 + skb->_skb_refdst = orefdst;
3501 + } else {
3502 skb_dst_drop(skb);
3503 + }
3504
3505 out_unlock:
3506 spin_unlock_bh(&fq->q.lock);
3507 diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
3508 index bc4bd247bb7d..1577f2f76060 100644
3509 --- a/net/netfilter/ipset/ip_set_core.c
3510 +++ b/net/netfilter/ipset/ip_set_core.c
3511 @@ -55,11 +55,15 @@ MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");
3512 MODULE_DESCRIPTION("core IP set support");
3513 MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_IPSET);
3514
3515 -/* When the nfnl mutex is held: */
3516 +/* When the nfnl mutex or ip_set_ref_lock is held: */
3517 #define ip_set_dereference(p) \
3518 - rcu_dereference_protected(p, lockdep_nfnl_is_held(NFNL_SUBSYS_IPSET))
3519 + rcu_dereference_protected(p, \
3520 + lockdep_nfnl_is_held(NFNL_SUBSYS_IPSET) || \
3521 + lockdep_is_held(&ip_set_ref_lock))
3522 #define ip_set(inst, id) \
3523 ip_set_dereference((inst)->ip_set_list)[id]
3524 +#define ip_set_ref_netlink(inst,id) \
3525 + rcu_dereference_raw((inst)->ip_set_list)[id]
3526
3527 /* The set types are implemented in modules and registered set types
3528 * can be found in ip_set_type_list. Adding/deleting types is
3529 @@ -693,21 +697,20 @@ ip_set_put_byindex(struct net *net, ip_set_id_t index)
3530 EXPORT_SYMBOL_GPL(ip_set_put_byindex);
3531
3532 /* Get the name of a set behind a set index.
3533 - * We assume the set is referenced, so it does exist and
3534 - * can't be destroyed. The set cannot be renamed due to
3535 - * the referencing either.
3536 - *
3537 + * Set itself is protected by RCU, but its name isn't: to protect against
3538 + * renaming, grab ip_set_ref_lock as reader (see ip_set_rename()) and copy the
3539 + * name.
3540 */
3541 -const char *
3542 -ip_set_name_byindex(struct net *net, ip_set_id_t index)
3543 +void
3544 +ip_set_name_byindex(struct net *net, ip_set_id_t index, char *name)
3545 {
3546 - const struct ip_set *set = ip_set_rcu_get(net, index);
3547 + struct ip_set *set = ip_set_rcu_get(net, index);
3548
3549 BUG_ON(!set);
3550 - BUG_ON(set->ref == 0);
3551
3552 - /* Referenced, so it's safe */
3553 - return set->name;
3554 + read_lock_bh(&ip_set_ref_lock);
3555 + strncpy(name, set->name, IPSET_MAXNAMELEN);
3556 + read_unlock_bh(&ip_set_ref_lock);
3557 }
3558 EXPORT_SYMBOL_GPL(ip_set_name_byindex);
3559
3560 @@ -961,7 +964,7 @@ static int ip_set_create(struct net *net, struct sock *ctnl,
3561 /* Wraparound */
3562 goto cleanup;
3563
3564 - list = kcalloc(i, sizeof(struct ip_set *), GFP_KERNEL);
3565 + list = kvcalloc(i, sizeof(struct ip_set *), GFP_KERNEL);
3566 if (!list)
3567 goto cleanup;
3568 /* nfnl mutex is held, both lists are valid */
3569 @@ -973,7 +976,7 @@ static int ip_set_create(struct net *net, struct sock *ctnl,
3570 /* Use new list */
3571 index = inst->ip_set_max;
3572 inst->ip_set_max = i;
3573 - kfree(tmp);
3574 + kvfree(tmp);
3575 ret = 0;
3576 } else if (ret) {
3577 goto cleanup;
3578 @@ -1153,7 +1156,7 @@ static int ip_set_rename(struct net *net, struct sock *ctnl,
3579 if (!set)
3580 return -ENOENT;
3581
3582 - read_lock_bh(&ip_set_ref_lock);
3583 + write_lock_bh(&ip_set_ref_lock);
3584 if (set->ref != 0) {
3585 ret = -IPSET_ERR_REFERENCED;
3586 goto out;
3587 @@ -1170,7 +1173,7 @@ static int ip_set_rename(struct net *net, struct sock *ctnl,
3588 strncpy(set->name, name2, IPSET_MAXNAMELEN);
3589
3590 out:
3591 - read_unlock_bh(&ip_set_ref_lock);
3592 + write_unlock_bh(&ip_set_ref_lock);
3593 return ret;
3594 }
3595
3596 @@ -1252,7 +1255,7 @@ ip_set_dump_done(struct netlink_callback *cb)
3597 struct ip_set_net *inst =
3598 (struct ip_set_net *)cb->args[IPSET_CB_NET];
3599 ip_set_id_t index = (ip_set_id_t)cb->args[IPSET_CB_INDEX];
3600 - struct ip_set *set = ip_set(inst, index);
3601 + struct ip_set *set = ip_set_ref_netlink(inst, index);
3602
3603 if (set->variant->uref)
3604 set->variant->uref(set, cb, false);
3605 @@ -1441,7 +1444,7 @@ next_set:
3606 release_refcount:
3607 /* If there was an error or set is done, release set */
3608 if (ret || !cb->args[IPSET_CB_ARG0]) {
3609 - set = ip_set(inst, index);
3610 + set = ip_set_ref_netlink(inst, index);
3611 if (set->variant->uref)
3612 set->variant->uref(set, cb, false);
3613 pr_debug("release set %s\n", set->name);
3614 @@ -2059,7 +2062,7 @@ ip_set_net_init(struct net *net)
3615 if (inst->ip_set_max >= IPSET_INVALID_ID)
3616 inst->ip_set_max = IPSET_INVALID_ID - 1;
3617
3618 - list = kcalloc(inst->ip_set_max, sizeof(struct ip_set *), GFP_KERNEL);
3619 + list = kvcalloc(inst->ip_set_max, sizeof(struct ip_set *), GFP_KERNEL);
3620 if (!list)
3621 return -ENOMEM;
3622 inst->is_deleted = false;
3623 @@ -2087,7 +2090,7 @@ ip_set_net_exit(struct net *net)
3624 }
3625 }
3626 nfnl_unlock(NFNL_SUBSYS_IPSET);
3627 - kfree(rcu_dereference_protected(inst->ip_set_list, 1));
3628 + kvfree(rcu_dereference_protected(inst->ip_set_list, 1));
3629 }
3630
3631 static struct pernet_operations ip_set_net_ops = {
3632 diff --git a/net/netfilter/ipset/ip_set_hash_netportnet.c b/net/netfilter/ipset/ip_set_hash_netportnet.c
3633 index d391485a6acd..613e18e720a4 100644
3634 --- a/net/netfilter/ipset/ip_set_hash_netportnet.c
3635 +++ b/net/netfilter/ipset/ip_set_hash_netportnet.c
3636 @@ -213,13 +213,13 @@ hash_netportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
3637
3638 if (tb[IPSET_ATTR_CIDR]) {
3639 e.cidr[0] = nla_get_u8(tb[IPSET_ATTR_CIDR]);
3640 - if (!e.cidr[0] || e.cidr[0] > HOST_MASK)
3641 + if (e.cidr[0] > HOST_MASK)
3642 return -IPSET_ERR_INVALID_CIDR;
3643 }
3644
3645 if (tb[IPSET_ATTR_CIDR2]) {
3646 e.cidr[1] = nla_get_u8(tb[IPSET_ATTR_CIDR2]);
3647 - if (!e.cidr[1] || e.cidr[1] > HOST_MASK)
3648 + if (e.cidr[1] > HOST_MASK)
3649 return -IPSET_ERR_INVALID_CIDR;
3650 }
3651
3652 @@ -493,13 +493,13 @@ hash_netportnet6_uadt(struct ip_set *set, struct nlattr *tb[],
3653
3654 if (tb[IPSET_ATTR_CIDR]) {
3655 e.cidr[0] = nla_get_u8(tb[IPSET_ATTR_CIDR]);
3656 - if (!e.cidr[0] || e.cidr[0] > HOST_MASK)
3657 + if (e.cidr[0] > HOST_MASK)
3658 return -IPSET_ERR_INVALID_CIDR;
3659 }
3660
3661 if (tb[IPSET_ATTR_CIDR2]) {
3662 e.cidr[1] = nla_get_u8(tb[IPSET_ATTR_CIDR2]);
3663 - if (!e.cidr[1] || e.cidr[1] > HOST_MASK)
3664 + if (e.cidr[1] > HOST_MASK)
3665 return -IPSET_ERR_INVALID_CIDR;
3666 }
3667
3668 diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c
3669 index 072a658fde04..4eef55da0878 100644
3670 --- a/net/netfilter/ipset/ip_set_list_set.c
3671 +++ b/net/netfilter/ipset/ip_set_list_set.c
3672 @@ -148,9 +148,7 @@ __list_set_del_rcu(struct rcu_head * rcu)
3673 {
3674 struct set_elem *e = container_of(rcu, struct set_elem, rcu);
3675 struct ip_set *set = e->set;
3676 - struct list_set *map = set->data;
3677
3678 - ip_set_put_byindex(map->net, e->id);
3679 ip_set_ext_destroy(set, e);
3680 kfree(e);
3681 }
3682 @@ -158,15 +156,21 @@ __list_set_del_rcu(struct rcu_head * rcu)
3683 static inline void
3684 list_set_del(struct ip_set *set, struct set_elem *e)
3685 {
3686 + struct list_set *map = set->data;
3687 +
3688 set->elements--;
3689 list_del_rcu(&e->list);
3690 + ip_set_put_byindex(map->net, e->id);
3691 call_rcu(&e->rcu, __list_set_del_rcu);
3692 }
3693
3694 static inline void
3695 -list_set_replace(struct set_elem *e, struct set_elem *old)
3696 +list_set_replace(struct ip_set *set, struct set_elem *e, struct set_elem *old)
3697 {
3698 + struct list_set *map = set->data;
3699 +
3700 list_replace_rcu(&old->list, &e->list);
3701 + ip_set_put_byindex(map->net, old->id);
3702 call_rcu(&old->rcu, __list_set_del_rcu);
3703 }
3704
3705 @@ -298,7 +302,7 @@ list_set_uadd(struct ip_set *set, void *value, const struct ip_set_ext *ext,
3706 INIT_LIST_HEAD(&e->list);
3707 list_set_init_extensions(set, ext, e);
3708 if (n)
3709 - list_set_replace(e, n);
3710 + list_set_replace(set, e, n);
3711 else if (next)
3712 list_add_tail_rcu(&e->list, &next->list);
3713 else if (prev)
3714 @@ -486,6 +490,7 @@ list_set_list(const struct ip_set *set,
3715 const struct list_set *map = set->data;
3716 struct nlattr *atd, *nested;
3717 u32 i = 0, first = cb->args[IPSET_CB_ARG0];
3718 + char name[IPSET_MAXNAMELEN];
3719 struct set_elem *e;
3720 int ret = 0;
3721
3722 @@ -504,8 +509,8 @@ list_set_list(const struct ip_set *set,
3723 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
3724 if (!nested)
3725 goto nla_put_failure;
3726 - if (nla_put_string(skb, IPSET_ATTR_NAME,
3727 - ip_set_name_byindex(map->net, e->id)))
3728 + ip_set_name_byindex(map->net, e->id, name);
3729 + if (nla_put_string(skb, IPSET_ATTR_NAME, name))
3730 goto nla_put_failure;
3731 if (ip_set_put_extensions(skb, set, e, true))
3732 goto nla_put_failure;
3733 diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c
3734 index 32535eea51b2..ad2fe6a7e47d 100644
3735 --- a/net/netfilter/nft_compat.c
3736 +++ b/net/netfilter/nft_compat.c
3737 @@ -54,9 +54,11 @@ static bool nft_xt_put(struct nft_xt *xt)
3738 return false;
3739 }
3740
3741 -static int nft_compat_chain_validate_dependency(const char *tablename,
3742 - const struct nft_chain *chain)
3743 +static int nft_compat_chain_validate_dependency(const struct nft_ctx *ctx,
3744 + const char *tablename)
3745 {
3746 + enum nft_chain_types type = NFT_CHAIN_T_DEFAULT;
3747 + const struct nft_chain *chain = ctx->chain;
3748 const struct nft_base_chain *basechain;
3749
3750 if (!tablename ||
3751 @@ -64,9 +66,12 @@ static int nft_compat_chain_validate_dependency(const char *tablename,
3752 return 0;
3753
3754 basechain = nft_base_chain(chain);
3755 - if (strcmp(tablename, "nat") == 0 &&
3756 - basechain->type->type != NFT_CHAIN_T_NAT)
3757 - return -EINVAL;
3758 + if (strcmp(tablename, "nat") == 0) {
3759 + if (ctx->family != NFPROTO_BRIDGE)
3760 + type = NFT_CHAIN_T_NAT;
3761 + if (basechain->type->type != type)
3762 + return -EINVAL;
3763 + }
3764
3765 return 0;
3766 }
3767 @@ -323,8 +328,7 @@ static int nft_target_validate(const struct nft_ctx *ctx,
3768 if (target->hooks && !(hook_mask & target->hooks))
3769 return -EINVAL;
3770
3771 - ret = nft_compat_chain_validate_dependency(target->table,
3772 - ctx->chain);
3773 + ret = nft_compat_chain_validate_dependency(ctx, target->table);
3774 if (ret < 0)
3775 return ret;
3776 }
3777 @@ -570,8 +574,7 @@ static int nft_match_validate(const struct nft_ctx *ctx,
3778 if (match->hooks && !(hook_mask & match->hooks))
3779 return -EINVAL;
3780
3781 - ret = nft_compat_chain_validate_dependency(match->table,
3782 - ctx->chain);
3783 + ret = nft_compat_chain_validate_dependency(ctx, match->table);
3784 if (ret < 0)
3785 return ret;
3786 }
3787 diff --git a/net/netfilter/nft_numgen.c b/net/netfilter/nft_numgen.c
3788 index 649d1700ec5b..3cc1b3dc3c3c 100644
3789 --- a/net/netfilter/nft_numgen.c
3790 +++ b/net/netfilter/nft_numgen.c
3791 @@ -24,7 +24,6 @@ struct nft_ng_inc {
3792 u32 modulus;
3793 atomic_t counter;
3794 u32 offset;
3795 - struct nft_set *map;
3796 };
3797
3798 static u32 nft_ng_inc_gen(struct nft_ng_inc *priv)
3799 @@ -48,34 +47,11 @@ static void nft_ng_inc_eval(const struct nft_expr *expr,
3800 regs->data[priv->dreg] = nft_ng_inc_gen(priv);
3801 }
3802
3803 -static void nft_ng_inc_map_eval(const struct nft_expr *expr,
3804 - struct nft_regs *regs,
3805 - const struct nft_pktinfo *pkt)
3806 -{
3807 - struct nft_ng_inc *priv = nft_expr_priv(expr);
3808 - const struct nft_set *map = priv->map;
3809 - const struct nft_set_ext *ext;
3810 - u32 result;
3811 - bool found;
3812 -
3813 - result = nft_ng_inc_gen(priv);
3814 - found = map->ops->lookup(nft_net(pkt), map, &result, &ext);
3815 -
3816 - if (!found)
3817 - return;
3818 -
3819 - nft_data_copy(&regs->data[priv->dreg],
3820 - nft_set_ext_data(ext), map->dlen);
3821 -}
3822 -
3823 static const struct nla_policy nft_ng_policy[NFTA_NG_MAX + 1] = {
3824 [NFTA_NG_DREG] = { .type = NLA_U32 },
3825 [NFTA_NG_MODULUS] = { .type = NLA_U32 },
3826 [NFTA_NG_TYPE] = { .type = NLA_U32 },
3827 [NFTA_NG_OFFSET] = { .type = NLA_U32 },
3828 - [NFTA_NG_SET_NAME] = { .type = NLA_STRING,
3829 - .len = NFT_SET_MAXNAMELEN - 1 },
3830 - [NFTA_NG_SET_ID] = { .type = NLA_U32 },
3831 };
3832
3833 static int nft_ng_inc_init(const struct nft_ctx *ctx,
3834 @@ -101,22 +77,6 @@ static int nft_ng_inc_init(const struct nft_ctx *ctx,
3835 NFT_DATA_VALUE, sizeof(u32));
3836 }
3837
3838 -static int nft_ng_inc_map_init(const struct nft_ctx *ctx,
3839 - const struct nft_expr *expr,
3840 - const struct nlattr * const tb[])
3841 -{
3842 - struct nft_ng_inc *priv = nft_expr_priv(expr);
3843 - u8 genmask = nft_genmask_next(ctx->net);
3844 -
3845 - nft_ng_inc_init(ctx, expr, tb);
3846 -
3847 - priv->map = nft_set_lookup_global(ctx->net, ctx->table,
3848 - tb[NFTA_NG_SET_NAME],
3849 - tb[NFTA_NG_SET_ID], genmask);
3850 -
3851 - return PTR_ERR_OR_ZERO(priv->map);
3852 -}
3853 -
3854 static int nft_ng_dump(struct sk_buff *skb, enum nft_registers dreg,
3855 u32 modulus, enum nft_ng_types type, u32 offset)
3856 {
3857 @@ -143,27 +103,10 @@ static int nft_ng_inc_dump(struct sk_buff *skb, const struct nft_expr *expr)
3858 priv->offset);
3859 }
3860
3861 -static int nft_ng_inc_map_dump(struct sk_buff *skb,
3862 - const struct nft_expr *expr)
3863 -{
3864 - const struct nft_ng_inc *priv = nft_expr_priv(expr);
3865 -
3866 - if (nft_ng_dump(skb, priv->dreg, priv->modulus,
3867 - NFT_NG_INCREMENTAL, priv->offset) ||
3868 - nla_put_string(skb, NFTA_NG_SET_NAME, priv->map->name))
3869 - goto nla_put_failure;
3870 -
3871 - return 0;
3872 -
3873 -nla_put_failure:
3874 - return -1;
3875 -}
3876 -
3877 struct nft_ng_random {
3878 enum nft_registers dreg:8;
3879 u32 modulus;
3880 u32 offset;
3881 - struct nft_set *map;
3882 };
3883
3884 static u32 nft_ng_random_gen(struct nft_ng_random *priv)
3885 @@ -183,25 +126,6 @@ static void nft_ng_random_eval(const struct nft_expr *expr,
3886 regs->data[priv->dreg] = nft_ng_random_gen(priv);
3887 }
3888
3889 -static void nft_ng_random_map_eval(const struct nft_expr *expr,
3890 - struct nft_regs *regs,
3891 - const struct nft_pktinfo *pkt)
3892 -{
3893 - struct nft_ng_random *priv = nft_expr_priv(expr);
3894 - const struct nft_set *map = priv->map;
3895 - const struct nft_set_ext *ext;
3896 - u32 result;
3897 - bool found;
3898 -
3899 - result = nft_ng_random_gen(priv);
3900 - found = map->ops->lookup(nft_net(pkt), map, &result, &ext);
3901 - if (!found)
3902 - return;
3903 -
3904 - nft_data_copy(&regs->data[priv->dreg],
3905 - nft_set_ext_data(ext), map->dlen);
3906 -}
3907 -
3908 static int nft_ng_random_init(const struct nft_ctx *ctx,
3909 const struct nft_expr *expr,
3910 const struct nlattr * const tb[])
3911 @@ -226,21 +150,6 @@ static int nft_ng_random_init(const struct nft_ctx *ctx,
3912 NFT_DATA_VALUE, sizeof(u32));
3913 }
3914
3915 -static int nft_ng_random_map_init(const struct nft_ctx *ctx,
3916 - const struct nft_expr *expr,
3917 - const struct nlattr * const tb[])
3918 -{
3919 - struct nft_ng_random *priv = nft_expr_priv(expr);
3920 - u8 genmask = nft_genmask_next(ctx->net);
3921 -
3922 - nft_ng_random_init(ctx, expr, tb);
3923 - priv->map = nft_set_lookup_global(ctx->net, ctx->table,
3924 - tb[NFTA_NG_SET_NAME],
3925 - tb[NFTA_NG_SET_ID], genmask);
3926 -
3927 - return PTR_ERR_OR_ZERO(priv->map);
3928 -}
3929 -
3930 static int nft_ng_random_dump(struct sk_buff *skb, const struct nft_expr *expr)
3931 {
3932 const struct nft_ng_random *priv = nft_expr_priv(expr);
3933 @@ -249,22 +158,6 @@ static int nft_ng_random_dump(struct sk_buff *skb, const struct nft_expr *expr)
3934 priv->offset);
3935 }
3936
3937 -static int nft_ng_random_map_dump(struct sk_buff *skb,
3938 - const struct nft_expr *expr)
3939 -{
3940 - const struct nft_ng_random *priv = nft_expr_priv(expr);
3941 -
3942 - if (nft_ng_dump(skb, priv->dreg, priv->modulus,
3943 - NFT_NG_RANDOM, priv->offset) ||
3944 - nla_put_string(skb, NFTA_NG_SET_NAME, priv->map->name))
3945 - goto nla_put_failure;
3946 -
3947 - return 0;
3948 -
3949 -nla_put_failure:
3950 - return -1;
3951 -}
3952 -
3953 static struct nft_expr_type nft_ng_type;
3954 static const struct nft_expr_ops nft_ng_inc_ops = {
3955 .type = &nft_ng_type,
3956 @@ -274,14 +167,6 @@ static const struct nft_expr_ops nft_ng_inc_ops = {
3957 .dump = nft_ng_inc_dump,
3958 };
3959
3960 -static const struct nft_expr_ops nft_ng_inc_map_ops = {
3961 - .type = &nft_ng_type,
3962 - .size = NFT_EXPR_SIZE(sizeof(struct nft_ng_inc)),
3963 - .eval = nft_ng_inc_map_eval,
3964 - .init = nft_ng_inc_map_init,
3965 - .dump = nft_ng_inc_map_dump,
3966 -};
3967 -
3968 static const struct nft_expr_ops nft_ng_random_ops = {
3969 .type = &nft_ng_type,
3970 .size = NFT_EXPR_SIZE(sizeof(struct nft_ng_random)),
3971 @@ -290,14 +175,6 @@ static const struct nft_expr_ops nft_ng_random_ops = {
3972 .dump = nft_ng_random_dump,
3973 };
3974
3975 -static const struct nft_expr_ops nft_ng_random_map_ops = {
3976 - .type = &nft_ng_type,
3977 - .size = NFT_EXPR_SIZE(sizeof(struct nft_ng_random)),
3978 - .eval = nft_ng_random_map_eval,
3979 - .init = nft_ng_random_map_init,
3980 - .dump = nft_ng_random_map_dump,
3981 -};
3982 -
3983 static const struct nft_expr_ops *
3984 nft_ng_select_ops(const struct nft_ctx *ctx, const struct nlattr * const tb[])
3985 {
3986 @@ -312,12 +189,8 @@ nft_ng_select_ops(const struct nft_ctx *ctx, const struct nlattr * const tb[])
3987
3988 switch (type) {
3989 case NFT_NG_INCREMENTAL:
3990 - if (tb[NFTA_NG_SET_NAME])
3991 - return &nft_ng_inc_map_ops;
3992 return &nft_ng_inc_ops;
3993 case NFT_NG_RANDOM:
3994 - if (tb[NFTA_NG_SET_NAME])
3995 - return &nft_ng_random_map_ops;
3996 return &nft_ng_random_ops;
3997 }
3998
3999 diff --git a/net/netfilter/xt_IDLETIMER.c b/net/netfilter/xt_IDLETIMER.c
4000 index 5ee859193783..25453a16385e 100644
4001 --- a/net/netfilter/xt_IDLETIMER.c
4002 +++ b/net/netfilter/xt_IDLETIMER.c
4003 @@ -116,6 +116,22 @@ static void idletimer_tg_expired(struct timer_list *t)
4004 schedule_work(&timer->work);
4005 }
4006
4007 +static int idletimer_check_sysfs_name(const char *name, unsigned int size)
4008 +{
4009 + int ret;
4010 +
4011 + ret = xt_check_proc_name(name, size);
4012 + if (ret < 0)
4013 + return ret;
4014 +
4015 + if (!strcmp(name, "power") ||
4016 + !strcmp(name, "subsystem") ||
4017 + !strcmp(name, "uevent"))
4018 + return -EINVAL;
4019 +
4020 + return 0;
4021 +}
4022 +
4023 static int idletimer_tg_create(struct idletimer_tg_info *info)
4024 {
4025 int ret;
4026 @@ -126,6 +142,10 @@ static int idletimer_tg_create(struct idletimer_tg_info *info)
4027 goto out;
4028 }
4029
4030 + ret = idletimer_check_sysfs_name(info->label, sizeof(info->label));
4031 + if (ret < 0)
4032 + goto out_free_timer;
4033 +
4034 sysfs_attr_init(&info->timer->attr.attr);
4035 info->timer->attr.attr.name = kstrdup(info->label, GFP_KERNEL);
4036 if (!info->timer->attr.attr.name) {
4037 diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
4038 index b53cc0960b5d..ac16f509c95c 100644
4039 --- a/net/sunrpc/xdr.c
4040 +++ b/net/sunrpc/xdr.c
4041 @@ -512,7 +512,7 @@ EXPORT_SYMBOL_GPL(xdr_commit_encode);
4042 static __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr,
4043 size_t nbytes)
4044 {
4045 - static __be32 *p;
4046 + __be32 *p;
4047 int space_left;
4048 int frag1bytes, frag2bytes;
4049
4050 diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
4051 index 663a7f343b42..edcad61fe3cd 100755
4052 --- a/scripts/package/mkdebian
4053 +++ b/scripts/package/mkdebian
4054 @@ -88,6 +88,7 @@ set_debarch() {
4055 version=$KERNELRELEASE
4056 if [ -n "$KDEB_PKGVERSION" ]; then
4057 packageversion=$KDEB_PKGVERSION
4058 + revision=${packageversion##*-}
4059 else
4060 revision=$(cat .version 2>/dev/null||echo 1)
4061 packageversion=$version-$revision
4062 @@ -205,10 +206,12 @@ cat <<EOF > debian/rules
4063 #!$(command -v $MAKE) -f
4064
4065 build:
4066 - \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} KBUILD_SRC=
4067 + \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
4068 + KBUILD_BUILD_VERSION=${revision} KBUILD_SRC=
4069
4070 binary-arch:
4071 - \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} KBUILD_SRC= intdeb-pkg
4072 + \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
4073 + KBUILD_BUILD_VERSION=${revision} KBUILD_SRC= intdeb-pkg
4074
4075 clean:
4076 rm -rf debian/*tmp debian/files
4077 diff --git a/scripts/setlocalversion b/scripts/setlocalversion
4078 index 79f7dd57d571..71f39410691b 100755
4079 --- a/scripts/setlocalversion
4080 +++ b/scripts/setlocalversion
4081 @@ -74,7 +74,7 @@ scm_version()
4082 fi
4083
4084 # Check for uncommitted changes
4085 - if git status -uno --porcelain | grep -qv '^.. scripts/package'; then
4086 + if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then
4087 printf '%s' -dirty
4088 fi
4089
4090 diff --git a/security/apparmor/lib.c b/security/apparmor/lib.c
4091 index 974affe50531..76491e7f4177 100644
4092 --- a/security/apparmor/lib.c
4093 +++ b/security/apparmor/lib.c
4094 @@ -90,10 +90,12 @@ const char *aa_splitn_fqname(const char *fqname, size_t n, const char **ns_name,
4095 const char *end = fqname + n;
4096 const char *name = skipn_spaces(fqname, n);
4097
4098 - if (!name)
4099 - return NULL;
4100 *ns_name = NULL;
4101 *ns_len = 0;
4102 +
4103 + if (!name)
4104 + return NULL;
4105 +
4106 if (name[0] == ':') {
4107 char *split = strnchr(&name[1], end - &name[1], ':');
4108 *ns_name = skipn_spaces(&name[1], end - &name[1]);
4109 diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
4110 index 0166a3d7cd55..dffd60cebc31 100644
4111 --- a/sound/pci/hda/patch_ca0132.c
4112 +++ b/sound/pci/hda/patch_ca0132.c
4113 @@ -7395,7 +7395,7 @@ static void ca0132_free(struct hda_codec *codec)
4114
4115 snd_hda_power_down(codec);
4116 if (spec->mem_base)
4117 - iounmap(spec->mem_base);
4118 + pci_iounmap(codec->bus->pci, spec->mem_base);
4119 kfree(spec->spec_init_verbs);
4120 kfree(codec->spec);
4121 }
4122 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
4123 index 1070749c3cf4..e58537e13ad3 100644
4124 --- a/sound/pci/hda/patch_realtek.c
4125 +++ b/sound/pci/hda/patch_realtek.c
4126 @@ -6481,6 +6481,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4127 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4128 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4129 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
4130 + SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
4131 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
4132 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
4133 SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
4134 diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c
4135 index ac1bcdc17dae..f7eb63cbbc65 100644
4136 --- a/tools/perf/jvmti/jvmti_agent.c
4137 +++ b/tools/perf/jvmti/jvmti_agent.c
4138 @@ -125,7 +125,7 @@ perf_get_timestamp(void)
4139 }
4140
4141 static int
4142 -debug_cache_init(void)
4143 +create_jit_cache_dir(void)
4144 {
4145 char str[32];
4146 char *base, *p;
4147 @@ -144,8 +144,13 @@ debug_cache_init(void)
4148
4149 strftime(str, sizeof(str), JIT_LANG"-jit-%Y%m%d", &tm);
4150
4151 - snprintf(jit_path, PATH_MAX - 1, "%s/.debug/", base);
4152 -
4153 + ret = snprintf(jit_path, PATH_MAX, "%s/.debug/", base);
4154 + if (ret >= PATH_MAX) {
4155 + warnx("jvmti: cannot generate jit cache dir because %s/.debug/"
4156 + " is too long, please check the cwd, JITDUMPDIR, and"
4157 + " HOME variables", base);
4158 + return -1;
4159 + }
4160 ret = mkdir(jit_path, 0755);
4161 if (ret == -1) {
4162 if (errno != EEXIST) {
4163 @@ -154,20 +159,32 @@ debug_cache_init(void)
4164 }
4165 }
4166
4167 - snprintf(jit_path, PATH_MAX - 1, "%s/.debug/jit", base);
4168 + ret = snprintf(jit_path, PATH_MAX, "%s/.debug/jit", base);
4169 + if (ret >= PATH_MAX) {
4170 + warnx("jvmti: cannot generate jit cache dir because"
4171 + " %s/.debug/jit is too long, please check the cwd,"
4172 + " JITDUMPDIR, and HOME variables", base);
4173 + return -1;
4174 + }
4175 ret = mkdir(jit_path, 0755);
4176 if (ret == -1) {
4177 if (errno != EEXIST) {
4178 - warn("cannot create jit cache dir %s", jit_path);
4179 + warn("jvmti: cannot create jit cache dir %s", jit_path);
4180 return -1;
4181 }
4182 }
4183
4184 - snprintf(jit_path, PATH_MAX - 1, "%s/.debug/jit/%s.XXXXXXXX", base, str);
4185 -
4186 + ret = snprintf(jit_path, PATH_MAX, "%s/.debug/jit/%s.XXXXXXXX", base, str);
4187 + if (ret >= PATH_MAX) {
4188 + warnx("jvmti: cannot generate jit cache dir because"
4189 + " %s/.debug/jit/%s.XXXXXXXX is too long, please check"
4190 + " the cwd, JITDUMPDIR, and HOME variables",
4191 + base, str);
4192 + return -1;
4193 + }
4194 p = mkdtemp(jit_path);
4195 if (p != jit_path) {
4196 - warn("cannot create jit cache dir %s", jit_path);
4197 + warn("jvmti: cannot create jit cache dir %s", jit_path);
4198 return -1;
4199 }
4200
4201 @@ -228,7 +245,7 @@ void *jvmti_open(void)
4202 {
4203 char dump_path[PATH_MAX];
4204 struct jitheader header;
4205 - int fd;
4206 + int fd, ret;
4207 FILE *fp;
4208
4209 init_arch_timestamp();
4210 @@ -245,12 +262,22 @@ void *jvmti_open(void)
4211
4212 memset(&header, 0, sizeof(header));
4213
4214 - debug_cache_init();
4215 + /*
4216 + * jitdump file dir
4217 + */
4218 + if (create_jit_cache_dir() < 0)
4219 + return NULL;
4220
4221 /*
4222 * jitdump file name
4223 */
4224 - scnprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid());
4225 + ret = snprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid());
4226 + if (ret >= PATH_MAX) {
4227 + warnx("jvmti: cannot generate jitdump file full path because"
4228 + " %s/jit-%i.dump is too long, please check the cwd,"
4229 + " JITDUMPDIR, and HOME variables", jit_path, getpid());
4230 + return NULL;
4231 + }
4232
4233 fd = open(dump_path, O_CREAT|O_TRUNC|O_RDWR, 0666);
4234 if (fd == -1)
4235 diff --git a/tools/perf/tests/attr/test-record-group-sampling b/tools/perf/tests/attr/test-record-group-sampling
4236 index 8a33ca4f9e1f..f0729c454f16 100644
4237 --- a/tools/perf/tests/attr/test-record-group-sampling
4238 +++ b/tools/perf/tests/attr/test-record-group-sampling
4239 @@ -37,4 +37,3 @@ sample_freq=0
4240 sample_period=0
4241 freq=0
4242 write_backward=0
4243 -sample_id_all=0
4244 diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
4245 index e596ae358c4d..03a72310315f 100644
4246 --- a/tools/perf/util/evsel.c
4247 +++ b/tools/perf/util/evsel.c
4248 @@ -952,7 +952,6 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
4249 attr->sample_freq = 0;
4250 attr->sample_period = 0;
4251 attr->write_backward = 0;
4252 - attr->sample_id_all = 0;
4253 }
4254
4255 if (opts->no_samples)
4256 diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
4257 index 29770ea61768..6e70cc00c161 100644
4258 --- a/tools/perf/util/symbol-elf.c
4259 +++ b/tools/perf/util/symbol-elf.c
4260 @@ -324,7 +324,17 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss)
4261 plt_entry_size = 16;
4262 break;
4263
4264 - default: /* FIXME: s390/alpha/mips/parisc/poperpc/sh/sparc/xtensa need to be checked */
4265 + case EM_SPARC:
4266 + plt_header_size = 48;
4267 + plt_entry_size = 12;
4268 + break;
4269 +
4270 + case EM_SPARCV9:
4271 + plt_header_size = 128;
4272 + plt_entry_size = 32;
4273 + break;
4274 +
4275 + default: /* FIXME: s390/alpha/mips/parisc/poperpc/sh/xtensa need to be checked */
4276 plt_header_size = shdr_plt.sh_entsize;
4277 plt_entry_size = shdr_plt.sh_entsize;
4278 break;
4279 diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
4280 index 6f318b15950e..5eff9bfc5758 100644
4281 --- a/tools/perf/util/unwind-libdw.c
4282 +++ b/tools/perf/util/unwind-libdw.c
4283 @@ -45,13 +45,13 @@ static int __report_module(struct addr_location *al, u64 ip,
4284 Dwarf_Addr s;
4285
4286 dwfl_module_info(mod, NULL, &s, NULL, NULL, NULL, NULL, NULL);
4287 - if (s != al->map->start)
4288 + if (s != al->map->start - al->map->pgoff)
4289 mod = 0;
4290 }
4291
4292 if (!mod)
4293 mod = dwfl_report_elf(ui->dwfl, dso->short_name,
4294 - (dso->symsrc_filename ? dso->symsrc_filename : dso->long_name), -1, al->map->start,
4295 + (dso->symsrc_filename ? dso->symsrc_filename : dso->long_name), -1, al->map->start - al->map->pgoff,
4296 false);
4297
4298 return mod && dwfl_addrmodule(ui->dwfl, ip) == mod ? 0 : -1;