1 |
commit: e6ea672694ccf0bad305b4ffeb7b8dac3e3f804e |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Mar 13 22:10:33 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Mar 13 22:10:33 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=e6ea6726 |
7 |
|
8 |
proj/linux-patches: Linux patch 5.0.2 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1001_linux-5.0.2.patch | 1235 ++++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 1239 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 99e0bb6..04daf20 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -47,6 +47,10 @@ Patch: 1000_linux-5.0.1.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.0.1 |
23 |
|
24 |
+Patch: 1001_linux-5.0.2.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.0.2 |
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/1001_linux-5.0.2.patch b/1001_linux-5.0.2.patch |
33 |
new file mode 100644 |
34 |
index 0000000..4fcf3cb |
35 |
--- /dev/null |
36 |
+++ b/1001_linux-5.0.2.patch |
37 |
@@ -0,0 +1,1235 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 3cd7163fe164..bb2f7664594a 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 0 |
46 |
+-SUBLEVEL = 1 |
47 |
++SUBLEVEL = 2 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Shy Crocodile |
50 |
+ |
51 |
+diff --git a/arch/arm/boot/dts/exynos3250.dtsi b/arch/arm/boot/dts/exynos3250.dtsi |
52 |
+index 608d17454179..5892a9f7622f 100644 |
53 |
+--- a/arch/arm/boot/dts/exynos3250.dtsi |
54 |
++++ b/arch/arm/boot/dts/exynos3250.dtsi |
55 |
+@@ -168,6 +168,9 @@ |
56 |
+ interrupt-controller; |
57 |
+ #interrupt-cells = <3>; |
58 |
+ interrupt-parent = <&gic>; |
59 |
++ clock-names = "clkout8"; |
60 |
++ clocks = <&cmu CLK_FIN_PLL>; |
61 |
++ #clock-cells = <1>; |
62 |
+ }; |
63 |
+ |
64 |
+ mipi_phy: video-phy { |
65 |
+diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi |
66 |
+index 3a9eb1e91c45..8a64c4e8c474 100644 |
67 |
+--- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi |
68 |
++++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi |
69 |
+@@ -49,7 +49,7 @@ |
70 |
+ }; |
71 |
+ |
72 |
+ emmc_pwrseq: pwrseq { |
73 |
+- pinctrl-0 = <&sd1_cd>; |
74 |
++ pinctrl-0 = <&emmc_rstn>; |
75 |
+ pinctrl-names = "default"; |
76 |
+ compatible = "mmc-pwrseq-emmc"; |
77 |
+ reset-gpios = <&gpk1 2 GPIO_ACTIVE_LOW>; |
78 |
+@@ -165,12 +165,6 @@ |
79 |
+ cpu0-supply = <&buck2_reg>; |
80 |
+ }; |
81 |
+ |
82 |
+-/* RSTN signal for eMMC */ |
83 |
+-&sd1_cd { |
84 |
+- samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; |
85 |
+- samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>; |
86 |
+-}; |
87 |
+- |
88 |
+ &pinctrl_1 { |
89 |
+ gpio_power_key: power_key { |
90 |
+ samsung,pins = "gpx1-3"; |
91 |
+@@ -188,6 +182,11 @@ |
92 |
+ samsung,pins = "gpx3-7"; |
93 |
+ samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>; |
94 |
+ }; |
95 |
++ |
96 |
++ emmc_rstn: emmc-rstn { |
97 |
++ samsung,pins = "gpk1-2"; |
98 |
++ samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; |
99 |
++ }; |
100 |
+ }; |
101 |
+ |
102 |
+ &ehci { |
103 |
+diff --git a/arch/arm/boot/dts/exynos5422-odroid-core.dtsi b/arch/arm/boot/dts/exynos5422-odroid-core.dtsi |
104 |
+index bf09eab90f8a..6bf3661293ee 100644 |
105 |
+--- a/arch/arm/boot/dts/exynos5422-odroid-core.dtsi |
106 |
++++ b/arch/arm/boot/dts/exynos5422-odroid-core.dtsi |
107 |
+@@ -468,7 +468,7 @@ |
108 |
+ buck8_reg: BUCK8 { |
109 |
+ regulator-name = "vdd_1.8v_ldo"; |
110 |
+ regulator-min-microvolt = <800000>; |
111 |
+- regulator-max-microvolt = <1500000>; |
112 |
++ regulator-max-microvolt = <2000000>; |
113 |
+ regulator-always-on; |
114 |
+ regulator-boot-on; |
115 |
+ }; |
116 |
+diff --git a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts |
117 |
+index 610235028cc7..c14205cd6bf5 100644 |
118 |
+--- a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts |
119 |
++++ b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts |
120 |
+@@ -118,6 +118,7 @@ |
121 |
+ reset-gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; |
122 |
+ clocks = <&pmic>; |
123 |
+ clock-names = "ext_clock"; |
124 |
++ post-power-on-delay-ms = <10>; |
125 |
+ power-off-delay-us = <10>; |
126 |
+ }; |
127 |
+ |
128 |
+@@ -300,7 +301,6 @@ |
129 |
+ |
130 |
+ dwmmc_0: dwmmc0@f723d000 { |
131 |
+ cap-mmc-highspeed; |
132 |
+- mmc-hs200-1_8v; |
133 |
+ non-removable; |
134 |
+ bus-width = <0x8>; |
135 |
+ vmmc-supply = <&ldo19>; |
136 |
+diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-zcu100-revC.dts b/arch/arm64/boot/dts/xilinx/zynqmp-zcu100-revC.dts |
137 |
+index 13a0a028df98..e5699d0d91e4 100644 |
138 |
+--- a/arch/arm64/boot/dts/xilinx/zynqmp-zcu100-revC.dts |
139 |
++++ b/arch/arm64/boot/dts/xilinx/zynqmp-zcu100-revC.dts |
140 |
+@@ -101,6 +101,7 @@ |
141 |
+ sdio_pwrseq: sdio-pwrseq { |
142 |
+ compatible = "mmc-pwrseq-simple"; |
143 |
+ reset-gpios = <&gpio 7 GPIO_ACTIVE_LOW>; /* WIFI_EN */ |
144 |
++ post-power-on-delay-ms = <10>; |
145 |
+ }; |
146 |
+ }; |
147 |
+ |
148 |
+diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c |
149 |
+index b684f0294f35..e2b1447192a8 100644 |
150 |
+--- a/arch/x86/events/core.c |
151 |
++++ b/arch/x86/events/core.c |
152 |
+@@ -1995,7 +1995,7 @@ static int x86_pmu_commit_txn(struct pmu *pmu) |
153 |
+ */ |
154 |
+ static void free_fake_cpuc(struct cpu_hw_events *cpuc) |
155 |
+ { |
156 |
+- kfree(cpuc->shared_regs); |
157 |
++ intel_cpuc_finish(cpuc); |
158 |
+ kfree(cpuc); |
159 |
+ } |
160 |
+ |
161 |
+@@ -2007,14 +2007,11 @@ static struct cpu_hw_events *allocate_fake_cpuc(void) |
162 |
+ cpuc = kzalloc(sizeof(*cpuc), GFP_KERNEL); |
163 |
+ if (!cpuc) |
164 |
+ return ERR_PTR(-ENOMEM); |
165 |
+- |
166 |
+- /* only needed, if we have extra_regs */ |
167 |
+- if (x86_pmu.extra_regs) { |
168 |
+- cpuc->shared_regs = allocate_shared_regs(cpu); |
169 |
+- if (!cpuc->shared_regs) |
170 |
+- goto error; |
171 |
+- } |
172 |
+ cpuc->is_fake = 1; |
173 |
++ |
174 |
++ if (intel_cpuc_prepare(cpuc, cpu)) |
175 |
++ goto error; |
176 |
++ |
177 |
+ return cpuc; |
178 |
+ error: |
179 |
+ free_fake_cpuc(cpuc); |
180 |
+diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
181 |
+index 730978dff63f..dadb8f7e5a0d 100644 |
182 |
+--- a/arch/x86/events/intel/core.c |
183 |
++++ b/arch/x86/events/intel/core.c |
184 |
+@@ -1999,6 +1999,39 @@ static void intel_pmu_nhm_enable_all(int added) |
185 |
+ intel_pmu_enable_all(added); |
186 |
+ } |
187 |
+ |
188 |
++static void intel_set_tfa(struct cpu_hw_events *cpuc, bool on) |
189 |
++{ |
190 |
++ u64 val = on ? MSR_TFA_RTM_FORCE_ABORT : 0; |
191 |
++ |
192 |
++ if (cpuc->tfa_shadow != val) { |
193 |
++ cpuc->tfa_shadow = val; |
194 |
++ wrmsrl(MSR_TSX_FORCE_ABORT, val); |
195 |
++ } |
196 |
++} |
197 |
++ |
198 |
++static void intel_tfa_commit_scheduling(struct cpu_hw_events *cpuc, int idx, int cntr) |
199 |
++{ |
200 |
++ /* |
201 |
++ * We're going to use PMC3, make sure TFA is set before we touch it. |
202 |
++ */ |
203 |
++ if (cntr == 3 && !cpuc->is_fake) |
204 |
++ intel_set_tfa(cpuc, true); |
205 |
++} |
206 |
++ |
207 |
++static void intel_tfa_pmu_enable_all(int added) |
208 |
++{ |
209 |
++ struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); |
210 |
++ |
211 |
++ /* |
212 |
++ * If we find PMC3 is no longer used when we enable the PMU, we can |
213 |
++ * clear TFA. |
214 |
++ */ |
215 |
++ if (!test_bit(3, cpuc->active_mask)) |
216 |
++ intel_set_tfa(cpuc, false); |
217 |
++ |
218 |
++ intel_pmu_enable_all(added); |
219 |
++} |
220 |
++ |
221 |
+ static void enable_counter_freeze(void) |
222 |
+ { |
223 |
+ update_debugctlmsr(get_debugctlmsr() | |
224 |
+@@ -2768,6 +2801,35 @@ intel_stop_scheduling(struct cpu_hw_events *cpuc) |
225 |
+ raw_spin_unlock(&excl_cntrs->lock); |
226 |
+ } |
227 |
+ |
228 |
++static struct event_constraint * |
229 |
++dyn_constraint(struct cpu_hw_events *cpuc, struct event_constraint *c, int idx) |
230 |
++{ |
231 |
++ WARN_ON_ONCE(!cpuc->constraint_list); |
232 |
++ |
233 |
++ if (!(c->flags & PERF_X86_EVENT_DYNAMIC)) { |
234 |
++ struct event_constraint *cx; |
235 |
++ |
236 |
++ /* |
237 |
++ * grab pre-allocated constraint entry |
238 |
++ */ |
239 |
++ cx = &cpuc->constraint_list[idx]; |
240 |
++ |
241 |
++ /* |
242 |
++ * initialize dynamic constraint |
243 |
++ * with static constraint |
244 |
++ */ |
245 |
++ *cx = *c; |
246 |
++ |
247 |
++ /* |
248 |
++ * mark constraint as dynamic |
249 |
++ */ |
250 |
++ cx->flags |= PERF_X86_EVENT_DYNAMIC; |
251 |
++ c = cx; |
252 |
++ } |
253 |
++ |
254 |
++ return c; |
255 |
++} |
256 |
++ |
257 |
+ static struct event_constraint * |
258 |
+ intel_get_excl_constraints(struct cpu_hw_events *cpuc, struct perf_event *event, |
259 |
+ int idx, struct event_constraint *c) |
260 |
+@@ -2798,27 +2860,7 @@ intel_get_excl_constraints(struct cpu_hw_events *cpuc, struct perf_event *event, |
261 |
+ * only needed when constraint has not yet |
262 |
+ * been cloned (marked dynamic) |
263 |
+ */ |
264 |
+- if (!(c->flags & PERF_X86_EVENT_DYNAMIC)) { |
265 |
+- struct event_constraint *cx; |
266 |
+- |
267 |
+- /* |
268 |
+- * grab pre-allocated constraint entry |
269 |
+- */ |
270 |
+- cx = &cpuc->constraint_list[idx]; |
271 |
+- |
272 |
+- /* |
273 |
+- * initialize dynamic constraint |
274 |
+- * with static constraint |
275 |
+- */ |
276 |
+- *cx = *c; |
277 |
+- |
278 |
+- /* |
279 |
+- * mark constraint as dynamic, so we |
280 |
+- * can free it later on |
281 |
+- */ |
282 |
+- cx->flags |= PERF_X86_EVENT_DYNAMIC; |
283 |
+- c = cx; |
284 |
+- } |
285 |
++ c = dyn_constraint(cpuc, c, idx); |
286 |
+ |
287 |
+ /* |
288 |
+ * From here on, the constraint is dynamic. |
289 |
+@@ -3345,6 +3387,26 @@ glp_get_event_constraints(struct cpu_hw_events *cpuc, int idx, |
290 |
+ return c; |
291 |
+ } |
292 |
+ |
293 |
++static bool allow_tsx_force_abort = true; |
294 |
++ |
295 |
++static struct event_constraint * |
296 |
++tfa_get_event_constraints(struct cpu_hw_events *cpuc, int idx, |
297 |
++ struct perf_event *event) |
298 |
++{ |
299 |
++ struct event_constraint *c = hsw_get_event_constraints(cpuc, idx, event); |
300 |
++ |
301 |
++ /* |
302 |
++ * Without TFA we must not use PMC3. |
303 |
++ */ |
304 |
++ if (!allow_tsx_force_abort && test_bit(3, c->idxmsk)) { |
305 |
++ c = dyn_constraint(cpuc, c, idx); |
306 |
++ c->idxmsk64 &= ~(1ULL << 3); |
307 |
++ c->weight--; |
308 |
++ } |
309 |
++ |
310 |
++ return c; |
311 |
++} |
312 |
++ |
313 |
+ /* |
314 |
+ * Broadwell: |
315 |
+ * |
316 |
+@@ -3398,7 +3460,7 @@ ssize_t intel_event_sysfs_show(char *page, u64 config) |
317 |
+ return x86_event_sysfs_show(page, config, event); |
318 |
+ } |
319 |
+ |
320 |
+-struct intel_shared_regs *allocate_shared_regs(int cpu) |
321 |
++static struct intel_shared_regs *allocate_shared_regs(int cpu) |
322 |
+ { |
323 |
+ struct intel_shared_regs *regs; |
324 |
+ int i; |
325 |
+@@ -3430,23 +3492,24 @@ static struct intel_excl_cntrs *allocate_excl_cntrs(int cpu) |
326 |
+ return c; |
327 |
+ } |
328 |
+ |
329 |
+-static int intel_pmu_cpu_prepare(int cpu) |
330 |
+-{ |
331 |
+- struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
332 |
+ |
333 |
++int intel_cpuc_prepare(struct cpu_hw_events *cpuc, int cpu) |
334 |
++{ |
335 |
+ if (x86_pmu.extra_regs || x86_pmu.lbr_sel_map) { |
336 |
+ cpuc->shared_regs = allocate_shared_regs(cpu); |
337 |
+ if (!cpuc->shared_regs) |
338 |
+ goto err; |
339 |
+ } |
340 |
+ |
341 |
+- if (x86_pmu.flags & PMU_FL_EXCL_CNTRS) { |
342 |
++ if (x86_pmu.flags & (PMU_FL_EXCL_CNTRS | PMU_FL_TFA)) { |
343 |
+ size_t sz = X86_PMC_IDX_MAX * sizeof(struct event_constraint); |
344 |
+ |
345 |
+- cpuc->constraint_list = kzalloc(sz, GFP_KERNEL); |
346 |
++ cpuc->constraint_list = kzalloc_node(sz, GFP_KERNEL, cpu_to_node(cpu)); |
347 |
+ if (!cpuc->constraint_list) |
348 |
+ goto err_shared_regs; |
349 |
++ } |
350 |
+ |
351 |
++ if (x86_pmu.flags & PMU_FL_EXCL_CNTRS) { |
352 |
+ cpuc->excl_cntrs = allocate_excl_cntrs(cpu); |
353 |
+ if (!cpuc->excl_cntrs) |
354 |
+ goto err_constraint_list; |
355 |
+@@ -3468,6 +3531,11 @@ err: |
356 |
+ return -ENOMEM; |
357 |
+ } |
358 |
+ |
359 |
++static int intel_pmu_cpu_prepare(int cpu) |
360 |
++{ |
361 |
++ return intel_cpuc_prepare(&per_cpu(cpu_hw_events, cpu), cpu); |
362 |
++} |
363 |
++ |
364 |
+ static void flip_smm_bit(void *data) |
365 |
+ { |
366 |
+ unsigned long set = *(unsigned long *)data; |
367 |
+@@ -3542,9 +3610,8 @@ static void intel_pmu_cpu_starting(int cpu) |
368 |
+ } |
369 |
+ } |
370 |
+ |
371 |
+-static void free_excl_cntrs(int cpu) |
372 |
++static void free_excl_cntrs(struct cpu_hw_events *cpuc) |
373 |
+ { |
374 |
+- struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
375 |
+ struct intel_excl_cntrs *c; |
376 |
+ |
377 |
+ c = cpuc->excl_cntrs; |
378 |
+@@ -3552,9 +3619,10 @@ static void free_excl_cntrs(int cpu) |
379 |
+ if (c->core_id == -1 || --c->refcnt == 0) |
380 |
+ kfree(c); |
381 |
+ cpuc->excl_cntrs = NULL; |
382 |
+- kfree(cpuc->constraint_list); |
383 |
+- cpuc->constraint_list = NULL; |
384 |
+ } |
385 |
++ |
386 |
++ kfree(cpuc->constraint_list); |
387 |
++ cpuc->constraint_list = NULL; |
388 |
+ } |
389 |
+ |
390 |
+ static void intel_pmu_cpu_dying(int cpu) |
391 |
+@@ -3565,9 +3633,8 @@ static void intel_pmu_cpu_dying(int cpu) |
392 |
+ disable_counter_freeze(); |
393 |
+ } |
394 |
+ |
395 |
+-static void intel_pmu_cpu_dead(int cpu) |
396 |
++void intel_cpuc_finish(struct cpu_hw_events *cpuc) |
397 |
+ { |
398 |
+- struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
399 |
+ struct intel_shared_regs *pc; |
400 |
+ |
401 |
+ pc = cpuc->shared_regs; |
402 |
+@@ -3577,7 +3644,12 @@ static void intel_pmu_cpu_dead(int cpu) |
403 |
+ cpuc->shared_regs = NULL; |
404 |
+ } |
405 |
+ |
406 |
+- free_excl_cntrs(cpu); |
407 |
++ free_excl_cntrs(cpuc); |
408 |
++} |
409 |
++ |
410 |
++static void intel_pmu_cpu_dead(int cpu) |
411 |
++{ |
412 |
++ intel_cpuc_finish(&per_cpu(cpu_hw_events, cpu)); |
413 |
+ } |
414 |
+ |
415 |
+ static void intel_pmu_sched_task(struct perf_event_context *ctx, |
416 |
+@@ -4070,8 +4142,11 @@ static struct attribute *intel_pmu_caps_attrs[] = { |
417 |
+ NULL |
418 |
+ }; |
419 |
+ |
420 |
++DEVICE_BOOL_ATTR(allow_tsx_force_abort, 0644, allow_tsx_force_abort); |
421 |
++ |
422 |
+ static struct attribute *intel_pmu_attrs[] = { |
423 |
+ &dev_attr_freeze_on_smi.attr, |
424 |
++ NULL, /* &dev_attr_allow_tsx_force_abort.attr.attr */ |
425 |
+ NULL, |
426 |
+ }; |
427 |
+ |
428 |
+@@ -4564,6 +4639,15 @@ __init int intel_pmu_init(void) |
429 |
+ tsx_attr = hsw_tsx_events_attrs; |
430 |
+ intel_pmu_pebs_data_source_skl( |
431 |
+ boot_cpu_data.x86_model == INTEL_FAM6_SKYLAKE_X); |
432 |
++ |
433 |
++ if (boot_cpu_has(X86_FEATURE_TSX_FORCE_ABORT)) { |
434 |
++ x86_pmu.flags |= PMU_FL_TFA; |
435 |
++ x86_pmu.get_event_constraints = tfa_get_event_constraints; |
436 |
++ x86_pmu.enable_all = intel_tfa_pmu_enable_all; |
437 |
++ x86_pmu.commit_scheduling = intel_tfa_commit_scheduling; |
438 |
++ intel_pmu_attrs[1] = &dev_attr_allow_tsx_force_abort.attr.attr; |
439 |
++ } |
440 |
++ |
441 |
+ pr_cont("Skylake events, "); |
442 |
+ name = "skylake"; |
443 |
+ break; |
444 |
+@@ -4715,7 +4799,7 @@ static __init int fixup_ht_bug(void) |
445 |
+ hardlockup_detector_perf_restart(); |
446 |
+ |
447 |
+ for_each_online_cpu(c) |
448 |
+- free_excl_cntrs(c); |
449 |
++ free_excl_cntrs(&per_cpu(cpu_hw_events, c)); |
450 |
+ |
451 |
+ cpus_read_unlock(); |
452 |
+ pr_info("PMU erratum BJ122, BV98, HSD29 workaround disabled, HT off\n"); |
453 |
+diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h |
454 |
+index d46fd6754d92..a345d079f876 100644 |
455 |
+--- a/arch/x86/events/perf_event.h |
456 |
++++ b/arch/x86/events/perf_event.h |
457 |
+@@ -242,6 +242,11 @@ struct cpu_hw_events { |
458 |
+ struct intel_excl_cntrs *excl_cntrs; |
459 |
+ int excl_thread_id; /* 0 or 1 */ |
460 |
+ |
461 |
++ /* |
462 |
++ * SKL TSX_FORCE_ABORT shadow |
463 |
++ */ |
464 |
++ u64 tfa_shadow; |
465 |
++ |
466 |
+ /* |
467 |
+ * AMD specific bits |
468 |
+ */ |
469 |
+@@ -681,6 +686,7 @@ do { \ |
470 |
+ #define PMU_FL_EXCL_CNTRS 0x4 /* has exclusive counter requirements */ |
471 |
+ #define PMU_FL_EXCL_ENABLED 0x8 /* exclusive counter active */ |
472 |
+ #define PMU_FL_PEBS_ALL 0x10 /* all events are valid PEBS events */ |
473 |
++#define PMU_FL_TFA 0x20 /* deal with TSX force abort */ |
474 |
+ |
475 |
+ #define EVENT_VAR(_id) event_attr_##_id |
476 |
+ #define EVENT_PTR(_id) &event_attr_##_id.attr.attr |
477 |
+@@ -889,7 +895,8 @@ struct event_constraint * |
478 |
+ x86_get_event_constraints(struct cpu_hw_events *cpuc, int idx, |
479 |
+ struct perf_event *event); |
480 |
+ |
481 |
+-struct intel_shared_regs *allocate_shared_regs(int cpu); |
482 |
++extern int intel_cpuc_prepare(struct cpu_hw_events *cpuc, int cpu); |
483 |
++extern void intel_cpuc_finish(struct cpu_hw_events *cpuc); |
484 |
+ |
485 |
+ int intel_pmu_init(void); |
486 |
+ |
487 |
+@@ -1025,9 +1032,13 @@ static inline int intel_pmu_init(void) |
488 |
+ return 0; |
489 |
+ } |
490 |
+ |
491 |
+-static inline struct intel_shared_regs *allocate_shared_regs(int cpu) |
492 |
++static inline int intel_cpuc_prepare(struct cpu_hw_event *cpuc, int cpu) |
493 |
++{ |
494 |
++ return 0; |
495 |
++} |
496 |
++ |
497 |
++static inline void intel_cpuc_finish(struct cpu_hw_event *cpuc) |
498 |
+ { |
499 |
+- return NULL; |
500 |
+ } |
501 |
+ |
502 |
+ static inline int is_ht_workaround_enabled(void) |
503 |
+diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h |
504 |
+index 6d6122524711..981ff9479648 100644 |
505 |
+--- a/arch/x86/include/asm/cpufeatures.h |
506 |
++++ b/arch/x86/include/asm/cpufeatures.h |
507 |
+@@ -344,6 +344,7 @@ |
508 |
+ /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ |
509 |
+ #define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */ |
510 |
+ #define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */ |
511 |
++#define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */ |
512 |
+ #define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */ |
513 |
+ #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ |
514 |
+ #define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */ |
515 |
+diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h |
516 |
+index 8e40c2446fd1..ca5bc0eacb95 100644 |
517 |
+--- a/arch/x86/include/asm/msr-index.h |
518 |
++++ b/arch/x86/include/asm/msr-index.h |
519 |
+@@ -666,6 +666,12 @@ |
520 |
+ |
521 |
+ #define MSR_IA32_TSC_DEADLINE 0x000006E0 |
522 |
+ |
523 |
++ |
524 |
++#define MSR_TSX_FORCE_ABORT 0x0000010F |
525 |
++ |
526 |
++#define MSR_TFA_RTM_FORCE_ABORT_BIT 0 |
527 |
++#define MSR_TFA_RTM_FORCE_ABORT BIT_ULL(MSR_TFA_RTM_FORCE_ABORT_BIT) |
528 |
++ |
529 |
+ /* P4/Xeon+ specific */ |
530 |
+ #define MSR_IA32_MCG_EAX 0x00000180 |
531 |
+ #define MSR_IA32_MCG_EBX 0x00000181 |
532 |
+diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c |
533 |
+index 30a5111ae5fd..527e69b12002 100644 |
534 |
+--- a/arch/x86/pci/fixup.c |
535 |
++++ b/arch/x86/pci/fixup.c |
536 |
+@@ -635,6 +635,22 @@ static void quirk_no_aersid(struct pci_dev *pdev) |
537 |
+ DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, |
538 |
+ PCI_CLASS_BRIDGE_PCI, 8, quirk_no_aersid); |
539 |
+ |
540 |
++static void quirk_intel_th_dnv(struct pci_dev *dev) |
541 |
++{ |
542 |
++ struct resource *r = &dev->resource[4]; |
543 |
++ |
544 |
++ /* |
545 |
++ * Denverton reports 2k of RTIT_BAR (intel_th resource 4), which |
546 |
++ * appears to be 4 MB in reality. |
547 |
++ */ |
548 |
++ if (r->end == r->start + 0x7ff) { |
549 |
++ r->start = 0; |
550 |
++ r->end = 0x3fffff; |
551 |
++ r->flags |= IORESOURCE_UNSET; |
552 |
++ } |
553 |
++} |
554 |
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x19e1, quirk_intel_th_dnv); |
555 |
++ |
556 |
+ #ifdef CONFIG_PHYS_ADDR_T_64BIT |
557 |
+ |
558 |
+ #define AMD_141b_MMIO_BASE(x) (0x80 + (x) * 0x8) |
559 |
+diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c |
560 |
+index 6bc8e6640d71..c51462f5aa1e 100644 |
561 |
+--- a/drivers/firmware/iscsi_ibft.c |
562 |
++++ b/drivers/firmware/iscsi_ibft.c |
563 |
+@@ -542,6 +542,7 @@ static umode_t __init ibft_check_tgt_for(void *data, int type) |
564 |
+ case ISCSI_BOOT_TGT_NIC_ASSOC: |
565 |
+ case ISCSI_BOOT_TGT_CHAP_TYPE: |
566 |
+ rc = S_IRUGO; |
567 |
++ break; |
568 |
+ case ISCSI_BOOT_TGT_NAME: |
569 |
+ if (tgt->tgt_name_len) |
570 |
+ rc = S_IRUGO; |
571 |
+diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c |
572 |
+index 225ae6980182..628ef617bb2f 100644 |
573 |
+--- a/drivers/input/mouse/elan_i2c_core.c |
574 |
++++ b/drivers/input/mouse/elan_i2c_core.c |
575 |
+@@ -1337,6 +1337,7 @@ static const struct acpi_device_id elan_acpi_id[] = { |
576 |
+ { "ELAN0000", 0 }, |
577 |
+ { "ELAN0100", 0 }, |
578 |
+ { "ELAN0600", 0 }, |
579 |
++ { "ELAN0601", 0 }, |
580 |
+ { "ELAN0602", 0 }, |
581 |
+ { "ELAN0605", 0 }, |
582 |
+ { "ELAN0608", 0 }, |
583 |
+diff --git a/drivers/input/tablet/wacom_serial4.c b/drivers/input/tablet/wacom_serial4.c |
584 |
+index 38bfaca48eab..150f9eecaca7 100644 |
585 |
+--- a/drivers/input/tablet/wacom_serial4.c |
586 |
++++ b/drivers/input/tablet/wacom_serial4.c |
587 |
+@@ -187,6 +187,7 @@ enum { |
588 |
+ MODEL_DIGITIZER_II = 0x5544, /* UD */ |
589 |
+ MODEL_GRAPHIRE = 0x4554, /* ET */ |
590 |
+ MODEL_PENPARTNER = 0x4354, /* CT */ |
591 |
++ MODEL_ARTPAD_II = 0x4B54, /* KT */ |
592 |
+ }; |
593 |
+ |
594 |
+ static void wacom_handle_model_response(struct wacom *wacom) |
595 |
+@@ -245,6 +246,7 @@ static void wacom_handle_model_response(struct wacom *wacom) |
596 |
+ wacom->flags = F_HAS_STYLUS2 | F_HAS_SCROLLWHEEL; |
597 |
+ break; |
598 |
+ |
599 |
++ case MODEL_ARTPAD_II: |
600 |
+ case MODEL_DIGITIZER_II: |
601 |
+ wacom->dev->name = "Wacom Digitizer II"; |
602 |
+ wacom->dev->id.version = MODEL_DIGITIZER_II; |
603 |
+diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c |
604 |
+index 66a174979b3c..81745644f720 100644 |
605 |
+--- a/drivers/media/rc/rc-main.c |
606 |
++++ b/drivers/media/rc/rc-main.c |
607 |
+@@ -274,6 +274,7 @@ static unsigned int ir_update_mapping(struct rc_dev *dev, |
608 |
+ unsigned int new_keycode) |
609 |
+ { |
610 |
+ int old_keycode = rc_map->scan[index].keycode; |
611 |
++ int i; |
612 |
+ |
613 |
+ /* Did the user wish to remove the mapping? */ |
614 |
+ if (new_keycode == KEY_RESERVED || new_keycode == KEY_UNKNOWN) { |
615 |
+@@ -288,9 +289,20 @@ static unsigned int ir_update_mapping(struct rc_dev *dev, |
616 |
+ old_keycode == KEY_RESERVED ? "New" : "Replacing", |
617 |
+ rc_map->scan[index].scancode, new_keycode); |
618 |
+ rc_map->scan[index].keycode = new_keycode; |
619 |
++ __set_bit(new_keycode, dev->input_dev->keybit); |
620 |
+ } |
621 |
+ |
622 |
+ if (old_keycode != KEY_RESERVED) { |
623 |
++ /* A previous mapping was updated... */ |
624 |
++ __clear_bit(old_keycode, dev->input_dev->keybit); |
625 |
++ /* ... but another scancode might use the same keycode */ |
626 |
++ for (i = 0; i < rc_map->len; i++) { |
627 |
++ if (rc_map->scan[i].keycode == old_keycode) { |
628 |
++ __set_bit(old_keycode, dev->input_dev->keybit); |
629 |
++ break; |
630 |
++ } |
631 |
++ } |
632 |
++ |
633 |
+ /* Possibly shrink the keytable, failure is not a problem */ |
634 |
+ ir_resize_table(dev, rc_map, GFP_ATOMIC); |
635 |
+ } |
636 |
+@@ -1750,7 +1762,6 @@ static int rc_prepare_rx_device(struct rc_dev *dev) |
637 |
+ set_bit(EV_REP, dev->input_dev->evbit); |
638 |
+ set_bit(EV_MSC, dev->input_dev->evbit); |
639 |
+ set_bit(MSC_SCAN, dev->input_dev->mscbit); |
640 |
+- bitmap_fill(dev->input_dev->keybit, KEY_CNT); |
641 |
+ |
642 |
+ /* Pointer/mouse events */ |
643 |
+ set_bit(EV_REL, dev->input_dev->evbit); |
644 |
+diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c |
645 |
+index b62cbd800111..33a22c016456 100644 |
646 |
+--- a/drivers/media/usb/uvc/uvc_driver.c |
647 |
++++ b/drivers/media/usb/uvc/uvc_driver.c |
648 |
+@@ -1106,11 +1106,19 @@ static int uvc_parse_standard_control(struct uvc_device *dev, |
649 |
+ return -EINVAL; |
650 |
+ } |
651 |
+ |
652 |
+- /* Make sure the terminal type MSB is not null, otherwise it |
653 |
+- * could be confused with a unit. |
654 |
++ /* |
655 |
++ * Reject invalid terminal types that would cause issues: |
656 |
++ * |
657 |
++ * - The high byte must be non-zero, otherwise it would be |
658 |
++ * confused with a unit. |
659 |
++ * |
660 |
++ * - Bit 15 must be 0, as we use it internally as a terminal |
661 |
++ * direction flag. |
662 |
++ * |
663 |
++ * Other unknown types are accepted. |
664 |
+ */ |
665 |
+ type = get_unaligned_le16(&buffer[4]); |
666 |
+- if ((type & 0xff00) == 0) { |
667 |
++ if ((type & 0x7f00) == 0 || (type & 0x8000) != 0) { |
668 |
+ uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol " |
669 |
+ "interface %d INPUT_TERMINAL %d has invalid " |
670 |
+ "type 0x%04x, skipping\n", udev->devnum, |
671 |
+diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c |
672 |
+index c070a9e51ebf..fae572b38416 100644 |
673 |
+--- a/drivers/net/wireless/ath/ath9k/init.c |
674 |
++++ b/drivers/net/wireless/ath/ath9k/init.c |
675 |
+@@ -636,15 +636,15 @@ static int ath9k_of_init(struct ath_softc *sc) |
676 |
+ ret = ath9k_eeprom_request(sc, eeprom_name); |
677 |
+ if (ret) |
678 |
+ return ret; |
679 |
++ |
680 |
++ ah->ah_flags &= ~AH_USE_EEPROM; |
681 |
++ ah->ah_flags |= AH_NO_EEP_SWAP; |
682 |
+ } |
683 |
+ |
684 |
+ mac = of_get_mac_address(np); |
685 |
+ if (mac) |
686 |
+ ether_addr_copy(common->macaddr, mac); |
687 |
+ |
688 |
+- ah->ah_flags &= ~AH_USE_EEPROM; |
689 |
+- ah->ah_flags |= AH_NO_EEP_SWAP; |
690 |
+- |
691 |
+ return 0; |
692 |
+ } |
693 |
+ |
694 |
+diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c |
695 |
+index 0dbcf429089f..1a8b85051b1b 100644 |
696 |
+--- a/drivers/pci/pcie/pme.c |
697 |
++++ b/drivers/pci/pcie/pme.c |
698 |
+@@ -432,31 +432,6 @@ static void pcie_pme_remove(struct pcie_device *srv) |
699 |
+ kfree(get_service_data(srv)); |
700 |
+ } |
701 |
+ |
702 |
+-static int pcie_pme_runtime_suspend(struct pcie_device *srv) |
703 |
+-{ |
704 |
+- struct pcie_pme_service_data *data = get_service_data(srv); |
705 |
+- |
706 |
+- spin_lock_irq(&data->lock); |
707 |
+- pcie_pme_interrupt_enable(srv->port, false); |
708 |
+- pcie_clear_root_pme_status(srv->port); |
709 |
+- data->noirq = true; |
710 |
+- spin_unlock_irq(&data->lock); |
711 |
+- |
712 |
+- return 0; |
713 |
+-} |
714 |
+- |
715 |
+-static int pcie_pme_runtime_resume(struct pcie_device *srv) |
716 |
+-{ |
717 |
+- struct pcie_pme_service_data *data = get_service_data(srv); |
718 |
+- |
719 |
+- spin_lock_irq(&data->lock); |
720 |
+- pcie_pme_interrupt_enable(srv->port, true); |
721 |
+- data->noirq = false; |
722 |
+- spin_unlock_irq(&data->lock); |
723 |
+- |
724 |
+- return 0; |
725 |
+-} |
726 |
+- |
727 |
+ static struct pcie_port_service_driver pcie_pme_driver = { |
728 |
+ .name = "pcie_pme", |
729 |
+ .port_type = PCI_EXP_TYPE_ROOT_PORT, |
730 |
+@@ -464,8 +439,6 @@ static struct pcie_port_service_driver pcie_pme_driver = { |
731 |
+ |
732 |
+ .probe = pcie_pme_probe, |
733 |
+ .suspend = pcie_pme_suspend, |
734 |
+- .runtime_suspend = pcie_pme_runtime_suspend, |
735 |
+- .runtime_resume = pcie_pme_runtime_resume, |
736 |
+ .resume = pcie_pme_resume, |
737 |
+ .remove = pcie_pme_remove, |
738 |
+ }; |
739 |
+diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c |
740 |
+index d5a6aa9676c8..a3adc954f40f 100644 |
741 |
+--- a/drivers/scsi/aacraid/commsup.c |
742 |
++++ b/drivers/scsi/aacraid/commsup.c |
743 |
+@@ -1303,8 +1303,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) |
744 |
+ ADD : DELETE; |
745 |
+ break; |
746 |
+ } |
747 |
+- case AifBuManagerEvent: |
748 |
+- aac_handle_aif_bu(dev, aifcmd); |
749 |
++ break; |
750 |
++ case AifBuManagerEvent: |
751 |
++ aac_handle_aif_bu(dev, aifcmd); |
752 |
+ break; |
753 |
+ } |
754 |
+ |
755 |
+diff --git a/drivers/staging/erofs/namei.c b/drivers/staging/erofs/namei.c |
756 |
+index 5596c52e246d..ecc51ef0753f 100644 |
757 |
+--- a/drivers/staging/erofs/namei.c |
758 |
++++ b/drivers/staging/erofs/namei.c |
759 |
+@@ -15,74 +15,77 @@ |
760 |
+ |
761 |
+ #include <trace/events/erofs.h> |
762 |
+ |
763 |
+-/* based on the value of qn->len is accurate */ |
764 |
+-static inline int dirnamecmp(struct qstr *qn, |
765 |
+- struct qstr *qd, unsigned int *matched) |
766 |
++struct erofs_qstr { |
767 |
++ const unsigned char *name; |
768 |
++ const unsigned char *end; |
769 |
++}; |
770 |
++ |
771 |
++/* based on the end of qn is accurate and it must have the trailing '\0' */ |
772 |
++static inline int dirnamecmp(const struct erofs_qstr *qn, |
773 |
++ const struct erofs_qstr *qd, |
774 |
++ unsigned int *matched) |
775 |
+ { |
776 |
+- unsigned int i = *matched, len = min(qn->len, qd->len); |
777 |
+-loop: |
778 |
+- if (unlikely(i >= len)) { |
779 |
+- *matched = i; |
780 |
+- if (qn->len < qd->len) { |
781 |
+- /* |
782 |
+- * actually (qn->len == qd->len) |
783 |
+- * when qd->name[i] == '\0' |
784 |
+- */ |
785 |
+- return qd->name[i] == '\0' ? 0 : -1; |
786 |
++ unsigned int i = *matched; |
787 |
++ |
788 |
++ /* |
789 |
++ * on-disk error, let's only BUG_ON in the debugging mode. |
790 |
++ * otherwise, it will return 1 to just skip the invalid name |
791 |
++ * and go on (in consideration of the lookup performance). |
792 |
++ */ |
793 |
++ DBG_BUGON(qd->name > qd->end); |
794 |
++ |
795 |
++ /* qd could not have trailing '\0' */ |
796 |
++ /* However it is absolutely safe if < qd->end */ |
797 |
++ while (qd->name + i < qd->end && qd->name[i] != '\0') { |
798 |
++ if (qn->name[i] != qd->name[i]) { |
799 |
++ *matched = i; |
800 |
++ return qn->name[i] > qd->name[i] ? 1 : -1; |
801 |
+ } |
802 |
+- return (qn->len > qd->len); |
803 |
++ ++i; |
804 |
+ } |
805 |
+- |
806 |
+- if (qn->name[i] != qd->name[i]) { |
807 |
+- *matched = i; |
808 |
+- return qn->name[i] > qd->name[i] ? 1 : -1; |
809 |
+- } |
810 |
+- |
811 |
+- ++i; |
812 |
+- goto loop; |
813 |
++ *matched = i; |
814 |
++ /* See comments in __d_alloc on the terminating NUL character */ |
815 |
++ return qn->name[i] == '\0' ? 0 : 1; |
816 |
+ } |
817 |
+ |
818 |
+-static struct erofs_dirent *find_target_dirent( |
819 |
+- struct qstr *name, |
820 |
+- u8 *data, int maxsize) |
821 |
++#define nameoff_from_disk(off, sz) (le16_to_cpu(off) & ((sz) - 1)) |
822 |
++ |
823 |
++static struct erofs_dirent *find_target_dirent(struct erofs_qstr *name, |
824 |
++ u8 *data, |
825 |
++ unsigned int dirblksize, |
826 |
++ const int ndirents) |
827 |
+ { |
828 |
+- unsigned int ndirents, head, back; |
829 |
++ int head, back; |
830 |
+ unsigned int startprfx, endprfx; |
831 |
+ struct erofs_dirent *const de = (struct erofs_dirent *)data; |
832 |
+ |
833 |
+- /* make sure that maxsize is valid */ |
834 |
+- BUG_ON(maxsize < sizeof(struct erofs_dirent)); |
835 |
+- |
836 |
+- ndirents = le16_to_cpu(de->nameoff) / sizeof(*de); |
837 |
+- |
838 |
+- /* corrupted dir (may be unnecessary...) */ |
839 |
+- BUG_ON(!ndirents); |
840 |
+- |
841 |
+- head = 0; |
842 |
++ /* since the 1st dirent has been evaluated previously */ |
843 |
++ head = 1; |
844 |
+ back = ndirents - 1; |
845 |
+ startprfx = endprfx = 0; |
846 |
+ |
847 |
+ while (head <= back) { |
848 |
+- unsigned int mid = head + (back - head) / 2; |
849 |
+- unsigned int nameoff = le16_to_cpu(de[mid].nameoff); |
850 |
++ const int mid = head + (back - head) / 2; |
851 |
++ const int nameoff = nameoff_from_disk(de[mid].nameoff, |
852 |
++ dirblksize); |
853 |
+ unsigned int matched = min(startprfx, endprfx); |
854 |
+- |
855 |
+- struct qstr dname = QSTR_INIT(data + nameoff, |
856 |
+- unlikely(mid >= ndirents - 1) ? |
857 |
+- maxsize - nameoff : |
858 |
+- le16_to_cpu(de[mid + 1].nameoff) - nameoff); |
859 |
++ struct erofs_qstr dname = { |
860 |
++ .name = data + nameoff, |
861 |
++ .end = unlikely(mid >= ndirents - 1) ? |
862 |
++ data + dirblksize : |
863 |
++ data + nameoff_from_disk(de[mid + 1].nameoff, |
864 |
++ dirblksize) |
865 |
++ }; |
866 |
+ |
867 |
+ /* string comparison without already matched prefix */ |
868 |
+ int ret = dirnamecmp(name, &dname, &matched); |
869 |
+ |
870 |
+- if (unlikely(!ret)) |
871 |
++ if (unlikely(!ret)) { |
872 |
+ return de + mid; |
873 |
+- else if (ret > 0) { |
874 |
++ } else if (ret > 0) { |
875 |
+ head = mid + 1; |
876 |
+ startprfx = matched; |
877 |
+- } else if (unlikely(mid < 1)) /* fix "mid" overflow */ |
878 |
+- break; |
879 |
+- else { |
880 |
++ } else { |
881 |
+ back = mid - 1; |
882 |
+ endprfx = matched; |
883 |
+ } |
884 |
+@@ -91,12 +94,12 @@ static struct erofs_dirent *find_target_dirent( |
885 |
+ return ERR_PTR(-ENOENT); |
886 |
+ } |
887 |
+ |
888 |
+-static struct page *find_target_block_classic( |
889 |
+- struct inode *dir, |
890 |
+- struct qstr *name, int *_diff) |
891 |
++static struct page *find_target_block_classic(struct inode *dir, |
892 |
++ struct erofs_qstr *name, |
893 |
++ int *_ndirents) |
894 |
+ { |
895 |
+ unsigned int startprfx, endprfx; |
896 |
+- unsigned int head, back; |
897 |
++ int head, back; |
898 |
+ struct address_space *const mapping = dir->i_mapping; |
899 |
+ struct page *candidate = ERR_PTR(-ENOENT); |
900 |
+ |
901 |
+@@ -105,41 +108,43 @@ static struct page *find_target_block_classic( |
902 |
+ back = inode_datablocks(dir) - 1; |
903 |
+ |
904 |
+ while (head <= back) { |
905 |
+- unsigned int mid = head + (back - head) / 2; |
906 |
++ const int mid = head + (back - head) / 2; |
907 |
+ struct page *page = read_mapping_page(mapping, mid, NULL); |
908 |
+ |
909 |
+- if (IS_ERR(page)) { |
910 |
+-exact_out: |
911 |
+- if (!IS_ERR(candidate)) /* valid candidate */ |
912 |
+- put_page(candidate); |
913 |
+- return page; |
914 |
+- } else { |
915 |
+- int diff; |
916 |
+- unsigned int ndirents, matched; |
917 |
+- struct qstr dname; |
918 |
++ if (!IS_ERR(page)) { |
919 |
+ struct erofs_dirent *de = kmap_atomic(page); |
920 |
+- unsigned int nameoff = le16_to_cpu(de->nameoff); |
921 |
+- |
922 |
+- ndirents = nameoff / sizeof(*de); |
923 |
++ const int nameoff = nameoff_from_disk(de->nameoff, |
924 |
++ EROFS_BLKSIZ); |
925 |
++ const int ndirents = nameoff / sizeof(*de); |
926 |
++ int diff; |
927 |
++ unsigned int matched; |
928 |
++ struct erofs_qstr dname; |
929 |
+ |
930 |
+- /* corrupted dir (should have one entry at least) */ |
931 |
+- BUG_ON(!ndirents || nameoff > PAGE_SIZE); |
932 |
++ if (unlikely(!ndirents)) { |
933 |
++ DBG_BUGON(1); |
934 |
++ kunmap_atomic(de); |
935 |
++ put_page(page); |
936 |
++ page = ERR_PTR(-EIO); |
937 |
++ goto out; |
938 |
++ } |
939 |
+ |
940 |
+ matched = min(startprfx, endprfx); |
941 |
+ |
942 |
+ dname.name = (u8 *)de + nameoff; |
943 |
+- dname.len = ndirents == 1 ? |
944 |
+- /* since the rest of the last page is 0 */ |
945 |
+- EROFS_BLKSIZ - nameoff |
946 |
+- : le16_to_cpu(de[1].nameoff) - nameoff; |
947 |
++ if (ndirents == 1) |
948 |
++ dname.end = (u8 *)de + EROFS_BLKSIZ; |
949 |
++ else |
950 |
++ dname.end = (u8 *)de + |
951 |
++ nameoff_from_disk(de[1].nameoff, |
952 |
++ EROFS_BLKSIZ); |
953 |
+ |
954 |
+ /* string comparison without already matched prefix */ |
955 |
+ diff = dirnamecmp(name, &dname, &matched); |
956 |
+ kunmap_atomic(de); |
957 |
+ |
958 |
+ if (unlikely(!diff)) { |
959 |
+- *_diff = 0; |
960 |
+- goto exact_out; |
961 |
++ *_ndirents = 0; |
962 |
++ goto out; |
963 |
+ } else if (diff > 0) { |
964 |
+ head = mid + 1; |
965 |
+ startprfx = matched; |
966 |
+@@ -147,45 +152,51 @@ exact_out: |
967 |
+ if (likely(!IS_ERR(candidate))) |
968 |
+ put_page(candidate); |
969 |
+ candidate = page; |
970 |
++ *_ndirents = ndirents; |
971 |
+ } else { |
972 |
+ put_page(page); |
973 |
+ |
974 |
+- if (unlikely(mid < 1)) /* fix "mid" overflow */ |
975 |
+- break; |
976 |
+- |
977 |
+ back = mid - 1; |
978 |
+ endprfx = matched; |
979 |
+ } |
980 |
++ continue; |
981 |
+ } |
982 |
++out: /* free if the candidate is valid */ |
983 |
++ if (!IS_ERR(candidate)) |
984 |
++ put_page(candidate); |
985 |
++ return page; |
986 |
+ } |
987 |
+- *_diff = 1; |
988 |
+ return candidate; |
989 |
+ } |
990 |
+ |
991 |
+ int erofs_namei(struct inode *dir, |
992 |
+- struct qstr *name, |
993 |
+- erofs_nid_t *nid, unsigned int *d_type) |
994 |
++ struct qstr *name, |
995 |
++ erofs_nid_t *nid, unsigned int *d_type) |
996 |
+ { |
997 |
+- int diff; |
998 |
++ int ndirents; |
999 |
+ struct page *page; |
1000 |
+- u8 *data; |
1001 |
++ void *data; |
1002 |
+ struct erofs_dirent *de; |
1003 |
++ struct erofs_qstr qn; |
1004 |
+ |
1005 |
+ if (unlikely(!dir->i_size)) |
1006 |
+ return -ENOENT; |
1007 |
+ |
1008 |
+- diff = 1; |
1009 |
+- page = find_target_block_classic(dir, name, &diff); |
1010 |
++ qn.name = name->name; |
1011 |
++ qn.end = name->name + name->len; |
1012 |
++ |
1013 |
++ ndirents = 0; |
1014 |
++ page = find_target_block_classic(dir, &qn, &ndirents); |
1015 |
+ |
1016 |
+ if (unlikely(IS_ERR(page))) |
1017 |
+ return PTR_ERR(page); |
1018 |
+ |
1019 |
+ data = kmap_atomic(page); |
1020 |
+ /* the target page has been mapped */ |
1021 |
+- de = likely(diff) ? |
1022 |
+- /* since the rest of the last page is 0 */ |
1023 |
+- find_target_dirent(name, data, EROFS_BLKSIZ) : |
1024 |
+- (struct erofs_dirent *)data; |
1025 |
++ if (ndirents) |
1026 |
++ de = find_target_dirent(&qn, data, EROFS_BLKSIZ, ndirents); |
1027 |
++ else |
1028 |
++ de = (struct erofs_dirent *)data; |
1029 |
+ |
1030 |
+ if (likely(!IS_ERR(de))) { |
1031 |
+ *nid = le64_to_cpu(de->nid); |
1032 |
+diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c |
1033 |
+index ca2e8fd78959..ab30d14ded06 100644 |
1034 |
+--- a/drivers/staging/erofs/unzip_vle.c |
1035 |
++++ b/drivers/staging/erofs/unzip_vle.c |
1036 |
+@@ -1017,11 +1017,10 @@ repeat: |
1037 |
+ if (llen > grp->llen) |
1038 |
+ llen = grp->llen; |
1039 |
+ |
1040 |
+- err = z_erofs_vle_unzip_fast_percpu(compressed_pages, |
1041 |
+- clusterpages, pages, llen, work->pageofs, |
1042 |
+- z_erofs_onlinepage_endio); |
1043 |
++ err = z_erofs_vle_unzip_fast_percpu(compressed_pages, clusterpages, |
1044 |
++ pages, llen, work->pageofs); |
1045 |
+ if (err != -ENOTSUPP) |
1046 |
+- goto out_percpu; |
1047 |
++ goto out; |
1048 |
+ |
1049 |
+ if (sparsemem_pages >= nr_pages) |
1050 |
+ goto skip_allocpage; |
1051 |
+@@ -1042,8 +1041,25 @@ skip_allocpage: |
1052 |
+ erofs_vunmap(vout, nr_pages); |
1053 |
+ |
1054 |
+ out: |
1055 |
++ /* must handle all compressed pages before endding pages */ |
1056 |
++ for (i = 0; i < clusterpages; ++i) { |
1057 |
++ page = compressed_pages[i]; |
1058 |
++ |
1059 |
++#ifdef EROFS_FS_HAS_MANAGED_CACHE |
1060 |
++ if (page->mapping == MNGD_MAPPING(sbi)) |
1061 |
++ continue; |
1062 |
++#endif |
1063 |
++ /* recycle all individual staging pages */ |
1064 |
++ (void)z_erofs_gather_if_stagingpage(page_pool, page); |
1065 |
++ |
1066 |
++ WRITE_ONCE(compressed_pages[i], NULL); |
1067 |
++ } |
1068 |
++ |
1069 |
+ for (i = 0; i < nr_pages; ++i) { |
1070 |
+ page = pages[i]; |
1071 |
++ if (!page) |
1072 |
++ continue; |
1073 |
++ |
1074 |
+ DBG_BUGON(!page->mapping); |
1075 |
+ |
1076 |
+ /* recycle all individual staging pages */ |
1077 |
+@@ -1056,20 +1072,6 @@ out: |
1078 |
+ z_erofs_onlinepage_endio(page); |
1079 |
+ } |
1080 |
+ |
1081 |
+-out_percpu: |
1082 |
+- for (i = 0; i < clusterpages; ++i) { |
1083 |
+- page = compressed_pages[i]; |
1084 |
+- |
1085 |
+-#ifdef EROFS_FS_HAS_MANAGED_CACHE |
1086 |
+- if (page->mapping == MNGD_MAPPING(sbi)) |
1087 |
+- continue; |
1088 |
+-#endif |
1089 |
+- /* recycle all individual staging pages */ |
1090 |
+- (void)z_erofs_gather_if_stagingpage(page_pool, page); |
1091 |
+- |
1092 |
+- WRITE_ONCE(compressed_pages[i], NULL); |
1093 |
+- } |
1094 |
+- |
1095 |
+ if (pages == z_pagemap_global) |
1096 |
+ mutex_unlock(&z_pagemap_global_lock); |
1097 |
+ else if (unlikely(pages != pages_onstack)) |
1098 |
+diff --git a/drivers/staging/erofs/unzip_vle.h b/drivers/staging/erofs/unzip_vle.h |
1099 |
+index 5a4e1b62c0d1..c0dfd6906aa8 100644 |
1100 |
+--- a/drivers/staging/erofs/unzip_vle.h |
1101 |
++++ b/drivers/staging/erofs/unzip_vle.h |
1102 |
+@@ -218,8 +218,7 @@ extern int z_erofs_vle_plain_copy(struct page **compressed_pages, |
1103 |
+ |
1104 |
+ extern int z_erofs_vle_unzip_fast_percpu(struct page **compressed_pages, |
1105 |
+ unsigned clusterpages, struct page **pages, |
1106 |
+- unsigned outlen, unsigned short pageofs, |
1107 |
+- void (*endio)(struct page *)); |
1108 |
++ unsigned int outlen, unsigned short pageofs); |
1109 |
+ |
1110 |
+ extern int z_erofs_vle_unzip_vmap(struct page **compressed_pages, |
1111 |
+ unsigned clusterpages, void *vaddr, unsigned llen, |
1112 |
+diff --git a/drivers/staging/erofs/unzip_vle_lz4.c b/drivers/staging/erofs/unzip_vle_lz4.c |
1113 |
+index 52797bd89da1..f471b894c848 100644 |
1114 |
+--- a/drivers/staging/erofs/unzip_vle_lz4.c |
1115 |
++++ b/drivers/staging/erofs/unzip_vle_lz4.c |
1116 |
+@@ -125,8 +125,7 @@ int z_erofs_vle_unzip_fast_percpu(struct page **compressed_pages, |
1117 |
+ unsigned int clusterpages, |
1118 |
+ struct page **pages, |
1119 |
+ unsigned int outlen, |
1120 |
+- unsigned short pageofs, |
1121 |
+- void (*endio)(struct page *)) |
1122 |
++ unsigned short pageofs) |
1123 |
+ { |
1124 |
+ void *vin, *vout; |
1125 |
+ unsigned int nr_pages, i, j; |
1126 |
+@@ -148,19 +147,16 @@ int z_erofs_vle_unzip_fast_percpu(struct page **compressed_pages, |
1127 |
+ ret = z_erofs_unzip_lz4(vin, vout + pageofs, |
1128 |
+ clusterpages * PAGE_SIZE, outlen); |
1129 |
+ |
1130 |
+- if (ret >= 0) { |
1131 |
+- outlen = ret; |
1132 |
+- ret = 0; |
1133 |
+- } |
1134 |
++ if (ret < 0) |
1135 |
++ goto out; |
1136 |
++ ret = 0; |
1137 |
+ |
1138 |
+ for (i = 0; i < nr_pages; ++i) { |
1139 |
+ j = min((unsigned int)PAGE_SIZE - pageofs, outlen); |
1140 |
+ |
1141 |
+ if (pages[i]) { |
1142 |
+- if (ret < 0) { |
1143 |
+- SetPageError(pages[i]); |
1144 |
+- } else if (clusterpages == 1 && |
1145 |
+- pages[i] == compressed_pages[0]) { |
1146 |
++ if (clusterpages == 1 && |
1147 |
++ pages[i] == compressed_pages[0]) { |
1148 |
+ memcpy(vin + pageofs, vout + pageofs, j); |
1149 |
+ } else { |
1150 |
+ void *dst = kmap_atomic(pages[i]); |
1151 |
+@@ -168,12 +164,13 @@ int z_erofs_vle_unzip_fast_percpu(struct page **compressed_pages, |
1152 |
+ memcpy(dst + pageofs, vout + pageofs, j); |
1153 |
+ kunmap_atomic(dst); |
1154 |
+ } |
1155 |
+- endio(pages[i]); |
1156 |
+ } |
1157 |
+ vout += PAGE_SIZE; |
1158 |
+ outlen -= j; |
1159 |
+ pageofs = 0; |
1160 |
+ } |
1161 |
++ |
1162 |
++out: |
1163 |
+ preempt_enable(); |
1164 |
+ |
1165 |
+ if (clusterpages == 1) |
1166 |
+diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c |
1167 |
+index b92740edc416..4b038f25f256 100644 |
1168 |
+--- a/fs/gfs2/glock.c |
1169 |
++++ b/fs/gfs2/glock.c |
1170 |
+@@ -107,7 +107,7 @@ static int glock_wake_function(wait_queue_entry_t *wait, unsigned int mode, |
1171 |
+ |
1172 |
+ static wait_queue_head_t *glock_waitqueue(struct lm_lockname *name) |
1173 |
+ { |
1174 |
+- u32 hash = jhash2((u32 *)name, sizeof(*name) / 4, 0); |
1175 |
++ u32 hash = jhash2((u32 *)name, ht_parms.key_len / 4, 0); |
1176 |
+ |
1177 |
+ return glock_wait_table + hash_32(hash, GLOCK_WAIT_TABLE_BITS); |
1178 |
+ } |
1179 |
+diff --git a/include/drm/drm_cache.h b/include/drm/drm_cache.h |
1180 |
+index bfe1639df02d..97fc498dc767 100644 |
1181 |
+--- a/include/drm/drm_cache.h |
1182 |
++++ b/include/drm/drm_cache.h |
1183 |
+@@ -47,6 +47,24 @@ static inline bool drm_arch_can_wc_memory(void) |
1184 |
+ return false; |
1185 |
+ #elif defined(CONFIG_MIPS) && defined(CONFIG_CPU_LOONGSON3) |
1186 |
+ return false; |
1187 |
++#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64) |
1188 |
++ /* |
1189 |
++ * The DRM driver stack is designed to work with cache coherent devices |
1190 |
++ * only, but permits an optimization to be enabled in some cases, where |
1191 |
++ * for some buffers, both the CPU and the GPU use uncached mappings, |
1192 |
++ * removing the need for DMA snooping and allocation in the CPU caches. |
1193 |
++ * |
1194 |
++ * The use of uncached GPU mappings relies on the correct implementation |
1195 |
++ * of the PCIe NoSnoop TLP attribute by the platform, otherwise the GPU |
1196 |
++ * will use cached mappings nonetheless. On x86 platforms, this does not |
1197 |
++ * seem to matter, as uncached CPU mappings will snoop the caches in any |
1198 |
++ * case. However, on ARM and arm64, enabling this optimization on a |
1199 |
++ * platform where NoSnoop is ignored results in loss of coherency, which |
1200 |
++ * breaks correct operation of the device. Since we have no way of |
1201 |
++ * detecting whether NoSnoop works or not, just disable this |
1202 |
++ * optimization entirely for ARM and arm64. |
1203 |
++ */ |
1204 |
++ return false; |
1205 |
+ #else |
1206 |
+ return true; |
1207 |
+ #endif |
1208 |
+diff --git a/net/core/skmsg.c b/net/core/skmsg.c |
1209 |
+index 8c826603bf36..8bc0ba1ebabe 100644 |
1210 |
+--- a/net/core/skmsg.c |
1211 |
++++ b/net/core/skmsg.c |
1212 |
+@@ -545,6 +545,7 @@ static void sk_psock_destroy_deferred(struct work_struct *gc) |
1213 |
+ struct sk_psock *psock = container_of(gc, struct sk_psock, gc); |
1214 |
+ |
1215 |
+ /* No sk_callback_lock since already detached. */ |
1216 |
++ strp_stop(&psock->parser.strp); |
1217 |
+ strp_done(&psock->parser.strp); |
1218 |
+ |
1219 |
+ cancel_work_sync(&psock->work); |
1220 |
+diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in |
1221 |
+index 7aad82406422..d3319a80788a 100644 |
1222 |
+--- a/scripts/gdb/linux/constants.py.in |
1223 |
++++ b/scripts/gdb/linux/constants.py.in |
1224 |
+@@ -37,12 +37,12 @@ |
1225 |
+ import gdb |
1226 |
+ |
1227 |
+ /* linux/fs.h */ |
1228 |
+-LX_VALUE(MS_RDONLY) |
1229 |
+-LX_VALUE(MS_SYNCHRONOUS) |
1230 |
+-LX_VALUE(MS_MANDLOCK) |
1231 |
+-LX_VALUE(MS_DIRSYNC) |
1232 |
+-LX_VALUE(MS_NOATIME) |
1233 |
+-LX_VALUE(MS_NODIRATIME) |
1234 |
++LX_VALUE(SB_RDONLY) |
1235 |
++LX_VALUE(SB_SYNCHRONOUS) |
1236 |
++LX_VALUE(SB_MANDLOCK) |
1237 |
++LX_VALUE(SB_DIRSYNC) |
1238 |
++LX_VALUE(SB_NOATIME) |
1239 |
++LX_VALUE(SB_NODIRATIME) |
1240 |
+ |
1241 |
+ /* linux/mount.h */ |
1242 |
+ LX_VALUE(MNT_NOSUID) |
1243 |
+diff --git a/scripts/gdb/linux/proc.py b/scripts/gdb/linux/proc.py |
1244 |
+index 0aebd7565b03..2f01a958eb22 100644 |
1245 |
+--- a/scripts/gdb/linux/proc.py |
1246 |
++++ b/scripts/gdb/linux/proc.py |
1247 |
+@@ -114,11 +114,11 @@ def info_opts(lst, opt): |
1248 |
+ return opts |
1249 |
+ |
1250 |
+ |
1251 |
+-FS_INFO = {constants.LX_MS_SYNCHRONOUS: ",sync", |
1252 |
+- constants.LX_MS_MANDLOCK: ",mand", |
1253 |
+- constants.LX_MS_DIRSYNC: ",dirsync", |
1254 |
+- constants.LX_MS_NOATIME: ",noatime", |
1255 |
+- constants.LX_MS_NODIRATIME: ",nodiratime"} |
1256 |
++FS_INFO = {constants.LX_SB_SYNCHRONOUS: ",sync", |
1257 |
++ constants.LX_SB_MANDLOCK: ",mand", |
1258 |
++ constants.LX_SB_DIRSYNC: ",dirsync", |
1259 |
++ constants.LX_SB_NOATIME: ",noatime", |
1260 |
++ constants.LX_SB_NODIRATIME: ",nodiratime"} |
1261 |
+ |
1262 |
+ MNT_INFO = {constants.LX_MNT_NOSUID: ",nosuid", |
1263 |
+ constants.LX_MNT_NODEV: ",nodev", |
1264 |
+@@ -184,7 +184,7 @@ values of that process namespace""" |
1265 |
+ fstype = superblock['s_type']['name'].string() |
1266 |
+ s_flags = int(superblock['s_flags']) |
1267 |
+ m_flags = int(vfs['mnt']['mnt_flags']) |
1268 |
+- rd = "ro" if (s_flags & constants.LX_MS_RDONLY) else "rw" |
1269 |
++ rd = "ro" if (s_flags & constants.LX_SB_RDONLY) else "rw" |
1270 |
+ |
1271 |
+ gdb.write( |
1272 |
+ "{} {} {} {}{}{} 0 0\n" |