Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:6.1 commit in: /
Date: Fri, 03 Mar 2023 12:28:32
Message-Id: 1677846497.cc989ca8dddb899405562c2fe5e9567d03aee7fe.mpagano@gentoo
1 commit: cc989ca8dddb899405562c2fe5e9567d03aee7fe
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Fri Mar 3 12:28:17 2023 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Fri Mar 3 12:28:17 2023 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=cc989ca8
7
8 Linux patch 6.1.15
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1014_linux-6.1.15.patch | 1648 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1652 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index aa47ca9b..328fcd23 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -99,6 +99,10 @@ Patch: 1013_linux-6.1.14.patch
21 From: https://www.kernel.org
22 Desc: Linux 6.1.14
23
24 +Patch: 1014_linux-6.1.15.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 6.1.15
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/1014_linux-6.1.15.patch b/1014_linux-6.1.15.patch
33 new file mode 100644
34 index 00000000..03dcc23c
35 --- /dev/null
36 +++ b/1014_linux-6.1.15.patch
37 @@ -0,0 +1,1648 @@
38 +diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst
39 +index 60bceb018d6a9..21f01d32c9598 100644
40 +--- a/Documentation/trace/ftrace.rst
41 ++++ b/Documentation/trace/ftrace.rst
42 +@@ -2940,7 +2940,7 @@ Produces::
43 + bash-1994 [000] .... 4342.324898: ima_get_action <-process_measurement
44 + bash-1994 [000] .... 4342.324898: ima_match_policy <-ima_get_action
45 + bash-1994 [000] .... 4342.324899: do_truncate <-do_last
46 +- bash-1994 [000] .... 4342.324899: should_remove_suid <-do_truncate
47 ++ bash-1994 [000] .... 4342.324899: setattr_should_drop_suidgid <-do_truncate
48 + bash-1994 [000] .... 4342.324899: notify_change <-do_truncate
49 + bash-1994 [000] .... 4342.324900: current_fs_time <-notify_change
50 + bash-1994 [000] .... 4342.324900: current_kernel_time <-current_fs_time
51 +diff --git a/Makefile b/Makefile
52 +index 3e82a32243626..4dfe902b7f193 100644
53 +--- a/Makefile
54 ++++ b/Makefile
55 +@@ -1,7 +1,7 @@
56 + # SPDX-License-Identifier: GPL-2.0
57 + VERSION = 6
58 + PATCHLEVEL = 1
59 +-SUBLEVEL = 14
60 ++SUBLEVEL = 15
61 + EXTRAVERSION =
62 + NAME = Hurr durr I'ma ninja sloth
63 +
64 +diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
65 +index 487b0e03d4b43..2ca76b69add78 100644
66 +--- a/arch/arm/boot/dts/rk3288.dtsi
67 ++++ b/arch/arm/boot/dts/rk3288.dtsi
68 +@@ -1181,6 +1181,7 @@
69 + clock-names = "dp", "pclk";
70 + phys = <&edp_phy>;
71 + phy-names = "dp";
72 ++ power-domains = <&power RK3288_PD_VIO>;
73 + resets = <&cru SRST_EDP>;
74 + reset-names = "dp";
75 + rockchip,grf = <&grf>;
76 +diff --git a/arch/arm/boot/dts/stihxxx-b2120.dtsi b/arch/arm/boot/dts/stihxxx-b2120.dtsi
77 +index 2aa94605d3d47..d52a7aaa10743 100644
78 +--- a/arch/arm/boot/dts/stihxxx-b2120.dtsi
79 ++++ b/arch/arm/boot/dts/stihxxx-b2120.dtsi
80 +@@ -178,7 +178,7 @@
81 + tsin-num = <0>;
82 + serial-not-parallel;
83 + i2c-bus = <&ssc2>;
84 +- reset-gpios = <&pio15 4 GPIO_ACTIVE_HIGH>;
85 ++ reset-gpios = <&pio15 4 GPIO_ACTIVE_LOW>;
86 + dvb-card = <STV0367_TDA18212_NIMA_1>;
87 + };
88 + };
89 +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
90 +index aa22a0c222655..5d5d9574088ca 100644
91 +--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
92 ++++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
93 +@@ -96,7 +96,6 @@
94 + linux,default-trigger = "heartbeat";
95 + gpios = <&rk805 1 GPIO_ACTIVE_LOW>;
96 + default-state = "on";
97 +- mode = <0x23>;
98 + };
99 +
100 + user_led: led-1 {
101 +@@ -104,7 +103,6 @@
102 + linux,default-trigger = "mmc1";
103 + gpios = <&rk805 0 GPIO_ACTIVE_LOW>;
104 + default-state = "off";
105 +- mode = <0x05>;
106 + };
107 + };
108 + };
109 +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-op1-opp.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-op1-opp.dtsi
110 +index 6e29e74f6fc68..783120e9cebeb 100644
111 +--- a/arch/arm64/boot/dts/rockchip/rk3399-op1-opp.dtsi
112 ++++ b/arch/arm64/boot/dts/rockchip/rk3399-op1-opp.dtsi
113 +@@ -111,7 +111,7 @@
114 + };
115 + };
116 +
117 +- dmc_opp_table: dmc_opp_table {
118 ++ dmc_opp_table: opp-table-3 {
119 + compatible = "operating-points-v2";
120 +
121 + opp00 {
122 +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
123 +index 2e058c3150256..fccc2b2f327df 100644
124 +--- a/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
125 ++++ b/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
126 +@@ -83,6 +83,13 @@
127 + };
128 + };
129 +
130 ++&cpu_alert0 {
131 ++ temperature = <65000>;
132 ++};
133 ++&cpu_alert1 {
134 ++ temperature = <68000>;
135 ++};
136 ++
137 + &cpu_l0 {
138 + cpu-supply = <&vdd_cpu_l>;
139 + };
140 +diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
141 +index 44313a18e484e..bab46db2b18cd 100644
142 +--- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
143 ++++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
144 +@@ -521,6 +521,8 @@
145 + };
146 +
147 + &i2s1_8ch {
148 ++ pinctrl-names = "default";
149 ++ pinctrl-0 = <&i2s1m0_sclktx &i2s1m0_lrcktx &i2s1m0_sdi0 &i2s1m0_sdo0>;
150 + rockchip,trcm-sync-tx-only;
151 + status = "okay";
152 + };
153 +diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
154 +index 164708f1eb674..1d423daae971b 100644
155 +--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
156 ++++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
157 +@@ -966,6 +966,7 @@
158 + clock-names = "aclk_mst", "aclk_slv",
159 + "aclk_dbi", "pclk", "aux";
160 + device_type = "pci";
161 ++ #interrupt-cells = <1>;
162 + interrupt-map-mask = <0 0 0 7>;
163 + interrupt-map = <0 0 0 1 &pcie_intc 0>,
164 + <0 0 0 2 &pcie_intc 1>,
165 +diff --git a/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget0.dts b/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget0.dts
166 +index 7069f51bc120e..99136adb1857f 100644
167 +--- a/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget0.dts
168 ++++ b/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget0.dts
169 +@@ -24,7 +24,7 @@
170 + snps,dis_enblslpm_quirk;
171 + snps,dis_u2_susphy_quirk;
172 + snps,dis_u3_susphy_quirk;
173 +- snps,usb2_gadget_lpm_disable;
174 ++ snps,usb2-gadget-lpm-disable;
175 + phy-names = "usb2-phy", "usb3-phy";
176 + phys = <&usb0_hsphy0>, <&usb0_ssphy0>;
177 + };
178 +diff --git a/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget1.dts b/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget1.dts
179 +index a3cfa8113ffb2..4c960f455461c 100644
180 +--- a/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget1.dts
181 ++++ b/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget1.dts
182 +@@ -24,7 +24,7 @@
183 + snps,dis_enblslpm_quirk;
184 + snps,dis_u2_susphy_quirk;
185 + snps,dis_u3_susphy_quirk;
186 +- snps,usb2_gadget_lpm_disable;
187 ++ snps,usb2-gadget-lpm-disable;
188 + phy-names = "usb2-phy", "usb3-phy";
189 + phys = <&usb1_hsphy0>, <&usb1_ssphy0>;
190 + };
191 +diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
192 +index 2ca5418457ed2..2b1141645d9e1 100644
193 +--- a/arch/powerpc/Kconfig
194 ++++ b/arch/powerpc/Kconfig
195 +@@ -161,7 +161,6 @@ config PPC
196 + select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
197 + select ARCH_WANT_LD_ORPHAN_WARN
198 + select ARCH_WANTS_MODULES_DATA_IN_VMALLOC if PPC_BOOK3S_32 || PPC_8xx
199 +- select ARCH_WANTS_NO_INSTR
200 + select ARCH_WEAK_RELEASE_ACQUIRE
201 + select BINFMT_ELF
202 + select BUILDTIME_TABLE_SORT
203 +diff --git a/arch/x86/include/asm/intel-family.h b/arch/x86/include/asm/intel-family.h
204 +index 347707d459c67..cbaf174d8efd9 100644
205 +--- a/arch/x86/include/asm/intel-family.h
206 ++++ b/arch/x86/include/asm/intel-family.h
207 +@@ -123,6 +123,8 @@
208 + #define INTEL_FAM6_METEORLAKE 0xAC
209 + #define INTEL_FAM6_METEORLAKE_L 0xAA
210 +
211 ++#define INTEL_FAM6_LUNARLAKE_M 0xBD
212 ++
213 + /* "Small Core" Processors (Atom/E-Core) */
214 +
215 + #define INTEL_FAM6_ATOM_BONNELL 0x1C /* Diamondville, Pineview */
216 +diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
217 +index ae5f4acf26753..6d4ac934cd499 100644
218 +--- a/drivers/acpi/nfit/core.c
219 ++++ b/drivers/acpi/nfit/core.c
220 +@@ -3297,8 +3297,8 @@ void acpi_nfit_shutdown(void *data)
221 +
222 + mutex_lock(&acpi_desc->init_mutex);
223 + set_bit(ARS_CANCEL, &acpi_desc->scrub_flags);
224 +- cancel_delayed_work_sync(&acpi_desc->dwork);
225 + mutex_unlock(&acpi_desc->init_mutex);
226 ++ cancel_delayed_work_sync(&acpi_desc->dwork);
227 +
228 + /*
229 + * Bounce the nvdimm bus lock to make sure any in-flight
230 +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
231 +index e9c4f22696c5c..a930b1873f2a4 100644
232 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
233 ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
234 +@@ -147,14 +147,6 @@ MODULE_FIRMWARE(FIRMWARE_NAVI12_DMCU);
235 + /* Number of bytes in PSP footer for firmware. */
236 + #define PSP_FOOTER_BYTES 0x100
237 +
238 +-/*
239 +- * DMUB Async to Sync Mechanism Status
240 +- */
241 +-#define DMUB_ASYNC_TO_SYNC_ACCESS_FAIL 1
242 +-#define DMUB_ASYNC_TO_SYNC_ACCESS_TIMEOUT 2
243 +-#define DMUB_ASYNC_TO_SYNC_ACCESS_SUCCESS 3
244 +-#define DMUB_ASYNC_TO_SYNC_ACCESS_INVALID 4
245 +-
246 + /**
247 + * DOC: overview
248 + *
249 +@@ -1456,6 +1448,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
250 + memset(&init_params, 0, sizeof(init_params));
251 + #endif
252 +
253 ++ mutex_init(&adev->dm.dpia_aux_lock);
254 + mutex_init(&adev->dm.dc_lock);
255 + mutex_init(&adev->dm.audio_lock);
256 + spin_lock_init(&adev->dm.vblank_lock);
257 +@@ -1816,6 +1809,7 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
258 +
259 + mutex_destroy(&adev->dm.audio_lock);
260 + mutex_destroy(&adev->dm.dc_lock);
261 ++ mutex_destroy(&adev->dm.dpia_aux_lock);
262 +
263 + return;
264 + }
265 +@@ -10200,91 +10194,95 @@ uint32_t dm_read_reg_func(const struct dc_context *ctx, uint32_t address,
266 + return value;
267 + }
268 +
269 +-static int amdgpu_dm_set_dmub_async_sync_status(bool is_cmd_aux,
270 +- struct dc_context *ctx,
271 +- uint8_t status_type,
272 +- uint32_t *operation_result)
273 ++int amdgpu_dm_process_dmub_aux_transfer_sync(
274 ++ struct dc_context *ctx,
275 ++ unsigned int link_index,
276 ++ struct aux_payload *payload,
277 ++ enum aux_return_code_type *operation_result)
278 + {
279 + struct amdgpu_device *adev = ctx->driver_context;
280 +- int return_status = -1;
281 + struct dmub_notification *p_notify = adev->dm.dmub_notify;
282 ++ int ret = -1;
283 +
284 +- if (is_cmd_aux) {
285 +- if (status_type == DMUB_ASYNC_TO_SYNC_ACCESS_SUCCESS) {
286 +- return_status = p_notify->aux_reply.length;
287 +- *operation_result = p_notify->result;
288 +- } else if (status_type == DMUB_ASYNC_TO_SYNC_ACCESS_TIMEOUT) {
289 +- *operation_result = AUX_RET_ERROR_TIMEOUT;
290 +- } else if (status_type == DMUB_ASYNC_TO_SYNC_ACCESS_FAIL) {
291 +- *operation_result = AUX_RET_ERROR_ENGINE_ACQUIRE;
292 +- } else if (status_type == DMUB_ASYNC_TO_SYNC_ACCESS_INVALID) {
293 +- *operation_result = AUX_RET_ERROR_INVALID_REPLY;
294 +- } else {
295 +- *operation_result = AUX_RET_ERROR_UNKNOWN;
296 ++ mutex_lock(&adev->dm.dpia_aux_lock);
297 ++ if (!dc_process_dmub_aux_transfer_async(ctx->dc, link_index, payload)) {
298 ++ *operation_result = AUX_RET_ERROR_ENGINE_ACQUIRE;
299 ++ goto out;
300 ++ }
301 ++
302 ++ if (!wait_for_completion_timeout(&adev->dm.dmub_aux_transfer_done, 10 * HZ)) {
303 ++ DRM_ERROR("wait_for_completion_timeout timeout!");
304 ++ *operation_result = AUX_RET_ERROR_TIMEOUT;
305 ++ goto out;
306 ++ }
307 ++
308 ++ if (p_notify->result != AUX_RET_SUCCESS) {
309 ++ /*
310 ++ * Transient states before tunneling is enabled could
311 ++ * lead to this error. We can ignore this for now.
312 ++ */
313 ++ if (p_notify->result != AUX_RET_ERROR_PROTOCOL_ERROR) {
314 ++ DRM_WARN("DPIA AUX failed on 0x%x(%d), error %d\n",
315 ++ payload->address, payload->length,
316 ++ p_notify->result);
317 + }
318 +- } else {
319 +- if (status_type == DMUB_ASYNC_TO_SYNC_ACCESS_SUCCESS) {
320 +- return_status = 0;
321 +- *operation_result = p_notify->sc_status;
322 +- } else {
323 +- *operation_result = SET_CONFIG_UNKNOWN_ERROR;
324 ++ *operation_result = AUX_RET_ERROR_INVALID_REPLY;
325 ++ goto out;
326 ++ }
327 ++
328 ++
329 ++ payload->reply[0] = adev->dm.dmub_notify->aux_reply.command;
330 ++ if (!payload->write && p_notify->aux_reply.length &&
331 ++ (payload->reply[0] == AUX_TRANSACTION_REPLY_AUX_ACK)) {
332 ++
333 ++ if (payload->length != p_notify->aux_reply.length) {
334 ++ DRM_WARN("invalid read length %d from DPIA AUX 0x%x(%d)!\n",
335 ++ p_notify->aux_reply.length,
336 ++ payload->address, payload->length);
337 ++ *operation_result = AUX_RET_ERROR_INVALID_REPLY;
338 ++ goto out;
339 + }
340 ++
341 ++ memcpy(payload->data, p_notify->aux_reply.data,
342 ++ p_notify->aux_reply.length);
343 + }
344 +
345 +- return return_status;
346 ++ /* success */
347 ++ ret = p_notify->aux_reply.length;
348 ++ *operation_result = p_notify->result;
349 ++out:
350 ++ reinit_completion(&adev->dm.dmub_aux_transfer_done);
351 ++ mutex_unlock(&adev->dm.dpia_aux_lock);
352 ++ return ret;
353 + }
354 +
355 +-int amdgpu_dm_process_dmub_aux_transfer_sync(bool is_cmd_aux, struct dc_context *ctx,
356 +- unsigned int link_index, void *cmd_payload, void *operation_result)
357 ++int amdgpu_dm_process_dmub_set_config_sync(
358 ++ struct dc_context *ctx,
359 ++ unsigned int link_index,
360 ++ struct set_config_cmd_payload *payload,
361 ++ enum set_config_status *operation_result)
362 + {
363 + struct amdgpu_device *adev = ctx->driver_context;
364 +- int ret = 0;
365 ++ bool is_cmd_complete;
366 ++ int ret;
367 +
368 +- if (is_cmd_aux) {
369 +- dc_process_dmub_aux_transfer_async(ctx->dc,
370 +- link_index, (struct aux_payload *)cmd_payload);
371 +- } else if (dc_process_dmub_set_config_async(ctx->dc, link_index,
372 +- (struct set_config_cmd_payload *)cmd_payload,
373 +- adev->dm.dmub_notify)) {
374 +- return amdgpu_dm_set_dmub_async_sync_status(is_cmd_aux,
375 +- ctx, DMUB_ASYNC_TO_SYNC_ACCESS_SUCCESS,
376 +- (uint32_t *)operation_result);
377 +- }
378 ++ mutex_lock(&adev->dm.dpia_aux_lock);
379 ++ is_cmd_complete = dc_process_dmub_set_config_async(ctx->dc,
380 ++ link_index, payload, adev->dm.dmub_notify);
381 +
382 +- ret = wait_for_completion_timeout(&adev->dm.dmub_aux_transfer_done, 10 * HZ);
383 +- if (ret == 0) {
384 ++ if (is_cmd_complete || wait_for_completion_timeout(&adev->dm.dmub_aux_transfer_done, 10 * HZ)) {
385 ++ ret = 0;
386 ++ *operation_result = adev->dm.dmub_notify->sc_status;
387 ++ } else {
388 + DRM_ERROR("wait_for_completion_timeout timeout!");
389 +- return amdgpu_dm_set_dmub_async_sync_status(is_cmd_aux,
390 +- ctx, DMUB_ASYNC_TO_SYNC_ACCESS_TIMEOUT,
391 +- (uint32_t *)operation_result);
392 +- }
393 +-
394 +- if (is_cmd_aux) {
395 +- if (adev->dm.dmub_notify->result == AUX_RET_SUCCESS) {
396 +- struct aux_payload *payload = (struct aux_payload *)cmd_payload;
397 +-
398 +- payload->reply[0] = adev->dm.dmub_notify->aux_reply.command;
399 +- if (!payload->write && adev->dm.dmub_notify->aux_reply.length &&
400 +- payload->reply[0] == AUX_TRANSACTION_REPLY_AUX_ACK) {
401 +-
402 +- if (payload->length != adev->dm.dmub_notify->aux_reply.length) {
403 +- DRM_WARN("invalid read from DPIA AUX %x(%d) got length %d!\n",
404 +- payload->address, payload->length,
405 +- adev->dm.dmub_notify->aux_reply.length);
406 +- return amdgpu_dm_set_dmub_async_sync_status(is_cmd_aux, ctx,
407 +- DMUB_ASYNC_TO_SYNC_ACCESS_INVALID,
408 +- (uint32_t *)operation_result);
409 +- }
410 +-
411 +- memcpy(payload->data, adev->dm.dmub_notify->aux_reply.data,
412 +- adev->dm.dmub_notify->aux_reply.length);
413 +- }
414 +- }
415 ++ ret = -1;
416 ++ *operation_result = SET_CONFIG_UNKNOWN_ERROR;
417 + }
418 +
419 +- return amdgpu_dm_set_dmub_async_sync_status(is_cmd_aux,
420 +- ctx, DMUB_ASYNC_TO_SYNC_ACCESS_SUCCESS,
421 +- (uint32_t *)operation_result);
422 ++ if (!is_cmd_complete)
423 ++ reinit_completion(&adev->dm.dmub_aux_transfer_done);
424 ++ mutex_unlock(&adev->dm.dpia_aux_lock);
425 ++ return ret;
426 + }
427 +
428 + /*
429 +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
430 +index 635c398fcefe7..ac26e917240b9 100644
431 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
432 ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
433 +@@ -59,7 +59,9 @@
434 + #include "signal_types.h"
435 + #include "amdgpu_dm_crc.h"
436 + struct aux_payload;
437 ++struct set_config_cmd_payload;
438 + enum aux_return_code_type;
439 ++enum set_config_status;
440 +
441 + /* Forward declarations */
442 + struct amdgpu_device;
443 +@@ -549,6 +551,13 @@ struct amdgpu_display_manager {
444 + * occurred on certain intel platform
445 + */
446 + bool aux_hpd_discon_quirk;
447 ++
448 ++ /**
449 ++ * @dpia_aux_lock:
450 ++ *
451 ++ * Guards access to DPIA AUX
452 ++ */
453 ++ struct mutex dpia_aux_lock;
454 + };
455 +
456 + enum dsc_clock_force_state {
457 +@@ -792,9 +801,11 @@ void amdgpu_dm_update_connector_after_detect(
458 +
459 + extern const struct drm_encoder_helper_funcs amdgpu_dm_encoder_helper_funcs;
460 +
461 +-int amdgpu_dm_process_dmub_aux_transfer_sync(bool is_cmd_aux,
462 +- struct dc_context *ctx, unsigned int link_index,
463 +- void *payload, void *operation_result);
464 ++int amdgpu_dm_process_dmub_aux_transfer_sync(struct dc_context *ctx, unsigned int link_index,
465 ++ struct aux_payload *payload, enum aux_return_code_type *operation_result);
466 ++
467 ++int amdgpu_dm_process_dmub_set_config_sync(struct dc_context *ctx, unsigned int link_index,
468 ++ struct set_config_cmd_payload *payload, enum set_config_status *operation_result);
469 +
470 + bool check_seamless_boot_capability(struct amdgpu_device *adev);
471 +
472 +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
473 +index 16623f73ddbe6..57454967617f8 100644
474 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
475 ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
476 +@@ -844,9 +844,8 @@ int dm_helper_dmub_aux_transfer_sync(
477 + struct aux_payload *payload,
478 + enum aux_return_code_type *operation_result)
479 + {
480 +- return amdgpu_dm_process_dmub_aux_transfer_sync(true, ctx,
481 +- link->link_index, (void *)payload,
482 +- (void *)operation_result);
483 ++ return amdgpu_dm_process_dmub_aux_transfer_sync(ctx, link->link_index, payload,
484 ++ operation_result);
485 + }
486 +
487 + int dm_helpers_dmub_set_config_sync(struct dc_context *ctx,
488 +@@ -854,9 +853,8 @@ int dm_helpers_dmub_set_config_sync(struct dc_context *ctx,
489 + struct set_config_cmd_payload *payload,
490 + enum set_config_status *operation_result)
491 + {
492 +- return amdgpu_dm_process_dmub_aux_transfer_sync(false, ctx,
493 +- link->link_index, (void *)payload,
494 +- (void *)operation_result);
495 ++ return amdgpu_dm_process_dmub_set_config_sync(ctx, link->link_index, payload,
496 ++ operation_result);
497 + }
498 +
499 + void dm_set_dcn_clocks(struct dc_context *ctx, struct dc_clocks *clks)
500 +diff --git a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c
501 +index a0741794db62a..8e824dc81dede 100644
502 +--- a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c
503 ++++ b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c
504 +@@ -391,3 +391,27 @@ void dcn314_set_pixels_per_cycle(struct pipe_ctx *pipe_ctx)
505 + pipe_ctx->stream_res.stream_enc->funcs->set_input_mode(pipe_ctx->stream_res.stream_enc,
506 + pix_per_cycle);
507 + }
508 ++
509 ++void dcn314_hubp_pg_control(struct dce_hwseq *hws, unsigned int hubp_inst, bool power_on)
510 ++{
511 ++ struct dc_context *ctx = hws->ctx;
512 ++ union dmub_rb_cmd cmd;
513 ++
514 ++ if (hws->ctx->dc->debug.disable_hubp_power_gate)
515 ++ return;
516 ++
517 ++ PERF_TRACE();
518 ++
519 ++ memset(&cmd, 0, sizeof(cmd));
520 ++ cmd.domain_control.header.type = DMUB_CMD__VBIOS;
521 ++ cmd.domain_control.header.sub_type = DMUB_CMD__VBIOS_DOMAIN_CONTROL;
522 ++ cmd.domain_control.header.payload_bytes = sizeof(cmd.domain_control.data);
523 ++ cmd.domain_control.data.inst = hubp_inst;
524 ++ cmd.domain_control.data.power_gate = !power_on;
525 ++
526 ++ dc_dmub_srv_cmd_queue(ctx->dmub_srv, &cmd);
527 ++ dc_dmub_srv_cmd_execute(ctx->dmub_srv);
528 ++ dc_dmub_srv_wait_idle(ctx->dmub_srv);
529 ++
530 ++ PERF_TRACE();
531 ++}
532 +diff --git a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.h b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.h
533 +index 244280298212c..c419d3dbdfee6 100644
534 +--- a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.h
535 ++++ b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.h
536 +@@ -41,4 +41,6 @@ unsigned int dcn314_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsig
537 +
538 + void dcn314_set_pixels_per_cycle(struct pipe_ctx *pipe_ctx);
539 +
540 ++void dcn314_hubp_pg_control(struct dce_hwseq *hws, unsigned int hubp_inst, bool power_on);
541 ++
542 + #endif /* __DC_HWSS_DCN314_H__ */
543 +diff --git a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.c b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.c
544 +index 5b6c2d94ec71d..343f4d9dd5e34 100644
545 +--- a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.c
546 ++++ b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.c
547 +@@ -137,7 +137,7 @@ static const struct hwseq_private_funcs dcn314_private_funcs = {
548 + .plane_atomic_disable = dcn20_plane_atomic_disable,
549 + .plane_atomic_power_down = dcn10_plane_atomic_power_down,
550 + .enable_power_gating_plane = dcn314_enable_power_gating_plane,
551 +- .hubp_pg_control = dcn31_hubp_pg_control,
552 ++ .hubp_pg_control = dcn314_hubp_pg_control,
553 + .program_all_writeback_pipes_in_tree = dcn30_program_all_writeback_pipes_in_tree,
554 + .update_odm = dcn314_update_odm,
555 + .dsc_pg_control = dcn314_dsc_pg_control,
556 +diff --git a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
557 +index 7a8f61517424c..27a4ea7dc74ec 100644
558 +--- a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
559 ++++ b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
560 +@@ -450,6 +450,10 @@ enum dmub_cmd_vbios_type {
561 + * Query DP alt status on a transmitter.
562 + */
563 + DMUB_CMD__VBIOS_TRANSMITTER_QUERY_DP_ALT = 26,
564 ++ /**
565 ++ * Controls domain power gating
566 ++ */
567 ++ DMUB_CMD__VBIOS_DOMAIN_CONTROL = 28,
568 + };
569 +
570 + //==============================================================================
571 +@@ -1191,6 +1195,23 @@ struct dmub_rb_cmd_dig1_transmitter_control {
572 + union dmub_cmd_dig1_transmitter_control_data transmitter_control; /**< payload */
573 + };
574 +
575 ++/**
576 ++ * struct dmub_rb_cmd_domain_control_data - Data for DOMAIN power control
577 ++ */
578 ++struct dmub_rb_cmd_domain_control_data {
579 ++ uint8_t inst : 6; /**< DOMAIN instance to control */
580 ++ uint8_t power_gate : 1; /**< 1=power gate, 0=power up */
581 ++ uint8_t reserved[3]; /**< Reserved for future use */
582 ++};
583 ++
584 ++/**
585 ++ * struct dmub_rb_cmd_domain_control - Controls DOMAIN power gating
586 ++ */
587 ++struct dmub_rb_cmd_domain_control {
588 ++ struct dmub_cmd_header header; /**< header */
589 ++ struct dmub_rb_cmd_domain_control_data data; /**< payload */
590 ++};
591 ++
592 + /**
593 + * DPIA tunnel command parameters.
594 + */
595 +@@ -3187,6 +3208,10 @@ union dmub_rb_cmd {
596 + * Definition of a DMUB_CMD__VBIOS_DIG1_TRANSMITTER_CONTROL command.
597 + */
598 + struct dmub_rb_cmd_dig1_transmitter_control dig1_transmitter_control;
599 ++ /**
600 ++ * Definition of a DMUB_CMD__VBIOS_DOMAIN_CONTROL command.
601 ++ */
602 ++ struct dmub_rb_cmd_domain_control domain_control;
603 + /**
604 + * Definition of a DMUB_CMD__PSR_SET_VERSION command.
605 + */
606 +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
607 +index 3e1803592bd4a..5c72aef3d3dd5 100644
608 +--- a/drivers/hid/hid-core.c
609 ++++ b/drivers/hid/hid-core.c
610 +@@ -1202,6 +1202,7 @@ int hid_open_report(struct hid_device *device)
611 + __u8 *end;
612 + __u8 *next;
613 + int ret;
614 ++ int i;
615 + static int (*dispatch_type[])(struct hid_parser *parser,
616 + struct hid_item *item) = {
617 + hid_parser_main,
618 +@@ -1252,6 +1253,8 @@ int hid_open_report(struct hid_device *device)
619 + goto err;
620 + }
621 + device->collection_size = HID_DEFAULT_NUM_COLLECTIONS;
622 ++ for (i = 0; i < HID_DEFAULT_NUM_COLLECTIONS; i++)
623 ++ device->collection[i].parent_idx = -1;
624 +
625 + ret = -EINVAL;
626 + while ((next = fetch_item(start, end, &item)) != NULL) {
627 +diff --git a/drivers/hid/hid-elecom.c b/drivers/hid/hid-elecom.c
628 +index e59e9911fc370..4fa45ee77503b 100644
629 +--- a/drivers/hid/hid-elecom.c
630 ++++ b/drivers/hid/hid-elecom.c
631 +@@ -12,6 +12,7 @@
632 + * Copyright (c) 2017 Alex Manoussakis <amanou@×××.org>
633 + * Copyright (c) 2017 Tomasz Kramkowski <tk@××××××.com>
634 + * Copyright (c) 2020 YOSHIOKA Takuma <lo48576@×××××××.red>
635 ++ * Copyright (c) 2022 Takahiro Fujii <fujii@×××××.net>
636 + */
637 +
638 + /*
639 +@@ -89,7 +90,7 @@ static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
640 + case USB_DEVICE_ID_ELECOM_M_DT1URBK:
641 + case USB_DEVICE_ID_ELECOM_M_DT1DRBK:
642 + case USB_DEVICE_ID_ELECOM_M_HT1URBK:
643 +- case USB_DEVICE_ID_ELECOM_M_HT1DRBK:
644 ++ case USB_DEVICE_ID_ELECOM_M_HT1DRBK_010D:
645 + /*
646 + * Report descriptor format:
647 + * 12: button bit count
648 +@@ -99,6 +100,16 @@ static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
649 + */
650 + mouse_button_fixup(hdev, rdesc, *rsize, 12, 30, 14, 20, 8);
651 + break;
652 ++ case USB_DEVICE_ID_ELECOM_M_HT1DRBK_011C:
653 ++ /*
654 ++ * Report descriptor format:
655 ++ * 22: button bit count
656 ++ * 30: padding bit count
657 ++ * 24: button report size
658 ++ * 16: button usage maximum
659 ++ */
660 ++ mouse_button_fixup(hdev, rdesc, *rsize, 22, 30, 24, 16, 8);
661 ++ break;
662 + }
663 + return rdesc;
664 + }
665 +@@ -112,7 +123,8 @@ static const struct hid_device_id elecom_devices[] = {
666 + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1URBK) },
667 + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1DRBK) },
668 + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_HT1URBK) },
669 +- { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_HT1DRBK) },
670 ++ { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_HT1DRBK_010D) },
671 ++ { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_HT1DRBK_011C) },
672 + { }
673 + };
674 + MODULE_DEVICE_TABLE(hid, elecom_devices);
675 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
676 +index 0f8c11842a3a5..9e36b4cd905ee 100644
677 +--- a/drivers/hid/hid-ids.h
678 ++++ b/drivers/hid/hid-ids.h
679 +@@ -413,6 +413,8 @@
680 + #define I2C_DEVICE_ID_HP_ENVY_X360_15T_DR100 0x29CF
681 + #define I2C_DEVICE_ID_HP_ENVY_X360_EU0009NV 0x2CF9
682 + #define I2C_DEVICE_ID_HP_SPECTRE_X360_15 0x2817
683 ++#define I2C_DEVICE_ID_HP_SPECTRE_X360_13_AW0020NG 0x29DF
684 ++#define I2C_DEVICE_ID_ASUS_TP420IA_TOUCHSCREEN 0x2BC8
685 + #define USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN 0x2544
686 + #define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706
687 + #define I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN 0x261A
688 +@@ -428,7 +430,8 @@
689 + #define USB_DEVICE_ID_ELECOM_M_DT1URBK 0x00fe
690 + #define USB_DEVICE_ID_ELECOM_M_DT1DRBK 0x00ff
691 + #define USB_DEVICE_ID_ELECOM_M_HT1URBK 0x010c
692 +-#define USB_DEVICE_ID_ELECOM_M_HT1DRBK 0x010d
693 ++#define USB_DEVICE_ID_ELECOM_M_HT1DRBK_010D 0x010d
694 ++#define USB_DEVICE_ID_ELECOM_M_HT1DRBK_011C 0x011c
695 +
696 + #define USB_VENDOR_ID_DREAM_CHEEKY 0x1d34
697 + #define USB_DEVICE_ID_DREAM_CHEEKY_WN 0x0004
698 +diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
699 +index 3ee5a9fea20e6..7e94ca1822afb 100644
700 +--- a/drivers/hid/hid-input.c
701 ++++ b/drivers/hid/hid-input.c
702 +@@ -370,6 +370,8 @@ static const struct hid_device_id hid_battery_quirks[] = {
703 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH,
704 + USB_DEVICE_ID_LOGITECH_DINOVO_EDGE_KBD),
705 + HID_BATTERY_QUIRK_IGNORE },
706 ++ { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_ASUS_TP420IA_TOUCHSCREEN),
707 ++ HID_BATTERY_QUIRK_IGNORE },
708 + { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN),
709 + HID_BATTERY_QUIRK_IGNORE },
710 + { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN),
711 +@@ -384,6 +386,8 @@ static const struct hid_device_id hid_battery_quirks[] = {
712 + HID_BATTERY_QUIRK_IGNORE },
713 + { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_15),
714 + HID_BATTERY_QUIRK_IGNORE },
715 ++ { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_13_AW0020NG),
716 ++ HID_BATTERY_QUIRK_IGNORE },
717 + { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN),
718 + HID_BATTERY_QUIRK_IGNORE },
719 + { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_SURFACE_GO2_TOUCHSCREEN),
720 +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
721 +index be3ad02573de8..5bc91f68b3747 100644
722 +--- a/drivers/hid/hid-quirks.c
723 ++++ b/drivers/hid/hid-quirks.c
724 +@@ -393,7 +393,8 @@ static const struct hid_device_id hid_have_special_driver[] = {
725 + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1URBK) },
726 + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1DRBK) },
727 + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_HT1URBK) },
728 +- { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_HT1DRBK) },
729 ++ { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_HT1DRBK_010D) },
730 ++ { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_HT1DRBK_011C) },
731 + #endif
732 + #if IS_ENABLED(CONFIG_HID_ELO)
733 + { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0009) },
734 +diff --git a/drivers/infiniband/hw/hfi1/user_exp_rcv.c b/drivers/infiniband/hw/hfi1/user_exp_rcv.c
735 +index b02f2f0809c81..350884d5f0896 100644
736 +--- a/drivers/infiniband/hw/hfi1/user_exp_rcv.c
737 ++++ b/drivers/infiniband/hw/hfi1/user_exp_rcv.c
738 +@@ -160,16 +160,11 @@ static void unpin_rcv_pages(struct hfi1_filedata *fd,
739 + static int pin_rcv_pages(struct hfi1_filedata *fd, struct tid_user_buf *tidbuf)
740 + {
741 + int pinned;
742 +- unsigned int npages;
743 ++ unsigned int npages = tidbuf->npages;
744 + unsigned long vaddr = tidbuf->vaddr;
745 + struct page **pages = NULL;
746 + struct hfi1_devdata *dd = fd->uctxt->dd;
747 +
748 +- /* Get the number of pages the user buffer spans */
749 +- npages = num_user_pages(vaddr, tidbuf->length);
750 +- if (!npages)
751 +- return -EINVAL;
752 +-
753 + if (npages > fd->uctxt->expected_count) {
754 + dd_dev_err(dd, "Expected buffer too big\n");
755 + return -EINVAL;
756 +@@ -196,7 +191,6 @@ static int pin_rcv_pages(struct hfi1_filedata *fd, struct tid_user_buf *tidbuf)
757 + return pinned;
758 + }
759 + tidbuf->pages = pages;
760 +- tidbuf->npages = npages;
761 + fd->tid_n_pinned += pinned;
762 + return pinned;
763 + }
764 +@@ -274,6 +268,7 @@ int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd,
765 + mutex_init(&tidbuf->cover_mutex);
766 + tidbuf->vaddr = tinfo->vaddr;
767 + tidbuf->length = tinfo->length;
768 ++ tidbuf->npages = num_user_pages(tidbuf->vaddr, tidbuf->length);
769 + tidbuf->psets = kcalloc(uctxt->expected_count, sizeof(*tidbuf->psets),
770 + GFP_KERNEL);
771 + if (!tidbuf->psets) {
772 +diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
773 +index 9bc6e3922e78e..32c3edaf90385 100644
774 +--- a/drivers/pinctrl/pinctrl-amd.c
775 ++++ b/drivers/pinctrl/pinctrl-amd.c
776 +@@ -365,6 +365,7 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
777 +
778 + } else {
779 + debounce_enable = " ∅";
780 ++ time = 0;
781 + }
782 + snprintf(debounce_value, sizeof(debounce_value), "%u", time * unit);
783 + seq_printf(s, "debounce %s (🕑 %sus)| ", debounce_enable, debounce_value);
784 +diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
785 +index f566eb1839dc5..71e091f879f0e 100644
786 +--- a/drivers/tty/vt/vc_screen.c
787 ++++ b/drivers/tty/vt/vc_screen.c
788 +@@ -403,10 +403,11 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
789 + unsigned int this_round, skip = 0;
790 + int size;
791 +
792 +- ret = -ENXIO;
793 + vc = vcs_vc(inode, &viewed);
794 +- if (!vc)
795 +- goto unlock_out;
796 ++ if (!vc) {
797 ++ ret = -ENXIO;
798 ++ break;
799 ++ }
800 +
801 + /* Check whether we are above size each round,
802 + * as copy_to_user at the end of this loop
803 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
804 +index 0aaaadb02cc69..1abe43ddb75f0 100644
805 +--- a/drivers/usb/core/hub.c
806 ++++ b/drivers/usb/core/hub.c
807 +@@ -2389,9 +2389,8 @@ static int usb_enumerate_device_otg(struct usb_device *udev)
808 + * usb_enumerate_device - Read device configs/intfs/otg (usbcore-internal)
809 + * @udev: newly addressed device (in ADDRESS state)
810 + *
811 +- * This is only called by usb_new_device() and usb_authorize_device()
812 +- * and FIXME -- all comments that apply to them apply here wrt to
813 +- * environment.
814 ++ * This is only called by usb_new_device() -- all comments that apply there
815 ++ * apply here wrt to environment.
816 + *
817 + * If the device is WUSB and not authorized, we don't attempt to read
818 + * the string descriptors, as they will be errored out by the device
819 +diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
820 +index 631574718d8ac..ccf6cd9722693 100644
821 +--- a/drivers/usb/core/sysfs.c
822 ++++ b/drivers/usb/core/sysfs.c
823 +@@ -868,11 +868,7 @@ read_descriptors(struct file *filp, struct kobject *kobj,
824 + size_t srclen, n;
825 + int cfgno;
826 + void *src;
827 +- int retval;
828 +
829 +- retval = usb_lock_device_interruptible(udev);
830 +- if (retval < 0)
831 +- return -EINTR;
832 + /* The binary attribute begins with the device descriptor.
833 + * Following that are the raw descriptor entries for all the
834 + * configurations (config plus subsidiary descriptors).
835 +@@ -897,7 +893,6 @@ read_descriptors(struct file *filp, struct kobject *kobj,
836 + off -= srclen;
837 + }
838 + }
839 +- usb_unlock_device(udev);
840 + return count - nleft;
841 + }
842 +
843 +diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
844 +index 89c9ab2b19f85..a23ddbb819795 100644
845 +--- a/drivers/usb/dwc3/dwc3-pci.c
846 ++++ b/drivers/usb/dwc3/dwc3-pci.c
847 +@@ -47,6 +47,7 @@
848 + #define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1
849 + #define PCI_DEVICE_ID_INTEL_RPL 0xa70e
850 + #define PCI_DEVICE_ID_INTEL_RPLS 0x7a61
851 ++#define PCI_DEVICE_ID_INTEL_MTLM 0x7eb1
852 + #define PCI_DEVICE_ID_INTEL_MTLP 0x7ec1
853 + #define PCI_DEVICE_ID_INTEL_MTL 0x7e7e
854 + #define PCI_DEVICE_ID_INTEL_TGL 0x9a15
855 +@@ -467,6 +468,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
856 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPLS),
857 + (kernel_ulong_t) &dwc3_pci_intel_swnode, },
858 +
859 ++ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTLM),
860 ++ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
861 ++
862 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTLP),
863 + (kernel_ulong_t) &dwc3_pci_intel_swnode, },
864 +
865 +diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
866 +index 7538279f98179..db6fd0238d4b4 100644
867 +--- a/drivers/usb/gadget/function/u_serial.c
868 ++++ b/drivers/usb/gadget/function/u_serial.c
869 +@@ -81,6 +81,9 @@
870 + #define WRITE_BUF_SIZE 8192 /* TX only */
871 + #define GS_CONSOLE_BUF_SIZE 8192
872 +
873 ++/* Prevents race conditions while accessing gser->ioport */
874 ++static DEFINE_SPINLOCK(serial_port_lock);
875 ++
876 + /* console info */
877 + struct gs_console {
878 + struct console console;
879 +@@ -1374,8 +1377,10 @@ void gserial_disconnect(struct gserial *gser)
880 + if (!port)
881 + return;
882 +
883 ++ spin_lock_irqsave(&serial_port_lock, flags);
884 ++
885 + /* tell the TTY glue not to do I/O here any more */
886 +- spin_lock_irqsave(&port->port_lock, flags);
887 ++ spin_lock(&port->port_lock);
888 +
889 + gs_console_disconnect(port);
890 +
891 +@@ -1390,7 +1395,8 @@ void gserial_disconnect(struct gserial *gser)
892 + tty_hangup(port->port.tty);
893 + }
894 + port->suspended = false;
895 +- spin_unlock_irqrestore(&port->port_lock, flags);
896 ++ spin_unlock(&port->port_lock);
897 ++ spin_unlock_irqrestore(&serial_port_lock, flags);
898 +
899 + /* disable endpoints, aborting down any active I/O */
900 + usb_ep_disable(gser->out);
901 +@@ -1424,10 +1430,19 @@ EXPORT_SYMBOL_GPL(gserial_suspend);
902 +
903 + void gserial_resume(struct gserial *gser)
904 + {
905 +- struct gs_port *port = gser->ioport;
906 ++ struct gs_port *port;
907 + unsigned long flags;
908 +
909 +- spin_lock_irqsave(&port->port_lock, flags);
910 ++ spin_lock_irqsave(&serial_port_lock, flags);
911 ++ port = gser->ioport;
912 ++
913 ++ if (!port) {
914 ++ spin_unlock_irqrestore(&serial_port_lock, flags);
915 ++ return;
916 ++ }
917 ++
918 ++ spin_lock(&port->port_lock);
919 ++ spin_unlock(&serial_port_lock);
920 + port->suspended = false;
921 + if (!port->start_delayed) {
922 + spin_unlock_irqrestore(&port->port_lock, flags);
923 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
924 +index 6b69d05e2fb06..a8534065e0d6d 100644
925 +--- a/drivers/usb/serial/option.c
926 ++++ b/drivers/usb/serial/option.c
927 +@@ -402,6 +402,8 @@ static void option_instat_callback(struct urb *urb);
928 + #define LONGCHEER_VENDOR_ID 0x1c9e
929 +
930 + /* 4G Systems products */
931 ++/* This one was sold as the VW and Skoda "Carstick LTE" */
932 ++#define FOUR_G_SYSTEMS_PRODUCT_CARSTICK_LTE 0x7605
933 + /* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick *
934 + * It seems to contain a Qualcomm QSC6240/6290 chipset */
935 + #define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603
936 +@@ -1976,6 +1978,8 @@ static const struct usb_device_id option_ids[] = {
937 + .driver_info = RSVD(2) },
938 + { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
939 + { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
940 ++ { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_CARSTICK_LTE),
941 ++ .driver_info = RSVD(0) },
942 + { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
943 + .driver_info = NCTRL(0) | NCTRL(1) },
944 + { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W100),
945 +diff --git a/drivers/usb/typec/pd.c b/drivers/usb/typec/pd.c
946 +index dc72005d68db9..b5ab26422c349 100644
947 +--- a/drivers/usb/typec/pd.c
948 ++++ b/drivers/usb/typec/pd.c
949 +@@ -161,7 +161,6 @@ static struct device_type source_fixed_supply_type = {
950 +
951 + static struct attribute *sink_fixed_supply_attrs[] = {
952 + &dev_attr_dual_role_power.attr,
953 +- &dev_attr_usb_suspend_supported.attr,
954 + &dev_attr_unconstrained_power.attr,
955 + &dev_attr_usb_communication_capable.attr,
956 + &dev_attr_dual_role_data.attr,
957 +diff --git a/fs/attr.c b/fs/attr.c
958 +index 1552a5f23d6b3..b45f30e516fad 100644
959 +--- a/fs/attr.c
960 ++++ b/fs/attr.c
961 +@@ -18,6 +18,70 @@
962 + #include <linux/evm.h>
963 + #include <linux/ima.h>
964 +
965 ++#include "internal.h"
966 ++
967 ++/**
968 ++ * setattr_should_drop_sgid - determine whether the setgid bit needs to be
969 ++ * removed
970 ++ * @mnt_userns: user namespace of the mount @inode was found from
971 ++ * @inode: inode to check
972 ++ *
973 ++ * This function determines whether the setgid bit needs to be removed.
974 ++ * We retain backwards compatibility and require setgid bit to be removed
975 ++ * unconditionally if S_IXGRP is set. Otherwise we have the exact same
976 ++ * requirements as setattr_prepare() and setattr_copy().
977 ++ *
978 ++ * Return: ATTR_KILL_SGID if setgid bit needs to be removed, 0 otherwise.
979 ++ */
980 ++int setattr_should_drop_sgid(struct user_namespace *mnt_userns,
981 ++ const struct inode *inode)
982 ++{
983 ++ umode_t mode = inode->i_mode;
984 ++
985 ++ if (!(mode & S_ISGID))
986 ++ return 0;
987 ++ if (mode & S_IXGRP)
988 ++ return ATTR_KILL_SGID;
989 ++ if (!in_group_or_capable(mnt_userns, inode,
990 ++ i_gid_into_vfsgid(mnt_userns, inode)))
991 ++ return ATTR_KILL_SGID;
992 ++ return 0;
993 ++}
994 ++
995 ++/**
996 ++ * setattr_should_drop_suidgid - determine whether the set{g,u}id bit needs to
997 ++ * be dropped
998 ++ * @mnt_userns: user namespace of the mount @inode was found from
999 ++ * @inode: inode to check
1000 ++ *
1001 ++ * This function determines whether the set{g,u}id bits need to be removed.
1002 ++ * If the setuid bit needs to be removed ATTR_KILL_SUID is returned. If the
1003 ++ * setgid bit needs to be removed ATTR_KILL_SGID is returned. If both
1004 ++ * set{g,u}id bits need to be removed the corresponding mask of both flags is
1005 ++ * returned.
1006 ++ *
1007 ++ * Return: A mask of ATTR_KILL_S{G,U}ID indicating which - if any - setid bits
1008 ++ * to remove, 0 otherwise.
1009 ++ */
1010 ++int setattr_should_drop_suidgid(struct user_namespace *mnt_userns,
1011 ++ struct inode *inode)
1012 ++{
1013 ++ umode_t mode = inode->i_mode;
1014 ++ int kill = 0;
1015 ++
1016 ++ /* suid always must be killed */
1017 ++ if (unlikely(mode & S_ISUID))
1018 ++ kill = ATTR_KILL_SUID;
1019 ++
1020 ++ kill |= setattr_should_drop_sgid(mnt_userns, inode);
1021 ++
1022 ++ if (unlikely(kill && !capable(CAP_FSETID) && S_ISREG(mode)))
1023 ++ return kill;
1024 ++
1025 ++ return 0;
1026 ++}
1027 ++EXPORT_SYMBOL(setattr_should_drop_suidgid);
1028 ++
1029 + /**
1030 + * chown_ok - verify permissions to chown inode
1031 + * @mnt_userns: user namespace of the mount @inode was found from
1032 +@@ -140,8 +204,7 @@ int setattr_prepare(struct user_namespace *mnt_userns, struct dentry *dentry,
1033 + vfsgid = i_gid_into_vfsgid(mnt_userns, inode);
1034 +
1035 + /* Also check the setgid bit! */
1036 +- if (!vfsgid_in_group_p(vfsgid) &&
1037 +- !capable_wrt_inode_uidgid(mnt_userns, inode, CAP_FSETID))
1038 ++ if (!in_group_or_capable(mnt_userns, inode, vfsgid))
1039 + attr->ia_mode &= ~S_ISGID;
1040 + }
1041 +
1042 +@@ -251,9 +314,8 @@ void setattr_copy(struct user_namespace *mnt_userns, struct inode *inode,
1043 + inode->i_ctime = attr->ia_ctime;
1044 + if (ia_valid & ATTR_MODE) {
1045 + umode_t mode = attr->ia_mode;
1046 +- vfsgid_t vfsgid = i_gid_into_vfsgid(mnt_userns, inode);
1047 +- if (!vfsgid_in_group_p(vfsgid) &&
1048 +- !capable_wrt_inode_uidgid(mnt_userns, inode, CAP_FSETID))
1049 ++ if (!in_group_or_capable(mnt_userns, inode,
1050 ++ i_gid_into_vfsgid(mnt_userns, inode)))
1051 + mode &= ~S_ISGID;
1052 + inode->i_mode = mode;
1053 + }
1054 +@@ -375,7 +437,7 @@ int notify_change(struct user_namespace *mnt_userns, struct dentry *dentry,
1055 + }
1056 + }
1057 + if (ia_valid & ATTR_KILL_SGID) {
1058 +- if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
1059 ++ if (mode & S_ISGID) {
1060 + if (!(ia_valid & ATTR_MODE)) {
1061 + ia_valid = attr->ia_valid |= ATTR_MODE;
1062 + attr->ia_mode = inode->i_mode;
1063 +diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
1064 +index 1c4b693ee4a3a..937b60ae576e0 100644
1065 +--- a/fs/btrfs/send.c
1066 ++++ b/fs/btrfs/send.c
1067 +@@ -7839,10 +7839,10 @@ long btrfs_ioctl_send(struct inode *inode, struct btrfs_ioctl_send_args *arg)
1068 + /*
1069 + * Check that we don't overflow at later allocations, we request
1070 + * clone_sources_count + 1 items, and compare to unsigned long inside
1071 +- * access_ok.
1072 ++ * access_ok. Also set an upper limit for allocation size so this can't
1073 ++ * easily exhaust memory. Max number of clone sources is about 200K.
1074 + */
1075 +- if (arg->clone_sources_count >
1076 +- ULONG_MAX / sizeof(struct clone_root) - 1) {
1077 ++ if (arg->clone_sources_count > SZ_8M / sizeof(struct clone_root)) {
1078 + ret = -EINVAL;
1079 + goto out;
1080 + }
1081 +diff --git a/fs/fuse/file.c b/fs/fuse/file.c
1082 +index 89f4741728ba3..c996c0ef8c632 100644
1083 +--- a/fs/fuse/file.c
1084 ++++ b/fs/fuse/file.c
1085 +@@ -1313,7 +1313,7 @@ static ssize_t fuse_cache_write_iter(struct kiocb *iocb, struct iov_iter *from)
1086 + return err;
1087 +
1088 + if (fc->handle_killpriv_v2 &&
1089 +- should_remove_suid(file_dentry(file))) {
1090 ++ setattr_should_drop_suidgid(&init_user_ns, file_inode(file))) {
1091 + goto writethrough;
1092 + }
1093 +
1094 +diff --git a/fs/inode.c b/fs/inode.c
1095 +index b608528efd3a4..8c4078889754f 100644
1096 +--- a/fs/inode.c
1097 ++++ b/fs/inode.c
1098 +@@ -1948,41 +1948,13 @@ skip_update:
1099 + }
1100 + EXPORT_SYMBOL(touch_atime);
1101 +
1102 +-/*
1103 +- * The logic we want is
1104 +- *
1105 +- * if suid or (sgid and xgrp)
1106 +- * remove privs
1107 +- */
1108 +-int should_remove_suid(struct dentry *dentry)
1109 +-{
1110 +- umode_t mode = d_inode(dentry)->i_mode;
1111 +- int kill = 0;
1112 +-
1113 +- /* suid always must be killed */
1114 +- if (unlikely(mode & S_ISUID))
1115 +- kill = ATTR_KILL_SUID;
1116 +-
1117 +- /*
1118 +- * sgid without any exec bits is just a mandatory locking mark; leave
1119 +- * it alone. If some exec bits are set, it's a real sgid; kill it.
1120 +- */
1121 +- if (unlikely((mode & S_ISGID) && (mode & S_IXGRP)))
1122 +- kill |= ATTR_KILL_SGID;
1123 +-
1124 +- if (unlikely(kill && !capable(CAP_FSETID) && S_ISREG(mode)))
1125 +- return kill;
1126 +-
1127 +- return 0;
1128 +-}
1129 +-EXPORT_SYMBOL(should_remove_suid);
1130 +-
1131 + /*
1132 + * Return mask of changes for notify_change() that need to be done as a
1133 + * response to write or truncate. Return 0 if nothing has to be changed.
1134 + * Negative value on error (change should be denied).
1135 + */
1136 +-int dentry_needs_remove_privs(struct dentry *dentry)
1137 ++int dentry_needs_remove_privs(struct user_namespace *mnt_userns,
1138 ++ struct dentry *dentry)
1139 + {
1140 + struct inode *inode = d_inode(dentry);
1141 + int mask = 0;
1142 +@@ -1991,7 +1963,7 @@ int dentry_needs_remove_privs(struct dentry *dentry)
1143 + if (IS_NOSEC(inode))
1144 + return 0;
1145 +
1146 +- mask = should_remove_suid(dentry);
1147 ++ mask = setattr_should_drop_suidgid(mnt_userns, inode);
1148 + ret = security_inode_need_killpriv(dentry);
1149 + if (ret < 0)
1150 + return ret;
1151 +@@ -2023,7 +1995,7 @@ static int __file_remove_privs(struct file *file, unsigned int flags)
1152 + if (IS_NOSEC(inode) || !S_ISREG(inode->i_mode))
1153 + return 0;
1154 +
1155 +- kill = dentry_needs_remove_privs(dentry);
1156 ++ kill = dentry_needs_remove_privs(file_mnt_user_ns(file), dentry);
1157 + if (kill < 0)
1158 + return kill;
1159 +
1160 +@@ -2487,6 +2459,28 @@ struct timespec64 current_time(struct inode *inode)
1161 + }
1162 + EXPORT_SYMBOL(current_time);
1163 +
1164 ++/**
1165 ++ * in_group_or_capable - check whether caller is CAP_FSETID privileged
1166 ++ * @mnt_userns: user namespace of the mount @inode was found from
1167 ++ * @inode: inode to check
1168 ++ * @vfsgid: the new/current vfsgid of @inode
1169 ++ *
1170 ++ * Check wether @vfsgid is in the caller's group list or if the caller is
1171 ++ * privileged with CAP_FSETID over @inode. This can be used to determine
1172 ++ * whether the setgid bit can be kept or must be dropped.
1173 ++ *
1174 ++ * Return: true if the caller is sufficiently privileged, false if not.
1175 ++ */
1176 ++bool in_group_or_capable(struct user_namespace *mnt_userns,
1177 ++ const struct inode *inode, vfsgid_t vfsgid)
1178 ++{
1179 ++ if (vfsgid_in_group_p(vfsgid))
1180 ++ return true;
1181 ++ if (capable_wrt_inode_uidgid(mnt_userns, inode, CAP_FSETID))
1182 ++ return true;
1183 ++ return false;
1184 ++}
1185 ++
1186 + /**
1187 + * mode_strip_sgid - handle the sgid bit for non-directories
1188 + * @mnt_userns: User namespace of the mount the inode was created from
1189 +@@ -2508,11 +2502,9 @@ umode_t mode_strip_sgid(struct user_namespace *mnt_userns,
1190 + return mode;
1191 + if (S_ISDIR(mode) || !dir || !(dir->i_mode & S_ISGID))
1192 + return mode;
1193 +- if (in_group_p(i_gid_into_mnt(mnt_userns, dir)))
1194 +- return mode;
1195 +- if (capable_wrt_inode_uidgid(mnt_userns, dir, CAP_FSETID))
1196 ++ if (in_group_or_capable(mnt_userns, dir,
1197 ++ i_gid_into_vfsgid(mnt_userns, dir)))
1198 + return mode;
1199 +-
1200 + return mode & ~S_ISGID;
1201 + }
1202 + EXPORT_SYMBOL(mode_strip_sgid);
1203 +diff --git a/fs/internal.h b/fs/internal.h
1204 +index 6f0386b34faec..5545c26d86ae5 100644
1205 +--- a/fs/internal.h
1206 ++++ b/fs/internal.h
1207 +@@ -150,7 +150,9 @@ extern int vfs_open(const struct path *, struct file *);
1208 + * inode.c
1209 + */
1210 + extern long prune_icache_sb(struct super_block *sb, struct shrink_control *sc);
1211 +-extern int dentry_needs_remove_privs(struct dentry *dentry);
1212 ++int dentry_needs_remove_privs(struct user_namespace *, struct dentry *dentry);
1213 ++bool in_group_or_capable(struct user_namespace *mnt_userns,
1214 ++ const struct inode *inode, vfsgid_t vfsgid);
1215 +
1216 + /*
1217 + * fs-writeback.c
1218 +@@ -234,3 +236,9 @@ int do_setxattr(struct user_namespace *mnt_userns, struct dentry *dentry,
1219 + struct xattr_ctx *ctx);
1220 +
1221 + ssize_t __kernel_write_iter(struct file *file, struct iov_iter *from, loff_t *pos);
1222 ++
1223 ++/*
1224 ++ * fs/attr.c
1225 ++ */
1226 ++int setattr_should_drop_sgid(struct user_namespace *mnt_userns,
1227 ++ const struct inode *inode);
1228 +diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
1229 +index 9c67edd215d5a..4d78e09795179 100644
1230 +--- a/fs/ocfs2/file.c
1231 ++++ b/fs/ocfs2/file.c
1232 +@@ -1991,7 +1991,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
1233 + }
1234 + }
1235 +
1236 +- if (file && should_remove_suid(file->f_path.dentry)) {
1237 ++ if (file && setattr_should_drop_suidgid(&init_user_ns, file_inode(file))) {
1238 + ret = __ocfs2_write_remove_suid(inode, di_bh);
1239 + if (ret) {
1240 + mlog_errno(ret);
1241 +@@ -2279,7 +2279,7 @@ static int ocfs2_prepare_inode_for_write(struct file *file,
1242 + * inode. There's also the dinode i_size state which
1243 + * can be lost via setattr during extending writes (we
1244 + * set inode->i_size at the end of a write. */
1245 +- if (should_remove_suid(dentry)) {
1246 ++ if (setattr_should_drop_suidgid(&init_user_ns, inode)) {
1247 + if (meta_level == 0) {
1248 + ocfs2_inode_unlock_for_extent_tree(inode,
1249 + &di_bh,
1250 +diff --git a/fs/open.c b/fs/open.c
1251 +index a81319b6177f6..9d0197db15e7b 100644
1252 +--- a/fs/open.c
1253 ++++ b/fs/open.c
1254 +@@ -54,7 +54,7 @@ int do_truncate(struct user_namespace *mnt_userns, struct dentry *dentry,
1255 + }
1256 +
1257 + /* Remove suid, sgid, and file capabilities on truncate too */
1258 +- ret = dentry_needs_remove_privs(dentry);
1259 ++ ret = dentry_needs_remove_privs(mnt_userns, dentry);
1260 + if (ret < 0)
1261 + return ret;
1262 + if (ret)
1263 +@@ -723,10 +723,10 @@ retry_deleg:
1264 + return -EINVAL;
1265 + if ((group != (gid_t)-1) && !setattr_vfsgid(&newattrs, gid))
1266 + return -EINVAL;
1267 +- if (!S_ISDIR(inode->i_mode))
1268 +- newattrs.ia_valid |=
1269 +- ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV;
1270 + inode_lock(inode);
1271 ++ if (!S_ISDIR(inode->i_mode))
1272 ++ newattrs.ia_valid |= ATTR_KILL_SUID | ATTR_KILL_PRIV |
1273 ++ setattr_should_drop_sgid(mnt_userns, inode);
1274 + /* Continue to send actual fs values, not the mount values. */
1275 + error = security_path_chown(
1276 + path,
1277 +diff --git a/include/linux/fs.h b/include/linux/fs.h
1278 +index 081d1f539628b..f14ecbeab2a9d 100644
1279 +--- a/include/linux/fs.h
1280 ++++ b/include/linux/fs.h
1281 +@@ -3118,7 +3118,7 @@ extern void __destroy_inode(struct inode *);
1282 + extern struct inode *new_inode_pseudo(struct super_block *sb);
1283 + extern struct inode *new_inode(struct super_block *sb);
1284 + extern void free_inode_nonrcu(struct inode *inode);
1285 +-extern int should_remove_suid(struct dentry *);
1286 ++extern int setattr_should_drop_suidgid(struct user_namespace *, struct inode *);
1287 + extern int file_remove_privs(struct file *);
1288 +
1289 + /*
1290 +@@ -3549,7 +3549,7 @@ int __init list_bdev_fs_names(char *buf, size_t size);
1291 +
1292 + static inline bool is_sxid(umode_t mode)
1293 + {
1294 +- return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
1295 ++ return mode & (S_ISUID | S_ISGID);
1296 + }
1297 +
1298 + static inline int check_sticky(struct user_namespace *mnt_userns,
1299 +diff --git a/kernel/power/process.c b/kernel/power/process.c
1300 +index ddd9988327fe2..beeab7f9fac86 100644
1301 +--- a/kernel/power/process.c
1302 ++++ b/kernel/power/process.c
1303 +@@ -27,6 +27,8 @@ unsigned int __read_mostly freeze_timeout_msecs = 20 * MSEC_PER_SEC;
1304 +
1305 + static int try_to_freeze_tasks(bool user_only)
1306 + {
1307 ++ const char *what = user_only ? "user space processes" :
1308 ++ "remaining freezable tasks";
1309 + struct task_struct *g, *p;
1310 + unsigned long end_time;
1311 + unsigned int todo;
1312 +@@ -36,6 +38,8 @@ static int try_to_freeze_tasks(bool user_only)
1313 + bool wakeup = false;
1314 + int sleep_usecs = USEC_PER_MSEC;
1315 +
1316 ++ pr_info("Freezing %s\n", what);
1317 ++
1318 + start = ktime_get_boottime();
1319 +
1320 + end_time = jiffies + msecs_to_jiffies(freeze_timeout_msecs);
1321 +@@ -82,7 +86,6 @@ static int try_to_freeze_tasks(bool user_only)
1322 + elapsed_msecs = ktime_to_ms(elapsed);
1323 +
1324 + if (todo) {
1325 +- pr_cont("\n");
1326 + pr_err("Freezing of tasks %s after %d.%03d seconds "
1327 + "(%d tasks refusing to freeze, wq_busy=%d):\n",
1328 + wakeup ? "aborted" : "failed",
1329 +@@ -101,8 +104,8 @@ static int try_to_freeze_tasks(bool user_only)
1330 + read_unlock(&tasklist_lock);
1331 + }
1332 + } else {
1333 +- pr_cont("(elapsed %d.%03d seconds) ", elapsed_msecs / 1000,
1334 +- elapsed_msecs % 1000);
1335 ++ pr_info("Freezing %s completed (elapsed %d.%03d seconds)\n",
1336 ++ what, elapsed_msecs / 1000, elapsed_msecs % 1000);
1337 + }
1338 +
1339 + return todo ? -EBUSY : 0;
1340 +@@ -130,14 +133,11 @@ int freeze_processes(void)
1341 + static_branch_inc(&freezer_active);
1342 +
1343 + pm_wakeup_clear(0);
1344 +- pr_info("Freezing user space processes ... ");
1345 + pm_freezing = true;
1346 + error = try_to_freeze_tasks(true);
1347 +- if (!error) {
1348 ++ if (!error)
1349 + __usermodehelper_set_disable_depth(UMH_DISABLED);
1350 +- pr_cont("done.");
1351 +- }
1352 +- pr_cont("\n");
1353 ++
1354 + BUG_ON(in_atomic());
1355 +
1356 + /*
1357 +@@ -166,14 +166,9 @@ int freeze_kernel_threads(void)
1358 + {
1359 + int error;
1360 +
1361 +- pr_info("Freezing remaining freezable tasks ... ");
1362 +-
1363 + pm_nosig_freezing = true;
1364 + error = try_to_freeze_tasks(false);
1365 +- if (!error)
1366 +- pr_cont("done.");
1367 +
1368 +- pr_cont("\n");
1369 + BUG_ON(in_atomic());
1370 +
1371 + if (error)
1372 +diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
1373 +index 748be72532485..78c9729a6057d 100644
1374 +--- a/net/caif/caif_socket.c
1375 ++++ b/net/caif/caif_socket.c
1376 +@@ -1015,6 +1015,7 @@ static void caif_sock_destructor(struct sock *sk)
1377 + return;
1378 + }
1379 + sk_stream_kill_queues(&cf_sk->sk);
1380 ++ WARN_ON_ONCE(sk->sk_forward_alloc);
1381 + caif_free_client(&cf_sk->layer);
1382 + }
1383 +
1384 +diff --git a/net/core/filter.c b/net/core/filter.c
1385 +index 0c2666e041d3c..b79a070fa8246 100644
1386 +--- a/net/core/filter.c
1387 ++++ b/net/core/filter.c
1388 +@@ -5807,7 +5807,7 @@ static int bpf_ipv4_fib_lookup(struct net *net, struct bpf_fib_lookup *params,
1389 + neigh = __ipv6_neigh_lookup_noref_stub(dev, dst);
1390 + }
1391 +
1392 +- if (!neigh)
1393 ++ if (!neigh || !(neigh->nud_state & NUD_VALID))
1394 + return BPF_FIB_LKUP_RET_NO_NEIGH;
1395 +
1396 + return bpf_fib_set_fwd_params(params, neigh, dev, mtu);
1397 +@@ -5922,7 +5922,7 @@ static int bpf_ipv6_fib_lookup(struct net *net, struct bpf_fib_lookup *params,
1398 + * not needed here.
1399 + */
1400 + neigh = __ipv6_neigh_lookup_noref_stub(dev, dst);
1401 +- if (!neigh)
1402 ++ if (!neigh || !(neigh->nud_state & NUD_VALID))
1403 + return BPF_FIB_LKUP_RET_NO_NEIGH;
1404 +
1405 + return bpf_fib_set_fwd_params(params, neigh, dev, mtu);
1406 +diff --git a/net/core/neighbour.c b/net/core/neighbour.c
1407 +index 952a54763358e..bf081f62ae58b 100644
1408 +--- a/net/core/neighbour.c
1409 ++++ b/net/core/neighbour.c
1410 +@@ -269,7 +269,7 @@ static int neigh_forced_gc(struct neigh_table *tbl)
1411 + (n->nud_state == NUD_NOARP) ||
1412 + (tbl->is_multicast &&
1413 + tbl->is_multicast(n->primary_key)) ||
1414 +- time_after(tref, n->updated))
1415 ++ !time_in_range(n->updated, tref, jiffies))
1416 + remove = true;
1417 + write_unlock(&n->lock);
1418 +
1419 +@@ -289,7 +289,17 @@ static int neigh_forced_gc(struct neigh_table *tbl)
1420 +
1421 + static void neigh_add_timer(struct neighbour *n, unsigned long when)
1422 + {
1423 ++ /* Use safe distance from the jiffies - LONG_MAX point while timer
1424 ++ * is running in DELAY/PROBE state but still show to user space
1425 ++ * large times in the past.
1426 ++ */
1427 ++ unsigned long mint = jiffies - (LONG_MAX - 86400 * HZ);
1428 ++
1429 + neigh_hold(n);
1430 ++ if (!time_in_range(n->confirmed, mint, jiffies))
1431 ++ n->confirmed = mint;
1432 ++ if (time_before(n->used, n->confirmed))
1433 ++ n->used = n->confirmed;
1434 + if (unlikely(mod_timer(&n->timer, when))) {
1435 + printk("NEIGH: BUG, double timer add, state is %x\n",
1436 + n->nud_state);
1437 +@@ -1001,12 +1011,14 @@ static void neigh_periodic_work(struct work_struct *work)
1438 + goto next_elt;
1439 + }
1440 +
1441 +- if (time_before(n->used, n->confirmed))
1442 ++ if (time_before(n->used, n->confirmed) &&
1443 ++ time_is_before_eq_jiffies(n->confirmed))
1444 + n->used = n->confirmed;
1445 +
1446 + if (refcount_read(&n->refcnt) == 1 &&
1447 + (state == NUD_FAILED ||
1448 +- time_after(jiffies, n->used + NEIGH_VAR(n->parms, GC_STALETIME)))) {
1449 ++ !time_in_range_open(jiffies, n->used,
1450 ++ n->used + NEIGH_VAR(n->parms, GC_STALETIME)))) {
1451 + *np = n->next;
1452 + neigh_mark_dead(n);
1453 + write_unlock(&n->lock);
1454 +diff --git a/net/core/stream.c b/net/core/stream.c
1455 +index 516895f482356..cbb268c15251c 100644
1456 +--- a/net/core/stream.c
1457 ++++ b/net/core/stream.c
1458 +@@ -209,7 +209,6 @@ void sk_stream_kill_queues(struct sock *sk)
1459 + sk_mem_reclaim_final(sk);
1460 +
1461 + WARN_ON_ONCE(sk->sk_wmem_queued);
1462 +- WARN_ON_ONCE(sk->sk_forward_alloc);
1463 +
1464 + /* It is _impossible_ for the backlog to contain anything
1465 + * when we get here. All user references to this socket
1466 +diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
1467 +index 5a67b120c4dbd..94a3609548b11 100644
1468 +--- a/net/xfrm/xfrm_interface.c
1469 ++++ b/net/xfrm/xfrm_interface.c
1470 +@@ -310,6 +310,52 @@ static void xfrmi_scrub_packet(struct sk_buff *skb, bool xnet)
1471 + skb->mark = 0;
1472 + }
1473 +
1474 ++static int xfrmi_input(struct sk_buff *skb, int nexthdr, __be32 spi,
1475 ++ int encap_type, unsigned short family)
1476 ++{
1477 ++ struct sec_path *sp;
1478 ++
1479 ++ sp = skb_sec_path(skb);
1480 ++ if (sp && (sp->len || sp->olen) &&
1481 ++ !xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family))
1482 ++ goto discard;
1483 ++
1484 ++ XFRM_SPI_SKB_CB(skb)->family = family;
1485 ++ if (family == AF_INET) {
1486 ++ XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr);
1487 ++ XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = NULL;
1488 ++ } else {
1489 ++ XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct ipv6hdr, daddr);
1490 ++ XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = NULL;
1491 ++ }
1492 ++
1493 ++ return xfrm_input(skb, nexthdr, spi, encap_type);
1494 ++discard:
1495 ++ kfree_skb(skb);
1496 ++ return 0;
1497 ++}
1498 ++
1499 ++static int xfrmi4_rcv(struct sk_buff *skb)
1500 ++{
1501 ++ return xfrmi_input(skb, ip_hdr(skb)->protocol, 0, 0, AF_INET);
1502 ++}
1503 ++
1504 ++static int xfrmi6_rcv(struct sk_buff *skb)
1505 ++{
1506 ++ return xfrmi_input(skb, skb_network_header(skb)[IP6CB(skb)->nhoff],
1507 ++ 0, 0, AF_INET6);
1508 ++}
1509 ++
1510 ++static int xfrmi4_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
1511 ++{
1512 ++ return xfrmi_input(skb, nexthdr, spi, encap_type, AF_INET);
1513 ++}
1514 ++
1515 ++static int xfrmi6_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
1516 ++{
1517 ++ return xfrmi_input(skb, nexthdr, spi, encap_type, AF_INET6);
1518 ++}
1519 ++
1520 + static int xfrmi_rcv_cb(struct sk_buff *skb, int err)
1521 + {
1522 + const struct xfrm_mode *inner_mode;
1523 +@@ -937,8 +983,8 @@ static struct pernet_operations xfrmi_net_ops = {
1524 + };
1525 +
1526 + static struct xfrm6_protocol xfrmi_esp6_protocol __read_mostly = {
1527 +- .handler = xfrm6_rcv,
1528 +- .input_handler = xfrm_input,
1529 ++ .handler = xfrmi6_rcv,
1530 ++ .input_handler = xfrmi6_input,
1531 + .cb_handler = xfrmi_rcv_cb,
1532 + .err_handler = xfrmi6_err,
1533 + .priority = 10,
1534 +@@ -988,8 +1034,8 @@ static struct xfrm6_tunnel xfrmi_ip6ip_handler __read_mostly = {
1535 + #endif
1536 +
1537 + static struct xfrm4_protocol xfrmi_esp4_protocol __read_mostly = {
1538 +- .handler = xfrm4_rcv,
1539 +- .input_handler = xfrm_input,
1540 ++ .handler = xfrmi4_rcv,
1541 ++ .input_handler = xfrmi4_input,
1542 + .cb_handler = xfrmi_rcv_cb,
1543 + .err_handler = xfrmi4_err,
1544 + .priority = 10,
1545 +diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
1546 +index 52538d5360673..7f49dab3b6b59 100644
1547 +--- a/net/xfrm/xfrm_policy.c
1548 ++++ b/net/xfrm/xfrm_policy.c
1549 +@@ -3670,6 +3670,9 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb,
1550 + goto reject;
1551 + }
1552 +
1553 ++ if (if_id)
1554 ++ secpath_reset(skb);
1555 ++
1556 + xfrm_pols_put(pols, npols);
1557 + return 1;
1558 + }
1559 +diff --git a/scripts/tags.sh b/scripts/tags.sh
1560 +index e137cf15aae9d..0d045182c08c0 100755
1561 +--- a/scripts/tags.sh
1562 ++++ b/scripts/tags.sh
1563 +@@ -91,7 +91,7 @@ all_compiled_sources()
1564 + {
1565 + echo include/generated/autoconf.h
1566 + find $ignore -name "*.cmd" -exec \
1567 +- grep -Poh '(?(?=^source_.* \K).*|(?=^ \K\S).*(?= \\))' {} \+ |
1568 ++ sed -n -E 's/^source_.* (.*)/\1/p; s/^ (\S.*) \\/\1/p' {} \+ |
1569 + awk '!a[$0]++'
1570 + } | xargs realpath -esq $([ -z "$KBUILD_ABS_SRCTREE" ] && echo --relative-to=.) |
1571 + sort -u
1572 +diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
1573 +index 87c1cc16592bb..555125efd9ad3 100644
1574 +--- a/sound/soc/codecs/es8326.c
1575 ++++ b/sound/soc/codecs/es8326.c
1576 +@@ -729,14 +729,16 @@ static int es8326_probe(struct snd_soc_component *component)
1577 + }
1578 + dev_dbg(component->dev, "jack-pol %x", es8326->jack_pol);
1579 +
1580 +- ret = device_property_read_u8(component->dev, "everest,interrupt-src", &es8326->jack_pol);
1581 ++ ret = device_property_read_u8(component->dev, "everest,interrupt-src",
1582 ++ &es8326->interrupt_src);
1583 + if (ret != 0) {
1584 + dev_dbg(component->dev, "interrupt-src return %d", ret);
1585 + es8326->interrupt_src = ES8326_HP_DET_SRC_PIN9;
1586 + }
1587 + dev_dbg(component->dev, "interrupt-src %x", es8326->interrupt_src);
1588 +
1589 +- ret = device_property_read_u8(component->dev, "everest,interrupt-clk", &es8326->jack_pol);
1590 ++ ret = device_property_read_u8(component->dev, "everest,interrupt-clk",
1591 ++ &es8326->interrupt_clk);
1592 + if (ret != 0) {
1593 + dev_dbg(component->dev, "interrupt-clk return %d", ret);
1594 + es8326->interrupt_clk = 0x45;
1595 +diff --git a/sound/soc/codecs/rt715-sdca-sdw.c b/sound/soc/codecs/rt715-sdca-sdw.c
1596 +index 3f981a9e7fb67..c54ecf3e69879 100644
1597 +--- a/sound/soc/codecs/rt715-sdca-sdw.c
1598 ++++ b/sound/soc/codecs/rt715-sdca-sdw.c
1599 +@@ -167,7 +167,7 @@ static int rt715_sdca_read_prop(struct sdw_slave *slave)
1600 + }
1601 +
1602 + /* set the timeout values */
1603 +- prop->clk_stop_timeout = 20;
1604 ++ prop->clk_stop_timeout = 200;
1605 +
1606 + return 0;
1607 + }
1608 +diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c
1609 +index 36966643e36ab..8afd67ba1e5a3 100644
1610 +--- a/sound/soc/sof/amd/acp.c
1611 ++++ b/sound/soc/sof/amd/acp.c
1612 +@@ -316,7 +316,6 @@ static irqreturn_t acp_irq_thread(int irq, void *context)
1613 + {
1614 + struct snd_sof_dev *sdev = context;
1615 + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata);
1616 +- unsigned int base = desc->dsp_intr_base;
1617 + unsigned int val, count = ACP_HW_SEM_RETRY_COUNT;
1618 +
1619 + val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->ext_intr_stat);
1620 +@@ -326,28 +325,20 @@ static irqreturn_t acp_irq_thread(int irq, void *context)
1621 + return IRQ_HANDLED;
1622 + }
1623 +
1624 +- val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, base + DSP_SW_INTR_STAT_OFFSET);
1625 +- if (val & ACP_DSP_TO_HOST_IRQ) {
1626 +- while (snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->hw_semaphore_offset)) {
1627 +- /* Wait until acquired HW Semaphore lock or timeout */
1628 +- count--;
1629 +- if (!count) {
1630 +- dev_err(sdev->dev, "%s: Failed to acquire HW lock\n", __func__);
1631 +- return IRQ_NONE;
1632 +- }
1633 ++ while (snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->hw_semaphore_offset)) {
1634 ++ /* Wait until acquired HW Semaphore lock or timeout */
1635 ++ count--;
1636 ++ if (!count) {
1637 ++ dev_err(sdev->dev, "%s: Failed to acquire HW lock\n", __func__);
1638 ++ return IRQ_NONE;
1639 + }
1640 +-
1641 +- sof_ops(sdev)->irq_thread(irq, sdev);
1642 +- val |= ACP_DSP_TO_HOST_IRQ;
1643 +- snd_sof_dsp_write(sdev, ACP_DSP_BAR, base + DSP_SW_INTR_STAT_OFFSET, val);
1644 +-
1645 +- /* Unlock or Release HW Semaphore */
1646 +- snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->hw_semaphore_offset, 0x0);
1647 +-
1648 +- return IRQ_HANDLED;
1649 + }
1650 +
1651 +- return IRQ_NONE;
1652 ++ sof_ops(sdev)->irq_thread(irq, sdev);
1653 ++ /* Unlock or Release HW Semaphore */
1654 ++ snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->hw_semaphore_offset, 0x0);
1655 ++
1656 ++ return IRQ_HANDLED;
1657 + };
1658 +
1659 + static irqreturn_t acp_irq_handler(int irq, void *dev_id)
1660 +@@ -358,8 +349,11 @@ static irqreturn_t acp_irq_handler(int irq, void *dev_id)
1661 + unsigned int val;
1662 +
1663 + val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, base + DSP_SW_INTR_STAT_OFFSET);
1664 +- if (val)
1665 ++ if (val) {
1666 ++ val |= ACP_DSP_TO_HOST_IRQ;
1667 ++ snd_sof_dsp_write(sdev, ACP_DSP_BAR, base + DSP_SW_INTR_STAT_OFFSET, val);
1668 + return IRQ_WAKE_THREAD;
1669 ++ }
1670 +
1671 + return IRQ_NONE;
1672 + }
1673 +diff --git a/tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh b/tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh
1674 +index 9c79bbcce5a87..aff0a59f92d9a 100755
1675 +--- a/tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh
1676 ++++ b/tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh
1677 +@@ -246,7 +246,7 @@ test_vlan_ingress_modify()
1678 + bridge vlan add dev $swp2 vid 300
1679 +
1680 + tc filter add dev $swp1 ingress chain $(IS1 2) pref 3 \
1681 +- protocol 802.1Q flower skip_sw vlan_id 200 \
1682 ++ protocol 802.1Q flower skip_sw vlan_id 200 src_mac $h1_mac \
1683 + action vlan modify id 300 \
1684 + action goto chain $(IS2 0 0)
1685 +