Annotation of /trunk/kernel-alx/patches-5.4/0247-5.4.148-all-fixes.patch
Parent Directory | Revision Log
Revision 3637 -
(hide annotations)
(download)
Mon Oct 24 12:40:44 2022 UTC (19 months, 3 weeks ago) by niro
File size: 289406 byte(s)
Mon Oct 24 12:40:44 2022 UTC (19 months, 3 weeks ago) by niro
File size: 289406 byte(s)
-add missing
1 | niro | 3637 | diff --git a/Documentation/admin-guide/devices.txt b/Documentation/admin-guide/devices.txt |
2 | index 1c5d2281efc97..771d9e7ae082b 100644 | ||
3 | --- a/Documentation/admin-guide/devices.txt | ||
4 | +++ b/Documentation/admin-guide/devices.txt | ||
5 | @@ -3002,10 +3002,10 @@ | ||
6 | 65 = /dev/infiniband/issm1 Second InfiniBand IsSM device | ||
7 | ... | ||
8 | 127 = /dev/infiniband/issm63 63rd InfiniBand IsSM device | ||
9 | - 128 = /dev/infiniband/uverbs0 First InfiniBand verbs device | ||
10 | - 129 = /dev/infiniband/uverbs1 Second InfiniBand verbs device | ||
11 | + 192 = /dev/infiniband/uverbs0 First InfiniBand verbs device | ||
12 | + 193 = /dev/infiniband/uverbs1 Second InfiniBand verbs device | ||
13 | ... | ||
14 | - 159 = /dev/infiniband/uverbs31 31st InfiniBand verbs device | ||
15 | + 223 = /dev/infiniband/uverbs31 31st InfiniBand verbs device | ||
16 | |||
17 | 232 char Biometric Devices | ||
18 | 0 = /dev/biometric/sensor0/fingerprint first fingerprint sensor on first device | ||
19 | diff --git a/Documentation/devicetree/bindings/arm/tegra.yaml b/Documentation/devicetree/bindings/arm/tegra.yaml | ||
20 | index 60b38eb5c61ab..56e1945911f1e 100644 | ||
21 | --- a/Documentation/devicetree/bindings/arm/tegra.yaml | ||
22 | +++ b/Documentation/devicetree/bindings/arm/tegra.yaml | ||
23 | @@ -49,7 +49,7 @@ properties: | ||
24 | - const: toradex,apalis_t30 | ||
25 | - const: nvidia,tegra30 | ||
26 | - items: | ||
27 | - - const: toradex,apalis_t30-eval-v1.1 | ||
28 | + - const: toradex,apalis_t30-v1.1-eval | ||
29 | - const: toradex,apalis_t30-eval | ||
30 | - const: toradex,apalis_t30-v1.1 | ||
31 | - const: toradex,apalis_t30 | ||
32 | diff --git a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt | ||
33 | index 44919d48d2415..c459f169a9044 100644 | ||
34 | --- a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt | ||
35 | +++ b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt | ||
36 | @@ -122,7 +122,7 @@ on various other factors also like; | ||
37 | so the device should have enough free bytes available its OOB/Spare | ||
38 | area to accommodate ECC for entire page. In general following expression | ||
39 | helps in determining if given device can accommodate ECC syndrome: | ||
40 | - "2 + (PAGESIZE / 512) * ECC_BYTES" >= OOBSIZE" | ||
41 | + "2 + (PAGESIZE / 512) * ECC_BYTES" <= OOBSIZE" | ||
42 | where | ||
43 | OOBSIZE number of bytes in OOB/spare area | ||
44 | PAGESIZE number of bytes in main-area of device page | ||
45 | diff --git a/Makefile b/Makefile | ||
46 | index 98227dae34947..b84706c6d6248 100644 | ||
47 | --- a/Makefile | ||
48 | +++ b/Makefile | ||
49 | @@ -1,7 +1,7 @@ | ||
50 | # SPDX-License-Identifier: GPL-2.0 | ||
51 | VERSION = 5 | ||
52 | PATCHLEVEL = 4 | ||
53 | -SUBLEVEL = 147 | ||
54 | +SUBLEVEL = 148 | ||
55 | EXTRAVERSION = | ||
56 | NAME = Kleptomaniac Octopus | ||
57 | |||
58 | diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c | ||
59 | index a2fbea3ee07c7..102418ac5ff4a 100644 | ||
60 | --- a/arch/arc/mm/cache.c | ||
61 | +++ b/arch/arc/mm/cache.c | ||
62 | @@ -1123,7 +1123,7 @@ void clear_user_page(void *to, unsigned long u_vaddr, struct page *page) | ||
63 | clear_page(to); | ||
64 | clear_bit(PG_dc_clean, &page->flags); | ||
65 | } | ||
66 | - | ||
67 | +EXPORT_SYMBOL(clear_user_page); | ||
68 | |||
69 | /********************************************************************** | ||
70 | * Explicit Cache flush request from user space via syscall | ||
71 | diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile | ||
72 | index f0b3a9281d69b..fb6cb24bde5c9 100644 | ||
73 | --- a/arch/arm/boot/compressed/Makefile | ||
74 | +++ b/arch/arm/boot/compressed/Makefile | ||
75 | @@ -90,6 +90,8 @@ $(addprefix $(obj)/,$(libfdt_objs) atags_to_fdt.o): \ | ||
76 | $(addprefix $(obj)/,$(libfdt_hdrs)) | ||
77 | |||
78 | ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y) | ||
79 | +CFLAGS_REMOVE_atags_to_fdt.o += -Wframe-larger-than=${CONFIG_FRAME_WARN} | ||
80 | +CFLAGS_atags_to_fdt.o += -Wframe-larger-than=1280 | ||
81 | OBJS += $(libfdt_objs) atags_to_fdt.o | ||
82 | endif | ||
83 | |||
84 | diff --git a/arch/arm/boot/dts/imx53-ppd.dts b/arch/arm/boot/dts/imx53-ppd.dts | ||
85 | index 5ff9a179c83c3..c80d1700e0949 100644 | ||
86 | --- a/arch/arm/boot/dts/imx53-ppd.dts | ||
87 | +++ b/arch/arm/boot/dts/imx53-ppd.dts | ||
88 | @@ -70,6 +70,12 @@ | ||
89 | clock-frequency = <11289600>; | ||
90 | }; | ||
91 | |||
92 | + achc_24M: achc-clock { | ||
93 | + compatible = "fixed-clock"; | ||
94 | + #clock-cells = <0>; | ||
95 | + clock-frequency = <24000000>; | ||
96 | + }; | ||
97 | + | ||
98 | sgtlsound: sound { | ||
99 | compatible = "fsl,imx53-cpuvo-sgtl5000", | ||
100 | "fsl,imx-audio-sgtl5000"; | ||
101 | @@ -287,16 +293,13 @@ | ||
102 | &gpio4 12 GPIO_ACTIVE_LOW>; | ||
103 | status = "okay"; | ||
104 | |||
105 | - spidev0: spi@0 { | ||
106 | - compatible = "ge,achc"; | ||
107 | - reg = <0>; | ||
108 | - spi-max-frequency = <1000000>; | ||
109 | - }; | ||
110 | - | ||
111 | - spidev1: spi@1 { | ||
112 | - compatible = "ge,achc"; | ||
113 | - reg = <1>; | ||
114 | - spi-max-frequency = <1000000>; | ||
115 | + spidev0: spi@1 { | ||
116 | + compatible = "ge,achc", "nxp,kinetis-k20"; | ||
117 | + reg = <1>, <0>; | ||
118 | + vdd-supply = <®_3v3>; | ||
119 | + vdda-supply = <®_3v3>; | ||
120 | + clocks = <&achc_24M>; | ||
121 | + reset-gpios = <&gpio3 6 GPIO_ACTIVE_LOW>; | ||
122 | }; | ||
123 | |||
124 | gpioxra0: gpio@2 { | ||
125 | diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi | ||
126 | index 8b79b4112ee1a..2b075e287610f 100644 | ||
127 | --- a/arch/arm/boot/dts/qcom-apq8064.dtsi | ||
128 | +++ b/arch/arm/boot/dts/qcom-apq8064.dtsi | ||
129 | @@ -1261,9 +1261,9 @@ | ||
130 | <&mmcc DSI1_BYTE_CLK>, | ||
131 | <&mmcc DSI_PIXEL_CLK>, | ||
132 | <&mmcc DSI1_ESC_CLK>; | ||
133 | - clock-names = "iface_clk", "bus_clk", "core_mmss_clk", | ||
134 | - "src_clk", "byte_clk", "pixel_clk", | ||
135 | - "core_clk"; | ||
136 | + clock-names = "iface", "bus", "core_mmss", | ||
137 | + "src", "byte", "pixel", | ||
138 | + "core"; | ||
139 | |||
140 | assigned-clocks = <&mmcc DSI1_BYTE_SRC>, | ||
141 | <&mmcc DSI1_ESC_SRC>, | ||
142 | diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi | ||
143 | index 20137fc578b1b..394a6b4dc69d5 100644 | ||
144 | --- a/arch/arm/boot/dts/tegra20-tamonten.dtsi | ||
145 | +++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi | ||
146 | @@ -185,8 +185,9 @@ | ||
147 | nvidia,pins = "ata", "atb", "atc", "atd", "ate", | ||
148 | "cdev1", "cdev2", "dap1", "dtb", "gma", | ||
149 | "gmb", "gmc", "gmd", "gme", "gpu7", | ||
150 | - "gpv", "i2cp", "pta", "rm", "slxa", | ||
151 | - "slxk", "spia", "spib", "uac"; | ||
152 | + "gpv", "i2cp", "irrx", "irtx", "pta", | ||
153 | + "rm", "slxa", "slxk", "spia", "spib", | ||
154 | + "uac"; | ||
155 | nvidia,pull = <TEGRA_PIN_PULL_NONE>; | ||
156 | nvidia,tristate = <TEGRA_PIN_DISABLE>; | ||
157 | }; | ||
158 | @@ -211,7 +212,7 @@ | ||
159 | conf_ddc { | ||
160 | nvidia,pins = "ddc", "dta", "dtd", "kbca", | ||
161 | "kbcb", "kbcc", "kbcd", "kbce", "kbcf", | ||
162 | - "sdc"; | ||
163 | + "sdc", "uad", "uca"; | ||
164 | nvidia,pull = <TEGRA_PIN_PULL_UP>; | ||
165 | nvidia,tristate = <TEGRA_PIN_DISABLE>; | ||
166 | }; | ||
167 | @@ -221,10 +222,9 @@ | ||
168 | "lvp0", "owc", "sdb"; | ||
169 | nvidia,tristate = <TEGRA_PIN_ENABLE>; | ||
170 | }; | ||
171 | - conf_irrx { | ||
172 | - nvidia,pins = "irrx", "irtx", "sdd", "spic", | ||
173 | - "spie", "spih", "uaa", "uab", "uad", | ||
174 | - "uca", "ucb"; | ||
175 | + conf_sdd { | ||
176 | + nvidia,pins = "sdd", "spic", "spie", "spih", | ||
177 | + "uaa", "uab", "ucb"; | ||
178 | nvidia,pull = <TEGRA_PIN_PULL_UP>; | ||
179 | nvidia,tristate = <TEGRA_PIN_ENABLE>; | ||
180 | }; | ||
181 | diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-frwy.dts b/arch/arm64/boot/dts/freescale/fsl-ls1046a-frwy.dts | ||
182 | index 3595be0f25277..2d6c73d7d397c 100644 | ||
183 | --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-frwy.dts | ||
184 | +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-frwy.dts | ||
185 | @@ -83,15 +83,9 @@ | ||
186 | }; | ||
187 | |||
188 | eeprom@52 { | ||
189 | - compatible = "atmel,24c512"; | ||
190 | + compatible = "onnn,cat24c04", "atmel,24c04"; | ||
191 | reg = <0x52>; | ||
192 | }; | ||
193 | - | ||
194 | - eeprom@53 { | ||
195 | - compatible = "atmel,24c512"; | ||
196 | - reg = <0x53>; | ||
197 | - }; | ||
198 | - | ||
199 | }; | ||
200 | }; | ||
201 | }; | ||
202 | diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts | ||
203 | index 2743397591141..8858c1e92f23c 100644 | ||
204 | --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts | ||
205 | +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts | ||
206 | @@ -58,14 +58,9 @@ | ||
207 | }; | ||
208 | |||
209 | eeprom@52 { | ||
210 | - compatible = "atmel,24c512"; | ||
211 | + compatible = "onnn,cat24c05", "atmel,24c04"; | ||
212 | reg = <0x52>; | ||
213 | }; | ||
214 | - | ||
215 | - eeprom@53 { | ||
216 | - compatible = "atmel,24c512"; | ||
217 | - reg = <0x53>; | ||
218 | - }; | ||
219 | }; | ||
220 | |||
221 | &i2c3 { | ||
222 | diff --git a/arch/arm64/boot/dts/nvidia/tegra132.dtsi b/arch/arm64/boot/dts/nvidia/tegra132.dtsi | ||
223 | index 631a7f77c3869..0b3eb8c0b8df0 100644 | ||
224 | --- a/arch/arm64/boot/dts/nvidia/tegra132.dtsi | ||
225 | +++ b/arch/arm64/boot/dts/nvidia/tegra132.dtsi | ||
226 | @@ -1082,13 +1082,13 @@ | ||
227 | |||
228 | cpu@0 { | ||
229 | device_type = "cpu"; | ||
230 | - compatible = "nvidia,denver"; | ||
231 | + compatible = "nvidia,tegra132-denver"; | ||
232 | reg = <0>; | ||
233 | }; | ||
234 | |||
235 | cpu@1 { | ||
236 | device_type = "cpu"; | ||
237 | - compatible = "nvidia,denver"; | ||
238 | + compatible = "nvidia,tegra132-denver"; | ||
239 | reg = <1>; | ||
240 | }; | ||
241 | }; | ||
242 | diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi | ||
243 | index 0821754f0fd6d..90adff8aa9baf 100644 | ||
244 | --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi | ||
245 | +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi | ||
246 | @@ -1434,7 +1434,7 @@ | ||
247 | }; | ||
248 | |||
249 | pcie_ep@14160000 { | ||
250 | - compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep"; | ||
251 | + compatible = "nvidia,tegra194-pcie-ep"; | ||
252 | power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX4A>; | ||
253 | reg = <0x00 0x14160000 0x0 0x00020000 /* appl registers (128K) */ | ||
254 | 0x00 0x36040000 0x0 0x00040000 /* iATU_DMA reg space (256K) */ | ||
255 | @@ -1466,7 +1466,7 @@ | ||
256 | }; | ||
257 | |||
258 | pcie_ep@14180000 { | ||
259 | - compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep"; | ||
260 | + compatible = "nvidia,tegra194-pcie-ep"; | ||
261 | power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8B>; | ||
262 | reg = <0x00 0x14180000 0x0 0x00020000 /* appl registers (128K) */ | ||
263 | 0x00 0x38040000 0x0 0x00040000 /* iATU_DMA reg space (256K) */ | ||
264 | @@ -1498,7 +1498,7 @@ | ||
265 | }; | ||
266 | |||
267 | pcie_ep@141a0000 { | ||
268 | - compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep"; | ||
269 | + compatible = "nvidia,tegra194-pcie-ep"; | ||
270 | power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8A>; | ||
271 | reg = <0x00 0x141a0000 0x0 0x00020000 /* appl registers (128K) */ | ||
272 | 0x00 0x3a040000 0x0 0x00040000 /* iATU_DMA reg space (256K) */ | ||
273 | diff --git a/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts b/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts | ||
274 | index 70be3f95209bc..830d9f2c1e5f2 100644 | ||
275 | --- a/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts | ||
276 | +++ b/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts | ||
277 | @@ -20,7 +20,7 @@ | ||
278 | stdout-path = "serial0"; | ||
279 | }; | ||
280 | |||
281 | - memory { | ||
282 | + memory@40000000 { | ||
283 | device_type = "memory"; | ||
284 | reg = <0x0 0x40000000 0x0 0x20000000>; | ||
285 | }; | ||
286 | diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h | ||
287 | index 817efd95d539f..9679b74a20817 100644 | ||
288 | --- a/arch/arm64/include/asm/kernel-pgtable.h | ||
289 | +++ b/arch/arm64/include/asm/kernel-pgtable.h | ||
290 | @@ -65,8 +65,8 @@ | ||
291 | #define EARLY_KASLR (0) | ||
292 | #endif | ||
293 | |||
294 | -#define EARLY_ENTRIES(vstart, vend, shift) (((vend) >> (shift)) \ | ||
295 | - - ((vstart) >> (shift)) + 1 + EARLY_KASLR) | ||
296 | +#define EARLY_ENTRIES(vstart, vend, shift) \ | ||
297 | + ((((vend) - 1) >> (shift)) - ((vstart) >> (shift)) + 1 + EARLY_KASLR) | ||
298 | |||
299 | #define EARLY_PGDS(vstart, vend) (EARLY_ENTRIES(vstart, vend, PGDIR_SHIFT)) | ||
300 | |||
301 | diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c | ||
302 | index 04b982a2799eb..e62c9cbf99f46 100644 | ||
303 | --- a/arch/arm64/kernel/fpsimd.c | ||
304 | +++ b/arch/arm64/kernel/fpsimd.c | ||
305 | @@ -498,7 +498,7 @@ size_t sve_state_size(struct task_struct const *task) | ||
306 | void sve_alloc(struct task_struct *task) | ||
307 | { | ||
308 | if (task->thread.sve_state) { | ||
309 | - memset(task->thread.sve_state, 0, sve_state_size(current)); | ||
310 | + memset(task->thread.sve_state, 0, sve_state_size(task)); | ||
311 | return; | ||
312 | } | ||
313 | |||
314 | diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S | ||
315 | index a2e0b37549433..2f784d3b4b390 100644 | ||
316 | --- a/arch/arm64/kernel/head.S | ||
317 | +++ b/arch/arm64/kernel/head.S | ||
318 | @@ -194,7 +194,7 @@ ENDPROC(preserve_boot_args) | ||
319 | * to be composed of multiple pages. (This effectively scales the end index). | ||
320 | * | ||
321 | * vstart: virtual address of start of range | ||
322 | - * vend: virtual address of end of range | ||
323 | + * vend: virtual address of end of range - we map [vstart, vend] | ||
324 | * shift: shift used to transform virtual address into index | ||
325 | * ptrs: number of entries in page table | ||
326 | * istart: index in table corresponding to vstart | ||
327 | @@ -231,17 +231,18 @@ ENDPROC(preserve_boot_args) | ||
328 | * | ||
329 | * tbl: location of page table | ||
330 | * rtbl: address to be used for first level page table entry (typically tbl + PAGE_SIZE) | ||
331 | - * vstart: start address to map | ||
332 | - * vend: end address to map - we map [vstart, vend] | ||
333 | + * vstart: virtual address of start of range | ||
334 | + * vend: virtual address of end of range - we map [vstart, vend - 1] | ||
335 | * flags: flags to use to map last level entries | ||
336 | * phys: physical address corresponding to vstart - physical memory is contiguous | ||
337 | * pgds: the number of pgd entries | ||
338 | * | ||
339 | * Temporaries: istart, iend, tmp, count, sv - these need to be different registers | ||
340 | - * Preserves: vstart, vend, flags | ||
341 | - * Corrupts: tbl, rtbl, istart, iend, tmp, count, sv | ||
342 | + * Preserves: vstart, flags | ||
343 | + * Corrupts: tbl, rtbl, vend, istart, iend, tmp, count, sv | ||
344 | */ | ||
345 | .macro map_memory, tbl, rtbl, vstart, vend, flags, phys, pgds, istart, iend, tmp, count, sv | ||
346 | + sub \vend, \vend, #1 | ||
347 | add \rtbl, \tbl, #PAGE_SIZE | ||
348 | mov \sv, \rtbl | ||
349 | mov \count, #0 | ||
350 | diff --git a/arch/m68k/Kconfig.bus b/arch/m68k/Kconfig.bus | ||
351 | index 9d0a3a23d50e5..355c51309ed85 100644 | ||
352 | --- a/arch/m68k/Kconfig.bus | ||
353 | +++ b/arch/m68k/Kconfig.bus | ||
354 | @@ -63,7 +63,7 @@ source "drivers/zorro/Kconfig" | ||
355 | |||
356 | endif | ||
357 | |||
358 | -if !MMU | ||
359 | +if COLDFIRE | ||
360 | |||
361 | config ISA_DMA_API | ||
362 | def_bool !M5272 | ||
363 | diff --git a/arch/mips/mti-malta/malta-dtshim.c b/arch/mips/mti-malta/malta-dtshim.c | ||
364 | index 98a063093b69a..0be28adff5572 100644 | ||
365 | --- a/arch/mips/mti-malta/malta-dtshim.c | ||
366 | +++ b/arch/mips/mti-malta/malta-dtshim.c | ||
367 | @@ -22,7 +22,7 @@ | ||
368 | #define ROCIT_CONFIG_GEN1_MEMMAP_SHIFT 8 | ||
369 | #define ROCIT_CONFIG_GEN1_MEMMAP_MASK (0xf << 8) | ||
370 | |||
371 | -static unsigned char fdt_buf[16 << 10] __initdata; | ||
372 | +static unsigned char fdt_buf[16 << 10] __initdata __aligned(8); | ||
373 | |||
374 | /* determined physical memory size, not overridden by command line args */ | ||
375 | extern unsigned long physical_memsize; | ||
376 | diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S | ||
377 | index c6481cfc5220f..6b27cf4a0d786 100644 | ||
378 | --- a/arch/openrisc/kernel/entry.S | ||
379 | +++ b/arch/openrisc/kernel/entry.S | ||
380 | @@ -547,6 +547,7 @@ EXCEPTION_ENTRY(_external_irq_handler) | ||
381 | l.bnf 1f // ext irq enabled, all ok. | ||
382 | l.nop | ||
383 | |||
384 | +#ifdef CONFIG_PRINTK | ||
385 | l.addi r1,r1,-0x8 | ||
386 | l.movhi r3,hi(42f) | ||
387 | l.ori r3,r3,lo(42f) | ||
388 | @@ -560,6 +561,7 @@ EXCEPTION_ENTRY(_external_irq_handler) | ||
389 | .string "\n\rESR interrupt bug: in _external_irq_handler (ESR %x)\n\r" | ||
390 | .align 4 | ||
391 | .previous | ||
392 | +#endif | ||
393 | |||
394 | l.ori r4,r4,SPR_SR_IEE // fix the bug | ||
395 | // l.sw PT_SR(r1),r4 | ||
396 | diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c | ||
397 | index 02895a8f2c551..92223f9ff05c7 100644 | ||
398 | --- a/arch/parisc/kernel/signal.c | ||
399 | +++ b/arch/parisc/kernel/signal.c | ||
400 | @@ -238,6 +238,12 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs, | ||
401 | #endif | ||
402 | |||
403 | usp = (regs->gr[30] & ~(0x01UL)); | ||
404 | +#ifdef CONFIG_64BIT | ||
405 | + if (is_compat_task()) { | ||
406 | + /* The gcc alloca implementation leaves garbage in the upper 32 bits of sp */ | ||
407 | + usp = (compat_uint_t)usp; | ||
408 | + } | ||
409 | +#endif | ||
410 | /*FIXME: frame_size parameter is unused, remove it. */ | ||
411 | frame = get_sigframe(&ksig->ka, usp, sizeof(*frame)); | ||
412 | |||
413 | diff --git a/arch/powerpc/configs/mpc885_ads_defconfig b/arch/powerpc/configs/mpc885_ads_defconfig | ||
414 | index 285d506c5a769..2f5e06309f096 100644 | ||
415 | --- a/arch/powerpc/configs/mpc885_ads_defconfig | ||
416 | +++ b/arch/powerpc/configs/mpc885_ads_defconfig | ||
417 | @@ -39,6 +39,7 @@ CONFIG_MTD_CFI_GEOMETRY=y | ||
418 | # CONFIG_MTD_CFI_I2 is not set | ||
419 | CONFIG_MTD_CFI_I4=y | ||
420 | CONFIG_MTD_CFI_AMDSTD=y | ||
421 | +CONFIG_MTD_PHYSMAP=y | ||
422 | CONFIG_MTD_PHYSMAP_OF=y | ||
423 | # CONFIG_BLK_DEV is not set | ||
424 | CONFIG_NETDEVICES=y | ||
425 | diff --git a/arch/powerpc/include/asm/pmc.h b/arch/powerpc/include/asm/pmc.h | ||
426 | index c6bbe9778d3cd..3c09109e708ef 100644 | ||
427 | --- a/arch/powerpc/include/asm/pmc.h | ||
428 | +++ b/arch/powerpc/include/asm/pmc.h | ||
429 | @@ -34,6 +34,13 @@ static inline void ppc_set_pmu_inuse(int inuse) | ||
430 | #endif | ||
431 | } | ||
432 | |||
433 | +#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE | ||
434 | +static inline int ppc_get_pmu_inuse(void) | ||
435 | +{ | ||
436 | + return get_paca()->pmcregs_in_use; | ||
437 | +} | ||
438 | +#endif | ||
439 | + | ||
440 | extern void power4_enable_pmcs(void); | ||
441 | |||
442 | #else /* CONFIG_PPC64 */ | ||
443 | diff --git a/arch/powerpc/kernel/stacktrace.c b/arch/powerpc/kernel/stacktrace.c | ||
444 | index b13c6213b0d9b..890f95151fb44 100644 | ||
445 | --- a/arch/powerpc/kernel/stacktrace.c | ||
446 | +++ b/arch/powerpc/kernel/stacktrace.c | ||
447 | @@ -8,6 +8,7 @@ | ||
448 | * Copyright 2018 Nick Piggin, Michael Ellerman, IBM Corp. | ||
449 | */ | ||
450 | |||
451 | +#include <linux/delay.h> | ||
452 | #include <linux/export.h> | ||
453 | #include <linux/kallsyms.h> | ||
454 | #include <linux/module.h> | ||
455 | diff --git a/arch/powerpc/kvm/book3s_64_vio_hv.c b/arch/powerpc/kvm/book3s_64_vio_hv.c | ||
456 | index ab6eeb8e753e5..35fd67b4ceb41 100644 | ||
457 | --- a/arch/powerpc/kvm/book3s_64_vio_hv.c | ||
458 | +++ b/arch/powerpc/kvm/book3s_64_vio_hv.c | ||
459 | @@ -177,10 +177,13 @@ static void kvmppc_rm_tce_put(struct kvmppc_spapr_tce_table *stt, | ||
460 | idx -= stt->offset; | ||
461 | page = stt->pages[idx / TCES_PER_PAGE]; | ||
462 | /* | ||
463 | - * page must not be NULL in real mode, | ||
464 | - * kvmppc_rm_ioba_validate() must have taken care of this. | ||
465 | + * kvmppc_rm_ioba_validate() allows pages not be allocated if TCE is | ||
466 | + * being cleared, otherwise it returns H_TOO_HARD and we skip this. | ||
467 | */ | ||
468 | - WARN_ON_ONCE_RM(!page); | ||
469 | + if (!page) { | ||
470 | + WARN_ON_ONCE_RM(tce != 0); | ||
471 | + return; | ||
472 | + } | ||
473 | tbl = kvmppc_page_address(page); | ||
474 | |||
475 | tbl[idx % TCES_PER_PAGE] = tce; | ||
476 | diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c | ||
477 | index bba358f134718..6c99ccc3bfcb0 100644 | ||
478 | --- a/arch/powerpc/kvm/book3s_hv.c | ||
479 | +++ b/arch/powerpc/kvm/book3s_hv.c | ||
480 | @@ -58,6 +58,7 @@ | ||
481 | #include <asm/kvm_book3s.h> | ||
482 | #include <asm/mmu_context.h> | ||
483 | #include <asm/lppaca.h> | ||
484 | +#include <asm/pmc.h> | ||
485 | #include <asm/processor.h> | ||
486 | #include <asm/cputhreads.h> | ||
487 | #include <asm/page.h> | ||
488 | @@ -3559,6 +3560,18 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit, | ||
489 | cpu_has_feature(CPU_FTR_P9_TM_HV_ASSIST)) | ||
490 | kvmppc_restore_tm_hv(vcpu, vcpu->arch.shregs.msr, true); | ||
491 | |||
492 | +#ifdef CONFIG_PPC_PSERIES | ||
493 | + if (kvmhv_on_pseries()) { | ||
494 | + barrier(); | ||
495 | + if (vcpu->arch.vpa.pinned_addr) { | ||
496 | + struct lppaca *lp = vcpu->arch.vpa.pinned_addr; | ||
497 | + get_lppaca()->pmcregs_in_use = lp->pmcregs_in_use; | ||
498 | + } else { | ||
499 | + get_lppaca()->pmcregs_in_use = 1; | ||
500 | + } | ||
501 | + barrier(); | ||
502 | + } | ||
503 | +#endif | ||
504 | kvmhv_load_guest_pmu(vcpu); | ||
505 | |||
506 | msr_check_and_set(MSR_FP | MSR_VEC | MSR_VSX); | ||
507 | @@ -3693,6 +3706,13 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit, | ||
508 | save_pmu |= nesting_enabled(vcpu->kvm); | ||
509 | |||
510 | kvmhv_save_guest_pmu(vcpu, save_pmu); | ||
511 | +#ifdef CONFIG_PPC_PSERIES | ||
512 | + if (kvmhv_on_pseries()) { | ||
513 | + barrier(); | ||
514 | + get_lppaca()->pmcregs_in_use = ppc_get_pmu_inuse(); | ||
515 | + barrier(); | ||
516 | + } | ||
517 | +#endif | ||
518 | |||
519 | vc->entry_exit_map = 0x101; | ||
520 | vc->in_guest = 0; | ||
521 | diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | ||
522 | index c6fbbd29bd871..feaf6ca2e76c1 100644 | ||
523 | --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S | ||
524 | +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | ||
525 | @@ -3137,7 +3137,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_P9_TM_HV_ASSIST) | ||
526 | /* The following code handles the fake_suspend = 1 case */ | ||
527 | mflr r0 | ||
528 | std r0, PPC_LR_STKOFF(r1) | ||
529 | - stdu r1, -PPC_MIN_STKFRM(r1) | ||
530 | + stdu r1, -TM_FRAME_SIZE(r1) | ||
531 | |||
532 | /* Turn on TM. */ | ||
533 | mfmsr r8 | ||
534 | @@ -3152,10 +3152,42 @@ BEGIN_FTR_SECTION | ||
535 | END_FTR_SECTION_IFSET(CPU_FTR_P9_TM_XER_SO_BUG) | ||
536 | nop | ||
537 | |||
538 | + /* | ||
539 | + * It's possible that treclaim. may modify registers, if we have lost | ||
540 | + * track of fake-suspend state in the guest due to it using rfscv. | ||
541 | + * Save and restore registers in case this occurs. | ||
542 | + */ | ||
543 | + mfspr r3, SPRN_DSCR | ||
544 | + mfspr r4, SPRN_XER | ||
545 | + mfspr r5, SPRN_AMR | ||
546 | + /* SPRN_TAR would need to be saved here if the kernel ever used it */ | ||
547 | + mfcr r12 | ||
548 | + SAVE_NVGPRS(r1) | ||
549 | + SAVE_GPR(2, r1) | ||
550 | + SAVE_GPR(3, r1) | ||
551 | + SAVE_GPR(4, r1) | ||
552 | + SAVE_GPR(5, r1) | ||
553 | + stw r12, 8(r1) | ||
554 | + std r1, HSTATE_HOST_R1(r13) | ||
555 | + | ||
556 | /* We have to treclaim here because that's the only way to do S->N */ | ||
557 | li r3, TM_CAUSE_KVM_RESCHED | ||
558 | TRECLAIM(R3) | ||
559 | |||
560 | + GET_PACA(r13) | ||
561 | + ld r1, HSTATE_HOST_R1(r13) | ||
562 | + REST_GPR(2, r1) | ||
563 | + REST_GPR(3, r1) | ||
564 | + REST_GPR(4, r1) | ||
565 | + REST_GPR(5, r1) | ||
566 | + lwz r12, 8(r1) | ||
567 | + REST_NVGPRS(r1) | ||
568 | + mtspr SPRN_DSCR, r3 | ||
569 | + mtspr SPRN_XER, r4 | ||
570 | + mtspr SPRN_AMR, r5 | ||
571 | + mtcr r12 | ||
572 | + HMT_MEDIUM | ||
573 | + | ||
574 | /* | ||
575 | * We were in fake suspend, so we are not going to save the | ||
576 | * register state as the guest checkpointed state (since | ||
577 | @@ -3183,7 +3215,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_P9_TM_XER_SO_BUG) | ||
578 | std r5, VCPU_TFHAR(r9) | ||
579 | std r6, VCPU_TFIAR(r9) | ||
580 | |||
581 | - addi r1, r1, PPC_MIN_STKFRM | ||
582 | + addi r1, r1, TM_FRAME_SIZE | ||
583 | ld r0, PPC_LR_STKOFF(r1) | ||
584 | mtlr r0 | ||
585 | blr | ||
586 | diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c | ||
587 | index 6884d16ec19b9..732cfc53e260d 100644 | ||
588 | --- a/arch/powerpc/perf/hv-gpci.c | ||
589 | +++ b/arch/powerpc/perf/hv-gpci.c | ||
590 | @@ -164,7 +164,7 @@ static unsigned long single_gpci_request(u32 req, u32 starting_index, | ||
591 | */ | ||
592 | count = 0; | ||
593 | for (i = offset; i < offset + length; i++) | ||
594 | - count |= arg->bytes[i] << (i - offset); | ||
595 | + count |= (u64)(arg->bytes[i]) << ((length - 1 - (i - offset)) * 8); | ||
596 | |||
597 | *value = count; | ||
598 | out: | ||
599 | diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h | ||
600 | index 1932088686a68..e6a5007f017d8 100644 | ||
601 | --- a/arch/s390/include/asm/setup.h | ||
602 | +++ b/arch/s390/include/asm/setup.h | ||
603 | @@ -39,6 +39,7 @@ | ||
604 | #define MACHINE_FLAG_NX BIT(15) | ||
605 | #define MACHINE_FLAG_GS BIT(16) | ||
606 | #define MACHINE_FLAG_SCC BIT(17) | ||
607 | +#define MACHINE_FLAG_PCI_MIO BIT(18) | ||
608 | |||
609 | #define LPP_MAGIC BIT(31) | ||
610 | #define LPP_PID_MASK _AC(0xffffffff, UL) | ||
611 | @@ -106,6 +107,7 @@ extern unsigned long __swsusp_reset_dma; | ||
612 | #define MACHINE_HAS_NX (S390_lowcore.machine_flags & MACHINE_FLAG_NX) | ||
613 | #define MACHINE_HAS_GS (S390_lowcore.machine_flags & MACHINE_FLAG_GS) | ||
614 | #define MACHINE_HAS_SCC (S390_lowcore.machine_flags & MACHINE_FLAG_SCC) | ||
615 | +#define MACHINE_HAS_PCI_MIO (S390_lowcore.machine_flags & MACHINE_FLAG_PCI_MIO) | ||
616 | |||
617 | /* | ||
618 | * Console mode. Override with conmode= | ||
619 | diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c | ||
620 | index 2531776cf6cf9..eb89cb0aa60b4 100644 | ||
621 | --- a/arch/s390/kernel/early.c | ||
622 | +++ b/arch/s390/kernel/early.c | ||
623 | @@ -252,6 +252,10 @@ static __init void detect_machine_facilities(void) | ||
624 | clock_comparator_max = -1ULL >> 1; | ||
625 | __ctl_set_bit(0, 53); | ||
626 | } | ||
627 | + if (IS_ENABLED(CONFIG_PCI) && test_facility(153)) { | ||
628 | + S390_lowcore.machine_flags |= MACHINE_FLAG_PCI_MIO; | ||
629 | + /* the control bit is set during PCI initialization */ | ||
630 | + } | ||
631 | } | ||
632 | |||
633 | static inline void save_vector_registers(void) | ||
634 | diff --git a/arch/s390/kernel/jump_label.c b/arch/s390/kernel/jump_label.c | ||
635 | index ab584e8e35275..9156653b56f69 100644 | ||
636 | --- a/arch/s390/kernel/jump_label.c | ||
637 | +++ b/arch/s390/kernel/jump_label.c | ||
638 | @@ -36,7 +36,7 @@ static void jump_label_bug(struct jump_entry *entry, struct insn *expected, | ||
639 | unsigned char *ipe = (unsigned char *)expected; | ||
640 | unsigned char *ipn = (unsigned char *)new; | ||
641 | |||
642 | - pr_emerg("Jump label code mismatch at %pS [%p]\n", ipc, ipc); | ||
643 | + pr_emerg("Jump label code mismatch at %pS [%px]\n", ipc, ipc); | ||
644 | pr_emerg("Found: %6ph\n", ipc); | ||
645 | pr_emerg("Expected: %6ph\n", ipe); | ||
646 | pr_emerg("New: %6ph\n", ipn); | ||
647 | diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c | ||
648 | index c1d96e588152b..5521f593cd20a 100644 | ||
649 | --- a/arch/s390/mm/init.c | ||
650 | +++ b/arch/s390/mm/init.c | ||
651 | @@ -168,9 +168,9 @@ static void pv_init(void) | ||
652 | return; | ||
653 | |||
654 | /* make sure bounce buffers are shared */ | ||
655 | + swiotlb_force = SWIOTLB_FORCE; | ||
656 | swiotlb_init(1); | ||
657 | swiotlb_update_mem_attributes(); | ||
658 | - swiotlb_force = SWIOTLB_FORCE; | ||
659 | } | ||
660 | |||
661 | void __init mem_init(void) | ||
662 | diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c | ||
663 | index 3e6612d8b921c..2d29966276296 100644 | ||
664 | --- a/arch/s390/net/bpf_jit_comp.c | ||
665 | +++ b/arch/s390/net/bpf_jit_comp.c | ||
666 | @@ -569,10 +569,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, | ||
667 | EMIT4(0xb9080000, dst_reg, src_reg); | ||
668 | break; | ||
669 | case BPF_ALU | BPF_ADD | BPF_K: /* dst = (u32) dst + (u32) imm */ | ||
670 | - if (!imm) | ||
671 | - break; | ||
672 | - /* alfi %dst,imm */ | ||
673 | - EMIT6_IMM(0xc20b0000, dst_reg, imm); | ||
674 | + if (imm != 0) { | ||
675 | + /* alfi %dst,imm */ | ||
676 | + EMIT6_IMM(0xc20b0000, dst_reg, imm); | ||
677 | + } | ||
678 | EMIT_ZERO(dst_reg); | ||
679 | break; | ||
680 | case BPF_ALU64 | BPF_ADD | BPF_K: /* dst = dst + imm */ | ||
681 | @@ -594,17 +594,22 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, | ||
682 | EMIT4(0xb9090000, dst_reg, src_reg); | ||
683 | break; | ||
684 | case BPF_ALU | BPF_SUB | BPF_K: /* dst = (u32) dst - (u32) imm */ | ||
685 | - if (!imm) | ||
686 | - break; | ||
687 | - /* alfi %dst,-imm */ | ||
688 | - EMIT6_IMM(0xc20b0000, dst_reg, -imm); | ||
689 | + if (imm != 0) { | ||
690 | + /* alfi %dst,-imm */ | ||
691 | + EMIT6_IMM(0xc20b0000, dst_reg, -imm); | ||
692 | + } | ||
693 | EMIT_ZERO(dst_reg); | ||
694 | break; | ||
695 | case BPF_ALU64 | BPF_SUB | BPF_K: /* dst = dst - imm */ | ||
696 | if (!imm) | ||
697 | break; | ||
698 | - /* agfi %dst,-imm */ | ||
699 | - EMIT6_IMM(0xc2080000, dst_reg, -imm); | ||
700 | + if (imm == -0x80000000) { | ||
701 | + /* algfi %dst,0x80000000 */ | ||
702 | + EMIT6_IMM(0xc20a0000, dst_reg, 0x80000000); | ||
703 | + } else { | ||
704 | + /* agfi %dst,-imm */ | ||
705 | + EMIT6_IMM(0xc2080000, dst_reg, -imm); | ||
706 | + } | ||
707 | break; | ||
708 | /* | ||
709 | * BPF_MUL | ||
710 | @@ -619,10 +624,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, | ||
711 | EMIT4(0xb90c0000, dst_reg, src_reg); | ||
712 | break; | ||
713 | case BPF_ALU | BPF_MUL | BPF_K: /* dst = (u32) dst * (u32) imm */ | ||
714 | - if (imm == 1) | ||
715 | - break; | ||
716 | - /* msfi %r5,imm */ | ||
717 | - EMIT6_IMM(0xc2010000, dst_reg, imm); | ||
718 | + if (imm != 1) { | ||
719 | + /* msfi %r5,imm */ | ||
720 | + EMIT6_IMM(0xc2010000, dst_reg, imm); | ||
721 | + } | ||
722 | EMIT_ZERO(dst_reg); | ||
723 | break; | ||
724 | case BPF_ALU64 | BPF_MUL | BPF_K: /* dst = dst * imm */ | ||
725 | @@ -675,6 +680,8 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, | ||
726 | if (BPF_OP(insn->code) == BPF_MOD) | ||
727 | /* lhgi %dst,0 */ | ||
728 | EMIT4_IMM(0xa7090000, dst_reg, 0); | ||
729 | + else | ||
730 | + EMIT_ZERO(dst_reg); | ||
731 | break; | ||
732 | } | ||
733 | /* lhi %w0,0 */ | ||
734 | @@ -769,10 +776,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, | ||
735 | EMIT4(0xb9820000, dst_reg, src_reg); | ||
736 | break; | ||
737 | case BPF_ALU | BPF_XOR | BPF_K: /* dst = (u32) dst ^ (u32) imm */ | ||
738 | - if (!imm) | ||
739 | - break; | ||
740 | - /* xilf %dst,imm */ | ||
741 | - EMIT6_IMM(0xc0070000, dst_reg, imm); | ||
742 | + if (imm != 0) { | ||
743 | + /* xilf %dst,imm */ | ||
744 | + EMIT6_IMM(0xc0070000, dst_reg, imm); | ||
745 | + } | ||
746 | EMIT_ZERO(dst_reg); | ||
747 | break; | ||
748 | case BPF_ALU64 | BPF_XOR | BPF_K: /* dst = dst ^ imm */ | ||
749 | @@ -793,10 +800,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, | ||
750 | EMIT6_DISP_LH(0xeb000000, 0x000d, dst_reg, dst_reg, src_reg, 0); | ||
751 | break; | ||
752 | case BPF_ALU | BPF_LSH | BPF_K: /* dst = (u32) dst << (u32) imm */ | ||
753 | - if (imm == 0) | ||
754 | - break; | ||
755 | - /* sll %dst,imm(%r0) */ | ||
756 | - EMIT4_DISP(0x89000000, dst_reg, REG_0, imm); | ||
757 | + if (imm != 0) { | ||
758 | + /* sll %dst,imm(%r0) */ | ||
759 | + EMIT4_DISP(0x89000000, dst_reg, REG_0, imm); | ||
760 | + } | ||
761 | EMIT_ZERO(dst_reg); | ||
762 | break; | ||
763 | case BPF_ALU64 | BPF_LSH | BPF_K: /* dst = dst << imm */ | ||
764 | @@ -818,10 +825,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, | ||
765 | EMIT6_DISP_LH(0xeb000000, 0x000c, dst_reg, dst_reg, src_reg, 0); | ||
766 | break; | ||
767 | case BPF_ALU | BPF_RSH | BPF_K: /* dst = (u32) dst >> (u32) imm */ | ||
768 | - if (imm == 0) | ||
769 | - break; | ||
770 | - /* srl %dst,imm(%r0) */ | ||
771 | - EMIT4_DISP(0x88000000, dst_reg, REG_0, imm); | ||
772 | + if (imm != 0) { | ||
773 | + /* srl %dst,imm(%r0) */ | ||
774 | + EMIT4_DISP(0x88000000, dst_reg, REG_0, imm); | ||
775 | + } | ||
776 | EMIT_ZERO(dst_reg); | ||
777 | break; | ||
778 | case BPF_ALU64 | BPF_RSH | BPF_K: /* dst = dst >> imm */ | ||
779 | @@ -843,10 +850,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, | ||
780 | EMIT6_DISP_LH(0xeb000000, 0x000a, dst_reg, dst_reg, src_reg, 0); | ||
781 | break; | ||
782 | case BPF_ALU | BPF_ARSH | BPF_K: /* ((s32) dst >> imm */ | ||
783 | - if (imm == 0) | ||
784 | - break; | ||
785 | - /* sra %dst,imm(%r0) */ | ||
786 | - EMIT4_DISP(0x8a000000, dst_reg, REG_0, imm); | ||
787 | + if (imm != 0) { | ||
788 | + /* sra %dst,imm(%r0) */ | ||
789 | + EMIT4_DISP(0x8a000000, dst_reg, REG_0, imm); | ||
790 | + } | ||
791 | EMIT_ZERO(dst_reg); | ||
792 | break; | ||
793 | case BPF_ALU64 | BPF_ARSH | BPF_K: /* ((s64) dst) >>= imm */ | ||
794 | diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c | ||
795 | index 6105b1b6e49b7..b8ddacf1efe11 100644 | ||
796 | --- a/arch/s390/pci/pci.c | ||
797 | +++ b/arch/s390/pci/pci.c | ||
798 | @@ -854,7 +854,6 @@ static void zpci_mem_exit(void) | ||
799 | } | ||
800 | |||
801 | static unsigned int s390_pci_probe __initdata = 1; | ||
802 | -static unsigned int s390_pci_no_mio __initdata; | ||
803 | unsigned int s390_pci_force_floating __initdata; | ||
804 | static unsigned int s390_pci_initialized; | ||
805 | |||
806 | @@ -865,7 +864,7 @@ char * __init pcibios_setup(char *str) | ||
807 | return NULL; | ||
808 | } | ||
809 | if (!strcmp(str, "nomio")) { | ||
810 | - s390_pci_no_mio = 1; | ||
811 | + S390_lowcore.machine_flags &= ~MACHINE_FLAG_PCI_MIO; | ||
812 | return NULL; | ||
813 | } | ||
814 | if (!strcmp(str, "force_floating")) { | ||
815 | @@ -890,7 +889,7 @@ static int __init pci_base_init(void) | ||
816 | if (!test_facility(69) || !test_facility(71)) | ||
817 | return 0; | ||
818 | |||
819 | - if (test_facility(153) && !s390_pci_no_mio) { | ||
820 | + if (MACHINE_HAS_PCI_MIO) { | ||
821 | static_branch_enable(&have_mio); | ||
822 | ctl_set_bit(2, 5); | ||
823 | } | ||
824 | diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c | ||
825 | index b8541d77452c1..a37ccafe065ba 100644 | ||
826 | --- a/arch/x86/mm/init_64.c | ||
827 | +++ b/arch/x86/mm/init_64.c | ||
828 | @@ -1355,18 +1355,18 @@ int kern_addr_valid(unsigned long addr) | ||
829 | return 0; | ||
830 | |||
831 | p4d = p4d_offset(pgd, addr); | ||
832 | - if (p4d_none(*p4d)) | ||
833 | + if (!p4d_present(*p4d)) | ||
834 | return 0; | ||
835 | |||
836 | pud = pud_offset(p4d, addr); | ||
837 | - if (pud_none(*pud)) | ||
838 | + if (!pud_present(*pud)) | ||
839 | return 0; | ||
840 | |||
841 | if (pud_large(*pud)) | ||
842 | return pfn_valid(pud_pfn(*pud)); | ||
843 | |||
844 | pmd = pmd_offset(pud, addr); | ||
845 | - if (pmd_none(*pmd)) | ||
846 | + if (!pmd_present(*pmd)) | ||
847 | return 0; | ||
848 | |||
849 | if (pmd_large(*pmd)) | ||
850 | diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c | ||
851 | index 3e66feff524a8..b99074ca5e686 100644 | ||
852 | --- a/arch/x86/xen/enlighten_pv.c | ||
853 | +++ b/arch/x86/xen/enlighten_pv.c | ||
854 | @@ -1183,6 +1183,11 @@ static void __init xen_dom0_set_legacy_features(void) | ||
855 | x86_platform.legacy.rtc = 1; | ||
856 | } | ||
857 | |||
858 | +static void __init xen_domu_set_legacy_features(void) | ||
859 | +{ | ||
860 | + x86_platform.legacy.rtc = 0; | ||
861 | +} | ||
862 | + | ||
863 | /* First C function to be called on Xen boot */ | ||
864 | asmlinkage __visible void __init xen_start_kernel(void) | ||
865 | { | ||
866 | @@ -1353,6 +1358,8 @@ asmlinkage __visible void __init xen_start_kernel(void) | ||
867 | add_preferred_console("xenboot", 0, NULL); | ||
868 | if (pci_xen) | ||
869 | x86_init.pci.arch_init = pci_xen_init; | ||
870 | + x86_platform.set_legacy_features = | ||
871 | + xen_domu_set_legacy_features; | ||
872 | } else { | ||
873 | const struct dom0_vga_console_info *info = | ||
874 | (void *)((char *)xen_start_info + | ||
875 | diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c | ||
876 | index 12fcb3858303a..8b1e40ec58f65 100644 | ||
877 | --- a/arch/x86/xen/p2m.c | ||
878 | +++ b/arch/x86/xen/p2m.c | ||
879 | @@ -622,8 +622,8 @@ int xen_alloc_p2m_entry(unsigned long pfn) | ||
880 | } | ||
881 | |||
882 | /* Expanded the p2m? */ | ||
883 | - if (pfn > xen_p2m_last_pfn) { | ||
884 | - xen_p2m_last_pfn = pfn; | ||
885 | + if (pfn >= xen_p2m_last_pfn) { | ||
886 | + xen_p2m_last_pfn = ALIGN(pfn + 1, P2M_PER_PAGE); | ||
887 | HYPERVISOR_shared_info->arch.max_pfn = xen_p2m_last_pfn; | ||
888 | } | ||
889 | |||
890 | diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c | ||
891 | index af81a62faba64..e7faea3d73d3b 100644 | ||
892 | --- a/arch/xtensa/platforms/iss/console.c | ||
893 | +++ b/arch/xtensa/platforms/iss/console.c | ||
894 | @@ -168,9 +168,13 @@ static const struct tty_operations serial_ops = { | ||
895 | |||
896 | int __init rs_init(void) | ||
897 | { | ||
898 | - tty_port_init(&serial_port); | ||
899 | + int ret; | ||
900 | |||
901 | serial_driver = alloc_tty_driver(SERIAL_MAX_NUM_LINES); | ||
902 | + if (!serial_driver) | ||
903 | + return -ENOMEM; | ||
904 | + | ||
905 | + tty_port_init(&serial_port); | ||
906 | |||
907 | pr_info("%s %s\n", serial_name, serial_version); | ||
908 | |||
909 | @@ -190,8 +194,15 @@ int __init rs_init(void) | ||
910 | tty_set_operations(serial_driver, &serial_ops); | ||
911 | tty_port_link_device(&serial_port, serial_driver, 0); | ||
912 | |||
913 | - if (tty_register_driver(serial_driver)) | ||
914 | - panic("Couldn't register serial driver\n"); | ||
915 | + ret = tty_register_driver(serial_driver); | ||
916 | + if (ret) { | ||
917 | + pr_err("Couldn't register serial driver\n"); | ||
918 | + tty_driver_kref_put(serial_driver); | ||
919 | + tty_port_destroy(&serial_port); | ||
920 | + | ||
921 | + return ret; | ||
922 | + } | ||
923 | + | ||
924 | return 0; | ||
925 | } | ||
926 | |||
927 | diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c | ||
928 | index 136232a01f715..8dee243e639f0 100644 | ||
929 | --- a/block/bfq-iosched.c | ||
930 | +++ b/block/bfq-iosched.c | ||
931 | @@ -2523,6 +2523,15 @@ bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq) | ||
932 | * are likely to increase the throughput. | ||
933 | */ | ||
934 | bfqq->new_bfqq = new_bfqq; | ||
935 | + /* | ||
936 | + * The above assignment schedules the following redirections: | ||
937 | + * each time some I/O for bfqq arrives, the process that | ||
938 | + * generated that I/O is disassociated from bfqq and | ||
939 | + * associated with new_bfqq. Here we increases new_bfqq->ref | ||
940 | + * in advance, adding the number of processes that are | ||
941 | + * expected to be associated with new_bfqq as they happen to | ||
942 | + * issue I/O. | ||
943 | + */ | ||
944 | new_bfqq->ref += process_refs; | ||
945 | return new_bfqq; | ||
946 | } | ||
947 | @@ -2582,6 +2591,10 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, | ||
948 | { | ||
949 | struct bfq_queue *in_service_bfqq, *new_bfqq; | ||
950 | |||
951 | + /* if a merge has already been setup, then proceed with that first */ | ||
952 | + if (bfqq->new_bfqq) | ||
953 | + return bfqq->new_bfqq; | ||
954 | + | ||
955 | /* | ||
956 | * Do not perform queue merging if the device is non | ||
957 | * rotational and performs internal queueing. In fact, such a | ||
958 | @@ -2636,9 +2649,6 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, | ||
959 | if (bfq_too_late_for_merging(bfqq)) | ||
960 | return NULL; | ||
961 | |||
962 | - if (bfqq->new_bfqq) | ||
963 | - return bfqq->new_bfqq; | ||
964 | - | ||
965 | if (!io_struct || unlikely(bfqq == &bfqd->oom_bfqq)) | ||
966 | return NULL; | ||
967 | |||
968 | @@ -5004,7 +5014,7 @@ bfq_set_next_ioprio_data(struct bfq_queue *bfqq, struct bfq_io_cq *bic) | ||
969 | if (bfqq->new_ioprio >= IOPRIO_BE_NR) { | ||
970 | pr_crit("bfq_set_next_ioprio_data: new_ioprio %d\n", | ||
971 | bfqq->new_ioprio); | ||
972 | - bfqq->new_ioprio = IOPRIO_BE_NR; | ||
973 | + bfqq->new_ioprio = IOPRIO_BE_NR - 1; | ||
974 | } | ||
975 | |||
976 | bfqq->entity.new_weight = bfq_ioprio_to_weight(bfqq->new_ioprio); | ||
977 | diff --git a/block/blk-zoned.c b/block/blk-zoned.c | ||
978 | index b17c094cb977c..a85d0a06a6ff2 100644 | ||
979 | --- a/block/blk-zoned.c | ||
980 | +++ b/block/blk-zoned.c | ||
981 | @@ -316,9 +316,6 @@ int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode, | ||
982 | if (!blk_queue_is_zoned(q)) | ||
983 | return -ENOTTY; | ||
984 | |||
985 | - if (!capable(CAP_SYS_ADMIN)) | ||
986 | - return -EACCES; | ||
987 | - | ||
988 | if (copy_from_user(&rep, argp, sizeof(struct blk_zone_report))) | ||
989 | return -EFAULT; | ||
990 | |||
991 | @@ -374,9 +371,6 @@ int blkdev_reset_zones_ioctl(struct block_device *bdev, fmode_t mode, | ||
992 | if (!blk_queue_is_zoned(q)) | ||
993 | return -ENOTTY; | ||
994 | |||
995 | - if (!capable(CAP_SYS_ADMIN)) | ||
996 | - return -EACCES; | ||
997 | - | ||
998 | if (!(mode & FMODE_WRITE)) | ||
999 | return -EBADF; | ||
1000 | |||
1001 | diff --git a/block/bsg.c b/block/bsg.c | ||
1002 | index 0d012efef5274..c8b9714e69232 100644 | ||
1003 | --- a/block/bsg.c | ||
1004 | +++ b/block/bsg.c | ||
1005 | @@ -371,10 +371,13 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
1006 | case SG_GET_RESERVED_SIZE: | ||
1007 | case SG_SET_RESERVED_SIZE: | ||
1008 | case SG_EMULATED_HOST: | ||
1009 | - case SCSI_IOCTL_SEND_COMMAND: | ||
1010 | return scsi_cmd_ioctl(bd->queue, NULL, file->f_mode, cmd, uarg); | ||
1011 | case SG_IO: | ||
1012 | return bsg_sg_io(bd->queue, file->f_mode, uarg); | ||
1013 | + case SCSI_IOCTL_SEND_COMMAND: | ||
1014 | + pr_warn_ratelimited("%s: calling unsupported SCSI_IOCTL_SEND_COMMAND\n", | ||
1015 | + current->comm); | ||
1016 | + return -EINVAL; | ||
1017 | default: | ||
1018 | return -ENOTTY; | ||
1019 | } | ||
1020 | diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c | ||
1021 | index 7788af0ca1090..5c354c7aff946 100644 | ||
1022 | --- a/drivers/ata/libata-core.c | ||
1023 | +++ b/drivers/ata/libata-core.c | ||
1024 | @@ -4556,6 +4556,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | ||
1025 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, | ||
1026 | { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | | ||
1027 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, | ||
1028 | + { "Samsung SSD 860*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | | ||
1029 | + ATA_HORKAGE_ZERO_AFTER_TRIM, }, | ||
1030 | + { "Samsung SSD 870*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | | ||
1031 | + ATA_HORKAGE_ZERO_AFTER_TRIM, }, | ||
1032 | { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | | ||
1033 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, | ||
1034 | |||
1035 | diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c | ||
1036 | index 9dcef6ac643b9..982fe91125322 100644 | ||
1037 | --- a/drivers/ata/sata_dwc_460ex.c | ||
1038 | +++ b/drivers/ata/sata_dwc_460ex.c | ||
1039 | @@ -1249,24 +1249,20 @@ static int sata_dwc_probe(struct platform_device *ofdev) | ||
1040 | irq = irq_of_parse_and_map(np, 0); | ||
1041 | if (irq == NO_IRQ) { | ||
1042 | dev_err(&ofdev->dev, "no SATA DMA irq\n"); | ||
1043 | - err = -ENODEV; | ||
1044 | - goto error_out; | ||
1045 | + return -ENODEV; | ||
1046 | } | ||
1047 | |||
1048 | #ifdef CONFIG_SATA_DWC_OLD_DMA | ||
1049 | if (!of_find_property(np, "dmas", NULL)) { | ||
1050 | err = sata_dwc_dma_init_old(ofdev, hsdev); | ||
1051 | if (err) | ||
1052 | - goto error_out; | ||
1053 | + return err; | ||
1054 | } | ||
1055 | #endif | ||
1056 | |||
1057 | hsdev->phy = devm_phy_optional_get(hsdev->dev, "sata-phy"); | ||
1058 | - if (IS_ERR(hsdev->phy)) { | ||
1059 | - err = PTR_ERR(hsdev->phy); | ||
1060 | - hsdev->phy = NULL; | ||
1061 | - goto error_out; | ||
1062 | - } | ||
1063 | + if (IS_ERR(hsdev->phy)) | ||
1064 | + return PTR_ERR(hsdev->phy); | ||
1065 | |||
1066 | err = phy_init(hsdev->phy); | ||
1067 | if (err) | ||
1068 | diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c | ||
1069 | index 977d27bd1a220..9a9dec657c166 100644 | ||
1070 | --- a/drivers/base/power/trace.c | ||
1071 | +++ b/drivers/base/power/trace.c | ||
1072 | @@ -13,6 +13,7 @@ | ||
1073 | #include <linux/export.h> | ||
1074 | #include <linux/rtc.h> | ||
1075 | #include <linux/suspend.h> | ||
1076 | +#include <linux/init.h> | ||
1077 | |||
1078 | #include <linux/mc146818rtc.h> | ||
1079 | |||
1080 | @@ -165,6 +166,9 @@ void generate_pm_trace(const void *tracedata, unsigned int user) | ||
1081 | const char *file = *(const char **)(tracedata + 2); | ||
1082 | unsigned int user_hash_value, file_hash_value; | ||
1083 | |||
1084 | + if (!x86_platform.legacy.rtc) | ||
1085 | + return; | ||
1086 | + | ||
1087 | user_hash_value = user % USERHASH; | ||
1088 | file_hash_value = hash_string(lineno, file, FILEHASH); | ||
1089 | set_magic_time(user_hash_value, file_hash_value, dev_hash_value); | ||
1090 | @@ -267,6 +271,9 @@ static struct notifier_block pm_trace_nb = { | ||
1091 | |||
1092 | static int early_resume_init(void) | ||
1093 | { | ||
1094 | + if (!x86_platform.legacy.rtc) | ||
1095 | + return 0; | ||
1096 | + | ||
1097 | hash_value_early_read = read_magic_time(); | ||
1098 | register_pm_notifier(&pm_trace_nb); | ||
1099 | return 0; | ||
1100 | @@ -277,6 +284,9 @@ static int late_resume_init(void) | ||
1101 | unsigned int val = hash_value_early_read; | ||
1102 | unsigned int user, file, dev; | ||
1103 | |||
1104 | + if (!x86_platform.legacy.rtc) | ||
1105 | + return 0; | ||
1106 | + | ||
1107 | user = val % USERHASH; | ||
1108 | val = val / USERHASH; | ||
1109 | file = val % FILEHASH; | ||
1110 | diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c | ||
1111 | index 44a46dcc0518b..d7fe1303f79dc 100644 | ||
1112 | --- a/drivers/clk/at91/clk-generated.c | ||
1113 | +++ b/drivers/clk/at91/clk-generated.c | ||
1114 | @@ -18,8 +18,6 @@ | ||
1115 | |||
1116 | #define GENERATED_MAX_DIV 255 | ||
1117 | |||
1118 | -#define GCK_INDEX_DT_AUDIO_PLL 5 | ||
1119 | - | ||
1120 | struct clk_generated { | ||
1121 | struct clk_hw hw; | ||
1122 | struct regmap *regmap; | ||
1123 | @@ -29,7 +27,7 @@ struct clk_generated { | ||
1124 | u32 gckdiv; | ||
1125 | const struct clk_pcr_layout *layout; | ||
1126 | u8 parent_id; | ||
1127 | - bool audio_pll_allowed; | ||
1128 | + int chg_pid; | ||
1129 | }; | ||
1130 | |||
1131 | #define to_clk_generated(hw) \ | ||
1132 | @@ -109,7 +107,7 @@ static void clk_generated_best_diff(struct clk_rate_request *req, | ||
1133 | tmp_rate = parent_rate / div; | ||
1134 | tmp_diff = abs(req->rate - tmp_rate); | ||
1135 | |||
1136 | - if (*best_diff < 0 || *best_diff > tmp_diff) { | ||
1137 | + if (*best_diff < 0 || *best_diff >= tmp_diff) { | ||
1138 | *best_rate = tmp_rate; | ||
1139 | *best_diff = tmp_diff; | ||
1140 | req->best_parent_rate = parent_rate; | ||
1141 | @@ -129,7 +127,16 @@ static int clk_generated_determine_rate(struct clk_hw *hw, | ||
1142 | int i; | ||
1143 | u32 div; | ||
1144 | |||
1145 | - for (i = 0; i < clk_hw_get_num_parents(hw) - 1; i++) { | ||
1146 | + /* do not look for a rate that is outside of our range */ | ||
1147 | + if (gck->range.max && req->rate > gck->range.max) | ||
1148 | + req->rate = gck->range.max; | ||
1149 | + if (gck->range.min && req->rate < gck->range.min) | ||
1150 | + req->rate = gck->range.min; | ||
1151 | + | ||
1152 | + for (i = 0; i < clk_hw_get_num_parents(hw); i++) { | ||
1153 | + if (gck->chg_pid == i) | ||
1154 | + continue; | ||
1155 | + | ||
1156 | parent = clk_hw_get_parent_by_index(hw, i); | ||
1157 | if (!parent) | ||
1158 | continue; | ||
1159 | @@ -161,10 +168,10 @@ static int clk_generated_determine_rate(struct clk_hw *hw, | ||
1160 | * that the only clks able to modify gck rate are those of audio IPs. | ||
1161 | */ | ||
1162 | |||
1163 | - if (!gck->audio_pll_allowed) | ||
1164 | + if (gck->chg_pid < 0) | ||
1165 | goto end; | ||
1166 | |||
1167 | - parent = clk_hw_get_parent_by_index(hw, GCK_INDEX_DT_AUDIO_PLL); | ||
1168 | + parent = clk_hw_get_parent_by_index(hw, gck->chg_pid); | ||
1169 | if (!parent) | ||
1170 | goto end; | ||
1171 | |||
1172 | @@ -271,8 +278,8 @@ struct clk_hw * __init | ||
1173 | at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock, | ||
1174 | const struct clk_pcr_layout *layout, | ||
1175 | const char *name, const char **parent_names, | ||
1176 | - u8 num_parents, u8 id, bool pll_audio, | ||
1177 | - const struct clk_range *range) | ||
1178 | + u8 num_parents, u8 id, | ||
1179 | + const struct clk_range *range, int chg_pid) | ||
1180 | { | ||
1181 | struct clk_generated *gck; | ||
1182 | struct clk_init_data init; | ||
1183 | @@ -287,15 +294,16 @@ at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock, | ||
1184 | init.ops = &generated_ops; | ||
1185 | init.parent_names = parent_names; | ||
1186 | init.num_parents = num_parents; | ||
1187 | - init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE | | ||
1188 | - CLK_SET_RATE_PARENT; | ||
1189 | + init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; | ||
1190 | + if (chg_pid >= 0) | ||
1191 | + init.flags |= CLK_SET_RATE_PARENT; | ||
1192 | |||
1193 | gck->id = id; | ||
1194 | gck->hw.init = &init; | ||
1195 | gck->regmap = regmap; | ||
1196 | gck->lock = lock; | ||
1197 | gck->range = *range; | ||
1198 | - gck->audio_pll_allowed = pll_audio; | ||
1199 | + gck->chg_pid = chg_pid; | ||
1200 | gck->layout = layout; | ||
1201 | |||
1202 | clk_generated_startup(gck); | ||
1203 | diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c | ||
1204 | index aa1754eac59ff..8a652c44c25ab 100644 | ||
1205 | --- a/drivers/clk/at91/dt-compat.c | ||
1206 | +++ b/drivers/clk/at91/dt-compat.c | ||
1207 | @@ -22,6 +22,8 @@ | ||
1208 | |||
1209 | #define SYSTEM_MAX_ID 31 | ||
1210 | |||
1211 | +#define GCK_INDEX_DT_AUDIO_PLL 5 | ||
1212 | + | ||
1213 | #ifdef CONFIG_HAVE_AT91_AUDIO_PLL | ||
1214 | static void __init of_sama5d2_clk_audio_pll_frac_setup(struct device_node *np) | ||
1215 | { | ||
1216 | @@ -135,7 +137,7 @@ static void __init of_sama5d2_clk_generated_setup(struct device_node *np) | ||
1217 | return; | ||
1218 | |||
1219 | for_each_child_of_node(np, gcknp) { | ||
1220 | - bool pll_audio = false; | ||
1221 | + int chg_pid = INT_MIN; | ||
1222 | |||
1223 | if (of_property_read_u32(gcknp, "reg", &id)) | ||
1224 | continue; | ||
1225 | @@ -152,12 +154,12 @@ static void __init of_sama5d2_clk_generated_setup(struct device_node *np) | ||
1226 | if (of_device_is_compatible(np, "atmel,sama5d2-clk-generated") && | ||
1227 | (id == GCK_ID_I2S0 || id == GCK_ID_I2S1 || | ||
1228 | id == GCK_ID_CLASSD)) | ||
1229 | - pll_audio = true; | ||
1230 | + chg_pid = GCK_INDEX_DT_AUDIO_PLL; | ||
1231 | |||
1232 | hw = at91_clk_register_generated(regmap, &pmc_pcr_lock, | ||
1233 | &dt_pcr_layout, name, | ||
1234 | parent_names, num_parents, | ||
1235 | - id, pll_audio, &range); | ||
1236 | + id, &range, chg_pid); | ||
1237 | if (IS_ERR(hw)) | ||
1238 | continue; | ||
1239 | |||
1240 | diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h | ||
1241 | index 9b8db9cdcda53..8a88ad2360742 100644 | ||
1242 | --- a/drivers/clk/at91/pmc.h | ||
1243 | +++ b/drivers/clk/at91/pmc.h | ||
1244 | @@ -118,8 +118,8 @@ struct clk_hw * __init | ||
1245 | at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock, | ||
1246 | const struct clk_pcr_layout *layout, | ||
1247 | const char *name, const char **parent_names, | ||
1248 | - u8 num_parents, u8 id, bool pll_audio, | ||
1249 | - const struct clk_range *range); | ||
1250 | + u8 num_parents, u8 id, | ||
1251 | + const struct clk_range *range, int chg_pid); | ||
1252 | |||
1253 | struct clk_hw * __init | ||
1254 | at91_clk_register_h32mx(struct regmap *regmap, const char *name, | ||
1255 | diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c | ||
1256 | index e3f4c8f20223a..39923899478f9 100644 | ||
1257 | --- a/drivers/clk/at91/sam9x60.c | ||
1258 | +++ b/drivers/clk/at91/sam9x60.c | ||
1259 | @@ -124,7 +124,6 @@ static const struct { | ||
1260 | char *n; | ||
1261 | u8 id; | ||
1262 | struct clk_range r; | ||
1263 | - bool pll; | ||
1264 | } sam9x60_gck[] = { | ||
1265 | { .n = "flex0_gclk", .id = 5, }, | ||
1266 | { .n = "flex1_gclk", .id = 6, }, | ||
1267 | @@ -144,11 +143,9 @@ static const struct { | ||
1268 | { .n = "sdmmc1_gclk", .id = 26, .r = { .min = 0, .max = 105000000 }, }, | ||
1269 | { .n = "flex11_gclk", .id = 32, }, | ||
1270 | { .n = "flex12_gclk", .id = 33, }, | ||
1271 | - { .n = "i2s_gclk", .id = 34, .r = { .min = 0, .max = 105000000 }, | ||
1272 | - .pll = true, }, | ||
1273 | + { .n = "i2s_gclk", .id = 34, .r = { .min = 0, .max = 105000000 }, }, | ||
1274 | { .n = "pit64b_gclk", .id = 37, }, | ||
1275 | - { .n = "classd_gclk", .id = 42, .r = { .min = 0, .max = 100000000 }, | ||
1276 | - .pll = true, }, | ||
1277 | + { .n = "classd_gclk", .id = 42, .r = { .min = 0, .max = 100000000 }, }, | ||
1278 | { .n = "tcb1_gclk", .id = 45, }, | ||
1279 | { .n = "dbgu_gclk", .id = 47, }, | ||
1280 | }; | ||
1281 | @@ -285,8 +282,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) | ||
1282 | sam9x60_gck[i].n, | ||
1283 | parent_names, 6, | ||
1284 | sam9x60_gck[i].id, | ||
1285 | - sam9x60_gck[i].pll, | ||
1286 | - &sam9x60_gck[i].r); | ||
1287 | + &sam9x60_gck[i].r, INT_MIN); | ||
1288 | if (IS_ERR(hw)) | ||
1289 | goto err_free; | ||
1290 | |||
1291 | diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c | ||
1292 | index ff7e3f727082e..d3c4bceb032d1 100644 | ||
1293 | --- a/drivers/clk/at91/sama5d2.c | ||
1294 | +++ b/drivers/clk/at91/sama5d2.c | ||
1295 | @@ -115,21 +115,20 @@ static const struct { | ||
1296 | char *n; | ||
1297 | u8 id; | ||
1298 | struct clk_range r; | ||
1299 | - bool pll; | ||
1300 | + int chg_pid; | ||
1301 | } sama5d2_gck[] = { | ||
1302 | - { .n = "sdmmc0_gclk", .id = 31, }, | ||
1303 | - { .n = "sdmmc1_gclk", .id = 32, }, | ||
1304 | - { .n = "tcb0_gclk", .id = 35, .r = { .min = 0, .max = 83000000 }, }, | ||
1305 | - { .n = "tcb1_gclk", .id = 36, .r = { .min = 0, .max = 83000000 }, }, | ||
1306 | - { .n = "pwm_gclk", .id = 38, .r = { .min = 0, .max = 83000000 }, }, | ||
1307 | - { .n = "isc_gclk", .id = 46, }, | ||
1308 | - { .n = "pdmic_gclk", .id = 48, }, | ||
1309 | - { .n = "i2s0_gclk", .id = 54, .pll = true }, | ||
1310 | - { .n = "i2s1_gclk", .id = 55, .pll = true }, | ||
1311 | - { .n = "can0_gclk", .id = 56, .r = { .min = 0, .max = 80000000 }, }, | ||
1312 | - { .n = "can1_gclk", .id = 57, .r = { .min = 0, .max = 80000000 }, }, | ||
1313 | - { .n = "classd_gclk", .id = 59, .r = { .min = 0, .max = 100000000 }, | ||
1314 | - .pll = true }, | ||
1315 | + { .n = "sdmmc0_gclk", .id = 31, .chg_pid = INT_MIN, }, | ||
1316 | + { .n = "sdmmc1_gclk", .id = 32, .chg_pid = INT_MIN, }, | ||
1317 | + { .n = "tcb0_gclk", .id = 35, .chg_pid = INT_MIN, .r = { .min = 0, .max = 83000000 }, }, | ||
1318 | + { .n = "tcb1_gclk", .id = 36, .chg_pid = INT_MIN, .r = { .min = 0, .max = 83000000 }, }, | ||
1319 | + { .n = "pwm_gclk", .id = 38, .chg_pid = INT_MIN, .r = { .min = 0, .max = 83000000 }, }, | ||
1320 | + { .n = "isc_gclk", .id = 46, .chg_pid = INT_MIN, }, | ||
1321 | + { .n = "pdmic_gclk", .id = 48, .chg_pid = INT_MIN, }, | ||
1322 | + { .n = "i2s0_gclk", .id = 54, .chg_pid = 5, }, | ||
1323 | + { .n = "i2s1_gclk", .id = 55, .chg_pid = 5, }, | ||
1324 | + { .n = "can0_gclk", .id = 56, .chg_pid = INT_MIN, .r = { .min = 0, .max = 80000000 }, }, | ||
1325 | + { .n = "can1_gclk", .id = 57, .chg_pid = INT_MIN, .r = { .min = 0, .max = 80000000 }, }, | ||
1326 | + { .n = "classd_gclk", .id = 59, .chg_pid = 5, .r = { .min = 0, .max = 100000000 }, }, | ||
1327 | }; | ||
1328 | |||
1329 | static const struct clk_programmable_layout sama5d2_programmable_layout = { | ||
1330 | @@ -317,8 +316,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np) | ||
1331 | sama5d2_gck[i].n, | ||
1332 | parent_names, 6, | ||
1333 | sama5d2_gck[i].id, | ||
1334 | - sama5d2_gck[i].pll, | ||
1335 | - &sama5d2_gck[i].r); | ||
1336 | + &sama5d2_gck[i].r, | ||
1337 | + sama5d2_gck[i].chg_pid); | ||
1338 | if (IS_ERR(hw)) | ||
1339 | goto err_free; | ||
1340 | |||
1341 | diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c | ||
1342 | index bc6ccf2c7aae0..c636c9ba01008 100644 | ||
1343 | --- a/drivers/cpufreq/powernv-cpufreq.c | ||
1344 | +++ b/drivers/cpufreq/powernv-cpufreq.c | ||
1345 | @@ -36,6 +36,7 @@ | ||
1346 | #define MAX_PSTATE_SHIFT 32 | ||
1347 | #define LPSTATE_SHIFT 48 | ||
1348 | #define GPSTATE_SHIFT 56 | ||
1349 | +#define MAX_NR_CHIPS 32 | ||
1350 | |||
1351 | #define MAX_RAMP_DOWN_TIME 5120 | ||
1352 | /* | ||
1353 | @@ -1050,12 +1051,20 @@ static int init_chip_info(void) | ||
1354 | unsigned int *chip; | ||
1355 | unsigned int cpu, i; | ||
1356 | unsigned int prev_chip_id = UINT_MAX; | ||
1357 | + cpumask_t *chip_cpu_mask; | ||
1358 | int ret = 0; | ||
1359 | |||
1360 | chip = kcalloc(num_possible_cpus(), sizeof(*chip), GFP_KERNEL); | ||
1361 | if (!chip) | ||
1362 | return -ENOMEM; | ||
1363 | |||
1364 | + /* Allocate a chip cpu mask large enough to fit mask for all chips */ | ||
1365 | + chip_cpu_mask = kcalloc(MAX_NR_CHIPS, sizeof(cpumask_t), GFP_KERNEL); | ||
1366 | + if (!chip_cpu_mask) { | ||
1367 | + ret = -ENOMEM; | ||
1368 | + goto free_and_return; | ||
1369 | + } | ||
1370 | + | ||
1371 | for_each_possible_cpu(cpu) { | ||
1372 | unsigned int id = cpu_to_chip_id(cpu); | ||
1373 | |||
1374 | @@ -1063,22 +1072,25 @@ static int init_chip_info(void) | ||
1375 | prev_chip_id = id; | ||
1376 | chip[nr_chips++] = id; | ||
1377 | } | ||
1378 | + cpumask_set_cpu(cpu, &chip_cpu_mask[nr_chips-1]); | ||
1379 | } | ||
1380 | |||
1381 | chips = kcalloc(nr_chips, sizeof(struct chip), GFP_KERNEL); | ||
1382 | if (!chips) { | ||
1383 | ret = -ENOMEM; | ||
1384 | - goto free_and_return; | ||
1385 | + goto out_free_chip_cpu_mask; | ||
1386 | } | ||
1387 | |||
1388 | for (i = 0; i < nr_chips; i++) { | ||
1389 | chips[i].id = chip[i]; | ||
1390 | - cpumask_copy(&chips[i].mask, cpumask_of_node(chip[i])); | ||
1391 | + cpumask_copy(&chips[i].mask, &chip_cpu_mask[i]); | ||
1392 | INIT_WORK(&chips[i].throttle, powernv_cpufreq_work_fn); | ||
1393 | for_each_cpu(cpu, &chips[i].mask) | ||
1394 | per_cpu(chip_info, cpu) = &chips[i]; | ||
1395 | } | ||
1396 | |||
1397 | +out_free_chip_cpu_mask: | ||
1398 | + kfree(chip_cpu_mask); | ||
1399 | free_and_return: | ||
1400 | kfree(chip); | ||
1401 | return ret; | ||
1402 | diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c | ||
1403 | index 66fa524b6261e..5471110792071 100644 | ||
1404 | --- a/drivers/crypto/mxs-dcp.c | ||
1405 | +++ b/drivers/crypto/mxs-dcp.c | ||
1406 | @@ -298,21 +298,20 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) | ||
1407 | |||
1408 | struct scatterlist *dst = req->dst; | ||
1409 | struct scatterlist *src = req->src; | ||
1410 | - const int nents = sg_nents(req->src); | ||
1411 | + int dst_nents = sg_nents(dst); | ||
1412 | |||
1413 | const int out_off = DCP_BUF_SZ; | ||
1414 | uint8_t *in_buf = sdcp->coh->aes_in_buf; | ||
1415 | uint8_t *out_buf = sdcp->coh->aes_out_buf; | ||
1416 | |||
1417 | - uint8_t *out_tmp, *src_buf, *dst_buf = NULL; | ||
1418 | uint32_t dst_off = 0; | ||
1419 | + uint8_t *src_buf = NULL; | ||
1420 | uint32_t last_out_len = 0; | ||
1421 | |||
1422 | uint8_t *key = sdcp->coh->aes_key; | ||
1423 | |||
1424 | int ret = 0; | ||
1425 | - int split = 0; | ||
1426 | - unsigned int i, len, clen, rem = 0, tlen = 0; | ||
1427 | + unsigned int i, len, clen, tlen = 0; | ||
1428 | int init = 0; | ||
1429 | bool limit_hit = false; | ||
1430 | |||
1431 | @@ -330,7 +329,7 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) | ||
1432 | memset(key + AES_KEYSIZE_128, 0, AES_KEYSIZE_128); | ||
1433 | } | ||
1434 | |||
1435 | - for_each_sg(req->src, src, nents, i) { | ||
1436 | + for_each_sg(req->src, src, sg_nents(src), i) { | ||
1437 | src_buf = sg_virt(src); | ||
1438 | len = sg_dma_len(src); | ||
1439 | tlen += len; | ||
1440 | @@ -355,34 +354,17 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) | ||
1441 | * submit the buffer. | ||
1442 | */ | ||
1443 | if (actx->fill == out_off || sg_is_last(src) || | ||
1444 | - limit_hit) { | ||
1445 | + limit_hit) { | ||
1446 | ret = mxs_dcp_run_aes(actx, req, init); | ||
1447 | if (ret) | ||
1448 | return ret; | ||
1449 | init = 0; | ||
1450 | |||
1451 | - out_tmp = out_buf; | ||
1452 | + sg_pcopy_from_buffer(dst, dst_nents, out_buf, | ||
1453 | + actx->fill, dst_off); | ||
1454 | + dst_off += actx->fill; | ||
1455 | last_out_len = actx->fill; | ||
1456 | - while (dst && actx->fill) { | ||
1457 | - if (!split) { | ||
1458 | - dst_buf = sg_virt(dst); | ||
1459 | - dst_off = 0; | ||
1460 | - } | ||
1461 | - rem = min(sg_dma_len(dst) - dst_off, | ||
1462 | - actx->fill); | ||
1463 | - | ||
1464 | - memcpy(dst_buf + dst_off, out_tmp, rem); | ||
1465 | - out_tmp += rem; | ||
1466 | - dst_off += rem; | ||
1467 | - actx->fill -= rem; | ||
1468 | - | ||
1469 | - if (dst_off == sg_dma_len(dst)) { | ||
1470 | - dst = sg_next(dst); | ||
1471 | - split = 0; | ||
1472 | - } else { | ||
1473 | - split = 1; | ||
1474 | - } | ||
1475 | - } | ||
1476 | + actx->fill = 0; | ||
1477 | } | ||
1478 | } while (len); | ||
1479 | |||
1480 | diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c | ||
1481 | index 67736c801f3ca..cc70da05db4b5 100644 | ||
1482 | --- a/drivers/dma/imx-sdma.c | ||
1483 | +++ b/drivers/dma/imx-sdma.c | ||
1484 | @@ -377,7 +377,6 @@ struct sdma_channel { | ||
1485 | unsigned long watermark_level; | ||
1486 | u32 shp_addr, per_addr; | ||
1487 | enum dma_status status; | ||
1488 | - bool context_loaded; | ||
1489 | struct imx_dma_data data; | ||
1490 | struct work_struct terminate_worker; | ||
1491 | }; | ||
1492 | @@ -988,9 +987,6 @@ static int sdma_load_context(struct sdma_channel *sdmac) | ||
1493 | int ret; | ||
1494 | unsigned long flags; | ||
1495 | |||
1496 | - if (sdmac->context_loaded) | ||
1497 | - return 0; | ||
1498 | - | ||
1499 | if (sdmac->direction == DMA_DEV_TO_MEM) | ||
1500 | load_address = sdmac->pc_from_device; | ||
1501 | else if (sdmac->direction == DMA_DEV_TO_DEV) | ||
1502 | @@ -1033,8 +1029,6 @@ static int sdma_load_context(struct sdma_channel *sdmac) | ||
1503 | |||
1504 | spin_unlock_irqrestore(&sdma->channel_0_lock, flags); | ||
1505 | |||
1506 | - sdmac->context_loaded = true; | ||
1507 | - | ||
1508 | return ret; | ||
1509 | } | ||
1510 | |||
1511 | @@ -1074,7 +1068,6 @@ static void sdma_channel_terminate_work(struct work_struct *work) | ||
1512 | sdmac->desc = NULL; | ||
1513 | spin_unlock_irqrestore(&sdmac->vc.lock, flags); | ||
1514 | vchan_dma_desc_free_list(&sdmac->vc, &head); | ||
1515 | - sdmac->context_loaded = false; | ||
1516 | } | ||
1517 | |||
1518 | static int sdma_disable_channel_async(struct dma_chan *chan) | ||
1519 | @@ -1141,7 +1134,6 @@ static void sdma_set_watermarklevel_for_p2p(struct sdma_channel *sdmac) | ||
1520 | static int sdma_config_channel(struct dma_chan *chan) | ||
1521 | { | ||
1522 | struct sdma_channel *sdmac = to_sdma_chan(chan); | ||
1523 | - int ret; | ||
1524 | |||
1525 | sdma_disable_channel(chan); | ||
1526 | |||
1527 | @@ -1181,9 +1173,7 @@ static int sdma_config_channel(struct dma_chan *chan) | ||
1528 | sdmac->watermark_level = 0; /* FIXME: M3_BASE_ADDRESS */ | ||
1529 | } | ||
1530 | |||
1531 | - ret = sdma_load_context(sdmac); | ||
1532 | - | ||
1533 | - return ret; | ||
1534 | + return 0; | ||
1535 | } | ||
1536 | |||
1537 | static int sdma_set_channel_priority(struct sdma_channel *sdmac, | ||
1538 | @@ -1335,7 +1325,6 @@ static void sdma_free_chan_resources(struct dma_chan *chan) | ||
1539 | |||
1540 | sdmac->event_id0 = 0; | ||
1541 | sdmac->event_id1 = 0; | ||
1542 | - sdmac->context_loaded = false; | ||
1543 | |||
1544 | sdma_set_channel_priority(sdmac, 0); | ||
1545 | |||
1546 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | ||
1547 | index d1e278e999eeb..1b2fa83798304 100644 | ||
1548 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h | ||
1549 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | ||
1550 | @@ -762,7 +762,7 @@ enum amd_hw_ip_block_type { | ||
1551 | MAX_HWIP | ||
1552 | }; | ||
1553 | |||
1554 | -#define HWIP_MAX_INSTANCE 8 | ||
1555 | +#define HWIP_MAX_INSTANCE 10 | ||
1556 | |||
1557 | struct amd_powerplay { | ||
1558 | void *pp_handle; | ||
1559 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c | ||
1560 | index 70dbe343f51df..89cecdba81ace 100644 | ||
1561 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c | ||
1562 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c | ||
1563 | @@ -339,7 +339,7 @@ static void amdgpu_i2c_put_byte(struct amdgpu_i2c_chan *i2c_bus, | ||
1564 | void | ||
1565 | amdgpu_i2c_router_select_ddc_port(const struct amdgpu_connector *amdgpu_connector) | ||
1566 | { | ||
1567 | - u8 val; | ||
1568 | + u8 val = 0; | ||
1569 | |||
1570 | if (!amdgpu_connector->router.ddc_valid) | ||
1571 | return; | ||
1572 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | ||
1573 | index 28361a9c5addc..532d1842f6a30 100644 | ||
1574 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | ||
1575 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | ||
1576 | @@ -200,7 +200,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) | ||
1577 | c++; | ||
1578 | } | ||
1579 | |||
1580 | - BUG_ON(c >= AMDGPU_BO_MAX_PLACEMENTS); | ||
1581 | + BUG_ON(c > AMDGPU_BO_MAX_PLACEMENTS); | ||
1582 | |||
1583 | placement->num_placement = c; | ||
1584 | placement->placement = places; | ||
1585 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | ||
1586 | index 8a32b5c93778b..bd7ae3e130b6f 100644 | ||
1587 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | ||
1588 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | ||
1589 | @@ -138,7 +138,7 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control) | ||
1590 | return ret; | ||
1591 | } | ||
1592 | |||
1593 | - __decode_table_header_from_buff(hdr, &buff[2]); | ||
1594 | + __decode_table_header_from_buff(hdr, buff); | ||
1595 | |||
1596 | if (hdr->header == EEPROM_TABLE_HDR_VAL) { | ||
1597 | control->num_recs = (hdr->tbl_size - EEPROM_TABLE_HEADER_SIZE) / | ||
1598 | diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c | ||
1599 | index 88813dad731fa..c021519af8106 100644 | ||
1600 | --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c | ||
1601 | +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c | ||
1602 | @@ -98,36 +98,78 @@ void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm, | ||
1603 | uint32_t *se_mask) | ||
1604 | { | ||
1605 | struct kfd_cu_info cu_info; | ||
1606 | - uint32_t cu_per_se[KFD_MAX_NUM_SE] = {0}; | ||
1607 | - int i, se, sh, cu = 0; | ||
1608 | - | ||
1609 | + uint32_t cu_per_sh[KFD_MAX_NUM_SE][KFD_MAX_NUM_SH_PER_SE] = {0}; | ||
1610 | + int i, se, sh, cu; | ||
1611 | amdgpu_amdkfd_get_cu_info(mm->dev->kgd, &cu_info); | ||
1612 | |||
1613 | if (cu_mask_count > cu_info.cu_active_number) | ||
1614 | cu_mask_count = cu_info.cu_active_number; | ||
1615 | |||
1616 | + /* Exceeding these bounds corrupts the stack and indicates a coding error. | ||
1617 | + * Returning with no CU's enabled will hang the queue, which should be | ||
1618 | + * attention grabbing. | ||
1619 | + */ | ||
1620 | + if (cu_info.num_shader_engines > KFD_MAX_NUM_SE) { | ||
1621 | + pr_err("Exceeded KFD_MAX_NUM_SE, chip reports %d\n", cu_info.num_shader_engines); | ||
1622 | + return; | ||
1623 | + } | ||
1624 | + if (cu_info.num_shader_arrays_per_engine > KFD_MAX_NUM_SH_PER_SE) { | ||
1625 | + pr_err("Exceeded KFD_MAX_NUM_SH, chip reports %d\n", | ||
1626 | + cu_info.num_shader_arrays_per_engine * cu_info.num_shader_engines); | ||
1627 | + return; | ||
1628 | + } | ||
1629 | + /* Count active CUs per SH. | ||
1630 | + * | ||
1631 | + * Some CUs in an SH may be disabled. HW expects disabled CUs to be | ||
1632 | + * represented in the high bits of each SH's enable mask (the upper and lower | ||
1633 | + * 16 bits of se_mask) and will take care of the actual distribution of | ||
1634 | + * disabled CUs within each SH automatically. | ||
1635 | + * Each half of se_mask must be filled only on bits 0-cu_per_sh[se][sh]-1. | ||
1636 | + * | ||
1637 | + * See note on Arcturus cu_bitmap layout in gfx_v9_0_get_cu_info. | ||
1638 | + */ | ||
1639 | for (se = 0; se < cu_info.num_shader_engines; se++) | ||
1640 | for (sh = 0; sh < cu_info.num_shader_arrays_per_engine; sh++) | ||
1641 | - cu_per_se[se] += hweight32(cu_info.cu_bitmap[se % 4][sh + (se / 4)]); | ||
1642 | - | ||
1643 | - /* Symmetrically map cu_mask to all SEs: | ||
1644 | - * cu_mask[0] bit0 -> se_mask[0] bit0; | ||
1645 | - * cu_mask[0] bit1 -> se_mask[1] bit0; | ||
1646 | - * ... (if # SE is 4) | ||
1647 | - * cu_mask[0] bit4 -> se_mask[0] bit1; | ||
1648 | + cu_per_sh[se][sh] = hweight32(cu_info.cu_bitmap[se % 4][sh + (se / 4)]); | ||
1649 | + | ||
1650 | + /* Symmetrically map cu_mask to all SEs & SHs: | ||
1651 | + * se_mask programs up to 2 SH in the upper and lower 16 bits. | ||
1652 | + * | ||
1653 | + * Examples | ||
1654 | + * Assuming 1 SH/SE, 4 SEs: | ||
1655 | + * cu_mask[0] bit0 -> se_mask[0] bit0 | ||
1656 | + * cu_mask[0] bit1 -> se_mask[1] bit0 | ||
1657 | + * ... | ||
1658 | + * cu_mask[0] bit4 -> se_mask[0] bit1 | ||
1659 | + * ... | ||
1660 | + * | ||
1661 | + * Assuming 2 SH/SE, 4 SEs | ||
1662 | + * cu_mask[0] bit0 -> se_mask[0] bit0 (SE0,SH0,CU0) | ||
1663 | + * cu_mask[0] bit1 -> se_mask[1] bit0 (SE1,SH0,CU0) | ||
1664 | + * ... | ||
1665 | + * cu_mask[0] bit4 -> se_mask[0] bit16 (SE0,SH1,CU0) | ||
1666 | + * cu_mask[0] bit5 -> se_mask[1] bit16 (SE1,SH1,CU0) | ||
1667 | + * ... | ||
1668 | + * cu_mask[0] bit8 -> se_mask[0] bit1 (SE0,SH0,CU1) | ||
1669 | * ... | ||
1670 | + * | ||
1671 | + * First ensure all CUs are disabled, then enable user specified CUs. | ||
1672 | */ | ||
1673 | - se = 0; | ||
1674 | - for (i = 0; i < cu_mask_count; i++) { | ||
1675 | - if (cu_mask[i / 32] & (1 << (i % 32))) | ||
1676 | - se_mask[se] |= 1 << cu; | ||
1677 | - | ||
1678 | - do { | ||
1679 | - se++; | ||
1680 | - if (se == cu_info.num_shader_engines) { | ||
1681 | - se = 0; | ||
1682 | - cu++; | ||
1683 | + for (i = 0; i < cu_info.num_shader_engines; i++) | ||
1684 | + se_mask[i] = 0; | ||
1685 | + | ||
1686 | + i = 0; | ||
1687 | + for (cu = 0; cu < 16; cu++) { | ||
1688 | + for (sh = 0; sh < cu_info.num_shader_arrays_per_engine; sh++) { | ||
1689 | + for (se = 0; se < cu_info.num_shader_engines; se++) { | ||
1690 | + if (cu_per_sh[se][sh] > cu) { | ||
1691 | + if (cu_mask[i / 32] & (1 << (i % 32))) | ||
1692 | + se_mask[se] |= 1 << (cu + sh * 16); | ||
1693 | + i++; | ||
1694 | + if (i == cu_mask_count) | ||
1695 | + return; | ||
1696 | + } | ||
1697 | } | ||
1698 | - } while (cu >= cu_per_se[se] && cu < 32); | ||
1699 | + } | ||
1700 | } | ||
1701 | } | ||
1702 | diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h | ||
1703 | index fbdb16418847c..4edc012e31387 100644 | ||
1704 | --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h | ||
1705 | +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h | ||
1706 | @@ -27,6 +27,7 @@ | ||
1707 | #include "kfd_priv.h" | ||
1708 | |||
1709 | #define KFD_MAX_NUM_SE 8 | ||
1710 | +#define KFD_MAX_NUM_SH_PER_SE 2 | ||
1711 | |||
1712 | /** | ||
1713 | * struct mqd_manager | ||
1714 | diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | ||
1715 | index f3dfb2887ae0b..2cdcefab2d7d4 100644 | ||
1716 | --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | ||
1717 | +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | ||
1718 | @@ -95,29 +95,29 @@ static ssize_t dp_link_settings_read(struct file *f, char __user *buf, | ||
1719 | |||
1720 | rd_buf_ptr = rd_buf; | ||
1721 | |||
1722 | - str_len = strlen("Current: %d %d %d "); | ||
1723 | - snprintf(rd_buf_ptr, str_len, "Current: %d %d %d ", | ||
1724 | + str_len = strlen("Current: %d 0x%x %d "); | ||
1725 | + snprintf(rd_buf_ptr, str_len, "Current: %d 0x%x %d ", | ||
1726 | link->cur_link_settings.lane_count, | ||
1727 | link->cur_link_settings.link_rate, | ||
1728 | link->cur_link_settings.link_spread); | ||
1729 | rd_buf_ptr += str_len; | ||
1730 | |||
1731 | - str_len = strlen("Verified: %d %d %d "); | ||
1732 | - snprintf(rd_buf_ptr, str_len, "Verified: %d %d %d ", | ||
1733 | + str_len = strlen("Verified: %d 0x%x %d "); | ||
1734 | + snprintf(rd_buf_ptr, str_len, "Verified: %d 0x%x %d ", | ||
1735 | link->verified_link_cap.lane_count, | ||
1736 | link->verified_link_cap.link_rate, | ||
1737 | link->verified_link_cap.link_spread); | ||
1738 | rd_buf_ptr += str_len; | ||
1739 | |||
1740 | - str_len = strlen("Reported: %d %d %d "); | ||
1741 | - snprintf(rd_buf_ptr, str_len, "Reported: %d %d %d ", | ||
1742 | + str_len = strlen("Reported: %d 0x%x %d "); | ||
1743 | + snprintf(rd_buf_ptr, str_len, "Reported: %d 0x%x %d ", | ||
1744 | link->reported_link_cap.lane_count, | ||
1745 | link->reported_link_cap.link_rate, | ||
1746 | link->reported_link_cap.link_spread); | ||
1747 | rd_buf_ptr += str_len; | ||
1748 | |||
1749 | - str_len = strlen("Preferred: %d %d %d "); | ||
1750 | - snprintf(rd_buf_ptr, str_len, "Preferred: %d %d %d\n", | ||
1751 | + str_len = strlen("Preferred: %d 0x%x %d "); | ||
1752 | + snprintf(rd_buf_ptr, str_len, "Preferred: %d 0x%x %d\n", | ||
1753 | link->preferred_link_setting.lane_count, | ||
1754 | link->preferred_link_setting.link_rate, | ||
1755 | link->preferred_link_setting.link_spread); | ||
1756 | diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | ||
1757 | index 60123db7ba02f..bc5ebea1abede 100644 | ||
1758 | --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | ||
1759 | +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | ||
1760 | @@ -3264,13 +3264,12 @@ static enum dc_status dcn10_set_clock(struct dc *dc, | ||
1761 | struct dc_clock_config clock_cfg = {0}; | ||
1762 | struct dc_clocks *current_clocks = &context->bw_ctx.bw.dcn.clk; | ||
1763 | |||
1764 | - if (dc->clk_mgr && dc->clk_mgr->funcs->get_clock) | ||
1765 | - dc->clk_mgr->funcs->get_clock(dc->clk_mgr, | ||
1766 | - context, clock_type, &clock_cfg); | ||
1767 | - | ||
1768 | - if (!dc->clk_mgr->funcs->get_clock) | ||
1769 | + if (!dc->clk_mgr || !dc->clk_mgr->funcs->get_clock) | ||
1770 | return DC_FAIL_UNSUPPORTED_1; | ||
1771 | |||
1772 | + dc->clk_mgr->funcs->get_clock(dc->clk_mgr, | ||
1773 | + context, clock_type, &clock_cfg); | ||
1774 | + | ||
1775 | if (clk_khz > clock_cfg.max_clock_khz) | ||
1776 | return DC_FAIL_CLK_EXCEED_MAX; | ||
1777 | |||
1778 | @@ -3288,7 +3287,7 @@ static enum dc_status dcn10_set_clock(struct dc *dc, | ||
1779 | else | ||
1780 | return DC_ERROR_UNEXPECTED; | ||
1781 | |||
1782 | - if (dc->clk_mgr && dc->clk_mgr->funcs->update_clocks) | ||
1783 | + if (dc->clk_mgr->funcs->update_clocks) | ||
1784 | dc->clk_mgr->funcs->update_clocks(dc->clk_mgr, | ||
1785 | context, true); | ||
1786 | return DC_OK; | ||
1787 | diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | ||
1788 | index 2b1175bb2daee..d2ea4c003d442 100644 | ||
1789 | --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | ||
1790 | +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | ||
1791 | @@ -2232,7 +2232,7 @@ void dcn20_set_mcif_arb_params( | ||
1792 | wb_arb_params->cli_watermark[k] = get_wm_writeback_urgent(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000; | ||
1793 | wb_arb_params->pstate_watermark[k] = get_wm_writeback_dram_clock_change(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000; | ||
1794 | } | ||
1795 | - wb_arb_params->time_per_pixel = 16.0 / context->res_ctx.pipe_ctx[i].stream->phy_pix_clk; /* 4 bit fraction, ms */ | ||
1796 | + wb_arb_params->time_per_pixel = 16.0 * 1000 / (context->res_ctx.pipe_ctx[i].stream->phy_pix_clk / 1000); /* 4 bit fraction, ms */ | ||
1797 | wb_arb_params->slice_lines = 32; | ||
1798 | wb_arb_params->arbitration_slice = 2; | ||
1799 | wb_arb_params->max_scaled_time = dcn20_calc_max_scaled_time(wb_arb_params->time_per_pixel, | ||
1800 | diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c | ||
1801 | index 00debd02c3220..0ba92428ef560 100644 | ||
1802 | --- a/drivers/gpu/drm/drm_debugfs.c | ||
1803 | +++ b/drivers/gpu/drm/drm_debugfs.c | ||
1804 | @@ -91,6 +91,7 @@ static int drm_clients_info(struct seq_file *m, void *data) | ||
1805 | mutex_lock(&dev->filelist_mutex); | ||
1806 | list_for_each_entry_reverse(priv, &dev->filelist, lhead) { | ||
1807 | struct task_struct *task; | ||
1808 | + bool is_current_master = drm_is_current_master(priv); | ||
1809 | |||
1810 | rcu_read_lock(); /* locks pid_task()->comm */ | ||
1811 | task = pid_task(priv->pid, PIDTYPE_PID); | ||
1812 | @@ -99,7 +100,7 @@ static int drm_clients_info(struct seq_file *m, void *data) | ||
1813 | task ? task->comm : "<unknown>", | ||
1814 | pid_vnr(priv->pid), | ||
1815 | priv->minor->index, | ||
1816 | - drm_is_current_master(priv) ? 'y' : 'n', | ||
1817 | + is_current_master ? 'y' : 'n', | ||
1818 | priv->authenticated ? 'y' : 'n', | ||
1819 | from_kuid_munged(seq_user_ns(m), uid), | ||
1820 | priv->magic); | ||
1821 | diff --git a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c | ||
1822 | index 0c9c40720ca9a..35225ff8792dd 100644 | ||
1823 | --- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c | ||
1824 | +++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c | ||
1825 | @@ -397,8 +397,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state, | ||
1826 | if (switch_mmu_context) { | ||
1827 | struct etnaviv_iommu_context *old_context = gpu->mmu_context; | ||
1828 | |||
1829 | - etnaviv_iommu_context_get(mmu_context); | ||
1830 | - gpu->mmu_context = mmu_context; | ||
1831 | + gpu->mmu_context = etnaviv_iommu_context_get(mmu_context); | ||
1832 | etnaviv_iommu_context_put(old_context); | ||
1833 | } | ||
1834 | |||
1835 | diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c | ||
1836 | index cb1faaac380a3..519948637186e 100644 | ||
1837 | --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c | ||
1838 | +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c | ||
1839 | @@ -304,8 +304,7 @@ struct etnaviv_vram_mapping *etnaviv_gem_mapping_get( | ||
1840 | list_del(&mapping->obj_node); | ||
1841 | } | ||
1842 | |||
1843 | - etnaviv_iommu_context_get(mmu_context); | ||
1844 | - mapping->context = mmu_context; | ||
1845 | + mapping->context = etnaviv_iommu_context_get(mmu_context); | ||
1846 | mapping->use = 1; | ||
1847 | |||
1848 | ret = etnaviv_iommu_map_gem(mmu_context, etnaviv_obj, | ||
1849 | diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | ||
1850 | index 1ba83a90cdef6..7085b08b1db42 100644 | ||
1851 | --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | ||
1852 | +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | ||
1853 | @@ -534,8 +534,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, | ||
1854 | goto err_submit_objects; | ||
1855 | |||
1856 | submit->ctx = file->driver_priv; | ||
1857 | - etnaviv_iommu_context_get(submit->ctx->mmu); | ||
1858 | - submit->mmu_context = submit->ctx->mmu; | ||
1859 | + submit->mmu_context = etnaviv_iommu_context_get(submit->ctx->mmu); | ||
1860 | submit->exec_state = args->exec_state; | ||
1861 | submit->flags = args->flags; | ||
1862 | |||
1863 | diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c | ||
1864 | index 85de8551ce866..db35736d47af2 100644 | ||
1865 | --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c | ||
1866 | +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c | ||
1867 | @@ -545,6 +545,12 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu) | ||
1868 | /* We rely on the GPU running, so program the clock */ | ||
1869 | etnaviv_gpu_update_clock(gpu); | ||
1870 | |||
1871 | + gpu->fe_running = false; | ||
1872 | + gpu->exec_state = -1; | ||
1873 | + if (gpu->mmu_context) | ||
1874 | + etnaviv_iommu_context_put(gpu->mmu_context); | ||
1875 | + gpu->mmu_context = NULL; | ||
1876 | + | ||
1877 | return 0; | ||
1878 | } | ||
1879 | |||
1880 | @@ -607,19 +613,23 @@ void etnaviv_gpu_start_fe(struct etnaviv_gpu *gpu, u32 address, u16 prefetch) | ||
1881 | VIVS_MMUv2_SEC_COMMAND_CONTROL_ENABLE | | ||
1882 | VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH(prefetch)); | ||
1883 | } | ||
1884 | + | ||
1885 | + gpu->fe_running = true; | ||
1886 | } | ||
1887 | |||
1888 | -static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu) | ||
1889 | +static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu, | ||
1890 | + struct etnaviv_iommu_context *context) | ||
1891 | { | ||
1892 | - u32 address = etnaviv_cmdbuf_get_va(&gpu->buffer, | ||
1893 | - &gpu->mmu_context->cmdbuf_mapping); | ||
1894 | u16 prefetch; | ||
1895 | + u32 address; | ||
1896 | |||
1897 | /* setup the MMU */ | ||
1898 | - etnaviv_iommu_restore(gpu, gpu->mmu_context); | ||
1899 | + etnaviv_iommu_restore(gpu, context); | ||
1900 | |||
1901 | /* Start command processor */ | ||
1902 | prefetch = etnaviv_buffer_init(gpu); | ||
1903 | + address = etnaviv_cmdbuf_get_va(&gpu->buffer, | ||
1904 | + &gpu->mmu_context->cmdbuf_mapping); | ||
1905 | |||
1906 | etnaviv_gpu_start_fe(gpu, address, prefetch); | ||
1907 | } | ||
1908 | @@ -790,7 +800,6 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) | ||
1909 | /* Now program the hardware */ | ||
1910 | mutex_lock(&gpu->lock); | ||
1911 | etnaviv_gpu_hw_init(gpu); | ||
1912 | - gpu->exec_state = -1; | ||
1913 | mutex_unlock(&gpu->lock); | ||
1914 | |||
1915 | pm_runtime_mark_last_busy(gpu->dev); | ||
1916 | @@ -994,8 +1003,6 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu) | ||
1917 | spin_unlock(&gpu->event_spinlock); | ||
1918 | |||
1919 | etnaviv_gpu_hw_init(gpu); | ||
1920 | - gpu->exec_state = -1; | ||
1921 | - gpu->mmu_context = NULL; | ||
1922 | |||
1923 | mutex_unlock(&gpu->lock); | ||
1924 | pm_runtime_mark_last_busy(gpu->dev); | ||
1925 | @@ -1306,14 +1313,12 @@ struct dma_fence *etnaviv_gpu_submit(struct etnaviv_gem_submit *submit) | ||
1926 | goto out_unlock; | ||
1927 | } | ||
1928 | |||
1929 | - if (!gpu->mmu_context) { | ||
1930 | - etnaviv_iommu_context_get(submit->mmu_context); | ||
1931 | - gpu->mmu_context = submit->mmu_context; | ||
1932 | - etnaviv_gpu_start_fe_idleloop(gpu); | ||
1933 | - } else { | ||
1934 | - etnaviv_iommu_context_get(gpu->mmu_context); | ||
1935 | - submit->prev_mmu_context = gpu->mmu_context; | ||
1936 | - } | ||
1937 | + if (!gpu->fe_running) | ||
1938 | + etnaviv_gpu_start_fe_idleloop(gpu, submit->mmu_context); | ||
1939 | + | ||
1940 | + if (submit->prev_mmu_context) | ||
1941 | + etnaviv_iommu_context_put(submit->prev_mmu_context); | ||
1942 | + submit->prev_mmu_context = etnaviv_iommu_context_get(gpu->mmu_context); | ||
1943 | |||
1944 | if (submit->nr_pmrs) { | ||
1945 | gpu->event[event[1]].sync_point = &sync_point_perfmon_sample_pre; | ||
1946 | @@ -1530,7 +1535,7 @@ int etnaviv_gpu_wait_idle(struct etnaviv_gpu *gpu, unsigned int timeout_ms) | ||
1947 | |||
1948 | static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu) | ||
1949 | { | ||
1950 | - if (gpu->initialized && gpu->mmu_context) { | ||
1951 | + if (gpu->initialized && gpu->fe_running) { | ||
1952 | /* Replace the last WAIT with END */ | ||
1953 | mutex_lock(&gpu->lock); | ||
1954 | etnaviv_buffer_end(gpu); | ||
1955 | @@ -1543,8 +1548,7 @@ static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu) | ||
1956 | */ | ||
1957 | etnaviv_gpu_wait_idle(gpu, 100); | ||
1958 | |||
1959 | - etnaviv_iommu_context_put(gpu->mmu_context); | ||
1960 | - gpu->mmu_context = NULL; | ||
1961 | + gpu->fe_running = false; | ||
1962 | } | ||
1963 | |||
1964 | gpu->exec_state = -1; | ||
1965 | @@ -1692,6 +1696,9 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master, | ||
1966 | etnaviv_gpu_hw_suspend(gpu); | ||
1967 | #endif | ||
1968 | |||
1969 | + if (gpu->mmu_context) | ||
1970 | + etnaviv_iommu_context_put(gpu->mmu_context); | ||
1971 | + | ||
1972 | if (gpu->initialized) { | ||
1973 | etnaviv_cmdbuf_free(&gpu->buffer); | ||
1974 | etnaviv_iommu_global_fini(gpu); | ||
1975 | diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h | ||
1976 | index 8f9bd4edc96a5..02478c75f8968 100644 | ||
1977 | --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h | ||
1978 | +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h | ||
1979 | @@ -101,6 +101,7 @@ struct etnaviv_gpu { | ||
1980 | struct workqueue_struct *wq; | ||
1981 | struct drm_gpu_scheduler sched; | ||
1982 | bool initialized; | ||
1983 | + bool fe_running; | ||
1984 | |||
1985 | /* 'ring'-buffer: */ | ||
1986 | struct etnaviv_cmdbuf buffer; | ||
1987 | diff --git a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c | ||
1988 | index 1a7c89a67bea3..afe5dd6a9925b 100644 | ||
1989 | --- a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c | ||
1990 | +++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c | ||
1991 | @@ -92,6 +92,10 @@ static void etnaviv_iommuv1_restore(struct etnaviv_gpu *gpu, | ||
1992 | struct etnaviv_iommuv1_context *v1_context = to_v1_context(context); | ||
1993 | u32 pgtable; | ||
1994 | |||
1995 | + if (gpu->mmu_context) | ||
1996 | + etnaviv_iommu_context_put(gpu->mmu_context); | ||
1997 | + gpu->mmu_context = etnaviv_iommu_context_get(context); | ||
1998 | + | ||
1999 | /* set base addresses */ | ||
2000 | gpu_write(gpu, VIVS_MC_MEMORY_BASE_ADDR_RA, context->global->memory_base); | ||
2001 | gpu_write(gpu, VIVS_MC_MEMORY_BASE_ADDR_FE, context->global->memory_base); | ||
2002 | diff --git a/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c b/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c | ||
2003 | index f8bf488e9d717..d664ae29ae209 100644 | ||
2004 | --- a/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c | ||
2005 | +++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c | ||
2006 | @@ -172,6 +172,10 @@ static void etnaviv_iommuv2_restore_nonsec(struct etnaviv_gpu *gpu, | ||
2007 | if (gpu_read(gpu, VIVS_MMUv2_CONTROL) & VIVS_MMUv2_CONTROL_ENABLE) | ||
2008 | return; | ||
2009 | |||
2010 | + if (gpu->mmu_context) | ||
2011 | + etnaviv_iommu_context_put(gpu->mmu_context); | ||
2012 | + gpu->mmu_context = etnaviv_iommu_context_get(context); | ||
2013 | + | ||
2014 | prefetch = etnaviv_buffer_config_mmuv2(gpu, | ||
2015 | (u32)v2_context->mtlb_dma, | ||
2016 | (u32)context->global->bad_page_dma); | ||
2017 | @@ -192,6 +196,10 @@ static void etnaviv_iommuv2_restore_sec(struct etnaviv_gpu *gpu, | ||
2018 | if (gpu_read(gpu, VIVS_MMUv2_SEC_CONTROL) & VIVS_MMUv2_SEC_CONTROL_ENABLE) | ||
2019 | return; | ||
2020 | |||
2021 | + if (gpu->mmu_context) | ||
2022 | + etnaviv_iommu_context_put(gpu->mmu_context); | ||
2023 | + gpu->mmu_context = etnaviv_iommu_context_get(context); | ||
2024 | + | ||
2025 | gpu_write(gpu, VIVS_MMUv2_PTA_ADDRESS_LOW, | ||
2026 | lower_32_bits(context->global->v2.pta_dma)); | ||
2027 | gpu_write(gpu, VIVS_MMUv2_PTA_ADDRESS_HIGH, | ||
2028 | diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c | ||
2029 | index 3607d348c2980..707f5c1a58740 100644 | ||
2030 | --- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c | ||
2031 | +++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c | ||
2032 | @@ -204,6 +204,7 @@ static int etnaviv_iommu_find_iova(struct etnaviv_iommu_context *context, | ||
2033 | */ | ||
2034 | list_for_each_entry_safe(m, n, &list, scan_node) { | ||
2035 | etnaviv_iommu_remove_mapping(context, m); | ||
2036 | + etnaviv_iommu_context_put(m->context); | ||
2037 | m->context = NULL; | ||
2038 | list_del_init(&m->mmu_node); | ||
2039 | list_del_init(&m->scan_node); | ||
2040 | diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.h b/drivers/gpu/drm/etnaviv/etnaviv_mmu.h | ||
2041 | index d1d6902fd13be..e4a0b7d09c2ea 100644 | ||
2042 | --- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.h | ||
2043 | +++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.h | ||
2044 | @@ -105,9 +105,11 @@ void etnaviv_iommu_dump(struct etnaviv_iommu_context *ctx, void *buf); | ||
2045 | struct etnaviv_iommu_context * | ||
2046 | etnaviv_iommu_context_init(struct etnaviv_iommu_global *global, | ||
2047 | struct etnaviv_cmdbuf_suballoc *suballoc); | ||
2048 | -static inline void etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx) | ||
2049 | +static inline struct etnaviv_iommu_context * | ||
2050 | +etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx) | ||
2051 | { | ||
2052 | kref_get(&ctx->refcount); | ||
2053 | + return ctx; | ||
2054 | } | ||
2055 | void etnaviv_iommu_context_put(struct etnaviv_iommu_context *ctx); | ||
2056 | void etnaviv_iommu_restore(struct etnaviv_gpu *gpu, | ||
2057 | diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c b/drivers/gpu/drm/exynos/exynos_drm_dma.c | ||
2058 | index 58b89ec11b0eb..a3c9d8b9e1a18 100644 | ||
2059 | --- a/drivers/gpu/drm/exynos/exynos_drm_dma.c | ||
2060 | +++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c | ||
2061 | @@ -140,6 +140,8 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev, | ||
2062 | EXYNOS_DEV_ADDR_START, EXYNOS_DEV_ADDR_SIZE); | ||
2063 | else if (IS_ENABLED(CONFIG_IOMMU_DMA)) | ||
2064 | mapping = iommu_get_domain_for_dev(priv->dma_dev); | ||
2065 | + else | ||
2066 | + mapping = ERR_PTR(-ENODEV); | ||
2067 | |||
2068 | if (IS_ERR(mapping)) | ||
2069 | return PTR_ERR(mapping); | ||
2070 | diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | ||
2071 | index 20194d86d0339..4f0c6d58e06fa 100644 | ||
2072 | --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | ||
2073 | +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | ||
2074 | @@ -108,13 +108,6 @@ static void mdp4_disable_commit(struct msm_kms *kms) | ||
2075 | |||
2076 | static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *state) | ||
2077 | { | ||
2078 | - int i; | ||
2079 | - struct drm_crtc *crtc; | ||
2080 | - struct drm_crtc_state *crtc_state; | ||
2081 | - | ||
2082 | - /* see 119ecb7fd */ | ||
2083 | - for_each_new_crtc_in_state(state, crtc, crtc_state, i) | ||
2084 | - drm_crtc_vblank_get(crtc); | ||
2085 | } | ||
2086 | |||
2087 | static void mdp4_flush_commit(struct msm_kms *kms, unsigned crtc_mask) | ||
2088 | @@ -133,12 +126,6 @@ static void mdp4_wait_flush(struct msm_kms *kms, unsigned crtc_mask) | ||
2089 | |||
2090 | static void mdp4_complete_commit(struct msm_kms *kms, unsigned crtc_mask) | ||
2091 | { | ||
2092 | - struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms)); | ||
2093 | - struct drm_crtc *crtc; | ||
2094 | - | ||
2095 | - /* see 119ecb7fd */ | ||
2096 | - for_each_crtc_mask(mdp4_kms->dev, crtc, crtc_mask) | ||
2097 | - drm_crtc_vblank_put(crtc); | ||
2098 | } | ||
2099 | |||
2100 | static long mdp4_round_pixclk(struct msm_kms *kms, unsigned long rate, | ||
2101 | @@ -418,6 +405,7 @@ struct msm_kms *mdp4_kms_init(struct drm_device *dev) | ||
2102 | { | ||
2103 | struct platform_device *pdev = to_platform_device(dev->dev); | ||
2104 | struct mdp4_platform_config *config = mdp4_get_config(pdev); | ||
2105 | + struct msm_drm_private *priv = dev->dev_private; | ||
2106 | struct mdp4_kms *mdp4_kms; | ||
2107 | struct msm_kms *kms = NULL; | ||
2108 | struct msm_gem_address_space *aspace; | ||
2109 | @@ -432,7 +420,8 @@ struct msm_kms *mdp4_kms_init(struct drm_device *dev) | ||
2110 | |||
2111 | mdp_kms_init(&mdp4_kms->base, &kms_funcs); | ||
2112 | |||
2113 | - kms = &mdp4_kms->base.base; | ||
2114 | + priv->kms = &mdp4_kms->base.base; | ||
2115 | + kms = priv->kms; | ||
2116 | |||
2117 | mdp4_kms->dev = dev; | ||
2118 | |||
2119 | diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c | ||
2120 | index bfd503d220881..8a014dc115712 100644 | ||
2121 | --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c | ||
2122 | +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c | ||
2123 | @@ -52,25 +52,16 @@ static int write_cmd(struct panfrost_device *pfdev, u32 as_nr, u32 cmd) | ||
2124 | } | ||
2125 | |||
2126 | static void lock_region(struct panfrost_device *pfdev, u32 as_nr, | ||
2127 | - u64 iova, size_t size) | ||
2128 | + u64 iova, u64 size) | ||
2129 | { | ||
2130 | u8 region_width; | ||
2131 | u64 region = iova & PAGE_MASK; | ||
2132 | - /* | ||
2133 | - * fls returns: | ||
2134 | - * 1 .. 32 | ||
2135 | - * | ||
2136 | - * 10 + fls(num_pages) | ||
2137 | - * results in the range (11 .. 42) | ||
2138 | - */ | ||
2139 | - | ||
2140 | - size = round_up(size, PAGE_SIZE); | ||
2141 | |||
2142 | - region_width = 10 + fls(size >> PAGE_SHIFT); | ||
2143 | - if ((size >> PAGE_SHIFT) != (1ul << (region_width - 11))) { | ||
2144 | - /* not pow2, so must go up to the next pow2 */ | ||
2145 | - region_width += 1; | ||
2146 | - } | ||
2147 | + /* The size is encoded as ceil(log2) minus(1), which may be calculated | ||
2148 | + * with fls. The size must be clamped to hardware bounds. | ||
2149 | + */ | ||
2150 | + size = max_t(u64, size, AS_LOCK_REGION_MIN_SIZE); | ||
2151 | + region_width = fls64(size - 1) - 1; | ||
2152 | region |= region_width; | ||
2153 | |||
2154 | /* Lock the region that needs to be updated */ | ||
2155 | @@ -81,7 +72,7 @@ static void lock_region(struct panfrost_device *pfdev, u32 as_nr, | ||
2156 | |||
2157 | |||
2158 | static int mmu_hw_do_operation_locked(struct panfrost_device *pfdev, int as_nr, | ||
2159 | - u64 iova, size_t size, u32 op) | ||
2160 | + u64 iova, u64 size, u32 op) | ||
2161 | { | ||
2162 | if (as_nr < 0) | ||
2163 | return 0; | ||
2164 | @@ -98,7 +89,7 @@ static int mmu_hw_do_operation_locked(struct panfrost_device *pfdev, int as_nr, | ||
2165 | |||
2166 | static int mmu_hw_do_operation(struct panfrost_device *pfdev, | ||
2167 | struct panfrost_mmu *mmu, | ||
2168 | - u64 iova, size_t size, u32 op) | ||
2169 | + u64 iova, u64 size, u32 op) | ||
2170 | { | ||
2171 | int ret; | ||
2172 | |||
2173 | @@ -115,7 +106,7 @@ static void panfrost_mmu_enable(struct panfrost_device *pfdev, struct panfrost_m | ||
2174 | u64 transtab = cfg->arm_mali_lpae_cfg.transtab; | ||
2175 | u64 memattr = cfg->arm_mali_lpae_cfg.memattr; | ||
2176 | |||
2177 | - mmu_hw_do_operation_locked(pfdev, as_nr, 0, ~0UL, AS_COMMAND_FLUSH_MEM); | ||
2178 | + mmu_hw_do_operation_locked(pfdev, as_nr, 0, ~0ULL, AS_COMMAND_FLUSH_MEM); | ||
2179 | |||
2180 | mmu_write(pfdev, AS_TRANSTAB_LO(as_nr), transtab & 0xffffffffUL); | ||
2181 | mmu_write(pfdev, AS_TRANSTAB_HI(as_nr), transtab >> 32); | ||
2182 | @@ -131,7 +122,7 @@ static void panfrost_mmu_enable(struct panfrost_device *pfdev, struct panfrost_m | ||
2183 | |||
2184 | static void panfrost_mmu_disable(struct panfrost_device *pfdev, u32 as_nr) | ||
2185 | { | ||
2186 | - mmu_hw_do_operation_locked(pfdev, as_nr, 0, ~0UL, AS_COMMAND_FLUSH_MEM); | ||
2187 | + mmu_hw_do_operation_locked(pfdev, as_nr, 0, ~0ULL, AS_COMMAND_FLUSH_MEM); | ||
2188 | |||
2189 | mmu_write(pfdev, AS_TRANSTAB_LO(as_nr), 0); | ||
2190 | mmu_write(pfdev, AS_TRANSTAB_HI(as_nr), 0); | ||
2191 | @@ -231,7 +222,7 @@ static size_t get_pgsize(u64 addr, size_t size) | ||
2192 | |||
2193 | static void panfrost_mmu_flush_range(struct panfrost_device *pfdev, | ||
2194 | struct panfrost_mmu *mmu, | ||
2195 | - u64 iova, size_t size) | ||
2196 | + u64 iova, u64 size) | ||
2197 | { | ||
2198 | if (mmu->as < 0) | ||
2199 | return; | ||
2200 | diff --git a/drivers/gpu/drm/panfrost/panfrost_regs.h b/drivers/gpu/drm/panfrost/panfrost_regs.h | ||
2201 | index eddaa62ad8b0e..2ae3a4d301d39 100644 | ||
2202 | --- a/drivers/gpu/drm/panfrost/panfrost_regs.h | ||
2203 | +++ b/drivers/gpu/drm/panfrost/panfrost_regs.h | ||
2204 | @@ -318,6 +318,8 @@ | ||
2205 | #define AS_FAULTSTATUS_ACCESS_TYPE_READ (0x2 << 8) | ||
2206 | #define AS_FAULTSTATUS_ACCESS_TYPE_WRITE (0x3 << 8) | ||
2207 | |||
2208 | +#define AS_LOCK_REGION_MIN_SIZE (1ULL << 15) | ||
2209 | + | ||
2210 | #define gpu_write(dev, reg, data) writel(data, dev->iomem + reg) | ||
2211 | #define gpu_read(dev, reg) readl(dev->iomem + reg) | ||
2212 | |||
2213 | diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c | ||
2214 | index 6d551ae251c0a..ea4c97f5b0736 100644 | ||
2215 | --- a/drivers/hid/hid-input.c | ||
2216 | +++ b/drivers/hid/hid-input.c | ||
2217 | @@ -415,8 +415,6 @@ static int hidinput_get_battery_property(struct power_supply *psy, | ||
2218 | |||
2219 | if (dev->battery_status == HID_BATTERY_UNKNOWN) | ||
2220 | val->intval = POWER_SUPPLY_STATUS_UNKNOWN; | ||
2221 | - else if (dev->battery_capacity == 100) | ||
2222 | - val->intval = POWER_SUPPLY_STATUS_FULL; | ||
2223 | else | ||
2224 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; | ||
2225 | break; | ||
2226 | diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c | ||
2227 | index 6f7a3702b5fba..ac076ac73de5d 100644 | ||
2228 | --- a/drivers/hid/i2c-hid/i2c-hid-core.c | ||
2229 | +++ b/drivers/hid/i2c-hid/i2c-hid-core.c | ||
2230 | @@ -178,8 +178,6 @@ static const struct i2c_hid_quirks { | ||
2231 | I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, | ||
2232 | { I2C_VENDOR_ID_RAYDIUM, I2C_PRODUCT_ID_RAYDIUM_3118, | ||
2233 | I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, | ||
2234 | - { USB_VENDOR_ID_ELAN, HID_ANY_ID, | ||
2235 | - I2C_HID_QUIRK_BOGUS_IRQ }, | ||
2236 | { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID, | ||
2237 | I2C_HID_QUIRK_RESET_ON_RESUME }, | ||
2238 | { I2C_VENDOR_ID_SYNAPTICS, I2C_PRODUCT_ID_SYNAPTICS_SYNA2393, | ||
2239 | @@ -190,7 +188,8 @@ static const struct i2c_hid_quirks { | ||
2240 | * Sending the wakeup after reset actually break ELAN touchscreen controller | ||
2241 | */ | ||
2242 | { USB_VENDOR_ID_ELAN, HID_ANY_ID, | ||
2243 | - I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET }, | ||
2244 | + I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET | | ||
2245 | + I2C_HID_QUIRK_BOGUS_IRQ }, | ||
2246 | { 0, 0 } | ||
2247 | }; | ||
2248 | |||
2249 | diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c | ||
2250 | index e6c022e1dc1cf..17cc8b3fc5d82 100644 | ||
2251 | --- a/drivers/iio/dac/ad5624r_spi.c | ||
2252 | +++ b/drivers/iio/dac/ad5624r_spi.c | ||
2253 | @@ -229,7 +229,7 @@ static int ad5624r_probe(struct spi_device *spi) | ||
2254 | if (!indio_dev) | ||
2255 | return -ENOMEM; | ||
2256 | st = iio_priv(indio_dev); | ||
2257 | - st->reg = devm_regulator_get(&spi->dev, "vcc"); | ||
2258 | + st->reg = devm_regulator_get_optional(&spi->dev, "vref"); | ||
2259 | if (!IS_ERR(st->reg)) { | ||
2260 | ret = regulator_enable(st->reg); | ||
2261 | if (ret) | ||
2262 | @@ -240,6 +240,22 @@ static int ad5624r_probe(struct spi_device *spi) | ||
2263 | goto error_disable_reg; | ||
2264 | |||
2265 | voltage_uv = ret; | ||
2266 | + } else { | ||
2267 | + if (PTR_ERR(st->reg) != -ENODEV) | ||
2268 | + return PTR_ERR(st->reg); | ||
2269 | + /* Backwards compatibility. This naming is not correct */ | ||
2270 | + st->reg = devm_regulator_get_optional(&spi->dev, "vcc"); | ||
2271 | + if (!IS_ERR(st->reg)) { | ||
2272 | + ret = regulator_enable(st->reg); | ||
2273 | + if (ret) | ||
2274 | + return ret; | ||
2275 | + | ||
2276 | + ret = regulator_get_voltage(st->reg); | ||
2277 | + if (ret < 0) | ||
2278 | + goto error_disable_reg; | ||
2279 | + | ||
2280 | + voltage_uv = ret; | ||
2281 | + } | ||
2282 | } | ||
2283 | |||
2284 | spi_set_drvdata(spi, indio_dev); | ||
2285 | diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c | ||
2286 | index da8adadf47559..75b6da00065a3 100644 | ||
2287 | --- a/drivers/infiniband/core/iwcm.c | ||
2288 | +++ b/drivers/infiniband/core/iwcm.c | ||
2289 | @@ -1187,29 +1187,34 @@ static int __init iw_cm_init(void) | ||
2290 | |||
2291 | ret = iwpm_init(RDMA_NL_IWCM); | ||
2292 | if (ret) | ||
2293 | - pr_err("iw_cm: couldn't init iwpm\n"); | ||
2294 | - else | ||
2295 | - rdma_nl_register(RDMA_NL_IWCM, iwcm_nl_cb_table); | ||
2296 | + return ret; | ||
2297 | + | ||
2298 | iwcm_wq = alloc_ordered_workqueue("iw_cm_wq", 0); | ||
2299 | if (!iwcm_wq) | ||
2300 | - return -ENOMEM; | ||
2301 | + goto err_alloc; | ||
2302 | |||
2303 | iwcm_ctl_table_hdr = register_net_sysctl(&init_net, "net/iw_cm", | ||
2304 | iwcm_ctl_table); | ||
2305 | if (!iwcm_ctl_table_hdr) { | ||
2306 | pr_err("iw_cm: couldn't register sysctl paths\n"); | ||
2307 | - destroy_workqueue(iwcm_wq); | ||
2308 | - return -ENOMEM; | ||
2309 | + goto err_sysctl; | ||
2310 | } | ||
2311 | |||
2312 | + rdma_nl_register(RDMA_NL_IWCM, iwcm_nl_cb_table); | ||
2313 | return 0; | ||
2314 | + | ||
2315 | +err_sysctl: | ||
2316 | + destroy_workqueue(iwcm_wq); | ||
2317 | +err_alloc: | ||
2318 | + iwpm_exit(RDMA_NL_IWCM); | ||
2319 | + return -ENOMEM; | ||
2320 | } | ||
2321 | |||
2322 | static void __exit iw_cm_cleanup(void) | ||
2323 | { | ||
2324 | + rdma_nl_unregister(RDMA_NL_IWCM); | ||
2325 | unregister_net_sysctl_table(iwcm_ctl_table_hdr); | ||
2326 | destroy_workqueue(iwcm_wq); | ||
2327 | - rdma_nl_unregister(RDMA_NL_IWCM); | ||
2328 | iwpm_exit(RDMA_NL_IWCM); | ||
2329 | } | ||
2330 | |||
2331 | diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c | ||
2332 | index 4edae89e8e3ca..17f1e59ab12ee 100644 | ||
2333 | --- a/drivers/infiniband/hw/efa/efa_verbs.c | ||
2334 | +++ b/drivers/infiniband/hw/efa/efa_verbs.c | ||
2335 | @@ -745,7 +745,6 @@ struct ib_qp *efa_create_qp(struct ib_pd *ibpd, | ||
2336 | rq_entry_inserted = true; | ||
2337 | qp->qp_handle = create_qp_resp.qp_handle; | ||
2338 | qp->ibqp.qp_num = create_qp_resp.qp_num; | ||
2339 | - qp->ibqp.qp_type = init_attr->qp_type; | ||
2340 | qp->max_send_wr = init_attr->cap.max_send_wr; | ||
2341 | qp->max_recv_wr = init_attr->cap.max_recv_wr; | ||
2342 | qp->max_send_sge = init_attr->cap.max_send_sge; | ||
2343 | diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c | ||
2344 | index fbff6b2f00e71..1256dbd5b2ef0 100644 | ||
2345 | --- a/drivers/infiniband/hw/hfi1/init.c | ||
2346 | +++ b/drivers/infiniband/hw/hfi1/init.c | ||
2347 | @@ -664,12 +664,7 @@ void hfi1_init_pportdata(struct pci_dev *pdev, struct hfi1_pportdata *ppd, | ||
2348 | |||
2349 | ppd->pkeys[default_pkey_idx] = DEFAULT_P_KEY; | ||
2350 | ppd->part_enforce |= HFI1_PART_ENFORCE_IN; | ||
2351 | - | ||
2352 | - if (loopback) { | ||
2353 | - dd_dev_err(dd, "Faking data partition 0x8001 in idx %u\n", | ||
2354 | - !default_pkey_idx); | ||
2355 | - ppd->pkeys[!default_pkey_idx] = 0x8001; | ||
2356 | - } | ||
2357 | + ppd->pkeys[0] = 0x8001; | ||
2358 | |||
2359 | INIT_WORK(&ppd->link_vc_work, handle_verify_cap); | ||
2360 | INIT_WORK(&ppd->link_up_work, handle_link_up); | ||
2361 | diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c | ||
2362 | index d85648b9c247a..571c04e70343a 100644 | ||
2363 | --- a/drivers/md/dm-crypt.c | ||
2364 | +++ b/drivers/md/dm-crypt.c | ||
2365 | @@ -2092,7 +2092,12 @@ static void *crypt_page_alloc(gfp_t gfp_mask, void *pool_data) | ||
2366 | struct crypt_config *cc = pool_data; | ||
2367 | struct page *page; | ||
2368 | |||
2369 | - if (unlikely(percpu_counter_compare(&cc->n_allocated_pages, dm_crypt_pages_per_client) >= 0) && | ||
2370 | + /* | ||
2371 | + * Note, percpu_counter_read_positive() may over (and under) estimate | ||
2372 | + * the current usage by at most (batch - 1) * num_online_cpus() pages, | ||
2373 | + * but avoids potential spinlock contention of an exact result. | ||
2374 | + */ | ||
2375 | + if (unlikely(percpu_counter_read_positive(&cc->n_allocated_pages) >= dm_crypt_pages_per_client) && | ||
2376 | likely(gfp_mask & __GFP_NORETRY)) | ||
2377 | return NULL; | ||
2378 | |||
2379 | diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c | ||
2380 | index 082796534b0ae..bb02354a48b81 100644 | ||
2381 | --- a/drivers/media/dvb-frontends/dib8000.c | ||
2382 | +++ b/drivers/media/dvb-frontends/dib8000.c | ||
2383 | @@ -2107,32 +2107,55 @@ static void dib8000_load_ana_fe_coefs(struct dib8000_state *state, const s16 *an | ||
2384 | dib8000_write_word(state, 117 + mode, ana_fe[mode]); | ||
2385 | } | ||
2386 | |||
2387 | -static const u16 lut_prbs_2k[14] = { | ||
2388 | - 0, 0x423, 0x009, 0x5C7, 0x7A6, 0x3D8, 0x527, 0x7FF, 0x79B, 0x3D6, 0x3A2, 0x53B, 0x2F4, 0x213 | ||
2389 | +static const u16 lut_prbs_2k[13] = { | ||
2390 | + 0x423, 0x009, 0x5C7, | ||
2391 | + 0x7A6, 0x3D8, 0x527, | ||
2392 | + 0x7FF, 0x79B, 0x3D6, | ||
2393 | + 0x3A2, 0x53B, 0x2F4, | ||
2394 | + 0x213 | ||
2395 | }; | ||
2396 | -static const u16 lut_prbs_4k[14] = { | ||
2397 | - 0, 0x208, 0x0C3, 0x7B9, 0x423, 0x5C7, 0x3D8, 0x7FF, 0x3D6, 0x53B, 0x213, 0x029, 0x0D0, 0x48E | ||
2398 | + | ||
2399 | +static const u16 lut_prbs_4k[13] = { | ||
2400 | + 0x208, 0x0C3, 0x7B9, | ||
2401 | + 0x423, 0x5C7, 0x3D8, | ||
2402 | + 0x7FF, 0x3D6, 0x53B, | ||
2403 | + 0x213, 0x029, 0x0D0, | ||
2404 | + 0x48E | ||
2405 | }; | ||
2406 | -static const u16 lut_prbs_8k[14] = { | ||
2407 | - 0, 0x740, 0x069, 0x7DD, 0x208, 0x7B9, 0x5C7, 0x7FF, 0x53B, 0x029, 0x48E, 0x4C4, 0x367, 0x684 | ||
2408 | + | ||
2409 | +static const u16 lut_prbs_8k[13] = { | ||
2410 | + 0x740, 0x069, 0x7DD, | ||
2411 | + 0x208, 0x7B9, 0x5C7, | ||
2412 | + 0x7FF, 0x53B, 0x029, | ||
2413 | + 0x48E, 0x4C4, 0x367, | ||
2414 | + 0x684 | ||
2415 | }; | ||
2416 | |||
2417 | static u16 dib8000_get_init_prbs(struct dib8000_state *state, u16 subchannel) | ||
2418 | { | ||
2419 | int sub_channel_prbs_group = 0; | ||
2420 | + int prbs_group; | ||
2421 | |||
2422 | - sub_channel_prbs_group = (subchannel / 3) + 1; | ||
2423 | - dprintk("sub_channel_prbs_group = %d , subchannel =%d prbs = 0x%04x\n", sub_channel_prbs_group, subchannel, lut_prbs_8k[sub_channel_prbs_group]); | ||
2424 | + sub_channel_prbs_group = subchannel / 3; | ||
2425 | + if (sub_channel_prbs_group >= ARRAY_SIZE(lut_prbs_2k)) | ||
2426 | + return 0; | ||
2427 | |||
2428 | switch (state->fe[0]->dtv_property_cache.transmission_mode) { | ||
2429 | case TRANSMISSION_MODE_2K: | ||
2430 | - return lut_prbs_2k[sub_channel_prbs_group]; | ||
2431 | + prbs_group = lut_prbs_2k[sub_channel_prbs_group]; | ||
2432 | + break; | ||
2433 | case TRANSMISSION_MODE_4K: | ||
2434 | - return lut_prbs_4k[sub_channel_prbs_group]; | ||
2435 | + prbs_group = lut_prbs_4k[sub_channel_prbs_group]; | ||
2436 | + break; | ||
2437 | default: | ||
2438 | case TRANSMISSION_MODE_8K: | ||
2439 | - return lut_prbs_8k[sub_channel_prbs_group]; | ||
2440 | + prbs_group = lut_prbs_8k[sub_channel_prbs_group]; | ||
2441 | } | ||
2442 | + | ||
2443 | + dprintk("sub_channel_prbs_group = %d , subchannel =%d prbs = 0x%04x\n", | ||
2444 | + sub_channel_prbs_group, subchannel, prbs_group); | ||
2445 | + | ||
2446 | + return prbs_group; | ||
2447 | } | ||
2448 | |||
2449 | static void dib8000_set_13seg_channel(struct dib8000_state *state) | ||
2450 | @@ -2409,10 +2432,8 @@ static void dib8000_set_isdbt_common_channel(struct dib8000_state *state, u8 seq | ||
2451 | /* TSB or ISDBT ? apply it now */ | ||
2452 | if (c->isdbt_sb_mode) { | ||
2453 | dib8000_set_sb_channel(state); | ||
2454 | - if (c->isdbt_sb_subchannel < 14) | ||
2455 | - init_prbs = dib8000_get_init_prbs(state, c->isdbt_sb_subchannel); | ||
2456 | - else | ||
2457 | - init_prbs = 0; | ||
2458 | + init_prbs = dib8000_get_init_prbs(state, | ||
2459 | + c->isdbt_sb_subchannel); | ||
2460 | } else { | ||
2461 | dib8000_set_13seg_channel(state); | ||
2462 | init_prbs = 0xfff; | ||
2463 | @@ -3004,6 +3025,7 @@ static int dib8000_tune(struct dvb_frontend *fe) | ||
2464 | |||
2465 | unsigned long *timeout = &state->timeout; | ||
2466 | unsigned long now = jiffies; | ||
2467 | + u16 init_prbs; | ||
2468 | #ifdef DIB8000_AGC_FREEZE | ||
2469 | u16 agc1, agc2; | ||
2470 | #endif | ||
2471 | @@ -3302,8 +3324,10 @@ static int dib8000_tune(struct dvb_frontend *fe) | ||
2472 | break; | ||
2473 | |||
2474 | case CT_DEMOD_STEP_11: /* 41 : init prbs autosearch */ | ||
2475 | - if (state->subchannel <= 41) { | ||
2476 | - dib8000_set_subchannel_prbs(state, dib8000_get_init_prbs(state, state->subchannel)); | ||
2477 | + init_prbs = dib8000_get_init_prbs(state, state->subchannel); | ||
2478 | + | ||
2479 | + if (init_prbs) { | ||
2480 | + dib8000_set_subchannel_prbs(state, init_prbs); | ||
2481 | *tune_state = CT_DEMOD_STEP_9; | ||
2482 | } else { | ||
2483 | *tune_state = CT_DEMOD_STOP; | ||
2484 | diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c | ||
2485 | index f86ae18bc104b..ffaa4a91e5713 100644 | ||
2486 | --- a/drivers/media/i2c/imx258.c | ||
2487 | +++ b/drivers/media/i2c/imx258.c | ||
2488 | @@ -22,7 +22,7 @@ | ||
2489 | #define IMX258_CHIP_ID 0x0258 | ||
2490 | |||
2491 | /* V_TIMING internal */ | ||
2492 | -#define IMX258_VTS_30FPS 0x0c98 | ||
2493 | +#define IMX258_VTS_30FPS 0x0c50 | ||
2494 | #define IMX258_VTS_30FPS_2K 0x0638 | ||
2495 | #define IMX258_VTS_30FPS_VGA 0x034c | ||
2496 | #define IMX258_VTS_MAX 0xffff | ||
2497 | @@ -46,7 +46,7 @@ | ||
2498 | /* Analog gain control */ | ||
2499 | #define IMX258_REG_ANALOG_GAIN 0x0204 | ||
2500 | #define IMX258_ANA_GAIN_MIN 0 | ||
2501 | -#define IMX258_ANA_GAIN_MAX 0x1fff | ||
2502 | +#define IMX258_ANA_GAIN_MAX 480 | ||
2503 | #define IMX258_ANA_GAIN_STEP 1 | ||
2504 | #define IMX258_ANA_GAIN_DEFAULT 0x0 | ||
2505 | |||
2506 | diff --git a/drivers/media/i2c/tda1997x.c b/drivers/media/i2c/tda1997x.c | ||
2507 | index 1088161498df0..18a2027ba1450 100644 | ||
2508 | --- a/drivers/media/i2c/tda1997x.c | ||
2509 | +++ b/drivers/media/i2c/tda1997x.c | ||
2510 | @@ -1695,14 +1695,15 @@ static int tda1997x_query_dv_timings(struct v4l2_subdev *sd, | ||
2511 | struct v4l2_dv_timings *timings) | ||
2512 | { | ||
2513 | struct tda1997x_state *state = to_state(sd); | ||
2514 | + int ret; | ||
2515 | |||
2516 | v4l_dbg(1, debug, state->client, "%s\n", __func__); | ||
2517 | memset(timings, 0, sizeof(struct v4l2_dv_timings)); | ||
2518 | mutex_lock(&state->lock); | ||
2519 | - tda1997x_detect_std(state, timings); | ||
2520 | + ret = tda1997x_detect_std(state, timings); | ||
2521 | mutex_unlock(&state->lock); | ||
2522 | |||
2523 | - return 0; | ||
2524 | + return ret; | ||
2525 | } | ||
2526 | |||
2527 | static const struct v4l2_subdev_video_ops tda1997x_video_ops = { | ||
2528 | diff --git a/drivers/media/platform/tegra-cec/tegra_cec.c b/drivers/media/platform/tegra-cec/tegra_cec.c | ||
2529 | index a632602131f21..efb80a78d2fa2 100644 | ||
2530 | --- a/drivers/media/platform/tegra-cec/tegra_cec.c | ||
2531 | +++ b/drivers/media/platform/tegra-cec/tegra_cec.c | ||
2532 | @@ -366,7 +366,11 @@ static int tegra_cec_probe(struct platform_device *pdev) | ||
2533 | return -ENOENT; | ||
2534 | } | ||
2535 | |||
2536 | - clk_prepare_enable(cec->clk); | ||
2537 | + ret = clk_prepare_enable(cec->clk); | ||
2538 | + if (ret) { | ||
2539 | + dev_err(&pdev->dev, "Unable to prepare clock for CEC\n"); | ||
2540 | + return ret; | ||
2541 | + } | ||
2542 | |||
2543 | /* set context info. */ | ||
2544 | cec->dev = &pdev->dev; | ||
2545 | @@ -446,9 +450,7 @@ static int tegra_cec_resume(struct platform_device *pdev) | ||
2546 | |||
2547 | dev_notice(&pdev->dev, "Resuming\n"); | ||
2548 | |||
2549 | - clk_prepare_enable(cec->clk); | ||
2550 | - | ||
2551 | - return 0; | ||
2552 | + return clk_prepare_enable(cec->clk); | ||
2553 | } | ||
2554 | #endif | ||
2555 | |||
2556 | diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c | ||
2557 | index ef8b83b707df0..13ab7312fa3b5 100644 | ||
2558 | --- a/drivers/media/rc/rc-loopback.c | ||
2559 | +++ b/drivers/media/rc/rc-loopback.c | ||
2560 | @@ -42,7 +42,7 @@ static int loop_set_tx_mask(struct rc_dev *dev, u32 mask) | ||
2561 | |||
2562 | if ((mask & (RXMASK_REGULAR | RXMASK_LEARNING)) != mask) { | ||
2563 | dprintk("invalid tx mask: %u\n", mask); | ||
2564 | - return -EINVAL; | ||
2565 | + return 2; | ||
2566 | } | ||
2567 | |||
2568 | dprintk("setting tx mask: %u\n", mask); | ||
2569 | diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c | ||
2570 | index 7d60dd3b0bd85..db7f8f8ee2f9f 100644 | ||
2571 | --- a/drivers/media/usb/uvc/uvc_v4l2.c | ||
2572 | +++ b/drivers/media/usb/uvc/uvc_v4l2.c | ||
2573 | @@ -894,8 +894,8 @@ static int uvc_ioctl_g_input(struct file *file, void *fh, unsigned int *input) | ||
2574 | { | ||
2575 | struct uvc_fh *handle = fh; | ||
2576 | struct uvc_video_chain *chain = handle->chain; | ||
2577 | + u8 *buf; | ||
2578 | int ret; | ||
2579 | - u8 i; | ||
2580 | |||
2581 | if (chain->selector == NULL || | ||
2582 | (chain->dev->quirks & UVC_QUIRK_IGNORE_SELECTOR_UNIT)) { | ||
2583 | @@ -903,22 +903,27 @@ static int uvc_ioctl_g_input(struct file *file, void *fh, unsigned int *input) | ||
2584 | return 0; | ||
2585 | } | ||
2586 | |||
2587 | + buf = kmalloc(1, GFP_KERNEL); | ||
2588 | + if (!buf) | ||
2589 | + return -ENOMEM; | ||
2590 | + | ||
2591 | ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, chain->selector->id, | ||
2592 | chain->dev->intfnum, UVC_SU_INPUT_SELECT_CONTROL, | ||
2593 | - &i, 1); | ||
2594 | - if (ret < 0) | ||
2595 | - return ret; | ||
2596 | + buf, 1); | ||
2597 | + if (!ret) | ||
2598 | + *input = *buf - 1; | ||
2599 | |||
2600 | - *input = i - 1; | ||
2601 | - return 0; | ||
2602 | + kfree(buf); | ||
2603 | + | ||
2604 | + return ret; | ||
2605 | } | ||
2606 | |||
2607 | static int uvc_ioctl_s_input(struct file *file, void *fh, unsigned int input) | ||
2608 | { | ||
2609 | struct uvc_fh *handle = fh; | ||
2610 | struct uvc_video_chain *chain = handle->chain; | ||
2611 | + u8 *buf; | ||
2612 | int ret; | ||
2613 | - u32 i; | ||
2614 | |||
2615 | ret = uvc_acquire_privileges(handle); | ||
2616 | if (ret < 0) | ||
2617 | @@ -934,10 +939,17 @@ static int uvc_ioctl_s_input(struct file *file, void *fh, unsigned int input) | ||
2618 | if (input >= chain->selector->bNrInPins) | ||
2619 | return -EINVAL; | ||
2620 | |||
2621 | - i = input + 1; | ||
2622 | - return uvc_query_ctrl(chain->dev, UVC_SET_CUR, chain->selector->id, | ||
2623 | - chain->dev->intfnum, UVC_SU_INPUT_SELECT_CONTROL, | ||
2624 | - &i, 1); | ||
2625 | + buf = kmalloc(1, GFP_KERNEL); | ||
2626 | + if (!buf) | ||
2627 | + return -ENOMEM; | ||
2628 | + | ||
2629 | + *buf = input + 1; | ||
2630 | + ret = uvc_query_ctrl(chain->dev, UVC_SET_CUR, chain->selector->id, | ||
2631 | + chain->dev->intfnum, UVC_SU_INPUT_SELECT_CONTROL, | ||
2632 | + buf, 1); | ||
2633 | + kfree(buf); | ||
2634 | + | ||
2635 | + return ret; | ||
2636 | } | ||
2637 | |||
2638 | static int uvc_ioctl_queryctrl(struct file *file, void *fh, | ||
2639 | diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c | ||
2640 | index 4f23e939ead0b..60454e1b727e9 100644 | ||
2641 | --- a/drivers/media/v4l2-core/v4l2-dv-timings.c | ||
2642 | +++ b/drivers/media/v4l2-core/v4l2-dv-timings.c | ||
2643 | @@ -196,7 +196,7 @@ bool v4l2_find_dv_timings_cap(struct v4l2_dv_timings *t, | ||
2644 | if (!v4l2_valid_dv_timings(t, cap, fnc, fnc_handle)) | ||
2645 | return false; | ||
2646 | |||
2647 | - for (i = 0; i < v4l2_dv_timings_presets[i].bt.width; i++) { | ||
2648 | + for (i = 0; v4l2_dv_timings_presets[i].bt.width; i++) { | ||
2649 | if (v4l2_valid_dv_timings(v4l2_dv_timings_presets + i, cap, | ||
2650 | fnc, fnc_handle) && | ||
2651 | v4l2_match_dv_timings(t, v4l2_dv_timings_presets + i, | ||
2652 | @@ -218,7 +218,7 @@ bool v4l2_find_dv_timings_cea861_vic(struct v4l2_dv_timings *t, u8 vic) | ||
2653 | { | ||
2654 | unsigned int i; | ||
2655 | |||
2656 | - for (i = 0; i < v4l2_dv_timings_presets[i].bt.width; i++) { | ||
2657 | + for (i = 0; v4l2_dv_timings_presets[i].bt.width; i++) { | ||
2658 | const struct v4l2_bt_timings *bt = | ||
2659 | &v4l2_dv_timings_presets[i].bt; | ||
2660 | |||
2661 | diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c | ||
2662 | index 3e9dc92cb467b..842de1f352dfc 100644 | ||
2663 | --- a/drivers/mfd/ab8500-core.c | ||
2664 | +++ b/drivers/mfd/ab8500-core.c | ||
2665 | @@ -493,7 +493,7 @@ static int ab8500_handle_hierarchical_line(struct ab8500 *ab8500, | ||
2666 | if (line == AB8540_INT_GPIO43F || line == AB8540_INT_GPIO44F) | ||
2667 | line += 1; | ||
2668 | |||
2669 | - handle_nested_irq(irq_create_mapping(ab8500->domain, line)); | ||
2670 | + handle_nested_irq(irq_find_mapping(ab8500->domain, line)); | ||
2671 | } | ||
2672 | |||
2673 | return 0; | ||
2674 | diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c | ||
2675 | index aa59496e43768..9db1000944c34 100644 | ||
2676 | --- a/drivers/mfd/axp20x.c | ||
2677 | +++ b/drivers/mfd/axp20x.c | ||
2678 | @@ -125,12 +125,13 @@ static const struct regmap_range axp288_writeable_ranges[] = { | ||
2679 | |||
2680 | static const struct regmap_range axp288_volatile_ranges[] = { | ||
2681 | regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP288_POWER_REASON), | ||
2682 | + regmap_reg_range(AXP22X_PWR_OUT_CTRL1, AXP22X_ALDO3_V_OUT), | ||
2683 | regmap_reg_range(AXP288_BC_GLOBAL, AXP288_BC_GLOBAL), | ||
2684 | regmap_reg_range(AXP288_BC_DET_STAT, AXP20X_VBUS_IPSOUT_MGMT), | ||
2685 | regmap_reg_range(AXP20X_CHRG_BAK_CTRL, AXP20X_CHRG_BAK_CTRL), | ||
2686 | regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IPSOUT_V_HIGH_L), | ||
2687 | regmap_reg_range(AXP20X_TIMER_CTRL, AXP20X_TIMER_CTRL), | ||
2688 | - regmap_reg_range(AXP22X_GPIO_STATE, AXP22X_GPIO_STATE), | ||
2689 | + regmap_reg_range(AXP20X_GPIO1_CTRL, AXP22X_GPIO_STATE), | ||
2690 | regmap_reg_range(AXP288_RT_BATT_V_H, AXP288_RT_BATT_V_L), | ||
2691 | regmap_reg_range(AXP20X_FG_RES, AXP288_FG_CC_CAP_REG), | ||
2692 | }; | ||
2693 | diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c | ||
2694 | index dfac6afa82ca5..f1f2ad9ff0b34 100644 | ||
2695 | --- a/drivers/mfd/db8500-prcmu.c | ||
2696 | +++ b/drivers/mfd/db8500-prcmu.c | ||
2697 | @@ -1695,22 +1695,20 @@ static long round_clock_rate(u8 clock, unsigned long rate) | ||
2698 | } | ||
2699 | |||
2700 | static const unsigned long db8500_armss_freqs[] = { | ||
2701 | - 200000000, | ||
2702 | - 400000000, | ||
2703 | - 800000000, | ||
2704 | + 199680000, | ||
2705 | + 399360000, | ||
2706 | + 798720000, | ||
2707 | 998400000 | ||
2708 | }; | ||
2709 | |||
2710 | /* The DB8520 has slightly higher ARMSS max frequency */ | ||
2711 | static const unsigned long db8520_armss_freqs[] = { | ||
2712 | - 200000000, | ||
2713 | - 400000000, | ||
2714 | - 800000000, | ||
2715 | + 199680000, | ||
2716 | + 399360000, | ||
2717 | + 798720000, | ||
2718 | 1152000000 | ||
2719 | }; | ||
2720 | |||
2721 | - | ||
2722 | - | ||
2723 | static long round_armss_rate(unsigned long rate) | ||
2724 | { | ||
2725 | unsigned long freq = 0; | ||
2726 | diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c | ||
2727 | index 1aee3b3253fc9..508349399f8af 100644 | ||
2728 | --- a/drivers/mfd/stmpe.c | ||
2729 | +++ b/drivers/mfd/stmpe.c | ||
2730 | @@ -1091,7 +1091,7 @@ static irqreturn_t stmpe_irq(int irq, void *data) | ||
2731 | |||
2732 | if (variant->id_val == STMPE801_ID || | ||
2733 | variant->id_val == STMPE1600_ID) { | ||
2734 | - int base = irq_create_mapping(stmpe->domain, 0); | ||
2735 | + int base = irq_find_mapping(stmpe->domain, 0); | ||
2736 | |||
2737 | handle_nested_irq(base); | ||
2738 | return IRQ_HANDLED; | ||
2739 | @@ -1119,7 +1119,7 @@ static irqreturn_t stmpe_irq(int irq, void *data) | ||
2740 | while (status) { | ||
2741 | int bit = __ffs(status); | ||
2742 | int line = bank * 8 + bit; | ||
2743 | - int nestedirq = irq_create_mapping(stmpe->domain, line); | ||
2744 | + int nestedirq = irq_find_mapping(stmpe->domain, line); | ||
2745 | |||
2746 | handle_nested_irq(nestedirq); | ||
2747 | status &= ~(1 << bit); | ||
2748 | diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c | ||
2749 | index 67c9995bb1aa6..23cfbd050120d 100644 | ||
2750 | --- a/drivers/mfd/tc3589x.c | ||
2751 | +++ b/drivers/mfd/tc3589x.c | ||
2752 | @@ -187,7 +187,7 @@ again: | ||
2753 | |||
2754 | while (status) { | ||
2755 | int bit = __ffs(status); | ||
2756 | - int virq = irq_create_mapping(tc3589x->domain, bit); | ||
2757 | + int virq = irq_find_mapping(tc3589x->domain, bit); | ||
2758 | |||
2759 | handle_nested_irq(virq); | ||
2760 | status &= ~(1 << bit); | ||
2761 | diff --git a/drivers/mfd/tqmx86.c b/drivers/mfd/tqmx86.c | ||
2762 | index 22d2f02d855c2..ccc5a9ac788c1 100644 | ||
2763 | --- a/drivers/mfd/tqmx86.c | ||
2764 | +++ b/drivers/mfd/tqmx86.c | ||
2765 | @@ -210,6 +210,8 @@ static int tqmx86_probe(struct platform_device *pdev) | ||
2766 | |||
2767 | /* Assumes the IRQ resource is first. */ | ||
2768 | tqmx_gpio_resources[0].start = gpio_irq; | ||
2769 | + } else { | ||
2770 | + tqmx_gpio_resources[0].flags = 0; | ||
2771 | } | ||
2772 | |||
2773 | ocores_platfom_data.clock_khz = tqmx86_board_id_to_clk_rate(board_id); | ||
2774 | diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c | ||
2775 | index 6c3a619e26286..651a028bc519a 100644 | ||
2776 | --- a/drivers/mfd/wm8994-irq.c | ||
2777 | +++ b/drivers/mfd/wm8994-irq.c | ||
2778 | @@ -154,7 +154,7 @@ static irqreturn_t wm8994_edge_irq(int irq, void *data) | ||
2779 | struct wm8994 *wm8994 = data; | ||
2780 | |||
2781 | while (gpio_get_value_cansleep(wm8994->pdata.irq_gpio)) | ||
2782 | - handle_nested_irq(irq_create_mapping(wm8994->edge_irq, 0)); | ||
2783 | + handle_nested_irq(irq_find_mapping(wm8994->edge_irq, 0)); | ||
2784 | |||
2785 | return IRQ_HANDLED; | ||
2786 | } | ||
2787 | diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c | ||
2788 | index c2338750313c4..a49782dd903cd 100644 | ||
2789 | --- a/drivers/misc/vmw_vmci/vmci_queue_pair.c | ||
2790 | +++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c | ||
2791 | @@ -2238,7 +2238,8 @@ int vmci_qp_broker_map(struct vmci_handle handle, | ||
2792 | |||
2793 | result = VMCI_SUCCESS; | ||
2794 | |||
2795 | - if (context_id != VMCI_HOST_CONTEXT_ID) { | ||
2796 | + if (context_id != VMCI_HOST_CONTEXT_ID && | ||
2797 | + !QPBROKERSTATE_HAS_MEM(entry)) { | ||
2798 | struct vmci_qp_page_store page_store; | ||
2799 | |||
2800 | page_store.pages = guest_mem; | ||
2801 | @@ -2345,7 +2346,8 @@ int vmci_qp_broker_unmap(struct vmci_handle handle, | ||
2802 | goto out; | ||
2803 | } | ||
2804 | |||
2805 | - if (context_id != VMCI_HOST_CONTEXT_ID) { | ||
2806 | + if (context_id != VMCI_HOST_CONTEXT_ID && | ||
2807 | + QPBROKERSTATE_HAS_MEM(entry)) { | ||
2808 | qp_acquire_queue_mutex(entry->produce_q); | ||
2809 | result = qp_save_headers(entry); | ||
2810 | if (result < VMCI_SUCCESS) | ||
2811 | diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c | ||
2812 | index 8322d22a59c45..e92f9373e2274 100644 | ||
2813 | --- a/drivers/mmc/core/block.c | ||
2814 | +++ b/drivers/mmc/core/block.c | ||
2815 | @@ -591,6 +591,7 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, | ||
2816 | } | ||
2817 | |||
2818 | mmc_wait_for_req(card->host, &mrq); | ||
2819 | + memcpy(&idata->ic.response, cmd.resp, sizeof(cmd.resp)); | ||
2820 | |||
2821 | if (cmd.error) { | ||
2822 | dev_err(mmc_dev(card->host), "%s: cmd error %d\n", | ||
2823 | @@ -640,8 +641,6 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, | ||
2824 | if (idata->ic.postsleep_min_us) | ||
2825 | usleep_range(idata->ic.postsleep_min_us, idata->ic.postsleep_max_us); | ||
2826 | |||
2827 | - memcpy(&(idata->ic.response), cmd.resp, sizeof(cmd.resp)); | ||
2828 | - | ||
2829 | if (idata->rpmb || (cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B) { | ||
2830 | /* | ||
2831 | * Ensure RPMB/R1B command has completed by polling CMD13 | ||
2832 | diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c | ||
2833 | index 11087976ab19c..9ff718b61c72e 100644 | ||
2834 | --- a/drivers/mmc/host/rtsx_pci_sdmmc.c | ||
2835 | +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c | ||
2836 | @@ -539,9 +539,22 @@ static int sd_write_long_data(struct realtek_pci_sdmmc *host, | ||
2837 | return 0; | ||
2838 | } | ||
2839 | |||
2840 | +static inline void sd_enable_initial_mode(struct realtek_pci_sdmmc *host) | ||
2841 | +{ | ||
2842 | + rtsx_pci_write_register(host->pcr, SD_CFG1, | ||
2843 | + SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_128); | ||
2844 | +} | ||
2845 | + | ||
2846 | +static inline void sd_disable_initial_mode(struct realtek_pci_sdmmc *host) | ||
2847 | +{ | ||
2848 | + rtsx_pci_write_register(host->pcr, SD_CFG1, | ||
2849 | + SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_0); | ||
2850 | +} | ||
2851 | + | ||
2852 | static int sd_rw_multi(struct realtek_pci_sdmmc *host, struct mmc_request *mrq) | ||
2853 | { | ||
2854 | struct mmc_data *data = mrq->data; | ||
2855 | + int err; | ||
2856 | |||
2857 | if (host->sg_count < 0) { | ||
2858 | data->error = host->sg_count; | ||
2859 | @@ -550,22 +563,19 @@ static int sd_rw_multi(struct realtek_pci_sdmmc *host, struct mmc_request *mrq) | ||
2860 | return data->error; | ||
2861 | } | ||
2862 | |||
2863 | - if (data->flags & MMC_DATA_READ) | ||
2864 | - return sd_read_long_data(host, mrq); | ||
2865 | + if (data->flags & MMC_DATA_READ) { | ||
2866 | + if (host->initial_mode) | ||
2867 | + sd_disable_initial_mode(host); | ||
2868 | |||
2869 | - return sd_write_long_data(host, mrq); | ||
2870 | -} | ||
2871 | + err = sd_read_long_data(host, mrq); | ||
2872 | |||
2873 | -static inline void sd_enable_initial_mode(struct realtek_pci_sdmmc *host) | ||
2874 | -{ | ||
2875 | - rtsx_pci_write_register(host->pcr, SD_CFG1, | ||
2876 | - SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_128); | ||
2877 | -} | ||
2878 | + if (host->initial_mode) | ||
2879 | + sd_enable_initial_mode(host); | ||
2880 | |||
2881 | -static inline void sd_disable_initial_mode(struct realtek_pci_sdmmc *host) | ||
2882 | -{ | ||
2883 | - rtsx_pci_write_register(host->pcr, SD_CFG1, | ||
2884 | - SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_0); | ||
2885 | + return err; | ||
2886 | + } | ||
2887 | + | ||
2888 | + return sd_write_long_data(host, mrq); | ||
2889 | } | ||
2890 | |||
2891 | static void sd_normal_rw(struct realtek_pci_sdmmc *host, | ||
2892 | diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c | ||
2893 | index 7023cbec4017b..dd10f7abf5a71 100644 | ||
2894 | --- a/drivers/mmc/host/sdhci-of-arasan.c | ||
2895 | +++ b/drivers/mmc/host/sdhci-of-arasan.c | ||
2896 | @@ -192,7 +192,12 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock) | ||
2897 | * through low speeds without power cycling. | ||
2898 | */ | ||
2899 | sdhci_set_clock(host, host->max_clk); | ||
2900 | - phy_power_on(sdhci_arasan->phy); | ||
2901 | + if (phy_power_on(sdhci_arasan->phy)) { | ||
2902 | + pr_err("%s: Cannot power on phy.\n", | ||
2903 | + mmc_hostname(host->mmc)); | ||
2904 | + return; | ||
2905 | + } | ||
2906 | + | ||
2907 | sdhci_arasan->is_phy_on = true; | ||
2908 | |||
2909 | /* | ||
2910 | @@ -228,7 +233,12 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock) | ||
2911 | msleep(20); | ||
2912 | |||
2913 | if (ctrl_phy) { | ||
2914 | - phy_power_on(sdhci_arasan->phy); | ||
2915 | + if (phy_power_on(sdhci_arasan->phy)) { | ||
2916 | + pr_err("%s: Cannot power on phy.\n", | ||
2917 | + mmc_hostname(host->mmc)); | ||
2918 | + return; | ||
2919 | + } | ||
2920 | + | ||
2921 | sdhci_arasan->is_phy_on = true; | ||
2922 | } | ||
2923 | } | ||
2924 | @@ -416,7 +426,9 @@ static int sdhci_arasan_suspend(struct device *dev) | ||
2925 | ret = phy_power_off(sdhci_arasan->phy); | ||
2926 | if (ret) { | ||
2927 | dev_err(dev, "Cannot power off phy.\n"); | ||
2928 | - sdhci_resume_host(host); | ||
2929 | + if (sdhci_resume_host(host)) | ||
2930 | + dev_err(dev, "Cannot resume host.\n"); | ||
2931 | + | ||
2932 | return ret; | ||
2933 | } | ||
2934 | sdhci_arasan->is_phy_on = false; | ||
2935 | diff --git a/drivers/mtd/nand/raw/cafe_nand.c b/drivers/mtd/nand/raw/cafe_nand.c | ||
2936 | index 2d1c22dc88c15..cc5009200cc23 100644 | ||
2937 | --- a/drivers/mtd/nand/raw/cafe_nand.c | ||
2938 | +++ b/drivers/mtd/nand/raw/cafe_nand.c | ||
2939 | @@ -757,7 +757,7 @@ static int cafe_nand_probe(struct pci_dev *pdev, | ||
2940 | "CAFE NAND", mtd); | ||
2941 | if (err) { | ||
2942 | dev_warn(&pdev->dev, "Could not register IRQ %d\n", pdev->irq); | ||
2943 | - goto out_ior; | ||
2944 | + goto out_free_rs; | ||
2945 | } | ||
2946 | |||
2947 | /* Disable master reset, enable NAND clock */ | ||
2948 | @@ -801,6 +801,8 @@ static int cafe_nand_probe(struct pci_dev *pdev, | ||
2949 | /* Disable NAND IRQ in global IRQ mask register */ | ||
2950 | cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK); | ||
2951 | free_irq(pdev->irq, mtd); | ||
2952 | + out_free_rs: | ||
2953 | + free_rs(cafe->rs); | ||
2954 | out_ior: | ||
2955 | pci_iounmap(pdev, cafe->mmio); | ||
2956 | out_free_mtd: | ||
2957 | diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c | ||
2958 | index e21643377162b..1949f631e1bc5 100644 | ||
2959 | --- a/drivers/net/bonding/bond_main.c | ||
2960 | +++ b/drivers/net/bonding/bond_main.c | ||
2961 | @@ -1926,7 +1926,6 @@ static int __bond_release_one(struct net_device *bond_dev, | ||
2962 | /* recompute stats just before removing the slave */ | ||
2963 | bond_get_stats(bond->dev, &bond->bond_stats); | ||
2964 | |||
2965 | - bond_upper_dev_unlink(bond, slave); | ||
2966 | /* unregister rx_handler early so bond_handle_frame wouldn't be called | ||
2967 | * for this slave anymore. | ||
2968 | */ | ||
2969 | @@ -1935,6 +1934,8 @@ static int __bond_release_one(struct net_device *bond_dev, | ||
2970 | if (BOND_MODE(bond) == BOND_MODE_8023AD) | ||
2971 | bond_3ad_unbind_slave(slave); | ||
2972 | |||
2973 | + bond_upper_dev_unlink(bond, slave); | ||
2974 | + | ||
2975 | if (bond_mode_can_use_xmit_hash(bond)) | ||
2976 | bond_update_slave_arr(bond, slave); | ||
2977 | |||
2978 | diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c | ||
2979 | index e78b683f73052..825d840cdb8c3 100644 | ||
2980 | --- a/drivers/net/dsa/b53/b53_common.c | ||
2981 | +++ b/drivers/net/dsa/b53/b53_common.c | ||
2982 | @@ -2353,9 +2353,8 @@ static int b53_switch_init(struct b53_device *dev) | ||
2983 | dev->cpu_port = 5; | ||
2984 | } | ||
2985 | |||
2986 | - /* cpu port is always last */ | ||
2987 | - dev->num_ports = dev->cpu_port + 1; | ||
2988 | dev->enabled_ports |= BIT(dev->cpu_port); | ||
2989 | + dev->num_ports = fls(dev->enabled_ports); | ||
2990 | |||
2991 | /* Include non standard CPU port built-in PHYs to be probed */ | ||
2992 | if (is539x(dev) || is531x5(dev)) { | ||
2993 | diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c | ||
2994 | index af3d56636a076..3225de0f655f2 100644 | ||
2995 | --- a/drivers/net/dsa/lantiq_gswip.c | ||
2996 | +++ b/drivers/net/dsa/lantiq_gswip.c | ||
2997 | @@ -837,7 +837,8 @@ static int gswip_setup(struct dsa_switch *ds) | ||
2998 | |||
2999 | gswip_switch_mask(priv, 0, GSWIP_MAC_CTRL_2_MLEN, | ||
3000 | GSWIP_MAC_CTRL_2p(cpu_port)); | ||
3001 | - gswip_switch_w(priv, VLAN_ETH_FRAME_LEN + 8, GSWIP_MAC_FLEN); | ||
3002 | + gswip_switch_w(priv, VLAN_ETH_FRAME_LEN + 8 + ETH_FCS_LEN, | ||
3003 | + GSWIP_MAC_FLEN); | ||
3004 | gswip_switch_mask(priv, 0, GSWIP_BM_QUEUE_GCTRL_GL_MOD, | ||
3005 | GSWIP_BM_QUEUE_GCTRL); | ||
3006 | |||
3007 | diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | ||
3008 | index cf39623b828b7..4630998d47fd4 100644 | ||
3009 | --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | ||
3010 | +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | ||
3011 | @@ -1246,7 +1246,7 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, | ||
3012 | |||
3013 | /* SR-IOV capability was enabled but there are no VFs*/ | ||
3014 | if (iov->total == 0) { | ||
3015 | - err = -EINVAL; | ||
3016 | + err = 0; | ||
3017 | goto failed; | ||
3018 | } | ||
3019 | |||
3020 | diff --git a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c | ||
3021 | index 0ccdde366ae17..540d99f59226e 100644 | ||
3022 | --- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c | ||
3023 | +++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c | ||
3024 | @@ -1153,6 +1153,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
3025 | if (!adapter->registered_device_map) { | ||
3026 | pr_err("%s: could not register any net devices\n", | ||
3027 | pci_name(pdev)); | ||
3028 | + err = -EINVAL; | ||
3029 | goto out_release_adapter_res; | ||
3030 | } | ||
3031 | |||
3032 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | ||
3033 | index e64e175162068..db9c8f943811b 100644 | ||
3034 | --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | ||
3035 | +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | ||
3036 | @@ -56,6 +56,7 @@ MODULE_PARM_DESC(debug, " Network interface message level setting"); | ||
3037 | #define HNS3_OUTER_VLAN_TAG 2 | ||
3038 | |||
3039 | #define HNS3_MIN_TX_LEN 33U | ||
3040 | +#define HNS3_MIN_TUN_PKT_LEN 65U | ||
3041 | |||
3042 | /* hns3_pci_tbl - PCI Device ID Table | ||
3043 | * | ||
3044 | @@ -931,8 +932,11 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto, | ||
3045 | l4.tcp->doff); | ||
3046 | break; | ||
3047 | case IPPROTO_UDP: | ||
3048 | - if (hns3_tunnel_csum_bug(skb)) | ||
3049 | - return skb_checksum_help(skb); | ||
3050 | + if (hns3_tunnel_csum_bug(skb)) { | ||
3051 | + int ret = skb_put_padto(skb, HNS3_MIN_TUN_PKT_LEN); | ||
3052 | + | ||
3053 | + return ret ? ret : skb_checksum_help(skb); | ||
3054 | + } | ||
3055 | |||
3056 | hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1); | ||
3057 | hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4T_S, | ||
3058 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | ||
3059 | index aa402e2671212..f44e8401496b1 100644 | ||
3060 | --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | ||
3061 | +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | ||
3062 | @@ -1328,9 +1328,10 @@ static void hclge_init_kdump_kernel_config(struct hclge_dev *hdev) | ||
3063 | |||
3064 | static int hclge_configure(struct hclge_dev *hdev) | ||
3065 | { | ||
3066 | + const struct cpumask *cpumask = cpu_online_mask; | ||
3067 | struct hclge_cfg cfg; | ||
3068 | unsigned int i; | ||
3069 | - int ret; | ||
3070 | + int node, ret; | ||
3071 | |||
3072 | ret = hclge_get_cfg(hdev, &cfg); | ||
3073 | if (ret) { | ||
3074 | @@ -1390,11 +1391,12 @@ static int hclge_configure(struct hclge_dev *hdev) | ||
3075 | |||
3076 | hclge_init_kdump_kernel_config(hdev); | ||
3077 | |||
3078 | - /* Set the init affinity based on pci func number */ | ||
3079 | - i = cpumask_weight(cpumask_of_node(dev_to_node(&hdev->pdev->dev))); | ||
3080 | - i = i ? PCI_FUNC(hdev->pdev->devfn) % i : 0; | ||
3081 | - cpumask_set_cpu(cpumask_local_spread(i, dev_to_node(&hdev->pdev->dev)), | ||
3082 | - &hdev->affinity_mask); | ||
3083 | + /* Set the affinity based on numa node */ | ||
3084 | + node = dev_to_node(&hdev->pdev->dev); | ||
3085 | + if (node != NUMA_NO_NODE) | ||
3086 | + cpumask = cpumask_of_node(node); | ||
3087 | + | ||
3088 | + cpumask_copy(&hdev->affinity_mask, cpumask); | ||
3089 | |||
3090 | return ret; | ||
3091 | } | ||
3092 | @@ -6683,11 +6685,12 @@ static void hclge_ae_stop(struct hnae3_handle *handle) | ||
3093 | hclge_clear_arfs_rules(handle); | ||
3094 | spin_unlock_bh(&hdev->fd_rule_lock); | ||
3095 | |||
3096 | - /* If it is not PF reset, the firmware will disable the MAC, | ||
3097 | + /* If it is not PF reset or FLR, the firmware will disable the MAC, | ||
3098 | * so it only need to stop phy here. | ||
3099 | */ | ||
3100 | if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) && | ||
3101 | - hdev->reset_type != HNAE3_FUNC_RESET) { | ||
3102 | + hdev->reset_type != HNAE3_FUNC_RESET && | ||
3103 | + hdev->reset_type != HNAE3_FLR_RESET) { | ||
3104 | hclge_mac_stop_phy(hdev); | ||
3105 | hclge_update_link_status(hdev); | ||
3106 | return; | ||
3107 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | ||
3108 | index ea348ebbbf2e9..db2e9dd5681eb 100644 | ||
3109 | --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | ||
3110 | +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | ||
3111 | @@ -1956,6 +1956,8 @@ static irqreturn_t hclgevf_misc_irq_handle(int irq, void *data) | ||
3112 | |||
3113 | hclgevf_enable_vector(&hdev->misc_vector, false); | ||
3114 | event_cause = hclgevf_check_evt_cause(hdev, &clearval); | ||
3115 | + if (event_cause != HCLGEVF_VECTOR0_EVENT_OTHER) | ||
3116 | + hclgevf_clear_event_cause(hdev, clearval); | ||
3117 | |||
3118 | switch (event_cause) { | ||
3119 | case HCLGEVF_VECTOR0_EVENT_RST: | ||
3120 | @@ -1968,10 +1970,8 @@ static irqreturn_t hclgevf_misc_irq_handle(int irq, void *data) | ||
3121 | break; | ||
3122 | } | ||
3123 | |||
3124 | - if (event_cause != HCLGEVF_VECTOR0_EVENT_OTHER) { | ||
3125 | - hclgevf_clear_event_cause(hdev, clearval); | ||
3126 | + if (event_cause != HCLGEVF_VECTOR0_EVENT_OTHER) | ||
3127 | hclgevf_enable_vector(&hdev->misc_vector, true); | ||
3128 | - } | ||
3129 | |||
3130 | return IRQ_HANDLED; | ||
3131 | } | ||
3132 | diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c | ||
3133 | index ecfe588f330ef..cfe7229593ead 100644 | ||
3134 | --- a/drivers/net/ethernet/ibm/ibmvnic.c | ||
3135 | +++ b/drivers/net/ethernet/ibm/ibmvnic.c | ||
3136 | @@ -4277,6 +4277,14 @@ static int handle_login_rsp(union ibmvnic_crq *login_rsp_crq, | ||
3137 | return 0; | ||
3138 | } | ||
3139 | |||
3140 | + if (adapter->failover_pending) { | ||
3141 | + adapter->init_done_rc = -EAGAIN; | ||
3142 | + netdev_dbg(netdev, "Failover pending, ignoring login response\n"); | ||
3143 | + complete(&adapter->init_done); | ||
3144 | + /* login response buffer will be released on reset */ | ||
3145 | + return 0; | ||
3146 | + } | ||
3147 | + | ||
3148 | netdev->mtu = adapter->req_mtu - ETH_HLEN; | ||
3149 | |||
3150 | netdev_dbg(adapter->netdev, "Login Response Buffer:\n"); | ||
3151 | diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c | ||
3152 | index 94a3f000e999b..bc46c262b42d8 100644 | ||
3153 | --- a/drivers/net/ethernet/intel/iavf/iavf_main.c | ||
3154 | +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c | ||
3155 | @@ -142,6 +142,30 @@ enum iavf_status iavf_free_virt_mem_d(struct iavf_hw *hw, | ||
3156 | return 0; | ||
3157 | } | ||
3158 | |||
3159 | +/** | ||
3160 | + * iavf_lock_timeout - try to set bit but give up after timeout | ||
3161 | + * @adapter: board private structure | ||
3162 | + * @bit: bit to set | ||
3163 | + * @msecs: timeout in msecs | ||
3164 | + * | ||
3165 | + * Returns 0 on success, negative on failure | ||
3166 | + **/ | ||
3167 | +static int iavf_lock_timeout(struct iavf_adapter *adapter, | ||
3168 | + enum iavf_critical_section_t bit, | ||
3169 | + unsigned int msecs) | ||
3170 | +{ | ||
3171 | + unsigned int wait, delay = 10; | ||
3172 | + | ||
3173 | + for (wait = 0; wait < msecs; wait += delay) { | ||
3174 | + if (!test_and_set_bit(bit, &adapter->crit_section)) | ||
3175 | + return 0; | ||
3176 | + | ||
3177 | + msleep(delay); | ||
3178 | + } | ||
3179 | + | ||
3180 | + return -1; | ||
3181 | +} | ||
3182 | + | ||
3183 | /** | ||
3184 | * iavf_schedule_reset - Set the flags and schedule a reset event | ||
3185 | * @adapter: board private structure | ||
3186 | @@ -1961,7 +1985,6 @@ static void iavf_watchdog_task(struct work_struct *work) | ||
3187 | /* check for hw reset */ | ||
3188 | reg_val = rd32(hw, IAVF_VF_ARQLEN1) & IAVF_VF_ARQLEN1_ARQENABLE_MASK; | ||
3189 | if (!reg_val) { | ||
3190 | - adapter->state = __IAVF_RESETTING; | ||
3191 | adapter->flags |= IAVF_FLAG_RESET_PENDING; | ||
3192 | adapter->aq_required = 0; | ||
3193 | adapter->current_op = VIRTCHNL_OP_UNKNOWN; | ||
3194 | @@ -2077,6 +2100,10 @@ static void iavf_reset_task(struct work_struct *work) | ||
3195 | if (test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) | ||
3196 | return; | ||
3197 | |||
3198 | + if (iavf_lock_timeout(adapter, __IAVF_IN_CRITICAL_TASK, 200)) { | ||
3199 | + schedule_work(&adapter->reset_task); | ||
3200 | + return; | ||
3201 | + } | ||
3202 | while (test_and_set_bit(__IAVF_IN_CLIENT_TASK, | ||
3203 | &adapter->crit_section)) | ||
3204 | usleep_range(500, 1000); | ||
3205 | @@ -2291,6 +2318,8 @@ static void iavf_adminq_task(struct work_struct *work) | ||
3206 | if (!event.msg_buf) | ||
3207 | goto out; | ||
3208 | |||
3209 | + if (iavf_lock_timeout(adapter, __IAVF_IN_CRITICAL_TASK, 200)) | ||
3210 | + goto freedom; | ||
3211 | do { | ||
3212 | ret = iavf_clean_arq_element(hw, &event, &pending); | ||
3213 | v_op = (enum virtchnl_ops)le32_to_cpu(event.desc.cookie_high); | ||
3214 | @@ -2304,6 +2333,7 @@ static void iavf_adminq_task(struct work_struct *work) | ||
3215 | if (pending != 0) | ||
3216 | memset(event.msg_buf, 0, IAVF_MAX_AQ_BUF_SIZE); | ||
3217 | } while (pending); | ||
3218 | + clear_bit(__IAVF_IN_CRITICAL_TASK, &adapter->crit_section); | ||
3219 | |||
3220 | if ((adapter->flags & | ||
3221 | (IAVF_FLAG_RESET_PENDING | IAVF_FLAG_RESET_NEEDED)) || | ||
3222 | @@ -3600,6 +3630,10 @@ static void iavf_init_task(struct work_struct *work) | ||
3223 | init_task.work); | ||
3224 | struct iavf_hw *hw = &adapter->hw; | ||
3225 | |||
3226 | + if (iavf_lock_timeout(adapter, __IAVF_IN_CRITICAL_TASK, 5000)) { | ||
3227 | + dev_warn(&adapter->pdev->dev, "failed to set __IAVF_IN_CRITICAL_TASK in %s\n", __FUNCTION__); | ||
3228 | + return; | ||
3229 | + } | ||
3230 | switch (adapter->state) { | ||
3231 | case __IAVF_STARTUP: | ||
3232 | if (iavf_startup(adapter) < 0) | ||
3233 | @@ -3612,14 +3646,14 @@ static void iavf_init_task(struct work_struct *work) | ||
3234 | case __IAVF_INIT_GET_RESOURCES: | ||
3235 | if (iavf_init_get_resources(adapter) < 0) | ||
3236 | goto init_failed; | ||
3237 | - return; | ||
3238 | + goto out; | ||
3239 | default: | ||
3240 | goto init_failed; | ||
3241 | } | ||
3242 | |||
3243 | queue_delayed_work(iavf_wq, &adapter->init_task, | ||
3244 | msecs_to_jiffies(30)); | ||
3245 | - return; | ||
3246 | + goto out; | ||
3247 | init_failed: | ||
3248 | if (++adapter->aq_wait_count > IAVF_AQ_MAX_ERR) { | ||
3249 | dev_err(&adapter->pdev->dev, | ||
3250 | @@ -3628,9 +3662,11 @@ init_failed: | ||
3251 | iavf_shutdown_adminq(hw); | ||
3252 | adapter->state = __IAVF_STARTUP; | ||
3253 | queue_delayed_work(iavf_wq, &adapter->init_task, HZ * 5); | ||
3254 | - return; | ||
3255 | + goto out; | ||
3256 | } | ||
3257 | queue_delayed_work(iavf_wq, &adapter->init_task, HZ); | ||
3258 | +out: | ||
3259 | + clear_bit(__IAVF_IN_CRITICAL_TASK, &adapter->crit_section); | ||
3260 | } | ||
3261 | |||
3262 | /** | ||
3263 | @@ -3647,9 +3683,12 @@ static void iavf_shutdown(struct pci_dev *pdev) | ||
3264 | if (netif_running(netdev)) | ||
3265 | iavf_close(netdev); | ||
3266 | |||
3267 | + if (iavf_lock_timeout(adapter, __IAVF_IN_CRITICAL_TASK, 5000)) | ||
3268 | + dev_warn(&adapter->pdev->dev, "failed to set __IAVF_IN_CRITICAL_TASK in %s\n", __FUNCTION__); | ||
3269 | /* Prevent the watchdog from running. */ | ||
3270 | adapter->state = __IAVF_REMOVE; | ||
3271 | adapter->aq_required = 0; | ||
3272 | + clear_bit(__IAVF_IN_CRITICAL_TASK, &adapter->crit_section); | ||
3273 | |||
3274 | #ifdef CONFIG_PM | ||
3275 | pci_save_state(pdev); | ||
3276 | @@ -3878,10 +3917,6 @@ static void iavf_remove(struct pci_dev *pdev) | ||
3277 | err); | ||
3278 | } | ||
3279 | |||
3280 | - /* Shut down all the garbage mashers on the detention level */ | ||
3281 | - adapter->state = __IAVF_REMOVE; | ||
3282 | - adapter->aq_required = 0; | ||
3283 | - adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; | ||
3284 | iavf_request_reset(adapter); | ||
3285 | msleep(50); | ||
3286 | /* If the FW isn't responding, kick it once, but only once. */ | ||
3287 | @@ -3889,6 +3924,13 @@ static void iavf_remove(struct pci_dev *pdev) | ||
3288 | iavf_request_reset(adapter); | ||
3289 | msleep(50); | ||
3290 | } | ||
3291 | + if (iavf_lock_timeout(adapter, __IAVF_IN_CRITICAL_TASK, 5000)) | ||
3292 | + dev_warn(&adapter->pdev->dev, "failed to set __IAVF_IN_CRITICAL_TASK in %s\n", __FUNCTION__); | ||
3293 | + | ||
3294 | + /* Shut down all the garbage mashers on the detention level */ | ||
3295 | + adapter->state = __IAVF_REMOVE; | ||
3296 | + adapter->aq_required = 0; | ||
3297 | + adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; | ||
3298 | iavf_free_all_tx_resources(adapter); | ||
3299 | iavf_free_all_rx_resources(adapter); | ||
3300 | iavf_misc_irq_disable(adapter); | ||
3301 | diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c | ||
3302 | index 084cf4a4114ad..9ba05d9aa8e08 100644 | ||
3303 | --- a/drivers/net/ethernet/intel/igc/igc_main.c | ||
3304 | +++ b/drivers/net/ethernet/intel/igc/igc_main.c | ||
3305 | @@ -2693,6 +2693,7 @@ static irqreturn_t igc_msix_ring(int irq, void *data) | ||
3306 | */ | ||
3307 | static int igc_request_msix(struct igc_adapter *adapter) | ||
3308 | { | ||
3309 | + unsigned int num_q_vectors = adapter->num_q_vectors; | ||
3310 | int i = 0, err = 0, vector = 0, free_vector = 0; | ||
3311 | struct net_device *netdev = adapter->netdev; | ||
3312 | |||
3313 | @@ -2701,7 +2702,13 @@ static int igc_request_msix(struct igc_adapter *adapter) | ||
3314 | if (err) | ||
3315 | goto err_out; | ||
3316 | |||
3317 | - for (i = 0; i < adapter->num_q_vectors; i++) { | ||
3318 | + if (num_q_vectors > MAX_Q_VECTORS) { | ||
3319 | + num_q_vectors = MAX_Q_VECTORS; | ||
3320 | + dev_warn(&adapter->pdev->dev, | ||
3321 | + "The number of queue vectors (%d) is higher than max allowed (%d)\n", | ||
3322 | + adapter->num_q_vectors, MAX_Q_VECTORS); | ||
3323 | + } | ||
3324 | + for (i = 0; i < num_q_vectors; i++) { | ||
3325 | struct igc_q_vector *q_vector = adapter->q_vector[i]; | ||
3326 | |||
3327 | vector++; | ||
3328 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | ||
3329 | index 76547d35cd0e1..bf091a6c0cd2d 100644 | ||
3330 | --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | ||
3331 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | ||
3332 | @@ -865,7 +865,7 @@ static void cb_timeout_handler(struct work_struct *work) | ||
3333 | ent->ret = -ETIMEDOUT; | ||
3334 | mlx5_core_warn(dev, "cmd[%d]: %s(0x%x) Async, timeout. Will cause a leak of a command resource\n", | ||
3335 | ent->idx, mlx5_command_str(msg_to_opcode(ent->in)), msg_to_opcode(ent->in)); | ||
3336 | - mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true); | ||
3337 | + mlx5_cmd_comp_handler(dev, 1ULL << ent->idx, true); | ||
3338 | |||
3339 | out: | ||
3340 | cmd_ent_put(ent); /* for the cmd_ent_get() took on schedule delayed work */ | ||
3341 | @@ -977,7 +977,7 @@ static void cmd_work_handler(struct work_struct *work) | ||
3342 | MLX5_SET(mbox_out, ent->out, status, status); | ||
3343 | MLX5_SET(mbox_out, ent->out, syndrome, drv_synd); | ||
3344 | |||
3345 | - mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true); | ||
3346 | + mlx5_cmd_comp_handler(dev, 1ULL << ent->idx, true); | ||
3347 | return; | ||
3348 | } | ||
3349 | |||
3350 | @@ -991,7 +991,7 @@ static void cmd_work_handler(struct work_struct *work) | ||
3351 | poll_timeout(ent); | ||
3352 | /* make sure we read the descriptor after ownership is SW */ | ||
3353 | rmb(); | ||
3354 | - mlx5_cmd_comp_handler(dev, 1UL << ent->idx, (ent->ret == -ETIMEDOUT)); | ||
3355 | + mlx5_cmd_comp_handler(dev, 1ULL << ent->idx, (ent->ret == -ETIMEDOUT)); | ||
3356 | } | ||
3357 | } | ||
3358 | |||
3359 | @@ -1051,7 +1051,7 @@ static void wait_func_handle_exec_timeout(struct mlx5_core_dev *dev, | ||
3360 | mlx5_command_str(msg_to_opcode(ent->in)), msg_to_opcode(ent->in)); | ||
3361 | |||
3362 | ent->ret = -ETIMEDOUT; | ||
3363 | - mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true); | ||
3364 | + mlx5_cmd_comp_handler(dev, 1ULL << ent->idx, true); | ||
3365 | } | ||
3366 | |||
3367 | static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) | ||
3368 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | ||
3369 | index dc36b0db37222..97359417c6e7f 100644 | ||
3370 | --- a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | ||
3371 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | ||
3372 | @@ -1005,7 +1005,7 @@ int mlx5_fw_tracer_init(struct mlx5_fw_tracer *tracer) | ||
3373 | err = mlx5_core_alloc_pd(dev, &tracer->buff.pdn); | ||
3374 | if (err) { | ||
3375 | mlx5_core_warn(dev, "FWTracer: Failed to allocate PD %d\n", err); | ||
3376 | - return err; | ||
3377 | + goto err_cancel_work; | ||
3378 | } | ||
3379 | |||
3380 | err = mlx5_fw_tracer_create_mkey(tracer); | ||
3381 | @@ -1029,6 +1029,7 @@ err_notifier_unregister: | ||
3382 | mlx5_core_destroy_mkey(dev, &tracer->buff.mkey); | ||
3383 | err_dealloc_pd: | ||
3384 | mlx5_core_dealloc_pd(dev, tracer->buff.pdn); | ||
3385 | +err_cancel_work: | ||
3386 | cancel_work_sync(&tracer->read_fw_strings_work); | ||
3387 | return err; | ||
3388 | } | ||
3389 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | ||
3390 | index 739bf5dc5a252..5fe4e028567a9 100644 | ||
3391 | --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | ||
3392 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | ||
3393 | @@ -1606,9 +1606,9 @@ static int build_match_list(struct match_list_head *match_head, | ||
3394 | |||
3395 | curr_match = kmalloc(sizeof(*curr_match), GFP_ATOMIC); | ||
3396 | if (!curr_match) { | ||
3397 | + rcu_read_unlock(); | ||
3398 | free_match_list(match_head, ft_locked); | ||
3399 | - err = -ENOMEM; | ||
3400 | - goto out; | ||
3401 | + return -ENOMEM; | ||
3402 | } | ||
3403 | if (!tree_get_node(&g->node)) { | ||
3404 | kfree(curr_match); | ||
3405 | @@ -1617,7 +1617,6 @@ static int build_match_list(struct match_list_head *match_head, | ||
3406 | curr_match->g = g; | ||
3407 | list_add_tail(&curr_match->list, &match_head->list); | ||
3408 | } | ||
3409 | -out: | ||
3410 | rcu_read_unlock(); | ||
3411 | return err; | ||
3412 | } | ||
3413 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c | ||
3414 | index f012aac83b10e..401564b94eb10 100644 | ||
3415 | --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c | ||
3416 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c | ||
3417 | @@ -603,6 +603,7 @@ static int dr_cmd_modify_qp_rtr2rts(struct mlx5_core_dev *mdev, | ||
3418 | MLX5_SET(qpc, qpc, log_ack_req_freq, 0); | ||
3419 | MLX5_SET(qpc, qpc, retry_count, attr->retry_cnt); | ||
3420 | MLX5_SET(qpc, qpc, rnr_retry, attr->rnr_retry); | ||
3421 | + MLX5_SET(qpc, qpc, primary_address_path.ack_timeout, 0x8); /* ~1ms */ | ||
3422 | |||
3423 | return mlx5_core_qp_modify(mdev, MLX5_CMD_OP_RTR2RTS_QP, 0, qpc, | ||
3424 | &dr_qp->mqp); | ||
3425 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c | ||
3426 | index 5d85ae59bc51e..3769b15b04b3b 100644 | ||
3427 | --- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c | ||
3428 | +++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c | ||
3429 | @@ -3173,6 +3173,7 @@ qed_mcp_get_nvm_image_att(struct qed_hwfn *p_hwfn, | ||
3430 | struct qed_nvm_image_att *p_image_att) | ||
3431 | { | ||
3432 | enum nvm_image_type type; | ||
3433 | + int rc; | ||
3434 | u32 i; | ||
3435 | |||
3436 | /* Translate image_id into MFW definitions */ | ||
3437 | @@ -3198,7 +3199,10 @@ qed_mcp_get_nvm_image_att(struct qed_hwfn *p_hwfn, | ||
3438 | return -EINVAL; | ||
3439 | } | ||
3440 | |||
3441 | - qed_mcp_nvm_info_populate(p_hwfn); | ||
3442 | + rc = qed_mcp_nvm_info_populate(p_hwfn); | ||
3443 | + if (rc) | ||
3444 | + return rc; | ||
3445 | + | ||
3446 | for (i = 0; i < p_hwfn->nvm_info.num_images; i++) | ||
3447 | if (type == p_hwfn->nvm_info.image_att[i].image_type) | ||
3448 | break; | ||
3449 | diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c | ||
3450 | index c48a0e2d4d7ef..6a009d51ec510 100644 | ||
3451 | --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c | ||
3452 | +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c | ||
3453 | @@ -440,7 +440,6 @@ int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter) | ||
3454 | QLCWR32(adapter, QLCNIC_CRB_PEG_NET_4 + 0x3c, 1); | ||
3455 | msleep(20); | ||
3456 | |||
3457 | - qlcnic_rom_unlock(adapter); | ||
3458 | /* big hammer don't reset CAM block on reset */ | ||
3459 | QLCWR32(adapter, QLCNIC_ROMUSB_GLB_SW_RESET, 0xfeffffff); | ||
3460 | |||
3461 | diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c | ||
3462 | index 274e5b4bc4ac8..f158fdf3aab2c 100644 | ||
3463 | --- a/drivers/net/ethernet/rdc/r6040.c | ||
3464 | +++ b/drivers/net/ethernet/rdc/r6040.c | ||
3465 | @@ -119,6 +119,8 @@ | ||
3466 | #define PHY_ST 0x8A /* PHY status register */ | ||
3467 | #define MAC_SM 0xAC /* MAC status machine */ | ||
3468 | #define MAC_SM_RST 0x0002 /* MAC status machine reset */ | ||
3469 | +#define MD_CSC 0xb6 /* MDC speed control register */ | ||
3470 | +#define MD_CSC_DEFAULT 0x0030 | ||
3471 | #define MAC_ID 0xBE /* Identifier register */ | ||
3472 | |||
3473 | #define TX_DCNT 0x80 /* TX descriptor count */ | ||
3474 | @@ -354,8 +356,9 @@ static void r6040_reset_mac(struct r6040_private *lp) | ||
3475 | { | ||
3476 | void __iomem *ioaddr = lp->base; | ||
3477 | int limit = MAC_DEF_TIMEOUT; | ||
3478 | - u16 cmd; | ||
3479 | + u16 cmd, md_csc; | ||
3480 | |||
3481 | + md_csc = ioread16(ioaddr + MD_CSC); | ||
3482 | iowrite16(MAC_RST, ioaddr + MCR1); | ||
3483 | while (limit--) { | ||
3484 | cmd = ioread16(ioaddr + MCR1); | ||
3485 | @@ -367,6 +370,10 @@ static void r6040_reset_mac(struct r6040_private *lp) | ||
3486 | iowrite16(MAC_SM_RST, ioaddr + MAC_SM); | ||
3487 | iowrite16(0, ioaddr + MAC_SM); | ||
3488 | mdelay(5); | ||
3489 | + | ||
3490 | + /* Restore MDIO clock frequency */ | ||
3491 | + if (md_csc != MD_CSC_DEFAULT) | ||
3492 | + iowrite16(md_csc, ioaddr + MD_CSC); | ||
3493 | } | ||
3494 | |||
3495 | static void r6040_init_mac_regs(struct net_device *dev) | ||
3496 | diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c | ||
3497 | index 931a44fe7afe8..50d85d0372302 100644 | ||
3498 | --- a/drivers/net/ethernet/renesas/sh_eth.c | ||
3499 | +++ b/drivers/net/ethernet/renesas/sh_eth.c | ||
3500 | @@ -2567,6 +2567,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) | ||
3501 | else | ||
3502 | txdesc->status |= cpu_to_le32(TD_TACT); | ||
3503 | |||
3504 | + wmb(); /* cur_tx must be incremented after TACT bit was set */ | ||
3505 | mdp->cur_tx++; | ||
3506 | |||
3507 | if (!(sh_eth_read(ndev, EDTRR) & mdp->cd->edtrr_trns)) | ||
3508 | diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | ||
3509 | index 0f56f8e336917..03b11f191c262 100644 | ||
3510 | --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | ||
3511 | +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | ||
3512 | @@ -288,10 +288,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) | ||
3513 | val &= ~NSS_COMMON_GMAC_CTL_PHY_IFACE_SEL; | ||
3514 | break; | ||
3515 | default: | ||
3516 | - dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n", | ||
3517 | - phy_modes(gmac->phy_mode)); | ||
3518 | - err = -EINVAL; | ||
3519 | - goto err_remove_config_dt; | ||
3520 | + goto err_unsupported_phy; | ||
3521 | } | ||
3522 | regmap_write(gmac->nss_common, NSS_COMMON_GMAC_CTL(gmac->id), val); | ||
3523 | |||
3524 | @@ -308,10 +305,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) | ||
3525 | NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id); | ||
3526 | break; | ||
3527 | default: | ||
3528 | - dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n", | ||
3529 | - phy_modes(gmac->phy_mode)); | ||
3530 | - err = -EINVAL; | ||
3531 | - goto err_remove_config_dt; | ||
3532 | + goto err_unsupported_phy; | ||
3533 | } | ||
3534 | regmap_write(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, val); | ||
3535 | |||
3536 | @@ -328,8 +322,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) | ||
3537 | NSS_COMMON_CLK_GATE_GMII_TX_EN(gmac->id); | ||
3538 | break; | ||
3539 | default: | ||
3540 | - /* We don't get here; the switch above will have errored out */ | ||
3541 | - unreachable(); | ||
3542 | + goto err_unsupported_phy; | ||
3543 | } | ||
3544 | regmap_write(gmac->nss_common, NSS_COMMON_CLK_GATE, val); | ||
3545 | |||
3546 | @@ -360,6 +353,11 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) | ||
3547 | |||
3548 | return 0; | ||
3549 | |||
3550 | +err_unsupported_phy: | ||
3551 | + dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n", | ||
3552 | + phy_modes(gmac->phy_mode)); | ||
3553 | + err = -EINVAL; | ||
3554 | + | ||
3555 | err_remove_config_dt: | ||
3556 | stmmac_remove_config_dt(pdev, plat_dat); | ||
3557 | |||
3558 | diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c | ||
3559 | index bede1ff289c59..a65b7291e12a2 100644 | ||
3560 | --- a/drivers/net/ethernet/wiznet/w5100.c | ||
3561 | +++ b/drivers/net/ethernet/wiznet/w5100.c | ||
3562 | @@ -1052,6 +1052,8 @@ static int w5100_mmio_probe(struct platform_device *pdev) | ||
3563 | mac_addr = data->mac_addr; | ||
3564 | |||
3565 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
3566 | + if (!mem) | ||
3567 | + return -EINVAL; | ||
3568 | if (resource_size(mem) < W5100_BUS_DIRECT_SIZE) | ||
3569 | ops = &w5100_mmio_indirect_ops; | ||
3570 | else | ||
3571 | diff --git a/drivers/net/phy/dp83640_reg.h b/drivers/net/phy/dp83640_reg.h | ||
3572 | index 21aa24c741b96..daae7fa58fb82 100644 | ||
3573 | --- a/drivers/net/phy/dp83640_reg.h | ||
3574 | +++ b/drivers/net/phy/dp83640_reg.h | ||
3575 | @@ -5,7 +5,7 @@ | ||
3576 | #ifndef HAVE_DP83640_REGISTERS | ||
3577 | #define HAVE_DP83640_REGISTERS | ||
3578 | |||
3579 | -#define PAGE0 0x0000 | ||
3580 | +/* #define PAGE0 0x0000 */ | ||
3581 | #define PHYCR2 0x001c /* PHY Control Register 2 */ | ||
3582 | |||
3583 | #define PAGE4 0x0004 | ||
3584 | diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c | ||
3585 | index eb100eb33de3d..77ac5a721e7b6 100644 | ||
3586 | --- a/drivers/net/usb/cdc_mbim.c | ||
3587 | +++ b/drivers/net/usb/cdc_mbim.c | ||
3588 | @@ -653,6 +653,11 @@ static const struct usb_device_id mbim_devs[] = { | ||
3589 | .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle, | ||
3590 | }, | ||
3591 | |||
3592 | + /* Telit LN920 */ | ||
3593 | + { USB_DEVICE_AND_INTERFACE_INFO(0x1bc7, 0x1061, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), | ||
3594 | + .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle, | ||
3595 | + }, | ||
3596 | + | ||
3597 | /* default entry */ | ||
3598 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), | ||
3599 | .driver_info = (unsigned long)&cdc_mbim_info_zlp, | ||
3600 | diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | ||
3601 | index b4885a700296e..b0a4ca3559fd8 100644 | ||
3602 | --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | ||
3603 | +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | ||
3604 | @@ -3351,7 +3351,8 @@ found: | ||
3605 | "Found block at %x: code=%d ref=%d length=%d major=%d minor=%d\n", | ||
3606 | cptr, code, reference, length, major, minor); | ||
3607 | if ((!AR_SREV_9485(ah) && length >= 1024) || | ||
3608 | - (AR_SREV_9485(ah) && length > EEPROM_DATA_LEN_9485)) { | ||
3609 | + (AR_SREV_9485(ah) && length > EEPROM_DATA_LEN_9485) || | ||
3610 | + (length > cptr)) { | ||
3611 | ath_dbg(common, EEPROM, "Skipping bad header\n"); | ||
3612 | cptr -= COMP_HDR_LEN; | ||
3613 | continue; | ||
3614 | diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c | ||
3615 | index 9fd8e64288ffa..7e2e22b6bbbc5 100644 | ||
3616 | --- a/drivers/net/wireless/ath/ath9k/hw.c | ||
3617 | +++ b/drivers/net/wireless/ath/ath9k/hw.c | ||
3618 | @@ -1622,7 +1622,6 @@ static void ath9k_hw_apply_gpio_override(struct ath_hw *ah) | ||
3619 | ath9k_hw_gpio_request_out(ah, i, NULL, | ||
3620 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||
3621 | ath9k_hw_set_gpio(ah, i, !!(ah->gpio_val & BIT(i))); | ||
3622 | - ath9k_hw_gpio_free(ah, i); | ||
3623 | } | ||
3624 | } | ||
3625 | |||
3626 | @@ -2730,14 +2729,17 @@ static void ath9k_hw_gpio_cfg_output_mux(struct ath_hw *ah, u32 gpio, u32 type) | ||
3627 | static void ath9k_hw_gpio_cfg_soc(struct ath_hw *ah, u32 gpio, bool out, | ||
3628 | const char *label) | ||
3629 | { | ||
3630 | + int err; | ||
3631 | + | ||
3632 | if (ah->caps.gpio_requested & BIT(gpio)) | ||
3633 | return; | ||
3634 | |||
3635 | - /* may be requested by BSP, free anyway */ | ||
3636 | - gpio_free(gpio); | ||
3637 | - | ||
3638 | - if (gpio_request_one(gpio, out ? GPIOF_OUT_INIT_LOW : GPIOF_IN, label)) | ||
3639 | + err = gpio_request_one(gpio, out ? GPIOF_OUT_INIT_LOW : GPIOF_IN, label); | ||
3640 | + if (err) { | ||
3641 | + ath_err(ath9k_hw_common(ah), "request GPIO%d failed:%d\n", | ||
3642 | + gpio, err); | ||
3643 | return; | ||
3644 | + } | ||
3645 | |||
3646 | ah->caps.gpio_requested |= BIT(gpio); | ||
3647 | } | ||
3648 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | ||
3649 | index 9c417dd062913..7736621dca653 100644 | ||
3650 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | ||
3651 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | ||
3652 | @@ -1043,8 +1043,10 @@ int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm, | ||
3653 | return -ENOMEM; | ||
3654 | |||
3655 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
3656 | - if (mvm->beacon_inject_active) | ||
3657 | + if (mvm->beacon_inject_active) { | ||
3658 | + dev_kfree_skb(beacon); | ||
3659 | return -EBUSY; | ||
3660 | + } | ||
3661 | #endif | ||
3662 | |||
3663 | ret = iwl_mvm_mac_ctxt_send_beacon(mvm, vif, beacon); | ||
3664 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | ||
3665 | index 09b1a6beee77c..081cbc9ec7368 100644 | ||
3666 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | ||
3667 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | ||
3668 | @@ -2970,16 +2970,20 @@ static void iwl_mvm_check_he_obss_narrow_bw_ru_iter(struct wiphy *wiphy, | ||
3669 | void *_data) | ||
3670 | { | ||
3671 | struct iwl_mvm_he_obss_narrow_bw_ru_data *data = _data; | ||
3672 | + const struct cfg80211_bss_ies *ies; | ||
3673 | const struct element *elem; | ||
3674 | |||
3675 | - elem = cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY, bss->ies->data, | ||
3676 | - bss->ies->len); | ||
3677 | + rcu_read_lock(); | ||
3678 | + ies = rcu_dereference(bss->ies); | ||
3679 | + elem = cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY, ies->data, | ||
3680 | + ies->len); | ||
3681 | |||
3682 | if (!elem || elem->datalen < 10 || | ||
3683 | !(elem->data[10] & | ||
3684 | WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT)) { | ||
3685 | data->tolerated = false; | ||
3686 | } | ||
3687 | + rcu_read_unlock(); | ||
3688 | } | ||
3689 | |||
3690 | static void iwl_mvm_check_he_obss_narrow_bw_ru(struct ieee80211_hw *hw, | ||
3691 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c | ||
3692 | index 8b0576cde797e..a9aab6c690e85 100644 | ||
3693 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c | ||
3694 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c | ||
3695 | @@ -687,10 +687,26 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | ||
3696 | |||
3697 | mvm->fw_restart = iwlwifi_mod_params.fw_restart ? -1 : 0; | ||
3698 | |||
3699 | - mvm->aux_queue = IWL_MVM_DQA_AUX_QUEUE; | ||
3700 | - mvm->snif_queue = IWL_MVM_DQA_INJECT_MONITOR_QUEUE; | ||
3701 | - mvm->probe_queue = IWL_MVM_DQA_AP_PROBE_RESP_QUEUE; | ||
3702 | - mvm->p2p_dev_queue = IWL_MVM_DQA_P2P_DEVICE_QUEUE; | ||
3703 | + if (iwl_mvm_has_new_tx_api(mvm)) { | ||
3704 | + /* | ||
3705 | + * If we have the new TX/queue allocation API initialize them | ||
3706 | + * all to invalid numbers. We'll rewrite the ones that we need | ||
3707 | + * later, but that doesn't happen for all of them all of the | ||
3708 | + * time (e.g. P2P Device is optional), and if a dynamic queue | ||
3709 | + * ends up getting number 2 (IWL_MVM_DQA_P2P_DEVICE_QUEUE) then | ||
3710 | + * iwl_mvm_is_static_queue() erroneously returns true, and we | ||
3711 | + * might have things getting stuck. | ||
3712 | + */ | ||
3713 | + mvm->aux_queue = IWL_MVM_INVALID_QUEUE; | ||
3714 | + mvm->snif_queue = IWL_MVM_INVALID_QUEUE; | ||
3715 | + mvm->probe_queue = IWL_MVM_INVALID_QUEUE; | ||
3716 | + mvm->p2p_dev_queue = IWL_MVM_INVALID_QUEUE; | ||
3717 | + } else { | ||
3718 | + mvm->aux_queue = IWL_MVM_DQA_AUX_QUEUE; | ||
3719 | + mvm->snif_queue = IWL_MVM_DQA_INJECT_MONITOR_QUEUE; | ||
3720 | + mvm->probe_queue = IWL_MVM_DQA_AP_PROBE_RESP_QUEUE; | ||
3721 | + mvm->p2p_dev_queue = IWL_MVM_DQA_P2P_DEVICE_QUEUE; | ||
3722 | + } | ||
3723 | |||
3724 | mvm->sf_state = SF_UNINIT; | ||
3725 | if (iwl_mvm_has_unified_ucode(mvm)) | ||
3726 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c | ||
3727 | index 40cafcf40ccf0..5df4bbb6c6de3 100644 | ||
3728 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c | ||
3729 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c | ||
3730 | @@ -346,8 +346,9 @@ static int iwl_mvm_invalidate_sta_queue(struct iwl_mvm *mvm, int queue, | ||
3731 | } | ||
3732 | |||
3733 | static int iwl_mvm_disable_txq(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | ||
3734 | - int queue, u8 tid, u8 flags) | ||
3735 | + u16 *queueptr, u8 tid, u8 flags) | ||
3736 | { | ||
3737 | + int queue = *queueptr; | ||
3738 | struct iwl_scd_txq_cfg_cmd cmd = { | ||
3739 | .scd_queue = queue, | ||
3740 | .action = SCD_CFG_DISABLE_QUEUE, | ||
3741 | @@ -356,6 +357,7 @@ static int iwl_mvm_disable_txq(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | ||
3742 | |||
3743 | if (iwl_mvm_has_new_tx_api(mvm)) { | ||
3744 | iwl_trans_txq_free(mvm->trans, queue); | ||
3745 | + *queueptr = IWL_MVM_INVALID_QUEUE; | ||
3746 | |||
3747 | return 0; | ||
3748 | } | ||
3749 | @@ -517,6 +519,7 @@ static int iwl_mvm_free_inactive_queue(struct iwl_mvm *mvm, int queue, | ||
3750 | u8 sta_id, tid; | ||
3751 | unsigned long disable_agg_tids = 0; | ||
3752 | bool same_sta; | ||
3753 | + u16 queue_tmp = queue; | ||
3754 | int ret; | ||
3755 | |||
3756 | lockdep_assert_held(&mvm->mutex); | ||
3757 | @@ -539,7 +542,7 @@ static int iwl_mvm_free_inactive_queue(struct iwl_mvm *mvm, int queue, | ||
3758 | iwl_mvm_invalidate_sta_queue(mvm, queue, | ||
3759 | disable_agg_tids, false); | ||
3760 | |||
3761 | - ret = iwl_mvm_disable_txq(mvm, old_sta, queue, tid, 0); | ||
3762 | + ret = iwl_mvm_disable_txq(mvm, old_sta, &queue_tmp, tid, 0); | ||
3763 | if (ret) { | ||
3764 | IWL_ERR(mvm, | ||
3765 | "Failed to free inactive queue %d (ret=%d)\n", | ||
3766 | @@ -1209,6 +1212,7 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm, | ||
3767 | unsigned int wdg_timeout = | ||
3768 | iwl_mvm_get_wd_timeout(mvm, mvmsta->vif, false, false); | ||
3769 | int queue = -1; | ||
3770 | + u16 queue_tmp; | ||
3771 | unsigned long disable_agg_tids = 0; | ||
3772 | enum iwl_mvm_agg_state queue_state; | ||
3773 | bool shared_queue = false, inc_ssn; | ||
3774 | @@ -1357,7 +1361,8 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm, | ||
3775 | return 0; | ||
3776 | |||
3777 | out_err: | ||
3778 | - iwl_mvm_disable_txq(mvm, sta, queue, tid, 0); | ||
3779 | + queue_tmp = queue; | ||
3780 | + iwl_mvm_disable_txq(mvm, sta, &queue_tmp, tid, 0); | ||
3781 | |||
3782 | return ret; | ||
3783 | } | ||
3784 | @@ -1795,7 +1800,7 @@ static void iwl_mvm_disable_sta_queues(struct iwl_mvm *mvm, | ||
3785 | if (mvm_sta->tid_data[i].txq_id == IWL_MVM_INVALID_QUEUE) | ||
3786 | continue; | ||
3787 | |||
3788 | - iwl_mvm_disable_txq(mvm, sta, mvm_sta->tid_data[i].txq_id, i, | ||
3789 | + iwl_mvm_disable_txq(mvm, sta, &mvm_sta->tid_data[i].txq_id, i, | ||
3790 | 0); | ||
3791 | mvm_sta->tid_data[i].txq_id = IWL_MVM_INVALID_QUEUE; | ||
3792 | } | ||
3793 | @@ -2005,7 +2010,7 @@ static int iwl_mvm_add_int_sta_with_queue(struct iwl_mvm *mvm, int macidx, | ||
3794 | ret = iwl_mvm_add_int_sta_common(mvm, sta, NULL, macidx, maccolor); | ||
3795 | if (ret) { | ||
3796 | if (!iwl_mvm_has_new_tx_api(mvm)) | ||
3797 | - iwl_mvm_disable_txq(mvm, NULL, *queue, | ||
3798 | + iwl_mvm_disable_txq(mvm, NULL, queue, | ||
3799 | IWL_MAX_TID_COUNT, 0); | ||
3800 | return ret; | ||
3801 | } | ||
3802 | @@ -2073,7 +2078,7 @@ int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | ||
3803 | if (WARN_ON_ONCE(mvm->snif_sta.sta_id == IWL_MVM_INVALID_STA)) | ||
3804 | return -EINVAL; | ||
3805 | |||
3806 | - iwl_mvm_disable_txq(mvm, NULL, mvm->snif_queue, IWL_MAX_TID_COUNT, 0); | ||
3807 | + iwl_mvm_disable_txq(mvm, NULL, &mvm->snif_queue, IWL_MAX_TID_COUNT, 0); | ||
3808 | ret = iwl_mvm_rm_sta_common(mvm, mvm->snif_sta.sta_id); | ||
3809 | if (ret) | ||
3810 | IWL_WARN(mvm, "Failed sending remove station\n"); | ||
3811 | @@ -2090,7 +2095,7 @@ int iwl_mvm_rm_aux_sta(struct iwl_mvm *mvm) | ||
3812 | if (WARN_ON_ONCE(mvm->aux_sta.sta_id == IWL_MVM_INVALID_STA)) | ||
3813 | return -EINVAL; | ||
3814 | |||
3815 | - iwl_mvm_disable_txq(mvm, NULL, mvm->aux_queue, IWL_MAX_TID_COUNT, 0); | ||
3816 | + iwl_mvm_disable_txq(mvm, NULL, &mvm->aux_queue, IWL_MAX_TID_COUNT, 0); | ||
3817 | ret = iwl_mvm_rm_sta_common(mvm, mvm->aux_sta.sta_id); | ||
3818 | if (ret) | ||
3819 | IWL_WARN(mvm, "Failed sending remove station\n"); | ||
3820 | @@ -2186,7 +2191,7 @@ static void iwl_mvm_free_bcast_sta_queues(struct iwl_mvm *mvm, | ||
3821 | struct ieee80211_vif *vif) | ||
3822 | { | ||
3823 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
3824 | - int queue; | ||
3825 | + u16 *queueptr, queue; | ||
3826 | |||
3827 | lockdep_assert_held(&mvm->mutex); | ||
3828 | |||
3829 | @@ -2195,10 +2200,10 @@ static void iwl_mvm_free_bcast_sta_queues(struct iwl_mvm *mvm, | ||
3830 | switch (vif->type) { | ||
3831 | case NL80211_IFTYPE_AP: | ||
3832 | case NL80211_IFTYPE_ADHOC: | ||
3833 | - queue = mvm->probe_queue; | ||
3834 | + queueptr = &mvm->probe_queue; | ||
3835 | break; | ||
3836 | case NL80211_IFTYPE_P2P_DEVICE: | ||
3837 | - queue = mvm->p2p_dev_queue; | ||
3838 | + queueptr = &mvm->p2p_dev_queue; | ||
3839 | break; | ||
3840 | default: | ||
3841 | WARN(1, "Can't free bcast queue on vif type %d\n", | ||
3842 | @@ -2206,7 +2211,8 @@ static void iwl_mvm_free_bcast_sta_queues(struct iwl_mvm *mvm, | ||
3843 | return; | ||
3844 | } | ||
3845 | |||
3846 | - iwl_mvm_disable_txq(mvm, NULL, queue, IWL_MAX_TID_COUNT, 0); | ||
3847 | + queue = *queueptr; | ||
3848 | + iwl_mvm_disable_txq(mvm, NULL, queueptr, IWL_MAX_TID_COUNT, 0); | ||
3849 | if (iwl_mvm_has_new_tx_api(mvm)) | ||
3850 | return; | ||
3851 | |||
3852 | @@ -2441,7 +2447,7 @@ int iwl_mvm_rm_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | ||
3853 | |||
3854 | iwl_mvm_flush_sta(mvm, &mvmvif->mcast_sta, true, 0); | ||
3855 | |||
3856 | - iwl_mvm_disable_txq(mvm, NULL, mvmvif->cab_queue, 0, 0); | ||
3857 | + iwl_mvm_disable_txq(mvm, NULL, &mvmvif->cab_queue, 0, 0); | ||
3858 | |||
3859 | ret = iwl_mvm_rm_sta_common(mvm, mvmvif->mcast_sta.sta_id); | ||
3860 | if (ret) | ||
3861 | diff --git a/drivers/ntb/test/ntb_msi_test.c b/drivers/ntb/test/ntb_msi_test.c | ||
3862 | index 99d826ed9c341..662067dc9ce2c 100644 | ||
3863 | --- a/drivers/ntb/test/ntb_msi_test.c | ||
3864 | +++ b/drivers/ntb/test/ntb_msi_test.c | ||
3865 | @@ -372,8 +372,10 @@ static int ntb_msit_probe(struct ntb_client *client, struct ntb_dev *ntb) | ||
3866 | if (ret) | ||
3867 | goto remove_dbgfs; | ||
3868 | |||
3869 | - if (!nm->isr_ctx) | ||
3870 | + if (!nm->isr_ctx) { | ||
3871 | + ret = -ENOMEM; | ||
3872 | goto remove_dbgfs; | ||
3873 | + } | ||
3874 | |||
3875 | ntb_link_enable(ntb, NTB_SPEED_AUTO, NTB_WIDTH_AUTO); | ||
3876 | |||
3877 | diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c | ||
3878 | index 5ce4766a6c9eb..251fe75798c13 100644 | ||
3879 | --- a/drivers/ntb/test/ntb_perf.c | ||
3880 | +++ b/drivers/ntb/test/ntb_perf.c | ||
3881 | @@ -597,6 +597,7 @@ static int perf_setup_inbuf(struct perf_peer *peer) | ||
3882 | return -ENOMEM; | ||
3883 | } | ||
3884 | if (!IS_ALIGNED(peer->inbuf_xlat, xlat_align)) { | ||
3885 | + ret = -EINVAL; | ||
3886 | dev_err(&perf->ntb->dev, "Unaligned inbuf allocated\n"); | ||
3887 | goto err_free_inbuf; | ||
3888 | } | ||
3889 | diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c | ||
3890 | index f6427a10a9908..38bbbbbc6f47f 100644 | ||
3891 | --- a/drivers/nvme/host/tcp.c | ||
3892 | +++ b/drivers/nvme/host/tcp.c | ||
3893 | @@ -642,17 +642,9 @@ static int nvme_tcp_recv_data(struct nvme_tcp_queue *queue, struct sk_buff *skb, | ||
3894 | unsigned int *offset, size_t *len) | ||
3895 | { | ||
3896 | struct nvme_tcp_data_pdu *pdu = (void *)queue->pdu; | ||
3897 | - struct nvme_tcp_request *req; | ||
3898 | - struct request *rq; | ||
3899 | - | ||
3900 | - rq = blk_mq_tag_to_rq(nvme_tcp_tagset(queue), pdu->command_id); | ||
3901 | - if (!rq) { | ||
3902 | - dev_err(queue->ctrl->ctrl.device, | ||
3903 | - "queue %d tag %#x not found\n", | ||
3904 | - nvme_tcp_queue_id(queue), pdu->command_id); | ||
3905 | - return -ENOENT; | ||
3906 | - } | ||
3907 | - req = blk_mq_rq_to_pdu(rq); | ||
3908 | + struct request *rq = | ||
3909 | + blk_mq_tag_to_rq(nvme_tcp_tagset(queue), pdu->command_id); | ||
3910 | + struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq); | ||
3911 | |||
3912 | while (true) { | ||
3913 | int recv_len, ret; | ||
3914 | diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c | ||
3915 | index a32e60b024b8d..6675b5e56960c 100644 | ||
3916 | --- a/drivers/of/kobj.c | ||
3917 | +++ b/drivers/of/kobj.c | ||
3918 | @@ -119,7 +119,7 @@ int __of_attach_node_sysfs(struct device_node *np) | ||
3919 | struct property *pp; | ||
3920 | int rc; | ||
3921 | |||
3922 | - if (!of_kset) | ||
3923 | + if (!IS_ENABLED(CONFIG_SYSFS) || !of_kset) | ||
3924 | return 0; | ||
3925 | |||
3926 | np->kobj.kset = of_kset; | ||
3927 | diff --git a/drivers/opp/of.c b/drivers/opp/of.c | ||
3928 | index 603c688fe23dc..30cc407c8f93f 100644 | ||
3929 | --- a/drivers/opp/of.c | ||
3930 | +++ b/drivers/opp/of.c | ||
3931 | @@ -95,15 +95,7 @@ static struct dev_pm_opp *_find_opp_of_np(struct opp_table *opp_table, | ||
3932 | static struct device_node *of_parse_required_opp(struct device_node *np, | ||
3933 | int index) | ||
3934 | { | ||
3935 | - struct device_node *required_np; | ||
3936 | - | ||
3937 | - required_np = of_parse_phandle(np, "required-opps", index); | ||
3938 | - if (unlikely(!required_np)) { | ||
3939 | - pr_err("%s: Unable to parse required-opps: %pOF, index: %d\n", | ||
3940 | - __func__, np, index); | ||
3941 | - } | ||
3942 | - | ||
3943 | - return required_np; | ||
3944 | + return of_parse_phandle(np, "required-opps", index); | ||
3945 | } | ||
3946 | |||
3947 | /* The caller must call dev_pm_opp_put_opp_table() after the table is used */ | ||
3948 | @@ -996,7 +988,7 @@ int of_get_required_opp_performance_state(struct device_node *np, int index) | ||
3949 | |||
3950 | required_np = of_parse_required_opp(np, index); | ||
3951 | if (!required_np) | ||
3952 | - return -EINVAL; | ||
3953 | + return -ENODEV; | ||
3954 | |||
3955 | opp_table = _find_table_of_opp_np(required_np); | ||
3956 | if (IS_ERR(opp_table)) { | ||
3957 | diff --git a/drivers/parport/ieee1284_ops.c b/drivers/parport/ieee1284_ops.c | ||
3958 | index 5d41dda6da4e7..75daa16f38b7f 100644 | ||
3959 | --- a/drivers/parport/ieee1284_ops.c | ||
3960 | +++ b/drivers/parport/ieee1284_ops.c | ||
3961 | @@ -535,7 +535,7 @@ size_t parport_ieee1284_ecp_read_data (struct parport *port, | ||
3962 | goto out; | ||
3963 | |||
3964 | /* Yield the port for a while. */ | ||
3965 | - if (count && dev->port->irq != PARPORT_IRQ_NONE) { | ||
3966 | + if (dev->port->irq != PARPORT_IRQ_NONE) { | ||
3967 | parport_release (dev); | ||
3968 | schedule_timeout_interruptible(msecs_to_jiffies(40)); | ||
3969 | parport_claim_or_block (dev); | ||
3970 | diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c | ||
3971 | index 0a2902569f140..0538348ed843f 100644 | ||
3972 | --- a/drivers/pci/controller/pci-aardvark.c | ||
3973 | +++ b/drivers/pci/controller/pci-aardvark.c | ||
3974 | @@ -62,6 +62,7 @@ | ||
3975 | #define PIO_COMPLETION_STATUS_CRS 2 | ||
3976 | #define PIO_COMPLETION_STATUS_CA 4 | ||
3977 | #define PIO_NON_POSTED_REQ BIT(10) | ||
3978 | +#define PIO_ERR_STATUS BIT(11) | ||
3979 | #define PIO_ADDR_LS (PIO_BASE_ADDR + 0x8) | ||
3980 | #define PIO_ADDR_MS (PIO_BASE_ADDR + 0xc) | ||
3981 | #define PIO_WR_DATA (PIO_BASE_ADDR + 0x10) | ||
3982 | @@ -176,7 +177,7 @@ | ||
3983 | (PCIE_CONF_BUS(bus) | PCIE_CONF_DEV(PCI_SLOT(devfn)) | \ | ||
3984 | PCIE_CONF_FUNC(PCI_FUNC(devfn)) | PCIE_CONF_REG(where)) | ||
3985 | |||
3986 | -#define PIO_RETRY_CNT 500 | ||
3987 | +#define PIO_RETRY_CNT 750000 /* 1.5 s */ | ||
3988 | #define PIO_RETRY_DELAY 2 /* 2 us*/ | ||
3989 | |||
3990 | #define LINK_WAIT_MAX_RETRIES 10 | ||
3991 | @@ -193,6 +194,7 @@ struct advk_pcie { | ||
3992 | struct list_head resources; | ||
3993 | struct irq_domain *irq_domain; | ||
3994 | struct irq_chip irq_chip; | ||
3995 | + raw_spinlock_t irq_lock; | ||
3996 | struct irq_domain *msi_domain; | ||
3997 | struct irq_domain *msi_inner_domain; | ||
3998 | struct irq_chip msi_bottom_irq_chip; | ||
3999 | @@ -363,7 +365,7 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) | ||
4000 | advk_writel(pcie, reg, PCIE_CORE_CMD_STATUS_REG); | ||
4001 | } | ||
4002 | |||
4003 | -static void advk_pcie_check_pio_status(struct advk_pcie *pcie) | ||
4004 | +static int advk_pcie_check_pio_status(struct advk_pcie *pcie, u32 *val) | ||
4005 | { | ||
4006 | struct device *dev = &pcie->pdev->dev; | ||
4007 | u32 reg; | ||
4008 | @@ -374,14 +376,49 @@ static void advk_pcie_check_pio_status(struct advk_pcie *pcie) | ||
4009 | status = (reg & PIO_COMPLETION_STATUS_MASK) >> | ||
4010 | PIO_COMPLETION_STATUS_SHIFT; | ||
4011 | |||
4012 | - if (!status) | ||
4013 | - return; | ||
4014 | - | ||
4015 | + /* | ||
4016 | + * According to HW spec, the PIO status check sequence as below: | ||
4017 | + * 1) even if COMPLETION_STATUS(bit9:7) indicates successful, | ||
4018 | + * it still needs to check Error Status(bit11), only when this bit | ||
4019 | + * indicates no error happen, the operation is successful. | ||
4020 | + * 2) value Unsupported Request(1) of COMPLETION_STATUS(bit9:7) only | ||
4021 | + * means a PIO write error, and for PIO read it is successful with | ||
4022 | + * a read value of 0xFFFFFFFF. | ||
4023 | + * 3) value Completion Retry Status(CRS) of COMPLETION_STATUS(bit9:7) | ||
4024 | + * only means a PIO write error, and for PIO read it is successful | ||
4025 | + * with a read value of 0xFFFF0001. | ||
4026 | + * 4) value Completer Abort (CA) of COMPLETION_STATUS(bit9:7) means | ||
4027 | + * error for both PIO read and PIO write operation. | ||
4028 | + * 5) other errors are indicated as 'unknown'. | ||
4029 | + */ | ||
4030 | switch (status) { | ||
4031 | + case PIO_COMPLETION_STATUS_OK: | ||
4032 | + if (reg & PIO_ERR_STATUS) { | ||
4033 | + strcomp_status = "COMP_ERR"; | ||
4034 | + break; | ||
4035 | + } | ||
4036 | + /* Get the read result */ | ||
4037 | + if (val) | ||
4038 | + *val = advk_readl(pcie, PIO_RD_DATA); | ||
4039 | + /* No error */ | ||
4040 | + strcomp_status = NULL; | ||
4041 | + break; | ||
4042 | case PIO_COMPLETION_STATUS_UR: | ||
4043 | strcomp_status = "UR"; | ||
4044 | break; | ||
4045 | case PIO_COMPLETION_STATUS_CRS: | ||
4046 | + /* PCIe r4.0, sec 2.3.2, says: | ||
4047 | + * If CRS Software Visibility is not enabled, the Root Complex | ||
4048 | + * must re-issue the Configuration Request as a new Request. | ||
4049 | + * A Root Complex implementation may choose to limit the number | ||
4050 | + * of Configuration Request/CRS Completion Status loops before | ||
4051 | + * determining that something is wrong with the target of the | ||
4052 | + * Request and taking appropriate action, e.g., complete the | ||
4053 | + * Request to the host as a failed transaction. | ||
4054 | + * | ||
4055 | + * To simplify implementation do not re-issue the Configuration | ||
4056 | + * Request and complete the Request as a failed transaction. | ||
4057 | + */ | ||
4058 | strcomp_status = "CRS"; | ||
4059 | break; | ||
4060 | case PIO_COMPLETION_STATUS_CA: | ||
4061 | @@ -392,6 +429,9 @@ static void advk_pcie_check_pio_status(struct advk_pcie *pcie) | ||
4062 | break; | ||
4063 | } | ||
4064 | |||
4065 | + if (!strcomp_status) | ||
4066 | + return 0; | ||
4067 | + | ||
4068 | if (reg & PIO_NON_POSTED_REQ) | ||
4069 | str_posted = "Non-posted"; | ||
4070 | else | ||
4071 | @@ -399,6 +439,8 @@ static void advk_pcie_check_pio_status(struct advk_pcie *pcie) | ||
4072 | |||
4073 | dev_err(dev, "%s PIO Response Status: %s, %#x @ %#x\n", | ||
4074 | str_posted, strcomp_status, reg, advk_readl(pcie, PIO_ADDR_LS)); | ||
4075 | + | ||
4076 | + return -EFAULT; | ||
4077 | } | ||
4078 | |||
4079 | static int advk_pcie_wait_pio(struct advk_pcie *pcie) | ||
4080 | @@ -625,10 +667,13 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, | ||
4081 | if (ret < 0) | ||
4082 | return PCIBIOS_SET_FAILED; | ||
4083 | |||
4084 | - advk_pcie_check_pio_status(pcie); | ||
4085 | + /* Check PIO status and get the read result */ | ||
4086 | + ret = advk_pcie_check_pio_status(pcie, val); | ||
4087 | + if (ret < 0) { | ||
4088 | + *val = 0xffffffff; | ||
4089 | + return PCIBIOS_SET_FAILED; | ||
4090 | + } | ||
4091 | |||
4092 | - /* Get the read result */ | ||
4093 | - *val = advk_readl(pcie, PIO_RD_DATA); | ||
4094 | if (size == 1) | ||
4095 | *val = (*val >> (8 * (where & 3))) & 0xff; | ||
4096 | else if (size == 2) | ||
4097 | @@ -692,7 +737,9 @@ static int advk_pcie_wr_conf(struct pci_bus *bus, u32 devfn, | ||
4098 | if (ret < 0) | ||
4099 | return PCIBIOS_SET_FAILED; | ||
4100 | |||
4101 | - advk_pcie_check_pio_status(pcie); | ||
4102 | + ret = advk_pcie_check_pio_status(pcie, NULL); | ||
4103 | + if (ret < 0) | ||
4104 | + return PCIBIOS_SET_FAILED; | ||
4105 | |||
4106 | return PCIBIOS_SUCCESSFUL; | ||
4107 | } | ||
4108 | @@ -766,22 +813,28 @@ static void advk_pcie_irq_mask(struct irq_data *d) | ||
4109 | { | ||
4110 | struct advk_pcie *pcie = d->domain->host_data; | ||
4111 | irq_hw_number_t hwirq = irqd_to_hwirq(d); | ||
4112 | + unsigned long flags; | ||
4113 | u32 mask; | ||
4114 | |||
4115 | + raw_spin_lock_irqsave(&pcie->irq_lock, flags); | ||
4116 | mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); | ||
4117 | mask |= PCIE_ISR1_INTX_ASSERT(hwirq); | ||
4118 | advk_writel(pcie, mask, PCIE_ISR1_MASK_REG); | ||
4119 | + raw_spin_unlock_irqrestore(&pcie->irq_lock, flags); | ||
4120 | } | ||
4121 | |||
4122 | static void advk_pcie_irq_unmask(struct irq_data *d) | ||
4123 | { | ||
4124 | struct advk_pcie *pcie = d->domain->host_data; | ||
4125 | irq_hw_number_t hwirq = irqd_to_hwirq(d); | ||
4126 | + unsigned long flags; | ||
4127 | u32 mask; | ||
4128 | |||
4129 | + raw_spin_lock_irqsave(&pcie->irq_lock, flags); | ||
4130 | mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); | ||
4131 | mask &= ~PCIE_ISR1_INTX_ASSERT(hwirq); | ||
4132 | advk_writel(pcie, mask, PCIE_ISR1_MASK_REG); | ||
4133 | + raw_spin_unlock_irqrestore(&pcie->irq_lock, flags); | ||
4134 | } | ||
4135 | |||
4136 | static int advk_pcie_irq_map(struct irq_domain *h, | ||
4137 | @@ -865,6 +918,8 @@ static int advk_pcie_init_irq_domain(struct advk_pcie *pcie) | ||
4138 | struct irq_chip *irq_chip; | ||
4139 | int ret = 0; | ||
4140 | |||
4141 | + raw_spin_lock_init(&pcie->irq_lock); | ||
4142 | + | ||
4143 | pcie_intc_node = of_get_next_child(node, NULL); | ||
4144 | if (!pcie_intc_node) { | ||
4145 | dev_err(dev, "No PCIe Intc node found\n"); | ||
4146 | diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c | ||
4147 | index 45c0f344ccd16..11b046b20b92a 100644 | ||
4148 | --- a/drivers/pci/controller/pcie-xilinx-nwl.c | ||
4149 | +++ b/drivers/pci/controller/pcie-xilinx-nwl.c | ||
4150 | @@ -6,6 +6,7 @@ | ||
4151 | * (C) Copyright 2014 - 2015, Xilinx, Inc. | ||
4152 | */ | ||
4153 | |||
4154 | +#include <linux/clk.h> | ||
4155 | #include <linux/delay.h> | ||
4156 | #include <linux/interrupt.h> | ||
4157 | #include <linux/irq.h> | ||
4158 | @@ -169,6 +170,7 @@ struct nwl_pcie { | ||
4159 | u8 root_busno; | ||
4160 | struct nwl_msi msi; | ||
4161 | struct irq_domain *legacy_irq_domain; | ||
4162 | + struct clk *clk; | ||
4163 | raw_spinlock_t leg_mask_lock; | ||
4164 | }; | ||
4165 | |||
4166 | @@ -839,6 +841,16 @@ static int nwl_pcie_probe(struct platform_device *pdev) | ||
4167 | return err; | ||
4168 | } | ||
4169 | |||
4170 | + pcie->clk = devm_clk_get(dev, NULL); | ||
4171 | + if (IS_ERR(pcie->clk)) | ||
4172 | + return PTR_ERR(pcie->clk); | ||
4173 | + | ||
4174 | + err = clk_prepare_enable(pcie->clk); | ||
4175 | + if (err) { | ||
4176 | + dev_err(dev, "can't enable PCIe ref clock\n"); | ||
4177 | + return err; | ||
4178 | + } | ||
4179 | + | ||
4180 | err = nwl_pcie_bridge_init(pcie); | ||
4181 | if (err) { | ||
4182 | dev_err(dev, "HW Initialization failed\n"); | ||
4183 | diff --git a/drivers/pci/hotplug/TODO b/drivers/pci/hotplug/TODO | ||
4184 | index a32070be5adf9..cc6194aa24c15 100644 | ||
4185 | --- a/drivers/pci/hotplug/TODO | ||
4186 | +++ b/drivers/pci/hotplug/TODO | ||
4187 | @@ -40,9 +40,6 @@ ibmphp: | ||
4188 | |||
4189 | * The return value of pci_hp_register() is not checked. | ||
4190 | |||
4191 | -* iounmap(io_mem) is called in the error path of ebda_rsrc_controller() | ||
4192 | - and once more in the error path of its caller ibmphp_access_ebda(). | ||
4193 | - | ||
4194 | * The various slot data structures are difficult to follow and need to be | ||
4195 | simplified. A lot of functions are too large and too complex, they need | ||
4196 | to be broken up into smaller, manageable pieces. Negative examples are | ||
4197 | diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c | ||
4198 | index 11a2661dc0627..7fb75401ad8a7 100644 | ||
4199 | --- a/drivers/pci/hotplug/ibmphp_ebda.c | ||
4200 | +++ b/drivers/pci/hotplug/ibmphp_ebda.c | ||
4201 | @@ -714,8 +714,7 @@ static int __init ebda_rsrc_controller(void) | ||
4202 | /* init hpc structure */ | ||
4203 | hpc_ptr = alloc_ebda_hpc(slot_num, bus_num); | ||
4204 | if (!hpc_ptr) { | ||
4205 | - rc = -ENOMEM; | ||
4206 | - goto error_no_hpc; | ||
4207 | + return -ENOMEM; | ||
4208 | } | ||
4209 | hpc_ptr->ctlr_id = ctlr_id; | ||
4210 | hpc_ptr->ctlr_relative_id = ctlr; | ||
4211 | @@ -910,8 +909,6 @@ error: | ||
4212 | kfree(tmp_slot); | ||
4213 | error_no_slot: | ||
4214 | free_ebda_hpc(hpc_ptr); | ||
4215 | -error_no_hpc: | ||
4216 | - iounmap(io_mem); | ||
4217 | return rc; | ||
4218 | } | ||
4219 | |||
4220 | diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c | ||
4221 | index 5bb37671a86ad..c8bd243717b7b 100644 | ||
4222 | --- a/drivers/pci/msi.c | ||
4223 | +++ b/drivers/pci/msi.c | ||
4224 | @@ -782,6 +782,9 @@ static void msix_mask_all(void __iomem *base, int tsize) | ||
4225 | u32 ctrl = PCI_MSIX_ENTRY_CTRL_MASKBIT; | ||
4226 | int i; | ||
4227 | |||
4228 | + if (pci_msi_ignore_mask) | ||
4229 | + return; | ||
4230 | + | ||
4231 | for (i = 0; i < tsize; i++, base += PCI_MSIX_ENTRY_SIZE) | ||
4232 | writel(ctrl, base + PCI_MSIX_ENTRY_VECTOR_CTRL); | ||
4233 | } | ||
4234 | diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c | ||
4235 | index 58c33b65d451a..b9550cd4280ca 100644 | ||
4236 | --- a/drivers/pci/pci.c | ||
4237 | +++ b/drivers/pci/pci.c | ||
4238 | @@ -224,7 +224,7 @@ static int pci_dev_str_match_path(struct pci_dev *dev, const char *path, | ||
4239 | |||
4240 | *endptr = strchrnul(path, ';'); | ||
4241 | |||
4242 | - wpath = kmemdup_nul(path, *endptr - path, GFP_KERNEL); | ||
4243 | + wpath = kmemdup_nul(path, *endptr - path, GFP_ATOMIC); | ||
4244 | if (!wpath) | ||
4245 | return -ENOMEM; | ||
4246 | |||
4247 | @@ -1672,11 +1672,7 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags) | ||
4248 | * so that things like MSI message writing will behave as expected | ||
4249 | * (e.g. if the device really is in D0 at enable time). | ||
4250 | */ | ||
4251 | - if (dev->pm_cap) { | ||
4252 | - u16 pmcsr; | ||
4253 | - pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); | ||
4254 | - dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); | ||
4255 | - } | ||
4256 | + pci_update_current_state(dev, dev->current_state); | ||
4257 | |||
4258 | if (atomic_inc_return(&dev->enable_cnt) > 1) | ||
4259 | return 0; /* already enabled */ | ||
4260 | diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c | ||
4261 | index 1b330129089fe..8637f6068f9c2 100644 | ||
4262 | --- a/drivers/pci/pcie/portdrv_core.c | ||
4263 | +++ b/drivers/pci/pcie/portdrv_core.c | ||
4264 | @@ -255,8 +255,13 @@ static int get_port_device_capability(struct pci_dev *dev) | ||
4265 | services |= PCIE_PORT_SERVICE_DPC; | ||
4266 | |||
4267 | if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM || | ||
4268 | - pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) | ||
4269 | - services |= PCIE_PORT_SERVICE_BWNOTIF; | ||
4270 | + pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) { | ||
4271 | + u32 linkcap; | ||
4272 | + | ||
4273 | + pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &linkcap); | ||
4274 | + if (linkcap & PCI_EXP_LNKCAP_LBNC) | ||
4275 | + services |= PCIE_PORT_SERVICE_BWNOTIF; | ||
4276 | + } | ||
4277 | |||
4278 | return services; | ||
4279 | } | ||
4280 | diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c | ||
4281 | index 97c343d31f989..686298c0f6cda 100644 | ||
4282 | --- a/drivers/pci/quirks.c | ||
4283 | +++ b/drivers/pci/quirks.c | ||
4284 | @@ -3252,6 +3252,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE, | ||
4285 | PCI_DEVICE_ID_SOLARFLARE_SFC4000A_1, fixup_mpss_256); | ||
4286 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE, | ||
4287 | PCI_DEVICE_ID_SOLARFLARE_SFC4000B, fixup_mpss_256); | ||
4288 | +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ASMEDIA, 0x0612, fixup_mpss_256); | ||
4289 | |||
4290 | /* | ||
4291 | * Intel 5000 and 5100 Memory controllers have an erratum with read completion | ||
4292 | @@ -4683,6 +4684,18 @@ static int pci_quirk_qcom_rp_acs(struct pci_dev *dev, u16 acs_flags) | ||
4293 | PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); | ||
4294 | } | ||
4295 | |||
4296 | +/* | ||
4297 | + * Each of these NXP Root Ports is in a Root Complex with a unique segment | ||
4298 | + * number and does provide isolation features to disable peer transactions | ||
4299 | + * and validate bus numbers in requests, but does not provide an ACS | ||
4300 | + * capability. | ||
4301 | + */ | ||
4302 | +static int pci_quirk_nxp_rp_acs(struct pci_dev *dev, u16 acs_flags) | ||
4303 | +{ | ||
4304 | + return pci_acs_ctrl_enabled(acs_flags, | ||
4305 | + PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); | ||
4306 | +} | ||
4307 | + | ||
4308 | static int pci_quirk_al_acs(struct pci_dev *dev, u16 acs_flags) | ||
4309 | { | ||
4310 | if (pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT) | ||
4311 | @@ -4909,6 +4922,10 @@ static const struct pci_dev_acs_enabled { | ||
4312 | { 0x10df, 0x720, pci_quirk_mf_endpoint_acs }, /* Emulex Skyhawk-R */ | ||
4313 | /* Cavium ThunderX */ | ||
4314 | { PCI_VENDOR_ID_CAVIUM, PCI_ANY_ID, pci_quirk_cavium_acs }, | ||
4315 | + /* Cavium multi-function devices */ | ||
4316 | + { PCI_VENDOR_ID_CAVIUM, 0xA026, pci_quirk_mf_endpoint_acs }, | ||
4317 | + { PCI_VENDOR_ID_CAVIUM, 0xA059, pci_quirk_mf_endpoint_acs }, | ||
4318 | + { PCI_VENDOR_ID_CAVIUM, 0xA060, pci_quirk_mf_endpoint_acs }, | ||
4319 | /* APM X-Gene */ | ||
4320 | { PCI_VENDOR_ID_AMCC, 0xE004, pci_quirk_xgene_acs }, | ||
4321 | /* Ampere Computing */ | ||
4322 | @@ -4929,6 +4946,39 @@ static const struct pci_dev_acs_enabled { | ||
4323 | { PCI_VENDOR_ID_ZHAOXIN, 0x3038, pci_quirk_mf_endpoint_acs }, | ||
4324 | { PCI_VENDOR_ID_ZHAOXIN, 0x3104, pci_quirk_mf_endpoint_acs }, | ||
4325 | { PCI_VENDOR_ID_ZHAOXIN, 0x9083, pci_quirk_mf_endpoint_acs }, | ||
4326 | + /* NXP root ports, xx=16, 12, or 08 cores */ | ||
4327 | + /* LX2xx0A : without security features + CAN-FD */ | ||
4328 | + { PCI_VENDOR_ID_NXP, 0x8d81, pci_quirk_nxp_rp_acs }, | ||
4329 | + { PCI_VENDOR_ID_NXP, 0x8da1, pci_quirk_nxp_rp_acs }, | ||
4330 | + { PCI_VENDOR_ID_NXP, 0x8d83, pci_quirk_nxp_rp_acs }, | ||
4331 | + /* LX2xx0C : security features + CAN-FD */ | ||
4332 | + { PCI_VENDOR_ID_NXP, 0x8d80, pci_quirk_nxp_rp_acs }, | ||
4333 | + { PCI_VENDOR_ID_NXP, 0x8da0, pci_quirk_nxp_rp_acs }, | ||
4334 | + { PCI_VENDOR_ID_NXP, 0x8d82, pci_quirk_nxp_rp_acs }, | ||
4335 | + /* LX2xx0E : security features + CAN */ | ||
4336 | + { PCI_VENDOR_ID_NXP, 0x8d90, pci_quirk_nxp_rp_acs }, | ||
4337 | + { PCI_VENDOR_ID_NXP, 0x8db0, pci_quirk_nxp_rp_acs }, | ||
4338 | + { PCI_VENDOR_ID_NXP, 0x8d92, pci_quirk_nxp_rp_acs }, | ||
4339 | + /* LX2xx0N : without security features + CAN */ | ||
4340 | + { PCI_VENDOR_ID_NXP, 0x8d91, pci_quirk_nxp_rp_acs }, | ||
4341 | + { PCI_VENDOR_ID_NXP, 0x8db1, pci_quirk_nxp_rp_acs }, | ||
4342 | + { PCI_VENDOR_ID_NXP, 0x8d93, pci_quirk_nxp_rp_acs }, | ||
4343 | + /* LX2xx2A : without security features + CAN-FD */ | ||
4344 | + { PCI_VENDOR_ID_NXP, 0x8d89, pci_quirk_nxp_rp_acs }, | ||
4345 | + { PCI_VENDOR_ID_NXP, 0x8da9, pci_quirk_nxp_rp_acs }, | ||
4346 | + { PCI_VENDOR_ID_NXP, 0x8d8b, pci_quirk_nxp_rp_acs }, | ||
4347 | + /* LX2xx2C : security features + CAN-FD */ | ||
4348 | + { PCI_VENDOR_ID_NXP, 0x8d88, pci_quirk_nxp_rp_acs }, | ||
4349 | + { PCI_VENDOR_ID_NXP, 0x8da8, pci_quirk_nxp_rp_acs }, | ||
4350 | + { PCI_VENDOR_ID_NXP, 0x8d8a, pci_quirk_nxp_rp_acs }, | ||
4351 | + /* LX2xx2E : security features + CAN */ | ||
4352 | + { PCI_VENDOR_ID_NXP, 0x8d98, pci_quirk_nxp_rp_acs }, | ||
4353 | + { PCI_VENDOR_ID_NXP, 0x8db8, pci_quirk_nxp_rp_acs }, | ||
4354 | + { PCI_VENDOR_ID_NXP, 0x8d9a, pci_quirk_nxp_rp_acs }, | ||
4355 | + /* LX2xx2N : without security features + CAN */ | ||
4356 | + { PCI_VENDOR_ID_NXP, 0x8d99, pci_quirk_nxp_rp_acs }, | ||
4357 | + { PCI_VENDOR_ID_NXP, 0x8db9, pci_quirk_nxp_rp_acs }, | ||
4358 | + { PCI_VENDOR_ID_NXP, 0x8d9b, pci_quirk_nxp_rp_acs }, | ||
4359 | /* Zhaoxin Root/Downstream Ports */ | ||
4360 | { PCI_VENDOR_ID_ZHAOXIN, PCI_ANY_ID, pci_quirk_zhaoxin_pcie_ports_acs }, | ||
4361 | { 0 } | ||
4362 | @@ -5393,7 +5443,7 @@ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, | ||
4363 | PCI_CLASS_MULTIMEDIA_HD_AUDIO, 8, quirk_gpu_hda); | ||
4364 | |||
4365 | /* | ||
4366 | - * Create device link for NVIDIA GPU with integrated USB xHCI Host | ||
4367 | + * Create device link for GPUs with integrated USB xHCI Host | ||
4368 | * controller to VGA. | ||
4369 | */ | ||
4370 | static void quirk_gpu_usb(struct pci_dev *usb) | ||
4371 | @@ -5402,9 +5452,11 @@ static void quirk_gpu_usb(struct pci_dev *usb) | ||
4372 | } | ||
4373 | DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, | ||
4374 | PCI_CLASS_SERIAL_USB, 8, quirk_gpu_usb); | ||
4375 | +DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, PCI_ANY_ID, | ||
4376 | + PCI_CLASS_SERIAL_USB, 8, quirk_gpu_usb); | ||
4377 | |||
4378 | /* | ||
4379 | - * Create device link for NVIDIA GPU with integrated Type-C UCSI controller | ||
4380 | + * Create device link for GPUs with integrated Type-C UCSI controller | ||
4381 | * to VGA. Currently there is no class code defined for UCSI device over PCI | ||
4382 | * so using UNKNOWN class for now and it will be updated when UCSI | ||
4383 | * over PCI gets a class code. | ||
4384 | @@ -5417,6 +5469,9 @@ static void quirk_gpu_usb_typec_ucsi(struct pci_dev *ucsi) | ||
4385 | DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, | ||
4386 | PCI_CLASS_SERIAL_UNKNOWN, 8, | ||
4387 | quirk_gpu_usb_typec_ucsi); | ||
4388 | +DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, PCI_ANY_ID, | ||
4389 | + PCI_CLASS_SERIAL_UNKNOWN, 8, | ||
4390 | + quirk_gpu_usb_typec_ucsi); | ||
4391 | |||
4392 | /* | ||
4393 | * Enable the NVIDIA GPU integrated HDA controller if the BIOS left it | ||
4394 | diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c | ||
4395 | index 8b003c890b87b..c9f03418e71e0 100644 | ||
4396 | --- a/drivers/pci/syscall.c | ||
4397 | +++ b/drivers/pci/syscall.c | ||
4398 | @@ -22,8 +22,10 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn, | ||
4399 | long err; | ||
4400 | int cfg_ret; | ||
4401 | |||
4402 | + err = -EPERM; | ||
4403 | + dev = NULL; | ||
4404 | if (!capable(CAP_SYS_ADMIN)) | ||
4405 | - return -EPERM; | ||
4406 | + goto error; | ||
4407 | |||
4408 | err = -ENODEV; | ||
4409 | dev = pci_get_domain_bus_and_slot(0, bus, dfn); | ||
4410 | diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c | ||
4411 | index 91596eee0bda1..ba078a7098468 100644 | ||
4412 | --- a/drivers/pinctrl/pinctrl-ingenic.c | ||
4413 | +++ b/drivers/pinctrl/pinctrl-ingenic.c | ||
4414 | @@ -348,7 +348,7 @@ static const struct ingenic_chip_info jz4725b_chip_info = { | ||
4415 | }; | ||
4416 | |||
4417 | static const u32 jz4760_pull_ups[6] = { | ||
4418 | - 0xffffffff, 0xfffcf3ff, 0xffffffff, 0xffffcfff, 0xfffffb7c, 0xfffff00f, | ||
4419 | + 0xffffffff, 0xfffcf3ff, 0xffffffff, 0xffffcfff, 0xfffffb7c, 0x0000000f, | ||
4420 | }; | ||
4421 | |||
4422 | static const u32 jz4760_pull_downs[6] = { | ||
4423 | @@ -611,11 +611,11 @@ static const struct ingenic_chip_info jz4760b_chip_info = { | ||
4424 | }; | ||
4425 | |||
4426 | static const u32 jz4770_pull_ups[6] = { | ||
4427 | - 0x3fffffff, 0xfff0030c, 0xffffffff, 0xffff4fff, 0xfffffb7c, 0xffa7f00f, | ||
4428 | + 0x3fffffff, 0xfff0f3fc, 0xffffffff, 0xffff4fff, 0xfffffb7c, 0x0024f00f, | ||
4429 | }; | ||
4430 | |||
4431 | static const u32 jz4770_pull_downs[6] = { | ||
4432 | - 0x00000000, 0x000f0c03, 0x00000000, 0x0000b000, 0x00000483, 0x00580ff0, | ||
4433 | + 0x00000000, 0x000f0c03, 0x00000000, 0x0000b000, 0x00000483, 0x005b0ff0, | ||
4434 | }; | ||
4435 | |||
4436 | static int jz4770_uart0_data_pins[] = { 0xa0, 0xa3, }; | ||
4437 | diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c | ||
4438 | index a9d511982780c..fb1c8965cb991 100644 | ||
4439 | --- a/drivers/pinctrl/pinctrl-single.c | ||
4440 | +++ b/drivers/pinctrl/pinctrl-single.c | ||
4441 | @@ -1201,6 +1201,7 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs, | ||
4442 | |||
4443 | if (PCS_HAS_PINCONF) { | ||
4444 | dev_err(pcs->dev, "pinconf not supported\n"); | ||
4445 | + res = -ENOTSUPP; | ||
4446 | goto free_pingroups; | ||
4447 | } | ||
4448 | |||
4449 | diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c | ||
4450 | index ccdf0bb214149..835c14bb315bc 100644 | ||
4451 | --- a/drivers/pinctrl/pinctrl-stmfx.c | ||
4452 | +++ b/drivers/pinctrl/pinctrl-stmfx.c | ||
4453 | @@ -540,7 +540,7 @@ static irqreturn_t stmfx_pinctrl_irq_thread_fn(int irq, void *dev_id) | ||
4454 | u8 pending[NR_GPIO_REGS]; | ||
4455 | u8 src[NR_GPIO_REGS] = {0, 0, 0}; | ||
4456 | unsigned long n, status; | ||
4457 | - int ret; | ||
4458 | + int i, ret; | ||
4459 | |||
4460 | ret = regmap_bulk_read(pctl->stmfx->map, STMFX_REG_IRQ_GPI_PENDING, | ||
4461 | &pending, NR_GPIO_REGS); | ||
4462 | @@ -550,7 +550,9 @@ static irqreturn_t stmfx_pinctrl_irq_thread_fn(int irq, void *dev_id) | ||
4463 | regmap_bulk_write(pctl->stmfx->map, STMFX_REG_IRQ_GPI_SRC, | ||
4464 | src, NR_GPIO_REGS); | ||
4465 | |||
4466 | - status = *(unsigned long *)pending; | ||
4467 | + BUILD_BUG_ON(NR_GPIO_REGS > sizeof(status)); | ||
4468 | + for (i = 0, status = 0; i < NR_GPIO_REGS; i++) | ||
4469 | + status |= (unsigned long)pending[i] << (i * 8); | ||
4470 | for_each_set_bit(n, &status, gc->ngpio) { | ||
4471 | handle_nested_irq(irq_find_mapping(gc->irq.domain, n)); | ||
4472 | stmfx_pinctrl_irq_toggle_trigger(pctl, n); | ||
4473 | diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c | ||
4474 | index f26574ef234ab..601fffeba39fe 100644 | ||
4475 | --- a/drivers/pinctrl/samsung/pinctrl-samsung.c | ||
4476 | +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c | ||
4477 | @@ -918,7 +918,7 @@ static int samsung_pinctrl_register(struct platform_device *pdev, | ||
4478 | pin_bank->grange.pin_base = drvdata->pin_base | ||
4479 | + pin_bank->pin_base; | ||
4480 | pin_bank->grange.base = pin_bank->grange.pin_base; | ||
4481 | - pin_bank->grange.npins = pin_bank->gpio_chip.ngpio; | ||
4482 | + pin_bank->grange.npins = pin_bank->nr_pins; | ||
4483 | pin_bank->grange.gc = &pin_bank->gpio_chip; | ||
4484 | pinctrl_add_gpio_range(drvdata->pctl_dev, &pin_bank->grange); | ||
4485 | } | ||
4486 | diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c | ||
4487 | index f659f96bda128..9b575e9dd71c5 100644 | ||
4488 | --- a/drivers/platform/chrome/cros_ec_proto.c | ||
4489 | +++ b/drivers/platform/chrome/cros_ec_proto.c | ||
4490 | @@ -213,6 +213,15 @@ static int cros_ec_host_command_proto_query(struct cros_ec_device *ec_dev, | ||
4491 | msg->insize = sizeof(struct ec_response_get_protocol_info); | ||
4492 | |||
4493 | ret = send_command(ec_dev, msg); | ||
4494 | + /* | ||
4495 | + * Send command once again when timeout occurred. | ||
4496 | + * Fingerprint MCU (FPMCU) is restarted during system boot which | ||
4497 | + * introduces small window in which FPMCU won't respond for any | ||
4498 | + * messages sent by kernel. There is no need to wait before next | ||
4499 | + * attempt because we waited at least EC_MSG_DEADLINE_MS. | ||
4500 | + */ | ||
4501 | + if (ret == -ETIMEDOUT) | ||
4502 | + ret = send_command(ec_dev, msg); | ||
4503 | |||
4504 | if (ret < 0) { | ||
4505 | dev_dbg(ec_dev->dev, | ||
4506 | diff --git a/drivers/platform/x86/dell-smbios-wmi.c b/drivers/platform/x86/dell-smbios-wmi.c | ||
4507 | index c97bd4a452422..5821e9d9a4ce4 100644 | ||
4508 | --- a/drivers/platform/x86/dell-smbios-wmi.c | ||
4509 | +++ b/drivers/platform/x86/dell-smbios-wmi.c | ||
4510 | @@ -69,6 +69,7 @@ static int run_smbios_call(struct wmi_device *wdev) | ||
4511 | if (obj->type == ACPI_TYPE_INTEGER) | ||
4512 | dev_dbg(&wdev->dev, "SMBIOS call failed: %llu\n", | ||
4513 | obj->integer.value); | ||
4514 | + kfree(output.pointer); | ||
4515 | return -EIO; | ||
4516 | } | ||
4517 | memcpy(&priv->buf->std, obj->buffer.pointer, obj->buffer.length); | ||
4518 | diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c | ||
4519 | index ab4740c3bf573..f8f8207a1895e 100644 | ||
4520 | --- a/drivers/power/supply/max17042_battery.c | ||
4521 | +++ b/drivers/power/supply/max17042_battery.c | ||
4522 | @@ -842,8 +842,12 @@ static irqreturn_t max17042_thread_handler(int id, void *dev) | ||
4523 | { | ||
4524 | struct max17042_chip *chip = dev; | ||
4525 | u32 val; | ||
4526 | + int ret; | ||
4527 | + | ||
4528 | + ret = regmap_read(chip->regmap, MAX17042_STATUS, &val); | ||
4529 | + if (ret) | ||
4530 | + return IRQ_HANDLED; | ||
4531 | |||
4532 | - regmap_read(chip->regmap, MAX17042_STATUS, &val); | ||
4533 | if ((val & STATUS_INTR_SOCMIN_BIT) || | ||
4534 | (val & STATUS_INTR_SOCMAX_BIT)) { | ||
4535 | dev_info(&chip->client->dev, "SOC threshold INTR\n"); | ||
4536 | diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c | ||
4537 | index 2c0467a9e7179..8d1b1fda62dd1 100644 | ||
4538 | --- a/drivers/rtc/rtc-tps65910.c | ||
4539 | +++ b/drivers/rtc/rtc-tps65910.c | ||
4540 | @@ -460,6 +460,6 @@ static struct platform_driver tps65910_rtc_driver = { | ||
4541 | }; | ||
4542 | |||
4543 | module_platform_driver(tps65910_rtc_driver); | ||
4544 | -MODULE_ALIAS("platform:rtc-tps65910"); | ||
4545 | +MODULE_ALIAS("platform:tps65910-rtc"); | ||
4546 | MODULE_AUTHOR("Venu Byravarasu <vbyravarasu@nvidia.com>"); | ||
4547 | MODULE_LICENSE("GPL"); | ||
4548 | diff --git a/drivers/s390/char/sclp_early.c b/drivers/s390/char/sclp_early.c | ||
4549 | index cc5e84b80c699..faa3a4b8ed91d 100644 | ||
4550 | --- a/drivers/s390/char/sclp_early.c | ||
4551 | +++ b/drivers/s390/char/sclp_early.c | ||
4552 | @@ -40,13 +40,14 @@ static void __init sclp_early_facilities_detect(struct read_info_sccb *sccb) | ||
4553 | sclp.has_gisaf = !!(sccb->fac118 & 0x08); | ||
4554 | sclp.has_hvs = !!(sccb->fac119 & 0x80); | ||
4555 | sclp.has_kss = !!(sccb->fac98 & 0x01); | ||
4556 | - sclp.has_sipl = !!(sccb->cbl & 0x4000); | ||
4557 | if (sccb->fac85 & 0x02) | ||
4558 | S390_lowcore.machine_flags |= MACHINE_FLAG_ESOP; | ||
4559 | if (sccb->fac91 & 0x40) | ||
4560 | S390_lowcore.machine_flags |= MACHINE_FLAG_TLB_GUEST; | ||
4561 | if (sccb->cpuoff > 134) | ||
4562 | sclp.has_diag318 = !!(sccb->byte_134 & 0x80); | ||
4563 | + if (sccb->cpuoff > 137) | ||
4564 | + sclp.has_sipl = !!(sccb->cbl & 0x4000); | ||
4565 | sclp.rnmax = sccb->rnmax ? sccb->rnmax : sccb->rnmax2; | ||
4566 | sclp.rzm = sccb->rnsize ? sccb->rnsize : sccb->rnsize2; | ||
4567 | sclp.rzm <<= 20; | ||
4568 | diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c | ||
4569 | index 6e988233fb81f..6a54556119dd6 100644 | ||
4570 | --- a/drivers/scsi/BusLogic.c | ||
4571 | +++ b/drivers/scsi/BusLogic.c | ||
4572 | @@ -3601,7 +3601,7 @@ static void blogic_msg(enum blogic_msglevel msglevel, char *fmt, | ||
4573 | if (buf[0] != '\n' || len > 1) | ||
4574 | printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf); | ||
4575 | } else | ||
4576 | - printk("%s", buf); | ||
4577 | + pr_cont("%s", buf); | ||
4578 | } else { | ||
4579 | if (begin) { | ||
4580 | if (adapter != NULL && adapter->adapter_initd) | ||
4581 | @@ -3609,7 +3609,7 @@ static void blogic_msg(enum blogic_msglevel msglevel, char *fmt, | ||
4582 | else | ||
4583 | printk("%s%s", blogic_msglevelmap[msglevel], buf); | ||
4584 | } else | ||
4585 | - printk("%s", buf); | ||
4586 | + pr_cont("%s", buf); | ||
4587 | } | ||
4588 | begin = (buf[len - 1] == '\n'); | ||
4589 | } | ||
4590 | diff --git a/drivers/scsi/pcmcia/fdomain_cs.c b/drivers/scsi/pcmcia/fdomain_cs.c | ||
4591 | index e42acf314d068..33df6a9ba9b5f 100644 | ||
4592 | --- a/drivers/scsi/pcmcia/fdomain_cs.c | ||
4593 | +++ b/drivers/scsi/pcmcia/fdomain_cs.c | ||
4594 | @@ -45,8 +45,10 @@ static int fdomain_probe(struct pcmcia_device *link) | ||
4595 | goto fail_disable; | ||
4596 | |||
4597 | if (!request_region(link->resource[0]->start, FDOMAIN_REGION_SIZE, | ||
4598 | - "fdomain_cs")) | ||
4599 | + "fdomain_cs")) { | ||
4600 | + ret = -EBUSY; | ||
4601 | goto fail_disable; | ||
4602 | + } | ||
4603 | |||
4604 | sh = fdomain_create(link->resource[0]->start, link->irq, 7, &link->dev); | ||
4605 | if (!sh) { | ||
4606 | diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c | ||
4607 | index 7a6306f8483ec..c95e04cc64240 100644 | ||
4608 | --- a/drivers/scsi/qedf/qedf_main.c | ||
4609 | +++ b/drivers/scsi/qedf/qedf_main.c | ||
4610 | @@ -2894,7 +2894,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf) | ||
4611 | { | ||
4612 | u32 *list; | ||
4613 | int i; | ||
4614 | - int status = 0, rc; | ||
4615 | + int status; | ||
4616 | u32 *pbl; | ||
4617 | dma_addr_t page; | ||
4618 | int num_pages; | ||
4619 | @@ -2906,7 +2906,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf) | ||
4620 | */ | ||
4621 | if (!qedf->num_queues) { | ||
4622 | QEDF_ERR(&(qedf->dbg_ctx), "No MSI-X vectors available!\n"); | ||
4623 | - return 1; | ||
4624 | + return -ENOMEM; | ||
4625 | } | ||
4626 | |||
4627 | /* | ||
4628 | @@ -2914,7 +2914,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf) | ||
4629 | * addresses of our queues | ||
4630 | */ | ||
4631 | if (!qedf->p_cpuq) { | ||
4632 | - status = 1; | ||
4633 | + status = -EINVAL; | ||
4634 | QEDF_ERR(&qedf->dbg_ctx, "p_cpuq is NULL.\n"); | ||
4635 | goto mem_alloc_failure; | ||
4636 | } | ||
4637 | @@ -2930,8 +2930,8 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf) | ||
4638 | "qedf->global_queues=%p.\n", qedf->global_queues); | ||
4639 | |||
4640 | /* Allocate DMA coherent buffers for BDQ */ | ||
4641 | - rc = qedf_alloc_bdq(qedf); | ||
4642 | - if (rc) { | ||
4643 | + status = qedf_alloc_bdq(qedf); | ||
4644 | + if (status) { | ||
4645 | QEDF_ERR(&qedf->dbg_ctx, "Unable to allocate bdq.\n"); | ||
4646 | goto mem_alloc_failure; | ||
4647 | } | ||
4648 | diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c | ||
4649 | index 1ec42c5f0b2a0..92c4a367b7bd7 100644 | ||
4650 | --- a/drivers/scsi/qedi/qedi_main.c | ||
4651 | +++ b/drivers/scsi/qedi/qedi_main.c | ||
4652 | @@ -1553,7 +1553,7 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) | ||
4653 | { | ||
4654 | u32 *list; | ||
4655 | int i; | ||
4656 | - int status = 0, rc; | ||
4657 | + int status; | ||
4658 | u32 *pbl; | ||
4659 | dma_addr_t page; | ||
4660 | int num_pages; | ||
4661 | @@ -1564,14 +1564,14 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) | ||
4662 | */ | ||
4663 | if (!qedi->num_queues) { | ||
4664 | QEDI_ERR(&qedi->dbg_ctx, "No MSI-X vectors available!\n"); | ||
4665 | - return 1; | ||
4666 | + return -ENOMEM; | ||
4667 | } | ||
4668 | |||
4669 | /* Make sure we allocated the PBL that will contain the physical | ||
4670 | * addresses of our queues | ||
4671 | */ | ||
4672 | if (!qedi->p_cpuq) { | ||
4673 | - status = 1; | ||
4674 | + status = -EINVAL; | ||
4675 | goto mem_alloc_failure; | ||
4676 | } | ||
4677 | |||
4678 | @@ -1586,13 +1586,13 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) | ||
4679 | "qedi->global_queues=%p.\n", qedi->global_queues); | ||
4680 | |||
4681 | /* Allocate DMA coherent buffers for BDQ */ | ||
4682 | - rc = qedi_alloc_bdq(qedi); | ||
4683 | - if (rc) | ||
4684 | + status = qedi_alloc_bdq(qedi); | ||
4685 | + if (status) | ||
4686 | goto mem_alloc_failure; | ||
4687 | |||
4688 | /* Allocate DMA coherent buffers for NVM_ISCSI_CFG */ | ||
4689 | - rc = qedi_alloc_nvm_iscsi_cfg(qedi); | ||
4690 | - if (rc) | ||
4691 | + status = qedi_alloc_nvm_iscsi_cfg(qedi); | ||
4692 | + if (status) | ||
4693 | goto mem_alloc_failure; | ||
4694 | |||
4695 | /* Allocate a CQ and an associated PBL for each MSI-X | ||
4696 | diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c | ||
4697 | index 11656e864fca9..97453c12b7358 100644 | ||
4698 | --- a/drivers/scsi/qla2xxx/qla_nvme.c | ||
4699 | +++ b/drivers/scsi/qla2xxx/qla_nvme.c | ||
4700 | @@ -84,8 +84,9 @@ static int qla_nvme_alloc_queue(struct nvme_fc_local_port *lport, | ||
4701 | struct qla_hw_data *ha; | ||
4702 | struct qla_qpair *qpair; | ||
4703 | |||
4704 | - if (!qidx) | ||
4705 | - qidx++; | ||
4706 | + /* Map admin queue and 1st IO queue to index 0 */ | ||
4707 | + if (qidx) | ||
4708 | + qidx--; | ||
4709 | |||
4710 | vha = (struct scsi_qla_host *)lport->private; | ||
4711 | ha = vha->hw; | ||
4712 | diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c | ||
4713 | index 052ce78814075..28cbefe715e59 100644 | ||
4714 | --- a/drivers/scsi/qla2xxx/qla_os.c | ||
4715 | +++ b/drivers/scsi/qla2xxx/qla_os.c | ||
4716 | @@ -15,6 +15,7 @@ | ||
4717 | #include <linux/slab.h> | ||
4718 | #include <linux/blk-mq-pci.h> | ||
4719 | #include <linux/refcount.h> | ||
4720 | +#include <linux/crash_dump.h> | ||
4721 | |||
4722 | #include <scsi/scsi_tcq.h> | ||
4723 | #include <scsi/scsicam.h> | ||
4724 | @@ -2799,6 +2800,11 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | ||
4725 | return ret; | ||
4726 | } | ||
4727 | |||
4728 | + if (is_kdump_kernel()) { | ||
4729 | + ql2xmqsupport = 0; | ||
4730 | + ql2xallocfwdump = 0; | ||
4731 | + } | ||
4732 | + | ||
4733 | /* This may fail but that's ok */ | ||
4734 | pci_enable_pcie_error_reporting(pdev); | ||
4735 | |||
4736 | diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c | ||
4737 | index 9bc451004184f..80ff00025c03d 100644 | ||
4738 | --- a/drivers/scsi/smartpqi/smartpqi_init.c | ||
4739 | +++ b/drivers/scsi/smartpqi/smartpqi_init.c | ||
4740 | @@ -1192,6 +1192,7 @@ static int pqi_get_raid_map(struct pqi_ctrl_info *ctrl_info, | ||
4741 | "Requested %d bytes, received %d bytes", | ||
4742 | raid_map_size, | ||
4743 | get_unaligned_le32(&raid_map->structure_size)); | ||
4744 | + rc = -EINVAL; | ||
4745 | goto error; | ||
4746 | } | ||
4747 | } | ||
4748 | diff --git a/drivers/soc/aspeed/aspeed-lpc-ctrl.c b/drivers/soc/aspeed/aspeed-lpc-ctrl.c | ||
4749 | index 01ed21e8bfee5..040c7dc1d4792 100644 | ||
4750 | --- a/drivers/soc/aspeed/aspeed-lpc-ctrl.c | ||
4751 | +++ b/drivers/soc/aspeed/aspeed-lpc-ctrl.c | ||
4752 | @@ -46,7 +46,7 @@ static int aspeed_lpc_ctrl_mmap(struct file *file, struct vm_area_struct *vma) | ||
4753 | unsigned long vsize = vma->vm_end - vma->vm_start; | ||
4754 | pgprot_t prot = vma->vm_page_prot; | ||
4755 | |||
4756 | - if (vma->vm_pgoff + vsize > lpc_ctrl->mem_base + lpc_ctrl->mem_size) | ||
4757 | + if (vma->vm_pgoff + vma_pages(vma) > lpc_ctrl->mem_size >> PAGE_SHIFT) | ||
4758 | return -EINVAL; | ||
4759 | |||
4760 | /* ast2400/2500 AHB accesses are not cache coherent */ | ||
4761 | diff --git a/drivers/soc/aspeed/aspeed-p2a-ctrl.c b/drivers/soc/aspeed/aspeed-p2a-ctrl.c | ||
4762 | index b60fbeaffcbd0..20b5fb2a207cc 100644 | ||
4763 | --- a/drivers/soc/aspeed/aspeed-p2a-ctrl.c | ||
4764 | +++ b/drivers/soc/aspeed/aspeed-p2a-ctrl.c | ||
4765 | @@ -110,7 +110,7 @@ static int aspeed_p2a_mmap(struct file *file, struct vm_area_struct *vma) | ||
4766 | vsize = vma->vm_end - vma->vm_start; | ||
4767 | prot = vma->vm_page_prot; | ||
4768 | |||
4769 | - if (vma->vm_pgoff + vsize > ctrl->mem_base + ctrl->mem_size) | ||
4770 | + if (vma->vm_pgoff + vma_pages(vma) > ctrl->mem_size >> PAGE_SHIFT) | ||
4771 | return -EINVAL; | ||
4772 | |||
4773 | /* ast2400/2500 AHB accesses are not cache coherent */ | ||
4774 | diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c | ||
4775 | index 33a27e6c6d67d..45c5aa712edac 100644 | ||
4776 | --- a/drivers/soc/qcom/qcom_aoss.c | ||
4777 | +++ b/drivers/soc/qcom/qcom_aoss.c | ||
4778 | @@ -472,12 +472,12 @@ static int qmp_cooling_device_add(struct qmp *qmp, | ||
4779 | static int qmp_cooling_devices_register(struct qmp *qmp) | ||
4780 | { | ||
4781 | struct device_node *np, *child; | ||
4782 | - int count = QMP_NUM_COOLING_RESOURCES; | ||
4783 | + int count = 0; | ||
4784 | int ret; | ||
4785 | |||
4786 | np = qmp->dev->of_node; | ||
4787 | |||
4788 | - qmp->cooling_devs = devm_kcalloc(qmp->dev, count, | ||
4789 | + qmp->cooling_devs = devm_kcalloc(qmp->dev, QMP_NUM_COOLING_RESOURCES, | ||
4790 | sizeof(*qmp->cooling_devs), | ||
4791 | GFP_KERNEL); | ||
4792 | |||
4793 | @@ -493,12 +493,16 @@ static int qmp_cooling_devices_register(struct qmp *qmp) | ||
4794 | goto unroll; | ||
4795 | } | ||
4796 | |||
4797 | + if (!count) | ||
4798 | + devm_kfree(qmp->dev, qmp->cooling_devs); | ||
4799 | + | ||
4800 | return 0; | ||
4801 | |||
4802 | unroll: | ||
4803 | while (--count >= 0) | ||
4804 | thermal_cooling_device_unregister | ||
4805 | (qmp->cooling_devs[count].cdev); | ||
4806 | + devm_kfree(qmp->dev, qmp->cooling_devs); | ||
4807 | |||
4808 | return ret; | ||
4809 | } | ||
4810 | diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c | ||
4811 | index cb6feb34dd401..f980af0373452 100644 | ||
4812 | --- a/drivers/staging/board/board.c | ||
4813 | +++ b/drivers/staging/board/board.c | ||
4814 | @@ -136,6 +136,7 @@ int __init board_staging_register_clock(const struct board_staging_clk *bsc) | ||
4815 | static int board_staging_add_dev_domain(struct platform_device *pdev, | ||
4816 | const char *domain) | ||
4817 | { | ||
4818 | + struct device *dev = &pdev->dev; | ||
4819 | struct of_phandle_args pd_args; | ||
4820 | struct device_node *np; | ||
4821 | |||
4822 | @@ -148,7 +149,11 @@ static int board_staging_add_dev_domain(struct platform_device *pdev, | ||
4823 | pd_args.np = np; | ||
4824 | pd_args.args_count = 0; | ||
4825 | |||
4826 | - return of_genpd_add_device(&pd_args, &pdev->dev); | ||
4827 | + /* Initialization similar to device_pm_init_common() */ | ||
4828 | + spin_lock_init(&dev->power.lock); | ||
4829 | + dev->power.early_init = true; | ||
4830 | + | ||
4831 | + return of_genpd_add_device(&pd_args, dev); | ||
4832 | } | ||
4833 | #else | ||
4834 | static inline int board_staging_add_dev_domain(struct platform_device *pdev, | ||
4835 | diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c | ||
4836 | index 4b379542ecd50..3fbe223d59b8e 100644 | ||
4837 | --- a/drivers/staging/ks7010/ks7010_sdio.c | ||
4838 | +++ b/drivers/staging/ks7010/ks7010_sdio.c | ||
4839 | @@ -938,9 +938,9 @@ static void ks7010_private_init(struct ks_wlan_private *priv, | ||
4840 | memset(&priv->wstats, 0, sizeof(priv->wstats)); | ||
4841 | |||
4842 | /* sleep mode */ | ||
4843 | + atomic_set(&priv->sleepstatus.status, 0); | ||
4844 | atomic_set(&priv->sleepstatus.doze_request, 0); | ||
4845 | atomic_set(&priv->sleepstatus.wakeup_request, 0); | ||
4846 | - atomic_set(&priv->sleepstatus.wakeup_request, 0); | ||
4847 | |||
4848 | trx_device_init(priv); | ||
4849 | hostif_init(priv); | ||
4850 | diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c | ||
4851 | index 1deb74112ad43..11d9d9155eef2 100644 | ||
4852 | --- a/drivers/staging/rts5208/rtsx_scsi.c | ||
4853 | +++ b/drivers/staging/rts5208/rtsx_scsi.c | ||
4854 | @@ -2802,10 +2802,10 @@ static int get_ms_information(struct scsi_cmnd *srb, struct rtsx_chip *chip) | ||
4855 | } | ||
4856 | |||
4857 | if (dev_info_id == 0x15) { | ||
4858 | - buf_len = 0x3A; | ||
4859 | + buf_len = 0x3C; | ||
4860 | data_len = 0x3A; | ||
4861 | } else { | ||
4862 | - buf_len = 0x6A; | ||
4863 | + buf_len = 0x6C; | ||
4864 | data_len = 0x6A; | ||
4865 | } | ||
4866 | |||
4867 | @@ -2855,11 +2855,7 @@ static int get_ms_information(struct scsi_cmnd *srb, struct rtsx_chip *chip) | ||
4868 | } | ||
4869 | |||
4870 | rtsx_stor_set_xfer_buf(buf, buf_len, srb); | ||
4871 | - | ||
4872 | - if (dev_info_id == 0x15) | ||
4873 | - scsi_set_resid(srb, scsi_bufflen(srb) - 0x3C); | ||
4874 | - else | ||
4875 | - scsi_set_resid(srb, scsi_bufflen(srb) - 0x6C); | ||
4876 | + scsi_set_resid(srb, scsi_bufflen(srb) - buf_len); | ||
4877 | |||
4878 | kfree(buf); | ||
4879 | return STATUS_SUCCESS; | ||
4880 | diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c | ||
4881 | index 596ad3edec9c0..48fabece76443 100644 | ||
4882 | --- a/drivers/target/target_core_xcopy.c | ||
4883 | +++ b/drivers/target/target_core_xcopy.c | ||
4884 | @@ -533,7 +533,6 @@ void target_xcopy_release_pt(void) | ||
4885 | * @cdb: SCSI CDB to be copied into @xpt_cmd. | ||
4886 | * @remote_port: If false, use the LUN through which the XCOPY command has | ||
4887 | * been received. If true, use @se_dev->xcopy_lun. | ||
4888 | - * @alloc_mem: Whether or not to allocate an SGL list. | ||
4889 | * | ||
4890 | * Set up a SCSI command (READ or WRITE) that will be used to execute an | ||
4891 | * XCOPY command. | ||
4892 | @@ -543,12 +542,9 @@ static int target_xcopy_setup_pt_cmd( | ||
4893 | struct xcopy_op *xop, | ||
4894 | struct se_device *se_dev, | ||
4895 | unsigned char *cdb, | ||
4896 | - bool remote_port, | ||
4897 | - bool alloc_mem) | ||
4898 | + bool remote_port) | ||
4899 | { | ||
4900 | struct se_cmd *cmd = &xpt_cmd->se_cmd; | ||
4901 | - sense_reason_t sense_rc; | ||
4902 | - int ret = 0, rc; | ||
4903 | |||
4904 | /* | ||
4905 | * Setup LUN+port to honor reservations based upon xop->op_origin for | ||
4906 | @@ -564,46 +560,17 @@ static int target_xcopy_setup_pt_cmd( | ||
4907 | cmd->se_cmd_flags |= SCF_SE_LUN_CMD; | ||
4908 | |||
4909 | cmd->tag = 0; | ||
4910 | - sense_rc = target_setup_cmd_from_cdb(cmd, cdb); | ||
4911 | - if (sense_rc) { | ||
4912 | - ret = -EINVAL; | ||
4913 | - goto out; | ||
4914 | - } | ||
4915 | + if (target_setup_cmd_from_cdb(cmd, cdb)) | ||
4916 | + return -EINVAL; | ||
4917 | |||
4918 | - if (alloc_mem) { | ||
4919 | - rc = target_alloc_sgl(&cmd->t_data_sg, &cmd->t_data_nents, | ||
4920 | - cmd->data_length, false, false); | ||
4921 | - if (rc < 0) { | ||
4922 | - ret = rc; | ||
4923 | - goto out; | ||
4924 | - } | ||
4925 | - /* | ||
4926 | - * Set this bit so that transport_free_pages() allows the | ||
4927 | - * caller to release SGLs + physical memory allocated by | ||
4928 | - * transport_generic_get_mem().. | ||
4929 | - */ | ||
4930 | - cmd->se_cmd_flags |= SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC; | ||
4931 | - } else { | ||
4932 | - /* | ||
4933 | - * Here the previously allocated SGLs for the internal READ | ||
4934 | - * are mapped zero-copy to the internal WRITE. | ||
4935 | - */ | ||
4936 | - sense_rc = transport_generic_map_mem_to_cmd(cmd, | ||
4937 | - xop->xop_data_sg, xop->xop_data_nents, | ||
4938 | - NULL, 0); | ||
4939 | - if (sense_rc) { | ||
4940 | - ret = -EINVAL; | ||
4941 | - goto out; | ||
4942 | - } | ||
4943 | + if (transport_generic_map_mem_to_cmd(cmd, xop->xop_data_sg, | ||
4944 | + xop->xop_data_nents, NULL, 0)) | ||
4945 | + return -EINVAL; | ||
4946 | |||
4947 | - pr_debug("Setup PASSTHROUGH_NOALLOC t_data_sg: %p t_data_nents:" | ||
4948 | - " %u\n", cmd->t_data_sg, cmd->t_data_nents); | ||
4949 | - } | ||
4950 | + pr_debug("Setup PASSTHROUGH_NOALLOC t_data_sg: %p t_data_nents:" | ||
4951 | + " %u\n", cmd->t_data_sg, cmd->t_data_nents); | ||
4952 | |||
4953 | return 0; | ||
4954 | - | ||
4955 | -out: | ||
4956 | - return ret; | ||
4957 | } | ||
4958 | |||
4959 | static int target_xcopy_issue_pt_cmd(struct xcopy_pt_cmd *xpt_cmd) | ||
4960 | @@ -660,15 +627,13 @@ static int target_xcopy_read_source( | ||
4961 | xop->src_pt_cmd = xpt_cmd; | ||
4962 | |||
4963 | rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, src_dev, &cdb[0], | ||
4964 | - remote_port, true); | ||
4965 | + remote_port); | ||
4966 | if (rc < 0) { | ||
4967 | ec_cmd->scsi_status = xpt_cmd->se_cmd.scsi_status; | ||
4968 | transport_generic_free_cmd(se_cmd, 0); | ||
4969 | return rc; | ||
4970 | } | ||
4971 | |||
4972 | - xop->xop_data_sg = se_cmd->t_data_sg; | ||
4973 | - xop->xop_data_nents = se_cmd->t_data_nents; | ||
4974 | pr_debug("XCOPY-READ: Saved xop->xop_data_sg: %p, num: %u for READ" | ||
4975 | " memory\n", xop->xop_data_sg, xop->xop_data_nents); | ||
4976 | |||
4977 | @@ -678,12 +643,6 @@ static int target_xcopy_read_source( | ||
4978 | transport_generic_free_cmd(se_cmd, 0); | ||
4979 | return rc; | ||
4980 | } | ||
4981 | - /* | ||
4982 | - * Clear off the allocated t_data_sg, that has been saved for | ||
4983 | - * zero-copy WRITE submission reuse in struct xcopy_op.. | ||
4984 | - */ | ||
4985 | - se_cmd->t_data_sg = NULL; | ||
4986 | - se_cmd->t_data_nents = 0; | ||
4987 | |||
4988 | return 0; | ||
4989 | } | ||
4990 | @@ -722,19 +681,9 @@ static int target_xcopy_write_destination( | ||
4991 | xop->dst_pt_cmd = xpt_cmd; | ||
4992 | |||
4993 | rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, dst_dev, &cdb[0], | ||
4994 | - remote_port, false); | ||
4995 | + remote_port); | ||
4996 | if (rc < 0) { | ||
4997 | - struct se_cmd *src_cmd = &xop->src_pt_cmd->se_cmd; | ||
4998 | ec_cmd->scsi_status = xpt_cmd->se_cmd.scsi_status; | ||
4999 | - /* | ||
5000 | - * If the failure happened before the t_mem_list hand-off in | ||
5001 | - * target_xcopy_setup_pt_cmd(), Reset memory + clear flag so that | ||
5002 | - * core releases this memory on error during X-COPY WRITE I/O. | ||
5003 | - */ | ||
5004 | - src_cmd->se_cmd_flags &= ~SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC; | ||
5005 | - src_cmd->t_data_sg = xop->xop_data_sg; | ||
5006 | - src_cmd->t_data_nents = xop->xop_data_nents; | ||
5007 | - | ||
5008 | transport_generic_free_cmd(se_cmd, 0); | ||
5009 | return rc; | ||
5010 | } | ||
5011 | @@ -742,7 +691,6 @@ static int target_xcopy_write_destination( | ||
5012 | rc = target_xcopy_issue_pt_cmd(xpt_cmd); | ||
5013 | if (rc < 0) { | ||
5014 | ec_cmd->scsi_status = xpt_cmd->se_cmd.scsi_status; | ||
5015 | - se_cmd->se_cmd_flags &= ~SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC; | ||
5016 | transport_generic_free_cmd(se_cmd, 0); | ||
5017 | return rc; | ||
5018 | } | ||
5019 | @@ -758,7 +706,7 @@ static void target_xcopy_do_work(struct work_struct *work) | ||
5020 | sector_t src_lba, dst_lba, end_lba; | ||
5021 | unsigned int max_sectors; | ||
5022 | int rc = 0; | ||
5023 | - unsigned short nolb, cur_nolb, max_nolb, copied_nolb = 0; | ||
5024 | + unsigned short nolb, max_nolb, copied_nolb = 0; | ||
5025 | |||
5026 | if (target_parse_xcopy_cmd(xop) != TCM_NO_SENSE) | ||
5027 | goto err_free; | ||
5028 | @@ -788,7 +736,23 @@ static void target_xcopy_do_work(struct work_struct *work) | ||
5029 | (unsigned long long)src_lba, (unsigned long long)dst_lba); | ||
5030 | |||
5031 | while (src_lba < end_lba) { | ||
5032 | - cur_nolb = min(nolb, max_nolb); | ||
5033 | + unsigned short cur_nolb = min(nolb, max_nolb); | ||
5034 | + u32 cur_bytes = cur_nolb * src_dev->dev_attrib.block_size; | ||
5035 | + | ||
5036 | + if (cur_bytes != xop->xop_data_bytes) { | ||
5037 | + /* | ||
5038 | + * (Re)allocate a buffer large enough to hold the XCOPY | ||
5039 | + * I/O size, which can be reused each read / write loop. | ||
5040 | + */ | ||
5041 | + target_free_sgl(xop->xop_data_sg, xop->xop_data_nents); | ||
5042 | + rc = target_alloc_sgl(&xop->xop_data_sg, | ||
5043 | + &xop->xop_data_nents, | ||
5044 | + cur_bytes, | ||
5045 | + false, false); | ||
5046 | + if (rc < 0) | ||
5047 | + goto out; | ||
5048 | + xop->xop_data_bytes = cur_bytes; | ||
5049 | + } | ||
5050 | |||
5051 | pr_debug("target_xcopy_do_work: Calling read src_dev: %p src_lba: %llu," | ||
5052 | " cur_nolb: %hu\n", src_dev, (unsigned long long)src_lba, cur_nolb); | ||
5053 | @@ -819,12 +783,11 @@ static void target_xcopy_do_work(struct work_struct *work) | ||
5054 | nolb -= cur_nolb; | ||
5055 | |||
5056 | transport_generic_free_cmd(&xop->src_pt_cmd->se_cmd, 0); | ||
5057 | - xop->dst_pt_cmd->se_cmd.se_cmd_flags &= ~SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC; | ||
5058 | - | ||
5059 | transport_generic_free_cmd(&xop->dst_pt_cmd->se_cmd, 0); | ||
5060 | } | ||
5061 | |||
5062 | xcopy_pt_undepend_remotedev(xop); | ||
5063 | + target_free_sgl(xop->xop_data_sg, xop->xop_data_nents); | ||
5064 | kfree(xop); | ||
5065 | |||
5066 | pr_debug("target_xcopy_do_work: Final src_lba: %llu, dst_lba: %llu\n", | ||
5067 | @@ -838,6 +801,7 @@ static void target_xcopy_do_work(struct work_struct *work) | ||
5068 | |||
5069 | out: | ||
5070 | xcopy_pt_undepend_remotedev(xop); | ||
5071 | + target_free_sgl(xop->xop_data_sg, xop->xop_data_nents); | ||
5072 | |||
5073 | err_free: | ||
5074 | kfree(xop); | ||
5075 | diff --git a/drivers/target/target_core_xcopy.h b/drivers/target/target_core_xcopy.h | ||
5076 | index 974bc1e19ff2b..a1805a14eea07 100644 | ||
5077 | --- a/drivers/target/target_core_xcopy.h | ||
5078 | +++ b/drivers/target/target_core_xcopy.h | ||
5079 | @@ -41,6 +41,7 @@ struct xcopy_op { | ||
5080 | struct xcopy_pt_cmd *src_pt_cmd; | ||
5081 | struct xcopy_pt_cmd *dst_pt_cmd; | ||
5082 | |||
5083 | + u32 xop_data_bytes; | ||
5084 | u32 xop_data_nents; | ||
5085 | struct scatterlist *xop_data_sg; | ||
5086 | struct work_struct xop_work; | ||
5087 | diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c | ||
5088 | index 66f95f758be05..73226337f5610 100644 | ||
5089 | --- a/drivers/tty/hvc/hvsi.c | ||
5090 | +++ b/drivers/tty/hvc/hvsi.c | ||
5091 | @@ -1038,7 +1038,7 @@ static const struct tty_operations hvsi_ops = { | ||
5092 | |||
5093 | static int __init hvsi_init(void) | ||
5094 | { | ||
5095 | - int i; | ||
5096 | + int i, ret; | ||
5097 | |||
5098 | hvsi_driver = alloc_tty_driver(hvsi_count); | ||
5099 | if (!hvsi_driver) | ||
5100 | @@ -1069,12 +1069,25 @@ static int __init hvsi_init(void) | ||
5101 | } | ||
5102 | hvsi_wait = wait_for_state; /* irqs active now */ | ||
5103 | |||
5104 | - if (tty_register_driver(hvsi_driver)) | ||
5105 | - panic("Couldn't register hvsi console driver\n"); | ||
5106 | + ret = tty_register_driver(hvsi_driver); | ||
5107 | + if (ret) { | ||
5108 | + pr_err("Couldn't register hvsi console driver\n"); | ||
5109 | + goto err_free_irq; | ||
5110 | + } | ||
5111 | |||
5112 | printk(KERN_DEBUG "HVSI: registered %i devices\n", hvsi_count); | ||
5113 | |||
5114 | return 0; | ||
5115 | +err_free_irq: | ||
5116 | + hvsi_wait = poll_for_state; | ||
5117 | + for (i = 0; i < hvsi_count; i++) { | ||
5118 | + struct hvsi_struct *hp = &hvsi_ports[i]; | ||
5119 | + | ||
5120 | + free_irq(hp->virq, hp); | ||
5121 | + } | ||
5122 | + tty_driver_kref_put(hvsi_driver); | ||
5123 | + | ||
5124 | + return ret; | ||
5125 | } | ||
5126 | device_initcall(hvsi_init); | ||
5127 | |||
5128 | diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c | ||
5129 | index 43fc5b6a25d35..a2bb103f22fc6 100644 | ||
5130 | --- a/drivers/tty/serial/8250/8250_pci.c | ||
5131 | +++ b/drivers/tty/serial/8250/8250_pci.c | ||
5132 | @@ -89,7 +89,7 @@ static void moan_device(const char *str, struct pci_dev *dev) | ||
5133 | |||
5134 | static int | ||
5135 | setup_port(struct serial_private *priv, struct uart_8250_port *port, | ||
5136 | - int bar, int offset, int regshift) | ||
5137 | + u8 bar, unsigned int offset, int regshift) | ||
5138 | { | ||
5139 | struct pci_dev *dev = priv->dev; | ||
5140 | |||
5141 | diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c | ||
5142 | index 8a7c6d65f10ef..777ef1a9591c0 100644 | ||
5143 | --- a/drivers/tty/serial/8250/8250_port.c | ||
5144 | +++ b/drivers/tty/serial/8250/8250_port.c | ||
5145 | @@ -125,7 +125,8 @@ static const struct serial8250_config uart_config[] = { | ||
5146 | .name = "16C950/954", | ||
5147 | .fifo_size = 128, | ||
5148 | .tx_loadsz = 128, | ||
5149 | - .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, | ||
5150 | + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01, | ||
5151 | + .rxtrig_bytes = {16, 32, 112, 120}, | ||
5152 | /* UART_CAP_EFR breaks billionon CF bluetooth card. */ | ||
5153 | .flags = UART_CAP_FIFO | UART_CAP_SLEEP, | ||
5154 | }, | ||
5155 | diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c | ||
5156 | index bf0e2a4cb0cef..c6f927a76c3be 100644 | ||
5157 | --- a/drivers/tty/serial/jsm/jsm_neo.c | ||
5158 | +++ b/drivers/tty/serial/jsm/jsm_neo.c | ||
5159 | @@ -815,7 +815,9 @@ static void neo_parse_isr(struct jsm_board *brd, u32 port) | ||
5160 | /* Parse any modem signal changes */ | ||
5161 | jsm_dbg(INTR, &ch->ch_bd->pci_dev, | ||
5162 | "MOD_STAT: sending to parse_modem_sigs\n"); | ||
5163 | + spin_lock_irqsave(&ch->uart_port.lock, lock_flags); | ||
5164 | neo_parse_modem(ch, readb(&ch->ch_neo_uart->msr)); | ||
5165 | + spin_unlock_irqrestore(&ch->uart_port.lock, lock_flags); | ||
5166 | } | ||
5167 | } | ||
5168 | |||
5169 | diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c | ||
5170 | index 689774c073ca4..8438454ca653f 100644 | ||
5171 | --- a/drivers/tty/serial/jsm/jsm_tty.c | ||
5172 | +++ b/drivers/tty/serial/jsm/jsm_tty.c | ||
5173 | @@ -187,6 +187,7 @@ static void jsm_tty_break(struct uart_port *port, int break_state) | ||
5174 | |||
5175 | static int jsm_tty_open(struct uart_port *port) | ||
5176 | { | ||
5177 | + unsigned long lock_flags; | ||
5178 | struct jsm_board *brd; | ||
5179 | struct jsm_channel *channel = | ||
5180 | container_of(port, struct jsm_channel, uart_port); | ||
5181 | @@ -240,6 +241,7 @@ static int jsm_tty_open(struct uart_port *port) | ||
5182 | channel->ch_cached_lsr = 0; | ||
5183 | channel->ch_stops_sent = 0; | ||
5184 | |||
5185 | + spin_lock_irqsave(&port->lock, lock_flags); | ||
5186 | termios = &port->state->port.tty->termios; | ||
5187 | channel->ch_c_cflag = termios->c_cflag; | ||
5188 | channel->ch_c_iflag = termios->c_iflag; | ||
5189 | @@ -259,6 +261,7 @@ static int jsm_tty_open(struct uart_port *port) | ||
5190 | jsm_carrier(channel); | ||
5191 | |||
5192 | channel->ch_open_count++; | ||
5193 | + spin_unlock_irqrestore(&port->lock, lock_flags); | ||
5194 | |||
5195 | jsm_dbg(OPEN, &channel->ch_bd->pci_dev, "finish\n"); | ||
5196 | return 0; | ||
5197 | diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c | ||
5198 | index 97ee1fc1cd247..ecff9b2088087 100644 | ||
5199 | --- a/drivers/tty/serial/sh-sci.c | ||
5200 | +++ b/drivers/tty/serial/sh-sci.c | ||
5201 | @@ -1763,6 +1763,10 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr) | ||
5202 | |||
5203 | /* Handle BREAKs */ | ||
5204 | sci_handle_breaks(port); | ||
5205 | + | ||
5206 | + /* drop invalid character received before break was detected */ | ||
5207 | + serial_port_in(port, SCxRDR); | ||
5208 | + | ||
5209 | sci_clear_SCxSR(port, SCxSR_BREAK_CLEAR(port)); | ||
5210 | |||
5211 | return IRQ_HANDLED; | ||
5212 | @@ -1842,7 +1846,8 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) | ||
5213 | ret = sci_er_interrupt(irq, ptr); | ||
5214 | |||
5215 | /* Break Interrupt */ | ||
5216 | - if ((ssr_status & SCxSR_BRK(port)) && err_enabled) | ||
5217 | + if (s->irqs[SCIx_ERI_IRQ] != s->irqs[SCIx_BRI_IRQ] && | ||
5218 | + (ssr_status & SCxSR_BRK(port)) && err_enabled) | ||
5219 | ret = sci_br_interrupt(irq, ptr); | ||
5220 | |||
5221 | /* Overrun Interrupt */ | ||
5222 | diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c | ||
5223 | index 48e4a5ca18359..f5f56ee07729f 100644 | ||
5224 | --- a/drivers/usb/chipidea/host.c | ||
5225 | +++ b/drivers/usb/chipidea/host.c | ||
5226 | @@ -233,18 +233,26 @@ static int ci_ehci_hub_control( | ||
5227 | ) | ||
5228 | { | ||
5229 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
5230 | + unsigned int ports = HCS_N_PORTS(ehci->hcs_params); | ||
5231 | u32 __iomem *status_reg; | ||
5232 | - u32 temp; | ||
5233 | + u32 temp, port_index; | ||
5234 | unsigned long flags; | ||
5235 | int retval = 0; | ||
5236 | struct device *dev = hcd->self.controller; | ||
5237 | struct ci_hdrc *ci = dev_get_drvdata(dev); | ||
5238 | |||
5239 | - status_reg = &ehci->regs->port_status[(wIndex & 0xff) - 1]; | ||
5240 | + port_index = wIndex & 0xff; | ||
5241 | + port_index -= (port_index > 0); | ||
5242 | + status_reg = &ehci->regs->port_status[port_index]; | ||
5243 | |||
5244 | spin_lock_irqsave(&ehci->lock, flags); | ||
5245 | |||
5246 | if (typeReq == SetPortFeature && wValue == USB_PORT_FEAT_SUSPEND) { | ||
5247 | + if (!wIndex || wIndex > ports) { | ||
5248 | + retval = -EPIPE; | ||
5249 | + goto done; | ||
5250 | + } | ||
5251 | + | ||
5252 | temp = ehci_readl(ehci, status_reg); | ||
5253 | if ((temp & PORT_PE) == 0 || (temp & PORT_RESET) != 0) { | ||
5254 | retval = -EPIPE; | ||
5255 | @@ -273,7 +281,7 @@ static int ci_ehci_hub_control( | ||
5256 | ehci_writel(ehci, temp, status_reg); | ||
5257 | } | ||
5258 | |||
5259 | - set_bit((wIndex & 0xff) - 1, &ehci->suspended_ports); | ||
5260 | + set_bit(port_index, &ehci->suspended_ports); | ||
5261 | goto done; | ||
5262 | } | ||
5263 | |||
5264 | diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c | ||
5265 | index 24dad1d78d1ea..6bd3fdb925cd9 100644 | ||
5266 | --- a/drivers/usb/gadget/composite.c | ||
5267 | +++ b/drivers/usb/gadget/composite.c | ||
5268 | @@ -481,7 +481,7 @@ static u8 encode_bMaxPower(enum usb_device_speed speed, | ||
5269 | { | ||
5270 | unsigned val; | ||
5271 | |||
5272 | - if (c->MaxPower) | ||
5273 | + if (c->MaxPower || (c->bmAttributes & USB_CONFIG_ATT_SELFPOWER)) | ||
5274 | val = c->MaxPower; | ||
5275 | else | ||
5276 | val = CONFIG_USB_GADGET_VBUS_DRAW; | ||
5277 | @@ -905,7 +905,11 @@ static int set_config(struct usb_composite_dev *cdev, | ||
5278 | } | ||
5279 | |||
5280 | /* when we return, be sure our power usage is valid */ | ||
5281 | - power = c->MaxPower ? c->MaxPower : CONFIG_USB_GADGET_VBUS_DRAW; | ||
5282 | + if (c->MaxPower || (c->bmAttributes & USB_CONFIG_ATT_SELFPOWER)) | ||
5283 | + power = c->MaxPower; | ||
5284 | + else | ||
5285 | + power = CONFIG_USB_GADGET_VBUS_DRAW; | ||
5286 | + | ||
5287 | if (gadget->speed < USB_SPEED_SUPER) | ||
5288 | power = min(power, 500U); | ||
5289 | else | ||
5290 | diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c | ||
5291 | index 99b840daf3d94..57da62e331848 100644 | ||
5292 | --- a/drivers/usb/gadget/function/u_ether.c | ||
5293 | +++ b/drivers/usb/gadget/function/u_ether.c | ||
5294 | @@ -491,8 +491,9 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb, | ||
5295 | } | ||
5296 | spin_unlock_irqrestore(&dev->lock, flags); | ||
5297 | |||
5298 | - if (skb && !in) { | ||
5299 | - dev_kfree_skb_any(skb); | ||
5300 | + if (!in) { | ||
5301 | + if (skb) | ||
5302 | + dev_kfree_skb_any(skb); | ||
5303 | return NETDEV_TX_OK; | ||
5304 | } | ||
5305 | |||
5306 | diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c | ||
5307 | index b6f196f5e252e..b0e0f8ea98a9c 100644 | ||
5308 | --- a/drivers/usb/host/ehci-mv.c | ||
5309 | +++ b/drivers/usb/host/ehci-mv.c | ||
5310 | @@ -41,26 +41,25 @@ struct ehci_hcd_mv { | ||
5311 | int (*set_vbus)(unsigned int vbus); | ||
5312 | }; | ||
5313 | |||
5314 | -static void ehci_clock_enable(struct ehci_hcd_mv *ehci_mv) | ||
5315 | +static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv) | ||
5316 | { | ||
5317 | - clk_prepare_enable(ehci_mv->clk); | ||
5318 | -} | ||
5319 | + int retval; | ||
5320 | |||
5321 | -static void ehci_clock_disable(struct ehci_hcd_mv *ehci_mv) | ||
5322 | -{ | ||
5323 | - clk_disable_unprepare(ehci_mv->clk); | ||
5324 | -} | ||
5325 | + retval = clk_prepare_enable(ehci_mv->clk); | ||
5326 | + if (retval) | ||
5327 | + return retval; | ||
5328 | |||
5329 | -static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv) | ||
5330 | -{ | ||
5331 | - ehci_clock_enable(ehci_mv); | ||
5332 | - return phy_init(ehci_mv->phy); | ||
5333 | + retval = phy_init(ehci_mv->phy); | ||
5334 | + if (retval) | ||
5335 | + clk_disable_unprepare(ehci_mv->clk); | ||
5336 | + | ||
5337 | + return retval; | ||
5338 | } | ||
5339 | |||
5340 | static void mv_ehci_disable(struct ehci_hcd_mv *ehci_mv) | ||
5341 | { | ||
5342 | phy_exit(ehci_mv->phy); | ||
5343 | - ehci_clock_disable(ehci_mv); | ||
5344 | + clk_disable_unprepare(ehci_mv->clk); | ||
5345 | } | ||
5346 | |||
5347 | static int mv_ehci_reset(struct usb_hcd *hcd) | ||
5348 | diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c | ||
5349 | index c3f74d6674e1d..f457e083a6f89 100644 | ||
5350 | --- a/drivers/usb/host/fotg210-hcd.c | ||
5351 | +++ b/drivers/usb/host/fotg210-hcd.c | ||
5352 | @@ -2511,11 +2511,6 @@ retry_xacterr: | ||
5353 | return count; | ||
5354 | } | ||
5355 | |||
5356 | -/* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */ | ||
5357 | -#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03)) | ||
5358 | -/* ... and packet size, for any kind of endpoint descriptor */ | ||
5359 | -#define max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff) | ||
5360 | - | ||
5361 | /* reverse of qh_urb_transaction: free a list of TDs. | ||
5362 | * used for cleanup after errors, before HC sees an URB's TDs. | ||
5363 | */ | ||
5364 | @@ -2601,7 +2596,7 @@ static struct list_head *qh_urb_transaction(struct fotg210_hcd *fotg210, | ||
5365 | token |= (1 /* "in" */ << 8); | ||
5366 | /* else it's already initted to "out" pid (0 << 8) */ | ||
5367 | |||
5368 | - maxpacket = max_packet(usb_maxpacket(urb->dev, urb->pipe, !is_input)); | ||
5369 | + maxpacket = usb_maxpacket(urb->dev, urb->pipe, !is_input); | ||
5370 | |||
5371 | /* | ||
5372 | * buffer gets wrapped in one or more qtds; | ||
5373 | @@ -2715,9 +2710,11 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, | ||
5374 | gfp_t flags) | ||
5375 | { | ||
5376 | struct fotg210_qh *qh = fotg210_qh_alloc(fotg210, flags); | ||
5377 | + struct usb_host_endpoint *ep; | ||
5378 | u32 info1 = 0, info2 = 0; | ||
5379 | int is_input, type; | ||
5380 | int maxp = 0; | ||
5381 | + int mult; | ||
5382 | struct usb_tt *tt = urb->dev->tt; | ||
5383 | struct fotg210_qh_hw *hw; | ||
5384 | |||
5385 | @@ -2732,14 +2729,15 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, | ||
5386 | |||
5387 | is_input = usb_pipein(urb->pipe); | ||
5388 | type = usb_pipetype(urb->pipe); | ||
5389 | - maxp = usb_maxpacket(urb->dev, urb->pipe, !is_input); | ||
5390 | + ep = usb_pipe_endpoint(urb->dev, urb->pipe); | ||
5391 | + maxp = usb_endpoint_maxp(&ep->desc); | ||
5392 | + mult = usb_endpoint_maxp_mult(&ep->desc); | ||
5393 | |||
5394 | /* 1024 byte maxpacket is a hardware ceiling. High bandwidth | ||
5395 | * acts like up to 3KB, but is built from smaller packets. | ||
5396 | */ | ||
5397 | - if (max_packet(maxp) > 1024) { | ||
5398 | - fotg210_dbg(fotg210, "bogus qh maxpacket %d\n", | ||
5399 | - max_packet(maxp)); | ||
5400 | + if (maxp > 1024) { | ||
5401 | + fotg210_dbg(fotg210, "bogus qh maxpacket %d\n", maxp); | ||
5402 | goto done; | ||
5403 | } | ||
5404 | |||
5405 | @@ -2753,8 +2751,7 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, | ||
5406 | */ | ||
5407 | if (type == PIPE_INTERRUPT) { | ||
5408 | qh->usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH, | ||
5409 | - is_input, 0, | ||
5410 | - hb_mult(maxp) * max_packet(maxp))); | ||
5411 | + is_input, 0, mult * maxp)); | ||
5412 | qh->start = NO_FRAME; | ||
5413 | |||
5414 | if (urb->dev->speed == USB_SPEED_HIGH) { | ||
5415 | @@ -2791,7 +2788,7 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, | ||
5416 | think_time = tt ? tt->think_time : 0; | ||
5417 | qh->tt_usecs = NS_TO_US(think_time + | ||
5418 | usb_calc_bus_time(urb->dev->speed, | ||
5419 | - is_input, 0, max_packet(maxp))); | ||
5420 | + is_input, 0, maxp)); | ||
5421 | qh->period = urb->interval; | ||
5422 | if (qh->period > fotg210->periodic_size) { | ||
5423 | qh->period = fotg210->periodic_size; | ||
5424 | @@ -2854,11 +2851,11 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, | ||
5425 | * to help them do so. So now people expect to use | ||
5426 | * such nonconformant devices with Linux too; sigh. | ||
5427 | */ | ||
5428 | - info1 |= max_packet(maxp) << 16; | ||
5429 | + info1 |= maxp << 16; | ||
5430 | info2 |= (FOTG210_TUNE_MULT_HS << 30); | ||
5431 | } else { /* PIPE_INTERRUPT */ | ||
5432 | - info1 |= max_packet(maxp) << 16; | ||
5433 | - info2 |= hb_mult(maxp) << 30; | ||
5434 | + info1 |= maxp << 16; | ||
5435 | + info2 |= mult << 30; | ||
5436 | } | ||
5437 | break; | ||
5438 | default: | ||
5439 | @@ -3928,6 +3925,7 @@ static void iso_stream_init(struct fotg210_hcd *fotg210, | ||
5440 | int is_input; | ||
5441 | long bandwidth; | ||
5442 | unsigned multi; | ||
5443 | + struct usb_host_endpoint *ep; | ||
5444 | |||
5445 | /* | ||
5446 | * this might be a "high bandwidth" highspeed endpoint, | ||
5447 | @@ -3935,14 +3933,14 @@ static void iso_stream_init(struct fotg210_hcd *fotg210, | ||
5448 | */ | ||
5449 | epnum = usb_pipeendpoint(pipe); | ||
5450 | is_input = usb_pipein(pipe) ? USB_DIR_IN : 0; | ||
5451 | - maxp = usb_maxpacket(dev, pipe, !is_input); | ||
5452 | + ep = usb_pipe_endpoint(dev, pipe); | ||
5453 | + maxp = usb_endpoint_maxp(&ep->desc); | ||
5454 | if (is_input) | ||
5455 | buf1 = (1 << 11); | ||
5456 | else | ||
5457 | buf1 = 0; | ||
5458 | |||
5459 | - maxp = max_packet(maxp); | ||
5460 | - multi = hb_mult(maxp); | ||
5461 | + multi = usb_endpoint_maxp_mult(&ep->desc); | ||
5462 | buf1 |= maxp; | ||
5463 | maxp *= multi; | ||
5464 | |||
5465 | @@ -4463,13 +4461,12 @@ static bool itd_complete(struct fotg210_hcd *fotg210, struct fotg210_itd *itd) | ||
5466 | |||
5467 | /* HC need not update length with this error */ | ||
5468 | if (!(t & FOTG210_ISOC_BABBLE)) { | ||
5469 | - desc->actual_length = | ||
5470 | - fotg210_itdlen(urb, desc, t); | ||
5471 | + desc->actual_length = FOTG210_ITD_LENGTH(t); | ||
5472 | urb->actual_length += desc->actual_length; | ||
5473 | } | ||
5474 | } else if (likely((t & FOTG210_ISOC_ACTIVE) == 0)) { | ||
5475 | desc->status = 0; | ||
5476 | - desc->actual_length = fotg210_itdlen(urb, desc, t); | ||
5477 | + desc->actual_length = FOTG210_ITD_LENGTH(t); | ||
5478 | urb->actual_length += desc->actual_length; | ||
5479 | } else { | ||
5480 | /* URB was too late */ | ||
5481 | diff --git a/drivers/usb/host/fotg210.h b/drivers/usb/host/fotg210.h | ||
5482 | index 1b4db95e5c43a..291add93d84ee 100644 | ||
5483 | --- a/drivers/usb/host/fotg210.h | ||
5484 | +++ b/drivers/usb/host/fotg210.h | ||
5485 | @@ -686,11 +686,6 @@ static inline unsigned fotg210_read_frame_index(struct fotg210_hcd *fotg210) | ||
5486 | return fotg210_readl(fotg210, &fotg210->regs->frame_index); | ||
5487 | } | ||
5488 | |||
5489 | -#define fotg210_itdlen(urb, desc, t) ({ \ | ||
5490 | - usb_pipein((urb)->pipe) ? \ | ||
5491 | - (desc)->length - FOTG210_ITD_LENGTH(t) : \ | ||
5492 | - FOTG210_ITD_LENGTH(t); \ | ||
5493 | -}) | ||
5494 | /*-------------------------------------------------------------------------*/ | ||
5495 | |||
5496 | #endif /* __LINUX_FOTG210_H */ | ||
5497 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c | ||
5498 | index a3813c75a3de8..505da4999e208 100644 | ||
5499 | --- a/drivers/usb/host/xhci.c | ||
5500 | +++ b/drivers/usb/host/xhci.c | ||
5501 | @@ -4662,19 +4662,19 @@ static u16 xhci_calculate_u1_timeout(struct xhci_hcd *xhci, | ||
5502 | { | ||
5503 | unsigned long long timeout_ns; | ||
5504 | |||
5505 | - if (xhci->quirks & XHCI_INTEL_HOST) | ||
5506 | - timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc); | ||
5507 | - else | ||
5508 | - timeout_ns = udev->u1_params.sel; | ||
5509 | - | ||
5510 | /* Prevent U1 if service interval is shorter than U1 exit latency */ | ||
5511 | if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { | ||
5512 | - if (xhci_service_interval_to_ns(desc) <= timeout_ns) { | ||
5513 | + if (xhci_service_interval_to_ns(desc) <= udev->u1_params.mel) { | ||
5514 | dev_dbg(&udev->dev, "Disable U1, ESIT shorter than exit latency\n"); | ||
5515 | return USB3_LPM_DISABLED; | ||
5516 | } | ||
5517 | } | ||
5518 | |||
5519 | + if (xhci->quirks & XHCI_INTEL_HOST) | ||
5520 | + timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc); | ||
5521 | + else | ||
5522 | + timeout_ns = udev->u1_params.sel; | ||
5523 | + | ||
5524 | /* The U1 timeout is encoded in 1us intervals. | ||
5525 | * Don't return a timeout of zero, because that's USB3_LPM_DISABLED. | ||
5526 | */ | ||
5527 | @@ -4726,19 +4726,19 @@ static u16 xhci_calculate_u2_timeout(struct xhci_hcd *xhci, | ||
5528 | { | ||
5529 | unsigned long long timeout_ns; | ||
5530 | |||
5531 | - if (xhci->quirks & XHCI_INTEL_HOST) | ||
5532 | - timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc); | ||
5533 | - else | ||
5534 | - timeout_ns = udev->u2_params.sel; | ||
5535 | - | ||
5536 | /* Prevent U2 if service interval is shorter than U2 exit latency */ | ||
5537 | if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { | ||
5538 | - if (xhci_service_interval_to_ns(desc) <= timeout_ns) { | ||
5539 | + if (xhci_service_interval_to_ns(desc) <= udev->u2_params.mel) { | ||
5540 | dev_dbg(&udev->dev, "Disable U2, ESIT shorter than exit latency\n"); | ||
5541 | return USB3_LPM_DISABLED; | ||
5542 | } | ||
5543 | } | ||
5544 | |||
5545 | + if (xhci->quirks & XHCI_INTEL_HOST) | ||
5546 | + timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc); | ||
5547 | + else | ||
5548 | + timeout_ns = udev->u2_params.sel; | ||
5549 | + | ||
5550 | /* The U2 timeout is encoded in 256us intervals */ | ||
5551 | timeout_ns = DIV_ROUND_UP_ULL(timeout_ns, 256 * 1000); | ||
5552 | /* If the necessary timeout value is bigger than what we can set in the | ||
5553 | diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c | ||
5554 | index 327d4f7baaf7c..89d659cef5c63 100644 | ||
5555 | --- a/drivers/usb/musb/musb_dsps.c | ||
5556 | +++ b/drivers/usb/musb/musb_dsps.c | ||
5557 | @@ -890,23 +890,22 @@ static int dsps_probe(struct platform_device *pdev) | ||
5558 | if (!glue->usbss_base) | ||
5559 | return -ENXIO; | ||
5560 | |||
5561 | - if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) { | ||
5562 | - ret = dsps_setup_optional_vbus_irq(pdev, glue); | ||
5563 | - if (ret) | ||
5564 | - goto err_iounmap; | ||
5565 | - } | ||
5566 | - | ||
5567 | platform_set_drvdata(pdev, glue); | ||
5568 | pm_runtime_enable(&pdev->dev); | ||
5569 | ret = dsps_create_musb_pdev(glue, pdev); | ||
5570 | if (ret) | ||
5571 | goto err; | ||
5572 | |||
5573 | + if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) { | ||
5574 | + ret = dsps_setup_optional_vbus_irq(pdev, glue); | ||
5575 | + if (ret) | ||
5576 | + goto err; | ||
5577 | + } | ||
5578 | + | ||
5579 | return 0; | ||
5580 | |||
5581 | err: | ||
5582 | pm_runtime_disable(&pdev->dev); | ||
5583 | -err_iounmap: | ||
5584 | iounmap(glue->usbss_base); | ||
5585 | return ret; | ||
5586 | } | ||
5587 | diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c | ||
5588 | index 98636fbf71882..170abb06a8a4d 100644 | ||
5589 | --- a/drivers/usb/usbip/vhci_hcd.c | ||
5590 | +++ b/drivers/usb/usbip/vhci_hcd.c | ||
5591 | @@ -455,8 +455,14 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | ||
5592 | vhci_hcd->port_status[rhport] &= ~(1 << USB_PORT_FEAT_RESET); | ||
5593 | vhci_hcd->re_timeout = 0; | ||
5594 | |||
5595 | + /* | ||
5596 | + * A few drivers do usb reset during probe when | ||
5597 | + * the device could be in VDEV_ST_USED state | ||
5598 | + */ | ||
5599 | if (vhci_hcd->vdev[rhport].ud.status == | ||
5600 | - VDEV_ST_NOTASSIGNED) { | ||
5601 | + VDEV_ST_NOTASSIGNED || | ||
5602 | + vhci_hcd->vdev[rhport].ud.status == | ||
5603 | + VDEV_ST_USED) { | ||
5604 | usbip_dbg_vhci_rh( | ||
5605 | " enable rhport %d (status %u)\n", | ||
5606 | rhport, | ||
5607 | @@ -952,8 +958,32 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev) | ||
5608 | spin_lock(&vdev->priv_lock); | ||
5609 | |||
5610 | list_for_each_entry_safe(unlink, tmp, &vdev->unlink_tx, list) { | ||
5611 | + struct urb *urb; | ||
5612 | + | ||
5613 | + /* give back urb of unsent unlink request */ | ||
5614 | pr_info("unlink cleanup tx %lu\n", unlink->unlink_seqnum); | ||
5615 | + | ||
5616 | + urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); | ||
5617 | + if (!urb) { | ||
5618 | + list_del(&unlink->list); | ||
5619 | + kfree(unlink); | ||
5620 | + continue; | ||
5621 | + } | ||
5622 | + | ||
5623 | + urb->status = -ENODEV; | ||
5624 | + | ||
5625 | + usb_hcd_unlink_urb_from_ep(hcd, urb); | ||
5626 | + | ||
5627 | list_del(&unlink->list); | ||
5628 | + | ||
5629 | + spin_unlock(&vdev->priv_lock); | ||
5630 | + spin_unlock_irqrestore(&vhci->lock, flags); | ||
5631 | + | ||
5632 | + usb_hcd_giveback_urb(hcd, urb, urb->status); | ||
5633 | + | ||
5634 | + spin_lock_irqsave(&vhci->lock, flags); | ||
5635 | + spin_lock(&vdev->priv_lock); | ||
5636 | + | ||
5637 | kfree(unlink); | ||
5638 | } | ||
5639 | |||
5640 | diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig | ||
5641 | index 503ed2f3fbb5e..65743de8aad11 100644 | ||
5642 | --- a/drivers/vfio/Kconfig | ||
5643 | +++ b/drivers/vfio/Kconfig | ||
5644 | @@ -29,7 +29,7 @@ menuconfig VFIO | ||
5645 | |||
5646 | If you don't know what to do here, say N. | ||
5647 | |||
5648 | -menuconfig VFIO_NOIOMMU | ||
5649 | +config VFIO_NOIOMMU | ||
5650 | bool "VFIO No-IOMMU support" | ||
5651 | depends on VFIO | ||
5652 | help | ||
5653 | diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c | ||
5654 | index 48e574ae60330..cec9173aac6f5 100644 | ||
5655 | --- a/drivers/vhost/net.c | ||
5656 | +++ b/drivers/vhost/net.c | ||
5657 | @@ -466,7 +466,7 @@ static void vhost_tx_batch(struct vhost_net *net, | ||
5658 | .num = nvq->batched_xdp, | ||
5659 | .ptr = nvq->xdp, | ||
5660 | }; | ||
5661 | - int err; | ||
5662 | + int i, err; | ||
5663 | |||
5664 | if (nvq->batched_xdp == 0) | ||
5665 | goto signal_used; | ||
5666 | @@ -475,6 +475,15 @@ static void vhost_tx_batch(struct vhost_net *net, | ||
5667 | err = sock->ops->sendmsg(sock, msghdr, 0); | ||
5668 | if (unlikely(err < 0)) { | ||
5669 | vq_err(&nvq->vq, "Fail to batch sending packets\n"); | ||
5670 | + | ||
5671 | + /* free pages owned by XDP; since this is an unlikely error path, | ||
5672 | + * keep it simple and avoid more complex bulk update for the | ||
5673 | + * used pages | ||
5674 | + */ | ||
5675 | + for (i = 0; i < nvq->batched_xdp; ++i) | ||
5676 | + put_page(virt_to_head_page(nvq->xdp[i].data)); | ||
5677 | + nvq->batched_xdp = 0; | ||
5678 | + nvq->done_idx = 0; | ||
5679 | return; | ||
5680 | } | ||
5681 | |||
5682 | diff --git a/drivers/video/fbdev/asiliantfb.c b/drivers/video/fbdev/asiliantfb.c | ||
5683 | index ea31054a28ca8..c1d6e63362259 100644 | ||
5684 | --- a/drivers/video/fbdev/asiliantfb.c | ||
5685 | +++ b/drivers/video/fbdev/asiliantfb.c | ||
5686 | @@ -227,6 +227,9 @@ static int asiliantfb_check_var(struct fb_var_screeninfo *var, | ||
5687 | { | ||
5688 | unsigned long Ftarget, ratio, remainder; | ||
5689 | |||
5690 | + if (!var->pixclock) | ||
5691 | + return -EINVAL; | ||
5692 | + | ||
5693 | ratio = 1000000 / var->pixclock; | ||
5694 | remainder = 1000000 % var->pixclock; | ||
5695 | Ftarget = 1000000 * ratio + (1000000 * remainder) / var->pixclock; | ||
5696 | diff --git a/drivers/video/fbdev/kyro/fbdev.c b/drivers/video/fbdev/kyro/fbdev.c | ||
5697 | index a7bd9f25911b5..74bf26b527b91 100644 | ||
5698 | --- a/drivers/video/fbdev/kyro/fbdev.c | ||
5699 | +++ b/drivers/video/fbdev/kyro/fbdev.c | ||
5700 | @@ -372,6 +372,11 @@ static int kyro_dev_overlay_viewport_set(u32 x, u32 y, u32 ulWidth, u32 ulHeight | ||
5701 | /* probably haven't called CreateOverlay yet */ | ||
5702 | return -EINVAL; | ||
5703 | |||
5704 | + if (ulWidth == 0 || ulWidth == 0xffffffff || | ||
5705 | + ulHeight == 0 || ulHeight == 0xffffffff || | ||
5706 | + (x < 2 && ulWidth + 2 == 0)) | ||
5707 | + return -EINVAL; | ||
5708 | + | ||
5709 | /* Stop Ramdac Output */ | ||
5710 | DisableRamdacOutput(deviceInfo.pSTGReg); | ||
5711 | |||
5712 | @@ -394,6 +399,9 @@ static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | ||
5713 | { | ||
5714 | struct kyrofb_info *par = info->par; | ||
5715 | |||
5716 | + if (!var->pixclock) | ||
5717 | + return -EINVAL; | ||
5718 | + | ||
5719 | if (var->bits_per_pixel != 16 && var->bits_per_pixel != 32) { | ||
5720 | printk(KERN_WARNING "kyrofb: depth not supported: %u\n", var->bits_per_pixel); | ||
5721 | return -EINVAL; | ||
5722 | diff --git a/drivers/video/fbdev/riva/fbdev.c b/drivers/video/fbdev/riva/fbdev.c | ||
5723 | index ca593a3e41d74..51c9d9508c0b0 100644 | ||
5724 | --- a/drivers/video/fbdev/riva/fbdev.c | ||
5725 | +++ b/drivers/video/fbdev/riva/fbdev.c | ||
5726 | @@ -1088,6 +1088,9 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | ||
5727 | int mode_valid = 0; | ||
5728 | |||
5729 | NVTRACE_ENTER(); | ||
5730 | + if (!var->pixclock) | ||
5731 | + return -EINVAL; | ||
5732 | + | ||
5733 | switch (var->bits_per_pixel) { | ||
5734 | case 1 ... 8: | ||
5735 | var->red.offset = var->green.offset = var->blue.offset = 0; | ||
5736 | diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c | ||
5737 | index dacd67dca43fe..946ae198b3449 100644 | ||
5738 | --- a/fs/btrfs/disk-io.c | ||
5739 | +++ b/fs/btrfs/disk-io.c | ||
5740 | @@ -2894,6 +2894,29 @@ int open_ctree(struct super_block *sb, | ||
5741 | */ | ||
5742 | fs_info->compress_type = BTRFS_COMPRESS_ZLIB; | ||
5743 | |||
5744 | + /* | ||
5745 | + * Flag our filesystem as having big metadata blocks if they are bigger | ||
5746 | + * than the page size | ||
5747 | + */ | ||
5748 | + if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) { | ||
5749 | + if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA)) | ||
5750 | + btrfs_info(fs_info, | ||
5751 | + "flagging fs with big metadata feature"); | ||
5752 | + features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA; | ||
5753 | + } | ||
5754 | + | ||
5755 | + /* Set up fs_info before parsing mount options */ | ||
5756 | + nodesize = btrfs_super_nodesize(disk_super); | ||
5757 | + sectorsize = btrfs_super_sectorsize(disk_super); | ||
5758 | + stripesize = sectorsize; | ||
5759 | + fs_info->dirty_metadata_batch = nodesize * (1 + ilog2(nr_cpu_ids)); | ||
5760 | + fs_info->delalloc_batch = sectorsize * 512 * (1 + ilog2(nr_cpu_ids)); | ||
5761 | + | ||
5762 | + /* Cache block sizes */ | ||
5763 | + fs_info->nodesize = nodesize; | ||
5764 | + fs_info->sectorsize = sectorsize; | ||
5765 | + fs_info->stripesize = stripesize; | ||
5766 | + | ||
5767 | ret = btrfs_parse_options(fs_info, options, sb->s_flags); | ||
5768 | if (ret) { | ||
5769 | err = ret; | ||
5770 | @@ -2920,28 +2943,6 @@ int open_ctree(struct super_block *sb, | ||
5771 | if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA) | ||
5772 | btrfs_info(fs_info, "has skinny extents"); | ||
5773 | |||
5774 | - /* | ||
5775 | - * flag our filesystem as having big metadata blocks if | ||
5776 | - * they are bigger than the page size | ||
5777 | - */ | ||
5778 | - if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) { | ||
5779 | - if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA)) | ||
5780 | - btrfs_info(fs_info, | ||
5781 | - "flagging fs with big metadata feature"); | ||
5782 | - features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA; | ||
5783 | - } | ||
5784 | - | ||
5785 | - nodesize = btrfs_super_nodesize(disk_super); | ||
5786 | - sectorsize = btrfs_super_sectorsize(disk_super); | ||
5787 | - stripesize = sectorsize; | ||
5788 | - fs_info->dirty_metadata_batch = nodesize * (1 + ilog2(nr_cpu_ids)); | ||
5789 | - fs_info->delalloc_batch = sectorsize * 512 * (1 + ilog2(nr_cpu_ids)); | ||
5790 | - | ||
5791 | - /* Cache block sizes */ | ||
5792 | - fs_info->nodesize = nodesize; | ||
5793 | - fs_info->sectorsize = sectorsize; | ||
5794 | - fs_info->stripesize = stripesize; | ||
5795 | - | ||
5796 | /* | ||
5797 | * mixed block groups end up with duplicate but slightly offset | ||
5798 | * extent buffers for the same range. It leads to corruptions | ||
5799 | diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c | ||
5800 | index 33b8fedab6c67..b859ed50cf46c 100644 | ||
5801 | --- a/fs/btrfs/inode.c | ||
5802 | +++ b/fs/btrfs/inode.c | ||
5803 | @@ -1200,11 +1200,6 @@ static noinline void async_cow_submit(struct btrfs_work *work) | ||
5804 | nr_pages = (async_chunk->end - async_chunk->start + PAGE_SIZE) >> | ||
5805 | PAGE_SHIFT; | ||
5806 | |||
5807 | - /* atomic_sub_return implies a barrier */ | ||
5808 | - if (atomic_sub_return(nr_pages, &fs_info->async_delalloc_pages) < | ||
5809 | - 5 * SZ_1M) | ||
5810 | - cond_wake_up_nomb(&fs_info->async_submit_wait); | ||
5811 | - | ||
5812 | /* | ||
5813 | * ->inode could be NULL if async_chunk_start has failed to compress, | ||
5814 | * in which case we don't have anything to submit, yet we need to | ||
5815 | @@ -1213,6 +1208,11 @@ static noinline void async_cow_submit(struct btrfs_work *work) | ||
5816 | */ | ||
5817 | if (async_chunk->inode) | ||
5818 | submit_compressed_extents(async_chunk); | ||
5819 | + | ||
5820 | + /* atomic_sub_return implies a barrier */ | ||
5821 | + if (atomic_sub_return(nr_pages, &fs_info->async_delalloc_pages) < | ||
5822 | + 5 * SZ_1M) | ||
5823 | + cond_wake_up_nomb(&fs_info->async_submit_wait); | ||
5824 | } | ||
5825 | |||
5826 | static noinline void async_cow_free(struct btrfs_work *work) | ||
5827 | diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c | ||
5828 | index 5412361d0c270..8ea4b3da85d1a 100644 | ||
5829 | --- a/fs/btrfs/tree-log.c | ||
5830 | +++ b/fs/btrfs/tree-log.c | ||
5831 | @@ -719,7 +719,9 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, | ||
5832 | */ | ||
5833 | ret = btrfs_lookup_data_extent(fs_info, ins.objectid, | ||
5834 | ins.offset); | ||
5835 | - if (ret == 0) { | ||
5836 | + if (ret < 0) { | ||
5837 | + goto out; | ||
5838 | + } else if (ret == 0) { | ||
5839 | btrfs_init_generic_ref(&ref, | ||
5840 | BTRFS_ADD_DELAYED_REF, | ||
5841 | ins.objectid, ins.offset, 0); | ||
5842 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c | ||
5843 | index e882c790292f9..8deee49a6b3fa 100644 | ||
5844 | --- a/fs/btrfs/volumes.c | ||
5845 | +++ b/fs/btrfs/volumes.c | ||
5846 | @@ -1311,6 +1311,9 @@ static void btrfs_close_one_device(struct btrfs_device *device) | ||
5847 | fs_devices->rw_devices--; | ||
5848 | } | ||
5849 | |||
5850 | + if (device->devid == BTRFS_DEV_REPLACE_DEVID) | ||
5851 | + clear_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state); | ||
5852 | + | ||
5853 | if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) | ||
5854 | fs_devices->missing_devices--; | ||
5855 | |||
5856 | diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c | ||
5857 | index 85bd644f9773b..30f841a880acd 100644 | ||
5858 | --- a/fs/cifs/sess.c | ||
5859 | +++ b/fs/cifs/sess.c | ||
5860 | @@ -610,7 +610,7 @@ sess_alloc_buffer(struct sess_data *sess_data, int wct) | ||
5861 | return 0; | ||
5862 | |||
5863 | out_free_smb_buf: | ||
5864 | - kfree(smb_buf); | ||
5865 | + cifs_small_buf_release(smb_buf); | ||
5866 | sess_data->iov[0].iov_base = NULL; | ||
5867 | sess_data->iov[0].iov_len = 0; | ||
5868 | sess_data->buf0_type = CIFS_NO_BUFFER; | ||
5869 | diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c | ||
5870 | index a57219c51c01a..f7d27cbbeb860 100644 | ||
5871 | --- a/fs/f2fs/checkpoint.c | ||
5872 | +++ b/fs/f2fs/checkpoint.c | ||
5873 | @@ -583,7 +583,7 @@ int f2fs_acquire_orphan_inode(struct f2fs_sb_info *sbi) | ||
5874 | |||
5875 | if (time_to_inject(sbi, FAULT_ORPHAN)) { | ||
5876 | spin_unlock(&im->ino_lock); | ||
5877 | - f2fs_show_injection_info(FAULT_ORPHAN); | ||
5878 | + f2fs_show_injection_info(sbi, FAULT_ORPHAN); | ||
5879 | return -ENOSPC; | ||
5880 | } | ||
5881 | |||
5882 | diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c | ||
5883 | index 64ee2a064e339..1679f9c0b63b3 100644 | ||
5884 | --- a/fs/f2fs/data.c | ||
5885 | +++ b/fs/f2fs/data.c | ||
5886 | @@ -167,9 +167,10 @@ static bool f2fs_bio_post_read_required(struct bio *bio) | ||
5887 | |||
5888 | static void f2fs_read_end_io(struct bio *bio) | ||
5889 | { | ||
5890 | - if (time_to_inject(F2FS_P_SB(bio_first_page_all(bio)), | ||
5891 | - FAULT_READ_IO)) { | ||
5892 | - f2fs_show_injection_info(FAULT_READ_IO); | ||
5893 | + struct f2fs_sb_info *sbi = F2FS_P_SB(bio_first_page_all(bio)); | ||
5894 | + | ||
5895 | + if (time_to_inject(sbi, FAULT_READ_IO)) { | ||
5896 | + f2fs_show_injection_info(sbi, FAULT_READ_IO); | ||
5897 | bio->bi_status = BLK_STS_IOERR; | ||
5898 | } | ||
5899 | |||
5900 | @@ -191,7 +192,7 @@ static void f2fs_write_end_io(struct bio *bio) | ||
5901 | struct bvec_iter_all iter_all; | ||
5902 | |||
5903 | if (time_to_inject(sbi, FAULT_WRITE_IO)) { | ||
5904 | - f2fs_show_injection_info(FAULT_WRITE_IO); | ||
5905 | + f2fs_show_injection_info(sbi, FAULT_WRITE_IO); | ||
5906 | bio->bi_status = BLK_STS_IOERR; | ||
5907 | } | ||
5908 | |||
5909 | @@ -1190,7 +1191,21 @@ next_dnode: | ||
5910 | if (err) { | ||
5911 | if (flag == F2FS_GET_BLOCK_BMAP) | ||
5912 | map->m_pblk = 0; | ||
5913 | + | ||
5914 | if (err == -ENOENT) { | ||
5915 | + /* | ||
5916 | + * There is one exceptional case that read_node_page() | ||
5917 | + * may return -ENOENT due to filesystem has been | ||
5918 | + * shutdown or cp_error, so force to convert error | ||
5919 | + * number to EIO for such case. | ||
5920 | + */ | ||
5921 | + if (map->m_may_create && | ||
5922 | + (is_sbi_flag_set(sbi, SBI_IS_SHUTDOWN) || | ||
5923 | + f2fs_cp_error(sbi))) { | ||
5924 | + err = -EIO; | ||
5925 | + goto unlock_out; | ||
5926 | + } | ||
5927 | + | ||
5928 | err = 0; | ||
5929 | if (map->m_next_pgofs) | ||
5930 | *map->m_next_pgofs = | ||
5931 | diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c | ||
5932 | index 78d041f9775a4..99c4a868d73b0 100644 | ||
5933 | --- a/fs/f2fs/dir.c | ||
5934 | +++ b/fs/f2fs/dir.c | ||
5935 | @@ -618,7 +618,7 @@ int f2fs_add_regular_entry(struct inode *dir, const struct qstr *new_name, | ||
5936 | |||
5937 | start: | ||
5938 | if (time_to_inject(F2FS_I_SB(dir), FAULT_DIR_DEPTH)) { | ||
5939 | - f2fs_show_injection_info(FAULT_DIR_DEPTH); | ||
5940 | + f2fs_show_injection_info(F2FS_I_SB(dir), FAULT_DIR_DEPTH); | ||
5941 | return -ENOSPC; | ||
5942 | } | ||
5943 | |||
5944 | @@ -892,6 +892,7 @@ int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d, | ||
5945 | struct f2fs_sb_info *sbi = F2FS_I_SB(d->inode); | ||
5946 | struct blk_plug plug; | ||
5947 | bool readdir_ra = sbi->readdir_ra == 1; | ||
5948 | + bool found_valid_dirent = false; | ||
5949 | int err = 0; | ||
5950 | |||
5951 | bit_pos = ((unsigned long)ctx->pos % d->max); | ||
5952 | @@ -906,12 +907,15 @@ int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d, | ||
5953 | |||
5954 | de = &d->dentry[bit_pos]; | ||
5955 | if (de->name_len == 0) { | ||
5956 | + if (found_valid_dirent || !bit_pos) { | ||
5957 | + printk_ratelimited( | ||
5958 | + "%sF2FS-fs (%s): invalid namelen(0), ino:%u, run fsck to fix.", | ||
5959 | + KERN_WARNING, sbi->sb->s_id, | ||
5960 | + le32_to_cpu(de->ino)); | ||
5961 | + set_sbi_flag(sbi, SBI_NEED_FSCK); | ||
5962 | + } | ||
5963 | bit_pos++; | ||
5964 | ctx->pos = start_pos + bit_pos; | ||
5965 | - printk_ratelimited( | ||
5966 | - "%s, invalid namelen(0), ino:%u, run fsck to fix.", | ||
5967 | - KERN_WARNING, le32_to_cpu(de->ino)); | ||
5968 | - set_sbi_flag(sbi, SBI_NEED_FSCK); | ||
5969 | continue; | ||
5970 | } | ||
5971 | |||
5972 | @@ -954,6 +958,7 @@ int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d, | ||
5973 | f2fs_ra_node_page(sbi, le32_to_cpu(de->ino)); | ||
5974 | |||
5975 | ctx->pos = start_pos + bit_pos; | ||
5976 | + found_valid_dirent = true; | ||
5977 | } | ||
5978 | out: | ||
5979 | if (readdir_ra) | ||
5980 | diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h | ||
5981 | index 4ca3c2a0a0f5b..031a17bf52a24 100644 | ||
5982 | --- a/fs/f2fs/f2fs.h | ||
5983 | +++ b/fs/f2fs/f2fs.h | ||
5984 | @@ -1374,9 +1374,10 @@ struct f2fs_private_dio { | ||
5985 | }; | ||
5986 | |||
5987 | #ifdef CONFIG_F2FS_FAULT_INJECTION | ||
5988 | -#define f2fs_show_injection_info(type) \ | ||
5989 | - printk_ratelimited("%sF2FS-fs : inject %s in %s of %pS\n", \ | ||
5990 | - KERN_INFO, f2fs_fault_name[type], \ | ||
5991 | +#define f2fs_show_injection_info(sbi, type) \ | ||
5992 | + printk_ratelimited("%sF2FS-fs (%s) : inject %s in %s of %pS\n", \ | ||
5993 | + KERN_INFO, sbi->sb->s_id, \ | ||
5994 | + f2fs_fault_name[type], \ | ||
5995 | __func__, __builtin_return_address(0)) | ||
5996 | static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type) | ||
5997 | { | ||
5998 | @@ -1396,7 +1397,7 @@ static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type) | ||
5999 | return false; | ||
6000 | } | ||
6001 | #else | ||
6002 | -#define f2fs_show_injection_info(type) do { } while (0) | ||
6003 | +#define f2fs_show_injection_info(sbi, type) do { } while (0) | ||
6004 | static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type) | ||
6005 | { | ||
6006 | return false; | ||
6007 | @@ -1781,7 +1782,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi, | ||
6008 | return ret; | ||
6009 | |||
6010 | if (time_to_inject(sbi, FAULT_BLOCK)) { | ||
6011 | - f2fs_show_injection_info(FAULT_BLOCK); | ||
6012 | + f2fs_show_injection_info(sbi, FAULT_BLOCK); | ||
6013 | release = *count; | ||
6014 | goto release_quota; | ||
6015 | } | ||
6016 | @@ -2033,7 +2034,7 @@ static inline int inc_valid_node_count(struct f2fs_sb_info *sbi, | ||
6017 | } | ||
6018 | |||
6019 | if (time_to_inject(sbi, FAULT_BLOCK)) { | ||
6020 | - f2fs_show_injection_info(FAULT_BLOCK); | ||
6021 | + f2fs_show_injection_info(sbi, FAULT_BLOCK); | ||
6022 | goto enospc; | ||
6023 | } | ||
6024 | |||
6025 | @@ -2148,7 +2149,8 @@ static inline struct page *f2fs_grab_cache_page(struct address_space *mapping, | ||
6026 | return page; | ||
6027 | |||
6028 | if (time_to_inject(F2FS_M_SB(mapping), FAULT_PAGE_ALLOC)) { | ||
6029 | - f2fs_show_injection_info(FAULT_PAGE_ALLOC); | ||
6030 | + f2fs_show_injection_info(F2FS_M_SB(mapping), | ||
6031 | + FAULT_PAGE_ALLOC); | ||
6032 | return NULL; | ||
6033 | } | ||
6034 | } | ||
6035 | @@ -2163,7 +2165,7 @@ static inline struct page *f2fs_pagecache_get_page( | ||
6036 | int fgp_flags, gfp_t gfp_mask) | ||
6037 | { | ||
6038 | if (time_to_inject(F2FS_M_SB(mapping), FAULT_PAGE_GET)) { | ||
6039 | - f2fs_show_injection_info(FAULT_PAGE_GET); | ||
6040 | + f2fs_show_injection_info(F2FS_M_SB(mapping), FAULT_PAGE_GET); | ||
6041 | return NULL; | ||
6042 | } | ||
6043 | |||
6044 | @@ -2232,7 +2234,7 @@ static inline struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, | ||
6045 | return bio; | ||
6046 | } | ||
6047 | if (time_to_inject(sbi, FAULT_ALLOC_BIO)) { | ||
6048 | - f2fs_show_injection_info(FAULT_ALLOC_BIO); | ||
6049 | + f2fs_show_injection_info(sbi, FAULT_ALLOC_BIO); | ||
6050 | return NULL; | ||
6051 | } | ||
6052 | |||
6053 | @@ -2797,7 +2799,7 @@ static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi, | ||
6054 | size_t size, gfp_t flags) | ||
6055 | { | ||
6056 | if (time_to_inject(sbi, FAULT_KMALLOC)) { | ||
6057 | - f2fs_show_injection_info(FAULT_KMALLOC); | ||
6058 | + f2fs_show_injection_info(sbi, FAULT_KMALLOC); | ||
6059 | return NULL; | ||
6060 | } | ||
6061 | |||
6062 | @@ -2814,7 +2816,7 @@ static inline void *f2fs_kvmalloc(struct f2fs_sb_info *sbi, | ||
6063 | size_t size, gfp_t flags) | ||
6064 | { | ||
6065 | if (time_to_inject(sbi, FAULT_KVMALLOC)) { | ||
6066 | - f2fs_show_injection_info(FAULT_KVMALLOC); | ||
6067 | + f2fs_show_injection_info(sbi, FAULT_KVMALLOC); | ||
6068 | return NULL; | ||
6069 | } | ||
6070 | |||
6071 | diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c | ||
6072 | index 6e58b2e62b189..516007bb1ced1 100644 | ||
6073 | --- a/fs/f2fs/file.c | ||
6074 | +++ b/fs/f2fs/file.c | ||
6075 | @@ -682,7 +682,7 @@ int f2fs_truncate(struct inode *inode) | ||
6076 | trace_f2fs_truncate(inode); | ||
6077 | |||
6078 | if (time_to_inject(F2FS_I_SB(inode), FAULT_TRUNCATE)) { | ||
6079 | - f2fs_show_injection_info(FAULT_TRUNCATE); | ||
6080 | + f2fs_show_injection_info(F2FS_I_SB(inode), FAULT_TRUNCATE); | ||
6081 | return -EIO; | ||
6082 | } | ||
6083 | |||
6084 | @@ -981,7 +981,6 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len) | ||
6085 | } | ||
6086 | |||
6087 | if (pg_start < pg_end) { | ||
6088 | - struct address_space *mapping = inode->i_mapping; | ||
6089 | loff_t blk_start, blk_end; | ||
6090 | struct f2fs_sb_info *sbi = F2FS_I_SB(inode); | ||
6091 | |||
6092 | @@ -993,8 +992,7 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len) | ||
6093 | down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); | ||
6094 | down_write(&F2FS_I(inode)->i_mmap_sem); | ||
6095 | |||
6096 | - truncate_inode_pages_range(mapping, blk_start, | ||
6097 | - blk_end - 1); | ||
6098 | + truncate_pagecache_range(inode, blk_start, blk_end - 1); | ||
6099 | |||
6100 | f2fs_lock_op(sbi); | ||
6101 | ret = f2fs_truncate_hole(inode, pg_start, pg_end); | ||
6102 | diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c | ||
6103 | index a78aa5480454f..4b6c36208f552 100644 | ||
6104 | --- a/fs/f2fs/gc.c | ||
6105 | +++ b/fs/f2fs/gc.c | ||
6106 | @@ -54,7 +54,7 @@ static int gc_thread_func(void *data) | ||
6107 | } | ||
6108 | |||
6109 | if (time_to_inject(sbi, FAULT_CHECKPOINT)) { | ||
6110 | - f2fs_show_injection_info(FAULT_CHECKPOINT); | ||
6111 | + f2fs_show_injection_info(sbi, FAULT_CHECKPOINT); | ||
6112 | f2fs_stop_checkpoint(sbi, false); | ||
6113 | } | ||
6114 | |||
6115 | @@ -1095,8 +1095,10 @@ next_step: | ||
6116 | int err; | ||
6117 | |||
6118 | if (S_ISREG(inode->i_mode)) { | ||
6119 | - if (!down_write_trylock(&fi->i_gc_rwsem[READ])) | ||
6120 | + if (!down_write_trylock(&fi->i_gc_rwsem[READ])) { | ||
6121 | + sbi->skipped_gc_rwsem++; | ||
6122 | continue; | ||
6123 | + } | ||
6124 | if (!down_write_trylock( | ||
6125 | &fi->i_gc_rwsem[WRITE])) { | ||
6126 | sbi->skipped_gc_rwsem++; | ||
6127 | diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c | ||
6128 | index 386ad54c13c3a..502bd491336a8 100644 | ||
6129 | --- a/fs/f2fs/inode.c | ||
6130 | +++ b/fs/f2fs/inode.c | ||
6131 | @@ -681,7 +681,7 @@ retry: | ||
6132 | err = f2fs_truncate(inode); | ||
6133 | |||
6134 | if (time_to_inject(sbi, FAULT_EVICT_INODE)) { | ||
6135 | - f2fs_show_injection_info(FAULT_EVICT_INODE); | ||
6136 | + f2fs_show_injection_info(sbi, FAULT_EVICT_INODE); | ||
6137 | err = -EIO; | ||
6138 | } | ||
6139 | |||
6140 | diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c | ||
6141 | index 48bb5d3c709db..4cb182c20eedd 100644 | ||
6142 | --- a/fs/f2fs/node.c | ||
6143 | +++ b/fs/f2fs/node.c | ||
6144 | @@ -2406,7 +2406,7 @@ bool f2fs_alloc_nid(struct f2fs_sb_info *sbi, nid_t *nid) | ||
6145 | struct free_nid *i = NULL; | ||
6146 | retry: | ||
6147 | if (time_to_inject(sbi, FAULT_ALLOC_NID)) { | ||
6148 | - f2fs_show_injection_info(FAULT_ALLOC_NID); | ||
6149 | + f2fs_show_injection_info(sbi, FAULT_ALLOC_NID); | ||
6150 | return false; | ||
6151 | } | ||
6152 | |||
6153 | diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c | ||
6154 | index 5ba677f85533c..78c54bb7898df 100644 | ||
6155 | --- a/fs/f2fs/segment.c | ||
6156 | +++ b/fs/f2fs/segment.c | ||
6157 | @@ -489,7 +489,7 @@ int f2fs_commit_inmem_pages(struct inode *inode) | ||
6158 | void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need) | ||
6159 | { | ||
6160 | if (time_to_inject(sbi, FAULT_CHECKPOINT)) { | ||
6161 | - f2fs_show_injection_info(FAULT_CHECKPOINT); | ||
6162 | + f2fs_show_injection_info(sbi, FAULT_CHECKPOINT); | ||
6163 | f2fs_stop_checkpoint(sbi, false); | ||
6164 | } | ||
6165 | |||
6166 | @@ -1017,8 +1017,9 @@ static void __remove_discard_cmd(struct f2fs_sb_info *sbi, | ||
6167 | |||
6168 | if (dc->error) | ||
6169 | printk_ratelimited( | ||
6170 | - "%sF2FS-fs: Issue discard(%u, %u, %u) failed, ret: %d", | ||
6171 | - KERN_INFO, dc->lstart, dc->start, dc->len, dc->error); | ||
6172 | + "%sF2FS-fs (%s): Issue discard(%u, %u, %u) failed, ret: %d", | ||
6173 | + KERN_INFO, sbi->sb->s_id, | ||
6174 | + dc->lstart, dc->start, dc->len, dc->error); | ||
6175 | __detach_discard_cmd(dcc, dc); | ||
6176 | } | ||
6177 | |||
6178 | @@ -1158,7 +1159,7 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi, | ||
6179 | dc->len += len; | ||
6180 | |||
6181 | if (time_to_inject(sbi, FAULT_DISCARD)) { | ||
6182 | - f2fs_show_injection_info(FAULT_DISCARD); | ||
6183 | + f2fs_show_injection_info(sbi, FAULT_DISCARD); | ||
6184 | err = -EIO; | ||
6185 | goto submit; | ||
6186 | } | ||
6187 | diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c | ||
6188 | index 6d904dc9bd199..41bf656658ba8 100644 | ||
6189 | --- a/fs/f2fs/super.c | ||
6190 | +++ b/fs/f2fs/super.c | ||
6191 | @@ -1994,6 +1994,33 @@ static int f2fs_enable_quotas(struct super_block *sb) | ||
6192 | return 0; | ||
6193 | } | ||
6194 | |||
6195 | +static int f2fs_quota_sync_file(struct f2fs_sb_info *sbi, int type) | ||
6196 | +{ | ||
6197 | + struct quota_info *dqopt = sb_dqopt(sbi->sb); | ||
6198 | + struct address_space *mapping = dqopt->files[type]->i_mapping; | ||
6199 | + int ret = 0; | ||
6200 | + | ||
6201 | + ret = dquot_writeback_dquots(sbi->sb, type); | ||
6202 | + if (ret) | ||
6203 | + goto out; | ||
6204 | + | ||
6205 | + ret = filemap_fdatawrite(mapping); | ||
6206 | + if (ret) | ||
6207 | + goto out; | ||
6208 | + | ||
6209 | + /* if we are using journalled quota */ | ||
6210 | + if (is_journalled_quota(sbi)) | ||
6211 | + goto out; | ||
6212 | + | ||
6213 | + ret = filemap_fdatawait(mapping); | ||
6214 | + | ||
6215 | + truncate_inode_pages(&dqopt->files[type]->i_data, 0); | ||
6216 | +out: | ||
6217 | + if (ret) | ||
6218 | + set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); | ||
6219 | + return ret; | ||
6220 | +} | ||
6221 | + | ||
6222 | int f2fs_quota_sync(struct super_block *sb, int type) | ||
6223 | { | ||
6224 | struct f2fs_sb_info *sbi = F2FS_SB(sb); | ||
6225 | @@ -2001,57 +2028,42 @@ int f2fs_quota_sync(struct super_block *sb, int type) | ||
6226 | int cnt; | ||
6227 | int ret; | ||
6228 | |||
6229 | - /* | ||
6230 | - * do_quotactl | ||
6231 | - * f2fs_quota_sync | ||
6232 | - * down_read(quota_sem) | ||
6233 | - * dquot_writeback_dquots() | ||
6234 | - * f2fs_dquot_commit | ||
6235 | - * block_operation | ||
6236 | - * down_read(quota_sem) | ||
6237 | - */ | ||
6238 | - f2fs_lock_op(sbi); | ||
6239 | - | ||
6240 | - down_read(&sbi->quota_sem); | ||
6241 | - ret = dquot_writeback_dquots(sb, type); | ||
6242 | - if (ret) | ||
6243 | - goto out; | ||
6244 | - | ||
6245 | /* | ||
6246 | * Now when everything is written we can discard the pagecache so | ||
6247 | * that userspace sees the changes. | ||
6248 | */ | ||
6249 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | ||
6250 | - struct address_space *mapping; | ||
6251 | |||
6252 | if (type != -1 && cnt != type) | ||
6253 | continue; | ||
6254 | - if (!sb_has_quota_active(sb, cnt)) | ||
6255 | - continue; | ||
6256 | |||
6257 | - mapping = dqopt->files[cnt]->i_mapping; | ||
6258 | + if (!sb_has_quota_active(sb, type)) | ||
6259 | + return 0; | ||
6260 | |||
6261 | - ret = filemap_fdatawrite(mapping); | ||
6262 | - if (ret) | ||
6263 | - goto out; | ||
6264 | + inode_lock(dqopt->files[cnt]); | ||
6265 | |||
6266 | - /* if we are using journalled quota */ | ||
6267 | - if (is_journalled_quota(sbi)) | ||
6268 | - continue; | ||
6269 | + /* | ||
6270 | + * do_quotactl | ||
6271 | + * f2fs_quota_sync | ||
6272 | + * down_read(quota_sem) | ||
6273 | + * dquot_writeback_dquots() | ||
6274 | + * f2fs_dquot_commit | ||
6275 | + * block_operation | ||
6276 | + * down_read(quota_sem) | ||
6277 | + */ | ||
6278 | + f2fs_lock_op(sbi); | ||
6279 | + down_read(&sbi->quota_sem); | ||
6280 | |||
6281 | - ret = filemap_fdatawait(mapping); | ||
6282 | - if (ret) | ||
6283 | - set_sbi_flag(F2FS_SB(sb), SBI_QUOTA_NEED_REPAIR); | ||
6284 | + ret = f2fs_quota_sync_file(sbi, cnt); | ||
6285 | + | ||
6286 | + up_read(&sbi->quota_sem); | ||
6287 | + f2fs_unlock_op(sbi); | ||
6288 | |||
6289 | - inode_lock(dqopt->files[cnt]); | ||
6290 | - truncate_inode_pages(&dqopt->files[cnt]->i_data, 0); | ||
6291 | inode_unlock(dqopt->files[cnt]); | ||
6292 | + | ||
6293 | + if (ret) | ||
6294 | + break; | ||
6295 | } | ||
6296 | -out: | ||
6297 | - if (ret) | ||
6298 | - set_sbi_flag(F2FS_SB(sb), SBI_QUOTA_NEED_REPAIR); | ||
6299 | - up_read(&sbi->quota_sem); | ||
6300 | - f2fs_unlock_op(sbi); | ||
6301 | return ret; | ||
6302 | } | ||
6303 | |||
6304 | diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c | ||
6305 | index 0ce39658a6200..44a426c8ea01e 100644 | ||
6306 | --- a/fs/fscache/cookie.c | ||
6307 | +++ b/fs/fscache/cookie.c | ||
6308 | @@ -74,10 +74,8 @@ void fscache_free_cookie(struct fscache_cookie *cookie) | ||
6309 | static int fscache_set_key(struct fscache_cookie *cookie, | ||
6310 | const void *index_key, size_t index_key_len) | ||
6311 | { | ||
6312 | - unsigned long long h; | ||
6313 | u32 *buf; | ||
6314 | int bufs; | ||
6315 | - int i; | ||
6316 | |||
6317 | bufs = DIV_ROUND_UP(index_key_len, sizeof(*buf)); | ||
6318 | |||
6319 | @@ -91,17 +89,7 @@ static int fscache_set_key(struct fscache_cookie *cookie, | ||
6320 | } | ||
6321 | |||
6322 | memcpy(buf, index_key, index_key_len); | ||
6323 | - | ||
6324 | - /* Calculate a hash and combine this with the length in the first word | ||
6325 | - * or first half word | ||
6326 | - */ | ||
6327 | - h = (unsigned long)cookie->parent; | ||
6328 | - h += index_key_len + cookie->type; | ||
6329 | - | ||
6330 | - for (i = 0; i < bufs; i++) | ||
6331 | - h += buf[i]; | ||
6332 | - | ||
6333 | - cookie->key_hash = h ^ (h >> 32); | ||
6334 | + cookie->key_hash = fscache_hash(0, buf, bufs); | ||
6335 | return 0; | ||
6336 | } | ||
6337 | |||
6338 | diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h | ||
6339 | index 9616af3768e11..d09d4e69c818e 100644 | ||
6340 | --- a/fs/fscache/internal.h | ||
6341 | +++ b/fs/fscache/internal.h | ||
6342 | @@ -97,6 +97,8 @@ extern struct workqueue_struct *fscache_object_wq; | ||
6343 | extern struct workqueue_struct *fscache_op_wq; | ||
6344 | DECLARE_PER_CPU(wait_queue_head_t, fscache_object_cong_wait); | ||
6345 | |||
6346 | +extern unsigned int fscache_hash(unsigned int salt, unsigned int *data, unsigned int n); | ||
6347 | + | ||
6348 | static inline bool fscache_object_congested(void) | ||
6349 | { | ||
6350 | return workqueue_congested(WORK_CPU_UNBOUND, fscache_object_wq); | ||
6351 | diff --git a/fs/fscache/main.c b/fs/fscache/main.c | ||
6352 | index 59c2494efda34..3aa3756c71761 100644 | ||
6353 | --- a/fs/fscache/main.c | ||
6354 | +++ b/fs/fscache/main.c | ||
6355 | @@ -94,6 +94,45 @@ static struct ctl_table fscache_sysctls_root[] = { | ||
6356 | }; | ||
6357 | #endif | ||
6358 | |||
6359 | +/* | ||
6360 | + * Mixing scores (in bits) for (7,20): | ||
6361 | + * Input delta: 1-bit 2-bit | ||
6362 | + * 1 round: 330.3 9201.6 | ||
6363 | + * 2 rounds: 1246.4 25475.4 | ||
6364 | + * 3 rounds: 1907.1 31295.1 | ||
6365 | + * 4 rounds: 2042.3 31718.6 | ||
6366 | + * Perfect: 2048 31744 | ||
6367 | + * (32*64) (32*31/2 * 64) | ||
6368 | + */ | ||
6369 | +#define HASH_MIX(x, y, a) \ | ||
6370 | + ( x ^= (a), \ | ||
6371 | + y ^= x, x = rol32(x, 7),\ | ||
6372 | + x += y, y = rol32(y,20),\ | ||
6373 | + y *= 9 ) | ||
6374 | + | ||
6375 | +static inline unsigned int fold_hash(unsigned long x, unsigned long y) | ||
6376 | +{ | ||
6377 | + /* Use arch-optimized multiply if one exists */ | ||
6378 | + return __hash_32(y ^ __hash_32(x)); | ||
6379 | +} | ||
6380 | + | ||
6381 | +/* | ||
6382 | + * Generate a hash. This is derived from full_name_hash(), but we want to be | ||
6383 | + * sure it is arch independent and that it doesn't change as bits of the | ||
6384 | + * computed hash value might appear on disk. The caller also guarantees that | ||
6385 | + * the hashed data will be a series of aligned 32-bit words. | ||
6386 | + */ | ||
6387 | +unsigned int fscache_hash(unsigned int salt, unsigned int *data, unsigned int n) | ||
6388 | +{ | ||
6389 | + unsigned int a, x = 0, y = salt; | ||
6390 | + | ||
6391 | + for (; n; n--) { | ||
6392 | + a = *data++; | ||
6393 | + HASH_MIX(x, y, a); | ||
6394 | + } | ||
6395 | + return fold_hash(x, y); | ||
6396 | +} | ||
6397 | + | ||
6398 | /* | ||
6399 | * initialise the fs caching module | ||
6400 | */ | ||
6401 | diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c | ||
6402 | index 16aa55b73ccf5..7205a89fbb5f3 100644 | ||
6403 | --- a/fs/fuse/dev.c | ||
6404 | +++ b/fs/fuse/dev.c | ||
6405 | @@ -282,10 +282,10 @@ void fuse_request_end(struct fuse_conn *fc, struct fuse_req *req) | ||
6406 | |||
6407 | /* | ||
6408 | * test_and_set_bit() implies smp_mb() between bit | ||
6409 | - * changing and below intr_entry check. Pairs with | ||
6410 | + * changing and below FR_INTERRUPTED check. Pairs with | ||
6411 | * smp_mb() from queue_interrupt(). | ||
6412 | */ | ||
6413 | - if (!list_empty(&req->intr_entry)) { | ||
6414 | + if (test_bit(FR_INTERRUPTED, &req->flags)) { | ||
6415 | spin_lock(&fiq->lock); | ||
6416 | list_del_init(&req->intr_entry); | ||
6417 | spin_unlock(&fiq->lock); | ||
6418 | diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c | ||
6419 | index 72dec177b3494..94c290a333a0a 100644 | ||
6420 | --- a/fs/gfs2/lock_dlm.c | ||
6421 | +++ b/fs/gfs2/lock_dlm.c | ||
6422 | @@ -292,6 +292,11 @@ static void gdlm_put_lock(struct gfs2_glock *gl) | ||
6423 | gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT); | ||
6424 | gfs2_update_request_times(gl); | ||
6425 | |||
6426 | + /* don't want to call dlm if we've unmounted the lock protocol */ | ||
6427 | + if (test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) { | ||
6428 | + gfs2_glock_free(gl); | ||
6429 | + return; | ||
6430 | + } | ||
6431 | /* don't want to skip dlm_unlock writing the lvb when lock has one */ | ||
6432 | |||
6433 | if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) && | ||
6434 | diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c | ||
6435 | index 498cb70c2c0d0..273a81971ed57 100644 | ||
6436 | --- a/fs/lockd/svclock.c | ||
6437 | +++ b/fs/lockd/svclock.c | ||
6438 | @@ -395,28 +395,10 @@ nlmsvc_release_lockowner(struct nlm_lock *lock) | ||
6439 | nlmsvc_put_lockowner(lock->fl.fl_owner); | ||
6440 | } | ||
6441 | |||
6442 | -static void nlmsvc_locks_copy_lock(struct file_lock *new, struct file_lock *fl) | ||
6443 | -{ | ||
6444 | - struct nlm_lockowner *nlm_lo = (struct nlm_lockowner *)fl->fl_owner; | ||
6445 | - new->fl_owner = nlmsvc_get_lockowner(nlm_lo); | ||
6446 | -} | ||
6447 | - | ||
6448 | -static void nlmsvc_locks_release_private(struct file_lock *fl) | ||
6449 | -{ | ||
6450 | - nlmsvc_put_lockowner((struct nlm_lockowner *)fl->fl_owner); | ||
6451 | -} | ||
6452 | - | ||
6453 | -static const struct file_lock_operations nlmsvc_lock_ops = { | ||
6454 | - .fl_copy_lock = nlmsvc_locks_copy_lock, | ||
6455 | - .fl_release_private = nlmsvc_locks_release_private, | ||
6456 | -}; | ||
6457 | - | ||
6458 | void nlmsvc_locks_init_private(struct file_lock *fl, struct nlm_host *host, | ||
6459 | pid_t pid) | ||
6460 | { | ||
6461 | fl->fl_owner = nlmsvc_find_lockowner(host, pid); | ||
6462 | - if (fl->fl_owner != NULL) | ||
6463 | - fl->fl_ops = &nlmsvc_lock_ops; | ||
6464 | } | ||
6465 | |||
6466 | /* | ||
6467 | @@ -788,9 +770,21 @@ nlmsvc_notify_blocked(struct file_lock *fl) | ||
6468 | printk(KERN_WARNING "lockd: notification for unknown block!\n"); | ||
6469 | } | ||
6470 | |||
6471 | +static fl_owner_t nlmsvc_get_owner(fl_owner_t owner) | ||
6472 | +{ | ||
6473 | + return nlmsvc_get_lockowner(owner); | ||
6474 | +} | ||
6475 | + | ||
6476 | +static void nlmsvc_put_owner(fl_owner_t owner) | ||
6477 | +{ | ||
6478 | + nlmsvc_put_lockowner(owner); | ||
6479 | +} | ||
6480 | + | ||
6481 | const struct lock_manager_operations nlmsvc_lock_operations = { | ||
6482 | .lm_notify = nlmsvc_notify_blocked, | ||
6483 | .lm_grant = nlmsvc_grant_deferred, | ||
6484 | + .lm_get_owner = nlmsvc_get_owner, | ||
6485 | + .lm_put_owner = nlmsvc_put_owner, | ||
6486 | }; | ||
6487 | |||
6488 | /* | ||
6489 | diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c | ||
6490 | index 6509ec3cb3730..073be36b0686c 100644 | ||
6491 | --- a/fs/overlayfs/dir.c | ||
6492 | +++ b/fs/overlayfs/dir.c | ||
6493 | @@ -513,8 +513,10 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode, | ||
6494 | goto out_cleanup; | ||
6495 | } | ||
6496 | err = ovl_instantiate(dentry, inode, newdentry, hardlink); | ||
6497 | - if (err) | ||
6498 | - goto out_cleanup; | ||
6499 | + if (err) { | ||
6500 | + ovl_cleanup(udir, newdentry); | ||
6501 | + dput(newdentry); | ||
6502 | + } | ||
6503 | out_dput: | ||
6504 | dput(upper); | ||
6505 | out_unlock: | ||
6506 | diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c | ||
6507 | index 2c807283115d7..ec57bbb6bb05c 100644 | ||
6508 | --- a/fs/userfaultfd.c | ||
6509 | +++ b/fs/userfaultfd.c | ||
6510 | @@ -32,11 +32,6 @@ int sysctl_unprivileged_userfaultfd __read_mostly = 1; | ||
6511 | |||
6512 | static struct kmem_cache *userfaultfd_ctx_cachep __read_mostly; | ||
6513 | |||
6514 | -enum userfaultfd_state { | ||
6515 | - UFFD_STATE_WAIT_API, | ||
6516 | - UFFD_STATE_RUNNING, | ||
6517 | -}; | ||
6518 | - | ||
6519 | /* | ||
6520 | * Start with fault_pending_wqh and fault_wqh so they're more likely | ||
6521 | * to be in the same cacheline. | ||
6522 | @@ -68,8 +63,6 @@ struct userfaultfd_ctx { | ||
6523 | unsigned int flags; | ||
6524 | /* features requested from the userspace */ | ||
6525 | unsigned int features; | ||
6526 | - /* state machine */ | ||
6527 | - enum userfaultfd_state state; | ||
6528 | /* released */ | ||
6529 | bool released; | ||
6530 | /* memory mappings are changing because of non-cooperative event */ | ||
6531 | @@ -103,6 +96,14 @@ struct userfaultfd_wake_range { | ||
6532 | unsigned long len; | ||
6533 | }; | ||
6534 | |||
6535 | +/* internal indication that UFFD_API ioctl was successfully executed */ | ||
6536 | +#define UFFD_FEATURE_INITIALIZED (1u << 31) | ||
6537 | + | ||
6538 | +static bool userfaultfd_is_initialized(struct userfaultfd_ctx *ctx) | ||
6539 | +{ | ||
6540 | + return ctx->features & UFFD_FEATURE_INITIALIZED; | ||
6541 | +} | ||
6542 | + | ||
6543 | static int userfaultfd_wake_function(wait_queue_entry_t *wq, unsigned mode, | ||
6544 | int wake_flags, void *key) | ||
6545 | { | ||
6546 | @@ -699,7 +700,6 @@ int dup_userfaultfd(struct vm_area_struct *vma, struct list_head *fcs) | ||
6547 | |||
6548 | refcount_set(&ctx->refcount, 1); | ||
6549 | ctx->flags = octx->flags; | ||
6550 | - ctx->state = UFFD_STATE_RUNNING; | ||
6551 | ctx->features = octx->features; | ||
6552 | ctx->released = false; | ||
6553 | ctx->mmap_changing = false; | ||
6554 | @@ -980,38 +980,33 @@ static __poll_t userfaultfd_poll(struct file *file, poll_table *wait) | ||
6555 | |||
6556 | poll_wait(file, &ctx->fd_wqh, wait); | ||
6557 | |||
6558 | - switch (ctx->state) { | ||
6559 | - case UFFD_STATE_WAIT_API: | ||
6560 | + if (!userfaultfd_is_initialized(ctx)) | ||
6561 | return EPOLLERR; | ||
6562 | - case UFFD_STATE_RUNNING: | ||
6563 | - /* | ||
6564 | - * poll() never guarantees that read won't block. | ||
6565 | - * userfaults can be waken before they're read(). | ||
6566 | - */ | ||
6567 | - if (unlikely(!(file->f_flags & O_NONBLOCK))) | ||
6568 | - return EPOLLERR; | ||
6569 | - /* | ||
6570 | - * lockless access to see if there are pending faults | ||
6571 | - * __pollwait last action is the add_wait_queue but | ||
6572 | - * the spin_unlock would allow the waitqueue_active to | ||
6573 | - * pass above the actual list_add inside | ||
6574 | - * add_wait_queue critical section. So use a full | ||
6575 | - * memory barrier to serialize the list_add write of | ||
6576 | - * add_wait_queue() with the waitqueue_active read | ||
6577 | - * below. | ||
6578 | - */ | ||
6579 | - ret = 0; | ||
6580 | - smp_mb(); | ||
6581 | - if (waitqueue_active(&ctx->fault_pending_wqh)) | ||
6582 | - ret = EPOLLIN; | ||
6583 | - else if (waitqueue_active(&ctx->event_wqh)) | ||
6584 | - ret = EPOLLIN; | ||
6585 | - | ||
6586 | - return ret; | ||
6587 | - default: | ||
6588 | - WARN_ON_ONCE(1); | ||
6589 | + | ||
6590 | + /* | ||
6591 | + * poll() never guarantees that read won't block. | ||
6592 | + * userfaults can be waken before they're read(). | ||
6593 | + */ | ||
6594 | + if (unlikely(!(file->f_flags & O_NONBLOCK))) | ||
6595 | return EPOLLERR; | ||
6596 | - } | ||
6597 | + /* | ||
6598 | + * lockless access to see if there are pending faults | ||
6599 | + * __pollwait last action is the add_wait_queue but | ||
6600 | + * the spin_unlock would allow the waitqueue_active to | ||
6601 | + * pass above the actual list_add inside | ||
6602 | + * add_wait_queue critical section. So use a full | ||
6603 | + * memory barrier to serialize the list_add write of | ||
6604 | + * add_wait_queue() with the waitqueue_active read | ||
6605 | + * below. | ||
6606 | + */ | ||
6607 | + ret = 0; | ||
6608 | + smp_mb(); | ||
6609 | + if (waitqueue_active(&ctx->fault_pending_wqh)) | ||
6610 | + ret = EPOLLIN; | ||
6611 | + else if (waitqueue_active(&ctx->event_wqh)) | ||
6612 | + ret = EPOLLIN; | ||
6613 | + | ||
6614 | + return ret; | ||
6615 | } | ||
6616 | |||
6617 | static const struct file_operations userfaultfd_fops; | ||
6618 | @@ -1205,7 +1200,7 @@ static ssize_t userfaultfd_read(struct file *file, char __user *buf, | ||
6619 | struct uffd_msg msg; | ||
6620 | int no_wait = file->f_flags & O_NONBLOCK; | ||
6621 | |||
6622 | - if (ctx->state == UFFD_STATE_WAIT_API) | ||
6623 | + if (!userfaultfd_is_initialized(ctx)) | ||
6624 | return -EINVAL; | ||
6625 | |||
6626 | for (;;) { | ||
6627 | @@ -1807,9 +1802,10 @@ out: | ||
6628 | static inline unsigned int uffd_ctx_features(__u64 user_features) | ||
6629 | { | ||
6630 | /* | ||
6631 | - * For the current set of features the bits just coincide | ||
6632 | + * For the current set of features the bits just coincide. Set | ||
6633 | + * UFFD_FEATURE_INITIALIZED to mark the features as enabled. | ||
6634 | */ | ||
6635 | - return (unsigned int)user_features; | ||
6636 | + return (unsigned int)user_features | UFFD_FEATURE_INITIALIZED; | ||
6637 | } | ||
6638 | |||
6639 | /* | ||
6640 | @@ -1822,12 +1818,10 @@ static int userfaultfd_api(struct userfaultfd_ctx *ctx, | ||
6641 | { | ||
6642 | struct uffdio_api uffdio_api; | ||
6643 | void __user *buf = (void __user *)arg; | ||
6644 | + unsigned int ctx_features; | ||
6645 | int ret; | ||
6646 | __u64 features; | ||
6647 | |||
6648 | - ret = -EINVAL; | ||
6649 | - if (ctx->state != UFFD_STATE_WAIT_API) | ||
6650 | - goto out; | ||
6651 | ret = -EFAULT; | ||
6652 | if (copy_from_user(&uffdio_api, buf, sizeof(uffdio_api))) | ||
6653 | goto out; | ||
6654 | @@ -1844,9 +1838,13 @@ static int userfaultfd_api(struct userfaultfd_ctx *ctx, | ||
6655 | ret = -EFAULT; | ||
6656 | if (copy_to_user(buf, &uffdio_api, sizeof(uffdio_api))) | ||
6657 | goto out; | ||
6658 | - ctx->state = UFFD_STATE_RUNNING; | ||
6659 | + | ||
6660 | /* only enable the requested features for this uffd context */ | ||
6661 | - ctx->features = uffd_ctx_features(features); | ||
6662 | + ctx_features = uffd_ctx_features(features); | ||
6663 | + ret = -EINVAL; | ||
6664 | + if (cmpxchg(&ctx->features, 0, ctx_features) != 0) | ||
6665 | + goto err_out; | ||
6666 | + | ||
6667 | ret = 0; | ||
6668 | out: | ||
6669 | return ret; | ||
6670 | @@ -1863,7 +1861,7 @@ static long userfaultfd_ioctl(struct file *file, unsigned cmd, | ||
6671 | int ret = -EINVAL; | ||
6672 | struct userfaultfd_ctx *ctx = file->private_data; | ||
6673 | |||
6674 | - if (cmd != UFFDIO_API && ctx->state == UFFD_STATE_WAIT_API) | ||
6675 | + if (cmd != UFFDIO_API && !userfaultfd_is_initialized(ctx)) | ||
6676 | return -EINVAL; | ||
6677 | |||
6678 | switch(cmd) { | ||
6679 | @@ -1964,7 +1962,6 @@ SYSCALL_DEFINE1(userfaultfd, int, flags) | ||
6680 | refcount_set(&ctx->refcount, 1); | ||
6681 | ctx->flags = flags; | ||
6682 | ctx->features = 0; | ||
6683 | - ctx->state = UFFD_STATE_WAIT_API; | ||
6684 | ctx->released = false; | ||
6685 | ctx->mmap_changing = false; | ||
6686 | ctx->mm = current->mm; | ||
6687 | diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h | ||
6688 | index 0588ef3bc6ff6..48722f2b8543b 100644 | ||
6689 | --- a/include/crypto/public_key.h | ||
6690 | +++ b/include/crypto/public_key.h | ||
6691 | @@ -38,9 +38,9 @@ extern void public_key_free(struct public_key *key); | ||
6692 | struct public_key_signature { | ||
6693 | struct asymmetric_key_id *auth_ids[2]; | ||
6694 | u8 *s; /* Signature */ | ||
6695 | - u32 s_size; /* Number of bytes in signature */ | ||
6696 | u8 *digest; | ||
6697 | - u8 digest_size; /* Number of bytes in digest */ | ||
6698 | + u32 s_size; /* Number of bytes in signature */ | ||
6699 | + u32 digest_size; /* Number of bytes in digest */ | ||
6700 | const char *pkey_algo; | ||
6701 | const char *hash_algo; | ||
6702 | const char *encoding; | ||
6703 | diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h | ||
6704 | index a0513c444446d..cef70d6e1657c 100644 | ||
6705 | --- a/include/linux/hugetlb.h | ||
6706 | +++ b/include/linux/hugetlb.h | ||
6707 | @@ -542,6 +542,11 @@ static inline spinlock_t *huge_pte_lockptr(struct hstate *h, | ||
6708 | |||
6709 | void hugetlb_report_usage(struct seq_file *m, struct mm_struct *mm); | ||
6710 | |||
6711 | +static inline void hugetlb_count_init(struct mm_struct *mm) | ||
6712 | +{ | ||
6713 | + atomic_long_set(&mm->hugetlb_usage, 0); | ||
6714 | +} | ||
6715 | + | ||
6716 | static inline void hugetlb_count_add(long l, struct mm_struct *mm) | ||
6717 | { | ||
6718 | atomic_long_add(l, &mm->hugetlb_usage); | ||
6719 | @@ -711,6 +716,10 @@ static inline spinlock_t *huge_pte_lockptr(struct hstate *h, | ||
6720 | return &mm->page_table_lock; | ||
6721 | } | ||
6722 | |||
6723 | +static inline void hugetlb_count_init(struct mm_struct *mm) | ||
6724 | +{ | ||
6725 | +} | ||
6726 | + | ||
6727 | static inline void hugetlb_report_usage(struct seq_file *f, struct mm_struct *m) | ||
6728 | { | ||
6729 | } | ||
6730 | diff --git a/include/linux/list.h b/include/linux/list.h | ||
6731 | index 85c92555e31f8..ce19c6b632a59 100644 | ||
6732 | --- a/include/linux/list.h | ||
6733 | +++ b/include/linux/list.h | ||
6734 | @@ -567,6 +567,15 @@ static inline void list_splice_tail_init(struct list_head *list, | ||
6735 | pos != (head); \ | ||
6736 | pos = n, n = pos->prev) | ||
6737 | |||
6738 | +/** | ||
6739 | + * list_entry_is_head - test if the entry points to the head of the list | ||
6740 | + * @pos: the type * to cursor | ||
6741 | + * @head: the head for your list. | ||
6742 | + * @member: the name of the list_head within the struct. | ||
6743 | + */ | ||
6744 | +#define list_entry_is_head(pos, head, member) \ | ||
6745 | + (&pos->member == (head)) | ||
6746 | + | ||
6747 | /** | ||
6748 | * list_for_each_entry - iterate over list of given type | ||
6749 | * @pos: the type * to use as a loop cursor. | ||
6750 | @@ -575,7 +584,7 @@ static inline void list_splice_tail_init(struct list_head *list, | ||
6751 | */ | ||
6752 | #define list_for_each_entry(pos, head, member) \ | ||
6753 | for (pos = list_first_entry(head, typeof(*pos), member); \ | ||
6754 | - &pos->member != (head); \ | ||
6755 | + !list_entry_is_head(pos, head, member); \ | ||
6756 | pos = list_next_entry(pos, member)) | ||
6757 | |||
6758 | /** | ||
6759 | @@ -586,7 +595,7 @@ static inline void list_splice_tail_init(struct list_head *list, | ||
6760 | */ | ||
6761 | #define list_for_each_entry_reverse(pos, head, member) \ | ||
6762 | for (pos = list_last_entry(head, typeof(*pos), member); \ | ||
6763 | - &pos->member != (head); \ | ||
6764 | + !list_entry_is_head(pos, head, member); \ | ||
6765 | pos = list_prev_entry(pos, member)) | ||
6766 | |||
6767 | /** | ||
6768 | @@ -611,7 +620,7 @@ static inline void list_splice_tail_init(struct list_head *list, | ||
6769 | */ | ||
6770 | #define list_for_each_entry_continue(pos, head, member) \ | ||
6771 | for (pos = list_next_entry(pos, member); \ | ||
6772 | - &pos->member != (head); \ | ||
6773 | + !list_entry_is_head(pos, head, member); \ | ||
6774 | pos = list_next_entry(pos, member)) | ||
6775 | |||
6776 | /** | ||
6777 | @@ -625,7 +634,7 @@ static inline void list_splice_tail_init(struct list_head *list, | ||
6778 | */ | ||
6779 | #define list_for_each_entry_continue_reverse(pos, head, member) \ | ||
6780 | for (pos = list_prev_entry(pos, member); \ | ||
6781 | - &pos->member != (head); \ | ||
6782 | + !list_entry_is_head(pos, head, member); \ | ||
6783 | pos = list_prev_entry(pos, member)) | ||
6784 | |||
6785 | /** | ||
6786 | @@ -637,7 +646,7 @@ static inline void list_splice_tail_init(struct list_head *list, | ||
6787 | * Iterate over list of given type, continuing from current position. | ||
6788 | */ | ||
6789 | #define list_for_each_entry_from(pos, head, member) \ | ||
6790 | - for (; &pos->member != (head); \ | ||
6791 | + for (; !list_entry_is_head(pos, head, member); \ | ||
6792 | pos = list_next_entry(pos, member)) | ||
6793 | |||
6794 | /** | ||
6795 | @@ -650,7 +659,7 @@ static inline void list_splice_tail_init(struct list_head *list, | ||
6796 | * Iterate backwards over list of given type, continuing from current position. | ||
6797 | */ | ||
6798 | #define list_for_each_entry_from_reverse(pos, head, member) \ | ||
6799 | - for (; &pos->member != (head); \ | ||
6800 | + for (; !list_entry_is_head(pos, head, member); \ | ||
6801 | pos = list_prev_entry(pos, member)) | ||
6802 | |||
6803 | /** | ||
6804 | @@ -663,7 +672,7 @@ static inline void list_splice_tail_init(struct list_head *list, | ||
6805 | #define list_for_each_entry_safe(pos, n, head, member) \ | ||
6806 | for (pos = list_first_entry(head, typeof(*pos), member), \ | ||
6807 | n = list_next_entry(pos, member); \ | ||
6808 | - &pos->member != (head); \ | ||
6809 | + !list_entry_is_head(pos, head, member); \ | ||
6810 | pos = n, n = list_next_entry(n, member)) | ||
6811 | |||
6812 | /** | ||
6813 | @@ -679,7 +688,7 @@ static inline void list_splice_tail_init(struct list_head *list, | ||
6814 | #define list_for_each_entry_safe_continue(pos, n, head, member) \ | ||
6815 | for (pos = list_next_entry(pos, member), \ | ||
6816 | n = list_next_entry(pos, member); \ | ||
6817 | - &pos->member != (head); \ | ||
6818 | + !list_entry_is_head(pos, head, member); \ | ||
6819 | pos = n, n = list_next_entry(n, member)) | ||
6820 | |||
6821 | /** | ||
6822 | @@ -694,7 +703,7 @@ static inline void list_splice_tail_init(struct list_head *list, | ||
6823 | */ | ||
6824 | #define list_for_each_entry_safe_from(pos, n, head, member) \ | ||
6825 | for (n = list_next_entry(pos, member); \ | ||
6826 | - &pos->member != (head); \ | ||
6827 | + !list_entry_is_head(pos, head, member); \ | ||
6828 | pos = n, n = list_next_entry(n, member)) | ||
6829 | |||
6830 | /** | ||
6831 | @@ -710,7 +719,7 @@ static inline void list_splice_tail_init(struct list_head *list, | ||
6832 | #define list_for_each_entry_safe_reverse(pos, n, head, member) \ | ||
6833 | for (pos = list_last_entry(head, typeof(*pos), member), \ | ||
6834 | n = list_prev_entry(pos, member); \ | ||
6835 | - &pos->member != (head); \ | ||
6836 | + !list_entry_is_head(pos, head, member); \ | ||
6837 | pos = n, n = list_prev_entry(n, member)) | ||
6838 | |||
6839 | /** | ||
6840 | diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h | ||
6841 | index 451efd4499cc5..961e35c68e413 100644 | ||
6842 | --- a/include/linux/memory_hotplug.h | ||
6843 | +++ b/include/linux/memory_hotplug.h | ||
6844 | @@ -358,6 +358,6 @@ extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map, | ||
6845 | unsigned long pnum); | ||
6846 | extern bool allow_online_pfn_range(int nid, unsigned long pfn, unsigned long nr_pages, | ||
6847 | int online_type); | ||
6848 | -extern struct zone *zone_for_pfn_range(int online_type, int nid, unsigned start_pfn, | ||
6849 | - unsigned long nr_pages); | ||
6850 | +extern struct zone *zone_for_pfn_range(int online_type, int nid, | ||
6851 | + unsigned long start_pfn, unsigned long nr_pages); | ||
6852 | #endif /* __LINUX_MEMORY_HOTPLUG_H */ | ||
6853 | diff --git a/include/linux/pci.h b/include/linux/pci.h | ||
6854 | index 6a6a819c5b49b..9a937f8b27838 100644 | ||
6855 | --- a/include/linux/pci.h | ||
6856 | +++ b/include/linux/pci.h | ||
6857 | @@ -1688,8 +1688,9 @@ static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } | ||
6858 | static inline void pci_disable_device(struct pci_dev *dev) { } | ||
6859 | static inline int pci_assign_resource(struct pci_dev *dev, int i) | ||
6860 | { return -EBUSY; } | ||
6861 | -static inline int __pci_register_driver(struct pci_driver *drv, | ||
6862 | - struct module *owner) | ||
6863 | +static inline int __must_check __pci_register_driver(struct pci_driver *drv, | ||
6864 | + struct module *owner, | ||
6865 | + const char *mod_name) | ||
6866 | { return 0; } | ||
6867 | static inline int pci_register_driver(struct pci_driver *drv) | ||
6868 | { return 0; } | ||
6869 | diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h | ||
6870 | index 0ad57693f3926..42588645478d9 100644 | ||
6871 | --- a/include/linux/pci_ids.h | ||
6872 | +++ b/include/linux/pci_ids.h | ||
6873 | @@ -2476,7 +2476,8 @@ | ||
6874 | #define PCI_VENDOR_ID_TDI 0x192E | ||
6875 | #define PCI_DEVICE_ID_TDI_EHCI 0x0101 | ||
6876 | |||
6877 | -#define PCI_VENDOR_ID_FREESCALE 0x1957 | ||
6878 | +#define PCI_VENDOR_ID_FREESCALE 0x1957 /* duplicate: NXP */ | ||
6879 | +#define PCI_VENDOR_ID_NXP 0x1957 /* duplicate: FREESCALE */ | ||
6880 | #define PCI_DEVICE_ID_MPC8308 0xc006 | ||
6881 | #define PCI_DEVICE_ID_MPC8315E 0x00b4 | ||
6882 | #define PCI_DEVICE_ID_MPC8315 0x00b5 | ||
6883 | diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h | ||
6884 | index 6493c98c86317..b04b5bd43f541 100644 | ||
6885 | --- a/include/linux/skbuff.h | ||
6886 | +++ b/include/linux/skbuff.h | ||
6887 | @@ -1887,7 +1887,7 @@ static inline void __skb_insert(struct sk_buff *newsk, | ||
6888 | WRITE_ONCE(newsk->prev, prev); | ||
6889 | WRITE_ONCE(next->prev, newsk); | ||
6890 | WRITE_ONCE(prev->next, newsk); | ||
6891 | - list->qlen++; | ||
6892 | + WRITE_ONCE(list->qlen, list->qlen + 1); | ||
6893 | } | ||
6894 | |||
6895 | static inline void __skb_queue_splice(const struct sk_buff_head *list, | ||
6896 | diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h | ||
6897 | index d7ef5b97174ce..3c6c4b1dbf1a4 100644 | ||
6898 | --- a/include/linux/sunrpc/xprt.h | ||
6899 | +++ b/include/linux/sunrpc/xprt.h | ||
6900 | @@ -419,6 +419,7 @@ void xprt_unlock_connect(struct rpc_xprt *, void *); | ||
6901 | #define XPRT_CONGESTED (9) | ||
6902 | #define XPRT_CWND_WAIT (10) | ||
6903 | #define XPRT_WRITE_SPACE (11) | ||
6904 | +#define XPRT_SND_IS_COOKIE (12) | ||
6905 | |||
6906 | static inline void xprt_set_connected(struct rpc_xprt *xprt) | ||
6907 | { | ||
6908 | diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h | ||
6909 | index edbbf4bfdd9e5..4a245d7a5c8d6 100644 | ||
6910 | --- a/include/uapi/linux/pkt_sched.h | ||
6911 | +++ b/include/uapi/linux/pkt_sched.h | ||
6912 | @@ -807,6 +807,8 @@ struct tc_codel_xstats { | ||
6913 | |||
6914 | /* FQ_CODEL */ | ||
6915 | |||
6916 | +#define FQ_CODEL_QUANTUM_MAX (1 << 20) | ||
6917 | + | ||
6918 | enum { | ||
6919 | TCA_FQ_CODEL_UNSPEC, | ||
6920 | TCA_FQ_CODEL_TARGET, | ||
6921 | diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h | ||
6922 | index be07b5470f4bb..f51bc8f368134 100644 | ||
6923 | --- a/include/uapi/linux/serial_reg.h | ||
6924 | +++ b/include/uapi/linux/serial_reg.h | ||
6925 | @@ -62,6 +62,7 @@ | ||
6926 | * ST16C654: 8 16 56 60 8 16 32 56 PORT_16654 | ||
6927 | * TI16C750: 1 16 32 56 xx xx xx xx PORT_16750 | ||
6928 | * TI16C752: 8 16 56 60 8 16 32 56 | ||
6929 | + * OX16C950: 16 32 112 120 16 32 64 112 PORT_16C950 | ||
6930 | * Tegra: 1 4 8 14 16 8 4 1 PORT_TEGRA | ||
6931 | */ | ||
6932 | #define UART_FCR_R_TRIG_00 0x00 | ||
6933 | diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c | ||
6934 | index cb6425e52bf7a..01e893cf9b9f7 100644 | ||
6935 | --- a/kernel/dma/debug.c | ||
6936 | +++ b/kernel/dma/debug.c | ||
6937 | @@ -846,7 +846,7 @@ static int dump_show(struct seq_file *seq, void *v) | ||
6938 | } | ||
6939 | DEFINE_SHOW_ATTRIBUTE(dump); | ||
6940 | |||
6941 | -static void dma_debug_fs_init(void) | ||
6942 | +static int __init dma_debug_fs_init(void) | ||
6943 | { | ||
6944 | struct dentry *dentry = debugfs_create_dir("dma-api", NULL); | ||
6945 | |||
6946 | @@ -859,7 +859,10 @@ static void dma_debug_fs_init(void) | ||
6947 | debugfs_create_u32("nr_total_entries", 0444, dentry, &nr_total_entries); | ||
6948 | debugfs_create_file("driver_filter", 0644, dentry, NULL, &filter_fops); | ||
6949 | debugfs_create_file("dump", 0444, dentry, NULL, &dump_fops); | ||
6950 | + | ||
6951 | + return 0; | ||
6952 | } | ||
6953 | +core_initcall_sync(dma_debug_fs_init); | ||
6954 | |||
6955 | static int device_dma_allocations(struct device *dev, struct dma_debug_entry **out_entry) | ||
6956 | { | ||
6957 | @@ -944,8 +947,6 @@ static int dma_debug_init(void) | ||
6958 | spin_lock_init(&dma_entry_hash[i].lock); | ||
6959 | } | ||
6960 | |||
6961 | - dma_debug_fs_init(); | ||
6962 | - | ||
6963 | nr_pages = DIV_ROUND_UP(nr_prealloc_entries, DMA_DEBUG_DYNAMIC_ENTRIES); | ||
6964 | for (i = 0; i < nr_pages; ++i) | ||
6965 | dma_debug_create_entries(GFP_KERNEL); | ||
6966 | diff --git a/kernel/events/core.c b/kernel/events/core.c | ||
6967 | index 2f848123cdae8..1993a741d2dc5 100644 | ||
6968 | --- a/kernel/events/core.c | ||
6969 | +++ b/kernel/events/core.c | ||
6970 | @@ -9259,7 +9259,7 @@ static void perf_event_addr_filters_apply(struct perf_event *event) | ||
6971 | return; | ||
6972 | |||
6973 | if (ifh->nr_file_filters) { | ||
6974 | - mm = get_task_mm(event->ctx->task); | ||
6975 | + mm = get_task_mm(task); | ||
6976 | if (!mm) | ||
6977 | goto restart; | ||
6978 | |||
6979 | diff --git a/kernel/fork.c b/kernel/fork.c | ||
6980 | index 50f37d5afb32b..cf2cebd214b92 100644 | ||
6981 | --- a/kernel/fork.c | ||
6982 | +++ b/kernel/fork.c | ||
6983 | @@ -1028,6 +1028,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, | ||
6984 | mm->pmd_huge_pte = NULL; | ||
6985 | #endif | ||
6986 | mm_init_uprobes_state(mm); | ||
6987 | + hugetlb_count_init(mm); | ||
6988 | |||
6989 | if (current->mm) { | ||
6990 | mm->flags = current->mm->flags & MMF_INIT_MASK; | ||
6991 | diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c | ||
6992 | index a6a79f85c81a8..f26415341c752 100644 | ||
6993 | --- a/kernel/pid_namespace.c | ||
6994 | +++ b/kernel/pid_namespace.c | ||
6995 | @@ -53,7 +53,8 @@ static struct kmem_cache *create_pid_cachep(unsigned int level) | ||
6996 | mutex_lock(&pid_caches_mutex); | ||
6997 | /* Name collision forces to do allocation under mutex. */ | ||
6998 | if (!*pkc) | ||
6999 | - *pkc = kmem_cache_create(name, len, 0, SLAB_HWCACHE_ALIGN, 0); | ||
7000 | + *pkc = kmem_cache_create(name, len, 0, | ||
7001 | + SLAB_HWCACHE_ALIGN | SLAB_ACCOUNT, 0); | ||
7002 | mutex_unlock(&pid_caches_mutex); | ||
7003 | /* current can fail, but someone else can succeed. */ | ||
7004 | return READ_ONCE(*pkc); | ||
7005 | diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c | ||
7006 | index 233322c77b76c..5de084dab4fa6 100644 | ||
7007 | --- a/kernel/trace/trace_kprobe.c | ||
7008 | +++ b/kernel/trace/trace_kprobe.c | ||
7009 | @@ -646,7 +646,11 @@ static int register_trace_kprobe(struct trace_kprobe *tk) | ||
7010 | /* Register new event */ | ||
7011 | ret = register_kprobe_event(tk); | ||
7012 | if (ret) { | ||
7013 | - pr_warn("Failed to register probe event(%d)\n", ret); | ||
7014 | + if (ret == -EEXIST) { | ||
7015 | + trace_probe_log_set_index(0); | ||
7016 | + trace_probe_log_err(0, EVENT_EXIST); | ||
7017 | + } else | ||
7018 | + pr_warn("Failed to register probe event(%d)\n", ret); | ||
7019 | goto end; | ||
7020 | } | ||
7021 | |||
7022 | diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c | ||
7023 | index f98d6d94cbbf7..23e85cb151346 100644 | ||
7024 | --- a/kernel/trace/trace_probe.c | ||
7025 | +++ b/kernel/trace/trace_probe.c | ||
7026 | @@ -1029,11 +1029,36 @@ error: | ||
7027 | return ret; | ||
7028 | } | ||
7029 | |||
7030 | +static struct trace_event_call * | ||
7031 | +find_trace_event_call(const char *system, const char *event_name) | ||
7032 | +{ | ||
7033 | + struct trace_event_call *tp_event; | ||
7034 | + const char *name; | ||
7035 | + | ||
7036 | + list_for_each_entry(tp_event, &ftrace_events, list) { | ||
7037 | + if (!tp_event->class->system || | ||
7038 | + strcmp(system, tp_event->class->system)) | ||
7039 | + continue; | ||
7040 | + name = trace_event_name(tp_event); | ||
7041 | + if (!name || strcmp(event_name, name)) | ||
7042 | + continue; | ||
7043 | + return tp_event; | ||
7044 | + } | ||
7045 | + | ||
7046 | + return NULL; | ||
7047 | +} | ||
7048 | + | ||
7049 | int trace_probe_register_event_call(struct trace_probe *tp) | ||
7050 | { | ||
7051 | struct trace_event_call *call = trace_probe_event_call(tp); | ||
7052 | int ret; | ||
7053 | |||
7054 | + lockdep_assert_held(&event_mutex); | ||
7055 | + | ||
7056 | + if (find_trace_event_call(trace_probe_group_name(tp), | ||
7057 | + trace_probe_name(tp))) | ||
7058 | + return -EEXIST; | ||
7059 | + | ||
7060 | ret = register_trace_event(&call->event); | ||
7061 | if (!ret) | ||
7062 | return -ENODEV; | ||
7063 | diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h | ||
7064 | index a0ff9e200ef6f..bab9e0dba9af2 100644 | ||
7065 | --- a/kernel/trace/trace_probe.h | ||
7066 | +++ b/kernel/trace/trace_probe.h | ||
7067 | @@ -410,6 +410,7 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call, | ||
7068 | C(NO_EVENT_NAME, "Event name is not specified"), \ | ||
7069 | C(EVENT_TOO_LONG, "Event name is too long"), \ | ||
7070 | C(BAD_EVENT_NAME, "Event name must follow the same rules as C identifiers"), \ | ||
7071 | + C(EVENT_EXIST, "Given group/event name is already used by another event"), \ | ||
7072 | C(RETVAL_ON_PROBE, "$retval is not available on probe"), \ | ||
7073 | C(BAD_STACK_NUM, "Invalid stack number"), \ | ||
7074 | C(BAD_ARG_NUM, "Invalid argument number"), \ | ||
7075 | diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c | ||
7076 | index 5294843de6efd..b515db036becc 100644 | ||
7077 | --- a/kernel/trace/trace_uprobe.c | ||
7078 | +++ b/kernel/trace/trace_uprobe.c | ||
7079 | @@ -514,7 +514,11 @@ static int register_trace_uprobe(struct trace_uprobe *tu) | ||
7080 | |||
7081 | ret = register_uprobe_event(tu); | ||
7082 | if (ret) { | ||
7083 | - pr_warn("Failed to register probe event(%d)\n", ret); | ||
7084 | + if (ret == -EEXIST) { | ||
7085 | + trace_probe_log_set_index(0); | ||
7086 | + trace_probe_log_err(0, EVENT_EXIST); | ||
7087 | + } else | ||
7088 | + pr_warn("Failed to register probe event(%d)\n", ret); | ||
7089 | goto end; | ||
7090 | } | ||
7091 | |||
7092 | diff --git a/kernel/workqueue.c b/kernel/workqueue.c | ||
7093 | index 6aeb53b4e19f8..885d4792abdfc 100644 | ||
7094 | --- a/kernel/workqueue.c | ||
7095 | +++ b/kernel/workqueue.c | ||
7096 | @@ -5869,6 +5869,13 @@ static void __init wq_numa_init(void) | ||
7097 | return; | ||
7098 | } | ||
7099 | |||
7100 | + for_each_possible_cpu(cpu) { | ||
7101 | + if (WARN_ON(cpu_to_node(cpu) == NUMA_NO_NODE)) { | ||
7102 | + pr_warn("workqueue: NUMA node mapping not available for cpu%d, disabling NUMA support\n", cpu); | ||
7103 | + return; | ||
7104 | + } | ||
7105 | + } | ||
7106 | + | ||
7107 | wq_update_unbound_numa_attrs_buf = alloc_workqueue_attrs(); | ||
7108 | BUG_ON(!wq_update_unbound_numa_attrs_buf); | ||
7109 | |||
7110 | @@ -5886,11 +5893,6 @@ static void __init wq_numa_init(void) | ||
7111 | |||
7112 | for_each_possible_cpu(cpu) { | ||
7113 | node = cpu_to_node(cpu); | ||
7114 | - if (WARN_ON(node == NUMA_NO_NODE)) { | ||
7115 | - pr_warn("workqueue: NUMA node mapping not available for cpu%d, disabling NUMA support\n", cpu); | ||
7116 | - /* happens iff arch is bonkers, let's just proceed */ | ||
7117 | - return; | ||
7118 | - } | ||
7119 | cpumask_set_cpu(cpu, tbl[node]); | ||
7120 | } | ||
7121 | |||
7122 | diff --git a/lib/test_bpf.c b/lib/test_bpf.c | ||
7123 | index 5ef3eccee27cb..3ae002ced4c7a 100644 | ||
7124 | --- a/lib/test_bpf.c | ||
7125 | +++ b/lib/test_bpf.c | ||
7126 | @@ -4286,8 +4286,8 @@ static struct bpf_test tests[] = { | ||
7127 | .u.insns_int = { | ||
7128 | BPF_LD_IMM64(R0, 0), | ||
7129 | BPF_LD_IMM64(R1, 0xffffffffffffffffLL), | ||
7130 | - BPF_STX_MEM(BPF_W, R10, R1, -40), | ||
7131 | - BPF_LDX_MEM(BPF_W, R0, R10, -40), | ||
7132 | + BPF_STX_MEM(BPF_DW, R10, R1, -40), | ||
7133 | + BPF_LDX_MEM(BPF_DW, R0, R10, -40), | ||
7134 | BPF_EXIT_INSN(), | ||
7135 | }, | ||
7136 | INTERNAL, | ||
7137 | @@ -6684,7 +6684,14 @@ static int run_one(const struct bpf_prog *fp, struct bpf_test *test) | ||
7138 | u64 duration; | ||
7139 | u32 ret; | ||
7140 | |||
7141 | - if (test->test[i].data_size == 0 && | ||
7142 | + /* | ||
7143 | + * NOTE: Several sub-tests may be present, in which case | ||
7144 | + * a zero {data_size, result} tuple indicates the end of | ||
7145 | + * the sub-test array. The first test is always run, | ||
7146 | + * even if both data_size and result happen to be zero. | ||
7147 | + */ | ||
7148 | + if (i > 0 && | ||
7149 | + test->test[i].data_size == 0 && | ||
7150 | test->test[i].result == 0) | ||
7151 | break; | ||
7152 | |||
7153 | diff --git a/lib/test_stackinit.c b/lib/test_stackinit.c | ||
7154 | index 2d7d257a430e6..35d398b065e4f 100644 | ||
7155 | --- a/lib/test_stackinit.c | ||
7156 | +++ b/lib/test_stackinit.c | ||
7157 | @@ -67,10 +67,10 @@ static bool range_contains(char *haystack_start, size_t haystack_size, | ||
7158 | #define INIT_STRUCT_none /**/ | ||
7159 | #define INIT_STRUCT_zero = { } | ||
7160 | #define INIT_STRUCT_static_partial = { .two = 0, } | ||
7161 | -#define INIT_STRUCT_static_all = { .one = arg->one, \ | ||
7162 | - .two = arg->two, \ | ||
7163 | - .three = arg->three, \ | ||
7164 | - .four = arg->four, \ | ||
7165 | +#define INIT_STRUCT_static_all = { .one = 0, \ | ||
7166 | + .two = 0, \ | ||
7167 | + .three = 0, \ | ||
7168 | + .four = 0, \ | ||
7169 | } | ||
7170 | #define INIT_STRUCT_dynamic_partial = { .two = arg->two, } | ||
7171 | #define INIT_STRUCT_dynamic_all = { .one = arg->one, \ | ||
7172 | @@ -84,8 +84,7 @@ static bool range_contains(char *haystack_start, size_t haystack_size, | ||
7173 | var.one = 0; \ | ||
7174 | var.two = 0; \ | ||
7175 | var.three = 0; \ | ||
7176 | - memset(&var.four, 0, \ | ||
7177 | - sizeof(var.four)) | ||
7178 | + var.four = 0 | ||
7179 | |||
7180 | /* | ||
7181 | * @name: unique string name for the test | ||
7182 | @@ -208,18 +207,13 @@ struct test_small_hole { | ||
7183 | unsigned long four; | ||
7184 | }; | ||
7185 | |||
7186 | -/* Try to trigger unhandled padding in a structure. */ | ||
7187 | -struct test_aligned { | ||
7188 | - u32 internal1; | ||
7189 | - u64 internal2; | ||
7190 | -} __aligned(64); | ||
7191 | - | ||
7192 | +/* Trigger unhandled padding in a structure. */ | ||
7193 | struct test_big_hole { | ||
7194 | u8 one; | ||
7195 | u8 two; | ||
7196 | u8 three; | ||
7197 | /* 61 byte padding hole here. */ | ||
7198 | - struct test_aligned four; | ||
7199 | + u8 four __aligned(64); | ||
7200 | } __aligned(64); | ||
7201 | |||
7202 | struct test_trailing_hole { | ||
7203 | diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c | ||
7204 | index 308beca3ffebc..bcc2686bd0a1b 100644 | ||
7205 | --- a/mm/memory_hotplug.c | ||
7206 | +++ b/mm/memory_hotplug.c | ||
7207 | @@ -775,8 +775,8 @@ static inline struct zone *default_zone_for_pfn(int nid, unsigned long start_pfn | ||
7208 | return movable_node_enabled ? movable_zone : kernel_zone; | ||
7209 | } | ||
7210 | |||
7211 | -struct zone * zone_for_pfn_range(int online_type, int nid, unsigned start_pfn, | ||
7212 | - unsigned long nr_pages) | ||
7213 | +struct zone *zone_for_pfn_range(int online_type, int nid, | ||
7214 | + unsigned long start_pfn, unsigned long nr_pages) | ||
7215 | { | ||
7216 | if (online_type == MMOP_ONLINE_KERNEL) | ||
7217 | return default_kernel_zone_for_pfn(nid, start_pfn, nr_pages); | ||
7218 | diff --git a/mm/vmscan.c b/mm/vmscan.c | ||
7219 | index fad9be4703ece..de94881eaa927 100644 | ||
7220 | --- a/mm/vmscan.c | ||
7221 | +++ b/mm/vmscan.c | ||
7222 | @@ -2513,7 +2513,7 @@ out: | ||
7223 | cgroup_size = max(cgroup_size, protection); | ||
7224 | |||
7225 | scan = lruvec_size - lruvec_size * protection / | ||
7226 | - cgroup_size; | ||
7227 | + (cgroup_size + 1); | ||
7228 | |||
7229 | /* | ||
7230 | * Minimally target SWAP_CLUSTER_MAX pages to keep | ||
7231 | diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c | ||
7232 | index 3963eb11c3fbd..44e6c74ed4288 100644 | ||
7233 | --- a/net/9p/trans_xen.c | ||
7234 | +++ b/net/9p/trans_xen.c | ||
7235 | @@ -138,7 +138,7 @@ static bool p9_xen_write_todo(struct xen_9pfs_dataring *ring, RING_IDX size) | ||
7236 | |||
7237 | static int p9_xen_request(struct p9_client *client, struct p9_req_t *p9_req) | ||
7238 | { | ||
7239 | - struct xen_9pfs_front_priv *priv = NULL; | ||
7240 | + struct xen_9pfs_front_priv *priv; | ||
7241 | RING_IDX cons, prod, masked_cons, masked_prod; | ||
7242 | unsigned long flags; | ||
7243 | u32 size = p9_req->tc.size; | ||
7244 | @@ -151,7 +151,7 @@ static int p9_xen_request(struct p9_client *client, struct p9_req_t *p9_req) | ||
7245 | break; | ||
7246 | } | ||
7247 | read_unlock(&xen_9pfs_lock); | ||
7248 | - if (!priv || priv->client != client) | ||
7249 | + if (list_entry_is_head(priv, &xen_9pfs_devs, list)) | ||
7250 | return -EINVAL; | ||
7251 | |||
7252 | num = p9_req->tc.tag % priv->num_rings; | ||
7253 | diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c | ||
7254 | index e8e7f108b0161..31469ff084cd3 100644 | ||
7255 | --- a/net/bluetooth/hci_event.c | ||
7256 | +++ b/net/bluetooth/hci_event.c | ||
7257 | @@ -4202,6 +4202,21 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev, | ||
7258 | |||
7259 | switch (ev->status) { | ||
7260 | case 0x00: | ||
7261 | + /* The synchronous connection complete event should only be | ||
7262 | + * sent once per new connection. Receiving a successful | ||
7263 | + * complete event when the connection status is already | ||
7264 | + * BT_CONNECTED means that the device is misbehaving and sent | ||
7265 | + * multiple complete event packets for the same new connection. | ||
7266 | + * | ||
7267 | + * Registering the device more than once can corrupt kernel | ||
7268 | + * memory, hence upon detecting this invalid event, we report | ||
7269 | + * an error and ignore the packet. | ||
7270 | + */ | ||
7271 | + if (conn->state == BT_CONNECTED) { | ||
7272 | + bt_dev_err(hdev, "Ignoring connect complete event for existing connection"); | ||
7273 | + goto unlock; | ||
7274 | + } | ||
7275 | + | ||
7276 | conn->handle = __le16_to_cpu(ev->handle); | ||
7277 | conn->state = BT_CONNECTED; | ||
7278 | conn->type = ev->link_type; | ||
7279 | @@ -4905,9 +4920,64 @@ static void hci_disconn_phylink_complete_evt(struct hci_dev *hdev, | ||
7280 | } | ||
7281 | #endif | ||
7282 | |||
7283 | +static void le_conn_update_addr(struct hci_conn *conn, bdaddr_t *bdaddr, | ||
7284 | + u8 bdaddr_type, bdaddr_t *local_rpa) | ||
7285 | +{ | ||
7286 | + if (conn->out) { | ||
7287 | + conn->dst_type = bdaddr_type; | ||
7288 | + conn->resp_addr_type = bdaddr_type; | ||
7289 | + bacpy(&conn->resp_addr, bdaddr); | ||
7290 | + | ||
7291 | + /* Check if the controller has set a Local RPA then it must be | ||
7292 | + * used instead or hdev->rpa. | ||
7293 | + */ | ||
7294 | + if (local_rpa && bacmp(local_rpa, BDADDR_ANY)) { | ||
7295 | + conn->init_addr_type = ADDR_LE_DEV_RANDOM; | ||
7296 | + bacpy(&conn->init_addr, local_rpa); | ||
7297 | + } else if (hci_dev_test_flag(conn->hdev, HCI_PRIVACY)) { | ||
7298 | + conn->init_addr_type = ADDR_LE_DEV_RANDOM; | ||
7299 | + bacpy(&conn->init_addr, &conn->hdev->rpa); | ||
7300 | + } else { | ||
7301 | + hci_copy_identity_address(conn->hdev, &conn->init_addr, | ||
7302 | + &conn->init_addr_type); | ||
7303 | + } | ||
7304 | + } else { | ||
7305 | + conn->resp_addr_type = conn->hdev->adv_addr_type; | ||
7306 | + /* Check if the controller has set a Local RPA then it must be | ||
7307 | + * used instead or hdev->rpa. | ||
7308 | + */ | ||
7309 | + if (local_rpa && bacmp(local_rpa, BDADDR_ANY)) { | ||
7310 | + conn->resp_addr_type = ADDR_LE_DEV_RANDOM; | ||
7311 | + bacpy(&conn->resp_addr, local_rpa); | ||
7312 | + } else if (conn->hdev->adv_addr_type == ADDR_LE_DEV_RANDOM) { | ||
7313 | + /* In case of ext adv, resp_addr will be updated in | ||
7314 | + * Adv Terminated event. | ||
7315 | + */ | ||
7316 | + if (!ext_adv_capable(conn->hdev)) | ||
7317 | + bacpy(&conn->resp_addr, | ||
7318 | + &conn->hdev->random_addr); | ||
7319 | + } else { | ||
7320 | + bacpy(&conn->resp_addr, &conn->hdev->bdaddr); | ||
7321 | + } | ||
7322 | + | ||
7323 | + conn->init_addr_type = bdaddr_type; | ||
7324 | + bacpy(&conn->init_addr, bdaddr); | ||
7325 | + | ||
7326 | + /* For incoming connections, set the default minimum | ||
7327 | + * and maximum connection interval. They will be used | ||
7328 | + * to check if the parameters are in range and if not | ||
7329 | + * trigger the connection update procedure. | ||
7330 | + */ | ||
7331 | + conn->le_conn_min_interval = conn->hdev->le_conn_min_interval; | ||
7332 | + conn->le_conn_max_interval = conn->hdev->le_conn_max_interval; | ||
7333 | + } | ||
7334 | +} | ||
7335 | + | ||
7336 | static void le_conn_complete_evt(struct hci_dev *hdev, u8 status, | ||
7337 | - bdaddr_t *bdaddr, u8 bdaddr_type, u8 role, u16 handle, | ||
7338 | - u16 interval, u16 latency, u16 supervision_timeout) | ||
7339 | + bdaddr_t *bdaddr, u8 bdaddr_type, | ||
7340 | + bdaddr_t *local_rpa, u8 role, u16 handle, | ||
7341 | + u16 interval, u16 latency, | ||
7342 | + u16 supervision_timeout) | ||
7343 | { | ||
7344 | struct hci_conn_params *params; | ||
7345 | struct hci_conn *conn; | ||
7346 | @@ -4955,32 +5025,7 @@ static void le_conn_complete_evt(struct hci_dev *hdev, u8 status, | ||
7347 | cancel_delayed_work(&conn->le_conn_timeout); | ||
7348 | } | ||
7349 | |||
7350 | - if (!conn->out) { | ||
7351 | - /* Set the responder (our side) address type based on | ||
7352 | - * the advertising address type. | ||
7353 | - */ | ||
7354 | - conn->resp_addr_type = hdev->adv_addr_type; | ||
7355 | - if (hdev->adv_addr_type == ADDR_LE_DEV_RANDOM) { | ||
7356 | - /* In case of ext adv, resp_addr will be updated in | ||
7357 | - * Adv Terminated event. | ||
7358 | - */ | ||
7359 | - if (!ext_adv_capable(hdev)) | ||
7360 | - bacpy(&conn->resp_addr, &hdev->random_addr); | ||
7361 | - } else { | ||
7362 | - bacpy(&conn->resp_addr, &hdev->bdaddr); | ||
7363 | - } | ||
7364 | - | ||
7365 | - conn->init_addr_type = bdaddr_type; | ||
7366 | - bacpy(&conn->init_addr, bdaddr); | ||
7367 | - | ||
7368 | - /* For incoming connections, set the default minimum | ||
7369 | - * and maximum connection interval. They will be used | ||
7370 | - * to check if the parameters are in range and if not | ||
7371 | - * trigger the connection update procedure. | ||
7372 | - */ | ||
7373 | - conn->le_conn_min_interval = hdev->le_conn_min_interval; | ||
7374 | - conn->le_conn_max_interval = hdev->le_conn_max_interval; | ||
7375 | - } | ||
7376 | + le_conn_update_addr(conn, bdaddr, bdaddr_type, local_rpa); | ||
7377 | |||
7378 | /* Lookup the identity address from the stored connection | ||
7379 | * address and address type. | ||
7380 | @@ -5074,7 +5119,7 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | ||
7381 | BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); | ||
7382 | |||
7383 | le_conn_complete_evt(hdev, ev->status, &ev->bdaddr, ev->bdaddr_type, | ||
7384 | - ev->role, le16_to_cpu(ev->handle), | ||
7385 | + NULL, ev->role, le16_to_cpu(ev->handle), | ||
7386 | le16_to_cpu(ev->interval), | ||
7387 | le16_to_cpu(ev->latency), | ||
7388 | le16_to_cpu(ev->supervision_timeout)); | ||
7389 | @@ -5088,7 +5133,7 @@ static void hci_le_enh_conn_complete_evt(struct hci_dev *hdev, | ||
7390 | BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); | ||
7391 | |||
7392 | le_conn_complete_evt(hdev, ev->status, &ev->bdaddr, ev->bdaddr_type, | ||
7393 | - ev->role, le16_to_cpu(ev->handle), | ||
7394 | + &ev->local_rpa, ev->role, le16_to_cpu(ev->handle), | ||
7395 | le16_to_cpu(ev->interval), | ||
7396 | le16_to_cpu(ev->latency), | ||
7397 | le16_to_cpu(ev->supervision_timeout)); | ||
7398 | @@ -5119,7 +5164,8 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, struct sk_buff *skb) | ||
7399 | if (conn) { | ||
7400 | struct adv_info *adv_instance; | ||
7401 | |||
7402 | - if (hdev->adv_addr_type != ADDR_LE_DEV_RANDOM) | ||
7403 | + if (hdev->adv_addr_type != ADDR_LE_DEV_RANDOM || | ||
7404 | + bacmp(&conn->resp_addr, BDADDR_ANY)) | ||
7405 | return; | ||
7406 | |||
7407 | if (!hdev->cur_adv_instance) { | ||
7408 | diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c | ||
7409 | index 1b7540cb8e5c4..1915943bb646a 100644 | ||
7410 | --- a/net/bluetooth/sco.c | ||
7411 | +++ b/net/bluetooth/sco.c | ||
7412 | @@ -48,6 +48,8 @@ struct sco_conn { | ||
7413 | spinlock_t lock; | ||
7414 | struct sock *sk; | ||
7415 | |||
7416 | + struct delayed_work timeout_work; | ||
7417 | + | ||
7418 | unsigned int mtu; | ||
7419 | }; | ||
7420 | |||
7421 | @@ -73,9 +75,20 @@ struct sco_pinfo { | ||
7422 | #define SCO_CONN_TIMEOUT (HZ * 40) | ||
7423 | #define SCO_DISCONN_TIMEOUT (HZ * 2) | ||
7424 | |||
7425 | -static void sco_sock_timeout(struct timer_list *t) | ||
7426 | +static void sco_sock_timeout(struct work_struct *work) | ||
7427 | { | ||
7428 | - struct sock *sk = from_timer(sk, t, sk_timer); | ||
7429 | + struct sco_conn *conn = container_of(work, struct sco_conn, | ||
7430 | + timeout_work.work); | ||
7431 | + struct sock *sk; | ||
7432 | + | ||
7433 | + sco_conn_lock(conn); | ||
7434 | + sk = conn->sk; | ||
7435 | + if (sk) | ||
7436 | + sock_hold(sk); | ||
7437 | + sco_conn_unlock(conn); | ||
7438 | + | ||
7439 | + if (!sk) | ||
7440 | + return; | ||
7441 | |||
7442 | BT_DBG("sock %p state %d", sk, sk->sk_state); | ||
7443 | |||
7444 | @@ -89,14 +102,21 @@ static void sco_sock_timeout(struct timer_list *t) | ||
7445 | |||
7446 | static void sco_sock_set_timer(struct sock *sk, long timeout) | ||
7447 | { | ||
7448 | + if (!sco_pi(sk)->conn) | ||
7449 | + return; | ||
7450 | + | ||
7451 | BT_DBG("sock %p state %d timeout %ld", sk, sk->sk_state, timeout); | ||
7452 | - sk_reset_timer(sk, &sk->sk_timer, jiffies + timeout); | ||
7453 | + cancel_delayed_work(&sco_pi(sk)->conn->timeout_work); | ||
7454 | + schedule_delayed_work(&sco_pi(sk)->conn->timeout_work, timeout); | ||
7455 | } | ||
7456 | |||
7457 | static void sco_sock_clear_timer(struct sock *sk) | ||
7458 | { | ||
7459 | + if (!sco_pi(sk)->conn) | ||
7460 | + return; | ||
7461 | + | ||
7462 | BT_DBG("sock %p state %d", sk, sk->sk_state); | ||
7463 | - sk_stop_timer(sk, &sk->sk_timer); | ||
7464 | + cancel_delayed_work(&sco_pi(sk)->conn->timeout_work); | ||
7465 | } | ||
7466 | |||
7467 | /* ---- SCO connections ---- */ | ||
7468 | @@ -176,6 +196,9 @@ static void sco_conn_del(struct hci_conn *hcon, int err) | ||
7469 | sco_chan_del(sk, err); | ||
7470 | bh_unlock_sock(sk); | ||
7471 | sock_put(sk); | ||
7472 | + | ||
7473 | + /* Ensure no more work items will run before freeing conn. */ | ||
7474 | + cancel_delayed_work_sync(&conn->timeout_work); | ||
7475 | } | ||
7476 | |||
7477 | hcon->sco_data = NULL; | ||
7478 | @@ -190,6 +213,8 @@ static void __sco_chan_add(struct sco_conn *conn, struct sock *sk, | ||
7479 | sco_pi(sk)->conn = conn; | ||
7480 | conn->sk = sk; | ||
7481 | |||
7482 | + INIT_DELAYED_WORK(&conn->timeout_work, sco_sock_timeout); | ||
7483 | + | ||
7484 | if (parent) | ||
7485 | bt_accept_enqueue(parent, sk, true); | ||
7486 | } | ||
7487 | @@ -209,44 +234,32 @@ static int sco_chan_add(struct sco_conn *conn, struct sock *sk, | ||
7488 | return err; | ||
7489 | } | ||
7490 | |||
7491 | -static int sco_connect(struct sock *sk) | ||
7492 | +static int sco_connect(struct hci_dev *hdev, struct sock *sk) | ||
7493 | { | ||
7494 | struct sco_conn *conn; | ||
7495 | struct hci_conn *hcon; | ||
7496 | - struct hci_dev *hdev; | ||
7497 | int err, type; | ||
7498 | |||
7499 | BT_DBG("%pMR -> %pMR", &sco_pi(sk)->src, &sco_pi(sk)->dst); | ||
7500 | |||
7501 | - hdev = hci_get_route(&sco_pi(sk)->dst, &sco_pi(sk)->src, BDADDR_BREDR); | ||
7502 | - if (!hdev) | ||
7503 | - return -EHOSTUNREACH; | ||
7504 | - | ||
7505 | - hci_dev_lock(hdev); | ||
7506 | - | ||
7507 | if (lmp_esco_capable(hdev) && !disable_esco) | ||
7508 | type = ESCO_LINK; | ||
7509 | else | ||
7510 | type = SCO_LINK; | ||
7511 | |||
7512 | if (sco_pi(sk)->setting == BT_VOICE_TRANSPARENT && | ||
7513 | - (!lmp_transp_capable(hdev) || !lmp_esco_capable(hdev))) { | ||
7514 | - err = -EOPNOTSUPP; | ||
7515 | - goto done; | ||
7516 | - } | ||
7517 | + (!lmp_transp_capable(hdev) || !lmp_esco_capable(hdev))) | ||
7518 | + return -EOPNOTSUPP; | ||
7519 | |||
7520 | hcon = hci_connect_sco(hdev, type, &sco_pi(sk)->dst, | ||
7521 | sco_pi(sk)->setting); | ||
7522 | - if (IS_ERR(hcon)) { | ||
7523 | - err = PTR_ERR(hcon); | ||
7524 | - goto done; | ||
7525 | - } | ||
7526 | + if (IS_ERR(hcon)) | ||
7527 | + return PTR_ERR(hcon); | ||
7528 | |||
7529 | conn = sco_conn_add(hcon); | ||
7530 | if (!conn) { | ||
7531 | hci_conn_drop(hcon); | ||
7532 | - err = -ENOMEM; | ||
7533 | - goto done; | ||
7534 | + return -ENOMEM; | ||
7535 | } | ||
7536 | |||
7537 | /* Update source addr of the socket */ | ||
7538 | @@ -254,7 +267,7 @@ static int sco_connect(struct sock *sk) | ||
7539 | |||
7540 | err = sco_chan_add(conn, sk, NULL); | ||
7541 | if (err) | ||
7542 | - goto done; | ||
7543 | + return err; | ||
7544 | |||
7545 | if (hcon->state == BT_CONNECTED) { | ||
7546 | sco_sock_clear_timer(sk); | ||
7547 | @@ -264,9 +277,6 @@ static int sco_connect(struct sock *sk) | ||
7548 | sco_sock_set_timer(sk, sk->sk_sndtimeo); | ||
7549 | } | ||
7550 | |||
7551 | -done: | ||
7552 | - hci_dev_unlock(hdev); | ||
7553 | - hci_dev_put(hdev); | ||
7554 | return err; | ||
7555 | } | ||
7556 | |||
7557 | @@ -484,8 +494,6 @@ static struct sock *sco_sock_alloc(struct net *net, struct socket *sock, | ||
7558 | |||
7559 | sco_pi(sk)->setting = BT_VOICE_CVSD_16BIT; | ||
7560 | |||
7561 | - timer_setup(&sk->sk_timer, sco_sock_timeout, 0); | ||
7562 | - | ||
7563 | bt_sock_link(&sco_sk_list, sk); | ||
7564 | return sk; | ||
7565 | } | ||
7566 | @@ -550,6 +558,7 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen | ||
7567 | { | ||
7568 | struct sockaddr_sco *sa = (struct sockaddr_sco *) addr; | ||
7569 | struct sock *sk = sock->sk; | ||
7570 | + struct hci_dev *hdev; | ||
7571 | int err; | ||
7572 | |||
7573 | BT_DBG("sk %p", sk); | ||
7574 | @@ -564,12 +573,19 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen | ||
7575 | if (sk->sk_type != SOCK_SEQPACKET) | ||
7576 | return -EINVAL; | ||
7577 | |||
7578 | + hdev = hci_get_route(&sa->sco_bdaddr, &sco_pi(sk)->src, BDADDR_BREDR); | ||
7579 | + if (!hdev) | ||
7580 | + return -EHOSTUNREACH; | ||
7581 | + hci_dev_lock(hdev); | ||
7582 | + | ||
7583 | lock_sock(sk); | ||
7584 | |||
7585 | /* Set destination address and psm */ | ||
7586 | bacpy(&sco_pi(sk)->dst, &sa->sco_bdaddr); | ||
7587 | |||
7588 | - err = sco_connect(sk); | ||
7589 | + err = sco_connect(hdev, sk); | ||
7590 | + hci_dev_unlock(hdev); | ||
7591 | + hci_dev_put(hdev); | ||
7592 | if (err) | ||
7593 | goto done; | ||
7594 | |||
7595 | diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c | ||
7596 | index a566289628522..910f164dd20cb 100644 | ||
7597 | --- a/net/caif/chnl_net.c | ||
7598 | +++ b/net/caif/chnl_net.c | ||
7599 | @@ -53,20 +53,6 @@ struct chnl_net { | ||
7600 | enum caif_states state; | ||
7601 | }; | ||
7602 | |||
7603 | -static void robust_list_del(struct list_head *delete_node) | ||
7604 | -{ | ||
7605 | - struct list_head *list_node; | ||
7606 | - struct list_head *n; | ||
7607 | - ASSERT_RTNL(); | ||
7608 | - list_for_each_safe(list_node, n, &chnl_net_list) { | ||
7609 | - if (list_node == delete_node) { | ||
7610 | - list_del(list_node); | ||
7611 | - return; | ||
7612 | - } | ||
7613 | - } | ||
7614 | - WARN_ON(1); | ||
7615 | -} | ||
7616 | - | ||
7617 | static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt) | ||
7618 | { | ||
7619 | struct sk_buff *skb; | ||
7620 | @@ -368,6 +354,7 @@ static int chnl_net_init(struct net_device *dev) | ||
7621 | ASSERT_RTNL(); | ||
7622 | priv = netdev_priv(dev); | ||
7623 | strncpy(priv->name, dev->name, sizeof(priv->name)); | ||
7624 | + INIT_LIST_HEAD(&priv->list_field); | ||
7625 | return 0; | ||
7626 | } | ||
7627 | |||
7628 | @@ -376,7 +363,7 @@ static void chnl_net_uninit(struct net_device *dev) | ||
7629 | struct chnl_net *priv; | ||
7630 | ASSERT_RTNL(); | ||
7631 | priv = netdev_priv(dev); | ||
7632 | - robust_list_del(&priv->list_field); | ||
7633 | + list_del_init(&priv->list_field); | ||
7634 | } | ||
7635 | |||
7636 | static const struct net_device_ops netdev_ops = { | ||
7637 | @@ -541,7 +528,7 @@ static void __exit chnl_exit_module(void) | ||
7638 | rtnl_lock(); | ||
7639 | list_for_each_safe(list_node, _tmp, &chnl_net_list) { | ||
7640 | dev = list_entry(list_node, struct chnl_net, list_field); | ||
7641 | - list_del(list_node); | ||
7642 | + list_del_init(list_node); | ||
7643 | delete_device(dev); | ||
7644 | } | ||
7645 | rtnl_unlock(); | ||
7646 | diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c | ||
7647 | index 96957a7c732fa..b740a74f06f22 100644 | ||
7648 | --- a/net/core/flow_dissector.c | ||
7649 | +++ b/net/core/flow_dissector.c | ||
7650 | @@ -1025,8 +1025,10 @@ proto_again: | ||
7651 | FLOW_DISSECTOR_KEY_IPV4_ADDRS, | ||
7652 | target_container); | ||
7653 | |||
7654 | - memcpy(&key_addrs->v4addrs, &iph->saddr, | ||
7655 | - sizeof(key_addrs->v4addrs)); | ||
7656 | + memcpy(&key_addrs->v4addrs.src, &iph->saddr, | ||
7657 | + sizeof(key_addrs->v4addrs.src)); | ||
7658 | + memcpy(&key_addrs->v4addrs.dst, &iph->daddr, | ||
7659 | + sizeof(key_addrs->v4addrs.dst)); | ||
7660 | key_control->addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; | ||
7661 | } | ||
7662 | |||
7663 | @@ -1070,8 +1072,10 @@ proto_again: | ||
7664 | FLOW_DISSECTOR_KEY_IPV6_ADDRS, | ||
7665 | target_container); | ||
7666 | |||
7667 | - memcpy(&key_addrs->v6addrs, &iph->saddr, | ||
7668 | - sizeof(key_addrs->v6addrs)); | ||
7669 | + memcpy(&key_addrs->v6addrs.src, &iph->saddr, | ||
7670 | + sizeof(key_addrs->v6addrs.src)); | ||
7671 | + memcpy(&key_addrs->v6addrs.dst, &iph->daddr, | ||
7672 | + sizeof(key_addrs->v6addrs.dst)); | ||
7673 | key_control->addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; | ||
7674 | } | ||
7675 | |||
7676 | diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c | ||
7677 | index 25187528c308a..1f352d669c944 100644 | ||
7678 | --- a/net/dccp/minisocks.c | ||
7679 | +++ b/net/dccp/minisocks.c | ||
7680 | @@ -94,6 +94,8 @@ struct sock *dccp_create_openreq_child(const struct sock *sk, | ||
7681 | newdp->dccps_role = DCCP_ROLE_SERVER; | ||
7682 | newdp->dccps_hc_rx_ackvec = NULL; | ||
7683 | newdp->dccps_service_list = NULL; | ||
7684 | + newdp->dccps_hc_rx_ccid = NULL; | ||
7685 | + newdp->dccps_hc_tx_ccid = NULL; | ||
7686 | newdp->dccps_service = dreq->dreq_service; | ||
7687 | newdp->dccps_timestamp_echo = dreq->dreq_timestamp_echo; | ||
7688 | newdp->dccps_timestamp_time = dreq->dreq_timestamp_time; | ||
7689 | diff --git a/net/dsa/slave.c b/net/dsa/slave.c | ||
7690 | index 75b4cd4bcafb9..59759ceb426ac 100644 | ||
7691 | --- a/net/dsa/slave.c | ||
7692 | +++ b/net/dsa/slave.c | ||
7693 | @@ -1327,13 +1327,11 @@ static int dsa_slave_phy_setup(struct net_device *slave_dev) | ||
7694 | * use the switch internal MDIO bus instead | ||
7695 | */ | ||
7696 | ret = dsa_slave_phy_connect(slave_dev, dp->index); | ||
7697 | - if (ret) { | ||
7698 | - netdev_err(slave_dev, | ||
7699 | - "failed to connect to port %d: %d\n", | ||
7700 | - dp->index, ret); | ||
7701 | - phylink_destroy(dp->pl); | ||
7702 | - return ret; | ||
7703 | - } | ||
7704 | + } | ||
7705 | + if (ret) { | ||
7706 | + netdev_err(slave_dev, "failed to connect to PHY: %pe\n", | ||
7707 | + ERR_PTR(ret)); | ||
7708 | + phylink_destroy(dp->pl); | ||
7709 | } | ||
7710 | |||
7711 | return ret; | ||
7712 | diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c | ||
7713 | index fd8298b8b1c52..c4989e5903e43 100644 | ||
7714 | --- a/net/ipv4/ip_gre.c | ||
7715 | +++ b/net/ipv4/ip_gre.c | ||
7716 | @@ -446,8 +446,6 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev, | ||
7717 | |||
7718 | static int gre_handle_offloads(struct sk_buff *skb, bool csum) | ||
7719 | { | ||
7720 | - if (csum && skb_checksum_start(skb) < skb->data) | ||
7721 | - return -EINVAL; | ||
7722 | return iptunnel_handle_offloads(skb, csum ? SKB_GSO_GRE_CSUM : SKB_GSO_GRE); | ||
7723 | } | ||
7724 | |||
7725 | @@ -605,15 +603,20 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, | ||
7726 | } | ||
7727 | |||
7728 | if (dev->header_ops) { | ||
7729 | + const int pull_len = tunnel->hlen + sizeof(struct iphdr); | ||
7730 | + | ||
7731 | if (skb_cow_head(skb, 0)) | ||
7732 | goto free_skb; | ||
7733 | |||
7734 | tnl_params = (const struct iphdr *)skb->data; | ||
7735 | |||
7736 | + if (pull_len > skb_transport_offset(skb)) | ||
7737 | + goto free_skb; | ||
7738 | + | ||
7739 | /* Pull skb since ip_tunnel_xmit() needs skb->data pointing | ||
7740 | * to gre header. | ||
7741 | */ | ||
7742 | - skb_pull(skb, tunnel->hlen + sizeof(struct iphdr)); | ||
7743 | + skb_pull(skb, pull_len); | ||
7744 | skb_reset_mac_header(skb); | ||
7745 | } else { | ||
7746 | if (skb_cow_head(skb, dev->needed_headroom)) | ||
7747 | diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c | ||
7748 | index f52bc9c22e5b8..0ec529d77a56e 100644 | ||
7749 | --- a/net/ipv4/ip_output.c | ||
7750 | +++ b/net/ipv4/ip_output.c | ||
7751 | @@ -446,8 +446,9 @@ static void ip_copy_addrs(struct iphdr *iph, const struct flowi4 *fl4) | ||
7752 | { | ||
7753 | BUILD_BUG_ON(offsetof(typeof(*fl4), daddr) != | ||
7754 | offsetof(typeof(*fl4), saddr) + sizeof(fl4->saddr)); | ||
7755 | - memcpy(&iph->saddr, &fl4->saddr, | ||
7756 | - sizeof(fl4->saddr) + sizeof(fl4->daddr)); | ||
7757 | + | ||
7758 | + iph->saddr = fl4->saddr; | ||
7759 | + iph->daddr = fl4->daddr; | ||
7760 | } | ||
7761 | |||
7762 | /* Note: skb->sk can be different from sk, in case of tunnels */ | ||
7763 | diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c | ||
7764 | index f5f4369c131c9..858bb10d8341e 100644 | ||
7765 | --- a/net/ipv4/nexthop.c | ||
7766 | +++ b/net/ipv4/nexthop.c | ||
7767 | @@ -1183,6 +1183,7 @@ static int nh_create_ipv4(struct net *net, struct nexthop *nh, | ||
7768 | .fc_gw4 = cfg->gw.ipv4, | ||
7769 | .fc_gw_family = cfg->gw.ipv4 ? AF_INET : 0, | ||
7770 | .fc_flags = cfg->nh_flags, | ||
7771 | + .fc_nlinfo = cfg->nlinfo, | ||
7772 | .fc_encap = cfg->nh_encap, | ||
7773 | .fc_encap_type = cfg->nh_encap_type, | ||
7774 | }; | ||
7775 | @@ -1218,6 +1219,7 @@ static int nh_create_ipv6(struct net *net, struct nexthop *nh, | ||
7776 | .fc_ifindex = cfg->nh_ifindex, | ||
7777 | .fc_gateway = cfg->gw.ipv6, | ||
7778 | .fc_flags = cfg->nh_flags, | ||
7779 | + .fc_nlinfo = cfg->nlinfo, | ||
7780 | .fc_encap = cfg->nh_encap, | ||
7781 | .fc_encap_type = cfg->nh_encap_type, | ||
7782 | }; | ||
7783 | diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c | ||
7784 | index 8af4fefe371f2..a5ec77a5ad6f5 100644 | ||
7785 | --- a/net/ipv4/tcp_fastopen.c | ||
7786 | +++ b/net/ipv4/tcp_fastopen.c | ||
7787 | @@ -379,8 +379,7 @@ struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb, | ||
7788 | return NULL; | ||
7789 | } | ||
7790 | |||
7791 | - if (syn_data && | ||
7792 | - tcp_fastopen_no_cookie(sk, dst, TFO_SERVER_COOKIE_NOT_REQD)) | ||
7793 | + if (tcp_fastopen_no_cookie(sk, dst, TFO_SERVER_COOKIE_NOT_REQD)) | ||
7794 | goto fastopen; | ||
7795 | |||
7796 | if (foc->len == 0) { | ||
7797 | diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c | ||
7798 | index a1768ded2d545..c0fcfa2964686 100644 | ||
7799 | --- a/net/ipv4/tcp_input.c | ||
7800 | +++ b/net/ipv4/tcp_input.c | ||
7801 | @@ -1209,7 +1209,7 @@ static u8 tcp_sacktag_one(struct sock *sk, | ||
7802 | if (dup_sack && (sacked & TCPCB_RETRANS)) { | ||
7803 | if (tp->undo_marker && tp->undo_retrans > 0 && | ||
7804 | after(end_seq, tp->undo_marker)) | ||
7805 | - tp->undo_retrans--; | ||
7806 | + tp->undo_retrans = max_t(int, 0, tp->undo_retrans - pcount); | ||
7807 | if ((sacked & TCPCB_SACKED_ACKED) && | ||
7808 | before(start_seq, state->reord)) | ||
7809 | state->reord = start_seq; | ||
7810 | diff --git a/net/ipv6/netfilter/nf_socket_ipv6.c b/net/ipv6/netfilter/nf_socket_ipv6.c | ||
7811 | index b9df879c48d3f..69c021704abd7 100644 | ||
7812 | --- a/net/ipv6/netfilter/nf_socket_ipv6.c | ||
7813 | +++ b/net/ipv6/netfilter/nf_socket_ipv6.c | ||
7814 | @@ -99,7 +99,7 @@ struct sock *nf_sk_lookup_slow_v6(struct net *net, const struct sk_buff *skb, | ||
7815 | { | ||
7816 | __be16 uninitialized_var(dport), uninitialized_var(sport); | ||
7817 | const struct in6_addr *daddr = NULL, *saddr = NULL; | ||
7818 | - struct ipv6hdr *iph = ipv6_hdr(skb); | ||
7819 | + struct ipv6hdr *iph = ipv6_hdr(skb), ipv6_var; | ||
7820 | struct sk_buff *data_skb = NULL; | ||
7821 | int doff = 0; | ||
7822 | int thoff = 0, tproto; | ||
7823 | @@ -129,8 +129,6 @@ struct sock *nf_sk_lookup_slow_v6(struct net *net, const struct sk_buff *skb, | ||
7824 | thoff + sizeof(*hp); | ||
7825 | |||
7826 | } else if (tproto == IPPROTO_ICMPV6) { | ||
7827 | - struct ipv6hdr ipv6_var; | ||
7828 | - | ||
7829 | if (extract_icmp6_fields(skb, thoff, &tproto, &saddr, &daddr, | ||
7830 | &sport, &dport, &ipv6_var)) | ||
7831 | return NULL; | ||
7832 | diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c | ||
7833 | index 95805a6331be2..421b2c89ce12a 100644 | ||
7834 | --- a/net/l2tp/l2tp_core.c | ||
7835 | +++ b/net/l2tp/l2tp_core.c | ||
7836 | @@ -886,8 +886,10 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb) | ||
7837 | } | ||
7838 | |||
7839 | if (tunnel->version == L2TP_HDR_VER_3 && | ||
7840 | - l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr)) | ||
7841 | + l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr)) { | ||
7842 | + l2tp_session_dec_refcount(session); | ||
7843 | goto error; | ||
7844 | + } | ||
7845 | |||
7846 | l2tp_recv_common(session, skb, ptr, optr, hdrflags, length); | ||
7847 | l2tp_session_dec_refcount(session); | ||
7848 | diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c | ||
7849 | index 6f576306a4d74..ddc001ad90555 100644 | ||
7850 | --- a/net/mac80211/iface.c | ||
7851 | +++ b/net/mac80211/iface.c | ||
7852 | @@ -1875,9 +1875,16 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | ||
7853 | |||
7854 | netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops); | ||
7855 | |||
7856 | - /* MTU range: 256 - 2304 */ | ||
7857 | + /* MTU range is normally 256 - 2304, where the upper limit is | ||
7858 | + * the maximum MSDU size. Monitor interfaces send and receive | ||
7859 | + * MPDU and A-MSDU frames which may be much larger so we do | ||
7860 | + * not impose an upper limit in that case. | ||
7861 | + */ | ||
7862 | ndev->min_mtu = 256; | ||
7863 | - ndev->max_mtu = local->hw.max_mtu; | ||
7864 | + if (type == NL80211_IFTYPE_MONITOR) | ||
7865 | + ndev->max_mtu = 0; | ||
7866 | + else | ||
7867 | + ndev->max_mtu = local->hw.max_mtu; | ||
7868 | |||
7869 | ret = register_netdevice(ndev); | ||
7870 | if (ret) { | ||
7871 | diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c | ||
7872 | index 8cd3daf0e3db6..1778e4e8ce247 100644 | ||
7873 | --- a/net/netlabel/netlabel_cipso_v4.c | ||
7874 | +++ b/net/netlabel/netlabel_cipso_v4.c | ||
7875 | @@ -144,8 +144,8 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, | ||
7876 | return -ENOMEM; | ||
7877 | doi_def->map.std = kzalloc(sizeof(*doi_def->map.std), GFP_KERNEL); | ||
7878 | if (doi_def->map.std == NULL) { | ||
7879 | - ret_val = -ENOMEM; | ||
7880 | - goto add_std_failure; | ||
7881 | + kfree(doi_def); | ||
7882 | + return -ENOMEM; | ||
7883 | } | ||
7884 | doi_def->type = CIPSO_V4_MAP_TRANS; | ||
7885 | |||
7886 | diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c | ||
7887 | index 9d993b4cf1aff..acc76a738cfd8 100644 | ||
7888 | --- a/net/netlink/af_netlink.c | ||
7889 | +++ b/net/netlink/af_netlink.c | ||
7890 | @@ -2521,13 +2521,15 @@ int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid, | ||
7891 | /* errors reported via destination sk->sk_err, but propagate | ||
7892 | * delivery errors if NETLINK_BROADCAST_ERROR flag is set */ | ||
7893 | err = nlmsg_multicast(sk, skb, exclude_portid, group, flags); | ||
7894 | + if (err == -ESRCH) | ||
7895 | + err = 0; | ||
7896 | } | ||
7897 | |||
7898 | if (report) { | ||
7899 | int err2; | ||
7900 | |||
7901 | err2 = nlmsg_unicast(sk, skb, portid); | ||
7902 | - if (!err || err == -ESRCH) | ||
7903 | + if (!err) | ||
7904 | err = err2; | ||
7905 | } | ||
7906 | |||
7907 | diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c | ||
7908 | index 76d72c3f52eda..86fb2f953bd5b 100644 | ||
7909 | --- a/net/sched/sch_fq_codel.c | ||
7910 | +++ b/net/sched/sch_fq_codel.c | ||
7911 | @@ -370,6 +370,7 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt, | ||
7912 | { | ||
7913 | struct fq_codel_sched_data *q = qdisc_priv(sch); | ||
7914 | struct nlattr *tb[TCA_FQ_CODEL_MAX + 1]; | ||
7915 | + u32 quantum = 0; | ||
7916 | int err; | ||
7917 | |||
7918 | if (!opt) | ||
7919 | @@ -387,6 +388,13 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt, | ||
7920 | q->flows_cnt > 65536) | ||
7921 | return -EINVAL; | ||
7922 | } | ||
7923 | + if (tb[TCA_FQ_CODEL_QUANTUM]) { | ||
7924 | + quantum = max(256U, nla_get_u32(tb[TCA_FQ_CODEL_QUANTUM])); | ||
7925 | + if (quantum > FQ_CODEL_QUANTUM_MAX) { | ||
7926 | + NL_SET_ERR_MSG(extack, "Invalid quantum"); | ||
7927 | + return -EINVAL; | ||
7928 | + } | ||
7929 | + } | ||
7930 | sch_tree_lock(sch); | ||
7931 | |||
7932 | if (tb[TCA_FQ_CODEL_TARGET]) { | ||
7933 | @@ -413,8 +421,8 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt, | ||
7934 | if (tb[TCA_FQ_CODEL_ECN]) | ||
7935 | q->cparams.ecn = !!nla_get_u32(tb[TCA_FQ_CODEL_ECN]); | ||
7936 | |||
7937 | - if (tb[TCA_FQ_CODEL_QUANTUM]) | ||
7938 | - q->quantum = max(256U, nla_get_u32(tb[TCA_FQ_CODEL_QUANTUM])); | ||
7939 | + if (quantum) | ||
7940 | + q->quantum = quantum; | ||
7941 | |||
7942 | if (tb[TCA_FQ_CODEL_DROP_BATCH_SIZE]) | ||
7943 | q->drop_batch_size = max(1U, nla_get_u32(tb[TCA_FQ_CODEL_DROP_BATCH_SIZE])); | ||
7944 | diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c | ||
7945 | index a4de4853c79de..da9ed0613eb7b 100644 | ||
7946 | --- a/net/sched/sch_taprio.c | ||
7947 | +++ b/net/sched/sch_taprio.c | ||
7948 | @@ -1503,7 +1503,9 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, | ||
7949 | taprio_set_picos_per_byte(dev, q); | ||
7950 | |||
7951 | if (mqprio) { | ||
7952 | - netdev_set_num_tc(dev, mqprio->num_tc); | ||
7953 | + err = netdev_set_num_tc(dev, mqprio->num_tc); | ||
7954 | + if (err) | ||
7955 | + goto free_sched; | ||
7956 | for (i = 0; i < mqprio->num_tc; i++) | ||
7957 | netdev_set_tc_queue(dev, i, | ||
7958 | mqprio->count[i], | ||
7959 | diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c | ||
7960 | index d5470c7fe8792..c0016473a255a 100644 | ||
7961 | --- a/net/sunrpc/auth_gss/svcauth_gss.c | ||
7962 | +++ b/net/sunrpc/auth_gss/svcauth_gss.c | ||
7963 | @@ -1937,7 +1937,7 @@ gss_svc_init_net(struct net *net) | ||
7964 | goto out2; | ||
7965 | return 0; | ||
7966 | out2: | ||
7967 | - destroy_use_gss_proxy_proc_entry(net); | ||
7968 | + rsi_cache_destroy_net(net); | ||
7969 | out1: | ||
7970 | rsc_cache_destroy_net(net); | ||
7971 | return rv; | ||
7972 | diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c | ||
7973 | index 639837b3a5d90..3653898f465ff 100644 | ||
7974 | --- a/net/sunrpc/xprt.c | ||
7975 | +++ b/net/sunrpc/xprt.c | ||
7976 | @@ -729,9 +729,9 @@ void xprt_force_disconnect(struct rpc_xprt *xprt) | ||
7977 | /* Try to schedule an autoclose RPC call */ | ||
7978 | if (test_and_set_bit(XPRT_LOCKED, &xprt->state) == 0) | ||
7979 | queue_work(xprtiod_workqueue, &xprt->task_cleanup); | ||
7980 | - else if (xprt->snd_task) | ||
7981 | + else if (xprt->snd_task && !test_bit(XPRT_SND_IS_COOKIE, &xprt->state)) | ||
7982 | rpc_wake_up_queued_task_set_status(&xprt->pending, | ||
7983 | - xprt->snd_task, -ENOTCONN); | ||
7984 | + xprt->snd_task, -ENOTCONN); | ||
7985 | spin_unlock(&xprt->transport_lock); | ||
7986 | } | ||
7987 | EXPORT_SYMBOL_GPL(xprt_force_disconnect); | ||
7988 | @@ -820,6 +820,7 @@ bool xprt_lock_connect(struct rpc_xprt *xprt, | ||
7989 | goto out; | ||
7990 | if (xprt->snd_task != task) | ||
7991 | goto out; | ||
7992 | + set_bit(XPRT_SND_IS_COOKIE, &xprt->state); | ||
7993 | xprt->snd_task = cookie; | ||
7994 | ret = true; | ||
7995 | out: | ||
7996 | @@ -835,6 +836,7 @@ void xprt_unlock_connect(struct rpc_xprt *xprt, void *cookie) | ||
7997 | if (!test_bit(XPRT_LOCKED, &xprt->state)) | ||
7998 | goto out; | ||
7999 | xprt->snd_task =NULL; | ||
8000 | + clear_bit(XPRT_SND_IS_COOKIE, &xprt->state); | ||
8001 | xprt->ops->release_xprt(xprt, NULL); | ||
8002 | xprt_schedule_autodisconnect(xprt); | ||
8003 | out: | ||
8004 | diff --git a/net/tipc/socket.c b/net/tipc/socket.c | ||
8005 | index a5922ce9109cf..fbbac9ba2862f 100644 | ||
8006 | --- a/net/tipc/socket.c | ||
8007 | +++ b/net/tipc/socket.c | ||
8008 | @@ -1756,6 +1756,7 @@ static int tipc_recvmsg(struct socket *sock, struct msghdr *m, | ||
8009 | bool connected = !tipc_sk_type_connectionless(sk); | ||
8010 | struct tipc_sock *tsk = tipc_sk(sk); | ||
8011 | int rc, err, hlen, dlen, copy; | ||
8012 | + struct tipc_skb_cb *skb_cb; | ||
8013 | struct sk_buff_head xmitq; | ||
8014 | struct tipc_msg *hdr; | ||
8015 | struct sk_buff *skb; | ||
8016 | @@ -1779,6 +1780,7 @@ static int tipc_recvmsg(struct socket *sock, struct msghdr *m, | ||
8017 | if (unlikely(rc)) | ||
8018 | goto exit; | ||
8019 | skb = skb_peek(&sk->sk_receive_queue); | ||
8020 | + skb_cb = TIPC_SKB_CB(skb); | ||
8021 | hdr = buf_msg(skb); | ||
8022 | dlen = msg_data_sz(hdr); | ||
8023 | hlen = msg_hdr_sz(hdr); | ||
8024 | @@ -1798,18 +1800,33 @@ static int tipc_recvmsg(struct socket *sock, struct msghdr *m, | ||
8025 | |||
8026 | /* Capture data if non-error msg, otherwise just set return value */ | ||
8027 | if (likely(!err)) { | ||
8028 | - copy = min_t(int, dlen, buflen); | ||
8029 | - if (unlikely(copy != dlen)) | ||
8030 | - m->msg_flags |= MSG_TRUNC; | ||
8031 | - rc = skb_copy_datagram_msg(skb, hlen, m, copy); | ||
8032 | + int offset = skb_cb->bytes_read; | ||
8033 | + | ||
8034 | + copy = min_t(int, dlen - offset, buflen); | ||
8035 | + rc = skb_copy_datagram_msg(skb, hlen + offset, m, copy); | ||
8036 | + if (unlikely(rc)) | ||
8037 | + goto exit; | ||
8038 | + if (unlikely(offset + copy < dlen)) { | ||
8039 | + if (flags & MSG_EOR) { | ||
8040 | + if (!(flags & MSG_PEEK)) | ||
8041 | + skb_cb->bytes_read = offset + copy; | ||
8042 | + } else { | ||
8043 | + m->msg_flags |= MSG_TRUNC; | ||
8044 | + skb_cb->bytes_read = 0; | ||
8045 | + } | ||
8046 | + } else { | ||
8047 | + if (flags & MSG_EOR) | ||
8048 | + m->msg_flags |= MSG_EOR; | ||
8049 | + skb_cb->bytes_read = 0; | ||
8050 | + } | ||
8051 | } else { | ||
8052 | copy = 0; | ||
8053 | rc = 0; | ||
8054 | - if (err != TIPC_CONN_SHUTDOWN && connected && !m->msg_control) | ||
8055 | + if (err != TIPC_CONN_SHUTDOWN && connected && !m->msg_control) { | ||
8056 | rc = -ECONNRESET; | ||
8057 | + goto exit; | ||
8058 | + } | ||
8059 | } | ||
8060 | - if (unlikely(rc)) | ||
8061 | - goto exit; | ||
8062 | |||
8063 | /* Mark message as group event if applicable */ | ||
8064 | if (unlikely(grp_evt)) { | ||
8065 | @@ -1832,6 +1849,9 @@ static int tipc_recvmsg(struct socket *sock, struct msghdr *m, | ||
8066 | tipc_node_distr_xmit(sock_net(sk), &xmitq); | ||
8067 | } | ||
8068 | |||
8069 | + if (skb_cb->bytes_read) | ||
8070 | + goto exit; | ||
8071 | + | ||
8072 | tsk_advance_rx_queue(sk); | ||
8073 | |||
8074 | if (likely(!connected)) | ||
8075 | @@ -2255,7 +2275,7 @@ static int tipc_sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) | ||
8076 | static void tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk, | ||
8077 | u32 dport, struct sk_buff_head *xmitq) | ||
8078 | { | ||
8079 | - unsigned long time_limit = jiffies + 2; | ||
8080 | + unsigned long time_limit = jiffies + usecs_to_jiffies(20000); | ||
8081 | struct sk_buff *skb; | ||
8082 | unsigned int lim; | ||
8083 | atomic_t *dcnt; | ||
8084 | diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c | ||
8085 | index 52ee3a9bb7093..3098710c9c344 100644 | ||
8086 | --- a/net/unix/af_unix.c | ||
8087 | +++ b/net/unix/af_unix.c | ||
8088 | @@ -2734,7 +2734,7 @@ static __poll_t unix_dgram_poll(struct file *file, struct socket *sock, | ||
8089 | |||
8090 | other = unix_peer(sk); | ||
8091 | if (other && unix_peer(other) != sk && | ||
8092 | - unix_recvq_full(other) && | ||
8093 | + unix_recvq_full_lockless(other) && | ||
8094 | unix_dgram_peer_wake_me(sk, other)) | ||
8095 | writable = 0; | ||
8096 | |||
8097 | diff --git a/samples/bpf/test_override_return.sh b/samples/bpf/test_override_return.sh | ||
8098 | index e68b9ee6814b8..35db26f736b9d 100755 | ||
8099 | --- a/samples/bpf/test_override_return.sh | ||
8100 | +++ b/samples/bpf/test_override_return.sh | ||
8101 | @@ -1,5 +1,6 @@ | ||
8102 | #!/bin/bash | ||
8103 | |||
8104 | +rm -r tmpmnt | ||
8105 | rm -f testfile.img | ||
8106 | dd if=/dev/zero of=testfile.img bs=1M seek=1000 count=1 | ||
8107 | DEVICE=$(losetup --show -f testfile.img) | ||
8108 | diff --git a/samples/bpf/tracex7_user.c b/samples/bpf/tracex7_user.c | ||
8109 | index ea6dae78f0dff..2ed13e9f3fcb0 100644 | ||
8110 | --- a/samples/bpf/tracex7_user.c | ||
8111 | +++ b/samples/bpf/tracex7_user.c | ||
8112 | @@ -13,6 +13,11 @@ int main(int argc, char **argv) | ||
8113 | char command[256]; | ||
8114 | int ret; | ||
8115 | |||
8116 | + if (!argv[1]) { | ||
8117 | + fprintf(stderr, "ERROR: Run with the btrfs device argument!\n"); | ||
8118 | + return 0; | ||
8119 | + } | ||
8120 | + | ||
8121 | snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]); | ||
8122 | |||
8123 | if (load_bpf_file(filename)) { | ||
8124 | diff --git a/scripts/gen_ksymdeps.sh b/scripts/gen_ksymdeps.sh | ||
8125 | index 1324986e1362c..725e8c9c1b53f 100755 | ||
8126 | --- a/scripts/gen_ksymdeps.sh | ||
8127 | +++ b/scripts/gen_ksymdeps.sh | ||
8128 | @@ -4,7 +4,13 @@ | ||
8129 | set -e | ||
8130 | |||
8131 | # List of exported symbols | ||
8132 | -ksyms=$($NM $1 | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z) | ||
8133 | +# | ||
8134 | +# If the object has no symbol, $NM warns 'no symbols'. | ||
8135 | +# Suppress the stderr. | ||
8136 | +# TODO: | ||
8137 | +# Use -q instead of 2>/dev/null when we upgrade the minimum version of | ||
8138 | +# binutils to 2.37, llvm to 13.0.0. | ||
8139 | +ksyms=$($NM $1 2>/dev/null | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z) | ||
8140 | |||
8141 | if [ -z "$ksyms" ]; then | ||
8142 | exit 0 | ||
8143 | diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c | ||
8144 | index 38ac3da4e791e..beeba1a9be170 100644 | ||
8145 | --- a/security/smack/smack_access.c | ||
8146 | +++ b/security/smack/smack_access.c | ||
8147 | @@ -81,23 +81,22 @@ int log_policy = SMACK_AUDIT_DENIED; | ||
8148 | int smk_access_entry(char *subject_label, char *object_label, | ||
8149 | struct list_head *rule_list) | ||
8150 | { | ||
8151 | - int may = -ENOENT; | ||
8152 | struct smack_rule *srp; | ||
8153 | |||
8154 | list_for_each_entry_rcu(srp, rule_list, list) { | ||
8155 | if (srp->smk_object->smk_known == object_label && | ||
8156 | srp->smk_subject->smk_known == subject_label) { | ||
8157 | - may = srp->smk_access; | ||
8158 | - break; | ||
8159 | + int may = srp->smk_access; | ||
8160 | + /* | ||
8161 | + * MAY_WRITE implies MAY_LOCK. | ||
8162 | + */ | ||
8163 | + if ((may & MAY_WRITE) == MAY_WRITE) | ||
8164 | + may |= MAY_LOCK; | ||
8165 | + return may; | ||
8166 | } | ||
8167 | } | ||
8168 | |||
8169 | - /* | ||
8170 | - * MAY_WRITE implies MAY_LOCK. | ||
8171 | - */ | ||
8172 | - if ((may & MAY_WRITE) == MAY_WRITE) | ||
8173 | - may |= MAY_LOCK; | ||
8174 | - return may; | ||
8175 | + return -ENOENT; | ||
8176 | } | ||
8177 | |||
8178 | /** | ||
8179 | diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig | ||
8180 | index 71f2d42188c46..51e75b7819682 100644 | ||
8181 | --- a/sound/soc/atmel/Kconfig | ||
8182 | +++ b/sound/soc/atmel/Kconfig | ||
8183 | @@ -11,7 +11,6 @@ if SND_ATMEL_SOC | ||
8184 | |||
8185 | config SND_ATMEL_SOC_PDC | ||
8186 | bool | ||
8187 | - depends on HAS_DMA | ||
8188 | |||
8189 | config SND_ATMEL_SOC_DMA | ||
8190 | bool | ||
8191 | diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c | ||
8192 | index c67b86e2d0c0a..7830d014d9247 100644 | ||
8193 | --- a/sound/soc/intel/boards/bytcr_rt5640.c | ||
8194 | +++ b/sound/soc/intel/boards/bytcr_rt5640.c | ||
8195 | @@ -284,9 +284,6 @@ static const struct snd_soc_dapm_widget byt_rt5640_widgets[] = { | ||
8196 | static const struct snd_soc_dapm_route byt_rt5640_audio_map[] = { | ||
8197 | {"Headphone", NULL, "Platform Clock"}, | ||
8198 | {"Headset Mic", NULL, "Platform Clock"}, | ||
8199 | - {"Internal Mic", NULL, "Platform Clock"}, | ||
8200 | - {"Speaker", NULL, "Platform Clock"}, | ||
8201 | - | ||
8202 | {"Headset Mic", NULL, "MICBIAS1"}, | ||
8203 | {"IN2P", NULL, "Headset Mic"}, | ||
8204 | {"Headphone", NULL, "HPOL"}, | ||
8205 | @@ -294,19 +291,23 @@ static const struct snd_soc_dapm_route byt_rt5640_audio_map[] = { | ||
8206 | }; | ||
8207 | |||
8208 | static const struct snd_soc_dapm_route byt_rt5640_intmic_dmic1_map[] = { | ||
8209 | + {"Internal Mic", NULL, "Platform Clock"}, | ||
8210 | {"DMIC1", NULL, "Internal Mic"}, | ||
8211 | }; | ||
8212 | |||
8213 | static const struct snd_soc_dapm_route byt_rt5640_intmic_dmic2_map[] = { | ||
8214 | + {"Internal Mic", NULL, "Platform Clock"}, | ||
8215 | {"DMIC2", NULL, "Internal Mic"}, | ||
8216 | }; | ||
8217 | |||
8218 | static const struct snd_soc_dapm_route byt_rt5640_intmic_in1_map[] = { | ||
8219 | + {"Internal Mic", NULL, "Platform Clock"}, | ||
8220 | {"Internal Mic", NULL, "MICBIAS1"}, | ||
8221 | {"IN1P", NULL, "Internal Mic"}, | ||
8222 | }; | ||
8223 | |||
8224 | static const struct snd_soc_dapm_route byt_rt5640_intmic_in3_map[] = { | ||
8225 | + {"Internal Mic", NULL, "Platform Clock"}, | ||
8226 | {"Internal Mic", NULL, "MICBIAS1"}, | ||
8227 | {"IN3P", NULL, "Internal Mic"}, | ||
8228 | }; | ||
8229 | @@ -348,6 +349,7 @@ static const struct snd_soc_dapm_route byt_rt5640_ssp0_aif2_map[] = { | ||
8230 | }; | ||
8231 | |||
8232 | static const struct snd_soc_dapm_route byt_rt5640_stereo_spk_map[] = { | ||
8233 | + {"Speaker", NULL, "Platform Clock"}, | ||
8234 | {"Speaker", NULL, "SPOLP"}, | ||
8235 | {"Speaker", NULL, "SPOLN"}, | ||
8236 | {"Speaker", NULL, "SPORP"}, | ||
8237 | @@ -355,6 +357,7 @@ static const struct snd_soc_dapm_route byt_rt5640_stereo_spk_map[] = { | ||
8238 | }; | ||
8239 | |||
8240 | static const struct snd_soc_dapm_route byt_rt5640_mono_spk_map[] = { | ||
8241 | + {"Speaker", NULL, "Platform Clock"}, | ||
8242 | {"Speaker", NULL, "SPOLP"}, | ||
8243 | {"Speaker", NULL, "SPOLN"}, | ||
8244 | }; | ||
8245 | diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c | ||
8246 | index 476ef1897961d..79c6cf2c14bfb 100644 | ||
8247 | --- a/sound/soc/intel/skylake/skl-messages.c | ||
8248 | +++ b/sound/soc/intel/skylake/skl-messages.c | ||
8249 | @@ -802,9 +802,12 @@ static u16 skl_get_module_param_size(struct skl_dev *skl, | ||
8250 | |||
8251 | case SKL_MODULE_TYPE_BASE_OUTFMT: | ||
8252 | case SKL_MODULE_TYPE_MIC_SELECT: | ||
8253 | - case SKL_MODULE_TYPE_KPB: | ||
8254 | return sizeof(struct skl_base_outfmt_cfg); | ||
8255 | |||
8256 | + case SKL_MODULE_TYPE_MIXER: | ||
8257 | + case SKL_MODULE_TYPE_KPB: | ||
8258 | + return sizeof(struct skl_base_cfg); | ||
8259 | + | ||
8260 | default: | ||
8261 | /* | ||
8262 | * return only base cfg when no specific module type is | ||
8263 | @@ -857,10 +860,14 @@ static int skl_set_module_format(struct skl_dev *skl, | ||
8264 | |||
8265 | case SKL_MODULE_TYPE_BASE_OUTFMT: | ||
8266 | case SKL_MODULE_TYPE_MIC_SELECT: | ||
8267 | - case SKL_MODULE_TYPE_KPB: | ||
8268 | skl_set_base_outfmt_format(skl, module_config, *param_data); | ||
8269 | break; | ||
8270 | |||
8271 | + case SKL_MODULE_TYPE_MIXER: | ||
8272 | + case SKL_MODULE_TYPE_KPB: | ||
8273 | + skl_set_base_module_format(skl, module_config, *param_data); | ||
8274 | + break; | ||
8275 | + | ||
8276 | default: | ||
8277 | skl_set_base_module_format(skl, module_config, *param_data); | ||
8278 | break; | ||
8279 | diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c | ||
8280 | index 7f287424af9b7..439dd4ba690c4 100644 | ||
8281 | --- a/sound/soc/intel/skylake/skl-pcm.c | ||
8282 | +++ b/sound/soc/intel/skylake/skl-pcm.c | ||
8283 | @@ -1333,21 +1333,6 @@ static int skl_get_module_info(struct skl_dev *skl, | ||
8284 | return -EIO; | ||
8285 | } | ||
8286 | |||
8287 | - list_for_each_entry(module, &skl->uuid_list, list) { | ||
8288 | - if (guid_equal(uuid_mod, &module->uuid)) { | ||
8289 | - mconfig->id.module_id = module->id; | ||
8290 | - if (mconfig->module) | ||
8291 | - mconfig->module->loadable = module->is_loadable; | ||
8292 | - ret = 0; | ||
8293 | - break; | ||
8294 | - } | ||
8295 | - } | ||
8296 | - | ||
8297 | - if (ret) | ||
8298 | - return ret; | ||
8299 | - | ||
8300 | - uuid_mod = &module->uuid; | ||
8301 | - ret = -EIO; | ||
8302 | for (i = 0; i < skl->nr_modules; i++) { | ||
8303 | skl_module = skl->modules[i]; | ||
8304 | uuid_tplg = &skl_module->uuid; | ||
8305 | @@ -1357,10 +1342,18 @@ static int skl_get_module_info(struct skl_dev *skl, | ||
8306 | break; | ||
8307 | } | ||
8308 | } | ||
8309 | + | ||
8310 | if (skl->nr_modules && ret) | ||
8311 | return ret; | ||
8312 | |||
8313 | + ret = -EIO; | ||
8314 | list_for_each_entry(module, &skl->uuid_list, list) { | ||
8315 | + if (guid_equal(uuid_mod, &module->uuid)) { | ||
8316 | + mconfig->id.module_id = module->id; | ||
8317 | + mconfig->module->loadable = module->is_loadable; | ||
8318 | + ret = 0; | ||
8319 | + } | ||
8320 | + | ||
8321 | for (i = 0; i < MAX_IN_QUEUE; i++) { | ||
8322 | pin_id = &mconfig->m_in_pin[i].id; | ||
8323 | if (guid_equal(&pin_id->mod_uuid, &module->uuid)) | ||
8324 | @@ -1374,7 +1367,7 @@ static int skl_get_module_info(struct skl_dev *skl, | ||
8325 | } | ||
8326 | } | ||
8327 | |||
8328 | - return 0; | ||
8329 | + return ret; | ||
8330 | } | ||
8331 | |||
8332 | static int skl_populate_modules(struct skl_dev *skl) | ||
8333 | diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c | ||
8334 | index 61c984f10d8e6..086c90e095770 100644 | ||
8335 | --- a/sound/soc/rockchip/rockchip_i2s.c | ||
8336 | +++ b/sound/soc/rockchip/rockchip_i2s.c | ||
8337 | @@ -186,7 +186,9 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, | ||
8338 | { | ||
8339 | struct rk_i2s_dev *i2s = to_info(cpu_dai); | ||
8340 | unsigned int mask = 0, val = 0; | ||
8341 | + int ret = 0; | ||
8342 | |||
8343 | + pm_runtime_get_sync(cpu_dai->dev); | ||
8344 | mask = I2S_CKR_MSS_MASK; | ||
8345 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | ||
8346 | case SND_SOC_DAIFMT_CBS_CFS: | ||
8347 | @@ -199,7 +201,8 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, | ||
8348 | i2s->is_master_mode = false; | ||
8349 | break; | ||
8350 | default: | ||
8351 | - return -EINVAL; | ||
8352 | + ret = -EINVAL; | ||
8353 | + goto err_pm_put; | ||
8354 | } | ||
8355 | |||
8356 | regmap_update_bits(i2s->regmap, I2S_CKR, mask, val); | ||
8357 | @@ -213,7 +216,8 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, | ||
8358 | val = I2S_CKR_CKP_POS; | ||
8359 | break; | ||
8360 | default: | ||
8361 | - return -EINVAL; | ||
8362 | + ret = -EINVAL; | ||
8363 | + goto err_pm_put; | ||
8364 | } | ||
8365 | |||
8366 | regmap_update_bits(i2s->regmap, I2S_CKR, mask, val); | ||
8367 | @@ -229,14 +233,15 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, | ||
8368 | case SND_SOC_DAIFMT_I2S: | ||
8369 | val = I2S_TXCR_IBM_NORMAL; | ||
8370 | break; | ||
8371 | - case SND_SOC_DAIFMT_DSP_A: /* PCM no delay mode */ | ||
8372 | - val = I2S_TXCR_TFS_PCM; | ||
8373 | - break; | ||
8374 | - case SND_SOC_DAIFMT_DSP_B: /* PCM delay 1 mode */ | ||
8375 | + case SND_SOC_DAIFMT_DSP_A: /* PCM delay 1 bit mode */ | ||
8376 | val = I2S_TXCR_TFS_PCM | I2S_TXCR_PBM_MODE(1); | ||
8377 | break; | ||
8378 | + case SND_SOC_DAIFMT_DSP_B: /* PCM no delay mode */ | ||
8379 | + val = I2S_TXCR_TFS_PCM; | ||
8380 | + break; | ||
8381 | default: | ||
8382 | - return -EINVAL; | ||
8383 | + ret = -EINVAL; | ||
8384 | + goto err_pm_put; | ||
8385 | } | ||
8386 | |||
8387 | regmap_update_bits(i2s->regmap, I2S_TXCR, mask, val); | ||
8388 | @@ -252,19 +257,23 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, | ||
8389 | case SND_SOC_DAIFMT_I2S: | ||
8390 | val = I2S_RXCR_IBM_NORMAL; | ||
8391 | break; | ||
8392 | - case SND_SOC_DAIFMT_DSP_A: /* PCM no delay mode */ | ||
8393 | - val = I2S_RXCR_TFS_PCM; | ||
8394 | - break; | ||
8395 | - case SND_SOC_DAIFMT_DSP_B: /* PCM delay 1 mode */ | ||
8396 | + case SND_SOC_DAIFMT_DSP_A: /* PCM delay 1 bit mode */ | ||
8397 | val = I2S_RXCR_TFS_PCM | I2S_RXCR_PBM_MODE(1); | ||
8398 | break; | ||
8399 | + case SND_SOC_DAIFMT_DSP_B: /* PCM no delay mode */ | ||
8400 | + val = I2S_RXCR_TFS_PCM; | ||
8401 | + break; | ||
8402 | default: | ||
8403 | - return -EINVAL; | ||
8404 | + ret = -EINVAL; | ||
8405 | + goto err_pm_put; | ||
8406 | } | ||
8407 | |||
8408 | regmap_update_bits(i2s->regmap, I2S_RXCR, mask, val); | ||
8409 | |||
8410 | - return 0; | ||
8411 | +err_pm_put: | ||
8412 | + pm_runtime_put(cpu_dai->dev); | ||
8413 | + | ||
8414 | + return ret; | ||
8415 | } | ||
8416 | |||
8417 | static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream, | ||
8418 | diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config | ||
8419 | index 9832affd5d54b..c75c9b03d6e77 100644 | ||
8420 | --- a/tools/perf/Makefile.config | ||
8421 | +++ b/tools/perf/Makefile.config | ||
8422 | @@ -118,10 +118,10 @@ FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS) | ||
8423 | FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS) | ||
8424 | FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS) | ||
8425 | |||
8426 | -FEATURE_CHECK_LDFLAGS-libunwind-arm = -lunwind -lunwind-arm | ||
8427 | -FEATURE_CHECK_LDFLAGS-libunwind-aarch64 = -lunwind -lunwind-aarch64 | ||
8428 | -FEATURE_CHECK_LDFLAGS-libunwind-x86 = -lunwind -llzma -lunwind-x86 | ||
8429 | -FEATURE_CHECK_LDFLAGS-libunwind-x86_64 = -lunwind -llzma -lunwind-x86_64 | ||
8430 | +FEATURE_CHECK_LDFLAGS-libunwind-arm += -lunwind -lunwind-arm | ||
8431 | +FEATURE_CHECK_LDFLAGS-libunwind-aarch64 += -lunwind -lunwind-aarch64 | ||
8432 | +FEATURE_CHECK_LDFLAGS-libunwind-x86 += -lunwind -llzma -lunwind-x86 | ||
8433 | +FEATURE_CHECK_LDFLAGS-libunwind-x86_64 += -lunwind -llzma -lunwind-x86_64 | ||
8434 | |||
8435 | FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto | ||
8436 | |||
8437 | diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c | ||
8438 | index 767fe1bfd922c..8c3addc2e9e1e 100644 | ||
8439 | --- a/tools/perf/util/machine.c | ||
8440 | +++ b/tools/perf/util/machine.c | ||
8441 | @@ -2020,6 +2020,7 @@ static int add_callchain_ip(struct thread *thread, | ||
8442 | |||
8443 | al.filtered = 0; | ||
8444 | al.sym = NULL; | ||
8445 | + al.srcline = NULL; | ||
8446 | if (!cpumode) { | ||
8447 | thread__find_cpumode_addr_location(thread, ip, &al); | ||
8448 | } else { | ||
8449 | diff --git a/tools/testing/selftests/bpf/progs/xdp_tx.c b/tools/testing/selftests/bpf/progs/xdp_tx.c | ||
8450 | index 57912e7c94b0a..9ed477776eca8 100644 | ||
8451 | --- a/tools/testing/selftests/bpf/progs/xdp_tx.c | ||
8452 | +++ b/tools/testing/selftests/bpf/progs/xdp_tx.c | ||
8453 | @@ -3,7 +3,7 @@ | ||
8454 | #include <linux/bpf.h> | ||
8455 | #include "bpf_helpers.h" | ||
8456 | |||
8457 | -SEC("tx") | ||
8458 | +SEC("xdp") | ||
8459 | int xdp_tx(struct xdp_md *xdp) | ||
8460 | { | ||
8461 | return XDP_TX; | ||
8462 | diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c | ||
8463 | index 1c4219ceced2f..45c7a55f0b8b5 100644 | ||
8464 | --- a/tools/testing/selftests/bpf/test_maps.c | ||
8465 | +++ b/tools/testing/selftests/bpf/test_maps.c | ||
8466 | @@ -972,7 +972,7 @@ static void test_sockmap(unsigned int tasks, void *data) | ||
8467 | |||
8468 | FD_ZERO(&w); | ||
8469 | FD_SET(sfd[3], &w); | ||
8470 | - to.tv_sec = 1; | ||
8471 | + to.tv_sec = 30; | ||
8472 | to.tv_usec = 0; | ||
8473 | s = select(sfd[3] + 1, &w, NULL, NULL, &to); | ||
8474 | if (s == -1) { | ||
8475 | diff --git a/tools/testing/selftests/bpf/test_xdp_veth.sh b/tools/testing/selftests/bpf/test_xdp_veth.sh | ||
8476 | index ba8ffcdaac302..995278e684b6e 100755 | ||
8477 | --- a/tools/testing/selftests/bpf/test_xdp_veth.sh | ||
8478 | +++ b/tools/testing/selftests/bpf/test_xdp_veth.sh | ||
8479 | @@ -108,7 +108,7 @@ ip link set dev veth2 xdp pinned $BPF_DIR/progs/redirect_map_1 | ||
8480 | ip link set dev veth3 xdp pinned $BPF_DIR/progs/redirect_map_2 | ||
8481 | |||
8482 | ip -n ns1 link set dev veth11 xdp obj xdp_dummy.o sec xdp_dummy | ||
8483 | -ip -n ns2 link set dev veth22 xdp obj xdp_tx.o sec tx | ||
8484 | +ip -n ns2 link set dev veth22 xdp obj xdp_tx.o sec xdp | ||
8485 | ip -n ns3 link set dev veth33 xdp obj xdp_dummy.o sec xdp_dummy | ||
8486 | |||
8487 | trap cleanup EXIT | ||
8488 | diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile | ||
8489 | index 59e417ec3e134..25d7f8f37cfd6 100644 | ||
8490 | --- a/tools/thermal/tmon/Makefile | ||
8491 | +++ b/tools/thermal/tmon/Makefile | ||
8492 | @@ -10,7 +10,7 @@ override CFLAGS+= $(call cc-option,-O3,-O1) ${WARNFLAGS} | ||
8493 | # Add "-fstack-protector" only if toolchain supports it. | ||
8494 | override CFLAGS+= $(call cc-option,-fstack-protector-strong) | ||
8495 | CC?= $(CROSS_COMPILE)gcc | ||
8496 | -PKG_CONFIG?= pkg-config | ||
8497 | +PKG_CONFIG?= $(CROSS_COMPILE)pkg-config | ||
8498 | |||
8499 | override CFLAGS+=-D VERSION=\"$(VERSION)\" | ||
8500 | LDFLAGS+= | ||
8501 | diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c | ||
8502 | index 4af85605730e4..f7150fbeeb55e 100644 | ||
8503 | --- a/virt/kvm/arm/arm.c | ||
8504 | +++ b/virt/kvm/arm/arm.c | ||
8505 | @@ -1141,6 +1141,14 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | ||
8506 | if (copy_from_user(®, argp, sizeof(reg))) | ||
8507 | break; | ||
8508 | |||
8509 | + /* | ||
8510 | + * We could owe a reset due to PSCI. Handle the pending reset | ||
8511 | + * here to ensure userspace register accesses are ordered after | ||
8512 | + * the reset. | ||
8513 | + */ | ||
8514 | + if (kvm_check_request(KVM_REQ_VCPU_RESET, vcpu)) | ||
8515 | + kvm_reset_vcpu(vcpu); | ||
8516 | + | ||
8517 | if (ioctl == KVM_SET_ONE_REG) | ||
8518 | r = kvm_arm_set_reg(vcpu, ®); | ||
8519 | else |