1 |
commit: 50b5973dba7e280fdff49b75c5e01b25f78ec68e |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jan 16 23:33:48 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 16 23:33:48 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=50b5973d |
7 |
|
8 |
proj/linux-patches: Linux patch 4.20.3 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1002_linux-4.20.3.patch | 1927 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 1931 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 0e0dc28..d6c119a 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -51,6 +51,10 @@ Patch: 1001_linux-4.20.2.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.20.2 |
23 |
|
24 |
+Patch: 1002_linux-4.20.3.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.20.3 |
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/1002_linux-4.20.3.patch b/1002_linux-4.20.3.patch |
33 |
new file mode 100644 |
34 |
index 0000000..268cb43 |
35 |
--- /dev/null |
36 |
+++ b/1002_linux-4.20.3.patch |
37 |
@@ -0,0 +1,1927 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 4ba3dd0bf35d..3b9e4658d31f 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 4 |
45 |
+ PATCHLEVEL = 20 |
46 |
+-SUBLEVEL = 2 |
47 |
++SUBLEVEL = 3 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Shy Crocodile |
50 |
+ |
51 |
+diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c |
52 |
+index 7d8ab36ff83d..b3a3f5a59b5c 100644 |
53 |
+--- a/arch/arm/mach-davinci/board-da830-evm.c |
54 |
++++ b/arch/arm/mach-davinci/board-da830-evm.c |
55 |
+@@ -207,9 +207,9 @@ static struct gpiod_lookup_table mmc_gpios_table = { |
56 |
+ .dev_id = "da830-mmc.0", |
57 |
+ .table = { |
58 |
+ /* gpio chip 1 contains gpio range 32-63 */ |
59 |
+- GPIO_LOOKUP("davinci_gpio.0", DA830_MMCSD_CD_PIN, "cd", |
60 |
++ GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_CD_PIN, "cd", |
61 |
+ GPIO_ACTIVE_LOW), |
62 |
+- GPIO_LOOKUP("davinci_gpio.0", DA830_MMCSD_WP_PIN, "wp", |
63 |
++ GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_WP_PIN, "wp", |
64 |
+ GPIO_ACTIVE_LOW), |
65 |
+ }, |
66 |
+ }; |
67 |
+diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c |
68 |
+index e1a949b47306..bf2549e1894b 100644 |
69 |
+--- a/arch/arm/mach-davinci/board-da850-evm.c |
70 |
++++ b/arch/arm/mach-davinci/board-da850-evm.c |
71 |
+@@ -780,9 +780,9 @@ static struct gpiod_lookup_table mmc_gpios_table = { |
72 |
+ .dev_id = "da830-mmc.0", |
73 |
+ .table = { |
74 |
+ /* gpio chip 2 contains gpio range 64-95 */ |
75 |
+- GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_CD_PIN, "cd", |
76 |
++ GPIO_LOOKUP("davinci_gpio", DA850_MMCSD_CD_PIN, "cd", |
77 |
+ GPIO_ACTIVE_LOW), |
78 |
+- GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_WP_PIN, "wp", |
79 |
++ GPIO_LOOKUP("davinci_gpio", DA850_MMCSD_WP_PIN, "wp", |
80 |
+ GPIO_ACTIVE_HIGH), |
81 |
+ }, |
82 |
+ }; |
83 |
+diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c |
84 |
+index f53a461a606f..f7fa960c23e3 100644 |
85 |
+--- a/arch/arm/mach-davinci/board-dm355-evm.c |
86 |
++++ b/arch/arm/mach-davinci/board-dm355-evm.c |
87 |
+@@ -117,9 +117,9 @@ static struct platform_device davinci_nand_device = { |
88 |
+ static struct gpiod_lookup_table i2c_recovery_gpiod_table = { |
89 |
+ .dev_id = "i2c_davinci.1", |
90 |
+ .table = { |
91 |
+- GPIO_LOOKUP("davinci_gpio.0", DM355_I2C_SDA_PIN, "sda", |
92 |
++ GPIO_LOOKUP("davinci_gpio", DM355_I2C_SDA_PIN, "sda", |
93 |
+ GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
94 |
+- GPIO_LOOKUP("davinci_gpio.0", DM355_I2C_SCL_PIN, "scl", |
95 |
++ GPIO_LOOKUP("davinci_gpio", DM355_I2C_SCL_PIN, "scl", |
96 |
+ GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
97 |
+ }, |
98 |
+ }; |
99 |
+diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c |
100 |
+index e4a8f9225d16..f752d828e42f 100644 |
101 |
+--- a/arch/arm/mach-davinci/board-dm644x-evm.c |
102 |
++++ b/arch/arm/mach-davinci/board-dm644x-evm.c |
103 |
+@@ -638,9 +638,9 @@ static struct i2c_board_info __initdata i2c_info[] = { |
104 |
+ static struct gpiod_lookup_table i2c_recovery_gpiod_table = { |
105 |
+ .dev_id = "i2c_davinci.1", |
106 |
+ .table = { |
107 |
+- GPIO_LOOKUP("davinci_gpio.0", DM644X_I2C_SDA_PIN, "sda", |
108 |
++ GPIO_LOOKUP("davinci_gpio", DM644X_I2C_SDA_PIN, "sda", |
109 |
+ GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
110 |
+- GPIO_LOOKUP("davinci_gpio.0", DM644X_I2C_SCL_PIN, "scl", |
111 |
++ GPIO_LOOKUP("davinci_gpio", DM644X_I2C_SCL_PIN, "scl", |
112 |
+ GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
113 |
+ }, |
114 |
+ }; |
115 |
+diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c |
116 |
+index 8e8d51f4a276..94c4f126ef86 100644 |
117 |
+--- a/arch/arm/mach-davinci/board-omapl138-hawk.c |
118 |
++++ b/arch/arm/mach-davinci/board-omapl138-hawk.c |
119 |
+@@ -134,9 +134,9 @@ static const short hawk_mmcsd0_pins[] = { |
120 |
+ static struct gpiod_lookup_table mmc_gpios_table = { |
121 |
+ .dev_id = "da830-mmc.0", |
122 |
+ .table = { |
123 |
+- GPIO_LOOKUP("davinci_gpio.0", DA850_HAWK_MMCSD_CD_PIN, "cd", |
124 |
++ GPIO_LOOKUP("davinci_gpio", DA850_HAWK_MMCSD_CD_PIN, "cd", |
125 |
+ GPIO_ACTIVE_LOW), |
126 |
+- GPIO_LOOKUP("davinci_gpio.0", DA850_HAWK_MMCSD_WP_PIN, "wp", |
127 |
++ GPIO_LOOKUP("davinci_gpio", DA850_HAWK_MMCSD_WP_PIN, "wp", |
128 |
+ GPIO_ACTIVE_LOW), |
129 |
+ }, |
130 |
+ }; |
131 |
+diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c |
132 |
+index fd59fef9931b..1355fab5f676 100644 |
133 |
+--- a/arch/powerpc/kernel/signal_32.c |
134 |
++++ b/arch/powerpc/kernel/signal_32.c |
135 |
+@@ -1158,11 +1158,11 @@ SYSCALL_DEFINE0(rt_sigreturn) |
136 |
+ { |
137 |
+ struct rt_sigframe __user *rt_sf; |
138 |
+ struct pt_regs *regs = current_pt_regs(); |
139 |
++ int tm_restore = 0; |
140 |
+ #ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
141 |
+ struct ucontext __user *uc_transact; |
142 |
+ unsigned long msr_hi; |
143 |
+ unsigned long tmp; |
144 |
+- int tm_restore = 0; |
145 |
+ #endif |
146 |
+ /* Always make any pending restarted system calls return -EINTR */ |
147 |
+ current->restart_block.fn = do_no_restart_syscall; |
148 |
+@@ -1210,11 +1210,19 @@ SYSCALL_DEFINE0(rt_sigreturn) |
149 |
+ goto bad; |
150 |
+ } |
151 |
+ } |
152 |
+- if (!tm_restore) |
153 |
+- /* Fall through, for non-TM restore */ |
154 |
++ if (!tm_restore) { |
155 |
++ /* |
156 |
++ * Unset regs->msr because ucontext MSR TS is not |
157 |
++ * set, and recheckpoint was not called. This avoid |
158 |
++ * hitting a TM Bad thing at RFID |
159 |
++ */ |
160 |
++ regs->msr &= ~MSR_TS_MASK; |
161 |
++ } |
162 |
++ /* Fall through, for non-TM restore */ |
163 |
+ #endif |
164 |
+- if (do_setcontext(&rt_sf->uc, regs, 1)) |
165 |
+- goto bad; |
166 |
++ if (!tm_restore) |
167 |
++ if (do_setcontext(&rt_sf->uc, regs, 1)) |
168 |
++ goto bad; |
169 |
+ |
170 |
+ /* |
171 |
+ * It's not clear whether or why it is desirable to save the |
172 |
+diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c |
173 |
+index bbd1c73243d7..6f70d1b4bf36 100644 |
174 |
+--- a/arch/powerpc/kernel/signal_64.c |
175 |
++++ b/arch/powerpc/kernel/signal_64.c |
176 |
+@@ -756,11 +756,23 @@ SYSCALL_DEFINE0(rt_sigreturn) |
177 |
+ &uc_transact->uc_mcontext)) |
178 |
+ goto badframe; |
179 |
+ } |
180 |
+- else |
181 |
+- /* Fall through, for non-TM restore */ |
182 |
+ #endif |
183 |
+- if (restore_sigcontext(current, NULL, 1, &uc->uc_mcontext)) |
184 |
+- goto badframe; |
185 |
++ /* Fall through, for non-TM restore */ |
186 |
++ if (!MSR_TM_ACTIVE(msr)) { |
187 |
++ /* |
188 |
++ * Unset MSR[TS] on the thread regs since MSR from user |
189 |
++ * context does not have MSR active, and recheckpoint was |
190 |
++ * not called since restore_tm_sigcontexts() was not called |
191 |
++ * also. |
192 |
++ * |
193 |
++ * If not unsetting it, the code can RFID to userspace with |
194 |
++ * MSR[TS] set, but without CPU in the proper state, |
195 |
++ * causing a TM bad thing. |
196 |
++ */ |
197 |
++ current->thread.regs->msr &= ~MSR_TS_MASK; |
198 |
++ if (restore_sigcontext(current, NULL, 1, &uc->uc_mcontext)) |
199 |
++ goto badframe; |
200 |
++ } |
201 |
+ |
202 |
+ if (restore_altstack(&uc->uc_stack)) |
203 |
+ goto badframe; |
204 |
+diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c |
205 |
+index 362f3cde6a31..7b135796813f 100644 |
206 |
+--- a/arch/x86/kernel/cpu/bugs.c |
207 |
++++ b/arch/x86/kernel/cpu/bugs.c |
208 |
+@@ -213,7 +213,7 @@ static enum spectre_v2_mitigation spectre_v2_enabled __ro_after_init = |
209 |
+ static enum spectre_v2_user_mitigation spectre_v2_user __ro_after_init = |
210 |
+ SPECTRE_V2_USER_NONE; |
211 |
+ |
212 |
+-#ifdef RETPOLINE |
213 |
++#ifdef CONFIG_RETPOLINE |
214 |
+ static bool spectre_v2_bad_module; |
215 |
+ |
216 |
+ bool retpoline_module_ok(bool has_retpoline) |
217 |
+diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c |
218 |
+index 70f4e80b9246..a1a22e9c0328 100644 |
219 |
+--- a/drivers/acpi/arm64/iort.c |
220 |
++++ b/drivers/acpi/arm64/iort.c |
221 |
+@@ -951,9 +951,10 @@ static int rc_dma_get_range(struct device *dev, u64 *size) |
222 |
+ { |
223 |
+ struct acpi_iort_node *node; |
224 |
+ struct acpi_iort_root_complex *rc; |
225 |
++ struct pci_bus *pbus = to_pci_dev(dev)->bus; |
226 |
+ |
227 |
+ node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX, |
228 |
+- iort_match_node_callback, dev); |
229 |
++ iort_match_node_callback, &pbus->dev); |
230 |
+ if (!node || node->revision < 1) |
231 |
+ return -ENODEV; |
232 |
+ |
233 |
+diff --git a/drivers/acpi/pmic/intel_pmic_xpower.c b/drivers/acpi/pmic/intel_pmic_xpower.c |
234 |
+index 2579675b7082..e7c0006e6602 100644 |
235 |
+--- a/drivers/acpi/pmic/intel_pmic_xpower.c |
236 |
++++ b/drivers/acpi/pmic/intel_pmic_xpower.c |
237 |
+@@ -20,8 +20,11 @@ |
238 |
+ #define GPI1_LDO_ON (3 << 0) |
239 |
+ #define GPI1_LDO_OFF (4 << 0) |
240 |
+ |
241 |
+-#define AXP288_ADC_TS_PIN_GPADC 0xf2 |
242 |
+-#define AXP288_ADC_TS_PIN_ON 0xf3 |
243 |
++#define AXP288_ADC_TS_CURRENT_ON_OFF_MASK GENMASK(1, 0) |
244 |
++#define AXP288_ADC_TS_CURRENT_OFF (0 << 0) |
245 |
++#define AXP288_ADC_TS_CURRENT_ON_WHEN_CHARGING (1 << 0) |
246 |
++#define AXP288_ADC_TS_CURRENT_ON_ONDEMAND (2 << 0) |
247 |
++#define AXP288_ADC_TS_CURRENT_ON (3 << 0) |
248 |
+ |
249 |
+ static struct pmic_table power_table[] = { |
250 |
+ { |
251 |
+@@ -212,22 +215,44 @@ out: |
252 |
+ */ |
253 |
+ static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg) |
254 |
+ { |
255 |
++ int ret, adc_ts_pin_ctrl; |
256 |
+ u8 buf[2]; |
257 |
+- int ret; |
258 |
+ |
259 |
+- ret = regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, |
260 |
+- AXP288_ADC_TS_PIN_GPADC); |
261 |
++ /* |
262 |
++ * The current-source used for the battery temp-sensor (TS) is shared |
263 |
++ * with the GPADC. For proper fuel-gauge and charger operation the TS |
264 |
++ * current-source needs to be permanently on. But to read the GPADC we |
265 |
++ * need to temporary switch the TS current-source to ondemand, so that |
266 |
++ * the GPADC can use it, otherwise we will always read an all 0 value. |
267 |
++ * |
268 |
++ * Note that the switching from on to on-ondemand is not necessary |
269 |
++ * when the TS current-source is off (this happens on devices which |
270 |
++ * do not use the TS-pin). |
271 |
++ */ |
272 |
++ ret = regmap_read(regmap, AXP288_ADC_TS_PIN_CTRL, &adc_ts_pin_ctrl); |
273 |
+ if (ret) |
274 |
+ return ret; |
275 |
+ |
276 |
+- /* After switching to the GPADC pin give things some time to settle */ |
277 |
+- usleep_range(6000, 10000); |
278 |
++ if (adc_ts_pin_ctrl & AXP288_ADC_TS_CURRENT_ON_OFF_MASK) { |
279 |
++ ret = regmap_update_bits(regmap, AXP288_ADC_TS_PIN_CTRL, |
280 |
++ AXP288_ADC_TS_CURRENT_ON_OFF_MASK, |
281 |
++ AXP288_ADC_TS_CURRENT_ON_ONDEMAND); |
282 |
++ if (ret) |
283 |
++ return ret; |
284 |
++ |
285 |
++ /* Wait a bit after switching the current-source */ |
286 |
++ usleep_range(6000, 10000); |
287 |
++ } |
288 |
+ |
289 |
+ ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, 2); |
290 |
+ if (ret == 0) |
291 |
+ ret = (buf[0] << 4) + ((buf[1] >> 4) & 0x0f); |
292 |
+ |
293 |
+- regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, AXP288_ADC_TS_PIN_ON); |
294 |
++ if (adc_ts_pin_ctrl & AXP288_ADC_TS_CURRENT_ON_OFF_MASK) { |
295 |
++ regmap_update_bits(regmap, AXP288_ADC_TS_PIN_CTRL, |
296 |
++ AXP288_ADC_TS_CURRENT_ON_OFF_MASK, |
297 |
++ AXP288_ADC_TS_CURRENT_ON); |
298 |
++ } |
299 |
+ |
300 |
+ return ret; |
301 |
+ } |
302 |
+diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c |
303 |
+index 1b475bc1ae16..665e93ca0b40 100644 |
304 |
+--- a/drivers/acpi/power.c |
305 |
++++ b/drivers/acpi/power.c |
306 |
+@@ -131,6 +131,23 @@ void acpi_power_resources_list_free(struct list_head *list) |
307 |
+ } |
308 |
+ } |
309 |
+ |
310 |
++static bool acpi_power_resource_is_dup(union acpi_object *package, |
311 |
++ unsigned int start, unsigned int i) |
312 |
++{ |
313 |
++ acpi_handle rhandle, dup; |
314 |
++ unsigned int j; |
315 |
++ |
316 |
++ /* The caller is expected to check the package element types */ |
317 |
++ rhandle = package->package.elements[i].reference.handle; |
318 |
++ for (j = start; j < i; j++) { |
319 |
++ dup = package->package.elements[j].reference.handle; |
320 |
++ if (dup == rhandle) |
321 |
++ return true; |
322 |
++ } |
323 |
++ |
324 |
++ return false; |
325 |
++} |
326 |
++ |
327 |
+ int acpi_extract_power_resources(union acpi_object *package, unsigned int start, |
328 |
+ struct list_head *list) |
329 |
+ { |
330 |
+@@ -150,6 +167,11 @@ int acpi_extract_power_resources(union acpi_object *package, unsigned int start, |
331 |
+ err = -ENODEV; |
332 |
+ break; |
333 |
+ } |
334 |
++ |
335 |
++ /* Some ACPI tables contain duplicate power resource references */ |
336 |
++ if (acpi_power_resource_is_dup(package, start, i)) |
337 |
++ continue; |
338 |
++ |
339 |
+ err = acpi_add_power_resource(rhandle); |
340 |
+ if (err) |
341 |
+ break; |
342 |
+diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c |
343 |
+index 8e5140bbf241..1e92b61d0bd5 100644 |
344 |
+--- a/drivers/block/rbd.c |
345 |
++++ b/drivers/block/rbd.c |
346 |
+@@ -5986,7 +5986,6 @@ static ssize_t do_rbd_remove(struct bus_type *bus, |
347 |
+ struct list_head *tmp; |
348 |
+ int dev_id; |
349 |
+ char opt_buf[6]; |
350 |
+- bool already = false; |
351 |
+ bool force = false; |
352 |
+ int ret; |
353 |
+ |
354 |
+@@ -6019,13 +6018,13 @@ static ssize_t do_rbd_remove(struct bus_type *bus, |
355 |
+ spin_lock_irq(&rbd_dev->lock); |
356 |
+ if (rbd_dev->open_count && !force) |
357 |
+ ret = -EBUSY; |
358 |
+- else |
359 |
+- already = test_and_set_bit(RBD_DEV_FLAG_REMOVING, |
360 |
+- &rbd_dev->flags); |
361 |
++ else if (test_and_set_bit(RBD_DEV_FLAG_REMOVING, |
362 |
++ &rbd_dev->flags)) |
363 |
++ ret = -EINPROGRESS; |
364 |
+ spin_unlock_irq(&rbd_dev->lock); |
365 |
+ } |
366 |
+ spin_unlock(&rbd_dev_list_lock); |
367 |
+- if (ret < 0 || already) |
368 |
++ if (ret) |
369 |
+ return ret; |
370 |
+ |
371 |
+ if (force) { |
372 |
+diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c |
373 |
+index 50b1551ba894..242c3370544e 100644 |
374 |
+--- a/drivers/cpufreq/scmi-cpufreq.c |
375 |
++++ b/drivers/cpufreq/scmi-cpufreq.c |
376 |
+@@ -52,9 +52,9 @@ scmi_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index) |
377 |
+ int ret; |
378 |
+ struct scmi_data *priv = policy->driver_data; |
379 |
+ struct scmi_perf_ops *perf_ops = handle->perf_ops; |
380 |
+- u64 freq = policy->freq_table[index].frequency * 1000; |
381 |
++ u64 freq = policy->freq_table[index].frequency; |
382 |
+ |
383 |
+- ret = perf_ops->freq_set(handle, priv->domain_id, freq, false); |
384 |
++ ret = perf_ops->freq_set(handle, priv->domain_id, freq * 1000, false); |
385 |
+ if (!ret) |
386 |
+ arch_set_freq_scale(policy->related_cpus, freq, |
387 |
+ policy->cpuinfo.max_freq); |
388 |
+@@ -176,7 +176,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) |
389 |
+ out_free_priv: |
390 |
+ kfree(priv); |
391 |
+ out_free_opp: |
392 |
+- dev_pm_opp_cpumask_remove_table(policy->cpus); |
393 |
++ dev_pm_opp_remove_all_dynamic(cpu_dev); |
394 |
+ |
395 |
+ return ret; |
396 |
+ } |
397 |
+@@ -188,7 +188,7 @@ static int scmi_cpufreq_exit(struct cpufreq_policy *policy) |
398 |
+ cpufreq_cooling_unregister(priv->cdev); |
399 |
+ dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); |
400 |
+ kfree(priv); |
401 |
+- dev_pm_opp_cpumask_remove_table(policy->related_cpus); |
402 |
++ dev_pm_opp_remove_all_dynamic(priv->cpu_dev); |
403 |
+ |
404 |
+ return 0; |
405 |
+ } |
406 |
+diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c |
407 |
+index 87a98ec77773..99449738faa4 100644 |
408 |
+--- a/drivers/cpufreq/scpi-cpufreq.c |
409 |
++++ b/drivers/cpufreq/scpi-cpufreq.c |
410 |
+@@ -177,7 +177,7 @@ out_free_cpufreq_table: |
411 |
+ out_free_priv: |
412 |
+ kfree(priv); |
413 |
+ out_free_opp: |
414 |
+- dev_pm_opp_cpumask_remove_table(policy->cpus); |
415 |
++ dev_pm_opp_remove_all_dynamic(cpu_dev); |
416 |
+ |
417 |
+ return ret; |
418 |
+ } |
419 |
+@@ -190,7 +190,7 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy) |
420 |
+ clk_put(priv->clk); |
421 |
+ dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); |
422 |
+ kfree(priv); |
423 |
+- dev_pm_opp_cpumask_remove_table(policy->related_cpus); |
424 |
++ dev_pm_opp_remove_all_dynamic(priv->cpu_dev); |
425 |
+ |
426 |
+ return 0; |
427 |
+ } |
428 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |
429 |
+index 74b611e8a1b1..c79517dc8804 100644 |
430 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |
431 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |
432 |
+@@ -864,6 +864,7 @@ static const struct pci_device_id pciidlist[] = { |
433 |
+ /* VEGAM */ |
434 |
+ {0x1002, 0x694C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGAM}, |
435 |
+ {0x1002, 0x694E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGAM}, |
436 |
++ {0x1002, 0x694F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGAM}, |
437 |
+ /* Vega 10 */ |
438 |
+ {0x1002, 0x6860, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, |
439 |
+ {0x1002, 0x6861, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, |
440 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
441 |
+index 5a6edf65c9ea..3118ae0e7a87 100644 |
442 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
443 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
444 |
+@@ -645,22 +645,36 @@ static void s3_handle_mst(struct drm_device *dev, bool suspend) |
445 |
+ { |
446 |
+ struct amdgpu_dm_connector *aconnector; |
447 |
+ struct drm_connector *connector; |
448 |
++ struct drm_dp_mst_topology_mgr *mgr; |
449 |
++ int ret; |
450 |
++ bool need_hotplug = false; |
451 |
+ |
452 |
+ drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); |
453 |
+ |
454 |
+- list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
455 |
+- aconnector = to_amdgpu_dm_connector(connector); |
456 |
+- if (aconnector->dc_link->type == dc_connection_mst_branch && |
457 |
+- !aconnector->mst_port) { |
458 |
++ list_for_each_entry(connector, &dev->mode_config.connector_list, |
459 |
++ head) { |
460 |
++ aconnector = to_amdgpu_dm_connector(connector); |
461 |
++ if (aconnector->dc_link->type != dc_connection_mst_branch || |
462 |
++ aconnector->mst_port) |
463 |
++ continue; |
464 |
+ |
465 |
+- if (suspend) |
466 |
+- drm_dp_mst_topology_mgr_suspend(&aconnector->mst_mgr); |
467 |
+- else |
468 |
+- drm_dp_mst_topology_mgr_resume(&aconnector->mst_mgr); |
469 |
+- } |
470 |
++ mgr = &aconnector->mst_mgr; |
471 |
++ |
472 |
++ if (suspend) { |
473 |
++ drm_dp_mst_topology_mgr_suspend(mgr); |
474 |
++ } else { |
475 |
++ ret = drm_dp_mst_topology_mgr_resume(mgr); |
476 |
++ if (ret < 0) { |
477 |
++ drm_dp_mst_topology_mgr_set_mst(mgr, false); |
478 |
++ need_hotplug = true; |
479 |
++ } |
480 |
++ } |
481 |
+ } |
482 |
+ |
483 |
+ drm_modeset_unlock(&dev->mode_config.connection_mutex); |
484 |
++ |
485 |
++ if (need_hotplug) |
486 |
++ drm_kms_helper_hotplug_event(dev); |
487 |
+ } |
488 |
+ |
489 |
+ static int dm_hw_init(void *handle) |
490 |
+@@ -816,7 +830,6 @@ static int dm_resume(void *handle) |
491 |
+ struct drm_plane_state *new_plane_state; |
492 |
+ struct dm_plane_state *dm_new_plane_state; |
493 |
+ enum dc_connection_type new_connection_type = dc_connection_none; |
494 |
+- int ret; |
495 |
+ int i; |
496 |
+ |
497 |
+ /* power on hardware */ |
498 |
+@@ -889,13 +902,13 @@ static int dm_resume(void *handle) |
499 |
+ } |
500 |
+ } |
501 |
+ |
502 |
+- ret = drm_atomic_helper_resume(ddev, dm->cached_state); |
503 |
++ drm_atomic_helper_resume(ddev, dm->cached_state); |
504 |
+ |
505 |
+ dm->cached_state = NULL; |
506 |
+ |
507 |
+ amdgpu_dm_irq_resume_late(adev); |
508 |
+ |
509 |
+- return ret; |
510 |
++ return 0; |
511 |
+ } |
512 |
+ |
513 |
+ static const struct amd_ip_funcs amdgpu_dm_funcs = { |
514 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
515 |
+index 5da2186b3615..5141c1401889 100644 |
516 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
517 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
518 |
+@@ -2617,11 +2617,11 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx, int option) |
519 |
+ { |
520 |
+ struct dc *core_dc = pipe_ctx->stream->ctx->dc; |
521 |
+ |
522 |
++ core_dc->hwss.blank_stream(pipe_ctx); |
523 |
++ |
524 |
+ if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) |
525 |
+ deallocate_mst_payload(pipe_ctx); |
526 |
+ |
527 |
+- core_dc->hwss.blank_stream(pipe_ctx); |
528 |
+- |
529 |
+ core_dc->hwss.disable_stream(pipe_ctx, option); |
530 |
+ |
531 |
+ disable_link(pipe_ctx->stream->sink->link, pipe_ctx->stream->signal); |
532 |
+diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c |
533 |
+index 9d64f874f965..b10ed61526a5 100644 |
534 |
+--- a/drivers/gpu/drm/drm_fb_helper.c |
535 |
++++ b/drivers/gpu/drm/drm_fb_helper.c |
536 |
+@@ -1621,6 +1621,64 @@ static bool drm_fb_pixel_format_equal(const struct fb_var_screeninfo *var_1, |
537 |
+ var_1->transp.msb_right == var_2->transp.msb_right; |
538 |
+ } |
539 |
+ |
540 |
++static void drm_fb_helper_fill_pixel_fmt(struct fb_var_screeninfo *var, |
541 |
++ u8 depth) |
542 |
++{ |
543 |
++ switch (depth) { |
544 |
++ case 8: |
545 |
++ var->red.offset = 0; |
546 |
++ var->green.offset = 0; |
547 |
++ var->blue.offset = 0; |
548 |
++ var->red.length = 8; /* 8bit DAC */ |
549 |
++ var->green.length = 8; |
550 |
++ var->blue.length = 8; |
551 |
++ var->transp.offset = 0; |
552 |
++ var->transp.length = 0; |
553 |
++ break; |
554 |
++ case 15: |
555 |
++ var->red.offset = 10; |
556 |
++ var->green.offset = 5; |
557 |
++ var->blue.offset = 0; |
558 |
++ var->red.length = 5; |
559 |
++ var->green.length = 5; |
560 |
++ var->blue.length = 5; |
561 |
++ var->transp.offset = 15; |
562 |
++ var->transp.length = 1; |
563 |
++ break; |
564 |
++ case 16: |
565 |
++ var->red.offset = 11; |
566 |
++ var->green.offset = 5; |
567 |
++ var->blue.offset = 0; |
568 |
++ var->red.length = 5; |
569 |
++ var->green.length = 6; |
570 |
++ var->blue.length = 5; |
571 |
++ var->transp.offset = 0; |
572 |
++ break; |
573 |
++ case 24: |
574 |
++ var->red.offset = 16; |
575 |
++ var->green.offset = 8; |
576 |
++ var->blue.offset = 0; |
577 |
++ var->red.length = 8; |
578 |
++ var->green.length = 8; |
579 |
++ var->blue.length = 8; |
580 |
++ var->transp.offset = 0; |
581 |
++ var->transp.length = 0; |
582 |
++ break; |
583 |
++ case 32: |
584 |
++ var->red.offset = 16; |
585 |
++ var->green.offset = 8; |
586 |
++ var->blue.offset = 0; |
587 |
++ var->red.length = 8; |
588 |
++ var->green.length = 8; |
589 |
++ var->blue.length = 8; |
590 |
++ var->transp.offset = 24; |
591 |
++ var->transp.length = 8; |
592 |
++ break; |
593 |
++ default: |
594 |
++ break; |
595 |
++ } |
596 |
++} |
597 |
++ |
598 |
+ /** |
599 |
+ * drm_fb_helper_check_var - implementation for &fb_ops.fb_check_var |
600 |
+ * @var: screeninfo to check |
601 |
+@@ -1650,6 +1708,20 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, |
602 |
+ return -EINVAL; |
603 |
+ } |
604 |
+ |
605 |
++ /* |
606 |
++ * Workaround for SDL 1.2, which is known to be setting all pixel format |
607 |
++ * fields values to zero in some cases. We treat this situation as a |
608 |
++ * kind of "use some reasonable autodetected values". |
609 |
++ */ |
610 |
++ if (!var->red.offset && !var->green.offset && |
611 |
++ !var->blue.offset && !var->transp.offset && |
612 |
++ !var->red.length && !var->green.length && |
613 |
++ !var->blue.length && !var->transp.length && |
614 |
++ !var->red.msb_right && !var->green.msb_right && |
615 |
++ !var->blue.msb_right && !var->transp.msb_right) { |
616 |
++ drm_fb_helper_fill_pixel_fmt(var, fb->format->depth); |
617 |
++ } |
618 |
++ |
619 |
+ /* |
620 |
+ * drm fbdev emulation doesn't support changing the pixel format at all, |
621 |
+ * so reject all pixel format changing requests. |
622 |
+@@ -1961,59 +2033,7 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpe |
623 |
+ info->var.yoffset = 0; |
624 |
+ info->var.activate = FB_ACTIVATE_NOW; |
625 |
+ |
626 |
+- switch (fb->format->depth) { |
627 |
+- case 8: |
628 |
+- info->var.red.offset = 0; |
629 |
+- info->var.green.offset = 0; |
630 |
+- info->var.blue.offset = 0; |
631 |
+- info->var.red.length = 8; /* 8bit DAC */ |
632 |
+- info->var.green.length = 8; |
633 |
+- info->var.blue.length = 8; |
634 |
+- info->var.transp.offset = 0; |
635 |
+- info->var.transp.length = 0; |
636 |
+- break; |
637 |
+- case 15: |
638 |
+- info->var.red.offset = 10; |
639 |
+- info->var.green.offset = 5; |
640 |
+- info->var.blue.offset = 0; |
641 |
+- info->var.red.length = 5; |
642 |
+- info->var.green.length = 5; |
643 |
+- info->var.blue.length = 5; |
644 |
+- info->var.transp.offset = 15; |
645 |
+- info->var.transp.length = 1; |
646 |
+- break; |
647 |
+- case 16: |
648 |
+- info->var.red.offset = 11; |
649 |
+- info->var.green.offset = 5; |
650 |
+- info->var.blue.offset = 0; |
651 |
+- info->var.red.length = 5; |
652 |
+- info->var.green.length = 6; |
653 |
+- info->var.blue.length = 5; |
654 |
+- info->var.transp.offset = 0; |
655 |
+- break; |
656 |
+- case 24: |
657 |
+- info->var.red.offset = 16; |
658 |
+- info->var.green.offset = 8; |
659 |
+- info->var.blue.offset = 0; |
660 |
+- info->var.red.length = 8; |
661 |
+- info->var.green.length = 8; |
662 |
+- info->var.blue.length = 8; |
663 |
+- info->var.transp.offset = 0; |
664 |
+- info->var.transp.length = 0; |
665 |
+- break; |
666 |
+- case 32: |
667 |
+- info->var.red.offset = 16; |
668 |
+- info->var.green.offset = 8; |
669 |
+- info->var.blue.offset = 0; |
670 |
+- info->var.red.length = 8; |
671 |
+- info->var.green.length = 8; |
672 |
+- info->var.blue.length = 8; |
673 |
+- info->var.transp.offset = 24; |
674 |
+- info->var.transp.length = 8; |
675 |
+- break; |
676 |
+- default: |
677 |
+- break; |
678 |
+- } |
679 |
++ drm_fb_helper_fill_pixel_fmt(&info->var, fb->format->depth); |
680 |
+ |
681 |
+ info->var.xres = fb_width; |
682 |
+ info->var.yres = fb_height; |
683 |
+diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c |
684 |
+index 07999fe09ad2..4fa1d2b146b1 100644 |
685 |
+--- a/drivers/gpu/drm/i915/i915_gem_gtt.c |
686 |
++++ b/drivers/gpu/drm/i915/i915_gem_gtt.c |
687 |
+@@ -2117,6 +2117,7 @@ static struct i915_vma *pd_vma_create(struct gen6_hw_ppgtt *ppgtt, int size) |
688 |
+ int gen6_ppgtt_pin(struct i915_hw_ppgtt *base) |
689 |
+ { |
690 |
+ struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(base); |
691 |
++ int err; |
692 |
+ |
693 |
+ /* |
694 |
+ * Workaround the limited maximum vma->pin_count and the aliasing_ppgtt |
695 |
+@@ -2132,9 +2133,17 @@ int gen6_ppgtt_pin(struct i915_hw_ppgtt *base) |
696 |
+ * allocator works in address space sizes, so it's multiplied by page |
697 |
+ * size. We allocate at the top of the GTT to avoid fragmentation. |
698 |
+ */ |
699 |
+- return i915_vma_pin(ppgtt->vma, |
700 |
+- 0, GEN6_PD_ALIGN, |
701 |
+- PIN_GLOBAL | PIN_HIGH); |
702 |
++ err = i915_vma_pin(ppgtt->vma, |
703 |
++ 0, GEN6_PD_ALIGN, |
704 |
++ PIN_GLOBAL | PIN_HIGH); |
705 |
++ if (err) |
706 |
++ goto unpin; |
707 |
++ |
708 |
++ return 0; |
709 |
++ |
710 |
++unpin: |
711 |
++ ppgtt->pin_count = 0; |
712 |
++ return err; |
713 |
+ } |
714 |
+ |
715 |
+ void gen6_ppgtt_unpin(struct i915_hw_ppgtt *base) |
716 |
+diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c |
717 |
+index 1aca742fde4a..ccd76c71af09 100644 |
718 |
+--- a/drivers/i2c/i2c-dev.c |
719 |
++++ b/drivers/i2c/i2c-dev.c |
720 |
+@@ -470,9 +470,15 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
721 |
+ data_arg.data); |
722 |
+ } |
723 |
+ case I2C_RETRIES: |
724 |
++ if (arg > INT_MAX) |
725 |
++ return -EINVAL; |
726 |
++ |
727 |
+ client->adapter->retries = arg; |
728 |
+ break; |
729 |
+ case I2C_TIMEOUT: |
730 |
++ if (arg > INT_MAX) |
731 |
++ return -EINVAL; |
732 |
++ |
733 |
+ /* For historical reasons, user-space sets the timeout |
734 |
+ * value in units of 10 ms. |
735 |
+ */ |
736 |
+diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c |
737 |
+index 699d3cf49c6d..7c42a57aca1f 100644 |
738 |
+--- a/drivers/mtd/nand/raw/qcom_nandc.c |
739 |
++++ b/drivers/mtd/nand/raw/qcom_nandc.c |
740 |
+@@ -2833,6 +2833,16 @@ static int qcom_nand_host_init_and_register(struct qcom_nand_controller *nandc, |
741 |
+ if (ret) |
742 |
+ return ret; |
743 |
+ |
744 |
++ if (nandc->props->is_bam) { |
745 |
++ free_bam_transaction(nandc); |
746 |
++ nandc->bam_txn = alloc_bam_transaction(nandc); |
747 |
++ if (!nandc->bam_txn) { |
748 |
++ dev_err(nandc->dev, |
749 |
++ "failed to allocate bam transaction\n"); |
750 |
++ return -ENOMEM; |
751 |
++ } |
752 |
++ } |
753 |
++ |
754 |
+ ret = mtd_device_register(mtd, NULL, 0); |
755 |
+ if (ret) |
756 |
+ nand_cleanup(chip); |
757 |
+@@ -2847,16 +2857,6 @@ static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc) |
758 |
+ struct qcom_nand_host *host; |
759 |
+ int ret; |
760 |
+ |
761 |
+- if (nandc->props->is_bam) { |
762 |
+- free_bam_transaction(nandc); |
763 |
+- nandc->bam_txn = alloc_bam_transaction(nandc); |
764 |
+- if (!nandc->bam_txn) { |
765 |
+- dev_err(nandc->dev, |
766 |
+- "failed to allocate bam transaction\n"); |
767 |
+- return -ENOMEM; |
768 |
+- } |
769 |
+- } |
770 |
+- |
771 |
+ for_each_available_child_of_node(dn, child) { |
772 |
+ host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); |
773 |
+ if (!host) { |
774 |
+diff --git a/drivers/opp/core.c b/drivers/opp/core.c |
775 |
+index 2c2df4e4fc14..9280f51f1ce6 100644 |
776 |
+--- a/drivers/opp/core.c |
777 |
++++ b/drivers/opp/core.c |
778 |
+@@ -951,11 +951,9 @@ void _opp_free(struct dev_pm_opp *opp) |
779 |
+ kfree(opp); |
780 |
+ } |
781 |
+ |
782 |
+-static void _opp_kref_release(struct kref *kref) |
783 |
++static void _opp_kref_release(struct dev_pm_opp *opp, |
784 |
++ struct opp_table *opp_table) |
785 |
+ { |
786 |
+- struct dev_pm_opp *opp = container_of(kref, struct dev_pm_opp, kref); |
787 |
+- struct opp_table *opp_table = opp->opp_table; |
788 |
+- |
789 |
+ /* |
790 |
+ * Notify the changes in the availability of the operable |
791 |
+ * frequency/voltage list. |
792 |
+@@ -964,7 +962,22 @@ static void _opp_kref_release(struct kref *kref) |
793 |
+ opp_debug_remove_one(opp); |
794 |
+ list_del(&opp->node); |
795 |
+ kfree(opp); |
796 |
++} |
797 |
+ |
798 |
++static void _opp_kref_release_unlocked(struct kref *kref) |
799 |
++{ |
800 |
++ struct dev_pm_opp *opp = container_of(kref, struct dev_pm_opp, kref); |
801 |
++ struct opp_table *opp_table = opp->opp_table; |
802 |
++ |
803 |
++ _opp_kref_release(opp, opp_table); |
804 |
++} |
805 |
++ |
806 |
++static void _opp_kref_release_locked(struct kref *kref) |
807 |
++{ |
808 |
++ struct dev_pm_opp *opp = container_of(kref, struct dev_pm_opp, kref); |
809 |
++ struct opp_table *opp_table = opp->opp_table; |
810 |
++ |
811 |
++ _opp_kref_release(opp, opp_table); |
812 |
+ mutex_unlock(&opp_table->lock); |
813 |
+ } |
814 |
+ |
815 |
+@@ -975,10 +988,16 @@ void dev_pm_opp_get(struct dev_pm_opp *opp) |
816 |
+ |
817 |
+ void dev_pm_opp_put(struct dev_pm_opp *opp) |
818 |
+ { |
819 |
+- kref_put_mutex(&opp->kref, _opp_kref_release, &opp->opp_table->lock); |
820 |
++ kref_put_mutex(&opp->kref, _opp_kref_release_locked, |
821 |
++ &opp->opp_table->lock); |
822 |
+ } |
823 |
+ EXPORT_SYMBOL_GPL(dev_pm_opp_put); |
824 |
+ |
825 |
++static void dev_pm_opp_put_unlocked(struct dev_pm_opp *opp) |
826 |
++{ |
827 |
++ kref_put(&opp->kref, _opp_kref_release_unlocked); |
828 |
++} |
829 |
++ |
830 |
+ /** |
831 |
+ * dev_pm_opp_remove() - Remove an OPP from OPP table |
832 |
+ * @dev: device for which we do this operation |
833 |
+@@ -1022,6 +1041,40 @@ void dev_pm_opp_remove(struct device *dev, unsigned long freq) |
834 |
+ } |
835 |
+ EXPORT_SYMBOL_GPL(dev_pm_opp_remove); |
836 |
+ |
837 |
++/** |
838 |
++ * dev_pm_opp_remove_all_dynamic() - Remove all dynamically created OPPs |
839 |
++ * @dev: device for which we do this operation |
840 |
++ * |
841 |
++ * This function removes all dynamically created OPPs from the opp table. |
842 |
++ */ |
843 |
++void dev_pm_opp_remove_all_dynamic(struct device *dev) |
844 |
++{ |
845 |
++ struct opp_table *opp_table; |
846 |
++ struct dev_pm_opp *opp, *temp; |
847 |
++ int count = 0; |
848 |
++ |
849 |
++ opp_table = _find_opp_table(dev); |
850 |
++ if (IS_ERR(opp_table)) |
851 |
++ return; |
852 |
++ |
853 |
++ mutex_lock(&opp_table->lock); |
854 |
++ list_for_each_entry_safe(opp, temp, &opp_table->opp_list, node) { |
855 |
++ if (opp->dynamic) { |
856 |
++ dev_pm_opp_put_unlocked(opp); |
857 |
++ count++; |
858 |
++ } |
859 |
++ } |
860 |
++ mutex_unlock(&opp_table->lock); |
861 |
++ |
862 |
++ /* Drop the references taken by dev_pm_opp_add() */ |
863 |
++ while (count--) |
864 |
++ dev_pm_opp_put_opp_table(opp_table); |
865 |
++ |
866 |
++ /* Drop the reference taken by _find_opp_table() */ |
867 |
++ dev_pm_opp_put_opp_table(opp_table); |
868 |
++} |
869 |
++EXPORT_SYMBOL_GPL(dev_pm_opp_remove_all_dynamic); |
870 |
++ |
871 |
+ struct dev_pm_opp *_opp_allocate(struct opp_table *table) |
872 |
+ { |
873 |
+ struct dev_pm_opp *opp; |
874 |
+diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c |
875 |
+index 29a05759a294..0fa9e8fdce66 100644 |
876 |
+--- a/drivers/pci/controller/dwc/pcie-designware-host.c |
877 |
++++ b/drivers/pci/controller/dwc/pcie-designware-host.c |
878 |
+@@ -99,9 +99,6 @@ irqreturn_t dw_handle_msi_irq(struct pcie_port *pp) |
879 |
+ (i * MAX_MSI_IRQS_PER_CTRL) + |
880 |
+ pos); |
881 |
+ generic_handle_irq(irq); |
882 |
+- dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_STATUS + |
883 |
+- (i * MSI_REG_CTRL_BLOCK_SIZE), |
884 |
+- 4, 1 << pos); |
885 |
+ pos++; |
886 |
+ } |
887 |
+ } |
888 |
+@@ -168,8 +165,8 @@ static void dw_pci_bottom_mask(struct irq_data *data) |
889 |
+ bit = data->hwirq % MAX_MSI_IRQS_PER_CTRL; |
890 |
+ |
891 |
+ pp->irq_status[ctrl] &= ~(1 << bit); |
892 |
+- dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, |
893 |
+- pp->irq_status[ctrl]); |
894 |
++ dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_MASK + res, 4, |
895 |
++ ~pp->irq_status[ctrl]); |
896 |
+ } |
897 |
+ |
898 |
+ raw_spin_unlock_irqrestore(&pp->lock, flags); |
899 |
+@@ -191,8 +188,8 @@ static void dw_pci_bottom_unmask(struct irq_data *data) |
900 |
+ bit = data->hwirq % MAX_MSI_IRQS_PER_CTRL; |
901 |
+ |
902 |
+ pp->irq_status[ctrl] |= 1 << bit; |
903 |
+- dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, |
904 |
+- pp->irq_status[ctrl]); |
905 |
++ dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_MASK + res, 4, |
906 |
++ ~pp->irq_status[ctrl]); |
907 |
+ } |
908 |
+ |
909 |
+ raw_spin_unlock_irqrestore(&pp->lock, flags); |
910 |
+@@ -200,13 +197,22 @@ static void dw_pci_bottom_unmask(struct irq_data *data) |
911 |
+ |
912 |
+ static void dw_pci_bottom_ack(struct irq_data *d) |
913 |
+ { |
914 |
+- struct msi_desc *msi = irq_data_get_msi_desc(d); |
915 |
+- struct pcie_port *pp; |
916 |
++ struct pcie_port *pp = irq_data_get_irq_chip_data(d); |
917 |
++ unsigned int res, bit, ctrl; |
918 |
++ unsigned long flags; |
919 |
++ |
920 |
++ ctrl = d->hwirq / MAX_MSI_IRQS_PER_CTRL; |
921 |
++ res = ctrl * MSI_REG_CTRL_BLOCK_SIZE; |
922 |
++ bit = d->hwirq % MAX_MSI_IRQS_PER_CTRL; |
923 |
++ |
924 |
++ raw_spin_lock_irqsave(&pp->lock, flags); |
925 |
+ |
926 |
+- pp = msi_desc_to_pci_sysdata(msi); |
927 |
++ dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_STATUS + res, 4, 1 << bit); |
928 |
+ |
929 |
+ if (pp->ops->msi_irq_ack) |
930 |
+ pp->ops->msi_irq_ack(d->hwirq, pp); |
931 |
++ |
932 |
++ raw_spin_unlock_irqrestore(&pp->lock, flags); |
933 |
+ } |
934 |
+ |
935 |
+ static struct irq_chip dw_pci_msi_bottom_irq_chip = { |
936 |
+@@ -658,10 +664,15 @@ void dw_pcie_setup_rc(struct pcie_port *pp) |
937 |
+ num_ctrls = pp->num_vectors / MAX_MSI_IRQS_PER_CTRL; |
938 |
+ |
939 |
+ /* Initialize IRQ Status array */ |
940 |
+- for (ctrl = 0; ctrl < num_ctrls; ctrl++) |
941 |
+- dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_ENABLE + |
942 |
++ for (ctrl = 0; ctrl < num_ctrls; ctrl++) { |
943 |
++ dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_MASK + |
944 |
+ (ctrl * MSI_REG_CTRL_BLOCK_SIZE), |
945 |
+- 4, &pp->irq_status[ctrl]); |
946 |
++ 4, ~0); |
947 |
++ dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + |
948 |
++ (ctrl * MSI_REG_CTRL_BLOCK_SIZE), |
949 |
++ 4, ~0); |
950 |
++ pp->irq_status[ctrl] = 0; |
951 |
++ } |
952 |
+ |
953 |
+ /* Setup RC BARs */ |
954 |
+ dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, 0x00000004); |
955 |
+diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c b/drivers/staging/rtl8188eu/core/rtw_security.c |
956 |
+index f7407632e80b..bab96c870042 100644 |
957 |
+--- a/drivers/staging/rtl8188eu/core/rtw_security.c |
958 |
++++ b/drivers/staging/rtl8188eu/core/rtw_security.c |
959 |
+@@ -154,7 +154,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) |
960 |
+ |
961 |
+ pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + hw_hdr_offset; |
962 |
+ |
963 |
+- crypto_ops = try_then_request_module(lib80211_get_crypto_ops("WEP"), "lib80211_crypt_wep"); |
964 |
++ crypto_ops = lib80211_get_crypto_ops("WEP"); |
965 |
+ |
966 |
+ if (!crypto_ops) |
967 |
+ return; |
968 |
+@@ -210,7 +210,7 @@ int rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe) |
969 |
+ void *crypto_private = NULL; |
970 |
+ int status = _SUCCESS; |
971 |
+ const int keyindex = prxattrib->key_index; |
972 |
+- struct lib80211_crypto_ops *crypto_ops = try_then_request_module(lib80211_get_crypto_ops("WEP"), "lib80211_crypt_wep"); |
973 |
++ struct lib80211_crypto_ops *crypto_ops = lib80211_get_crypto_ops("WEP"); |
974 |
+ char iv[4], icv[4]; |
975 |
+ |
976 |
+ if (!crypto_ops) { |
977 |
+@@ -1291,7 +1291,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe) |
978 |
+ struct sk_buff *skb = ((struct recv_frame *)precvframe)->pkt; |
979 |
+ void *crypto_private = NULL; |
980 |
+ u8 *key, *pframe = skb->data; |
981 |
+- struct lib80211_crypto_ops *crypto_ops = try_then_request_module(lib80211_get_crypto_ops("CCMP"), "lib80211_crypt_ccmp"); |
982 |
++ struct lib80211_crypto_ops *crypto_ops = lib80211_get_crypto_ops("CCMP"); |
983 |
+ struct security_priv *psecuritypriv = &padapter->securitypriv; |
984 |
+ char iv[8], icv[8]; |
985 |
+ |
986 |
+diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
987 |
+index ed8c62b2d9d1..739f8960811a 100644 |
988 |
+--- a/drivers/usb/class/cdc-acm.c |
989 |
++++ b/drivers/usb/class/cdc-acm.c |
990 |
+@@ -1865,6 +1865,13 @@ static const struct usb_device_id acm_ids[] = { |
991 |
+ .driver_info = IGNORE_DEVICE, |
992 |
+ }, |
993 |
+ |
994 |
++ { USB_DEVICE(0x1bc7, 0x0021), /* Telit 3G ACM only composition */ |
995 |
++ .driver_info = SEND_ZERO_PACKET, |
996 |
++ }, |
997 |
++ { USB_DEVICE(0x1bc7, 0x0023), /* Telit 3G ACM + ECM composition */ |
998 |
++ .driver_info = SEND_ZERO_PACKET, |
999 |
++ }, |
1000 |
++ |
1001 |
+ /* control interfaces without any protocol set */ |
1002 |
+ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, |
1003 |
+ USB_CDC_PROTO_NONE) }, |
1004 |
+diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c |
1005 |
+index 356b05c82dbc..f713cecc1f41 100644 |
1006 |
+--- a/drivers/usb/core/generic.c |
1007 |
++++ b/drivers/usb/core/generic.c |
1008 |
+@@ -143,9 +143,12 @@ int usb_choose_configuration(struct usb_device *udev) |
1009 |
+ continue; |
1010 |
+ } |
1011 |
+ |
1012 |
+- if (i > 0 && desc && is_audio(desc) && is_uac3_config(desc)) { |
1013 |
+- best = c; |
1014 |
+- break; |
1015 |
++ if (i > 0 && desc && is_audio(desc)) { |
1016 |
++ if (is_uac3_config(desc)) { |
1017 |
++ best = c; |
1018 |
++ break; |
1019 |
++ } |
1020 |
++ continue; |
1021 |
+ } |
1022 |
+ |
1023 |
+ /* From the remaining configs, choose the first one whose |
1024 |
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
1025 |
+index 514c5214ddb2..8bc35d53408b 100644 |
1026 |
+--- a/drivers/usb/core/quirks.c |
1027 |
++++ b/drivers/usb/core/quirks.c |
1028 |
+@@ -394,7 +394,8 @@ static const struct usb_device_id usb_quirk_list[] = { |
1029 |
+ { USB_DEVICE(0x1a40, 0x0101), .driver_info = USB_QUIRK_HUB_SLOW_RESET }, |
1030 |
+ |
1031 |
+ /* Corsair K70 RGB */ |
1032 |
+- { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT }, |
1033 |
++ { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT | |
1034 |
++ USB_QUIRK_DELAY_CTRL_MSG }, |
1035 |
+ |
1036 |
+ /* Corsair Strafe */ |
1037 |
+ { USB_DEVICE(0x1b1c, 0x1b15), .driver_info = USB_QUIRK_DELAY_INIT | |
1038 |
+diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c |
1039 |
+index e227bb5b794f..101ebac43c87 100644 |
1040 |
+--- a/drivers/usb/storage/scsiglue.c |
1041 |
++++ b/drivers/usb/storage/scsiglue.c |
1042 |
+@@ -235,8 +235,12 @@ static int slave_configure(struct scsi_device *sdev) |
1043 |
+ if (!(us->fflags & US_FL_NEEDS_CAP16)) |
1044 |
+ sdev->try_rc_10_first = 1; |
1045 |
+ |
1046 |
+- /* assume SPC3 or latter devices support sense size > 18 */ |
1047 |
+- if (sdev->scsi_level > SCSI_SPC_2) |
1048 |
++ /* |
1049 |
++ * assume SPC3 or latter devices support sense size > 18 |
1050 |
++ * unless US_FL_BAD_SENSE quirk is specified. |
1051 |
++ */ |
1052 |
++ if (sdev->scsi_level > SCSI_SPC_2 && |
1053 |
++ !(us->fflags & US_FL_BAD_SENSE)) |
1054 |
+ us->fflags |= US_FL_SANE_SENSE; |
1055 |
+ |
1056 |
+ /* |
1057 |
+diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
1058 |
+index f7f83b21dc74..ea0d27a94afe 100644 |
1059 |
+--- a/drivers/usb/storage/unusual_devs.h |
1060 |
++++ b/drivers/usb/storage/unusual_devs.h |
1061 |
+@@ -1265,6 +1265,18 @@ UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff, |
1062 |
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1063 |
+ US_FL_FIX_CAPACITY ), |
1064 |
+ |
1065 |
++/* |
1066 |
++ * Reported by Icenowy Zheng <icenowy@××××.io> |
1067 |
++ * The SMI SM3350 USB-UFS bridge controller will enter a wrong state |
1068 |
++ * that do not process read/write command if a long sense is requested, |
1069 |
++ * so force to use 18-byte sense. |
1070 |
++ */ |
1071 |
++UNUSUAL_DEV( 0x090c, 0x3350, 0x0000, 0xffff, |
1072 |
++ "SMI", |
1073 |
++ "SM3350 UFS-to-USB-Mass-Storage bridge", |
1074 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1075 |
++ US_FL_BAD_SENSE ), |
1076 |
++ |
1077 |
+ /* |
1078 |
+ * Reported by Paul Hartman <paul.hartman+linux@×××××.com> |
1079 |
+ * This card reader returns "Illegal Request, Logical Block Address |
1080 |
+diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c |
1081 |
+index d9fd3188615d..64cbc2d007c9 100644 |
1082 |
+--- a/drivers/vfio/vfio_iommu_type1.c |
1083 |
++++ b/drivers/vfio/vfio_iommu_type1.c |
1084 |
+@@ -878,7 +878,7 @@ static int vfio_dma_do_unmap(struct vfio_iommu *iommu, |
1085 |
+ return -EINVAL; |
1086 |
+ if (!unmap->size || unmap->size & mask) |
1087 |
+ return -EINVAL; |
1088 |
+- if (unmap->iova + unmap->size < unmap->iova || |
1089 |
++ if (unmap->iova + unmap->size - 1 < unmap->iova || |
1090 |
+ unmap->size > SIZE_MAX) |
1091 |
+ return -EINVAL; |
1092 |
+ |
1093 |
+diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c |
1094 |
+index 99e7645ad94e..47f1183b3dbe 100644 |
1095 |
+--- a/fs/btrfs/ctree.c |
1096 |
++++ b/fs/btrfs/ctree.c |
1097 |
+@@ -1015,19 +1015,21 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, |
1098 |
+ parent_start = parent->start; |
1099 |
+ |
1100 |
+ /* |
1101 |
+- * If we are COWing a node/leaf from the extent, chunk or device trees, |
1102 |
+- * make sure that we do not finish block group creation of pending block |
1103 |
+- * groups. We do this to avoid a deadlock. |
1104 |
++ * If we are COWing a node/leaf from the extent, chunk, device or free |
1105 |
++ * space trees, make sure that we do not finish block group creation of |
1106 |
++ * pending block groups. We do this to avoid a deadlock. |
1107 |
+ * COWing can result in allocation of a new chunk, and flushing pending |
1108 |
+ * block groups (btrfs_create_pending_block_groups()) can be triggered |
1109 |
+ * when finishing allocation of a new chunk. Creation of a pending block |
1110 |
+- * group modifies the extent, chunk and device trees, therefore we could |
1111 |
+- * deadlock with ourselves since we are holding a lock on an extent |
1112 |
+- * buffer that btrfs_create_pending_block_groups() may try to COW later. |
1113 |
++ * group modifies the extent, chunk, device and free space trees, |
1114 |
++ * therefore we could deadlock with ourselves since we are holding a |
1115 |
++ * lock on an extent buffer that btrfs_create_pending_block_groups() may |
1116 |
++ * try to COW later. |
1117 |
+ */ |
1118 |
+ if (root == fs_info->extent_root || |
1119 |
+ root == fs_info->chunk_root || |
1120 |
+- root == fs_info->dev_root) |
1121 |
++ root == fs_info->dev_root || |
1122 |
++ root == fs_info->free_space_root) |
1123 |
+ trans->can_flush_pending_bgs = false; |
1124 |
+ |
1125 |
+ cow = btrfs_alloc_tree_block(trans, root, parent_start, |
1126 |
+diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c |
1127 |
+index f70825af6438..9e419f6878c5 100644 |
1128 |
+--- a/fs/btrfs/qgroup.c |
1129 |
++++ b/fs/btrfs/qgroup.c |
1130 |
+@@ -1013,16 +1013,22 @@ out_add_root: |
1131 |
+ btrfs_abort_transaction(trans, ret); |
1132 |
+ goto out_free_path; |
1133 |
+ } |
1134 |
+- spin_lock(&fs_info->qgroup_lock); |
1135 |
+- fs_info->quota_root = quota_root; |
1136 |
+- set_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); |
1137 |
+- spin_unlock(&fs_info->qgroup_lock); |
1138 |
+ |
1139 |
+ ret = btrfs_commit_transaction(trans); |
1140 |
+ trans = NULL; |
1141 |
+ if (ret) |
1142 |
+ goto out_free_path; |
1143 |
+ |
1144 |
++ /* |
1145 |
++ * Set quota enabled flag after committing the transaction, to avoid |
1146 |
++ * deadlocks on fs_info->qgroup_ioctl_lock with concurrent snapshot |
1147 |
++ * creation. |
1148 |
++ */ |
1149 |
++ spin_lock(&fs_info->qgroup_lock); |
1150 |
++ fs_info->quota_root = quota_root; |
1151 |
++ set_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); |
1152 |
++ spin_unlock(&fs_info->qgroup_lock); |
1153 |
++ |
1154 |
+ ret = qgroup_rescan_init(fs_info, 0, 1); |
1155 |
+ if (!ret) { |
1156 |
+ qgroup_rescan_zero_tracking(fs_info); |
1157 |
+diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
1158 |
+index f435d397019e..c872adfc939e 100644 |
1159 |
+--- a/fs/btrfs/volumes.c |
1160 |
++++ b/fs/btrfs/volumes.c |
1161 |
+@@ -3724,6 +3724,7 @@ int btrfs_balance(struct btrfs_fs_info *fs_info, |
1162 |
+ int ret; |
1163 |
+ u64 num_devices; |
1164 |
+ unsigned seq; |
1165 |
++ bool reducing_integrity; |
1166 |
+ |
1167 |
+ if (btrfs_fs_closing(fs_info) || |
1168 |
+ atomic_read(&fs_info->balance_pause_req) || |
1169 |
+@@ -3803,24 +3804,30 @@ int btrfs_balance(struct btrfs_fs_info *fs_info, |
1170 |
+ !(bctl->sys.target & allowed)) || |
1171 |
+ ((bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT) && |
1172 |
+ (fs_info->avail_metadata_alloc_bits & allowed) && |
1173 |
+- !(bctl->meta.target & allowed))) { |
1174 |
+- if (bctl->flags & BTRFS_BALANCE_FORCE) { |
1175 |
+- btrfs_info(fs_info, |
1176 |
+- "balance: force reducing metadata integrity"); |
1177 |
+- } else { |
1178 |
+- btrfs_err(fs_info, |
1179 |
+- "balance: reduces metadata integrity, use --force if you want this"); |
1180 |
+- ret = -EINVAL; |
1181 |
+- goto out; |
1182 |
+- } |
1183 |
+- } |
1184 |
++ !(bctl->meta.target & allowed))) |
1185 |
++ reducing_integrity = true; |
1186 |
++ else |
1187 |
++ reducing_integrity = false; |
1188 |
++ |
1189 |
++ /* if we're not converting, the target field is uninitialized */ |
1190 |
++ meta_target = (bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT) ? |
1191 |
++ bctl->meta.target : fs_info->avail_metadata_alloc_bits; |
1192 |
++ data_target = (bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) ? |
1193 |
++ bctl->data.target : fs_info->avail_data_alloc_bits; |
1194 |
+ } while (read_seqretry(&fs_info->profiles_lock, seq)); |
1195 |
+ |
1196 |
+- /* if we're not converting, the target field is uninitialized */ |
1197 |
+- meta_target = (bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT) ? |
1198 |
+- bctl->meta.target : fs_info->avail_metadata_alloc_bits; |
1199 |
+- data_target = (bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) ? |
1200 |
+- bctl->data.target : fs_info->avail_data_alloc_bits; |
1201 |
++ if (reducing_integrity) { |
1202 |
++ if (bctl->flags & BTRFS_BALANCE_FORCE) { |
1203 |
++ btrfs_info(fs_info, |
1204 |
++ "balance: force reducing metadata integrity"); |
1205 |
++ } else { |
1206 |
++ btrfs_err(fs_info, |
1207 |
++ "balance: reduces metadata integrity, use --force if you want this"); |
1208 |
++ ret = -EINVAL; |
1209 |
++ goto out; |
1210 |
++ } |
1211 |
++ } |
1212 |
++ |
1213 |
+ if (btrfs_get_num_tolerated_disk_barrier_failures(meta_target) < |
1214 |
+ btrfs_get_num_tolerated_disk_barrier_failures(data_target)) { |
1215 |
+ int meta_index = btrfs_bg_flags_to_raid_index(meta_target); |
1216 |
+diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c |
1217 |
+index ea78c3d6dcfc..f141b45ce349 100644 |
1218 |
+--- a/fs/btrfs/xattr.c |
1219 |
++++ b/fs/btrfs/xattr.c |
1220 |
+@@ -11,6 +11,7 @@ |
1221 |
+ #include <linux/security.h> |
1222 |
+ #include <linux/posix_acl_xattr.h> |
1223 |
+ #include <linux/iversion.h> |
1224 |
++#include <linux/sched/mm.h> |
1225 |
+ #include "ctree.h" |
1226 |
+ #include "btrfs_inode.h" |
1227 |
+ #include "transaction.h" |
1228 |
+@@ -422,9 +423,15 @@ static int btrfs_initxattrs(struct inode *inode, |
1229 |
+ { |
1230 |
+ const struct xattr *xattr; |
1231 |
+ struct btrfs_trans_handle *trans = fs_info; |
1232 |
++ unsigned int nofs_flag; |
1233 |
+ char *name; |
1234 |
+ int err = 0; |
1235 |
+ |
1236 |
++ /* |
1237 |
++ * We're holding a transaction handle, so use a NOFS memory allocation |
1238 |
++ * context to avoid deadlock if reclaim happens. |
1239 |
++ */ |
1240 |
++ nofs_flag = memalloc_nofs_save(); |
1241 |
+ for (xattr = xattr_array; xattr->name != NULL; xattr++) { |
1242 |
+ name = kmalloc(XATTR_SECURITY_PREFIX_LEN + |
1243 |
+ strlen(xattr->name) + 1, GFP_KERNEL); |
1244 |
+@@ -440,6 +447,7 @@ static int btrfs_initxattrs(struct inode *inode, |
1245 |
+ if (err < 0) |
1246 |
+ break; |
1247 |
+ } |
1248 |
++ memalloc_nofs_restore(nofs_flag); |
1249 |
+ return err; |
1250 |
+ } |
1251 |
+ |
1252 |
+diff --git a/fs/cifs/file.c b/fs/cifs/file.c |
1253 |
+index c23bf9da93d2..d5c3e0725849 100644 |
1254 |
+--- a/fs/cifs/file.c |
1255 |
++++ b/fs/cifs/file.c |
1256 |
+@@ -1131,10 +1131,10 @@ cifs_push_mandatory_locks(struct cifsFileInfo *cfile) |
1257 |
+ |
1258 |
+ /* |
1259 |
+ * Accessing maxBuf is racy with cifs_reconnect - need to store value |
1260 |
+- * and check it for zero before using. |
1261 |
++ * and check it before using. |
1262 |
+ */ |
1263 |
+ max_buf = tcon->ses->server->maxBuf; |
1264 |
+- if (!max_buf) { |
1265 |
++ if (max_buf < (sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE))) { |
1266 |
+ free_xid(xid); |
1267 |
+ return -EINVAL; |
1268 |
+ } |
1269 |
+@@ -1471,10 +1471,10 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, |
1270 |
+ |
1271 |
+ /* |
1272 |
+ * Accessing maxBuf is racy with cifs_reconnect - need to store value |
1273 |
+- * and check it for zero before using. |
1274 |
++ * and check it before using. |
1275 |
+ */ |
1276 |
+ max_buf = tcon->ses->server->maxBuf; |
1277 |
+- if (!max_buf) |
1278 |
++ if (max_buf < (sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE))) |
1279 |
+ return -EINVAL; |
1280 |
+ |
1281 |
+ max_num = (max_buf - sizeof(struct smb_hdr)) / |
1282 |
+diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c |
1283 |
+index 8a41f4eba726..6f33253938cd 100644 |
1284 |
+--- a/fs/cifs/misc.c |
1285 |
++++ b/fs/cifs/misc.c |
1286 |
+@@ -111,21 +111,27 @@ struct cifs_tcon * |
1287 |
+ tconInfoAlloc(void) |
1288 |
+ { |
1289 |
+ struct cifs_tcon *ret_buf; |
1290 |
+- ret_buf = kzalloc(sizeof(struct cifs_tcon), GFP_KERNEL); |
1291 |
+- if (ret_buf) { |
1292 |
+- atomic_inc(&tconInfoAllocCount); |
1293 |
+- ret_buf->tidStatus = CifsNew; |
1294 |
+- ++ret_buf->tc_count; |
1295 |
+- INIT_LIST_HEAD(&ret_buf->openFileList); |
1296 |
+- INIT_LIST_HEAD(&ret_buf->tcon_list); |
1297 |
+- spin_lock_init(&ret_buf->open_file_lock); |
1298 |
+- mutex_init(&ret_buf->crfid.fid_mutex); |
1299 |
+- ret_buf->crfid.fid = kzalloc(sizeof(struct cifs_fid), |
1300 |
+- GFP_KERNEL); |
1301 |
+- spin_lock_init(&ret_buf->stat_lock); |
1302 |
+- atomic_set(&ret_buf->num_local_opens, 0); |
1303 |
+- atomic_set(&ret_buf->num_remote_opens, 0); |
1304 |
++ |
1305 |
++ ret_buf = kzalloc(sizeof(*ret_buf), GFP_KERNEL); |
1306 |
++ if (!ret_buf) |
1307 |
++ return NULL; |
1308 |
++ ret_buf->crfid.fid = kzalloc(sizeof(*ret_buf->crfid.fid), GFP_KERNEL); |
1309 |
++ if (!ret_buf->crfid.fid) { |
1310 |
++ kfree(ret_buf); |
1311 |
++ return NULL; |
1312 |
+ } |
1313 |
++ |
1314 |
++ atomic_inc(&tconInfoAllocCount); |
1315 |
++ ret_buf->tidStatus = CifsNew; |
1316 |
++ ++ret_buf->tc_count; |
1317 |
++ INIT_LIST_HEAD(&ret_buf->openFileList); |
1318 |
++ INIT_LIST_HEAD(&ret_buf->tcon_list); |
1319 |
++ spin_lock_init(&ret_buf->open_file_lock); |
1320 |
++ mutex_init(&ret_buf->crfid.fid_mutex); |
1321 |
++ spin_lock_init(&ret_buf->stat_lock); |
1322 |
++ atomic_set(&ret_buf->num_local_opens, 0); |
1323 |
++ atomic_set(&ret_buf->num_remote_opens, 0); |
1324 |
++ |
1325 |
+ return ret_buf; |
1326 |
+ } |
1327 |
+ |
1328 |
+diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c |
1329 |
+index 4ed10dd086e6..2fc3d31967ee 100644 |
1330 |
+--- a/fs/cifs/smb2file.c |
1331 |
++++ b/fs/cifs/smb2file.c |
1332 |
+@@ -122,10 +122,10 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, |
1333 |
+ |
1334 |
+ /* |
1335 |
+ * Accessing maxBuf is racy with cifs_reconnect - need to store value |
1336 |
+- * and check it for zero before using. |
1337 |
++ * and check it before using. |
1338 |
+ */ |
1339 |
+ max_buf = tcon->ses->server->maxBuf; |
1340 |
+- if (!max_buf) |
1341 |
++ if (max_buf < sizeof(struct smb2_lock_element)) |
1342 |
+ return -EINVAL; |
1343 |
+ |
1344 |
+ max_num = max_buf / sizeof(struct smb2_lock_element); |
1345 |
+diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c |
1346 |
+index 27f86537a5d1..836c59fca049 100644 |
1347 |
+--- a/fs/cifs/smb2pdu.c |
1348 |
++++ b/fs/cifs/smb2pdu.c |
1349 |
+@@ -3197,12 +3197,14 @@ smb2_async_readv(struct cifs_readdata *rdata) |
1350 |
+ if (rdata->credits) { |
1351 |
+ shdr->CreditCharge = cpu_to_le16(DIV_ROUND_UP(rdata->bytes, |
1352 |
+ SMB2_MAX_BUFFER_SIZE)); |
1353 |
+- shdr->CreditRequest = shdr->CreditCharge; |
1354 |
++ shdr->CreditRequest = |
1355 |
++ cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 1); |
1356 |
+ spin_lock(&server->req_lock); |
1357 |
+ server->credits += rdata->credits - |
1358 |
+ le16_to_cpu(shdr->CreditCharge); |
1359 |
+ spin_unlock(&server->req_lock); |
1360 |
+ wake_up(&server->request_q); |
1361 |
++ rdata->credits = le16_to_cpu(shdr->CreditCharge); |
1362 |
+ flags |= CIFS_HAS_CREDITS; |
1363 |
+ } |
1364 |
+ |
1365 |
+@@ -3474,12 +3476,14 @@ smb2_async_writev(struct cifs_writedata *wdata, |
1366 |
+ if (wdata->credits) { |
1367 |
+ shdr->CreditCharge = cpu_to_le16(DIV_ROUND_UP(wdata->bytes, |
1368 |
+ SMB2_MAX_BUFFER_SIZE)); |
1369 |
+- shdr->CreditRequest = shdr->CreditCharge; |
1370 |
++ shdr->CreditRequest = |
1371 |
++ cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 1); |
1372 |
+ spin_lock(&server->req_lock); |
1373 |
+ server->credits += wdata->credits - |
1374 |
+ le16_to_cpu(shdr->CreditCharge); |
1375 |
+ spin_unlock(&server->req_lock); |
1376 |
+ wake_up(&server->request_q); |
1377 |
++ wdata->credits = le16_to_cpu(shdr->CreditCharge); |
1378 |
+ flags |= CIFS_HAS_CREDITS; |
1379 |
+ } |
1380 |
+ |
1381 |
+diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c |
1382 |
+index 83ff0c25710d..d51064c1ba42 100644 |
1383 |
+--- a/fs/cifs/transport.c |
1384 |
++++ b/fs/cifs/transport.c |
1385 |
+@@ -385,7 +385,7 @@ smbd_done: |
1386 |
+ if (rc < 0 && rc != -EINTR) |
1387 |
+ cifs_dbg(VFS, "Error %d sending data on socket to server\n", |
1388 |
+ rc); |
1389 |
+- else |
1390 |
++ else if (rc > 0) |
1391 |
+ rc = 0; |
1392 |
+ |
1393 |
+ return rc; |
1394 |
+@@ -793,7 +793,8 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, |
1395 |
+ int i, j, rc = 0; |
1396 |
+ int timeout, optype; |
1397 |
+ struct mid_q_entry *midQ[MAX_COMPOUND]; |
1398 |
+- unsigned int credits = 0; |
1399 |
++ bool cancelled_mid[MAX_COMPOUND] = {false}; |
1400 |
++ unsigned int credits[MAX_COMPOUND] = {0}; |
1401 |
+ char *buf; |
1402 |
+ |
1403 |
+ timeout = flags & CIFS_TIMEOUT_MASK; |
1404 |
+@@ -811,13 +812,31 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, |
1405 |
+ return -ENOENT; |
1406 |
+ |
1407 |
+ /* |
1408 |
+- * Ensure that we do not send more than 50 overlapping requests |
1409 |
+- * to the same server. We may make this configurable later or |
1410 |
+- * use ses->maxReq. |
1411 |
++ * Ensure we obtain 1 credit per request in the compound chain. |
1412 |
++ * It can be optimized further by waiting for all the credits |
1413 |
++ * at once but this can wait long enough if we don't have enough |
1414 |
++ * credits due to some heavy operations in progress or the server |
1415 |
++ * not granting us much, so a fallback to the current approach is |
1416 |
++ * needed anyway. |
1417 |
+ */ |
1418 |
+- rc = wait_for_free_request(ses->server, timeout, optype); |
1419 |
+- if (rc) |
1420 |
+- return rc; |
1421 |
++ for (i = 0; i < num_rqst; i++) { |
1422 |
++ rc = wait_for_free_request(ses->server, timeout, optype); |
1423 |
++ if (rc) { |
1424 |
++ /* |
1425 |
++ * We haven't sent an SMB packet to the server yet but |
1426 |
++ * we already obtained credits for i requests in the |
1427 |
++ * compound chain - need to return those credits back |
1428 |
++ * for future use. Note that we need to call add_credits |
1429 |
++ * multiple times to match the way we obtained credits |
1430 |
++ * in the first place and to account for in flight |
1431 |
++ * requests correctly. |
1432 |
++ */ |
1433 |
++ for (j = 0; j < i; j++) |
1434 |
++ add_credits(ses->server, 1, optype); |
1435 |
++ return rc; |
1436 |
++ } |
1437 |
++ credits[i] = 1; |
1438 |
++ } |
1439 |
+ |
1440 |
+ /* |
1441 |
+ * Make sure that we sign in the same order that we send on this socket |
1442 |
+@@ -833,8 +852,10 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, |
1443 |
+ for (j = 0; j < i; j++) |
1444 |
+ cifs_delete_mid(midQ[j]); |
1445 |
+ mutex_unlock(&ses->server->srv_mutex); |
1446 |
++ |
1447 |
+ /* Update # of requests on wire to server */ |
1448 |
+- add_credits(ses->server, 1, optype); |
1449 |
++ for (j = 0; j < num_rqst; j++) |
1450 |
++ add_credits(ses->server, credits[j], optype); |
1451 |
+ return PTR_ERR(midQ[i]); |
1452 |
+ } |
1453 |
+ |
1454 |
+@@ -881,19 +902,16 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, |
1455 |
+ if (midQ[i]->mid_state == MID_REQUEST_SUBMITTED) { |
1456 |
+ midQ[i]->mid_flags |= MID_WAIT_CANCELLED; |
1457 |
+ midQ[i]->callback = DeleteMidQEntry; |
1458 |
+- spin_unlock(&GlobalMid_Lock); |
1459 |
+- add_credits(ses->server, 1, optype); |
1460 |
+- return rc; |
1461 |
++ cancelled_mid[i] = true; |
1462 |
+ } |
1463 |
+ spin_unlock(&GlobalMid_Lock); |
1464 |
+ } |
1465 |
+ } |
1466 |
+ |
1467 |
+ for (i = 0; i < num_rqst; i++) |
1468 |
+- if (midQ[i]->resp_buf) |
1469 |
+- credits += ses->server->ops->get_credits(midQ[i]); |
1470 |
+- if (!credits) |
1471 |
+- credits = 1; |
1472 |
++ if (!cancelled_mid[i] && midQ[i]->resp_buf |
1473 |
++ && (midQ[i]->mid_state == MID_RESPONSE_RECEIVED)) |
1474 |
++ credits[i] = ses->server->ops->get_credits(midQ[i]); |
1475 |
+ |
1476 |
+ for (i = 0; i < num_rqst; i++) { |
1477 |
+ if (rc < 0) |
1478 |
+@@ -901,8 +919,9 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, |
1479 |
+ |
1480 |
+ rc = cifs_sync_mid_result(midQ[i], ses->server); |
1481 |
+ if (rc != 0) { |
1482 |
+- add_credits(ses->server, credits, optype); |
1483 |
+- return rc; |
1484 |
++ /* mark this mid as cancelled to not free it below */ |
1485 |
++ cancelled_mid[i] = true; |
1486 |
++ goto out; |
1487 |
+ } |
1488 |
+ |
1489 |
+ if (!midQ[i]->resp_buf || |
1490 |
+@@ -949,9 +968,11 @@ out: |
1491 |
+ * This is prevented above by using a noop callback that will not |
1492 |
+ * wake this thread except for the very last PDU. |
1493 |
+ */ |
1494 |
+- for (i = 0; i < num_rqst; i++) |
1495 |
+- cifs_delete_mid(midQ[i]); |
1496 |
+- add_credits(ses->server, credits, optype); |
1497 |
++ for (i = 0; i < num_rqst; i++) { |
1498 |
++ if (!cancelled_mid[i]) |
1499 |
++ cifs_delete_mid(midQ[i]); |
1500 |
++ add_credits(ses->server, credits[i], optype); |
1501 |
++ } |
1502 |
+ |
1503 |
+ return rc; |
1504 |
+ } |
1505 |
+diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c |
1506 |
+index 26a7fe5c4fd3..712f00995390 100644 |
1507 |
+--- a/fs/ext4/fsync.c |
1508 |
++++ b/fs/ext4/fsync.c |
1509 |
+@@ -116,8 +116,16 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) |
1510 |
+ goto out; |
1511 |
+ } |
1512 |
+ |
1513 |
++ ret = file_write_and_wait_range(file, start, end); |
1514 |
++ if (ret) |
1515 |
++ return ret; |
1516 |
++ |
1517 |
+ if (!journal) { |
1518 |
+- ret = __generic_file_fsync(file, start, end, datasync); |
1519 |
++ struct writeback_control wbc = { |
1520 |
++ .sync_mode = WB_SYNC_ALL |
1521 |
++ }; |
1522 |
++ |
1523 |
++ ret = ext4_write_inode(inode, &wbc); |
1524 |
+ if (!ret) |
1525 |
+ ret = ext4_sync_parent(inode); |
1526 |
+ if (test_opt(inode->i_sb, BARRIER)) |
1527 |
+@@ -125,9 +133,6 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) |
1528 |
+ goto out; |
1529 |
+ } |
1530 |
+ |
1531 |
+- ret = file_write_and_wait_range(file, start, end); |
1532 |
+- if (ret) |
1533 |
+- return ret; |
1534 |
+ /* |
1535 |
+ * data=writeback,ordered: |
1536 |
+ * The caller's filemap_fdatawrite()/wait will sync the data. |
1537 |
+@@ -159,6 +164,9 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) |
1538 |
+ ret = err; |
1539 |
+ } |
1540 |
+ out: |
1541 |
++ err = file_check_and_advance_wb_err(file); |
1542 |
++ if (ret == 0) |
1543 |
++ ret = err; |
1544 |
+ trace_ext4_sync_file_exit(inode, ret); |
1545 |
+ return ret; |
1546 |
+ } |
1547 |
+diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c |
1548 |
+index 27373d88b5f0..56f6e1782d5f 100644 |
1549 |
+--- a/fs/ext4/inline.c |
1550 |
++++ b/fs/ext4/inline.c |
1551 |
+@@ -1890,12 +1890,12 @@ int ext4_inline_data_fiemap(struct inode *inode, |
1552 |
+ physical += (char *)ext4_raw_inode(&iloc) - iloc.bh->b_data; |
1553 |
+ physical += offsetof(struct ext4_inode, i_block); |
1554 |
+ |
1555 |
+- if (physical) |
1556 |
+- error = fiemap_fill_next_extent(fieinfo, start, physical, |
1557 |
+- inline_len, flags); |
1558 |
+ brelse(iloc.bh); |
1559 |
+ out: |
1560 |
+ up_read(&EXT4_I(inode)->xattr_sem); |
1561 |
++ if (physical) |
1562 |
++ error = fiemap_fill_next_extent(fieinfo, start, physical, |
1563 |
++ inline_len, flags); |
1564 |
+ return (error < 0 ? error : 0); |
1565 |
+ } |
1566 |
+ |
1567 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
1568 |
+index 9affabd07682..34d7e0703cc6 100644 |
1569 |
+--- a/fs/ext4/inode.c |
1570 |
++++ b/fs/ext4/inode.c |
1571 |
+@@ -2778,7 +2778,8 @@ static int ext4_writepages(struct address_space *mapping, |
1572 |
+ * We may need to convert up to one extent per block in |
1573 |
+ * the page and we may dirty the inode. |
1574 |
+ */ |
1575 |
+- rsv_blocks = 1 + (PAGE_SIZE >> inode->i_blkbits); |
1576 |
++ rsv_blocks = 1 + ext4_chunk_trans_blocks(inode, |
1577 |
++ PAGE_SIZE >> inode->i_blkbits); |
1578 |
+ } |
1579 |
+ |
1580 |
+ /* |
1581 |
+@@ -4833,7 +4834,7 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, |
1582 |
+ gid_t i_gid; |
1583 |
+ projid_t i_projid; |
1584 |
+ |
1585 |
+- if (((flags & EXT4_IGET_NORMAL) && |
1586 |
++ if ((!(flags & EXT4_IGET_SPECIAL) && |
1587 |
+ (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO)) || |
1588 |
+ (ino < EXT4_ROOT_INO) || |
1589 |
+ (ino > le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count))) { |
1590 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
1591 |
+index 6641a1b8a6a5..521320de2017 100644 |
1592 |
+--- a/fs/ext4/super.c |
1593 |
++++ b/fs/ext4/super.c |
1594 |
+@@ -4905,7 +4905,7 @@ static int ext4_commit_super(struct super_block *sb, int sync) |
1595 |
+ ext4_superblock_csum_set(sb); |
1596 |
+ if (sync) |
1597 |
+ lock_buffer(sbh); |
1598 |
+- if (buffer_write_io_error(sbh)) { |
1599 |
++ if (buffer_write_io_error(sbh) || !buffer_uptodate(sbh)) { |
1600 |
+ /* |
1601 |
+ * Oh, dear. A previous attempt to write the |
1602 |
+ * superblock failed. This could happen because the |
1603 |
+diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h |
1604 |
+index 2010493e1040..977ddf2774f9 100644 |
1605 |
+--- a/include/linux/compiler-gcc.h |
1606 |
++++ b/include/linux/compiler-gcc.h |
1607 |
+@@ -68,7 +68,7 @@ |
1608 |
+ */ |
1609 |
+ #define uninitialized_var(x) x = x |
1610 |
+ |
1611 |
+-#ifdef RETPOLINE |
1612 |
++#ifdef CONFIG_RETPOLINE |
1613 |
+ #define __noretpoline __attribute__((__indirect_branch__("keep"))) |
1614 |
+ #endif |
1615 |
+ |
1616 |
+diff --git a/include/linux/module.h b/include/linux/module.h |
1617 |
+index fce6b4335e36..0c575f51fe57 100644 |
1618 |
+--- a/include/linux/module.h |
1619 |
++++ b/include/linux/module.h |
1620 |
+@@ -817,7 +817,7 @@ static inline void module_bug_finalize(const Elf_Ehdr *hdr, |
1621 |
+ static inline void module_bug_cleanup(struct module *mod) {} |
1622 |
+ #endif /* CONFIG_GENERIC_BUG */ |
1623 |
+ |
1624 |
+-#ifdef RETPOLINE |
1625 |
++#ifdef CONFIG_RETPOLINE |
1626 |
+ extern bool retpoline_module_ok(bool has_retpoline); |
1627 |
+ #else |
1628 |
+ static inline bool retpoline_module_ok(bool has_retpoline) |
1629 |
+diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h |
1630 |
+index 5d399eeef172..f4f8840eab04 100644 |
1631 |
+--- a/include/linux/pm_opp.h |
1632 |
++++ b/include/linux/pm_opp.h |
1633 |
+@@ -108,6 +108,7 @@ void dev_pm_opp_put(struct dev_pm_opp *opp); |
1634 |
+ int dev_pm_opp_add(struct device *dev, unsigned long freq, |
1635 |
+ unsigned long u_volt); |
1636 |
+ void dev_pm_opp_remove(struct device *dev, unsigned long freq); |
1637 |
++void dev_pm_opp_remove_all_dynamic(struct device *dev); |
1638 |
+ |
1639 |
+ int dev_pm_opp_enable(struct device *dev, unsigned long freq); |
1640 |
+ |
1641 |
+@@ -214,6 +215,10 @@ static inline void dev_pm_opp_remove(struct device *dev, unsigned long freq) |
1642 |
+ { |
1643 |
+ } |
1644 |
+ |
1645 |
++static inline void dev_pm_opp_remove_all_dynamic(struct device *dev) |
1646 |
++{ |
1647 |
++} |
1648 |
++ |
1649 |
+ static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq) |
1650 |
+ { |
1651 |
+ return 0; |
1652 |
+diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h |
1653 |
+index 73e130a840ce..fdb6b317d974 100644 |
1654 |
+--- a/include/linux/sunrpc/svc.h |
1655 |
++++ b/include/linux/sunrpc/svc.h |
1656 |
+@@ -295,9 +295,12 @@ struct svc_rqst { |
1657 |
+ struct svc_cacherep * rq_cacherep; /* cache info */ |
1658 |
+ struct task_struct *rq_task; /* service thread */ |
1659 |
+ spinlock_t rq_lock; /* per-request lock */ |
1660 |
++ struct net *rq_bc_net; /* pointer to backchannel's |
1661 |
++ * net namespace |
1662 |
++ */ |
1663 |
+ }; |
1664 |
+ |
1665 |
+-#define SVC_NET(svc_rqst) (svc_rqst->rq_xprt->xpt_net) |
1666 |
++#define SVC_NET(rqst) (rqst->rq_xprt ? rqst->rq_xprt->xpt_net : rqst->rq_bc_net) |
1667 |
+ |
1668 |
+ /* |
1669 |
+ * Rigorous type checking on sockaddr type conversions |
1670 |
+diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h |
1671 |
+index 28e384186c35..8617f4fd6b70 100644 |
1672 |
+--- a/include/trace/events/sunrpc.h |
1673 |
++++ b/include/trace/events/sunrpc.h |
1674 |
+@@ -569,7 +569,8 @@ TRACE_EVENT(svc_process, |
1675 |
+ __field(u32, vers) |
1676 |
+ __field(u32, proc) |
1677 |
+ __string(service, name) |
1678 |
+- __string(addr, rqst->rq_xprt->xpt_remotebuf) |
1679 |
++ __string(addr, rqst->rq_xprt ? |
1680 |
++ rqst->rq_xprt->xpt_remotebuf : "(null)") |
1681 |
+ ), |
1682 |
+ |
1683 |
+ TP_fast_assign( |
1684 |
+@@ -577,7 +578,8 @@ TRACE_EVENT(svc_process, |
1685 |
+ __entry->vers = rqst->rq_vers; |
1686 |
+ __entry->proc = rqst->rq_proc; |
1687 |
+ __assign_str(service, name); |
1688 |
+- __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); |
1689 |
++ __assign_str(addr, rqst->rq_xprt ? |
1690 |
++ rqst->rq_xprt->xpt_remotebuf : "(null)"); |
1691 |
+ ), |
1692 |
+ |
1693 |
+ TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%u", |
1694 |
+diff --git a/kernel/fork.c b/kernel/fork.c |
1695 |
+index 3c16bc490583..906cd0c13d15 100644 |
1696 |
+--- a/kernel/fork.c |
1697 |
++++ b/kernel/fork.c |
1698 |
+@@ -221,6 +221,7 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node) |
1699 |
+ memset(s->addr, 0, THREAD_SIZE); |
1700 |
+ |
1701 |
+ tsk->stack_vm_area = s; |
1702 |
++ tsk->stack = s->addr; |
1703 |
+ return s->addr; |
1704 |
+ } |
1705 |
+ |
1706 |
+diff --git a/mm/memory.c b/mm/memory.c |
1707 |
+index 4ad2d293ddc2..59c00ae6b928 100644 |
1708 |
+--- a/mm/memory.c |
1709 |
++++ b/mm/memory.c |
1710 |
+@@ -2993,6 +2993,29 @@ static vm_fault_t __do_fault(struct vm_fault *vmf) |
1711 |
+ struct vm_area_struct *vma = vmf->vma; |
1712 |
+ vm_fault_t ret; |
1713 |
+ |
1714 |
++ /* |
1715 |
++ * Preallocate pte before we take page_lock because this might lead to |
1716 |
++ * deadlocks for memcg reclaim which waits for pages under writeback: |
1717 |
++ * lock_page(A) |
1718 |
++ * SetPageWriteback(A) |
1719 |
++ * unlock_page(A) |
1720 |
++ * lock_page(B) |
1721 |
++ * lock_page(B) |
1722 |
++ * pte_alloc_pne |
1723 |
++ * shrink_page_list |
1724 |
++ * wait_on_page_writeback(A) |
1725 |
++ * SetPageWriteback(B) |
1726 |
++ * unlock_page(B) |
1727 |
++ * # flush A, B to clear the writeback |
1728 |
++ */ |
1729 |
++ if (pmd_none(*vmf->pmd) && !vmf->prealloc_pte) { |
1730 |
++ vmf->prealloc_pte = pte_alloc_one(vmf->vma->vm_mm, |
1731 |
++ vmf->address); |
1732 |
++ if (!vmf->prealloc_pte) |
1733 |
++ return VM_FAULT_OOM; |
1734 |
++ smp_wmb(); /* See comment in __pte_alloc() */ |
1735 |
++ } |
1736 |
++ |
1737 |
+ ret = vma->vm_ops->fault(vmf); |
1738 |
+ if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY | |
1739 |
+ VM_FAULT_DONE_COW))) |
1740 |
+diff --git a/mm/slab.c b/mm/slab.c |
1741 |
+index 2a5654bb3b3f..9d5de959d9d9 100644 |
1742 |
+--- a/mm/slab.c |
1743 |
++++ b/mm/slab.c |
1744 |
+@@ -679,8 +679,10 @@ static struct alien_cache *__alloc_alien_cache(int node, int entries, |
1745 |
+ struct alien_cache *alc = NULL; |
1746 |
+ |
1747 |
+ alc = kmalloc_node(memsize, gfp, node); |
1748 |
+- init_arraycache(&alc->ac, entries, batch); |
1749 |
+- spin_lock_init(&alc->lock); |
1750 |
++ if (alc) { |
1751 |
++ init_arraycache(&alc->ac, entries, batch); |
1752 |
++ spin_lock_init(&alc->lock); |
1753 |
++ } |
1754 |
+ return alc; |
1755 |
+ } |
1756 |
+ |
1757 |
+diff --git a/mm/usercopy.c b/mm/usercopy.c |
1758 |
+index 852eb4e53f06..14faadcedd06 100644 |
1759 |
+--- a/mm/usercopy.c |
1760 |
++++ b/mm/usercopy.c |
1761 |
+@@ -247,7 +247,8 @@ static DEFINE_STATIC_KEY_FALSE_RO(bypass_usercopy_checks); |
1762 |
+ /* |
1763 |
+ * Validates that the given object is: |
1764 |
+ * - not bogus address |
1765 |
+- * - known-safe heap or stack object |
1766 |
++ * - fully contained by stack (or stack frame, when available) |
1767 |
++ * - fully within SLAB object (or object whitelist area, when available) |
1768 |
+ * - not in kernel text |
1769 |
+ */ |
1770 |
+ void __check_object_size(const void *ptr, unsigned long n, bool to_user) |
1771 |
+@@ -262,9 +263,6 @@ void __check_object_size(const void *ptr, unsigned long n, bool to_user) |
1772 |
+ /* Check for invalid addresses. */ |
1773 |
+ check_bogus_address((const unsigned long)ptr, n, to_user); |
1774 |
+ |
1775 |
+- /* Check for bad heap object. */ |
1776 |
+- check_heap_object(ptr, n, to_user); |
1777 |
+- |
1778 |
+ /* Check for bad stack object. */ |
1779 |
+ switch (check_stack_object(ptr, n)) { |
1780 |
+ case NOT_STACK: |
1781 |
+@@ -282,6 +280,9 @@ void __check_object_size(const void *ptr, unsigned long n, bool to_user) |
1782 |
+ usercopy_abort("process stack", NULL, to_user, 0, n); |
1783 |
+ } |
1784 |
+ |
1785 |
++ /* Check for bad heap object. */ |
1786 |
++ check_heap_object(ptr, n, to_user); |
1787 |
++ |
1788 |
+ /* Check for object in kernel to avoid text exposure. */ |
1789 |
+ check_kernel_text_object((const unsigned long)ptr, n, to_user); |
1790 |
+ } |
1791 |
+diff --git a/mm/util.c b/mm/util.c |
1792 |
+index 8bf08b5b5760..5c9c7359ee8a 100644 |
1793 |
+--- a/mm/util.c |
1794 |
++++ b/mm/util.c |
1795 |
+@@ -478,7 +478,7 @@ bool page_mapped(struct page *page) |
1796 |
+ return true; |
1797 |
+ if (PageHuge(page)) |
1798 |
+ return false; |
1799 |
+- for (i = 0; i < hpage_nr_pages(page); i++) { |
1800 |
++ for (i = 0; i < (1 << compound_order(page)); i++) { |
1801 |
+ if (atomic_read(&page[i]._mapcount) >= 0) |
1802 |
+ return true; |
1803 |
+ } |
1804 |
+diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c |
1805 |
+index d13e05f1a990..d65f8d35de87 100644 |
1806 |
+--- a/net/sunrpc/svc.c |
1807 |
++++ b/net/sunrpc/svc.c |
1808 |
+@@ -1144,6 +1144,8 @@ void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) |
1809 |
+ static __printf(2,3) void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) {} |
1810 |
+ #endif |
1811 |
+ |
1812 |
++extern void svc_tcp_prep_reply_hdr(struct svc_rqst *); |
1813 |
++ |
1814 |
+ /* |
1815 |
+ * Common routine for processing the RPC request. |
1816 |
+ */ |
1817 |
+@@ -1172,7 +1174,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) |
1818 |
+ clear_bit(RQ_DROPME, &rqstp->rq_flags); |
1819 |
+ |
1820 |
+ /* Setup reply header */ |
1821 |
+- rqstp->rq_xprt->xpt_ops->xpo_prep_reply_hdr(rqstp); |
1822 |
++ if (rqstp->rq_prot == IPPROTO_TCP) |
1823 |
++ svc_tcp_prep_reply_hdr(rqstp); |
1824 |
+ |
1825 |
+ svc_putu32(resv, rqstp->rq_xid); |
1826 |
+ |
1827 |
+@@ -1244,7 +1247,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) |
1828 |
+ * for lower versions. RPC_PROG_MISMATCH seems to be the closest |
1829 |
+ * fit. |
1830 |
+ */ |
1831 |
+- if (versp->vs_need_cong_ctrl && |
1832 |
++ if (versp->vs_need_cong_ctrl && rqstp->rq_xprt && |
1833 |
+ !test_bit(XPT_CONG_CTRL, &rqstp->rq_xprt->xpt_flags)) |
1834 |
+ goto err_bad_vers; |
1835 |
+ |
1836 |
+@@ -1336,7 +1339,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) |
1837 |
+ return 0; |
1838 |
+ |
1839 |
+ close: |
1840 |
+- if (test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags)) |
1841 |
++ if (rqstp->rq_xprt && test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags)) |
1842 |
+ svc_close_xprt(rqstp->rq_xprt); |
1843 |
+ dprintk("svc: svc_process close\n"); |
1844 |
+ return 0; |
1845 |
+@@ -1459,10 +1462,10 @@ bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req, |
1846 |
+ dprintk("svc: %s(%p)\n", __func__, req); |
1847 |
+ |
1848 |
+ /* Build the svc_rqst used by the common processing routine */ |
1849 |
+- rqstp->rq_xprt = serv->sv_bc_xprt; |
1850 |
+ rqstp->rq_xid = req->rq_xid; |
1851 |
+ rqstp->rq_prot = req->rq_xprt->prot; |
1852 |
+ rqstp->rq_server = serv; |
1853 |
++ rqstp->rq_bc_net = req->rq_xprt->xprt_net; |
1854 |
+ |
1855 |
+ rqstp->rq_addrlen = sizeof(req->rq_xprt->addr); |
1856 |
+ memcpy(&rqstp->rq_addr, &req->rq_xprt->addr, rqstp->rq_addrlen); |
1857 |
+diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c |
1858 |
+index 51d36230b6e3..bd42da287c26 100644 |
1859 |
+--- a/net/sunrpc/svc_xprt.c |
1860 |
++++ b/net/sunrpc/svc_xprt.c |
1861 |
+@@ -468,10 +468,11 @@ out: |
1862 |
+ */ |
1863 |
+ void svc_reserve(struct svc_rqst *rqstp, int space) |
1864 |
+ { |
1865 |
++ struct svc_xprt *xprt = rqstp->rq_xprt; |
1866 |
++ |
1867 |
+ space += rqstp->rq_res.head[0].iov_len; |
1868 |
+ |
1869 |
+- if (space < rqstp->rq_reserved) { |
1870 |
+- struct svc_xprt *xprt = rqstp->rq_xprt; |
1871 |
++ if (xprt && space < rqstp->rq_reserved) { |
1872 |
+ atomic_sub((rqstp->rq_reserved - space), &xprt->xpt_reserved); |
1873 |
+ rqstp->rq_reserved = space; |
1874 |
+ |
1875 |
+diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c |
1876 |
+index b7e67310ec37..b90492c43711 100644 |
1877 |
+--- a/net/sunrpc/svcsock.c |
1878 |
++++ b/net/sunrpc/svcsock.c |
1879 |
+@@ -1173,7 +1173,7 @@ static int svc_tcp_sendto(struct svc_rqst *rqstp) |
1880 |
+ /* |
1881 |
+ * Setup response header. TCP has a 4B record length field. |
1882 |
+ */ |
1883 |
+-static void svc_tcp_prep_reply_hdr(struct svc_rqst *rqstp) |
1884 |
++void svc_tcp_prep_reply_hdr(struct svc_rqst *rqstp) |
1885 |
+ { |
1886 |
+ struct kvec *resv = &rqstp->rq_res.head[0]; |
1887 |
+ |
1888 |
+diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c |
1889 |
+index 0d998c54564d..5a5b3780456f 100644 |
1890 |
+--- a/scripts/mod/modpost.c |
1891 |
++++ b/scripts/mod/modpost.c |
1892 |
+@@ -2157,7 +2157,7 @@ static void add_intree_flag(struct buffer *b, int is_intree) |
1893 |
+ /* Cannot check for assembler */ |
1894 |
+ static void add_retpoline(struct buffer *b) |
1895 |
+ { |
1896 |
+- buf_printf(b, "\n#ifdef RETPOLINE\n"); |
1897 |
++ buf_printf(b, "\n#ifdef CONFIG_RETPOLINE\n"); |
1898 |
+ buf_printf(b, "MODULE_INFO(retpoline, \"Y\");\n"); |
1899 |
+ buf_printf(b, "#endif\n"); |
1900 |
+ } |
1901 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
1902 |
+index 54fc9c0f07de..0d95316d6dbd 100644 |
1903 |
+--- a/sound/pci/hda/patch_realtek.c |
1904 |
++++ b/sound/pci/hda/patch_realtek.c |
1905 |
+@@ -4102,6 +4102,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) |
1906 |
+ case 0x10ec0295: |
1907 |
+ case 0x10ec0289: |
1908 |
+ case 0x10ec0299: |
1909 |
++ alc_process_coef_fw(codec, alc225_pre_hsmode); |
1910 |
+ alc_process_coef_fw(codec, coef0225); |
1911 |
+ break; |
1912 |
+ case 0x10ec0867: |
1913 |
+@@ -5380,6 +5381,13 @@ static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, |
1914 |
+ snd_hda_override_wcaps(codec, 0x03, 0); |
1915 |
+ } |
1916 |
+ |
1917 |
++static void alc_fixup_disable_mic_vref(struct hda_codec *codec, |
1918 |
++ const struct hda_fixup *fix, int action) |
1919 |
++{ |
1920 |
++ if (action == HDA_FIXUP_ACT_PRE_PROBE) |
1921 |
++ snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); |
1922 |
++} |
1923 |
++ |
1924 |
+ /* for hda_fixup_thinkpad_acpi() */ |
1925 |
+ #include "thinkpad_helper.c" |
1926 |
+ |
1927 |
+@@ -5492,6 +5500,7 @@ enum { |
1928 |
+ ALC293_FIXUP_LENOVO_SPK_NOISE, |
1929 |
+ ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, |
1930 |
+ ALC255_FIXUP_DELL_SPK_NOISE, |
1931 |
++ ALC225_FIXUP_DISABLE_MIC_VREF, |
1932 |
+ ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, |
1933 |
+ ALC295_FIXUP_DISABLE_DAC3, |
1934 |
+ ALC280_FIXUP_HP_HEADSET_MIC, |
1935 |
+@@ -6191,6 +6200,12 @@ static const struct hda_fixup alc269_fixups[] = { |
1936 |
+ .chained = true, |
1937 |
+ .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE |
1938 |
+ }, |
1939 |
++ [ALC225_FIXUP_DISABLE_MIC_VREF] = { |
1940 |
++ .type = HDA_FIXUP_FUNC, |
1941 |
++ .v.func = alc_fixup_disable_mic_vref, |
1942 |
++ .chained = true, |
1943 |
++ .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE |
1944 |
++ }, |
1945 |
+ [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = { |
1946 |
+ .type = HDA_FIXUP_VERBS, |
1947 |
+ .v.verbs = (const struct hda_verb[]) { |
1948 |
+@@ -6200,7 +6215,7 @@ static const struct hda_fixup alc269_fixups[] = { |
1949 |
+ {} |
1950 |
+ }, |
1951 |
+ .chained = true, |
1952 |
+- .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE |
1953 |
++ .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF |
1954 |
+ }, |
1955 |
+ [ALC280_FIXUP_HP_HEADSET_MIC] = { |
1956 |
+ .type = HDA_FIXUP_FUNC, |
1957 |
+@@ -6503,6 +6518,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
1958 |
+ SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), |
1959 |
+ SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), |
1960 |
+ SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB), |
1961 |
++ SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), |
1962 |
+ SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
1963 |
+ SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
1964 |
+ SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), |