1 |
commit: 54ae6ee8b5bae9dc320080c834184ead5030ce4c |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 26 10:40:05 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 26 10:40:05 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=54ae6ee8 |
7 |
|
8 |
Linux patch 4.18.10 |
9 |
|
10 |
0000_README | 4 + |
11 |
1009_linux-4.18.10.patch | 6974 ++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 6978 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 6534d27..a9e2bd7 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -79,6 +79,10 @@ Patch: 1008_linux-4.18.9.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.18.9 |
21 |
|
22 |
+Patch: 1009_linux-4.18.10.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.18.10 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1009_linux-4.18.10.patch b/1009_linux-4.18.10.patch |
31 |
new file mode 100644 |
32 |
index 0000000..16ee162 |
33 |
--- /dev/null |
34 |
+++ b/1009_linux-4.18.10.patch |
35 |
@@ -0,0 +1,6974 @@ |
36 |
+diff --git a/Makefile b/Makefile |
37 |
+index 1178348fb9ca..ffab15235ff0 100644 |
38 |
+--- a/Makefile |
39 |
++++ b/Makefile |
40 |
+@@ -1,7 +1,7 @@ |
41 |
+ # SPDX-License-Identifier: GPL-2.0 |
42 |
+ VERSION = 4 |
43 |
+ PATCHLEVEL = 18 |
44 |
+-SUBLEVEL = 9 |
45 |
++SUBLEVEL = 10 |
46 |
+ EXTRAVERSION = |
47 |
+ NAME = Merciless Moray |
48 |
+ |
49 |
+@@ -225,10 +225,12 @@ no-dot-config-targets := $(clean-targets) \ |
50 |
+ cscope gtags TAGS tags help% %docs check% coccicheck \ |
51 |
+ $(version_h) headers_% archheaders archscripts \ |
52 |
+ kernelversion %src-pkg |
53 |
++no-sync-config-targets := $(no-dot-config-targets) install %install |
54 |
+ |
55 |
+-config-targets := 0 |
56 |
+-mixed-targets := 0 |
57 |
+-dot-config := 1 |
58 |
++config-targets := 0 |
59 |
++mixed-targets := 0 |
60 |
++dot-config := 1 |
61 |
++may-sync-config := 1 |
62 |
+ |
63 |
+ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) |
64 |
+ ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) |
65 |
+@@ -236,6 +238,16 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) |
66 |
+ endif |
67 |
+ endif |
68 |
+ |
69 |
++ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),) |
70 |
++ ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),) |
71 |
++ may-sync-config := 0 |
72 |
++ endif |
73 |
++endif |
74 |
++ |
75 |
++ifneq ($(KBUILD_EXTMOD),) |
76 |
++ may-sync-config := 0 |
77 |
++endif |
78 |
++ |
79 |
+ ifeq ($(KBUILD_EXTMOD),) |
80 |
+ ifneq ($(filter config %config,$(MAKECMDGOALS)),) |
81 |
+ config-targets := 1 |
82 |
+@@ -610,7 +622,7 @@ ARCH_CFLAGS := |
83 |
+ include arch/$(SRCARCH)/Makefile |
84 |
+ |
85 |
+ ifeq ($(dot-config),1) |
86 |
+-ifeq ($(KBUILD_EXTMOD),) |
87 |
++ifeq ($(may-sync-config),1) |
88 |
+ # Read in dependencies to all Kconfig* files, make sure to run syncconfig if |
89 |
+ # changes are detected. This should be included after arch/$(SRCARCH)/Makefile |
90 |
+ # because some architectures define CROSS_COMPILE there. |
91 |
+@@ -625,8 +637,9 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; |
92 |
+ include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd |
93 |
+ $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig |
94 |
+ else |
95 |
+-# external modules needs include/generated/autoconf.h and include/config/auto.conf |
96 |
+-# but do not care if they are up-to-date. Use auto.conf to trigger the test |
97 |
++# External modules and some install targets need include/generated/autoconf.h |
98 |
++# and include/config/auto.conf but do not care if they are up-to-date. |
99 |
++# Use auto.conf to trigger the test |
100 |
+ PHONY += include/config/auto.conf |
101 |
+ |
102 |
+ include/config/auto.conf: |
103 |
+@@ -638,7 +651,7 @@ include/config/auto.conf: |
104 |
+ echo >&2 ; \ |
105 |
+ /bin/false) |
106 |
+ |
107 |
+-endif # KBUILD_EXTMOD |
108 |
++endif # may-sync-config |
109 |
+ |
110 |
+ else |
111 |
+ # Dummy target needed, because used as prerequisite |
112 |
+diff --git a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts |
113 |
+index 4dc0b347b1ee..c2dc9d09484a 100644 |
114 |
+--- a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts |
115 |
++++ b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts |
116 |
+@@ -189,6 +189,8 @@ |
117 |
+ regulator-max-microvolt = <2950000>; |
118 |
+ |
119 |
+ regulator-boot-on; |
120 |
++ regulator-system-load = <200000>; |
121 |
++ regulator-allow-set-load; |
122 |
+ }; |
123 |
+ |
124 |
+ l21 { |
125 |
+diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c |
126 |
+index d3db306a5a70..941b0ffd9806 100644 |
127 |
+--- a/arch/arm/mach-exynos/suspend.c |
128 |
++++ b/arch/arm/mach-exynos/suspend.c |
129 |
+@@ -203,6 +203,7 @@ static int __init exynos_pmu_irq_init(struct device_node *node, |
130 |
+ NULL); |
131 |
+ if (!domain) { |
132 |
+ iounmap(pmu_base_addr); |
133 |
++ pmu_base_addr = NULL; |
134 |
+ return -ENOMEM; |
135 |
+ } |
136 |
+ |
137 |
+diff --git a/arch/arm/mach-hisi/hotplug.c b/arch/arm/mach-hisi/hotplug.c |
138 |
+index a129aae72602..909bb2493781 100644 |
139 |
+--- a/arch/arm/mach-hisi/hotplug.c |
140 |
++++ b/arch/arm/mach-hisi/hotplug.c |
141 |
+@@ -148,13 +148,20 @@ static int hi3xxx_hotplug_init(void) |
142 |
+ struct device_node *node; |
143 |
+ |
144 |
+ node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl"); |
145 |
+- if (node) { |
146 |
+- ctrl_base = of_iomap(node, 0); |
147 |
+- id = HI3620_CTRL; |
148 |
+- return 0; |
149 |
++ if (!node) { |
150 |
++ id = ERROR_CTRL; |
151 |
++ return -ENOENT; |
152 |
+ } |
153 |
+- id = ERROR_CTRL; |
154 |
+- return -ENOENT; |
155 |
++ |
156 |
++ ctrl_base = of_iomap(node, 0); |
157 |
++ of_node_put(node); |
158 |
++ if (!ctrl_base) { |
159 |
++ id = ERROR_CTRL; |
160 |
++ return -ENOMEM; |
161 |
++ } |
162 |
++ |
163 |
++ id = HI3620_CTRL; |
164 |
++ return 0; |
165 |
+ } |
166 |
+ |
167 |
+ void hi3xxx_set_cpu(int cpu, bool enable) |
168 |
+@@ -173,11 +180,15 @@ static bool hix5hd2_hotplug_init(void) |
169 |
+ struct device_node *np; |
170 |
+ |
171 |
+ np = of_find_compatible_node(NULL, NULL, "hisilicon,cpuctrl"); |
172 |
+- if (np) { |
173 |
+- ctrl_base = of_iomap(np, 0); |
174 |
+- return true; |
175 |
+- } |
176 |
+- return false; |
177 |
++ if (!np) |
178 |
++ return false; |
179 |
++ |
180 |
++ ctrl_base = of_iomap(np, 0); |
181 |
++ of_node_put(np); |
182 |
++ if (!ctrl_base) |
183 |
++ return false; |
184 |
++ |
185 |
++ return true; |
186 |
+ } |
187 |
+ |
188 |
+ void hix5hd2_set_cpu(int cpu, bool enable) |
189 |
+@@ -219,10 +230,10 @@ void hip01_set_cpu(int cpu, bool enable) |
190 |
+ |
191 |
+ if (!ctrl_base) { |
192 |
+ np = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl"); |
193 |
+- if (np) |
194 |
+- ctrl_base = of_iomap(np, 0); |
195 |
+- else |
196 |
+- BUG(); |
197 |
++ BUG_ON(!np); |
198 |
++ ctrl_base = of_iomap(np, 0); |
199 |
++ of_node_put(np); |
200 |
++ BUG_ON(!ctrl_base); |
201 |
+ } |
202 |
+ |
203 |
+ if (enable) { |
204 |
+diff --git a/arch/arm64/boot/dts/mediatek/mt7622.dtsi b/arch/arm64/boot/dts/mediatek/mt7622.dtsi |
205 |
+index 9213c966c224..ec7ea8dca777 100644 |
206 |
+--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi |
207 |
++++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi |
208 |
+@@ -331,7 +331,7 @@ |
209 |
+ reg = <0 0x11002000 0 0x400>; |
210 |
+ interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_LOW>; |
211 |
+ clocks = <&topckgen CLK_TOP_UART_SEL>, |
212 |
+- <&pericfg CLK_PERI_UART1_PD>; |
213 |
++ <&pericfg CLK_PERI_UART0_PD>; |
214 |
+ clock-names = "baud", "bus"; |
215 |
+ status = "disabled"; |
216 |
+ }; |
217 |
+diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi |
218 |
+index 9ff848792712..78ce3979ef09 100644 |
219 |
+--- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi |
220 |
++++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi |
221 |
+@@ -338,7 +338,7 @@ |
222 |
+ led@6 { |
223 |
+ label = "apq8016-sbc:blue:bt"; |
224 |
+ gpios = <&pm8916_mpps 3 GPIO_ACTIVE_HIGH>; |
225 |
+- linux,default-trigger = "bt"; |
226 |
++ linux,default-trigger = "bluetooth-power"; |
227 |
+ default-state = "off"; |
228 |
+ }; |
229 |
+ }; |
230 |
+diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi |
231 |
+index 0298bd0d0e1a..caf112629caa 100644 |
232 |
+--- a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi |
233 |
++++ b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi |
234 |
+@@ -58,6 +58,7 @@ |
235 |
+ clocks = <&sys_clk 32>; |
236 |
+ enable-method = "psci"; |
237 |
+ operating-points-v2 = <&cluster0_opp>; |
238 |
++ #cooling-cells = <2>; |
239 |
+ }; |
240 |
+ |
241 |
+ cpu2: cpu@100 { |
242 |
+@@ -77,6 +78,7 @@ |
243 |
+ clocks = <&sys_clk 33>; |
244 |
+ enable-method = "psci"; |
245 |
+ operating-points-v2 = <&cluster1_opp>; |
246 |
++ #cooling-cells = <2>; |
247 |
+ }; |
248 |
+ }; |
249 |
+ |
250 |
+diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c |
251 |
+index 33147aacdafd..dd5b4fab114f 100644 |
252 |
+--- a/arch/arm64/kernel/perf_event.c |
253 |
++++ b/arch/arm64/kernel/perf_event.c |
254 |
+@@ -670,6 +670,28 @@ static void armv8pmu_disable_event(struct perf_event *event) |
255 |
+ raw_spin_unlock_irqrestore(&events->pmu_lock, flags); |
256 |
+ } |
257 |
+ |
258 |
++static void armv8pmu_start(struct arm_pmu *cpu_pmu) |
259 |
++{ |
260 |
++ unsigned long flags; |
261 |
++ struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events); |
262 |
++ |
263 |
++ raw_spin_lock_irqsave(&events->pmu_lock, flags); |
264 |
++ /* Enable all counters */ |
265 |
++ armv8pmu_pmcr_write(armv8pmu_pmcr_read() | ARMV8_PMU_PMCR_E); |
266 |
++ raw_spin_unlock_irqrestore(&events->pmu_lock, flags); |
267 |
++} |
268 |
++ |
269 |
++static void armv8pmu_stop(struct arm_pmu *cpu_pmu) |
270 |
++{ |
271 |
++ unsigned long flags; |
272 |
++ struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events); |
273 |
++ |
274 |
++ raw_spin_lock_irqsave(&events->pmu_lock, flags); |
275 |
++ /* Disable all counters */ |
276 |
++ armv8pmu_pmcr_write(armv8pmu_pmcr_read() & ~ARMV8_PMU_PMCR_E); |
277 |
++ raw_spin_unlock_irqrestore(&events->pmu_lock, flags); |
278 |
++} |
279 |
++ |
280 |
+ static irqreturn_t armv8pmu_handle_irq(struct arm_pmu *cpu_pmu) |
281 |
+ { |
282 |
+ u32 pmovsr; |
283 |
+@@ -694,6 +716,11 @@ static irqreturn_t armv8pmu_handle_irq(struct arm_pmu *cpu_pmu) |
284 |
+ */ |
285 |
+ regs = get_irq_regs(); |
286 |
+ |
287 |
++ /* |
288 |
++ * Stop the PMU while processing the counter overflows |
289 |
++ * to prevent skews in group events. |
290 |
++ */ |
291 |
++ armv8pmu_stop(cpu_pmu); |
292 |
+ for (idx = 0; idx < cpu_pmu->num_events; ++idx) { |
293 |
+ struct perf_event *event = cpuc->events[idx]; |
294 |
+ struct hw_perf_event *hwc; |
295 |
+@@ -718,6 +745,7 @@ static irqreturn_t armv8pmu_handle_irq(struct arm_pmu *cpu_pmu) |
296 |
+ if (perf_event_overflow(event, &data, regs)) |
297 |
+ cpu_pmu->disable(event); |
298 |
+ } |
299 |
++ armv8pmu_start(cpu_pmu); |
300 |
+ |
301 |
+ /* |
302 |
+ * Handle the pending perf events. |
303 |
+@@ -731,28 +759,6 @@ static irqreturn_t armv8pmu_handle_irq(struct arm_pmu *cpu_pmu) |
304 |
+ return IRQ_HANDLED; |
305 |
+ } |
306 |
+ |
307 |
+-static void armv8pmu_start(struct arm_pmu *cpu_pmu) |
308 |
+-{ |
309 |
+- unsigned long flags; |
310 |
+- struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events); |
311 |
+- |
312 |
+- raw_spin_lock_irqsave(&events->pmu_lock, flags); |
313 |
+- /* Enable all counters */ |
314 |
+- armv8pmu_pmcr_write(armv8pmu_pmcr_read() | ARMV8_PMU_PMCR_E); |
315 |
+- raw_spin_unlock_irqrestore(&events->pmu_lock, flags); |
316 |
+-} |
317 |
+- |
318 |
+-static void armv8pmu_stop(struct arm_pmu *cpu_pmu) |
319 |
+-{ |
320 |
+- unsigned long flags; |
321 |
+- struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events); |
322 |
+- |
323 |
+- raw_spin_lock_irqsave(&events->pmu_lock, flags); |
324 |
+- /* Disable all counters */ |
325 |
+- armv8pmu_pmcr_write(armv8pmu_pmcr_read() & ~ARMV8_PMU_PMCR_E); |
326 |
+- raw_spin_unlock_irqrestore(&events->pmu_lock, flags); |
327 |
+-} |
328 |
+- |
329 |
+ static int armv8pmu_get_event_idx(struct pmu_hw_events *cpuc, |
330 |
+ struct perf_event *event) |
331 |
+ { |
332 |
+diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c |
333 |
+index 5c338ce5a7fa..db5440339ab3 100644 |
334 |
+--- a/arch/arm64/kernel/ptrace.c |
335 |
++++ b/arch/arm64/kernel/ptrace.c |
336 |
+@@ -277,19 +277,22 @@ static int ptrace_hbp_set_event(unsigned int note_type, |
337 |
+ |
338 |
+ switch (note_type) { |
339 |
+ case NT_ARM_HW_BREAK: |
340 |
+- if (idx < ARM_MAX_BRP) { |
341 |
+- tsk->thread.debug.hbp_break[idx] = bp; |
342 |
+- err = 0; |
343 |
+- } |
344 |
++ if (idx >= ARM_MAX_BRP) |
345 |
++ goto out; |
346 |
++ idx = array_index_nospec(idx, ARM_MAX_BRP); |
347 |
++ tsk->thread.debug.hbp_break[idx] = bp; |
348 |
++ err = 0; |
349 |
+ break; |
350 |
+ case NT_ARM_HW_WATCH: |
351 |
+- if (idx < ARM_MAX_WRP) { |
352 |
+- tsk->thread.debug.hbp_watch[idx] = bp; |
353 |
+- err = 0; |
354 |
+- } |
355 |
++ if (idx >= ARM_MAX_WRP) |
356 |
++ goto out; |
357 |
++ idx = array_index_nospec(idx, ARM_MAX_WRP); |
358 |
++ tsk->thread.debug.hbp_watch[idx] = bp; |
359 |
++ err = 0; |
360 |
+ break; |
361 |
+ } |
362 |
+ |
363 |
++out: |
364 |
+ return err; |
365 |
+ } |
366 |
+ |
367 |
+diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c |
368 |
+index f206dafbb0a3..26a058d58d37 100644 |
369 |
+--- a/arch/mips/ath79/setup.c |
370 |
++++ b/arch/mips/ath79/setup.c |
371 |
+@@ -40,6 +40,7 @@ static char ath79_sys_type[ATH79_SYS_TYPE_LEN]; |
372 |
+ |
373 |
+ static void ath79_restart(char *command) |
374 |
+ { |
375 |
++ local_irq_disable(); |
376 |
+ ath79_device_reset_set(AR71XX_RESET_FULL_CHIP); |
377 |
+ for (;;) |
378 |
+ if (cpu_wait) |
379 |
+diff --git a/arch/mips/include/asm/mach-ath79/ath79.h b/arch/mips/include/asm/mach-ath79/ath79.h |
380 |
+index 441faa92c3cd..6e6c0fead776 100644 |
381 |
+--- a/arch/mips/include/asm/mach-ath79/ath79.h |
382 |
++++ b/arch/mips/include/asm/mach-ath79/ath79.h |
383 |
+@@ -134,6 +134,7 @@ static inline u32 ath79_pll_rr(unsigned reg) |
384 |
+ static inline void ath79_reset_wr(unsigned reg, u32 val) |
385 |
+ { |
386 |
+ __raw_writel(val, ath79_reset_base + reg); |
387 |
++ (void) __raw_readl(ath79_reset_base + reg); /* flush */ |
388 |
+ } |
389 |
+ |
390 |
+ static inline u32 ath79_reset_rr(unsigned reg) |
391 |
+diff --git a/arch/mips/jz4740/Platform b/arch/mips/jz4740/Platform |
392 |
+index 28448d358c10..a2a5a85ea1f9 100644 |
393 |
+--- a/arch/mips/jz4740/Platform |
394 |
++++ b/arch/mips/jz4740/Platform |
395 |
+@@ -1,4 +1,4 @@ |
396 |
+ platform-$(CONFIG_MACH_INGENIC) += jz4740/ |
397 |
+ cflags-$(CONFIG_MACH_INGENIC) += -I$(srctree)/arch/mips/include/asm/mach-jz4740 |
398 |
+ load-$(CONFIG_MACH_INGENIC) += 0xffffffff80010000 |
399 |
+-zload-$(CONFIG_MACH_INGENIC) += 0xffffffff80600000 |
400 |
++zload-$(CONFIG_MACH_INGENIC) += 0xffffffff81000000 |
401 |
+diff --git a/arch/mips/loongson64/common/cs5536/cs5536_ohci.c b/arch/mips/loongson64/common/cs5536/cs5536_ohci.c |
402 |
+index f7c905e50dc4..92dc6bafc127 100644 |
403 |
+--- a/arch/mips/loongson64/common/cs5536/cs5536_ohci.c |
404 |
++++ b/arch/mips/loongson64/common/cs5536/cs5536_ohci.c |
405 |
+@@ -138,7 +138,7 @@ u32 pci_ohci_read_reg(int reg) |
406 |
+ break; |
407 |
+ case PCI_OHCI_INT_REG: |
408 |
+ _rdmsr(DIVIL_MSR_REG(PIC_YSEL_LOW), &hi, &lo); |
409 |
+- if ((lo & 0x00000f00) == CS5536_USB_INTR) |
410 |
++ if (((lo >> PIC_YSEL_LOW_USB_SHIFT) & 0xf) == CS5536_USB_INTR) |
411 |
+ conf_data = 1; |
412 |
+ break; |
413 |
+ default: |
414 |
+diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c |
415 |
+index 8c456fa691a5..8167ce8e0cdd 100644 |
416 |
+--- a/arch/powerpc/kvm/book3s_64_vio.c |
417 |
++++ b/arch/powerpc/kvm/book3s_64_vio.c |
418 |
+@@ -180,7 +180,7 @@ extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, |
419 |
+ if ((tbltmp->it_page_shift <= stt->page_shift) && |
420 |
+ (tbltmp->it_offset << tbltmp->it_page_shift == |
421 |
+ stt->offset << stt->page_shift) && |
422 |
+- (tbltmp->it_size << tbltmp->it_page_shift == |
423 |
++ (tbltmp->it_size << tbltmp->it_page_shift >= |
424 |
+ stt->size << stt->page_shift)) { |
425 |
+ /* |
426 |
+ * Reference the table to avoid races with |
427 |
+@@ -296,7 +296,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm, |
428 |
+ { |
429 |
+ struct kvmppc_spapr_tce_table *stt = NULL; |
430 |
+ struct kvmppc_spapr_tce_table *siter; |
431 |
+- unsigned long npages, size; |
432 |
++ unsigned long npages, size = args->size; |
433 |
+ int ret = -ENOMEM; |
434 |
+ int i; |
435 |
+ |
436 |
+@@ -304,7 +304,6 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm, |
437 |
+ (args->offset + args->size > (ULLONG_MAX >> args->page_shift))) |
438 |
+ return -EINVAL; |
439 |
+ |
440 |
+- size = _ALIGN_UP(args->size, PAGE_SIZE >> 3); |
441 |
+ npages = kvmppc_tce_pages(size); |
442 |
+ ret = kvmppc_account_memlimit(kvmppc_stt_pages(npages), true); |
443 |
+ if (ret) |
444 |
+diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c |
445 |
+index a995513573c2..2ebd5132a29f 100644 |
446 |
+--- a/arch/powerpc/kvm/book3s_hv.c |
447 |
++++ b/arch/powerpc/kvm/book3s_hv.c |
448 |
+@@ -4562,6 +4562,8 @@ static int kvmppc_book3s_init_hv(void) |
449 |
+ pr_err("KVM-HV: Cannot determine method for accessing XICS\n"); |
450 |
+ return -ENODEV; |
451 |
+ } |
452 |
++ /* presence of intc confirmed - node can be dropped again */ |
453 |
++ of_node_put(np); |
454 |
+ } |
455 |
+ #endif |
456 |
+ |
457 |
+diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c |
458 |
+index 0d539c661748..371e33ecc547 100644 |
459 |
+--- a/arch/powerpc/platforms/powernv/opal.c |
460 |
++++ b/arch/powerpc/platforms/powernv/opal.c |
461 |
+@@ -388,7 +388,7 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len) |
462 |
+ /* Closed or other error drop */ |
463 |
+ if (rc != OPAL_SUCCESS && rc != OPAL_BUSY && |
464 |
+ rc != OPAL_BUSY_EVENT) { |
465 |
+- written = total_len; |
466 |
++ written += total_len; |
467 |
+ break; |
468 |
+ } |
469 |
+ if (rc == OPAL_SUCCESS) { |
470 |
+diff --git a/arch/s390/crypto/paes_s390.c b/arch/s390/crypto/paes_s390.c |
471 |
+index 80b27294c1de..ab9a0ebecc19 100644 |
472 |
+--- a/arch/s390/crypto/paes_s390.c |
473 |
++++ b/arch/s390/crypto/paes_s390.c |
474 |
+@@ -208,7 +208,7 @@ static int cbc_paes_crypt(struct blkcipher_desc *desc, unsigned long modifier, |
475 |
+ walk->dst.virt.addr, walk->src.virt.addr, n); |
476 |
+ if (k) |
477 |
+ ret = blkcipher_walk_done(desc, walk, nbytes - k); |
478 |
+- if (n < k) { |
479 |
++ if (k < n) { |
480 |
+ if (__cbc_paes_set_key(ctx) != 0) |
481 |
+ return blkcipher_walk_done(desc, walk, -EIO); |
482 |
+ memcpy(param.key, ctx->pk.protkey, MAXPROTKEYSIZE); |
483 |
+diff --git a/arch/x86/kernel/eisa.c b/arch/x86/kernel/eisa.c |
484 |
+index f260e452e4f8..e8c8c5d78dbd 100644 |
485 |
+--- a/arch/x86/kernel/eisa.c |
486 |
++++ b/arch/x86/kernel/eisa.c |
487 |
+@@ -7,11 +7,17 @@ |
488 |
+ #include <linux/eisa.h> |
489 |
+ #include <linux/io.h> |
490 |
+ |
491 |
++#include <xen/xen.h> |
492 |
++ |
493 |
+ static __init int eisa_bus_probe(void) |
494 |
+ { |
495 |
+- void __iomem *p = ioremap(0x0FFFD9, 4); |
496 |
++ void __iomem *p; |
497 |
++ |
498 |
++ if (xen_pv_domain() && !xen_initial_domain()) |
499 |
++ return 0; |
500 |
+ |
501 |
+- if (readl(p) == 'E' + ('I'<<8) + ('S'<<16) + ('A'<<24)) |
502 |
++ p = ioremap(0x0FFFD9, 4); |
503 |
++ if (p && readl(p) == 'E' + ('I' << 8) + ('S' << 16) + ('A' << 24)) |
504 |
+ EISA_bus = 1; |
505 |
+ iounmap(p); |
506 |
+ return 0; |
507 |
+diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c |
508 |
+index 946455e9cfef..1d2106d83b4e 100644 |
509 |
+--- a/arch/x86/mm/pti.c |
510 |
++++ b/arch/x86/mm/pti.c |
511 |
+@@ -177,7 +177,7 @@ static p4d_t *pti_user_pagetable_walk_p4d(unsigned long address) |
512 |
+ |
513 |
+ if (pgd_none(*pgd)) { |
514 |
+ unsigned long new_p4d_page = __get_free_page(gfp); |
515 |
+- if (!new_p4d_page) |
516 |
++ if (WARN_ON_ONCE(!new_p4d_page)) |
517 |
+ return NULL; |
518 |
+ |
519 |
+ set_pgd(pgd, __pgd(_KERNPG_TABLE | __pa(new_p4d_page))); |
520 |
+@@ -196,13 +196,17 @@ static p4d_t *pti_user_pagetable_walk_p4d(unsigned long address) |
521 |
+ static pmd_t *pti_user_pagetable_walk_pmd(unsigned long address) |
522 |
+ { |
523 |
+ gfp_t gfp = (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO); |
524 |
+- p4d_t *p4d = pti_user_pagetable_walk_p4d(address); |
525 |
++ p4d_t *p4d; |
526 |
+ pud_t *pud; |
527 |
+ |
528 |
++ p4d = pti_user_pagetable_walk_p4d(address); |
529 |
++ if (!p4d) |
530 |
++ return NULL; |
531 |
++ |
532 |
+ BUILD_BUG_ON(p4d_large(*p4d) != 0); |
533 |
+ if (p4d_none(*p4d)) { |
534 |
+ unsigned long new_pud_page = __get_free_page(gfp); |
535 |
+- if (!new_pud_page) |
536 |
++ if (WARN_ON_ONCE(!new_pud_page)) |
537 |
+ return NULL; |
538 |
+ |
539 |
+ set_p4d(p4d, __p4d(_KERNPG_TABLE | __pa(new_pud_page))); |
540 |
+@@ -216,7 +220,7 @@ static pmd_t *pti_user_pagetable_walk_pmd(unsigned long address) |
541 |
+ } |
542 |
+ if (pud_none(*pud)) { |
543 |
+ unsigned long new_pmd_page = __get_free_page(gfp); |
544 |
+- if (!new_pmd_page) |
545 |
++ if (WARN_ON_ONCE(!new_pmd_page)) |
546 |
+ return NULL; |
547 |
+ |
548 |
+ set_pud(pud, __pud(_KERNPG_TABLE | __pa(new_pmd_page))); |
549 |
+@@ -238,9 +242,13 @@ static pmd_t *pti_user_pagetable_walk_pmd(unsigned long address) |
550 |
+ static __init pte_t *pti_user_pagetable_walk_pte(unsigned long address) |
551 |
+ { |
552 |
+ gfp_t gfp = (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO); |
553 |
+- pmd_t *pmd = pti_user_pagetable_walk_pmd(address); |
554 |
++ pmd_t *pmd; |
555 |
+ pte_t *pte; |
556 |
+ |
557 |
++ pmd = pti_user_pagetable_walk_pmd(address); |
558 |
++ if (!pmd) |
559 |
++ return NULL; |
560 |
++ |
561 |
+ /* We can't do anything sensible if we hit a large mapping. */ |
562 |
+ if (pmd_large(*pmd)) { |
563 |
+ WARN_ON(1); |
564 |
+@@ -298,6 +306,10 @@ pti_clone_pmds(unsigned long start, unsigned long end, pmdval_t clear) |
565 |
+ p4d_t *p4d; |
566 |
+ pud_t *pud; |
567 |
+ |
568 |
++ /* Overflow check */ |
569 |
++ if (addr < start) |
570 |
++ break; |
571 |
++ |
572 |
+ pgd = pgd_offset_k(addr); |
573 |
+ if (WARN_ON(pgd_none(*pgd))) |
574 |
+ return; |
575 |
+@@ -355,6 +367,9 @@ static void __init pti_clone_p4d(unsigned long addr) |
576 |
+ pgd_t *kernel_pgd; |
577 |
+ |
578 |
+ user_p4d = pti_user_pagetable_walk_p4d(addr); |
579 |
++ if (!user_p4d) |
580 |
++ return; |
581 |
++ |
582 |
+ kernel_pgd = pgd_offset_k(addr); |
583 |
+ kernel_p4d = p4d_offset(kernel_pgd, addr); |
584 |
+ *user_p4d = *kernel_p4d; |
585 |
+diff --git a/arch/xtensa/platforms/iss/setup.c b/arch/xtensa/platforms/iss/setup.c |
586 |
+index f4bbb28026f8..58709e89a8ed 100644 |
587 |
+--- a/arch/xtensa/platforms/iss/setup.c |
588 |
++++ b/arch/xtensa/platforms/iss/setup.c |
589 |
+@@ -78,23 +78,28 @@ static struct notifier_block iss_panic_block = { |
590 |
+ |
591 |
+ void __init platform_setup(char **p_cmdline) |
592 |
+ { |
593 |
++ static void *argv[COMMAND_LINE_SIZE / sizeof(void *)] __initdata; |
594 |
++ static char cmdline[COMMAND_LINE_SIZE] __initdata; |
595 |
+ int argc = simc_argc(); |
596 |
+ int argv_size = simc_argv_size(); |
597 |
+ |
598 |
+ if (argc > 1) { |
599 |
+- void **argv = alloc_bootmem(argv_size); |
600 |
+- char *cmdline = alloc_bootmem(argv_size); |
601 |
+- int i; |
602 |
++ if (argv_size > sizeof(argv)) { |
603 |
++ pr_err("%s: command line too long: argv_size = %d\n", |
604 |
++ __func__, argv_size); |
605 |
++ } else { |
606 |
++ int i; |
607 |
+ |
608 |
+- cmdline[0] = 0; |
609 |
+- simc_argv((void *)argv); |
610 |
++ cmdline[0] = 0; |
611 |
++ simc_argv((void *)argv); |
612 |
+ |
613 |
+- for (i = 1; i < argc; ++i) { |
614 |
+- if (i > 1) |
615 |
+- strcat(cmdline, " "); |
616 |
+- strcat(cmdline, argv[i]); |
617 |
++ for (i = 1; i < argc; ++i) { |
618 |
++ if (i > 1) |
619 |
++ strcat(cmdline, " "); |
620 |
++ strcat(cmdline, argv[i]); |
621 |
++ } |
622 |
++ *p_cmdline = cmdline; |
623 |
+ } |
624 |
+- *p_cmdline = cmdline; |
625 |
+ } |
626 |
+ |
627 |
+ atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block); |
628 |
+diff --git a/block/blk-core.c b/block/blk-core.c |
629 |
+index cbaca5a73f2e..f9d2e1b66e05 100644 |
630 |
+--- a/block/blk-core.c |
631 |
++++ b/block/blk-core.c |
632 |
+@@ -791,9 +791,13 @@ void blk_cleanup_queue(struct request_queue *q) |
633 |
+ * make sure all in-progress dispatch are completed because |
634 |
+ * blk_freeze_queue() can only complete all requests, and |
635 |
+ * dispatch may still be in-progress since we dispatch requests |
636 |
+- * from more than one contexts |
637 |
++ * from more than one contexts. |
638 |
++ * |
639 |
++ * No need to quiesce queue if it isn't initialized yet since |
640 |
++ * blk_freeze_queue() should be enough for cases of passthrough |
641 |
++ * request. |
642 |
+ */ |
643 |
+- if (q->mq_ops) |
644 |
++ if (q->mq_ops && blk_queue_init_done(q)) |
645 |
+ blk_mq_quiesce_queue(q); |
646 |
+ |
647 |
+ /* for synchronous bio-based driver finish in-flight integrity i/o */ |
648 |
+diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c |
649 |
+index 56c493c6cd90..f5745acc2d98 100644 |
650 |
+--- a/block/blk-mq-sched.c |
651 |
++++ b/block/blk-mq-sched.c |
652 |
+@@ -339,7 +339,8 @@ bool __blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio) |
653 |
+ return e->type->ops.mq.bio_merge(hctx, bio); |
654 |
+ } |
655 |
+ |
656 |
+- if (hctx->flags & BLK_MQ_F_SHOULD_MERGE) { |
657 |
++ if ((hctx->flags & BLK_MQ_F_SHOULD_MERGE) && |
658 |
++ !list_empty_careful(&ctx->rq_list)) { |
659 |
+ /* default per sw-queue merge */ |
660 |
+ spin_lock(&ctx->lock); |
661 |
+ ret = blk_mq_attempt_merge(q, ctx, bio); |
662 |
+diff --git a/block/blk-settings.c b/block/blk-settings.c |
663 |
+index d1de71124656..24fff4a3d08a 100644 |
664 |
+--- a/block/blk-settings.c |
665 |
++++ b/block/blk-settings.c |
666 |
+@@ -128,7 +128,7 @@ void blk_set_stacking_limits(struct queue_limits *lim) |
667 |
+ |
668 |
+ /* Inherit limits from component devices */ |
669 |
+ lim->max_segments = USHRT_MAX; |
670 |
+- lim->max_discard_segments = 1; |
671 |
++ lim->max_discard_segments = USHRT_MAX; |
672 |
+ lim->max_hw_sectors = UINT_MAX; |
673 |
+ lim->max_segment_size = UINT_MAX; |
674 |
+ lim->max_sectors = UINT_MAX; |
675 |
+diff --git a/crypto/api.c b/crypto/api.c |
676 |
+index 0ee632bba064..7aca9f86c5f3 100644 |
677 |
+--- a/crypto/api.c |
678 |
++++ b/crypto/api.c |
679 |
+@@ -229,7 +229,7 @@ static struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, |
680 |
+ mask &= ~(CRYPTO_ALG_LARVAL | CRYPTO_ALG_DEAD); |
681 |
+ |
682 |
+ alg = crypto_alg_lookup(name, type, mask); |
683 |
+- if (!alg) { |
684 |
++ if (!alg && !(mask & CRYPTO_NOLOAD)) { |
685 |
+ request_module("crypto-%s", name); |
686 |
+ |
687 |
+ if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask & |
688 |
+diff --git a/drivers/base/core.c b/drivers/base/core.c |
689 |
+index df3e1a44707a..3aba4ad8af5c 100644 |
690 |
+--- a/drivers/base/core.c |
691 |
++++ b/drivers/base/core.c |
692 |
+@@ -2809,6 +2809,9 @@ void device_shutdown(void) |
693 |
+ { |
694 |
+ struct device *dev, *parent; |
695 |
+ |
696 |
++ wait_for_device_probe(); |
697 |
++ device_block_probing(); |
698 |
++ |
699 |
+ spin_lock(&devices_kset->list_lock); |
700 |
+ /* |
701 |
+ * Walk the devices list backward, shutting down each in turn. |
702 |
+diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c |
703 |
+index f6518067aa7d..f99e5c883368 100644 |
704 |
+--- a/drivers/block/DAC960.c |
705 |
++++ b/drivers/block/DAC960.c |
706 |
+@@ -21,6 +21,7 @@ |
707 |
+ #define DAC960_DriverDate "21 Aug 2007" |
708 |
+ |
709 |
+ |
710 |
++#include <linux/compiler.h> |
711 |
+ #include <linux/module.h> |
712 |
+ #include <linux/types.h> |
713 |
+ #include <linux/miscdevice.h> |
714 |
+@@ -6426,7 +6427,7 @@ static bool DAC960_V2_ExecuteUserCommand(DAC960_Controller_T *Controller, |
715 |
+ return true; |
716 |
+ } |
717 |
+ |
718 |
+-static int dac960_proc_show(struct seq_file *m, void *v) |
719 |
++static int __maybe_unused dac960_proc_show(struct seq_file *m, void *v) |
720 |
+ { |
721 |
+ unsigned char *StatusMessage = "OK\n"; |
722 |
+ int ControllerNumber; |
723 |
+@@ -6446,14 +6447,16 @@ static int dac960_proc_show(struct seq_file *m, void *v) |
724 |
+ return 0; |
725 |
+ } |
726 |
+ |
727 |
+-static int dac960_initial_status_proc_show(struct seq_file *m, void *v) |
728 |
++static int __maybe_unused dac960_initial_status_proc_show(struct seq_file *m, |
729 |
++ void *v) |
730 |
+ { |
731 |
+ DAC960_Controller_T *Controller = (DAC960_Controller_T *)m->private; |
732 |
+ seq_printf(m, "%.*s", Controller->InitialStatusLength, Controller->CombinedStatusBuffer); |
733 |
+ return 0; |
734 |
+ } |
735 |
+ |
736 |
+-static int dac960_current_status_proc_show(struct seq_file *m, void *v) |
737 |
++static int __maybe_unused dac960_current_status_proc_show(struct seq_file *m, |
738 |
++ void *v) |
739 |
+ { |
740 |
+ DAC960_Controller_T *Controller = (DAC960_Controller_T *) m->private; |
741 |
+ unsigned char *StatusMessage = |
742 |
+diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c |
743 |
+index a3397664f800..97d6856c9c0f 100644 |
744 |
+--- a/drivers/char/ipmi/ipmi_bt_sm.c |
745 |
++++ b/drivers/char/ipmi/ipmi_bt_sm.c |
746 |
+@@ -59,8 +59,6 @@ enum bt_states { |
747 |
+ BT_STATE_RESET3, |
748 |
+ BT_STATE_RESTART, |
749 |
+ BT_STATE_PRINTME, |
750 |
+- BT_STATE_CAPABILITIES_BEGIN, |
751 |
+- BT_STATE_CAPABILITIES_END, |
752 |
+ BT_STATE_LONG_BUSY /* BT doesn't get hosed :-) */ |
753 |
+ }; |
754 |
+ |
755 |
+@@ -86,7 +84,6 @@ struct si_sm_data { |
756 |
+ int error_retries; /* end of "common" fields */ |
757 |
+ int nonzero_status; /* hung BMCs stay all 0 */ |
758 |
+ enum bt_states complete; /* to divert the state machine */ |
759 |
+- int BT_CAP_outreqs; |
760 |
+ long BT_CAP_req2rsp; |
761 |
+ int BT_CAP_retries; /* Recommended retries */ |
762 |
+ }; |
763 |
+@@ -137,8 +134,6 @@ static char *state2txt(unsigned char state) |
764 |
+ case BT_STATE_RESET3: return("RESET3"); |
765 |
+ case BT_STATE_RESTART: return("RESTART"); |
766 |
+ case BT_STATE_LONG_BUSY: return("LONG_BUSY"); |
767 |
+- case BT_STATE_CAPABILITIES_BEGIN: return("CAP_BEGIN"); |
768 |
+- case BT_STATE_CAPABILITIES_END: return("CAP_END"); |
769 |
+ } |
770 |
+ return("BAD STATE"); |
771 |
+ } |
772 |
+@@ -185,7 +180,6 @@ static unsigned int bt_init_data(struct si_sm_data *bt, struct si_sm_io *io) |
773 |
+ bt->complete = BT_STATE_IDLE; /* end here */ |
774 |
+ bt->BT_CAP_req2rsp = BT_NORMAL_TIMEOUT * USEC_PER_SEC; |
775 |
+ bt->BT_CAP_retries = BT_NORMAL_RETRY_LIMIT; |
776 |
+- /* BT_CAP_outreqs == zero is a flag to read BT Capabilities */ |
777 |
+ return 3; /* We claim 3 bytes of space; ought to check SPMI table */ |
778 |
+ } |
779 |
+ |
780 |
+@@ -451,7 +445,7 @@ static enum si_sm_result error_recovery(struct si_sm_data *bt, |
781 |
+ |
782 |
+ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) |
783 |
+ { |
784 |
+- unsigned char status, BT_CAP[8]; |
785 |
++ unsigned char status; |
786 |
+ static enum bt_states last_printed = BT_STATE_PRINTME; |
787 |
+ int i; |
788 |
+ |
789 |
+@@ -504,12 +498,6 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) |
790 |
+ if (status & BT_H_BUSY) /* clear a leftover H_BUSY */ |
791 |
+ BT_CONTROL(BT_H_BUSY); |
792 |
+ |
793 |
+- bt->timeout = bt->BT_CAP_req2rsp; |
794 |
+- |
795 |
+- /* Read BT capabilities if it hasn't been done yet */ |
796 |
+- if (!bt->BT_CAP_outreqs) |
797 |
+- BT_STATE_CHANGE(BT_STATE_CAPABILITIES_BEGIN, |
798 |
+- SI_SM_CALL_WITHOUT_DELAY); |
799 |
+ BT_SI_SM_RETURN(SI_SM_IDLE); |
800 |
+ |
801 |
+ case BT_STATE_XACTION_START: |
802 |
+@@ -614,37 +602,6 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) |
803 |
+ BT_STATE_CHANGE(BT_STATE_XACTION_START, |
804 |
+ SI_SM_CALL_WITH_DELAY); |
805 |
+ |
806 |
+- /* |
807 |
+- * Get BT Capabilities, using timing of upper level state machine. |
808 |
+- * Set outreqs to prevent infinite loop on timeout. |
809 |
+- */ |
810 |
+- case BT_STATE_CAPABILITIES_BEGIN: |
811 |
+- bt->BT_CAP_outreqs = 1; |
812 |
+- { |
813 |
+- unsigned char GetBT_CAP[] = { 0x18, 0x36 }; |
814 |
+- bt->state = BT_STATE_IDLE; |
815 |
+- bt_start_transaction(bt, GetBT_CAP, sizeof(GetBT_CAP)); |
816 |
+- } |
817 |
+- bt->complete = BT_STATE_CAPABILITIES_END; |
818 |
+- BT_STATE_CHANGE(BT_STATE_XACTION_START, |
819 |
+- SI_SM_CALL_WITH_DELAY); |
820 |
+- |
821 |
+- case BT_STATE_CAPABILITIES_END: |
822 |
+- i = bt_get_result(bt, BT_CAP, sizeof(BT_CAP)); |
823 |
+- bt_init_data(bt, bt->io); |
824 |
+- if ((i == 8) && !BT_CAP[2]) { |
825 |
+- bt->BT_CAP_outreqs = BT_CAP[3]; |
826 |
+- bt->BT_CAP_req2rsp = BT_CAP[6] * USEC_PER_SEC; |
827 |
+- bt->BT_CAP_retries = BT_CAP[7]; |
828 |
+- } else |
829 |
+- printk(KERN_WARNING "IPMI BT: using default values\n"); |
830 |
+- if (!bt->BT_CAP_outreqs) |
831 |
+- bt->BT_CAP_outreqs = 1; |
832 |
+- printk(KERN_WARNING "IPMI BT: req2rsp=%ld secs retries=%d\n", |
833 |
+- bt->BT_CAP_req2rsp / USEC_PER_SEC, bt->BT_CAP_retries); |
834 |
+- bt->timeout = bt->BT_CAP_req2rsp; |
835 |
+- return SI_SM_CALL_WITHOUT_DELAY; |
836 |
+- |
837 |
+ default: /* should never occur */ |
838 |
+ return error_recovery(bt, |
839 |
+ status, |
840 |
+@@ -655,6 +612,11 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) |
841 |
+ |
842 |
+ static int bt_detect(struct si_sm_data *bt) |
843 |
+ { |
844 |
++ unsigned char GetBT_CAP[] = { 0x18, 0x36 }; |
845 |
++ unsigned char BT_CAP[8]; |
846 |
++ enum si_sm_result smi_result; |
847 |
++ int rv; |
848 |
++ |
849 |
+ /* |
850 |
+ * It's impossible for the BT status and interrupt registers to be |
851 |
+ * all 1's, (assuming a properly functioning, self-initialized BMC) |
852 |
+@@ -665,6 +627,48 @@ static int bt_detect(struct si_sm_data *bt) |
853 |
+ if ((BT_STATUS == 0xFF) && (BT_INTMASK_R == 0xFF)) |
854 |
+ return 1; |
855 |
+ reset_flags(bt); |
856 |
++ |
857 |
++ /* |
858 |
++ * Try getting the BT capabilities here. |
859 |
++ */ |
860 |
++ rv = bt_start_transaction(bt, GetBT_CAP, sizeof(GetBT_CAP)); |
861 |
++ if (rv) { |
862 |
++ dev_warn(bt->io->dev, |
863 |
++ "Can't start capabilities transaction: %d\n", rv); |
864 |
++ goto out_no_bt_cap; |
865 |
++ } |
866 |
++ |
867 |
++ smi_result = SI_SM_CALL_WITHOUT_DELAY; |
868 |
++ for (;;) { |
869 |
++ if (smi_result == SI_SM_CALL_WITH_DELAY || |
870 |
++ smi_result == SI_SM_CALL_WITH_TICK_DELAY) { |
871 |
++ schedule_timeout_uninterruptible(1); |
872 |
++ smi_result = bt_event(bt, jiffies_to_usecs(1)); |
873 |
++ } else if (smi_result == SI_SM_CALL_WITHOUT_DELAY) { |
874 |
++ smi_result = bt_event(bt, 0); |
875 |
++ } else |
876 |
++ break; |
877 |
++ } |
878 |
++ |
879 |
++ rv = bt_get_result(bt, BT_CAP, sizeof(BT_CAP)); |
880 |
++ bt_init_data(bt, bt->io); |
881 |
++ if (rv < 8) { |
882 |
++ dev_warn(bt->io->dev, "bt cap response too short: %d\n", rv); |
883 |
++ goto out_no_bt_cap; |
884 |
++ } |
885 |
++ |
886 |
++ if (BT_CAP[2]) { |
887 |
++ dev_warn(bt->io->dev, "Error fetching bt cap: %x\n", BT_CAP[2]); |
888 |
++out_no_bt_cap: |
889 |
++ dev_warn(bt->io->dev, "using default values\n"); |
890 |
++ } else { |
891 |
++ bt->BT_CAP_req2rsp = BT_CAP[6] * USEC_PER_SEC; |
892 |
++ bt->BT_CAP_retries = BT_CAP[7]; |
893 |
++ } |
894 |
++ |
895 |
++ dev_info(bt->io->dev, "req2rsp=%ld secs retries=%d\n", |
896 |
++ bt->BT_CAP_req2rsp / USEC_PER_SEC, bt->BT_CAP_retries); |
897 |
++ |
898 |
+ return 0; |
899 |
+ } |
900 |
+ |
901 |
+diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c |
902 |
+index 51832b8a2c62..7fc9612070a1 100644 |
903 |
+--- a/drivers/char/ipmi/ipmi_msghandler.c |
904 |
++++ b/drivers/char/ipmi/ipmi_msghandler.c |
905 |
+@@ -3381,39 +3381,45 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, |
906 |
+ |
907 |
+ rv = handlers->start_processing(send_info, intf); |
908 |
+ if (rv) |
909 |
+- goto out; |
910 |
++ goto out_err; |
911 |
+ |
912 |
+ rv = __bmc_get_device_id(intf, NULL, &id, NULL, NULL, i); |
913 |
+ if (rv) { |
914 |
+ dev_err(si_dev, "Unable to get the device id: %d\n", rv); |
915 |
+- goto out; |
916 |
++ goto out_err_started; |
917 |
+ } |
918 |
+ |
919 |
+ mutex_lock(&intf->bmc_reg_mutex); |
920 |
+ rv = __scan_channels(intf, &id); |
921 |
+ mutex_unlock(&intf->bmc_reg_mutex); |
922 |
++ if (rv) |
923 |
++ goto out_err_bmc_reg; |
924 |
+ |
925 |
+- out: |
926 |
+- if (rv) { |
927 |
+- ipmi_bmc_unregister(intf); |
928 |
+- list_del_rcu(&intf->link); |
929 |
+- mutex_unlock(&ipmi_interfaces_mutex); |
930 |
+- synchronize_srcu(&ipmi_interfaces_srcu); |
931 |
+- cleanup_srcu_struct(&intf->users_srcu); |
932 |
+- kref_put(&intf->refcount, intf_free); |
933 |
+- } else { |
934 |
+- /* |
935 |
+- * Keep memory order straight for RCU readers. Make |
936 |
+- * sure everything else is committed to memory before |
937 |
+- * setting intf_num to mark the interface valid. |
938 |
+- */ |
939 |
+- smp_wmb(); |
940 |
+- intf->intf_num = i; |
941 |
+- mutex_unlock(&ipmi_interfaces_mutex); |
942 |
++ /* |
943 |
++ * Keep memory order straight for RCU readers. Make |
944 |
++ * sure everything else is committed to memory before |
945 |
++ * setting intf_num to mark the interface valid. |
946 |
++ */ |
947 |
++ smp_wmb(); |
948 |
++ intf->intf_num = i; |
949 |
++ mutex_unlock(&ipmi_interfaces_mutex); |
950 |
+ |
951 |
+- /* After this point the interface is legal to use. */ |
952 |
+- call_smi_watchers(i, intf->si_dev); |
953 |
+- } |
954 |
++ /* After this point the interface is legal to use. */ |
955 |
++ call_smi_watchers(i, intf->si_dev); |
956 |
++ |
957 |
++ return 0; |
958 |
++ |
959 |
++ out_err_bmc_reg: |
960 |
++ ipmi_bmc_unregister(intf); |
961 |
++ out_err_started: |
962 |
++ if (intf->handlers->shutdown) |
963 |
++ intf->handlers->shutdown(intf->send_info); |
964 |
++ out_err: |
965 |
++ list_del_rcu(&intf->link); |
966 |
++ mutex_unlock(&ipmi_interfaces_mutex); |
967 |
++ synchronize_srcu(&ipmi_interfaces_srcu); |
968 |
++ cleanup_srcu_struct(&intf->users_srcu); |
969 |
++ kref_put(&intf->refcount, intf_free); |
970 |
+ |
971 |
+ return rv; |
972 |
+ } |
973 |
+@@ -3504,7 +3510,8 @@ void ipmi_unregister_smi(struct ipmi_smi *intf) |
974 |
+ } |
975 |
+ srcu_read_unlock(&intf->users_srcu, index); |
976 |
+ |
977 |
+- intf->handlers->shutdown(intf->send_info); |
978 |
++ if (intf->handlers->shutdown) |
979 |
++ intf->handlers->shutdown(intf->send_info); |
980 |
+ |
981 |
+ cleanup_smi_msgs(intf); |
982 |
+ |
983 |
+diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c |
984 |
+index 90ec010bffbd..5faa917df1b6 100644 |
985 |
+--- a/drivers/char/ipmi/ipmi_si_intf.c |
986 |
++++ b/drivers/char/ipmi/ipmi_si_intf.c |
987 |
+@@ -2083,18 +2083,9 @@ static int try_smi_init(struct smi_info *new_smi) |
988 |
+ si_to_str[new_smi->io.si_type]); |
989 |
+ |
990 |
+ WARN_ON(new_smi->io.dev->init_name != NULL); |
991 |
+- kfree(init_name); |
992 |
+- |
993 |
+- return 0; |
994 |
+- |
995 |
+-out_err: |
996 |
+- if (new_smi->intf) { |
997 |
+- ipmi_unregister_smi(new_smi->intf); |
998 |
+- new_smi->intf = NULL; |
999 |
+- } |
1000 |
+ |
1001 |
++ out_err: |
1002 |
+ kfree(init_name); |
1003 |
+- |
1004 |
+ return rv; |
1005 |
+ } |
1006 |
+ |
1007 |
+@@ -2227,6 +2218,8 @@ static void shutdown_smi(void *send_info) |
1008 |
+ |
1009 |
+ kfree(smi_info->si_sm); |
1010 |
+ smi_info->si_sm = NULL; |
1011 |
++ |
1012 |
++ smi_info->intf = NULL; |
1013 |
+ } |
1014 |
+ |
1015 |
+ /* |
1016 |
+@@ -2240,10 +2233,8 @@ static void cleanup_one_si(struct smi_info *smi_info) |
1017 |
+ |
1018 |
+ list_del(&smi_info->link); |
1019 |
+ |
1020 |
+- if (smi_info->intf) { |
1021 |
++ if (smi_info->intf) |
1022 |
+ ipmi_unregister_smi(smi_info->intf); |
1023 |
+- smi_info->intf = NULL; |
1024 |
+- } |
1025 |
+ |
1026 |
+ if (smi_info->pdev) { |
1027 |
+ if (smi_info->pdev_registered) |
1028 |
+diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c |
1029 |
+index 18e4650c233b..265d6a6583bc 100644 |
1030 |
+--- a/drivers/char/ipmi/ipmi_ssif.c |
1031 |
++++ b/drivers/char/ipmi/ipmi_ssif.c |
1032 |
+@@ -181,6 +181,8 @@ struct ssif_addr_info { |
1033 |
+ struct device *dev; |
1034 |
+ struct i2c_client *client; |
1035 |
+ |
1036 |
++ struct i2c_client *added_client; |
1037 |
++ |
1038 |
+ struct mutex clients_mutex; |
1039 |
+ struct list_head clients; |
1040 |
+ |
1041 |
+@@ -1214,18 +1216,11 @@ static void shutdown_ssif(void *send_info) |
1042 |
+ complete(&ssif_info->wake_thread); |
1043 |
+ kthread_stop(ssif_info->thread); |
1044 |
+ } |
1045 |
+- |
1046 |
+- /* |
1047 |
+- * No message can be outstanding now, we have removed the |
1048 |
+- * upper layer and it permitted us to do so. |
1049 |
+- */ |
1050 |
+- kfree(ssif_info); |
1051 |
+ } |
1052 |
+ |
1053 |
+ static int ssif_remove(struct i2c_client *client) |
1054 |
+ { |
1055 |
+ struct ssif_info *ssif_info = i2c_get_clientdata(client); |
1056 |
+- struct ipmi_smi *intf; |
1057 |
+ struct ssif_addr_info *addr_info; |
1058 |
+ |
1059 |
+ if (!ssif_info) |
1060 |
+@@ -1235,9 +1230,7 @@ static int ssif_remove(struct i2c_client *client) |
1061 |
+ * After this point, we won't deliver anything asychronously |
1062 |
+ * to the message handler. We can unregister ourself. |
1063 |
+ */ |
1064 |
+- intf = ssif_info->intf; |
1065 |
+- ssif_info->intf = NULL; |
1066 |
+- ipmi_unregister_smi(intf); |
1067 |
++ ipmi_unregister_smi(ssif_info->intf); |
1068 |
+ |
1069 |
+ list_for_each_entry(addr_info, &ssif_infos, link) { |
1070 |
+ if (addr_info->client == client) { |
1071 |
+@@ -1246,6 +1239,8 @@ static int ssif_remove(struct i2c_client *client) |
1072 |
+ } |
1073 |
+ } |
1074 |
+ |
1075 |
++ kfree(ssif_info); |
1076 |
++ |
1077 |
+ return 0; |
1078 |
+ } |
1079 |
+ |
1080 |
+@@ -1648,15 +1643,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) |
1081 |
+ |
1082 |
+ out: |
1083 |
+ if (rv) { |
1084 |
+- /* |
1085 |
+- * Note that if addr_info->client is assigned, we |
1086 |
+- * leave it. The i2c client hangs around even if we |
1087 |
+- * return a failure here, and the failure here is not |
1088 |
+- * propagated back to the i2c code. This seems to be |
1089 |
+- * design intent, strange as it may be. But if we |
1090 |
+- * don't leave it, ssif_platform_remove will not remove |
1091 |
+- * the client like it should. |
1092 |
+- */ |
1093 |
++ addr_info->client = NULL; |
1094 |
+ dev_err(&client->dev, "Unable to start IPMI SSIF: %d\n", rv); |
1095 |
+ kfree(ssif_info); |
1096 |
+ } |
1097 |
+@@ -1676,7 +1663,8 @@ static int ssif_adapter_handler(struct device *adev, void *opaque) |
1098 |
+ if (adev->type != &i2c_adapter_type) |
1099 |
+ return 0; |
1100 |
+ |
1101 |
+- i2c_new_device(to_i2c_adapter(adev), &addr_info->binfo); |
1102 |
++ addr_info->added_client = i2c_new_device(to_i2c_adapter(adev), |
1103 |
++ &addr_info->binfo); |
1104 |
+ |
1105 |
+ if (!addr_info->adapter_name) |
1106 |
+ return 1; /* Only try the first I2C adapter by default. */ |
1107 |
+@@ -1849,7 +1837,7 @@ static int ssif_platform_remove(struct platform_device *dev) |
1108 |
+ return 0; |
1109 |
+ |
1110 |
+ mutex_lock(&ssif_infos_mutex); |
1111 |
+- i2c_unregister_device(addr_info->client); |
1112 |
++ i2c_unregister_device(addr_info->added_client); |
1113 |
+ |
1114 |
+ list_del(&addr_info->link); |
1115 |
+ kfree(addr_info); |
1116 |
+diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c |
1117 |
+index a5d402de5584..20724abd38bd 100644 |
1118 |
+--- a/drivers/clk/clk-fixed-factor.c |
1119 |
++++ b/drivers/clk/clk-fixed-factor.c |
1120 |
+@@ -177,8 +177,15 @@ static struct clk *_of_fixed_factor_clk_setup(struct device_node *node) |
1121 |
+ |
1122 |
+ clk = clk_register_fixed_factor(NULL, clk_name, parent_name, flags, |
1123 |
+ mult, div); |
1124 |
+- if (IS_ERR(clk)) |
1125 |
++ if (IS_ERR(clk)) { |
1126 |
++ /* |
1127 |
++ * If parent clock is not registered, registration would fail. |
1128 |
++ * Clear OF_POPULATED flag so that clock registration can be |
1129 |
++ * attempted again from probe function. |
1130 |
++ */ |
1131 |
++ of_node_clear_flag(node, OF_POPULATED); |
1132 |
+ return clk; |
1133 |
++ } |
1134 |
+ |
1135 |
+ ret = of_clk_add_provider(node, of_clk_src_simple_get, clk); |
1136 |
+ if (ret) { |
1137 |
+diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c |
1138 |
+index e2ed078abd90..2d96e7966e94 100644 |
1139 |
+--- a/drivers/clk/clk.c |
1140 |
++++ b/drivers/clk/clk.c |
1141 |
+@@ -2933,6 +2933,7 @@ struct clk *__clk_create_clk(struct clk_hw *hw, const char *dev_id, |
1142 |
+ return clk; |
1143 |
+ } |
1144 |
+ |
1145 |
++/* keep in sync with __clk_put */ |
1146 |
+ void __clk_free_clk(struct clk *clk) |
1147 |
+ { |
1148 |
+ clk_prepare_lock(); |
1149 |
+@@ -3312,6 +3313,7 @@ int __clk_get(struct clk *clk) |
1150 |
+ return 1; |
1151 |
+ } |
1152 |
+ |
1153 |
++/* keep in sync with __clk_free_clk */ |
1154 |
+ void __clk_put(struct clk *clk) |
1155 |
+ { |
1156 |
+ struct module *owner; |
1157 |
+@@ -3345,6 +3347,7 @@ void __clk_put(struct clk *clk) |
1158 |
+ |
1159 |
+ module_put(owner); |
1160 |
+ |
1161 |
++ kfree_const(clk->con_id); |
1162 |
+ kfree(clk); |
1163 |
+ } |
1164 |
+ |
1165 |
+diff --git a/drivers/clk/imx/clk-imx6sll.c b/drivers/clk/imx/clk-imx6sll.c |
1166 |
+index 3651c77fbabe..645d8a42007c 100644 |
1167 |
+--- a/drivers/clk/imx/clk-imx6sll.c |
1168 |
++++ b/drivers/clk/imx/clk-imx6sll.c |
1169 |
+@@ -92,6 +92,7 @@ static void __init imx6sll_clocks_init(struct device_node *ccm_node) |
1170 |
+ |
1171 |
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx6sll-anatop"); |
1172 |
+ base = of_iomap(np, 0); |
1173 |
++ of_node_put(np); |
1174 |
+ WARN_ON(!base); |
1175 |
+ |
1176 |
+ /* Do not bypass PLLs initially */ |
1177 |
+diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c |
1178 |
+index ba563ba50b40..9f1a40498642 100644 |
1179 |
+--- a/drivers/clk/imx/clk-imx6ul.c |
1180 |
++++ b/drivers/clk/imx/clk-imx6ul.c |
1181 |
+@@ -142,6 +142,7 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node) |
1182 |
+ |
1183 |
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx6ul-anatop"); |
1184 |
+ base = of_iomap(np, 0); |
1185 |
++ of_node_put(np); |
1186 |
+ WARN_ON(!base); |
1187 |
+ |
1188 |
+ clks[IMX6UL_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
1189 |
+diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c |
1190 |
+index 44e4e27eddad..6f7637b19738 100644 |
1191 |
+--- a/drivers/clk/mvebu/armada-37xx-periph.c |
1192 |
++++ b/drivers/clk/mvebu/armada-37xx-periph.c |
1193 |
+@@ -429,9 +429,6 @@ static u8 clk_pm_cpu_get_parent(struct clk_hw *hw) |
1194 |
+ val &= pm_cpu->mask_mux; |
1195 |
+ } |
1196 |
+ |
1197 |
+- if (val >= num_parents) |
1198 |
+- return -EINVAL; |
1199 |
+- |
1200 |
+ return val; |
1201 |
+ } |
1202 |
+ |
1203 |
+diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c |
1204 |
+index a896692b74ec..01dada561c10 100644 |
1205 |
+--- a/drivers/clk/tegra/clk-bpmp.c |
1206 |
++++ b/drivers/clk/tegra/clk-bpmp.c |
1207 |
+@@ -586,9 +586,15 @@ static struct clk_hw *tegra_bpmp_clk_of_xlate(struct of_phandle_args *clkspec, |
1208 |
+ unsigned int id = clkspec->args[0], i; |
1209 |
+ struct tegra_bpmp *bpmp = data; |
1210 |
+ |
1211 |
+- for (i = 0; i < bpmp->num_clocks; i++) |
1212 |
+- if (bpmp->clocks[i]->id == id) |
1213 |
+- return &bpmp->clocks[i]->hw; |
1214 |
++ for (i = 0; i < bpmp->num_clocks; i++) { |
1215 |
++ struct tegra_bpmp_clk *clk = bpmp->clocks[i]; |
1216 |
++ |
1217 |
++ if (!clk) |
1218 |
++ continue; |
1219 |
++ |
1220 |
++ if (clk->id == id) |
1221 |
++ return &clk->hw; |
1222 |
++ } |
1223 |
+ |
1224 |
+ return NULL; |
1225 |
+ } |
1226 |
+diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c |
1227 |
+index 051b8c6bae64..a9c85095bd56 100644 |
1228 |
+--- a/drivers/crypto/ccp/psp-dev.c |
1229 |
++++ b/drivers/crypto/ccp/psp-dev.c |
1230 |
+@@ -38,6 +38,17 @@ static DEFINE_MUTEX(sev_cmd_mutex); |
1231 |
+ static struct sev_misc_dev *misc_dev; |
1232 |
+ static struct psp_device *psp_master; |
1233 |
+ |
1234 |
++static int psp_cmd_timeout = 100; |
1235 |
++module_param(psp_cmd_timeout, int, 0644); |
1236 |
++MODULE_PARM_DESC(psp_cmd_timeout, " default timeout value, in seconds, for PSP commands"); |
1237 |
++ |
1238 |
++static int psp_probe_timeout = 5; |
1239 |
++module_param(psp_probe_timeout, int, 0644); |
1240 |
++MODULE_PARM_DESC(psp_probe_timeout, " default timeout value, in seconds, during PSP device probe"); |
1241 |
++ |
1242 |
++static bool psp_dead; |
1243 |
++static int psp_timeout; |
1244 |
++ |
1245 |
+ static struct psp_device *psp_alloc_struct(struct sp_device *sp) |
1246 |
+ { |
1247 |
+ struct device *dev = sp->dev; |
1248 |
+@@ -82,10 +93,19 @@ done: |
1249 |
+ return IRQ_HANDLED; |
1250 |
+ } |
1251 |
+ |
1252 |
+-static void sev_wait_cmd_ioc(struct psp_device *psp, unsigned int *reg) |
1253 |
++static int sev_wait_cmd_ioc(struct psp_device *psp, |
1254 |
++ unsigned int *reg, unsigned int timeout) |
1255 |
+ { |
1256 |
+- wait_event(psp->sev_int_queue, psp->sev_int_rcvd); |
1257 |
++ int ret; |
1258 |
++ |
1259 |
++ ret = wait_event_timeout(psp->sev_int_queue, |
1260 |
++ psp->sev_int_rcvd, timeout * HZ); |
1261 |
++ if (!ret) |
1262 |
++ return -ETIMEDOUT; |
1263 |
++ |
1264 |
+ *reg = ioread32(psp->io_regs + PSP_CMDRESP); |
1265 |
++ |
1266 |
++ return 0; |
1267 |
+ } |
1268 |
+ |
1269 |
+ static int sev_cmd_buffer_len(int cmd) |
1270 |
+@@ -133,12 +153,15 @@ static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret) |
1271 |
+ if (!psp) |
1272 |
+ return -ENODEV; |
1273 |
+ |
1274 |
++ if (psp_dead) |
1275 |
++ return -EBUSY; |
1276 |
++ |
1277 |
+ /* Get the physical address of the command buffer */ |
1278 |
+ phys_lsb = data ? lower_32_bits(__psp_pa(data)) : 0; |
1279 |
+ phys_msb = data ? upper_32_bits(__psp_pa(data)) : 0; |
1280 |
+ |
1281 |
+- dev_dbg(psp->dev, "sev command id %#x buffer 0x%08x%08x\n", |
1282 |
+- cmd, phys_msb, phys_lsb); |
1283 |
++ dev_dbg(psp->dev, "sev command id %#x buffer 0x%08x%08x timeout %us\n", |
1284 |
++ cmd, phys_msb, phys_lsb, psp_timeout); |
1285 |
+ |
1286 |
+ print_hex_dump_debug("(in): ", DUMP_PREFIX_OFFSET, 16, 2, data, |
1287 |
+ sev_cmd_buffer_len(cmd), false); |
1288 |
+@@ -154,7 +177,18 @@ static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret) |
1289 |
+ iowrite32(reg, psp->io_regs + PSP_CMDRESP); |
1290 |
+ |
1291 |
+ /* wait for command completion */ |
1292 |
+- sev_wait_cmd_ioc(psp, ®); |
1293 |
++ ret = sev_wait_cmd_ioc(psp, ®, psp_timeout); |
1294 |
++ if (ret) { |
1295 |
++ if (psp_ret) |
1296 |
++ *psp_ret = 0; |
1297 |
++ |
1298 |
++ dev_err(psp->dev, "sev command %#x timed out, disabling PSP \n", cmd); |
1299 |
++ psp_dead = true; |
1300 |
++ |
1301 |
++ return ret; |
1302 |
++ } |
1303 |
++ |
1304 |
++ psp_timeout = psp_cmd_timeout; |
1305 |
+ |
1306 |
+ if (psp_ret) |
1307 |
+ *psp_ret = reg & PSP_CMDRESP_ERR_MASK; |
1308 |
+@@ -886,6 +920,8 @@ void psp_pci_init(void) |
1309 |
+ |
1310 |
+ psp_master = sp->psp_data; |
1311 |
+ |
1312 |
++ psp_timeout = psp_probe_timeout; |
1313 |
++ |
1314 |
+ if (sev_get_api_version()) |
1315 |
+ goto err; |
1316 |
+ |
1317 |
+diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c |
1318 |
+index 0f2245e1af2b..97d86dca7e85 100644 |
1319 |
+--- a/drivers/crypto/sahara.c |
1320 |
++++ b/drivers/crypto/sahara.c |
1321 |
+@@ -1351,7 +1351,7 @@ err_sha_v4_algs: |
1322 |
+ |
1323 |
+ err_sha_v3_algs: |
1324 |
+ for (j = 0; j < k; j++) |
1325 |
+- crypto_unregister_ahash(&sha_v4_algs[j]); |
1326 |
++ crypto_unregister_ahash(&sha_v3_algs[j]); |
1327 |
+ |
1328 |
+ err_aes_algs: |
1329 |
+ for (j = 0; j < i; j++) |
1330 |
+@@ -1367,7 +1367,7 @@ static void sahara_unregister_algs(struct sahara_dev *dev) |
1331 |
+ for (i = 0; i < ARRAY_SIZE(aes_algs); i++) |
1332 |
+ crypto_unregister_alg(&aes_algs[i]); |
1333 |
+ |
1334 |
+- for (i = 0; i < ARRAY_SIZE(sha_v4_algs); i++) |
1335 |
++ for (i = 0; i < ARRAY_SIZE(sha_v3_algs); i++) |
1336 |
+ crypto_unregister_ahash(&sha_v3_algs[i]); |
1337 |
+ |
1338 |
+ if (dev->version > SAHARA_VERSION_3) |
1339 |
+diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c |
1340 |
+index 0b5b3abe054e..e26adf67e218 100644 |
1341 |
+--- a/drivers/devfreq/devfreq.c |
1342 |
++++ b/drivers/devfreq/devfreq.c |
1343 |
+@@ -625,7 +625,8 @@ struct devfreq *devfreq_add_device(struct device *dev, |
1344 |
+ err = device_register(&devfreq->dev); |
1345 |
+ if (err) { |
1346 |
+ mutex_unlock(&devfreq->lock); |
1347 |
+- goto err_dev; |
1348 |
++ put_device(&devfreq->dev); |
1349 |
++ goto err_out; |
1350 |
+ } |
1351 |
+ |
1352 |
+ devfreq->trans_table = |
1353 |
+@@ -672,6 +673,7 @@ err_init: |
1354 |
+ mutex_unlock(&devfreq_list_lock); |
1355 |
+ |
1356 |
+ device_unregister(&devfreq->dev); |
1357 |
++ devfreq = NULL; |
1358 |
+ err_dev: |
1359 |
+ if (devfreq) |
1360 |
+ kfree(devfreq); |
1361 |
+diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c |
1362 |
+index c6589ccf1b9a..d349fedf4ab2 100644 |
1363 |
+--- a/drivers/dma/mv_xor_v2.c |
1364 |
++++ b/drivers/dma/mv_xor_v2.c |
1365 |
+@@ -899,6 +899,8 @@ static int mv_xor_v2_remove(struct platform_device *pdev) |
1366 |
+ |
1367 |
+ platform_msi_domain_free_irqs(&pdev->dev); |
1368 |
+ |
1369 |
++ tasklet_kill(&xor_dev->irq_tasklet); |
1370 |
++ |
1371 |
+ clk_disable_unprepare(xor_dev->clk); |
1372 |
+ |
1373 |
+ return 0; |
1374 |
+diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c |
1375 |
+index de0957fe9668..bb6dfa2e1e8a 100644 |
1376 |
+--- a/drivers/dma/pl330.c |
1377 |
++++ b/drivers/dma/pl330.c |
1378 |
+@@ -2257,13 +2257,14 @@ static int pl330_terminate_all(struct dma_chan *chan) |
1379 |
+ |
1380 |
+ pm_runtime_get_sync(pl330->ddma.dev); |
1381 |
+ spin_lock_irqsave(&pch->lock, flags); |
1382 |
++ |
1383 |
+ spin_lock(&pl330->lock); |
1384 |
+ _stop(pch->thread); |
1385 |
+- spin_unlock(&pl330->lock); |
1386 |
+- |
1387 |
+ pch->thread->req[0].desc = NULL; |
1388 |
+ pch->thread->req[1].desc = NULL; |
1389 |
+ pch->thread->req_running = -1; |
1390 |
++ spin_unlock(&pl330->lock); |
1391 |
++ |
1392 |
+ power_down = pch->active; |
1393 |
+ pch->active = false; |
1394 |
+ |
1395 |
+diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c |
1396 |
+index 2a2ccd9c78e4..8305a1ce8a9b 100644 |
1397 |
+--- a/drivers/dma/sh/rcar-dmac.c |
1398 |
++++ b/drivers/dma/sh/rcar-dmac.c |
1399 |
+@@ -774,8 +774,9 @@ static void rcar_dmac_sync_tcr(struct rcar_dmac_chan *chan) |
1400 |
+ /* make sure all remaining data was flushed */ |
1401 |
+ rcar_dmac_chcr_de_barrier(chan); |
1402 |
+ |
1403 |
+- /* back DE */ |
1404 |
+- rcar_dmac_chan_write(chan, RCAR_DMACHCR, chcr); |
1405 |
++ /* back DE if remain data exists */ |
1406 |
++ if (rcar_dmac_chan_read(chan, RCAR_DMATCR)) |
1407 |
++ rcar_dmac_chan_write(chan, RCAR_DMACHCR, chcr); |
1408 |
+ } |
1409 |
+ |
1410 |
+ static void rcar_dmac_chan_halt(struct rcar_dmac_chan *chan) |
1411 |
+diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c |
1412 |
+index b5214c143fee..388a929baf95 100644 |
1413 |
+--- a/drivers/firmware/efi/arm-init.c |
1414 |
++++ b/drivers/firmware/efi/arm-init.c |
1415 |
+@@ -259,7 +259,6 @@ void __init efi_init(void) |
1416 |
+ |
1417 |
+ reserve_regions(); |
1418 |
+ efi_esrt_init(); |
1419 |
+- efi_memmap_unmap(); |
1420 |
+ |
1421 |
+ memblock_reserve(params.mmap & PAGE_MASK, |
1422 |
+ PAGE_ALIGN(params.mmap_size + |
1423 |
+diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c |
1424 |
+index 5889cbea60b8..4712445c3213 100644 |
1425 |
+--- a/drivers/firmware/efi/arm-runtime.c |
1426 |
++++ b/drivers/firmware/efi/arm-runtime.c |
1427 |
+@@ -110,11 +110,13 @@ static int __init arm_enable_runtime_services(void) |
1428 |
+ { |
1429 |
+ u64 mapsize; |
1430 |
+ |
1431 |
+- if (!efi_enabled(EFI_BOOT)) { |
1432 |
++ if (!efi_enabled(EFI_BOOT) || !efi_enabled(EFI_MEMMAP)) { |
1433 |
+ pr_info("EFI services will not be available.\n"); |
1434 |
+ return 0; |
1435 |
+ } |
1436 |
+ |
1437 |
++ efi_memmap_unmap(); |
1438 |
++ |
1439 |
+ if (efi_runtime_disabled()) { |
1440 |
+ pr_info("EFI runtime services will be disabled.\n"); |
1441 |
+ return 0; |
1442 |
+diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c |
1443 |
+index 1ab80e06e7c5..e5d80ebd72b6 100644 |
1444 |
+--- a/drivers/firmware/efi/esrt.c |
1445 |
++++ b/drivers/firmware/efi/esrt.c |
1446 |
+@@ -326,7 +326,8 @@ void __init efi_esrt_init(void) |
1447 |
+ |
1448 |
+ end = esrt_data + size; |
1449 |
+ pr_info("Reserving ESRT space from %pa to %pa.\n", &esrt_data, &end); |
1450 |
+- efi_mem_reserve(esrt_data, esrt_data_size); |
1451 |
++ if (md.type == EFI_BOOT_SERVICES_DATA) |
1452 |
++ efi_mem_reserve(esrt_data, esrt_data_size); |
1453 |
+ |
1454 |
+ pr_debug("esrt-init: loaded.\n"); |
1455 |
+ } |
1456 |
+diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c |
1457 |
+index 2e33fd552899..99070e2ac3cd 100644 |
1458 |
+--- a/drivers/gpio/gpio-pxa.c |
1459 |
++++ b/drivers/gpio/gpio-pxa.c |
1460 |
+@@ -665,6 +665,8 @@ static int pxa_gpio_probe(struct platform_device *pdev) |
1461 |
+ pchip->irq0 = irq0; |
1462 |
+ pchip->irq1 = irq1; |
1463 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1464 |
++ if (!res) |
1465 |
++ return -EINVAL; |
1466 |
+ gpio_reg_base = devm_ioremap(&pdev->dev, res->start, |
1467 |
+ resource_size(res)); |
1468 |
+ if (!gpio_reg_base) |
1469 |
+diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h |
1470 |
+index 1a8e20363861..a7e49fef73d4 100644 |
1471 |
+--- a/drivers/gpio/gpiolib.h |
1472 |
++++ b/drivers/gpio/gpiolib.h |
1473 |
+@@ -92,7 +92,7 @@ struct acpi_gpio_info { |
1474 |
+ }; |
1475 |
+ |
1476 |
+ /* gpio suffixes used for ACPI and device tree lookup */ |
1477 |
+-static const char * const gpio_suffixes[] = { "gpios", "gpio" }; |
1478 |
++static __maybe_unused const char * const gpio_suffixes[] = { "gpios", "gpio" }; |
1479 |
+ |
1480 |
+ #ifdef CONFIG_OF_GPIO |
1481 |
+ struct gpio_desc *of_find_gpio(struct device *dev, |
1482 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c b/drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c |
1483 |
+index c3744d89352c..ebe79bf00145 100644 |
1484 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c |
1485 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c |
1486 |
+@@ -188,9 +188,9 @@ void __iomem *kfd_get_kernel_doorbell(struct kfd_dev *kfd, |
1487 |
+ *doorbell_off = kfd->doorbell_id_offset + inx; |
1488 |
+ |
1489 |
+ pr_debug("Get kernel queue doorbell\n" |
1490 |
+- " doorbell offset == 0x%08X\n" |
1491 |
+- " kernel address == %p\n", |
1492 |
+- *doorbell_off, (kfd->doorbell_kernel_ptr + inx)); |
1493 |
++ " doorbell offset == 0x%08X\n" |
1494 |
++ " doorbell index == 0x%x\n", |
1495 |
++ *doorbell_off, inx); |
1496 |
+ |
1497 |
+ return kfd->doorbell_kernel_ptr + inx; |
1498 |
+ } |
1499 |
+@@ -199,7 +199,8 @@ void kfd_release_kernel_doorbell(struct kfd_dev *kfd, u32 __iomem *db_addr) |
1500 |
+ { |
1501 |
+ unsigned int inx; |
1502 |
+ |
1503 |
+- inx = (unsigned int)(db_addr - kfd->doorbell_kernel_ptr); |
1504 |
++ inx = (unsigned int)(db_addr - kfd->doorbell_kernel_ptr) |
1505 |
++ * sizeof(u32) / kfd->device_info->doorbell_size; |
1506 |
+ |
1507 |
+ mutex_lock(&kfd->doorbell_mutex); |
1508 |
+ __clear_bit(inx, kfd->doorbell_available_index); |
1509 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c |
1510 |
+index 1d80b4f7c681..4694386cc623 100644 |
1511 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c |
1512 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c |
1513 |
+@@ -244,6 +244,8 @@ struct kfd_process *kfd_get_process(const struct task_struct *thread) |
1514 |
+ return ERR_PTR(-EINVAL); |
1515 |
+ |
1516 |
+ process = find_process(thread); |
1517 |
++ if (!process) |
1518 |
++ return ERR_PTR(-EINVAL); |
1519 |
+ |
1520 |
+ return process; |
1521 |
+ } |
1522 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
1523 |
+index 8a7890b03d97..6ccd59b87403 100644 |
1524 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
1525 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
1526 |
+@@ -497,6 +497,10 @@ static bool detect_dp( |
1527 |
+ sink_caps->signal = SIGNAL_TYPE_DISPLAY_PORT_MST; |
1528 |
+ link->type = dc_connection_mst_branch; |
1529 |
+ |
1530 |
++ dal_ddc_service_set_transaction_type( |
1531 |
++ link->ddc, |
1532 |
++ sink_caps->transaction_type); |
1533 |
++ |
1534 |
+ /* |
1535 |
+ * This call will initiate MST topology discovery. Which |
1536 |
+ * will detect MST ports and add new DRM connector DRM |
1537 |
+diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c |
1538 |
+index d567be49c31b..b487774d8041 100644 |
1539 |
+--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c |
1540 |
++++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c |
1541 |
+@@ -1020,7 +1020,7 @@ static int pp_get_display_power_level(void *handle, |
1542 |
+ static int pp_get_current_clocks(void *handle, |
1543 |
+ struct amd_pp_clock_info *clocks) |
1544 |
+ { |
1545 |
+- struct amd_pp_simple_clock_info simple_clocks; |
1546 |
++ struct amd_pp_simple_clock_info simple_clocks = { 0 }; |
1547 |
+ struct pp_clock_info hw_clocks; |
1548 |
+ struct pp_hwmgr *hwmgr = handle; |
1549 |
+ int ret = 0; |
1550 |
+@@ -1056,7 +1056,10 @@ static int pp_get_current_clocks(void *handle, |
1551 |
+ clocks->max_engine_clock_in_sr = hw_clocks.max_eng_clk; |
1552 |
+ clocks->min_engine_clock_in_sr = hw_clocks.min_eng_clk; |
1553 |
+ |
1554 |
+- clocks->max_clocks_state = simple_clocks.level; |
1555 |
++ if (simple_clocks.level == 0) |
1556 |
++ clocks->max_clocks_state = PP_DAL_POWERLEVEL_7; |
1557 |
++ else |
1558 |
++ clocks->max_clocks_state = simple_clocks.level; |
1559 |
+ |
1560 |
+ if (0 == phm_get_current_shallow_sleep_clocks(hwmgr, &hwmgr->current_ps->hardware, &hw_clocks)) { |
1561 |
+ clocks->max_engine_clock_in_sr = hw_clocks.max_eng_clk; |
1562 |
+@@ -1159,6 +1162,8 @@ static int pp_get_display_mode_validation_clocks(void *handle, |
1563 |
+ if (!hwmgr || !hwmgr->pm_en ||!clocks) |
1564 |
+ return -EINVAL; |
1565 |
+ |
1566 |
++ clocks->level = PP_DAL_POWERLEVEL_7; |
1567 |
++ |
1568 |
+ mutex_lock(&hwmgr->smu_lock); |
1569 |
+ |
1570 |
+ if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_DynamicPatchPowerState)) |
1571 |
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c |
1572 |
+index f8e866ceda02..77779adeef28 100644 |
1573 |
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c |
1574 |
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c |
1575 |
+@@ -4555,12 +4555,12 @@ static int smu7_get_sclks(struct pp_hwmgr *hwmgr, struct amd_pp_clocks *clocks) |
1576 |
+ return -EINVAL; |
1577 |
+ dep_sclk_table = table_info->vdd_dep_on_sclk; |
1578 |
+ for (i = 0; i < dep_sclk_table->count; i++) |
1579 |
+- clocks->clock[i] = dep_sclk_table->entries[i].clk; |
1580 |
++ clocks->clock[i] = dep_sclk_table->entries[i].clk * 10; |
1581 |
+ clocks->count = dep_sclk_table->count; |
1582 |
+ } else if (hwmgr->pp_table_version == PP_TABLE_V0) { |
1583 |
+ sclk_table = hwmgr->dyn_state.vddc_dependency_on_sclk; |
1584 |
+ for (i = 0; i < sclk_table->count; i++) |
1585 |
+- clocks->clock[i] = sclk_table->entries[i].clk; |
1586 |
++ clocks->clock[i] = sclk_table->entries[i].clk * 10; |
1587 |
+ clocks->count = sclk_table->count; |
1588 |
+ } |
1589 |
+ |
1590 |
+@@ -4592,7 +4592,7 @@ static int smu7_get_mclks(struct pp_hwmgr *hwmgr, struct amd_pp_clocks *clocks) |
1591 |
+ return -EINVAL; |
1592 |
+ dep_mclk_table = table_info->vdd_dep_on_mclk; |
1593 |
+ for (i = 0; i < dep_mclk_table->count; i++) { |
1594 |
+- clocks->clock[i] = dep_mclk_table->entries[i].clk; |
1595 |
++ clocks->clock[i] = dep_mclk_table->entries[i].clk * 10; |
1596 |
+ clocks->latency[i] = smu7_get_mem_latency(hwmgr, |
1597 |
+ dep_mclk_table->entries[i].clk); |
1598 |
+ } |
1599 |
+@@ -4600,7 +4600,7 @@ static int smu7_get_mclks(struct pp_hwmgr *hwmgr, struct amd_pp_clocks *clocks) |
1600 |
+ } else if (hwmgr->pp_table_version == PP_TABLE_V0) { |
1601 |
+ mclk_table = hwmgr->dyn_state.vddc_dependency_on_mclk; |
1602 |
+ for (i = 0; i < mclk_table->count; i++) |
1603 |
+- clocks->clock[i] = mclk_table->entries[i].clk; |
1604 |
++ clocks->clock[i] = mclk_table->entries[i].clk * 10; |
1605 |
+ clocks->count = mclk_table->count; |
1606 |
+ } |
1607 |
+ return 0; |
1608 |
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c |
1609 |
+index 617557bd8c24..0adfc5392cd3 100644 |
1610 |
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c |
1611 |
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c |
1612 |
+@@ -1605,17 +1605,17 @@ static int smu8_get_clock_by_type(struct pp_hwmgr *hwmgr, enum amd_pp_clock_type |
1613 |
+ switch (type) { |
1614 |
+ case amd_pp_disp_clock: |
1615 |
+ for (i = 0; i < clocks->count; i++) |
1616 |
+- clocks->clock[i] = data->sys_info.display_clock[i]; |
1617 |
++ clocks->clock[i] = data->sys_info.display_clock[i] * 10; |
1618 |
+ break; |
1619 |
+ case amd_pp_sys_clock: |
1620 |
+ table = hwmgr->dyn_state.vddc_dependency_on_sclk; |
1621 |
+ for (i = 0; i < clocks->count; i++) |
1622 |
+- clocks->clock[i] = table->entries[i].clk; |
1623 |
++ clocks->clock[i] = table->entries[i].clk * 10; |
1624 |
+ break; |
1625 |
+ case amd_pp_mem_clock: |
1626 |
+ clocks->count = SMU8_NUM_NBPMEMORYCLOCK; |
1627 |
+ for (i = 0; i < clocks->count; i++) |
1628 |
+- clocks->clock[i] = data->sys_info.nbp_memory_clock[clocks->count - 1 - i]; |
1629 |
++ clocks->clock[i] = data->sys_info.nbp_memory_clock[clocks->count - 1 - i] * 10; |
1630 |
+ break; |
1631 |
+ default: |
1632 |
+ return -1; |
1633 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c |
1634 |
+index 963a4dba8213..9109b69cd052 100644 |
1635 |
+--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c |
1636 |
++++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c |
1637 |
+@@ -160,7 +160,11 @@ nouveau_debugfs_pstate_set(struct file *file, const char __user *ubuf, |
1638 |
+ args.ustate = value; |
1639 |
+ } |
1640 |
+ |
1641 |
++ ret = pm_runtime_get_sync(drm->dev); |
1642 |
++ if (IS_ERR_VALUE(ret) && ret != -EACCES) |
1643 |
++ return ret; |
1644 |
+ ret = nvif_mthd(ctrl, NVIF_CONTROL_PSTATE_USER, &args, sizeof(args)); |
1645 |
++ pm_runtime_put_autosuspend(drm->dev); |
1646 |
+ if (ret < 0) |
1647 |
+ return ret; |
1648 |
+ |
1649 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c |
1650 |
+index f5d3158f0378..c7ec86d6c3c9 100644 |
1651 |
+--- a/drivers/gpu/drm/nouveau/nouveau_drm.c |
1652 |
++++ b/drivers/gpu/drm/nouveau/nouveau_drm.c |
1653 |
+@@ -908,8 +908,10 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv) |
1654 |
+ get_task_comm(tmpname, current); |
1655 |
+ snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid)); |
1656 |
+ |
1657 |
+- if (!(cli = kzalloc(sizeof(*cli), GFP_KERNEL))) |
1658 |
+- return ret; |
1659 |
++ if (!(cli = kzalloc(sizeof(*cli), GFP_KERNEL))) { |
1660 |
++ ret = -ENOMEM; |
1661 |
++ goto done; |
1662 |
++ } |
1663 |
+ |
1664 |
+ ret = nouveau_cli_init(drm, name, cli); |
1665 |
+ if (ret) |
1666 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c |
1667 |
+index 78597da6313a..0e372a190d3f 100644 |
1668 |
+--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c |
1669 |
++++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c |
1670 |
+@@ -23,6 +23,10 @@ |
1671 |
+ #ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER |
1672 |
+ #include "priv.h" |
1673 |
+ |
1674 |
++#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) |
1675 |
++#include <asm/dma-iommu.h> |
1676 |
++#endif |
1677 |
++ |
1678 |
+ static int |
1679 |
+ nvkm_device_tegra_power_up(struct nvkm_device_tegra *tdev) |
1680 |
+ { |
1681 |
+@@ -105,6 +109,15 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev) |
1682 |
+ unsigned long pgsize_bitmap; |
1683 |
+ int ret; |
1684 |
+ |
1685 |
++#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) |
1686 |
++ if (dev->archdata.mapping) { |
1687 |
++ struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); |
1688 |
++ |
1689 |
++ arm_iommu_detach_device(dev); |
1690 |
++ arm_iommu_release_mapping(mapping); |
1691 |
++ } |
1692 |
++#endif |
1693 |
++ |
1694 |
+ if (!tdev->func->iommu_bit) |
1695 |
+ return; |
1696 |
+ |
1697 |
+diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c |
1698 |
+index a188a3959f1a..6ad827b93ae1 100644 |
1699 |
+--- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c |
1700 |
++++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c |
1701 |
+@@ -823,7 +823,7 @@ static void s6e8aa0_read_mtp_id(struct s6e8aa0 *ctx) |
1702 |
+ int ret, i; |
1703 |
+ |
1704 |
+ ret = s6e8aa0_dcs_read(ctx, 0xd1, id, ARRAY_SIZE(id)); |
1705 |
+- if (ret < ARRAY_SIZE(id) || id[0] == 0x00) { |
1706 |
++ if (ret < 0 || ret < ARRAY_SIZE(id) || id[0] == 0x00) { |
1707 |
+ dev_err(ctx->dev, "read id failed\n"); |
1708 |
+ ctx->error = -EIO; |
1709 |
+ return; |
1710 |
+diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c |
1711 |
+index 5450a2db1219..2beadb3f79c2 100644 |
1712 |
+--- a/drivers/gpu/ipu-v3/ipu-csi.c |
1713 |
++++ b/drivers/gpu/ipu-v3/ipu-csi.c |
1714 |
+@@ -318,13 +318,17 @@ static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config *cfg, u32 mbus_code) |
1715 |
+ /* |
1716 |
+ * Fill a CSI bus config struct from mbus_config and mbus_framefmt. |
1717 |
+ */ |
1718 |
+-static void fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg, |
1719 |
++static int fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg, |
1720 |
+ struct v4l2_mbus_config *mbus_cfg, |
1721 |
+ struct v4l2_mbus_framefmt *mbus_fmt) |
1722 |
+ { |
1723 |
++ int ret; |
1724 |
++ |
1725 |
+ memset(csicfg, 0, sizeof(*csicfg)); |
1726 |
+ |
1727 |
+- mbus_code_to_bus_cfg(csicfg, mbus_fmt->code); |
1728 |
++ ret = mbus_code_to_bus_cfg(csicfg, mbus_fmt->code); |
1729 |
++ if (ret < 0) |
1730 |
++ return ret; |
1731 |
+ |
1732 |
+ switch (mbus_cfg->type) { |
1733 |
+ case V4L2_MBUS_PARALLEL: |
1734 |
+@@ -356,6 +360,8 @@ static void fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg, |
1735 |
+ /* will never get here, keep compiler quiet */ |
1736 |
+ break; |
1737 |
+ } |
1738 |
++ |
1739 |
++ return 0; |
1740 |
+ } |
1741 |
+ |
1742 |
+ int ipu_csi_init_interface(struct ipu_csi *csi, |
1743 |
+@@ -365,8 +371,11 @@ int ipu_csi_init_interface(struct ipu_csi *csi, |
1744 |
+ struct ipu_csi_bus_config cfg; |
1745 |
+ unsigned long flags; |
1746 |
+ u32 width, height, data = 0; |
1747 |
++ int ret; |
1748 |
+ |
1749 |
+- fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt); |
1750 |
++ ret = fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt); |
1751 |
++ if (ret < 0) |
1752 |
++ return ret; |
1753 |
+ |
1754 |
+ /* set default sensor frame width and height */ |
1755 |
+ width = mbus_fmt->width; |
1756 |
+@@ -587,11 +596,14 @@ int ipu_csi_set_mipi_datatype(struct ipu_csi *csi, u32 vc, |
1757 |
+ struct ipu_csi_bus_config cfg; |
1758 |
+ unsigned long flags; |
1759 |
+ u32 temp; |
1760 |
++ int ret; |
1761 |
+ |
1762 |
+ if (vc > 3) |
1763 |
+ return -EINVAL; |
1764 |
+ |
1765 |
+- mbus_code_to_bus_cfg(&cfg, mbus_fmt->code); |
1766 |
++ ret = mbus_code_to_bus_cfg(&cfg, mbus_fmt->code); |
1767 |
++ if (ret < 0) |
1768 |
++ return ret; |
1769 |
+ |
1770 |
+ spin_lock_irqsave(&csi->lock, flags); |
1771 |
+ |
1772 |
+diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c |
1773 |
+index b10fe26c4891..c9a466be7709 100644 |
1774 |
+--- a/drivers/hv/vmbus_drv.c |
1775 |
++++ b/drivers/hv/vmbus_drv.c |
1776 |
+@@ -1178,6 +1178,9 @@ static ssize_t vmbus_chan_attr_show(struct kobject *kobj, |
1777 |
+ if (!attribute->show) |
1778 |
+ return -EIO; |
1779 |
+ |
1780 |
++ if (chan->state != CHANNEL_OPENED_STATE) |
1781 |
++ return -EINVAL; |
1782 |
++ |
1783 |
+ return attribute->show(chan, buf); |
1784 |
+ } |
1785 |
+ |
1786 |
+diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c |
1787 |
+index 9bc04c50d45b..1d94ebec027b 100644 |
1788 |
+--- a/drivers/hwtracing/coresight/coresight-etm4x.c |
1789 |
++++ b/drivers/hwtracing/coresight/coresight-etm4x.c |
1790 |
+@@ -1027,7 +1027,8 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) |
1791 |
+ } |
1792 |
+ |
1793 |
+ pm_runtime_put(&adev->dev); |
1794 |
+- dev_info(dev, "%s initialized\n", (char *)id->data); |
1795 |
++ dev_info(dev, "CPU%d: ETM v%d.%d initialized\n", |
1796 |
++ drvdata->cpu, drvdata->arch >> 4, drvdata->arch & 0xf); |
1797 |
+ |
1798 |
+ if (boot_enable) { |
1799 |
+ coresight_enable(drvdata->csdev); |
1800 |
+@@ -1045,23 +1046,19 @@ err_arch_supported: |
1801 |
+ return ret; |
1802 |
+ } |
1803 |
+ |
1804 |
++#define ETM4x_AMBA_ID(pid) \ |
1805 |
++ { \ |
1806 |
++ .id = pid, \ |
1807 |
++ .mask = 0x000fffff, \ |
1808 |
++ } |
1809 |
++ |
1810 |
+ static const struct amba_id etm4_ids[] = { |
1811 |
+- { /* ETM 4.0 - Cortex-A53 */ |
1812 |
+- .id = 0x000bb95d, |
1813 |
+- .mask = 0x000fffff, |
1814 |
+- .data = "ETM 4.0", |
1815 |
+- }, |
1816 |
+- { /* ETM 4.0 - Cortex-A57 */ |
1817 |
+- .id = 0x000bb95e, |
1818 |
+- .mask = 0x000fffff, |
1819 |
+- .data = "ETM 4.0", |
1820 |
+- }, |
1821 |
+- { /* ETM 4.0 - A72, Maia, HiSilicon */ |
1822 |
+- .id = 0x000bb95a, |
1823 |
+- .mask = 0x000fffff, |
1824 |
+- .data = "ETM 4.0", |
1825 |
+- }, |
1826 |
+- { 0, 0}, |
1827 |
++ ETM4x_AMBA_ID(0x000bb95d), /* Cortex-A53 */ |
1828 |
++ ETM4x_AMBA_ID(0x000bb95e), /* Cortex-A57 */ |
1829 |
++ ETM4x_AMBA_ID(0x000bb95a), /* Cortex-A72 */ |
1830 |
++ ETM4x_AMBA_ID(0x000bb959), /* Cortex-A73 */ |
1831 |
++ ETM4x_AMBA_ID(0x000bb9da), /* Cortex-A35 */ |
1832 |
++ {}, |
1833 |
+ }; |
1834 |
+ |
1835 |
+ static struct amba_driver etm4x_driver = { |
1836 |
+diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c |
1837 |
+index 01b7457fe8fc..459ef930d98c 100644 |
1838 |
+--- a/drivers/hwtracing/coresight/coresight-tpiu.c |
1839 |
++++ b/drivers/hwtracing/coresight/coresight-tpiu.c |
1840 |
+@@ -40,8 +40,9 @@ |
1841 |
+ |
1842 |
+ /** register definition **/ |
1843 |
+ /* FFSR - 0x300 */ |
1844 |
+-#define FFSR_FT_STOPPED BIT(1) |
1845 |
++#define FFSR_FT_STOPPED_BIT 1 |
1846 |
+ /* FFCR - 0x304 */ |
1847 |
++#define FFCR_FON_MAN_BIT 6 |
1848 |
+ #define FFCR_FON_MAN BIT(6) |
1849 |
+ #define FFCR_STOP_FI BIT(12) |
1850 |
+ |
1851 |
+@@ -86,9 +87,9 @@ static void tpiu_disable_hw(struct tpiu_drvdata *drvdata) |
1852 |
+ /* Generate manual flush */ |
1853 |
+ writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR); |
1854 |
+ /* Wait for flush to complete */ |
1855 |
+- coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0); |
1856 |
++ coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN_BIT, 0); |
1857 |
+ /* Wait for formatter to stop */ |
1858 |
+- coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED, 1); |
1859 |
++ coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED_BIT, 1); |
1860 |
+ |
1861 |
+ CS_LOCK(drvdata->base); |
1862 |
+ } |
1863 |
+diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c |
1864 |
+index 29e834aab539..b673718952f6 100644 |
1865 |
+--- a/drivers/hwtracing/coresight/coresight.c |
1866 |
++++ b/drivers/hwtracing/coresight/coresight.c |
1867 |
+@@ -108,7 +108,7 @@ static int coresight_find_link_inport(struct coresight_device *csdev, |
1868 |
+ dev_err(&csdev->dev, "couldn't find inport, parent: %s, child: %s\n", |
1869 |
+ dev_name(&parent->dev), dev_name(&csdev->dev)); |
1870 |
+ |
1871 |
+- return 0; |
1872 |
++ return -ENODEV; |
1873 |
+ } |
1874 |
+ |
1875 |
+ static int coresight_find_link_outport(struct coresight_device *csdev, |
1876 |
+@@ -126,7 +126,7 @@ static int coresight_find_link_outport(struct coresight_device *csdev, |
1877 |
+ dev_err(&csdev->dev, "couldn't find outport, parent: %s, child: %s\n", |
1878 |
+ dev_name(&csdev->dev), dev_name(&child->dev)); |
1879 |
+ |
1880 |
+- return 0; |
1881 |
++ return -ENODEV; |
1882 |
+ } |
1883 |
+ |
1884 |
+ static int coresight_enable_sink(struct coresight_device *csdev, u32 mode) |
1885 |
+@@ -179,6 +179,9 @@ static int coresight_enable_link(struct coresight_device *csdev, |
1886 |
+ else |
1887 |
+ refport = 0; |
1888 |
+ |
1889 |
++ if (refport < 0) |
1890 |
++ return refport; |
1891 |
++ |
1892 |
+ if (atomic_inc_return(&csdev->refcnt[refport]) == 1) { |
1893 |
+ if (link_ops(csdev)->enable) { |
1894 |
+ ret = link_ops(csdev)->enable(csdev, inport, outport); |
1895 |
+diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c |
1896 |
+index 715b6fdb4989..5c8ea4e9203c 100644 |
1897 |
+--- a/drivers/i2c/busses/i2c-aspeed.c |
1898 |
++++ b/drivers/i2c/busses/i2c-aspeed.c |
1899 |
+@@ -111,22 +111,22 @@ |
1900 |
+ #define ASPEED_I2CD_DEV_ADDR_MASK GENMASK(6, 0) |
1901 |
+ |
1902 |
+ enum aspeed_i2c_master_state { |
1903 |
++ ASPEED_I2C_MASTER_INACTIVE, |
1904 |
+ ASPEED_I2C_MASTER_START, |
1905 |
+ ASPEED_I2C_MASTER_TX_FIRST, |
1906 |
+ ASPEED_I2C_MASTER_TX, |
1907 |
+ ASPEED_I2C_MASTER_RX_FIRST, |
1908 |
+ ASPEED_I2C_MASTER_RX, |
1909 |
+ ASPEED_I2C_MASTER_STOP, |
1910 |
+- ASPEED_I2C_MASTER_INACTIVE, |
1911 |
+ }; |
1912 |
+ |
1913 |
+ enum aspeed_i2c_slave_state { |
1914 |
++ ASPEED_I2C_SLAVE_STOP, |
1915 |
+ ASPEED_I2C_SLAVE_START, |
1916 |
+ ASPEED_I2C_SLAVE_READ_REQUESTED, |
1917 |
+ ASPEED_I2C_SLAVE_READ_PROCESSED, |
1918 |
+ ASPEED_I2C_SLAVE_WRITE_REQUESTED, |
1919 |
+ ASPEED_I2C_SLAVE_WRITE_RECEIVED, |
1920 |
+- ASPEED_I2C_SLAVE_STOP, |
1921 |
+ }; |
1922 |
+ |
1923 |
+ struct aspeed_i2c_bus { |
1924 |
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
1925 |
+index dafcb6f019b3..2702ead01a03 100644 |
1926 |
+--- a/drivers/infiniband/core/cma.c |
1927 |
++++ b/drivers/infiniband/core/cma.c |
1928 |
+@@ -722,6 +722,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) |
1929 |
+ dgid = (union ib_gid *) &addr->sib_addr; |
1930 |
+ pkey = ntohs(addr->sib_pkey); |
1931 |
+ |
1932 |
++ mutex_lock(&lock); |
1933 |
+ list_for_each_entry(cur_dev, &dev_list, list) { |
1934 |
+ for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) { |
1935 |
+ if (!rdma_cap_af_ib(cur_dev->device, p)) |
1936 |
+@@ -748,18 +749,19 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) |
1937 |
+ cma_dev = cur_dev; |
1938 |
+ sgid = gid; |
1939 |
+ id_priv->id.port_num = p; |
1940 |
++ goto found; |
1941 |
+ } |
1942 |
+ } |
1943 |
+ } |
1944 |
+ } |
1945 |
+- |
1946 |
+- if (!cma_dev) |
1947 |
+- return -ENODEV; |
1948 |
++ mutex_unlock(&lock); |
1949 |
++ return -ENODEV; |
1950 |
+ |
1951 |
+ found: |
1952 |
+ cma_attach_to_dev(id_priv, cma_dev); |
1953 |
+- addr = (struct sockaddr_ib *) cma_src_addr(id_priv); |
1954 |
+- memcpy(&addr->sib_addr, &sgid, sizeof sgid); |
1955 |
++ mutex_unlock(&lock); |
1956 |
++ addr = (struct sockaddr_ib *)cma_src_addr(id_priv); |
1957 |
++ memcpy(&addr->sib_addr, &sgid, sizeof(sgid)); |
1958 |
+ cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr); |
1959 |
+ return 0; |
1960 |
+ } |
1961 |
+diff --git a/drivers/infiniband/hw/mlx5/cong.c b/drivers/infiniband/hw/mlx5/cong.c |
1962 |
+index 985fa2637390..7e4e358a4fd8 100644 |
1963 |
+--- a/drivers/infiniband/hw/mlx5/cong.c |
1964 |
++++ b/drivers/infiniband/hw/mlx5/cong.c |
1965 |
+@@ -359,9 +359,6 @@ static ssize_t get_param(struct file *filp, char __user *buf, size_t count, |
1966 |
+ int ret; |
1967 |
+ char lbuf[11]; |
1968 |
+ |
1969 |
+- if (*pos) |
1970 |
+- return 0; |
1971 |
+- |
1972 |
+ ret = mlx5_ib_get_cc_params(param->dev, param->port_num, offset, &var); |
1973 |
+ if (ret) |
1974 |
+ return ret; |
1975 |
+@@ -370,11 +367,7 @@ static ssize_t get_param(struct file *filp, char __user *buf, size_t count, |
1976 |
+ if (ret < 0) |
1977 |
+ return ret; |
1978 |
+ |
1979 |
+- if (copy_to_user(buf, lbuf, ret)) |
1980 |
+- return -EFAULT; |
1981 |
+- |
1982 |
+- *pos += ret; |
1983 |
+- return ret; |
1984 |
++ return simple_read_from_buffer(buf, count, pos, lbuf, ret); |
1985 |
+ } |
1986 |
+ |
1987 |
+ static const struct file_operations dbg_cc_fops = { |
1988 |
+diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c |
1989 |
+index 90a9c461cedc..308456d28afb 100644 |
1990 |
+--- a/drivers/infiniband/hw/mlx5/mr.c |
1991 |
++++ b/drivers/infiniband/hw/mlx5/mr.c |
1992 |
+@@ -271,16 +271,16 @@ static ssize_t size_write(struct file *filp, const char __user *buf, |
1993 |
+ { |
1994 |
+ struct mlx5_cache_ent *ent = filp->private_data; |
1995 |
+ struct mlx5_ib_dev *dev = ent->dev; |
1996 |
+- char lbuf[20]; |
1997 |
++ char lbuf[20] = {0}; |
1998 |
+ u32 var; |
1999 |
+ int err; |
2000 |
+ int c; |
2001 |
+ |
2002 |
+- if (copy_from_user(lbuf, buf, sizeof(lbuf))) |
2003 |
++ count = min(count, sizeof(lbuf) - 1); |
2004 |
++ if (copy_from_user(lbuf, buf, count)) |
2005 |
+ return -EFAULT; |
2006 |
+ |
2007 |
+ c = order2idx(dev, ent->order); |
2008 |
+- lbuf[sizeof(lbuf) - 1] = 0; |
2009 |
+ |
2010 |
+ if (sscanf(lbuf, "%u", &var) != 1) |
2011 |
+ return -EINVAL; |
2012 |
+@@ -310,19 +310,11 @@ static ssize_t size_read(struct file *filp, char __user *buf, size_t count, |
2013 |
+ char lbuf[20]; |
2014 |
+ int err; |
2015 |
+ |
2016 |
+- if (*pos) |
2017 |
+- return 0; |
2018 |
+- |
2019 |
+ err = snprintf(lbuf, sizeof(lbuf), "%d\n", ent->size); |
2020 |
+ if (err < 0) |
2021 |
+ return err; |
2022 |
+ |
2023 |
+- if (copy_to_user(buf, lbuf, err)) |
2024 |
+- return -EFAULT; |
2025 |
+- |
2026 |
+- *pos += err; |
2027 |
+- |
2028 |
+- return err; |
2029 |
++ return simple_read_from_buffer(buf, count, pos, lbuf, err); |
2030 |
+ } |
2031 |
+ |
2032 |
+ static const struct file_operations size_fops = { |
2033 |
+@@ -337,16 +329,16 @@ static ssize_t limit_write(struct file *filp, const char __user *buf, |
2034 |
+ { |
2035 |
+ struct mlx5_cache_ent *ent = filp->private_data; |
2036 |
+ struct mlx5_ib_dev *dev = ent->dev; |
2037 |
+- char lbuf[20]; |
2038 |
++ char lbuf[20] = {0}; |
2039 |
+ u32 var; |
2040 |
+ int err; |
2041 |
+ int c; |
2042 |
+ |
2043 |
+- if (copy_from_user(lbuf, buf, sizeof(lbuf))) |
2044 |
++ count = min(count, sizeof(lbuf) - 1); |
2045 |
++ if (copy_from_user(lbuf, buf, count)) |
2046 |
+ return -EFAULT; |
2047 |
+ |
2048 |
+ c = order2idx(dev, ent->order); |
2049 |
+- lbuf[sizeof(lbuf) - 1] = 0; |
2050 |
+ |
2051 |
+ if (sscanf(lbuf, "%u", &var) != 1) |
2052 |
+ return -EINVAL; |
2053 |
+@@ -372,19 +364,11 @@ static ssize_t limit_read(struct file *filp, char __user *buf, size_t count, |
2054 |
+ char lbuf[20]; |
2055 |
+ int err; |
2056 |
+ |
2057 |
+- if (*pos) |
2058 |
+- return 0; |
2059 |
+- |
2060 |
+ err = snprintf(lbuf, sizeof(lbuf), "%d\n", ent->limit); |
2061 |
+ if (err < 0) |
2062 |
+ return err; |
2063 |
+ |
2064 |
+- if (copy_to_user(buf, lbuf, err)) |
2065 |
+- return -EFAULT; |
2066 |
+- |
2067 |
+- *pos += err; |
2068 |
+- |
2069 |
+- return err; |
2070 |
++ return simple_read_from_buffer(buf, count, pos, lbuf, err); |
2071 |
+ } |
2072 |
+ |
2073 |
+ static const struct file_operations limit_fops = { |
2074 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c |
2075 |
+index dfba44a40f0b..fe45d6cad6cd 100644 |
2076 |
+--- a/drivers/infiniband/sw/rxe/rxe_recv.c |
2077 |
++++ b/drivers/infiniband/sw/rxe/rxe_recv.c |
2078 |
+@@ -225,9 +225,14 @@ static int hdr_check(struct rxe_pkt_info *pkt) |
2079 |
+ goto err1; |
2080 |
+ } |
2081 |
+ |
2082 |
++ if (unlikely(qpn == 0)) { |
2083 |
++ pr_warn_once("QP 0 not supported"); |
2084 |
++ goto err1; |
2085 |
++ } |
2086 |
++ |
2087 |
+ if (qpn != IB_MULTICAST_QPN) { |
2088 |
+- index = (qpn == 0) ? port->qp_smi_index : |
2089 |
+- ((qpn == 1) ? port->qp_gsi_index : qpn); |
2090 |
++ index = (qpn == 1) ? port->qp_gsi_index : qpn; |
2091 |
++ |
2092 |
+ qp = rxe_pool_get_index(&rxe->qp_pool, index); |
2093 |
+ if (unlikely(!qp)) { |
2094 |
+ pr_warn_ratelimited("no qp matches qpn 0x%x\n", qpn); |
2095 |
+diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c |
2096 |
+index 6535d9beb24d..a620701f9d41 100644 |
2097 |
+--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c |
2098 |
++++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c |
2099 |
+@@ -1028,12 +1028,14 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even |
2100 |
+ |
2101 |
+ skb_queue_head_init(&skqueue); |
2102 |
+ |
2103 |
++ netif_tx_lock_bh(p->dev); |
2104 |
+ spin_lock_irq(&priv->lock); |
2105 |
+ set_bit(IPOIB_FLAG_OPER_UP, &p->flags); |
2106 |
+ if (p->neigh) |
2107 |
+ while ((skb = __skb_dequeue(&p->neigh->queue))) |
2108 |
+ __skb_queue_tail(&skqueue, skb); |
2109 |
+ spin_unlock_irq(&priv->lock); |
2110 |
++ netif_tx_unlock_bh(p->dev); |
2111 |
+ |
2112 |
+ while ((skb = __skb_dequeue(&skqueue))) { |
2113 |
+ skb->dev = p->dev; |
2114 |
+diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c |
2115 |
+index 26cde95bc0f3..7630d5ed2b41 100644 |
2116 |
+--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c |
2117 |
++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c |
2118 |
+@@ -1787,7 +1787,8 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port) |
2119 |
+ goto out_free_pd; |
2120 |
+ } |
2121 |
+ |
2122 |
+- if (ipoib_neigh_hash_init(priv) < 0) { |
2123 |
++ ret = ipoib_neigh_hash_init(priv); |
2124 |
++ if (ret) { |
2125 |
+ pr_warn("%s failed to init neigh hash\n", dev->name); |
2126 |
+ goto out_dev_uninit; |
2127 |
+ } |
2128 |
+diff --git a/drivers/input/joystick/pxrc.c b/drivers/input/joystick/pxrc.c |
2129 |
+index 07a0dbd3ced2..cfb410cf0789 100644 |
2130 |
+--- a/drivers/input/joystick/pxrc.c |
2131 |
++++ b/drivers/input/joystick/pxrc.c |
2132 |
+@@ -120,48 +120,51 @@ static void pxrc_close(struct input_dev *input) |
2133 |
+ mutex_unlock(&pxrc->pm_mutex); |
2134 |
+ } |
2135 |
+ |
2136 |
++static void pxrc_free_urb(void *_pxrc) |
2137 |
++{ |
2138 |
++ struct pxrc *pxrc = _pxrc; |
2139 |
++ |
2140 |
++ usb_free_urb(pxrc->urb); |
2141 |
++} |
2142 |
++ |
2143 |
+ static int pxrc_usb_init(struct pxrc *pxrc) |
2144 |
+ { |
2145 |
+ struct usb_endpoint_descriptor *epirq; |
2146 |
+ unsigned int pipe; |
2147 |
+- int retval; |
2148 |
++ int error; |
2149 |
+ |
2150 |
+ /* Set up the endpoint information */ |
2151 |
+ /* This device only has an interrupt endpoint */ |
2152 |
+- retval = usb_find_common_endpoints(pxrc->intf->cur_altsetting, |
2153 |
+- NULL, NULL, &epirq, NULL); |
2154 |
+- if (retval) { |
2155 |
+- dev_err(&pxrc->intf->dev, |
2156 |
+- "Could not find endpoint\n"); |
2157 |
+- goto error; |
2158 |
++ error = usb_find_common_endpoints(pxrc->intf->cur_altsetting, |
2159 |
++ NULL, NULL, &epirq, NULL); |
2160 |
++ if (error) { |
2161 |
++ dev_err(&pxrc->intf->dev, "Could not find endpoint\n"); |
2162 |
++ return error; |
2163 |
+ } |
2164 |
+ |
2165 |
+ pxrc->bsize = usb_endpoint_maxp(epirq); |
2166 |
+ pxrc->epaddr = epirq->bEndpointAddress; |
2167 |
+ pxrc->data = devm_kmalloc(&pxrc->intf->dev, pxrc->bsize, GFP_KERNEL); |
2168 |
+- if (!pxrc->data) { |
2169 |
+- retval = -ENOMEM; |
2170 |
+- goto error; |
2171 |
+- } |
2172 |
++ if (!pxrc->data) |
2173 |
++ return -ENOMEM; |
2174 |
+ |
2175 |
+ usb_set_intfdata(pxrc->intf, pxrc); |
2176 |
+ usb_make_path(pxrc->udev, pxrc->phys, sizeof(pxrc->phys)); |
2177 |
+ strlcat(pxrc->phys, "/input0", sizeof(pxrc->phys)); |
2178 |
+ |
2179 |
+ pxrc->urb = usb_alloc_urb(0, GFP_KERNEL); |
2180 |
+- if (!pxrc->urb) { |
2181 |
+- retval = -ENOMEM; |
2182 |
+- goto error; |
2183 |
+- } |
2184 |
++ if (!pxrc->urb) |
2185 |
++ return -ENOMEM; |
2186 |
++ |
2187 |
++ error = devm_add_action_or_reset(&pxrc->intf->dev, pxrc_free_urb, pxrc); |
2188 |
++ if (error) |
2189 |
++ return error; |
2190 |
+ |
2191 |
+ pipe = usb_rcvintpipe(pxrc->udev, pxrc->epaddr), |
2192 |
+ usb_fill_int_urb(pxrc->urb, pxrc->udev, pipe, pxrc->data, pxrc->bsize, |
2193 |
+ pxrc_usb_irq, pxrc, 1); |
2194 |
+ |
2195 |
+-error: |
2196 |
+- return retval; |
2197 |
+- |
2198 |
+- |
2199 |
++ return 0; |
2200 |
+ } |
2201 |
+ |
2202 |
+ static int pxrc_input_init(struct pxrc *pxrc) |
2203 |
+@@ -197,7 +200,7 @@ static int pxrc_probe(struct usb_interface *intf, |
2204 |
+ const struct usb_device_id *id) |
2205 |
+ { |
2206 |
+ struct pxrc *pxrc; |
2207 |
+- int retval; |
2208 |
++ int error; |
2209 |
+ |
2210 |
+ pxrc = devm_kzalloc(&intf->dev, sizeof(*pxrc), GFP_KERNEL); |
2211 |
+ if (!pxrc) |
2212 |
+@@ -207,29 +210,20 @@ static int pxrc_probe(struct usb_interface *intf, |
2213 |
+ pxrc->udev = usb_get_dev(interface_to_usbdev(intf)); |
2214 |
+ pxrc->intf = intf; |
2215 |
+ |
2216 |
+- retval = pxrc_usb_init(pxrc); |
2217 |
+- if (retval) |
2218 |
+- goto error; |
2219 |
++ error = pxrc_usb_init(pxrc); |
2220 |
++ if (error) |
2221 |
++ return error; |
2222 |
+ |
2223 |
+- retval = pxrc_input_init(pxrc); |
2224 |
+- if (retval) |
2225 |
+- goto err_free_urb; |
2226 |
++ error = pxrc_input_init(pxrc); |
2227 |
++ if (error) |
2228 |
++ return error; |
2229 |
+ |
2230 |
+ return 0; |
2231 |
+- |
2232 |
+-err_free_urb: |
2233 |
+- usb_free_urb(pxrc->urb); |
2234 |
+- |
2235 |
+-error: |
2236 |
+- return retval; |
2237 |
+ } |
2238 |
+ |
2239 |
+ static void pxrc_disconnect(struct usb_interface *intf) |
2240 |
+ { |
2241 |
+- struct pxrc *pxrc = usb_get_intfdata(intf); |
2242 |
+- |
2243 |
+- usb_free_urb(pxrc->urb); |
2244 |
+- usb_set_intfdata(intf, NULL); |
2245 |
++ /* All driver resources are devm-managed. */ |
2246 |
+ } |
2247 |
+ |
2248 |
+ static int pxrc_suspend(struct usb_interface *intf, pm_message_t message) |
2249 |
+diff --git a/drivers/input/touchscreen/rohm_bu21023.c b/drivers/input/touchscreen/rohm_bu21023.c |
2250 |
+index bda0500c9b57..714affdd742f 100644 |
2251 |
+--- a/drivers/input/touchscreen/rohm_bu21023.c |
2252 |
++++ b/drivers/input/touchscreen/rohm_bu21023.c |
2253 |
+@@ -304,7 +304,7 @@ static int rohm_i2c_burst_read(struct i2c_client *client, u8 start, void *buf, |
2254 |
+ msg[1].len = len; |
2255 |
+ msg[1].buf = buf; |
2256 |
+ |
2257 |
+- i2c_lock_adapter(adap); |
2258 |
++ i2c_lock_bus(adap, I2C_LOCK_SEGMENT); |
2259 |
+ |
2260 |
+ for (i = 0; i < 2; i++) { |
2261 |
+ if (__i2c_transfer(adap, &msg[i], 1) < 0) { |
2262 |
+@@ -313,7 +313,7 @@ static int rohm_i2c_burst_read(struct i2c_client *client, u8 start, void *buf, |
2263 |
+ } |
2264 |
+ } |
2265 |
+ |
2266 |
+- i2c_unlock_adapter(adap); |
2267 |
++ i2c_unlock_bus(adap, I2C_LOCK_SEGMENT); |
2268 |
+ |
2269 |
+ return ret; |
2270 |
+ } |
2271 |
+diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c |
2272 |
+index b73c6a7bf7f2..b7076aa24d6b 100644 |
2273 |
+--- a/drivers/iommu/arm-smmu-v3.c |
2274 |
++++ b/drivers/iommu/arm-smmu-v3.c |
2275 |
+@@ -1302,6 +1302,7 @@ static irqreturn_t arm_smmu_priq_thread(int irq, void *dev) |
2276 |
+ |
2277 |
+ /* Sync our overflow flag, as we believe we're up to speed */ |
2278 |
+ q->cons = Q_OVF(q, q->prod) | Q_WRP(q, q->cons) | Q_IDX(q, q->cons); |
2279 |
++ writel(q->cons, q->cons_reg); |
2280 |
+ return IRQ_HANDLED; |
2281 |
+ } |
2282 |
+ |
2283 |
+diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c |
2284 |
+index 50e3a9fcf43e..b5948ba6b3b3 100644 |
2285 |
+--- a/drivers/iommu/io-pgtable-arm-v7s.c |
2286 |
++++ b/drivers/iommu/io-pgtable-arm-v7s.c |
2287 |
+@@ -192,6 +192,7 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, |
2288 |
+ { |
2289 |
+ struct io_pgtable_cfg *cfg = &data->iop.cfg; |
2290 |
+ struct device *dev = cfg->iommu_dev; |
2291 |
++ phys_addr_t phys; |
2292 |
+ dma_addr_t dma; |
2293 |
+ size_t size = ARM_V7S_TABLE_SIZE(lvl); |
2294 |
+ void *table = NULL; |
2295 |
+@@ -200,6 +201,10 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, |
2296 |
+ table = (void *)__get_dma_pages(__GFP_ZERO, get_order(size)); |
2297 |
+ else if (lvl == 2) |
2298 |
+ table = kmem_cache_zalloc(data->l2_tables, gfp | GFP_DMA); |
2299 |
++ phys = virt_to_phys(table); |
2300 |
++ if (phys != (arm_v7s_iopte)phys) |
2301 |
++ /* Doesn't fit in PTE */ |
2302 |
++ goto out_free; |
2303 |
+ if (table && !(cfg->quirks & IO_PGTABLE_QUIRK_NO_DMA)) { |
2304 |
+ dma = dma_map_single(dev, table, size, DMA_TO_DEVICE); |
2305 |
+ if (dma_mapping_error(dev, dma)) |
2306 |
+@@ -209,7 +214,7 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, |
2307 |
+ * address directly, so if the DMA layer suggests otherwise by |
2308 |
+ * translating or truncating them, that bodes very badly... |
2309 |
+ */ |
2310 |
+- if (dma != virt_to_phys(table)) |
2311 |
++ if (dma != phys) |
2312 |
+ goto out_unmap; |
2313 |
+ } |
2314 |
+ kmemleak_ignore(table); |
2315 |
+diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c |
2316 |
+index 010a254305dd..88641b4560bc 100644 |
2317 |
+--- a/drivers/iommu/io-pgtable-arm.c |
2318 |
++++ b/drivers/iommu/io-pgtable-arm.c |
2319 |
+@@ -237,7 +237,8 @@ static void *__arm_lpae_alloc_pages(size_t size, gfp_t gfp, |
2320 |
+ void *pages; |
2321 |
+ |
2322 |
+ VM_BUG_ON((gfp & __GFP_HIGHMEM)); |
2323 |
+- p = alloc_pages_node(dev_to_node(dev), gfp | __GFP_ZERO, order); |
2324 |
++ p = alloc_pages_node(dev ? dev_to_node(dev) : NUMA_NO_NODE, |
2325 |
++ gfp | __GFP_ZERO, order); |
2326 |
+ if (!p) |
2327 |
+ return NULL; |
2328 |
+ |
2329 |
+diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c |
2330 |
+index feb1664815b7..6e2882cda55d 100644 |
2331 |
+--- a/drivers/iommu/ipmmu-vmsa.c |
2332 |
++++ b/drivers/iommu/ipmmu-vmsa.c |
2333 |
+@@ -47,6 +47,7 @@ struct ipmmu_features { |
2334 |
+ unsigned int number_of_contexts; |
2335 |
+ bool setup_imbuscr; |
2336 |
+ bool twobit_imttbcr_sl0; |
2337 |
++ bool reserved_context; |
2338 |
+ }; |
2339 |
+ |
2340 |
+ struct ipmmu_vmsa_device { |
2341 |
+@@ -916,6 +917,7 @@ static const struct ipmmu_features ipmmu_features_default = { |
2342 |
+ .number_of_contexts = 1, /* software only tested with one context */ |
2343 |
+ .setup_imbuscr = true, |
2344 |
+ .twobit_imttbcr_sl0 = false, |
2345 |
++ .reserved_context = false, |
2346 |
+ }; |
2347 |
+ |
2348 |
+ static const struct ipmmu_features ipmmu_features_r8a7795 = { |
2349 |
+@@ -924,6 +926,7 @@ static const struct ipmmu_features ipmmu_features_r8a7795 = { |
2350 |
+ .number_of_contexts = 8, |
2351 |
+ .setup_imbuscr = false, |
2352 |
+ .twobit_imttbcr_sl0 = true, |
2353 |
++ .reserved_context = true, |
2354 |
+ }; |
2355 |
+ |
2356 |
+ static const struct of_device_id ipmmu_of_ids[] = { |
2357 |
+@@ -1017,6 +1020,11 @@ static int ipmmu_probe(struct platform_device *pdev) |
2358 |
+ } |
2359 |
+ |
2360 |
+ ipmmu_device_reset(mmu); |
2361 |
++ |
2362 |
++ if (mmu->features->reserved_context) { |
2363 |
++ dev_info(&pdev->dev, "IPMMU context 0 is reserved\n"); |
2364 |
++ set_bit(0, mmu->ctx); |
2365 |
++ } |
2366 |
+ } |
2367 |
+ |
2368 |
+ /* |
2369 |
+diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c |
2370 |
+index b57f764d6a16..93ebba6dcc25 100644 |
2371 |
+--- a/drivers/lightnvm/pblk-init.c |
2372 |
++++ b/drivers/lightnvm/pblk-init.c |
2373 |
+@@ -716,10 +716,11 @@ static int pblk_setup_line_meta_12(struct pblk *pblk, struct pblk_line *line, |
2374 |
+ |
2375 |
+ /* |
2376 |
+ * In 1.2 spec. chunk state is not persisted by the device. Thus |
2377 |
+- * some of the values are reset each time pblk is instantiated. |
2378 |
++ * some of the values are reset each time pblk is instantiated, |
2379 |
++ * so we have to assume that the block is closed. |
2380 |
+ */ |
2381 |
+ if (lun_bb_meta[line->id] == NVM_BLK_T_FREE) |
2382 |
+- chunk->state = NVM_CHK_ST_FREE; |
2383 |
++ chunk->state = NVM_CHK_ST_CLOSED; |
2384 |
+ else |
2385 |
+ chunk->state = NVM_CHK_ST_OFFLINE; |
2386 |
+ |
2387 |
+diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c |
2388 |
+index 3a5069183859..d83466b3821b 100644 |
2389 |
+--- a/drivers/lightnvm/pblk-recovery.c |
2390 |
++++ b/drivers/lightnvm/pblk-recovery.c |
2391 |
+@@ -742,9 +742,10 @@ static int pblk_recov_check_line_version(struct pblk *pblk, |
2392 |
+ return 1; |
2393 |
+ } |
2394 |
+ |
2395 |
+-#ifdef NVM_DEBUG |
2396 |
++#ifdef CONFIG_NVM_PBLK_DEBUG |
2397 |
+ if (header->version_minor > EMETA_VERSION_MINOR) |
2398 |
+- pr_info("pblk: newer line minor version found: %d\n", line_v); |
2399 |
++ pr_info("pblk: newer line minor version found: %d\n", |
2400 |
++ header->version_minor); |
2401 |
+ #endif |
2402 |
+ |
2403 |
+ return 0; |
2404 |
+diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c |
2405 |
+index 12decdbd722d..fc65f0dedf7f 100644 |
2406 |
+--- a/drivers/md/dm-verity-target.c |
2407 |
++++ b/drivers/md/dm-verity-target.c |
2408 |
+@@ -99,10 +99,26 @@ static int verity_hash_update(struct dm_verity *v, struct ahash_request *req, |
2409 |
+ { |
2410 |
+ struct scatterlist sg; |
2411 |
+ |
2412 |
+- sg_init_one(&sg, data, len); |
2413 |
+- ahash_request_set_crypt(req, &sg, NULL, len); |
2414 |
+- |
2415 |
+- return crypto_wait_req(crypto_ahash_update(req), wait); |
2416 |
++ if (likely(!is_vmalloc_addr(data))) { |
2417 |
++ sg_init_one(&sg, data, len); |
2418 |
++ ahash_request_set_crypt(req, &sg, NULL, len); |
2419 |
++ return crypto_wait_req(crypto_ahash_update(req), wait); |
2420 |
++ } else { |
2421 |
++ do { |
2422 |
++ int r; |
2423 |
++ size_t this_step = min_t(size_t, len, PAGE_SIZE - offset_in_page(data)); |
2424 |
++ flush_kernel_vmap_range((void *)data, this_step); |
2425 |
++ sg_init_table(&sg, 1); |
2426 |
++ sg_set_page(&sg, vmalloc_to_page(data), this_step, offset_in_page(data)); |
2427 |
++ ahash_request_set_crypt(req, &sg, NULL, this_step); |
2428 |
++ r = crypto_wait_req(crypto_ahash_update(req), wait); |
2429 |
++ if (unlikely(r)) |
2430 |
++ return r; |
2431 |
++ data += this_step; |
2432 |
++ len -= this_step; |
2433 |
++ } while (len); |
2434 |
++ return 0; |
2435 |
++ } |
2436 |
+ } |
2437 |
+ |
2438 |
+ /* |
2439 |
+diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c |
2440 |
+index f32ec7342ef0..5653e8eebe2b 100644 |
2441 |
+--- a/drivers/media/common/videobuf2/videobuf2-core.c |
2442 |
++++ b/drivers/media/common/videobuf2/videobuf2-core.c |
2443 |
+@@ -1377,6 +1377,11 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb) |
2444 |
+ struct vb2_buffer *vb; |
2445 |
+ int ret; |
2446 |
+ |
2447 |
++ if (q->error) { |
2448 |
++ dprintk(1, "fatal error occurred on queue\n"); |
2449 |
++ return -EIO; |
2450 |
++ } |
2451 |
++ |
2452 |
+ vb = q->bufs[index]; |
2453 |
+ |
2454 |
+ switch (vb->state) { |
2455 |
+diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c |
2456 |
+index b3f762578f7f..1722cdab0daf 100644 |
2457 |
+--- a/drivers/media/i2c/ov5645.c |
2458 |
++++ b/drivers/media/i2c/ov5645.c |
2459 |
+@@ -510,8 +510,8 @@ static const struct reg_value ov5645_setting_full[] = { |
2460 |
+ }; |
2461 |
+ |
2462 |
+ static const s64 link_freq[] = { |
2463 |
+- 222880000, |
2464 |
+- 334320000 |
2465 |
++ 224000000, |
2466 |
++ 336000000 |
2467 |
+ }; |
2468 |
+ |
2469 |
+ static const struct ov5645_mode_info ov5645_mode_info_data[] = { |
2470 |
+@@ -520,7 +520,7 @@ static const struct ov5645_mode_info ov5645_mode_info_data[] = { |
2471 |
+ .height = 960, |
2472 |
+ .data = ov5645_setting_sxga, |
2473 |
+ .data_size = ARRAY_SIZE(ov5645_setting_sxga), |
2474 |
+- .pixel_clock = 111440000, |
2475 |
++ .pixel_clock = 112000000, |
2476 |
+ .link_freq = 0 /* an index in link_freq[] */ |
2477 |
+ }, |
2478 |
+ { |
2479 |
+@@ -528,7 +528,7 @@ static const struct ov5645_mode_info ov5645_mode_info_data[] = { |
2480 |
+ .height = 1080, |
2481 |
+ .data = ov5645_setting_1080p, |
2482 |
+ .data_size = ARRAY_SIZE(ov5645_setting_1080p), |
2483 |
+- .pixel_clock = 167160000, |
2484 |
++ .pixel_clock = 168000000, |
2485 |
+ .link_freq = 1 /* an index in link_freq[] */ |
2486 |
+ }, |
2487 |
+ { |
2488 |
+@@ -536,7 +536,7 @@ static const struct ov5645_mode_info ov5645_mode_info_data[] = { |
2489 |
+ .height = 1944, |
2490 |
+ .data = ov5645_setting_full, |
2491 |
+ .data_size = ARRAY_SIZE(ov5645_setting_full), |
2492 |
+- .pixel_clock = 167160000, |
2493 |
++ .pixel_clock = 168000000, |
2494 |
+ .link_freq = 1 /* an index in link_freq[] */ |
2495 |
+ }, |
2496 |
+ }; |
2497 |
+@@ -1145,7 +1145,8 @@ static int ov5645_probe(struct i2c_client *client, |
2498 |
+ return ret; |
2499 |
+ } |
2500 |
+ |
2501 |
+- if (xclk_freq != 23880000) { |
2502 |
++ /* external clock must be 24MHz, allow 1% tolerance */ |
2503 |
++ if (xclk_freq < 23760000 || xclk_freq > 24240000) { |
2504 |
+ dev_err(dev, "external clock frequency %u is not supported\n", |
2505 |
+ xclk_freq); |
2506 |
+ return -EINVAL; |
2507 |
+diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c |
2508 |
+index 0ea8dd44026c..3a06c000f97b 100644 |
2509 |
+--- a/drivers/media/pci/tw686x/tw686x-video.c |
2510 |
++++ b/drivers/media/pci/tw686x/tw686x-video.c |
2511 |
+@@ -1190,6 +1190,14 @@ int tw686x_video_init(struct tw686x_dev *dev) |
2512 |
+ return err; |
2513 |
+ } |
2514 |
+ |
2515 |
++ /* Initialize vc->dev and vc->ch for the error path */ |
2516 |
++ for (ch = 0; ch < max_channels(dev); ch++) { |
2517 |
++ struct tw686x_video_channel *vc = &dev->video_channels[ch]; |
2518 |
++ |
2519 |
++ vc->dev = dev; |
2520 |
++ vc->ch = ch; |
2521 |
++ } |
2522 |
++ |
2523 |
+ for (ch = 0; ch < max_channels(dev); ch++) { |
2524 |
+ struct tw686x_video_channel *vc = &dev->video_channels[ch]; |
2525 |
+ struct video_device *vdev; |
2526 |
+@@ -1198,9 +1206,6 @@ int tw686x_video_init(struct tw686x_dev *dev) |
2527 |
+ spin_lock_init(&vc->qlock); |
2528 |
+ INIT_LIST_HEAD(&vc->vidq_queued); |
2529 |
+ |
2530 |
+- vc->dev = dev; |
2531 |
+- vc->ch = ch; |
2532 |
+- |
2533 |
+ /* default settings */ |
2534 |
+ err = tw686x_set_standard(vc, V4L2_STD_NTSC); |
2535 |
+ if (err) |
2536 |
+diff --git a/drivers/mfd/88pm860x-i2c.c b/drivers/mfd/88pm860x-i2c.c |
2537 |
+index 84e313107233..7b9052ea7413 100644 |
2538 |
+--- a/drivers/mfd/88pm860x-i2c.c |
2539 |
++++ b/drivers/mfd/88pm860x-i2c.c |
2540 |
+@@ -146,14 +146,14 @@ int pm860x_page_reg_write(struct i2c_client *i2c, int reg, |
2541 |
+ unsigned char zero; |
2542 |
+ int ret; |
2543 |
+ |
2544 |
+- i2c_lock_adapter(i2c->adapter); |
2545 |
++ i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT); |
2546 |
+ read_device(i2c, 0xFA, 0, &zero); |
2547 |
+ read_device(i2c, 0xFB, 0, &zero); |
2548 |
+ read_device(i2c, 0xFF, 0, &zero); |
2549 |
+ ret = write_device(i2c, reg, 1, &data); |
2550 |
+ read_device(i2c, 0xFE, 0, &zero); |
2551 |
+ read_device(i2c, 0xFC, 0, &zero); |
2552 |
+- i2c_unlock_adapter(i2c->adapter); |
2553 |
++ i2c_unlock_bus(i2c->adapter, I2C_LOCK_SEGMENT); |
2554 |
+ return ret; |
2555 |
+ } |
2556 |
+ EXPORT_SYMBOL(pm860x_page_reg_write); |
2557 |
+@@ -164,14 +164,14 @@ int pm860x_page_bulk_read(struct i2c_client *i2c, int reg, |
2558 |
+ unsigned char zero = 0; |
2559 |
+ int ret; |
2560 |
+ |
2561 |
+- i2c_lock_adapter(i2c->adapter); |
2562 |
++ i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT); |
2563 |
+ read_device(i2c, 0xfa, 0, &zero); |
2564 |
+ read_device(i2c, 0xfb, 0, &zero); |
2565 |
+ read_device(i2c, 0xff, 0, &zero); |
2566 |
+ ret = read_device(i2c, reg, count, buf); |
2567 |
+ read_device(i2c, 0xFE, 0, &zero); |
2568 |
+ read_device(i2c, 0xFC, 0, &zero); |
2569 |
+- i2c_unlock_adapter(i2c->adapter); |
2570 |
++ i2c_unlock_bus(i2c->adapter, I2C_LOCK_SEGMENT); |
2571 |
+ return ret; |
2572 |
+ } |
2573 |
+ EXPORT_SYMBOL(pm860x_page_bulk_read); |
2574 |
+diff --git a/drivers/misc/hmc6352.c b/drivers/misc/hmc6352.c |
2575 |
+index eeb7eef62174..38f90e179927 100644 |
2576 |
+--- a/drivers/misc/hmc6352.c |
2577 |
++++ b/drivers/misc/hmc6352.c |
2578 |
+@@ -27,6 +27,7 @@ |
2579 |
+ #include <linux/err.h> |
2580 |
+ #include <linux/delay.h> |
2581 |
+ #include <linux/sysfs.h> |
2582 |
++#include <linux/nospec.h> |
2583 |
+ |
2584 |
+ static DEFINE_MUTEX(compass_mutex); |
2585 |
+ |
2586 |
+@@ -50,6 +51,7 @@ static int compass_store(struct device *dev, const char *buf, size_t count, |
2587 |
+ return ret; |
2588 |
+ if (val >= strlen(map)) |
2589 |
+ return -EINVAL; |
2590 |
++ val = array_index_nospec(val, strlen(map)); |
2591 |
+ mutex_lock(&compass_mutex); |
2592 |
+ ret = compass_command(c, map[val]); |
2593 |
+ mutex_unlock(&compass_mutex); |
2594 |
+diff --git a/drivers/misc/ibmvmc.c b/drivers/misc/ibmvmc.c |
2595 |
+index fb83d1375638..50d82c3d032a 100644 |
2596 |
+--- a/drivers/misc/ibmvmc.c |
2597 |
++++ b/drivers/misc/ibmvmc.c |
2598 |
+@@ -2131,7 +2131,7 @@ static int ibmvmc_init_crq_queue(struct crq_server_adapter *adapter) |
2599 |
+ retrc = plpar_hcall_norets(H_REG_CRQ, |
2600 |
+ vdev->unit_address, |
2601 |
+ queue->msg_token, PAGE_SIZE); |
2602 |
+- retrc = rc; |
2603 |
++ rc = retrc; |
2604 |
+ |
2605 |
+ if (rc == H_RESOURCE) |
2606 |
+ rc = ibmvmc_reset_crq_queue(adapter); |
2607 |
+diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c |
2608 |
+index 0208c4b027c5..fa0236a5e59a 100644 |
2609 |
+--- a/drivers/misc/mei/bus-fixup.c |
2610 |
++++ b/drivers/misc/mei/bus-fixup.c |
2611 |
+@@ -267,7 +267,7 @@ static int mei_nfc_if_version(struct mei_cl *cl, |
2612 |
+ |
2613 |
+ ret = 0; |
2614 |
+ bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length, 0); |
2615 |
+- if (bytes_recv < if_version_length) { |
2616 |
++ if (bytes_recv < 0 || bytes_recv < if_version_length) { |
2617 |
+ dev_err(bus->dev, "Could not read IF version\n"); |
2618 |
+ ret = -EIO; |
2619 |
+ goto err; |
2620 |
+diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c |
2621 |
+index b1133739fb4b..692b2f9a18cb 100644 |
2622 |
+--- a/drivers/misc/mei/bus.c |
2623 |
++++ b/drivers/misc/mei/bus.c |
2624 |
+@@ -505,17 +505,15 @@ int mei_cldev_enable(struct mei_cl_device *cldev) |
2625 |
+ |
2626 |
+ cl = cldev->cl; |
2627 |
+ |
2628 |
++ mutex_lock(&bus->device_lock); |
2629 |
+ if (cl->state == MEI_FILE_UNINITIALIZED) { |
2630 |
+- mutex_lock(&bus->device_lock); |
2631 |
+ ret = mei_cl_link(cl); |
2632 |
+- mutex_unlock(&bus->device_lock); |
2633 |
+ if (ret) |
2634 |
+- return ret; |
2635 |
++ goto out; |
2636 |
+ /* update pointers */ |
2637 |
+ cl->cldev = cldev; |
2638 |
+ } |
2639 |
+ |
2640 |
+- mutex_lock(&bus->device_lock); |
2641 |
+ if (mei_cl_is_connected(cl)) { |
2642 |
+ ret = 0; |
2643 |
+ goto out; |
2644 |
+@@ -600,9 +598,8 @@ int mei_cldev_disable(struct mei_cl_device *cldev) |
2645 |
+ if (err < 0) |
2646 |
+ dev_err(bus->dev, "Could not disconnect from the ME client\n"); |
2647 |
+ |
2648 |
+-out: |
2649 |
+ mei_cl_bus_module_put(cldev); |
2650 |
+- |
2651 |
++out: |
2652 |
+ /* Flush queues and remove any pending read */ |
2653 |
+ mei_cl_flush_queues(cl, NULL); |
2654 |
+ mei_cl_unlink(cl); |
2655 |
+@@ -860,12 +857,13 @@ static void mei_cl_bus_dev_release(struct device *dev) |
2656 |
+ |
2657 |
+ mei_me_cl_put(cldev->me_cl); |
2658 |
+ mei_dev_bus_put(cldev->bus); |
2659 |
++ mei_cl_unlink(cldev->cl); |
2660 |
+ kfree(cldev->cl); |
2661 |
+ kfree(cldev); |
2662 |
+ } |
2663 |
+ |
2664 |
+ static const struct device_type mei_cl_device_type = { |
2665 |
+- .release = mei_cl_bus_dev_release, |
2666 |
++ .release = mei_cl_bus_dev_release, |
2667 |
+ }; |
2668 |
+ |
2669 |
+ /** |
2670 |
+diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c |
2671 |
+index fe6595fe94f1..995ff1b7e7b5 100644 |
2672 |
+--- a/drivers/misc/mei/hbm.c |
2673 |
++++ b/drivers/misc/mei/hbm.c |
2674 |
+@@ -1140,15 +1140,18 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) |
2675 |
+ |
2676 |
+ props_res = (struct hbm_props_response *)mei_msg; |
2677 |
+ |
2678 |
+- if (props_res->status) { |
2679 |
++ if (props_res->status == MEI_HBMS_CLIENT_NOT_FOUND) { |
2680 |
++ dev_dbg(dev->dev, "hbm: properties response: %d CLIENT_NOT_FOUND\n", |
2681 |
++ props_res->me_addr); |
2682 |
++ } else if (props_res->status) { |
2683 |
+ dev_err(dev->dev, "hbm: properties response: wrong status = %d %s\n", |
2684 |
+ props_res->status, |
2685 |
+ mei_hbm_status_str(props_res->status)); |
2686 |
+ return -EPROTO; |
2687 |
++ } else { |
2688 |
++ mei_hbm_me_cl_add(dev, props_res); |
2689 |
+ } |
2690 |
+ |
2691 |
+- mei_hbm_me_cl_add(dev, props_res); |
2692 |
+- |
2693 |
+ /* request property for the next client */ |
2694 |
+ if (mei_hbm_prop_req(dev, props_res->me_addr + 1)) |
2695 |
+ return -EIO; |
2696 |
+diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-sdio.c |
2697 |
+index 09cb89645d06..2cfec33178c1 100644 |
2698 |
+--- a/drivers/mmc/host/meson-mx-sdio.c |
2699 |
++++ b/drivers/mmc/host/meson-mx-sdio.c |
2700 |
+@@ -517,19 +517,23 @@ static struct mmc_host_ops meson_mx_mmc_ops = { |
2701 |
+ static struct platform_device *meson_mx_mmc_slot_pdev(struct device *parent) |
2702 |
+ { |
2703 |
+ struct device_node *slot_node; |
2704 |
++ struct platform_device *pdev; |
2705 |
+ |
2706 |
+ /* |
2707 |
+ * TODO: the MMC core framework currently does not support |
2708 |
+ * controllers with multiple slots properly. So we only register |
2709 |
+ * the first slot for now |
2710 |
+ */ |
2711 |
+- slot_node = of_find_compatible_node(parent->of_node, NULL, "mmc-slot"); |
2712 |
++ slot_node = of_get_compatible_child(parent->of_node, "mmc-slot"); |
2713 |
+ if (!slot_node) { |
2714 |
+ dev_warn(parent, "no 'mmc-slot' sub-node found\n"); |
2715 |
+ return ERR_PTR(-ENOENT); |
2716 |
+ } |
2717 |
+ |
2718 |
+- return of_platform_device_create(slot_node, NULL, parent); |
2719 |
++ pdev = of_platform_device_create(slot_node, NULL, parent); |
2720 |
++ of_node_put(slot_node); |
2721 |
++ |
2722 |
++ return pdev; |
2723 |
+ } |
2724 |
+ |
2725 |
+ static int meson_mx_mmc_add_host(struct meson_mx_mmc_host *host) |
2726 |
+diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c |
2727 |
+index 071693ebfe18..68760d4a5d3d 100644 |
2728 |
+--- a/drivers/mmc/host/omap_hsmmc.c |
2729 |
++++ b/drivers/mmc/host/omap_hsmmc.c |
2730 |
+@@ -2177,6 +2177,7 @@ static int omap_hsmmc_remove(struct platform_device *pdev) |
2731 |
+ dma_release_channel(host->tx_chan); |
2732 |
+ dma_release_channel(host->rx_chan); |
2733 |
+ |
2734 |
++ dev_pm_clear_wake_irq(host->dev); |
2735 |
+ pm_runtime_dont_use_autosuspend(host->dev); |
2736 |
+ pm_runtime_put_sync(host->dev); |
2737 |
+ pm_runtime_disable(host->dev); |
2738 |
+diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c |
2739 |
+index 4ffa6b173a21..8332f56e6c0d 100644 |
2740 |
+--- a/drivers/mmc/host/sdhci-of-esdhc.c |
2741 |
++++ b/drivers/mmc/host/sdhci-of-esdhc.c |
2742 |
+@@ -22,6 +22,7 @@ |
2743 |
+ #include <linux/sys_soc.h> |
2744 |
+ #include <linux/clk.h> |
2745 |
+ #include <linux/ktime.h> |
2746 |
++#include <linux/dma-mapping.h> |
2747 |
+ #include <linux/mmc/host.h> |
2748 |
+ #include "sdhci-pltfm.h" |
2749 |
+ #include "sdhci-esdhc.h" |
2750 |
+@@ -427,6 +428,11 @@ static void esdhc_of_adma_workaround(struct sdhci_host *host, u32 intmask) |
2751 |
+ static int esdhc_of_enable_dma(struct sdhci_host *host) |
2752 |
+ { |
2753 |
+ u32 value; |
2754 |
++ struct device *dev = mmc_dev(host->mmc); |
2755 |
++ |
2756 |
++ if (of_device_is_compatible(dev->of_node, "fsl,ls1043a-esdhc") || |
2757 |
++ of_device_is_compatible(dev->of_node, "fsl,ls1046a-esdhc")) |
2758 |
++ dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40)); |
2759 |
+ |
2760 |
+ value = sdhci_readl(host, ESDHC_DMA_SYSCTL); |
2761 |
+ value |= ESDHC_DMA_SNOOP; |
2762 |
+diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c |
2763 |
+index 970d38f68939..137df06b9b6e 100644 |
2764 |
+--- a/drivers/mmc/host/sdhci-tegra.c |
2765 |
++++ b/drivers/mmc/host/sdhci-tegra.c |
2766 |
+@@ -334,7 +334,8 @@ static const struct sdhci_pltfm_data sdhci_tegra30_pdata = { |
2767 |
+ SDHCI_QUIRK_NO_HISPD_BIT | |
2768 |
+ SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | |
2769 |
+ SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, |
2770 |
+- .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, |
2771 |
++ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | |
2772 |
++ SDHCI_QUIRK2_BROKEN_HS200, |
2773 |
+ .ops = &tegra_sdhci_ops, |
2774 |
+ }; |
2775 |
+ |
2776 |
+diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c |
2777 |
+index 1c828e0e9905..a7b5602ef6f7 100644 |
2778 |
+--- a/drivers/mmc/host/sdhci.c |
2779 |
++++ b/drivers/mmc/host/sdhci.c |
2780 |
+@@ -3734,14 +3734,21 @@ int sdhci_setup_host(struct sdhci_host *host) |
2781 |
+ mmc_gpio_get_cd(host->mmc) < 0) |
2782 |
+ mmc->caps |= MMC_CAP_NEEDS_POLL; |
2783 |
+ |
2784 |
+- /* If vqmmc regulator and no 1.8V signalling, then there's no UHS */ |
2785 |
+ if (!IS_ERR(mmc->supply.vqmmc)) { |
2786 |
+ ret = regulator_enable(mmc->supply.vqmmc); |
2787 |
++ |
2788 |
++ /* If vqmmc provides no 1.8V signalling, then there's no UHS */ |
2789 |
+ if (!regulator_is_supported_voltage(mmc->supply.vqmmc, 1700000, |
2790 |
+ 1950000)) |
2791 |
+ host->caps1 &= ~(SDHCI_SUPPORT_SDR104 | |
2792 |
+ SDHCI_SUPPORT_SDR50 | |
2793 |
+ SDHCI_SUPPORT_DDR50); |
2794 |
++ |
2795 |
++ /* In eMMC case vqmmc might be a fixed 1.8V regulator */ |
2796 |
++ if (!regulator_is_supported_voltage(mmc->supply.vqmmc, 2700000, |
2797 |
++ 3600000)) |
2798 |
++ host->flags &= ~SDHCI_SIGNALING_330; |
2799 |
++ |
2800 |
+ if (ret) { |
2801 |
+ pr_warn("%s: Failed to enable vqmmc regulator: %d\n", |
2802 |
+ mmc_hostname(mmc), ret); |
2803 |
+diff --git a/drivers/mtd/maps/solutionengine.c b/drivers/mtd/maps/solutionengine.c |
2804 |
+index bb580bc16445..c07f21b20463 100644 |
2805 |
+--- a/drivers/mtd/maps/solutionengine.c |
2806 |
++++ b/drivers/mtd/maps/solutionengine.c |
2807 |
+@@ -59,9 +59,9 @@ static int __init init_soleng_maps(void) |
2808 |
+ return -ENXIO; |
2809 |
+ } |
2810 |
+ } |
2811 |
+- printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n", |
2812 |
+- soleng_flash_map.phys & 0x1fffffff, |
2813 |
+- soleng_eprom_map.phys & 0x1fffffff); |
2814 |
++ printk(KERN_NOTICE "Solution Engine: Flash at 0x%pap, EPROM at 0x%pap\n", |
2815 |
++ &soleng_flash_map.phys, |
2816 |
++ &soleng_eprom_map.phys); |
2817 |
+ flash_mtd->owner = THIS_MODULE; |
2818 |
+ |
2819 |
+ eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map); |
2820 |
+diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c |
2821 |
+index cd67c85cc87d..02389528f622 100644 |
2822 |
+--- a/drivers/mtd/mtdchar.c |
2823 |
++++ b/drivers/mtd/mtdchar.c |
2824 |
+@@ -160,8 +160,12 @@ static ssize_t mtdchar_read(struct file *file, char __user *buf, size_t count, |
2825 |
+ |
2826 |
+ pr_debug("MTD_read\n"); |
2827 |
+ |
2828 |
+- if (*ppos + count > mtd->size) |
2829 |
+- count = mtd->size - *ppos; |
2830 |
++ if (*ppos + count > mtd->size) { |
2831 |
++ if (*ppos < mtd->size) |
2832 |
++ count = mtd->size - *ppos; |
2833 |
++ else |
2834 |
++ count = 0; |
2835 |
++ } |
2836 |
+ |
2837 |
+ if (!count) |
2838 |
+ return 0; |
2839 |
+@@ -246,7 +250,7 @@ static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t c |
2840 |
+ |
2841 |
+ pr_debug("MTD_write\n"); |
2842 |
+ |
2843 |
+- if (*ppos == mtd->size) |
2844 |
++ if (*ppos >= mtd->size) |
2845 |
+ return -ENOSPC; |
2846 |
+ |
2847 |
+ if (*ppos + count > mtd->size) |
2848 |
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c |
2849 |
+index cc1e4f820e64..533094233659 100644 |
2850 |
+--- a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c |
2851 |
++++ b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c |
2852 |
+@@ -289,7 +289,7 @@ static int xgbe_alloc_pages(struct xgbe_prv_data *pdata, |
2853 |
+ struct page *pages = NULL; |
2854 |
+ dma_addr_t pages_dma; |
2855 |
+ gfp_t gfp; |
2856 |
+- int order, ret; |
2857 |
++ int order; |
2858 |
+ |
2859 |
+ again: |
2860 |
+ order = alloc_order; |
2861 |
+@@ -316,10 +316,9 @@ again: |
2862 |
+ /* Map the pages */ |
2863 |
+ pages_dma = dma_map_page(pdata->dev, pages, 0, |
2864 |
+ PAGE_SIZE << order, DMA_FROM_DEVICE); |
2865 |
+- ret = dma_mapping_error(pdata->dev, pages_dma); |
2866 |
+- if (ret) { |
2867 |
++ if (dma_mapping_error(pdata->dev, pages_dma)) { |
2868 |
+ put_page(pages); |
2869 |
+- return ret; |
2870 |
++ return -ENOMEM; |
2871 |
+ } |
2872 |
+ |
2873 |
+ pa->pages = pages; |
2874 |
+diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c |
2875 |
+index 929d485a3a2f..e088dedc1747 100644 |
2876 |
+--- a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c |
2877 |
++++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c |
2878 |
+@@ -493,6 +493,9 @@ static void cn23xx_pf_setup_global_output_regs(struct octeon_device *oct) |
2879 |
+ for (q_no = srn; q_no < ern; q_no++) { |
2880 |
+ reg_val = octeon_read_csr(oct, CN23XX_SLI_OQ_PKT_CONTROL(q_no)); |
2881 |
+ |
2882 |
++ /* clear IPTR */ |
2883 |
++ reg_val &= ~CN23XX_PKT_OUTPUT_CTL_IPTR; |
2884 |
++ |
2885 |
+ /* set DPTR */ |
2886 |
+ reg_val |= CN23XX_PKT_OUTPUT_CTL_DPTR; |
2887 |
+ |
2888 |
+diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c |
2889 |
+index 9338a0008378..1f8b7f651254 100644 |
2890 |
+--- a/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c |
2891 |
++++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c |
2892 |
+@@ -165,6 +165,9 @@ static void cn23xx_vf_setup_global_output_regs(struct octeon_device *oct) |
2893 |
+ reg_val = |
2894 |
+ octeon_read_csr(oct, CN23XX_VF_SLI_OQ_PKT_CONTROL(q_no)); |
2895 |
+ |
2896 |
++ /* clear IPTR */ |
2897 |
++ reg_val &= ~CN23XX_PKT_OUTPUT_CTL_IPTR; |
2898 |
++ |
2899 |
+ /* set DPTR */ |
2900 |
+ reg_val |= CN23XX_PKT_OUTPUT_CTL_DPTR; |
2901 |
+ |
2902 |
+diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c |
2903 |
+index 6d7404f66f84..c9a061e707c4 100644 |
2904 |
+--- a/drivers/net/ethernet/cortina/gemini.c |
2905 |
++++ b/drivers/net/ethernet/cortina/gemini.c |
2906 |
+@@ -1753,7 +1753,10 @@ static int gmac_open(struct net_device *netdev) |
2907 |
+ phy_start(netdev->phydev); |
2908 |
+ |
2909 |
+ err = geth_resize_freeq(port); |
2910 |
+- if (err) { |
2911 |
++ /* It's fine if it's just busy, the other port has set up |
2912 |
++ * the freeq in that case. |
2913 |
++ */ |
2914 |
++ if (err && (err != -EBUSY)) { |
2915 |
+ netdev_err(netdev, "could not resize freeq\n"); |
2916 |
+ goto err_stop_phy; |
2917 |
+ } |
2918 |
+diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c |
2919 |
+index ff92ab1daeb8..1e9d882c04ef 100644 |
2920 |
+--- a/drivers/net/ethernet/emulex/benet/be_cmds.c |
2921 |
++++ b/drivers/net/ethernet/emulex/benet/be_cmds.c |
2922 |
+@@ -4500,7 +4500,7 @@ int be_cmd_get_profile_config(struct be_adapter *adapter, |
2923 |
+ port_res->max_vfs += le16_to_cpu(pcie->num_vfs); |
2924 |
+ } |
2925 |
+ } |
2926 |
+- return status; |
2927 |
++ goto err; |
2928 |
+ } |
2929 |
+ |
2930 |
+ pcie = be_get_pcie_desc(resp->func_param, desc_count, |
2931 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
2932 |
+index 25a73bb2e642..9d69621f5ab4 100644 |
2933 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
2934 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
2935 |
+@@ -3081,7 +3081,6 @@ static int hns3_client_init(struct hnae3_handle *handle) |
2936 |
+ priv->dev = &pdev->dev; |
2937 |
+ priv->netdev = netdev; |
2938 |
+ priv->ae_handle = handle; |
2939 |
+- priv->ae_handle->reset_level = HNAE3_NONE_RESET; |
2940 |
+ priv->ae_handle->last_reset_time = jiffies; |
2941 |
+ priv->tx_timeout_count = 0; |
2942 |
+ |
2943 |
+@@ -3102,6 +3101,11 @@ static int hns3_client_init(struct hnae3_handle *handle) |
2944 |
+ /* Carrier off reporting is important to ethtool even BEFORE open */ |
2945 |
+ netif_carrier_off(netdev); |
2946 |
+ |
2947 |
++ if (handle->flags & HNAE3_SUPPORT_VF) |
2948 |
++ handle->reset_level = HNAE3_VF_RESET; |
2949 |
++ else |
2950 |
++ handle->reset_level = HNAE3_FUNC_RESET; |
2951 |
++ |
2952 |
+ ret = hns3_get_ring_config(priv); |
2953 |
+ if (ret) { |
2954 |
+ ret = -ENOMEM; |
2955 |
+@@ -3418,7 +3422,7 @@ static int hns3_reset_notify_down_enet(struct hnae3_handle *handle) |
2956 |
+ struct net_device *ndev = kinfo->netdev; |
2957 |
+ |
2958 |
+ if (!netif_running(ndev)) |
2959 |
+- return -EIO; |
2960 |
++ return 0; |
2961 |
+ |
2962 |
+ return hns3_nic_net_stop(ndev); |
2963 |
+ } |
2964 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
2965 |
+index 6fd7ea8074b0..13f43b74fd6d 100644 |
2966 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
2967 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
2968 |
+@@ -2825,15 +2825,13 @@ static void hclge_clear_reset_cause(struct hclge_dev *hdev) |
2969 |
+ static void hclge_reset(struct hclge_dev *hdev) |
2970 |
+ { |
2971 |
+ /* perform reset of the stack & ae device for a client */ |
2972 |
+- |
2973 |
++ rtnl_lock(); |
2974 |
+ hclge_notify_client(hdev, HNAE3_DOWN_CLIENT); |
2975 |
+ |
2976 |
+ if (!hclge_reset_wait(hdev)) { |
2977 |
+- rtnl_lock(); |
2978 |
+ hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT); |
2979 |
+ hclge_reset_ae_dev(hdev->ae_dev); |
2980 |
+ hclge_notify_client(hdev, HNAE3_INIT_CLIENT); |
2981 |
+- rtnl_unlock(); |
2982 |
+ |
2983 |
+ hclge_clear_reset_cause(hdev); |
2984 |
+ } else { |
2985 |
+@@ -2843,6 +2841,7 @@ static void hclge_reset(struct hclge_dev *hdev) |
2986 |
+ } |
2987 |
+ |
2988 |
+ hclge_notify_client(hdev, HNAE3_UP_CLIENT); |
2989 |
++ rtnl_unlock(); |
2990 |
+ } |
2991 |
+ |
2992 |
+ static void hclge_reset_event(struct hnae3_handle *handle) |
2993 |
+diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
2994 |
+index 0319ed9ef8b8..f7f08e3fa761 100644 |
2995 |
+--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
2996 |
++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
2997 |
+@@ -5011,6 +5011,12 @@ static int mvpp2_probe(struct platform_device *pdev) |
2998 |
+ (unsigned long)of_device_get_match_data(&pdev->dev); |
2999 |
+ } |
3000 |
+ |
3001 |
++ /* multi queue mode isn't supported on PPV2.1, fallback to single |
3002 |
++ * mode |
3003 |
++ */ |
3004 |
++ if (priv->hw_version == MVPP21) |
3005 |
++ queue_mode = MVPP2_QDIST_SINGLE_MODE; |
3006 |
++ |
3007 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
3008 |
+ base = devm_ioremap_resource(&pdev->dev, res); |
3009 |
+ if (IS_ERR(base)) |
3010 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
3011 |
+index 384c1fa49081..f167f4eec3ff 100644 |
3012 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
3013 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
3014 |
+@@ -452,6 +452,7 @@ const char *mlx5_command_str(int command) |
3015 |
+ MLX5_COMMAND_STR_CASE(SET_HCA_CAP); |
3016 |
+ MLX5_COMMAND_STR_CASE(QUERY_ISSI); |
3017 |
+ MLX5_COMMAND_STR_CASE(SET_ISSI); |
3018 |
++ MLX5_COMMAND_STR_CASE(SET_DRIVER_VERSION); |
3019 |
+ MLX5_COMMAND_STR_CASE(CREATE_MKEY); |
3020 |
+ MLX5_COMMAND_STR_CASE(QUERY_MKEY); |
3021 |
+ MLX5_COMMAND_STR_CASE(DESTROY_MKEY); |
3022 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c |
3023 |
+index b994b80d5714..922811fb66e7 100644 |
3024 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c |
3025 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c |
3026 |
+@@ -132,11 +132,11 @@ void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv) |
3027 |
+ delayed_event_start(priv); |
3028 |
+ |
3029 |
+ dev_ctx->context = intf->add(dev); |
3030 |
+- set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state); |
3031 |
+- if (intf->attach) |
3032 |
+- set_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state); |
3033 |
+- |
3034 |
+ if (dev_ctx->context) { |
3035 |
++ set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state); |
3036 |
++ if (intf->attach) |
3037 |
++ set_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state); |
3038 |
++ |
3039 |
+ spin_lock_irq(&priv->ctx_lock); |
3040 |
+ list_add_tail(&dev_ctx->list, &priv->ctx_list); |
3041 |
+ |
3042 |
+@@ -211,12 +211,17 @@ static void mlx5_attach_interface(struct mlx5_interface *intf, struct mlx5_priv |
3043 |
+ if (intf->attach) { |
3044 |
+ if (test_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state)) |
3045 |
+ goto out; |
3046 |
+- intf->attach(dev, dev_ctx->context); |
3047 |
++ if (intf->attach(dev, dev_ctx->context)) |
3048 |
++ goto out; |
3049 |
++ |
3050 |
+ set_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state); |
3051 |
+ } else { |
3052 |
+ if (test_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state)) |
3053 |
+ goto out; |
3054 |
+ dev_ctx->context = intf->add(dev); |
3055 |
++ if (!dev_ctx->context) |
3056 |
++ goto out; |
3057 |
++ |
3058 |
+ set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state); |
3059 |
+ } |
3060 |
+ |
3061 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c |
3062 |
+index 91f1209886ff..4c53957c918c 100644 |
3063 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c |
3064 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c |
3065 |
+@@ -658,6 +658,7 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw, int nvports) |
3066 |
+ if (err) |
3067 |
+ goto miss_rule_err; |
3068 |
+ |
3069 |
++ kvfree(flow_group_in); |
3070 |
+ return 0; |
3071 |
+ |
3072 |
+ miss_rule_err: |
3073 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
3074 |
+index 6ddb2565884d..0031c510ab68 100644 |
3075 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
3076 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
3077 |
+@@ -1649,6 +1649,33 @@ static u64 matched_fgs_get_version(struct list_head *match_head) |
3078 |
+ return version; |
3079 |
+ } |
3080 |
+ |
3081 |
++static struct fs_fte * |
3082 |
++lookup_fte_locked(struct mlx5_flow_group *g, |
3083 |
++ u32 *match_value, |
3084 |
++ bool take_write) |
3085 |
++{ |
3086 |
++ struct fs_fte *fte_tmp; |
3087 |
++ |
3088 |
++ if (take_write) |
3089 |
++ nested_down_write_ref_node(&g->node, FS_LOCK_PARENT); |
3090 |
++ else |
3091 |
++ nested_down_read_ref_node(&g->node, FS_LOCK_PARENT); |
3092 |
++ fte_tmp = rhashtable_lookup_fast(&g->ftes_hash, match_value, |
3093 |
++ rhash_fte); |
3094 |
++ if (!fte_tmp || !tree_get_node(&fte_tmp->node)) { |
3095 |
++ fte_tmp = NULL; |
3096 |
++ goto out; |
3097 |
++ } |
3098 |
++ |
3099 |
++ nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD); |
3100 |
++out: |
3101 |
++ if (take_write) |
3102 |
++ up_write_ref_node(&g->node); |
3103 |
++ else |
3104 |
++ up_read_ref_node(&g->node); |
3105 |
++ return fte_tmp; |
3106 |
++} |
3107 |
++ |
3108 |
+ static struct mlx5_flow_handle * |
3109 |
+ try_add_to_existing_fg(struct mlx5_flow_table *ft, |
3110 |
+ struct list_head *match_head, |
3111 |
+@@ -1671,10 +1698,6 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft, |
3112 |
+ if (IS_ERR(fte)) |
3113 |
+ return ERR_PTR(-ENOMEM); |
3114 |
+ |
3115 |
+- list_for_each_entry(iter, match_head, list) { |
3116 |
+- nested_down_read_ref_node(&iter->g->node, FS_LOCK_PARENT); |
3117 |
+- } |
3118 |
+- |
3119 |
+ search_again_locked: |
3120 |
+ version = matched_fgs_get_version(match_head); |
3121 |
+ /* Try to find a fg that already contains a matching fte */ |
3122 |
+@@ -1682,20 +1705,9 @@ search_again_locked: |
3123 |
+ struct fs_fte *fte_tmp; |
3124 |
+ |
3125 |
+ g = iter->g; |
3126 |
+- fte_tmp = rhashtable_lookup_fast(&g->ftes_hash, spec->match_value, |
3127 |
+- rhash_fte); |
3128 |
+- if (!fte_tmp || !tree_get_node(&fte_tmp->node)) |
3129 |
++ fte_tmp = lookup_fte_locked(g, spec->match_value, take_write); |
3130 |
++ if (!fte_tmp) |
3131 |
+ continue; |
3132 |
+- |
3133 |
+- nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD); |
3134 |
+- if (!take_write) { |
3135 |
+- list_for_each_entry(iter, match_head, list) |
3136 |
+- up_read_ref_node(&iter->g->node); |
3137 |
+- } else { |
3138 |
+- list_for_each_entry(iter, match_head, list) |
3139 |
+- up_write_ref_node(&iter->g->node); |
3140 |
+- } |
3141 |
+- |
3142 |
+ rule = add_rule_fg(g, spec->match_value, |
3143 |
+ flow_act, dest, dest_num, fte_tmp); |
3144 |
+ up_write_ref_node(&fte_tmp->node); |
3145 |
+@@ -1704,19 +1716,6 @@ search_again_locked: |
3146 |
+ return rule; |
3147 |
+ } |
3148 |
+ |
3149 |
+- /* No group with matching fte found. Try to add a new fte to any |
3150 |
+- * matching fg. |
3151 |
+- */ |
3152 |
+- |
3153 |
+- if (!take_write) { |
3154 |
+- list_for_each_entry(iter, match_head, list) |
3155 |
+- up_read_ref_node(&iter->g->node); |
3156 |
+- list_for_each_entry(iter, match_head, list) |
3157 |
+- nested_down_write_ref_node(&iter->g->node, |
3158 |
+- FS_LOCK_PARENT); |
3159 |
+- take_write = true; |
3160 |
+- } |
3161 |
+- |
3162 |
+ /* Check the ft version, for case that new flow group |
3163 |
+ * was added while the fgs weren't locked |
3164 |
+ */ |
3165 |
+@@ -1728,27 +1727,30 @@ search_again_locked: |
3166 |
+ /* Check the fgs version, for case the new FTE with the |
3167 |
+ * same values was added while the fgs weren't locked |
3168 |
+ */ |
3169 |
+- if (version != matched_fgs_get_version(match_head)) |
3170 |
++ if (version != matched_fgs_get_version(match_head)) { |
3171 |
++ take_write = true; |
3172 |
+ goto search_again_locked; |
3173 |
++ } |
3174 |
+ |
3175 |
+ list_for_each_entry(iter, match_head, list) { |
3176 |
+ g = iter->g; |
3177 |
+ |
3178 |
+ if (!g->node.active) |
3179 |
+ continue; |
3180 |
++ |
3181 |
++ nested_down_write_ref_node(&g->node, FS_LOCK_PARENT); |
3182 |
++ |
3183 |
+ err = insert_fte(g, fte); |
3184 |
+ if (err) { |
3185 |
++ up_write_ref_node(&g->node); |
3186 |
+ if (err == -ENOSPC) |
3187 |
+ continue; |
3188 |
+- list_for_each_entry(iter, match_head, list) |
3189 |
+- up_write_ref_node(&iter->g->node); |
3190 |
+ kmem_cache_free(steering->ftes_cache, fte); |
3191 |
+ return ERR_PTR(err); |
3192 |
+ } |
3193 |
+ |
3194 |
+ nested_down_write_ref_node(&fte->node, FS_LOCK_CHILD); |
3195 |
+- list_for_each_entry(iter, match_head, list) |
3196 |
+- up_write_ref_node(&iter->g->node); |
3197 |
++ up_write_ref_node(&g->node); |
3198 |
+ rule = add_rule_fg(g, spec->match_value, |
3199 |
+ flow_act, dest, dest_num, fte); |
3200 |
+ up_write_ref_node(&fte->node); |
3201 |
+@@ -1757,8 +1759,6 @@ search_again_locked: |
3202 |
+ } |
3203 |
+ rule = ERR_PTR(-ENOENT); |
3204 |
+ out: |
3205 |
+- list_for_each_entry(iter, match_head, list) |
3206 |
+- up_write_ref_node(&iter->g->node); |
3207 |
+ kmem_cache_free(steering->ftes_cache, fte); |
3208 |
+ return rule; |
3209 |
+ } |
3210 |
+@@ -1797,6 +1797,8 @@ search_again_locked: |
3211 |
+ if (err) { |
3212 |
+ if (take_write) |
3213 |
+ up_write_ref_node(&ft->node); |
3214 |
++ else |
3215 |
++ up_read_ref_node(&ft->node); |
3216 |
+ return ERR_PTR(err); |
3217 |
+ } |
3218 |
+ |
3219 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c |
3220 |
+index d39b0b7011b2..9f39aeca863f 100644 |
3221 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/health.c |
3222 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c |
3223 |
+@@ -331,9 +331,17 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev) |
3224 |
+ add_timer(&health->timer); |
3225 |
+ } |
3226 |
+ |
3227 |
+-void mlx5_stop_health_poll(struct mlx5_core_dev *dev) |
3228 |
++void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health) |
3229 |
+ { |
3230 |
+ struct mlx5_core_health *health = &dev->priv.health; |
3231 |
++ unsigned long flags; |
3232 |
++ |
3233 |
++ if (disable_health) { |
3234 |
++ spin_lock_irqsave(&health->wq_lock, flags); |
3235 |
++ set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); |
3236 |
++ set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); |
3237 |
++ spin_unlock_irqrestore(&health->wq_lock, flags); |
3238 |
++ } |
3239 |
+ |
3240 |
+ del_timer_sync(&health->timer); |
3241 |
+ } |
3242 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
3243 |
+index 615005e63819..76e6ca87db11 100644 |
3244 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c |
3245 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
3246 |
+@@ -874,8 +874,10 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv) |
3247 |
+ priv->numa_node = dev_to_node(&dev->pdev->dev); |
3248 |
+ |
3249 |
+ priv->dbg_root = debugfs_create_dir(dev_name(&pdev->dev), mlx5_debugfs_root); |
3250 |
+- if (!priv->dbg_root) |
3251 |
++ if (!priv->dbg_root) { |
3252 |
++ dev_err(&pdev->dev, "Cannot create debugfs dir, aborting\n"); |
3253 |
+ return -ENOMEM; |
3254 |
++ } |
3255 |
+ |
3256 |
+ err = mlx5_pci_enable_device(dev); |
3257 |
+ if (err) { |
3258 |
+@@ -924,7 +926,7 @@ static void mlx5_pci_close(struct mlx5_core_dev *dev, struct mlx5_priv *priv) |
3259 |
+ pci_clear_master(dev->pdev); |
3260 |
+ release_bar(dev->pdev); |
3261 |
+ mlx5_pci_disable_device(dev); |
3262 |
+- debugfs_remove(priv->dbg_root); |
3263 |
++ debugfs_remove_recursive(priv->dbg_root); |
3264 |
+ } |
3265 |
+ |
3266 |
+ static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv) |
3267 |
+@@ -1266,7 +1268,7 @@ err_cleanup_once: |
3268 |
+ mlx5_cleanup_once(dev); |
3269 |
+ |
3270 |
+ err_stop_poll: |
3271 |
+- mlx5_stop_health_poll(dev); |
3272 |
++ mlx5_stop_health_poll(dev, boot); |
3273 |
+ if (mlx5_cmd_teardown_hca(dev)) { |
3274 |
+ dev_err(&dev->pdev->dev, "tear_down_hca failed, skip cleanup\n"); |
3275 |
+ goto out_err; |
3276 |
+@@ -1325,7 +1327,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, |
3277 |
+ mlx5_free_irq_vectors(dev); |
3278 |
+ if (cleanup) |
3279 |
+ mlx5_cleanup_once(dev); |
3280 |
+- mlx5_stop_health_poll(dev); |
3281 |
++ mlx5_stop_health_poll(dev, cleanup); |
3282 |
+ err = mlx5_cmd_teardown_hca(dev); |
3283 |
+ if (err) { |
3284 |
+ dev_err(&dev->pdev->dev, "tear_down_hca failed, skip cleanup\n"); |
3285 |
+@@ -1587,7 +1589,7 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev *dev) |
3286 |
+ * with the HCA, so the health polll is no longer needed. |
3287 |
+ */ |
3288 |
+ mlx5_drain_health_wq(dev); |
3289 |
+- mlx5_stop_health_poll(dev); |
3290 |
++ mlx5_stop_health_poll(dev, false); |
3291 |
+ |
3292 |
+ ret = mlx5_cmd_force_teardown_hca(dev); |
3293 |
+ if (ret) { |
3294 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/wq.c b/drivers/net/ethernet/mellanox/mlx5/core/wq.c |
3295 |
+index c8c315eb5128..d838af9539b1 100644 |
3296 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/wq.c |
3297 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/wq.c |
3298 |
+@@ -39,9 +39,9 @@ u32 mlx5_wq_cyc_get_size(struct mlx5_wq_cyc *wq) |
3299 |
+ return (u32)wq->fbc.sz_m1 + 1; |
3300 |
+ } |
3301 |
+ |
3302 |
+-u32 mlx5_wq_cyc_get_frag_size(struct mlx5_wq_cyc *wq) |
3303 |
++u16 mlx5_wq_cyc_get_frag_size(struct mlx5_wq_cyc *wq) |
3304 |
+ { |
3305 |
+- return (u32)wq->fbc.frag_sz_m1 + 1; |
3306 |
++ return wq->fbc.frag_sz_m1 + 1; |
3307 |
+ } |
3308 |
+ |
3309 |
+ u32 mlx5_cqwq_get_size(struct mlx5_cqwq *wq) |
3310 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/wq.h b/drivers/net/ethernet/mellanox/mlx5/core/wq.h |
3311 |
+index 0b47126815b6..16476cc1a602 100644 |
3312 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/wq.h |
3313 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/wq.h |
3314 |
+@@ -80,7 +80,7 @@ int mlx5_wq_cyc_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, |
3315 |
+ void *wqc, struct mlx5_wq_cyc *wq, |
3316 |
+ struct mlx5_wq_ctrl *wq_ctrl); |
3317 |
+ u32 mlx5_wq_cyc_get_size(struct mlx5_wq_cyc *wq); |
3318 |
+-u32 mlx5_wq_cyc_get_frag_size(struct mlx5_wq_cyc *wq); |
3319 |
++u16 mlx5_wq_cyc_get_frag_size(struct mlx5_wq_cyc *wq); |
3320 |
+ |
3321 |
+ int mlx5_wq_qp_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, |
3322 |
+ void *qpc, struct mlx5_wq_qp *wq, |
3323 |
+diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.c b/drivers/net/ethernet/netronome/nfp/nfp_main.c |
3324 |
+index 152283d7e59c..4a540c5e27fe 100644 |
3325 |
+--- a/drivers/net/ethernet/netronome/nfp/nfp_main.c |
3326 |
++++ b/drivers/net/ethernet/netronome/nfp/nfp_main.c |
3327 |
+@@ -236,16 +236,20 @@ static int nfp_pcie_sriov_read_nfd_limit(struct nfp_pf *pf) |
3328 |
+ int err; |
3329 |
+ |
3330 |
+ pf->limit_vfs = nfp_rtsym_read_le(pf->rtbl, "nfd_vf_cfg_max_vfs", &err); |
3331 |
+- if (!err) |
3332 |
+- return pci_sriov_set_totalvfs(pf->pdev, pf->limit_vfs); |
3333 |
++ if (err) { |
3334 |
++ /* For backwards compatibility if symbol not found allow all */ |
3335 |
++ pf->limit_vfs = ~0; |
3336 |
++ if (err == -ENOENT) |
3337 |
++ return 0; |
3338 |
+ |
3339 |
+- pf->limit_vfs = ~0; |
3340 |
+- /* Allow any setting for backwards compatibility if symbol not found */ |
3341 |
+- if (err == -ENOENT) |
3342 |
+- return 0; |
3343 |
++ nfp_warn(pf->cpp, "Warning: VF limit read failed: %d\n", err); |
3344 |
++ return err; |
3345 |
++ } |
3346 |
+ |
3347 |
+- nfp_warn(pf->cpp, "Warning: VF limit read failed: %d\n", err); |
3348 |
+- return err; |
3349 |
++ err = pci_sriov_set_totalvfs(pf->pdev, pf->limit_vfs); |
3350 |
++ if (err) |
3351 |
++ nfp_warn(pf->cpp, "Failed to set VF count in sysfs: %d\n", err); |
3352 |
++ return 0; |
3353 |
+ } |
3354 |
+ |
3355 |
+ static int nfp_pcie_sriov_enable(struct pci_dev *pdev, int num_vfs) |
3356 |
+diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c |
3357 |
+index c2a9e64bc57b..bfccc1955907 100644 |
3358 |
+--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c |
3359 |
++++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c |
3360 |
+@@ -1093,7 +1093,7 @@ static bool nfp_net_xdp_complete(struct nfp_net_tx_ring *tx_ring) |
3361 |
+ * @dp: NFP Net data path struct |
3362 |
+ * @tx_ring: TX ring structure |
3363 |
+ * |
3364 |
+- * Assumes that the device is stopped |
3365 |
++ * Assumes that the device is stopped, must be idempotent. |
3366 |
+ */ |
3367 |
+ static void |
3368 |
+ nfp_net_tx_ring_reset(struct nfp_net_dp *dp, struct nfp_net_tx_ring *tx_ring) |
3369 |
+@@ -1295,13 +1295,18 @@ static void nfp_net_rx_give_one(const struct nfp_net_dp *dp, |
3370 |
+ * nfp_net_rx_ring_reset() - Reflect in SW state of freelist after disable |
3371 |
+ * @rx_ring: RX ring structure |
3372 |
+ * |
3373 |
+- * Warning: Do *not* call if ring buffers were never put on the FW freelist |
3374 |
+- * (i.e. device was not enabled)! |
3375 |
++ * Assumes that the device is stopped, must be idempotent. |
3376 |
+ */ |
3377 |
+ static void nfp_net_rx_ring_reset(struct nfp_net_rx_ring *rx_ring) |
3378 |
+ { |
3379 |
+ unsigned int wr_idx, last_idx; |
3380 |
+ |
3381 |
++ /* wr_p == rd_p means ring was never fed FL bufs. RX rings are always |
3382 |
++ * kept at cnt - 1 FL bufs. |
3383 |
++ */ |
3384 |
++ if (rx_ring->wr_p == 0 && rx_ring->rd_p == 0) |
3385 |
++ return; |
3386 |
++ |
3387 |
+ /* Move the empty entry to the end of the list */ |
3388 |
+ wr_idx = D_IDX(rx_ring, rx_ring->wr_p); |
3389 |
+ last_idx = rx_ring->cnt - 1; |
3390 |
+@@ -2524,6 +2529,8 @@ static void nfp_net_vec_clear_ring_data(struct nfp_net *nn, unsigned int idx) |
3391 |
+ /** |
3392 |
+ * nfp_net_clear_config_and_disable() - Clear control BAR and disable NFP |
3393 |
+ * @nn: NFP Net device to reconfigure |
3394 |
++ * |
3395 |
++ * Warning: must be fully idempotent. |
3396 |
+ */ |
3397 |
+ static void nfp_net_clear_config_and_disable(struct nfp_net *nn) |
3398 |
+ { |
3399 |
+diff --git a/drivers/net/ethernet/qualcomm/qca_7k.c b/drivers/net/ethernet/qualcomm/qca_7k.c |
3400 |
+index ffe7a16bdfc8..6c8543fb90c0 100644 |
3401 |
+--- a/drivers/net/ethernet/qualcomm/qca_7k.c |
3402 |
++++ b/drivers/net/ethernet/qualcomm/qca_7k.c |
3403 |
+@@ -45,34 +45,33 @@ qcaspi_read_register(struct qcaspi *qca, u16 reg, u16 *result) |
3404 |
+ { |
3405 |
+ __be16 rx_data; |
3406 |
+ __be16 tx_data; |
3407 |
+- struct spi_transfer *transfer; |
3408 |
+- struct spi_message *msg; |
3409 |
++ struct spi_transfer transfer[2]; |
3410 |
++ struct spi_message msg; |
3411 |
+ int ret; |
3412 |
+ |
3413 |
++ memset(transfer, 0, sizeof(transfer)); |
3414 |
++ |
3415 |
++ spi_message_init(&msg); |
3416 |
++ |
3417 |
+ tx_data = cpu_to_be16(QCA7K_SPI_READ | QCA7K_SPI_INTERNAL | reg); |
3418 |
++ *result = 0; |
3419 |
++ |
3420 |
++ transfer[0].tx_buf = &tx_data; |
3421 |
++ transfer[0].len = QCASPI_CMD_LEN; |
3422 |
++ transfer[1].rx_buf = &rx_data; |
3423 |
++ transfer[1].len = QCASPI_CMD_LEN; |
3424 |
++ |
3425 |
++ spi_message_add_tail(&transfer[0], &msg); |
3426 |
+ |
3427 |
+ if (qca->legacy_mode) { |
3428 |
+- msg = &qca->spi_msg1; |
3429 |
+- transfer = &qca->spi_xfer1; |
3430 |
+- transfer->tx_buf = &tx_data; |
3431 |
+- transfer->rx_buf = NULL; |
3432 |
+- transfer->len = QCASPI_CMD_LEN; |
3433 |
+- spi_sync(qca->spi_dev, msg); |
3434 |
+- } else { |
3435 |
+- msg = &qca->spi_msg2; |
3436 |
+- transfer = &qca->spi_xfer2[0]; |
3437 |
+- transfer->tx_buf = &tx_data; |
3438 |
+- transfer->rx_buf = NULL; |
3439 |
+- transfer->len = QCASPI_CMD_LEN; |
3440 |
+- transfer = &qca->spi_xfer2[1]; |
3441 |
++ spi_sync(qca->spi_dev, &msg); |
3442 |
++ spi_message_init(&msg); |
3443 |
+ } |
3444 |
+- transfer->tx_buf = NULL; |
3445 |
+- transfer->rx_buf = &rx_data; |
3446 |
+- transfer->len = QCASPI_CMD_LEN; |
3447 |
+- ret = spi_sync(qca->spi_dev, msg); |
3448 |
++ spi_message_add_tail(&transfer[1], &msg); |
3449 |
++ ret = spi_sync(qca->spi_dev, &msg); |
3450 |
+ |
3451 |
+ if (!ret) |
3452 |
+- ret = msg->status; |
3453 |
++ ret = msg.status; |
3454 |
+ |
3455 |
+ if (ret) |
3456 |
+ qcaspi_spi_error(qca); |
3457 |
+@@ -86,35 +85,32 @@ int |
3458 |
+ qcaspi_write_register(struct qcaspi *qca, u16 reg, u16 value) |
3459 |
+ { |
3460 |
+ __be16 tx_data[2]; |
3461 |
+- struct spi_transfer *transfer; |
3462 |
+- struct spi_message *msg; |
3463 |
++ struct spi_transfer transfer[2]; |
3464 |
++ struct spi_message msg; |
3465 |
+ int ret; |
3466 |
+ |
3467 |
++ memset(&transfer, 0, sizeof(transfer)); |
3468 |
++ |
3469 |
++ spi_message_init(&msg); |
3470 |
++ |
3471 |
+ tx_data[0] = cpu_to_be16(QCA7K_SPI_WRITE | QCA7K_SPI_INTERNAL | reg); |
3472 |
+ tx_data[1] = cpu_to_be16(value); |
3473 |
+ |
3474 |
++ transfer[0].tx_buf = &tx_data[0]; |
3475 |
++ transfer[0].len = QCASPI_CMD_LEN; |
3476 |
++ transfer[1].tx_buf = &tx_data[1]; |
3477 |
++ transfer[1].len = QCASPI_CMD_LEN; |
3478 |
++ |
3479 |
++ spi_message_add_tail(&transfer[0], &msg); |
3480 |
+ if (qca->legacy_mode) { |
3481 |
+- msg = &qca->spi_msg1; |
3482 |
+- transfer = &qca->spi_xfer1; |
3483 |
+- transfer->tx_buf = &tx_data[0]; |
3484 |
+- transfer->rx_buf = NULL; |
3485 |
+- transfer->len = QCASPI_CMD_LEN; |
3486 |
+- spi_sync(qca->spi_dev, msg); |
3487 |
+- } else { |
3488 |
+- msg = &qca->spi_msg2; |
3489 |
+- transfer = &qca->spi_xfer2[0]; |
3490 |
+- transfer->tx_buf = &tx_data[0]; |
3491 |
+- transfer->rx_buf = NULL; |
3492 |
+- transfer->len = QCASPI_CMD_LEN; |
3493 |
+- transfer = &qca->spi_xfer2[1]; |
3494 |
++ spi_sync(qca->spi_dev, &msg); |
3495 |
++ spi_message_init(&msg); |
3496 |
+ } |
3497 |
+- transfer->tx_buf = &tx_data[1]; |
3498 |
+- transfer->rx_buf = NULL; |
3499 |
+- transfer->len = QCASPI_CMD_LEN; |
3500 |
+- ret = spi_sync(qca->spi_dev, msg); |
3501 |
++ spi_message_add_tail(&transfer[1], &msg); |
3502 |
++ ret = spi_sync(qca->spi_dev, &msg); |
3503 |
+ |
3504 |
+ if (!ret) |
3505 |
+- ret = msg->status; |
3506 |
++ ret = msg.status; |
3507 |
+ |
3508 |
+ if (ret) |
3509 |
+ qcaspi_spi_error(qca); |
3510 |
+diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c |
3511 |
+index 206f0266463e..66b775d462fd 100644 |
3512 |
+--- a/drivers/net/ethernet/qualcomm/qca_spi.c |
3513 |
++++ b/drivers/net/ethernet/qualcomm/qca_spi.c |
3514 |
+@@ -99,22 +99,24 @@ static u32 |
3515 |
+ qcaspi_write_burst(struct qcaspi *qca, u8 *src, u32 len) |
3516 |
+ { |
3517 |
+ __be16 cmd; |
3518 |
+- struct spi_message *msg = &qca->spi_msg2; |
3519 |
+- struct spi_transfer *transfer = &qca->spi_xfer2[0]; |
3520 |
++ struct spi_message msg; |
3521 |
++ struct spi_transfer transfer[2]; |
3522 |
+ int ret; |
3523 |
+ |
3524 |
++ memset(&transfer, 0, sizeof(transfer)); |
3525 |
++ spi_message_init(&msg); |
3526 |
++ |
3527 |
+ cmd = cpu_to_be16(QCA7K_SPI_WRITE | QCA7K_SPI_EXTERNAL); |
3528 |
+- transfer->tx_buf = &cmd; |
3529 |
+- transfer->rx_buf = NULL; |
3530 |
+- transfer->len = QCASPI_CMD_LEN; |
3531 |
+- transfer = &qca->spi_xfer2[1]; |
3532 |
+- transfer->tx_buf = src; |
3533 |
+- transfer->rx_buf = NULL; |
3534 |
+- transfer->len = len; |
3535 |
++ transfer[0].tx_buf = &cmd; |
3536 |
++ transfer[0].len = QCASPI_CMD_LEN; |
3537 |
++ transfer[1].tx_buf = src; |
3538 |
++ transfer[1].len = len; |
3539 |
+ |
3540 |
+- ret = spi_sync(qca->spi_dev, msg); |
3541 |
++ spi_message_add_tail(&transfer[0], &msg); |
3542 |
++ spi_message_add_tail(&transfer[1], &msg); |
3543 |
++ ret = spi_sync(qca->spi_dev, &msg); |
3544 |
+ |
3545 |
+- if (ret || (msg->actual_length != QCASPI_CMD_LEN + len)) { |
3546 |
++ if (ret || (msg.actual_length != QCASPI_CMD_LEN + len)) { |
3547 |
+ qcaspi_spi_error(qca); |
3548 |
+ return 0; |
3549 |
+ } |
3550 |
+@@ -125,17 +127,20 @@ qcaspi_write_burst(struct qcaspi *qca, u8 *src, u32 len) |
3551 |
+ static u32 |
3552 |
+ qcaspi_write_legacy(struct qcaspi *qca, u8 *src, u32 len) |
3553 |
+ { |
3554 |
+- struct spi_message *msg = &qca->spi_msg1; |
3555 |
+- struct spi_transfer *transfer = &qca->spi_xfer1; |
3556 |
++ struct spi_message msg; |
3557 |
++ struct spi_transfer transfer; |
3558 |
+ int ret; |
3559 |
+ |
3560 |
+- transfer->tx_buf = src; |
3561 |
+- transfer->rx_buf = NULL; |
3562 |
+- transfer->len = len; |
3563 |
++ memset(&transfer, 0, sizeof(transfer)); |
3564 |
++ spi_message_init(&msg); |
3565 |
++ |
3566 |
++ transfer.tx_buf = src; |
3567 |
++ transfer.len = len; |
3568 |
+ |
3569 |
+- ret = spi_sync(qca->spi_dev, msg); |
3570 |
++ spi_message_add_tail(&transfer, &msg); |
3571 |
++ ret = spi_sync(qca->spi_dev, &msg); |
3572 |
+ |
3573 |
+- if (ret || (msg->actual_length != len)) { |
3574 |
++ if (ret || (msg.actual_length != len)) { |
3575 |
+ qcaspi_spi_error(qca); |
3576 |
+ return 0; |
3577 |
+ } |
3578 |
+@@ -146,23 +151,25 @@ qcaspi_write_legacy(struct qcaspi *qca, u8 *src, u32 len) |
3579 |
+ static u32 |
3580 |
+ qcaspi_read_burst(struct qcaspi *qca, u8 *dst, u32 len) |
3581 |
+ { |
3582 |
+- struct spi_message *msg = &qca->spi_msg2; |
3583 |
++ struct spi_message msg; |
3584 |
+ __be16 cmd; |
3585 |
+- struct spi_transfer *transfer = &qca->spi_xfer2[0]; |
3586 |
++ struct spi_transfer transfer[2]; |
3587 |
+ int ret; |
3588 |
+ |
3589 |
++ memset(&transfer, 0, sizeof(transfer)); |
3590 |
++ spi_message_init(&msg); |
3591 |
++ |
3592 |
+ cmd = cpu_to_be16(QCA7K_SPI_READ | QCA7K_SPI_EXTERNAL); |
3593 |
+- transfer->tx_buf = &cmd; |
3594 |
+- transfer->rx_buf = NULL; |
3595 |
+- transfer->len = QCASPI_CMD_LEN; |
3596 |
+- transfer = &qca->spi_xfer2[1]; |
3597 |
+- transfer->tx_buf = NULL; |
3598 |
+- transfer->rx_buf = dst; |
3599 |
+- transfer->len = len; |
3600 |
++ transfer[0].tx_buf = &cmd; |
3601 |
++ transfer[0].len = QCASPI_CMD_LEN; |
3602 |
++ transfer[1].rx_buf = dst; |
3603 |
++ transfer[1].len = len; |
3604 |
+ |
3605 |
+- ret = spi_sync(qca->spi_dev, msg); |
3606 |
++ spi_message_add_tail(&transfer[0], &msg); |
3607 |
++ spi_message_add_tail(&transfer[1], &msg); |
3608 |
++ ret = spi_sync(qca->spi_dev, &msg); |
3609 |
+ |
3610 |
+- if (ret || (msg->actual_length != QCASPI_CMD_LEN + len)) { |
3611 |
++ if (ret || (msg.actual_length != QCASPI_CMD_LEN + len)) { |
3612 |
+ qcaspi_spi_error(qca); |
3613 |
+ return 0; |
3614 |
+ } |
3615 |
+@@ -173,17 +180,20 @@ qcaspi_read_burst(struct qcaspi *qca, u8 *dst, u32 len) |
3616 |
+ static u32 |
3617 |
+ qcaspi_read_legacy(struct qcaspi *qca, u8 *dst, u32 len) |
3618 |
+ { |
3619 |
+- struct spi_message *msg = &qca->spi_msg1; |
3620 |
+- struct spi_transfer *transfer = &qca->spi_xfer1; |
3621 |
++ struct spi_message msg; |
3622 |
++ struct spi_transfer transfer; |
3623 |
+ int ret; |
3624 |
+ |
3625 |
+- transfer->tx_buf = NULL; |
3626 |
+- transfer->rx_buf = dst; |
3627 |
+- transfer->len = len; |
3628 |
++ memset(&transfer, 0, sizeof(transfer)); |
3629 |
++ spi_message_init(&msg); |
3630 |
+ |
3631 |
+- ret = spi_sync(qca->spi_dev, msg); |
3632 |
++ transfer.rx_buf = dst; |
3633 |
++ transfer.len = len; |
3634 |
+ |
3635 |
+- if (ret || (msg->actual_length != len)) { |
3636 |
++ spi_message_add_tail(&transfer, &msg); |
3637 |
++ ret = spi_sync(qca->spi_dev, &msg); |
3638 |
++ |
3639 |
++ if (ret || (msg.actual_length != len)) { |
3640 |
+ qcaspi_spi_error(qca); |
3641 |
+ return 0; |
3642 |
+ } |
3643 |
+@@ -195,19 +205,23 @@ static int |
3644 |
+ qcaspi_tx_cmd(struct qcaspi *qca, u16 cmd) |
3645 |
+ { |
3646 |
+ __be16 tx_data; |
3647 |
+- struct spi_message *msg = &qca->spi_msg1; |
3648 |
+- struct spi_transfer *transfer = &qca->spi_xfer1; |
3649 |
++ struct spi_message msg; |
3650 |
++ struct spi_transfer transfer; |
3651 |
+ int ret; |
3652 |
+ |
3653 |
++ memset(&transfer, 0, sizeof(transfer)); |
3654 |
++ |
3655 |
++ spi_message_init(&msg); |
3656 |
++ |
3657 |
+ tx_data = cpu_to_be16(cmd); |
3658 |
+- transfer->len = sizeof(tx_data); |
3659 |
+- transfer->tx_buf = &tx_data; |
3660 |
+- transfer->rx_buf = NULL; |
3661 |
++ transfer.len = sizeof(cmd); |
3662 |
++ transfer.tx_buf = &tx_data; |
3663 |
++ spi_message_add_tail(&transfer, &msg); |
3664 |
+ |
3665 |
+- ret = spi_sync(qca->spi_dev, msg); |
3666 |
++ ret = spi_sync(qca->spi_dev, &msg); |
3667 |
+ |
3668 |
+ if (!ret) |
3669 |
+- ret = msg->status; |
3670 |
++ ret = msg.status; |
3671 |
+ |
3672 |
+ if (ret) |
3673 |
+ qcaspi_spi_error(qca); |
3674 |
+@@ -835,16 +849,6 @@ qcaspi_netdev_setup(struct net_device *dev) |
3675 |
+ qca = netdev_priv(dev); |
3676 |
+ memset(qca, 0, sizeof(struct qcaspi)); |
3677 |
+ |
3678 |
+- memset(&qca->spi_xfer1, 0, sizeof(struct spi_transfer)); |
3679 |
+- memset(&qca->spi_xfer2, 0, sizeof(struct spi_transfer) * 2); |
3680 |
+- |
3681 |
+- spi_message_init(&qca->spi_msg1); |
3682 |
+- spi_message_add_tail(&qca->spi_xfer1, &qca->spi_msg1); |
3683 |
+- |
3684 |
+- spi_message_init(&qca->spi_msg2); |
3685 |
+- spi_message_add_tail(&qca->spi_xfer2[0], &qca->spi_msg2); |
3686 |
+- spi_message_add_tail(&qca->spi_xfer2[1], &qca->spi_msg2); |
3687 |
+- |
3688 |
+ memset(&qca->txr, 0, sizeof(qca->txr)); |
3689 |
+ qca->txr.count = TX_RING_MAX_LEN; |
3690 |
+ } |
3691 |
+diff --git a/drivers/net/ethernet/qualcomm/qca_spi.h b/drivers/net/ethernet/qualcomm/qca_spi.h |
3692 |
+index fc4beb1b32d1..fc0e98726b36 100644 |
3693 |
+--- a/drivers/net/ethernet/qualcomm/qca_spi.h |
3694 |
++++ b/drivers/net/ethernet/qualcomm/qca_spi.h |
3695 |
+@@ -83,11 +83,6 @@ struct qcaspi { |
3696 |
+ struct tx_ring txr; |
3697 |
+ struct qcaspi_stats stats; |
3698 |
+ |
3699 |
+- struct spi_message spi_msg1; |
3700 |
+- struct spi_message spi_msg2; |
3701 |
+- struct spi_transfer spi_xfer1; |
3702 |
+- struct spi_transfer spi_xfer2[2]; |
3703 |
+- |
3704 |
+ u8 *rx_buffer; |
3705 |
+ u32 buffer_size; |
3706 |
+ u8 sync; |
3707 |
+diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c |
3708 |
+index 9b09c9d0d0fb..5f0366a125e2 100644 |
3709 |
+--- a/drivers/net/wan/fsl_ucc_hdlc.c |
3710 |
++++ b/drivers/net/wan/fsl_ucc_hdlc.c |
3711 |
+@@ -192,7 +192,7 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) |
3712 |
+ priv->ucc_pram_offset = qe_muram_alloc(sizeof(struct ucc_hdlc_param), |
3713 |
+ ALIGNMENT_OF_UCC_HDLC_PRAM); |
3714 |
+ |
3715 |
+- if (priv->ucc_pram_offset < 0) { |
3716 |
++ if (IS_ERR_VALUE(priv->ucc_pram_offset)) { |
3717 |
+ dev_err(priv->dev, "Can not allocate MURAM for hdlc parameter.\n"); |
3718 |
+ ret = -ENOMEM; |
3719 |
+ goto free_tx_bd; |
3720 |
+@@ -230,14 +230,14 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) |
3721 |
+ |
3722 |
+ /* Alloc riptr, tiptr */ |
3723 |
+ riptr = qe_muram_alloc(32, 32); |
3724 |
+- if (riptr < 0) { |
3725 |
++ if (IS_ERR_VALUE(riptr)) { |
3726 |
+ dev_err(priv->dev, "Cannot allocate MURAM mem for Receive internal temp data pointer\n"); |
3727 |
+ ret = -ENOMEM; |
3728 |
+ goto free_tx_skbuff; |
3729 |
+ } |
3730 |
+ |
3731 |
+ tiptr = qe_muram_alloc(32, 32); |
3732 |
+- if (tiptr < 0) { |
3733 |
++ if (IS_ERR_VALUE(tiptr)) { |
3734 |
+ dev_err(priv->dev, "Cannot allocate MURAM mem for Transmit internal temp data pointer\n"); |
3735 |
+ ret = -ENOMEM; |
3736 |
+ goto free_riptr; |
3737 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h |
3738 |
+index 45ea32796cda..92b38a21cd10 100644 |
3739 |
+--- a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h |
3740 |
++++ b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h |
3741 |
+@@ -660,7 +660,7 @@ static inline void iwl_enable_fw_load_int(struct iwl_trans *trans) |
3742 |
+ } |
3743 |
+ } |
3744 |
+ |
3745 |
+-static inline u8 iwl_pcie_get_cmd_index(struct iwl_txq *q, u32 index) |
3746 |
++static inline u8 iwl_pcie_get_cmd_index(const struct iwl_txq *q, u32 index) |
3747 |
+ { |
3748 |
+ return index & (q->n_window - 1); |
3749 |
+ } |
3750 |
+@@ -730,9 +730,13 @@ static inline void iwl_stop_queue(struct iwl_trans *trans, |
3751 |
+ |
3752 |
+ static inline bool iwl_queue_used(const struct iwl_txq *q, int i) |
3753 |
+ { |
3754 |
+- return q->write_ptr >= q->read_ptr ? |
3755 |
+- (i >= q->read_ptr && i < q->write_ptr) : |
3756 |
+- !(i < q->read_ptr && i >= q->write_ptr); |
3757 |
++ int index = iwl_pcie_get_cmd_index(q, i); |
3758 |
++ int r = iwl_pcie_get_cmd_index(q, q->read_ptr); |
3759 |
++ int w = iwl_pcie_get_cmd_index(q, q->write_ptr); |
3760 |
++ |
3761 |
++ return w >= r ? |
3762 |
++ (index >= r && index < w) : |
3763 |
++ !(index < r && index >= w); |
3764 |
+ } |
3765 |
+ |
3766 |
+ static inline bool iwl_is_rfkill_set(struct iwl_trans *trans) |
3767 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c |
3768 |
+index 473fe7ccb07c..11bd7ce2be8e 100644 |
3769 |
+--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c |
3770 |
++++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c |
3771 |
+@@ -1225,9 +1225,13 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx) |
3772 |
+ struct iwl_txq *txq = trans_pcie->txq[txq_id]; |
3773 |
+ unsigned long flags; |
3774 |
+ int nfreed = 0; |
3775 |
++ u16 r; |
3776 |
+ |
3777 |
+ lockdep_assert_held(&txq->lock); |
3778 |
+ |
3779 |
++ idx = iwl_pcie_get_cmd_index(txq, idx); |
3780 |
++ r = iwl_pcie_get_cmd_index(txq, txq->read_ptr); |
3781 |
++ |
3782 |
+ if ((idx >= TFD_QUEUE_SIZE_MAX) || (!iwl_queue_used(txq, idx))) { |
3783 |
+ IWL_ERR(trans, |
3784 |
+ "%s: Read index for DMA queue txq id (%d), index %d is out of range [0-%d] %d %d.\n", |
3785 |
+@@ -1236,12 +1240,13 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx) |
3786 |
+ return; |
3787 |
+ } |
3788 |
+ |
3789 |
+- for (idx = iwl_queue_inc_wrap(idx); txq->read_ptr != idx; |
3790 |
+- txq->read_ptr = iwl_queue_inc_wrap(txq->read_ptr)) { |
3791 |
++ for (idx = iwl_queue_inc_wrap(idx); r != idx; |
3792 |
++ r = iwl_queue_inc_wrap(r)) { |
3793 |
++ txq->read_ptr = iwl_queue_inc_wrap(txq->read_ptr); |
3794 |
+ |
3795 |
+ if (nfreed++ > 0) { |
3796 |
+ IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", |
3797 |
+- idx, txq->write_ptr, txq->read_ptr); |
3798 |
++ idx, txq->write_ptr, r); |
3799 |
+ iwl_force_nmi(trans); |
3800 |
+ } |
3801 |
+ } |
3802 |
+diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c |
3803 |
+index 9dd2ca62d84a..c2b6aa1d485f 100644 |
3804 |
+--- a/drivers/net/xen-netfront.c |
3805 |
++++ b/drivers/net/xen-netfront.c |
3806 |
+@@ -87,8 +87,7 @@ struct netfront_cb { |
3807 |
+ /* IRQ name is queue name with "-tx" or "-rx" appended */ |
3808 |
+ #define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3) |
3809 |
+ |
3810 |
+-static DECLARE_WAIT_QUEUE_HEAD(module_load_q); |
3811 |
+-static DECLARE_WAIT_QUEUE_HEAD(module_unload_q); |
3812 |
++static DECLARE_WAIT_QUEUE_HEAD(module_wq); |
3813 |
+ |
3814 |
+ struct netfront_stats { |
3815 |
+ u64 packets; |
3816 |
+@@ -1331,11 +1330,11 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) |
3817 |
+ netif_carrier_off(netdev); |
3818 |
+ |
3819 |
+ xenbus_switch_state(dev, XenbusStateInitialising); |
3820 |
+- wait_event(module_load_q, |
3821 |
+- xenbus_read_driver_state(dev->otherend) != |
3822 |
+- XenbusStateClosed && |
3823 |
+- xenbus_read_driver_state(dev->otherend) != |
3824 |
+- XenbusStateUnknown); |
3825 |
++ wait_event(module_wq, |
3826 |
++ xenbus_read_driver_state(dev->otherend) != |
3827 |
++ XenbusStateClosed && |
3828 |
++ xenbus_read_driver_state(dev->otherend) != |
3829 |
++ XenbusStateUnknown); |
3830 |
+ return netdev; |
3831 |
+ |
3832 |
+ exit: |
3833 |
+@@ -1603,14 +1602,16 @@ static int xennet_init_queue(struct netfront_queue *queue) |
3834 |
+ { |
3835 |
+ unsigned short i; |
3836 |
+ int err = 0; |
3837 |
++ char *devid; |
3838 |
+ |
3839 |
+ spin_lock_init(&queue->tx_lock); |
3840 |
+ spin_lock_init(&queue->rx_lock); |
3841 |
+ |
3842 |
+ timer_setup(&queue->rx_refill_timer, rx_refill_timeout, 0); |
3843 |
+ |
3844 |
+- snprintf(queue->name, sizeof(queue->name), "%s-q%u", |
3845 |
+- queue->info->netdev->name, queue->id); |
3846 |
++ devid = strrchr(queue->info->xbdev->nodename, '/') + 1; |
3847 |
++ snprintf(queue->name, sizeof(queue->name), "vif%s-q%u", |
3848 |
++ devid, queue->id); |
3849 |
+ |
3850 |
+ /* Initialise tx_skbs as a free chain containing every entry. */ |
3851 |
+ queue->tx_skb_freelist = 0; |
3852 |
+@@ -2007,15 +2008,14 @@ static void netback_changed(struct xenbus_device *dev, |
3853 |
+ |
3854 |
+ dev_dbg(&dev->dev, "%s\n", xenbus_strstate(backend_state)); |
3855 |
+ |
3856 |
++ wake_up_all(&module_wq); |
3857 |
++ |
3858 |
+ switch (backend_state) { |
3859 |
+ case XenbusStateInitialising: |
3860 |
+ case XenbusStateInitialised: |
3861 |
+ case XenbusStateReconfiguring: |
3862 |
+ case XenbusStateReconfigured: |
3863 |
+- break; |
3864 |
+- |
3865 |
+ case XenbusStateUnknown: |
3866 |
+- wake_up_all(&module_unload_q); |
3867 |
+ break; |
3868 |
+ |
3869 |
+ case XenbusStateInitWait: |
3870 |
+@@ -2031,12 +2031,10 @@ static void netback_changed(struct xenbus_device *dev, |
3871 |
+ break; |
3872 |
+ |
3873 |
+ case XenbusStateClosed: |
3874 |
+- wake_up_all(&module_unload_q); |
3875 |
+ if (dev->state == XenbusStateClosed) |
3876 |
+ break; |
3877 |
+ /* Missed the backend's CLOSING state -- fallthrough */ |
3878 |
+ case XenbusStateClosing: |
3879 |
+- wake_up_all(&module_unload_q); |
3880 |
+ xenbus_frontend_closed(dev); |
3881 |
+ break; |
3882 |
+ } |
3883 |
+@@ -2144,14 +2142,14 @@ static int xennet_remove(struct xenbus_device *dev) |
3884 |
+ |
3885 |
+ if (xenbus_read_driver_state(dev->otherend) != XenbusStateClosed) { |
3886 |
+ xenbus_switch_state(dev, XenbusStateClosing); |
3887 |
+- wait_event(module_unload_q, |
3888 |
++ wait_event(module_wq, |
3889 |
+ xenbus_read_driver_state(dev->otherend) == |
3890 |
+ XenbusStateClosing || |
3891 |
+ xenbus_read_driver_state(dev->otherend) == |
3892 |
+ XenbusStateUnknown); |
3893 |
+ |
3894 |
+ xenbus_switch_state(dev, XenbusStateClosed); |
3895 |
+- wait_event(module_unload_q, |
3896 |
++ wait_event(module_wq, |
3897 |
+ xenbus_read_driver_state(dev->otherend) == |
3898 |
+ XenbusStateClosed || |
3899 |
+ xenbus_read_driver_state(dev->otherend) == |
3900 |
+diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c |
3901 |
+index 66ec5985c9f3..69fb62feb833 100644 |
3902 |
+--- a/drivers/nvme/host/rdma.c |
3903 |
++++ b/drivers/nvme/host/rdma.c |
3904 |
+@@ -1741,6 +1741,8 @@ static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown) |
3905 |
+ nvme_rdma_stop_io_queues(ctrl); |
3906 |
+ blk_mq_tagset_busy_iter(&ctrl->tag_set, |
3907 |
+ nvme_cancel_request, &ctrl->ctrl); |
3908 |
++ if (shutdown) |
3909 |
++ nvme_start_queues(&ctrl->ctrl); |
3910 |
+ nvme_rdma_destroy_io_queues(ctrl, shutdown); |
3911 |
+ } |
3912 |
+ |
3913 |
+diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c |
3914 |
+index 8c42b3a8c420..64c7596a46a1 100644 |
3915 |
+--- a/drivers/nvme/target/io-cmd-file.c |
3916 |
++++ b/drivers/nvme/target/io-cmd-file.c |
3917 |
+@@ -209,22 +209,24 @@ static void nvmet_file_execute_discard(struct nvmet_req *req) |
3918 |
+ { |
3919 |
+ int mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE; |
3920 |
+ struct nvme_dsm_range range; |
3921 |
+- loff_t offset; |
3922 |
+- loff_t len; |
3923 |
+- int i, ret; |
3924 |
++ loff_t offset, len; |
3925 |
++ u16 ret; |
3926 |
++ int i; |
3927 |
+ |
3928 |
+ for (i = 0; i <= le32_to_cpu(req->cmd->dsm.nr); i++) { |
3929 |
+- if (nvmet_copy_from_sgl(req, i * sizeof(range), &range, |
3930 |
+- sizeof(range))) |
3931 |
++ ret = nvmet_copy_from_sgl(req, i * sizeof(range), &range, |
3932 |
++ sizeof(range)); |
3933 |
++ if (ret) |
3934 |
+ break; |
3935 |
+ offset = le64_to_cpu(range.slba) << req->ns->blksize_shift; |
3936 |
+ len = le32_to_cpu(range.nlb) << req->ns->blksize_shift; |
3937 |
+- ret = vfs_fallocate(req->ns->file, mode, offset, len); |
3938 |
+- if (ret) |
3939 |
++ if (vfs_fallocate(req->ns->file, mode, offset, len)) { |
3940 |
++ ret = NVME_SC_INTERNAL | NVME_SC_DNR; |
3941 |
+ break; |
3942 |
++ } |
3943 |
+ } |
3944 |
+ |
3945 |
+- nvmet_req_complete(req, ret < 0 ? NVME_SC_INTERNAL | NVME_SC_DNR : 0); |
3946 |
++ nvmet_req_complete(req, ret); |
3947 |
+ } |
3948 |
+ |
3949 |
+ static void nvmet_file_dsm_work(struct work_struct *w) |
3950 |
+diff --git a/drivers/of/base.c b/drivers/of/base.c |
3951 |
+index 466e3c8582f0..53a51c6911eb 100644 |
3952 |
+--- a/drivers/of/base.c |
3953 |
++++ b/drivers/of/base.c |
3954 |
+@@ -118,6 +118,9 @@ void of_populate_phandle_cache(void) |
3955 |
+ if (np->phandle && np->phandle != OF_PHANDLE_ILLEGAL) |
3956 |
+ phandles++; |
3957 |
+ |
3958 |
++ if (!phandles) |
3959 |
++ goto out; |
3960 |
++ |
3961 |
+ cache_entries = roundup_pow_of_two(phandles); |
3962 |
+ phandle_cache_mask = cache_entries - 1; |
3963 |
+ |
3964 |
+@@ -719,6 +722,31 @@ struct device_node *of_get_next_available_child(const struct device_node *node, |
3965 |
+ } |
3966 |
+ EXPORT_SYMBOL(of_get_next_available_child); |
3967 |
+ |
3968 |
++/** |
3969 |
++ * of_get_compatible_child - Find compatible child node |
3970 |
++ * @parent: parent node |
3971 |
++ * @compatible: compatible string |
3972 |
++ * |
3973 |
++ * Lookup child node whose compatible property contains the given compatible |
3974 |
++ * string. |
3975 |
++ * |
3976 |
++ * Returns a node pointer with refcount incremented, use of_node_put() on it |
3977 |
++ * when done; or NULL if not found. |
3978 |
++ */ |
3979 |
++struct device_node *of_get_compatible_child(const struct device_node *parent, |
3980 |
++ const char *compatible) |
3981 |
++{ |
3982 |
++ struct device_node *child; |
3983 |
++ |
3984 |
++ for_each_child_of_node(parent, child) { |
3985 |
++ if (of_device_is_compatible(child, compatible)) |
3986 |
++ break; |
3987 |
++ } |
3988 |
++ |
3989 |
++ return child; |
3990 |
++} |
3991 |
++EXPORT_SYMBOL(of_get_compatible_child); |
3992 |
++ |
3993 |
+ /** |
3994 |
+ * of_get_child_by_name - Find the child node by name for a given parent |
3995 |
+ * @node: parent node |
3996 |
+diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c |
3997 |
+index 01cf1c1a841a..8de329546b82 100644 |
3998 |
+--- a/drivers/parport/parport_sunbpp.c |
3999 |
++++ b/drivers/parport/parport_sunbpp.c |
4000 |
+@@ -286,12 +286,16 @@ static int bpp_probe(struct platform_device *op) |
4001 |
+ |
4002 |
+ ops = kmemdup(&parport_sunbpp_ops, sizeof(struct parport_operations), |
4003 |
+ GFP_KERNEL); |
4004 |
+- if (!ops) |
4005 |
++ if (!ops) { |
4006 |
++ err = -ENOMEM; |
4007 |
+ goto out_unmap; |
4008 |
++ } |
4009 |
+ |
4010 |
+ dprintk(("register_port\n")); |
4011 |
+- if (!(p = parport_register_port((unsigned long)base, irq, dma, ops))) |
4012 |
++ if (!(p = parport_register_port((unsigned long)base, irq, dma, ops))) { |
4013 |
++ err = -ENOMEM; |
4014 |
+ goto out_free_ops; |
4015 |
++ } |
4016 |
+ |
4017 |
+ p->size = size; |
4018 |
+ p->dev = &op->dev; |
4019 |
+diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c |
4020 |
+index a2e88386af28..0fbf612b8ef2 100644 |
4021 |
+--- a/drivers/pci/pcie/aer.c |
4022 |
++++ b/drivers/pci/pcie/aer.c |
4023 |
+@@ -303,6 +303,9 @@ int pcie_aer_get_firmware_first(struct pci_dev *dev) |
4024 |
+ if (!pci_is_pcie(dev)) |
4025 |
+ return 0; |
4026 |
+ |
4027 |
++ if (pcie_ports_native) |
4028 |
++ return 0; |
4029 |
++ |
4030 |
+ if (!dev->__aer_firmware_first_valid) |
4031 |
+ aer_set_firmware_first(dev); |
4032 |
+ return dev->__aer_firmware_first; |
4033 |
+@@ -323,6 +326,9 @@ bool aer_acpi_firmware_first(void) |
4034 |
+ .firmware_first = 0, |
4035 |
+ }; |
4036 |
+ |
4037 |
++ if (pcie_ports_native) |
4038 |
++ return false; |
4039 |
++ |
4040 |
+ if (!parsed) { |
4041 |
+ apei_hest_parse(aer_hest_parse, &info); |
4042 |
+ aer_firmware_first = info.firmware_first; |
4043 |
+diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7622.c b/drivers/pinctrl/mediatek/pinctrl-mt7622.c |
4044 |
+index 4c4740ffeb9c..3ea685634b6c 100644 |
4045 |
+--- a/drivers/pinctrl/mediatek/pinctrl-mt7622.c |
4046 |
++++ b/drivers/pinctrl/mediatek/pinctrl-mt7622.c |
4047 |
+@@ -1537,7 +1537,7 @@ static int mtk_build_groups(struct mtk_pinctrl *hw) |
4048 |
+ err = pinctrl_generic_add_group(hw->pctrl, group->name, |
4049 |
+ group->pins, group->num_pins, |
4050 |
+ group->data); |
4051 |
+- if (err) { |
4052 |
++ if (err < 0) { |
4053 |
+ dev_err(hw->dev, "Failed to register group %s\n", |
4054 |
+ group->name); |
4055 |
+ return err; |
4056 |
+@@ -1558,7 +1558,7 @@ static int mtk_build_functions(struct mtk_pinctrl *hw) |
4057 |
+ func->group_names, |
4058 |
+ func->num_group_names, |
4059 |
+ func->data); |
4060 |
+- if (err) { |
4061 |
++ if (err < 0) { |
4062 |
+ dev_err(hw->dev, "Failed to register function %s\n", |
4063 |
+ func->name); |
4064 |
+ return err; |
4065 |
+diff --git a/drivers/pinctrl/pinctrl-rza1.c b/drivers/pinctrl/pinctrl-rza1.c |
4066 |
+index 717c0f4449a0..f76edf664539 100644 |
4067 |
+--- a/drivers/pinctrl/pinctrl-rza1.c |
4068 |
++++ b/drivers/pinctrl/pinctrl-rza1.c |
4069 |
+@@ -1006,6 +1006,7 @@ static int rza1_dt_node_to_map(struct pinctrl_dev *pctldev, |
4070 |
+ const char *grpname; |
4071 |
+ const char **fngrps; |
4072 |
+ int ret, npins; |
4073 |
++ int gsel, fsel; |
4074 |
+ |
4075 |
+ npins = rza1_dt_node_pin_count(np); |
4076 |
+ if (npins < 0) { |
4077 |
+@@ -1055,18 +1056,19 @@ static int rza1_dt_node_to_map(struct pinctrl_dev *pctldev, |
4078 |
+ fngrps[0] = grpname; |
4079 |
+ |
4080 |
+ mutex_lock(&rza1_pctl->mutex); |
4081 |
+- ret = pinctrl_generic_add_group(pctldev, grpname, grpins, npins, |
4082 |
+- NULL); |
4083 |
+- if (ret) { |
4084 |
++ gsel = pinctrl_generic_add_group(pctldev, grpname, grpins, npins, |
4085 |
++ NULL); |
4086 |
++ if (gsel < 0) { |
4087 |
+ mutex_unlock(&rza1_pctl->mutex); |
4088 |
+- return ret; |
4089 |
++ return gsel; |
4090 |
+ } |
4091 |
+ |
4092 |
+- ret = pinmux_generic_add_function(pctldev, grpname, fngrps, 1, |
4093 |
+- mux_confs); |
4094 |
+- if (ret) |
4095 |
++ fsel = pinmux_generic_add_function(pctldev, grpname, fngrps, 1, |
4096 |
++ mux_confs); |
4097 |
++ if (fsel < 0) { |
4098 |
++ ret = fsel; |
4099 |
+ goto remove_group; |
4100 |
+- mutex_unlock(&rza1_pctl->mutex); |
4101 |
++ } |
4102 |
+ |
4103 |
+ dev_info(rza1_pctl->dev, "Parsed function and group %s with %d pins\n", |
4104 |
+ grpname, npins); |
4105 |
+@@ -1083,15 +1085,15 @@ static int rza1_dt_node_to_map(struct pinctrl_dev *pctldev, |
4106 |
+ (*map)->data.mux.group = np->name; |
4107 |
+ (*map)->data.mux.function = np->name; |
4108 |
+ *num_maps = 1; |
4109 |
++ mutex_unlock(&rza1_pctl->mutex); |
4110 |
+ |
4111 |
+ return 0; |
4112 |
+ |
4113 |
+ remove_function: |
4114 |
+- mutex_lock(&rza1_pctl->mutex); |
4115 |
+- pinmux_generic_remove_last_function(pctldev); |
4116 |
++ pinmux_generic_remove_function(pctldev, fsel); |
4117 |
+ |
4118 |
+ remove_group: |
4119 |
+- pinctrl_generic_remove_last_group(pctldev); |
4120 |
++ pinctrl_generic_remove_group(pctldev, gsel); |
4121 |
+ mutex_unlock(&rza1_pctl->mutex); |
4122 |
+ |
4123 |
+ dev_info(rza1_pctl->dev, "Unable to parse function and group %s\n", |
4124 |
+diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c |
4125 |
+index 0e22f52b2a19..2155a30c282b 100644 |
4126 |
+--- a/drivers/pinctrl/qcom/pinctrl-msm.c |
4127 |
++++ b/drivers/pinctrl/qcom/pinctrl-msm.c |
4128 |
+@@ -250,22 +250,30 @@ static int msm_config_group_get(struct pinctrl_dev *pctldev, |
4129 |
+ /* Convert register value to pinconf value */ |
4130 |
+ switch (param) { |
4131 |
+ case PIN_CONFIG_BIAS_DISABLE: |
4132 |
+- arg = arg == MSM_NO_PULL; |
4133 |
++ if (arg != MSM_NO_PULL) |
4134 |
++ return -EINVAL; |
4135 |
++ arg = 1; |
4136 |
+ break; |
4137 |
+ case PIN_CONFIG_BIAS_PULL_DOWN: |
4138 |
+- arg = arg == MSM_PULL_DOWN; |
4139 |
++ if (arg != MSM_PULL_DOWN) |
4140 |
++ return -EINVAL; |
4141 |
++ arg = 1; |
4142 |
+ break; |
4143 |
+ case PIN_CONFIG_BIAS_BUS_HOLD: |
4144 |
+ if (pctrl->soc->pull_no_keeper) |
4145 |
+ return -ENOTSUPP; |
4146 |
+ |
4147 |
+- arg = arg == MSM_KEEPER; |
4148 |
++ if (arg != MSM_KEEPER) |
4149 |
++ return -EINVAL; |
4150 |
++ arg = 1; |
4151 |
+ break; |
4152 |
+ case PIN_CONFIG_BIAS_PULL_UP: |
4153 |
+ if (pctrl->soc->pull_no_keeper) |
4154 |
+ arg = arg == MSM_PULL_UP_NO_KEEPER; |
4155 |
+ else |
4156 |
+ arg = arg == MSM_PULL_UP; |
4157 |
++ if (!arg) |
4158 |
++ return -EINVAL; |
4159 |
+ break; |
4160 |
+ case PIN_CONFIG_DRIVE_STRENGTH: |
4161 |
+ arg = msm_regval_to_drive(arg); |
4162 |
+diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c |
4163 |
+index 3e66e0d10010..cf82db78e69e 100644 |
4164 |
+--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c |
4165 |
++++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c |
4166 |
+@@ -390,31 +390,47 @@ static int pmic_gpio_config_get(struct pinctrl_dev *pctldev, |
4167 |
+ |
4168 |
+ switch (param) { |
4169 |
+ case PIN_CONFIG_DRIVE_PUSH_PULL: |
4170 |
+- arg = pad->buffer_type == PMIC_GPIO_OUT_BUF_CMOS; |
4171 |
++ if (pad->buffer_type != PMIC_GPIO_OUT_BUF_CMOS) |
4172 |
++ return -EINVAL; |
4173 |
++ arg = 1; |
4174 |
+ break; |
4175 |
+ case PIN_CONFIG_DRIVE_OPEN_DRAIN: |
4176 |
+- arg = pad->buffer_type == PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS; |
4177 |
++ if (pad->buffer_type != PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS) |
4178 |
++ return -EINVAL; |
4179 |
++ arg = 1; |
4180 |
+ break; |
4181 |
+ case PIN_CONFIG_DRIVE_OPEN_SOURCE: |
4182 |
+- arg = pad->buffer_type == PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS; |
4183 |
++ if (pad->buffer_type != PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS) |
4184 |
++ return -EINVAL; |
4185 |
++ arg = 1; |
4186 |
+ break; |
4187 |
+ case PIN_CONFIG_BIAS_PULL_DOWN: |
4188 |
+- arg = pad->pullup == PMIC_GPIO_PULL_DOWN; |
4189 |
++ if (pad->pullup != PMIC_GPIO_PULL_DOWN) |
4190 |
++ return -EINVAL; |
4191 |
++ arg = 1; |
4192 |
+ break; |
4193 |
+ case PIN_CONFIG_BIAS_DISABLE: |
4194 |
+- arg = pad->pullup = PMIC_GPIO_PULL_DISABLE; |
4195 |
++ if (pad->pullup != PMIC_GPIO_PULL_DISABLE) |
4196 |
++ return -EINVAL; |
4197 |
++ arg = 1; |
4198 |
+ break; |
4199 |
+ case PIN_CONFIG_BIAS_PULL_UP: |
4200 |
+- arg = pad->pullup == PMIC_GPIO_PULL_UP_30; |
4201 |
++ if (pad->pullup != PMIC_GPIO_PULL_UP_30) |
4202 |
++ return -EINVAL; |
4203 |
++ arg = 1; |
4204 |
+ break; |
4205 |
+ case PIN_CONFIG_BIAS_HIGH_IMPEDANCE: |
4206 |
+- arg = !pad->is_enabled; |
4207 |
++ if (pad->is_enabled) |
4208 |
++ return -EINVAL; |
4209 |
++ arg = 1; |
4210 |
+ break; |
4211 |
+ case PIN_CONFIG_POWER_SOURCE: |
4212 |
+ arg = pad->power_source; |
4213 |
+ break; |
4214 |
+ case PIN_CONFIG_INPUT_ENABLE: |
4215 |
+- arg = pad->input_enabled; |
4216 |
++ if (!pad->input_enabled) |
4217 |
++ return -EINVAL; |
4218 |
++ arg = 1; |
4219 |
+ break; |
4220 |
+ case PIN_CONFIG_OUTPUT: |
4221 |
+ arg = pad->out_value; |
4222 |
+diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c |
4223 |
+index eef76bfa5d73..e50941c3ba54 100644 |
4224 |
+--- a/drivers/platform/x86/toshiba_acpi.c |
4225 |
++++ b/drivers/platform/x86/toshiba_acpi.c |
4226 |
+@@ -34,6 +34,7 @@ |
4227 |
+ #define TOSHIBA_ACPI_VERSION "0.24" |
4228 |
+ #define PROC_INTERFACE_VERSION 1 |
4229 |
+ |
4230 |
++#include <linux/compiler.h> |
4231 |
+ #include <linux/kernel.h> |
4232 |
+ #include <linux/module.h> |
4233 |
+ #include <linux/moduleparam.h> |
4234 |
+@@ -1682,7 +1683,7 @@ static const struct file_operations keys_proc_fops = { |
4235 |
+ .write = keys_proc_write, |
4236 |
+ }; |
4237 |
+ |
4238 |
+-static int version_proc_show(struct seq_file *m, void *v) |
4239 |
++static int __maybe_unused version_proc_show(struct seq_file *m, void *v) |
4240 |
+ { |
4241 |
+ seq_printf(m, "driver: %s\n", TOSHIBA_ACPI_VERSION); |
4242 |
+ seq_printf(m, "proc_interface: %d\n", PROC_INTERFACE_VERSION); |
4243 |
+diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c |
4244 |
+index 9817f1a75342..ba3d5e63ada6 100644 |
4245 |
+--- a/drivers/regulator/qcom_spmi-regulator.c |
4246 |
++++ b/drivers/regulator/qcom_spmi-regulator.c |
4247 |
+@@ -1752,7 +1752,8 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev) |
4248 |
+ const char *name; |
4249 |
+ struct device *dev = &pdev->dev; |
4250 |
+ struct device_node *node = pdev->dev.of_node; |
4251 |
+- struct device_node *syscon; |
4252 |
++ struct device_node *syscon, *reg_node; |
4253 |
++ struct property *reg_prop; |
4254 |
+ int ret, lenp; |
4255 |
+ struct list_head *vreg_list; |
4256 |
+ |
4257 |
+@@ -1774,16 +1775,19 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev) |
4258 |
+ syscon = of_parse_phandle(node, "qcom,saw-reg", 0); |
4259 |
+ saw_regmap = syscon_node_to_regmap(syscon); |
4260 |
+ of_node_put(syscon); |
4261 |
+- if (IS_ERR(regmap)) |
4262 |
++ if (IS_ERR(saw_regmap)) |
4263 |
+ dev_err(dev, "ERROR reading SAW regmap\n"); |
4264 |
+ } |
4265 |
+ |
4266 |
+ for (reg = match->data; reg->name; reg++) { |
4267 |
+ |
4268 |
+- if (saw_regmap && \ |
4269 |
+- of_find_property(of_find_node_by_name(node, reg->name), \ |
4270 |
+- "qcom,saw-slave", &lenp)) { |
4271 |
+- continue; |
4272 |
++ if (saw_regmap) { |
4273 |
++ reg_node = of_get_child_by_name(node, reg->name); |
4274 |
++ reg_prop = of_find_property(reg_node, "qcom,saw-slave", |
4275 |
++ &lenp); |
4276 |
++ of_node_put(reg_node); |
4277 |
++ if (reg_prop) |
4278 |
++ continue; |
4279 |
+ } |
4280 |
+ |
4281 |
+ vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); |
4282 |
+@@ -1816,13 +1820,17 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev) |
4283 |
+ if (ret) |
4284 |
+ continue; |
4285 |
+ |
4286 |
+- if (saw_regmap && \ |
4287 |
+- of_find_property(of_find_node_by_name(node, reg->name), \ |
4288 |
+- "qcom,saw-leader", &lenp)) { |
4289 |
+- spmi_saw_ops = *(vreg->desc.ops); |
4290 |
+- spmi_saw_ops.set_voltage_sel = \ |
4291 |
+- spmi_regulator_saw_set_voltage; |
4292 |
+- vreg->desc.ops = &spmi_saw_ops; |
4293 |
++ if (saw_regmap) { |
4294 |
++ reg_node = of_get_child_by_name(node, reg->name); |
4295 |
++ reg_prop = of_find_property(reg_node, "qcom,saw-leader", |
4296 |
++ &lenp); |
4297 |
++ of_node_put(reg_node); |
4298 |
++ if (reg_prop) { |
4299 |
++ spmi_saw_ops = *(vreg->desc.ops); |
4300 |
++ spmi_saw_ops.set_voltage_sel = |
4301 |
++ spmi_regulator_saw_set_voltage; |
4302 |
++ vreg->desc.ops = &spmi_saw_ops; |
4303 |
++ } |
4304 |
+ } |
4305 |
+ |
4306 |
+ config.dev = dev; |
4307 |
+diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c |
4308 |
+index 2bf8e7c49f2a..e5ec59102b01 100644 |
4309 |
+--- a/drivers/remoteproc/qcom_q6v5_pil.c |
4310 |
++++ b/drivers/remoteproc/qcom_q6v5_pil.c |
4311 |
+@@ -1370,7 +1370,6 @@ static const struct rproc_hexagon_res sdm845_mss = { |
4312 |
+ .hexagon_mba_image = "mba.mbn", |
4313 |
+ .proxy_clk_names = (char*[]){ |
4314 |
+ "xo", |
4315 |
+- "axis2", |
4316 |
+ "prng", |
4317 |
+ NULL |
4318 |
+ }, |
4319 |
+diff --git a/drivers/reset/reset-imx7.c b/drivers/reset/reset-imx7.c |
4320 |
+index 4db177bc89bc..fdeac1946429 100644 |
4321 |
+--- a/drivers/reset/reset-imx7.c |
4322 |
++++ b/drivers/reset/reset-imx7.c |
4323 |
+@@ -80,7 +80,7 @@ static int imx7_reset_set(struct reset_controller_dev *rcdev, |
4324 |
+ { |
4325 |
+ struct imx7_src *imx7src = to_imx7_src(rcdev); |
4326 |
+ const struct imx7_src_signal *signal = &imx7_src_signals[id]; |
4327 |
+- unsigned int value = 0; |
4328 |
++ unsigned int value = assert ? signal->bit : 0; |
4329 |
+ |
4330 |
+ switch (id) { |
4331 |
+ case IMX7_RESET_PCIEPHY: |
4332 |
+diff --git a/drivers/rtc/rtc-bq4802.c b/drivers/rtc/rtc-bq4802.c |
4333 |
+index d768f6747961..113493b52149 100644 |
4334 |
+--- a/drivers/rtc/rtc-bq4802.c |
4335 |
++++ b/drivers/rtc/rtc-bq4802.c |
4336 |
+@@ -162,6 +162,10 @@ static int bq4802_probe(struct platform_device *pdev) |
4337 |
+ } else if (p->r->flags & IORESOURCE_MEM) { |
4338 |
+ p->regs = devm_ioremap(&pdev->dev, p->r->start, |
4339 |
+ resource_size(p->r)); |
4340 |
++ if (!p->regs){ |
4341 |
++ err = -ENOMEM; |
4342 |
++ goto out; |
4343 |
++ } |
4344 |
+ p->read = bq4802_read_mem; |
4345 |
+ p->write = bq4802_write_mem; |
4346 |
+ } else { |
4347 |
+diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c |
4348 |
+index d01ac29fd986..ffdb78421a25 100644 |
4349 |
+--- a/drivers/s390/net/qeth_core_main.c |
4350 |
++++ b/drivers/s390/net/qeth_core_main.c |
4351 |
+@@ -3530,13 +3530,14 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index, |
4352 |
+ qdio_flags = QDIO_FLAG_SYNC_OUTPUT; |
4353 |
+ if (atomic_read(&queue->set_pci_flags_count)) |
4354 |
+ qdio_flags |= QDIO_FLAG_PCI_OUT; |
4355 |
++ atomic_add(count, &queue->used_buffers); |
4356 |
++ |
4357 |
+ rc = do_QDIO(CARD_DDEV(queue->card), qdio_flags, |
4358 |
+ queue->queue_no, index, count); |
4359 |
+ if (queue->card->options.performance_stats) |
4360 |
+ queue->card->perf_stats.outbound_do_qdio_time += |
4361 |
+ qeth_get_micros() - |
4362 |
+ queue->card->perf_stats.outbound_do_qdio_start_time; |
4363 |
+- atomic_add(count, &queue->used_buffers); |
4364 |
+ if (rc) { |
4365 |
+ queue->card->stats.tx_errors += count; |
4366 |
+ /* ignore temporary SIGA errors without busy condition */ |
4367 |
+diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c |
4368 |
+index c3f18afb368b..cfb659747693 100644 |
4369 |
+--- a/drivers/s390/net/qeth_core_sys.c |
4370 |
++++ b/drivers/s390/net/qeth_core_sys.c |
4371 |
+@@ -426,6 +426,7 @@ static ssize_t qeth_dev_layer2_store(struct device *dev, |
4372 |
+ if (card->discipline) { |
4373 |
+ card->discipline->remove(card->gdev); |
4374 |
+ qeth_core_free_discipline(card); |
4375 |
++ card->options.layer2 = -1; |
4376 |
+ } |
4377 |
+ |
4378 |
+ rc = qeth_core_load_discipline(card, newdis); |
4379 |
+diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c |
4380 |
+index 3f3569ec5ce3..ddc7921ae5da 100644 |
4381 |
+--- a/drivers/scsi/libfc/fc_disc.c |
4382 |
++++ b/drivers/scsi/libfc/fc_disc.c |
4383 |
+@@ -294,9 +294,11 @@ static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event) |
4384 |
+ * discovery, reverify or log them in. Otherwise, log them out. |
4385 |
+ * Skip ports which were never discovered. These are the dNS port |
4386 |
+ * and ports which were created by PLOGI. |
4387 |
++ * |
4388 |
++ * We don't need to use the _rcu variant here as the rport list |
4389 |
++ * is protected by the disc mutex which is already held on entry. |
4390 |
+ */ |
4391 |
+- rcu_read_lock(); |
4392 |
+- list_for_each_entry_rcu(rdata, &disc->rports, peers) { |
4393 |
++ list_for_each_entry(rdata, &disc->rports, peers) { |
4394 |
+ if (!kref_get_unless_zero(&rdata->kref)) |
4395 |
+ continue; |
4396 |
+ if (rdata->disc_id) { |
4397 |
+@@ -307,7 +309,6 @@ static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event) |
4398 |
+ } |
4399 |
+ kref_put(&rdata->kref, fc_rport_destroy); |
4400 |
+ } |
4401 |
+- rcu_read_unlock(); |
4402 |
+ mutex_unlock(&disc->disc_mutex); |
4403 |
+ disc->disc_callback(lport, event); |
4404 |
+ mutex_lock(&disc->disc_mutex); |
4405 |
+diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c |
4406 |
+index d723fd1d7b26..cab1fb087e6a 100644 |
4407 |
+--- a/drivers/scsi/lpfc/lpfc_nvme.c |
4408 |
++++ b/drivers/scsi/lpfc/lpfc_nvme.c |
4409 |
+@@ -2976,7 +2976,7 @@ lpfc_nvme_wait_for_io_drain(struct lpfc_hba *phba) |
4410 |
+ struct lpfc_sli_ring *pring; |
4411 |
+ u32 i, wait_cnt = 0; |
4412 |
+ |
4413 |
+- if (phba->sli_rev < LPFC_SLI_REV4) |
4414 |
++ if (phba->sli_rev < LPFC_SLI_REV4 || !phba->sli4_hba.nvme_wq) |
4415 |
+ return; |
4416 |
+ |
4417 |
+ /* Cycle through all NVME rings and make sure all outstanding |
4418 |
+@@ -2985,6 +2985,9 @@ lpfc_nvme_wait_for_io_drain(struct lpfc_hba *phba) |
4419 |
+ for (i = 0; i < phba->cfg_nvme_io_channel; i++) { |
4420 |
+ pring = phba->sli4_hba.nvme_wq[i]->pring; |
4421 |
+ |
4422 |
++ if (!pring) |
4423 |
++ continue; |
4424 |
++ |
4425 |
+ /* Retrieve everything on the txcmplq */ |
4426 |
+ while (!list_empty(&pring->txcmplq)) { |
4427 |
+ msleep(LPFC_XRI_EXCH_BUSY_WAIT_T1); |
4428 |
+diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c |
4429 |
+index 7271c9d885dd..5e5ec3363b44 100644 |
4430 |
+--- a/drivers/scsi/lpfc/lpfc_nvmet.c |
4431 |
++++ b/drivers/scsi/lpfc/lpfc_nvmet.c |
4432 |
+@@ -402,6 +402,7 @@ lpfc_nvmet_ctxbuf_post(struct lpfc_hba *phba, struct lpfc_nvmet_ctxbuf *ctx_buf) |
4433 |
+ |
4434 |
+ /* Process FCP command */ |
4435 |
+ if (rc == 0) { |
4436 |
++ ctxp->rqb_buffer = NULL; |
4437 |
+ atomic_inc(&tgtp->rcv_fcp_cmd_out); |
4438 |
+ nvmebuf->hrq->rqbp->rqb_free_buffer(phba, nvmebuf); |
4439 |
+ return; |
4440 |
+@@ -1116,8 +1117,17 @@ lpfc_nvmet_defer_rcv(struct nvmet_fc_target_port *tgtport, |
4441 |
+ lpfc_nvmeio_data(phba, "NVMET DEFERRCV: xri x%x sz %d CPU %02x\n", |
4442 |
+ ctxp->oxid, ctxp->size, smp_processor_id()); |
4443 |
+ |
4444 |
++ if (!nvmebuf) { |
4445 |
++ lpfc_printf_log(phba, KERN_INFO, LOG_NVME_IOERR, |
4446 |
++ "6425 Defer rcv: no buffer xri x%x: " |
4447 |
++ "flg %x ste %x\n", |
4448 |
++ ctxp->oxid, ctxp->flag, ctxp->state); |
4449 |
++ return; |
4450 |
++ } |
4451 |
++ |
4452 |
+ tgtp = phba->targetport->private; |
4453 |
+- atomic_inc(&tgtp->rcv_fcp_cmd_defer); |
4454 |
++ if (tgtp) |
4455 |
++ atomic_inc(&tgtp->rcv_fcp_cmd_defer); |
4456 |
+ |
4457 |
+ /* Free the nvmebuf since a new buffer already replaced it */ |
4458 |
+ nvmebuf->hrq->rqbp->rqb_free_buffer(phba, nvmebuf); |
4459 |
+diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c |
4460 |
+index 70b2ee80d6bd..bf4bd71ab53f 100644 |
4461 |
+--- a/drivers/soc/qcom/smem.c |
4462 |
++++ b/drivers/soc/qcom/smem.c |
4463 |
+@@ -364,11 +364,6 @@ static int qcom_smem_alloc_private(struct qcom_smem *smem, |
4464 |
+ end = phdr_to_last_uncached_entry(phdr); |
4465 |
+ cached = phdr_to_last_cached_entry(phdr); |
4466 |
+ |
4467 |
+- if (smem->global_partition) { |
4468 |
+- dev_err(smem->dev, "Already found the global partition\n"); |
4469 |
+- return -EINVAL; |
4470 |
+- } |
4471 |
+- |
4472 |
+ while (hdr < end) { |
4473 |
+ if (hdr->canary != SMEM_PRIVATE_CANARY) |
4474 |
+ goto bad_canary; |
4475 |
+@@ -736,6 +731,11 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem) |
4476 |
+ bool found = false; |
4477 |
+ int i; |
4478 |
+ |
4479 |
++ if (smem->global_partition) { |
4480 |
++ dev_err(smem->dev, "Already found the global partition\n"); |
4481 |
++ return -EINVAL; |
4482 |
++ } |
4483 |
++ |
4484 |
+ ptable = qcom_smem_get_ptable(smem); |
4485 |
+ if (IS_ERR(ptable)) |
4486 |
+ return PTR_ERR(ptable); |
4487 |
+diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c |
4488 |
+index f693bfe95ab9..a087464efdd7 100644 |
4489 |
+--- a/drivers/spi/spi-dw.c |
4490 |
++++ b/drivers/spi/spi-dw.c |
4491 |
+@@ -485,6 +485,8 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) |
4492 |
+ dws->dma_inited = 0; |
4493 |
+ dws->dma_addr = (dma_addr_t)(dws->paddr + DW_SPI_DR); |
4494 |
+ |
4495 |
++ spi_controller_set_devdata(master, dws); |
4496 |
++ |
4497 |
+ ret = request_irq(dws->irq, dw_spi_irq, IRQF_SHARED, dev_name(dev), |
4498 |
+ master); |
4499 |
+ if (ret < 0) { |
4500 |
+@@ -518,7 +520,6 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) |
4501 |
+ } |
4502 |
+ } |
4503 |
+ |
4504 |
+- spi_controller_set_devdata(master, dws); |
4505 |
+ ret = devm_spi_register_controller(dev, master); |
4506 |
+ if (ret) { |
4507 |
+ dev_err(&master->dev, "problem registering spi master\n"); |
4508 |
+diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |
4509 |
+index 396371728aa1..537d5bb5e294 100644 |
4510 |
+--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |
4511 |
++++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |
4512 |
+@@ -767,7 +767,7 @@ static void free_bufs(struct dpaa2_eth_priv *priv, u64 *buf_array, int count) |
4513 |
+ for (i = 0; i < count; i++) { |
4514 |
+ vaddr = dpaa2_iova_to_virt(priv->iommu_domain, buf_array[i]); |
4515 |
+ dma_unmap_single(dev, buf_array[i], DPAA2_ETH_RX_BUF_SIZE, |
4516 |
+- DMA_BIDIRECTIONAL); |
4517 |
++ DMA_FROM_DEVICE); |
4518 |
+ skb_free_frag(vaddr); |
4519 |
+ } |
4520 |
+ } |
4521 |
+diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c |
4522 |
+index f0cefa1b7b0f..b20d34449ed4 100644 |
4523 |
+--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c |
4524 |
++++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c |
4525 |
+@@ -439,16 +439,16 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream) |
4526 |
+ my_workqueue_init(alsa_stream); |
4527 |
+ |
4528 |
+ ret = bcm2835_audio_open_connection(alsa_stream); |
4529 |
+- if (ret) { |
4530 |
+- ret = -1; |
4531 |
+- goto exit; |
4532 |
+- } |
4533 |
++ if (ret) |
4534 |
++ goto free_wq; |
4535 |
++ |
4536 |
+ instance = alsa_stream->instance; |
4537 |
+ LOG_DBG(" instance (%p)\n", instance); |
4538 |
+ |
4539 |
+ if (mutex_lock_interruptible(&instance->vchi_mutex)) { |
4540 |
+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n", instance->num_connections); |
4541 |
+- return -EINTR; |
4542 |
++ ret = -EINTR; |
4543 |
++ goto free_wq; |
4544 |
+ } |
4545 |
+ vchi_service_use(instance->vchi_handle[0]); |
4546 |
+ |
4547 |
+@@ -471,7 +471,11 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream) |
4548 |
+ unlock: |
4549 |
+ vchi_service_release(instance->vchi_handle[0]); |
4550 |
+ mutex_unlock(&instance->vchi_mutex); |
4551 |
+-exit: |
4552 |
++ |
4553 |
++free_wq: |
4554 |
++ if (ret) |
4555 |
++ destroy_workqueue(alsa_stream->my_wq); |
4556 |
++ |
4557 |
+ return ret; |
4558 |
+ } |
4559 |
+ |
4560 |
+diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c |
4561 |
+index ce26741ae9d9..3f61d04c47ab 100644 |
4562 |
+--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c |
4563 |
++++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c |
4564 |
+@@ -580,6 +580,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) |
4565 |
+ static void stop_streaming(struct vb2_queue *vq) |
4566 |
+ { |
4567 |
+ int ret; |
4568 |
++ unsigned long timeout; |
4569 |
+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); |
4570 |
+ |
4571 |
+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", |
4572 |
+@@ -605,10 +606,10 @@ static void stop_streaming(struct vb2_queue *vq) |
4573 |
+ sizeof(dev->capture.frame_count)); |
4574 |
+ |
4575 |
+ /* wait for last frame to complete */ |
4576 |
+- ret = wait_for_completion_timeout(&dev->capture.frame_cmplt, HZ); |
4577 |
+- if (ret <= 0) |
4578 |
++ timeout = wait_for_completion_timeout(&dev->capture.frame_cmplt, HZ); |
4579 |
++ if (timeout == 0) |
4580 |
+ v4l2_err(&dev->v4l2_dev, |
4581 |
+- "error %d waiting for frame completion\n", ret); |
4582 |
++ "timed out waiting for frame completion\n"); |
4583 |
+ |
4584 |
+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, |
4585 |
+ "disabling connection\n"); |
4586 |
+diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c |
4587 |
+index f5b5ead6347c..51e5b04ff0f5 100644 |
4588 |
+--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c |
4589 |
++++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c |
4590 |
+@@ -630,6 +630,7 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, |
4591 |
+ { |
4592 |
+ struct mmal_msg_context *msg_context; |
4593 |
+ int ret; |
4594 |
++ unsigned long timeout; |
4595 |
+ |
4596 |
+ /* payload size must not cause message to exceed max size */ |
4597 |
+ if (payload_len > |
4598 |
+@@ -668,11 +669,11 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, |
4599 |
+ return ret; |
4600 |
+ } |
4601 |
+ |
4602 |
+- ret = wait_for_completion_timeout(&msg_context->u.sync.cmplt, 3 * HZ); |
4603 |
+- if (ret <= 0) { |
4604 |
+- pr_err("error %d waiting for sync completion\n", ret); |
4605 |
+- if (ret == 0) |
4606 |
+- ret = -ETIME; |
4607 |
++ timeout = wait_for_completion_timeout(&msg_context->u.sync.cmplt, |
4608 |
++ 3 * HZ); |
4609 |
++ if (timeout == 0) { |
4610 |
++ pr_err("timed out waiting for sync completion\n"); |
4611 |
++ ret = -ETIME; |
4612 |
+ /* todo: what happens if the message arrives after aborting */ |
4613 |
+ release_msg_context(msg_context); |
4614 |
+ return ret; |
4615 |
+diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c |
4616 |
+index bfb37f0be22f..863e86b9a424 100644 |
4617 |
+--- a/drivers/tty/serial/8250/8250_of.c |
4618 |
++++ b/drivers/tty/serial/8250/8250_of.c |
4619 |
+@@ -124,7 +124,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev, |
4620 |
+ dev_warn(&ofdev->dev, "unsupported reg-io-width (%d)\n", |
4621 |
+ prop); |
4622 |
+ ret = -EINVAL; |
4623 |
+- goto err_dispose; |
4624 |
++ goto err_unprepare; |
4625 |
+ } |
4626 |
+ } |
4627 |
+ port->flags |= UPF_IOREMAP; |
4628 |
+diff --git a/drivers/tty/tty_baudrate.c b/drivers/tty/tty_baudrate.c |
4629 |
+index 6ff8cdfc9d2a..3e827a3d48d5 100644 |
4630 |
+--- a/drivers/tty/tty_baudrate.c |
4631 |
++++ b/drivers/tty/tty_baudrate.c |
4632 |
+@@ -157,18 +157,25 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, |
4633 |
+ termios->c_ospeed = obaud; |
4634 |
+ |
4635 |
+ #ifdef BOTHER |
4636 |
++ if ((termios->c_cflag >> IBSHIFT) & CBAUD) |
4637 |
++ ibinput = 1; /* An input speed was specified */ |
4638 |
++ |
4639 |
+ /* If the user asked for a precise weird speed give a precise weird |
4640 |
+ answer. If they asked for a Bfoo speed they may have problems |
4641 |
+ digesting non-exact replies so fuzz a bit */ |
4642 |
+ |
4643 |
+- if ((termios->c_cflag & CBAUD) == BOTHER) |
4644 |
++ if ((termios->c_cflag & CBAUD) == BOTHER) { |
4645 |
+ oclose = 0; |
4646 |
++ if (!ibinput) |
4647 |
++ iclose = 0; |
4648 |
++ } |
4649 |
+ if (((termios->c_cflag >> IBSHIFT) & CBAUD) == BOTHER) |
4650 |
+ iclose = 0; |
4651 |
+- if ((termios->c_cflag >> IBSHIFT) & CBAUD) |
4652 |
+- ibinput = 1; /* An input speed was specified */ |
4653 |
+ #endif |
4654 |
+ termios->c_cflag &= ~CBAUD; |
4655 |
++#ifdef IBSHIFT |
4656 |
++ termios->c_cflag &= ~(CBAUD << IBSHIFT); |
4657 |
++#endif |
4658 |
+ |
4659 |
+ /* |
4660 |
+ * Our goal is to find a close match to the standard baud rate |
4661 |
+diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
4662 |
+index 75c4623ad779..f8ee32d9843a 100644 |
4663 |
+--- a/drivers/usb/class/cdc-acm.c |
4664 |
++++ b/drivers/usb/class/cdc-acm.c |
4665 |
+@@ -779,20 +779,9 @@ static int acm_tty_write(struct tty_struct *tty, |
4666 |
+ } |
4667 |
+ |
4668 |
+ if (acm->susp_count) { |
4669 |
+- if (acm->putbuffer) { |
4670 |
+- /* now to preserve order */ |
4671 |
+- usb_anchor_urb(acm->putbuffer->urb, &acm->delayed); |
4672 |
+- acm->putbuffer = NULL; |
4673 |
+- } |
4674 |
+ usb_anchor_urb(wb->urb, &acm->delayed); |
4675 |
+ spin_unlock_irqrestore(&acm->write_lock, flags); |
4676 |
+ return count; |
4677 |
+- } else { |
4678 |
+- if (acm->putbuffer) { |
4679 |
+- /* at this point there is no good way to handle errors */ |
4680 |
+- acm_start_wb(acm, acm->putbuffer); |
4681 |
+- acm->putbuffer = NULL; |
4682 |
+- } |
4683 |
+ } |
4684 |
+ |
4685 |
+ stat = acm_start_wb(acm, wb); |
4686 |
+@@ -803,66 +792,6 @@ static int acm_tty_write(struct tty_struct *tty, |
4687 |
+ return count; |
4688 |
+ } |
4689 |
+ |
4690 |
+-static void acm_tty_flush_chars(struct tty_struct *tty) |
4691 |
+-{ |
4692 |
+- struct acm *acm = tty->driver_data; |
4693 |
+- struct acm_wb *cur; |
4694 |
+- int err; |
4695 |
+- unsigned long flags; |
4696 |
+- |
4697 |
+- spin_lock_irqsave(&acm->write_lock, flags); |
4698 |
+- |
4699 |
+- cur = acm->putbuffer; |
4700 |
+- if (!cur) /* nothing to do */ |
4701 |
+- goto out; |
4702 |
+- |
4703 |
+- acm->putbuffer = NULL; |
4704 |
+- err = usb_autopm_get_interface_async(acm->control); |
4705 |
+- if (err < 0) { |
4706 |
+- cur->use = 0; |
4707 |
+- acm->putbuffer = cur; |
4708 |
+- goto out; |
4709 |
+- } |
4710 |
+- |
4711 |
+- if (acm->susp_count) |
4712 |
+- usb_anchor_urb(cur->urb, &acm->delayed); |
4713 |
+- else |
4714 |
+- acm_start_wb(acm, cur); |
4715 |
+-out: |
4716 |
+- spin_unlock_irqrestore(&acm->write_lock, flags); |
4717 |
+- return; |
4718 |
+-} |
4719 |
+- |
4720 |
+-static int acm_tty_put_char(struct tty_struct *tty, unsigned char ch) |
4721 |
+-{ |
4722 |
+- struct acm *acm = tty->driver_data; |
4723 |
+- struct acm_wb *cur; |
4724 |
+- int wbn; |
4725 |
+- unsigned long flags; |
4726 |
+- |
4727 |
+-overflow: |
4728 |
+- cur = acm->putbuffer; |
4729 |
+- if (!cur) { |
4730 |
+- spin_lock_irqsave(&acm->write_lock, flags); |
4731 |
+- wbn = acm_wb_alloc(acm); |
4732 |
+- if (wbn >= 0) { |
4733 |
+- cur = &acm->wb[wbn]; |
4734 |
+- acm->putbuffer = cur; |
4735 |
+- } |
4736 |
+- spin_unlock_irqrestore(&acm->write_lock, flags); |
4737 |
+- if (!cur) |
4738 |
+- return 0; |
4739 |
+- } |
4740 |
+- |
4741 |
+- if (cur->len == acm->writesize) { |
4742 |
+- acm_tty_flush_chars(tty); |
4743 |
+- goto overflow; |
4744 |
+- } |
4745 |
+- |
4746 |
+- cur->buf[cur->len++] = ch; |
4747 |
+- return 1; |
4748 |
+-} |
4749 |
+- |
4750 |
+ static int acm_tty_write_room(struct tty_struct *tty) |
4751 |
+ { |
4752 |
+ struct acm *acm = tty->driver_data; |
4753 |
+@@ -1987,8 +1916,6 @@ static const struct tty_operations acm_ops = { |
4754 |
+ .cleanup = acm_tty_cleanup, |
4755 |
+ .hangup = acm_tty_hangup, |
4756 |
+ .write = acm_tty_write, |
4757 |
+- .put_char = acm_tty_put_char, |
4758 |
+- .flush_chars = acm_tty_flush_chars, |
4759 |
+ .write_room = acm_tty_write_room, |
4760 |
+ .ioctl = acm_tty_ioctl, |
4761 |
+ .throttle = acm_tty_throttle, |
4762 |
+diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h |
4763 |
+index eacc116e83da..ca06b20d7af9 100644 |
4764 |
+--- a/drivers/usb/class/cdc-acm.h |
4765 |
++++ b/drivers/usb/class/cdc-acm.h |
4766 |
+@@ -96,7 +96,6 @@ struct acm { |
4767 |
+ unsigned long read_urbs_free; |
4768 |
+ struct urb *read_urbs[ACM_NR]; |
4769 |
+ struct acm_rb read_buffers[ACM_NR]; |
4770 |
+- struct acm_wb *putbuffer; /* for acm_tty_put_char() */ |
4771 |
+ int rx_buflimit; |
4772 |
+ spinlock_t read_lock; |
4773 |
+ u8 *notification_buffer; /* to reassemble fragmented notifications */ |
4774 |
+diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c |
4775 |
+index a0d284ef3f40..632a2bfabc08 100644 |
4776 |
+--- a/drivers/usb/class/cdc-wdm.c |
4777 |
++++ b/drivers/usb/class/cdc-wdm.c |
4778 |
+@@ -458,7 +458,7 @@ static int service_outstanding_interrupt(struct wdm_device *desc) |
4779 |
+ |
4780 |
+ set_bit(WDM_RESPONDING, &desc->flags); |
4781 |
+ spin_unlock_irq(&desc->iuspin); |
4782 |
+- rv = usb_submit_urb(desc->response, GFP_KERNEL); |
4783 |
++ rv = usb_submit_urb(desc->response, GFP_ATOMIC); |
4784 |
+ spin_lock_irq(&desc->iuspin); |
4785 |
+ if (rv) { |
4786 |
+ dev_err(&desc->intf->dev, |
4787 |
+diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c |
4788 |
+index 66fe1b78d952..03432467b05f 100644 |
4789 |
+--- a/drivers/usb/core/hcd-pci.c |
4790 |
++++ b/drivers/usb/core/hcd-pci.c |
4791 |
+@@ -515,8 +515,6 @@ static int resume_common(struct device *dev, int event) |
4792 |
+ event == PM_EVENT_RESTORE); |
4793 |
+ if (retval) { |
4794 |
+ dev_err(dev, "PCI post-resume error %d!\n", retval); |
4795 |
+- if (hcd->shared_hcd) |
4796 |
+- usb_hc_died(hcd->shared_hcd); |
4797 |
+ usb_hc_died(hcd); |
4798 |
+ } |
4799 |
+ } |
4800 |
+diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c |
4801 |
+index 1a15392326fc..525ebd03cfe5 100644 |
4802 |
+--- a/drivers/usb/core/message.c |
4803 |
++++ b/drivers/usb/core/message.c |
4804 |
+@@ -1340,6 +1340,11 @@ void usb_enable_interface(struct usb_device *dev, |
4805 |
+ * is submitted that needs that bandwidth. Some other operating systems |
4806 |
+ * allocate bandwidth early, when a configuration is chosen. |
4807 |
+ * |
4808 |
++ * xHCI reserves bandwidth and configures the alternate setting in |
4809 |
++ * usb_hcd_alloc_bandwidth(). If it fails the original interface altsetting |
4810 |
++ * may be disabled. Drivers cannot rely on any particular alternate |
4811 |
++ * setting being in effect after a failure. |
4812 |
++ * |
4813 |
+ * This call is synchronous, and may not be used in an interrupt context. |
4814 |
+ * Also, drivers must not change altsettings while urbs are scheduled for |
4815 |
+ * endpoints in that interface; all such urbs must first be completed |
4816 |
+@@ -1375,6 +1380,12 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) |
4817 |
+ alternate); |
4818 |
+ return -EINVAL; |
4819 |
+ } |
4820 |
++ /* |
4821 |
++ * usb3 hosts configure the interface in usb_hcd_alloc_bandwidth, |
4822 |
++ * including freeing dropped endpoint ring buffers. |
4823 |
++ * Make sure the interface endpoints are flushed before that |
4824 |
++ */ |
4825 |
++ usb_disable_interface(dev, iface, false); |
4826 |
+ |
4827 |
+ /* Make sure we have enough bandwidth for this alternate interface. |
4828 |
+ * Remove the current alt setting and add the new alt setting. |
4829 |
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
4830 |
+index 097057d2eacf..e77dfe5ed5ec 100644 |
4831 |
+--- a/drivers/usb/core/quirks.c |
4832 |
++++ b/drivers/usb/core/quirks.c |
4833 |
+@@ -178,6 +178,10 @@ static const struct usb_device_id usb_quirk_list[] = { |
4834 |
+ /* CBM - Flash disk */ |
4835 |
+ { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME }, |
4836 |
+ |
4837 |
++ /* WORLDE Controller KS49 or Prodipe MIDI 49C USB controller */ |
4838 |
++ { USB_DEVICE(0x0218, 0x0201), .driver_info = |
4839 |
++ USB_QUIRK_CONFIG_INTF_STRINGS }, |
4840 |
++ |
4841 |
+ /* WORLDE easy key (easykey.25) MIDI controller */ |
4842 |
+ { USB_DEVICE(0x0218, 0x0401), .driver_info = |
4843 |
+ USB_QUIRK_CONFIG_INTF_STRINGS }, |
4844 |
+@@ -406,6 +410,9 @@ static const struct usb_device_id usb_quirk_list[] = { |
4845 |
+ { USB_DEVICE(0x2040, 0x7200), .driver_info = |
4846 |
+ USB_QUIRK_CONFIG_INTF_STRINGS }, |
4847 |
+ |
4848 |
++ /* DJI CineSSD */ |
4849 |
++ { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, |
4850 |
++ |
4851 |
+ /* INTEL VALUE SSD */ |
4852 |
+ { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, |
4853 |
+ |
4854 |
+diff --git a/drivers/usb/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h |
4855 |
+index db610c56f1d6..2aacd1afd9ff 100644 |
4856 |
+--- a/drivers/usb/dwc3/gadget.h |
4857 |
++++ b/drivers/usb/dwc3/gadget.h |
4858 |
+@@ -25,7 +25,7 @@ struct dwc3; |
4859 |
+ #define DWC3_DEPCFG_XFER_IN_PROGRESS_EN BIT(9) |
4860 |
+ #define DWC3_DEPCFG_XFER_NOT_READY_EN BIT(10) |
4861 |
+ #define DWC3_DEPCFG_FIFO_ERROR_EN BIT(11) |
4862 |
+-#define DWC3_DEPCFG_STREAM_EVENT_EN BIT(12) |
4863 |
++#define DWC3_DEPCFG_STREAM_EVENT_EN BIT(13) |
4864 |
+ #define DWC3_DEPCFG_BINTERVAL_M1(n) (((n) & 0xff) << 16) |
4865 |
+ #define DWC3_DEPCFG_STREAM_CAPABLE BIT(24) |
4866 |
+ #define DWC3_DEPCFG_EP_NUMBER(n) (((n) & 0x1f) << 25) |
4867 |
+diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c |
4868 |
+index 318246d8b2e2..b02ab2a8d927 100644 |
4869 |
+--- a/drivers/usb/gadget/udc/net2280.c |
4870 |
++++ b/drivers/usb/gadget/udc/net2280.c |
4871 |
+@@ -1545,11 +1545,14 @@ static int net2280_pullup(struct usb_gadget *_gadget, int is_on) |
4872 |
+ writel(tmp | BIT(USB_DETECT_ENABLE), &dev->usb->usbctl); |
4873 |
+ } else { |
4874 |
+ writel(tmp & ~BIT(USB_DETECT_ENABLE), &dev->usb->usbctl); |
4875 |
+- stop_activity(dev, dev->driver); |
4876 |
++ stop_activity(dev, NULL); |
4877 |
+ } |
4878 |
+ |
4879 |
+ spin_unlock_irqrestore(&dev->lock, flags); |
4880 |
+ |
4881 |
++ if (!is_on && dev->driver) |
4882 |
++ dev->driver->disconnect(&dev->gadget); |
4883 |
++ |
4884 |
+ return 0; |
4885 |
+ } |
4886 |
+ |
4887 |
+@@ -2466,8 +2469,11 @@ static void stop_activity(struct net2280 *dev, struct usb_gadget_driver *driver) |
4888 |
+ nuke(&dev->ep[i]); |
4889 |
+ |
4890 |
+ /* report disconnect; the driver is already quiesced */ |
4891 |
+- if (driver) |
4892 |
++ if (driver) { |
4893 |
++ spin_unlock(&dev->lock); |
4894 |
+ driver->disconnect(&dev->gadget); |
4895 |
++ spin_lock(&dev->lock); |
4896 |
++ } |
4897 |
+ |
4898 |
+ usb_reinit(dev); |
4899 |
+ } |
4900 |
+@@ -3341,6 +3347,8 @@ next_endpoints: |
4901 |
+ BIT(PCI_RETRY_ABORT_INTERRUPT)) |
4902 |
+ |
4903 |
+ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) |
4904 |
++__releases(dev->lock) |
4905 |
++__acquires(dev->lock) |
4906 |
+ { |
4907 |
+ struct net2280_ep *ep; |
4908 |
+ u32 tmp, num, mask, scratch; |
4909 |
+@@ -3381,12 +3389,14 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) |
4910 |
+ if (disconnect || reset) { |
4911 |
+ stop_activity(dev, dev->driver); |
4912 |
+ ep0_start(dev); |
4913 |
++ spin_unlock(&dev->lock); |
4914 |
+ if (reset) |
4915 |
+ usb_gadget_udc_reset |
4916 |
+ (&dev->gadget, dev->driver); |
4917 |
+ else |
4918 |
+ (dev->driver->disconnect) |
4919 |
+ (&dev->gadget); |
4920 |
++ spin_lock(&dev->lock); |
4921 |
+ return; |
4922 |
+ } |
4923 |
+ } |
4924 |
+@@ -3405,6 +3415,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) |
4925 |
+ tmp = BIT(SUSPEND_REQUEST_CHANGE_INTERRUPT); |
4926 |
+ if (stat & tmp) { |
4927 |
+ writel(tmp, &dev->regs->irqstat1); |
4928 |
++ spin_unlock(&dev->lock); |
4929 |
+ if (stat & BIT(SUSPEND_REQUEST_INTERRUPT)) { |
4930 |
+ if (dev->driver->suspend) |
4931 |
+ dev->driver->suspend(&dev->gadget); |
4932 |
+@@ -3415,6 +3426,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) |
4933 |
+ dev->driver->resume(&dev->gadget); |
4934 |
+ /* at high speed, note erratum 0133 */ |
4935 |
+ } |
4936 |
++ spin_lock(&dev->lock); |
4937 |
+ stat &= ~tmp; |
4938 |
+ } |
4939 |
+ |
4940 |
+diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c |
4941 |
+index 7cf98c793e04..5b5f1c8b47c9 100644 |
4942 |
+--- a/drivers/usb/gadget/udc/renesas_usb3.c |
4943 |
++++ b/drivers/usb/gadget/udc/renesas_usb3.c |
4944 |
+@@ -787,12 +787,15 @@ static void usb3_irq_epc_int_1_speed(struct renesas_usb3 *usb3) |
4945 |
+ switch (speed) { |
4946 |
+ case USB_STA_SPEED_SS: |
4947 |
+ usb3->gadget.speed = USB_SPEED_SUPER; |
4948 |
++ usb3->gadget.ep0->maxpacket = USB3_EP0_SS_MAX_PACKET_SIZE; |
4949 |
+ break; |
4950 |
+ case USB_STA_SPEED_HS: |
4951 |
+ usb3->gadget.speed = USB_SPEED_HIGH; |
4952 |
++ usb3->gadget.ep0->maxpacket = USB3_EP0_HSFS_MAX_PACKET_SIZE; |
4953 |
+ break; |
4954 |
+ case USB_STA_SPEED_FS: |
4955 |
+ usb3->gadget.speed = USB_SPEED_FULL; |
4956 |
++ usb3->gadget.ep0->maxpacket = USB3_EP0_HSFS_MAX_PACKET_SIZE; |
4957 |
+ break; |
4958 |
+ default: |
4959 |
+ usb3->gadget.speed = USB_SPEED_UNKNOWN; |
4960 |
+@@ -2451,7 +2454,7 @@ static int renesas_usb3_init_ep(struct renesas_usb3 *usb3, struct device *dev, |
4961 |
+ /* for control pipe */ |
4962 |
+ usb3->gadget.ep0 = &usb3_ep->ep; |
4963 |
+ usb_ep_set_maxpacket_limit(&usb3_ep->ep, |
4964 |
+- USB3_EP0_HSFS_MAX_PACKET_SIZE); |
4965 |
++ USB3_EP0_SS_MAX_PACKET_SIZE); |
4966 |
+ usb3_ep->ep.caps.type_control = true; |
4967 |
+ usb3_ep->ep.caps.dir_in = true; |
4968 |
+ usb3_ep->ep.caps.dir_out = true; |
4969 |
+diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c |
4970 |
+index 032b8652910a..02f8e08b3ee8 100644 |
4971 |
+--- a/drivers/usb/host/u132-hcd.c |
4972 |
++++ b/drivers/usb/host/u132-hcd.c |
4973 |
+@@ -2555,7 +2555,7 @@ static int u132_get_frame(struct usb_hcd *hcd) |
4974 |
+ } else { |
4975 |
+ int frame = 0; |
4976 |
+ dev_err(&u132->platform_dev->dev, "TODO: u132_get_frame\n"); |
4977 |
+- msleep(100); |
4978 |
++ mdelay(100); |
4979 |
+ return frame; |
4980 |
+ } |
4981 |
+ } |
4982 |
+diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c |
4983 |
+index ef350c33dc4a..b1f27aa38b10 100644 |
4984 |
+--- a/drivers/usb/host/xhci-mem.c |
4985 |
++++ b/drivers/usb/host/xhci-mem.c |
4986 |
+@@ -1613,6 +1613,10 @@ void xhci_endpoint_copy(struct xhci_hcd *xhci, |
4987 |
+ in_ep_ctx->ep_info2 = out_ep_ctx->ep_info2; |
4988 |
+ in_ep_ctx->deq = out_ep_ctx->deq; |
4989 |
+ in_ep_ctx->tx_info = out_ep_ctx->tx_info; |
4990 |
++ if (xhci->quirks & XHCI_MTK_HOST) { |
4991 |
++ in_ep_ctx->reserved[0] = out_ep_ctx->reserved[0]; |
4992 |
++ in_ep_ctx->reserved[1] = out_ep_ctx->reserved[1]; |
4993 |
++ } |
4994 |
+ } |
4995 |
+ |
4996 |
+ /* Copy output xhci_slot_ctx to the input xhci_slot_ctx. |
4997 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
4998 |
+index 68e6132aa8b2..c2220a7fc758 100644 |
4999 |
+--- a/drivers/usb/host/xhci.c |
5000 |
++++ b/drivers/usb/host/xhci.c |
5001 |
+@@ -37,6 +37,21 @@ static unsigned long long quirks; |
5002 |
+ module_param(quirks, ullong, S_IRUGO); |
5003 |
+ MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default"); |
5004 |
+ |
5005 |
++static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring) |
5006 |
++{ |
5007 |
++ struct xhci_segment *seg = ring->first_seg; |
5008 |
++ |
5009 |
++ if (!td || !td->start_seg) |
5010 |
++ return false; |
5011 |
++ do { |
5012 |
++ if (seg == td->start_seg) |
5013 |
++ return true; |
5014 |
++ seg = seg->next; |
5015 |
++ } while (seg && seg != ring->first_seg); |
5016 |
++ |
5017 |
++ return false; |
5018 |
++} |
5019 |
++ |
5020 |
+ /* TODO: copied from ehci-hcd.c - can this be refactored? */ |
5021 |
+ /* |
5022 |
+ * xhci_handshake - spin reading hc until handshake completes or fails |
5023 |
+@@ -1571,6 +1586,21 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) |
5024 |
+ goto done; |
5025 |
+ } |
5026 |
+ |
5027 |
++ /* |
5028 |
++ * check ring is not re-allocated since URB was enqueued. If it is, then |
5029 |
++ * make sure none of the ring related pointers in this URB private data |
5030 |
++ * are touched, such as td_list, otherwise we overwrite freed data |
5031 |
++ */ |
5032 |
++ if (!td_on_ring(&urb_priv->td[0], ep_ring)) { |
5033 |
++ xhci_err(xhci, "Canceled URB td not found on endpoint ring"); |
5034 |
++ for (i = urb_priv->num_tds_done; i < urb_priv->num_tds; i++) { |
5035 |
++ td = &urb_priv->td[i]; |
5036 |
++ if (!list_empty(&td->cancelled_td_list)) |
5037 |
++ list_del_init(&td->cancelled_td_list); |
5038 |
++ } |
5039 |
++ goto err_giveback; |
5040 |
++ } |
5041 |
++ |
5042 |
+ if (xhci->xhc_state & XHCI_STATE_HALTED) { |
5043 |
+ xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
5044 |
+ "HC halted, freeing TD manually."); |
5045 |
+diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c |
5046 |
+index de9a502491c2..69822852888a 100644 |
5047 |
+--- a/drivers/usb/misc/uss720.c |
5048 |
++++ b/drivers/usb/misc/uss720.c |
5049 |
+@@ -369,7 +369,7 @@ static unsigned char parport_uss720_frob_control(struct parport *pp, unsigned ch |
5050 |
+ mask &= 0x0f; |
5051 |
+ val &= 0x0f; |
5052 |
+ d = (priv->reg[1] & (~mask)) ^ val; |
5053 |
+- if (set_1284_register(pp, 2, d, GFP_KERNEL)) |
5054 |
++ if (set_1284_register(pp, 2, d, GFP_ATOMIC)) |
5055 |
+ return 0; |
5056 |
+ priv->reg[1] = d; |
5057 |
+ return d & 0xf; |
5058 |
+@@ -379,7 +379,7 @@ static unsigned char parport_uss720_read_status(struct parport *pp) |
5059 |
+ { |
5060 |
+ unsigned char ret; |
5061 |
+ |
5062 |
+- if (get_1284_register(pp, 1, &ret, GFP_KERNEL)) |
5063 |
++ if (get_1284_register(pp, 1, &ret, GFP_ATOMIC)) |
5064 |
+ return 0; |
5065 |
+ return ret & 0xf8; |
5066 |
+ } |
5067 |
+diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c |
5068 |
+index 3be40eaa1ac9..1232dd49556d 100644 |
5069 |
+--- a/drivers/usb/misc/yurex.c |
5070 |
++++ b/drivers/usb/misc/yurex.c |
5071 |
+@@ -421,13 +421,13 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer, |
5072 |
+ { |
5073 |
+ struct usb_yurex *dev; |
5074 |
+ int i, set = 0, retval = 0; |
5075 |
+- char buffer[16]; |
5076 |
++ char buffer[16 + 1]; |
5077 |
+ char *data = buffer; |
5078 |
+ unsigned long long c, c2 = 0; |
5079 |
+ signed long timeout = 0; |
5080 |
+ DEFINE_WAIT(wait); |
5081 |
+ |
5082 |
+- count = min(sizeof(buffer), count); |
5083 |
++ count = min(sizeof(buffer) - 1, count); |
5084 |
+ dev = file->private_data; |
5085 |
+ |
5086 |
+ /* verify that we actually have some data to write */ |
5087 |
+@@ -446,6 +446,7 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer, |
5088 |
+ retval = -EFAULT; |
5089 |
+ goto error; |
5090 |
+ } |
5091 |
++ buffer[count] = 0; |
5092 |
+ memset(dev->cntl_buffer, CMD_PADDING, YUREX_BUF_SIZE); |
5093 |
+ |
5094 |
+ switch (buffer[0]) { |
5095 |
+diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c |
5096 |
+index eecfd0671362..d045d8458f81 100644 |
5097 |
+--- a/drivers/usb/mtu3/mtu3_core.c |
5098 |
++++ b/drivers/usb/mtu3/mtu3_core.c |
5099 |
+@@ -107,8 +107,12 @@ static int mtu3_device_enable(struct mtu3 *mtu) |
5100 |
+ (SSUSB_U2_PORT_DIS | SSUSB_U2_PORT_PDN | |
5101 |
+ SSUSB_U2_PORT_HOST_SEL)); |
5102 |
+ |
5103 |
+- if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG) |
5104 |
++ if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG) { |
5105 |
+ mtu3_setbits(ibase, SSUSB_U2_CTRL(0), SSUSB_U2_PORT_OTG_SEL); |
5106 |
++ if (mtu->is_u3_ip) |
5107 |
++ mtu3_setbits(ibase, SSUSB_U3_CTRL(0), |
5108 |
++ SSUSB_U3_PORT_DUAL_MODE); |
5109 |
++ } |
5110 |
+ |
5111 |
+ return ssusb_check_clocks(mtu->ssusb, check_clk); |
5112 |
+ } |
5113 |
+diff --git a/drivers/usb/mtu3/mtu3_hw_regs.h b/drivers/usb/mtu3/mtu3_hw_regs.h |
5114 |
+index 6ee371478d89..a45bb253939f 100644 |
5115 |
+--- a/drivers/usb/mtu3/mtu3_hw_regs.h |
5116 |
++++ b/drivers/usb/mtu3/mtu3_hw_regs.h |
5117 |
+@@ -459,6 +459,7 @@ |
5118 |
+ |
5119 |
+ /* U3D_SSUSB_U3_CTRL_0P */ |
5120 |
+ #define SSUSB_U3_PORT_SSP_SPEED BIT(9) |
5121 |
++#define SSUSB_U3_PORT_DUAL_MODE BIT(7) |
5122 |
+ #define SSUSB_U3_PORT_HOST_SEL BIT(2) |
5123 |
+ #define SSUSB_U3_PORT_PDN BIT(1) |
5124 |
+ #define SSUSB_U3_PORT_DIS BIT(0) |
5125 |
+diff --git a/drivers/usb/serial/io_ti.h b/drivers/usb/serial/io_ti.h |
5126 |
+index e53c68261017..9bbcee37524e 100644 |
5127 |
+--- a/drivers/usb/serial/io_ti.h |
5128 |
++++ b/drivers/usb/serial/io_ti.h |
5129 |
+@@ -173,7 +173,7 @@ struct ump_interrupt { |
5130 |
+ } __attribute__((packed)); |
5131 |
+ |
5132 |
+ |
5133 |
+-#define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 4) - 3) |
5134 |
++#define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 6) & 0x01) |
5135 |
+ #define TIUMP_GET_FUNC_FROM_CODE(c) ((c) & 0x0f) |
5136 |
+ #define TIUMP_INTERRUPT_CODE_LSR 0x03 |
5137 |
+ #define TIUMP_INTERRUPT_CODE_MSR 0x04 |
5138 |
+diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c |
5139 |
+index 6b22857f6e52..58fc7964ee6b 100644 |
5140 |
+--- a/drivers/usb/serial/ti_usb_3410_5052.c |
5141 |
++++ b/drivers/usb/serial/ti_usb_3410_5052.c |
5142 |
+@@ -1119,7 +1119,7 @@ static void ti_break(struct tty_struct *tty, int break_state) |
5143 |
+ |
5144 |
+ static int ti_get_port_from_code(unsigned char code) |
5145 |
+ { |
5146 |
+- return (code >> 4) - 3; |
5147 |
++ return (code >> 6) & 0x01; |
5148 |
+ } |
5149 |
+ |
5150 |
+ static int ti_get_func_from_code(unsigned char code) |
5151 |
+diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c |
5152 |
+index c267f2812a04..e227bb5b794f 100644 |
5153 |
+--- a/drivers/usb/storage/scsiglue.c |
5154 |
++++ b/drivers/usb/storage/scsiglue.c |
5155 |
+@@ -376,6 +376,15 @@ static int queuecommand_lck(struct scsi_cmnd *srb, |
5156 |
+ return 0; |
5157 |
+ } |
5158 |
+ |
5159 |
++ if ((us->fflags & US_FL_NO_ATA_1X) && |
5160 |
++ (srb->cmnd[0] == ATA_12 || srb->cmnd[0] == ATA_16)) { |
5161 |
++ memcpy(srb->sense_buffer, usb_stor_sense_invalidCDB, |
5162 |
++ sizeof(usb_stor_sense_invalidCDB)); |
5163 |
++ srb->result = SAM_STAT_CHECK_CONDITION; |
5164 |
++ done(srb); |
5165 |
++ return 0; |
5166 |
++ } |
5167 |
++ |
5168 |
+ /* enqueue the command and wake up the control thread */ |
5169 |
+ srb->scsi_done = done; |
5170 |
+ us->srb = srb; |
5171 |
+diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c |
5172 |
+index 9e9de5452860..1f7b401c4d04 100644 |
5173 |
+--- a/drivers/usb/storage/uas.c |
5174 |
++++ b/drivers/usb/storage/uas.c |
5175 |
+@@ -842,6 +842,27 @@ static int uas_slave_configure(struct scsi_device *sdev) |
5176 |
+ sdev->skip_ms_page_8 = 1; |
5177 |
+ sdev->wce_default_on = 1; |
5178 |
+ } |
5179 |
++ |
5180 |
++ /* |
5181 |
++ * Some disks return the total number of blocks in response |
5182 |
++ * to READ CAPACITY rather than the highest block number. |
5183 |
++ * If this device makes that mistake, tell the sd driver. |
5184 |
++ */ |
5185 |
++ if (devinfo->flags & US_FL_FIX_CAPACITY) |
5186 |
++ sdev->fix_capacity = 1; |
5187 |
++ |
5188 |
++ /* |
5189 |
++ * Some devices don't like MODE SENSE with page=0x3f, |
5190 |
++ * which is the command used for checking if a device |
5191 |
++ * is write-protected. Now that we tell the sd driver |
5192 |
++ * to do a 192-byte transfer with this command the |
5193 |
++ * majority of devices work fine, but a few still can't |
5194 |
++ * handle it. The sd driver will simply assume those |
5195 |
++ * devices are write-enabled. |
5196 |
++ */ |
5197 |
++ if (devinfo->flags & US_FL_NO_WP_DETECT) |
5198 |
++ sdev->skip_ms_page_3f = 1; |
5199 |
++ |
5200 |
+ scsi_change_queue_depth(sdev, devinfo->qdepth - 2); |
5201 |
+ return 0; |
5202 |
+ } |
5203 |
+diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
5204 |
+index 22fcfccf453a..f7f83b21dc74 100644 |
5205 |
+--- a/drivers/usb/storage/unusual_devs.h |
5206 |
++++ b/drivers/usb/storage/unusual_devs.h |
5207 |
+@@ -2288,6 +2288,13 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, |
5208 |
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
5209 |
+ US_FL_GO_SLOW ), |
5210 |
+ |
5211 |
++/* Reported-by: Tim Anderson <tsa@×××××××××××××××.com> */ |
5212 |
++UNUSUAL_DEV( 0x2ca3, 0x0031, 0x0000, 0x9999, |
5213 |
++ "DJI", |
5214 |
++ "CineSSD", |
5215 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
5216 |
++ US_FL_NO_ATA_1X), |
5217 |
++ |
5218 |
+ /* |
5219 |
+ * Reported by Frederic Marchal <frederic.marchal@××××××××××.com> |
5220 |
+ * Mio Moov 330 |
5221 |
+diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c |
5222 |
+index 2510fa728d77..de119f11b78f 100644 |
5223 |
+--- a/drivers/video/fbdev/core/modedb.c |
5224 |
++++ b/drivers/video/fbdev/core/modedb.c |
5225 |
+@@ -644,7 +644,7 @@ static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info, |
5226 |
+ * |
5227 |
+ * Valid mode specifiers for @mode_option: |
5228 |
+ * |
5229 |
+- * <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m] or |
5230 |
++ * <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][p][m] or |
5231 |
+ * <name>[-<bpp>][@<refresh>] |
5232 |
+ * |
5233 |
+ * with <xres>, <yres>, <bpp> and <refresh> decimal numbers and |
5234 |
+@@ -653,10 +653,10 @@ static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info, |
5235 |
+ * If 'M' is present after yres (and before refresh/bpp if present), |
5236 |
+ * the function will compute the timings using VESA(tm) Coordinated |
5237 |
+ * Video Timings (CVT). If 'R' is present after 'M', will compute with |
5238 |
+- * reduced blanking (for flatpanels). If 'i' is present, compute |
5239 |
+- * interlaced mode. If 'm' is present, add margins equal to 1.8% |
5240 |
+- * of xres rounded down to 8 pixels, and 1.8% of yres. The char |
5241 |
+- * 'i' and 'm' must be after 'M' and 'R'. Example: |
5242 |
++ * reduced blanking (for flatpanels). If 'i' or 'p' are present, compute |
5243 |
++ * interlaced or progressive mode. If 'm' is present, add margins equal |
5244 |
++ * to 1.8% of xres rounded down to 8 pixels, and 1.8% of yres. The chars |
5245 |
++ * 'i', 'p' and 'm' must be after 'M' and 'R'. Example: |
5246 |
+ * |
5247 |
+ * 1024x768MR-8@60m - Reduced blank with margins at 60Hz. |
5248 |
+ * |
5249 |
+@@ -697,7 +697,8 @@ int fb_find_mode(struct fb_var_screeninfo *var, |
5250 |
+ unsigned int namelen = strlen(name); |
5251 |
+ int res_specified = 0, bpp_specified = 0, refresh_specified = 0; |
5252 |
+ unsigned int xres = 0, yres = 0, bpp = default_bpp, refresh = 0; |
5253 |
+- int yres_specified = 0, cvt = 0, rb = 0, interlace = 0; |
5254 |
++ int yres_specified = 0, cvt = 0, rb = 0; |
5255 |
++ int interlace_specified = 0, interlace = 0; |
5256 |
+ int margins = 0; |
5257 |
+ u32 best, diff, tdiff; |
5258 |
+ |
5259 |
+@@ -748,9 +749,17 @@ int fb_find_mode(struct fb_var_screeninfo *var, |
5260 |
+ if (!cvt) |
5261 |
+ margins = 1; |
5262 |
+ break; |
5263 |
++ case 'p': |
5264 |
++ if (!cvt) { |
5265 |
++ interlace = 0; |
5266 |
++ interlace_specified = 1; |
5267 |
++ } |
5268 |
++ break; |
5269 |
+ case 'i': |
5270 |
+- if (!cvt) |
5271 |
++ if (!cvt) { |
5272 |
+ interlace = 1; |
5273 |
++ interlace_specified = 1; |
5274 |
++ } |
5275 |
+ break; |
5276 |
+ default: |
5277 |
+ goto done; |
5278 |
+@@ -819,11 +828,21 @@ done: |
5279 |
+ if ((name_matches(db[i], name, namelen) || |
5280 |
+ (res_specified && res_matches(db[i], xres, yres))) && |
5281 |
+ !fb_try_mode(var, info, &db[i], bpp)) { |
5282 |
+- if (refresh_specified && db[i].refresh == refresh) |
5283 |
+- return 1; |
5284 |
++ const int db_interlace = (db[i].vmode & |
5285 |
++ FB_VMODE_INTERLACED ? 1 : 0); |
5286 |
++ int score = abs(db[i].refresh - refresh); |
5287 |
++ |
5288 |
++ if (interlace_specified) |
5289 |
++ score += abs(db_interlace - interlace); |
5290 |
++ |
5291 |
++ if (!interlace_specified || |
5292 |
++ db_interlace == interlace) |
5293 |
++ if (refresh_specified && |
5294 |
++ db[i].refresh == refresh) |
5295 |
++ return 1; |
5296 |
+ |
5297 |
+- if (abs(db[i].refresh - refresh) < diff) { |
5298 |
+- diff = abs(db[i].refresh - refresh); |
5299 |
++ if (score < diff) { |
5300 |
++ diff = score; |
5301 |
+ best = i; |
5302 |
+ } |
5303 |
+ } |
5304 |
+diff --git a/drivers/video/fbdev/goldfishfb.c b/drivers/video/fbdev/goldfishfb.c |
5305 |
+index 3b70044773b6..9fe7edf725c6 100644 |
5306 |
+--- a/drivers/video/fbdev/goldfishfb.c |
5307 |
++++ b/drivers/video/fbdev/goldfishfb.c |
5308 |
+@@ -301,6 +301,7 @@ static int goldfish_fb_remove(struct platform_device *pdev) |
5309 |
+ dma_free_coherent(&pdev->dev, framesize, (void *)fb->fb.screen_base, |
5310 |
+ fb->fb.fix.smem_start); |
5311 |
+ iounmap(fb->reg_base); |
5312 |
++ kfree(fb); |
5313 |
+ return 0; |
5314 |
+ } |
5315 |
+ |
5316 |
+diff --git a/drivers/video/fbdev/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c |
5317 |
+index 585f39efcff6..1c75f4806ed3 100644 |
5318 |
+--- a/drivers/video/fbdev/omap/omapfb_main.c |
5319 |
++++ b/drivers/video/fbdev/omap/omapfb_main.c |
5320 |
+@@ -958,7 +958,7 @@ int omapfb_register_client(struct omapfb_notifier_block *omapfb_nb, |
5321 |
+ { |
5322 |
+ int r; |
5323 |
+ |
5324 |
+- if ((unsigned)omapfb_nb->plane_idx > OMAPFB_PLANE_NUM) |
5325 |
++ if ((unsigned)omapfb_nb->plane_idx >= OMAPFB_PLANE_NUM) |
5326 |
+ return -EINVAL; |
5327 |
+ |
5328 |
+ if (!notifier_inited) { |
5329 |
+diff --git a/drivers/video/fbdev/omap2/omapfb/Makefile b/drivers/video/fbdev/omap2/omapfb/Makefile |
5330 |
+index 602edfed09df..f54c3f56b641 100644 |
5331 |
+--- a/drivers/video/fbdev/omap2/omapfb/Makefile |
5332 |
++++ b/drivers/video/fbdev/omap2/omapfb/Makefile |
5333 |
+@@ -2,5 +2,5 @@ |
5334 |
+ obj-$(CONFIG_OMAP2_VRFB) += vrfb.o |
5335 |
+ obj-y += dss/ |
5336 |
+ obj-y += displays/ |
5337 |
+-obj-$(CONFIG_FB_OMAP2) += omapfb.o |
5338 |
+-omapfb-y := omapfb-main.o omapfb-sysfs.o omapfb-ioctl.o |
5339 |
++obj-$(CONFIG_FB_OMAP2) += omap2fb.o |
5340 |
++omap2fb-y := omapfb-main.o omapfb-sysfs.o omapfb-ioctl.o |
5341 |
+diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c |
5342 |
+index 76722a59f55e..dfe382e68287 100644 |
5343 |
+--- a/drivers/video/fbdev/pxafb.c |
5344 |
++++ b/drivers/video/fbdev/pxafb.c |
5345 |
+@@ -2128,8 +2128,8 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp, |
5346 |
+ return -EINVAL; |
5347 |
+ |
5348 |
+ ret = -ENOMEM; |
5349 |
+- info->modes = kmalloc_array(timings->num_timings, |
5350 |
+- sizeof(info->modes[0]), GFP_KERNEL); |
5351 |
++ info->modes = kcalloc(timings->num_timings, sizeof(info->modes[0]), |
5352 |
++ GFP_KERNEL); |
5353 |
+ if (!info->modes) |
5354 |
+ goto out; |
5355 |
+ info->num_modes = timings->num_timings; |
5356 |
+diff --git a/drivers/video/fbdev/via/viafbdev.c b/drivers/video/fbdev/via/viafbdev.c |
5357 |
+index d2f785068ef4..7bb7e90b8f00 100644 |
5358 |
+--- a/drivers/video/fbdev/via/viafbdev.c |
5359 |
++++ b/drivers/video/fbdev/via/viafbdev.c |
5360 |
+@@ -19,6 +19,7 @@ |
5361 |
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
5362 |
+ */ |
5363 |
+ |
5364 |
++#include <linux/compiler.h> |
5365 |
+ #include <linux/module.h> |
5366 |
+ #include <linux/seq_file.h> |
5367 |
+ #include <linux/slab.h> |
5368 |
+@@ -1468,7 +1469,7 @@ static const struct file_operations viafb_vt1636_proc_fops = { |
5369 |
+ |
5370 |
+ #endif /* CONFIG_FB_VIA_DIRECT_PROCFS */ |
5371 |
+ |
5372 |
+-static int viafb_sup_odev_proc_show(struct seq_file *m, void *v) |
5373 |
++static int __maybe_unused viafb_sup_odev_proc_show(struct seq_file *m, void *v) |
5374 |
+ { |
5375 |
+ via_odev_to_seq(m, supported_odev_map[ |
5376 |
+ viaparinfo->shared->chip_info.gfx_chip_name]); |
5377 |
+diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c |
5378 |
+index 816cc921cf36..efae2fb0930a 100644 |
5379 |
+--- a/fs/binfmt_elf.c |
5380 |
++++ b/fs/binfmt_elf.c |
5381 |
+@@ -1751,7 +1751,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t, |
5382 |
+ const struct user_regset *regset = &view->regsets[i]; |
5383 |
+ do_thread_regset_writeback(t->task, regset); |
5384 |
+ if (regset->core_note_type && regset->get && |
5385 |
+- (!regset->active || regset->active(t->task, regset))) { |
5386 |
++ (!regset->active || regset->active(t->task, regset) > 0)) { |
5387 |
+ int ret; |
5388 |
+ size_t size = regset_size(t->task, regset); |
5389 |
+ void *data = kmalloc(size, GFP_KERNEL); |
5390 |
+diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c |
5391 |
+index eeab81c9452f..e169e1a5fd35 100644 |
5392 |
+--- a/fs/cifs/readdir.c |
5393 |
++++ b/fs/cifs/readdir.c |
5394 |
+@@ -376,8 +376,15 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level) |
5395 |
+ |
5396 |
+ new_entry = old_entry + sizeof(FIND_FILE_STANDARD_INFO) + |
5397 |
+ pfData->FileNameLength; |
5398 |
+- } else |
5399 |
+- new_entry = old_entry + le32_to_cpu(pDirInfo->NextEntryOffset); |
5400 |
++ } else { |
5401 |
++ u32 next_offset = le32_to_cpu(pDirInfo->NextEntryOffset); |
5402 |
++ |
5403 |
++ if (old_entry + next_offset < old_entry) { |
5404 |
++ cifs_dbg(VFS, "invalid offset %u\n", next_offset); |
5405 |
++ return NULL; |
5406 |
++ } |
5407 |
++ new_entry = old_entry + next_offset; |
5408 |
++ } |
5409 |
+ cifs_dbg(FYI, "new entry %p old entry %p\n", new_entry, old_entry); |
5410 |
+ /* validate that new_entry is not past end of SMB */ |
5411 |
+ if (new_entry >= end_of_smb) { |
5412 |
+diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c |
5413 |
+index 82be1dfeca33..29cce842ed04 100644 |
5414 |
+--- a/fs/cifs/smb2pdu.c |
5415 |
++++ b/fs/cifs/smb2pdu.c |
5416 |
+@@ -2418,14 +2418,14 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, |
5417 |
+ /* We check for obvious errors in the output buffer length and offset */ |
5418 |
+ if (*plen == 0) |
5419 |
+ goto ioctl_exit; /* server returned no data */ |
5420 |
+- else if (*plen > 0xFF00) { |
5421 |
++ else if (*plen > rsp_iov.iov_len || *plen > 0xFF00) { |
5422 |
+ cifs_dbg(VFS, "srv returned invalid ioctl length: %d\n", *plen); |
5423 |
+ *plen = 0; |
5424 |
+ rc = -EIO; |
5425 |
+ goto ioctl_exit; |
5426 |
+ } |
5427 |
+ |
5428 |
+- if (rsp_iov.iov_len < le32_to_cpu(rsp->OutputOffset) + *plen) { |
5429 |
++ if (rsp_iov.iov_len - *plen < le32_to_cpu(rsp->OutputOffset)) { |
5430 |
+ cifs_dbg(VFS, "Malformed ioctl resp: len %d offset %d\n", *plen, |
5431 |
+ le32_to_cpu(rsp->OutputOffset)); |
5432 |
+ *plen = 0; |
5433 |
+@@ -3492,33 +3492,38 @@ num_entries(char *bufstart, char *end_of_buf, char **lastentry, size_t size) |
5434 |
+ int len; |
5435 |
+ unsigned int entrycount = 0; |
5436 |
+ unsigned int next_offset = 0; |
5437 |
+- FILE_DIRECTORY_INFO *entryptr; |
5438 |
++ char *entryptr; |
5439 |
++ FILE_DIRECTORY_INFO *dir_info; |
5440 |
+ |
5441 |
+ if (bufstart == NULL) |
5442 |
+ return 0; |
5443 |
+ |
5444 |
+- entryptr = (FILE_DIRECTORY_INFO *)bufstart; |
5445 |
++ entryptr = bufstart; |
5446 |
+ |
5447 |
+ while (1) { |
5448 |
+- entryptr = (FILE_DIRECTORY_INFO *) |
5449 |
+- ((char *)entryptr + next_offset); |
5450 |
+- |
5451 |
+- if ((char *)entryptr + size > end_of_buf) { |
5452 |
++ if (entryptr + next_offset < entryptr || |
5453 |
++ entryptr + next_offset > end_of_buf || |
5454 |
++ entryptr + next_offset + size > end_of_buf) { |
5455 |
+ cifs_dbg(VFS, "malformed search entry would overflow\n"); |
5456 |
+ break; |
5457 |
+ } |
5458 |
+ |
5459 |
+- len = le32_to_cpu(entryptr->FileNameLength); |
5460 |
+- if ((char *)entryptr + len + size > end_of_buf) { |
5461 |
++ entryptr = entryptr + next_offset; |
5462 |
++ dir_info = (FILE_DIRECTORY_INFO *)entryptr; |
5463 |
++ |
5464 |
++ len = le32_to_cpu(dir_info->FileNameLength); |
5465 |
++ if (entryptr + len < entryptr || |
5466 |
++ entryptr + len > end_of_buf || |
5467 |
++ entryptr + len + size > end_of_buf) { |
5468 |
+ cifs_dbg(VFS, "directory entry name would overflow frame end of buf %p\n", |
5469 |
+ end_of_buf); |
5470 |
+ break; |
5471 |
+ } |
5472 |
+ |
5473 |
+- *lastentry = (char *)entryptr; |
5474 |
++ *lastentry = entryptr; |
5475 |
+ entrycount++; |
5476 |
+ |
5477 |
+- next_offset = le32_to_cpu(entryptr->NextEntryOffset); |
5478 |
++ next_offset = le32_to_cpu(dir_info->NextEntryOffset); |
5479 |
+ if (!next_offset) |
5480 |
+ break; |
5481 |
+ } |
5482 |
+diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c |
5483 |
+index 577cff24707b..39843fa7e11b 100644 |
5484 |
+--- a/fs/configfs/dir.c |
5485 |
++++ b/fs/configfs/dir.c |
5486 |
+@@ -1777,6 +1777,16 @@ void configfs_unregister_group(struct config_group *group) |
5487 |
+ struct dentry *dentry = group->cg_item.ci_dentry; |
5488 |
+ struct dentry *parent = group->cg_item.ci_parent->ci_dentry; |
5489 |
+ |
5490 |
++ mutex_lock(&subsys->su_mutex); |
5491 |
++ if (!group->cg_item.ci_parent->ci_group) { |
5492 |
++ /* |
5493 |
++ * The parent has already been unlinked and detached |
5494 |
++ * due to a rmdir. |
5495 |
++ */ |
5496 |
++ goto unlink_group; |
5497 |
++ } |
5498 |
++ mutex_unlock(&subsys->su_mutex); |
5499 |
++ |
5500 |
+ inode_lock_nested(d_inode(parent), I_MUTEX_PARENT); |
5501 |
+ spin_lock(&configfs_dirent_lock); |
5502 |
+ configfs_detach_prep(dentry, NULL); |
5503 |
+@@ -1791,6 +1801,7 @@ void configfs_unregister_group(struct config_group *group) |
5504 |
+ dput(dentry); |
5505 |
+ |
5506 |
+ mutex_lock(&subsys->su_mutex); |
5507 |
++unlink_group: |
5508 |
+ unlink_group(group); |
5509 |
+ mutex_unlock(&subsys->su_mutex); |
5510 |
+ } |
5511 |
+diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
5512 |
+index 128d489acebb..742147cbe759 100644 |
5513 |
+--- a/fs/f2fs/super.c |
5514 |
++++ b/fs/f2fs/super.c |
5515 |
+@@ -3106,9 +3106,19 @@ static struct dentry *f2fs_mount(struct file_system_type *fs_type, int flags, |
5516 |
+ static void kill_f2fs_super(struct super_block *sb) |
5517 |
+ { |
5518 |
+ if (sb->s_root) { |
5519 |
+- set_sbi_flag(F2FS_SB(sb), SBI_IS_CLOSE); |
5520 |
+- f2fs_stop_gc_thread(F2FS_SB(sb)); |
5521 |
+- f2fs_stop_discard_thread(F2FS_SB(sb)); |
5522 |
++ struct f2fs_sb_info *sbi = F2FS_SB(sb); |
5523 |
++ |
5524 |
++ set_sbi_flag(sbi, SBI_IS_CLOSE); |
5525 |
++ f2fs_stop_gc_thread(sbi); |
5526 |
++ f2fs_stop_discard_thread(sbi); |
5527 |
++ |
5528 |
++ if (is_sbi_flag_set(sbi, SBI_IS_DIRTY) || |
5529 |
++ !is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) { |
5530 |
++ struct cp_control cpc = { |
5531 |
++ .reason = CP_UMOUNT, |
5532 |
++ }; |
5533 |
++ f2fs_write_checkpoint(sbi, &cpc); |
5534 |
++ } |
5535 |
+ } |
5536 |
+ kill_block_super(sb); |
5537 |
+ } |
5538 |
+diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c |
5539 |
+index ed6699705c13..fd5bea55fd60 100644 |
5540 |
+--- a/fs/gfs2/bmap.c |
5541 |
++++ b/fs/gfs2/bmap.c |
5542 |
+@@ -2060,7 +2060,7 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset, |
5543 |
+ end_of_file = (i_size_read(&ip->i_inode) + sdp->sd_sb.sb_bsize - 1) >> shift; |
5544 |
+ lblock = offset >> shift; |
5545 |
+ lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift; |
5546 |
+- if (lblock_stop > end_of_file) |
5547 |
++ if (lblock_stop > end_of_file && ip != GFS2_I(sdp->sd_rindex)) |
5548 |
+ return 1; |
5549 |
+ |
5550 |
+ size = (lblock_stop - lblock) << shift; |
5551 |
+diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c |
5552 |
+index 33abcf29bc05..b86249ebde11 100644 |
5553 |
+--- a/fs/gfs2/rgrp.c |
5554 |
++++ b/fs/gfs2/rgrp.c |
5555 |
+@@ -1686,7 +1686,8 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext, |
5556 |
+ |
5557 |
+ while(1) { |
5558 |
+ bi = rbm_bi(rbm); |
5559 |
+- if (test_bit(GBF_FULL, &bi->bi_flags) && |
5560 |
++ if ((ip == NULL || !gfs2_rs_active(&ip->i_res)) && |
5561 |
++ test_bit(GBF_FULL, &bi->bi_flags) && |
5562 |
+ (state == GFS2_BLKST_FREE)) |
5563 |
+ goto next_bitmap; |
5564 |
+ |
5565 |
+diff --git a/fs/namespace.c b/fs/namespace.c |
5566 |
+index bd2f4c68506a..1949e0939d40 100644 |
5567 |
+--- a/fs/namespace.c |
5568 |
++++ b/fs/namespace.c |
5569 |
+@@ -446,10 +446,10 @@ int mnt_want_write_file_path(struct file *file) |
5570 |
+ { |
5571 |
+ int ret; |
5572 |
+ |
5573 |
+- sb_start_write(file->f_path.mnt->mnt_sb); |
5574 |
++ sb_start_write(file_inode(file)->i_sb); |
5575 |
+ ret = __mnt_want_write_file(file); |
5576 |
+ if (ret) |
5577 |
+- sb_end_write(file->f_path.mnt->mnt_sb); |
5578 |
++ sb_end_write(file_inode(file)->i_sb); |
5579 |
+ return ret; |
5580 |
+ } |
5581 |
+ |
5582 |
+@@ -540,7 +540,8 @@ void __mnt_drop_write_file(struct file *file) |
5583 |
+ |
5584 |
+ void mnt_drop_write_file_path(struct file *file) |
5585 |
+ { |
5586 |
+- mnt_drop_write(file->f_path.mnt); |
5587 |
++ __mnt_drop_write_file(file); |
5588 |
++ sb_end_write(file_inode(file)->i_sb); |
5589 |
+ } |
5590 |
+ |
5591 |
+ void mnt_drop_write_file(struct file *file) |
5592 |
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
5593 |
+index ff98e2a3f3cc..f688338b0482 100644 |
5594 |
+--- a/fs/nfs/nfs4proc.c |
5595 |
++++ b/fs/nfs/nfs4proc.c |
5596 |
+@@ -2642,14 +2642,18 @@ static void nfs41_check_delegation_stateid(struct nfs4_state *state) |
5597 |
+ } |
5598 |
+ |
5599 |
+ nfs4_stateid_copy(&stateid, &delegation->stateid); |
5600 |
+- if (test_bit(NFS_DELEGATION_REVOKED, &delegation->flags) || |
5601 |
+- !test_and_clear_bit(NFS_DELEGATION_TEST_EXPIRED, |
5602 |
+- &delegation->flags)) { |
5603 |
++ if (test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) { |
5604 |
+ rcu_read_unlock(); |
5605 |
+ nfs_finish_clear_delegation_stateid(state, &stateid); |
5606 |
+ return; |
5607 |
+ } |
5608 |
+ |
5609 |
++ if (!test_and_clear_bit(NFS_DELEGATION_TEST_EXPIRED, |
5610 |
++ &delegation->flags)) { |
5611 |
++ rcu_read_unlock(); |
5612 |
++ return; |
5613 |
++ } |
5614 |
++ |
5615 |
+ cred = get_rpccred(delegation->cred); |
5616 |
+ rcu_read_unlock(); |
5617 |
+ status = nfs41_test_and_free_expired_stateid(server, &stateid, cred); |
5618 |
+diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c |
5619 |
+index 2bf2eaa08ca7..3c18c12a5c4c 100644 |
5620 |
+--- a/fs/nfs/nfs4state.c |
5621 |
++++ b/fs/nfs/nfs4state.c |
5622 |
+@@ -1390,6 +1390,8 @@ int nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4_ |
5623 |
+ |
5624 |
+ if (!nfs4_state_mark_reclaim_nograce(clp, state)) |
5625 |
+ return -EBADF; |
5626 |
++ nfs_inode_find_delegation_state_and_recover(state->inode, |
5627 |
++ &state->stateid); |
5628 |
+ dprintk("%s: scheduling stateid recovery for server %s\n", __func__, |
5629 |
+ clp->cl_hostname); |
5630 |
+ nfs4_schedule_state_manager(clp); |
5631 |
+diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h |
5632 |
+index a275fba93170..708342f4692f 100644 |
5633 |
+--- a/fs/nfs/nfs4trace.h |
5634 |
++++ b/fs/nfs/nfs4trace.h |
5635 |
+@@ -1194,7 +1194,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event, |
5636 |
+ TP_fast_assign( |
5637 |
+ __entry->error = error; |
5638 |
+ __entry->fhandle = nfs_fhandle_hash(fhandle); |
5639 |
+- if (inode != NULL) { |
5640 |
++ if (!IS_ERR_OR_NULL(inode)) { |
5641 |
+ __entry->fileid = NFS_FILEID(inode); |
5642 |
+ __entry->dev = inode->i_sb->s_dev; |
5643 |
+ } else { |
5644 |
+diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c |
5645 |
+index 704b37311467..fa2121f877c1 100644 |
5646 |
+--- a/fs/overlayfs/super.c |
5647 |
++++ b/fs/overlayfs/super.c |
5648 |
+@@ -970,16 +970,6 @@ static int ovl_get_upper(struct ovl_fs *ofs, struct path *upperpath) |
5649 |
+ if (err) |
5650 |
+ goto out; |
5651 |
+ |
5652 |
+- err = -EBUSY; |
5653 |
+- if (ovl_inuse_trylock(upperpath->dentry)) { |
5654 |
+- ofs->upperdir_locked = true; |
5655 |
+- } else if (ofs->config.index) { |
5656 |
+- pr_err("overlayfs: upperdir is in-use by another mount, mount with '-o index=off' to override exclusive upperdir protection.\n"); |
5657 |
+- goto out; |
5658 |
+- } else { |
5659 |
+- pr_warn("overlayfs: upperdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n"); |
5660 |
+- } |
5661 |
+- |
5662 |
+ upper_mnt = clone_private_mount(upperpath); |
5663 |
+ err = PTR_ERR(upper_mnt); |
5664 |
+ if (IS_ERR(upper_mnt)) { |
5665 |
+@@ -990,6 +980,17 @@ static int ovl_get_upper(struct ovl_fs *ofs, struct path *upperpath) |
5666 |
+ /* Don't inherit atime flags */ |
5667 |
+ upper_mnt->mnt_flags &= ~(MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME); |
5668 |
+ ofs->upper_mnt = upper_mnt; |
5669 |
++ |
5670 |
++ err = -EBUSY; |
5671 |
++ if (ovl_inuse_trylock(ofs->upper_mnt->mnt_root)) { |
5672 |
++ ofs->upperdir_locked = true; |
5673 |
++ } else if (ofs->config.index) { |
5674 |
++ pr_err("overlayfs: upperdir is in-use by another mount, mount with '-o index=off' to override exclusive upperdir protection.\n"); |
5675 |
++ goto out; |
5676 |
++ } else { |
5677 |
++ pr_warn("overlayfs: upperdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n"); |
5678 |
++ } |
5679 |
++ |
5680 |
+ err = 0; |
5681 |
+ out: |
5682 |
+ return err; |
5683 |
+@@ -1089,8 +1090,10 @@ static int ovl_get_workdir(struct ovl_fs *ofs, struct path *upperpath) |
5684 |
+ goto out; |
5685 |
+ } |
5686 |
+ |
5687 |
++ ofs->workbasedir = dget(workpath.dentry); |
5688 |
++ |
5689 |
+ err = -EBUSY; |
5690 |
+- if (ovl_inuse_trylock(workpath.dentry)) { |
5691 |
++ if (ovl_inuse_trylock(ofs->workbasedir)) { |
5692 |
+ ofs->workdir_locked = true; |
5693 |
+ } else if (ofs->config.index) { |
5694 |
+ pr_err("overlayfs: workdir is in-use by another mount, mount with '-o index=off' to override exclusive workdir protection.\n"); |
5695 |
+@@ -1099,7 +1102,6 @@ static int ovl_get_workdir(struct ovl_fs *ofs, struct path *upperpath) |
5696 |
+ pr_warn("overlayfs: workdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n"); |
5697 |
+ } |
5698 |
+ |
5699 |
+- ofs->workbasedir = dget(workpath.dentry); |
5700 |
+ err = ovl_make_workdir(ofs, &workpath); |
5701 |
+ if (err) |
5702 |
+ goto out; |
5703 |
+diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c |
5704 |
+index 951a14edcf51..0792595ebcfb 100644 |
5705 |
+--- a/fs/pstore/ram_core.c |
5706 |
++++ b/fs/pstore/ram_core.c |
5707 |
+@@ -429,7 +429,12 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size, |
5708 |
+ vaddr = vmap(pages, page_count, VM_MAP, prot); |
5709 |
+ kfree(pages); |
5710 |
+ |
5711 |
+- return vaddr; |
5712 |
++ /* |
5713 |
++ * Since vmap() uses page granularity, we must add the offset |
5714 |
++ * into the page here, to get the byte granularity address |
5715 |
++ * into the mapping to represent the actual "start" location. |
5716 |
++ */ |
5717 |
++ return vaddr + offset_in_page(start); |
5718 |
+ } |
5719 |
+ |
5720 |
+ static void *persistent_ram_iomap(phys_addr_t start, size_t size, |
5721 |
+@@ -448,6 +453,11 @@ static void *persistent_ram_iomap(phys_addr_t start, size_t size, |
5722 |
+ else |
5723 |
+ va = ioremap_wc(start, size); |
5724 |
+ |
5725 |
++ /* |
5726 |
++ * Since request_mem_region() and ioremap() are byte-granularity |
5727 |
++ * there is no need handle anything special like we do when the |
5728 |
++ * vmap() case in persistent_ram_vmap() above. |
5729 |
++ */ |
5730 |
+ return va; |
5731 |
+ } |
5732 |
+ |
5733 |
+@@ -468,7 +478,7 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size, |
5734 |
+ return -ENOMEM; |
5735 |
+ } |
5736 |
+ |
5737 |
+- prz->buffer = prz->vaddr + offset_in_page(start); |
5738 |
++ prz->buffer = prz->vaddr; |
5739 |
+ prz->buffer_size = size - sizeof(struct persistent_ram_buffer); |
5740 |
+ |
5741 |
+ return 0; |
5742 |
+@@ -515,7 +525,8 @@ void persistent_ram_free(struct persistent_ram_zone *prz) |
5743 |
+ |
5744 |
+ if (prz->vaddr) { |
5745 |
+ if (pfn_valid(prz->paddr >> PAGE_SHIFT)) { |
5746 |
+- vunmap(prz->vaddr); |
5747 |
++ /* We must vunmap() at page-granularity. */ |
5748 |
++ vunmap(prz->vaddr - offset_in_page(prz->paddr)); |
5749 |
+ } else { |
5750 |
+ iounmap(prz->vaddr); |
5751 |
+ release_mem_region(prz->paddr, prz->size); |
5752 |
+diff --git a/include/linux/crypto.h b/include/linux/crypto.h |
5753 |
+index 6eb06101089f..e8839d3a7559 100644 |
5754 |
+--- a/include/linux/crypto.h |
5755 |
++++ b/include/linux/crypto.h |
5756 |
+@@ -112,6 +112,11 @@ |
5757 |
+ */ |
5758 |
+ #define CRYPTO_ALG_OPTIONAL_KEY 0x00004000 |
5759 |
+ |
5760 |
++/* |
5761 |
++ * Don't trigger module loading |
5762 |
++ */ |
5763 |
++#define CRYPTO_NOLOAD 0x00008000 |
5764 |
++ |
5765 |
+ /* |
5766 |
+ * Transform masks and values (for crt_flags). |
5767 |
+ */ |
5768 |
+diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h |
5769 |
+index 83957920653a..64f450593b54 100644 |
5770 |
+--- a/include/linux/mlx5/driver.h |
5771 |
++++ b/include/linux/mlx5/driver.h |
5772 |
+@@ -357,7 +357,7 @@ struct mlx5_frag_buf { |
5773 |
+ struct mlx5_frag_buf_ctrl { |
5774 |
+ struct mlx5_frag_buf frag_buf; |
5775 |
+ u32 sz_m1; |
5776 |
+- u32 frag_sz_m1; |
5777 |
++ u16 frag_sz_m1; |
5778 |
+ u32 strides_offset; |
5779 |
+ u8 log_sz; |
5780 |
+ u8 log_stride; |
5781 |
+@@ -1042,7 +1042,7 @@ int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn); |
5782 |
+ void mlx5_health_cleanup(struct mlx5_core_dev *dev); |
5783 |
+ int mlx5_health_init(struct mlx5_core_dev *dev); |
5784 |
+ void mlx5_start_health_poll(struct mlx5_core_dev *dev); |
5785 |
+-void mlx5_stop_health_poll(struct mlx5_core_dev *dev); |
5786 |
++void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health); |
5787 |
+ void mlx5_drain_health_wq(struct mlx5_core_dev *dev); |
5788 |
+ void mlx5_trigger_health_work(struct mlx5_core_dev *dev); |
5789 |
+ void mlx5_drain_health_recovery(struct mlx5_core_dev *dev); |
5790 |
+diff --git a/include/linux/of.h b/include/linux/of.h |
5791 |
+index 4d25e4f952d9..b99a1a8c2952 100644 |
5792 |
+--- a/include/linux/of.h |
5793 |
++++ b/include/linux/of.h |
5794 |
+@@ -290,6 +290,8 @@ extern struct device_node *of_get_next_child(const struct device_node *node, |
5795 |
+ extern struct device_node *of_get_next_available_child( |
5796 |
+ const struct device_node *node, struct device_node *prev); |
5797 |
+ |
5798 |
++extern struct device_node *of_get_compatible_child(const struct device_node *parent, |
5799 |
++ const char *compatible); |
5800 |
+ extern struct device_node *of_get_child_by_name(const struct device_node *node, |
5801 |
+ const char *name); |
5802 |
+ |
5803 |
+@@ -632,6 +634,12 @@ static inline bool of_have_populated_dt(void) |
5804 |
+ return false; |
5805 |
+ } |
5806 |
+ |
5807 |
++static inline struct device_node *of_get_compatible_child(const struct device_node *parent, |
5808 |
++ const char *compatible) |
5809 |
++{ |
5810 |
++ return NULL; |
5811 |
++} |
5812 |
++ |
5813 |
+ static inline struct device_node *of_get_child_by_name( |
5814 |
+ const struct device_node *node, |
5815 |
+ const char *name) |
5816 |
+diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c |
5817 |
+index c17c0c268436..dce35e16bff4 100644 |
5818 |
+--- a/kernel/audit_watch.c |
5819 |
++++ b/kernel/audit_watch.c |
5820 |
+@@ -419,6 +419,13 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list) |
5821 |
+ struct path parent_path; |
5822 |
+ int h, ret = 0; |
5823 |
+ |
5824 |
++ /* |
5825 |
++ * When we will be calling audit_add_to_parent, krule->watch might have |
5826 |
++ * been updated and watch might have been freed. |
5827 |
++ * So we need to keep a reference of watch. |
5828 |
++ */ |
5829 |
++ audit_get_watch(watch); |
5830 |
++ |
5831 |
+ mutex_unlock(&audit_filter_mutex); |
5832 |
+ |
5833 |
+ /* Avoid calling path_lookup under audit_filter_mutex. */ |
5834 |
+@@ -427,8 +434,10 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list) |
5835 |
+ /* caller expects mutex locked */ |
5836 |
+ mutex_lock(&audit_filter_mutex); |
5837 |
+ |
5838 |
+- if (ret) |
5839 |
++ if (ret) { |
5840 |
++ audit_put_watch(watch); |
5841 |
+ return ret; |
5842 |
++ } |
5843 |
+ |
5844 |
+ /* either find an old parent or attach a new one */ |
5845 |
+ parent = audit_find_parent(d_backing_inode(parent_path.dentry)); |
5846 |
+@@ -446,6 +455,7 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list) |
5847 |
+ *list = &audit_inode_hash[h]; |
5848 |
+ error: |
5849 |
+ path_put(&parent_path); |
5850 |
++ audit_put_watch(watch); |
5851 |
+ return ret; |
5852 |
+ } |
5853 |
+ |
5854 |
+diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c |
5855 |
+index 3d83ee7df381..badabb0b435c 100644 |
5856 |
+--- a/kernel/bpf/cgroup.c |
5857 |
++++ b/kernel/bpf/cgroup.c |
5858 |
+@@ -95,7 +95,7 @@ static int compute_effective_progs(struct cgroup *cgrp, |
5859 |
+ enum bpf_attach_type type, |
5860 |
+ struct bpf_prog_array __rcu **array) |
5861 |
+ { |
5862 |
+- struct bpf_prog_array __rcu *progs; |
5863 |
++ struct bpf_prog_array *progs; |
5864 |
+ struct bpf_prog_list *pl; |
5865 |
+ struct cgroup *p = cgrp; |
5866 |
+ int cnt = 0; |
5867 |
+@@ -120,13 +120,12 @@ static int compute_effective_progs(struct cgroup *cgrp, |
5868 |
+ &p->bpf.progs[type], node) { |
5869 |
+ if (!pl->prog) |
5870 |
+ continue; |
5871 |
+- rcu_dereference_protected(progs, 1)-> |
5872 |
+- progs[cnt++] = pl->prog; |
5873 |
++ progs->progs[cnt++] = pl->prog; |
5874 |
+ } |
5875 |
+ p = cgroup_parent(p); |
5876 |
+ } while (p); |
5877 |
+ |
5878 |
+- *array = progs; |
5879 |
++ rcu_assign_pointer(*array, progs); |
5880 |
+ return 0; |
5881 |
+ } |
5882 |
+ |
5883 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
5884 |
+index eec2d5fb676b..c7b3e34811ec 100644 |
5885 |
+--- a/kernel/events/core.c |
5886 |
++++ b/kernel/events/core.c |
5887 |
+@@ -5948,6 +5948,7 @@ perf_output_sample_ustack(struct perf_output_handle *handle, u64 dump_size, |
5888 |
+ unsigned long sp; |
5889 |
+ unsigned int rem; |
5890 |
+ u64 dyn_size; |
5891 |
++ mm_segment_t fs; |
5892 |
+ |
5893 |
+ /* |
5894 |
+ * We dump: |
5895 |
+@@ -5965,7 +5966,10 @@ perf_output_sample_ustack(struct perf_output_handle *handle, u64 dump_size, |
5896 |
+ |
5897 |
+ /* Data. */ |
5898 |
+ sp = perf_user_stack_pointer(regs); |
5899 |
++ fs = get_fs(); |
5900 |
++ set_fs(USER_DS); |
5901 |
+ rem = __output_copy_user(handle, (void *) sp, dump_size); |
5902 |
++ set_fs(fs); |
5903 |
+ dyn_size = dump_size - rem; |
5904 |
+ |
5905 |
+ perf_output_skip(handle, rem); |
5906 |
+diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c |
5907 |
+index 42fcb7f05fac..f42cf69ef539 100644 |
5908 |
+--- a/kernel/rcu/rcutorture.c |
5909 |
++++ b/kernel/rcu/rcutorture.c |
5910 |
+@@ -1446,7 +1446,7 @@ static int rcu_torture_stall(void *args) |
5911 |
+ VERBOSE_TOROUT_STRING("rcu_torture_stall end holdoff"); |
5912 |
+ } |
5913 |
+ if (!kthread_should_stop()) { |
5914 |
+- stop_at = get_seconds() + stall_cpu; |
5915 |
++ stop_at = ktime_get_seconds() + stall_cpu; |
5916 |
+ /* RCU CPU stall is expected behavior in following code. */ |
5917 |
+ rcu_read_lock(); |
5918 |
+ if (stall_cpu_irqsoff) |
5919 |
+@@ -1455,7 +1455,8 @@ static int rcu_torture_stall(void *args) |
5920 |
+ preempt_disable(); |
5921 |
+ pr_alert("rcu_torture_stall start on CPU %d.\n", |
5922 |
+ smp_processor_id()); |
5923 |
+- while (ULONG_CMP_LT(get_seconds(), stop_at)) |
5924 |
++ while (ULONG_CMP_LT((unsigned long)ktime_get_seconds(), |
5925 |
++ stop_at)) |
5926 |
+ continue; /* Induce RCU CPU stall warning. */ |
5927 |
+ if (stall_cpu_irqsoff) |
5928 |
+ local_irq_enable(); |
5929 |
+diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
5930 |
+index 9c219f7b0970..478d9d3e6be9 100644 |
5931 |
+--- a/kernel/sched/fair.c |
5932 |
++++ b/kernel/sched/fair.c |
5933 |
+@@ -735,11 +735,12 @@ static void attach_entity_cfs_rq(struct sched_entity *se); |
5934 |
+ * To solve this problem, we also cap the util_avg of successive tasks to |
5935 |
+ * only 1/2 of the left utilization budget: |
5936 |
+ * |
5937 |
+- * util_avg_cap = (1024 - cfs_rq->avg.util_avg) / 2^n |
5938 |
++ * util_avg_cap = (cpu_scale - cfs_rq->avg.util_avg) / 2^n |
5939 |
+ * |
5940 |
+- * where n denotes the nth task. |
5941 |
++ * where n denotes the nth task and cpu_scale the CPU capacity. |
5942 |
+ * |
5943 |
+- * For example, a simplest series from the beginning would be like: |
5944 |
++ * For example, for a CPU with 1024 of capacity, a simplest series from |
5945 |
++ * the beginning would be like: |
5946 |
+ * |
5947 |
+ * task util_avg: 512, 256, 128, 64, 32, 16, 8, ... |
5948 |
+ * cfs_rq util_avg: 512, 768, 896, 960, 992, 1008, 1016, ... |
5949 |
+@@ -751,7 +752,8 @@ void post_init_entity_util_avg(struct sched_entity *se) |
5950 |
+ { |
5951 |
+ struct cfs_rq *cfs_rq = cfs_rq_of(se); |
5952 |
+ struct sched_avg *sa = &se->avg; |
5953 |
+- long cap = (long)(SCHED_CAPACITY_SCALE - cfs_rq->avg.util_avg) / 2; |
5954 |
++ long cpu_scale = arch_scale_cpu_capacity(NULL, cpu_of(rq_of(cfs_rq))); |
5955 |
++ long cap = (long)(cpu_scale - cfs_rq->avg.util_avg) / 2; |
5956 |
+ |
5957 |
+ if (cap > 0) { |
5958 |
+ if (cfs_rq->avg.util_avg != 0) { |
5959 |
+diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c |
5960 |
+index 928be527477e..a7a2aaa3026a 100644 |
5961 |
+--- a/kernel/sched/wait.c |
5962 |
++++ b/kernel/sched/wait.c |
5963 |
+@@ -392,35 +392,36 @@ static inline bool is_kthread_should_stop(void) |
5964 |
+ * if (condition) |
5965 |
+ * break; |
5966 |
+ * |
5967 |
+- * p->state = mode; condition = true; |
5968 |
+- * smp_mb(); // A smp_wmb(); // C |
5969 |
+- * if (!wq_entry->flags & WQ_FLAG_WOKEN) wq_entry->flags |= WQ_FLAG_WOKEN; |
5970 |
+- * schedule() try_to_wake_up(); |
5971 |
+- * p->state = TASK_RUNNING; ~~~~~~~~~~~~~~~~~~ |
5972 |
+- * wq_entry->flags &= ~WQ_FLAG_WOKEN; condition = true; |
5973 |
+- * smp_mb() // B smp_wmb(); // C |
5974 |
+- * wq_entry->flags |= WQ_FLAG_WOKEN; |
5975 |
+- * } |
5976 |
+- * remove_wait_queue(&wq_head, &wait); |
5977 |
++ * // in wait_woken() // in woken_wake_function() |
5978 |
+ * |
5979 |
++ * p->state = mode; wq_entry->flags |= WQ_FLAG_WOKEN; |
5980 |
++ * smp_mb(); // A try_to_wake_up(): |
5981 |
++ * if (!(wq_entry->flags & WQ_FLAG_WOKEN)) <full barrier> |
5982 |
++ * schedule() if (p->state & mode) |
5983 |
++ * p->state = TASK_RUNNING; p->state = TASK_RUNNING; |
5984 |
++ * wq_entry->flags &= ~WQ_FLAG_WOKEN; ~~~~~~~~~~~~~~~~~~ |
5985 |
++ * smp_mb(); // B condition = true; |
5986 |
++ * } smp_mb(); // C |
5987 |
++ * remove_wait_queue(&wq_head, &wait); wq_entry->flags |= WQ_FLAG_WOKEN; |
5988 |
+ */ |
5989 |
+ long wait_woken(struct wait_queue_entry *wq_entry, unsigned mode, long timeout) |
5990 |
+ { |
5991 |
+- set_current_state(mode); /* A */ |
5992 |
+ /* |
5993 |
+- * The above implies an smp_mb(), which matches with the smp_wmb() from |
5994 |
+- * woken_wake_function() such that if we observe WQ_FLAG_WOKEN we must |
5995 |
+- * also observe all state before the wakeup. |
5996 |
++ * The below executes an smp_mb(), which matches with the full barrier |
5997 |
++ * executed by the try_to_wake_up() in woken_wake_function() such that |
5998 |
++ * either we see the store to wq_entry->flags in woken_wake_function() |
5999 |
++ * or woken_wake_function() sees our store to current->state. |
6000 |
+ */ |
6001 |
++ set_current_state(mode); /* A */ |
6002 |
+ if (!(wq_entry->flags & WQ_FLAG_WOKEN) && !is_kthread_should_stop()) |
6003 |
+ timeout = schedule_timeout(timeout); |
6004 |
+ __set_current_state(TASK_RUNNING); |
6005 |
+ |
6006 |
+ /* |
6007 |
+- * The below implies an smp_mb(), it too pairs with the smp_wmb() from |
6008 |
+- * woken_wake_function() such that we must either observe the wait |
6009 |
+- * condition being true _OR_ WQ_FLAG_WOKEN such that we will not miss |
6010 |
+- * an event. |
6011 |
++ * The below executes an smp_mb(), which matches with the smp_mb() (C) |
6012 |
++ * in woken_wake_function() such that either we see the wait condition |
6013 |
++ * being true or the store to wq_entry->flags in woken_wake_function() |
6014 |
++ * follows ours in the coherence order. |
6015 |
+ */ |
6016 |
+ smp_store_mb(wq_entry->flags, wq_entry->flags & ~WQ_FLAG_WOKEN); /* B */ |
6017 |
+ |
6018 |
+@@ -430,14 +431,8 @@ EXPORT_SYMBOL(wait_woken); |
6019 |
+ |
6020 |
+ int woken_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key) |
6021 |
+ { |
6022 |
+- /* |
6023 |
+- * Although this function is called under waitqueue lock, LOCK |
6024 |
+- * doesn't imply write barrier and the users expects write |
6025 |
+- * barrier semantics on wakeup functions. The following |
6026 |
+- * smp_wmb() is equivalent to smp_wmb() in try_to_wake_up() |
6027 |
+- * and is paired with smp_store_mb() in wait_woken(). |
6028 |
+- */ |
6029 |
+- smp_wmb(); /* C */ |
6030 |
++ /* Pairs with the smp_store_mb() in wait_woken(). */ |
6031 |
++ smp_mb(); /* C */ |
6032 |
+ wq_entry->flags |= WQ_FLAG_WOKEN; |
6033 |
+ |
6034 |
+ return default_wake_function(wq_entry, mode, sync, key); |
6035 |
+diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c |
6036 |
+index 3264e1873219..deacc52d7ff1 100644 |
6037 |
+--- a/net/bluetooth/af_bluetooth.c |
6038 |
++++ b/net/bluetooth/af_bluetooth.c |
6039 |
+@@ -159,7 +159,7 @@ void bt_accept_enqueue(struct sock *parent, struct sock *sk) |
6040 |
+ BT_DBG("parent %p, sk %p", parent, sk); |
6041 |
+ |
6042 |
+ sock_hold(sk); |
6043 |
+- lock_sock(sk); |
6044 |
++ lock_sock_nested(sk, SINGLE_DEPTH_NESTING); |
6045 |
+ list_add_tail(&bt_sk(sk)->accept_q, &bt_sk(parent)->accept_q); |
6046 |
+ bt_sk(sk)->parent = parent; |
6047 |
+ release_sock(sk); |
6048 |
+diff --git a/net/core/skbuff.c b/net/core/skbuff.c |
6049 |
+index fb35b62af272..3680912f056a 100644 |
6050 |
+--- a/net/core/skbuff.c |
6051 |
++++ b/net/core/skbuff.c |
6052 |
+@@ -939,9 +939,6 @@ struct ubuf_info *sock_zerocopy_alloc(struct sock *sk, size_t size) |
6053 |
+ |
6054 |
+ WARN_ON_ONCE(!in_task()); |
6055 |
+ |
6056 |
+- if (!sock_flag(sk, SOCK_ZEROCOPY)) |
6057 |
+- return NULL; |
6058 |
+- |
6059 |
+ skb = sock_omalloc(sk, 0, GFP_KERNEL); |
6060 |
+ if (!skb) |
6061 |
+ return NULL; |
6062 |
+diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c |
6063 |
+index 055f4bbba86b..41883c34a385 100644 |
6064 |
+--- a/net/ipv4/ip_gre.c |
6065 |
++++ b/net/ipv4/ip_gre.c |
6066 |
+@@ -178,6 +178,9 @@ static void ipgre_err(struct sk_buff *skb, u32 info, |
6067 |
+ |
6068 |
+ if (tpi->proto == htons(ETH_P_TEB)) |
6069 |
+ itn = net_generic(net, gre_tap_net_id); |
6070 |
++ else if (tpi->proto == htons(ETH_P_ERSPAN) || |
6071 |
++ tpi->proto == htons(ETH_P_ERSPAN2)) |
6072 |
++ itn = net_generic(net, erspan_net_id); |
6073 |
+ else |
6074 |
+ itn = net_generic(net, ipgre_net_id); |
6075 |
+ |
6076 |
+@@ -328,6 +331,8 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, |
6077 |
+ ip_tunnel_rcv(tunnel, skb, tpi, tun_dst, log_ecn_error); |
6078 |
+ return PACKET_RCVD; |
6079 |
+ } |
6080 |
++ return PACKET_REJECT; |
6081 |
++ |
6082 |
+ drop: |
6083 |
+ kfree_skb(skb); |
6084 |
+ return PACKET_RCVD; |
6085 |
+diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c |
6086 |
+index 4491faf83f4f..086201d96d54 100644 |
6087 |
+--- a/net/ipv4/tcp.c |
6088 |
++++ b/net/ipv4/tcp.c |
6089 |
+@@ -1186,7 +1186,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) |
6090 |
+ |
6091 |
+ flags = msg->msg_flags; |
6092 |
+ |
6093 |
+- if (flags & MSG_ZEROCOPY && size) { |
6094 |
++ if (flags & MSG_ZEROCOPY && size && sock_flag(sk, SOCK_ZEROCOPY)) { |
6095 |
+ if (sk->sk_state != TCP_ESTABLISHED) { |
6096 |
+ err = -EINVAL; |
6097 |
+ goto out_err; |
6098 |
+diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c |
6099 |
+index bdf6fa78d0d2..aa082b71d2e4 100644 |
6100 |
+--- a/net/mac80211/cfg.c |
6101 |
++++ b/net/mac80211/cfg.c |
6102 |
+@@ -495,7 +495,7 @@ static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, |
6103 |
+ goto out_unlock; |
6104 |
+ } |
6105 |
+ |
6106 |
+- ieee80211_key_free(key, true); |
6107 |
++ ieee80211_key_free(key, sdata->vif.type == NL80211_IFTYPE_STATION); |
6108 |
+ |
6109 |
+ ret = 0; |
6110 |
+ out_unlock: |
6111 |
+diff --git a/net/mac80211/key.c b/net/mac80211/key.c |
6112 |
+index ee0d0cc8dc3b..c054ac85793c 100644 |
6113 |
+--- a/net/mac80211/key.c |
6114 |
++++ b/net/mac80211/key.c |
6115 |
+@@ -656,11 +656,15 @@ int ieee80211_key_link(struct ieee80211_key *key, |
6116 |
+ { |
6117 |
+ struct ieee80211_local *local = sdata->local; |
6118 |
+ struct ieee80211_key *old_key; |
6119 |
+- int idx, ret; |
6120 |
+- bool pairwise; |
6121 |
+- |
6122 |
+- pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE; |
6123 |
+- idx = key->conf.keyidx; |
6124 |
++ int idx = key->conf.keyidx; |
6125 |
++ bool pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE; |
6126 |
++ /* |
6127 |
++ * We want to delay tailroom updates only for station - in that |
6128 |
++ * case it helps roaming speed, but in other cases it hurts and |
6129 |
++ * can cause warnings to appear. |
6130 |
++ */ |
6131 |
++ bool delay_tailroom = sdata->vif.type == NL80211_IFTYPE_STATION; |
6132 |
++ int ret; |
6133 |
+ |
6134 |
+ mutex_lock(&sdata->local->key_mtx); |
6135 |
+ |
6136 |
+@@ -688,14 +692,14 @@ int ieee80211_key_link(struct ieee80211_key *key, |
6137 |
+ increment_tailroom_need_count(sdata); |
6138 |
+ |
6139 |
+ ieee80211_key_replace(sdata, sta, pairwise, old_key, key); |
6140 |
+- ieee80211_key_destroy(old_key, true); |
6141 |
++ ieee80211_key_destroy(old_key, delay_tailroom); |
6142 |
+ |
6143 |
+ ieee80211_debugfs_key_add(key); |
6144 |
+ |
6145 |
+ if (!local->wowlan) { |
6146 |
+ ret = ieee80211_key_enable_hw_accel(key); |
6147 |
+ if (ret) |
6148 |
+- ieee80211_key_free(key, true); |
6149 |
++ ieee80211_key_free(key, delay_tailroom); |
6150 |
+ } else { |
6151 |
+ ret = 0; |
6152 |
+ } |
6153 |
+@@ -930,7 +934,8 @@ void ieee80211_free_sta_keys(struct ieee80211_local *local, |
6154 |
+ ieee80211_key_replace(key->sdata, key->sta, |
6155 |
+ key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, |
6156 |
+ key, NULL); |
6157 |
+- __ieee80211_key_destroy(key, true); |
6158 |
++ __ieee80211_key_destroy(key, key->sdata->vif.type == |
6159 |
++ NL80211_IFTYPE_STATION); |
6160 |
+ } |
6161 |
+ |
6162 |
+ for (i = 0; i < NUM_DEFAULT_KEYS; i++) { |
6163 |
+@@ -940,7 +945,8 @@ void ieee80211_free_sta_keys(struct ieee80211_local *local, |
6164 |
+ ieee80211_key_replace(key->sdata, key->sta, |
6165 |
+ key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, |
6166 |
+ key, NULL); |
6167 |
+- __ieee80211_key_destroy(key, true); |
6168 |
++ __ieee80211_key_destroy(key, key->sdata->vif.type == |
6169 |
++ NL80211_IFTYPE_STATION); |
6170 |
+ } |
6171 |
+ |
6172 |
+ mutex_unlock(&local->key_mtx); |
6173 |
+diff --git a/net/rds/bind.c b/net/rds/bind.c |
6174 |
+index 5aa3a64aa4f0..48257d3a4201 100644 |
6175 |
+--- a/net/rds/bind.c |
6176 |
++++ b/net/rds/bind.c |
6177 |
+@@ -60,11 +60,13 @@ struct rds_sock *rds_find_bound(__be32 addr, __be16 port) |
6178 |
+ u64 key = ((u64)addr << 32) | port; |
6179 |
+ struct rds_sock *rs; |
6180 |
+ |
6181 |
+- rs = rhashtable_lookup_fast(&bind_hash_table, &key, ht_parms); |
6182 |
++ rcu_read_lock(); |
6183 |
++ rs = rhashtable_lookup(&bind_hash_table, &key, ht_parms); |
6184 |
+ if (rs && !sock_flag(rds_rs_to_sk(rs), SOCK_DEAD)) |
6185 |
+ rds_sock_addref(rs); |
6186 |
+ else |
6187 |
+ rs = NULL; |
6188 |
++ rcu_read_unlock(); |
6189 |
+ |
6190 |
+ rdsdebug("returning rs %p for %pI4:%u\n", rs, &addr, |
6191 |
+ ntohs(port)); |
6192 |
+@@ -157,6 +159,7 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
6193 |
+ goto out; |
6194 |
+ } |
6195 |
+ |
6196 |
++ sock_set_flag(sk, SOCK_RCU_FREE); |
6197 |
+ ret = rds_add_bound(rs, sin->sin_addr.s_addr, &sin->sin_port); |
6198 |
+ if (ret) |
6199 |
+ goto out; |
6200 |
+diff --git a/net/tipc/socket.c b/net/tipc/socket.c |
6201 |
+index 0a5fa347135e..ac8ca238c541 100644 |
6202 |
+--- a/net/tipc/socket.c |
6203 |
++++ b/net/tipc/socket.c |
6204 |
+@@ -578,6 +578,7 @@ static int tipc_release(struct socket *sock) |
6205 |
+ sk_stop_timer(sk, &sk->sk_timer); |
6206 |
+ tipc_sk_remove(tsk); |
6207 |
+ |
6208 |
++ sock_orphan(sk); |
6209 |
+ /* Reject any messages that accumulated in backlog queue */ |
6210 |
+ release_sock(sk); |
6211 |
+ tipc_dest_list_purge(&tsk->cong_links); |
6212 |
+diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c |
6213 |
+index 1f3d9789af30..b3344bbe336b 100644 |
6214 |
+--- a/net/tls/tls_sw.c |
6215 |
++++ b/net/tls/tls_sw.c |
6216 |
+@@ -149,6 +149,9 @@ static int alloc_encrypted_sg(struct sock *sk, int len) |
6217 |
+ &ctx->sg_encrypted_num_elem, |
6218 |
+ &ctx->sg_encrypted_size, 0); |
6219 |
+ |
6220 |
++ if (rc == -ENOSPC) |
6221 |
++ ctx->sg_encrypted_num_elem = ARRAY_SIZE(ctx->sg_encrypted_data); |
6222 |
++ |
6223 |
+ return rc; |
6224 |
+ } |
6225 |
+ |
6226 |
+@@ -162,6 +165,9 @@ static int alloc_plaintext_sg(struct sock *sk, int len) |
6227 |
+ &ctx->sg_plaintext_num_elem, &ctx->sg_plaintext_size, |
6228 |
+ tls_ctx->pending_open_record_frags); |
6229 |
+ |
6230 |
++ if (rc == -ENOSPC) |
6231 |
++ ctx->sg_plaintext_num_elem = ARRAY_SIZE(ctx->sg_plaintext_data); |
6232 |
++ |
6233 |
+ return rc; |
6234 |
+ } |
6235 |
+ |
6236 |
+@@ -280,7 +286,7 @@ static int zerocopy_from_iter(struct sock *sk, struct iov_iter *from, |
6237 |
+ int length, int *pages_used, |
6238 |
+ unsigned int *size_used, |
6239 |
+ struct scatterlist *to, int to_max_pages, |
6240 |
+- bool charge) |
6241 |
++ bool charge, bool revert) |
6242 |
+ { |
6243 |
+ struct page *pages[MAX_SKB_FRAGS]; |
6244 |
+ |
6245 |
+@@ -331,6 +337,8 @@ static int zerocopy_from_iter(struct sock *sk, struct iov_iter *from, |
6246 |
+ out: |
6247 |
+ *size_used = size; |
6248 |
+ *pages_used = num_elem; |
6249 |
++ if (revert) |
6250 |
++ iov_iter_revert(from, size); |
6251 |
+ |
6252 |
+ return rc; |
6253 |
+ } |
6254 |
+@@ -432,7 +440,7 @@ alloc_encrypted: |
6255 |
+ &ctx->sg_plaintext_size, |
6256 |
+ ctx->sg_plaintext_data, |
6257 |
+ ARRAY_SIZE(ctx->sg_plaintext_data), |
6258 |
+- true); |
6259 |
++ true, false); |
6260 |
+ if (ret) |
6261 |
+ goto fallback_to_reg_send; |
6262 |
+ |
6263 |
+@@ -820,7 +828,7 @@ int tls_sw_recvmsg(struct sock *sk, |
6264 |
+ err = zerocopy_from_iter(sk, &msg->msg_iter, |
6265 |
+ to_copy, &pages, |
6266 |
+ &chunk, &sgin[1], |
6267 |
+- MAX_SKB_FRAGS, false); |
6268 |
++ MAX_SKB_FRAGS, false, true); |
6269 |
+ if (err < 0) |
6270 |
+ goto fallback_to_reg_recv; |
6271 |
+ |
6272 |
+diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c |
6273 |
+index 7c5e8978aeaa..a94983e03a8b 100644 |
6274 |
+--- a/net/xfrm/xfrm_policy.c |
6275 |
++++ b/net/xfrm/xfrm_policy.c |
6276 |
+@@ -1831,7 +1831,10 @@ xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols, |
6277 |
+ /* Try to instantiate a bundle */ |
6278 |
+ err = xfrm_tmpl_resolve(pols, num_pols, fl, xfrm, family); |
6279 |
+ if (err <= 0) { |
6280 |
+- if (err != 0 && err != -EAGAIN) |
6281 |
++ if (err == 0) |
6282 |
++ return NULL; |
6283 |
++ |
6284 |
++ if (err != -EAGAIN) |
6285 |
+ XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR); |
6286 |
+ return ERR_PTR(err); |
6287 |
+ } |
6288 |
+diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include |
6289 |
+index 86321f06461e..ed303f552f9d 100644 |
6290 |
+--- a/scripts/Kbuild.include |
6291 |
++++ b/scripts/Kbuild.include |
6292 |
+@@ -400,3 +400,6 @@ endif |
6293 |
+ endef |
6294 |
+ # |
6295 |
+ ############################################################################### |
6296 |
++ |
6297 |
++# delete partially updated (i.e. corrupted) files on error |
6298 |
++.DELETE_ON_ERROR: |
6299 |
+diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c |
6300 |
+index b60524310855..c20e3142b541 100644 |
6301 |
+--- a/security/integrity/evm/evm_crypto.c |
6302 |
++++ b/security/integrity/evm/evm_crypto.c |
6303 |
+@@ -97,7 +97,8 @@ static struct shash_desc *init_desc(char type) |
6304 |
+ mutex_lock(&mutex); |
6305 |
+ if (*tfm) |
6306 |
+ goto out; |
6307 |
+- *tfm = crypto_alloc_shash(algo, 0, CRYPTO_ALG_ASYNC); |
6308 |
++ *tfm = crypto_alloc_shash(algo, 0, |
6309 |
++ CRYPTO_ALG_ASYNC | CRYPTO_NOLOAD); |
6310 |
+ if (IS_ERR(*tfm)) { |
6311 |
+ rc = PTR_ERR(*tfm); |
6312 |
+ pr_err("Can not allocate %s (reason: %ld)\n", algo, rc); |
6313 |
+diff --git a/security/security.c b/security/security.c |
6314 |
+index 68f46d849abe..4e572b38937d 100644 |
6315 |
+--- a/security/security.c |
6316 |
++++ b/security/security.c |
6317 |
+@@ -118,6 +118,8 @@ static int lsm_append(char *new, char **result) |
6318 |
+ |
6319 |
+ if (*result == NULL) { |
6320 |
+ *result = kstrdup(new, GFP_KERNEL); |
6321 |
++ if (*result == NULL) |
6322 |
++ return -ENOMEM; |
6323 |
+ } else { |
6324 |
+ /* Check if it is the last registered name */ |
6325 |
+ if (match_last_lsm(*result, new)) |
6326 |
+diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c |
6327 |
+index 19de675d4504..8b6cd5a79bfa 100644 |
6328 |
+--- a/security/smack/smack_lsm.c |
6329 |
++++ b/security/smack/smack_lsm.c |
6330 |
+@@ -3924,15 +3924,19 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) |
6331 |
+ struct smack_known *skp = NULL; |
6332 |
+ int rc = 0; |
6333 |
+ struct smk_audit_info ad; |
6334 |
++ u16 family = sk->sk_family; |
6335 |
+ #ifdef CONFIG_AUDIT |
6336 |
+ struct lsm_network_audit net; |
6337 |
+ #endif |
6338 |
+ #if IS_ENABLED(CONFIG_IPV6) |
6339 |
+ struct sockaddr_in6 sadd; |
6340 |
+ int proto; |
6341 |
++ |
6342 |
++ if (family == PF_INET6 && skb->protocol == htons(ETH_P_IP)) |
6343 |
++ family = PF_INET; |
6344 |
+ #endif /* CONFIG_IPV6 */ |
6345 |
+ |
6346 |
+- switch (sk->sk_family) { |
6347 |
++ switch (family) { |
6348 |
+ case PF_INET: |
6349 |
+ #ifdef CONFIG_SECURITY_SMACK_NETFILTER |
6350 |
+ /* |
6351 |
+@@ -3950,7 +3954,7 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) |
6352 |
+ */ |
6353 |
+ netlbl_secattr_init(&secattr); |
6354 |
+ |
6355 |
+- rc = netlbl_skbuff_getattr(skb, sk->sk_family, &secattr); |
6356 |
++ rc = netlbl_skbuff_getattr(skb, family, &secattr); |
6357 |
+ if (rc == 0) |
6358 |
+ skp = smack_from_secattr(&secattr, ssp); |
6359 |
+ else |
6360 |
+@@ -3963,7 +3967,7 @@ access_check: |
6361 |
+ #endif |
6362 |
+ #ifdef CONFIG_AUDIT |
6363 |
+ smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); |
6364 |
+- ad.a.u.net->family = sk->sk_family; |
6365 |
++ ad.a.u.net->family = family; |
6366 |
+ ad.a.u.net->netif = skb->skb_iif; |
6367 |
+ ipv4_skb_to_auditdata(skb, &ad.a, NULL); |
6368 |
+ #endif |
6369 |
+@@ -3977,7 +3981,7 @@ access_check: |
6370 |
+ rc = smk_bu_note("IPv4 delivery", skp, ssp->smk_in, |
6371 |
+ MAY_WRITE, rc); |
6372 |
+ if (rc != 0) |
6373 |
+- netlbl_skbuff_err(skb, sk->sk_family, rc, 0); |
6374 |
++ netlbl_skbuff_err(skb, family, rc, 0); |
6375 |
+ break; |
6376 |
+ #if IS_ENABLED(CONFIG_IPV6) |
6377 |
+ case PF_INET6: |
6378 |
+@@ -3993,7 +3997,7 @@ access_check: |
6379 |
+ skp = smack_net_ambient; |
6380 |
+ #ifdef CONFIG_AUDIT |
6381 |
+ smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); |
6382 |
+- ad.a.u.net->family = sk->sk_family; |
6383 |
++ ad.a.u.net->family = family; |
6384 |
+ ad.a.u.net->netif = skb->skb_iif; |
6385 |
+ ipv6_skb_to_auditdata(skb, &ad.a, NULL); |
6386 |
+ #endif /* CONFIG_AUDIT */ |
6387 |
+diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c |
6388 |
+index 44b5ae833082..a4aac948ea49 100644 |
6389 |
+--- a/sound/core/pcm_lib.c |
6390 |
++++ b/sound/core/pcm_lib.c |
6391 |
+@@ -626,27 +626,33 @@ EXPORT_SYMBOL(snd_interval_refine); |
6392 |
+ |
6393 |
+ static int snd_interval_refine_first(struct snd_interval *i) |
6394 |
+ { |
6395 |
++ const unsigned int last_max = i->max; |
6396 |
++ |
6397 |
+ if (snd_BUG_ON(snd_interval_empty(i))) |
6398 |
+ return -EINVAL; |
6399 |
+ if (snd_interval_single(i)) |
6400 |
+ return 0; |
6401 |
+ i->max = i->min; |
6402 |
+- i->openmax = i->openmin; |
6403 |
+- if (i->openmax) |
6404 |
++ if (i->openmin) |
6405 |
+ i->max++; |
6406 |
++ /* only exclude max value if also excluded before refine */ |
6407 |
++ i->openmax = (i->openmax && i->max >= last_max); |
6408 |
+ return 1; |
6409 |
+ } |
6410 |
+ |
6411 |
+ static int snd_interval_refine_last(struct snd_interval *i) |
6412 |
+ { |
6413 |
++ const unsigned int last_min = i->min; |
6414 |
++ |
6415 |
+ if (snd_BUG_ON(snd_interval_empty(i))) |
6416 |
+ return -EINVAL; |
6417 |
+ if (snd_interval_single(i)) |
6418 |
+ return 0; |
6419 |
+ i->min = i->max; |
6420 |
+- i->openmin = i->openmax; |
6421 |
+- if (i->openmin) |
6422 |
++ if (i->openmax) |
6423 |
+ i->min--; |
6424 |
++ /* only exclude min value if also excluded before refine */ |
6425 |
++ i->openmin = (i->openmin && i->min <= last_min); |
6426 |
+ return 1; |
6427 |
+ } |
6428 |
+ |
6429 |
+diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c |
6430 |
+index 6c584d9b6c42..a19f802b2071 100644 |
6431 |
+--- a/sound/isa/msnd/msnd_pinnacle.c |
6432 |
++++ b/sound/isa/msnd/msnd_pinnacle.c |
6433 |
+@@ -82,10 +82,10 @@ |
6434 |
+ |
6435 |
+ static void set_default_audio_parameters(struct snd_msnd *chip) |
6436 |
+ { |
6437 |
+- chip->play_sample_size = DEFSAMPLESIZE; |
6438 |
++ chip->play_sample_size = snd_pcm_format_width(DEFSAMPLESIZE); |
6439 |
+ chip->play_sample_rate = DEFSAMPLERATE; |
6440 |
+ chip->play_channels = DEFCHANNELS; |
6441 |
+- chip->capture_sample_size = DEFSAMPLESIZE; |
6442 |
++ chip->capture_sample_size = snd_pcm_format_width(DEFSAMPLESIZE); |
6443 |
+ chip->capture_sample_rate = DEFSAMPLERATE; |
6444 |
+ chip->capture_channels = DEFCHANNELS; |
6445 |
+ } |
6446 |
+diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c |
6447 |
+index 38e4a8515709..d00734d31e04 100644 |
6448 |
+--- a/sound/soc/codecs/hdmi-codec.c |
6449 |
++++ b/sound/soc/codecs/hdmi-codec.c |
6450 |
+@@ -291,10 +291,6 @@ static const struct snd_soc_dapm_widget hdmi_widgets[] = { |
6451 |
+ SND_SOC_DAPM_OUTPUT("TX"), |
6452 |
+ }; |
6453 |
+ |
6454 |
+-static const struct snd_soc_dapm_route hdmi_routes[] = { |
6455 |
+- { "TX", NULL, "Playback" }, |
6456 |
+-}; |
6457 |
+- |
6458 |
+ enum { |
6459 |
+ DAI_ID_I2S = 0, |
6460 |
+ DAI_ID_SPDIF, |
6461 |
+@@ -689,9 +685,23 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, |
6462 |
+ return snd_ctl_add(rtd->card->snd_card, kctl); |
6463 |
+ } |
6464 |
+ |
6465 |
++static int hdmi_dai_probe(struct snd_soc_dai *dai) |
6466 |
++{ |
6467 |
++ struct snd_soc_dapm_context *dapm; |
6468 |
++ struct snd_soc_dapm_route route = { |
6469 |
++ .sink = "TX", |
6470 |
++ .source = dai->driver->playback.stream_name, |
6471 |
++ }; |
6472 |
++ |
6473 |
++ dapm = snd_soc_component_get_dapm(dai->component); |
6474 |
++ |
6475 |
++ return snd_soc_dapm_add_routes(dapm, &route, 1); |
6476 |
++} |
6477 |
++ |
6478 |
+ static const struct snd_soc_dai_driver hdmi_i2s_dai = { |
6479 |
+ .name = "i2s-hifi", |
6480 |
+ .id = DAI_ID_I2S, |
6481 |
++ .probe = hdmi_dai_probe, |
6482 |
+ .playback = { |
6483 |
+ .stream_name = "I2S Playback", |
6484 |
+ .channels_min = 2, |
6485 |
+@@ -707,6 +717,7 @@ static const struct snd_soc_dai_driver hdmi_i2s_dai = { |
6486 |
+ static const struct snd_soc_dai_driver hdmi_spdif_dai = { |
6487 |
+ .name = "spdif-hifi", |
6488 |
+ .id = DAI_ID_SPDIF, |
6489 |
++ .probe = hdmi_dai_probe, |
6490 |
+ .playback = { |
6491 |
+ .stream_name = "SPDIF Playback", |
6492 |
+ .channels_min = 2, |
6493 |
+@@ -733,8 +744,6 @@ static int hdmi_of_xlate_dai_id(struct snd_soc_component *component, |
6494 |
+ static const struct snd_soc_component_driver hdmi_driver = { |
6495 |
+ .dapm_widgets = hdmi_widgets, |
6496 |
+ .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets), |
6497 |
+- .dapm_routes = hdmi_routes, |
6498 |
+- .num_dapm_routes = ARRAY_SIZE(hdmi_routes), |
6499 |
+ .of_xlate_dai_id = hdmi_of_xlate_dai_id, |
6500 |
+ .idle_bias_on = 1, |
6501 |
+ .use_pmdown_time = 1, |
6502 |
+diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c |
6503 |
+index 1570b91bf018..dca82dd6e3bf 100644 |
6504 |
+--- a/sound/soc/codecs/rt5514.c |
6505 |
++++ b/sound/soc/codecs/rt5514.c |
6506 |
+@@ -64,8 +64,8 @@ static const struct reg_sequence rt5514_patch[] = { |
6507 |
+ {RT5514_ANA_CTRL_LDO10, 0x00028604}, |
6508 |
+ {RT5514_ANA_CTRL_ADCFED, 0x00000800}, |
6509 |
+ {RT5514_ASRC_IN_CTRL1, 0x00000003}, |
6510 |
+- {RT5514_DOWNFILTER0_CTRL3, 0x10000362}, |
6511 |
+- {RT5514_DOWNFILTER1_CTRL3, 0x10000362}, |
6512 |
++ {RT5514_DOWNFILTER0_CTRL3, 0x10000352}, |
6513 |
++ {RT5514_DOWNFILTER1_CTRL3, 0x10000352}, |
6514 |
+ }; |
6515 |
+ |
6516 |
+ static const struct reg_default rt5514_reg[] = { |
6517 |
+@@ -92,10 +92,10 @@ static const struct reg_default rt5514_reg[] = { |
6518 |
+ {RT5514_ASRC_IN_CTRL1, 0x00000003}, |
6519 |
+ {RT5514_DOWNFILTER0_CTRL1, 0x00020c2f}, |
6520 |
+ {RT5514_DOWNFILTER0_CTRL2, 0x00020c2f}, |
6521 |
+- {RT5514_DOWNFILTER0_CTRL3, 0x10000362}, |
6522 |
++ {RT5514_DOWNFILTER0_CTRL3, 0x10000352}, |
6523 |
+ {RT5514_DOWNFILTER1_CTRL1, 0x00020c2f}, |
6524 |
+ {RT5514_DOWNFILTER1_CTRL2, 0x00020c2f}, |
6525 |
+- {RT5514_DOWNFILTER1_CTRL3, 0x10000362}, |
6526 |
++ {RT5514_DOWNFILTER1_CTRL3, 0x10000352}, |
6527 |
+ {RT5514_ANA_CTRL_LDO10, 0x00028604}, |
6528 |
+ {RT5514_ANA_CTRL_LDO18_16, 0x02000345}, |
6529 |
+ {RT5514_ANA_CTRL_ADC12, 0x0000a2a8}, |
6530 |
+diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c |
6531 |
+index 6b5669f3e85d..39d2c67cd064 100644 |
6532 |
+--- a/sound/soc/codecs/rt5651.c |
6533 |
++++ b/sound/soc/codecs/rt5651.c |
6534 |
+@@ -1696,6 +1696,13 @@ static irqreturn_t rt5651_irq(int irq, void *data) |
6535 |
+ return IRQ_HANDLED; |
6536 |
+ } |
6537 |
+ |
6538 |
++static void rt5651_cancel_work(void *data) |
6539 |
++{ |
6540 |
++ struct rt5651_priv *rt5651 = data; |
6541 |
++ |
6542 |
++ cancel_work_sync(&rt5651->jack_detect_work); |
6543 |
++} |
6544 |
++ |
6545 |
+ static int rt5651_set_jack(struct snd_soc_component *component, |
6546 |
+ struct snd_soc_jack *hp_jack, void *data) |
6547 |
+ { |
6548 |
+@@ -2036,6 +2043,11 @@ static int rt5651_i2c_probe(struct i2c_client *i2c, |
6549 |
+ |
6550 |
+ INIT_WORK(&rt5651->jack_detect_work, rt5651_jack_detect_work); |
6551 |
+ |
6552 |
++ /* Make sure work is stopped on probe-error / remove */ |
6553 |
++ ret = devm_add_action_or_reset(&i2c->dev, rt5651_cancel_work, rt5651); |
6554 |
++ if (ret) |
6555 |
++ return ret; |
6556 |
++ |
6557 |
+ ret = devm_snd_soc_register_component(&i2c->dev, |
6558 |
+ &soc_component_dev_rt5651, |
6559 |
+ rt5651_dai, ARRAY_SIZE(rt5651_dai)); |
6560 |
+@@ -2043,15 +2055,6 @@ static int rt5651_i2c_probe(struct i2c_client *i2c, |
6561 |
+ return ret; |
6562 |
+ } |
6563 |
+ |
6564 |
+-static int rt5651_i2c_remove(struct i2c_client *i2c) |
6565 |
+-{ |
6566 |
+- struct rt5651_priv *rt5651 = i2c_get_clientdata(i2c); |
6567 |
+- |
6568 |
+- cancel_work_sync(&rt5651->jack_detect_work); |
6569 |
+- |
6570 |
+- return 0; |
6571 |
+-} |
6572 |
+- |
6573 |
+ static struct i2c_driver rt5651_i2c_driver = { |
6574 |
+ .driver = { |
6575 |
+ .name = "rt5651", |
6576 |
+@@ -2059,7 +2062,6 @@ static struct i2c_driver rt5651_i2c_driver = { |
6577 |
+ .of_match_table = of_match_ptr(rt5651_of_match), |
6578 |
+ }, |
6579 |
+ .probe = rt5651_i2c_probe, |
6580 |
+- .remove = rt5651_i2c_remove, |
6581 |
+ .id_table = rt5651_i2c_id, |
6582 |
+ }; |
6583 |
+ module_i2c_driver(rt5651_i2c_driver); |
6584 |
+diff --git a/sound/soc/qcom/qdsp6/q6afe-dai.c b/sound/soc/qcom/qdsp6/q6afe-dai.c |
6585 |
+index 5002dd05bf27..f8298be7038f 100644 |
6586 |
+--- a/sound/soc/qcom/qdsp6/q6afe-dai.c |
6587 |
++++ b/sound/soc/qcom/qdsp6/q6afe-dai.c |
6588 |
+@@ -1180,7 +1180,7 @@ static void of_q6afe_parse_dai_data(struct device *dev, |
6589 |
+ int id, i, num_lines; |
6590 |
+ |
6591 |
+ ret = of_property_read_u32(node, "reg", &id); |
6592 |
+- if (ret || id > AFE_PORT_MAX) { |
6593 |
++ if (ret || id < 0 || id >= AFE_PORT_MAX) { |
6594 |
+ dev_err(dev, "valid dai id not found:%d\n", ret); |
6595 |
+ continue; |
6596 |
+ } |
6597 |
+diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
6598 |
+index 8aac48f9c322..08aa78007020 100644 |
6599 |
+--- a/sound/usb/quirks-table.h |
6600 |
++++ b/sound/usb/quirks-table.h |
6601 |
+@@ -2875,7 +2875,8 @@ YAMAHA_DEVICE(0x7010, "UB99"), |
6602 |
+ */ |
6603 |
+ |
6604 |
+ #define AU0828_DEVICE(vid, pid, vname, pname) { \ |
6605 |
+- USB_DEVICE_VENDOR_SPEC(vid, pid), \ |
6606 |
++ .idVendor = vid, \ |
6607 |
++ .idProduct = pid, \ |
6608 |
+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ |
6609 |
+ USB_DEVICE_ID_MATCH_INT_CLASS | \ |
6610 |
+ USB_DEVICE_ID_MATCH_INT_SUBCLASS, \ |
6611 |
+diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
6612 |
+index 02b6cc02767f..dde87d64bc32 100644 |
6613 |
+--- a/sound/usb/quirks.c |
6614 |
++++ b/sound/usb/quirks.c |
6615 |
+@@ -1373,6 +1373,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, |
6616 |
+ return SNDRV_PCM_FMTBIT_DSD_U32_BE; |
6617 |
+ break; |
6618 |
+ |
6619 |
++ case USB_ID(0x16d0, 0x09dd): /* Encore mDSD */ |
6620 |
+ case USB_ID(0x0d8c, 0x0316): /* Hegel HD12 DSD */ |
6621 |
+ case USB_ID(0x16b0, 0x06b2): /* NuPrime DAC-10 */ |
6622 |
+ case USB_ID(0x16d0, 0x0733): /* Furutech ADL Stratos */ |
6623 |
+@@ -1443,6 +1444,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, |
6624 |
+ */ |
6625 |
+ switch (USB_ID_VENDOR(chip->usb_id)) { |
6626 |
+ case 0x20b1: /* XMOS based devices */ |
6627 |
++ case 0x152a: /* Thesycon devices */ |
6628 |
+ case 0x25ce: /* Mytek devices */ |
6629 |
+ if (fp->dsd_raw) |
6630 |
+ return SNDRV_PCM_FMTBIT_DSD_U32_BE; |
6631 |
+diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c |
6632 |
+index dbf6e8bd98ba..bbb2a8ef367c 100644 |
6633 |
+--- a/tools/hv/hv_kvp_daemon.c |
6634 |
++++ b/tools/hv/hv_kvp_daemon.c |
6635 |
+@@ -286,7 +286,7 @@ static int kvp_key_delete(int pool, const __u8 *key, int key_size) |
6636 |
+ * Found a match; just move the remaining |
6637 |
+ * entries up. |
6638 |
+ */ |
6639 |
+- if (i == num_records) { |
6640 |
++ if (i == (num_records - 1)) { |
6641 |
+ kvp_file_info[pool].num_records--; |
6642 |
+ kvp_update_file(pool); |
6643 |
+ return 0; |
6644 |
+diff --git a/tools/perf/arch/powerpc/util/skip-callchain-idx.c b/tools/perf/arch/powerpc/util/skip-callchain-idx.c |
6645 |
+index ef5d59a5742e..7c6eeb4633fe 100644 |
6646 |
+--- a/tools/perf/arch/powerpc/util/skip-callchain-idx.c |
6647 |
++++ b/tools/perf/arch/powerpc/util/skip-callchain-idx.c |
6648 |
+@@ -58,9 +58,13 @@ static int check_return_reg(int ra_regno, Dwarf_Frame *frame) |
6649 |
+ } |
6650 |
+ |
6651 |
+ /* |
6652 |
+- * Check if return address is on the stack. |
6653 |
++ * Check if return address is on the stack. If return address |
6654 |
++ * is in a register (typically R0), it is yet to be saved on |
6655 |
++ * the stack. |
6656 |
+ */ |
6657 |
+- if (nops != 0 || ops != NULL) |
6658 |
++ if ((nops != 0 || ops != NULL) && |
6659 |
++ !(nops == 1 && ops[0].atom == DW_OP_regx && |
6660 |
++ ops[0].number2 == 0 && ops[0].offset == 0)) |
6661 |
+ return 0; |
6662 |
+ |
6663 |
+ /* |
6664 |
+@@ -246,7 +250,7 @@ int arch_skip_callchain_idx(struct thread *thread, struct ip_callchain *chain) |
6665 |
+ if (!chain || chain->nr < 3) |
6666 |
+ return skip_slot; |
6667 |
+ |
6668 |
+- ip = chain->ips[2]; |
6669 |
++ ip = chain->ips[1]; |
6670 |
+ |
6671 |
+ thread__find_symbol(thread, PERF_RECORD_MISC_USER, ip, &al); |
6672 |
+ |
6673 |
+diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c |
6674 |
+index dd850a26d579..4f5de8245b32 100644 |
6675 |
+--- a/tools/perf/tests/builtin-test.c |
6676 |
++++ b/tools/perf/tests/builtin-test.c |
6677 |
+@@ -599,7 +599,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) |
6678 |
+ for (subi = 0; subi < subn; subi++) { |
6679 |
+ pr_info("%2d.%1d: %-*s:", i, subi + 1, subw, |
6680 |
+ t->subtest.get_desc(subi)); |
6681 |
+- err = test_and_print(t, skip, subi); |
6682 |
++ err = test_and_print(t, skip, subi + 1); |
6683 |
+ if (err != TEST_OK && t->subtest.skip_if_fail) |
6684 |
+ skip = true; |
6685 |
+ } |
6686 |
+diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh |
6687 |
+index 94e513e62b34..3013ac8f83d0 100755 |
6688 |
+--- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh |
6689 |
++++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh |
6690 |
+@@ -13,11 +13,24 @@ |
6691 |
+ libc=$(grep -w libc /proc/self/maps | head -1 | sed -r 's/.*[[:space:]](\/.*)/\1/g') |
6692 |
+ nm -Dg $libc 2>/dev/null | fgrep -q inet_pton || exit 254 |
6693 |
+ |
6694 |
++event_pattern='probe_libc:inet_pton(\_[[:digit:]]+)?' |
6695 |
++ |
6696 |
++add_libc_inet_pton_event() { |
6697 |
++ |
6698 |
++ event_name=$(perf probe -f -x $libc -a inet_pton 2>&1 | tail -n +2 | head -n -5 | \ |
6699 |
++ grep -P -o "$event_pattern(?=[[:space:]]\(on inet_pton in $libc\))") |
6700 |
++ |
6701 |
++ if [ $? -ne 0 -o -z "$event_name" ] ; then |
6702 |
++ printf "FAIL: could not add event\n" |
6703 |
++ return 1 |
6704 |
++ fi |
6705 |
++} |
6706 |
++ |
6707 |
+ trace_libc_inet_pton_backtrace() { |
6708 |
+ |
6709 |
+ expected=`mktemp -u /tmp/expected.XXX` |
6710 |
+ |
6711 |
+- echo "ping[][0-9 \.:]+probe_libc:inet_pton: \([[:xdigit:]]+\)" > $expected |
6712 |
++ echo "ping[][0-9 \.:]+$event_name: \([[:xdigit:]]+\)" > $expected |
6713 |
+ echo ".*inet_pton\+0x[[:xdigit:]]+[[:space:]]\($libc|inlined\)$" >> $expected |
6714 |
+ case "$(uname -m)" in |
6715 |
+ s390x) |
6716 |
+@@ -26,6 +39,12 @@ trace_libc_inet_pton_backtrace() { |
6717 |
+ echo "(__GI_)?getaddrinfo\+0x[[:xdigit:]]+[[:space:]]\($libc|inlined\)$" >> $expected |
6718 |
+ echo "main\+0x[[:xdigit:]]+[[:space:]]\(.*/bin/ping.*\)$" >> $expected |
6719 |
+ ;; |
6720 |
++ ppc64|ppc64le) |
6721 |
++ eventattr='max-stack=4' |
6722 |
++ echo "gaih_inet.*\+0x[[:xdigit:]]+[[:space:]]\($libc\)$" >> $expected |
6723 |
++ echo "getaddrinfo\+0x[[:xdigit:]]+[[:space:]]\($libc\)$" >> $expected |
6724 |
++ echo ".*\+0x[[:xdigit:]]+[[:space:]]\(.*/bin/ping.*\)$" >> $expected |
6725 |
++ ;; |
6726 |
+ *) |
6727 |
+ eventattr='max-stack=3' |
6728 |
+ echo "getaddrinfo\+0x[[:xdigit:]]+[[:space:]]\($libc\)$" >> $expected |
6729 |
+@@ -35,7 +54,7 @@ trace_libc_inet_pton_backtrace() { |
6730 |
+ |
6731 |
+ perf_data=`mktemp -u /tmp/perf.data.XXX` |
6732 |
+ perf_script=`mktemp -u /tmp/perf.script.XXX` |
6733 |
+- perf record -e probe_libc:inet_pton/$eventattr/ -o $perf_data ping -6 -c 1 ::1 > /dev/null 2>&1 |
6734 |
++ perf record -e $event_name/$eventattr/ -o $perf_data ping -6 -c 1 ::1 > /dev/null 2>&1 |
6735 |
+ perf script -i $perf_data > $perf_script |
6736 |
+ |
6737 |
+ exec 3<$perf_script |
6738 |
+@@ -46,7 +65,7 @@ trace_libc_inet_pton_backtrace() { |
6739 |
+ echo "$line" | egrep -q "$pattern" |
6740 |
+ if [ $? -ne 0 ] ; then |
6741 |
+ printf "FAIL: expected backtrace entry \"%s\" got \"%s\"\n" "$pattern" "$line" |
6742 |
+- exit 1 |
6743 |
++ return 1 |
6744 |
+ fi |
6745 |
+ done |
6746 |
+ |
6747 |
+@@ -56,13 +75,20 @@ trace_libc_inet_pton_backtrace() { |
6748 |
+ # even if the perf script output does not match. |
6749 |
+ } |
6750 |
+ |
6751 |
++delete_libc_inet_pton_event() { |
6752 |
++ |
6753 |
++ if [ -n "$event_name" ] ; then |
6754 |
++ perf probe -q -d $event_name |
6755 |
++ fi |
6756 |
++} |
6757 |
++ |
6758 |
+ # Check for IPv6 interface existence |
6759 |
+ ip a sh lo | fgrep -q inet6 || exit 2 |
6760 |
+ |
6761 |
+ skip_if_no_perf_probe && \ |
6762 |
+-perf probe -q $libc inet_pton && \ |
6763 |
++add_libc_inet_pton_event && \ |
6764 |
+ trace_libc_inet_pton_backtrace |
6765 |
+ err=$? |
6766 |
+ rm -f ${perf_data} ${perf_script} ${expected} |
6767 |
+-perf probe -q -d probe_libc:inet_pton |
6768 |
++delete_libc_inet_pton_event |
6769 |
+ exit $err |
6770 |
+diff --git a/tools/perf/util/comm.c b/tools/perf/util/comm.c |
6771 |
+index 7798a2cc8a86..31279a7bd919 100644 |
6772 |
+--- a/tools/perf/util/comm.c |
6773 |
++++ b/tools/perf/util/comm.c |
6774 |
+@@ -20,9 +20,10 @@ static struct rw_semaphore comm_str_lock = {.lock = PTHREAD_RWLOCK_INITIALIZER,} |
6775 |
+ |
6776 |
+ static struct comm_str *comm_str__get(struct comm_str *cs) |
6777 |
+ { |
6778 |
+- if (cs) |
6779 |
+- refcount_inc(&cs->refcnt); |
6780 |
+- return cs; |
6781 |
++ if (cs && refcount_inc_not_zero(&cs->refcnt)) |
6782 |
++ return cs; |
6783 |
++ |
6784 |
++ return NULL; |
6785 |
+ } |
6786 |
+ |
6787 |
+ static void comm_str__put(struct comm_str *cs) |
6788 |
+@@ -67,9 +68,14 @@ struct comm_str *__comm_str__findnew(const char *str, struct rb_root *root) |
6789 |
+ parent = *p; |
6790 |
+ iter = rb_entry(parent, struct comm_str, rb_node); |
6791 |
+ |
6792 |
++ /* |
6793 |
++ * If we race with comm_str__put, iter->refcnt is 0 |
6794 |
++ * and it will be removed within comm_str__put call |
6795 |
++ * shortly, ignore it in this search. |
6796 |
++ */ |
6797 |
+ cmp = strcmp(str, iter->str); |
6798 |
+- if (!cmp) |
6799 |
+- return comm_str__get(iter); |
6800 |
++ if (!cmp && comm_str__get(iter)) |
6801 |
++ return iter; |
6802 |
+ |
6803 |
+ if (cmp < 0) |
6804 |
+ p = &(*p)->rb_left; |
6805 |
+diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c |
6806 |
+index 653ff65aa2c3..5af58aac91ad 100644 |
6807 |
+--- a/tools/perf/util/header.c |
6808 |
++++ b/tools/perf/util/header.c |
6809 |
+@@ -2587,7 +2587,7 @@ static const struct feature_ops feat_ops[HEADER_LAST_FEATURE] = { |
6810 |
+ FEAT_OPR(NUMA_TOPOLOGY, numa_topology, true), |
6811 |
+ FEAT_OPN(BRANCH_STACK, branch_stack, false), |
6812 |
+ FEAT_OPR(PMU_MAPPINGS, pmu_mappings, false), |
6813 |
+- FEAT_OPN(GROUP_DESC, group_desc, false), |
6814 |
++ FEAT_OPR(GROUP_DESC, group_desc, false), |
6815 |
+ FEAT_OPN(AUXTRACE, auxtrace, false), |
6816 |
+ FEAT_OPN(STAT, stat, false), |
6817 |
+ FEAT_OPN(CACHE, cache, true), |
6818 |
+diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c |
6819 |
+index e7b4a8b513f2..22dbb6612b41 100644 |
6820 |
+--- a/tools/perf/util/machine.c |
6821 |
++++ b/tools/perf/util/machine.c |
6822 |
+@@ -2272,6 +2272,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) |
6823 |
+ { |
6824 |
+ struct callchain_cursor *cursor = arg; |
6825 |
+ const char *srcline = NULL; |
6826 |
++ u64 addr; |
6827 |
+ |
6828 |
+ if (symbol_conf.hide_unresolved && entry->sym == NULL) |
6829 |
+ return 0; |
6830 |
+@@ -2279,7 +2280,13 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) |
6831 |
+ if (append_inlines(cursor, entry->map, entry->sym, entry->ip) == 0) |
6832 |
+ return 0; |
6833 |
+ |
6834 |
+- srcline = callchain_srcline(entry->map, entry->sym, entry->ip); |
6835 |
++ /* |
6836 |
++ * Convert entry->ip from a virtual address to an offset in |
6837 |
++ * its corresponding binary. |
6838 |
++ */ |
6839 |
++ addr = map__map_ip(entry->map, entry->ip); |
6840 |
++ |
6841 |
++ srcline = callchain_srcline(entry->map, entry->sym, addr); |
6842 |
+ return callchain_cursor_append(cursor, entry->ip, |
6843 |
+ entry->map, entry->sym, |
6844 |
+ false, NULL, 0, 0, 0, srcline); |
6845 |
+diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c |
6846 |
+index 89ac5b5dc218..f5431092c6d1 100644 |
6847 |
+--- a/tools/perf/util/map.c |
6848 |
++++ b/tools/perf/util/map.c |
6849 |
+@@ -590,6 +590,13 @@ struct symbol *map_groups__find_symbol(struct map_groups *mg, |
6850 |
+ return NULL; |
6851 |
+ } |
6852 |
+ |
6853 |
++static bool map__contains_symbol(struct map *map, struct symbol *sym) |
6854 |
++{ |
6855 |
++ u64 ip = map->unmap_ip(map, sym->start); |
6856 |
++ |
6857 |
++ return ip >= map->start && ip < map->end; |
6858 |
++} |
6859 |
++ |
6860 |
+ struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name, |
6861 |
+ struct map **mapp) |
6862 |
+ { |
6863 |
+@@ -605,6 +612,10 @@ struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name, |
6864 |
+ |
6865 |
+ if (sym == NULL) |
6866 |
+ continue; |
6867 |
++ if (!map__contains_symbol(pos, sym)) { |
6868 |
++ sym = NULL; |
6869 |
++ continue; |
6870 |
++ } |
6871 |
+ if (mapp != NULL) |
6872 |
+ *mapp = pos; |
6873 |
+ goto out; |
6874 |
+diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c |
6875 |
+index 538db4e5d1e6..6f318b15950e 100644 |
6876 |
+--- a/tools/perf/util/unwind-libdw.c |
6877 |
++++ b/tools/perf/util/unwind-libdw.c |
6878 |
+@@ -77,7 +77,7 @@ static int entry(u64 ip, struct unwind_info *ui) |
6879 |
+ if (__report_module(&al, ip, ui)) |
6880 |
+ return -1; |
6881 |
+ |
6882 |
+- e->ip = al.addr; |
6883 |
++ e->ip = ip; |
6884 |
+ e->map = al.map; |
6885 |
+ e->sym = al.sym; |
6886 |
+ |
6887 |
+diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c |
6888 |
+index 6a11bc7e6b27..79f521a552cf 100644 |
6889 |
+--- a/tools/perf/util/unwind-libunwind-local.c |
6890 |
++++ b/tools/perf/util/unwind-libunwind-local.c |
6891 |
+@@ -575,7 +575,7 @@ static int entry(u64 ip, struct thread *thread, |
6892 |
+ struct addr_location al; |
6893 |
+ |
6894 |
+ e.sym = thread__find_symbol(thread, PERF_RECORD_MISC_USER, ip, &al); |
6895 |
+- e.ip = al.addr; |
6896 |
++ e.ip = ip; |
6897 |
+ e.map = al.map; |
6898 |
+ |
6899 |
+ pr_debug("unwind: %s:ip = 0x%" PRIx64 " (0x%" PRIx64 ")\n", |
6900 |
+diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c |
6901 |
+index e2926f72a821..94c3bdf82ff7 100644 |
6902 |
+--- a/tools/testing/nvdimm/test/nfit.c |
6903 |
++++ b/tools/testing/nvdimm/test/nfit.c |
6904 |
+@@ -1308,7 +1308,8 @@ static void smart_init(struct nfit_test *t) |
6905 |
+ | ND_INTEL_SMART_ALARM_VALID |
6906 |
+ | ND_INTEL_SMART_USED_VALID |
6907 |
+ | ND_INTEL_SMART_SHUTDOWN_VALID |
6908 |
+- | ND_INTEL_SMART_MTEMP_VALID, |
6909 |
++ | ND_INTEL_SMART_MTEMP_VALID |
6910 |
++ | ND_INTEL_SMART_CTEMP_VALID, |
6911 |
+ .health = ND_INTEL_SMART_NON_CRITICAL_HEALTH, |
6912 |
+ .media_temperature = 23 * 16, |
6913 |
+ .ctrl_temperature = 25 * 16, |
6914 |
+diff --git a/tools/testing/selftests/android/ion/ionapp_export.c b/tools/testing/selftests/android/ion/ionapp_export.c |
6915 |
+index a944e72621a9..b5fa0a2dc968 100644 |
6916 |
+--- a/tools/testing/selftests/android/ion/ionapp_export.c |
6917 |
++++ b/tools/testing/selftests/android/ion/ionapp_export.c |
6918 |
+@@ -51,6 +51,7 @@ int main(int argc, char *argv[]) |
6919 |
+ |
6920 |
+ heap_size = 0; |
6921 |
+ flags = 0; |
6922 |
++ heap_type = ION_HEAP_TYPE_SYSTEM; |
6923 |
+ |
6924 |
+ while ((opt = getopt(argc, argv, "hi:s:")) != -1) { |
6925 |
+ switch (opt) { |
6926 |
+diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c |
6927 |
+index ca6cd146aafe..dcf73c5dab6e 100644 |
6928 |
+--- a/tools/testing/selftests/timers/raw_skew.c |
6929 |
++++ b/tools/testing/selftests/timers/raw_skew.c |
6930 |
+@@ -134,6 +134,11 @@ int main(int argv, char **argc) |
6931 |
+ printf(" %lld.%i(act)", ppm/1000, abs((int)(ppm%1000))); |
6932 |
+ |
6933 |
+ if (llabs(eppm - ppm) > 1000) { |
6934 |
++ if (tx1.offset || tx2.offset || |
6935 |
++ tx1.freq != tx2.freq || tx1.tick != tx2.tick) { |
6936 |
++ printf(" [SKIP]\n"); |
6937 |
++ return ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n"); |
6938 |
++ } |
6939 |
+ printf(" [FAILED]\n"); |
6940 |
+ return ksft_exit_fail(); |
6941 |
+ } |
6942 |
+diff --git a/tools/testing/selftests/vDSO/vdso_test.c b/tools/testing/selftests/vDSO/vdso_test.c |
6943 |
+index 2df26bd0099c..eda53f833d8e 100644 |
6944 |
+--- a/tools/testing/selftests/vDSO/vdso_test.c |
6945 |
++++ b/tools/testing/selftests/vDSO/vdso_test.c |
6946 |
+@@ -15,6 +15,8 @@ |
6947 |
+ #include <sys/auxv.h> |
6948 |
+ #include <sys/time.h> |
6949 |
+ |
6950 |
++#include "../kselftest.h" |
6951 |
++ |
6952 |
+ extern void *vdso_sym(const char *version, const char *name); |
6953 |
+ extern void vdso_init_from_sysinfo_ehdr(uintptr_t base); |
6954 |
+ extern void vdso_init_from_auxv(void *auxv); |
6955 |
+@@ -37,7 +39,7 @@ int main(int argc, char **argv) |
6956 |
+ unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR); |
6957 |
+ if (!sysinfo_ehdr) { |
6958 |
+ printf("AT_SYSINFO_EHDR is not present!\n"); |
6959 |
+- return 0; |
6960 |
++ return KSFT_SKIP; |
6961 |
+ } |
6962 |
+ |
6963 |
+ vdso_init_from_sysinfo_ehdr(getauxval(AT_SYSINFO_EHDR)); |
6964 |
+@@ -48,7 +50,7 @@ int main(int argc, char **argv) |
6965 |
+ |
6966 |
+ if (!gtod) { |
6967 |
+ printf("Could not find %s\n", name); |
6968 |
+- return 1; |
6969 |
++ return KSFT_SKIP; |
6970 |
+ } |
6971 |
+ |
6972 |
+ struct timeval tv; |
6973 |
+@@ -59,6 +61,7 @@ int main(int argc, char **argv) |
6974 |
+ (long long)tv.tv_sec, (long long)tv.tv_usec); |
6975 |
+ } else { |
6976 |
+ printf("%s failed\n", name); |
6977 |
++ return KSFT_FAIL; |
6978 |
+ } |
6979 |
+ |
6980 |
+ return 0; |
6981 |
+diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c |
6982 |
+index 2673efce65f3..b71417913741 100644 |
6983 |
+--- a/virt/kvm/arm/vgic/vgic-init.c |
6984 |
++++ b/virt/kvm/arm/vgic/vgic-init.c |
6985 |
+@@ -271,6 +271,10 @@ int vgic_init(struct kvm *kvm) |
6986 |
+ if (vgic_initialized(kvm)) |
6987 |
+ return 0; |
6988 |
+ |
6989 |
++ /* Are we also in the middle of creating a VCPU? */ |
6990 |
++ if (kvm->created_vcpus != atomic_read(&kvm->online_vcpus)) |
6991 |
++ return -EBUSY; |
6992 |
++ |
6993 |
+ /* freeze the number of spis */ |
6994 |
+ if (!dist->nr_spis) |
6995 |
+ dist->nr_spis = VGIC_NR_IRQS_LEGACY - VGIC_NR_PRIVATE_IRQS; |
6996 |
+diff --git a/virt/kvm/arm/vgic/vgic-mmio-v2.c b/virt/kvm/arm/vgic/vgic-mmio-v2.c |
6997 |
+index ffc587bf4742..64e571cc02df 100644 |
6998 |
+--- a/virt/kvm/arm/vgic/vgic-mmio-v2.c |
6999 |
++++ b/virt/kvm/arm/vgic/vgic-mmio-v2.c |
7000 |
+@@ -352,6 +352,9 @@ static void vgic_mmio_write_apr(struct kvm_vcpu *vcpu, |
7001 |
+ |
7002 |
+ if (n > vgic_v3_max_apr_idx(vcpu)) |
7003 |
+ return; |
7004 |
++ |
7005 |
++ n = array_index_nospec(n, 4); |
7006 |
++ |
7007 |
+ /* GICv3 only uses ICH_AP1Rn for memory mapped (GICv2) guests */ |
7008 |
+ vgicv3->vgic_ap1r[n] = val; |
7009 |
+ } |