1 |
commit: 0183b5b10995269f4f30116a291631085336b482 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Oct 7 12:47:24 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Oct 7 12:47:24 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=0183b5b1 |
7 |
|
8 |
Linux patch 5.8.14 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1013_linux-5.8.14.patch | 3103 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 3107 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 0944db1..6e16f1d 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -95,6 +95,10 @@ Patch: 1012_linux-5.8.13.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.8.13 |
23 |
|
24 |
+Patch: 1013_linux-5.8.14.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.8.14 |
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/1013_linux-5.8.14.patch b/1013_linux-5.8.14.patch |
33 |
new file mode 100644 |
34 |
index 0000000..fe7cc03 |
35 |
--- /dev/null |
36 |
+++ b/1013_linux-5.8.14.patch |
37 |
@@ -0,0 +1,3103 @@ |
38 |
+diff --git a/Documentation/devicetree/bindings/gpio/sgpio-aspeed.txt b/Documentation/devicetree/bindings/gpio/sgpio-aspeed.txt |
39 |
+index d4d83916c09dd..be329ea4794f8 100644 |
40 |
+--- a/Documentation/devicetree/bindings/gpio/sgpio-aspeed.txt |
41 |
++++ b/Documentation/devicetree/bindings/gpio/sgpio-aspeed.txt |
42 |
+@@ -20,8 +20,9 @@ Required properties: |
43 |
+ - gpio-controller : Marks the device node as a GPIO controller |
44 |
+ - interrupts : Interrupt specifier, see interrupt-controller/interrupts.txt |
45 |
+ - interrupt-controller : Mark the GPIO controller as an interrupt-controller |
46 |
+-- ngpios : number of GPIO lines, see gpio.txt |
47 |
+- (should be multiple of 8, up to 80 pins) |
48 |
++- ngpios : number of *hardware* GPIO lines, see gpio.txt. This will expose |
49 |
++ 2 software GPIOs per hardware GPIO: one for hardware input, one for hardware |
50 |
++ output. Up to 80 pins, must be a multiple of 8. |
51 |
+ - clocks : A phandle to the APB clock for SGPM clock division |
52 |
+ - bus-frequency : SGPM CLK frequency |
53 |
+ |
54 |
+diff --git a/Makefile b/Makefile |
55 |
+index 0d81d8cba48b6..33ceda527e5ef 100644 |
56 |
+--- a/Makefile |
57 |
++++ b/Makefile |
58 |
+@@ -1,7 +1,7 @@ |
59 |
+ # SPDX-License-Identifier: GPL-2.0 |
60 |
+ VERSION = 5 |
61 |
+ PATCHLEVEL = 8 |
62 |
+-SUBLEVEL = 13 |
63 |
++SUBLEVEL = 14 |
64 |
+ EXTRAVERSION = |
65 |
+ NAME = Kleptomaniac Octopus |
66 |
+ |
67 |
+diff --git a/block/blk-mq.c b/block/blk-mq.c |
68 |
+index a366726094a89..8e623e0282757 100644 |
69 |
+--- a/block/blk-mq.c |
70 |
++++ b/block/blk-mq.c |
71 |
+@@ -1304,6 +1304,11 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list, |
72 |
+ |
73 |
+ hctx->dispatched[queued_to_index(queued)]++; |
74 |
+ |
75 |
++ /* If we didn't flush the entire list, we could have told the driver |
76 |
++ * there was more coming, but that turned out to be a lie. |
77 |
++ */ |
78 |
++ if ((!list_empty(list) || errors) && q->mq_ops->commit_rqs && queued) |
79 |
++ q->mq_ops->commit_rqs(hctx); |
80 |
+ /* |
81 |
+ * Any items that need requeuing? Stuff them into hctx->dispatch, |
82 |
+ * that is where we will continue on next queue run. |
83 |
+@@ -1311,14 +1316,6 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list, |
84 |
+ if (!list_empty(list)) { |
85 |
+ bool needs_restart; |
86 |
+ |
87 |
+- /* |
88 |
+- * If we didn't flush the entire list, we could have told |
89 |
+- * the driver there was more coming, but that turned out to |
90 |
+- * be a lie. |
91 |
+- */ |
92 |
+- if (q->mq_ops->commit_rqs && queued) |
93 |
+- q->mq_ops->commit_rqs(hctx); |
94 |
+- |
95 |
+ spin_lock(&hctx->lock); |
96 |
+ list_splice_tail_init(list, &hctx->dispatch); |
97 |
+ spin_unlock(&hctx->lock); |
98 |
+@@ -1971,6 +1968,7 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx, |
99 |
+ struct list_head *list) |
100 |
+ { |
101 |
+ int queued = 0; |
102 |
++ int errors = 0; |
103 |
+ |
104 |
+ while (!list_empty(list)) { |
105 |
+ blk_status_t ret; |
106 |
+@@ -1987,6 +1985,7 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx, |
107 |
+ break; |
108 |
+ } |
109 |
+ blk_mq_end_request(rq, ret); |
110 |
++ errors++; |
111 |
+ } else |
112 |
+ queued++; |
113 |
+ } |
114 |
+@@ -1996,7 +1995,8 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx, |
115 |
+ * the driver there was more coming, but that turned out to |
116 |
+ * be a lie. |
117 |
+ */ |
118 |
+- if (!list_empty(list) && hctx->queue->mq_ops->commit_rqs && queued) |
119 |
++ if ((!list_empty(list) || errors) && |
120 |
++ hctx->queue->mq_ops->commit_rqs && queued) |
121 |
+ hctx->queue->mq_ops->commit_rqs(hctx); |
122 |
+ } |
123 |
+ |
124 |
+diff --git a/block/blk-settings.c b/block/blk-settings.c |
125 |
+index 9a2c23cd97007..525bdb699deb8 100644 |
126 |
+--- a/block/blk-settings.c |
127 |
++++ b/block/blk-settings.c |
128 |
+@@ -832,6 +832,52 @@ bool blk_queue_can_use_dma_map_merging(struct request_queue *q, |
129 |
+ } |
130 |
+ EXPORT_SYMBOL_GPL(blk_queue_can_use_dma_map_merging); |
131 |
+ |
132 |
++/** |
133 |
++ * blk_queue_set_zoned - configure a disk queue zoned model. |
134 |
++ * @disk: the gendisk of the queue to configure |
135 |
++ * @model: the zoned model to set |
136 |
++ * |
137 |
++ * Set the zoned model of the request queue of @disk according to @model. |
138 |
++ * When @model is BLK_ZONED_HM (host managed), this should be called only |
139 |
++ * if zoned block device support is enabled (CONFIG_BLK_DEV_ZONED option). |
140 |
++ * If @model specifies BLK_ZONED_HA (host aware), the effective model used |
141 |
++ * depends on CONFIG_BLK_DEV_ZONED settings and on the existence of partitions |
142 |
++ * on the disk. |
143 |
++ */ |
144 |
++void blk_queue_set_zoned(struct gendisk *disk, enum blk_zoned_model model) |
145 |
++{ |
146 |
++ switch (model) { |
147 |
++ case BLK_ZONED_HM: |
148 |
++ /* |
149 |
++ * Host managed devices are supported only if |
150 |
++ * CONFIG_BLK_DEV_ZONED is enabled. |
151 |
++ */ |
152 |
++ WARN_ON_ONCE(!IS_ENABLED(CONFIG_BLK_DEV_ZONED)); |
153 |
++ break; |
154 |
++ case BLK_ZONED_HA: |
155 |
++ /* |
156 |
++ * Host aware devices can be treated either as regular block |
157 |
++ * devices (similar to drive managed devices) or as zoned block |
158 |
++ * devices to take advantage of the zone command set, similarly |
159 |
++ * to host managed devices. We try the latter if there are no |
160 |
++ * partitions and zoned block device support is enabled, else |
161 |
++ * we do nothing special as far as the block layer is concerned. |
162 |
++ */ |
163 |
++ if (!IS_ENABLED(CONFIG_BLK_DEV_ZONED) || |
164 |
++ disk_has_partitions(disk)) |
165 |
++ model = BLK_ZONED_NONE; |
166 |
++ break; |
167 |
++ case BLK_ZONED_NONE: |
168 |
++ default: |
169 |
++ if (WARN_ON_ONCE(model != BLK_ZONED_NONE)) |
170 |
++ model = BLK_ZONED_NONE; |
171 |
++ break; |
172 |
++ } |
173 |
++ |
174 |
++ disk->queue->limits.zoned = model; |
175 |
++} |
176 |
++EXPORT_SYMBOL_GPL(blk_queue_set_zoned); |
177 |
++ |
178 |
+ static int __init blk_settings_init(void) |
179 |
+ { |
180 |
+ blk_max_low_pfn = max_low_pfn - 1; |
181 |
+diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c |
182 |
+index 51564fc23c639..f4086287bb71b 100644 |
183 |
+--- a/drivers/clk/samsung/clk-exynos4.c |
184 |
++++ b/drivers/clk/samsung/clk-exynos4.c |
185 |
+@@ -927,7 +927,7 @@ static const struct samsung_gate_clock exynos4210_gate_clks[] __initconst = { |
186 |
+ GATE(CLK_PCIE, "pcie", "aclk133", GATE_IP_FSYS, 14, 0, 0), |
187 |
+ GATE(CLK_SMMU_PCIE, "smmu_pcie", "aclk133", GATE_IP_FSYS, 18, 0, 0), |
188 |
+ GATE(CLK_MODEMIF, "modemif", "aclk100", GATE_IP_PERIL, 28, 0, 0), |
189 |
+- GATE(CLK_CHIPID, "chipid", "aclk100", E4210_GATE_IP_PERIR, 0, 0, 0), |
190 |
++ GATE(CLK_CHIPID, "chipid", "aclk100", E4210_GATE_IP_PERIR, 0, CLK_IGNORE_UNUSED, 0), |
191 |
+ GATE(CLK_SYSREG, "sysreg", "aclk100", E4210_GATE_IP_PERIR, 0, |
192 |
+ CLK_IGNORE_UNUSED, 0), |
193 |
+ GATE(CLK_HDMI_CEC, "hdmi_cec", "aclk100", E4210_GATE_IP_PERIR, 11, 0, |
194 |
+@@ -969,7 +969,7 @@ static const struct samsung_gate_clock exynos4x12_gate_clks[] __initconst = { |
195 |
+ 0), |
196 |
+ GATE(CLK_TSADC, "tsadc", "aclk133", E4X12_GATE_BUS_FSYS1, 16, 0, 0), |
197 |
+ GATE(CLK_MIPI_HSI, "mipi_hsi", "aclk133", GATE_IP_FSYS, 10, 0, 0), |
198 |
+- GATE(CLK_CHIPID, "chipid", "aclk100", E4X12_GATE_IP_PERIR, 0, 0, 0), |
199 |
++ GATE(CLK_CHIPID, "chipid", "aclk100", E4X12_GATE_IP_PERIR, 0, CLK_IGNORE_UNUSED, 0), |
200 |
+ GATE(CLK_SYSREG, "sysreg", "aclk100", E4X12_GATE_IP_PERIR, 1, |
201 |
+ CLK_IGNORE_UNUSED, 0), |
202 |
+ GATE(CLK_HDMI_CEC, "hdmi_cec", "aclk100", E4X12_GATE_IP_PERIR, 11, 0, |
203 |
+diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c |
204 |
+index fea33399a632d..bd620876544d9 100644 |
205 |
+--- a/drivers/clk/samsung/clk-exynos5420.c |
206 |
++++ b/drivers/clk/samsung/clk-exynos5420.c |
207 |
+@@ -1655,6 +1655,11 @@ static void __init exynos5x_clk_init(struct device_node *np, |
208 |
+ * main G3D clock enablement status. |
209 |
+ */ |
210 |
+ clk_prepare_enable(__clk_lookup("mout_sw_aclk_g3d")); |
211 |
++ /* |
212 |
++ * Keep top BPLL mux enabled permanently to ensure that DRAM operates |
213 |
++ * properly. |
214 |
++ */ |
215 |
++ clk_prepare_enable(__clk_lookup("mout_bpll")); |
216 |
+ |
217 |
+ samsung_clk_of_add_provider(np, ctx); |
218 |
+ } |
219 |
+diff --git a/drivers/clk/socfpga/clk-s10.c b/drivers/clk/socfpga/clk-s10.c |
220 |
+index c1dfc9b34e4e9..661a8e9bfb9bd 100644 |
221 |
+--- a/drivers/clk/socfpga/clk-s10.c |
222 |
++++ b/drivers/clk/socfpga/clk-s10.c |
223 |
+@@ -209,7 +209,7 @@ static const struct stratix10_perip_cnt_clock s10_main_perip_cnt_clks[] = { |
224 |
+ { STRATIX10_EMAC_B_FREE_CLK, "emacb_free_clk", NULL, emacb_free_mux, ARRAY_SIZE(emacb_free_mux), |
225 |
+ 0, 0, 2, 0xB0, 1}, |
226 |
+ { STRATIX10_EMAC_PTP_FREE_CLK, "emac_ptp_free_clk", NULL, emac_ptp_free_mux, |
227 |
+- ARRAY_SIZE(emac_ptp_free_mux), 0, 0, 4, 0xB0, 2}, |
228 |
++ ARRAY_SIZE(emac_ptp_free_mux), 0, 0, 2, 0xB0, 2}, |
229 |
+ { STRATIX10_GPIO_DB_FREE_CLK, "gpio_db_free_clk", NULL, gpio_db_free_mux, |
230 |
+ ARRAY_SIZE(gpio_db_free_mux), 0, 0, 0, 0xB0, 3}, |
231 |
+ { STRATIX10_SDMMC_FREE_CLK, "sdmmc_free_clk", NULL, sdmmc_free_mux, |
232 |
+diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c |
233 |
+index 0b212cf2e7942..1cc982d3de635 100644 |
234 |
+--- a/drivers/clk/tegra/clk-pll.c |
235 |
++++ b/drivers/clk/tegra/clk-pll.c |
236 |
+@@ -1601,9 +1601,6 @@ static int clk_plle_tegra114_enable(struct clk_hw *hw) |
237 |
+ unsigned long flags = 0; |
238 |
+ unsigned long input_rate; |
239 |
+ |
240 |
+- if (clk_pll_is_enabled(hw)) |
241 |
+- return 0; |
242 |
+- |
243 |
+ input_rate = clk_hw_get_rate(clk_hw_get_parent(hw)); |
244 |
+ |
245 |
+ if (_get_table_rate(hw, &sel, pll->params->fixed_rate, input_rate)) |
246 |
+diff --git a/drivers/clk/tegra/clk-tegra210-emc.c b/drivers/clk/tegra/clk-tegra210-emc.c |
247 |
+index 352a2c3fc3740..51fd0ec2a2d04 100644 |
248 |
+--- a/drivers/clk/tegra/clk-tegra210-emc.c |
249 |
++++ b/drivers/clk/tegra/clk-tegra210-emc.c |
250 |
+@@ -12,6 +12,8 @@ |
251 |
+ #include <linux/io.h> |
252 |
+ #include <linux/slab.h> |
253 |
+ |
254 |
++#include "clk.h" |
255 |
++ |
256 |
+ #define CLK_SOURCE_EMC 0x19c |
257 |
+ #define CLK_SOURCE_EMC_2X_CLK_SRC GENMASK(31, 29) |
258 |
+ #define CLK_SOURCE_EMC_MC_EMC_SAME_FREQ BIT(16) |
259 |
+diff --git a/drivers/clocksource/timer-gx6605s.c b/drivers/clocksource/timer-gx6605s.c |
260 |
+index 80d0939d040b5..8d386adbe8009 100644 |
261 |
+--- a/drivers/clocksource/timer-gx6605s.c |
262 |
++++ b/drivers/clocksource/timer-gx6605s.c |
263 |
+@@ -28,6 +28,7 @@ static irqreturn_t gx6605s_timer_interrupt(int irq, void *dev) |
264 |
+ void __iomem *base = timer_of_base(to_timer_of(ce)); |
265 |
+ |
266 |
+ writel_relaxed(GX6605S_STATUS_CLR, base + TIMER_STATUS); |
267 |
++ writel_relaxed(0, base + TIMER_INI); |
268 |
+ |
269 |
+ ce->event_handler(ce); |
270 |
+ |
271 |
+diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c |
272 |
+index 3806f911b61c0..915172e3ec906 100644 |
273 |
+--- a/drivers/cpuidle/cpuidle-psci.c |
274 |
++++ b/drivers/cpuidle/cpuidle-psci.c |
275 |
+@@ -64,7 +64,7 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev, |
276 |
+ return -1; |
277 |
+ |
278 |
+ /* Do runtime PM to manage a hierarchical CPU toplogy. */ |
279 |
+- pm_runtime_put_sync_suspend(pd_dev); |
280 |
++ RCU_NONIDLE(pm_runtime_put_sync_suspend(pd_dev)); |
281 |
+ |
282 |
+ state = psci_get_domain_state(); |
283 |
+ if (!state) |
284 |
+@@ -72,7 +72,7 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev, |
285 |
+ |
286 |
+ ret = psci_cpu_suspend_enter(state) ? -1 : idx; |
287 |
+ |
288 |
+- pm_runtime_get_sync(pd_dev); |
289 |
++ RCU_NONIDLE(pm_runtime_get_sync(pd_dev)); |
290 |
+ |
291 |
+ cpu_pm_exit(); |
292 |
+ |
293 |
+diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c |
294 |
+index 604f803579312..323822372b4ce 100644 |
295 |
+--- a/drivers/dma/dmatest.c |
296 |
++++ b/drivers/dma/dmatest.c |
297 |
+@@ -129,6 +129,7 @@ struct dmatest_params { |
298 |
+ * @nr_channels: number of channels under test |
299 |
+ * @lock: access protection to the fields of this structure |
300 |
+ * @did_init: module has been initialized completely |
301 |
++ * @last_error: test has faced configuration issues |
302 |
+ */ |
303 |
+ static struct dmatest_info { |
304 |
+ /* Test parameters */ |
305 |
+@@ -137,6 +138,7 @@ static struct dmatest_info { |
306 |
+ /* Internal state */ |
307 |
+ struct list_head channels; |
308 |
+ unsigned int nr_channels; |
309 |
++ int last_error; |
310 |
+ struct mutex lock; |
311 |
+ bool did_init; |
312 |
+ } test_info = { |
313 |
+@@ -1175,10 +1177,22 @@ static int dmatest_run_set(const char *val, const struct kernel_param *kp) |
314 |
+ return ret; |
315 |
+ } else if (dmatest_run) { |
316 |
+ if (!is_threaded_test_pending(info)) { |
317 |
+- pr_info("No channels configured, continue with any\n"); |
318 |
+- if (!is_threaded_test_run(info)) |
319 |
+- stop_threaded_test(info); |
320 |
+- add_threaded_test(info); |
321 |
++ /* |
322 |
++ * We have nothing to run. This can be due to: |
323 |
++ */ |
324 |
++ ret = info->last_error; |
325 |
++ if (ret) { |
326 |
++ /* 1) Misconfiguration */ |
327 |
++ pr_err("Channel misconfigured, can't continue\n"); |
328 |
++ mutex_unlock(&info->lock); |
329 |
++ return ret; |
330 |
++ } else { |
331 |
++ /* 2) We rely on defaults */ |
332 |
++ pr_info("No channels configured, continue with any\n"); |
333 |
++ if (!is_threaded_test_run(info)) |
334 |
++ stop_threaded_test(info); |
335 |
++ add_threaded_test(info); |
336 |
++ } |
337 |
+ } |
338 |
+ start_threaded_tests(info); |
339 |
+ } else { |
340 |
+@@ -1195,7 +1209,7 @@ static int dmatest_chan_set(const char *val, const struct kernel_param *kp) |
341 |
+ struct dmatest_info *info = &test_info; |
342 |
+ struct dmatest_chan *dtc; |
343 |
+ char chan_reset_val[20]; |
344 |
+- int ret = 0; |
345 |
++ int ret; |
346 |
+ |
347 |
+ mutex_lock(&info->lock); |
348 |
+ ret = param_set_copystring(val, kp); |
349 |
+@@ -1250,12 +1264,14 @@ static int dmatest_chan_set(const char *val, const struct kernel_param *kp) |
350 |
+ goto add_chan_err; |
351 |
+ } |
352 |
+ |
353 |
++ info->last_error = ret; |
354 |
+ mutex_unlock(&info->lock); |
355 |
+ |
356 |
+ return ret; |
357 |
+ |
358 |
+ add_chan_err: |
359 |
+ param_set_copystring(chan_reset_val, kp); |
360 |
++ info->last_error = ret; |
361 |
+ mutex_unlock(&info->lock); |
362 |
+ |
363 |
+ return ret; |
364 |
+diff --git a/drivers/gpio/gpio-amd-fch.c b/drivers/gpio/gpio-amd-fch.c |
365 |
+index 4e44ba4d7423c..2a21354ed6a03 100644 |
366 |
+--- a/drivers/gpio/gpio-amd-fch.c |
367 |
++++ b/drivers/gpio/gpio-amd-fch.c |
368 |
+@@ -92,7 +92,7 @@ static int amd_fch_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio) |
369 |
+ ret = (readl_relaxed(ptr) & AMD_FCH_GPIO_FLAG_DIRECTION); |
370 |
+ spin_unlock_irqrestore(&priv->lock, flags); |
371 |
+ |
372 |
+- return ret ? GPIO_LINE_DIRECTION_IN : GPIO_LINE_DIRECTION_OUT; |
373 |
++ return ret ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN; |
374 |
+ } |
375 |
+ |
376 |
+ static void amd_fch_gpio_set(struct gpio_chip *gc, |
377 |
+diff --git a/drivers/gpio/gpio-aspeed-sgpio.c b/drivers/gpio/gpio-aspeed-sgpio.c |
378 |
+index d16645c1d8d9d..a0eb00c024f62 100644 |
379 |
+--- a/drivers/gpio/gpio-aspeed-sgpio.c |
380 |
++++ b/drivers/gpio/gpio-aspeed-sgpio.c |
381 |
+@@ -17,7 +17,17 @@ |
382 |
+ #include <linux/spinlock.h> |
383 |
+ #include <linux/string.h> |
384 |
+ |
385 |
+-#define MAX_NR_SGPIO 80 |
386 |
++/* |
387 |
++ * MAX_NR_HW_GPIO represents the number of actual hardware-supported GPIOs (ie, |
388 |
++ * slots within the clocked serial GPIO data). Since each HW GPIO is both an |
389 |
++ * input and an output, we provide MAX_NR_HW_GPIO * 2 lines on our gpiochip |
390 |
++ * device. |
391 |
++ * |
392 |
++ * We use SGPIO_OUTPUT_OFFSET to define the split between the inputs and |
393 |
++ * outputs; the inputs start at line 0, the outputs start at OUTPUT_OFFSET. |
394 |
++ */ |
395 |
++#define MAX_NR_HW_SGPIO 80 |
396 |
++#define SGPIO_OUTPUT_OFFSET MAX_NR_HW_SGPIO |
397 |
+ |
398 |
+ #define ASPEED_SGPIO_CTRL 0x54 |
399 |
+ |
400 |
+@@ -30,8 +40,8 @@ struct aspeed_sgpio { |
401 |
+ struct clk *pclk; |
402 |
+ spinlock_t lock; |
403 |
+ void __iomem *base; |
404 |
+- uint32_t dir_in[3]; |
405 |
+ int irq; |
406 |
++ int n_sgpio; |
407 |
+ }; |
408 |
+ |
409 |
+ struct aspeed_sgpio_bank { |
410 |
+@@ -111,31 +121,69 @@ static void __iomem *bank_reg(struct aspeed_sgpio *gpio, |
411 |
+ } |
412 |
+ } |
413 |
+ |
414 |
+-#define GPIO_BANK(x) ((x) >> 5) |
415 |
+-#define GPIO_OFFSET(x) ((x) & 0x1f) |
416 |
++#define GPIO_BANK(x) ((x % SGPIO_OUTPUT_OFFSET) >> 5) |
417 |
++#define GPIO_OFFSET(x) ((x % SGPIO_OUTPUT_OFFSET) & 0x1f) |
418 |
+ #define GPIO_BIT(x) BIT(GPIO_OFFSET(x)) |
419 |
+ |
420 |
+ static const struct aspeed_sgpio_bank *to_bank(unsigned int offset) |
421 |
+ { |
422 |
+- unsigned int bank = GPIO_BANK(offset); |
423 |
++ unsigned int bank; |
424 |
++ |
425 |
++ bank = GPIO_BANK(offset); |
426 |
+ |
427 |
+ WARN_ON(bank >= ARRAY_SIZE(aspeed_sgpio_banks)); |
428 |
+ return &aspeed_sgpio_banks[bank]; |
429 |
+ } |
430 |
+ |
431 |
++static int aspeed_sgpio_init_valid_mask(struct gpio_chip *gc, |
432 |
++ unsigned long *valid_mask, unsigned int ngpios) |
433 |
++{ |
434 |
++ struct aspeed_sgpio *sgpio = gpiochip_get_data(gc); |
435 |
++ int n = sgpio->n_sgpio; |
436 |
++ int c = SGPIO_OUTPUT_OFFSET - n; |
437 |
++ |
438 |
++ WARN_ON(ngpios < MAX_NR_HW_SGPIO * 2); |
439 |
++ |
440 |
++ /* input GPIOs in the lower range */ |
441 |
++ bitmap_set(valid_mask, 0, n); |
442 |
++ bitmap_clear(valid_mask, n, c); |
443 |
++ |
444 |
++ /* output GPIOS above SGPIO_OUTPUT_OFFSET */ |
445 |
++ bitmap_set(valid_mask, SGPIO_OUTPUT_OFFSET, n); |
446 |
++ bitmap_clear(valid_mask, SGPIO_OUTPUT_OFFSET + n, c); |
447 |
++ |
448 |
++ return 0; |
449 |
++} |
450 |
++ |
451 |
++static void aspeed_sgpio_irq_init_valid_mask(struct gpio_chip *gc, |
452 |
++ unsigned long *valid_mask, unsigned int ngpios) |
453 |
++{ |
454 |
++ struct aspeed_sgpio *sgpio = gpiochip_get_data(gc); |
455 |
++ int n = sgpio->n_sgpio; |
456 |
++ |
457 |
++ WARN_ON(ngpios < MAX_NR_HW_SGPIO * 2); |
458 |
++ |
459 |
++ /* input GPIOs in the lower range */ |
460 |
++ bitmap_set(valid_mask, 0, n); |
461 |
++ bitmap_clear(valid_mask, n, ngpios - n); |
462 |
++} |
463 |
++ |
464 |
++static bool aspeed_sgpio_is_input(unsigned int offset) |
465 |
++{ |
466 |
++ return offset < SGPIO_OUTPUT_OFFSET; |
467 |
++} |
468 |
++ |
469 |
+ static int aspeed_sgpio_get(struct gpio_chip *gc, unsigned int offset) |
470 |
+ { |
471 |
+ struct aspeed_sgpio *gpio = gpiochip_get_data(gc); |
472 |
+ const struct aspeed_sgpio_bank *bank = to_bank(offset); |
473 |
+ unsigned long flags; |
474 |
+ enum aspeed_sgpio_reg reg; |
475 |
+- bool is_input; |
476 |
+ int rc = 0; |
477 |
+ |
478 |
+ spin_lock_irqsave(&gpio->lock, flags); |
479 |
+ |
480 |
+- is_input = gpio->dir_in[GPIO_BANK(offset)] & GPIO_BIT(offset); |
481 |
+- reg = is_input ? reg_val : reg_rdata; |
482 |
++ reg = aspeed_sgpio_is_input(offset) ? reg_val : reg_rdata; |
483 |
+ rc = !!(ioread32(bank_reg(gpio, bank, reg)) & GPIO_BIT(offset)); |
484 |
+ |
485 |
+ spin_unlock_irqrestore(&gpio->lock, flags); |
486 |
+@@ -143,22 +191,31 @@ static int aspeed_sgpio_get(struct gpio_chip *gc, unsigned int offset) |
487 |
+ return rc; |
488 |
+ } |
489 |
+ |
490 |
+-static void sgpio_set_value(struct gpio_chip *gc, unsigned int offset, int val) |
491 |
++static int sgpio_set_value(struct gpio_chip *gc, unsigned int offset, int val) |
492 |
+ { |
493 |
+ struct aspeed_sgpio *gpio = gpiochip_get_data(gc); |
494 |
+ const struct aspeed_sgpio_bank *bank = to_bank(offset); |
495 |
+- void __iomem *addr; |
496 |
++ void __iomem *addr_r, *addr_w; |
497 |
+ u32 reg = 0; |
498 |
+ |
499 |
+- addr = bank_reg(gpio, bank, reg_val); |
500 |
+- reg = ioread32(addr); |
501 |
++ if (aspeed_sgpio_is_input(offset)) |
502 |
++ return -EINVAL; |
503 |
++ |
504 |
++ /* Since this is an output, read the cached value from rdata, then |
505 |
++ * update val. */ |
506 |
++ addr_r = bank_reg(gpio, bank, reg_rdata); |
507 |
++ addr_w = bank_reg(gpio, bank, reg_val); |
508 |
++ |
509 |
++ reg = ioread32(addr_r); |
510 |
+ |
511 |
+ if (val) |
512 |
+ reg |= GPIO_BIT(offset); |
513 |
+ else |
514 |
+ reg &= ~GPIO_BIT(offset); |
515 |
+ |
516 |
+- iowrite32(reg, addr); |
517 |
++ iowrite32(reg, addr_w); |
518 |
++ |
519 |
++ return 0; |
520 |
+ } |
521 |
+ |
522 |
+ static void aspeed_sgpio_set(struct gpio_chip *gc, unsigned int offset, int val) |
523 |
+@@ -175,43 +232,28 @@ static void aspeed_sgpio_set(struct gpio_chip *gc, unsigned int offset, int val) |
524 |
+ |
525 |
+ static int aspeed_sgpio_dir_in(struct gpio_chip *gc, unsigned int offset) |
526 |
+ { |
527 |
+- struct aspeed_sgpio *gpio = gpiochip_get_data(gc); |
528 |
+- unsigned long flags; |
529 |
+- |
530 |
+- spin_lock_irqsave(&gpio->lock, flags); |
531 |
+- gpio->dir_in[GPIO_BANK(offset)] |= GPIO_BIT(offset); |
532 |
+- spin_unlock_irqrestore(&gpio->lock, flags); |
533 |
+- |
534 |
+- return 0; |
535 |
++ return aspeed_sgpio_is_input(offset) ? 0 : -EINVAL; |
536 |
+ } |
537 |
+ |
538 |
+ static int aspeed_sgpio_dir_out(struct gpio_chip *gc, unsigned int offset, int val) |
539 |
+ { |
540 |
+ struct aspeed_sgpio *gpio = gpiochip_get_data(gc); |
541 |
+ unsigned long flags; |
542 |
++ int rc; |
543 |
+ |
544 |
+- spin_lock_irqsave(&gpio->lock, flags); |
545 |
+- |
546 |
+- gpio->dir_in[GPIO_BANK(offset)] &= ~GPIO_BIT(offset); |
547 |
+- sgpio_set_value(gc, offset, val); |
548 |
++ /* No special action is required for setting the direction; we'll |
549 |
++ * error-out in sgpio_set_value if this isn't an output GPIO */ |
550 |
+ |
551 |
++ spin_lock_irqsave(&gpio->lock, flags); |
552 |
++ rc = sgpio_set_value(gc, offset, val); |
553 |
+ spin_unlock_irqrestore(&gpio->lock, flags); |
554 |
+ |
555 |
+- return 0; |
556 |
++ return rc; |
557 |
+ } |
558 |
+ |
559 |
+ static int aspeed_sgpio_get_direction(struct gpio_chip *gc, unsigned int offset) |
560 |
+ { |
561 |
+- int dir_status; |
562 |
+- struct aspeed_sgpio *gpio = gpiochip_get_data(gc); |
563 |
+- unsigned long flags; |
564 |
+- |
565 |
+- spin_lock_irqsave(&gpio->lock, flags); |
566 |
+- dir_status = gpio->dir_in[GPIO_BANK(offset)] & GPIO_BIT(offset); |
567 |
+- spin_unlock_irqrestore(&gpio->lock, flags); |
568 |
+- |
569 |
+- return dir_status; |
570 |
+- |
571 |
++ return !!aspeed_sgpio_is_input(offset); |
572 |
+ } |
573 |
+ |
574 |
+ static void irqd_to_aspeed_sgpio_data(struct irq_data *d, |
575 |
+@@ -402,6 +444,7 @@ static int aspeed_sgpio_setup_irqs(struct aspeed_sgpio *gpio, |
576 |
+ |
577 |
+ irq = &gpio->chip.irq; |
578 |
+ irq->chip = &aspeed_sgpio_irqchip; |
579 |
++ irq->init_valid_mask = aspeed_sgpio_irq_init_valid_mask; |
580 |
+ irq->handler = handle_bad_irq; |
581 |
+ irq->default_type = IRQ_TYPE_NONE; |
582 |
+ irq->parent_handler = aspeed_sgpio_irq_handler; |
583 |
+@@ -409,17 +452,15 @@ static int aspeed_sgpio_setup_irqs(struct aspeed_sgpio *gpio, |
584 |
+ irq->parents = &gpio->irq; |
585 |
+ irq->num_parents = 1; |
586 |
+ |
587 |
+- /* set IRQ settings and Enable Interrupt */ |
588 |
++ /* Apply default IRQ settings */ |
589 |
+ for (i = 0; i < ARRAY_SIZE(aspeed_sgpio_banks); i++) { |
590 |
+ bank = &aspeed_sgpio_banks[i]; |
591 |
+ /* set falling or level-low irq */ |
592 |
+ iowrite32(0x00000000, bank_reg(gpio, bank, reg_irq_type0)); |
593 |
+ /* trigger type is edge */ |
594 |
+ iowrite32(0x00000000, bank_reg(gpio, bank, reg_irq_type1)); |
595 |
+- /* dual edge trigger mode. */ |
596 |
+- iowrite32(0xffffffff, bank_reg(gpio, bank, reg_irq_type2)); |
597 |
+- /* enable irq */ |
598 |
+- iowrite32(0xffffffff, bank_reg(gpio, bank, reg_irq_enable)); |
599 |
++ /* single edge trigger */ |
600 |
++ iowrite32(0x00000000, bank_reg(gpio, bank, reg_irq_type2)); |
601 |
+ } |
602 |
+ |
603 |
+ return 0; |
604 |
+@@ -452,11 +493,12 @@ static int __init aspeed_sgpio_probe(struct platform_device *pdev) |
605 |
+ if (rc < 0) { |
606 |
+ dev_err(&pdev->dev, "Could not read ngpios property\n"); |
607 |
+ return -EINVAL; |
608 |
+- } else if (nr_gpios > MAX_NR_SGPIO) { |
609 |
++ } else if (nr_gpios > MAX_NR_HW_SGPIO) { |
610 |
+ dev_err(&pdev->dev, "Number of GPIOs exceeds the maximum of %d: %d\n", |
611 |
+- MAX_NR_SGPIO, nr_gpios); |
612 |
++ MAX_NR_HW_SGPIO, nr_gpios); |
613 |
+ return -EINVAL; |
614 |
+ } |
615 |
++ gpio->n_sgpio = nr_gpios; |
616 |
+ |
617 |
+ rc = of_property_read_u32(pdev->dev.of_node, "bus-frequency", &sgpio_freq); |
618 |
+ if (rc < 0) { |
619 |
+@@ -497,7 +539,8 @@ static int __init aspeed_sgpio_probe(struct platform_device *pdev) |
620 |
+ spin_lock_init(&gpio->lock); |
621 |
+ |
622 |
+ gpio->chip.parent = &pdev->dev; |
623 |
+- gpio->chip.ngpio = nr_gpios; |
624 |
++ gpio->chip.ngpio = MAX_NR_HW_SGPIO * 2; |
625 |
++ gpio->chip.init_valid_mask = aspeed_sgpio_init_valid_mask; |
626 |
+ gpio->chip.direction_input = aspeed_sgpio_dir_in; |
627 |
+ gpio->chip.direction_output = aspeed_sgpio_dir_out; |
628 |
+ gpio->chip.get_direction = aspeed_sgpio_get_direction; |
629 |
+@@ -509,9 +552,6 @@ static int __init aspeed_sgpio_probe(struct platform_device *pdev) |
630 |
+ gpio->chip.label = dev_name(&pdev->dev); |
631 |
+ gpio->chip.base = -1; |
632 |
+ |
633 |
+- /* set all SGPIO pins as input (1). */ |
634 |
+- memset(gpio->dir_in, 0xff, sizeof(gpio->dir_in)); |
635 |
+- |
636 |
+ aspeed_sgpio_setup_irqs(gpio, pdev); |
637 |
+ |
638 |
+ rc = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio); |
639 |
+diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c |
640 |
+index 879db23d84549..d07bf2c3f1369 100644 |
641 |
+--- a/drivers/gpio/gpio-aspeed.c |
642 |
++++ b/drivers/gpio/gpio-aspeed.c |
643 |
+@@ -1114,8 +1114,8 @@ static const struct aspeed_gpio_config ast2500_config = |
644 |
+ |
645 |
+ static const struct aspeed_bank_props ast2600_bank_props[] = { |
646 |
+ /* input output */ |
647 |
+- {5, 0xffffffff, 0x0000ffff}, /* U/V/W/X */ |
648 |
+- {6, 0xffff0000, 0x0fff0000}, /* Y/Z */ |
649 |
++ {5, 0xffffffff, 0xffffff00}, /* U/V/W/X */ |
650 |
++ {6, 0x0000ffff, 0x0000ffff}, /* Y/Z */ |
651 |
+ { }, |
652 |
+ }; |
653 |
+ |
654 |
+diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c |
655 |
+index bc345185db260..1652897fdf90d 100644 |
656 |
+--- a/drivers/gpio/gpio-mockup.c |
657 |
++++ b/drivers/gpio/gpio-mockup.c |
658 |
+@@ -552,6 +552,7 @@ static int __init gpio_mockup_init(void) |
659 |
+ err = platform_driver_register(&gpio_mockup_driver); |
660 |
+ if (err) { |
661 |
+ gpio_mockup_err("error registering platform driver\n"); |
662 |
++ debugfs_remove_recursive(gpio_mockup_dbg_dir); |
663 |
+ return err; |
664 |
+ } |
665 |
+ |
666 |
+@@ -582,6 +583,7 @@ static int __init gpio_mockup_init(void) |
667 |
+ gpio_mockup_err("error registering device"); |
668 |
+ platform_driver_unregister(&gpio_mockup_driver); |
669 |
+ gpio_mockup_unregister_pdevs(); |
670 |
++ debugfs_remove_recursive(gpio_mockup_dbg_dir); |
671 |
+ return PTR_ERR(pdev); |
672 |
+ } |
673 |
+ |
674 |
+diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c |
675 |
+index a3b9bdedbe443..11c3bbd105f11 100644 |
676 |
+--- a/drivers/gpio/gpio-pca953x.c |
677 |
++++ b/drivers/gpio/gpio-pca953x.c |
678 |
+@@ -813,7 +813,7 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid) |
679 |
+ { |
680 |
+ struct pca953x_chip *chip = devid; |
681 |
+ struct gpio_chip *gc = &chip->gpio_chip; |
682 |
+- DECLARE_BITMAP(pending, MAX_LINE); |
683 |
++ DECLARE_BITMAP(pending, MAX_LINE) = {}; |
684 |
+ int level; |
685 |
+ bool ret; |
686 |
+ |
687 |
+@@ -938,6 +938,7 @@ out: |
688 |
+ static int device_pca957x_init(struct pca953x_chip *chip, u32 invert) |
689 |
+ { |
690 |
+ DECLARE_BITMAP(val, MAX_LINE); |
691 |
++ unsigned int i; |
692 |
+ int ret; |
693 |
+ |
694 |
+ ret = device_pca95xx_init(chip, invert); |
695 |
+@@ -945,7 +946,9 @@ static int device_pca957x_init(struct pca953x_chip *chip, u32 invert) |
696 |
+ goto out; |
697 |
+ |
698 |
+ /* To enable register 6, 7 to control pull up and pull down */ |
699 |
+- memset(val, 0x02, NBANK(chip)); |
700 |
++ for (i = 0; i < NBANK(chip); i++) |
701 |
++ bitmap_set_value8(val, 0x02, i * BANK_SZ); |
702 |
++ |
703 |
+ ret = pca953x_write_regs(chip, PCA957X_BKEN, val); |
704 |
+ if (ret) |
705 |
+ goto out; |
706 |
+diff --git a/drivers/gpio/gpio-siox.c b/drivers/gpio/gpio-siox.c |
707 |
+index 26e1fe092304d..f8c5e9fc4baca 100644 |
708 |
+--- a/drivers/gpio/gpio-siox.c |
709 |
++++ b/drivers/gpio/gpio-siox.c |
710 |
+@@ -245,6 +245,7 @@ static int gpio_siox_probe(struct siox_device *sdevice) |
711 |
+ girq->chip = &ddata->ichip; |
712 |
+ girq->default_type = IRQ_TYPE_NONE; |
713 |
+ girq->handler = handle_level_irq; |
714 |
++ girq->threaded = true; |
715 |
+ |
716 |
+ ret = devm_gpiochip_add_data(dev, &ddata->gchip, NULL); |
717 |
+ if (ret) |
718 |
+diff --git a/drivers/gpio/gpio-sprd.c b/drivers/gpio/gpio-sprd.c |
719 |
+index d7314d39ab65b..36ea8a3bd4510 100644 |
720 |
+--- a/drivers/gpio/gpio-sprd.c |
721 |
++++ b/drivers/gpio/gpio-sprd.c |
722 |
+@@ -149,17 +149,20 @@ static int sprd_gpio_irq_set_type(struct irq_data *data, |
723 |
+ sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0); |
724 |
+ sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 0); |
725 |
+ sprd_gpio_update(chip, offset, SPRD_GPIO_IEV, 1); |
726 |
++ sprd_gpio_update(chip, offset, SPRD_GPIO_IC, 1); |
727 |
+ irq_set_handler_locked(data, handle_edge_irq); |
728 |
+ break; |
729 |
+ case IRQ_TYPE_EDGE_FALLING: |
730 |
+ sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0); |
731 |
+ sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 0); |
732 |
+ sprd_gpio_update(chip, offset, SPRD_GPIO_IEV, 0); |
733 |
++ sprd_gpio_update(chip, offset, SPRD_GPIO_IC, 1); |
734 |
+ irq_set_handler_locked(data, handle_edge_irq); |
735 |
+ break; |
736 |
+ case IRQ_TYPE_EDGE_BOTH: |
737 |
+ sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0); |
738 |
+ sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 1); |
739 |
++ sprd_gpio_update(chip, offset, SPRD_GPIO_IC, 1); |
740 |
+ irq_set_handler_locked(data, handle_edge_irq); |
741 |
+ break; |
742 |
+ case IRQ_TYPE_LEVEL_HIGH: |
743 |
+diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c |
744 |
+index 6be0684cfa494..a70bc71281056 100644 |
745 |
+--- a/drivers/gpio/gpio-tc3589x.c |
746 |
++++ b/drivers/gpio/gpio-tc3589x.c |
747 |
+@@ -212,7 +212,7 @@ static void tc3589x_gpio_irq_sync_unlock(struct irq_data *d) |
748 |
+ continue; |
749 |
+ |
750 |
+ tc3589x_gpio->oldregs[i][j] = new; |
751 |
+- tc3589x_reg_write(tc3589x, regmap[i] + j * 8, new); |
752 |
++ tc3589x_reg_write(tc3589x, regmap[i] + j, new); |
753 |
+ } |
754 |
+ } |
755 |
+ |
756 |
+diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c |
757 |
+index 4fa075d49fbc9..6e813b13d6988 100644 |
758 |
+--- a/drivers/gpio/gpiolib.c |
759 |
++++ b/drivers/gpio/gpiolib.c |
760 |
+@@ -836,6 +836,21 @@ static __poll_t lineevent_poll(struct file *filep, |
761 |
+ return events; |
762 |
+ } |
763 |
+ |
764 |
++static ssize_t lineevent_get_size(void) |
765 |
++{ |
766 |
++#ifdef __x86_64__ |
767 |
++ /* i386 has no padding after 'id' */ |
768 |
++ if (in_ia32_syscall()) { |
769 |
++ struct compat_gpioeevent_data { |
770 |
++ compat_u64 timestamp; |
771 |
++ u32 id; |
772 |
++ }; |
773 |
++ |
774 |
++ return sizeof(struct compat_gpioeevent_data); |
775 |
++ } |
776 |
++#endif |
777 |
++ return sizeof(struct gpioevent_data); |
778 |
++} |
779 |
+ |
780 |
+ static ssize_t lineevent_read(struct file *filep, |
781 |
+ char __user *buf, |
782 |
+@@ -845,9 +860,20 @@ static ssize_t lineevent_read(struct file *filep, |
783 |
+ struct lineevent_state *le = filep->private_data; |
784 |
+ struct gpioevent_data ge; |
785 |
+ ssize_t bytes_read = 0; |
786 |
++ ssize_t ge_size; |
787 |
+ int ret; |
788 |
+ |
789 |
+- if (count < sizeof(ge)) |
790 |
++ /* |
791 |
++ * When compatible system call is being used the struct gpioevent_data, |
792 |
++ * in case of at least ia32, has different size due to the alignment |
793 |
++ * differences. Because we have first member 64 bits followed by one of |
794 |
++ * 32 bits there is no gap between them. The only difference is the |
795 |
++ * padding at the end of the data structure. Hence, we calculate the |
796 |
++ * actual sizeof() and pass this as an argument to copy_to_user() to |
797 |
++ * drop unneeded bytes from the output. |
798 |
++ */ |
799 |
++ ge_size = lineevent_get_size(); |
800 |
++ if (count < ge_size) |
801 |
+ return -EINVAL; |
802 |
+ |
803 |
+ do { |
804 |
+@@ -883,10 +909,10 @@ static ssize_t lineevent_read(struct file *filep, |
805 |
+ break; |
806 |
+ } |
807 |
+ |
808 |
+- if (copy_to_user(buf + bytes_read, &ge, sizeof(ge))) |
809 |
++ if (copy_to_user(buf + bytes_read, &ge, ge_size)) |
810 |
+ return -EFAULT; |
811 |
+- bytes_read += sizeof(ge); |
812 |
+- } while (count >= bytes_read + sizeof(ge)); |
813 |
++ bytes_read += ge_size; |
814 |
++ } while (count >= bytes_read + ge_size); |
815 |
+ |
816 |
+ return bytes_read; |
817 |
+ } |
818 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |
819 |
+index 5e51f0acf744f..f05fecbec0a86 100644 |
820 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |
821 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |
822 |
+@@ -297,7 +297,7 @@ int amdgpu_display_crtc_set_config(struct drm_mode_set *set, |
823 |
+ take the current one */ |
824 |
+ if (active && !adev->have_disp_power_ref) { |
825 |
+ adev->have_disp_power_ref = true; |
826 |
+- goto out; |
827 |
++ return ret; |
828 |
+ } |
829 |
+ /* if we have no active crtcs, then drop the power ref |
830 |
+ we got before */ |
831 |
+diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c |
832 |
+index 7d361623ff679..041f601b07d06 100644 |
833 |
+--- a/drivers/gpu/drm/i915/gvt/vgpu.c |
834 |
++++ b/drivers/gpu/drm/i915/gvt/vgpu.c |
835 |
+@@ -367,6 +367,7 @@ void intel_gvt_destroy_idle_vgpu(struct intel_vgpu *vgpu) |
836 |
+ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt, |
837 |
+ struct intel_vgpu_creation_params *param) |
838 |
+ { |
839 |
++ struct drm_i915_private *dev_priv = gvt->gt->i915; |
840 |
+ struct intel_vgpu *vgpu; |
841 |
+ int ret; |
842 |
+ |
843 |
+@@ -434,7 +435,10 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt, |
844 |
+ if (ret) |
845 |
+ goto out_clean_sched_policy; |
846 |
+ |
847 |
+- ret = intel_gvt_hypervisor_set_edid(vgpu, PORT_D); |
848 |
++ if (IS_BROADWELL(dev_priv)) |
849 |
++ ret = intel_gvt_hypervisor_set_edid(vgpu, PORT_B); |
850 |
++ else |
851 |
++ ret = intel_gvt_hypervisor_set_edid(vgpu, PORT_D); |
852 |
+ if (ret) |
853 |
+ goto out_clean_sched_policy; |
854 |
+ |
855 |
+diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c |
856 |
+index cc4fb916318f3..c3304028e3dcd 100644 |
857 |
+--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c |
858 |
++++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c |
859 |
+@@ -307,7 +307,7 @@ static struct regmap_config sun8i_mixer_regmap_config = { |
860 |
+ .reg_bits = 32, |
861 |
+ .val_bits = 32, |
862 |
+ .reg_stride = 4, |
863 |
+- .max_register = 0xbfffc, /* guessed */ |
864 |
++ .max_register = 0xffffc, /* guessed */ |
865 |
+ }; |
866 |
+ |
867 |
+ static int sun8i_mixer_of_get_id(struct device_node *node) |
868 |
+diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c |
869 |
+index 1213e1932ccb5..24d584a1c9a78 100644 |
870 |
+--- a/drivers/i2c/busses/i2c-cpm.c |
871 |
++++ b/drivers/i2c/busses/i2c-cpm.c |
872 |
+@@ -65,6 +65,9 @@ struct i2c_ram { |
873 |
+ char res1[4]; /* Reserved */ |
874 |
+ ushort rpbase; /* Relocation pointer */ |
875 |
+ char res2[2]; /* Reserved */ |
876 |
++ /* The following elements are only for CPM2 */ |
877 |
++ char res3[4]; /* Reserved */ |
878 |
++ uint sdmatmp; /* Internal */ |
879 |
+ }; |
880 |
+ |
881 |
+ #define I2COM_START 0x80 |
882 |
+diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c |
883 |
+index 3843eabeddda3..6126290e4d650 100644 |
884 |
+--- a/drivers/i2c/busses/i2c-i801.c |
885 |
++++ b/drivers/i2c/busses/i2c-i801.c |
886 |
+@@ -1913,6 +1913,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) |
887 |
+ |
888 |
+ pci_set_drvdata(dev, priv); |
889 |
+ |
890 |
++ dev_pm_set_driver_flags(&dev->dev, DPM_FLAG_NO_DIRECT_COMPLETE); |
891 |
+ pm_runtime_set_autosuspend_delay(&dev->dev, 1000); |
892 |
+ pm_runtime_use_autosuspend(&dev->dev); |
893 |
+ pm_runtime_put_autosuspend(&dev->dev); |
894 |
+diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c |
895 |
+index dfcf04e1967f1..2ad166355ec9b 100644 |
896 |
+--- a/drivers/i2c/busses/i2c-npcm7xx.c |
897 |
++++ b/drivers/i2c/busses/i2c-npcm7xx.c |
898 |
+@@ -2163,6 +2163,15 @@ static int npcm_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, |
899 |
+ if (bus->cmd_err == -EAGAIN) |
900 |
+ ret = i2c_recover_bus(adap); |
901 |
+ |
902 |
++ /* |
903 |
++ * After any type of error, check if LAST bit is still set, |
904 |
++ * due to a HW issue. |
905 |
++ * It cannot be cleared without resetting the module. |
906 |
++ */ |
907 |
++ if (bus->cmd_err && |
908 |
++ (NPCM_I2CRXF_CTL_LAST_PEC & ioread8(bus->reg + NPCM_I2CRXF_CTL))) |
909 |
++ npcm_i2c_reset(bus); |
910 |
++ |
911 |
+ #if IS_ENABLED(CONFIG_I2C_SLAVE) |
912 |
+ /* reenable slave if it was enabled */ |
913 |
+ if (bus->slave) |
914 |
+diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c |
915 |
+index 21fdcde77883f..56e7696aa3c0f 100644 |
916 |
+--- a/drivers/iio/adc/qcom-spmi-adc5.c |
917 |
++++ b/drivers/iio/adc/qcom-spmi-adc5.c |
918 |
+@@ -786,7 +786,7 @@ static int adc5_probe(struct platform_device *pdev) |
919 |
+ |
920 |
+ static struct platform_driver adc5_driver = { |
921 |
+ .driver = { |
922 |
+- .name = "qcom-spmi-adc5.c", |
923 |
++ .name = "qcom-spmi-adc5", |
924 |
+ .of_match_table = adc5_match_table, |
925 |
+ }, |
926 |
+ .probe = adc5_probe, |
927 |
+diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c |
928 |
+index 854d5e7587241..ef2fa0905208d 100644 |
929 |
+--- a/drivers/input/mouse/trackpoint.c |
930 |
++++ b/drivers/input/mouse/trackpoint.c |
931 |
+@@ -282,6 +282,8 @@ static int trackpoint_start_protocol(struct psmouse *psmouse, |
932 |
+ case TP_VARIANT_ALPS: |
933 |
+ case TP_VARIANT_ELAN: |
934 |
+ case TP_VARIANT_NXP: |
935 |
++ case TP_VARIANT_JYT_SYNAPTICS: |
936 |
++ case TP_VARIANT_SYNAPTICS: |
937 |
+ if (variant_id) |
938 |
+ *variant_id = param[0]; |
939 |
+ if (firmware_id) |
940 |
+diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h |
941 |
+index 37fb9aa88f9c3..a4c9b9652560a 100644 |
942 |
+--- a/drivers/input/serio/i8042-x86ia64io.h |
943 |
++++ b/drivers/input/serio/i8042-x86ia64io.h |
944 |
+@@ -721,6 +721,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nopnp_table[] = { |
945 |
+ DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"), |
946 |
+ }, |
947 |
+ }, |
948 |
++ { |
949 |
++ /* Acer Aspire 5 A515 */ |
950 |
++ .matches = { |
951 |
++ DMI_MATCH(DMI_BOARD_NAME, "Grumpy_PK"), |
952 |
++ DMI_MATCH(DMI_BOARD_VENDOR, "PK"), |
953 |
++ }, |
954 |
++ }, |
955 |
+ { } |
956 |
+ }; |
957 |
+ |
958 |
+diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c |
959 |
+index bf45f8e2c7edd..016e35d3d6c86 100644 |
960 |
+--- a/drivers/iommu/amd/init.c |
961 |
++++ b/drivers/iommu/amd/init.c |
962 |
+@@ -1110,25 +1110,6 @@ static int __init add_early_maps(void) |
963 |
+ return 0; |
964 |
+ } |
965 |
+ |
966 |
+-/* |
967 |
+- * Reads the device exclusion range from ACPI and initializes the IOMMU with |
968 |
+- * it |
969 |
+- */ |
970 |
+-static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m) |
971 |
+-{ |
972 |
+- if (!(m->flags & IVMD_FLAG_EXCL_RANGE)) |
973 |
+- return; |
974 |
+- |
975 |
+- /* |
976 |
+- * Treat per-device exclusion ranges as r/w unity-mapped regions |
977 |
+- * since some buggy BIOSes might lead to the overwritten exclusion |
978 |
+- * range (exclusion_start and exclusion_length members). This |
979 |
+- * happens when there are multiple exclusion ranges (IVMD entries) |
980 |
+- * defined in ACPI table. |
981 |
+- */ |
982 |
+- m->flags = (IVMD_FLAG_IW | IVMD_FLAG_IR | IVMD_FLAG_UNITY_MAP); |
983 |
+-} |
984 |
+- |
985 |
+ /* |
986 |
+ * Takes a pointer to an AMD IOMMU entry in the ACPI table and |
987 |
+ * initializes the hardware and our data structures with it. |
988 |
+@@ -2080,30 +2061,6 @@ static void __init free_unity_maps(void) |
989 |
+ } |
990 |
+ } |
991 |
+ |
992 |
+-/* called when we find an exclusion range definition in ACPI */ |
993 |
+-static int __init init_exclusion_range(struct ivmd_header *m) |
994 |
+-{ |
995 |
+- int i; |
996 |
+- |
997 |
+- switch (m->type) { |
998 |
+- case ACPI_IVMD_TYPE: |
999 |
+- set_device_exclusion_range(m->devid, m); |
1000 |
+- break; |
1001 |
+- case ACPI_IVMD_TYPE_ALL: |
1002 |
+- for (i = 0; i <= amd_iommu_last_bdf; ++i) |
1003 |
+- set_device_exclusion_range(i, m); |
1004 |
+- break; |
1005 |
+- case ACPI_IVMD_TYPE_RANGE: |
1006 |
+- for (i = m->devid; i <= m->aux; ++i) |
1007 |
+- set_device_exclusion_range(i, m); |
1008 |
+- break; |
1009 |
+- default: |
1010 |
+- break; |
1011 |
+- } |
1012 |
+- |
1013 |
+- return 0; |
1014 |
+-} |
1015 |
+- |
1016 |
+ /* called for unity map ACPI definition */ |
1017 |
+ static int __init init_unity_map_range(struct ivmd_header *m) |
1018 |
+ { |
1019 |
+@@ -2114,9 +2071,6 @@ static int __init init_unity_map_range(struct ivmd_header *m) |
1020 |
+ if (e == NULL) |
1021 |
+ return -ENOMEM; |
1022 |
+ |
1023 |
+- if (m->flags & IVMD_FLAG_EXCL_RANGE) |
1024 |
+- init_exclusion_range(m); |
1025 |
+- |
1026 |
+ switch (m->type) { |
1027 |
+ default: |
1028 |
+ kfree(e); |
1029 |
+@@ -2140,6 +2094,16 @@ static int __init init_unity_map_range(struct ivmd_header *m) |
1030 |
+ e->address_end = e->address_start + PAGE_ALIGN(m->range_length); |
1031 |
+ e->prot = m->flags >> 1; |
1032 |
+ |
1033 |
++ /* |
1034 |
++ * Treat per-device exclusion ranges as r/w unity-mapped regions |
1035 |
++ * since some buggy BIOSes might lead to the overwritten exclusion |
1036 |
++ * range (exclusion_start and exclusion_length members). This |
1037 |
++ * happens when there are multiple exclusion ranges (IVMD entries) |
1038 |
++ * defined in ACPI table. |
1039 |
++ */ |
1040 |
++ if (m->flags & IVMD_FLAG_EXCL_RANGE) |
1041 |
++ e->prot = (IVMD_FLAG_IW | IVMD_FLAG_IR) >> 1; |
1042 |
++ |
1043 |
+ DUMP_printk("%s devid_start: %02x:%02x.%x devid_end: %02x:%02x.%x" |
1044 |
+ " range_start: %016llx range_end: %016llx flags: %x\n", s, |
1045 |
+ PCI_BUS_NUM(e->devid_start), PCI_SLOT(e->devid_start), |
1046 |
+diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c |
1047 |
+index 60c8a56e4a3f8..89f628da148ac 100644 |
1048 |
+--- a/drivers/iommu/exynos-iommu.c |
1049 |
++++ b/drivers/iommu/exynos-iommu.c |
1050 |
+@@ -1295,13 +1295,17 @@ static int exynos_iommu_of_xlate(struct device *dev, |
1051 |
+ return -ENODEV; |
1052 |
+ |
1053 |
+ data = platform_get_drvdata(sysmmu); |
1054 |
+- if (!data) |
1055 |
++ if (!data) { |
1056 |
++ put_device(&sysmmu->dev); |
1057 |
+ return -ENODEV; |
1058 |
++ } |
1059 |
+ |
1060 |
+ if (!owner) { |
1061 |
+ owner = kzalloc(sizeof(*owner), GFP_KERNEL); |
1062 |
+- if (!owner) |
1063 |
++ if (!owner) { |
1064 |
++ put_device(&sysmmu->dev); |
1065 |
+ return -ENOMEM; |
1066 |
++ } |
1067 |
+ |
1068 |
+ INIT_LIST_HEAD(&owner->controllers); |
1069 |
+ mutex_init(&owner->rpm_lock); |
1070 |
+diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c |
1071 |
+index 693ee73eb2912..ef03d6fafc5ce 100644 |
1072 |
+--- a/drivers/memstick/core/memstick.c |
1073 |
++++ b/drivers/memstick/core/memstick.c |
1074 |
+@@ -441,6 +441,9 @@ static void memstick_check(struct work_struct *work) |
1075 |
+ } else if (host->card->stop) |
1076 |
+ host->card->stop(host->card); |
1077 |
+ |
1078 |
++ if (host->removing) |
1079 |
++ goto out_power_off; |
1080 |
++ |
1081 |
+ card = memstick_alloc_card(host); |
1082 |
+ |
1083 |
+ if (!card) { |
1084 |
+@@ -545,6 +548,7 @@ EXPORT_SYMBOL(memstick_add_host); |
1085 |
+ */ |
1086 |
+ void memstick_remove_host(struct memstick_host *host) |
1087 |
+ { |
1088 |
++ host->removing = 1; |
1089 |
+ flush_workqueue(workqueue); |
1090 |
+ mutex_lock(&host->lock); |
1091 |
+ if (host->card) |
1092 |
+diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c |
1093 |
+index af413805bbf1a..914f5184295ff 100644 |
1094 |
+--- a/drivers/mmc/host/sdhci-pci-core.c |
1095 |
++++ b/drivers/mmc/host/sdhci-pci-core.c |
1096 |
+@@ -794,7 +794,8 @@ static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot) |
1097 |
+ static bool glk_broken_cqhci(struct sdhci_pci_slot *slot) |
1098 |
+ { |
1099 |
+ return slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_GLK_EMMC && |
1100 |
+- dmi_match(DMI_BIOS_VENDOR, "LENOVO"); |
1101 |
++ (dmi_match(DMI_BIOS_VENDOR, "LENOVO") || |
1102 |
++ dmi_match(DMI_SYS_VENDOR, "IRBIS")); |
1103 |
+ } |
1104 |
+ |
1105 |
+ static int glk_emmc_probe_slot(struct sdhci_pci_slot *slot) |
1106 |
+diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c |
1107 |
+index 1dd9e348152d7..7c167a394b762 100644 |
1108 |
+--- a/drivers/net/dsa/ocelot/felix_vsc9959.c |
1109 |
++++ b/drivers/net/dsa/ocelot/felix_vsc9959.c |
1110 |
+@@ -607,17 +607,17 @@ struct vcap_field vsc9959_vcap_is2_keys[] = { |
1111 |
+ [VCAP_IS2_HK_DIP_EQ_SIP] = {118, 1}, |
1112 |
+ /* IP4_TCP_UDP (TYPE=100) */ |
1113 |
+ [VCAP_IS2_HK_TCP] = {119, 1}, |
1114 |
+- [VCAP_IS2_HK_L4_SPORT] = {120, 16}, |
1115 |
+- [VCAP_IS2_HK_L4_DPORT] = {136, 16}, |
1116 |
++ [VCAP_IS2_HK_L4_DPORT] = {120, 16}, |
1117 |
++ [VCAP_IS2_HK_L4_SPORT] = {136, 16}, |
1118 |
+ [VCAP_IS2_HK_L4_RNG] = {152, 8}, |
1119 |
+ [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {160, 1}, |
1120 |
+ [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {161, 1}, |
1121 |
+- [VCAP_IS2_HK_L4_URG] = {162, 1}, |
1122 |
+- [VCAP_IS2_HK_L4_ACK] = {163, 1}, |
1123 |
+- [VCAP_IS2_HK_L4_PSH] = {164, 1}, |
1124 |
+- [VCAP_IS2_HK_L4_RST] = {165, 1}, |
1125 |
+- [VCAP_IS2_HK_L4_SYN] = {166, 1}, |
1126 |
+- [VCAP_IS2_HK_L4_FIN] = {167, 1}, |
1127 |
++ [VCAP_IS2_HK_L4_FIN] = {162, 1}, |
1128 |
++ [VCAP_IS2_HK_L4_SYN] = {163, 1}, |
1129 |
++ [VCAP_IS2_HK_L4_RST] = {164, 1}, |
1130 |
++ [VCAP_IS2_HK_L4_PSH] = {165, 1}, |
1131 |
++ [VCAP_IS2_HK_L4_ACK] = {166, 1}, |
1132 |
++ [VCAP_IS2_HK_L4_URG] = {167, 1}, |
1133 |
+ [VCAP_IS2_HK_L4_1588_DOM] = {168, 8}, |
1134 |
+ [VCAP_IS2_HK_L4_1588_VER] = {176, 4}, |
1135 |
+ /* IP4_OTHER (TYPE=101) */ |
1136 |
+diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c |
1137 |
+index 592454f444ce2..0b30011b9839e 100644 |
1138 |
+--- a/drivers/net/ethernet/dec/tulip/de2104x.c |
1139 |
++++ b/drivers/net/ethernet/dec/tulip/de2104x.c |
1140 |
+@@ -85,7 +85,7 @@ MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copi |
1141 |
+ #define DSL CONFIG_DE2104X_DSL |
1142 |
+ #endif |
1143 |
+ |
1144 |
+-#define DE_RX_RING_SIZE 64 |
1145 |
++#define DE_RX_RING_SIZE 128 |
1146 |
+ #define DE_TX_RING_SIZE 64 |
1147 |
+ #define DE_RING_BYTES \ |
1148 |
+ ((sizeof(struct de_desc) * DE_RX_RING_SIZE) + \ |
1149 |
+diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h |
1150 |
+index abda736e7c7dc..a4d2dd2637e26 100644 |
1151 |
+--- a/drivers/net/hyperv/hyperv_net.h |
1152 |
++++ b/drivers/net/hyperv/hyperv_net.h |
1153 |
+@@ -973,6 +973,9 @@ struct net_device_context { |
1154 |
+ /* Serial number of the VF to team with */ |
1155 |
+ u32 vf_serial; |
1156 |
+ |
1157 |
++ /* Is the current data path through the VF NIC? */ |
1158 |
++ bool data_path_is_vf; |
1159 |
++ |
1160 |
+ /* Used to temporarily save the config info across hibernation */ |
1161 |
+ struct netvsc_device_info *saved_netvsc_dev_info; |
1162 |
+ }; |
1163 |
+diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c |
1164 |
+index a2db5ef3b62a2..3b0dc1f0ef212 100644 |
1165 |
+--- a/drivers/net/hyperv/netvsc_drv.c |
1166 |
++++ b/drivers/net/hyperv/netvsc_drv.c |
1167 |
+@@ -2323,7 +2323,16 @@ static int netvsc_register_vf(struct net_device *vf_netdev) |
1168 |
+ return NOTIFY_OK; |
1169 |
+ } |
1170 |
+ |
1171 |
+-/* VF up/down change detected, schedule to change data path */ |
1172 |
++/* Change the data path when VF UP/DOWN/CHANGE are detected. |
1173 |
++ * |
1174 |
++ * Typically a UP or DOWN event is followed by a CHANGE event, so |
1175 |
++ * net_device_ctx->data_path_is_vf is used to cache the current data path |
1176 |
++ * to avoid the duplicate call of netvsc_switch_datapath() and the duplicate |
1177 |
++ * message. |
1178 |
++ * |
1179 |
++ * During hibernation, if a VF NIC driver (e.g. mlx5) preserves the network |
1180 |
++ * interface, there is only the CHANGE event and no UP or DOWN event. |
1181 |
++ */ |
1182 |
+ static int netvsc_vf_changed(struct net_device *vf_netdev) |
1183 |
+ { |
1184 |
+ struct net_device_context *net_device_ctx; |
1185 |
+@@ -2340,6 +2349,10 @@ static int netvsc_vf_changed(struct net_device *vf_netdev) |
1186 |
+ if (!netvsc_dev) |
1187 |
+ return NOTIFY_DONE; |
1188 |
+ |
1189 |
++ if (net_device_ctx->data_path_is_vf == vf_is_up) |
1190 |
++ return NOTIFY_OK; |
1191 |
++ net_device_ctx->data_path_is_vf = vf_is_up; |
1192 |
++ |
1193 |
+ netvsc_switch_datapath(ndev, vf_is_up); |
1194 |
+ netdev_info(ndev, "Data path switched %s VF: %s\n", |
1195 |
+ vf_is_up ? "to" : "from", vf_netdev->name); |
1196 |
+@@ -2581,6 +2594,12 @@ static int netvsc_resume(struct hv_device *dev) |
1197 |
+ rtnl_lock(); |
1198 |
+ |
1199 |
+ net_device_ctx = netdev_priv(net); |
1200 |
++ |
1201 |
++ /* Reset the data path to the netvsc NIC before re-opening the vmbus |
1202 |
++ * channel. Later netvsc_netdev_event() will switch the data path to |
1203 |
++ * the VF upon the UP or CHANGE event. |
1204 |
++ */ |
1205 |
++ net_device_ctx->data_path_is_vf = false; |
1206 |
+ device_info = net_device_ctx->saved_netvsc_dev_info; |
1207 |
+ |
1208 |
+ ret = netvsc_attach(net, device_info); |
1209 |
+diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c |
1210 |
+index bd9c07888ebb4..6fa7a009a24a4 100644 |
1211 |
+--- a/drivers/net/usb/rndis_host.c |
1212 |
++++ b/drivers/net/usb/rndis_host.c |
1213 |
+@@ -201,7 +201,7 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen) |
1214 |
+ dev_dbg(&info->control->dev, |
1215 |
+ "rndis response error, code %d\n", retval); |
1216 |
+ } |
1217 |
+- msleep(20); |
1218 |
++ msleep(40); |
1219 |
+ } |
1220 |
+ dev_dbg(&info->control->dev, "rndis response timeout\n"); |
1221 |
+ return -ETIMEDOUT; |
1222 |
+diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c |
1223 |
+index 444130655d8ea..cb5898f7d68c9 100644 |
1224 |
+--- a/drivers/net/wan/hdlc_cisco.c |
1225 |
++++ b/drivers/net/wan/hdlc_cisco.c |
1226 |
+@@ -118,6 +118,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type, |
1227 |
+ skb_put(skb, sizeof(struct cisco_packet)); |
1228 |
+ skb->priority = TC_PRIO_CONTROL; |
1229 |
+ skb->dev = dev; |
1230 |
++ skb->protocol = htons(ETH_P_HDLC); |
1231 |
+ skb_reset_network_header(skb); |
1232 |
+ |
1233 |
+ dev_queue_xmit(skb); |
1234 |
+diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c |
1235 |
+index 9acad651ea1f6..d6cfd51613ed8 100644 |
1236 |
+--- a/drivers/net/wan/hdlc_fr.c |
1237 |
++++ b/drivers/net/wan/hdlc_fr.c |
1238 |
+@@ -433,6 +433,8 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev) |
1239 |
+ if (pvc->state.fecn) /* TX Congestion counter */ |
1240 |
+ dev->stats.tx_compressed++; |
1241 |
+ skb->dev = pvc->frad; |
1242 |
++ skb->protocol = htons(ETH_P_HDLC); |
1243 |
++ skb_reset_network_header(skb); |
1244 |
+ dev_queue_xmit(skb); |
1245 |
+ return NETDEV_TX_OK; |
1246 |
+ } |
1247 |
+@@ -555,6 +557,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep) |
1248 |
+ skb_put(skb, i); |
1249 |
+ skb->priority = TC_PRIO_CONTROL; |
1250 |
+ skb->dev = dev; |
1251 |
++ skb->protocol = htons(ETH_P_HDLC); |
1252 |
+ skb_reset_network_header(skb); |
1253 |
+ |
1254 |
+ dev_queue_xmit(skb); |
1255 |
+@@ -1041,7 +1044,7 @@ static void pvc_setup(struct net_device *dev) |
1256 |
+ { |
1257 |
+ dev->type = ARPHRD_DLCI; |
1258 |
+ dev->flags = IFF_POINTOPOINT; |
1259 |
+- dev->hard_header_len = 10; |
1260 |
++ dev->hard_header_len = 0; |
1261 |
+ dev->addr_len = 2; |
1262 |
+ netif_keep_dst(dev); |
1263 |
+ } |
1264 |
+@@ -1093,6 +1096,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) |
1265 |
+ dev->mtu = HDLC_MAX_MTU; |
1266 |
+ dev->min_mtu = 68; |
1267 |
+ dev->max_mtu = HDLC_MAX_MTU; |
1268 |
++ dev->needed_headroom = 10; |
1269 |
+ dev->priv_flags |= IFF_NO_QUEUE; |
1270 |
+ dev->ml_priv = pvc; |
1271 |
+ |
1272 |
+diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c |
1273 |
+index 16f33d1ffbfb9..64f8556513369 100644 |
1274 |
+--- a/drivers/net/wan/hdlc_ppp.c |
1275 |
++++ b/drivers/net/wan/hdlc_ppp.c |
1276 |
+@@ -251,6 +251,7 @@ static void ppp_tx_cp(struct net_device *dev, u16 pid, u8 code, |
1277 |
+ |
1278 |
+ skb->priority = TC_PRIO_CONTROL; |
1279 |
+ skb->dev = dev; |
1280 |
++ skb->protocol = htons(ETH_P_HDLC); |
1281 |
+ skb_reset_network_header(skb); |
1282 |
+ skb_queue_tail(&tx_queue, skb); |
1283 |
+ } |
1284 |
+diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c |
1285 |
+index e61616b0b91c7..b726101d4707a 100644 |
1286 |
+--- a/drivers/net/wan/lapbether.c |
1287 |
++++ b/drivers/net/wan/lapbether.c |
1288 |
+@@ -198,8 +198,6 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) |
1289 |
+ struct net_device *dev; |
1290 |
+ int size = skb->len; |
1291 |
+ |
1292 |
+- skb->protocol = htons(ETH_P_X25); |
1293 |
+- |
1294 |
+ ptr = skb_push(skb, 2); |
1295 |
+ |
1296 |
+ *ptr++ = size % 256; |
1297 |
+@@ -210,6 +208,8 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) |
1298 |
+ |
1299 |
+ skb->dev = dev = lapbeth->ethdev; |
1300 |
+ |
1301 |
++ skb->protocol = htons(ETH_P_DEC); |
1302 |
++ |
1303 |
+ skb_reset_network_header(skb); |
1304 |
+ |
1305 |
+ dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0); |
1306 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c |
1307 |
+index aadf56e80bae8..d7a3b05ab50c3 100644 |
1308 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c |
1309 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c |
1310 |
+@@ -691,8 +691,12 @@ void mt7915_unregister_device(struct mt7915_dev *dev) |
1311 |
+ spin_lock_bh(&dev->token_lock); |
1312 |
+ idr_for_each_entry(&dev->token, txwi, id) { |
1313 |
+ mt7915_txp_skb_unmap(&dev->mt76, txwi); |
1314 |
+- if (txwi->skb) |
1315 |
+- dev_kfree_skb_any(txwi->skb); |
1316 |
++ if (txwi->skb) { |
1317 |
++ struct ieee80211_hw *hw; |
1318 |
++ |
1319 |
++ hw = mt76_tx_status_get_hw(&dev->mt76, txwi->skb); |
1320 |
++ ieee80211_free_txskb(hw, txwi->skb); |
1321 |
++ } |
1322 |
+ mt76_put_txwi(&dev->mt76, txwi); |
1323 |
+ } |
1324 |
+ spin_unlock_bh(&dev->token_lock); |
1325 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c |
1326 |
+index a264e304a3dfb..5800b2d1fb233 100644 |
1327 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c |
1328 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c |
1329 |
+@@ -844,7 +844,7 @@ mt7915_tx_complete_status(struct mt76_dev *mdev, struct sk_buff *skb, |
1330 |
+ if (sta || !(info->flags & IEEE80211_TX_CTL_NO_ACK)) |
1331 |
+ mt7915_tx_status(sta, hw, info, NULL); |
1332 |
+ |
1333 |
+- dev_kfree_skb(skb); |
1334 |
++ ieee80211_free_txskb(hw, skb); |
1335 |
+ } |
1336 |
+ |
1337 |
+ void mt7915_txp_skb_unmap(struct mt76_dev *dev, |
1338 |
+diff --git a/drivers/net/wireless/ti/wlcore/cmd.h b/drivers/net/wireless/ti/wlcore/cmd.h |
1339 |
+index 9acd8a41ea61f..f2609d5b6bf71 100644 |
1340 |
+--- a/drivers/net/wireless/ti/wlcore/cmd.h |
1341 |
++++ b/drivers/net/wireless/ti/wlcore/cmd.h |
1342 |
+@@ -458,7 +458,6 @@ enum wl1271_cmd_key_type { |
1343 |
+ KEY_TKIP = 2, |
1344 |
+ KEY_AES = 3, |
1345 |
+ KEY_GEM = 4, |
1346 |
+- KEY_IGTK = 5, |
1347 |
+ }; |
1348 |
+ |
1349 |
+ struct wl1271_cmd_set_keys { |
1350 |
+diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c |
1351 |
+index de6c8a7589ca3..ef169de992249 100644 |
1352 |
+--- a/drivers/net/wireless/ti/wlcore/main.c |
1353 |
++++ b/drivers/net/wireless/ti/wlcore/main.c |
1354 |
+@@ -3550,9 +3550,6 @@ int wlcore_set_key(struct wl1271 *wl, enum set_key_cmd cmd, |
1355 |
+ case WL1271_CIPHER_SUITE_GEM: |
1356 |
+ key_type = KEY_GEM; |
1357 |
+ break; |
1358 |
+- case WLAN_CIPHER_SUITE_AES_CMAC: |
1359 |
+- key_type = KEY_IGTK; |
1360 |
+- break; |
1361 |
+ default: |
1362 |
+ wl1271_error("Unknown key algo 0x%x", key_conf->cipher); |
1363 |
+ |
1364 |
+@@ -6222,7 +6219,6 @@ static int wl1271_init_ieee80211(struct wl1271 *wl) |
1365 |
+ WLAN_CIPHER_SUITE_TKIP, |
1366 |
+ WLAN_CIPHER_SUITE_CCMP, |
1367 |
+ WL1271_CIPHER_SUITE_GEM, |
1368 |
+- WLAN_CIPHER_SUITE_AES_CMAC, |
1369 |
+ }; |
1370 |
+ |
1371 |
+ /* The tx descriptor buffer */ |
1372 |
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
1373 |
+index f2556f0ea20dc..69165a8f7c1f0 100644 |
1374 |
+--- a/drivers/nvme/host/core.c |
1375 |
++++ b/drivers/nvme/host/core.c |
1376 |
+@@ -3060,10 +3060,24 @@ static int nvme_dev_open(struct inode *inode, struct file *file) |
1377 |
+ return -EWOULDBLOCK; |
1378 |
+ } |
1379 |
+ |
1380 |
++ nvme_get_ctrl(ctrl); |
1381 |
++ if (!try_module_get(ctrl->ops->module)) |
1382 |
++ return -EINVAL; |
1383 |
++ |
1384 |
+ file->private_data = ctrl; |
1385 |
+ return 0; |
1386 |
+ } |
1387 |
+ |
1388 |
++static int nvme_dev_release(struct inode *inode, struct file *file) |
1389 |
++{ |
1390 |
++ struct nvme_ctrl *ctrl = |
1391 |
++ container_of(inode->i_cdev, struct nvme_ctrl, cdev); |
1392 |
++ |
1393 |
++ module_put(ctrl->ops->module); |
1394 |
++ nvme_put_ctrl(ctrl); |
1395 |
++ return 0; |
1396 |
++} |
1397 |
++ |
1398 |
+ static int nvme_dev_user_cmd(struct nvme_ctrl *ctrl, void __user *argp) |
1399 |
+ { |
1400 |
+ struct nvme_ns *ns; |
1401 |
+@@ -3126,6 +3140,7 @@ static long nvme_dev_ioctl(struct file *file, unsigned int cmd, |
1402 |
+ static const struct file_operations nvme_dev_fops = { |
1403 |
+ .owner = THIS_MODULE, |
1404 |
+ .open = nvme_dev_open, |
1405 |
++ .release = nvme_dev_release, |
1406 |
+ .unlocked_ioctl = nvme_dev_ioctl, |
1407 |
+ .compat_ioctl = compat_ptr_ioctl, |
1408 |
+ }; |
1409 |
+diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c |
1410 |
+index 92c966ac34c20..43c1745ecd45b 100644 |
1411 |
+--- a/drivers/nvme/host/fc.c |
1412 |
++++ b/drivers/nvme/host/fc.c |
1413 |
+@@ -3668,12 +3668,14 @@ nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts) |
1414 |
+ spin_lock_irqsave(&nvme_fc_lock, flags); |
1415 |
+ list_for_each_entry(lport, &nvme_fc_lport_list, port_list) { |
1416 |
+ if (lport->localport.node_name != laddr.nn || |
1417 |
+- lport->localport.port_name != laddr.pn) |
1418 |
++ lport->localport.port_name != laddr.pn || |
1419 |
++ lport->localport.port_state != FC_OBJSTATE_ONLINE) |
1420 |
+ continue; |
1421 |
+ |
1422 |
+ list_for_each_entry(rport, &lport->endp_list, endp_list) { |
1423 |
+ if (rport->remoteport.node_name != raddr.nn || |
1424 |
+- rport->remoteport.port_name != raddr.pn) |
1425 |
++ rport->remoteport.port_name != raddr.pn || |
1426 |
++ rport->remoteport.port_state != FC_OBJSTATE_ONLINE) |
1427 |
+ continue; |
1428 |
+ |
1429 |
+ /* if fail to get reference fall through. Will error */ |
1430 |
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
1431 |
+index 69a19fe241063..cc3ae9c63a01b 100644 |
1432 |
+--- a/drivers/nvme/host/pci.c |
1433 |
++++ b/drivers/nvme/host/pci.c |
1434 |
+@@ -942,13 +942,6 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx) |
1435 |
+ struct nvme_completion *cqe = &nvmeq->cqes[idx]; |
1436 |
+ struct request *req; |
1437 |
+ |
1438 |
+- if (unlikely(cqe->command_id >= nvmeq->q_depth)) { |
1439 |
+- dev_warn(nvmeq->dev->ctrl.device, |
1440 |
+- "invalid id %d completed on queue %d\n", |
1441 |
+- cqe->command_id, le16_to_cpu(cqe->sq_id)); |
1442 |
+- return; |
1443 |
+- } |
1444 |
+- |
1445 |
+ /* |
1446 |
+ * AEN requests are special as they don't time out and can |
1447 |
+ * survive any kind of queue freeze and often don't respond to |
1448 |
+@@ -962,6 +955,13 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx) |
1449 |
+ } |
1450 |
+ |
1451 |
+ req = blk_mq_tag_to_rq(nvme_queue_tagset(nvmeq), cqe->command_id); |
1452 |
++ if (unlikely(!req)) { |
1453 |
++ dev_warn(nvmeq->dev->ctrl.device, |
1454 |
++ "invalid id %d completed on queue %d\n", |
1455 |
++ cqe->command_id, le16_to_cpu(cqe->sq_id)); |
1456 |
++ return; |
1457 |
++ } |
1458 |
++ |
1459 |
+ trace_nvme_sq(req, cqe->sq_head, nvmeq->sq_tail); |
1460 |
+ nvme_end_request(req, cqe->status, cqe->result); |
1461 |
+ } |
1462 |
+@@ -3093,7 +3093,8 @@ static const struct pci_device_id nvme_id_table[] = { |
1463 |
+ { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */ |
1464 |
+ .driver_data = NVME_QUIRK_NO_DEEPEST_PS | |
1465 |
+ NVME_QUIRK_MEDIUM_PRIO_SQ | |
1466 |
+- NVME_QUIRK_NO_TEMP_THRESH_CHANGE }, |
1467 |
++ NVME_QUIRK_NO_TEMP_THRESH_CHANGE | |
1468 |
++ NVME_QUIRK_DISABLE_WRITE_ZEROES, }, |
1469 |
+ { PCI_VDEVICE(INTEL, 0xf1a6), /* Intel 760p/Pro 7600p */ |
1470 |
+ .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, }, |
1471 |
+ { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */ |
1472 |
+diff --git a/drivers/phy/ti/phy-am654-serdes.c b/drivers/phy/ti/phy-am654-serdes.c |
1473 |
+index a174b3c3f010f..819c49af169ac 100644 |
1474 |
+--- a/drivers/phy/ti/phy-am654-serdes.c |
1475 |
++++ b/drivers/phy/ti/phy-am654-serdes.c |
1476 |
+@@ -725,8 +725,10 @@ static int serdes_am654_probe(struct platform_device *pdev) |
1477 |
+ pm_runtime_enable(dev); |
1478 |
+ |
1479 |
+ phy = devm_phy_create(dev, NULL, &ops); |
1480 |
+- if (IS_ERR(phy)) |
1481 |
+- return PTR_ERR(phy); |
1482 |
++ if (IS_ERR(phy)) { |
1483 |
++ ret = PTR_ERR(phy); |
1484 |
++ goto clk_err; |
1485 |
++ } |
1486 |
+ |
1487 |
+ phy_set_drvdata(phy, am654_phy); |
1488 |
+ phy_provider = devm_of_phy_provider_register(dev, serdes_am654_xlate); |
1489 |
+diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c |
1490 |
+index 2f3dfb56c3fa4..35bbe59357088 100644 |
1491 |
+--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c |
1492 |
++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c |
1493 |
+@@ -259,6 +259,10 @@ bool mtk_is_virt_gpio(struct mtk_pinctrl *hw, unsigned int gpio_n) |
1494 |
+ |
1495 |
+ desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio_n]; |
1496 |
+ |
1497 |
++ /* if the GPIO is not supported for eint mode */ |
1498 |
++ if (desc->eint.eint_m == NO_EINT_SUPPORT) |
1499 |
++ return virt_gpio; |
1500 |
++ |
1501 |
+ if (desc->funcs && !desc->funcs[desc->eint.eint_m].name) |
1502 |
+ virt_gpio = true; |
1503 |
+ |
1504 |
+diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-xp.c b/drivers/pinctrl/mvebu/pinctrl-armada-xp.c |
1505 |
+index a767a05fa3a0d..48e2a6c56a83b 100644 |
1506 |
+--- a/drivers/pinctrl/mvebu/pinctrl-armada-xp.c |
1507 |
++++ b/drivers/pinctrl/mvebu/pinctrl-armada-xp.c |
1508 |
+@@ -414,7 +414,7 @@ static struct mvebu_mpp_mode mv98dx3236_mpp_modes[] = { |
1509 |
+ MPP_VAR_FUNCTION(0x1, "i2c0", "sck", V_98DX3236_PLUS)), |
1510 |
+ MPP_MODE(15, |
1511 |
+ MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), |
1512 |
+- MPP_VAR_FUNCTION(0x4, "i2c0", "sda", V_98DX3236_PLUS)), |
1513 |
++ MPP_VAR_FUNCTION(0x1, "i2c0", "sda", V_98DX3236_PLUS)), |
1514 |
+ MPP_MODE(16, |
1515 |
+ MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), |
1516 |
+ MPP_VAR_FUNCTION(0x4, "dev", "oe", V_98DX3236_PLUS)), |
1517 |
+diff --git a/drivers/pinctrl/qcom/pinctrl-sm8250.c b/drivers/pinctrl/qcom/pinctrl-sm8250.c |
1518 |
+index a660f1274b667..826df0d637eaa 100644 |
1519 |
+--- a/drivers/pinctrl/qcom/pinctrl-sm8250.c |
1520 |
++++ b/drivers/pinctrl/qcom/pinctrl-sm8250.c |
1521 |
+@@ -1308,7 +1308,7 @@ static const struct msm_pingroup sm8250_groups[] = { |
1522 |
+ [178] = PINGROUP(178, WEST, _, _, _, _, _, _, _, _, _), |
1523 |
+ [179] = PINGROUP(179, WEST, _, _, _, _, _, _, _, _, _), |
1524 |
+ [180] = UFS_RESET(ufs_reset, 0xb8000), |
1525 |
+- [181] = SDC_PINGROUP(sdc2_clk, 0x7000, 14, 6), |
1526 |
++ [181] = SDC_PINGROUP(sdc2_clk, 0xb7000, 14, 6), |
1527 |
+ [182] = SDC_PINGROUP(sdc2_cmd, 0xb7000, 11, 3), |
1528 |
+ [183] = SDC_PINGROUP(sdc2_data, 0xb7000, 9, 0), |
1529 |
+ }; |
1530 |
+diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c |
1531 |
+index b5dd1caae5e92..d10efb66cf193 100644 |
1532 |
+--- a/drivers/scsi/iscsi_tcp.c |
1533 |
++++ b/drivers/scsi/iscsi_tcp.c |
1534 |
+@@ -736,6 +736,7 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn, |
1535 |
+ struct iscsi_tcp_conn *tcp_conn = conn->dd_data; |
1536 |
+ struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; |
1537 |
+ struct sockaddr_in6 addr; |
1538 |
++ struct socket *sock; |
1539 |
+ int rc; |
1540 |
+ |
1541 |
+ switch(param) { |
1542 |
+@@ -747,13 +748,17 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn, |
1543 |
+ spin_unlock_bh(&conn->session->frwd_lock); |
1544 |
+ return -ENOTCONN; |
1545 |
+ } |
1546 |
++ sock = tcp_sw_conn->sock; |
1547 |
++ sock_hold(sock->sk); |
1548 |
++ spin_unlock_bh(&conn->session->frwd_lock); |
1549 |
++ |
1550 |
+ if (param == ISCSI_PARAM_LOCAL_PORT) |
1551 |
+- rc = kernel_getsockname(tcp_sw_conn->sock, |
1552 |
++ rc = kernel_getsockname(sock, |
1553 |
+ (struct sockaddr *)&addr); |
1554 |
+ else |
1555 |
+- rc = kernel_getpeername(tcp_sw_conn->sock, |
1556 |
++ rc = kernel_getpeername(sock, |
1557 |
+ (struct sockaddr *)&addr); |
1558 |
+- spin_unlock_bh(&conn->session->frwd_lock); |
1559 |
++ sock_put(sock->sk); |
1560 |
+ if (rc < 0) |
1561 |
+ return rc; |
1562 |
+ |
1563 |
+@@ -775,6 +780,7 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost, |
1564 |
+ struct iscsi_tcp_conn *tcp_conn; |
1565 |
+ struct iscsi_sw_tcp_conn *tcp_sw_conn; |
1566 |
+ struct sockaddr_in6 addr; |
1567 |
++ struct socket *sock; |
1568 |
+ int rc; |
1569 |
+ |
1570 |
+ switch (param) { |
1571 |
+@@ -789,16 +795,18 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost, |
1572 |
+ return -ENOTCONN; |
1573 |
+ } |
1574 |
+ tcp_conn = conn->dd_data; |
1575 |
+- |
1576 |
+ tcp_sw_conn = tcp_conn->dd_data; |
1577 |
+- if (!tcp_sw_conn->sock) { |
1578 |
++ sock = tcp_sw_conn->sock; |
1579 |
++ if (!sock) { |
1580 |
+ spin_unlock_bh(&session->frwd_lock); |
1581 |
+ return -ENOTCONN; |
1582 |
+ } |
1583 |
++ sock_hold(sock->sk); |
1584 |
++ spin_unlock_bh(&session->frwd_lock); |
1585 |
+ |
1586 |
+- rc = kernel_getsockname(tcp_sw_conn->sock, |
1587 |
++ rc = kernel_getsockname(sock, |
1588 |
+ (struct sockaddr *)&addr); |
1589 |
+- spin_unlock_bh(&session->frwd_lock); |
1590 |
++ sock_put(sock->sk); |
1591 |
+ if (rc < 0) |
1592 |
+ return rc; |
1593 |
+ |
1594 |
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c |
1595 |
+index d90fefffe31b7..4b2117cb84837 100644 |
1596 |
+--- a/drivers/scsi/sd.c |
1597 |
++++ b/drivers/scsi/sd.c |
1598 |
+@@ -2966,26 +2966,32 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp) |
1599 |
+ |
1600 |
+ if (sdkp->device->type == TYPE_ZBC) { |
1601 |
+ /* Host-managed */ |
1602 |
+- q->limits.zoned = BLK_ZONED_HM; |
1603 |
++ blk_queue_set_zoned(sdkp->disk, BLK_ZONED_HM); |
1604 |
+ } else { |
1605 |
+ sdkp->zoned = (buffer[8] >> 4) & 3; |
1606 |
+- if (sdkp->zoned == 1 && !disk_has_partitions(sdkp->disk)) { |
1607 |
++ if (sdkp->zoned == 1) { |
1608 |
+ /* Host-aware */ |
1609 |
+- q->limits.zoned = BLK_ZONED_HA; |
1610 |
++ blk_queue_set_zoned(sdkp->disk, BLK_ZONED_HA); |
1611 |
+ } else { |
1612 |
+- /* |
1613 |
+- * Treat drive-managed devices and host-aware devices |
1614 |
+- * with partitions as regular block devices. |
1615 |
+- */ |
1616 |
+- q->limits.zoned = BLK_ZONED_NONE; |
1617 |
+- if (sdkp->zoned == 2 && sdkp->first_scan) |
1618 |
+- sd_printk(KERN_NOTICE, sdkp, |
1619 |
+- "Drive-managed SMR disk\n"); |
1620 |
++ /* Regular disk or drive managed disk */ |
1621 |
++ blk_queue_set_zoned(sdkp->disk, BLK_ZONED_NONE); |
1622 |
+ } |
1623 |
+ } |
1624 |
+- if (blk_queue_is_zoned(q) && sdkp->first_scan) |
1625 |
++ |
1626 |
++ if (!sdkp->first_scan) |
1627 |
++ goto out; |
1628 |
++ |
1629 |
++ if (blk_queue_is_zoned(q)) { |
1630 |
+ sd_printk(KERN_NOTICE, sdkp, "Host-%s zoned block device\n", |
1631 |
+ q->limits.zoned == BLK_ZONED_HM ? "managed" : "aware"); |
1632 |
++ } else { |
1633 |
++ if (sdkp->zoned == 1) |
1634 |
++ sd_printk(KERN_NOTICE, sdkp, |
1635 |
++ "Host-aware SMR disk used as regular disk\n"); |
1636 |
++ else if (sdkp->zoned == 2) |
1637 |
++ sd_printk(KERN_NOTICE, sdkp, |
1638 |
++ "Drive-managed SMR disk\n"); |
1639 |
++ } |
1640 |
+ |
1641 |
+ out: |
1642 |
+ kfree(buffer); |
1643 |
+@@ -3398,10 +3404,6 @@ static int sd_probe(struct device *dev) |
1644 |
+ sdkp->first_scan = 1; |
1645 |
+ sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS; |
1646 |
+ |
1647 |
+- error = sd_zbc_init_disk(sdkp); |
1648 |
+- if (error) |
1649 |
+- goto out_free_index; |
1650 |
+- |
1651 |
+ sd_revalidate_disk(gd); |
1652 |
+ |
1653 |
+ gd->flags = GENHD_FL_EXT_DEVT; |
1654 |
+diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h |
1655 |
+index 3a74f4b45134f..9c24de305c6b9 100644 |
1656 |
+--- a/drivers/scsi/sd.h |
1657 |
++++ b/drivers/scsi/sd.h |
1658 |
+@@ -213,7 +213,6 @@ static inline int sd_is_zoned(struct scsi_disk *sdkp) |
1659 |
+ |
1660 |
+ #ifdef CONFIG_BLK_DEV_ZONED |
1661 |
+ |
1662 |
+-int sd_zbc_init_disk(struct scsi_disk *sdkp); |
1663 |
+ void sd_zbc_release_disk(struct scsi_disk *sdkp); |
1664 |
+ extern int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buffer); |
1665 |
+ extern void sd_zbc_print_zones(struct scsi_disk *sdkp); |
1666 |
+@@ -229,17 +228,6 @@ blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba, |
1667 |
+ |
1668 |
+ #else /* CONFIG_BLK_DEV_ZONED */ |
1669 |
+ |
1670 |
+-static inline int sd_zbc_init(void) |
1671 |
+-{ |
1672 |
+- return 0; |
1673 |
+-} |
1674 |
+- |
1675 |
+-static inline int sd_zbc_init_disk(struct scsi_disk *sdkp) |
1676 |
+-{ |
1677 |
+- return 0; |
1678 |
+-} |
1679 |
+- |
1680 |
+-static inline void sd_zbc_exit(void) {} |
1681 |
+ static inline void sd_zbc_release_disk(struct scsi_disk *sdkp) {} |
1682 |
+ |
1683 |
+ static inline int sd_zbc_read_zones(struct scsi_disk *sdkp, |
1684 |
+@@ -260,7 +248,7 @@ static inline blk_status_t sd_zbc_setup_zone_mgmt_cmnd(struct scsi_cmnd *cmd, |
1685 |
+ static inline unsigned int sd_zbc_complete(struct scsi_cmnd *cmd, |
1686 |
+ unsigned int good_bytes, struct scsi_sense_hdr *sshdr) |
1687 |
+ { |
1688 |
+- return 0; |
1689 |
++ return good_bytes; |
1690 |
+ } |
1691 |
+ |
1692 |
+ static inline blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, |
1693 |
+diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c |
1694 |
+index 6f7eba66687e9..8384b5dcfa029 100644 |
1695 |
+--- a/drivers/scsi/sd_zbc.c |
1696 |
++++ b/drivers/scsi/sd_zbc.c |
1697 |
+@@ -633,6 +633,45 @@ static int sd_zbc_check_capacity(struct scsi_disk *sdkp, unsigned char *buf, |
1698 |
+ return 0; |
1699 |
+ } |
1700 |
+ |
1701 |
++void sd_zbc_print_zones(struct scsi_disk *sdkp) |
1702 |
++{ |
1703 |
++ if (!sd_is_zoned(sdkp) || !sdkp->capacity) |
1704 |
++ return; |
1705 |
++ |
1706 |
++ if (sdkp->capacity & (sdkp->zone_blocks - 1)) |
1707 |
++ sd_printk(KERN_NOTICE, sdkp, |
1708 |
++ "%u zones of %u logical blocks + 1 runt zone\n", |
1709 |
++ sdkp->nr_zones - 1, |
1710 |
++ sdkp->zone_blocks); |
1711 |
++ else |
1712 |
++ sd_printk(KERN_NOTICE, sdkp, |
1713 |
++ "%u zones of %u logical blocks\n", |
1714 |
++ sdkp->nr_zones, |
1715 |
++ sdkp->zone_blocks); |
1716 |
++} |
1717 |
++ |
1718 |
++static int sd_zbc_init_disk(struct scsi_disk *sdkp) |
1719 |
++{ |
1720 |
++ sdkp->zones_wp_offset = NULL; |
1721 |
++ spin_lock_init(&sdkp->zones_wp_offset_lock); |
1722 |
++ sdkp->rev_wp_offset = NULL; |
1723 |
++ mutex_init(&sdkp->rev_mutex); |
1724 |
++ INIT_WORK(&sdkp->zone_wp_offset_work, sd_zbc_update_wp_offset_workfn); |
1725 |
++ sdkp->zone_wp_update_buf = kzalloc(SD_BUF_SIZE, GFP_KERNEL); |
1726 |
++ if (!sdkp->zone_wp_update_buf) |
1727 |
++ return -ENOMEM; |
1728 |
++ |
1729 |
++ return 0; |
1730 |
++} |
1731 |
++ |
1732 |
++void sd_zbc_release_disk(struct scsi_disk *sdkp) |
1733 |
++{ |
1734 |
++ kvfree(sdkp->zones_wp_offset); |
1735 |
++ sdkp->zones_wp_offset = NULL; |
1736 |
++ kfree(sdkp->zone_wp_update_buf); |
1737 |
++ sdkp->zone_wp_update_buf = NULL; |
1738 |
++} |
1739 |
++ |
1740 |
+ static void sd_zbc_revalidate_zones_cb(struct gendisk *disk) |
1741 |
+ { |
1742 |
+ struct scsi_disk *sdkp = scsi_disk(disk); |
1743 |
+@@ -645,8 +684,30 @@ static int sd_zbc_revalidate_zones(struct scsi_disk *sdkp, |
1744 |
+ unsigned int nr_zones) |
1745 |
+ { |
1746 |
+ struct gendisk *disk = sdkp->disk; |
1747 |
++ struct request_queue *q = disk->queue; |
1748 |
++ u32 max_append; |
1749 |
+ int ret = 0; |
1750 |
+ |
1751 |
++ /* |
1752 |
++ * For all zoned disks, initialize zone append emulation data if not |
1753 |
++ * already done. This is necessary also for host-aware disks used as |
1754 |
++ * regular disks due to the presence of partitions as these partitions |
1755 |
++ * may be deleted and the disk zoned model changed back from |
1756 |
++ * BLK_ZONED_NONE to BLK_ZONED_HA. |
1757 |
++ */ |
1758 |
++ if (sd_is_zoned(sdkp) && !sdkp->zone_wp_update_buf) { |
1759 |
++ ret = sd_zbc_init_disk(sdkp); |
1760 |
++ if (ret) |
1761 |
++ return ret; |
1762 |
++ } |
1763 |
++ |
1764 |
++ /* |
1765 |
++ * There is nothing to do for regular disks, including host-aware disks |
1766 |
++ * that have partitions. |
1767 |
++ */ |
1768 |
++ if (!blk_queue_is_zoned(q)) |
1769 |
++ return 0; |
1770 |
++ |
1771 |
+ /* |
1772 |
+ * Make sure revalidate zones are serialized to ensure exclusive |
1773 |
+ * updates of the scsi disk data. |
1774 |
+@@ -681,6 +742,19 @@ static int sd_zbc_revalidate_zones(struct scsi_disk *sdkp, |
1775 |
+ kvfree(sdkp->rev_wp_offset); |
1776 |
+ sdkp->rev_wp_offset = NULL; |
1777 |
+ |
1778 |
++ if (ret) { |
1779 |
++ sdkp->zone_blocks = 0; |
1780 |
++ sdkp->nr_zones = 0; |
1781 |
++ sdkp->capacity = 0; |
1782 |
++ goto unlock; |
1783 |
++ } |
1784 |
++ |
1785 |
++ max_append = min_t(u32, logical_to_sectors(sdkp->device, zone_blocks), |
1786 |
++ q->limits.max_segments << (PAGE_SHIFT - 9)); |
1787 |
++ max_append = min_t(u32, max_append, queue_max_hw_sectors(q)); |
1788 |
++ |
1789 |
++ blk_queue_max_zone_append_sectors(q, max_append); |
1790 |
++ |
1791 |
+ unlock: |
1792 |
+ mutex_unlock(&sdkp->rev_mutex); |
1793 |
+ |
1794 |
+@@ -693,7 +767,6 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf) |
1795 |
+ struct request_queue *q = disk->queue; |
1796 |
+ unsigned int nr_zones; |
1797 |
+ u32 zone_blocks = 0; |
1798 |
+- u32 max_append; |
1799 |
+ int ret; |
1800 |
+ |
1801 |
+ if (!sd_is_zoned(sdkp)) |
1802 |
+@@ -726,20 +799,6 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf) |
1803 |
+ if (ret) |
1804 |
+ goto err; |
1805 |
+ |
1806 |
+- /* |
1807 |
+- * On the first scan 'chunk_sectors' isn't setup yet, so calling |
1808 |
+- * blk_queue_max_zone_append_sectors() will result in a WARN(). Defer |
1809 |
+- * this setting to the second scan. |
1810 |
+- */ |
1811 |
+- if (sdkp->first_scan) |
1812 |
+- return 0; |
1813 |
+- |
1814 |
+- max_append = min_t(u32, logical_to_sectors(sdkp->device, zone_blocks), |
1815 |
+- q->limits.max_segments << (PAGE_SHIFT - 9)); |
1816 |
+- max_append = min_t(u32, max_append, queue_max_hw_sectors(q)); |
1817 |
+- |
1818 |
+- blk_queue_max_zone_append_sectors(q, max_append); |
1819 |
+- |
1820 |
+ return 0; |
1821 |
+ |
1822 |
+ err: |
1823 |
+@@ -747,45 +806,3 @@ err: |
1824 |
+ |
1825 |
+ return ret; |
1826 |
+ } |
1827 |
+- |
1828 |
+-void sd_zbc_print_zones(struct scsi_disk *sdkp) |
1829 |
+-{ |
1830 |
+- if (!sd_is_zoned(sdkp) || !sdkp->capacity) |
1831 |
+- return; |
1832 |
+- |
1833 |
+- if (sdkp->capacity & (sdkp->zone_blocks - 1)) |
1834 |
+- sd_printk(KERN_NOTICE, sdkp, |
1835 |
+- "%u zones of %u logical blocks + 1 runt zone\n", |
1836 |
+- sdkp->nr_zones - 1, |
1837 |
+- sdkp->zone_blocks); |
1838 |
+- else |
1839 |
+- sd_printk(KERN_NOTICE, sdkp, |
1840 |
+- "%u zones of %u logical blocks\n", |
1841 |
+- sdkp->nr_zones, |
1842 |
+- sdkp->zone_blocks); |
1843 |
+-} |
1844 |
+- |
1845 |
+-int sd_zbc_init_disk(struct scsi_disk *sdkp) |
1846 |
+-{ |
1847 |
+- if (!sd_is_zoned(sdkp)) |
1848 |
+- return 0; |
1849 |
+- |
1850 |
+- sdkp->zones_wp_offset = NULL; |
1851 |
+- spin_lock_init(&sdkp->zones_wp_offset_lock); |
1852 |
+- sdkp->rev_wp_offset = NULL; |
1853 |
+- mutex_init(&sdkp->rev_mutex); |
1854 |
+- INIT_WORK(&sdkp->zone_wp_offset_work, sd_zbc_update_wp_offset_workfn); |
1855 |
+- sdkp->zone_wp_update_buf = kzalloc(SD_BUF_SIZE, GFP_KERNEL); |
1856 |
+- if (!sdkp->zone_wp_update_buf) |
1857 |
+- return -ENOMEM; |
1858 |
+- |
1859 |
+- return 0; |
1860 |
+-} |
1861 |
+- |
1862 |
+-void sd_zbc_release_disk(struct scsi_disk *sdkp) |
1863 |
+-{ |
1864 |
+- kvfree(sdkp->zones_wp_offset); |
1865 |
+- sdkp->zones_wp_offset = NULL; |
1866 |
+- kfree(sdkp->zone_wp_update_buf); |
1867 |
+- sdkp->zone_wp_update_buf = NULL; |
1868 |
+-} |
1869 |
+diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c |
1870 |
+index e60581283a247..6d148ab70b93e 100644 |
1871 |
+--- a/drivers/spi/spi-fsl-espi.c |
1872 |
++++ b/drivers/spi/spi-fsl-espi.c |
1873 |
+@@ -564,13 +564,14 @@ static void fsl_espi_cpu_irq(struct fsl_espi *espi, u32 events) |
1874 |
+ static irqreturn_t fsl_espi_irq(s32 irq, void *context_data) |
1875 |
+ { |
1876 |
+ struct fsl_espi *espi = context_data; |
1877 |
+- u32 events; |
1878 |
++ u32 events, mask; |
1879 |
+ |
1880 |
+ spin_lock(&espi->lock); |
1881 |
+ |
1882 |
+ /* Get interrupt events(tx/rx) */ |
1883 |
+ events = fsl_espi_read_reg(espi, ESPI_SPIE); |
1884 |
+- if (!events) { |
1885 |
++ mask = fsl_espi_read_reg(espi, ESPI_SPIM); |
1886 |
++ if (!(events & mask)) { |
1887 |
+ spin_unlock(&espi->lock); |
1888 |
+ return IRQ_NONE; |
1889 |
+ } |
1890 |
+diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c |
1891 |
+index e6e1fa68de542..94f4f05b5002c 100644 |
1892 |
+--- a/drivers/target/target_core_transport.c |
1893 |
++++ b/drivers/target/target_core_transport.c |
1894 |
+@@ -1840,7 +1840,8 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, |
1895 |
+ * out unpacked_lun for the original se_cmd. |
1896 |
+ */ |
1897 |
+ if (tm_type == TMR_ABORT_TASK && (flags & TARGET_SCF_LOOKUP_LUN_FROM_TAG)) { |
1898 |
+- if (!target_lookup_lun_from_tag(se_sess, tag, &unpacked_lun)) |
1899 |
++ if (!target_lookup_lun_from_tag(se_sess, tag, |
1900 |
++ &se_cmd->orig_fe_lun)) |
1901 |
+ goto failure; |
1902 |
+ } |
1903 |
+ |
1904 |
+diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c |
1905 |
+index 7e73e989645bd..b351962279e4d 100644 |
1906 |
+--- a/drivers/usb/core/driver.c |
1907 |
++++ b/drivers/usb/core/driver.c |
1908 |
+@@ -269,8 +269,30 @@ static int usb_probe_device(struct device *dev) |
1909 |
+ if (error) |
1910 |
+ return error; |
1911 |
+ |
1912 |
++ /* Probe the USB device with the driver in hand, but only |
1913 |
++ * defer to a generic driver in case the current USB |
1914 |
++ * device driver has an id_table or a match function; i.e., |
1915 |
++ * when the device driver was explicitly matched against |
1916 |
++ * a device. |
1917 |
++ * |
1918 |
++ * If the device driver does not have either of these, |
1919 |
++ * then we assume that it can bind to any device and is |
1920 |
++ * not truly a more specialized/non-generic driver, so a |
1921 |
++ * return value of -ENODEV should not force the device |
1922 |
++ * to be handled by the generic USB driver, as there |
1923 |
++ * can still be another, more specialized, device driver. |
1924 |
++ * |
1925 |
++ * This accommodates the usbip driver. |
1926 |
++ * |
1927 |
++ * TODO: What if, in the future, there are multiple |
1928 |
++ * specialized USB device drivers for a particular device? |
1929 |
++ * In such cases, there is a need to try all matching |
1930 |
++ * specialised device drivers prior to setting the |
1931 |
++ * use_generic_driver bit. |
1932 |
++ */ |
1933 |
+ error = udriver->probe(udev); |
1934 |
+- if (error == -ENODEV && udriver != &usb_generic_driver) { |
1935 |
++ if (error == -ENODEV && udriver != &usb_generic_driver && |
1936 |
++ (udriver->id_table || udriver->match)) { |
1937 |
+ udev->use_generic_driver = 1; |
1938 |
+ return -EPROBE_DEFER; |
1939 |
+ } |
1940 |
+@@ -831,14 +853,17 @@ static int usb_device_match(struct device *dev, struct device_driver *drv) |
1941 |
+ udev = to_usb_device(dev); |
1942 |
+ udrv = to_usb_device_driver(drv); |
1943 |
+ |
1944 |
+- if (udrv->id_table && |
1945 |
+- usb_device_match_id(udev, udrv->id_table) != NULL) { |
1946 |
+- return 1; |
1947 |
+- } |
1948 |
++ if (udrv->id_table) |
1949 |
++ return usb_device_match_id(udev, udrv->id_table) != NULL; |
1950 |
+ |
1951 |
+ if (udrv->match) |
1952 |
+ return udrv->match(udev); |
1953 |
+- return 0; |
1954 |
++ |
1955 |
++ /* If the device driver under consideration does not have a |
1956 |
++ * id_table or a match function, then let the driver's probe |
1957 |
++ * function decide. |
1958 |
++ */ |
1959 |
++ return 1; |
1960 |
+ |
1961 |
+ } else if (is_usb_interface(dev)) { |
1962 |
+ struct usb_interface *intf; |
1963 |
+@@ -905,26 +930,19 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) |
1964 |
+ return 0; |
1965 |
+ } |
1966 |
+ |
1967 |
+-static bool is_dev_usb_generic_driver(struct device *dev) |
1968 |
+-{ |
1969 |
+- struct usb_device_driver *udd = dev->driver ? |
1970 |
+- to_usb_device_driver(dev->driver) : NULL; |
1971 |
+- |
1972 |
+- return udd == &usb_generic_driver; |
1973 |
+-} |
1974 |
+- |
1975 |
+ static int __usb_bus_reprobe_drivers(struct device *dev, void *data) |
1976 |
+ { |
1977 |
+ struct usb_device_driver *new_udriver = data; |
1978 |
+ struct usb_device *udev; |
1979 |
+ int ret; |
1980 |
+ |
1981 |
+- if (!is_dev_usb_generic_driver(dev)) |
1982 |
++ /* Don't reprobe if current driver isn't usb_generic_driver */ |
1983 |
++ if (dev->driver != &usb_generic_driver.drvwrap.driver) |
1984 |
+ return 0; |
1985 |
+ |
1986 |
+ udev = to_usb_device(dev); |
1987 |
+ if (usb_device_match_id(udev, new_udriver->id_table) == NULL && |
1988 |
+- (!new_udriver->match || new_udriver->match(udev) != 0)) |
1989 |
++ (!new_udriver->match || new_udriver->match(udev) == 0)) |
1990 |
+ return 0; |
1991 |
+ |
1992 |
+ ret = device_reprobe(dev); |
1993 |
+diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c |
1994 |
+index b4206b0dede54..1f638759a9533 100644 |
1995 |
+--- a/drivers/usb/gadget/function/f_ncm.c |
1996 |
++++ b/drivers/usb/gadget/function/f_ncm.c |
1997 |
+@@ -1189,7 +1189,6 @@ static int ncm_unwrap_ntb(struct gether *port, |
1998 |
+ const struct ndp_parser_opts *opts = ncm->parser_opts; |
1999 |
+ unsigned crc_len = ncm->is_crc ? sizeof(uint32_t) : 0; |
2000 |
+ int dgram_counter; |
2001 |
+- bool ndp_after_header; |
2002 |
+ |
2003 |
+ /* dwSignature */ |
2004 |
+ if (get_unaligned_le32(tmp) != opts->nth_sign) { |
2005 |
+@@ -1216,7 +1215,6 @@ static int ncm_unwrap_ntb(struct gether *port, |
2006 |
+ } |
2007 |
+ |
2008 |
+ ndp_index = get_ncm(&tmp, opts->ndp_index); |
2009 |
+- ndp_after_header = false; |
2010 |
+ |
2011 |
+ /* Run through all the NDP's in the NTB */ |
2012 |
+ do { |
2013 |
+@@ -1232,8 +1230,6 @@ static int ncm_unwrap_ntb(struct gether *port, |
2014 |
+ ndp_index); |
2015 |
+ goto err; |
2016 |
+ } |
2017 |
+- if (ndp_index == opts->nth_size) |
2018 |
+- ndp_after_header = true; |
2019 |
+ |
2020 |
+ /* |
2021 |
+ * walk through NDP |
2022 |
+@@ -1312,37 +1308,13 @@ static int ncm_unwrap_ntb(struct gether *port, |
2023 |
+ index2 = get_ncm(&tmp, opts->dgram_item_len); |
2024 |
+ dg_len2 = get_ncm(&tmp, opts->dgram_item_len); |
2025 |
+ |
2026 |
+- if (index2 == 0 || dg_len2 == 0) |
2027 |
+- break; |
2028 |
+- |
2029 |
+ /* wDatagramIndex[1] */ |
2030 |
+- if (ndp_after_header) { |
2031 |
+- if (index2 < opts->nth_size + opts->ndp_size) { |
2032 |
+- INFO(port->func.config->cdev, |
2033 |
+- "Bad index: %#X\n", index2); |
2034 |
+- goto err; |
2035 |
+- } |
2036 |
+- } else { |
2037 |
+- if (index2 < opts->nth_size + opts->dpe_size) { |
2038 |
+- INFO(port->func.config->cdev, |
2039 |
+- "Bad index: %#X\n", index2); |
2040 |
+- goto err; |
2041 |
+- } |
2042 |
+- } |
2043 |
+ if (index2 > block_len - opts->dpe_size) { |
2044 |
+ INFO(port->func.config->cdev, |
2045 |
+ "Bad index: %#X\n", index2); |
2046 |
+ goto err; |
2047 |
+ } |
2048 |
+ |
2049 |
+- /* wDatagramLength[1] */ |
2050 |
+- if ((dg_len2 < 14 + crc_len) || |
2051 |
+- (dg_len2 > frame_max)) { |
2052 |
+- INFO(port->func.config->cdev, |
2053 |
+- "Bad dgram length: %#X\n", dg_len); |
2054 |
+- goto err; |
2055 |
+- } |
2056 |
+- |
2057 |
+ /* |
2058 |
+ * Copy the data into a new skb. |
2059 |
+ * This ensures the truesize is correct |
2060 |
+@@ -1359,6 +1331,8 @@ static int ncm_unwrap_ntb(struct gether *port, |
2061 |
+ ndp_len -= 2 * (opts->dgram_item_len * 2); |
2062 |
+ |
2063 |
+ dgram_counter++; |
2064 |
++ if (index2 == 0 || dg_len2 == 0) |
2065 |
++ break; |
2066 |
+ } while (ndp_len > 2 * (opts->dgram_item_len * 2)); |
2067 |
+ } while (ndp_index); |
2068 |
+ |
2069 |
+diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c |
2070 |
+index 9d7d642022d1f..2305d425e6c9a 100644 |
2071 |
+--- a/drivers/usb/usbip/stub_dev.c |
2072 |
++++ b/drivers/usb/usbip/stub_dev.c |
2073 |
+@@ -461,11 +461,6 @@ static void stub_disconnect(struct usb_device *udev) |
2074 |
+ return; |
2075 |
+ } |
2076 |
+ |
2077 |
+-static bool usbip_match(struct usb_device *udev) |
2078 |
+-{ |
2079 |
+- return true; |
2080 |
+-} |
2081 |
+- |
2082 |
+ #ifdef CONFIG_PM |
2083 |
+ |
2084 |
+ /* These functions need usb_port_suspend and usb_port_resume, |
2085 |
+@@ -491,7 +486,6 @@ struct usb_device_driver stub_driver = { |
2086 |
+ .name = "usbip-host", |
2087 |
+ .probe = stub_probe, |
2088 |
+ .disconnect = stub_disconnect, |
2089 |
+- .match = usbip_match, |
2090 |
+ #ifdef CONFIG_PM |
2091 |
+ .suspend = stub_suspend, |
2092 |
+ .resume = stub_resume, |
2093 |
+diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c |
2094 |
+index 90b8f56fbadb1..6f02c18fa65c8 100644 |
2095 |
+--- a/drivers/xen/events/events_base.c |
2096 |
++++ b/drivers/xen/events/events_base.c |
2097 |
+@@ -92,6 +92,8 @@ static bool (*pirq_needs_eoi)(unsigned irq); |
2098 |
+ /* Xen will never allocate port zero for any purpose. */ |
2099 |
+ #define VALID_EVTCHN(chn) ((chn) != 0) |
2100 |
+ |
2101 |
++static struct irq_info *legacy_info_ptrs[NR_IRQS_LEGACY]; |
2102 |
++ |
2103 |
+ static struct irq_chip xen_dynamic_chip; |
2104 |
+ static struct irq_chip xen_percpu_chip; |
2105 |
+ static struct irq_chip xen_pirq_chip; |
2106 |
+@@ -156,7 +158,18 @@ int get_evtchn_to_irq(evtchn_port_t evtchn) |
2107 |
+ /* Get info for IRQ */ |
2108 |
+ struct irq_info *info_for_irq(unsigned irq) |
2109 |
+ { |
2110 |
+- return irq_get_chip_data(irq); |
2111 |
++ if (irq < nr_legacy_irqs()) |
2112 |
++ return legacy_info_ptrs[irq]; |
2113 |
++ else |
2114 |
++ return irq_get_chip_data(irq); |
2115 |
++} |
2116 |
++ |
2117 |
++static void set_info_for_irq(unsigned int irq, struct irq_info *info) |
2118 |
++{ |
2119 |
++ if (irq < nr_legacy_irqs()) |
2120 |
++ legacy_info_ptrs[irq] = info; |
2121 |
++ else |
2122 |
++ irq_set_chip_data(irq, info); |
2123 |
+ } |
2124 |
+ |
2125 |
+ /* Constructors for packed IRQ information. */ |
2126 |
+@@ -377,7 +390,7 @@ static void xen_irq_init(unsigned irq) |
2127 |
+ info->type = IRQT_UNBOUND; |
2128 |
+ info->refcnt = -1; |
2129 |
+ |
2130 |
+- irq_set_chip_data(irq, info); |
2131 |
++ set_info_for_irq(irq, info); |
2132 |
+ |
2133 |
+ list_add_tail(&info->list, &xen_irq_list_head); |
2134 |
+ } |
2135 |
+@@ -426,14 +439,14 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi) |
2136 |
+ |
2137 |
+ static void xen_free_irq(unsigned irq) |
2138 |
+ { |
2139 |
+- struct irq_info *info = irq_get_chip_data(irq); |
2140 |
++ struct irq_info *info = info_for_irq(irq); |
2141 |
+ |
2142 |
+ if (WARN_ON(!info)) |
2143 |
+ return; |
2144 |
+ |
2145 |
+ list_del(&info->list); |
2146 |
+ |
2147 |
+- irq_set_chip_data(irq, NULL); |
2148 |
++ set_info_for_irq(irq, NULL); |
2149 |
+ |
2150 |
+ WARN_ON(info->refcnt > 0); |
2151 |
+ |
2152 |
+@@ -603,7 +616,7 @@ EXPORT_SYMBOL_GPL(xen_irq_from_gsi); |
2153 |
+ static void __unbind_from_irq(unsigned int irq) |
2154 |
+ { |
2155 |
+ evtchn_port_t evtchn = evtchn_from_irq(irq); |
2156 |
+- struct irq_info *info = irq_get_chip_data(irq); |
2157 |
++ struct irq_info *info = info_for_irq(irq); |
2158 |
+ |
2159 |
+ if (info->refcnt > 0) { |
2160 |
+ info->refcnt--; |
2161 |
+@@ -1108,7 +1121,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi, |
2162 |
+ |
2163 |
+ void unbind_from_irqhandler(unsigned int irq, void *dev_id) |
2164 |
+ { |
2165 |
+- struct irq_info *info = irq_get_chip_data(irq); |
2166 |
++ struct irq_info *info = info_for_irq(irq); |
2167 |
+ |
2168 |
+ if (WARN_ON(!info)) |
2169 |
+ return; |
2170 |
+@@ -1142,7 +1155,7 @@ int evtchn_make_refcounted(evtchn_port_t evtchn) |
2171 |
+ if (irq == -1) |
2172 |
+ return -ENOENT; |
2173 |
+ |
2174 |
+- info = irq_get_chip_data(irq); |
2175 |
++ info = info_for_irq(irq); |
2176 |
+ |
2177 |
+ if (!info) |
2178 |
+ return -ENOENT; |
2179 |
+@@ -1170,7 +1183,7 @@ int evtchn_get(evtchn_port_t evtchn) |
2180 |
+ if (irq == -1) |
2181 |
+ goto done; |
2182 |
+ |
2183 |
+- info = irq_get_chip_data(irq); |
2184 |
++ info = info_for_irq(irq); |
2185 |
+ |
2186 |
+ if (!info) |
2187 |
+ goto done; |
2188 |
+diff --git a/fs/autofs/waitq.c b/fs/autofs/waitq.c |
2189 |
+index 74c886f7c51cb..5ced859dac539 100644 |
2190 |
+--- a/fs/autofs/waitq.c |
2191 |
++++ b/fs/autofs/waitq.c |
2192 |
+@@ -53,7 +53,7 @@ static int autofs_write(struct autofs_sb_info *sbi, |
2193 |
+ |
2194 |
+ mutex_lock(&sbi->pipe_mutex); |
2195 |
+ while (bytes) { |
2196 |
+- wr = kernel_write(file, data, bytes, &file->f_pos); |
2197 |
++ wr = __kernel_write(file, data, bytes, NULL); |
2198 |
+ if (wr <= 0) |
2199 |
+ break; |
2200 |
+ data += wr; |
2201 |
+diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c |
2202 |
+index db93909b25e08..eb86e4b88c73a 100644 |
2203 |
+--- a/fs/btrfs/dev-replace.c |
2204 |
++++ b/fs/btrfs/dev-replace.c |
2205 |
+@@ -599,6 +599,37 @@ static void btrfs_rm_dev_replace_unblocked(struct btrfs_fs_info *fs_info) |
2206 |
+ wake_up(&fs_info->dev_replace.replace_wait); |
2207 |
+ } |
2208 |
+ |
2209 |
++/* |
2210 |
++ * When finishing the device replace, before swapping the source device with the |
2211 |
++ * target device we must update the chunk allocation state in the target device, |
2212 |
++ * as it is empty because replace works by directly copying the chunks and not |
2213 |
++ * through the normal chunk allocation path. |
2214 |
++ */ |
2215 |
++static int btrfs_set_target_alloc_state(struct btrfs_device *srcdev, |
2216 |
++ struct btrfs_device *tgtdev) |
2217 |
++{ |
2218 |
++ struct extent_state *cached_state = NULL; |
2219 |
++ u64 start = 0; |
2220 |
++ u64 found_start; |
2221 |
++ u64 found_end; |
2222 |
++ int ret = 0; |
2223 |
++ |
2224 |
++ lockdep_assert_held(&srcdev->fs_info->chunk_mutex); |
2225 |
++ |
2226 |
++ while (!find_first_extent_bit(&srcdev->alloc_state, start, |
2227 |
++ &found_start, &found_end, |
2228 |
++ CHUNK_ALLOCATED, &cached_state)) { |
2229 |
++ ret = set_extent_bits(&tgtdev->alloc_state, found_start, |
2230 |
++ found_end, CHUNK_ALLOCATED); |
2231 |
++ if (ret) |
2232 |
++ break; |
2233 |
++ start = found_end + 1; |
2234 |
++ } |
2235 |
++ |
2236 |
++ free_extent_state(cached_state); |
2237 |
++ return ret; |
2238 |
++} |
2239 |
++ |
2240 |
+ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, |
2241 |
+ int scrub_ret) |
2242 |
+ { |
2243 |
+@@ -673,8 +704,14 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, |
2244 |
+ dev_replace->time_stopped = ktime_get_real_seconds(); |
2245 |
+ dev_replace->item_needs_writeback = 1; |
2246 |
+ |
2247 |
+- /* replace old device with new one in mapping tree */ |
2248 |
++ /* |
2249 |
++ * Update allocation state in the new device and replace the old device |
2250 |
++ * with the new one in the mapping tree. |
2251 |
++ */ |
2252 |
+ if (!scrub_ret) { |
2253 |
++ scrub_ret = btrfs_set_target_alloc_state(src_device, tgt_device); |
2254 |
++ if (scrub_ret) |
2255 |
++ goto error; |
2256 |
+ btrfs_dev_replace_update_device_in_mapping_tree(fs_info, |
2257 |
+ src_device, |
2258 |
+ tgt_device); |
2259 |
+@@ -685,6 +722,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, |
2260 |
+ btrfs_dev_name(src_device), |
2261 |
+ src_device->devid, |
2262 |
+ rcu_str_deref(tgt_device->name), scrub_ret); |
2263 |
++error: |
2264 |
+ up_write(&dev_replace->rwsem); |
2265 |
+ mutex_unlock(&fs_info->chunk_mutex); |
2266 |
+ mutex_unlock(&fs_info->fs_devices->device_list_mutex); |
2267 |
+diff --git a/fs/eventpoll.c b/fs/eventpoll.c |
2268 |
+index 8107e06d7f6f5..4df61129566d4 100644 |
2269 |
+--- a/fs/eventpoll.c |
2270 |
++++ b/fs/eventpoll.c |
2271 |
+@@ -218,8 +218,7 @@ struct eventpoll { |
2272 |
+ struct file *file; |
2273 |
+ |
2274 |
+ /* used to optimize loop detection check */ |
2275 |
+- struct list_head visited_list_link; |
2276 |
+- int visited; |
2277 |
++ u64 gen; |
2278 |
+ |
2279 |
+ #ifdef CONFIG_NET_RX_BUSY_POLL |
2280 |
+ /* used to track busy poll napi_id */ |
2281 |
+@@ -274,6 +273,8 @@ static long max_user_watches __read_mostly; |
2282 |
+ */ |
2283 |
+ static DEFINE_MUTEX(epmutex); |
2284 |
+ |
2285 |
++static u64 loop_check_gen = 0; |
2286 |
++ |
2287 |
+ /* Used to check for epoll file descriptor inclusion loops */ |
2288 |
+ static struct nested_calls poll_loop_ncalls; |
2289 |
+ |
2290 |
+@@ -283,9 +284,6 @@ static struct kmem_cache *epi_cache __read_mostly; |
2291 |
+ /* Slab cache used to allocate "struct eppoll_entry" */ |
2292 |
+ static struct kmem_cache *pwq_cache __read_mostly; |
2293 |
+ |
2294 |
+-/* Visited nodes during ep_loop_check(), so we can unset them when we finish */ |
2295 |
+-static LIST_HEAD(visited_list); |
2296 |
+- |
2297 |
+ /* |
2298 |
+ * List of files with newly added links, where we may need to limit the number |
2299 |
+ * of emanating paths. Protected by the epmutex. |
2300 |
+@@ -1450,7 +1448,7 @@ static int reverse_path_check(void) |
2301 |
+ |
2302 |
+ static int ep_create_wakeup_source(struct epitem *epi) |
2303 |
+ { |
2304 |
+- const char *name; |
2305 |
++ struct name_snapshot n; |
2306 |
+ struct wakeup_source *ws; |
2307 |
+ |
2308 |
+ if (!epi->ep->ws) { |
2309 |
+@@ -1459,8 +1457,9 @@ static int ep_create_wakeup_source(struct epitem *epi) |
2310 |
+ return -ENOMEM; |
2311 |
+ } |
2312 |
+ |
2313 |
+- name = epi->ffd.file->f_path.dentry->d_name.name; |
2314 |
+- ws = wakeup_source_register(NULL, name); |
2315 |
++ take_dentry_name_snapshot(&n, epi->ffd.file->f_path.dentry); |
2316 |
++ ws = wakeup_source_register(NULL, n.name.name); |
2317 |
++ release_dentry_name_snapshot(&n); |
2318 |
+ |
2319 |
+ if (!ws) |
2320 |
+ return -ENOMEM; |
2321 |
+@@ -1522,6 +1521,22 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event, |
2322 |
+ RCU_INIT_POINTER(epi->ws, NULL); |
2323 |
+ } |
2324 |
+ |
2325 |
++ /* Add the current item to the list of active epoll hook for this file */ |
2326 |
++ spin_lock(&tfile->f_lock); |
2327 |
++ list_add_tail_rcu(&epi->fllink, &tfile->f_ep_links); |
2328 |
++ spin_unlock(&tfile->f_lock); |
2329 |
++ |
2330 |
++ /* |
2331 |
++ * Add the current item to the RB tree. All RB tree operations are |
2332 |
++ * protected by "mtx", and ep_insert() is called with "mtx" held. |
2333 |
++ */ |
2334 |
++ ep_rbtree_insert(ep, epi); |
2335 |
++ |
2336 |
++ /* now check if we've created too many backpaths */ |
2337 |
++ error = -EINVAL; |
2338 |
++ if (full_check && reverse_path_check()) |
2339 |
++ goto error_remove_epi; |
2340 |
++ |
2341 |
+ /* Initialize the poll table using the queue callback */ |
2342 |
+ epq.epi = epi; |
2343 |
+ init_poll_funcptr(&epq.pt, ep_ptable_queue_proc); |
2344 |
+@@ -1544,22 +1559,6 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event, |
2345 |
+ if (epi->nwait < 0) |
2346 |
+ goto error_unregister; |
2347 |
+ |
2348 |
+- /* Add the current item to the list of active epoll hook for this file */ |
2349 |
+- spin_lock(&tfile->f_lock); |
2350 |
+- list_add_tail_rcu(&epi->fllink, &tfile->f_ep_links); |
2351 |
+- spin_unlock(&tfile->f_lock); |
2352 |
+- |
2353 |
+- /* |
2354 |
+- * Add the current item to the RB tree. All RB tree operations are |
2355 |
+- * protected by "mtx", and ep_insert() is called with "mtx" held. |
2356 |
+- */ |
2357 |
+- ep_rbtree_insert(ep, epi); |
2358 |
+- |
2359 |
+- /* now check if we've created too many backpaths */ |
2360 |
+- error = -EINVAL; |
2361 |
+- if (full_check && reverse_path_check()) |
2362 |
+- goto error_remove_epi; |
2363 |
+- |
2364 |
+ /* We have to drop the new item inside our item list to keep track of it */ |
2365 |
+ write_lock_irq(&ep->lock); |
2366 |
+ |
2367 |
+@@ -1588,6 +1587,8 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event, |
2368 |
+ |
2369 |
+ return 0; |
2370 |
+ |
2371 |
++error_unregister: |
2372 |
++ ep_unregister_pollwait(ep, epi); |
2373 |
+ error_remove_epi: |
2374 |
+ spin_lock(&tfile->f_lock); |
2375 |
+ list_del_rcu(&epi->fllink); |
2376 |
+@@ -1595,9 +1596,6 @@ error_remove_epi: |
2377 |
+ |
2378 |
+ rb_erase_cached(&epi->rbn, &ep->rbr); |
2379 |
+ |
2380 |
+-error_unregister: |
2381 |
+- ep_unregister_pollwait(ep, epi); |
2382 |
+- |
2383 |
+ /* |
2384 |
+ * We need to do this because an event could have been arrived on some |
2385 |
+ * allocated wait queue. Note that we don't care about the ep->ovflist |
2386 |
+@@ -1972,13 +1970,12 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests) |
2387 |
+ struct epitem *epi; |
2388 |
+ |
2389 |
+ mutex_lock_nested(&ep->mtx, call_nests + 1); |
2390 |
+- ep->visited = 1; |
2391 |
+- list_add(&ep->visited_list_link, &visited_list); |
2392 |
++ ep->gen = loop_check_gen; |
2393 |
+ for (rbp = rb_first_cached(&ep->rbr); rbp; rbp = rb_next(rbp)) { |
2394 |
+ epi = rb_entry(rbp, struct epitem, rbn); |
2395 |
+ if (unlikely(is_file_epoll(epi->ffd.file))) { |
2396 |
+ ep_tovisit = epi->ffd.file->private_data; |
2397 |
+- if (ep_tovisit->visited) |
2398 |
++ if (ep_tovisit->gen == loop_check_gen) |
2399 |
+ continue; |
2400 |
+ error = ep_call_nested(&poll_loop_ncalls, |
2401 |
+ ep_loop_check_proc, epi->ffd.file, |
2402 |
+@@ -2019,18 +2016,8 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests) |
2403 |
+ */ |
2404 |
+ static int ep_loop_check(struct eventpoll *ep, struct file *file) |
2405 |
+ { |
2406 |
+- int ret; |
2407 |
+- struct eventpoll *ep_cur, *ep_next; |
2408 |
+- |
2409 |
+- ret = ep_call_nested(&poll_loop_ncalls, |
2410 |
++ return ep_call_nested(&poll_loop_ncalls, |
2411 |
+ ep_loop_check_proc, file, ep, current); |
2412 |
+- /* clear visited list */ |
2413 |
+- list_for_each_entry_safe(ep_cur, ep_next, &visited_list, |
2414 |
+- visited_list_link) { |
2415 |
+- ep_cur->visited = 0; |
2416 |
+- list_del(&ep_cur->visited_list_link); |
2417 |
+- } |
2418 |
+- return ret; |
2419 |
+ } |
2420 |
+ |
2421 |
+ static void clear_tfile_check_list(void) |
2422 |
+@@ -2195,11 +2182,13 @@ int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds, |
2423 |
+ goto error_tgt_fput; |
2424 |
+ if (op == EPOLL_CTL_ADD) { |
2425 |
+ if (!list_empty(&f.file->f_ep_links) || |
2426 |
++ ep->gen == loop_check_gen || |
2427 |
+ is_file_epoll(tf.file)) { |
2428 |
+ mutex_unlock(&ep->mtx); |
2429 |
+ error = epoll_mutex_lock(&epmutex, 0, nonblock); |
2430 |
+ if (error) |
2431 |
+ goto error_tgt_fput; |
2432 |
++ loop_check_gen++; |
2433 |
+ full_check = 1; |
2434 |
+ if (is_file_epoll(tf.file)) { |
2435 |
+ error = -ELOOP; |
2436 |
+@@ -2263,6 +2252,7 @@ int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds, |
2437 |
+ error_tgt_fput: |
2438 |
+ if (full_check) { |
2439 |
+ clear_tfile_check_list(); |
2440 |
++ loop_check_gen++; |
2441 |
+ mutex_unlock(&epmutex); |
2442 |
+ } |
2443 |
+ |
2444 |
+diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
2445 |
+index 83d917f7e5425..98e170cc0b932 100644 |
2446 |
+--- a/fs/fuse/file.c |
2447 |
++++ b/fs/fuse/file.c |
2448 |
+@@ -3091,11 +3091,10 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) |
2449 |
+ ssize_t ret = 0; |
2450 |
+ struct file *file = iocb->ki_filp; |
2451 |
+ struct fuse_file *ff = file->private_data; |
2452 |
+- bool async_dio = ff->fc->async_dio; |
2453 |
+ loff_t pos = 0; |
2454 |
+ struct inode *inode; |
2455 |
+ loff_t i_size; |
2456 |
+- size_t count = iov_iter_count(iter); |
2457 |
++ size_t count = iov_iter_count(iter), shortened = 0; |
2458 |
+ loff_t offset = iocb->ki_pos; |
2459 |
+ struct fuse_io_priv *io; |
2460 |
+ |
2461 |
+@@ -3103,17 +3102,9 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) |
2462 |
+ inode = file->f_mapping->host; |
2463 |
+ i_size = i_size_read(inode); |
2464 |
+ |
2465 |
+- if ((iov_iter_rw(iter) == READ) && (offset > i_size)) |
2466 |
++ if ((iov_iter_rw(iter) == READ) && (offset >= i_size)) |
2467 |
+ return 0; |
2468 |
+ |
2469 |
+- /* optimization for short read */ |
2470 |
+- if (async_dio && iov_iter_rw(iter) != WRITE && offset + count > i_size) { |
2471 |
+- if (offset >= i_size) |
2472 |
+- return 0; |
2473 |
+- iov_iter_truncate(iter, fuse_round_up(ff->fc, i_size - offset)); |
2474 |
+- count = iov_iter_count(iter); |
2475 |
+- } |
2476 |
+- |
2477 |
+ io = kmalloc(sizeof(struct fuse_io_priv), GFP_KERNEL); |
2478 |
+ if (!io) |
2479 |
+ return -ENOMEM; |
2480 |
+@@ -3129,15 +3120,22 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) |
2481 |
+ * By default, we want to optimize all I/Os with async request |
2482 |
+ * submission to the client filesystem if supported. |
2483 |
+ */ |
2484 |
+- io->async = async_dio; |
2485 |
++ io->async = ff->fc->async_dio; |
2486 |
+ io->iocb = iocb; |
2487 |
+ io->blocking = is_sync_kiocb(iocb); |
2488 |
+ |
2489 |
++ /* optimization for short read */ |
2490 |
++ if (io->async && !io->write && offset + count > i_size) { |
2491 |
++ iov_iter_truncate(iter, fuse_round_up(ff->fc, i_size - offset)); |
2492 |
++ shortened = count - iov_iter_count(iter); |
2493 |
++ count -= shortened; |
2494 |
++ } |
2495 |
++ |
2496 |
+ /* |
2497 |
+ * We cannot asynchronously extend the size of a file. |
2498 |
+ * In such case the aio will behave exactly like sync io. |
2499 |
+ */ |
2500 |
+- if ((offset + count > i_size) && iov_iter_rw(iter) == WRITE) |
2501 |
++ if ((offset + count > i_size) && io->write) |
2502 |
+ io->blocking = true; |
2503 |
+ |
2504 |
+ if (io->async && io->blocking) { |
2505 |
+@@ -3155,6 +3153,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) |
2506 |
+ } else { |
2507 |
+ ret = __fuse_direct_read(io, iter, &pos); |
2508 |
+ } |
2509 |
++ iov_iter_reexpand(iter, iov_iter_count(iter) + shortened); |
2510 |
+ |
2511 |
+ if (io->async) { |
2512 |
+ bool blocking = io->blocking; |
2513 |
+diff --git a/fs/io_uring.c b/fs/io_uring.c |
2514 |
+index 1d5640cc2a488..ebc3586b18795 100644 |
2515 |
+--- a/fs/io_uring.c |
2516 |
++++ b/fs/io_uring.c |
2517 |
+@@ -3318,7 +3318,7 @@ static int io_epoll_ctl_prep(struct io_kiocb *req, |
2518 |
+ #if defined(CONFIG_EPOLL) |
2519 |
+ if (sqe->ioprio || sqe->buf_index) |
2520 |
+ return -EINVAL; |
2521 |
+- if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) |
2522 |
++ if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL | IORING_SETUP_SQPOLL))) |
2523 |
+ return -EINVAL; |
2524 |
+ |
2525 |
+ req->epoll.epfd = READ_ONCE(sqe->fd); |
2526 |
+@@ -3435,7 +3435,7 @@ static int io_fadvise(struct io_kiocb *req, bool force_nonblock) |
2527 |
+ |
2528 |
+ static int io_statx_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) |
2529 |
+ { |
2530 |
+- if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) |
2531 |
++ if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL | IORING_SETUP_SQPOLL))) |
2532 |
+ return -EINVAL; |
2533 |
+ if (sqe->ioprio || sqe->buf_index) |
2534 |
+ return -EINVAL; |
2535 |
+@@ -4310,6 +4310,8 @@ static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode, |
2536 |
+ if (mask && !(mask & poll->events)) |
2537 |
+ return 0; |
2538 |
+ |
2539 |
++ list_del_init(&wait->entry); |
2540 |
++ |
2541 |
+ if (poll && poll->head) { |
2542 |
+ bool done; |
2543 |
+ |
2544 |
+@@ -5040,6 +5042,8 @@ static int io_async_cancel(struct io_kiocb *req) |
2545 |
+ static int io_files_update_prep(struct io_kiocb *req, |
2546 |
+ const struct io_uring_sqe *sqe) |
2547 |
+ { |
2548 |
++ if (unlikely(req->ctx->flags & IORING_SETUP_SQPOLL)) |
2549 |
++ return -EINVAL; |
2550 |
+ if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT))) |
2551 |
+ return -EINVAL; |
2552 |
+ if (sqe->ioprio || sqe->rw_flags) |
2553 |
+diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c |
2554 |
+index 5a331da5f55ad..785f46217f11a 100644 |
2555 |
+--- a/fs/nfs/dir.c |
2556 |
++++ b/fs/nfs/dir.c |
2557 |
+@@ -579,6 +579,9 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en |
2558 |
+ xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE); |
2559 |
+ |
2560 |
+ do { |
2561 |
++ if (entry->label) |
2562 |
++ entry->label->len = NFS4_MAXLABELLEN; |
2563 |
++ |
2564 |
+ status = xdr_decode(desc, entry, &stream); |
2565 |
+ if (status != 0) { |
2566 |
+ if (status == -EAGAIN) |
2567 |
+diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c |
2568 |
+index 048272d60a165..f9348ed1bcdad 100644 |
2569 |
+--- a/fs/nfs/flexfilelayout/flexfilelayout.c |
2570 |
++++ b/fs/nfs/flexfilelayout/flexfilelayout.c |
2571 |
+@@ -838,6 +838,7 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio, |
2572 |
+ struct nfs4_ff_layout_mirror *mirror; |
2573 |
+ struct nfs4_pnfs_ds *ds; |
2574 |
+ int ds_idx; |
2575 |
++ u32 i; |
2576 |
+ |
2577 |
+ retry: |
2578 |
+ ff_layout_pg_check_layout(pgio, req); |
2579 |
+@@ -864,14 +865,14 @@ retry: |
2580 |
+ goto retry; |
2581 |
+ } |
2582 |
+ |
2583 |
+- mirror = FF_LAYOUT_COMP(pgio->pg_lseg, ds_idx); |
2584 |
++ for (i = 0; i < pgio->pg_mirror_count; i++) { |
2585 |
++ mirror = FF_LAYOUT_COMP(pgio->pg_lseg, i); |
2586 |
++ pgm = &pgio->pg_mirrors[i]; |
2587 |
++ pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize; |
2588 |
++ } |
2589 |
+ |
2590 |
+ pgio->pg_mirror_idx = ds_idx; |
2591 |
+ |
2592 |
+- /* read always uses only one mirror - idx 0 for pgio layer */ |
2593 |
+- pgm = &pgio->pg_mirrors[0]; |
2594 |
+- pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize; |
2595 |
+- |
2596 |
+ if (NFS_SERVER(pgio->pg_inode)->flags & |
2597 |
+ (NFS_MOUNT_SOFT|NFS_MOUNT_SOFTERR)) |
2598 |
+ pgio->pg_maxretrans = io_maxretrans; |
2599 |
+diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c |
2600 |
+index e2ae54b35dfe1..395a468e349b0 100644 |
2601 |
+--- a/fs/nfs/nfs42proc.c |
2602 |
++++ b/fs/nfs/nfs42proc.c |
2603 |
+@@ -355,7 +355,15 @@ static ssize_t _nfs42_proc_copy(struct file *src, |
2604 |
+ |
2605 |
+ truncate_pagecache_range(dst_inode, pos_dst, |
2606 |
+ pos_dst + res->write_res.count); |
2607 |
+- |
2608 |
++ spin_lock(&dst_inode->i_lock); |
2609 |
++ NFS_I(dst_inode)->cache_validity |= (NFS_INO_REVAL_PAGECACHE | |
2610 |
++ NFS_INO_REVAL_FORCED | NFS_INO_INVALID_SIZE | |
2611 |
++ NFS_INO_INVALID_ATTR | NFS_INO_INVALID_DATA); |
2612 |
++ spin_unlock(&dst_inode->i_lock); |
2613 |
++ spin_lock(&src_inode->i_lock); |
2614 |
++ NFS_I(src_inode)->cache_validity |= (NFS_INO_REVAL_PAGECACHE | |
2615 |
++ NFS_INO_REVAL_FORCED | NFS_INO_INVALID_ATIME); |
2616 |
++ spin_unlock(&src_inode->i_lock); |
2617 |
+ status = res->write_res.count; |
2618 |
+ out: |
2619 |
+ if (args->sync) |
2620 |
+diff --git a/fs/pipe.c b/fs/pipe.c |
2621 |
+index 60dbee4571436..117db82b10af5 100644 |
2622 |
+--- a/fs/pipe.c |
2623 |
++++ b/fs/pipe.c |
2624 |
+@@ -106,25 +106,6 @@ void pipe_double_lock(struct pipe_inode_info *pipe1, |
2625 |
+ } |
2626 |
+ } |
2627 |
+ |
2628 |
+-/* Drop the inode semaphore and wait for a pipe event, atomically */ |
2629 |
+-void pipe_wait(struct pipe_inode_info *pipe) |
2630 |
+-{ |
2631 |
+- DEFINE_WAIT(rdwait); |
2632 |
+- DEFINE_WAIT(wrwait); |
2633 |
+- |
2634 |
+- /* |
2635 |
+- * Pipes are system-local resources, so sleeping on them |
2636 |
+- * is considered a noninteractive wait: |
2637 |
+- */ |
2638 |
+- prepare_to_wait(&pipe->rd_wait, &rdwait, TASK_INTERRUPTIBLE); |
2639 |
+- prepare_to_wait(&pipe->wr_wait, &wrwait, TASK_INTERRUPTIBLE); |
2640 |
+- pipe_unlock(pipe); |
2641 |
+- schedule(); |
2642 |
+- finish_wait(&pipe->rd_wait, &rdwait); |
2643 |
+- finish_wait(&pipe->wr_wait, &wrwait); |
2644 |
+- pipe_lock(pipe); |
2645 |
+-} |
2646 |
+- |
2647 |
+ static void anon_pipe_buf_release(struct pipe_inode_info *pipe, |
2648 |
+ struct pipe_buffer *buf) |
2649 |
+ { |
2650 |
+@@ -1035,12 +1016,52 @@ SYSCALL_DEFINE1(pipe, int __user *, fildes) |
2651 |
+ return do_pipe2(fildes, 0); |
2652 |
+ } |
2653 |
+ |
2654 |
++/* |
2655 |
++ * This is the stupid "wait for pipe to be readable or writable" |
2656 |
++ * model. |
2657 |
++ * |
2658 |
++ * See pipe_read/write() for the proper kind of exclusive wait, |
2659 |
++ * but that requires that we wake up any other readers/writers |
2660 |
++ * if we then do not end up reading everything (ie the whole |
2661 |
++ * "wake_next_reader/writer" logic in pipe_read/write()). |
2662 |
++ */ |
2663 |
++void pipe_wait_readable(struct pipe_inode_info *pipe) |
2664 |
++{ |
2665 |
++ pipe_unlock(pipe); |
2666 |
++ wait_event_interruptible(pipe->rd_wait, pipe_readable(pipe)); |
2667 |
++ pipe_lock(pipe); |
2668 |
++} |
2669 |
++ |
2670 |
++void pipe_wait_writable(struct pipe_inode_info *pipe) |
2671 |
++{ |
2672 |
++ pipe_unlock(pipe); |
2673 |
++ wait_event_interruptible(pipe->wr_wait, pipe_writable(pipe)); |
2674 |
++ pipe_lock(pipe); |
2675 |
++} |
2676 |
++ |
2677 |
++/* |
2678 |
++ * This depends on both the wait (here) and the wakeup (wake_up_partner) |
2679 |
++ * holding the pipe lock, so "*cnt" is stable and we know a wakeup cannot |
2680 |
++ * race with the count check and waitqueue prep. |
2681 |
++ * |
2682 |
++ * Normally in order to avoid races, you'd do the prepare_to_wait() first, |
2683 |
++ * then check the condition you're waiting for, and only then sleep. But |
2684 |
++ * because of the pipe lock, we can check the condition before being on |
2685 |
++ * the wait queue. |
2686 |
++ * |
2687 |
++ * We use the 'rd_wait' waitqueue for pipe partner waiting. |
2688 |
++ */ |
2689 |
+ static int wait_for_partner(struct pipe_inode_info *pipe, unsigned int *cnt) |
2690 |
+ { |
2691 |
++ DEFINE_WAIT(rdwait); |
2692 |
+ int cur = *cnt; |
2693 |
+ |
2694 |
+ while (cur == *cnt) { |
2695 |
+- pipe_wait(pipe); |
2696 |
++ prepare_to_wait(&pipe->rd_wait, &rdwait, TASK_INTERRUPTIBLE); |
2697 |
++ pipe_unlock(pipe); |
2698 |
++ schedule(); |
2699 |
++ finish_wait(&pipe->rd_wait, &rdwait); |
2700 |
++ pipe_lock(pipe); |
2701 |
+ if (signal_pending(current)) |
2702 |
+ break; |
2703 |
+ } |
2704 |
+@@ -1050,7 +1071,6 @@ static int wait_for_partner(struct pipe_inode_info *pipe, unsigned int *cnt) |
2705 |
+ static void wake_up_partner(struct pipe_inode_info *pipe) |
2706 |
+ { |
2707 |
+ wake_up_interruptible_all(&pipe->rd_wait); |
2708 |
+- wake_up_interruptible_all(&pipe->wr_wait); |
2709 |
+ } |
2710 |
+ |
2711 |
+ static int fifo_open(struct inode *inode, struct file *filp) |
2712 |
+diff --git a/fs/read_write.c b/fs/read_write.c |
2713 |
+index 4fb797822567a..9a5cb9c2f0d46 100644 |
2714 |
+--- a/fs/read_write.c |
2715 |
++++ b/fs/read_write.c |
2716 |
+@@ -538,6 +538,14 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t |
2717 |
+ inc_syscw(current); |
2718 |
+ return ret; |
2719 |
+ } |
2720 |
++/* |
2721 |
++ * This "EXPORT_SYMBOL_GPL()" is more of a "EXPORT_SYMBOL_DONTUSE()", |
2722 |
++ * but autofs is one of the few internal kernel users that actually |
2723 |
++ * wants this _and_ can be built as a module. So we need to export |
2724 |
++ * this symbol for autofs, even though it really isn't appropriate |
2725 |
++ * for any other kernel modules. |
2726 |
++ */ |
2727 |
++EXPORT_SYMBOL_GPL(__kernel_write); |
2728 |
+ |
2729 |
+ ssize_t kernel_write(struct file *file, const void *buf, size_t count, |
2730 |
+ loff_t *pos) |
2731 |
+diff --git a/fs/splice.c b/fs/splice.c |
2732 |
+index d7c8a7c4db07f..c3d00dfc73446 100644 |
2733 |
+--- a/fs/splice.c |
2734 |
++++ b/fs/splice.c |
2735 |
+@@ -563,7 +563,7 @@ static int splice_from_pipe_next(struct pipe_inode_info *pipe, struct splice_des |
2736 |
+ sd->need_wakeup = false; |
2737 |
+ } |
2738 |
+ |
2739 |
+- pipe_wait(pipe); |
2740 |
++ pipe_wait_readable(pipe); |
2741 |
+ } |
2742 |
+ |
2743 |
+ return 1; |
2744 |
+@@ -1077,7 +1077,7 @@ static int wait_for_space(struct pipe_inode_info *pipe, unsigned flags) |
2745 |
+ return -EAGAIN; |
2746 |
+ if (signal_pending(current)) |
2747 |
+ return -ERESTARTSYS; |
2748 |
+- pipe_wait(pipe); |
2749 |
++ pipe_wait_writable(pipe); |
2750 |
+ } |
2751 |
+ } |
2752 |
+ |
2753 |
+@@ -1454,7 +1454,7 @@ static int ipipe_prep(struct pipe_inode_info *pipe, unsigned int flags) |
2754 |
+ ret = -EAGAIN; |
2755 |
+ break; |
2756 |
+ } |
2757 |
+- pipe_wait(pipe); |
2758 |
++ pipe_wait_readable(pipe); |
2759 |
+ } |
2760 |
+ |
2761 |
+ pipe_unlock(pipe); |
2762 |
+@@ -1493,7 +1493,7 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags) |
2763 |
+ ret = -ERESTARTSYS; |
2764 |
+ break; |
2765 |
+ } |
2766 |
+- pipe_wait(pipe); |
2767 |
++ pipe_wait_writable(pipe); |
2768 |
+ } |
2769 |
+ |
2770 |
+ pipe_unlock(pipe); |
2771 |
+diff --git a/fs/vboxsf/super.c b/fs/vboxsf/super.c |
2772 |
+index 8fe03b4a0d2b0..25aade3441922 100644 |
2773 |
+--- a/fs/vboxsf/super.c |
2774 |
++++ b/fs/vboxsf/super.c |
2775 |
+@@ -384,7 +384,7 @@ fail_nomem: |
2776 |
+ |
2777 |
+ static int vboxsf_parse_monolithic(struct fs_context *fc, void *data) |
2778 |
+ { |
2779 |
+- char *options = data; |
2780 |
++ unsigned char *options = data; |
2781 |
+ |
2782 |
+ if (options && options[0] == VBSF_MOUNT_SIGNATURE_BYTE_0 && |
2783 |
+ options[1] == VBSF_MOUNT_SIGNATURE_BYTE_1 && |
2784 |
+diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h |
2785 |
+index 57241417ff2f8..1af8c9ac50a4b 100644 |
2786 |
+--- a/include/linux/blkdev.h |
2787 |
++++ b/include/linux/blkdev.h |
2788 |
+@@ -354,6 +354,8 @@ struct queue_limits { |
2789 |
+ typedef int (*report_zones_cb)(struct blk_zone *zone, unsigned int idx, |
2790 |
+ void *data); |
2791 |
+ |
2792 |
++void blk_queue_set_zoned(struct gendisk *disk, enum blk_zoned_model model); |
2793 |
++ |
2794 |
+ #ifdef CONFIG_BLK_DEV_ZONED |
2795 |
+ |
2796 |
+ #define BLK_ALL_ZONES ((unsigned int)-1) |
2797 |
+diff --git a/include/linux/memstick.h b/include/linux/memstick.h |
2798 |
+index da4c65f9435ff..ebf73d4ee9690 100644 |
2799 |
+--- a/include/linux/memstick.h |
2800 |
++++ b/include/linux/memstick.h |
2801 |
+@@ -281,6 +281,7 @@ struct memstick_host { |
2802 |
+ |
2803 |
+ struct memstick_dev *card; |
2804 |
+ unsigned int retries; |
2805 |
++ bool removing; |
2806 |
+ |
2807 |
+ /* Notify the host that some requests are pending. */ |
2808 |
+ void (*request)(struct memstick_host *host); |
2809 |
+diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h |
2810 |
+index 50afd0d0084ca..5d2705f1d01c3 100644 |
2811 |
+--- a/include/linux/pipe_fs_i.h |
2812 |
++++ b/include/linux/pipe_fs_i.h |
2813 |
+@@ -240,8 +240,9 @@ extern unsigned int pipe_max_size; |
2814 |
+ extern unsigned long pipe_user_pages_hard; |
2815 |
+ extern unsigned long pipe_user_pages_soft; |
2816 |
+ |
2817 |
+-/* Drop the inode semaphore and wait for a pipe event, atomically */ |
2818 |
+-void pipe_wait(struct pipe_inode_info *pipe); |
2819 |
++/* Wait for a pipe to be readable/writable while dropping the pipe lock */ |
2820 |
++void pipe_wait_readable(struct pipe_inode_info *); |
2821 |
++void pipe_wait_writable(struct pipe_inode_info *); |
2822 |
+ |
2823 |
+ struct pipe_inode_info *alloc_pipe_info(void); |
2824 |
+ void free_pipe_info(struct pipe_inode_info *); |
2825 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
2826 |
+index b5cb5be3ca6f6..b3d0d266fb737 100644 |
2827 |
+--- a/kernel/trace/ftrace.c |
2828 |
++++ b/kernel/trace/ftrace.c |
2829 |
+@@ -6877,16 +6877,14 @@ static void ftrace_ops_assist_func(unsigned long ip, unsigned long parent_ip, |
2830 |
+ { |
2831 |
+ int bit; |
2832 |
+ |
2833 |
+- if ((op->flags & FTRACE_OPS_FL_RCU) && !rcu_is_watching()) |
2834 |
+- return; |
2835 |
+- |
2836 |
+ bit = trace_test_and_set_recursion(TRACE_LIST_START, TRACE_LIST_MAX); |
2837 |
+ if (bit < 0) |
2838 |
+ return; |
2839 |
+ |
2840 |
+ preempt_disable_notrace(); |
2841 |
+ |
2842 |
+- op->func(ip, parent_ip, op, regs); |
2843 |
++ if (!(op->flags & FTRACE_OPS_FL_RCU) || rcu_is_watching()) |
2844 |
++ op->func(ip, parent_ip, op, regs); |
2845 |
+ |
2846 |
+ preempt_enable_notrace(); |
2847 |
+ trace_clear_recursion(bit); |
2848 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
2849 |
+index 6fc6da55b94e2..68c0ff4bd02fa 100644 |
2850 |
+--- a/kernel/trace/trace.c |
2851 |
++++ b/kernel/trace/trace.c |
2852 |
+@@ -3507,13 +3507,15 @@ struct trace_entry *trace_find_next_entry(struct trace_iterator *iter, |
2853 |
+ if (iter->ent && iter->ent != iter->temp) { |
2854 |
+ if ((!iter->temp || iter->temp_size < iter->ent_size) && |
2855 |
+ !WARN_ON_ONCE(iter->temp == static_temp_buf)) { |
2856 |
+- kfree(iter->temp); |
2857 |
+- iter->temp = kmalloc(iter->ent_size, GFP_KERNEL); |
2858 |
+- if (!iter->temp) |
2859 |
++ void *temp; |
2860 |
++ temp = kmalloc(iter->ent_size, GFP_KERNEL); |
2861 |
++ if (!temp) |
2862 |
+ return NULL; |
2863 |
++ kfree(iter->temp); |
2864 |
++ iter->temp = temp; |
2865 |
++ iter->temp_size = iter->ent_size; |
2866 |
+ } |
2867 |
+ memcpy(iter->temp, iter->ent, iter->ent_size); |
2868 |
+- iter->temp_size = iter->ent_size; |
2869 |
+ iter->ent = iter->temp; |
2870 |
+ } |
2871 |
+ entry = __find_next_entry(iter, ent_cpu, NULL, ent_ts); |
2872 |
+@@ -3743,14 +3745,14 @@ unsigned long trace_total_entries(struct trace_array *tr) |
2873 |
+ |
2874 |
+ static void print_lat_help_header(struct seq_file *m) |
2875 |
+ { |
2876 |
+- seq_puts(m, "# _------=> CPU# \n" |
2877 |
+- "# / _-----=> irqs-off \n" |
2878 |
+- "# | / _----=> need-resched \n" |
2879 |
+- "# || / _---=> hardirq/softirq \n" |
2880 |
+- "# ||| / _--=> preempt-depth \n" |
2881 |
+- "# |||| / delay \n" |
2882 |
+- "# cmd pid ||||| time | caller \n" |
2883 |
+- "# \\ / ||||| \\ | / \n"); |
2884 |
++ seq_puts(m, "# _------=> CPU# \n" |
2885 |
++ "# / _-----=> irqs-off \n" |
2886 |
++ "# | / _----=> need-resched \n" |
2887 |
++ "# || / _---=> hardirq/softirq \n" |
2888 |
++ "# ||| / _--=> preempt-depth \n" |
2889 |
++ "# |||| / delay \n" |
2890 |
++ "# cmd pid ||||| time | caller \n" |
2891 |
++ "# \\ / ||||| \\ | / \n"); |
2892 |
+ } |
2893 |
+ |
2894 |
+ static void print_event_info(struct array_buffer *buf, struct seq_file *m) |
2895 |
+@@ -3771,26 +3773,26 @@ static void print_func_help_header(struct array_buffer *buf, struct seq_file *m, |
2896 |
+ |
2897 |
+ print_event_info(buf, m); |
2898 |
+ |
2899 |
+- seq_printf(m, "# TASK-PID %s CPU# TIMESTAMP FUNCTION\n", tgid ? "TGID " : ""); |
2900 |
+- seq_printf(m, "# | | %s | | |\n", tgid ? " | " : ""); |
2901 |
++ seq_printf(m, "# TASK-PID %s CPU# TIMESTAMP FUNCTION\n", tgid ? " TGID " : ""); |
2902 |
++ seq_printf(m, "# | | %s | | |\n", tgid ? " | " : ""); |
2903 |
+ } |
2904 |
+ |
2905 |
+ static void print_func_help_header_irq(struct array_buffer *buf, struct seq_file *m, |
2906 |
+ unsigned int flags) |
2907 |
+ { |
2908 |
+ bool tgid = flags & TRACE_ITER_RECORD_TGID; |
2909 |
+- const char *space = " "; |
2910 |
+- int prec = tgid ? 10 : 2; |
2911 |
++ const char *space = " "; |
2912 |
++ int prec = tgid ? 12 : 2; |
2913 |
+ |
2914 |
+ print_event_info(buf, m); |
2915 |
+ |
2916 |
+- seq_printf(m, "# %.*s _-----=> irqs-off\n", prec, space); |
2917 |
+- seq_printf(m, "# %.*s / _----=> need-resched\n", prec, space); |
2918 |
+- seq_printf(m, "# %.*s| / _---=> hardirq/softirq\n", prec, space); |
2919 |
+- seq_printf(m, "# %.*s|| / _--=> preempt-depth\n", prec, space); |
2920 |
+- seq_printf(m, "# %.*s||| / delay\n", prec, space); |
2921 |
+- seq_printf(m, "# TASK-PID %.*sCPU# |||| TIMESTAMP FUNCTION\n", prec, " TGID "); |
2922 |
+- seq_printf(m, "# | | %.*s | |||| | |\n", prec, " | "); |
2923 |
++ seq_printf(m, "# %.*s _-----=> irqs-off\n", prec, space); |
2924 |
++ seq_printf(m, "# %.*s / _----=> need-resched\n", prec, space); |
2925 |
++ seq_printf(m, "# %.*s| / _---=> hardirq/softirq\n", prec, space); |
2926 |
++ seq_printf(m, "# %.*s|| / _--=> preempt-depth\n", prec, space); |
2927 |
++ seq_printf(m, "# %.*s||| / delay\n", prec, space); |
2928 |
++ seq_printf(m, "# TASK-PID %.*s CPU# |||| TIMESTAMP FUNCTION\n", prec, " TGID "); |
2929 |
++ seq_printf(m, "# | | %.*s | |||| | |\n", prec, " | "); |
2930 |
+ } |
2931 |
+ |
2932 |
+ void |
2933 |
+diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c |
2934 |
+index 73976de7f8cc8..a8d719263e1bc 100644 |
2935 |
+--- a/kernel/trace/trace_output.c |
2936 |
++++ b/kernel/trace/trace_output.c |
2937 |
+@@ -497,7 +497,7 @@ lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu) |
2938 |
+ |
2939 |
+ trace_find_cmdline(entry->pid, comm); |
2940 |
+ |
2941 |
+- trace_seq_printf(s, "%8.8s-%-5d %3d", |
2942 |
++ trace_seq_printf(s, "%8.8s-%-7d %3d", |
2943 |
+ comm, entry->pid, cpu); |
2944 |
+ |
2945 |
+ return trace_print_lat_fmt(s, entry); |
2946 |
+@@ -588,15 +588,15 @@ int trace_print_context(struct trace_iterator *iter) |
2947 |
+ |
2948 |
+ trace_find_cmdline(entry->pid, comm); |
2949 |
+ |
2950 |
+- trace_seq_printf(s, "%16s-%-5d ", comm, entry->pid); |
2951 |
++ trace_seq_printf(s, "%16s-%-7d ", comm, entry->pid); |
2952 |
+ |
2953 |
+ if (tr->trace_flags & TRACE_ITER_RECORD_TGID) { |
2954 |
+ unsigned int tgid = trace_find_tgid(entry->pid); |
2955 |
+ |
2956 |
+ if (!tgid) |
2957 |
+- trace_seq_printf(s, "(-----) "); |
2958 |
++ trace_seq_printf(s, "(-------) "); |
2959 |
+ else |
2960 |
+- trace_seq_printf(s, "(%5d) ", tgid); |
2961 |
++ trace_seq_printf(s, "(%7d) ", tgid); |
2962 |
+ } |
2963 |
+ |
2964 |
+ trace_seq_printf(s, "[%03d] ", iter->cpu); |
2965 |
+@@ -636,7 +636,7 @@ int trace_print_lat_context(struct trace_iterator *iter) |
2966 |
+ trace_find_cmdline(entry->pid, comm); |
2967 |
+ |
2968 |
+ trace_seq_printf( |
2969 |
+- s, "%16s %5d %3d %d %08x %08lx ", |
2970 |
++ s, "%16s %7d %3d %d %08x %08lx ", |
2971 |
+ comm, entry->pid, iter->cpu, entry->flags, |
2972 |
+ entry->preempt_count, iter->idx); |
2973 |
+ } else { |
2974 |
+@@ -917,7 +917,7 @@ static enum print_line_t trace_ctxwake_print(struct trace_iterator *iter, |
2975 |
+ S = task_index_to_char(field->prev_state); |
2976 |
+ trace_find_cmdline(field->next_pid, comm); |
2977 |
+ trace_seq_printf(&iter->seq, |
2978 |
+- " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n", |
2979 |
++ " %7d:%3d:%c %s [%03d] %7d:%3d:%c %s\n", |
2980 |
+ field->prev_pid, |
2981 |
+ field->prev_prio, |
2982 |
+ S, delim, |
2983 |
+diff --git a/lib/random32.c b/lib/random32.c |
2984 |
+index 3d749abb9e80d..1786f78bf4c53 100644 |
2985 |
+--- a/lib/random32.c |
2986 |
++++ b/lib/random32.c |
2987 |
+@@ -48,7 +48,7 @@ static inline void prandom_state_selftest(void) |
2988 |
+ } |
2989 |
+ #endif |
2990 |
+ |
2991 |
+-DEFINE_PER_CPU(struct rnd_state, net_rand_state); |
2992 |
++DEFINE_PER_CPU(struct rnd_state, net_rand_state) __latent_entropy; |
2993 |
+ |
2994 |
+ /** |
2995 |
+ * prandom_u32_state - seeded pseudo-random number generator. |
2996 |
+diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
2997 |
+index 5c5af4b5fc080..f2c3ac648fc08 100644 |
2998 |
+--- a/net/mac80211/rx.c |
2999 |
++++ b/net/mac80211/rx.c |
3000 |
+@@ -451,7 +451,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, |
3001 |
+ else if (status->bw == RATE_INFO_BW_5) |
3002 |
+ channel_flags |= IEEE80211_CHAN_QUARTER; |
3003 |
+ |
3004 |
+- if (status->band == NL80211_BAND_5GHZ) |
3005 |
++ if (status->band == NL80211_BAND_5GHZ || |
3006 |
++ status->band == NL80211_BAND_6GHZ) |
3007 |
+ channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ; |
3008 |
+ else if (status->encoding != RX_ENC_LEGACY) |
3009 |
+ channel_flags |= IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ; |
3010 |
+diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c |
3011 |
+index 9c6045f9c24da..d1b64d0751f2e 100644 |
3012 |
+--- a/net/mac80211/vht.c |
3013 |
++++ b/net/mac80211/vht.c |
3014 |
+@@ -168,10 +168,7 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, |
3015 |
+ /* take some capabilities as-is */ |
3016 |
+ cap_info = le32_to_cpu(vht_cap_ie->vht_cap_info); |
3017 |
+ vht_cap->cap = cap_info; |
3018 |
+- vht_cap->cap &= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 | |
3019 |
+- IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 | |
3020 |
+- IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 | |
3021 |
+- IEEE80211_VHT_CAP_RXLDPC | |
3022 |
++ vht_cap->cap &= IEEE80211_VHT_CAP_RXLDPC | |
3023 |
+ IEEE80211_VHT_CAP_VHT_TXOP_PS | |
3024 |
+ IEEE80211_VHT_CAP_HTC_VHT | |
3025 |
+ IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK | |
3026 |
+@@ -180,6 +177,9 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, |
3027 |
+ IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN | |
3028 |
+ IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
3029 |
+ |
3030 |
++ vht_cap->cap |= min_t(u32, cap_info & IEEE80211_VHT_CAP_MAX_MPDU_MASK, |
3031 |
++ own_cap.cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK); |
3032 |
++ |
3033 |
+ /* and some based on our own capabilities */ |
3034 |
+ switch (own_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) { |
3035 |
+ case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ: |
3036 |
+diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile |
3037 |
+index 0b44917f981c7..d4129e0275e4a 100644 |
3038 |
+--- a/scripts/dtc/Makefile |
3039 |
++++ b/scripts/dtc/Makefile |
3040 |
+@@ -10,7 +10,7 @@ dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ |
3041 |
+ dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o |
3042 |
+ |
3043 |
+ # Source files need to get at the userspace version of libfdt_env.h to compile |
3044 |
+-HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt |
3045 |
++HOST_EXTRACFLAGS += -I $(srctree)/$(src)/libfdt |
3046 |
+ |
3047 |
+ ifeq ($(shell pkg-config --exists yaml-0.1 2>/dev/null && echo yes),) |
3048 |
+ ifneq ($(CHECK_DT_BINDING)$(CHECK_DTBS),) |
3049 |
+diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c |
3050 |
+index 6dc3078649fa0..e8b26050f5458 100644 |
3051 |
+--- a/scripts/kallsyms.c |
3052 |
++++ b/scripts/kallsyms.c |
3053 |
+@@ -82,6 +82,7 @@ static char *sym_name(const struct sym_entry *s) |
3054 |
+ |
3055 |
+ static bool is_ignored_symbol(const char *name, char type) |
3056 |
+ { |
3057 |
++ /* Symbol names that exactly match to the following are ignored.*/ |
3058 |
+ static const char * const ignored_symbols[] = { |
3059 |
+ /* |
3060 |
+ * Symbols which vary between passes. Passes 1 and 2 must have |
3061 |
+@@ -104,6 +105,7 @@ static bool is_ignored_symbol(const char *name, char type) |
3062 |
+ NULL |
3063 |
+ }; |
3064 |
+ |
3065 |
++ /* Symbol names that begin with the following are ignored.*/ |
3066 |
+ static const char * const ignored_prefixes[] = { |
3067 |
+ "$", /* local symbols for ARM, MIPS, etc. */ |
3068 |
+ ".LASANPC", /* s390 kasan local symbols */ |
3069 |
+@@ -112,6 +114,7 @@ static bool is_ignored_symbol(const char *name, char type) |
3070 |
+ NULL |
3071 |
+ }; |
3072 |
+ |
3073 |
++ /* Symbol names that end with the following are ignored.*/ |
3074 |
+ static const char * const ignored_suffixes[] = { |
3075 |
+ "_from_arm", /* arm */ |
3076 |
+ "_from_thumb", /* arm */ |
3077 |
+@@ -119,9 +122,15 @@ static bool is_ignored_symbol(const char *name, char type) |
3078 |
+ NULL |
3079 |
+ }; |
3080 |
+ |
3081 |
++ /* Symbol names that contain the following are ignored.*/ |
3082 |
++ static const char * const ignored_matches[] = { |
3083 |
++ ".long_branch.", /* ppc stub */ |
3084 |
++ ".plt_branch.", /* ppc stub */ |
3085 |
++ NULL |
3086 |
++ }; |
3087 |
++ |
3088 |
+ const char * const *p; |
3089 |
+ |
3090 |
+- /* Exclude symbols which vary between passes. */ |
3091 |
+ for (p = ignored_symbols; *p; p++) |
3092 |
+ if (!strcmp(name, *p)) |
3093 |
+ return true; |
3094 |
+@@ -137,6 +146,11 @@ static bool is_ignored_symbol(const char *name, char type) |
3095 |
+ return true; |
3096 |
+ } |
3097 |
+ |
3098 |
++ for (p = ignored_matches; *p; p++) { |
3099 |
++ if (strstr(name, *p)) |
3100 |
++ return true; |
3101 |
++ } |
3102 |
++ |
3103 |
+ if (type == 'U' || type == 'u') |
3104 |
+ return true; |
3105 |
+ /* exclude debugging symbols */ |
3106 |
+diff --git a/tools/io_uring/io_uring-bench.c b/tools/io_uring/io_uring-bench.c |
3107 |
+index 0f257139b003e..7703f01183854 100644 |
3108 |
+--- a/tools/io_uring/io_uring-bench.c |
3109 |
++++ b/tools/io_uring/io_uring-bench.c |
3110 |
+@@ -130,7 +130,7 @@ static int io_uring_register_files(struct submitter *s) |
3111 |
+ s->nr_files); |
3112 |
+ } |
3113 |
+ |
3114 |
+-static int gettid(void) |
3115 |
++static int lk_gettid(void) |
3116 |
+ { |
3117 |
+ return syscall(__NR_gettid); |
3118 |
+ } |
3119 |
+@@ -281,7 +281,7 @@ static void *submitter_fn(void *data) |
3120 |
+ struct io_sq_ring *ring = &s->sq_ring; |
3121 |
+ int ret, prepped; |
3122 |
+ |
3123 |
+- printf("submitter=%d\n", gettid()); |
3124 |
++ printf("submitter=%d\n", lk_gettid()); |
3125 |
+ |
3126 |
+ srand48_r(pthread_self(), &s->rand); |
3127 |
+ |
3128 |
+diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile |
3129 |
+index c820b0be9d637..9ae8f4ef0aac2 100644 |
3130 |
+--- a/tools/lib/bpf/Makefile |
3131 |
++++ b/tools/lib/bpf/Makefile |
3132 |
+@@ -59,7 +59,7 @@ FEATURE_USER = .libbpf |
3133 |
+ FEATURE_TESTS = libelf libelf-mmap zlib bpf reallocarray |
3134 |
+ FEATURE_DISPLAY = libelf zlib bpf |
3135 |
+ |
3136 |
+-INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi |
3137 |
++INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi |
3138 |
+ FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES) |
3139 |
+ |
3140 |
+ check_feat := 1 |