1 |
commit: 57661b28b79bbbbea7e6812d625ee222265e71cc |
2 |
Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Aug 21 10:48:18 2020 +0000 |
4 |
Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Aug 21 10:49:01 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=57661b28 |
7 |
|
8 |
Linux patch 4.19.141 |
9 |
|
10 |
Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1140_linux-4.19.141.patch | 2957 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 2961 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 1b514b0..1680f0b 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -599,6 +599,10 @@ Patch: 1139_linux-4.19.140.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.19.140 |
23 |
|
24 |
+Patch: 1140_linux-4.19.141.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.19.141 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1140_linux-4.19.141.patch b/1140_linux-4.19.141.patch |
33 |
new file mode 100644 |
34 |
index 0000000..f4b0b6a |
35 |
--- /dev/null |
36 |
+++ b/1140_linux-4.19.141.patch |
37 |
@@ -0,0 +1,2957 @@ |
38 |
+diff --git a/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.txt b/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.txt |
39 |
+index c82794002595f..89647d7143879 100644 |
40 |
+--- a/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.txt |
41 |
++++ b/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.txt |
42 |
+@@ -21,7 +21,7 @@ controller state. The mux controller state is described in |
43 |
+ |
44 |
+ Example: |
45 |
+ mux: mux-controller { |
46 |
+- compatible = "mux-gpio"; |
47 |
++ compatible = "gpio-mux"; |
48 |
+ #mux-control-cells = <0>; |
49 |
+ |
50 |
+ mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>, |
51 |
+diff --git a/Makefile b/Makefile |
52 |
+index c5ee1c10a39c8..5b64e11419846 100644 |
53 |
+--- a/Makefile |
54 |
++++ b/Makefile |
55 |
+@@ -1,7 +1,7 @@ |
56 |
+ # SPDX-License-Identifier: GPL-2.0 |
57 |
+ VERSION = 4 |
58 |
+ PATCHLEVEL = 19 |
59 |
+-SUBLEVEL = 140 |
60 |
++SUBLEVEL = 141 |
61 |
+ EXTRAVERSION = |
62 |
+ NAME = "People's Front" |
63 |
+ |
64 |
+diff --git a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts |
65 |
+index 3ab25ad402b90..6cbdd66921aab 100644 |
66 |
+--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts |
67 |
++++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts |
68 |
+@@ -19,6 +19,12 @@ |
69 |
+ model = "Globalscale Marvell ESPRESSOBin Board"; |
70 |
+ compatible = "globalscale,espressobin", "marvell,armada3720", "marvell,armada3710"; |
71 |
+ |
72 |
++ aliases { |
73 |
++ ethernet0 = ð0; |
74 |
++ serial0 = &uart0; |
75 |
++ serial1 = &uart1; |
76 |
++ }; |
77 |
++ |
78 |
+ chosen { |
79 |
+ stdout-path = "serial0:115200n8"; |
80 |
+ }; |
81 |
+diff --git a/arch/mips/kernel/topology.c b/arch/mips/kernel/topology.c |
82 |
+index cd3e1f82e1a5d..08ad6371fbe08 100644 |
83 |
+--- a/arch/mips/kernel/topology.c |
84 |
++++ b/arch/mips/kernel/topology.c |
85 |
+@@ -20,7 +20,7 @@ static int __init topology_init(void) |
86 |
+ for_each_present_cpu(i) { |
87 |
+ struct cpu *c = &per_cpu(cpu_devices, i); |
88 |
+ |
89 |
+- c->hotpluggable = 1; |
90 |
++ c->hotpluggable = !!i; |
91 |
+ ret = register_cpu(c, i); |
92 |
+ if (ret) |
93 |
+ printk(KERN_WARNING "topology_init: register_cpu %d " |
94 |
+diff --git a/arch/openrisc/kernel/stacktrace.c b/arch/openrisc/kernel/stacktrace.c |
95 |
+index 43f140a28bc72..54d38809e22cb 100644 |
96 |
+--- a/arch/openrisc/kernel/stacktrace.c |
97 |
++++ b/arch/openrisc/kernel/stacktrace.c |
98 |
+@@ -13,6 +13,7 @@ |
99 |
+ #include <linux/export.h> |
100 |
+ #include <linux/sched.h> |
101 |
+ #include <linux/sched/debug.h> |
102 |
++#include <linux/sched/task_stack.h> |
103 |
+ #include <linux/stacktrace.h> |
104 |
+ |
105 |
+ #include <asm/processor.h> |
106 |
+@@ -68,12 +69,25 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) |
107 |
+ { |
108 |
+ unsigned long *sp = NULL; |
109 |
+ |
110 |
++ if (!try_get_task_stack(tsk)) |
111 |
++ return; |
112 |
++ |
113 |
+ if (tsk == current) |
114 |
+ sp = (unsigned long *) &sp; |
115 |
+- else |
116 |
+- sp = (unsigned long *) KSTK_ESP(tsk); |
117 |
++ else { |
118 |
++ unsigned long ksp; |
119 |
++ |
120 |
++ /* Locate stack from kernel context */ |
121 |
++ ksp = task_thread_info(tsk)->ksp; |
122 |
++ ksp += STACK_FRAME_OVERHEAD; /* redzone */ |
123 |
++ ksp += sizeof(struct pt_regs); |
124 |
++ |
125 |
++ sp = (unsigned long *) ksp; |
126 |
++ } |
127 |
+ |
128 |
+ unwind_stack(trace, sp, save_stack_address_nosched); |
129 |
++ |
130 |
++ put_task_stack(tsk); |
131 |
+ } |
132 |
+ EXPORT_SYMBOL_GPL(save_stack_trace_tsk); |
133 |
+ |
134 |
+diff --git a/arch/powerpc/include/asm/percpu.h b/arch/powerpc/include/asm/percpu.h |
135 |
+index dce863a7635cd..8e5b7d0b851c6 100644 |
136 |
+--- a/arch/powerpc/include/asm/percpu.h |
137 |
++++ b/arch/powerpc/include/asm/percpu.h |
138 |
+@@ -10,8 +10,6 @@ |
139 |
+ |
140 |
+ #ifdef CONFIG_SMP |
141 |
+ |
142 |
+-#include <asm/paca.h> |
143 |
+- |
144 |
+ #define __my_cpu_offset local_paca->data_offset |
145 |
+ |
146 |
+ #endif /* CONFIG_SMP */ |
147 |
+@@ -19,4 +17,6 @@ |
148 |
+ |
149 |
+ #include <asm-generic/percpu.h> |
150 |
+ |
151 |
++#include <asm/paca.h> |
152 |
++ |
153 |
+ #endif /* _ASM_POWERPC_PERCPU_H_ */ |
154 |
+diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c |
155 |
+index 6e0ff8b600ced..eb5252177b662 100644 |
156 |
+--- a/arch/powerpc/mm/fault.c |
157 |
++++ b/arch/powerpc/mm/fault.c |
158 |
+@@ -233,6 +233,9 @@ static bool bad_kernel_fault(bool is_exec, unsigned long error_code, |
159 |
+ return is_exec || (address >= TASK_SIZE); |
160 |
+ } |
161 |
+ |
162 |
++// This comes from 64-bit struct rt_sigframe + __SIGNAL_FRAMESIZE |
163 |
++#define SIGFRAME_MAX_SIZE (4096 + 128) |
164 |
++ |
165 |
+ static bool bad_stack_expansion(struct pt_regs *regs, unsigned long address, |
166 |
+ struct vm_area_struct *vma, unsigned int flags, |
167 |
+ bool *must_retry) |
168 |
+@@ -240,7 +243,7 @@ static bool bad_stack_expansion(struct pt_regs *regs, unsigned long address, |
169 |
+ /* |
170 |
+ * N.B. The POWER/Open ABI allows programs to access up to |
171 |
+ * 288 bytes below the stack pointer. |
172 |
+- * The kernel signal delivery code writes up to about 1.5kB |
173 |
++ * The kernel signal delivery code writes a bit over 4KB |
174 |
+ * below the stack pointer (r1) before decrementing it. |
175 |
+ * The exec code can write slightly over 640kB to the stack |
176 |
+ * before setting the user r1. Thus we allow the stack to |
177 |
+@@ -265,7 +268,7 @@ static bool bad_stack_expansion(struct pt_regs *regs, unsigned long address, |
178 |
+ * between the last mapped region and the stack will |
179 |
+ * expand the stack rather than segfaulting. |
180 |
+ */ |
181 |
+- if (address + 2048 >= uregs->gpr[1]) |
182 |
++ if (address + SIGFRAME_MAX_SIZE >= uregs->gpr[1]) |
183 |
+ return false; |
184 |
+ |
185 |
+ if ((flags & FAULT_FLAG_WRITE) && (flags & FAULT_FLAG_USER) && |
186 |
+diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c |
187 |
+index b168c3742b431..afabe69186195 100644 |
188 |
+--- a/arch/powerpc/platforms/pseries/hotplug-memory.c |
189 |
++++ b/arch/powerpc/platforms/pseries/hotplug-memory.c |
190 |
+@@ -31,7 +31,7 @@ static bool rtas_hp_event; |
191 |
+ unsigned long pseries_memory_block_size(void) |
192 |
+ { |
193 |
+ struct device_node *np; |
194 |
+- unsigned int memblock_size = MIN_MEMORY_BLOCK_SIZE; |
195 |
++ u64 memblock_size = MIN_MEMORY_BLOCK_SIZE; |
196 |
+ struct resource r; |
197 |
+ |
198 |
+ np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); |
199 |
+diff --git a/arch/sh/boards/mach-landisk/setup.c b/arch/sh/boards/mach-landisk/setup.c |
200 |
+index f1147caebacf0..af69fb7fef7c7 100644 |
201 |
+--- a/arch/sh/boards/mach-landisk/setup.c |
202 |
++++ b/arch/sh/boards/mach-landisk/setup.c |
203 |
+@@ -85,6 +85,9 @@ device_initcall(landisk_devices_setup); |
204 |
+ |
205 |
+ static void __init landisk_setup(char **cmdline_p) |
206 |
+ { |
207 |
++ /* I/O port identity mapping */ |
208 |
++ __set_io_port_base(0); |
209 |
++ |
210 |
+ /* LED ON */ |
211 |
+ __raw_writeb(__raw_readb(PA_LED) | 0x03, PA_LED); |
212 |
+ |
213 |
+diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c |
214 |
+index 99c28c02b7a54..8b7e0b46e86ea 100644 |
215 |
+--- a/arch/x86/kernel/apic/vector.c |
216 |
++++ b/arch/x86/kernel/apic/vector.c |
217 |
+@@ -556,6 +556,10 @@ static int x86_vector_alloc_irqs(struct irq_domain *domain, unsigned int virq, |
218 |
+ irqd->chip_data = apicd; |
219 |
+ irqd->hwirq = virq + i; |
220 |
+ irqd_set_single_target(irqd); |
221 |
++ |
222 |
++ /* Don't invoke affinity setter on deactivated interrupts */ |
223 |
++ irqd_set_affinity_on_activate(irqd); |
224 |
++ |
225 |
+ /* |
226 |
+ * Legacy vectors are already assigned when the IOAPIC |
227 |
+ * takes them over. They stay on the same vector. This is |
228 |
+diff --git a/arch/xtensa/kernel/perf_event.c b/arch/xtensa/kernel/perf_event.c |
229 |
+index ff1d81385ed7a..768e1f7ab8715 100644 |
230 |
+--- a/arch/xtensa/kernel/perf_event.c |
231 |
++++ b/arch/xtensa/kernel/perf_event.c |
232 |
+@@ -404,7 +404,7 @@ static struct pmu xtensa_pmu = { |
233 |
+ .read = xtensa_pmu_read, |
234 |
+ }; |
235 |
+ |
236 |
+-static int xtensa_pmu_setup(int cpu) |
237 |
++static int xtensa_pmu_setup(unsigned int cpu) |
238 |
+ { |
239 |
+ unsigned i; |
240 |
+ |
241 |
+diff --git a/drivers/base/dd.c b/drivers/base/dd.c |
242 |
+index caaeb7910a046..0047bbdd43c0f 100644 |
243 |
+--- a/drivers/base/dd.c |
244 |
++++ b/drivers/base/dd.c |
245 |
+@@ -792,7 +792,9 @@ static int __device_attach(struct device *dev, bool allow_async) |
246 |
+ int ret = 0; |
247 |
+ |
248 |
+ device_lock(dev); |
249 |
+- if (dev->driver) { |
250 |
++ if (dev->p->dead) { |
251 |
++ goto out_unlock; |
252 |
++ } else if (dev->driver) { |
253 |
+ if (device_is_bound(dev)) { |
254 |
+ ret = 1; |
255 |
+ goto out_unlock; |
256 |
+diff --git a/drivers/clk/sirf/clk-atlas6.c b/drivers/clk/sirf/clk-atlas6.c |
257 |
+index 0cd11e6893afa..25ed60776560e 100644 |
258 |
+--- a/drivers/clk/sirf/clk-atlas6.c |
259 |
++++ b/drivers/clk/sirf/clk-atlas6.c |
260 |
+@@ -136,7 +136,7 @@ static void __init atlas6_clk_init(struct device_node *np) |
261 |
+ |
262 |
+ for (i = pll1; i < maxclk; i++) { |
263 |
+ atlas6_clks[i] = clk_register(NULL, atlas6_clk_hw_array[i]); |
264 |
+- BUG_ON(!atlas6_clks[i]); |
265 |
++ BUG_ON(IS_ERR(atlas6_clks[i])); |
266 |
+ } |
267 |
+ clk_register_clkdev(atlas6_clks[cpu], NULL, "cpu"); |
268 |
+ clk_register_clkdev(atlas6_clks[io], NULL, "io"); |
269 |
+diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
270 |
+index 083aa71487e8e..db87cb8930d24 100644 |
271 |
+--- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
272 |
++++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
273 |
+@@ -2723,7 +2723,10 @@ static int ci_initialize_mc_reg_table(struct pp_hwmgr *hwmgr) |
274 |
+ |
275 |
+ static bool ci_is_dpm_running(struct pp_hwmgr *hwmgr) |
276 |
+ { |
277 |
+- return ci_is_smc_ram_running(hwmgr); |
278 |
++ return (1 == PHM_READ_INDIRECT_FIELD(hwmgr->device, |
279 |
++ CGS_IND_REG__SMC, FEATURE_STATUS, |
280 |
++ VOLTAGE_CONTROLLER_ON)) |
281 |
++ ? true : false; |
282 |
+ } |
283 |
+ |
284 |
+ static int ci_smu_init(struct pp_hwmgr *hwmgr) |
285 |
+diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c |
286 |
+index fa5c25d36d3dc..652de972c3aea 100644 |
287 |
+--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c |
288 |
++++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c |
289 |
+@@ -107,6 +107,12 @@ static const struct dmi_system_id orientation_data[] = { |
290 |
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T101HA"), |
291 |
+ }, |
292 |
+ .driver_data = (void *)&lcd800x1280_rightside_up, |
293 |
++ }, { /* Asus T103HAF */ |
294 |
++ .matches = { |
295 |
++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
296 |
++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T103HAF"), |
297 |
++ }, |
298 |
++ .driver_data = (void *)&lcd800x1280_rightside_up, |
299 |
+ }, { /* GPD MicroPC (generic strings, also match on bios date) */ |
300 |
+ .matches = { |
301 |
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"), |
302 |
+diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c |
303 |
+index 42daa5c9ff8e6..221a8cbc57f90 100644 |
304 |
+--- a/drivers/gpu/drm/imx/imx-ldb.c |
305 |
++++ b/drivers/gpu/drm/imx/imx-ldb.c |
306 |
+@@ -311,18 +311,19 @@ static void imx_ldb_encoder_disable(struct drm_encoder *encoder) |
307 |
+ { |
308 |
+ struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder); |
309 |
+ struct imx_ldb *ldb = imx_ldb_ch->ldb; |
310 |
++ int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; |
311 |
+ int mux, ret; |
312 |
+ |
313 |
+ drm_panel_disable(imx_ldb_ch->panel); |
314 |
+ |
315 |
+- if (imx_ldb_ch == &ldb->channel[0]) |
316 |
++ if (imx_ldb_ch == &ldb->channel[0] || dual) |
317 |
+ ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK; |
318 |
+- else if (imx_ldb_ch == &ldb->channel[1]) |
319 |
++ if (imx_ldb_ch == &ldb->channel[1] || dual) |
320 |
+ ldb->ldb_ctrl &= ~LDB_CH1_MODE_EN_MASK; |
321 |
+ |
322 |
+ regmap_write(ldb->regmap, IOMUXC_GPR2, ldb->ldb_ctrl); |
323 |
+ |
324 |
+- if (ldb->ldb_ctrl & LDB_SPLIT_MODE_EN) { |
325 |
++ if (dual) { |
326 |
+ clk_disable_unprepare(ldb->clk[0]); |
327 |
+ clk_disable_unprepare(ldb->clk[1]); |
328 |
+ } |
329 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |
330 |
+index 6a712a8d59e93..e486b6517ac55 100644 |
331 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |
332 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |
333 |
+@@ -2861,7 +2861,7 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv, |
334 |
+ ++i; |
335 |
+ } |
336 |
+ |
337 |
+- if (i != unit) { |
338 |
++ if (&con->head == &dev_priv->dev->mode_config.connector_list) { |
339 |
+ DRM_ERROR("Could not find initial display unit.\n"); |
340 |
+ ret = -EINVAL; |
341 |
+ goto out_unlock; |
342 |
+@@ -2885,13 +2885,13 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv, |
343 |
+ break; |
344 |
+ } |
345 |
+ |
346 |
+- if (mode->type & DRM_MODE_TYPE_PREFERRED) |
347 |
+- *p_mode = mode; |
348 |
+- else { |
349 |
++ if (&mode->head == &con->modes) { |
350 |
+ WARN_ONCE(true, "Could not find initial preferred mode.\n"); |
351 |
+ *p_mode = list_first_entry(&con->modes, |
352 |
+ struct drm_display_mode, |
353 |
+ head); |
354 |
++ } else { |
355 |
++ *p_mode = mode; |
356 |
+ } |
357 |
+ |
358 |
+ out_unlock: |
359 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c |
360 |
+index 7235781171912..0743a73117000 100644 |
361 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c |
362 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c |
363 |
+@@ -79,7 +79,7 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv) |
364 |
+ struct vmw_legacy_display_unit *entry; |
365 |
+ struct drm_framebuffer *fb = NULL; |
366 |
+ struct drm_crtc *crtc = NULL; |
367 |
+- int i = 0; |
368 |
++ int i; |
369 |
+ |
370 |
+ /* If there is no display topology the host just assumes |
371 |
+ * that the guest will set the same layout as the host. |
372 |
+@@ -90,12 +90,11 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv) |
373 |
+ crtc = &entry->base.crtc; |
374 |
+ w = max(w, crtc->x + crtc->mode.hdisplay); |
375 |
+ h = max(h, crtc->y + crtc->mode.vdisplay); |
376 |
+- i++; |
377 |
+ } |
378 |
+ |
379 |
+ if (crtc == NULL) |
380 |
+ return 0; |
381 |
+- fb = entry->base.crtc.primary->state->fb; |
382 |
++ fb = crtc->primary->state->fb; |
383 |
+ |
384 |
+ return vmw_kms_write_svga(dev_priv, w, h, fb->pitches[0], |
385 |
+ fb->format->cpp[0] * 8, |
386 |
+diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c |
387 |
+index 91653adc41cc4..cdaf1d74e31a2 100644 |
388 |
+--- a/drivers/gpu/ipu-v3/ipu-image-convert.c |
389 |
++++ b/drivers/gpu/ipu-v3/ipu-image-convert.c |
390 |
+@@ -998,9 +998,10 @@ done: |
391 |
+ return IRQ_WAKE_THREAD; |
392 |
+ } |
393 |
+ |
394 |
+-static irqreturn_t norotate_irq(int irq, void *data) |
395 |
++static irqreturn_t eof_irq(int irq, void *data) |
396 |
+ { |
397 |
+ struct ipu_image_convert_chan *chan = data; |
398 |
++ struct ipu_image_convert_priv *priv = chan->priv; |
399 |
+ struct ipu_image_convert_ctx *ctx; |
400 |
+ struct ipu_image_convert_run *run; |
401 |
+ unsigned long flags; |
402 |
+@@ -1017,45 +1018,26 @@ static irqreturn_t norotate_irq(int irq, void *data) |
403 |
+ |
404 |
+ ctx = run->ctx; |
405 |
+ |
406 |
+- if (ipu_rot_mode_is_irt(ctx->rot_mode)) { |
407 |
+- /* this is a rotation operation, just ignore */ |
408 |
+- spin_unlock_irqrestore(&chan->irqlock, flags); |
409 |
+- return IRQ_HANDLED; |
410 |
+- } |
411 |
+- |
412 |
+- ret = do_irq(run); |
413 |
+-out: |
414 |
+- spin_unlock_irqrestore(&chan->irqlock, flags); |
415 |
+- return ret; |
416 |
+-} |
417 |
+- |
418 |
+-static irqreturn_t rotate_irq(int irq, void *data) |
419 |
+-{ |
420 |
+- struct ipu_image_convert_chan *chan = data; |
421 |
+- struct ipu_image_convert_priv *priv = chan->priv; |
422 |
+- struct ipu_image_convert_ctx *ctx; |
423 |
+- struct ipu_image_convert_run *run; |
424 |
+- unsigned long flags; |
425 |
+- irqreturn_t ret; |
426 |
+- |
427 |
+- spin_lock_irqsave(&chan->irqlock, flags); |
428 |
+- |
429 |
+- /* get current run and its context */ |
430 |
+- run = chan->current_run; |
431 |
+- if (!run) { |
432 |
++ if (irq == chan->out_eof_irq) { |
433 |
++ if (ipu_rot_mode_is_irt(ctx->rot_mode)) { |
434 |
++ /* this is a rotation op, just ignore */ |
435 |
++ ret = IRQ_HANDLED; |
436 |
++ goto out; |
437 |
++ } |
438 |
++ } else if (irq == chan->rot_out_eof_irq) { |
439 |
++ if (!ipu_rot_mode_is_irt(ctx->rot_mode)) { |
440 |
++ /* this was NOT a rotation op, shouldn't happen */ |
441 |
++ dev_err(priv->ipu->dev, |
442 |
++ "Unexpected rotation interrupt\n"); |
443 |
++ ret = IRQ_HANDLED; |
444 |
++ goto out; |
445 |
++ } |
446 |
++ } else { |
447 |
++ dev_err(priv->ipu->dev, "Received unknown irq %d\n", irq); |
448 |
+ ret = IRQ_NONE; |
449 |
+ goto out; |
450 |
+ } |
451 |
+ |
452 |
+- ctx = run->ctx; |
453 |
+- |
454 |
+- if (!ipu_rot_mode_is_irt(ctx->rot_mode)) { |
455 |
+- /* this was NOT a rotation operation, shouldn't happen */ |
456 |
+- dev_err(priv->ipu->dev, "Unexpected rotation interrupt\n"); |
457 |
+- spin_unlock_irqrestore(&chan->irqlock, flags); |
458 |
+- return IRQ_HANDLED; |
459 |
+- } |
460 |
+- |
461 |
+ ret = do_irq(run); |
462 |
+ out: |
463 |
+ spin_unlock_irqrestore(&chan->irqlock, flags); |
464 |
+@@ -1148,7 +1130,7 @@ static int get_ipu_resources(struct ipu_image_convert_chan *chan) |
465 |
+ chan->out_chan, |
466 |
+ IPU_IRQ_EOF); |
467 |
+ |
468 |
+- ret = request_threaded_irq(chan->out_eof_irq, norotate_irq, do_bh, |
469 |
++ ret = request_threaded_irq(chan->out_eof_irq, eof_irq, do_bh, |
470 |
+ 0, "ipu-ic", chan); |
471 |
+ if (ret < 0) { |
472 |
+ dev_err(priv->ipu->dev, "could not acquire irq %d\n", |
473 |
+@@ -1161,7 +1143,7 @@ static int get_ipu_resources(struct ipu_image_convert_chan *chan) |
474 |
+ chan->rotation_out_chan, |
475 |
+ IPU_IRQ_EOF); |
476 |
+ |
477 |
+- ret = request_threaded_irq(chan->rot_out_eof_irq, rotate_irq, do_bh, |
478 |
++ ret = request_threaded_irq(chan->rot_out_eof_irq, eof_irq, do_bh, |
479 |
+ 0, "ipu-ic", chan); |
480 |
+ if (ret < 0) { |
481 |
+ dev_err(priv->ipu->dev, "could not acquire irq %d\n", |
482 |
+diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c |
483 |
+index 6e49e438ef5a5..dcdce18fc7062 100644 |
484 |
+--- a/drivers/i2c/busses/i2c-rcar.c |
485 |
++++ b/drivers/i2c/busses/i2c-rcar.c |
486 |
+@@ -587,13 +587,14 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv) |
487 |
+ rcar_i2c_write(priv, ICSIER, SDR | SSR | SAR); |
488 |
+ } |
489 |
+ |
490 |
+- rcar_i2c_write(priv, ICSSR, ~SAR & 0xff); |
491 |
++ /* Clear SSR, too, because of old STOPs to other clients than us */ |
492 |
++ rcar_i2c_write(priv, ICSSR, ~(SAR | SSR) & 0xff); |
493 |
+ } |
494 |
+ |
495 |
+ /* master sent stop */ |
496 |
+ if (ssr_filtered & SSR) { |
497 |
+ i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value); |
498 |
+- rcar_i2c_write(priv, ICSIER, SAR | SSR); |
499 |
++ rcar_i2c_write(priv, ICSIER, SAR); |
500 |
+ rcar_i2c_write(priv, ICSSR, ~SSR & 0xff); |
501 |
+ } |
502 |
+ |
503 |
+@@ -848,7 +849,7 @@ static int rcar_reg_slave(struct i2c_client *slave) |
504 |
+ priv->slave = slave; |
505 |
+ rcar_i2c_write(priv, ICSAR, slave->addr); |
506 |
+ rcar_i2c_write(priv, ICSSR, 0); |
507 |
+- rcar_i2c_write(priv, ICSIER, SAR | SSR); |
508 |
++ rcar_i2c_write(priv, ICSIER, SAR); |
509 |
+ rcar_i2c_write(priv, ICSCR, SIE | SDBS); |
510 |
+ |
511 |
+ return 0; |
512 |
+@@ -860,12 +861,14 @@ static int rcar_unreg_slave(struct i2c_client *slave) |
513 |
+ |
514 |
+ WARN_ON(!priv->slave); |
515 |
+ |
516 |
+- /* disable irqs and ensure none is running before clearing ptr */ |
517 |
++ /* ensure no irq is running before clearing ptr */ |
518 |
++ disable_irq(priv->irq); |
519 |
+ rcar_i2c_write(priv, ICSIER, 0); |
520 |
+- rcar_i2c_write(priv, ICSCR, 0); |
521 |
++ rcar_i2c_write(priv, ICSSR, 0); |
522 |
++ enable_irq(priv->irq); |
523 |
++ rcar_i2c_write(priv, ICSCR, SDBS); |
524 |
+ rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */ |
525 |
+ |
526 |
+- synchronize_irq(priv->irq); |
527 |
+ priv->slave = NULL; |
528 |
+ |
529 |
+ pm_runtime_put(rcar_i2c_priv_to_dev(priv)); |
530 |
+diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c |
531 |
+index 095530c233e41..7549abd544c0f 100644 |
532 |
+--- a/drivers/iio/dac/ad5592r-base.c |
533 |
++++ b/drivers/iio/dac/ad5592r-base.c |
534 |
+@@ -417,7 +417,7 @@ static int ad5592r_read_raw(struct iio_dev *iio_dev, |
535 |
+ s64 tmp = *val * (3767897513LL / 25LL); |
536 |
+ *val = div_s64_rem(tmp, 1000000000LL, val2); |
537 |
+ |
538 |
+- ret = IIO_VAL_INT_PLUS_MICRO; |
539 |
++ return IIO_VAL_INT_PLUS_MICRO; |
540 |
+ } else { |
541 |
+ int mult; |
542 |
+ |
543 |
+@@ -448,7 +448,7 @@ static int ad5592r_read_raw(struct iio_dev *iio_dev, |
544 |
+ ret = IIO_VAL_INT; |
545 |
+ break; |
546 |
+ default: |
547 |
+- ret = -EINVAL; |
548 |
++ return -EINVAL; |
549 |
+ } |
550 |
+ |
551 |
+ unlock: |
552 |
+diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h |
553 |
+index 85267bbf48360..ef12221017053 100644 |
554 |
+--- a/drivers/infiniband/ulp/ipoib/ipoib.h |
555 |
++++ b/drivers/infiniband/ulp/ipoib/ipoib.h |
556 |
+@@ -513,7 +513,7 @@ void ipoib_ib_dev_cleanup(struct net_device *dev); |
557 |
+ |
558 |
+ int ipoib_ib_dev_open_default(struct net_device *dev); |
559 |
+ int ipoib_ib_dev_open(struct net_device *dev); |
560 |
+-int ipoib_ib_dev_stop(struct net_device *dev); |
561 |
++void ipoib_ib_dev_stop(struct net_device *dev); |
562 |
+ void ipoib_ib_dev_up(struct net_device *dev); |
563 |
+ void ipoib_ib_dev_down(struct net_device *dev); |
564 |
+ int ipoib_ib_dev_stop_default(struct net_device *dev); |
565 |
+diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c |
566 |
+index 0f2e80f54d333..82b9c5b6e3e65 100644 |
567 |
+--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c |
568 |
++++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c |
569 |
+@@ -669,14 +669,13 @@ int ipoib_send(struct net_device *dev, struct sk_buff *skb, |
570 |
+ return rc; |
571 |
+ } |
572 |
+ |
573 |
+-static void __ipoib_reap_ah(struct net_device *dev) |
574 |
++static void ipoib_reap_dead_ahs(struct ipoib_dev_priv *priv) |
575 |
+ { |
576 |
+- struct ipoib_dev_priv *priv = ipoib_priv(dev); |
577 |
+ struct ipoib_ah *ah, *tah; |
578 |
+ LIST_HEAD(remove_list); |
579 |
+ unsigned long flags; |
580 |
+ |
581 |
+- netif_tx_lock_bh(dev); |
582 |
++ netif_tx_lock_bh(priv->dev); |
583 |
+ spin_lock_irqsave(&priv->lock, flags); |
584 |
+ |
585 |
+ list_for_each_entry_safe(ah, tah, &priv->dead_ahs, list) |
586 |
+@@ -687,37 +686,37 @@ static void __ipoib_reap_ah(struct net_device *dev) |
587 |
+ } |
588 |
+ |
589 |
+ spin_unlock_irqrestore(&priv->lock, flags); |
590 |
+- netif_tx_unlock_bh(dev); |
591 |
++ netif_tx_unlock_bh(priv->dev); |
592 |
+ } |
593 |
+ |
594 |
+ void ipoib_reap_ah(struct work_struct *work) |
595 |
+ { |
596 |
+ struct ipoib_dev_priv *priv = |
597 |
+ container_of(work, struct ipoib_dev_priv, ah_reap_task.work); |
598 |
+- struct net_device *dev = priv->dev; |
599 |
+ |
600 |
+- __ipoib_reap_ah(dev); |
601 |
++ ipoib_reap_dead_ahs(priv); |
602 |
+ |
603 |
+ if (!test_bit(IPOIB_STOP_REAPER, &priv->flags)) |
604 |
+ queue_delayed_work(priv->wq, &priv->ah_reap_task, |
605 |
+ round_jiffies_relative(HZ)); |
606 |
+ } |
607 |
+ |
608 |
+-static void ipoib_flush_ah(struct net_device *dev) |
609 |
++static void ipoib_start_ah_reaper(struct ipoib_dev_priv *priv) |
610 |
+ { |
611 |
+- struct ipoib_dev_priv *priv = ipoib_priv(dev); |
612 |
+- |
613 |
+- cancel_delayed_work(&priv->ah_reap_task); |
614 |
+- flush_workqueue(priv->wq); |
615 |
+- ipoib_reap_ah(&priv->ah_reap_task.work); |
616 |
++ clear_bit(IPOIB_STOP_REAPER, &priv->flags); |
617 |
++ queue_delayed_work(priv->wq, &priv->ah_reap_task, |
618 |
++ round_jiffies_relative(HZ)); |
619 |
+ } |
620 |
+ |
621 |
+-static void ipoib_stop_ah(struct net_device *dev) |
622 |
++static void ipoib_stop_ah_reaper(struct ipoib_dev_priv *priv) |
623 |
+ { |
624 |
+- struct ipoib_dev_priv *priv = ipoib_priv(dev); |
625 |
+- |
626 |
+ set_bit(IPOIB_STOP_REAPER, &priv->flags); |
627 |
+- ipoib_flush_ah(dev); |
628 |
++ cancel_delayed_work(&priv->ah_reap_task); |
629 |
++ /* |
630 |
++ * After ipoib_stop_ah_reaper() we always go through |
631 |
++ * ipoib_reap_dead_ahs() which ensures the work is really stopped and |
632 |
++ * does a final flush out of the dead_ah's list |
633 |
++ */ |
634 |
+ } |
635 |
+ |
636 |
+ static int recvs_pending(struct net_device *dev) |
637 |
+@@ -846,18 +845,6 @@ timeout: |
638 |
+ return 0; |
639 |
+ } |
640 |
+ |
641 |
+-int ipoib_ib_dev_stop(struct net_device *dev) |
642 |
+-{ |
643 |
+- struct ipoib_dev_priv *priv = ipoib_priv(dev); |
644 |
+- |
645 |
+- priv->rn_ops->ndo_stop(dev); |
646 |
+- |
647 |
+- clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); |
648 |
+- ipoib_flush_ah(dev); |
649 |
+- |
650 |
+- return 0; |
651 |
+-} |
652 |
+- |
653 |
+ int ipoib_ib_dev_open_default(struct net_device *dev) |
654 |
+ { |
655 |
+ struct ipoib_dev_priv *priv = ipoib_priv(dev); |
656 |
+@@ -901,10 +888,7 @@ int ipoib_ib_dev_open(struct net_device *dev) |
657 |
+ return -1; |
658 |
+ } |
659 |
+ |
660 |
+- clear_bit(IPOIB_STOP_REAPER, &priv->flags); |
661 |
+- queue_delayed_work(priv->wq, &priv->ah_reap_task, |
662 |
+- round_jiffies_relative(HZ)); |
663 |
+- |
664 |
++ ipoib_start_ah_reaper(priv); |
665 |
+ if (priv->rn_ops->ndo_open(dev)) { |
666 |
+ pr_warn("%s: Failed to open dev\n", dev->name); |
667 |
+ goto dev_stop; |
668 |
+@@ -915,13 +899,20 @@ int ipoib_ib_dev_open(struct net_device *dev) |
669 |
+ return 0; |
670 |
+ |
671 |
+ dev_stop: |
672 |
+- set_bit(IPOIB_STOP_REAPER, &priv->flags); |
673 |
+- cancel_delayed_work(&priv->ah_reap_task); |
674 |
+- set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); |
675 |
+- ipoib_ib_dev_stop(dev); |
676 |
++ ipoib_stop_ah_reaper(priv); |
677 |
+ return -1; |
678 |
+ } |
679 |
+ |
680 |
++void ipoib_ib_dev_stop(struct net_device *dev) |
681 |
++{ |
682 |
++ struct ipoib_dev_priv *priv = ipoib_priv(dev); |
683 |
++ |
684 |
++ priv->rn_ops->ndo_stop(dev); |
685 |
++ |
686 |
++ clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); |
687 |
++ ipoib_stop_ah_reaper(priv); |
688 |
++} |
689 |
++ |
690 |
+ void ipoib_pkey_dev_check_presence(struct net_device *dev) |
691 |
+ { |
692 |
+ struct ipoib_dev_priv *priv = ipoib_priv(dev); |
693 |
+@@ -1232,7 +1223,7 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, |
694 |
+ ipoib_mcast_dev_flush(dev); |
695 |
+ if (oper_up) |
696 |
+ set_bit(IPOIB_FLAG_OPER_UP, &priv->flags); |
697 |
+- ipoib_flush_ah(dev); |
698 |
++ ipoib_reap_dead_ahs(priv); |
699 |
+ } |
700 |
+ |
701 |
+ if (level >= IPOIB_FLUSH_NORMAL) |
702 |
+@@ -1307,7 +1298,7 @@ void ipoib_ib_dev_cleanup(struct net_device *dev) |
703 |
+ * the neighbor garbage collection is stopped and reaped. |
704 |
+ * That should all be done now, so make a final ah flush. |
705 |
+ */ |
706 |
+- ipoib_stop_ah(dev); |
707 |
++ ipoib_reap_dead_ahs(priv); |
708 |
+ |
709 |
+ clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); |
710 |
+ |
711 |
+diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c |
712 |
+index 6093e8268583d..d0c35eb687aeb 100644 |
713 |
+--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c |
714 |
++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c |
715 |
+@@ -1979,6 +1979,8 @@ static void ipoib_ndo_uninit(struct net_device *dev) |
716 |
+ |
717 |
+ /* no more works over the priv->wq */ |
718 |
+ if (priv->wq) { |
719 |
++ /* See ipoib_mcast_carrier_on_task() */ |
720 |
++ WARN_ON(test_bit(IPOIB_FLAG_OPER_UP, &priv->flags)); |
721 |
+ flush_workqueue(priv->wq); |
722 |
+ destroy_workqueue(priv->wq); |
723 |
+ priv->wq = NULL; |
724 |
+diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c |
725 |
+index 1d6010d463e2c..022a8cb58a066 100644 |
726 |
+--- a/drivers/input/mouse/sentelic.c |
727 |
++++ b/drivers/input/mouse/sentelic.c |
728 |
+@@ -454,7 +454,7 @@ static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data, |
729 |
+ |
730 |
+ fsp_reg_write_enable(psmouse, false); |
731 |
+ |
732 |
+- return count; |
733 |
++ return retval; |
734 |
+ } |
735 |
+ |
736 |
+ PSMOUSE_DEFINE_WO_ATTR(setreg, S_IWUSR, NULL, fsp_attr_set_setreg); |
737 |
+diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c |
738 |
+index 50217548c3b8e..5ce55fabc9d80 100644 |
739 |
+--- a/drivers/iommu/omap-iommu-debug.c |
740 |
++++ b/drivers/iommu/omap-iommu-debug.c |
741 |
+@@ -101,8 +101,11 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf, |
742 |
+ mutex_lock(&iommu_debug_lock); |
743 |
+ |
744 |
+ bytes = omap_iommu_dump_ctx(obj, p, count); |
745 |
++ if (bytes < 0) |
746 |
++ goto err; |
747 |
+ bytes = simple_read_from_buffer(userbuf, count, ppos, buf, bytes); |
748 |
+ |
749 |
++err: |
750 |
+ mutex_unlock(&iommu_debug_lock); |
751 |
+ kfree(buf); |
752 |
+ |
753 |
+diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c |
754 |
+index fe7d63cdfb1d7..d5cc32e80f5e2 100644 |
755 |
+--- a/drivers/irqchip/irq-gic-v3-its.c |
756 |
++++ b/drivers/irqchip/irq-gic-v3-its.c |
757 |
+@@ -2458,6 +2458,7 @@ static int its_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, |
758 |
+ { |
759 |
+ msi_alloc_info_t *info = args; |
760 |
+ struct its_device *its_dev = info->scratchpad[0].ptr; |
761 |
++ struct irq_data *irqd; |
762 |
+ irq_hw_number_t hwirq; |
763 |
+ int err; |
764 |
+ int i; |
765 |
+@@ -2473,7 +2474,9 @@ static int its_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, |
766 |
+ |
767 |
+ irq_domain_set_hwirq_and_chip(domain, virq + i, |
768 |
+ hwirq + i, &its_irq_chip, its_dev); |
769 |
+- irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq + i))); |
770 |
++ irqd = irq_get_irq_data(virq + i); |
771 |
++ irqd_set_single_target(irqd); |
772 |
++ irqd_set_affinity_on_activate(irqd); |
773 |
+ pr_debug("ID:%d pID:%d vID:%d\n", |
774 |
+ (int)(hwirq + i - its_dev->event_map.lpi_base), |
775 |
+ (int)(hwirq + i), virq + i); |
776 |
+diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h |
777 |
+index 2a2f189dd37cb..1cc6ae3e058c6 100644 |
778 |
+--- a/drivers/md/bcache/bcache.h |
779 |
++++ b/drivers/md/bcache/bcache.h |
780 |
+@@ -264,7 +264,7 @@ struct bcache_device { |
781 |
+ #define BCACHE_DEV_UNLINK_DONE 2 |
782 |
+ #define BCACHE_DEV_WB_RUNNING 3 |
783 |
+ #define BCACHE_DEV_RATE_DW_RUNNING 4 |
784 |
+- unsigned int nr_stripes; |
785 |
++ int nr_stripes; |
786 |
+ unsigned int stripe_size; |
787 |
+ atomic_t *stripe_sectors_dirty; |
788 |
+ unsigned long *full_dirty_stripes; |
789 |
+diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c |
790 |
+index 268f1b6850840..ec48cf86cab60 100644 |
791 |
+--- a/drivers/md/bcache/bset.c |
792 |
++++ b/drivers/md/bcache/bset.c |
793 |
+@@ -321,7 +321,7 @@ int bch_btree_keys_alloc(struct btree_keys *b, |
794 |
+ |
795 |
+ b->page_order = page_order; |
796 |
+ |
797 |
+- t->data = (void *) __get_free_pages(gfp, b->page_order); |
798 |
++ t->data = (void *) __get_free_pages(__GFP_COMP|gfp, b->page_order); |
799 |
+ if (!t->data) |
800 |
+ goto err; |
801 |
+ |
802 |
+diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c |
803 |
+index 38a8f8d2a908d..d320574b9a4c8 100644 |
804 |
+--- a/drivers/md/bcache/btree.c |
805 |
++++ b/drivers/md/bcache/btree.c |
806 |
+@@ -830,7 +830,7 @@ int bch_btree_cache_alloc(struct cache_set *c) |
807 |
+ mutex_init(&c->verify_lock); |
808 |
+ |
809 |
+ c->verify_ondisk = (void *) |
810 |
+- __get_free_pages(GFP_KERNEL, ilog2(bucket_pages(c))); |
811 |
++ __get_free_pages(GFP_KERNEL|__GFP_COMP, ilog2(bucket_pages(c))); |
812 |
+ |
813 |
+ c->verify_data = mca_bucket_alloc(c, &ZERO_KEY, GFP_KERNEL); |
814 |
+ |
815 |
+diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c |
816 |
+index 7bb15cddca5ec..182c2b7bd9601 100644 |
817 |
+--- a/drivers/md/bcache/journal.c |
818 |
++++ b/drivers/md/bcache/journal.c |
819 |
+@@ -864,8 +864,8 @@ int bch_journal_alloc(struct cache_set *c) |
820 |
+ j->w[1].c = c; |
821 |
+ |
822 |
+ if (!(init_fifo(&j->pin, JOURNAL_PIN, GFP_KERNEL)) || |
823 |
+- !(j->w[0].data = (void *) __get_free_pages(GFP_KERNEL, JSET_BITS)) || |
824 |
+- !(j->w[1].data = (void *) __get_free_pages(GFP_KERNEL, JSET_BITS))) |
825 |
++ !(j->w[0].data = (void *) __get_free_pages(GFP_KERNEL|__GFP_COMP, JSET_BITS)) || |
826 |
++ !(j->w[1].data = (void *) __get_free_pages(GFP_KERNEL|__GFP_COMP, JSET_BITS))) |
827 |
+ return -ENOMEM; |
828 |
+ |
829 |
+ return 0; |
830 |
+diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c |
831 |
+index 46ad0bf18e1fd..825bfde10c694 100644 |
832 |
+--- a/drivers/md/bcache/super.c |
833 |
++++ b/drivers/md/bcache/super.c |
834 |
+@@ -1693,7 +1693,7 @@ void bch_cache_set_unregister(struct cache_set *c) |
835 |
+ } |
836 |
+ |
837 |
+ #define alloc_bucket_pages(gfp, c) \ |
838 |
+- ((void *) __get_free_pages(__GFP_ZERO|gfp, ilog2(bucket_pages(c)))) |
839 |
++ ((void *) __get_free_pages(__GFP_ZERO|__GFP_COMP|gfp, ilog2(bucket_pages(c)))) |
840 |
+ |
841 |
+ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) |
842 |
+ { |
843 |
+diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c |
844 |
+index b5fc3c6c7178e..aa58833fb012f 100644 |
845 |
+--- a/drivers/md/bcache/writeback.c |
846 |
++++ b/drivers/md/bcache/writeback.c |
847 |
+@@ -506,15 +506,19 @@ void bcache_dev_sectors_dirty_add(struct cache_set *c, unsigned int inode, |
848 |
+ uint64_t offset, int nr_sectors) |
849 |
+ { |
850 |
+ struct bcache_device *d = c->devices[inode]; |
851 |
+- unsigned int stripe_offset, stripe, sectors_dirty; |
852 |
++ unsigned int stripe_offset, sectors_dirty; |
853 |
++ int stripe; |
854 |
+ |
855 |
+ if (!d) |
856 |
+ return; |
857 |
+ |
858 |
++ stripe = offset_to_stripe(d, offset); |
859 |
++ if (stripe < 0) |
860 |
++ return; |
861 |
++ |
862 |
+ if (UUID_FLASH_ONLY(&c->uuids[inode])) |
863 |
+ atomic_long_add(nr_sectors, &c->flash_dev_dirty_sectors); |
864 |
+ |
865 |
+- stripe = offset_to_stripe(d, offset); |
866 |
+ stripe_offset = offset & (d->stripe_size - 1); |
867 |
+ |
868 |
+ while (nr_sectors) { |
869 |
+@@ -554,12 +558,12 @@ static bool dirty_pred(struct keybuf *buf, struct bkey *k) |
870 |
+ static void refill_full_stripes(struct cached_dev *dc) |
871 |
+ { |
872 |
+ struct keybuf *buf = &dc->writeback_keys; |
873 |
+- unsigned int start_stripe, stripe, next_stripe; |
874 |
++ unsigned int start_stripe, next_stripe; |
875 |
++ int stripe; |
876 |
+ bool wrapped = false; |
877 |
+ |
878 |
+ stripe = offset_to_stripe(&dc->disk, KEY_OFFSET(&buf->last_scanned)); |
879 |
+- |
880 |
+- if (stripe >= dc->disk.nr_stripes) |
881 |
++ if (stripe < 0) |
882 |
+ stripe = 0; |
883 |
+ |
884 |
+ start_stripe = stripe; |
885 |
+diff --git a/drivers/md/bcache/writeback.h b/drivers/md/bcache/writeback.h |
886 |
+index e75dc33339f6f..b902e574c5c40 100644 |
887 |
+--- a/drivers/md/bcache/writeback.h |
888 |
++++ b/drivers/md/bcache/writeback.h |
889 |
+@@ -28,10 +28,22 @@ static inline uint64_t bcache_dev_sectors_dirty(struct bcache_device *d) |
890 |
+ return ret; |
891 |
+ } |
892 |
+ |
893 |
+-static inline unsigned int offset_to_stripe(struct bcache_device *d, |
894 |
++static inline int offset_to_stripe(struct bcache_device *d, |
895 |
+ uint64_t offset) |
896 |
+ { |
897 |
+ do_div(offset, d->stripe_size); |
898 |
++ |
899 |
++ /* d->nr_stripes is in range [1, INT_MAX] */ |
900 |
++ if (unlikely(offset >= d->nr_stripes)) { |
901 |
++ pr_err("Invalid stripe %llu (>= nr_stripes %d).\n", |
902 |
++ offset, d->nr_stripes); |
903 |
++ return -EINVAL; |
904 |
++ } |
905 |
++ |
906 |
++ /* |
907 |
++ * Here offset is definitly smaller than INT_MAX, |
908 |
++ * return it as int will never overflow. |
909 |
++ */ |
910 |
+ return offset; |
911 |
+ } |
912 |
+ |
913 |
+@@ -39,7 +51,10 @@ static inline bool bcache_dev_stripe_dirty(struct cached_dev *dc, |
914 |
+ uint64_t offset, |
915 |
+ unsigned int nr_sectors) |
916 |
+ { |
917 |
+- unsigned int stripe = offset_to_stripe(&dc->disk, offset); |
918 |
++ int stripe = offset_to_stripe(&dc->disk, offset); |
919 |
++ |
920 |
++ if (stripe < 0) |
921 |
++ return false; |
922 |
+ |
923 |
+ while (1) { |
924 |
+ if (atomic_read(dc->disk.stripe_sectors_dirty + stripe)) |
925 |
+diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c |
926 |
+index 4d36373e1c0f0..9fde174ce3961 100644 |
927 |
+--- a/drivers/md/dm-rq.c |
928 |
++++ b/drivers/md/dm-rq.c |
929 |
+@@ -95,9 +95,6 @@ static void dm_old_stop_queue(struct request_queue *q) |
930 |
+ |
931 |
+ static void dm_mq_stop_queue(struct request_queue *q) |
932 |
+ { |
933 |
+- if (blk_mq_queue_stopped(q)) |
934 |
+- return; |
935 |
+- |
936 |
+ blk_mq_quiesce_queue(q); |
937 |
+ } |
938 |
+ |
939 |
+diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c |
940 |
+index 01021382131bc..d91154d654550 100644 |
941 |
+--- a/drivers/md/raid5.c |
942 |
++++ b/drivers/md/raid5.c |
943 |
+@@ -3596,6 +3596,7 @@ static int need_this_block(struct stripe_head *sh, struct stripe_head_state *s, |
944 |
+ * is missing/faulty, then we need to read everything we can. |
945 |
+ */ |
946 |
+ if (sh->raid_conf->level != 6 && |
947 |
++ sh->raid_conf->rmw_level != PARITY_DISABLE_RMW && |
948 |
+ sh->sector < sh->raid_conf->mddev->recovery_cp) |
949 |
+ /* reconstruct-write isn't being forced */ |
950 |
+ return 0; |
951 |
+@@ -4832,7 +4833,7 @@ static void handle_stripe(struct stripe_head *sh) |
952 |
+ * or to load a block that is being partially written. |
953 |
+ */ |
954 |
+ if (s.to_read || s.non_overwrite |
955 |
+- || (conf->level == 6 && s.to_write && s.failed) |
956 |
++ || (s.to_write && s.failed) |
957 |
+ || (s.syncing && (s.uptodate + s.compute < disks)) |
958 |
+ || s.replacing |
959 |
+ || s.expanding) |
960 |
+diff --git a/drivers/media/platform/rockchip/rga/rga-hw.c b/drivers/media/platform/rockchip/rga/rga-hw.c |
961 |
+index 96d1b1b3fe8e8..681de42f12e9a 100644 |
962 |
+--- a/drivers/media/platform/rockchip/rga/rga-hw.c |
963 |
++++ b/drivers/media/platform/rockchip/rga/rga-hw.c |
964 |
+@@ -208,22 +208,25 @@ static void rga_cmd_set_trans_info(struct rga_ctx *ctx) |
965 |
+ dst_info.data.format = ctx->out.fmt->hw_format; |
966 |
+ dst_info.data.swap = ctx->out.fmt->color_swap; |
967 |
+ |
968 |
+- if (ctx->in.fmt->hw_format >= RGA_COLOR_FMT_YUV422SP) { |
969 |
+- if (ctx->out.fmt->hw_format < RGA_COLOR_FMT_YUV422SP) { |
970 |
+- switch (ctx->in.colorspace) { |
971 |
+- case V4L2_COLORSPACE_REC709: |
972 |
+- src_info.data.csc_mode = |
973 |
+- RGA_SRC_CSC_MODE_BT709_R0; |
974 |
+- break; |
975 |
+- default: |
976 |
+- src_info.data.csc_mode = |
977 |
+- RGA_SRC_CSC_MODE_BT601_R0; |
978 |
+- break; |
979 |
+- } |
980 |
++ /* |
981 |
++ * CSC mode must only be set when the colorspace families differ between |
982 |
++ * input and output. It must remain unset (zeroed) if both are the same. |
983 |
++ */ |
984 |
++ |
985 |
++ if (RGA_COLOR_FMT_IS_YUV(ctx->in.fmt->hw_format) && |
986 |
++ RGA_COLOR_FMT_IS_RGB(ctx->out.fmt->hw_format)) { |
987 |
++ switch (ctx->in.colorspace) { |
988 |
++ case V4L2_COLORSPACE_REC709: |
989 |
++ src_info.data.csc_mode = RGA_SRC_CSC_MODE_BT709_R0; |
990 |
++ break; |
991 |
++ default: |
992 |
++ src_info.data.csc_mode = RGA_SRC_CSC_MODE_BT601_R0; |
993 |
++ break; |
994 |
+ } |
995 |
+ } |
996 |
+ |
997 |
+- if (ctx->out.fmt->hw_format >= RGA_COLOR_FMT_YUV422SP) { |
998 |
++ if (RGA_COLOR_FMT_IS_RGB(ctx->in.fmt->hw_format) && |
999 |
++ RGA_COLOR_FMT_IS_YUV(ctx->out.fmt->hw_format)) { |
1000 |
+ switch (ctx->out.colorspace) { |
1001 |
+ case V4L2_COLORSPACE_REC709: |
1002 |
+ dst_info.data.csc_mode = RGA_SRC_CSC_MODE_BT709_R0; |
1003 |
+diff --git a/drivers/media/platform/rockchip/rga/rga-hw.h b/drivers/media/platform/rockchip/rga/rga-hw.h |
1004 |
+index ca3c204abe420..3e4b70eb9ced5 100644 |
1005 |
+--- a/drivers/media/platform/rockchip/rga/rga-hw.h |
1006 |
++++ b/drivers/media/platform/rockchip/rga/rga-hw.h |
1007 |
+@@ -103,6 +103,11 @@ |
1008 |
+ #define RGA_COLOR_FMT_CP_8BPP 15 |
1009 |
+ #define RGA_COLOR_FMT_MASK 15 |
1010 |
+ |
1011 |
++#define RGA_COLOR_FMT_IS_YUV(fmt) \ |
1012 |
++ (((fmt) >= RGA_COLOR_FMT_YUV422SP) && ((fmt) < RGA_COLOR_FMT_CP_1BPP)) |
1013 |
++#define RGA_COLOR_FMT_IS_RGB(fmt) \ |
1014 |
++ ((fmt) < RGA_COLOR_FMT_YUV422SP) |
1015 |
++ |
1016 |
+ #define RGA_COLOR_NONE_SWAP 0 |
1017 |
+ #define RGA_COLOR_RB_SWAP 1 |
1018 |
+ #define RGA_COLOR_ALPHA_SWAP 2 |
1019 |
+diff --git a/drivers/media/platform/vsp1/vsp1_dl.c b/drivers/media/platform/vsp1/vsp1_dl.c |
1020 |
+index a5634ca85a316..a07caf981e15a 100644 |
1021 |
+--- a/drivers/media/platform/vsp1/vsp1_dl.c |
1022 |
++++ b/drivers/media/platform/vsp1/vsp1_dl.c |
1023 |
+@@ -431,6 +431,8 @@ vsp1_dl_cmd_pool_create(struct vsp1_device *vsp1, enum vsp1_extcmd_type type, |
1024 |
+ if (!pool) |
1025 |
+ return NULL; |
1026 |
+ |
1027 |
++ pool->vsp1 = vsp1; |
1028 |
++ |
1029 |
+ spin_lock_init(&pool->lock); |
1030 |
+ INIT_LIST_HEAD(&pool->free); |
1031 |
+ |
1032 |
+diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c |
1033 |
+index a4403a57ddc89..09acaa2cf74a2 100644 |
1034 |
+--- a/drivers/mfd/arizona-core.c |
1035 |
++++ b/drivers/mfd/arizona-core.c |
1036 |
+@@ -1433,6 +1433,15 @@ err_irq: |
1037 |
+ arizona_irq_exit(arizona); |
1038 |
+ err_pm: |
1039 |
+ pm_runtime_disable(arizona->dev); |
1040 |
++ |
1041 |
++ switch (arizona->pdata.clk32k_src) { |
1042 |
++ case ARIZONA_32KZ_MCLK1: |
1043 |
++ case ARIZONA_32KZ_MCLK2: |
1044 |
++ arizona_clk32k_disable(arizona); |
1045 |
++ break; |
1046 |
++ default: |
1047 |
++ break; |
1048 |
++ } |
1049 |
+ err_reset: |
1050 |
+ arizona_enable_reset(arizona); |
1051 |
+ regulator_disable(arizona->dcvdd); |
1052 |
+@@ -1455,6 +1464,15 @@ int arizona_dev_exit(struct arizona *arizona) |
1053 |
+ regulator_disable(arizona->dcvdd); |
1054 |
+ regulator_put(arizona->dcvdd); |
1055 |
+ |
1056 |
++ switch (arizona->pdata.clk32k_src) { |
1057 |
++ case ARIZONA_32KZ_MCLK1: |
1058 |
++ case ARIZONA_32KZ_MCLK2: |
1059 |
++ arizona_clk32k_disable(arizona); |
1060 |
++ break; |
1061 |
++ default: |
1062 |
++ break; |
1063 |
++ } |
1064 |
++ |
1065 |
+ mfd_remove_devices(arizona->dev); |
1066 |
+ arizona_free_irq(arizona, ARIZONA_IRQ_UNDERCLOCKED, arizona); |
1067 |
+ arizona_free_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, arizona); |
1068 |
+diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c |
1069 |
+index 6ea0dd37b4535..fe614ba5fec90 100644 |
1070 |
+--- a/drivers/mfd/dln2.c |
1071 |
++++ b/drivers/mfd/dln2.c |
1072 |
+@@ -290,7 +290,11 @@ static void dln2_rx(struct urb *urb) |
1073 |
+ len = urb->actual_length - sizeof(struct dln2_header); |
1074 |
+ |
1075 |
+ if (handle == DLN2_HANDLE_EVENT) { |
1076 |
++ unsigned long flags; |
1077 |
++ |
1078 |
++ spin_lock_irqsave(&dln2->event_cb_lock, flags); |
1079 |
+ dln2_run_event_callbacks(dln2, id, echo, data, len); |
1080 |
++ spin_unlock_irqrestore(&dln2->event_cb_lock, flags); |
1081 |
+ } else { |
1082 |
+ /* URB will be re-submitted in _dln2_transfer (free_rx_slot) */ |
1083 |
+ if (dln2_transfer_complete(dln2, urb, handle, echo)) |
1084 |
+diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c |
1085 |
+index 382172fb3da8f..74eea8247490d 100644 |
1086 |
+--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c |
1087 |
++++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c |
1088 |
+@@ -222,15 +222,12 @@ static void renesas_sdhi_internal_dmac_issue_tasklet_fn(unsigned long arg) |
1089 |
+ DTRAN_CTRL_DM_START); |
1090 |
+ } |
1091 |
+ |
1092 |
+-static void renesas_sdhi_internal_dmac_complete_tasklet_fn(unsigned long arg) |
1093 |
++static bool renesas_sdhi_internal_dmac_complete(struct tmio_mmc_host *host) |
1094 |
+ { |
1095 |
+- struct tmio_mmc_host *host = (struct tmio_mmc_host *)arg; |
1096 |
+ enum dma_data_direction dir; |
1097 |
+ |
1098 |
+- spin_lock_irq(&host->lock); |
1099 |
+- |
1100 |
+ if (!host->data) |
1101 |
+- goto out; |
1102 |
++ return false; |
1103 |
+ |
1104 |
+ if (host->data->flags & MMC_DATA_READ) |
1105 |
+ dir = DMA_FROM_DEVICE; |
1106 |
+@@ -243,6 +240,17 @@ static void renesas_sdhi_internal_dmac_complete_tasklet_fn(unsigned long arg) |
1107 |
+ if (dir == DMA_FROM_DEVICE) |
1108 |
+ clear_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags); |
1109 |
+ |
1110 |
++ return true; |
1111 |
++} |
1112 |
++ |
1113 |
++static void renesas_sdhi_internal_dmac_complete_tasklet_fn(unsigned long arg) |
1114 |
++{ |
1115 |
++ struct tmio_mmc_host *host = (struct tmio_mmc_host *)arg; |
1116 |
++ |
1117 |
++ spin_lock_irq(&host->lock); |
1118 |
++ if (!renesas_sdhi_internal_dmac_complete(host)) |
1119 |
++ goto out; |
1120 |
++ |
1121 |
+ tmio_mmc_do_data_irq(host); |
1122 |
+ out: |
1123 |
+ spin_unlock_irq(&host->lock); |
1124 |
+diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c |
1125 |
+index 2a0cbc535a2ed..19673ed929e68 100644 |
1126 |
+--- a/drivers/net/ethernet/qualcomm/emac/emac.c |
1127 |
++++ b/drivers/net/ethernet/qualcomm/emac/emac.c |
1128 |
+@@ -493,13 +493,24 @@ static int emac_clks_phase1_init(struct platform_device *pdev, |
1129 |
+ |
1130 |
+ ret = clk_prepare_enable(adpt->clk[EMAC_CLK_CFG_AHB]); |
1131 |
+ if (ret) |
1132 |
+- return ret; |
1133 |
++ goto disable_clk_axi; |
1134 |
+ |
1135 |
+ ret = clk_set_rate(adpt->clk[EMAC_CLK_HIGH_SPEED], 19200000); |
1136 |
+ if (ret) |
1137 |
+- return ret; |
1138 |
++ goto disable_clk_cfg_ahb; |
1139 |
++ |
1140 |
++ ret = clk_prepare_enable(adpt->clk[EMAC_CLK_HIGH_SPEED]); |
1141 |
++ if (ret) |
1142 |
++ goto disable_clk_cfg_ahb; |
1143 |
+ |
1144 |
+- return clk_prepare_enable(adpt->clk[EMAC_CLK_HIGH_SPEED]); |
1145 |
++ return 0; |
1146 |
++ |
1147 |
++disable_clk_cfg_ahb: |
1148 |
++ clk_disable_unprepare(adpt->clk[EMAC_CLK_CFG_AHB]); |
1149 |
++disable_clk_axi: |
1150 |
++ clk_disable_unprepare(adpt->clk[EMAC_CLK_AXI]); |
1151 |
++ |
1152 |
++ return ret; |
1153 |
+ } |
1154 |
+ |
1155 |
+ /* Enable clocks; needs emac_clks_phase1_init to be called before */ |
1156 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c |
1157 |
+index 4d75158c64b29..826626e870d5c 100644 |
1158 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c |
1159 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c |
1160 |
+@@ -350,6 +350,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) |
1161 |
+ plat_dat->has_gmac = true; |
1162 |
+ plat_dat->bsp_priv = gmac; |
1163 |
+ plat_dat->fix_mac_speed = ipq806x_gmac_fix_mac_speed; |
1164 |
++ plat_dat->multicast_filter_bins = 0; |
1165 |
+ |
1166 |
+ err = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); |
1167 |
+ if (err) |
1168 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c |
1169 |
+index e4e9a7591efe9..4d617ba11ecb5 100644 |
1170 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c |
1171 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c |
1172 |
+@@ -176,6 +176,9 @@ static void dwmac1000_set_filter(struct mac_device_info *hw, |
1173 |
+ value = GMAC_FRAME_FILTER_PR; |
1174 |
+ } else if (dev->flags & IFF_ALLMULTI) { |
1175 |
+ value = GMAC_FRAME_FILTER_PM; /* pass all multi */ |
1176 |
++ } else if (!netdev_mc_empty(dev) && (mcbitslog2 == 0)) { |
1177 |
++ /* Fall back to all multicast if we've no filter */ |
1178 |
++ value = GMAC_FRAME_FILTER_PM; |
1179 |
+ } else if (!netdev_mc_empty(dev)) { |
1180 |
+ struct netdev_hw_addr *ha; |
1181 |
+ |
1182 |
+diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c |
1183 |
+index 5cb40b2518f93..87a2829dffd44 100644 |
1184 |
+--- a/drivers/pci/bus.c |
1185 |
++++ b/drivers/pci/bus.c |
1186 |
+@@ -323,12 +323,8 @@ void pci_bus_add_device(struct pci_dev *dev) |
1187 |
+ |
1188 |
+ dev->match_driver = true; |
1189 |
+ retval = device_attach(&dev->dev); |
1190 |
+- if (retval < 0 && retval != -EPROBE_DEFER) { |
1191 |
++ if (retval < 0 && retval != -EPROBE_DEFER) |
1192 |
+ pci_warn(dev, "device attach failed (%d)\n", retval); |
1193 |
+- pci_proc_detach_device(dev); |
1194 |
+- pci_remove_sysfs_dev_files(dev); |
1195 |
+- return; |
1196 |
+- } |
1197 |
+ |
1198 |
+ pci_dev_assign_added(dev, true); |
1199 |
+ } |
1200 |
+diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c |
1201 |
+index e292801fff7fd..1bdac298a943f 100644 |
1202 |
+--- a/drivers/pci/controller/dwc/pcie-qcom.c |
1203 |
++++ b/drivers/pci/controller/dwc/pcie-qcom.c |
1204 |
+@@ -45,7 +45,13 @@ |
1205 |
+ #define PCIE_CAP_CPL_TIMEOUT_DISABLE 0x10 |
1206 |
+ |
1207 |
+ #define PCIE20_PARF_PHY_CTRL 0x40 |
1208 |
++#define PHY_CTRL_PHY_TX0_TERM_OFFSET_MASK GENMASK(20, 16) |
1209 |
++#define PHY_CTRL_PHY_TX0_TERM_OFFSET(x) ((x) << 16) |
1210 |
++ |
1211 |
+ #define PCIE20_PARF_PHY_REFCLK 0x4C |
1212 |
++#define PHY_REFCLK_SSP_EN BIT(16) |
1213 |
++#define PHY_REFCLK_USE_PAD BIT(12) |
1214 |
++ |
1215 |
+ #define PCIE20_PARF_DBI_BASE_ADDR 0x168 |
1216 |
+ #define PCIE20_PARF_SLV_ADDR_SPACE_SIZE 0x16C |
1217 |
+ #define PCIE20_PARF_MHI_CLOCK_RESET_CTRL 0x174 |
1218 |
+@@ -76,6 +82,18 @@ |
1219 |
+ #define DBI_RO_WR_EN 1 |
1220 |
+ |
1221 |
+ #define PERST_DELAY_US 1000 |
1222 |
++/* PARF registers */ |
1223 |
++#define PCIE20_PARF_PCS_DEEMPH 0x34 |
1224 |
++#define PCS_DEEMPH_TX_DEEMPH_GEN1(x) ((x) << 16) |
1225 |
++#define PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(x) ((x) << 8) |
1226 |
++#define PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(x) ((x) << 0) |
1227 |
++ |
1228 |
++#define PCIE20_PARF_PCS_SWING 0x38 |
1229 |
++#define PCS_SWING_TX_SWING_FULL(x) ((x) << 8) |
1230 |
++#define PCS_SWING_TX_SWING_LOW(x) ((x) << 0) |
1231 |
++ |
1232 |
++#define PCIE20_PARF_CONFIG_BITS 0x50 |
1233 |
++#define PHY_RX0_EQ(x) ((x) << 24) |
1234 |
+ |
1235 |
+ #define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358 |
1236 |
+ #define SLV_ADDR_SPACE_SZ 0x10000000 |
1237 |
+@@ -275,6 +293,7 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) |
1238 |
+ struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; |
1239 |
+ struct dw_pcie *pci = pcie->pci; |
1240 |
+ struct device *dev = pci->dev; |
1241 |
++ struct device_node *node = dev->of_node; |
1242 |
+ u32 val; |
1243 |
+ int ret; |
1244 |
+ |
1245 |
+@@ -319,9 +338,29 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) |
1246 |
+ val &= ~BIT(0); |
1247 |
+ writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL); |
1248 |
+ |
1249 |
++ if (of_device_is_compatible(node, "qcom,pcie-ipq8064")) { |
1250 |
++ writel(PCS_DEEMPH_TX_DEEMPH_GEN1(24) | |
1251 |
++ PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(24) | |
1252 |
++ PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(34), |
1253 |
++ pcie->parf + PCIE20_PARF_PCS_DEEMPH); |
1254 |
++ writel(PCS_SWING_TX_SWING_FULL(120) | |
1255 |
++ PCS_SWING_TX_SWING_LOW(120), |
1256 |
++ pcie->parf + PCIE20_PARF_PCS_SWING); |
1257 |
++ writel(PHY_RX0_EQ(4), pcie->parf + PCIE20_PARF_CONFIG_BITS); |
1258 |
++ } |
1259 |
++ |
1260 |
++ if (of_device_is_compatible(node, "qcom,pcie-ipq8064")) { |
1261 |
++ /* set TX termination offset */ |
1262 |
++ val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL); |
1263 |
++ val &= ~PHY_CTRL_PHY_TX0_TERM_OFFSET_MASK; |
1264 |
++ val |= PHY_CTRL_PHY_TX0_TERM_OFFSET(7); |
1265 |
++ writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL); |
1266 |
++ } |
1267 |
++ |
1268 |
+ /* enable external reference clock */ |
1269 |
+ val = readl(pcie->parf + PCIE20_PARF_PHY_REFCLK); |
1270 |
+- val |= BIT(16); |
1271 |
++ val &= ~PHY_REFCLK_USE_PAD; |
1272 |
++ val |= PHY_REFCLK_SSP_EN; |
1273 |
+ writel(val, pcie->parf + PCIE20_PARF_PHY_REFCLK); |
1274 |
+ |
1275 |
+ ret = reset_control_deassert(res->phy_reset); |
1276 |
+diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c |
1277 |
+index c94c135254479..be35bbfa69687 100644 |
1278 |
+--- a/drivers/pci/hotplug/acpiphp_glue.c |
1279 |
++++ b/drivers/pci/hotplug/acpiphp_glue.c |
1280 |
+@@ -122,13 +122,21 @@ static struct acpiphp_context *acpiphp_grab_context(struct acpi_device *adev) |
1281 |
+ struct acpiphp_context *context; |
1282 |
+ |
1283 |
+ acpi_lock_hp_context(); |
1284 |
++ |
1285 |
+ context = acpiphp_get_context(adev); |
1286 |
+- if (!context || context->func.parent->is_going_away) { |
1287 |
+- acpi_unlock_hp_context(); |
1288 |
+- return NULL; |
1289 |
++ if (!context) |
1290 |
++ goto unlock; |
1291 |
++ |
1292 |
++ if (context->func.parent->is_going_away) { |
1293 |
++ acpiphp_put_context(context); |
1294 |
++ context = NULL; |
1295 |
++ goto unlock; |
1296 |
+ } |
1297 |
++ |
1298 |
+ get_bridge(context->func.parent); |
1299 |
+ acpiphp_put_context(context); |
1300 |
++ |
1301 |
++unlock: |
1302 |
+ acpi_unlock_hp_context(); |
1303 |
+ return context; |
1304 |
+ } |
1305 |
+diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c |
1306 |
+index cbc0d8da7483c..9a5b6a8e2502f 100644 |
1307 |
+--- a/drivers/pci/probe.c |
1308 |
++++ b/drivers/pci/probe.c |
1309 |
+@@ -348,6 +348,57 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) |
1310 |
+ } |
1311 |
+ } |
1312 |
+ |
1313 |
++static void pci_read_bridge_windows(struct pci_dev *bridge) |
1314 |
++{ |
1315 |
++ u16 io; |
1316 |
++ u32 pmem, tmp; |
1317 |
++ |
1318 |
++ pci_read_config_word(bridge, PCI_IO_BASE, &io); |
1319 |
++ if (!io) { |
1320 |
++ pci_write_config_word(bridge, PCI_IO_BASE, 0xe0f0); |
1321 |
++ pci_read_config_word(bridge, PCI_IO_BASE, &io); |
1322 |
++ pci_write_config_word(bridge, PCI_IO_BASE, 0x0); |
1323 |
++ } |
1324 |
++ if (io) |
1325 |
++ bridge->io_window = 1; |
1326 |
++ |
1327 |
++ /* |
1328 |
++ * DECchip 21050 pass 2 errata: the bridge may miss an address |
1329 |
++ * disconnect boundary by one PCI data phase. Workaround: do not |
1330 |
++ * use prefetching on this device. |
1331 |
++ */ |
1332 |
++ if (bridge->vendor == PCI_VENDOR_ID_DEC && bridge->device == 0x0001) |
1333 |
++ return; |
1334 |
++ |
1335 |
++ pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem); |
1336 |
++ if (!pmem) { |
1337 |
++ pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, |
1338 |
++ 0xffe0fff0); |
1339 |
++ pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem); |
1340 |
++ pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, 0x0); |
1341 |
++ } |
1342 |
++ if (!pmem) |
1343 |
++ return; |
1344 |
++ |
1345 |
++ bridge->pref_window = 1; |
1346 |
++ |
1347 |
++ if ((pmem & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { |
1348 |
++ |
1349 |
++ /* |
1350 |
++ * Bridge claims to have a 64-bit prefetchable memory |
1351 |
++ * window; verify that the upper bits are actually |
1352 |
++ * writable. |
1353 |
++ */ |
1354 |
++ pci_read_config_dword(bridge, PCI_PREF_BASE_UPPER32, &pmem); |
1355 |
++ pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, |
1356 |
++ 0xffffffff); |
1357 |
++ pci_read_config_dword(bridge, PCI_PREF_BASE_UPPER32, &tmp); |
1358 |
++ pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, pmem); |
1359 |
++ if (tmp) |
1360 |
++ bridge->pref_64_window = 1; |
1361 |
++ } |
1362 |
++} |
1363 |
++ |
1364 |
+ static void pci_read_bridge_io(struct pci_bus *child) |
1365 |
+ { |
1366 |
+ struct pci_dev *dev = child->self; |
1367 |
+@@ -1712,6 +1763,7 @@ int pci_setup_device(struct pci_dev *dev) |
1368 |
+ pci_read_irq(dev); |
1369 |
+ dev->transparent = ((dev->class & 0xff) == 1); |
1370 |
+ pci_read_bases(dev, 2, PCI_ROM_ADDRESS1); |
1371 |
++ pci_read_bridge_windows(dev); |
1372 |
+ set_pcie_hotplug_bridge(dev); |
1373 |
+ pos = pci_find_capability(dev, PCI_CAP_ID_SSVID); |
1374 |
+ if (pos) { |
1375 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
1376 |
+index 9129ccd593d10..af2149632102a 100644 |
1377 |
+--- a/drivers/pci/quirks.c |
1378 |
++++ b/drivers/pci/quirks.c |
1379 |
+@@ -5068,7 +5068,8 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0422, quirk_no_ext_tags); |
1380 |
+ */ |
1381 |
+ static void quirk_amd_harvest_no_ats(struct pci_dev *pdev) |
1382 |
+ { |
1383 |
+- if (pdev->device == 0x7340 && pdev->revision != 0xc5) |
1384 |
++ if ((pdev->device == 0x7312 && pdev->revision != 0x00) || |
1385 |
++ (pdev->device == 0x7340 && pdev->revision != 0xc5)) |
1386 |
+ return; |
1387 |
+ |
1388 |
+ pci_info(pdev, "disabling ATS\n"); |
1389 |
+@@ -5079,6 +5080,8 @@ static void quirk_amd_harvest_no_ats(struct pci_dev *pdev) |
1390 |
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x98e4, quirk_amd_harvest_no_ats); |
1391 |
+ /* AMD Iceland dGPU */ |
1392 |
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6900, quirk_amd_harvest_no_ats); |
1393 |
++/* AMD Navi10 dGPU */ |
1394 |
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7312, quirk_amd_harvest_no_ats); |
1395 |
+ /* AMD Navi14 dGPU */ |
1396 |
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7340, quirk_amd_harvest_no_ats); |
1397 |
+ #endif /* CONFIG_PCI_ATS */ |
1398 |
+diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c |
1399 |
+index 8e5b00a420a55..87c8190de622f 100644 |
1400 |
+--- a/drivers/pci/setup-bus.c |
1401 |
++++ b/drivers/pci/setup-bus.c |
1402 |
+@@ -735,58 +735,21 @@ int pci_claim_bridge_resource(struct pci_dev *bridge, int i) |
1403 |
+ base/limit registers must be read-only and read as 0. */ |
1404 |
+ static void pci_bridge_check_ranges(struct pci_bus *bus) |
1405 |
+ { |
1406 |
+- u16 io; |
1407 |
+- u32 pmem; |
1408 |
+ struct pci_dev *bridge = bus->self; |
1409 |
+- struct resource *b_res; |
1410 |
++ struct resource *b_res = &bridge->resource[PCI_BRIDGE_RESOURCES]; |
1411 |
+ |
1412 |
+- b_res = &bridge->resource[PCI_BRIDGE_RESOURCES]; |
1413 |
+ b_res[1].flags |= IORESOURCE_MEM; |
1414 |
+ |
1415 |
+- pci_read_config_word(bridge, PCI_IO_BASE, &io); |
1416 |
+- if (!io) { |
1417 |
+- pci_write_config_word(bridge, PCI_IO_BASE, 0xe0f0); |
1418 |
+- pci_read_config_word(bridge, PCI_IO_BASE, &io); |
1419 |
+- pci_write_config_word(bridge, PCI_IO_BASE, 0x0); |
1420 |
+- } |
1421 |
+- if (io) |
1422 |
++ if (bridge->io_window) |
1423 |
+ b_res[0].flags |= IORESOURCE_IO; |
1424 |
+ |
1425 |
+- /* DECchip 21050 pass 2 errata: the bridge may miss an address |
1426 |
+- disconnect boundary by one PCI data phase. |
1427 |
+- Workaround: do not use prefetching on this device. */ |
1428 |
+- if (bridge->vendor == PCI_VENDOR_ID_DEC && bridge->device == 0x0001) |
1429 |
+- return; |
1430 |
+- |
1431 |
+- pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem); |
1432 |
+- if (!pmem) { |
1433 |
+- pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, |
1434 |
+- 0xffe0fff0); |
1435 |
+- pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem); |
1436 |
+- pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, 0x0); |
1437 |
+- } |
1438 |
+- if (pmem) { |
1439 |
++ if (bridge->pref_window) { |
1440 |
+ b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH; |
1441 |
+- if ((pmem & PCI_PREF_RANGE_TYPE_MASK) == |
1442 |
+- PCI_PREF_RANGE_TYPE_64) { |
1443 |
++ if (bridge->pref_64_window) { |
1444 |
+ b_res[2].flags |= IORESOURCE_MEM_64; |
1445 |
+ b_res[2].flags |= PCI_PREF_RANGE_TYPE_64; |
1446 |
+ } |
1447 |
+ } |
1448 |
+- |
1449 |
+- /* double check if bridge does support 64 bit pref */ |
1450 |
+- if (b_res[2].flags & IORESOURCE_MEM_64) { |
1451 |
+- u32 mem_base_hi, tmp; |
1452 |
+- pci_read_config_dword(bridge, PCI_PREF_BASE_UPPER32, |
1453 |
+- &mem_base_hi); |
1454 |
+- pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, |
1455 |
+- 0xffffffff); |
1456 |
+- pci_read_config_dword(bridge, PCI_PREF_BASE_UPPER32, &tmp); |
1457 |
+- if (!tmp) |
1458 |
+- b_res[2].flags &= ~IORESOURCE_MEM_64; |
1459 |
+- pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, |
1460 |
+- mem_base_hi); |
1461 |
+- } |
1462 |
+ } |
1463 |
+ |
1464 |
+ /* Helper function for sizing routines: find first available |
1465 |
+diff --git a/drivers/pwm/pwm-bcm-iproc.c b/drivers/pwm/pwm-bcm-iproc.c |
1466 |
+index 31b01035d0ab3..8cfba3614e601 100644 |
1467 |
+--- a/drivers/pwm/pwm-bcm-iproc.c |
1468 |
++++ b/drivers/pwm/pwm-bcm-iproc.c |
1469 |
+@@ -85,8 +85,6 @@ static void iproc_pwmc_get_state(struct pwm_chip *chip, struct pwm_device *pwm, |
1470 |
+ u64 tmp, multi, rate; |
1471 |
+ u32 value, prescale; |
1472 |
+ |
1473 |
+- rate = clk_get_rate(ip->clk); |
1474 |
+- |
1475 |
+ value = readl(ip->base + IPROC_PWM_CTRL_OFFSET); |
1476 |
+ |
1477 |
+ if (value & BIT(IPROC_PWM_CTRL_EN_SHIFT(pwm->hwpwm))) |
1478 |
+@@ -99,6 +97,13 @@ static void iproc_pwmc_get_state(struct pwm_chip *chip, struct pwm_device *pwm, |
1479 |
+ else |
1480 |
+ state->polarity = PWM_POLARITY_INVERSED; |
1481 |
+ |
1482 |
++ rate = clk_get_rate(ip->clk); |
1483 |
++ if (rate == 0) { |
1484 |
++ state->period = 0; |
1485 |
++ state->duty_cycle = 0; |
1486 |
++ return; |
1487 |
++ } |
1488 |
++ |
1489 |
+ value = readl(ip->base + IPROC_PWM_PRESCALE_OFFSET); |
1490 |
+ prescale = value >> IPROC_PWM_PRESCALE_SHIFT(pwm->hwpwm); |
1491 |
+ prescale &= IPROC_PWM_PRESCALE_MAX; |
1492 |
+diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c |
1493 |
+index 0d33e3079f0dc..ef61cb709acd4 100644 |
1494 |
+--- a/drivers/remoteproc/qcom_q6v5.c |
1495 |
++++ b/drivers/remoteproc/qcom_q6v5.c |
1496 |
+@@ -151,6 +151,8 @@ int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5) |
1497 |
+ { |
1498 |
+ int ret; |
1499 |
+ |
1500 |
++ q6v5->running = false; |
1501 |
++ |
1502 |
+ qcom_smem_state_update_bits(q6v5->state, |
1503 |
+ BIT(q6v5->stop_bit), BIT(q6v5->stop_bit)); |
1504 |
+ |
1505 |
+diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c |
1506 |
+index 768eba8c111d9..5bc33817568ea 100644 |
1507 |
+--- a/drivers/scsi/lpfc/lpfc_nvmet.c |
1508 |
++++ b/drivers/scsi/lpfc/lpfc_nvmet.c |
1509 |
+@@ -1712,7 +1712,7 @@ lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba) |
1510 |
+ } |
1511 |
+ tgtp->tport_unreg_cmp = &tport_unreg_cmp; |
1512 |
+ nvmet_fc_unregister_targetport(phba->targetport); |
1513 |
+- if (!wait_for_completion_timeout(tgtp->tport_unreg_cmp, |
1514 |
++ if (!wait_for_completion_timeout(&tport_unreg_cmp, |
1515 |
+ msecs_to_jiffies(LPFC_NVMET_WAIT_TMO))) |
1516 |
+ lpfc_printf_log(phba, KERN_ERR, LOG_NVME, |
1517 |
+ "6179 Unreg targetport %p timeout " |
1518 |
+diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
1519 |
+index 3c0f38cd3a5a4..ce9cc1f90b052 100644 |
1520 |
+--- a/drivers/usb/serial/ftdi_sio.c |
1521 |
++++ b/drivers/usb/serial/ftdi_sio.c |
1522 |
+@@ -2037,12 +2037,11 @@ static int ftdi_prepare_write_buffer(struct usb_serial_port *port, |
1523 |
+ #define FTDI_RS_ERR_MASK (FTDI_RS_BI | FTDI_RS_PE | FTDI_RS_FE | FTDI_RS_OE) |
1524 |
+ |
1525 |
+ static int ftdi_process_packet(struct usb_serial_port *port, |
1526 |
+- struct ftdi_private *priv, char *packet, int len) |
1527 |
++ struct ftdi_private *priv, unsigned char *buf, int len) |
1528 |
+ { |
1529 |
++ unsigned char status; |
1530 |
+ int i; |
1531 |
+- char status; |
1532 |
+ char flag; |
1533 |
+- char *ch; |
1534 |
+ |
1535 |
+ if (len < 2) { |
1536 |
+ dev_dbg(&port->dev, "malformed packet\n"); |
1537 |
+@@ -2052,7 +2051,7 @@ static int ftdi_process_packet(struct usb_serial_port *port, |
1538 |
+ /* Compare new line status to the old one, signal if different/ |
1539 |
+ N.B. packet may be processed more than once, but differences |
1540 |
+ are only processed once. */ |
1541 |
+- status = packet[0] & FTDI_STATUS_B0_MASK; |
1542 |
++ status = buf[0] & FTDI_STATUS_B0_MASK; |
1543 |
+ if (status != priv->prev_status) { |
1544 |
+ char diff_status = status ^ priv->prev_status; |
1545 |
+ |
1546 |
+@@ -2078,13 +2077,12 @@ static int ftdi_process_packet(struct usb_serial_port *port, |
1547 |
+ } |
1548 |
+ |
1549 |
+ /* save if the transmitter is empty or not */ |
1550 |
+- if (packet[1] & FTDI_RS_TEMT) |
1551 |
++ if (buf[1] & FTDI_RS_TEMT) |
1552 |
+ priv->transmit_empty = 1; |
1553 |
+ else |
1554 |
+ priv->transmit_empty = 0; |
1555 |
+ |
1556 |
+- len -= 2; |
1557 |
+- if (!len) |
1558 |
++ if (len == 2) |
1559 |
+ return 0; /* status only */ |
1560 |
+ |
1561 |
+ /* |
1562 |
+@@ -2092,40 +2090,41 @@ static int ftdi_process_packet(struct usb_serial_port *port, |
1563 |
+ * data payload to avoid over-reporting. |
1564 |
+ */ |
1565 |
+ flag = TTY_NORMAL; |
1566 |
+- if (packet[1] & FTDI_RS_ERR_MASK) { |
1567 |
++ if (buf[1] & FTDI_RS_ERR_MASK) { |
1568 |
+ /* Break takes precedence over parity, which takes precedence |
1569 |
+ * over framing errors */ |
1570 |
+- if (packet[1] & FTDI_RS_BI) { |
1571 |
++ if (buf[1] & FTDI_RS_BI) { |
1572 |
+ flag = TTY_BREAK; |
1573 |
+ port->icount.brk++; |
1574 |
+ usb_serial_handle_break(port); |
1575 |
+- } else if (packet[1] & FTDI_RS_PE) { |
1576 |
++ } else if (buf[1] & FTDI_RS_PE) { |
1577 |
+ flag = TTY_PARITY; |
1578 |
+ port->icount.parity++; |
1579 |
+- } else if (packet[1] & FTDI_RS_FE) { |
1580 |
++ } else if (buf[1] & FTDI_RS_FE) { |
1581 |
+ flag = TTY_FRAME; |
1582 |
+ port->icount.frame++; |
1583 |
+ } |
1584 |
+ /* Overrun is special, not associated with a char */ |
1585 |
+- if (packet[1] & FTDI_RS_OE) { |
1586 |
++ if (buf[1] & FTDI_RS_OE) { |
1587 |
+ port->icount.overrun++; |
1588 |
+ tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); |
1589 |
+ } |
1590 |
+ } |
1591 |
+ |
1592 |
+- port->icount.rx += len; |
1593 |
+- ch = packet + 2; |
1594 |
++ port->icount.rx += len - 2; |
1595 |
+ |
1596 |
+ if (port->port.console && port->sysrq) { |
1597 |
+- for (i = 0; i < len; i++, ch++) { |
1598 |
+- if (!usb_serial_handle_sysrq_char(port, *ch)) |
1599 |
+- tty_insert_flip_char(&port->port, *ch, flag); |
1600 |
++ for (i = 2; i < len; i++) { |
1601 |
++ if (usb_serial_handle_sysrq_char(port, buf[i])) |
1602 |
++ continue; |
1603 |
++ tty_insert_flip_char(&port->port, buf[i], flag); |
1604 |
+ } |
1605 |
+ } else { |
1606 |
+- tty_insert_flip_string_fixed_flag(&port->port, ch, flag, len); |
1607 |
++ tty_insert_flip_string_fixed_flag(&port->port, buf + 2, flag, |
1608 |
++ len - 2); |
1609 |
+ } |
1610 |
+ |
1611 |
+- return len; |
1612 |
++ return len - 2; |
1613 |
+ } |
1614 |
+ |
1615 |
+ static void ftdi_process_read_urb(struct urb *urb) |
1616 |
+diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c |
1617 |
+index 9a1c761258ce4..5d0ea419070dc 100644 |
1618 |
+--- a/drivers/watchdog/f71808e_wdt.c |
1619 |
++++ b/drivers/watchdog/f71808e_wdt.c |
1620 |
+@@ -688,9 +688,9 @@ static int __init watchdog_init(int sioaddr) |
1621 |
+ * into the module have been registered yet. |
1622 |
+ */ |
1623 |
+ watchdog.sioaddr = sioaddr; |
1624 |
+- watchdog.ident.options = WDIOC_SETTIMEOUT |
1625 |
+- | WDIOF_MAGICCLOSE |
1626 |
+- | WDIOF_KEEPALIVEPING; |
1627 |
++ watchdog.ident.options = WDIOF_MAGICCLOSE |
1628 |
++ | WDIOF_KEEPALIVEPING |
1629 |
++ | WDIOF_CARDRESET; |
1630 |
+ |
1631 |
+ snprintf(watchdog.ident.identity, |
1632 |
+ sizeof(watchdog.ident.identity), "%s watchdog", |
1633 |
+@@ -704,6 +704,13 @@ static int __init watchdog_init(int sioaddr) |
1634 |
+ wdt_conf = superio_inb(sioaddr, F71808FG_REG_WDT_CONF); |
1635 |
+ watchdog.caused_reboot = wdt_conf & BIT(F71808FG_FLAG_WDTMOUT_STS); |
1636 |
+ |
1637 |
++ /* |
1638 |
++ * We don't want WDTMOUT_STS to stick around till regular reboot. |
1639 |
++ * Write 1 to the bit to clear it to zero. |
1640 |
++ */ |
1641 |
++ superio_outb(sioaddr, F71808FG_REG_WDT_CONF, |
1642 |
++ wdt_conf | BIT(F71808FG_FLAG_WDTMOUT_STS)); |
1643 |
++ |
1644 |
+ superio_exit(sioaddr); |
1645 |
+ |
1646 |
+ err = watchdog_set_timeout(timeout); |
1647 |
+diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c |
1648 |
+index 10b2090f3e5e7..1c322caecf7f1 100644 |
1649 |
+--- a/drivers/watchdog/watchdog_dev.c |
1650 |
++++ b/drivers/watchdog/watchdog_dev.c |
1651 |
+@@ -947,6 +947,15 @@ static int watchdog_cdev_register(struct watchdog_device *wdd) |
1652 |
+ if (IS_ERR_OR_NULL(watchdog_kworker)) |
1653 |
+ return -ENODEV; |
1654 |
+ |
1655 |
++ device_initialize(&wd_data->dev); |
1656 |
++ wd_data->dev.devt = MKDEV(MAJOR(watchdog_devt), wdd->id); |
1657 |
++ wd_data->dev.class = &watchdog_class; |
1658 |
++ wd_data->dev.parent = wdd->parent; |
1659 |
++ wd_data->dev.groups = wdd->groups; |
1660 |
++ wd_data->dev.release = watchdog_core_data_release; |
1661 |
++ dev_set_drvdata(&wd_data->dev, wdd); |
1662 |
++ dev_set_name(&wd_data->dev, "watchdog%d", wdd->id); |
1663 |
++ |
1664 |
+ kthread_init_work(&wd_data->work, watchdog_ping_work); |
1665 |
+ hrtimer_init(&wd_data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
1666 |
+ wd_data->timer.function = watchdog_timer_expired; |
1667 |
+@@ -967,15 +976,6 @@ static int watchdog_cdev_register(struct watchdog_device *wdd) |
1668 |
+ } |
1669 |
+ } |
1670 |
+ |
1671 |
+- device_initialize(&wd_data->dev); |
1672 |
+- wd_data->dev.devt = MKDEV(MAJOR(watchdog_devt), wdd->id); |
1673 |
+- wd_data->dev.class = &watchdog_class; |
1674 |
+- wd_data->dev.parent = wdd->parent; |
1675 |
+- wd_data->dev.groups = wdd->groups; |
1676 |
+- wd_data->dev.release = watchdog_core_data_release; |
1677 |
+- dev_set_drvdata(&wd_data->dev, wdd); |
1678 |
+- dev_set_name(&wd_data->dev, "watchdog%d", wdd->id); |
1679 |
+- |
1680 |
+ /* Fill in the data structures */ |
1681 |
+ cdev_init(&wd_data->cdev, &watchdog_fops); |
1682 |
+ |
1683 |
+diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c |
1684 |
+index 9740f7b5d4fb4..3130844e219cf 100644 |
1685 |
+--- a/fs/btrfs/disk-io.c |
1686 |
++++ b/fs/btrfs/disk-io.c |
1687 |
+@@ -1500,9 +1500,16 @@ int btrfs_init_fs_root(struct btrfs_root *root) |
1688 |
+ spin_lock_init(&root->ino_cache_lock); |
1689 |
+ init_waitqueue_head(&root->ino_cache_wait); |
1690 |
+ |
1691 |
+- ret = get_anon_bdev(&root->anon_dev); |
1692 |
+- if (ret) |
1693 |
+- goto fail; |
1694 |
++ /* |
1695 |
++ * Don't assign anonymous block device to roots that are not exposed to |
1696 |
++ * userspace, the id pool is limited to 1M |
1697 |
++ */ |
1698 |
++ if (is_fstree(root->root_key.objectid) && |
1699 |
++ btrfs_root_refs(&root->root_item) > 0) { |
1700 |
++ ret = get_anon_bdev(&root->anon_dev); |
1701 |
++ if (ret) |
1702 |
++ goto fail; |
1703 |
++ } |
1704 |
+ |
1705 |
+ mutex_lock(&root->objectid_mutex); |
1706 |
+ ret = btrfs_find_highest_objectid(root, |
1707 |
+diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c |
1708 |
+index c9965e89097fd..4c65305fd4180 100644 |
1709 |
+--- a/fs/btrfs/free-space-cache.c |
1710 |
++++ b/fs/btrfs/free-space-cache.c |
1711 |
+@@ -2169,7 +2169,7 @@ out: |
1712 |
+ static bool try_merge_free_space(struct btrfs_free_space_ctl *ctl, |
1713 |
+ struct btrfs_free_space *info, bool update_stat) |
1714 |
+ { |
1715 |
+- struct btrfs_free_space *left_info; |
1716 |
++ struct btrfs_free_space *left_info = NULL; |
1717 |
+ struct btrfs_free_space *right_info; |
1718 |
+ bool merged = false; |
1719 |
+ u64 offset = info->offset; |
1720 |
+@@ -2184,7 +2184,7 @@ static bool try_merge_free_space(struct btrfs_free_space_ctl *ctl, |
1721 |
+ if (right_info && rb_prev(&right_info->offset_index)) |
1722 |
+ left_info = rb_entry(rb_prev(&right_info->offset_index), |
1723 |
+ struct btrfs_free_space, offset_index); |
1724 |
+- else |
1725 |
++ else if (!right_info) |
1726 |
+ left_info = tree_search_offset(ctl, offset - 1, 0, 0); |
1727 |
+ |
1728 |
+ if (right_info && !right_info->bitmap) { |
1729 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
1730 |
+index 7befb7c12bd32..1656ef0e959f0 100644 |
1731 |
+--- a/fs/btrfs/inode.c |
1732 |
++++ b/fs/btrfs/inode.c |
1733 |
+@@ -4458,6 +4458,8 @@ int btrfs_delete_subvolume(struct inode *dir, struct dentry *dentry) |
1734 |
+ } |
1735 |
+ } |
1736 |
+ |
1737 |
++ free_anon_bdev(dest->anon_dev); |
1738 |
++ dest->anon_dev = 0; |
1739 |
+ out_end_trans: |
1740 |
+ trans->block_rsv = NULL; |
1741 |
+ trans->bytes_reserved = 0; |
1742 |
+@@ -7012,7 +7014,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, |
1743 |
+ found_type == BTRFS_FILE_EXTENT_PREALLOC) { |
1744 |
+ /* Only regular file could have regular/prealloc extent */ |
1745 |
+ if (!S_ISREG(inode->vfs_inode.i_mode)) { |
1746 |
+- ret = -EUCLEAN; |
1747 |
++ err = -EUCLEAN; |
1748 |
+ btrfs_crit(fs_info, |
1749 |
+ "regular/prealloc extent found for non-regular inode %llu", |
1750 |
+ btrfs_ino(inode)); |
1751 |
+diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c |
1752 |
+index dbc685ca017f2..5dec52bd2897b 100644 |
1753 |
+--- a/fs/btrfs/ref-verify.c |
1754 |
++++ b/fs/btrfs/ref-verify.c |
1755 |
+@@ -297,6 +297,8 @@ static struct block_entry *add_block_entry(struct btrfs_fs_info *fs_info, |
1756 |
+ exist_re = insert_root_entry(&exist->roots, re); |
1757 |
+ if (exist_re) |
1758 |
+ kfree(re); |
1759 |
++ } else { |
1760 |
++ kfree(re); |
1761 |
+ } |
1762 |
+ kfree(be); |
1763 |
+ return exist; |
1764 |
+diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c |
1765 |
+index 6a5b16a119eda..ed539496089f1 100644 |
1766 |
+--- a/fs/btrfs/super.c |
1767 |
++++ b/fs/btrfs/super.c |
1768 |
+@@ -432,6 +432,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, |
1769 |
+ char *compress_type; |
1770 |
+ bool compress_force = false; |
1771 |
+ enum btrfs_compression_type saved_compress_type; |
1772 |
++ int saved_compress_level; |
1773 |
+ bool saved_compress_force; |
1774 |
+ int no_compress = 0; |
1775 |
+ |
1776 |
+@@ -514,6 +515,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, |
1777 |
+ info->compress_type : BTRFS_COMPRESS_NONE; |
1778 |
+ saved_compress_force = |
1779 |
+ btrfs_test_opt(info, FORCE_COMPRESS); |
1780 |
++ saved_compress_level = info->compress_level; |
1781 |
+ if (token == Opt_compress || |
1782 |
+ token == Opt_compress_force || |
1783 |
+ strncmp(args[0].from, "zlib", 4) == 0) { |
1784 |
+@@ -552,6 +554,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, |
1785 |
+ no_compress = 0; |
1786 |
+ } else if (strncmp(args[0].from, "no", 2) == 0) { |
1787 |
+ compress_type = "no"; |
1788 |
++ info->compress_level = 0; |
1789 |
++ info->compress_type = 0; |
1790 |
+ btrfs_clear_opt(info->mount_opt, COMPRESS); |
1791 |
+ btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS); |
1792 |
+ compress_force = false; |
1793 |
+@@ -572,11 +576,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, |
1794 |
+ */ |
1795 |
+ btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS); |
1796 |
+ } |
1797 |
+- if ((btrfs_test_opt(info, COMPRESS) && |
1798 |
+- (info->compress_type != saved_compress_type || |
1799 |
+- compress_force != saved_compress_force)) || |
1800 |
+- (!btrfs_test_opt(info, COMPRESS) && |
1801 |
+- no_compress == 1)) { |
1802 |
++ if (no_compress == 1) { |
1803 |
++ btrfs_info(info, "use no compression"); |
1804 |
++ } else if ((info->compress_type != saved_compress_type) || |
1805 |
++ (compress_force != saved_compress_force) || |
1806 |
++ (info->compress_level != saved_compress_level)) { |
1807 |
+ btrfs_info(info, "%s %s compression, level %d", |
1808 |
+ (compress_force) ? "force" : "use", |
1809 |
+ compress_type, info->compress_level); |
1810 |
+@@ -2314,9 +2318,7 @@ static int btrfs_unfreeze(struct super_block *sb) |
1811 |
+ static int btrfs_show_devname(struct seq_file *m, struct dentry *root) |
1812 |
+ { |
1813 |
+ struct btrfs_fs_info *fs_info = btrfs_sb(root->d_sb); |
1814 |
+- struct btrfs_fs_devices *cur_devices; |
1815 |
+ struct btrfs_device *dev, *first_dev = NULL; |
1816 |
+- struct list_head *head; |
1817 |
+ |
1818 |
+ /* |
1819 |
+ * Lightweight locking of the devices. We should not need |
1820 |
+@@ -2326,18 +2328,13 @@ static int btrfs_show_devname(struct seq_file *m, struct dentry *root) |
1821 |
+ * least until until the rcu_read_unlock. |
1822 |
+ */ |
1823 |
+ rcu_read_lock(); |
1824 |
+- cur_devices = fs_info->fs_devices; |
1825 |
+- while (cur_devices) { |
1826 |
+- head = &cur_devices->devices; |
1827 |
+- list_for_each_entry_rcu(dev, head, dev_list) { |
1828 |
+- if (test_bit(BTRFS_DEV_STATE_MISSING, &dev->dev_state)) |
1829 |
+- continue; |
1830 |
+- if (!dev->name) |
1831 |
+- continue; |
1832 |
+- if (!first_dev || dev->devid < first_dev->devid) |
1833 |
+- first_dev = dev; |
1834 |
+- } |
1835 |
+- cur_devices = cur_devices->seed; |
1836 |
++ list_for_each_entry_rcu(dev, &fs_info->fs_devices->devices, dev_list) { |
1837 |
++ if (test_bit(BTRFS_DEV_STATE_MISSING, &dev->dev_state)) |
1838 |
++ continue; |
1839 |
++ if (!dev->name) |
1840 |
++ continue; |
1841 |
++ if (!first_dev || dev->devid < first_dev->devid) |
1842 |
++ first_dev = dev; |
1843 |
+ } |
1844 |
+ |
1845 |
+ if (first_dev) |
1846 |
+diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
1847 |
+index 928ac2c4899e7..090315f4ac78f 100644 |
1848 |
+--- a/fs/btrfs/tree-log.c |
1849 |
++++ b/fs/btrfs/tree-log.c |
1850 |
+@@ -3988,11 +3988,8 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, |
1851 |
+ fs_info->csum_root, |
1852 |
+ ds + cs, ds + cs + cl - 1, |
1853 |
+ &ordered_sums, 0); |
1854 |
+- if (ret) { |
1855 |
+- btrfs_release_path(dst_path); |
1856 |
+- kfree(ins_data); |
1857 |
+- return ret; |
1858 |
+- } |
1859 |
++ if (ret) |
1860 |
++ break; |
1861 |
+ } |
1862 |
+ } |
1863 |
+ } |
1864 |
+@@ -4005,7 +4002,6 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, |
1865 |
+ * we have to do this after the loop above to avoid changing the |
1866 |
+ * log tree while trying to change the log tree. |
1867 |
+ */ |
1868 |
+- ret = 0; |
1869 |
+ while (!list_empty(&ordered_sums)) { |
1870 |
+ struct btrfs_ordered_sum *sums = list_entry(ordered_sums.next, |
1871 |
+ struct btrfs_ordered_sum, |
1872 |
+diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
1873 |
+index e0ba1e9ddcdf0..4abb2a155ac5b 100644 |
1874 |
+--- a/fs/btrfs/volumes.c |
1875 |
++++ b/fs/btrfs/volumes.c |
1876 |
+@@ -155,7 +155,9 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, |
1877 |
+ * |
1878 |
+ * global::fs_devs - add, remove, updates to the global list |
1879 |
+ * |
1880 |
+- * does not protect: manipulation of the fs_devices::devices list! |
1881 |
++ * does not protect: manipulation of the fs_devices::devices list in general |
1882 |
++ * but in mount context it could be used to exclude list modifications by eg. |
1883 |
++ * scan ioctl |
1884 |
+ * |
1885 |
+ * btrfs_device::name - renames (write side), read is RCU |
1886 |
+ * |
1887 |
+@@ -168,6 +170,9 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, |
1888 |
+ * may be used to exclude some operations from running concurrently without any |
1889 |
+ * modifications to the list (see write_all_supers) |
1890 |
+ * |
1891 |
++ * Is not required at mount and close times, because our device list is |
1892 |
++ * protected by the uuid_mutex at that point. |
1893 |
++ * |
1894 |
+ * balance_mutex |
1895 |
+ * ------------- |
1896 |
+ * protects balance structures (status, state) and context accessed from |
1897 |
+@@ -656,6 +661,11 @@ static void btrfs_free_stale_devices(const char *path, |
1898 |
+ } |
1899 |
+ } |
1900 |
+ |
1901 |
++/* |
1902 |
++ * This is only used on mount, and we are protected from competing things |
1903 |
++ * messing with our fs_devices by the uuid_mutex, thus we do not need the |
1904 |
++ * fs_devices->device_list_mutex here. |
1905 |
++ */ |
1906 |
+ static int btrfs_open_one_device(struct btrfs_fs_devices *fs_devices, |
1907 |
+ struct btrfs_device *device, fmode_t flags, |
1908 |
+ void *holder) |
1909 |
+@@ -1153,8 +1163,14 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, |
1910 |
+ int ret; |
1911 |
+ |
1912 |
+ lockdep_assert_held(&uuid_mutex); |
1913 |
++ /* |
1914 |
++ * The device_list_mutex cannot be taken here in case opening the |
1915 |
++ * underlying device takes further locks like bd_mutex. |
1916 |
++ * |
1917 |
++ * We also don't need the lock here as this is called during mount and |
1918 |
++ * exclusion is provided by uuid_mutex |
1919 |
++ */ |
1920 |
+ |
1921 |
+- mutex_lock(&fs_devices->device_list_mutex); |
1922 |
+ if (fs_devices->opened) { |
1923 |
+ fs_devices->opened++; |
1924 |
+ ret = 0; |
1925 |
+@@ -1162,7 +1178,6 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, |
1926 |
+ list_sort(NULL, &fs_devices->devices, devid_cmp); |
1927 |
+ ret = open_fs_devices(fs_devices, flags, holder); |
1928 |
+ } |
1929 |
+- mutex_unlock(&fs_devices->device_list_mutex); |
1930 |
+ |
1931 |
+ return ret; |
1932 |
+ } |
1933 |
+diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c |
1934 |
+index 14265b4bbcc00..2fc96f7923ee5 100644 |
1935 |
+--- a/fs/cifs/smb2misc.c |
1936 |
++++ b/fs/cifs/smb2misc.c |
1937 |
+@@ -509,15 +509,31 @@ cifs_ses_oplock_break(struct work_struct *work) |
1938 |
+ kfree(lw); |
1939 |
+ } |
1940 |
+ |
1941 |
++static void |
1942 |
++smb2_queue_pending_open_break(struct tcon_link *tlink, __u8 *lease_key, |
1943 |
++ __le32 new_lease_state) |
1944 |
++{ |
1945 |
++ struct smb2_lease_break_work *lw; |
1946 |
++ |
1947 |
++ lw = kmalloc(sizeof(struct smb2_lease_break_work), GFP_KERNEL); |
1948 |
++ if (!lw) { |
1949 |
++ cifs_put_tlink(tlink); |
1950 |
++ return; |
1951 |
++ } |
1952 |
++ |
1953 |
++ INIT_WORK(&lw->lease_break, cifs_ses_oplock_break); |
1954 |
++ lw->tlink = tlink; |
1955 |
++ lw->lease_state = new_lease_state; |
1956 |
++ memcpy(lw->lease_key, lease_key, SMB2_LEASE_KEY_SIZE); |
1957 |
++ queue_work(cifsiod_wq, &lw->lease_break); |
1958 |
++} |
1959 |
++ |
1960 |
+ static bool |
1961 |
+-smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp, |
1962 |
+- struct smb2_lease_break_work *lw) |
1963 |
++smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp) |
1964 |
+ { |
1965 |
+- bool found; |
1966 |
+ __u8 lease_state; |
1967 |
+ struct list_head *tmp; |
1968 |
+ struct cifsFileInfo *cfile; |
1969 |
+- struct cifs_pending_open *open; |
1970 |
+ struct cifsInodeInfo *cinode; |
1971 |
+ int ack_req = le32_to_cpu(rsp->Flags & |
1972 |
+ SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED); |
1973 |
+@@ -556,22 +572,29 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp, |
1974 |
+ &cinode->flags); |
1975 |
+ |
1976 |
+ cifs_queue_oplock_break(cfile); |
1977 |
+- kfree(lw); |
1978 |
+ return true; |
1979 |
+ } |
1980 |
+ |
1981 |
+- found = false; |
1982 |
++ return false; |
1983 |
++} |
1984 |
++ |
1985 |
++static struct cifs_pending_open * |
1986 |
++smb2_tcon_find_pending_open_lease(struct cifs_tcon *tcon, |
1987 |
++ struct smb2_lease_break *rsp) |
1988 |
++{ |
1989 |
++ __u8 lease_state = le32_to_cpu(rsp->NewLeaseState); |
1990 |
++ int ack_req = le32_to_cpu(rsp->Flags & |
1991 |
++ SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED); |
1992 |
++ struct cifs_pending_open *open; |
1993 |
++ struct cifs_pending_open *found = NULL; |
1994 |
++ |
1995 |
+ list_for_each_entry(open, &tcon->pending_opens, olist) { |
1996 |
+ if (memcmp(open->lease_key, rsp->LeaseKey, |
1997 |
+ SMB2_LEASE_KEY_SIZE)) |
1998 |
+ continue; |
1999 |
+ |
2000 |
+ if (!found && ack_req) { |
2001 |
+- found = true; |
2002 |
+- memcpy(lw->lease_key, open->lease_key, |
2003 |
+- SMB2_LEASE_KEY_SIZE); |
2004 |
+- lw->tlink = cifs_get_tlink(open->tlink); |
2005 |
+- queue_work(cifsiod_wq, &lw->lease_break); |
2006 |
++ found = open; |
2007 |
+ } |
2008 |
+ |
2009 |
+ cifs_dbg(FYI, "found in the pending open list\n"); |
2010 |
+@@ -592,14 +615,7 @@ smb2_is_valid_lease_break(char *buffer) |
2011 |
+ struct TCP_Server_Info *server; |
2012 |
+ struct cifs_ses *ses; |
2013 |
+ struct cifs_tcon *tcon; |
2014 |
+- struct smb2_lease_break_work *lw; |
2015 |
+- |
2016 |
+- lw = kmalloc(sizeof(struct smb2_lease_break_work), GFP_KERNEL); |
2017 |
+- if (!lw) |
2018 |
+- return false; |
2019 |
+- |
2020 |
+- INIT_WORK(&lw->lease_break, cifs_ses_oplock_break); |
2021 |
+- lw->lease_state = rsp->NewLeaseState; |
2022 |
++ struct cifs_pending_open *open; |
2023 |
+ |
2024 |
+ cifs_dbg(FYI, "Checking for lease break\n"); |
2025 |
+ |
2026 |
+@@ -617,11 +633,27 @@ smb2_is_valid_lease_break(char *buffer) |
2027 |
+ spin_lock(&tcon->open_file_lock); |
2028 |
+ cifs_stats_inc( |
2029 |
+ &tcon->stats.cifs_stats.num_oplock_brks); |
2030 |
+- if (smb2_tcon_has_lease(tcon, rsp, lw)) { |
2031 |
++ if (smb2_tcon_has_lease(tcon, rsp)) { |
2032 |
+ spin_unlock(&tcon->open_file_lock); |
2033 |
+ spin_unlock(&cifs_tcp_ses_lock); |
2034 |
+ return true; |
2035 |
+ } |
2036 |
++ open = smb2_tcon_find_pending_open_lease(tcon, |
2037 |
++ rsp); |
2038 |
++ if (open) { |
2039 |
++ __u8 lease_key[SMB2_LEASE_KEY_SIZE]; |
2040 |
++ struct tcon_link *tlink; |
2041 |
++ |
2042 |
++ tlink = cifs_get_tlink(open->tlink); |
2043 |
++ memcpy(lease_key, open->lease_key, |
2044 |
++ SMB2_LEASE_KEY_SIZE); |
2045 |
++ spin_unlock(&tcon->open_file_lock); |
2046 |
++ spin_unlock(&cifs_tcp_ses_lock); |
2047 |
++ smb2_queue_pending_open_break(tlink, |
2048 |
++ lease_key, |
2049 |
++ rsp->NewLeaseState); |
2050 |
++ return true; |
2051 |
++ } |
2052 |
+ spin_unlock(&tcon->open_file_lock); |
2053 |
+ |
2054 |
+ if (tcon->crfid.is_valid && |
2055 |
+@@ -639,7 +671,6 @@ smb2_is_valid_lease_break(char *buffer) |
2056 |
+ } |
2057 |
+ } |
2058 |
+ spin_unlock(&cifs_tcp_ses_lock); |
2059 |
+- kfree(lw); |
2060 |
+ cifs_dbg(FYI, "Can not process lease break - no lease matched\n"); |
2061 |
+ return false; |
2062 |
+ } |
2063 |
+diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c |
2064 |
+index e2d2b749c8f38..379ac8caa29a6 100644 |
2065 |
+--- a/fs/cifs/smb2pdu.c |
2066 |
++++ b/fs/cifs/smb2pdu.c |
2067 |
+@@ -1132,6 +1132,8 @@ SMB2_auth_kerberos(struct SMB2_sess_data *sess_data) |
2068 |
+ spnego_key = cifs_get_spnego_key(ses); |
2069 |
+ if (IS_ERR(spnego_key)) { |
2070 |
+ rc = PTR_ERR(spnego_key); |
2071 |
++ if (rc == -ENOKEY) |
2072 |
++ cifs_dbg(VFS, "Verify user has a krb5 ticket and keyutils is installed\n"); |
2073 |
+ spnego_key = NULL; |
2074 |
+ goto out; |
2075 |
+ } |
2076 |
+diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c |
2077 |
+index 5c3d7b7e49755..d8a03b1afbc33 100644 |
2078 |
+--- a/fs/ext2/ialloc.c |
2079 |
++++ b/fs/ext2/ialloc.c |
2080 |
+@@ -80,6 +80,7 @@ static void ext2_release_inode(struct super_block *sb, int group, int dir) |
2081 |
+ if (dir) |
2082 |
+ le16_add_cpu(&desc->bg_used_dirs_count, -1); |
2083 |
+ spin_unlock(sb_bgl_lock(EXT2_SB(sb), group)); |
2084 |
++ percpu_counter_inc(&EXT2_SB(sb)->s_freeinodes_counter); |
2085 |
+ if (dir) |
2086 |
+ percpu_counter_dec(&EXT2_SB(sb)->s_dirs_counter); |
2087 |
+ mark_buffer_dirty(bh); |
2088 |
+@@ -531,7 +532,7 @@ got: |
2089 |
+ goto fail; |
2090 |
+ } |
2091 |
+ |
2092 |
+- percpu_counter_add(&sbi->s_freeinodes_counter, -1); |
2093 |
++ percpu_counter_dec(&sbi->s_freeinodes_counter); |
2094 |
+ if (S_ISDIR(mode)) |
2095 |
+ percpu_counter_inc(&sbi->s_dirs_counter); |
2096 |
+ |
2097 |
+diff --git a/fs/minix/inode.c b/fs/minix/inode.c |
2098 |
+index 4f994de46e6b9..03fe8bac36cf4 100644 |
2099 |
+--- a/fs/minix/inode.c |
2100 |
++++ b/fs/minix/inode.c |
2101 |
+@@ -155,8 +155,10 @@ static int minix_remount (struct super_block * sb, int * flags, char * data) |
2102 |
+ return 0; |
2103 |
+ } |
2104 |
+ |
2105 |
+-static bool minix_check_superblock(struct minix_sb_info *sbi) |
2106 |
++static bool minix_check_superblock(struct super_block *sb) |
2107 |
+ { |
2108 |
++ struct minix_sb_info *sbi = minix_sb(sb); |
2109 |
++ |
2110 |
+ if (sbi->s_imap_blocks == 0 || sbi->s_zmap_blocks == 0) |
2111 |
+ return false; |
2112 |
+ |
2113 |
+@@ -166,7 +168,7 @@ static bool minix_check_superblock(struct minix_sb_info *sbi) |
2114 |
+ * of indirect blocks which places the limit well above U32_MAX. |
2115 |
+ */ |
2116 |
+ if (sbi->s_version == MINIX_V1 && |
2117 |
+- sbi->s_max_size > (7 + 512 + 512*512) * BLOCK_SIZE) |
2118 |
++ sb->s_maxbytes > (7 + 512 + 512*512) * BLOCK_SIZE) |
2119 |
+ return false; |
2120 |
+ |
2121 |
+ return true; |
2122 |
+@@ -207,7 +209,7 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) |
2123 |
+ sbi->s_zmap_blocks = ms->s_zmap_blocks; |
2124 |
+ sbi->s_firstdatazone = ms->s_firstdatazone; |
2125 |
+ sbi->s_log_zone_size = ms->s_log_zone_size; |
2126 |
+- sbi->s_max_size = ms->s_max_size; |
2127 |
++ s->s_maxbytes = ms->s_max_size; |
2128 |
+ s->s_magic = ms->s_magic; |
2129 |
+ if (s->s_magic == MINIX_SUPER_MAGIC) { |
2130 |
+ sbi->s_version = MINIX_V1; |
2131 |
+@@ -238,7 +240,7 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) |
2132 |
+ sbi->s_zmap_blocks = m3s->s_zmap_blocks; |
2133 |
+ sbi->s_firstdatazone = m3s->s_firstdatazone; |
2134 |
+ sbi->s_log_zone_size = m3s->s_log_zone_size; |
2135 |
+- sbi->s_max_size = m3s->s_max_size; |
2136 |
++ s->s_maxbytes = m3s->s_max_size; |
2137 |
+ sbi->s_ninodes = m3s->s_ninodes; |
2138 |
+ sbi->s_nzones = m3s->s_zones; |
2139 |
+ sbi->s_dirsize = 64; |
2140 |
+@@ -250,7 +252,7 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) |
2141 |
+ } else |
2142 |
+ goto out_no_fs; |
2143 |
+ |
2144 |
+- if (!minix_check_superblock(sbi)) |
2145 |
++ if (!minix_check_superblock(s)) |
2146 |
+ goto out_illegal_sb; |
2147 |
+ |
2148 |
+ /* |
2149 |
+diff --git a/fs/minix/itree_v1.c b/fs/minix/itree_v1.c |
2150 |
+index 046cc96ee7adb..1fed906042aa8 100644 |
2151 |
+--- a/fs/minix/itree_v1.c |
2152 |
++++ b/fs/minix/itree_v1.c |
2153 |
+@@ -29,12 +29,12 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) |
2154 |
+ if (block < 0) { |
2155 |
+ printk("MINIX-fs: block_to_path: block %ld < 0 on dev %pg\n", |
2156 |
+ block, inode->i_sb->s_bdev); |
2157 |
+- } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) { |
2158 |
+- if (printk_ratelimit()) |
2159 |
+- printk("MINIX-fs: block_to_path: " |
2160 |
+- "block %ld too big on dev %pg\n", |
2161 |
+- block, inode->i_sb->s_bdev); |
2162 |
+- } else if (block < 7) { |
2163 |
++ return 0; |
2164 |
++ } |
2165 |
++ if ((u64)block * BLOCK_SIZE >= inode->i_sb->s_maxbytes) |
2166 |
++ return 0; |
2167 |
++ |
2168 |
++ if (block < 7) { |
2169 |
+ offsets[n++] = block; |
2170 |
+ } else if ((block -= 7) < 512) { |
2171 |
+ offsets[n++] = 7; |
2172 |
+diff --git a/fs/minix/itree_v2.c b/fs/minix/itree_v2.c |
2173 |
+index f7fc7eccccccd..9d00f31a2d9d1 100644 |
2174 |
+--- a/fs/minix/itree_v2.c |
2175 |
++++ b/fs/minix/itree_v2.c |
2176 |
+@@ -32,13 +32,12 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) |
2177 |
+ if (block < 0) { |
2178 |
+ printk("MINIX-fs: block_to_path: block %ld < 0 on dev %pg\n", |
2179 |
+ block, sb->s_bdev); |
2180 |
+- } else if ((u64)block * (u64)sb->s_blocksize >= |
2181 |
+- minix_sb(sb)->s_max_size) { |
2182 |
+- if (printk_ratelimit()) |
2183 |
+- printk("MINIX-fs: block_to_path: " |
2184 |
+- "block %ld too big on dev %pg\n", |
2185 |
+- block, sb->s_bdev); |
2186 |
+- } else if (block < DIRCOUNT) { |
2187 |
++ return 0; |
2188 |
++ } |
2189 |
++ if ((u64)block * (u64)sb->s_blocksize >= sb->s_maxbytes) |
2190 |
++ return 0; |
2191 |
++ |
2192 |
++ if (block < DIRCOUNT) { |
2193 |
+ offsets[n++] = block; |
2194 |
+ } else if ((block -= DIRCOUNT) < INDIRCOUNT(sb)) { |
2195 |
+ offsets[n++] = DIRCOUNT; |
2196 |
+diff --git a/fs/minix/minix.h b/fs/minix/minix.h |
2197 |
+index df081e8afcc3c..168d45d3de73e 100644 |
2198 |
+--- a/fs/minix/minix.h |
2199 |
++++ b/fs/minix/minix.h |
2200 |
+@@ -32,7 +32,6 @@ struct minix_sb_info { |
2201 |
+ unsigned long s_zmap_blocks; |
2202 |
+ unsigned long s_firstdatazone; |
2203 |
+ unsigned long s_log_zone_size; |
2204 |
+- unsigned long s_max_size; |
2205 |
+ int s_dirsize; |
2206 |
+ int s_namelen; |
2207 |
+ struct buffer_head ** s_imap; |
2208 |
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
2209 |
+index 05cb68ca1ba1a..1ef75b1deffa3 100644 |
2210 |
+--- a/fs/nfs/nfs4proc.c |
2211 |
++++ b/fs/nfs/nfs4proc.c |
2212 |
+@@ -5603,8 +5603,6 @@ static int _nfs4_get_security_label(struct inode *inode, void *buf, |
2213 |
+ return ret; |
2214 |
+ if (!(fattr.valid & NFS_ATTR_FATTR_V4_SECURITY_LABEL)) |
2215 |
+ return -ENOENT; |
2216 |
+- if (buflen < label.len) |
2217 |
+- return -ERANGE; |
2218 |
+ return 0; |
2219 |
+ } |
2220 |
+ |
2221 |
+diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c |
2222 |
+index c4cf0192d7bb8..0a5cae8f8aff9 100644 |
2223 |
+--- a/fs/nfs/nfs4xdr.c |
2224 |
++++ b/fs/nfs/nfs4xdr.c |
2225 |
+@@ -4280,7 +4280,11 @@ static int decode_attr_security_label(struct xdr_stream *xdr, uint32_t *bitmap, |
2226 |
+ goto out_overflow; |
2227 |
+ if (len < NFS4_MAXLABELLEN) { |
2228 |
+ if (label) { |
2229 |
+- memcpy(label->label, p, len); |
2230 |
++ if (label->len) { |
2231 |
++ if (label->len < len) |
2232 |
++ return -ERANGE; |
2233 |
++ memcpy(label->label, p, len); |
2234 |
++ } |
2235 |
+ label->len = len; |
2236 |
+ label->pi = pi; |
2237 |
+ label->lfs = lfs; |
2238 |
+diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h |
2239 |
+index 2319336183005..b9f62d29355ba 100644 |
2240 |
+--- a/fs/ocfs2/ocfs2.h |
2241 |
++++ b/fs/ocfs2/ocfs2.h |
2242 |
+@@ -338,8 +338,8 @@ struct ocfs2_super |
2243 |
+ spinlock_t osb_lock; |
2244 |
+ u32 s_next_generation; |
2245 |
+ unsigned long osb_flags; |
2246 |
+- s16 s_inode_steal_slot; |
2247 |
+- s16 s_meta_steal_slot; |
2248 |
++ u16 s_inode_steal_slot; |
2249 |
++ u16 s_meta_steal_slot; |
2250 |
+ atomic_t s_num_inodes_stolen; |
2251 |
+ atomic_t s_num_meta_stolen; |
2252 |
+ |
2253 |
+diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c |
2254 |
+index 15a89c513da2f..0230b4ece0f0e 100644 |
2255 |
+--- a/fs/ocfs2/suballoc.c |
2256 |
++++ b/fs/ocfs2/suballoc.c |
2257 |
+@@ -893,9 +893,9 @@ static void __ocfs2_set_steal_slot(struct ocfs2_super *osb, int slot, int type) |
2258 |
+ { |
2259 |
+ spin_lock(&osb->osb_lock); |
2260 |
+ if (type == INODE_ALLOC_SYSTEM_INODE) |
2261 |
+- osb->s_inode_steal_slot = slot; |
2262 |
++ osb->s_inode_steal_slot = (u16)slot; |
2263 |
+ else if (type == EXTENT_ALLOC_SYSTEM_INODE) |
2264 |
+- osb->s_meta_steal_slot = slot; |
2265 |
++ osb->s_meta_steal_slot = (u16)slot; |
2266 |
+ spin_unlock(&osb->osb_lock); |
2267 |
+ } |
2268 |
+ |
2269 |
+diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c |
2270 |
+index 3415e0b09398f..2658d91c1f7b6 100644 |
2271 |
+--- a/fs/ocfs2/super.c |
2272 |
++++ b/fs/ocfs2/super.c |
2273 |
+@@ -92,7 +92,7 @@ struct mount_options |
2274 |
+ unsigned long commit_interval; |
2275 |
+ unsigned long mount_opt; |
2276 |
+ unsigned int atime_quantum; |
2277 |
+- signed short slot; |
2278 |
++ unsigned short slot; |
2279 |
+ int localalloc_opt; |
2280 |
+ unsigned int resv_level; |
2281 |
+ int dir_resv_level; |
2282 |
+@@ -1384,7 +1384,7 @@ static int ocfs2_parse_options(struct super_block *sb, |
2283 |
+ goto bail; |
2284 |
+ } |
2285 |
+ if (option) |
2286 |
+- mopt->slot = (s16)option; |
2287 |
++ mopt->slot = (u16)option; |
2288 |
+ break; |
2289 |
+ case Opt_commit: |
2290 |
+ if (match_int(&args[0], &option)) { |
2291 |
+diff --git a/fs/ufs/super.c b/fs/ufs/super.c |
2292 |
+index a4e07e910f1b4..6e59e45d7bfbd 100644 |
2293 |
+--- a/fs/ufs/super.c |
2294 |
++++ b/fs/ufs/super.c |
2295 |
+@@ -100,7 +100,7 @@ static struct inode *ufs_nfs_get_inode(struct super_block *sb, u64 ino, u32 gene |
2296 |
+ struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; |
2297 |
+ struct inode *inode; |
2298 |
+ |
2299 |
+- if (ino < UFS_ROOTINO || ino > uspi->s_ncg * uspi->s_ipg) |
2300 |
++ if (ino < UFS_ROOTINO || ino > (u64)uspi->s_ncg * uspi->s_ipg) |
2301 |
+ return ERR_PTR(-ESTALE); |
2302 |
+ |
2303 |
+ inode = ufs_iget(sb, ino); |
2304 |
+diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h |
2305 |
+index b1b4411b4c6b8..539f4a84412f4 100644 |
2306 |
+--- a/include/linux/intel-iommu.h |
2307 |
++++ b/include/linux/intel-iommu.h |
2308 |
+@@ -308,8 +308,8 @@ enum { |
2309 |
+ |
2310 |
+ #define QI_DEV_EIOTLB_ADDR(a) ((u64)(a) & VTD_PAGE_MASK) |
2311 |
+ #define QI_DEV_EIOTLB_SIZE (((u64)1) << 11) |
2312 |
+-#define QI_DEV_EIOTLB_GLOB(g) ((u64)g) |
2313 |
+-#define QI_DEV_EIOTLB_PASID(p) (((u64)p) << 32) |
2314 |
++#define QI_DEV_EIOTLB_GLOB(g) ((u64)(g) & 0x1) |
2315 |
++#define QI_DEV_EIOTLB_PASID(p) ((u64)((p) & 0xfffff) << 32) |
2316 |
+ #define QI_DEV_EIOTLB_SID(sid) ((u64)((sid) & 0xffff) << 16) |
2317 |
+ #define QI_DEV_EIOTLB_QDEP(qd) ((u64)((qd) & 0x1f) << 4) |
2318 |
+ #define QI_DEV_EIOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | \ |
2319 |
+diff --git a/include/linux/irq.h b/include/linux/irq.h |
2320 |
+index 6ecaf056ab637..a042faefb9b73 100644 |
2321 |
+--- a/include/linux/irq.h |
2322 |
++++ b/include/linux/irq.h |
2323 |
+@@ -210,6 +210,8 @@ struct irq_data { |
2324 |
+ * IRQD_CAN_RESERVE - Can use reservation mode |
2325 |
+ * IRQD_MSI_NOMASK_QUIRK - Non-maskable MSI quirk for affinity change |
2326 |
+ * required |
2327 |
++ * IRQD_AFFINITY_ON_ACTIVATE - Affinity is set on activation. Don't call |
2328 |
++ * irq_chip::irq_set_affinity() when deactivated. |
2329 |
+ */ |
2330 |
+ enum { |
2331 |
+ IRQD_TRIGGER_MASK = 0xf, |
2332 |
+@@ -233,6 +235,7 @@ enum { |
2333 |
+ IRQD_DEFAULT_TRIGGER_SET = (1 << 25), |
2334 |
+ IRQD_CAN_RESERVE = (1 << 26), |
2335 |
+ IRQD_MSI_NOMASK_QUIRK = (1 << 27), |
2336 |
++ IRQD_AFFINITY_ON_ACTIVATE = (1 << 29), |
2337 |
+ }; |
2338 |
+ |
2339 |
+ #define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors) |
2340 |
+@@ -407,6 +410,16 @@ static inline bool irqd_msi_nomask_quirk(struct irq_data *d) |
2341 |
+ return __irqd_to_state(d) & IRQD_MSI_NOMASK_QUIRK; |
2342 |
+ } |
2343 |
+ |
2344 |
++static inline void irqd_set_affinity_on_activate(struct irq_data *d) |
2345 |
++{ |
2346 |
++ __irqd_to_state(d) |= IRQD_AFFINITY_ON_ACTIVATE; |
2347 |
++} |
2348 |
++ |
2349 |
++static inline bool irqd_affinity_on_activate(struct irq_data *d) |
2350 |
++{ |
2351 |
++ return __irqd_to_state(d) & IRQD_AFFINITY_ON_ACTIVATE; |
2352 |
++} |
2353 |
++ |
2354 |
+ #undef __irqd_to_state |
2355 |
+ |
2356 |
+ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) |
2357 |
+diff --git a/include/linux/pci.h b/include/linux/pci.h |
2358 |
+index b1f297f4b7b0b..2517492dd1855 100644 |
2359 |
+--- a/include/linux/pci.h |
2360 |
++++ b/include/linux/pci.h |
2361 |
+@@ -373,6 +373,9 @@ struct pci_dev { |
2362 |
+ bool match_driver; /* Skip attaching driver */ |
2363 |
+ |
2364 |
+ unsigned int transparent:1; /* Subtractive decode bridge */ |
2365 |
++ unsigned int io_window:1; /* Bridge has I/O window */ |
2366 |
++ unsigned int pref_window:1; /* Bridge has pref mem window */ |
2367 |
++ unsigned int pref_64_window:1; /* Pref mem window is 64-bit */ |
2368 |
+ unsigned int multifunction:1; /* Multi-function device */ |
2369 |
+ |
2370 |
+ unsigned int is_busmaster:1; /* Is busmaster */ |
2371 |
+diff --git a/include/net/sock.h b/include/net/sock.h |
2372 |
+index e2df102e669e8..77f36257cac97 100644 |
2373 |
+--- a/include/net/sock.h |
2374 |
++++ b/include/net/sock.h |
2375 |
+@@ -845,6 +845,8 @@ static inline int sk_memalloc_socks(void) |
2376 |
+ { |
2377 |
+ return static_branch_unlikely(&memalloc_socks_key); |
2378 |
+ } |
2379 |
++ |
2380 |
++void __receive_sock(struct file *file); |
2381 |
+ #else |
2382 |
+ |
2383 |
+ static inline int sk_memalloc_socks(void) |
2384 |
+@@ -852,6 +854,8 @@ static inline int sk_memalloc_socks(void) |
2385 |
+ return 0; |
2386 |
+ } |
2387 |
+ |
2388 |
++static inline void __receive_sock(struct file *file) |
2389 |
++{ } |
2390 |
+ #endif |
2391 |
+ |
2392 |
+ static inline gfp_t sk_gfp_mask(const struct sock *sk, gfp_t gfp_mask) |
2393 |
+diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c |
2394 |
+index 025fcd029f833..3b66c77670d9b 100644 |
2395 |
+--- a/kernel/irq/manage.c |
2396 |
++++ b/kernel/irq/manage.c |
2397 |
+@@ -280,12 +280,16 @@ static bool irq_set_affinity_deactivated(struct irq_data *data, |
2398 |
+ struct irq_desc *desc = irq_data_to_desc(data); |
2399 |
+ |
2400 |
+ /* |
2401 |
++ * Handle irq chips which can handle affinity only in activated |
2402 |
++ * state correctly |
2403 |
++ * |
2404 |
+ * If the interrupt is not yet activated, just store the affinity |
2405 |
+ * mask and do not call the chip driver at all. On activation the |
2406 |
+ * driver has to make sure anyway that the interrupt is in a |
2407 |
+ * useable state so startup works. |
2408 |
+ */ |
2409 |
+- if (!IS_ENABLED(CONFIG_IRQ_DOMAIN_HIERARCHY) || irqd_is_activated(data)) |
2410 |
++ if (!IS_ENABLED(CONFIG_IRQ_DOMAIN_HIERARCHY) || |
2411 |
++ irqd_is_activated(data) || !irqd_affinity_on_activate(data)) |
2412 |
+ return false; |
2413 |
+ |
2414 |
+ cpumask_copy(desc->irq_common_data.affinity, mask); |
2415 |
+diff --git a/kernel/kprobes.c b/kernel/kprobes.c |
2416 |
+index 178327a75e733..eb4bffe6d764d 100644 |
2417 |
+--- a/kernel/kprobes.c |
2418 |
++++ b/kernel/kprobes.c |
2419 |
+@@ -2077,6 +2077,13 @@ static void kill_kprobe(struct kprobe *p) |
2420 |
+ * the original probed function (which will be freed soon) any more. |
2421 |
+ */ |
2422 |
+ arch_remove_kprobe(p); |
2423 |
++ |
2424 |
++ /* |
2425 |
++ * The module is going away. We should disarm the kprobe which |
2426 |
++ * is using ftrace. |
2427 |
++ */ |
2428 |
++ if (kprobe_ftrace(p)) |
2429 |
++ disarm_kprobe_ftrace(p); |
2430 |
+ } |
2431 |
+ |
2432 |
+ /* Disable one kprobe */ |
2433 |
+diff --git a/kernel/module.c b/kernel/module.c |
2434 |
+index ae8e7a1fa74a8..d05e1bfdd3559 100644 |
2435 |
+--- a/kernel/module.c |
2436 |
++++ b/kernel/module.c |
2437 |
+@@ -1461,18 +1461,34 @@ struct module_sect_attrs { |
2438 |
+ struct module_sect_attr attrs[0]; |
2439 |
+ }; |
2440 |
+ |
2441 |
++#define MODULE_SECT_READ_SIZE (3 /* "0x", "\n" */ + (BITS_PER_LONG / 4)) |
2442 |
+ static ssize_t module_sect_read(struct file *file, struct kobject *kobj, |
2443 |
+ struct bin_attribute *battr, |
2444 |
+ char *buf, loff_t pos, size_t count) |
2445 |
+ { |
2446 |
+ struct module_sect_attr *sattr = |
2447 |
+ container_of(battr, struct module_sect_attr, battr); |
2448 |
++ char bounce[MODULE_SECT_READ_SIZE + 1]; |
2449 |
++ size_t wrote; |
2450 |
+ |
2451 |
+ if (pos != 0) |
2452 |
+ return -EINVAL; |
2453 |
+ |
2454 |
+- return sprintf(buf, "0x%px\n", |
2455 |
+- kallsyms_show_value(file->f_cred) ? (void *)sattr->address : NULL); |
2456 |
++ /* |
2457 |
++ * Since we're a binary read handler, we must account for the |
2458 |
++ * trailing NUL byte that sprintf will write: if "buf" is |
2459 |
++ * too small to hold the NUL, or the NUL is exactly the last |
2460 |
++ * byte, the read will look like it got truncated by one byte. |
2461 |
++ * Since there is no way to ask sprintf nicely to not write |
2462 |
++ * the NUL, we have to use a bounce buffer. |
2463 |
++ */ |
2464 |
++ wrote = scnprintf(bounce, sizeof(bounce), "0x%px\n", |
2465 |
++ kallsyms_show_value(file->f_cred) |
2466 |
++ ? (void *)sattr->address : NULL); |
2467 |
++ count = min(count, wrote); |
2468 |
++ memcpy(buf, bounce, count); |
2469 |
++ |
2470 |
++ return count; |
2471 |
+ } |
2472 |
+ |
2473 |
+ static void free_sect_attrs(struct module_sect_attrs *sect_attrs) |
2474 |
+@@ -1521,7 +1537,7 @@ static void add_sect_attrs(struct module *mod, const struct load_info *info) |
2475 |
+ goto out; |
2476 |
+ sect_attrs->nsections++; |
2477 |
+ sattr->battr.read = module_sect_read; |
2478 |
+- sattr->battr.size = 3 /* "0x", "\n" */ + (BITS_PER_LONG / 4); |
2479 |
++ sattr->battr.size = MODULE_SECT_READ_SIZE; |
2480 |
+ sattr->battr.attr.mode = 0400; |
2481 |
+ *(gattr++) = &(sattr++)->battr; |
2482 |
+ } |
2483 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
2484 |
+index 0c379cd40bea3..70f7743c16729 100644 |
2485 |
+--- a/kernel/trace/ftrace.c |
2486 |
++++ b/kernel/trace/ftrace.c |
2487 |
+@@ -5665,8 +5665,11 @@ static int referenced_filters(struct dyn_ftrace *rec) |
2488 |
+ int cnt = 0; |
2489 |
+ |
2490 |
+ for (ops = ftrace_ops_list; ops != &ftrace_list_end; ops = ops->next) { |
2491 |
+- if (ops_references_rec(ops, rec)) |
2492 |
+- cnt++; |
2493 |
++ if (ops_references_rec(ops, rec)) { |
2494 |
++ cnt++; |
2495 |
++ if (ops->flags & FTRACE_OPS_FL_SAVE_REGS) |
2496 |
++ rec->flags |= FTRACE_FL_REGS; |
2497 |
++ } |
2498 |
+ } |
2499 |
+ |
2500 |
+ return cnt; |
2501 |
+@@ -5843,8 +5846,8 @@ void ftrace_module_enable(struct module *mod) |
2502 |
+ if (ftrace_start_up) |
2503 |
+ cnt += referenced_filters(rec); |
2504 |
+ |
2505 |
+- /* This clears FTRACE_FL_DISABLED */ |
2506 |
+- rec->flags = cnt; |
2507 |
++ rec->flags &= ~FTRACE_FL_DISABLED; |
2508 |
++ rec->flags += cnt; |
2509 |
+ |
2510 |
+ if (ftrace_start_up && cnt) { |
2511 |
+ int failed = __ftrace_replace_code(rec, 1); |
2512 |
+@@ -6447,12 +6450,12 @@ void ftrace_pid_follow_fork(struct trace_array *tr, bool enable) |
2513 |
+ if (enable) { |
2514 |
+ register_trace_sched_process_fork(ftrace_pid_follow_sched_process_fork, |
2515 |
+ tr); |
2516 |
+- register_trace_sched_process_exit(ftrace_pid_follow_sched_process_exit, |
2517 |
++ register_trace_sched_process_free(ftrace_pid_follow_sched_process_exit, |
2518 |
+ tr); |
2519 |
+ } else { |
2520 |
+ unregister_trace_sched_process_fork(ftrace_pid_follow_sched_process_fork, |
2521 |
+ tr); |
2522 |
+- unregister_trace_sched_process_exit(ftrace_pid_follow_sched_process_exit, |
2523 |
++ unregister_trace_sched_process_free(ftrace_pid_follow_sched_process_exit, |
2524 |
+ tr); |
2525 |
+ } |
2526 |
+ } |
2527 |
+diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c |
2528 |
+index ec340e1cbffcb..27726121d332c 100644 |
2529 |
+--- a/kernel/trace/trace_events.c |
2530 |
++++ b/kernel/trace/trace_events.c |
2531 |
+@@ -534,12 +534,12 @@ void trace_event_follow_fork(struct trace_array *tr, bool enable) |
2532 |
+ if (enable) { |
2533 |
+ register_trace_prio_sched_process_fork(event_filter_pid_sched_process_fork, |
2534 |
+ tr, INT_MIN); |
2535 |
+- register_trace_prio_sched_process_exit(event_filter_pid_sched_process_exit, |
2536 |
++ register_trace_prio_sched_process_free(event_filter_pid_sched_process_exit, |
2537 |
+ tr, INT_MAX); |
2538 |
+ } else { |
2539 |
+ unregister_trace_sched_process_fork(event_filter_pid_sched_process_fork, |
2540 |
+ tr); |
2541 |
+- unregister_trace_sched_process_exit(event_filter_pid_sched_process_exit, |
2542 |
++ unregister_trace_sched_process_free(event_filter_pid_sched_process_exit, |
2543 |
+ tr); |
2544 |
+ } |
2545 |
+ } |
2546 |
+diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c |
2547 |
+index 8030e24dbf148..568918fae8d41 100644 |
2548 |
+--- a/kernel/trace/trace_hwlat.c |
2549 |
++++ b/kernel/trace/trace_hwlat.c |
2550 |
+@@ -270,6 +270,7 @@ static bool disable_migrate; |
2551 |
+ static void move_to_next_cpu(void) |
2552 |
+ { |
2553 |
+ struct cpumask *current_mask = &save_cpumask; |
2554 |
++ struct trace_array *tr = hwlat_trace; |
2555 |
+ int next_cpu; |
2556 |
+ |
2557 |
+ if (disable_migrate) |
2558 |
+@@ -283,7 +284,7 @@ static void move_to_next_cpu(void) |
2559 |
+ goto disable; |
2560 |
+ |
2561 |
+ get_online_cpus(); |
2562 |
+- cpumask_and(current_mask, cpu_online_mask, tracing_buffer_mask); |
2563 |
++ cpumask_and(current_mask, cpu_online_mask, tr->tracing_cpumask); |
2564 |
+ next_cpu = cpumask_next(smp_processor_id(), current_mask); |
2565 |
+ put_online_cpus(); |
2566 |
+ |
2567 |
+@@ -360,7 +361,7 @@ static int start_kthread(struct trace_array *tr) |
2568 |
+ /* Just pick the first CPU on first iteration */ |
2569 |
+ current_mask = &save_cpumask; |
2570 |
+ get_online_cpus(); |
2571 |
+- cpumask_and(current_mask, cpu_online_mask, tracing_buffer_mask); |
2572 |
++ cpumask_and(current_mask, cpu_online_mask, tr->tracing_cpumask); |
2573 |
+ put_online_cpus(); |
2574 |
+ next_cpu = cpumask_first(current_mask); |
2575 |
+ |
2576 |
+diff --git a/lib/test_kmod.c b/lib/test_kmod.c |
2577 |
+index 9cf77628fc913..87a0cc750ea23 100644 |
2578 |
+--- a/lib/test_kmod.c |
2579 |
++++ b/lib/test_kmod.c |
2580 |
+@@ -745,7 +745,7 @@ static int trigger_config_run_type(struct kmod_test_device *test_dev, |
2581 |
+ break; |
2582 |
+ case TEST_KMOD_FS_TYPE: |
2583 |
+ kfree_const(config->test_fs); |
2584 |
+- config->test_driver = NULL; |
2585 |
++ config->test_fs = NULL; |
2586 |
+ copied = config_copy_test_fs(config, test_str, |
2587 |
+ strlen(test_str)); |
2588 |
+ break; |
2589 |
+diff --git a/mm/khugepaged.c b/mm/khugepaged.c |
2590 |
+index ecefdba4b0dda..483c4573695a9 100644 |
2591 |
+--- a/mm/khugepaged.c |
2592 |
++++ b/mm/khugepaged.c |
2593 |
+@@ -1251,6 +1251,7 @@ static void collect_mm_slot(struct mm_slot *mm_slot) |
2594 |
+ static void retract_page_tables(struct address_space *mapping, pgoff_t pgoff) |
2595 |
+ { |
2596 |
+ struct vm_area_struct *vma; |
2597 |
++ struct mm_struct *mm; |
2598 |
+ unsigned long addr; |
2599 |
+ pmd_t *pmd, _pmd; |
2600 |
+ |
2601 |
+@@ -1264,7 +1265,8 @@ static void retract_page_tables(struct address_space *mapping, pgoff_t pgoff) |
2602 |
+ continue; |
2603 |
+ if (vma->vm_end < addr + HPAGE_PMD_SIZE) |
2604 |
+ continue; |
2605 |
+- pmd = mm_find_pmd(vma->vm_mm, addr); |
2606 |
++ mm = vma->vm_mm; |
2607 |
++ pmd = mm_find_pmd(mm, addr); |
2608 |
+ if (!pmd) |
2609 |
+ continue; |
2610 |
+ /* |
2611 |
+@@ -1273,14 +1275,16 @@ static void retract_page_tables(struct address_space *mapping, pgoff_t pgoff) |
2612 |
+ * re-fault. Not ideal, but it's more important to not disturb |
2613 |
+ * the system too much. |
2614 |
+ */ |
2615 |
+- if (down_write_trylock(&vma->vm_mm->mmap_sem)) { |
2616 |
+- spinlock_t *ptl = pmd_lock(vma->vm_mm, pmd); |
2617 |
+- /* assume page table is clear */ |
2618 |
+- _pmd = pmdp_collapse_flush(vma, addr, pmd); |
2619 |
+- spin_unlock(ptl); |
2620 |
+- up_write(&vma->vm_mm->mmap_sem); |
2621 |
+- mm_dec_nr_ptes(vma->vm_mm); |
2622 |
+- pte_free(vma->vm_mm, pmd_pgtable(_pmd)); |
2623 |
++ if (down_write_trylock(&mm->mmap_sem)) { |
2624 |
++ if (!khugepaged_test_exit(mm)) { |
2625 |
++ spinlock_t *ptl = pmd_lock(mm, pmd); |
2626 |
++ /* assume page table is clear */ |
2627 |
++ _pmd = pmdp_collapse_flush(vma, addr, pmd); |
2628 |
++ spin_unlock(ptl); |
2629 |
++ mm_dec_nr_ptes(mm); |
2630 |
++ pte_free(mm, pmd_pgtable(_pmd)); |
2631 |
++ } |
2632 |
++ up_write(&mm->mmap_sem); |
2633 |
+ } |
2634 |
+ } |
2635 |
+ i_mmap_unlock_write(mapping); |
2636 |
+diff --git a/mm/page_counter.c b/mm/page_counter.c |
2637 |
+index de31470655f66..147ff99187b81 100644 |
2638 |
+--- a/mm/page_counter.c |
2639 |
++++ b/mm/page_counter.c |
2640 |
+@@ -77,7 +77,7 @@ void page_counter_charge(struct page_counter *counter, unsigned long nr_pages) |
2641 |
+ long new; |
2642 |
+ |
2643 |
+ new = atomic_long_add_return(nr_pages, &c->usage); |
2644 |
+- propagate_protected_usage(counter, new); |
2645 |
++ propagate_protected_usage(c, new); |
2646 |
+ /* |
2647 |
+ * This is indeed racy, but we can live with some |
2648 |
+ * inaccuracy in the watermark. |
2649 |
+@@ -121,7 +121,7 @@ bool page_counter_try_charge(struct page_counter *counter, |
2650 |
+ new = atomic_long_add_return(nr_pages, &c->usage); |
2651 |
+ if (new > c->max) { |
2652 |
+ atomic_long_sub(nr_pages, &c->usage); |
2653 |
+- propagate_protected_usage(counter, new); |
2654 |
++ propagate_protected_usage(c, new); |
2655 |
+ /* |
2656 |
+ * This is racy, but we can live with some |
2657 |
+ * inaccuracy in the failcnt. |
2658 |
+@@ -130,7 +130,7 @@ bool page_counter_try_charge(struct page_counter *counter, |
2659 |
+ *fail = c; |
2660 |
+ goto failed; |
2661 |
+ } |
2662 |
+- propagate_protected_usage(counter, new); |
2663 |
++ propagate_protected_usage(c, new); |
2664 |
+ /* |
2665 |
+ * Just like with failcnt, we can live with some |
2666 |
+ * inaccuracy in the watermark. |
2667 |
+diff --git a/net/compat.c b/net/compat.c |
2668 |
+index 3c4b0283b29a1..2a8c7cb5f06a8 100644 |
2669 |
+--- a/net/compat.c |
2670 |
++++ b/net/compat.c |
2671 |
+@@ -289,6 +289,7 @@ void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm) |
2672 |
+ break; |
2673 |
+ } |
2674 |
+ /* Bump the usage count and install the file. */ |
2675 |
++ __receive_sock(fp[i]); |
2676 |
+ fd_install(new_fd, get_file(fp[i])); |
2677 |
+ } |
2678 |
+ |
2679 |
+diff --git a/net/core/sock.c b/net/core/sock.c |
2680 |
+index 6c3b031b6ad66..e6cbe137cb6fc 100644 |
2681 |
+--- a/net/core/sock.c |
2682 |
++++ b/net/core/sock.c |
2683 |
+@@ -2636,6 +2636,27 @@ int sock_no_mmap(struct file *file, struct socket *sock, struct vm_area_struct * |
2684 |
+ } |
2685 |
+ EXPORT_SYMBOL(sock_no_mmap); |
2686 |
+ |
2687 |
++/* |
2688 |
++ * When a file is received (via SCM_RIGHTS, etc), we must bump the |
2689 |
++ * various sock-based usage counts. |
2690 |
++ */ |
2691 |
++void __receive_sock(struct file *file) |
2692 |
++{ |
2693 |
++ struct socket *sock; |
2694 |
++ int error; |
2695 |
++ |
2696 |
++ /* |
2697 |
++ * The resulting value of "error" is ignored here since we only |
2698 |
++ * need to take action when the file is a socket and testing |
2699 |
++ * "sock" for NULL is sufficient. |
2700 |
++ */ |
2701 |
++ sock = sock_from_file(file, &error); |
2702 |
++ if (sock) { |
2703 |
++ sock_update_netprioidx(&sock->sk->sk_cgrp_data); |
2704 |
++ sock_update_classid(&sock->sk->sk_cgrp_data); |
2705 |
++ } |
2706 |
++} |
2707 |
++ |
2708 |
+ ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags) |
2709 |
+ { |
2710 |
+ ssize_t res; |
2711 |
+diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c |
2712 |
+index ec2e83272f9d8..2a82d438991b5 100644 |
2713 |
+--- a/net/mac80211/sta_info.c |
2714 |
++++ b/net/mac80211/sta_info.c |
2715 |
+@@ -979,7 +979,7 @@ static void __sta_info_destroy_part2(struct sta_info *sta) |
2716 |
+ might_sleep(); |
2717 |
+ lockdep_assert_held(&local->sta_mtx); |
2718 |
+ |
2719 |
+- while (sta->sta_state == IEEE80211_STA_AUTHORIZED) { |
2720 |
++ if (sta->sta_state == IEEE80211_STA_AUTHORIZED) { |
2721 |
+ ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC); |
2722 |
+ WARN_ON_ONCE(ret); |
2723 |
+ } |
2724 |
+diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c |
2725 |
+index 3ef2b27ebbe8c..f32c55ffffc79 100644 |
2726 |
+--- a/sound/pci/echoaudio/echoaudio.c |
2727 |
++++ b/sound/pci/echoaudio/echoaudio.c |
2728 |
+@@ -2216,7 +2216,6 @@ static int snd_echo_resume(struct device *dev) |
2729 |
+ if (err < 0) { |
2730 |
+ kfree(commpage_bak); |
2731 |
+ dev_err(dev, "resume init_hw err=%d\n", err); |
2732 |
+- snd_echo_free(chip); |
2733 |
+ return err; |
2734 |
+ } |
2735 |
+ |
2736 |
+@@ -2243,7 +2242,6 @@ static int snd_echo_resume(struct device *dev) |
2737 |
+ if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, |
2738 |
+ KBUILD_MODNAME, chip)) { |
2739 |
+ dev_err(chip->card->dev, "cannot grab irq\n"); |
2740 |
+- snd_echo_free(chip); |
2741 |
+ return -EBUSY; |
2742 |
+ } |
2743 |
+ chip->irq = pci->irq; |
2744 |
+diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature |
2745 |
+index 42a787856cd87..7c17f17ea2cd2 100644 |
2746 |
+--- a/tools/build/Makefile.feature |
2747 |
++++ b/tools/build/Makefile.feature |
2748 |
+@@ -7,7 +7,7 @@ endif |
2749 |
+ |
2750 |
+ feature_check = $(eval $(feature_check_code)) |
2751 |
+ define feature_check_code |
2752 |
+- feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" CXXFLAGS="$(EXTRA_CXXFLAGS) $(FEATURE_CHECK_CXXFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(feature_dir) $(OUTPUT_FEATURES)test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0) |
2753 |
++ feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CC="$(CC)" CXX="$(CXX)" CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" CXXFLAGS="$(EXTRA_CXXFLAGS) $(FEATURE_CHECK_CXXFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(feature_dir) $(OUTPUT_FEATURES)test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0) |
2754 |
+ endef |
2755 |
+ |
2756 |
+ feature_set = $(eval $(feature_set_code)) |
2757 |
+diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile |
2758 |
+index bf8a8ebcca1eb..c4845b66b9baa 100644 |
2759 |
+--- a/tools/build/feature/Makefile |
2760 |
++++ b/tools/build/feature/Makefile |
2761 |
+@@ -62,8 +62,6 @@ FILES= \ |
2762 |
+ |
2763 |
+ FILES := $(addprefix $(OUTPUT),$(FILES)) |
2764 |
+ |
2765 |
+-CC ?= $(CROSS_COMPILE)gcc |
2766 |
+-CXX ?= $(CROSS_COMPILE)g++ |
2767 |
+ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config |
2768 |
+ LLVM_CONFIG ?= llvm-config |
2769 |
+ |
2770 |
+diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c |
2771 |
+index 0251dd348124a..4864fc67d01b5 100644 |
2772 |
+--- a/tools/perf/bench/mem-functions.c |
2773 |
++++ b/tools/perf/bench/mem-functions.c |
2774 |
+@@ -222,12 +222,8 @@ static int bench_mem_common(int argc, const char **argv, struct bench_mem_info * |
2775 |
+ return 0; |
2776 |
+ } |
2777 |
+ |
2778 |
+-static u64 do_memcpy_cycles(const struct function *r, size_t size, void *src, void *dst) |
2779 |
++static void memcpy_prefault(memcpy_t fn, size_t size, void *src, void *dst) |
2780 |
+ { |
2781 |
+- u64 cycle_start = 0ULL, cycle_end = 0ULL; |
2782 |
+- memcpy_t fn = r->fn.memcpy; |
2783 |
+- int i; |
2784 |
+- |
2785 |
+ /* Make sure to always prefault zero pages even if MMAP_THRESH is crossed: */ |
2786 |
+ memset(src, 0, size); |
2787 |
+ |
2788 |
+@@ -236,6 +232,15 @@ static u64 do_memcpy_cycles(const struct function *r, size_t size, void *src, vo |
2789 |
+ * to not measure page fault overhead: |
2790 |
+ */ |
2791 |
+ fn(dst, src, size); |
2792 |
++} |
2793 |
++ |
2794 |
++static u64 do_memcpy_cycles(const struct function *r, size_t size, void *src, void *dst) |
2795 |
++{ |
2796 |
++ u64 cycle_start = 0ULL, cycle_end = 0ULL; |
2797 |
++ memcpy_t fn = r->fn.memcpy; |
2798 |
++ int i; |
2799 |
++ |
2800 |
++ memcpy_prefault(fn, size, src, dst); |
2801 |
+ |
2802 |
+ cycle_start = get_cycles(); |
2803 |
+ for (i = 0; i < nr_loops; ++i) |
2804 |
+@@ -251,11 +256,7 @@ static double do_memcpy_gettimeofday(const struct function *r, size_t size, void |
2805 |
+ memcpy_t fn = r->fn.memcpy; |
2806 |
+ int i; |
2807 |
+ |
2808 |
+- /* |
2809 |
+- * We prefault the freshly allocated memory range here, |
2810 |
+- * to not measure page fault overhead: |
2811 |
+- */ |
2812 |
+- fn(dst, src, size); |
2813 |
++ memcpy_prefault(fn, size, src, dst); |
2814 |
+ |
2815 |
+ BUG_ON(gettimeofday(&tv_start, NULL)); |
2816 |
+ for (i = 0; i < nr_loops; ++i) |
2817 |
+diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c |
2818 |
+index 4357141c7c924..6522b6513895c 100644 |
2819 |
+--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c |
2820 |
++++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c |
2821 |
+@@ -1129,6 +1129,7 @@ static int intel_pt_walk_fup(struct intel_pt_decoder *decoder) |
2822 |
+ return 0; |
2823 |
+ if (err == -EAGAIN || |
2824 |
+ intel_pt_fup_with_nlip(decoder, &intel_pt_insn, ip, err)) { |
2825 |
++ decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; |
2826 |
+ if (intel_pt_fup_event(decoder)) |
2827 |
+ return 0; |
2828 |
+ return -EAGAIN; |
2829 |
+@@ -1780,17 +1781,13 @@ next: |
2830 |
+ } |
2831 |
+ if (decoder->set_fup_mwait) |
2832 |
+ no_tip = true; |
2833 |
++ if (no_tip) |
2834 |
++ decoder->pkt_state = INTEL_PT_STATE_FUP_NO_TIP; |
2835 |
++ else |
2836 |
++ decoder->pkt_state = INTEL_PT_STATE_FUP; |
2837 |
+ err = intel_pt_walk_fup(decoder); |
2838 |
+- if (err != -EAGAIN) { |
2839 |
+- if (err) |
2840 |
+- return err; |
2841 |
+- if (no_tip) |
2842 |
+- decoder->pkt_state = |
2843 |
+- INTEL_PT_STATE_FUP_NO_TIP; |
2844 |
+- else |
2845 |
+- decoder->pkt_state = INTEL_PT_STATE_FUP; |
2846 |
+- return 0; |
2847 |
+- } |
2848 |
++ if (err != -EAGAIN) |
2849 |
++ return err; |
2850 |
+ if (no_tip) { |
2851 |
+ no_tip = false; |
2852 |
+ break; |
2853 |
+@@ -2375,15 +2372,11 @@ const struct intel_pt_state *intel_pt_decode(struct intel_pt_decoder *decoder) |
2854 |
+ err = intel_pt_walk_tip(decoder); |
2855 |
+ break; |
2856 |
+ case INTEL_PT_STATE_FUP: |
2857 |
+- decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; |
2858 |
+ err = intel_pt_walk_fup(decoder); |
2859 |
+ if (err == -EAGAIN) |
2860 |
+ err = intel_pt_walk_fup_tip(decoder); |
2861 |
+- else if (!err) |
2862 |
+- decoder->pkt_state = INTEL_PT_STATE_FUP; |
2863 |
+ break; |
2864 |
+ case INTEL_PT_STATE_FUP_NO_TIP: |
2865 |
+- decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; |
2866 |
+ err = intel_pt_walk_fup(decoder); |
2867 |
+ if (err == -EAGAIN) |
2868 |
+ err = intel_pt_walk_trace(decoder); |
2869 |
+diff --git a/tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c b/tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c |
2870 |
+index bdbbbe8431e03..3694613f418f6 100644 |
2871 |
+--- a/tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c |
2872 |
++++ b/tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c |
2873 |
+@@ -44,7 +44,7 @@ struct shared_info { |
2874 |
+ unsigned long amr2; |
2875 |
+ |
2876 |
+ /* AMR value that ptrace should refuse to write to the child. */ |
2877 |
+- unsigned long amr3; |
2878 |
++ unsigned long invalid_amr; |
2879 |
+ |
2880 |
+ /* IAMR value the parent expects to read from the child. */ |
2881 |
+ unsigned long expected_iamr; |
2882 |
+@@ -57,8 +57,8 @@ struct shared_info { |
2883 |
+ * (even though they're valid ones) because userspace doesn't have |
2884 |
+ * access to those registers. |
2885 |
+ */ |
2886 |
+- unsigned long new_iamr; |
2887 |
+- unsigned long new_uamor; |
2888 |
++ unsigned long invalid_iamr; |
2889 |
++ unsigned long invalid_uamor; |
2890 |
+ }; |
2891 |
+ |
2892 |
+ static int sys_pkey_alloc(unsigned long flags, unsigned long init_access_rights) |
2893 |
+@@ -66,11 +66,6 @@ static int sys_pkey_alloc(unsigned long flags, unsigned long init_access_rights) |
2894 |
+ return syscall(__NR_pkey_alloc, flags, init_access_rights); |
2895 |
+ } |
2896 |
+ |
2897 |
+-static int sys_pkey_free(int pkey) |
2898 |
+-{ |
2899 |
+- return syscall(__NR_pkey_free, pkey); |
2900 |
+-} |
2901 |
+- |
2902 |
+ static int child(struct shared_info *info) |
2903 |
+ { |
2904 |
+ unsigned long reg; |
2905 |
+@@ -100,28 +95,32 @@ static int child(struct shared_info *info) |
2906 |
+ |
2907 |
+ info->amr1 |= 3ul << pkeyshift(pkey1); |
2908 |
+ info->amr2 |= 3ul << pkeyshift(pkey2); |
2909 |
+- info->amr3 |= info->amr2 | 3ul << pkeyshift(pkey3); |
2910 |
++ /* |
2911 |
++ * invalid amr value where we try to force write |
2912 |
++ * things which are deined by a uamor setting. |
2913 |
++ */ |
2914 |
++ info->invalid_amr = info->amr2 | (~0x0UL & ~info->expected_uamor); |
2915 |
+ |
2916 |
++ /* |
2917 |
++ * if PKEY_DISABLE_EXECUTE succeeded we should update the expected_iamr |
2918 |
++ */ |
2919 |
+ if (disable_execute) |
2920 |
+ info->expected_iamr |= 1ul << pkeyshift(pkey1); |
2921 |
+ else |
2922 |
+ info->expected_iamr &= ~(1ul << pkeyshift(pkey1)); |
2923 |
+ |
2924 |
+- info->expected_iamr &= ~(1ul << pkeyshift(pkey2) | 1ul << pkeyshift(pkey3)); |
2925 |
+- |
2926 |
+- info->expected_uamor |= 3ul << pkeyshift(pkey1) | |
2927 |
+- 3ul << pkeyshift(pkey2); |
2928 |
+- info->new_iamr |= 1ul << pkeyshift(pkey1) | 1ul << pkeyshift(pkey2); |
2929 |
+- info->new_uamor |= 3ul << pkeyshift(pkey1); |
2930 |
++ /* |
2931 |
++ * We allocated pkey2 and pkey 3 above. Clear the IAMR bits. |
2932 |
++ */ |
2933 |
++ info->expected_iamr &= ~(1ul << pkeyshift(pkey2)); |
2934 |
++ info->expected_iamr &= ~(1ul << pkeyshift(pkey3)); |
2935 |
+ |
2936 |
+ /* |
2937 |
+- * We won't use pkey3. We just want a plausible but invalid key to test |
2938 |
+- * whether ptrace will let us write to AMR bits we are not supposed to. |
2939 |
+- * |
2940 |
+- * This also tests whether the kernel restores the UAMOR permissions |
2941 |
+- * after a key is freed. |
2942 |
++ * Create an IAMR value different from expected value. |
2943 |
++ * Kernel will reject an IAMR and UAMOR change. |
2944 |
+ */ |
2945 |
+- sys_pkey_free(pkey3); |
2946 |
++ info->invalid_iamr = info->expected_iamr | (1ul << pkeyshift(pkey1) | 1ul << pkeyshift(pkey2)); |
2947 |
++ info->invalid_uamor = info->expected_uamor & ~(0x3ul << pkeyshift(pkey1)); |
2948 |
+ |
2949 |
+ printf("%-30s AMR: %016lx pkey1: %d pkey2: %d pkey3: %d\n", |
2950 |
+ user_write, info->amr1, pkey1, pkey2, pkey3); |
2951 |
+@@ -196,9 +195,9 @@ static int parent(struct shared_info *info, pid_t pid) |
2952 |
+ PARENT_SKIP_IF_UNSUPPORTED(ret, &info->child_sync); |
2953 |
+ PARENT_FAIL_IF(ret, &info->child_sync); |
2954 |
+ |
2955 |
+- info->amr1 = info->amr2 = info->amr3 = regs[0]; |
2956 |
+- info->expected_iamr = info->new_iamr = regs[1]; |
2957 |
+- info->expected_uamor = info->new_uamor = regs[2]; |
2958 |
++ info->amr1 = info->amr2 = regs[0]; |
2959 |
++ info->expected_iamr = regs[1]; |
2960 |
++ info->expected_uamor = regs[2]; |
2961 |
+ |
2962 |
+ /* Wake up child so that it can set itself up. */ |
2963 |
+ ret = prod_child(&info->child_sync); |
2964 |
+@@ -234,10 +233,10 @@ static int parent(struct shared_info *info, pid_t pid) |
2965 |
+ return ret; |
2966 |
+ |
2967 |
+ /* Write invalid AMR value in child. */ |
2968 |
+- ret = ptrace_write_regs(pid, NT_PPC_PKEY, &info->amr3, 1); |
2969 |
++ ret = ptrace_write_regs(pid, NT_PPC_PKEY, &info->invalid_amr, 1); |
2970 |
+ PARENT_FAIL_IF(ret, &info->child_sync); |
2971 |
+ |
2972 |
+- printf("%-30s AMR: %016lx\n", ptrace_write_running, info->amr3); |
2973 |
++ printf("%-30s AMR: %016lx\n", ptrace_write_running, info->invalid_amr); |
2974 |
+ |
2975 |
+ /* Wake up child so that it can verify it didn't change. */ |
2976 |
+ ret = prod_child(&info->child_sync); |
2977 |
+@@ -249,7 +248,7 @@ static int parent(struct shared_info *info, pid_t pid) |
2978 |
+ |
2979 |
+ /* Try to write to IAMR. */ |
2980 |
+ regs[0] = info->amr1; |
2981 |
+- regs[1] = info->new_iamr; |
2982 |
++ regs[1] = info->invalid_iamr; |
2983 |
+ ret = ptrace_write_regs(pid, NT_PPC_PKEY, regs, 2); |
2984 |
+ PARENT_FAIL_IF(!ret, &info->child_sync); |
2985 |
+ |
2986 |
+@@ -257,7 +256,7 @@ static int parent(struct shared_info *info, pid_t pid) |
2987 |
+ ptrace_write_running, regs[0], regs[1]); |
2988 |
+ |
2989 |
+ /* Try to write to IAMR and UAMOR. */ |
2990 |
+- regs[2] = info->new_uamor; |
2991 |
++ regs[2] = info->invalid_uamor; |
2992 |
+ ret = ptrace_write_regs(pid, NT_PPC_PKEY, regs, 3); |
2993 |
+ PARENT_FAIL_IF(!ret, &info->child_sync); |
2994 |
+ |