Contents of /trunk/kernel-magellan/patches-4.6/0101-4.6.2-all-fixes.patch
Parent Directory | Revision Log
Revision 2816 -
(show annotations)
(download)
Thu Aug 4 13:24:35 2016 UTC (8 years, 1 month ago) by niro
File size: 155274 byte(s)
Thu Aug 4 13:24:35 2016 UTC (8 years, 1 month ago) by niro
File size: 155274 byte(s)
-linux-4.6.2
1 | diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl |
2 | index 1692c4dd5487..ab037f6fa2ee 100644 |
3 | --- a/Documentation/DocBook/gpu.tmpl |
4 | +++ b/Documentation/DocBook/gpu.tmpl |
5 | @@ -1623,6 +1623,12 @@ void intel_crt_init(struct drm_device *dev) |
6 | !Edrivers/gpu/drm/drm_dp_helper.c |
7 | </sect2> |
8 | <sect2> |
9 | + <title>Display Port Dual Mode Adaptor Helper Functions Reference</title> |
10 | +!Pdrivers/gpu/drm/drm_dp_dual_mode_helper.c dp dual mode helpers |
11 | +!Iinclude/drm/drm_dp_dual_mode_helper.h |
12 | +!Edrivers/gpu/drm/drm_dp_dual_mode_helper.c |
13 | + </sect2> |
14 | + <sect2> |
15 | <title>Display Port MST Helper Functions Reference</title> |
16 | !Pdrivers/gpu/drm/drm_dp_mst_topology.c dp mst helper |
17 | !Iinclude/drm/drm_dp_mst_helper.h |
18 | diff --git a/Documentation/devicetree/bindings/clock/imx35-clock.txt b/Documentation/devicetree/bindings/clock/imx35-clock.txt |
19 | index a70356452a82..f49783213c56 100644 |
20 | --- a/Documentation/devicetree/bindings/clock/imx35-clock.txt |
21 | +++ b/Documentation/devicetree/bindings/clock/imx35-clock.txt |
22 | @@ -94,6 +94,7 @@ clocks and IDs. |
23 | csi_sel 79 |
24 | iim_gate 80 |
25 | gpu2d_gate 81 |
26 | + ckli_gate 82 |
27 | |
28 | Examples: |
29 | |
30 | diff --git a/Makefile b/Makefile |
31 | index 2fcc41ea99a3..93068c2d0656 100644 |
32 | --- a/Makefile |
33 | +++ b/Makefile |
34 | @@ -1,6 +1,6 @@ |
35 | VERSION = 4 |
36 | PATCHLEVEL = 6 |
37 | -SUBLEVEL = 1 |
38 | +SUBLEVEL = 2 |
39 | EXTRAVERSION = |
40 | NAME = Charred Weasel |
41 | |
42 | @@ -364,7 +364,7 @@ AFLAGS_MODULE = |
43 | LDFLAGS_MODULE = |
44 | CFLAGS_KERNEL = |
45 | AFLAGS_KERNEL = |
46 | -CFLAGS_GCOV = -fprofile-arcs -ftest-coverage |
47 | +CFLAGS_GCOV = -fprofile-arcs -ftest-coverage -fno-tree-loop-im |
48 | CFLAGS_KCOV = -fsanitize-coverage=trace-pc |
49 | |
50 | |
51 | diff --git a/arch/arm/boot/dts/armada-385-linksys.dtsi b/arch/arm/boot/dts/armada-385-linksys.dtsi |
52 | index 85d2c377c332..8450944b28e6 100644 |
53 | --- a/arch/arm/boot/dts/armada-385-linksys.dtsi |
54 | +++ b/arch/arm/boot/dts/armada-385-linksys.dtsi |
55 | @@ -245,7 +245,7 @@ |
56 | button@2 { |
57 | label = "Factory Reset Button"; |
58 | linux,code = <KEY_RESTART>; |
59 | - gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; |
60 | + gpios = <&gpio0 29 GPIO_ACTIVE_LOW>; |
61 | }; |
62 | }; |
63 | |
64 | @@ -260,7 +260,7 @@ |
65 | }; |
66 | |
67 | sata { |
68 | - gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>; |
69 | + gpios = <&gpio1 22 GPIO_ACTIVE_LOW>; |
70 | default-state = "off"; |
71 | }; |
72 | }; |
73 | @@ -313,7 +313,7 @@ |
74 | |
75 | &pinctrl { |
76 | keys_pin: keys-pin { |
77 | - marvell,pins = "mpp24", "mpp47"; |
78 | + marvell,pins = "mpp24", "mpp29"; |
79 | marvell,function = "gpio"; |
80 | }; |
81 | |
82 | diff --git a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts |
83 | index b89e6cf1271a..7a461541ce50 100644 |
84 | --- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts |
85 | +++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts |
86 | @@ -304,13 +304,13 @@ |
87 | button@1 { |
88 | label = "WPS"; |
89 | linux,code = <KEY_WPS_BUTTON>; |
90 | - gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>; |
91 | + gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; |
92 | }; |
93 | |
94 | button@2 { |
95 | label = "Factory Reset Button"; |
96 | linux,code = <KEY_RESTART>; |
97 | - gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; |
98 | + gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; |
99 | }; |
100 | }; |
101 | |
102 | diff --git a/arch/arm/boot/dts/exynos4210-trats.dts b/arch/arm/boot/dts/exynos4210-trats.dts |
103 | index 1df2f0bc1d76..a9fae910bb15 100644 |
104 | --- a/arch/arm/boot/dts/exynos4210-trats.dts |
105 | +++ b/arch/arm/boot/dts/exynos4210-trats.dts |
106 | @@ -298,6 +298,8 @@ |
107 | compatible = "maxim,max8997-pmic"; |
108 | |
109 | reg = <0x66>; |
110 | + interrupt-parent = <&gpx0>; |
111 | + interrupts = <7 0>; |
112 | |
113 | max8997,pmic-buck1-uses-gpio-dvs; |
114 | max8997,pmic-buck2-uses-gpio-dvs; |
115 | diff --git a/arch/arm/boot/dts/sama5d2-pinfunc.h b/arch/arm/boot/dts/sama5d2-pinfunc.h |
116 | index b0c912feaa2f..8a394f336003 100644 |
117 | --- a/arch/arm/boot/dts/sama5d2-pinfunc.h |
118 | +++ b/arch/arm/boot/dts/sama5d2-pinfunc.h |
119 | @@ -837,8 +837,8 @@ |
120 | #define PIN_PD23__ISC_FIELD PINMUX_PIN(PIN_PD23, 6, 4) |
121 | #define PIN_PD24 120 |
122 | #define PIN_PD24__GPIO PINMUX_PIN(PIN_PD24, 0, 0) |
123 | -#define PIN_PD24__UTXD2 PINMUX_PIN(PIN_PD23, 1, 2) |
124 | -#define PIN_PD24__FLEXCOM4_IO3 PINMUX_PIN(PIN_PD23, 3, 3) |
125 | +#define PIN_PD24__UTXD2 PINMUX_PIN(PIN_PD24, 1, 2) |
126 | +#define PIN_PD24__FLEXCOM4_IO3 PINMUX_PIN(PIN_PD24, 3, 3) |
127 | #define PIN_PD25 121 |
128 | #define PIN_PD25__GPIO PINMUX_PIN(PIN_PD25, 0, 0) |
129 | #define PIN_PD25__SPI1_SPCK PINMUX_PIN(PIN_PD25, 1, 3) |
130 | diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi |
131 | index 2c8f5e6ad905..bf70d0ae93ce 100644 |
132 | --- a/arch/arm/boot/dts/sun4i-a10.dtsi |
133 | +++ b/arch/arm/boot/dts/sun4i-a10.dtsi |
134 | @@ -96,7 +96,7 @@ |
135 | allwinner,pipeline = "de_fe0-de_be0-lcd0-tve0"; |
136 | clocks = <&pll5 1>, <&ahb_gates 34>, <&ahb_gates 36>, |
137 | <&ahb_gates 44>, <&ahb_gates 46>, |
138 | - <&dram_gates 25>, <&dram_gates 26>; |
139 | + <&dram_gates 5>, <&dram_gates 25>, <&dram_gates 26>; |
140 | status = "disabled"; |
141 | }; |
142 | }; |
143 | diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi |
144 | index 0940a788f824..ee4e8e7d3e30 100644 |
145 | --- a/arch/arm/boot/dts/sun7i-a20.dtsi |
146 | +++ b/arch/arm/boot/dts/sun7i-a20.dtsi |
147 | @@ -85,8 +85,9 @@ |
148 | compatible = "allwinner,simple-framebuffer", |
149 | "simple-framebuffer"; |
150 | allwinner,pipeline = "de_be0-lcd0-tve0"; |
151 | - clocks = <&pll5 1>, <&ahb_gates 34>, <&ahb_gates 36>, |
152 | - <&ahb_gates 44>, <&dram_gates 26>; |
153 | + clocks = <&pll5 1>, |
154 | + <&ahb_gates 34>, <&ahb_gates 36>, <&ahb_gates 44>, |
155 | + <&dram_gates 5>, <&dram_gates 26>; |
156 | status = "disabled"; |
157 | }; |
158 | }; |
159 | diff --git a/arch/mips/ath79/early_printk.c b/arch/mips/ath79/early_printk.c |
160 | index b955fafc58ba..d1adc59af5bf 100644 |
161 | --- a/arch/mips/ath79/early_printk.c |
162 | +++ b/arch/mips/ath79/early_printk.c |
163 | @@ -31,13 +31,15 @@ static inline void prom_putchar_wait(void __iomem *reg, u32 mask, u32 val) |
164 | } while (1); |
165 | } |
166 | |
167 | +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) |
168 | + |
169 | static void prom_putchar_ar71xx(unsigned char ch) |
170 | { |
171 | void __iomem *base = (void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE)); |
172 | |
173 | - prom_putchar_wait(base + UART_LSR * 4, UART_LSR_THRE, UART_LSR_THRE); |
174 | + prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY); |
175 | __raw_writel(ch, base + UART_TX * 4); |
176 | - prom_putchar_wait(base + UART_LSR * 4, UART_LSR_THRE, UART_LSR_THRE); |
177 | + prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY); |
178 | } |
179 | |
180 | static void prom_putchar_ar933x(unsigned char ch) |
181 | diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h |
182 | index 867f924b05c7..e689b894353c 100644 |
183 | --- a/arch/mips/include/asm/asmmacro.h |
184 | +++ b/arch/mips/include/asm/asmmacro.h |
185 | @@ -298,21 +298,21 @@ |
186 | .set pop |
187 | .endm |
188 | |
189 | - .macro copy_u_w ws, n |
190 | + .macro copy_s_w ws, n |
191 | .set push |
192 | .set mips32r2 |
193 | .set fp=64 |
194 | .set msa |
195 | - copy_u.w $1, $w\ws[\n] |
196 | + copy_s.w $1, $w\ws[\n] |
197 | .set pop |
198 | .endm |
199 | |
200 | - .macro copy_u_d ws, n |
201 | + .macro copy_s_d ws, n |
202 | .set push |
203 | .set mips64r2 |
204 | .set fp=64 |
205 | .set msa |
206 | - copy_u.d $1, $w\ws[\n] |
207 | + copy_s.d $1, $w\ws[\n] |
208 | .set pop |
209 | .endm |
210 | |
211 | @@ -346,8 +346,8 @@ |
212 | #define STH_MSA_INSN 0x5800081f |
213 | #define STW_MSA_INSN 0x5800082f |
214 | #define STD_MSA_INSN 0x5800083f |
215 | -#define COPY_UW_MSA_INSN 0x58f00056 |
216 | -#define COPY_UD_MSA_INSN 0x58f80056 |
217 | +#define COPY_SW_MSA_INSN 0x58b00056 |
218 | +#define COPY_SD_MSA_INSN 0x58b80056 |
219 | #define INSERT_W_MSA_INSN 0x59300816 |
220 | #define INSERT_D_MSA_INSN 0x59380816 |
221 | #else |
222 | @@ -361,8 +361,8 @@ |
223 | #define STH_MSA_INSN 0x78000825 |
224 | #define STW_MSA_INSN 0x78000826 |
225 | #define STD_MSA_INSN 0x78000827 |
226 | -#define COPY_UW_MSA_INSN 0x78f00059 |
227 | -#define COPY_UD_MSA_INSN 0x78f80059 |
228 | +#define COPY_SW_MSA_INSN 0x78b00059 |
229 | +#define COPY_SD_MSA_INSN 0x78b80059 |
230 | #define INSERT_W_MSA_INSN 0x79300819 |
231 | #define INSERT_D_MSA_INSN 0x79380819 |
232 | #endif |
233 | @@ -393,7 +393,7 @@ |
234 | .set push |
235 | .set noat |
236 | SET_HARDFLOAT |
237 | - addu $1, \base, \off |
238 | + PTR_ADDU $1, \base, \off |
239 | .word LDB_MSA_INSN | (\wd << 6) |
240 | .set pop |
241 | .endm |
242 | @@ -402,7 +402,7 @@ |
243 | .set push |
244 | .set noat |
245 | SET_HARDFLOAT |
246 | - addu $1, \base, \off |
247 | + PTR_ADDU $1, \base, \off |
248 | .word LDH_MSA_INSN | (\wd << 6) |
249 | .set pop |
250 | .endm |
251 | @@ -411,7 +411,7 @@ |
252 | .set push |
253 | .set noat |
254 | SET_HARDFLOAT |
255 | - addu $1, \base, \off |
256 | + PTR_ADDU $1, \base, \off |
257 | .word LDW_MSA_INSN | (\wd << 6) |
258 | .set pop |
259 | .endm |
260 | @@ -420,7 +420,7 @@ |
261 | .set push |
262 | .set noat |
263 | SET_HARDFLOAT |
264 | - addu $1, \base, \off |
265 | + PTR_ADDU $1, \base, \off |
266 | .word LDD_MSA_INSN | (\wd << 6) |
267 | .set pop |
268 | .endm |
269 | @@ -429,7 +429,7 @@ |
270 | .set push |
271 | .set noat |
272 | SET_HARDFLOAT |
273 | - addu $1, \base, \off |
274 | + PTR_ADDU $1, \base, \off |
275 | .word STB_MSA_INSN | (\wd << 6) |
276 | .set pop |
277 | .endm |
278 | @@ -438,7 +438,7 @@ |
279 | .set push |
280 | .set noat |
281 | SET_HARDFLOAT |
282 | - addu $1, \base, \off |
283 | + PTR_ADDU $1, \base, \off |
284 | .word STH_MSA_INSN | (\wd << 6) |
285 | .set pop |
286 | .endm |
287 | @@ -447,7 +447,7 @@ |
288 | .set push |
289 | .set noat |
290 | SET_HARDFLOAT |
291 | - addu $1, \base, \off |
292 | + PTR_ADDU $1, \base, \off |
293 | .word STW_MSA_INSN | (\wd << 6) |
294 | .set pop |
295 | .endm |
296 | @@ -456,26 +456,26 @@ |
297 | .set push |
298 | .set noat |
299 | SET_HARDFLOAT |
300 | - addu $1, \base, \off |
301 | + PTR_ADDU $1, \base, \off |
302 | .word STD_MSA_INSN | (\wd << 6) |
303 | .set pop |
304 | .endm |
305 | |
306 | - .macro copy_u_w ws, n |
307 | + .macro copy_s_w ws, n |
308 | .set push |
309 | .set noat |
310 | SET_HARDFLOAT |
311 | .insn |
312 | - .word COPY_UW_MSA_INSN | (\n << 16) | (\ws << 11) |
313 | + .word COPY_SW_MSA_INSN | (\n << 16) | (\ws << 11) |
314 | .set pop |
315 | .endm |
316 | |
317 | - .macro copy_u_d ws, n |
318 | + .macro copy_s_d ws, n |
319 | .set push |
320 | .set noat |
321 | SET_HARDFLOAT |
322 | .insn |
323 | - .word COPY_UD_MSA_INSN | (\n << 16) | (\ws << 11) |
324 | + .word COPY_SD_MSA_INSN | (\n << 16) | (\ws << 11) |
325 | .set pop |
326 | .endm |
327 | |
328 | diff --git a/arch/mips/include/asm/cacheflush.h b/arch/mips/include/asm/cacheflush.h |
329 | index 723229f4cf27..176de586a71a 100644 |
330 | --- a/arch/mips/include/asm/cacheflush.h |
331 | +++ b/arch/mips/include/asm/cacheflush.h |
332 | @@ -51,7 +51,6 @@ extern void (*flush_cache_range)(struct vm_area_struct *vma, |
333 | unsigned long start, unsigned long end); |
334 | extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn); |
335 | extern void __flush_dcache_page(struct page *page); |
336 | -extern void __flush_icache_page(struct vm_area_struct *vma, struct page *page); |
337 | |
338 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 |
339 | static inline void flush_dcache_page(struct page *page) |
340 | @@ -77,11 +76,6 @@ static inline void flush_anon_page(struct vm_area_struct *vma, |
341 | static inline void flush_icache_page(struct vm_area_struct *vma, |
342 | struct page *page) |
343 | { |
344 | - if (!cpu_has_ic_fills_f_dc && (vma->vm_flags & VM_EXEC) && |
345 | - Page_dcache_dirty(page)) { |
346 | - __flush_icache_page(vma, page); |
347 | - ClearPageDcacheDirty(page); |
348 | - } |
349 | } |
350 | |
351 | extern void (*flush_icache_range)(unsigned long start, unsigned long end); |
352 | diff --git a/arch/mips/include/asm/msa.h b/arch/mips/include/asm/msa.h |
353 | index bbb85fe21642..6e4effa6f626 100644 |
354 | --- a/arch/mips/include/asm/msa.h |
355 | +++ b/arch/mips/include/asm/msa.h |
356 | @@ -147,6 +147,19 @@ static inline void restore_msa(struct task_struct *t) |
357 | _restore_msa(t); |
358 | } |
359 | |
360 | +static inline void init_msa_upper(void) |
361 | +{ |
362 | + /* |
363 | + * Check cpu_has_msa only if it's a constant. This will allow the |
364 | + * compiler to optimise out code for CPUs without MSA without adding |
365 | + * an extra redundant check for CPUs with MSA. |
366 | + */ |
367 | + if (__builtin_constant_p(cpu_has_msa) && !cpu_has_msa) |
368 | + return; |
369 | + |
370 | + _init_msa_upper(); |
371 | +} |
372 | + |
373 | #ifdef TOOLCHAIN_SUPPORTS_MSA |
374 | |
375 | #define __BUILD_MSA_CTL_REG(name, cs) \ |
376 | diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h |
377 | index 9a4fe0133ff1..65bf2c065db5 100644 |
378 | --- a/arch/mips/include/asm/pgtable.h |
379 | +++ b/arch/mips/include/asm/pgtable.h |
380 | @@ -127,10 +127,14 @@ do { \ |
381 | } \ |
382 | } while(0) |
383 | |
384 | +static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, |
385 | + pte_t *ptep, pte_t pteval); |
386 | + |
387 | #if defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32) |
388 | |
389 | #define pte_none(pte) (!(((pte).pte_high) & ~_PAGE_GLOBAL)) |
390 | #define pte_present(pte) ((pte).pte_low & _PAGE_PRESENT) |
391 | +#define pte_no_exec(pte) ((pte).pte_low & _PAGE_NO_EXEC) |
392 | |
393 | static inline void set_pte(pte_t *ptep, pte_t pte) |
394 | { |
395 | @@ -148,7 +152,6 @@ static inline void set_pte(pte_t *ptep, pte_t pte) |
396 | buddy->pte_high |= _PAGE_GLOBAL; |
397 | } |
398 | } |
399 | -#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval) |
400 | |
401 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
402 | { |
403 | @@ -166,6 +169,7 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt |
404 | |
405 | #define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL)) |
406 | #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) |
407 | +#define pte_no_exec(pte) (pte_val(pte) & _PAGE_NO_EXEC) |
408 | |
409 | /* |
410 | * Certain architectures need to do special things when pte's |
411 | @@ -218,7 +222,6 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) |
412 | } |
413 | #endif |
414 | } |
415 | -#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval) |
416 | |
417 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
418 | { |
419 | @@ -234,6 +237,22 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt |
420 | } |
421 | #endif |
422 | |
423 | +static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, |
424 | + pte_t *ptep, pte_t pteval) |
425 | +{ |
426 | + extern void __update_cache(unsigned long address, pte_t pte); |
427 | + |
428 | + if (!pte_present(pteval)) |
429 | + goto cache_sync_done; |
430 | + |
431 | + if (pte_present(*ptep) && (pte_pfn(*ptep) == pte_pfn(pteval))) |
432 | + goto cache_sync_done; |
433 | + |
434 | + __update_cache(addr, pteval); |
435 | +cache_sync_done: |
436 | + set_pte(ptep, pteval); |
437 | +} |
438 | + |
439 | /* |
440 | * (pmds are folded into puds so this doesn't get actually called, |
441 | * but the define is needed for a generic inline function.) |
442 | @@ -430,15 +449,12 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
443 | |
444 | extern void __update_tlb(struct vm_area_struct *vma, unsigned long address, |
445 | pte_t pte); |
446 | -extern void __update_cache(struct vm_area_struct *vma, unsigned long address, |
447 | - pte_t pte); |
448 | |
449 | static inline void update_mmu_cache(struct vm_area_struct *vma, |
450 | unsigned long address, pte_t *ptep) |
451 | { |
452 | pte_t pte = *ptep; |
453 | __update_tlb(vma, address, pte); |
454 | - __update_cache(vma, address, pte); |
455 | } |
456 | |
457 | static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, |
458 | diff --git a/arch/mips/include/asm/switch_to.h b/arch/mips/include/asm/switch_to.h |
459 | index 28b5d84a5022..ebb5c0f2f90d 100644 |
460 | --- a/arch/mips/include/asm/switch_to.h |
461 | +++ b/arch/mips/include/asm/switch_to.h |
462 | @@ -105,7 +105,7 @@ do { \ |
463 | __clear_software_ll_bit(); \ |
464 | if (cpu_has_userlocal) \ |
465 | write_c0_userlocal(task_thread_info(next)->tp_value); \ |
466 | - __restore_watch(); \ |
467 | + __restore_watch(next); \ |
468 | (last) = resume(prev, next, task_thread_info(next)); \ |
469 | } while (0) |
470 | |
471 | diff --git a/arch/mips/include/asm/watch.h b/arch/mips/include/asm/watch.h |
472 | index 20126ec79359..6ffe3eadf105 100644 |
473 | --- a/arch/mips/include/asm/watch.h |
474 | +++ b/arch/mips/include/asm/watch.h |
475 | @@ -12,21 +12,21 @@ |
476 | |
477 | #include <asm/mipsregs.h> |
478 | |
479 | -void mips_install_watch_registers(void); |
480 | +void mips_install_watch_registers(struct task_struct *t); |
481 | void mips_read_watch_registers(void); |
482 | void mips_clear_watch_registers(void); |
483 | void mips_probe_watch_registers(struct cpuinfo_mips *c); |
484 | |
485 | #ifdef CONFIG_HARDWARE_WATCHPOINTS |
486 | -#define __restore_watch() do { \ |
487 | +#define __restore_watch(task) do { \ |
488 | if (unlikely(test_bit(TIF_LOAD_WATCH, \ |
489 | - ¤t_thread_info()->flags))) { \ |
490 | - mips_install_watch_registers(); \ |
491 | + &task_thread_info(task)->flags))) { \ |
492 | + mips_install_watch_registers(task); \ |
493 | } \ |
494 | } while (0) |
495 | |
496 | #else |
497 | -#define __restore_watch() do {} while (0) |
498 | +#define __restore_watch(task) do {} while (0) |
499 | #endif |
500 | |
501 | #endif /* _ASM_WATCH_H */ |
502 | diff --git a/arch/mips/include/uapi/asm/siginfo.h b/arch/mips/include/uapi/asm/siginfo.h |
503 | index cc49dc240d67..8069cf766603 100644 |
504 | --- a/arch/mips/include/uapi/asm/siginfo.h |
505 | +++ b/arch/mips/include/uapi/asm/siginfo.h |
506 | @@ -28,7 +28,7 @@ |
507 | |
508 | #define __ARCH_SIGSYS |
509 | |
510 | -#include <uapi/asm-generic/siginfo.h> |
511 | +#include <asm-generic/siginfo.h> |
512 | |
513 | /* We can't use generic siginfo_t, because our si_code and si_errno are swapped */ |
514 | typedef struct siginfo { |
515 | @@ -42,13 +42,13 @@ typedef struct siginfo { |
516 | |
517 | /* kill() */ |
518 | struct { |
519 | - pid_t _pid; /* sender's pid */ |
520 | + __kernel_pid_t _pid; /* sender's pid */ |
521 | __ARCH_SI_UID_T _uid; /* sender's uid */ |
522 | } _kill; |
523 | |
524 | /* POSIX.1b timers */ |
525 | struct { |
526 | - timer_t _tid; /* timer id */ |
527 | + __kernel_timer_t _tid; /* timer id */ |
528 | int _overrun; /* overrun count */ |
529 | char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)]; |
530 | sigval_t _sigval; /* same as below */ |
531 | @@ -57,26 +57,26 @@ typedef struct siginfo { |
532 | |
533 | /* POSIX.1b signals */ |
534 | struct { |
535 | - pid_t _pid; /* sender's pid */ |
536 | + __kernel_pid_t _pid; /* sender's pid */ |
537 | __ARCH_SI_UID_T _uid; /* sender's uid */ |
538 | sigval_t _sigval; |
539 | } _rt; |
540 | |
541 | /* SIGCHLD */ |
542 | struct { |
543 | - pid_t _pid; /* which child */ |
544 | + __kernel_pid_t _pid; /* which child */ |
545 | __ARCH_SI_UID_T _uid; /* sender's uid */ |
546 | int _status; /* exit code */ |
547 | - clock_t _utime; |
548 | - clock_t _stime; |
549 | + __kernel_clock_t _utime; |
550 | + __kernel_clock_t _stime; |
551 | } _sigchld; |
552 | |
553 | /* IRIX SIGCHLD */ |
554 | struct { |
555 | - pid_t _pid; /* which child */ |
556 | - clock_t _utime; |
557 | + __kernel_pid_t _pid; /* which child */ |
558 | + __kernel_clock_t _utime; |
559 | int _status; /* exit code */ |
560 | - clock_t _stime; |
561 | + __kernel_clock_t _stime; |
562 | } _irix_sigchld; |
563 | |
564 | /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ |
565 | @@ -123,6 +123,4 @@ typedef struct siginfo { |
566 | #define SI_TIMER __SI_CODE(__SI_TIMER, -3) /* sent by timer expiration */ |
567 | #define SI_MESGQ __SI_CODE(__SI_MESGQ, -4) /* sent by real time mesq state change */ |
568 | |
569 | -#include <asm-generic/siginfo.h> |
570 | - |
571 | #endif /* _UAPI_ASM_SIGINFO_H */ |
572 | diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c |
573 | index 3fff89ae760b..625ee770b1aa 100644 |
574 | --- a/arch/mips/kernel/mips-r2-to-r6-emul.c |
575 | +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c |
576 | @@ -28,6 +28,7 @@ |
577 | #include <asm/inst.h> |
578 | #include <asm/mips-r2-to-r6-emul.h> |
579 | #include <asm/local.h> |
580 | +#include <asm/mipsregs.h> |
581 | #include <asm/ptrace.h> |
582 | #include <asm/uaccess.h> |
583 | |
584 | @@ -1251,10 +1252,10 @@ fpu_emul: |
585 | " j 10b\n" |
586 | " .previous\n" |
587 | " .section __ex_table,\"a\"\n" |
588 | - " .word 1b,8b\n" |
589 | - " .word 2b,8b\n" |
590 | - " .word 3b,8b\n" |
591 | - " .word 4b,8b\n" |
592 | + STR(PTR) " 1b,8b\n" |
593 | + STR(PTR) " 2b,8b\n" |
594 | + STR(PTR) " 3b,8b\n" |
595 | + STR(PTR) " 4b,8b\n" |
596 | " .previous\n" |
597 | " .set pop\n" |
598 | : "+&r"(rt), "=&r"(rs), |
599 | @@ -1326,10 +1327,10 @@ fpu_emul: |
600 | " j 10b\n" |
601 | " .previous\n" |
602 | " .section __ex_table,\"a\"\n" |
603 | - " .word 1b,8b\n" |
604 | - " .word 2b,8b\n" |
605 | - " .word 3b,8b\n" |
606 | - " .word 4b,8b\n" |
607 | + STR(PTR) " 1b,8b\n" |
608 | + STR(PTR) " 2b,8b\n" |
609 | + STR(PTR) " 3b,8b\n" |
610 | + STR(PTR) " 4b,8b\n" |
611 | " .previous\n" |
612 | " .set pop\n" |
613 | : "+&r"(rt), "=&r"(rs), |
614 | @@ -1397,10 +1398,10 @@ fpu_emul: |
615 | " j 9b\n" |
616 | " .previous\n" |
617 | " .section __ex_table,\"a\"\n" |
618 | - " .word 1b,8b\n" |
619 | - " .word 2b,8b\n" |
620 | - " .word 3b,8b\n" |
621 | - " .word 4b,8b\n" |
622 | + STR(PTR) " 1b,8b\n" |
623 | + STR(PTR) " 2b,8b\n" |
624 | + STR(PTR) " 3b,8b\n" |
625 | + STR(PTR) " 4b,8b\n" |
626 | " .previous\n" |
627 | " .set pop\n" |
628 | : "+&r"(rt), "=&r"(rs), |
629 | @@ -1467,10 +1468,10 @@ fpu_emul: |
630 | " j 9b\n" |
631 | " .previous\n" |
632 | " .section __ex_table,\"a\"\n" |
633 | - " .word 1b,8b\n" |
634 | - " .word 2b,8b\n" |
635 | - " .word 3b,8b\n" |
636 | - " .word 4b,8b\n" |
637 | + STR(PTR) " 1b,8b\n" |
638 | + STR(PTR) " 2b,8b\n" |
639 | + STR(PTR) " 3b,8b\n" |
640 | + STR(PTR) " 4b,8b\n" |
641 | " .previous\n" |
642 | " .set pop\n" |
643 | : "+&r"(rt), "=&r"(rs), |
644 | @@ -1582,14 +1583,14 @@ fpu_emul: |
645 | " j 9b\n" |
646 | " .previous\n" |
647 | " .section __ex_table,\"a\"\n" |
648 | - " .word 1b,8b\n" |
649 | - " .word 2b,8b\n" |
650 | - " .word 3b,8b\n" |
651 | - " .word 4b,8b\n" |
652 | - " .word 5b,8b\n" |
653 | - " .word 6b,8b\n" |
654 | - " .word 7b,8b\n" |
655 | - " .word 0b,8b\n" |
656 | + STR(PTR) " 1b,8b\n" |
657 | + STR(PTR) " 2b,8b\n" |
658 | + STR(PTR) " 3b,8b\n" |
659 | + STR(PTR) " 4b,8b\n" |
660 | + STR(PTR) " 5b,8b\n" |
661 | + STR(PTR) " 6b,8b\n" |
662 | + STR(PTR) " 7b,8b\n" |
663 | + STR(PTR) " 0b,8b\n" |
664 | " .previous\n" |
665 | " .set pop\n" |
666 | : "+&r"(rt), "=&r"(rs), |
667 | @@ -1701,14 +1702,14 @@ fpu_emul: |
668 | " j 9b\n" |
669 | " .previous\n" |
670 | " .section __ex_table,\"a\"\n" |
671 | - " .word 1b,8b\n" |
672 | - " .word 2b,8b\n" |
673 | - " .word 3b,8b\n" |
674 | - " .word 4b,8b\n" |
675 | - " .word 5b,8b\n" |
676 | - " .word 6b,8b\n" |
677 | - " .word 7b,8b\n" |
678 | - " .word 0b,8b\n" |
679 | + STR(PTR) " 1b,8b\n" |
680 | + STR(PTR) " 2b,8b\n" |
681 | + STR(PTR) " 3b,8b\n" |
682 | + STR(PTR) " 4b,8b\n" |
683 | + STR(PTR) " 5b,8b\n" |
684 | + STR(PTR) " 6b,8b\n" |
685 | + STR(PTR) " 7b,8b\n" |
686 | + STR(PTR) " 0b,8b\n" |
687 | " .previous\n" |
688 | " .set pop\n" |
689 | : "+&r"(rt), "=&r"(rs), |
690 | @@ -1820,14 +1821,14 @@ fpu_emul: |
691 | " j 9b\n" |
692 | " .previous\n" |
693 | " .section __ex_table,\"a\"\n" |
694 | - " .word 1b,8b\n" |
695 | - " .word 2b,8b\n" |
696 | - " .word 3b,8b\n" |
697 | - " .word 4b,8b\n" |
698 | - " .word 5b,8b\n" |
699 | - " .word 6b,8b\n" |
700 | - " .word 7b,8b\n" |
701 | - " .word 0b,8b\n" |
702 | + STR(PTR) " 1b,8b\n" |
703 | + STR(PTR) " 2b,8b\n" |
704 | + STR(PTR) " 3b,8b\n" |
705 | + STR(PTR) " 4b,8b\n" |
706 | + STR(PTR) " 5b,8b\n" |
707 | + STR(PTR) " 6b,8b\n" |
708 | + STR(PTR) " 7b,8b\n" |
709 | + STR(PTR) " 0b,8b\n" |
710 | " .previous\n" |
711 | " .set pop\n" |
712 | : "+&r"(rt), "=&r"(rs), |
713 | @@ -1938,14 +1939,14 @@ fpu_emul: |
714 | " j 9b\n" |
715 | " .previous\n" |
716 | " .section __ex_table,\"a\"\n" |
717 | - " .word 1b,8b\n" |
718 | - " .word 2b,8b\n" |
719 | - " .word 3b,8b\n" |
720 | - " .word 4b,8b\n" |
721 | - " .word 5b,8b\n" |
722 | - " .word 6b,8b\n" |
723 | - " .word 7b,8b\n" |
724 | - " .word 0b,8b\n" |
725 | + STR(PTR) " 1b,8b\n" |
726 | + STR(PTR) " 2b,8b\n" |
727 | + STR(PTR) " 3b,8b\n" |
728 | + STR(PTR) " 4b,8b\n" |
729 | + STR(PTR) " 5b,8b\n" |
730 | + STR(PTR) " 6b,8b\n" |
731 | + STR(PTR) " 7b,8b\n" |
732 | + STR(PTR) " 0b,8b\n" |
733 | " .previous\n" |
734 | " .set pop\n" |
735 | : "+&r"(rt), "=&r"(rs), |
736 | @@ -2000,7 +2001,7 @@ fpu_emul: |
737 | "j 2b\n" |
738 | ".previous\n" |
739 | ".section __ex_table,\"a\"\n" |
740 | - ".word 1b, 3b\n" |
741 | + STR(PTR) " 1b,3b\n" |
742 | ".previous\n" |
743 | : "=&r"(res), "+&r"(err) |
744 | : "r"(vaddr), "i"(SIGSEGV) |
745 | @@ -2058,7 +2059,7 @@ fpu_emul: |
746 | "j 2b\n" |
747 | ".previous\n" |
748 | ".section __ex_table,\"a\"\n" |
749 | - ".word 1b, 3b\n" |
750 | + STR(PTR) " 1b,3b\n" |
751 | ".previous\n" |
752 | : "+&r"(res), "+&r"(err) |
753 | : "r"(vaddr), "i"(SIGSEGV)); |
754 | @@ -2119,7 +2120,7 @@ fpu_emul: |
755 | "j 2b\n" |
756 | ".previous\n" |
757 | ".section __ex_table,\"a\"\n" |
758 | - ".word 1b, 3b\n" |
759 | + STR(PTR) " 1b,3b\n" |
760 | ".previous\n" |
761 | : "=&r"(res), "+&r"(err) |
762 | : "r"(vaddr), "i"(SIGSEGV) |
763 | @@ -2182,7 +2183,7 @@ fpu_emul: |
764 | "j 2b\n" |
765 | ".previous\n" |
766 | ".section __ex_table,\"a\"\n" |
767 | - ".word 1b, 3b\n" |
768 | + STR(PTR) " 1b,3b\n" |
769 | ".previous\n" |
770 | : "+&r"(res), "+&r"(err) |
771 | : "r"(vaddr), "i"(SIGSEGV)); |
772 | diff --git a/arch/mips/kernel/pm.c b/arch/mips/kernel/pm.c |
773 | index fefdf39d3df3..dc814892133c 100644 |
774 | --- a/arch/mips/kernel/pm.c |
775 | +++ b/arch/mips/kernel/pm.c |
776 | @@ -56,7 +56,7 @@ static void mips_cpu_restore(void) |
777 | write_c0_userlocal(current_thread_info()->tp_value); |
778 | |
779 | /* Restore watch registers */ |
780 | - __restore_watch(); |
781 | + __restore_watch(current); |
782 | } |
783 | |
784 | /** |
785 | diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c |
786 | index 92880cee449e..d83730cd2719 100644 |
787 | --- a/arch/mips/kernel/process.c |
788 | +++ b/arch/mips/kernel/process.c |
789 | @@ -455,7 +455,7 @@ unsigned long notrace unwind_stack_by_address(unsigned long stack_page, |
790 | *sp + sizeof(*regs) <= stack_page + THREAD_SIZE - 32) { |
791 | regs = (struct pt_regs *)*sp; |
792 | pc = regs->cp0_epc; |
793 | - if (__kernel_text_address(pc)) { |
794 | + if (!user_mode(regs) && __kernel_text_address(pc)) { |
795 | *sp = regs->regs[29]; |
796 | *ra = regs->regs[31]; |
797 | return pc; |
798 | @@ -580,11 +580,19 @@ int mips_get_process_fp_mode(struct task_struct *task) |
799 | return value; |
800 | } |
801 | |
802 | +static void prepare_for_fp_mode_switch(void *info) |
803 | +{ |
804 | + struct mm_struct *mm = info; |
805 | + |
806 | + if (current->mm == mm) |
807 | + lose_fpu(1); |
808 | +} |
809 | + |
810 | int mips_set_process_fp_mode(struct task_struct *task, unsigned int value) |
811 | { |
812 | const unsigned int known_bits = PR_FP_MODE_FR | PR_FP_MODE_FRE; |
813 | - unsigned long switch_count; |
814 | struct task_struct *t; |
815 | + int max_users; |
816 | |
817 | /* Check the value is valid */ |
818 | if (value & ~known_bits) |
819 | @@ -601,6 +609,9 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value) |
820 | if (!(value & PR_FP_MODE_FR) && cpu_has_fpu && cpu_has_mips_r6) |
821 | return -EOPNOTSUPP; |
822 | |
823 | + /* Proceed with the mode switch */ |
824 | + preempt_disable(); |
825 | + |
826 | /* Save FP & vector context, then disable FPU & MSA */ |
827 | if (task->signal == current->signal) |
828 | lose_fpu(1); |
829 | @@ -610,31 +621,17 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value) |
830 | smp_mb__after_atomic(); |
831 | |
832 | /* |
833 | - * If there are multiple online CPUs then wait until all threads whose |
834 | - * FP mode is about to change have been context switched. This approach |
835 | - * allows us to only worry about whether an FP mode switch is in |
836 | - * progress when FP is first used in a tasks time slice. Pretty much all |
837 | - * of the mode switch overhead can thus be confined to cases where mode |
838 | - * switches are actually occurring. That is, to here. However for the |
839 | - * thread performing the mode switch it may take a while... |
840 | + * If there are multiple online CPUs then force any which are running |
841 | + * threads in this process to lose their FPU context, which they can't |
842 | + * regain until fp_mode_switching is cleared later. |
843 | */ |
844 | if (num_online_cpus() > 1) { |
845 | - spin_lock_irq(&task->sighand->siglock); |
846 | - |
847 | - for_each_thread(task, t) { |
848 | - if (t == current) |
849 | - continue; |
850 | - |
851 | - switch_count = t->nvcsw + t->nivcsw; |
852 | + /* No need to send an IPI for the local CPU */ |
853 | + max_users = (task->mm == current->mm) ? 1 : 0; |
854 | |
855 | - do { |
856 | - spin_unlock_irq(&task->sighand->siglock); |
857 | - cond_resched(); |
858 | - spin_lock_irq(&task->sighand->siglock); |
859 | - } while ((t->nvcsw + t->nivcsw) == switch_count); |
860 | - } |
861 | - |
862 | - spin_unlock_irq(&task->sighand->siglock); |
863 | + if (atomic_read(¤t->mm->mm_users) > max_users) |
864 | + smp_call_function(prepare_for_fp_mode_switch, |
865 | + (void *)current->mm, 1); |
866 | } |
867 | |
868 | /* |
869 | @@ -659,6 +656,7 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value) |
870 | |
871 | /* Allow threads to use FP again */ |
872 | atomic_set(&task->mm->context.fp_mode_switching, 0); |
873 | + preempt_enable(); |
874 | |
875 | return 0; |
876 | } |
877 | diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c |
878 | index a5279b2f3198..4285d8b7c566 100644 |
879 | --- a/arch/mips/kernel/ptrace.c |
880 | +++ b/arch/mips/kernel/ptrace.c |
881 | @@ -57,8 +57,7 @@ static void init_fp_ctx(struct task_struct *target) |
882 | /* Begin with data registers set to all 1s... */ |
883 | memset(&target->thread.fpu.fpr, ~0, sizeof(target->thread.fpu.fpr)); |
884 | |
885 | - /* ...and FCSR zeroed */ |
886 | - target->thread.fpu.fcr31 = 0; |
887 | + /* FCSR has been preset by `mips_set_personality_nan'. */ |
888 | |
889 | /* |
890 | * Record that the target has "used" math, such that the context |
891 | @@ -80,6 +79,22 @@ void ptrace_disable(struct task_struct *child) |
892 | } |
893 | |
894 | /* |
895 | + * Poke at FCSR according to its mask. Don't set the cause bits as |
896 | + * this is currently not handled correctly in FP context restoration |
897 | + * and will cause an oops if a corresponding enable bit is set. |
898 | + */ |
899 | +static void ptrace_setfcr31(struct task_struct *child, u32 value) |
900 | +{ |
901 | + u32 fcr31; |
902 | + u32 mask; |
903 | + |
904 | + value &= ~FPU_CSR_ALL_X; |
905 | + fcr31 = child->thread.fpu.fcr31; |
906 | + mask = boot_cpu_data.fpu_msk31; |
907 | + child->thread.fpu.fcr31 = (value & ~mask) | (fcr31 & mask); |
908 | +} |
909 | + |
910 | +/* |
911 | * Read a general register set. We always use the 64-bit format, even |
912 | * for 32-bit kernels and for 32-bit processes on a 64-bit kernel. |
913 | * Registers are sign extended to fill the available space. |
914 | @@ -159,9 +174,7 @@ int ptrace_setfpregs(struct task_struct *child, __u32 __user *data) |
915 | { |
916 | union fpureg *fregs; |
917 | u64 fpr_val; |
918 | - u32 fcr31; |
919 | u32 value; |
920 | - u32 mask; |
921 | int i; |
922 | |
923 | if (!access_ok(VERIFY_READ, data, 33 * 8)) |
924 | @@ -176,9 +189,7 @@ int ptrace_setfpregs(struct task_struct *child, __u32 __user *data) |
925 | } |
926 | |
927 | __get_user(value, data + 64); |
928 | - fcr31 = child->thread.fpu.fcr31; |
929 | - mask = boot_cpu_data.fpu_msk31; |
930 | - child->thread.fpu.fcr31 = (value & ~mask) | (fcr31 & mask); |
931 | + ptrace_setfcr31(child, value); |
932 | |
933 | /* FIR may not be written. */ |
934 | |
935 | @@ -805,7 +816,7 @@ long arch_ptrace(struct task_struct *child, long request, |
936 | break; |
937 | #endif |
938 | case FPC_CSR: |
939 | - child->thread.fpu.fcr31 = data & ~FPU_CSR_ALL_X; |
940 | + ptrace_setfcr31(child, data); |
941 | break; |
942 | case DSP_BASE ... DSP_BASE + 5: { |
943 | dspreg_t *dregs; |
944 | diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S |
945 | index 17732f876eff..56d86b09c917 100644 |
946 | --- a/arch/mips/kernel/r4k_fpu.S |
947 | +++ b/arch/mips/kernel/r4k_fpu.S |
948 | @@ -244,17 +244,17 @@ LEAF(\name) |
949 | .set push |
950 | .set noat |
951 | #ifdef CONFIG_64BIT |
952 | - copy_u_d \wr, 1 |
953 | + copy_s_d \wr, 1 |
954 | EX sd $1, \off(\base) |
955 | #elif defined(CONFIG_CPU_LITTLE_ENDIAN) |
956 | - copy_u_w \wr, 2 |
957 | + copy_s_w \wr, 2 |
958 | EX sw $1, \off(\base) |
959 | - copy_u_w \wr, 3 |
960 | + copy_s_w \wr, 3 |
961 | EX sw $1, (\off+4)(\base) |
962 | #else /* CONFIG_CPU_BIG_ENDIAN */ |
963 | - copy_u_w \wr, 2 |
964 | + copy_s_w \wr, 2 |
965 | EX sw $1, (\off+4)(\base) |
966 | - copy_u_w \wr, 3 |
967 | + copy_s_w \wr, 3 |
968 | EX sw $1, \off(\base) |
969 | #endif |
970 | .set pop |
971 | diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c |
972 | index 4f607341a793..d20caacfdbd3 100644 |
973 | --- a/arch/mips/kernel/setup.c |
974 | +++ b/arch/mips/kernel/setup.c |
975 | @@ -706,6 +706,9 @@ static void __init arch_mem_init(char **cmdline_p) |
976 | for_each_memblock(reserved, reg) |
977 | if (reg->size != 0) |
978 | reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT); |
979 | + |
980 | + reserve_bootmem_region(__pa_symbol(&__nosave_begin), |
981 | + __pa_symbol(&__nosave_end)); /* Reserve for hibernation */ |
982 | } |
983 | |
984 | static void __init resource_init(void) |
985 | diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c |
986 | index bf792e2839a6..9e35b6b26aa8 100644 |
987 | --- a/arch/mips/kernel/signal.c |
988 | +++ b/arch/mips/kernel/signal.c |
989 | @@ -195,6 +195,9 @@ static int restore_msa_extcontext(void __user *buf, unsigned int size) |
990 | unsigned int csr; |
991 | int i, err; |
992 | |
993 | + if (!config_enabled(CONFIG_CPU_HAS_MSA)) |
994 | + return SIGSYS; |
995 | + |
996 | if (size != sizeof(*msa)) |
997 | return -EINVAL; |
998 | |
999 | @@ -398,8 +401,8 @@ int protected_restore_fp_context(void __user *sc) |
1000 | } |
1001 | |
1002 | fp_done: |
1003 | - if (used & USED_EXTCONTEXT) |
1004 | - err |= restore_extcontext(sc_to_extcontext(sc)); |
1005 | + if (!err && (used & USED_EXTCONTEXT)) |
1006 | + err = restore_extcontext(sc_to_extcontext(sc)); |
1007 | |
1008 | return err ?: sig; |
1009 | } |
1010 | @@ -767,15 +770,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) |
1011 | sigset_t *oldset = sigmask_to_save(); |
1012 | int ret; |
1013 | struct mips_abi *abi = current->thread.abi; |
1014 | -#ifdef CONFIG_CPU_MICROMIPS |
1015 | - void *vdso; |
1016 | - unsigned long tmp = (unsigned long)current->mm->context.vdso; |
1017 | - |
1018 | - set_isa16_mode(tmp); |
1019 | - vdso = (void *)tmp; |
1020 | -#else |
1021 | void *vdso = current->mm->context.vdso; |
1022 | -#endif |
1023 | |
1024 | if (regs->regs[0]) { |
1025 | switch(regs->regs[2]) { |
1026 | diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c |
1027 | index ae0c89d23ad7..5aa1d5c2659a 100644 |
1028 | --- a/arch/mips/kernel/traps.c |
1029 | +++ b/arch/mips/kernel/traps.c |
1030 | @@ -145,7 +145,7 @@ static void show_backtrace(struct task_struct *task, const struct pt_regs *regs) |
1031 | if (!task) |
1032 | task = current; |
1033 | |
1034 | - if (raw_show_trace || !__kernel_text_address(pc)) { |
1035 | + if (raw_show_trace || user_mode(regs) || !__kernel_text_address(pc)) { |
1036 | show_raw_backtrace(sp); |
1037 | return; |
1038 | } |
1039 | @@ -1249,7 +1249,7 @@ static int enable_restore_fp_context(int msa) |
1040 | err = init_fpu(); |
1041 | if (msa && !err) { |
1042 | enable_msa(); |
1043 | - _init_msa_upper(); |
1044 | + init_msa_upper(); |
1045 | set_thread_flag(TIF_USEDMSA); |
1046 | set_thread_flag(TIF_MSA_CTX_LIVE); |
1047 | } |
1048 | @@ -1312,7 +1312,7 @@ static int enable_restore_fp_context(int msa) |
1049 | */ |
1050 | prior_msa = test_and_set_thread_flag(TIF_MSA_CTX_LIVE); |
1051 | if (!prior_msa && was_fpu_owner) { |
1052 | - _init_msa_upper(); |
1053 | + init_msa_upper(); |
1054 | |
1055 | goto out; |
1056 | } |
1057 | @@ -1329,7 +1329,7 @@ static int enable_restore_fp_context(int msa) |
1058 | * of each vector register such that it cannot see data left |
1059 | * behind by another task. |
1060 | */ |
1061 | - _init_msa_upper(); |
1062 | + init_msa_upper(); |
1063 | } else { |
1064 | /* We need to restore the vector context. */ |
1065 | restore_msa(current); |
1066 | diff --git a/arch/mips/kernel/watch.c b/arch/mips/kernel/watch.c |
1067 | index 2a03abb5bd2c..9b78e375118e 100644 |
1068 | --- a/arch/mips/kernel/watch.c |
1069 | +++ b/arch/mips/kernel/watch.c |
1070 | @@ -15,10 +15,9 @@ |
1071 | * Install the watch registers for the current thread. A maximum of |
1072 | * four registers are installed although the machine may have more. |
1073 | */ |
1074 | -void mips_install_watch_registers(void) |
1075 | +void mips_install_watch_registers(struct task_struct *t) |
1076 | { |
1077 | - struct mips3264_watch_reg_state *watches = |
1078 | - ¤t->thread.watch.mips3264; |
1079 | + struct mips3264_watch_reg_state *watches = &t->thread.watch.mips3264; |
1080 | switch (current_cpu_data.watch_reg_use_cnt) { |
1081 | default: |
1082 | BUG(); |
1083 | diff --git a/arch/mips/lib/ashldi3.c b/arch/mips/lib/ashldi3.c |
1084 | index beb80f316095..927dc94a030f 100644 |
1085 | --- a/arch/mips/lib/ashldi3.c |
1086 | +++ b/arch/mips/lib/ashldi3.c |
1087 | @@ -2,7 +2,7 @@ |
1088 | |
1089 | #include "libgcc.h" |
1090 | |
1091 | -long long __ashldi3(long long u, word_type b) |
1092 | +long long notrace __ashldi3(long long u, word_type b) |
1093 | { |
1094 | DWunion uu, w; |
1095 | word_type bm; |
1096 | diff --git a/arch/mips/lib/ashrdi3.c b/arch/mips/lib/ashrdi3.c |
1097 | index c884a912b660..9fdf1a598428 100644 |
1098 | --- a/arch/mips/lib/ashrdi3.c |
1099 | +++ b/arch/mips/lib/ashrdi3.c |
1100 | @@ -2,7 +2,7 @@ |
1101 | |
1102 | #include "libgcc.h" |
1103 | |
1104 | -long long __ashrdi3(long long u, word_type b) |
1105 | +long long notrace __ashrdi3(long long u, word_type b) |
1106 | { |
1107 | DWunion uu, w; |
1108 | word_type bm; |
1109 | diff --git a/arch/mips/lib/bswapdi.c b/arch/mips/lib/bswapdi.c |
1110 | index 77e5f9c1f005..e3e77aa52c95 100644 |
1111 | --- a/arch/mips/lib/bswapdi.c |
1112 | +++ b/arch/mips/lib/bswapdi.c |
1113 | @@ -1,6 +1,6 @@ |
1114 | #include <linux/module.h> |
1115 | |
1116 | -unsigned long long __bswapdi2(unsigned long long u) |
1117 | +unsigned long long notrace __bswapdi2(unsigned long long u) |
1118 | { |
1119 | return (((u) & 0xff00000000000000ull) >> 56) | |
1120 | (((u) & 0x00ff000000000000ull) >> 40) | |
1121 | diff --git a/arch/mips/lib/bswapsi.c b/arch/mips/lib/bswapsi.c |
1122 | index 2b302ff121d2..530a8afe6fda 100644 |
1123 | --- a/arch/mips/lib/bswapsi.c |
1124 | +++ b/arch/mips/lib/bswapsi.c |
1125 | @@ -1,6 +1,6 @@ |
1126 | #include <linux/module.h> |
1127 | |
1128 | -unsigned int __bswapsi2(unsigned int u) |
1129 | +unsigned int notrace __bswapsi2(unsigned int u) |
1130 | { |
1131 | return (((u) & 0xff000000) >> 24) | |
1132 | (((u) & 0x00ff0000) >> 8) | |
1133 | diff --git a/arch/mips/lib/cmpdi2.c b/arch/mips/lib/cmpdi2.c |
1134 | index 8c1306437ed1..06857da96993 100644 |
1135 | --- a/arch/mips/lib/cmpdi2.c |
1136 | +++ b/arch/mips/lib/cmpdi2.c |
1137 | @@ -2,7 +2,7 @@ |
1138 | |
1139 | #include "libgcc.h" |
1140 | |
1141 | -word_type __cmpdi2(long long a, long long b) |
1142 | +word_type notrace __cmpdi2(long long a, long long b) |
1143 | { |
1144 | const DWunion au = { |
1145 | .ll = a |
1146 | diff --git a/arch/mips/lib/lshrdi3.c b/arch/mips/lib/lshrdi3.c |
1147 | index dcf8d6810b7c..364547449c65 100644 |
1148 | --- a/arch/mips/lib/lshrdi3.c |
1149 | +++ b/arch/mips/lib/lshrdi3.c |
1150 | @@ -2,7 +2,7 @@ |
1151 | |
1152 | #include "libgcc.h" |
1153 | |
1154 | -long long __lshrdi3(long long u, word_type b) |
1155 | +long long notrace __lshrdi3(long long u, word_type b) |
1156 | { |
1157 | DWunion uu, w; |
1158 | word_type bm; |
1159 | diff --git a/arch/mips/lib/ucmpdi2.c b/arch/mips/lib/ucmpdi2.c |
1160 | index bb4cb2f828ea..bd599f58234c 100644 |
1161 | --- a/arch/mips/lib/ucmpdi2.c |
1162 | +++ b/arch/mips/lib/ucmpdi2.c |
1163 | @@ -2,7 +2,7 @@ |
1164 | |
1165 | #include "libgcc.h" |
1166 | |
1167 | -word_type __ucmpdi2(unsigned long long a, unsigned long long b) |
1168 | +word_type notrace __ucmpdi2(unsigned long long a, unsigned long long b) |
1169 | { |
1170 | const DWunion au = {.ll = a}; |
1171 | const DWunion bu = {.ll = b}; |
1172 | diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform |
1173 | index 85d808924c94..0fce4608aa88 100644 |
1174 | --- a/arch/mips/loongson64/Platform |
1175 | +++ b/arch/mips/loongson64/Platform |
1176 | @@ -31,7 +31,7 @@ cflags-$(CONFIG_CPU_LOONGSON3) += -Wa,--trap |
1177 | # can't easily be used safely within the kbuild framework. |
1178 | # |
1179 | ifeq ($(call cc-ifversion, -ge, 0409, y), y) |
1180 | - ifeq ($(call ld-ifversion, -ge, 22500000, y), y) |
1181 | + ifeq ($(call ld-ifversion, -ge, 225000000, y), y) |
1182 | cflags-$(CONFIG_CPU_LOONGSON3) += \ |
1183 | $(call cc-option,-march=loongson3a -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) |
1184 | else |
1185 | diff --git a/arch/mips/loongson64/loongson-3/numa.c b/arch/mips/loongson64/loongson-3/numa.c |
1186 | index 6f9e010cec4d..282c5a8c2fcd 100644 |
1187 | --- a/arch/mips/loongson64/loongson-3/numa.c |
1188 | +++ b/arch/mips/loongson64/loongson-3/numa.c |
1189 | @@ -213,10 +213,10 @@ static void __init node_mem_init(unsigned int node) |
1190 | BOOTMEM_DEFAULT); |
1191 | |
1192 | if (node == 0 && node_end_pfn(0) >= (0xffffffff >> PAGE_SHIFT)) { |
1193 | - /* Reserve 0xff800000~0xffffffff for RS780E integrated GPU */ |
1194 | + /* Reserve 0xfe000000~0xffffffff for RS780E integrated GPU */ |
1195 | reserve_bootmem_node(NODE_DATA(node), |
1196 | - (node_addrspace_offset | 0xff800000), |
1197 | - 8 << 20, BOOTMEM_DEFAULT); |
1198 | + (node_addrspace_offset | 0xfe000000), |
1199 | + 32 << 20, BOOTMEM_DEFAULT); |
1200 | } |
1201 | |
1202 | sparse_memory_present_with_active_regions(node); |
1203 | diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c |
1204 | index cdfd44ffa51c..41d3e0e7defa 100644 |
1205 | --- a/arch/mips/math-emu/cp1emu.c |
1206 | +++ b/arch/mips/math-emu/cp1emu.c |
1207 | @@ -445,9 +445,11 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, |
1208 | case spec_op: |
1209 | switch (insn.r_format.func) { |
1210 | case jalr_op: |
1211 | - regs->regs[insn.r_format.rd] = |
1212 | - regs->cp0_epc + dec_insn.pc_inc + |
1213 | - dec_insn.next_pc_inc; |
1214 | + if (insn.r_format.rd != 0) { |
1215 | + regs->regs[insn.r_format.rd] = |
1216 | + regs->cp0_epc + dec_insn.pc_inc + |
1217 | + dec_insn.next_pc_inc; |
1218 | + } |
1219 | /* Fall through */ |
1220 | case jr_op: |
1221 | /* For R6, JR already emulated in jalr_op */ |
1222 | diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c |
1223 | index 3f159caf6dbc..bf04c6c479a4 100644 |
1224 | --- a/arch/mips/mm/cache.c |
1225 | +++ b/arch/mips/mm/cache.c |
1226 | @@ -16,6 +16,7 @@ |
1227 | #include <linux/mm.h> |
1228 | |
1229 | #include <asm/cacheflush.h> |
1230 | +#include <asm/highmem.h> |
1231 | #include <asm/processor.h> |
1232 | #include <asm/cpu.h> |
1233 | #include <asm/cpu-features.h> |
1234 | @@ -83,8 +84,6 @@ void __flush_dcache_page(struct page *page) |
1235 | struct address_space *mapping = page_mapping(page); |
1236 | unsigned long addr; |
1237 | |
1238 | - if (PageHighMem(page)) |
1239 | - return; |
1240 | if (mapping && !mapping_mapped(mapping)) { |
1241 | SetPageDcacheDirty(page); |
1242 | return; |
1243 | @@ -95,8 +94,15 @@ void __flush_dcache_page(struct page *page) |
1244 | * case is for exec env/arg pages and those are %99 certainly going to |
1245 | * get faulted into the tlb (and thus flushed) anyways. |
1246 | */ |
1247 | - addr = (unsigned long) page_address(page); |
1248 | + if (PageHighMem(page)) |
1249 | + addr = (unsigned long)kmap_atomic(page); |
1250 | + else |
1251 | + addr = (unsigned long)page_address(page); |
1252 | + |
1253 | flush_data_cache_page(addr); |
1254 | + |
1255 | + if (PageHighMem(page)) |
1256 | + __kunmap_atomic((void *)addr); |
1257 | } |
1258 | |
1259 | EXPORT_SYMBOL(__flush_dcache_page); |
1260 | @@ -119,33 +125,28 @@ void __flush_anon_page(struct page *page, unsigned long vmaddr) |
1261 | |
1262 | EXPORT_SYMBOL(__flush_anon_page); |
1263 | |
1264 | -void __flush_icache_page(struct vm_area_struct *vma, struct page *page) |
1265 | -{ |
1266 | - unsigned long addr; |
1267 | - |
1268 | - if (PageHighMem(page)) |
1269 | - return; |
1270 | - |
1271 | - addr = (unsigned long) page_address(page); |
1272 | - flush_data_cache_page(addr); |
1273 | -} |
1274 | -EXPORT_SYMBOL_GPL(__flush_icache_page); |
1275 | - |
1276 | -void __update_cache(struct vm_area_struct *vma, unsigned long address, |
1277 | - pte_t pte) |
1278 | +void __update_cache(unsigned long address, pte_t pte) |
1279 | { |
1280 | struct page *page; |
1281 | unsigned long pfn, addr; |
1282 | - int exec = (vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc; |
1283 | + int exec = !pte_no_exec(pte) && !cpu_has_ic_fills_f_dc; |
1284 | |
1285 | pfn = pte_pfn(pte); |
1286 | if (unlikely(!pfn_valid(pfn))) |
1287 | return; |
1288 | page = pfn_to_page(pfn); |
1289 | - if (page_mapping(page) && Page_dcache_dirty(page)) { |
1290 | - addr = (unsigned long) page_address(page); |
1291 | + if (Page_dcache_dirty(page)) { |
1292 | + if (PageHighMem(page)) |
1293 | + addr = (unsigned long)kmap_atomic(page); |
1294 | + else |
1295 | + addr = (unsigned long)page_address(page); |
1296 | + |
1297 | if (exec || pages_do_alias(addr, address & PAGE_MASK)) |
1298 | flush_data_cache_page(addr); |
1299 | + |
1300 | + if (PageHighMem(page)) |
1301 | + __kunmap_atomic((void *)addr); |
1302 | + |
1303 | ClearPageDcacheDirty(page); |
1304 | } |
1305 | } |
1306 | diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile |
1307 | index ee3617c0c5e2..f37e6ba40f52 100644 |
1308 | --- a/arch/mips/vdso/Makefile |
1309 | +++ b/arch/mips/vdso/Makefile |
1310 | @@ -5,10 +5,12 @@ obj-vdso-y := elf.o gettimeofday.o sigreturn.o |
1311 | ccflags-vdso := \ |
1312 | $(filter -I%,$(KBUILD_CFLAGS)) \ |
1313 | $(filter -E%,$(KBUILD_CFLAGS)) \ |
1314 | + $(filter -mmicromips,$(KBUILD_CFLAGS)) \ |
1315 | $(filter -march=%,$(KBUILD_CFLAGS)) |
1316 | cflags-vdso := $(ccflags-vdso) \ |
1317 | $(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \ |
1318 | - -O2 -g -fPIC -fno-common -fno-builtin -G 0 -DDISABLE_BRANCH_PROFILING \ |
1319 | + -O2 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \ |
1320 | + -DDISABLE_BRANCH_PROFILING \ |
1321 | $(call cc-option, -fno-stack-protector) |
1322 | aflags-vdso := $(ccflags-vdso) \ |
1323 | $(filter -I%,$(KBUILD_CFLAGS)) \ |
1324 | diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c |
1325 | index 6544017eb90b..67584847973a 100644 |
1326 | --- a/arch/powerpc/kernel/eeh.c |
1327 | +++ b/arch/powerpc/kernel/eeh.c |
1328 | @@ -1068,7 +1068,7 @@ void eeh_add_device_early(struct pci_dn *pdn) |
1329 | struct pci_controller *phb; |
1330 | struct eeh_dev *edev = pdn_to_eeh_dev(pdn); |
1331 | |
1332 | - if (!edev || !eeh_enabled()) |
1333 | + if (!edev) |
1334 | return; |
1335 | |
1336 | if (!eeh_has_flag(EEH_PROBE_MODE_DEVTREE)) |
1337 | diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c |
1338 | index fb6207d2c604..31e4c7e1a4b4 100644 |
1339 | --- a/arch/powerpc/kernel/eeh_driver.c |
1340 | +++ b/arch/powerpc/kernel/eeh_driver.c |
1341 | @@ -171,6 +171,16 @@ static void *eeh_dev_save_state(void *data, void *userdata) |
1342 | if (!edev) |
1343 | return NULL; |
1344 | |
1345 | + /* |
1346 | + * We cannot access the config space on some adapters. |
1347 | + * Otherwise, it will cause fenced PHB. We don't save |
1348 | + * the content in their config space and will restore |
1349 | + * from the initial config space saved when the EEH |
1350 | + * device is created. |
1351 | + */ |
1352 | + if (edev->pe && (edev->pe->state & EEH_PE_CFG_RESTRICTED)) |
1353 | + return NULL; |
1354 | + |
1355 | pdev = eeh_dev_to_pci_dev(edev); |
1356 | if (!pdev) |
1357 | return NULL; |
1358 | @@ -312,6 +322,19 @@ static void *eeh_dev_restore_state(void *data, void *userdata) |
1359 | if (!edev) |
1360 | return NULL; |
1361 | |
1362 | + /* |
1363 | + * The content in the config space isn't saved because |
1364 | + * the blocked config space on some adapters. We have |
1365 | + * to restore the initial saved config space when the |
1366 | + * EEH device is created. |
1367 | + */ |
1368 | + if (edev->pe && (edev->pe->state & EEH_PE_CFG_RESTRICTED)) { |
1369 | + if (list_is_last(&edev->list, &edev->pe->edevs)) |
1370 | + eeh_pe_restore_bars(edev->pe); |
1371 | + |
1372 | + return NULL; |
1373 | + } |
1374 | + |
1375 | pdev = eeh_dev_to_pci_dev(edev); |
1376 | if (!pdev) |
1377 | return NULL; |
1378 | @@ -564,9 +587,6 @@ int eeh_pe_reset_and_recover(struct eeh_pe *pe) |
1379 | /* Save states */ |
1380 | eeh_pe_dev_traverse(pe, eeh_dev_save_state, NULL); |
1381 | |
1382 | - /* Report error */ |
1383 | - eeh_pe_dev_traverse(pe, eeh_report_error, &result); |
1384 | - |
1385 | /* Issue reset */ |
1386 | ret = eeh_reset_pe(pe); |
1387 | if (ret) { |
1388 | diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S |
1389 | index 7716cebf4b8e..2b66f25d40db 100644 |
1390 | --- a/arch/powerpc/kernel/exceptions-64s.S |
1391 | +++ b/arch/powerpc/kernel/exceptions-64s.S |
1392 | @@ -953,11 +953,6 @@ hv_facility_unavailable_relon_trampoline: |
1393 | #endif |
1394 | STD_RELON_EXCEPTION_PSERIES(0x5700, 0x1700, altivec_assist) |
1395 | |
1396 | - /* Other future vectors */ |
1397 | - .align 7 |
1398 | - .globl __end_interrupts |
1399 | -__end_interrupts: |
1400 | - |
1401 | .align 7 |
1402 | system_call_entry: |
1403 | b system_call_common |
1404 | @@ -1244,6 +1239,17 @@ __end_handlers: |
1405 | STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable) |
1406 | STD_RELON_EXCEPTION_HV_OOL(0xf80, hv_facility_unavailable) |
1407 | |
1408 | + /* |
1409 | + * The __end_interrupts marker must be past the out-of-line (OOL) |
1410 | + * handlers, so that they are copied to real address 0x100 when running |
1411 | + * a relocatable kernel. This ensures they can be reached from the short |
1412 | + * trampoline handlers (like 0x4f00, 0x4f20, etc.) which branch |
1413 | + * directly, without using LOAD_HANDLER(). |
1414 | + */ |
1415 | + .align 7 |
1416 | + .globl __end_interrupts |
1417 | +__end_interrupts: |
1418 | + |
1419 | #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) |
1420 | /* |
1421 | * Data area reserved for FWNMI option. |
1422 | diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c |
1423 | index 7ab29518a3b9..e345891450c3 100644 |
1424 | --- a/arch/x86/xen/setup.c |
1425 | +++ b/arch/x86/xen/setup.c |
1426 | @@ -393,6 +393,9 @@ static unsigned long __init xen_set_identity_and_remap_chunk( |
1427 | unsigned long i = 0; |
1428 | unsigned long n = end_pfn - start_pfn; |
1429 | |
1430 | + if (remap_pfn == 0) |
1431 | + remap_pfn = nr_pages; |
1432 | + |
1433 | while (i < n) { |
1434 | unsigned long cur_pfn = start_pfn + i; |
1435 | unsigned long left = n - i; |
1436 | @@ -438,17 +441,29 @@ static unsigned long __init xen_set_identity_and_remap_chunk( |
1437 | return remap_pfn; |
1438 | } |
1439 | |
1440 | -static void __init xen_set_identity_and_remap(unsigned long nr_pages) |
1441 | +static unsigned long __init xen_count_remap_pages( |
1442 | + unsigned long start_pfn, unsigned long end_pfn, unsigned long nr_pages, |
1443 | + unsigned long remap_pages) |
1444 | +{ |
1445 | + if (start_pfn >= nr_pages) |
1446 | + return remap_pages; |
1447 | + |
1448 | + return remap_pages + min(end_pfn, nr_pages) - start_pfn; |
1449 | +} |
1450 | + |
1451 | +static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, |
1452 | + unsigned long (*func)(unsigned long start_pfn, unsigned long end_pfn, |
1453 | + unsigned long nr_pages, unsigned long last_val)) |
1454 | { |
1455 | phys_addr_t start = 0; |
1456 | - unsigned long last_pfn = nr_pages; |
1457 | + unsigned long ret_val = 0; |
1458 | const struct e820entry *entry = xen_e820_map; |
1459 | int i; |
1460 | |
1461 | /* |
1462 | * Combine non-RAM regions and gaps until a RAM region (or the |
1463 | - * end of the map) is reached, then set the 1:1 map and |
1464 | - * remap the memory in those non-RAM regions. |
1465 | + * end of the map) is reached, then call the provided function |
1466 | + * to perform its duty on the non-RAM region. |
1467 | * |
1468 | * The combined non-RAM regions are rounded to a whole number |
1469 | * of pages so any partial pages are accessible via the 1:1 |
1470 | @@ -466,14 +481,13 @@ static void __init xen_set_identity_and_remap(unsigned long nr_pages) |
1471 | end_pfn = PFN_UP(entry->addr); |
1472 | |
1473 | if (start_pfn < end_pfn) |
1474 | - last_pfn = xen_set_identity_and_remap_chunk( |
1475 | - start_pfn, end_pfn, nr_pages, |
1476 | - last_pfn); |
1477 | + ret_val = func(start_pfn, end_pfn, nr_pages, |
1478 | + ret_val); |
1479 | start = end; |
1480 | } |
1481 | } |
1482 | |
1483 | - pr_info("Released %ld page(s)\n", xen_released_pages); |
1484 | + return ret_val; |
1485 | } |
1486 | |
1487 | /* |
1488 | @@ -596,35 +610,6 @@ static void __init xen_ignore_unusable(void) |
1489 | } |
1490 | } |
1491 | |
1492 | -static unsigned long __init xen_count_remap_pages(unsigned long max_pfn) |
1493 | -{ |
1494 | - unsigned long extra = 0; |
1495 | - unsigned long start_pfn, end_pfn; |
1496 | - const struct e820entry *entry = xen_e820_map; |
1497 | - int i; |
1498 | - |
1499 | - end_pfn = 0; |
1500 | - for (i = 0; i < xen_e820_map_entries; i++, entry++) { |
1501 | - start_pfn = PFN_DOWN(entry->addr); |
1502 | - /* Adjacent regions on non-page boundaries handling! */ |
1503 | - end_pfn = min(end_pfn, start_pfn); |
1504 | - |
1505 | - if (start_pfn >= max_pfn) |
1506 | - return extra + max_pfn - end_pfn; |
1507 | - |
1508 | - /* Add any holes in map to result. */ |
1509 | - extra += start_pfn - end_pfn; |
1510 | - |
1511 | - end_pfn = PFN_UP(entry->addr + entry->size); |
1512 | - end_pfn = min(end_pfn, max_pfn); |
1513 | - |
1514 | - if (entry->type != E820_RAM) |
1515 | - extra += end_pfn - start_pfn; |
1516 | - } |
1517 | - |
1518 | - return extra; |
1519 | -} |
1520 | - |
1521 | bool __init xen_is_e820_reserved(phys_addr_t start, phys_addr_t size) |
1522 | { |
1523 | struct e820entry *entry; |
1524 | @@ -804,7 +789,7 @@ char * __init xen_memory_setup(void) |
1525 | max_pages = xen_get_max_pages(); |
1526 | |
1527 | /* How many extra pages do we need due to remapping? */ |
1528 | - max_pages += xen_count_remap_pages(max_pfn); |
1529 | + max_pages += xen_foreach_remap_area(max_pfn, xen_count_remap_pages); |
1530 | |
1531 | if (max_pages > max_pfn) |
1532 | extra_pages += max_pages - max_pfn; |
1533 | @@ -922,7 +907,9 @@ char * __init xen_memory_setup(void) |
1534 | * Set identity map on non-RAM pages and prepare remapping the |
1535 | * underlying RAM. |
1536 | */ |
1537 | - xen_set_identity_and_remap(max_pfn); |
1538 | + xen_foreach_remap_area(max_pfn, xen_set_identity_and_remap_chunk); |
1539 | + |
1540 | + pr_info("Released %ld page(s)\n", xen_released_pages); |
1541 | |
1542 | return "Xen"; |
1543 | } |
1544 | diff --git a/crypto/asymmetric_keys/pkcs7_parser.c b/crypto/asymmetric_keys/pkcs7_parser.c |
1545 | index 40de03f49ff8..bdd0d753ce5d 100644 |
1546 | --- a/crypto/asymmetric_keys/pkcs7_parser.c |
1547 | +++ b/crypto/asymmetric_keys/pkcs7_parser.c |
1548 | @@ -237,6 +237,7 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen, |
1549 | break; |
1550 | case OID_sha224: |
1551 | ctx->sinfo->sig.hash_algo = "sha224"; |
1552 | + break; |
1553 | default: |
1554 | printk("Unsupported digest algo: %u\n", ctx->last_oid); |
1555 | return -ENOPKG; |
1556 | diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c |
1557 | index 6e7c3ccea24b..27aea96036c4 100644 |
1558 | --- a/drivers/base/power/main.c |
1559 | +++ b/drivers/base/power/main.c |
1560 | @@ -1267,14 +1267,15 @@ int dpm_suspend_late(pm_message_t state) |
1561 | error = device_suspend_late(dev); |
1562 | |
1563 | mutex_lock(&dpm_list_mtx); |
1564 | + if (!list_empty(&dev->power.entry)) |
1565 | + list_move(&dev->power.entry, &dpm_late_early_list); |
1566 | + |
1567 | if (error) { |
1568 | pm_dev_err(dev, state, " late", error); |
1569 | dpm_save_failed_dev(dev_name(dev)); |
1570 | put_device(dev); |
1571 | break; |
1572 | } |
1573 | - if (!list_empty(&dev->power.entry)) |
1574 | - list_move(&dev->power.entry, &dpm_late_early_list); |
1575 | put_device(dev); |
1576 | |
1577 | if (async_error) |
1578 | diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c |
1579 | index 4c7055009bd6..b74690418504 100644 |
1580 | --- a/drivers/base/power/runtime.c |
1581 | +++ b/drivers/base/power/runtime.c |
1582 | @@ -1506,11 +1506,16 @@ int pm_runtime_force_resume(struct device *dev) |
1583 | goto out; |
1584 | } |
1585 | |
1586 | - ret = callback(dev); |
1587 | + ret = pm_runtime_set_active(dev); |
1588 | if (ret) |
1589 | goto out; |
1590 | |
1591 | - pm_runtime_set_active(dev); |
1592 | + ret = callback(dev); |
1593 | + if (ret) { |
1594 | + pm_runtime_set_suspended(dev); |
1595 | + goto out; |
1596 | + } |
1597 | + |
1598 | pm_runtime_mark_last_busy(dev); |
1599 | out: |
1600 | pm_runtime_enable(dev); |
1601 | diff --git a/drivers/char/hw_random/exynos-rng.c b/drivers/char/hw_random/exynos-rng.c |
1602 | index ada081232528..b98a141ea89c 100644 |
1603 | --- a/drivers/char/hw_random/exynos-rng.c |
1604 | +++ b/drivers/char/hw_random/exynos-rng.c |
1605 | @@ -89,6 +89,7 @@ static int exynos_read(struct hwrng *rng, void *buf, |
1606 | struct exynos_rng, rng); |
1607 | u32 *data = buf; |
1608 | int retry = 100; |
1609 | + int ret = 4; |
1610 | |
1611 | pm_runtime_get_sync(exynos_rng->dev); |
1612 | |
1613 | @@ -97,17 +98,20 @@ static int exynos_read(struct hwrng *rng, void *buf, |
1614 | while (!(exynos_rng_readl(exynos_rng, |
1615 | EXYNOS_PRNG_STATUS_OFFSET) & PRNG_DONE) && --retry) |
1616 | cpu_relax(); |
1617 | - if (!retry) |
1618 | - return -ETIMEDOUT; |
1619 | + if (!retry) { |
1620 | + ret = -ETIMEDOUT; |
1621 | + goto out; |
1622 | + } |
1623 | |
1624 | exynos_rng_writel(exynos_rng, PRNG_DONE, EXYNOS_PRNG_STATUS_OFFSET); |
1625 | |
1626 | *data = exynos_rng_readl(exynos_rng, EXYNOS_PRNG_OUT1_OFFSET); |
1627 | |
1628 | +out: |
1629 | pm_runtime_mark_last_busy(exynos_rng->dev); |
1630 | pm_runtime_put_sync_autosuspend(exynos_rng->dev); |
1631 | |
1632 | - return 4; |
1633 | + return ret; |
1634 | } |
1635 | |
1636 | static int exynos_rng_probe(struct platform_device *pdev) |
1637 | diff --git a/drivers/clk/at91/clk-h32mx.c b/drivers/clk/at91/clk-h32mx.c |
1638 | index 819f5842fa66..8e20c8a76db7 100644 |
1639 | --- a/drivers/clk/at91/clk-h32mx.c |
1640 | +++ b/drivers/clk/at91/clk-h32mx.c |
1641 | @@ -114,7 +114,7 @@ static void __init of_sama5d4_clk_h32mx_setup(struct device_node *np) |
1642 | h32mxclk->regmap = regmap; |
1643 | |
1644 | clk = clk_register(NULL, &h32mxclk->hw); |
1645 | - if (!clk) { |
1646 | + if (IS_ERR(clk)) { |
1647 | kfree(h32mxclk); |
1648 | return; |
1649 | } |
1650 | diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c |
1651 | index 90338c38e38a..1f79f48d5adc 100644 |
1652 | --- a/drivers/clk/bcm/clk-bcm2835.c |
1653 | +++ b/drivers/clk/bcm/clk-bcm2835.c |
1654 | @@ -51,6 +51,7 @@ |
1655 | #define CM_GNRICCTL 0x000 |
1656 | #define CM_GNRICDIV 0x004 |
1657 | # define CM_DIV_FRAC_BITS 12 |
1658 | +# define CM_DIV_FRAC_MASK GENMASK(CM_DIV_FRAC_BITS - 1, 0) |
1659 | |
1660 | #define CM_VPUCTL 0x008 |
1661 | #define CM_VPUDIV 0x00c |
1662 | @@ -128,6 +129,7 @@ |
1663 | # define CM_GATE BIT(CM_GATE_BIT) |
1664 | # define CM_BUSY BIT(7) |
1665 | # define CM_BUSYD BIT(8) |
1666 | +# define CM_FRAC BIT(9) |
1667 | # define CM_SRC_SHIFT 0 |
1668 | # define CM_SRC_BITS 4 |
1669 | # define CM_SRC_MASK 0xf |
1670 | @@ -644,6 +646,7 @@ struct bcm2835_clock_data { |
1671 | u32 frac_bits; |
1672 | |
1673 | bool is_vpu_clock; |
1674 | + bool is_mash_clock; |
1675 | }; |
1676 | |
1677 | static const char *const bcm2835_clock_per_parents[] = { |
1678 | @@ -825,6 +828,7 @@ static const struct bcm2835_clock_data bcm2835_clock_pwm_data = { |
1679 | .div_reg = CM_PWMDIV, |
1680 | .int_bits = 12, |
1681 | .frac_bits = 12, |
1682 | + .is_mash_clock = true, |
1683 | }; |
1684 | |
1685 | struct bcm2835_pll { |
1686 | @@ -910,8 +914,14 @@ static void bcm2835_pll_off(struct clk_hw *hw) |
1687 | struct bcm2835_cprman *cprman = pll->cprman; |
1688 | const struct bcm2835_pll_data *data = pll->data; |
1689 | |
1690 | - cprman_write(cprman, data->cm_ctrl_reg, CM_PLL_ANARST); |
1691 | - cprman_write(cprman, data->a2w_ctrl_reg, A2W_PLL_CTRL_PWRDN); |
1692 | + spin_lock(&cprman->regs_lock); |
1693 | + cprman_write(cprman, data->cm_ctrl_reg, |
1694 | + cprman_read(cprman, data->cm_ctrl_reg) | |
1695 | + CM_PLL_ANARST); |
1696 | + cprman_write(cprman, data->a2w_ctrl_reg, |
1697 | + cprman_read(cprman, data->a2w_ctrl_reg) | |
1698 | + A2W_PLL_CTRL_PWRDN); |
1699 | + spin_unlock(&cprman->regs_lock); |
1700 | } |
1701 | |
1702 | static int bcm2835_pll_on(struct clk_hw *hw) |
1703 | @@ -921,6 +931,10 @@ static int bcm2835_pll_on(struct clk_hw *hw) |
1704 | const struct bcm2835_pll_data *data = pll->data; |
1705 | ktime_t timeout; |
1706 | |
1707 | + cprman_write(cprman, data->a2w_ctrl_reg, |
1708 | + cprman_read(cprman, data->a2w_ctrl_reg) & |
1709 | + ~A2W_PLL_CTRL_PWRDN); |
1710 | + |
1711 | /* Take the PLL out of reset. */ |
1712 | cprman_write(cprman, data->cm_ctrl_reg, |
1713 | cprman_read(cprman, data->cm_ctrl_reg) & ~CM_PLL_ANARST); |
1714 | @@ -1174,7 +1188,7 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, |
1715 | GENMASK(CM_DIV_FRAC_BITS - data->frac_bits, 0) >> 1; |
1716 | u64 temp = (u64)parent_rate << CM_DIV_FRAC_BITS; |
1717 | u64 rem; |
1718 | - u32 div; |
1719 | + u32 div, mindiv, maxdiv; |
1720 | |
1721 | rem = do_div(temp, rate); |
1722 | div = temp; |
1723 | @@ -1184,10 +1198,23 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, |
1724 | div += unused_frac_mask + 1; |
1725 | div &= ~unused_frac_mask; |
1726 | |
1727 | - /* Clamp to the limits. */ |
1728 | - div = max(div, unused_frac_mask + 1); |
1729 | - div = min_t(u32, div, GENMASK(data->int_bits + CM_DIV_FRAC_BITS - 1, |
1730 | - CM_DIV_FRAC_BITS - data->frac_bits)); |
1731 | + /* different clamping limits apply for a mash clock */ |
1732 | + if (data->is_mash_clock) { |
1733 | + /* clamp to min divider of 2 */ |
1734 | + mindiv = 2 << CM_DIV_FRAC_BITS; |
1735 | + /* clamp to the highest possible integer divider */ |
1736 | + maxdiv = (BIT(data->int_bits) - 1) << CM_DIV_FRAC_BITS; |
1737 | + } else { |
1738 | + /* clamp to min divider of 1 */ |
1739 | + mindiv = 1 << CM_DIV_FRAC_BITS; |
1740 | + /* clamp to the highest possible fractional divider */ |
1741 | + maxdiv = GENMASK(data->int_bits + CM_DIV_FRAC_BITS - 1, |
1742 | + CM_DIV_FRAC_BITS - data->frac_bits); |
1743 | + } |
1744 | + |
1745 | + /* apply the clamping limits */ |
1746 | + div = max_t(u32, div, mindiv); |
1747 | + div = min_t(u32, div, maxdiv); |
1748 | |
1749 | return div; |
1750 | } |
1751 | @@ -1281,9 +1308,26 @@ static int bcm2835_clock_set_rate(struct clk_hw *hw, |
1752 | struct bcm2835_cprman *cprman = clock->cprman; |
1753 | const struct bcm2835_clock_data *data = clock->data; |
1754 | u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate, false); |
1755 | + u32 ctl; |
1756 | + |
1757 | + spin_lock(&cprman->regs_lock); |
1758 | + |
1759 | + /* |
1760 | + * Setting up frac support |
1761 | + * |
1762 | + * In principle it is recommended to stop/start the clock first, |
1763 | + * but as we set CLK_SET_RATE_GATE during registration of the |
1764 | + * clock this requirement should be take care of by the |
1765 | + * clk-framework. |
1766 | + */ |
1767 | + ctl = cprman_read(cprman, data->ctl_reg) & ~CM_FRAC; |
1768 | + ctl |= (div & CM_DIV_FRAC_MASK) ? CM_FRAC : 0; |
1769 | + cprman_write(cprman, data->ctl_reg, ctl); |
1770 | |
1771 | cprman_write(cprman, data->div_reg, div); |
1772 | |
1773 | + spin_unlock(&cprman->regs_lock); |
1774 | + |
1775 | return 0; |
1776 | } |
1777 | |
1778 | diff --git a/drivers/clk/imx/clk-imx35.c b/drivers/clk/imx/clk-imx35.c |
1779 | index a71d24cb4c06..b0978d3b83e2 100644 |
1780 | --- a/drivers/clk/imx/clk-imx35.c |
1781 | +++ b/drivers/clk/imx/clk-imx35.c |
1782 | @@ -66,7 +66,7 @@ static const char *std_sel[] = {"ppll", "arm"}; |
1783 | static const char *ipg_per_sel[] = {"ahb_per_div", "arm_per_div"}; |
1784 | |
1785 | enum mx35_clks { |
1786 | - ckih, ckil, mpll, ppll, mpll_075, arm, hsp, hsp_div, hsp_sel, ahb, ipg, |
1787 | + ckih, mpll, ppll, mpll_075, arm, hsp, hsp_div, hsp_sel, ahb, ipg, |
1788 | arm_per_div, ahb_per_div, ipg_per, uart_sel, uart_div, esdhc_sel, |
1789 | esdhc1_div, esdhc2_div, esdhc3_div, spdif_sel, spdif_div_pre, |
1790 | spdif_div_post, ssi_sel, ssi1_div_pre, ssi1_div_post, ssi2_div_pre, |
1791 | @@ -79,7 +79,7 @@ enum mx35_clks { |
1792 | rtc_gate, rtic_gate, scc_gate, sdma_gate, spba_gate, spdif_gate, |
1793 | ssi1_gate, ssi2_gate, uart1_gate, uart2_gate, uart3_gate, usbotg_gate, |
1794 | wdog_gate, max_gate, admux_gate, csi_gate, csi_div, csi_sel, iim_gate, |
1795 | - gpu2d_gate, clk_max |
1796 | + gpu2d_gate, ckil, clk_max |
1797 | }; |
1798 | |
1799 | static struct clk *clk[clk_max]; |
1800 | diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c |
1801 | index f996efc56605..0db185762a10 100644 |
1802 | --- a/drivers/cpuidle/cpuidle.c |
1803 | +++ b/drivers/cpuidle/cpuidle.c |
1804 | @@ -214,7 +214,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, |
1805 | tick_broadcast_exit(); |
1806 | } |
1807 | |
1808 | - if (!cpuidle_state_is_coupled(drv, entered_state)) |
1809 | + if (!cpuidle_state_is_coupled(drv, index)) |
1810 | local_irq_enable(); |
1811 | |
1812 | diff = ktime_to_us(ktime_sub(time_end, time_start)); |
1813 | @@ -433,6 +433,8 @@ static void __cpuidle_unregister_device(struct cpuidle_device *dev) |
1814 | list_del(&dev->device_list); |
1815 | per_cpu(cpuidle_devices, dev->cpu) = NULL; |
1816 | module_put(drv->owner); |
1817 | + |
1818 | + dev->registered = 0; |
1819 | } |
1820 | |
1821 | static void __cpuidle_device_init(struct cpuidle_device *dev) |
1822 | diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile |
1823 | index 6eb94fc561dc..22228ef50f36 100644 |
1824 | --- a/drivers/gpu/drm/Makefile |
1825 | +++ b/drivers/gpu/drm/Makefile |
1826 | @@ -23,7 +23,7 @@ drm-$(CONFIG_AGP) += drm_agpsupport.o |
1827 | |
1828 | drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \ |
1829 | drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \ |
1830 | - drm_kms_helper_common.o |
1831 | + drm_kms_helper_common.o drm_dp_dual_mode_helper.o |
1832 | |
1833 | drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o |
1834 | drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o |
1835 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
1836 | index 119cdc2c43e7..7ef2c13921b4 100644 |
1837 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
1838 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
1839 | @@ -194,12 +194,12 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector) |
1840 | bpc = 8; |
1841 | DRM_DEBUG("%s: HDMI deep color 10 bpc exceeds max tmds clock. Using %d bpc.\n", |
1842 | connector->name, bpc); |
1843 | - } else if (bpc > 8) { |
1844 | - /* max_tmds_clock missing, but hdmi spec mandates it for deep color. */ |
1845 | - DRM_DEBUG("%s: Required max tmds clock for HDMI deep color missing. Using 8 bpc.\n", |
1846 | - connector->name); |
1847 | - bpc = 8; |
1848 | } |
1849 | + } else if (bpc > 8) { |
1850 | + /* max_tmds_clock missing, but hdmi spec mandates it for deep color. */ |
1851 | + DRM_DEBUG("%s: Required max tmds clock for HDMI deep color missing. Using 8 bpc.\n", |
1852 | + connector->name); |
1853 | + bpc = 8; |
1854 | } |
1855 | } |
1856 | |
1857 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c |
1858 | index 7b7f4aba60c0..fe36caf1b7d7 100644 |
1859 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c |
1860 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c |
1861 | @@ -150,7 +150,7 @@ u32 amdgpu_dpm_get_vrefresh(struct amdgpu_device *adev) |
1862 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
1863 | amdgpu_crtc = to_amdgpu_crtc(crtc); |
1864 | if (crtc->enabled && amdgpu_crtc->enabled && amdgpu_crtc->hw_mode.clock) { |
1865 | - vrefresh = amdgpu_crtc->hw_mode.vrefresh; |
1866 | + vrefresh = drm_mode_vrefresh(&amdgpu_crtc->hw_mode); |
1867 | break; |
1868 | } |
1869 | } |
1870 | diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c |
1871 | index 8ee1db866e80..d307d9627887 100644 |
1872 | --- a/drivers/gpu/drm/drm_atomic.c |
1873 | +++ b/drivers/gpu/drm/drm_atomic.c |
1874 | @@ -139,7 +139,7 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state) |
1875 | for (i = 0; i < state->num_connector; i++) { |
1876 | struct drm_connector *connector = state->connectors[i]; |
1877 | |
1878 | - if (!connector) |
1879 | + if (!connector || !connector->funcs) |
1880 | continue; |
1881 | |
1882 | /* |
1883 | diff --git a/drivers/gpu/drm/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/drm_dp_dual_mode_helper.c |
1884 | new file mode 100644 |
1885 | index 000000000000..a7b2a751f6fe |
1886 | --- /dev/null |
1887 | +++ b/drivers/gpu/drm/drm_dp_dual_mode_helper.c |
1888 | @@ -0,0 +1,366 @@ |
1889 | +/* |
1890 | + * Copyright © 2016 Intel Corporation |
1891 | + * |
1892 | + * Permission is hereby granted, free of charge, to any person obtaining a |
1893 | + * copy of this software and associated documentation files (the "Software"), |
1894 | + * to deal in the Software without restriction, including without limitation |
1895 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
1896 | + * and/or sell copies of the Software, and to permit persons to whom the |
1897 | + * Software is furnished to do so, subject to the following conditions: |
1898 | + * |
1899 | + * The above copyright notice and this permission notice shall be included in |
1900 | + * all copies or substantial portions of the Software. |
1901 | + * |
1902 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
1903 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
1904 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
1905 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
1906 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
1907 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
1908 | + * OTHER DEALINGS IN THE SOFTWARE. |
1909 | + */ |
1910 | + |
1911 | +#include <linux/errno.h> |
1912 | +#include <linux/export.h> |
1913 | +#include <linux/i2c.h> |
1914 | +#include <linux/slab.h> |
1915 | +#include <linux/string.h> |
1916 | +#include <drm/drm_dp_dual_mode_helper.h> |
1917 | +#include <drm/drmP.h> |
1918 | + |
1919 | +/** |
1920 | + * DOC: dp dual mode helpers |
1921 | + * |
1922 | + * Helper functions to deal with DP dual mode (aka. DP++) adaptors. |
1923 | + * |
1924 | + * Type 1: |
1925 | + * Adaptor registers (if any) and the sink DDC bus may be accessed via I2C. |
1926 | + * |
1927 | + * Type 2: |
1928 | + * Adaptor registers and sink DDC bus can be accessed either via I2C or |
1929 | + * I2C-over-AUX. Source devices may choose to implement either of these |
1930 | + * access methods. |
1931 | + */ |
1932 | + |
1933 | +#define DP_DUAL_MODE_SLAVE_ADDRESS 0x40 |
1934 | + |
1935 | +/** |
1936 | + * drm_dp_dual_mode_read - Read from the DP dual mode adaptor register(s) |
1937 | + * @adapter: I2C adapter for the DDC bus |
1938 | + * @offset: register offset |
1939 | + * @buffer: buffer for return data |
1940 | + * @size: sizo of the buffer |
1941 | + * |
1942 | + * Reads @size bytes from the DP dual mode adaptor registers |
1943 | + * starting at @offset. |
1944 | + * |
1945 | + * Returns: |
1946 | + * 0 on success, negative error code on failure |
1947 | + */ |
1948 | +ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter, |
1949 | + u8 offset, void *buffer, size_t size) |
1950 | +{ |
1951 | + struct i2c_msg msgs[] = { |
1952 | + { |
1953 | + .addr = DP_DUAL_MODE_SLAVE_ADDRESS, |
1954 | + .flags = 0, |
1955 | + .len = 1, |
1956 | + .buf = &offset, |
1957 | + }, |
1958 | + { |
1959 | + .addr = DP_DUAL_MODE_SLAVE_ADDRESS, |
1960 | + .flags = I2C_M_RD, |
1961 | + .len = size, |
1962 | + .buf = buffer, |
1963 | + }, |
1964 | + }; |
1965 | + int ret; |
1966 | + |
1967 | + ret = i2c_transfer(adapter, msgs, ARRAY_SIZE(msgs)); |
1968 | + if (ret < 0) |
1969 | + return ret; |
1970 | + if (ret != ARRAY_SIZE(msgs)) |
1971 | + return -EPROTO; |
1972 | + |
1973 | + return 0; |
1974 | +} |
1975 | +EXPORT_SYMBOL(drm_dp_dual_mode_read); |
1976 | + |
1977 | +/** |
1978 | + * drm_dp_dual_mode_write - Write to the DP dual mode adaptor register(s) |
1979 | + * @adapter: I2C adapter for the DDC bus |
1980 | + * @offset: register offset |
1981 | + * @buffer: buffer for write data |
1982 | + * @size: sizo of the buffer |
1983 | + * |
1984 | + * Writes @size bytes to the DP dual mode adaptor registers |
1985 | + * starting at @offset. |
1986 | + * |
1987 | + * Returns: |
1988 | + * 0 on success, negative error code on failure |
1989 | + */ |
1990 | +ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, |
1991 | + u8 offset, const void *buffer, size_t size) |
1992 | +{ |
1993 | + struct i2c_msg msg = { |
1994 | + .addr = DP_DUAL_MODE_SLAVE_ADDRESS, |
1995 | + .flags = 0, |
1996 | + .len = 1 + size, |
1997 | + .buf = NULL, |
1998 | + }; |
1999 | + void *data; |
2000 | + int ret; |
2001 | + |
2002 | + data = kmalloc(msg.len, GFP_TEMPORARY); |
2003 | + if (!data) |
2004 | + return -ENOMEM; |
2005 | + |
2006 | + msg.buf = data; |
2007 | + |
2008 | + memcpy(data, &offset, 1); |
2009 | + memcpy(data + 1, buffer, size); |
2010 | + |
2011 | + ret = i2c_transfer(adapter, &msg, 1); |
2012 | + |
2013 | + kfree(data); |
2014 | + |
2015 | + if (ret < 0) |
2016 | + return ret; |
2017 | + if (ret != 1) |
2018 | + return -EPROTO; |
2019 | + |
2020 | + return 0; |
2021 | +} |
2022 | +EXPORT_SYMBOL(drm_dp_dual_mode_write); |
2023 | + |
2024 | +static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN]) |
2025 | +{ |
2026 | + static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] = |
2027 | + "DP-HDMI ADAPTOR\x04"; |
2028 | + |
2029 | + return memcmp(hdmi_id, dp_dual_mode_hdmi_id, |
2030 | + sizeof(dp_dual_mode_hdmi_id)) == 0; |
2031 | +} |
2032 | + |
2033 | +static bool is_type2_adaptor(uint8_t adaptor_id) |
2034 | +{ |
2035 | + return adaptor_id == (DP_DUAL_MODE_TYPE_TYPE2 | |
2036 | + DP_DUAL_MODE_REV_TYPE2); |
2037 | +} |
2038 | + |
2039 | +/** |
2040 | + * drm_dp_dual_mode_detect - Identify the DP dual mode adaptor |
2041 | + * @adapter: I2C adapter for the DDC bus |
2042 | + * |
2043 | + * Attempt to identify the type of the DP dual mode adaptor used. |
2044 | + * |
2045 | + * Note that when the answer is @DRM_DP_DUAL_MODE_UNKNOWN it's not |
2046 | + * certain whether we're dealing with a native HDMI port or |
2047 | + * a type 1 DVI dual mode adaptor. The driver will have to use |
2048 | + * some other hardware/driver specific mechanism to make that |
2049 | + * distinction. |
2050 | + * |
2051 | + * Returns: |
2052 | + * The type of the DP dual mode adaptor used |
2053 | + */ |
2054 | +enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter) |
2055 | +{ |
2056 | + char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] = {}; |
2057 | + uint8_t adaptor_id = 0x00; |
2058 | + ssize_t ret; |
2059 | + |
2060 | + /* |
2061 | + * Let's see if the adaptor is there the by reading the |
2062 | + * HDMI ID registers. |
2063 | + * |
2064 | + * Note that type 1 DVI adaptors are not required to implemnt |
2065 | + * any registers, and that presents a problem for detection. |
2066 | + * If the i2c transfer is nacked, we may or may not be dealing |
2067 | + * with a type 1 DVI adaptor. Some other mechanism of detecting |
2068 | + * the presence of the adaptor is required. One way would be |
2069 | + * to check the state of the CONFIG1 pin, Another method would |
2070 | + * simply require the driver to know whether the port is a DP++ |
2071 | + * port or a native HDMI port. Both of these methods are entirely |
2072 | + * hardware/driver specific so we can't deal with them here. |
2073 | + */ |
2074 | + ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_HDMI_ID, |
2075 | + hdmi_id, sizeof(hdmi_id)); |
2076 | + if (ret) |
2077 | + return DRM_DP_DUAL_MODE_UNKNOWN; |
2078 | + |
2079 | + /* |
2080 | + * Sigh. Some (maybe all?) type 1 adaptors are broken and ack |
2081 | + * the offset but ignore it, and instead they just always return |
2082 | + * data from the start of the HDMI ID buffer. So for a broken |
2083 | + * type 1 HDMI adaptor a single byte read will always give us |
2084 | + * 0x44, and for a type 1 DVI adaptor it should give 0x00 |
2085 | + * (assuming it implements any registers). Fortunately neither |
2086 | + * of those values will match the type 2 signature of the |
2087 | + * DP_DUAL_MODE_ADAPTOR_ID register so we can proceed with |
2088 | + * the type 2 adaptor detection safely even in the presence |
2089 | + * of broken type 1 adaptors. |
2090 | + */ |
2091 | + ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_ADAPTOR_ID, |
2092 | + &adaptor_id, sizeof(adaptor_id)); |
2093 | + if (ret == 0) { |
2094 | + if (is_type2_adaptor(adaptor_id)) { |
2095 | + if (is_hdmi_adaptor(hdmi_id)) |
2096 | + return DRM_DP_DUAL_MODE_TYPE2_HDMI; |
2097 | + else |
2098 | + return DRM_DP_DUAL_MODE_TYPE2_DVI; |
2099 | + } |
2100 | + } |
2101 | + |
2102 | + if (is_hdmi_adaptor(hdmi_id)) |
2103 | + return DRM_DP_DUAL_MODE_TYPE1_HDMI; |
2104 | + else |
2105 | + return DRM_DP_DUAL_MODE_TYPE1_DVI; |
2106 | +} |
2107 | +EXPORT_SYMBOL(drm_dp_dual_mode_detect); |
2108 | + |
2109 | +/** |
2110 | + * drm_dp_dual_mode_max_tmds_clock - Max TMDS clock for DP dual mode adaptor |
2111 | + * @type: DP dual mode adaptor type |
2112 | + * @adapter: I2C adapter for the DDC bus |
2113 | + * |
2114 | + * Determine the max TMDS clock the adaptor supports based on the |
2115 | + * type of the dual mode adaptor and the DP_DUAL_MODE_MAX_TMDS_CLOCK |
2116 | + * register (on type2 adaptors). As some type 1 adaptors have |
2117 | + * problems with registers (see comments in drm_dp_dual_mode_detect()) |
2118 | + * we don't read the register on those, instead we simply assume |
2119 | + * a 165 MHz limit based on the specification. |
2120 | + * |
2121 | + * Returns: |
2122 | + * Maximum supported TMDS clock rate for the DP dual mode adaptor in kHz. |
2123 | + */ |
2124 | +int drm_dp_dual_mode_max_tmds_clock(enum drm_dp_dual_mode_type type, |
2125 | + struct i2c_adapter *adapter) |
2126 | +{ |
2127 | + uint8_t max_tmds_clock; |
2128 | + ssize_t ret; |
2129 | + |
2130 | + /* native HDMI so no limit */ |
2131 | + if (type == DRM_DP_DUAL_MODE_NONE) |
2132 | + return 0; |
2133 | + |
2134 | + /* |
2135 | + * Type 1 adaptors are limited to 165MHz |
2136 | + * Type 2 adaptors can tells us their limit |
2137 | + */ |
2138 | + if (type < DRM_DP_DUAL_MODE_TYPE2_DVI) |
2139 | + return 165000; |
2140 | + |
2141 | + ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_MAX_TMDS_CLOCK, |
2142 | + &max_tmds_clock, sizeof(max_tmds_clock)); |
2143 | + if (ret || max_tmds_clock == 0x00 || max_tmds_clock == 0xff) { |
2144 | + DRM_DEBUG_KMS("Failed to query max TMDS clock\n"); |
2145 | + return 165000; |
2146 | + } |
2147 | + |
2148 | + return max_tmds_clock * 5000 / 2; |
2149 | +} |
2150 | +EXPORT_SYMBOL(drm_dp_dual_mode_max_tmds_clock); |
2151 | + |
2152 | +/** |
2153 | + * drm_dp_dual_mode_get_tmds_output - Get the state of the TMDS output buffers in the DP dual mode adaptor |
2154 | + * @type: DP dual mode adaptor type |
2155 | + * @adapter: I2C adapter for the DDC bus |
2156 | + * @enabled: current state of the TMDS output buffers |
2157 | + * |
2158 | + * Get the state of the TMDS output buffers in the adaptor. For |
2159 | + * type2 adaptors this is queried from the DP_DUAL_MODE_TMDS_OEN |
2160 | + * register. As some type 1 adaptors have problems with registers |
2161 | + * (see comments in drm_dp_dual_mode_detect()) we don't read the |
2162 | + * register on those, instead we simply assume that the buffers |
2163 | + * are always enabled. |
2164 | + * |
2165 | + * Returns: |
2166 | + * 0 on success, negative error code on failure |
2167 | + */ |
2168 | +int drm_dp_dual_mode_get_tmds_output(enum drm_dp_dual_mode_type type, |
2169 | + struct i2c_adapter *adapter, |
2170 | + bool *enabled) |
2171 | +{ |
2172 | + uint8_t tmds_oen; |
2173 | + ssize_t ret; |
2174 | + |
2175 | + if (type < DRM_DP_DUAL_MODE_TYPE2_DVI) { |
2176 | + *enabled = true; |
2177 | + return 0; |
2178 | + } |
2179 | + |
2180 | + ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_TMDS_OEN, |
2181 | + &tmds_oen, sizeof(tmds_oen)); |
2182 | + if (ret) { |
2183 | + DRM_DEBUG_KMS("Failed to query state of TMDS output buffers\n"); |
2184 | + return ret; |
2185 | + } |
2186 | + |
2187 | + *enabled = !(tmds_oen & DP_DUAL_MODE_TMDS_DISABLE); |
2188 | + |
2189 | + return 0; |
2190 | +} |
2191 | +EXPORT_SYMBOL(drm_dp_dual_mode_get_tmds_output); |
2192 | + |
2193 | +/** |
2194 | + * drm_dp_dual_mode_set_tmds_output - Enable/disable TMDS output buffers in the DP dual mode adaptor |
2195 | + * @type: DP dual mode adaptor type |
2196 | + * @adapter: I2C adapter for the DDC bus |
2197 | + * @enable: enable (as opposed to disable) the TMDS output buffers |
2198 | + * |
2199 | + * Set the state of the TMDS output buffers in the adaptor. For |
2200 | + * type2 this is set via the DP_DUAL_MODE_TMDS_OEN register. As |
2201 | + * some type 1 adaptors have problems with registers (see comments |
2202 | + * in drm_dp_dual_mode_detect()) we avoid touching the register, |
2203 | + * making this function a no-op on type 1 adaptors. |
2204 | + * |
2205 | + * Returns: |
2206 | + * 0 on success, negative error code on failure |
2207 | + */ |
2208 | +int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type, |
2209 | + struct i2c_adapter *adapter, bool enable) |
2210 | +{ |
2211 | + uint8_t tmds_oen = enable ? 0 : DP_DUAL_MODE_TMDS_DISABLE; |
2212 | + ssize_t ret; |
2213 | + |
2214 | + if (type < DRM_DP_DUAL_MODE_TYPE2_DVI) |
2215 | + return 0; |
2216 | + |
2217 | + ret = drm_dp_dual_mode_write(adapter, DP_DUAL_MODE_TMDS_OEN, |
2218 | + &tmds_oen, sizeof(tmds_oen)); |
2219 | + if (ret) { |
2220 | + DRM_DEBUG_KMS("Failed to %s TMDS output buffers\n", |
2221 | + enable ? "enable" : "disable"); |
2222 | + return ret; |
2223 | + } |
2224 | + |
2225 | + return 0; |
2226 | +} |
2227 | +EXPORT_SYMBOL(drm_dp_dual_mode_set_tmds_output); |
2228 | + |
2229 | +/** |
2230 | + * drm_dp_get_dual_mode_type_name - Get the name of the DP dual mode adaptor type as a string |
2231 | + * @type: DP dual mode adaptor type |
2232 | + * |
2233 | + * Returns: |
2234 | + * String representation of the DP dual mode adaptor type |
2235 | + */ |
2236 | +const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type) |
2237 | +{ |
2238 | + switch (type) { |
2239 | + case DRM_DP_DUAL_MODE_NONE: |
2240 | + return "none"; |
2241 | + case DRM_DP_DUAL_MODE_TYPE1_DVI: |
2242 | + return "type 1 DVI"; |
2243 | + case DRM_DP_DUAL_MODE_TYPE1_HDMI: |
2244 | + return "type 1 HDMI"; |
2245 | + case DRM_DP_DUAL_MODE_TYPE2_DVI: |
2246 | + return "type 2 DVI"; |
2247 | + case DRM_DP_DUAL_MODE_TYPE2_HDMI: |
2248 | + return "type 2 HDMI"; |
2249 | + default: |
2250 | + WARN_ON(type != DRM_DP_DUAL_MODE_UNKNOWN); |
2251 | + return "unknown"; |
2252 | + } |
2253 | +} |
2254 | +EXPORT_SYMBOL(drm_dp_get_dual_mode_type_name); |
2255 | diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c |
2256 | index 855108e6e1bd..fe4df976f0b8 100644 |
2257 | --- a/drivers/gpu/drm/drm_fb_helper.c |
2258 | +++ b/drivers/gpu/drm/drm_fb_helper.c |
2259 | @@ -1895,7 +1895,6 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper, |
2260 | int n, int width, int height) |
2261 | { |
2262 | int c, o; |
2263 | - struct drm_device *dev = fb_helper->dev; |
2264 | struct drm_connector *connector; |
2265 | const struct drm_connector_helper_funcs *connector_funcs; |
2266 | struct drm_encoder *encoder; |
2267 | @@ -1914,7 +1913,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper, |
2268 | if (modes[n] == NULL) |
2269 | return best_score; |
2270 | |
2271 | - crtcs = kzalloc(dev->mode_config.num_connector * |
2272 | + crtcs = kzalloc(fb_helper->connector_count * |
2273 | sizeof(struct drm_fb_helper_crtc *), GFP_KERNEL); |
2274 | if (!crtcs) |
2275 | return best_score; |
2276 | @@ -1960,7 +1959,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper, |
2277 | if (score > best_score) { |
2278 | best_score = score; |
2279 | memcpy(best_crtcs, crtcs, |
2280 | - dev->mode_config.num_connector * |
2281 | + fb_helper->connector_count * |
2282 | sizeof(struct drm_fb_helper_crtc *)); |
2283 | } |
2284 | } |
2285 | diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c |
2286 | index 6b43ae3ffd73..1616af209bfc 100644 |
2287 | --- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c |
2288 | +++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c |
2289 | @@ -72,7 +72,7 @@ static const char *const dsi_errors[] = { |
2290 | "RX Prot Violation", |
2291 | "HS Generic Write FIFO Full", |
2292 | "LP Generic Write FIFO Full", |
2293 | - "Generic Read Data Avail" |
2294 | + "Generic Read Data Avail", |
2295 | "Special Packet Sent", |
2296 | "Tearing Effect", |
2297 | }; |
2298 | diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c |
2299 | index 8e579a8505ac..e7c1686e479c 100644 |
2300 | --- a/drivers/gpu/drm/i915/intel_atomic.c |
2301 | +++ b/drivers/gpu/drm/i915/intel_atomic.c |
2302 | @@ -96,7 +96,8 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc) |
2303 | crtc_state->update_pipe = false; |
2304 | crtc_state->disable_lp_wm = false; |
2305 | crtc_state->disable_cxsr = false; |
2306 | - crtc_state->wm_changed = false; |
2307 | + crtc_state->update_wm_pre = false; |
2308 | + crtc_state->update_wm_post = false; |
2309 | crtc_state->fb_changed = false; |
2310 | |
2311 | return &crtc_state->base; |
2312 | diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c |
2313 | index e0b851a0004a..7de7721f65bc 100644 |
2314 | --- a/drivers/gpu/drm/i915/intel_atomic_plane.c |
2315 | +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c |
2316 | @@ -195,12 +195,10 @@ static void intel_plane_atomic_update(struct drm_plane *plane, |
2317 | struct intel_plane_state *intel_state = |
2318 | to_intel_plane_state(plane->state); |
2319 | struct drm_crtc *crtc = plane->state->crtc ?: old_state->crtc; |
2320 | - struct drm_crtc_state *crtc_state = |
2321 | - drm_atomic_get_existing_crtc_state(old_state->state, crtc); |
2322 | |
2323 | if (intel_state->visible) |
2324 | intel_plane->update_plane(plane, |
2325 | - to_intel_crtc_state(crtc_state), |
2326 | + to_intel_crtc_state(crtc->state), |
2327 | intel_state); |
2328 | else |
2329 | intel_plane->disable_plane(plane, crtc); |
2330 | diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c |
2331 | index 96ffcc541e17..50f5b0c975e3 100644 |
2332 | --- a/drivers/gpu/drm/i915/intel_ddi.c |
2333 | +++ b/drivers/gpu/drm/i915/intel_ddi.c |
2334 | @@ -2309,6 +2309,12 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder) |
2335 | enum port port = intel_ddi_get_encoder_port(intel_encoder); |
2336 | int type = intel_encoder->type; |
2337 | |
2338 | + if (type == INTEL_OUTPUT_HDMI) { |
2339 | + struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); |
2340 | + |
2341 | + intel_dp_dual_mode_set_tmds_output(intel_hdmi, true); |
2342 | + } |
2343 | + |
2344 | intel_prepare_ddi_buffer(intel_encoder); |
2345 | |
2346 | if (type == INTEL_OUTPUT_EDP) { |
2347 | @@ -2375,6 +2381,12 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder) |
2348 | DPLL_CTRL2_DDI_CLK_OFF(port))); |
2349 | else if (INTEL_INFO(dev)->gen < 9) |
2350 | I915_WRITE(PORT_CLK_SEL(port), PORT_CLK_SEL_NONE); |
2351 | + |
2352 | + if (type == INTEL_OUTPUT_HDMI) { |
2353 | + struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); |
2354 | + |
2355 | + intel_dp_dual_mode_set_tmds_output(intel_hdmi, false); |
2356 | + } |
2357 | } |
2358 | |
2359 | static void intel_enable_ddi(struct intel_encoder *intel_encoder) |
2360 | diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
2361 | index 0104a06d01fd..7741efbd5e57 100644 |
2362 | --- a/drivers/gpu/drm/i915/intel_display.c |
2363 | +++ b/drivers/gpu/drm/i915/intel_display.c |
2364 | @@ -4796,7 +4796,7 @@ static void intel_post_plane_update(struct intel_crtc *crtc) |
2365 | |
2366 | crtc->wm.cxsr_allowed = true; |
2367 | |
2368 | - if (pipe_config->wm_changed && pipe_config->base.active) |
2369 | + if (pipe_config->update_wm_post && pipe_config->base.active) |
2370 | intel_update_watermarks(&crtc->base); |
2371 | |
2372 | if (atomic->update_fbc) |
2373 | @@ -4843,7 +4843,7 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state) |
2374 | intel_set_memory_cxsr(dev_priv, false); |
2375 | } |
2376 | |
2377 | - if (!needs_modeset(&pipe_config->base) && pipe_config->wm_changed) |
2378 | + if (!needs_modeset(&pipe_config->base) && pipe_config->update_wm_pre) |
2379 | intel_update_watermarks(&crtc->base); |
2380 | } |
2381 | |
2382 | @@ -6210,6 +6210,7 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc) |
2383 | |
2384 | intel_crtc_load_lut(crtc); |
2385 | |
2386 | + intel_update_watermarks(crtc); |
2387 | intel_enable_pipe(intel_crtc); |
2388 | |
2389 | assert_vblank_disabled(crtc); |
2390 | @@ -11833,14 +11834,22 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state, |
2391 | plane->base.id, was_visible, visible, |
2392 | turn_off, turn_on, mode_changed); |
2393 | |
2394 | - if (turn_on || turn_off) { |
2395 | - pipe_config->wm_changed = true; |
2396 | + if (turn_on) { |
2397 | + pipe_config->update_wm_pre = true; |
2398 | + |
2399 | + /* must disable cxsr around plane enable/disable */ |
2400 | + if (plane->type != DRM_PLANE_TYPE_CURSOR) |
2401 | + pipe_config->disable_cxsr = true; |
2402 | + } else if (turn_off) { |
2403 | + pipe_config->update_wm_post = true; |
2404 | |
2405 | /* must disable cxsr around plane enable/disable */ |
2406 | if (plane->type != DRM_PLANE_TYPE_CURSOR) |
2407 | pipe_config->disable_cxsr = true; |
2408 | } else if (intel_wm_need_update(plane, plane_state)) { |
2409 | - pipe_config->wm_changed = true; |
2410 | + /* FIXME bollocks */ |
2411 | + pipe_config->update_wm_pre = true; |
2412 | + pipe_config->update_wm_post = true; |
2413 | } |
2414 | |
2415 | if (visible || was_visible) |
2416 | @@ -11940,7 +11949,7 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc, |
2417 | } |
2418 | |
2419 | if (mode_changed && !crtc_state->active) |
2420 | - pipe_config->wm_changed = true; |
2421 | + pipe_config->update_wm_post = true; |
2422 | |
2423 | if (mode_changed && crtc_state->enable && |
2424 | dev_priv->display.crtc_compute_clock && |
2425 | @@ -13453,12 +13462,12 @@ static bool needs_vblank_wait(struct intel_crtc_state *crtc_state) |
2426 | return true; |
2427 | |
2428 | /* wm changes, need vblank before final wm's */ |
2429 | - if (crtc_state->wm_changed) |
2430 | + if (crtc_state->update_wm_post) |
2431 | return true; |
2432 | |
2433 | /* |
2434 | * cxsr is re-enabled after vblank. |
2435 | - * This is already handled by crtc_state->wm_changed, |
2436 | + * This is already handled by crtc_state->update_wm_post, |
2437 | * but added for clarity. |
2438 | */ |
2439 | if (crtc_state->disable_cxsr) |
2440 | @@ -15958,6 +15967,18 @@ void intel_display_resume(struct drm_device *dev) |
2441 | retry: |
2442 | ret = drm_modeset_lock_all_ctx(dev, &ctx); |
2443 | |
2444 | + /* |
2445 | + * With MST, the number of connectors can change between suspend and |
2446 | + * resume, which means that the state we want to restore might now be |
2447 | + * impossible to use since it'll be pointing to non-existant |
2448 | + * connectors. |
2449 | + */ |
2450 | + if (ret == 0 && state && |
2451 | + state->num_connector != dev->mode_config.num_connector) { |
2452 | + drm_atomic_state_free(state); |
2453 | + state = NULL; |
2454 | + } |
2455 | + |
2456 | if (ret == 0 && !setup) { |
2457 | setup = true; |
2458 | |
2459 | diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h |
2460 | index 9d0770c23fde..3a30b37d6885 100644 |
2461 | --- a/drivers/gpu/drm/i915/intel_drv.h |
2462 | +++ b/drivers/gpu/drm/i915/intel_drv.h |
2463 | @@ -33,6 +33,7 @@ |
2464 | #include <drm/drm_crtc.h> |
2465 | #include <drm/drm_crtc_helper.h> |
2466 | #include <drm/drm_fb_helper.h> |
2467 | +#include <drm/drm_dp_dual_mode_helper.h> |
2468 | #include <drm/drm_dp_mst_helper.h> |
2469 | #include <drm/drm_rect.h> |
2470 | #include <drm/drm_atomic.h> |
2471 | @@ -378,7 +379,7 @@ struct intel_crtc_state { |
2472 | |
2473 | bool update_pipe; /* can a fast modeset be performed? */ |
2474 | bool disable_cxsr; |
2475 | - bool wm_changed; /* watermarks are updated */ |
2476 | + bool update_wm_pre, update_wm_post; /* watermarks are updated */ |
2477 | bool fb_changed; /* fb on any of the planes is changed */ |
2478 | |
2479 | /* Pipe source size (ie. panel fitter input size) |
2480 | @@ -703,6 +704,10 @@ struct cxsr_latency { |
2481 | struct intel_hdmi { |
2482 | i915_reg_t hdmi_reg; |
2483 | int ddc_bus; |
2484 | + struct { |
2485 | + enum drm_dp_dual_mode_type type; |
2486 | + int max_tmds_clock; |
2487 | + } dp_dual_mode; |
2488 | bool limited_color_range; |
2489 | bool color_range_auto; |
2490 | bool has_hdmi_sink; |
2491 | @@ -1351,6 +1356,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, |
2492 | struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder); |
2493 | bool intel_hdmi_compute_config(struct intel_encoder *encoder, |
2494 | struct intel_crtc_state *pipe_config); |
2495 | +void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable); |
2496 | |
2497 | |
2498 | /* intel_lvds.c */ |
2499 | diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c |
2500 | index 97a91e631915..c607217c13ea 100644 |
2501 | --- a/drivers/gpu/drm/i915/intel_fbdev.c |
2502 | +++ b/drivers/gpu/drm/i915/intel_fbdev.c |
2503 | @@ -366,12 +366,12 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, |
2504 | uint64_t conn_configured = 0, mask; |
2505 | int pass = 0; |
2506 | |
2507 | - save_enabled = kcalloc(dev->mode_config.num_connector, sizeof(bool), |
2508 | + save_enabled = kcalloc(fb_helper->connector_count, sizeof(bool), |
2509 | GFP_KERNEL); |
2510 | if (!save_enabled) |
2511 | return false; |
2512 | |
2513 | - memcpy(save_enabled, enabled, dev->mode_config.num_connector); |
2514 | + memcpy(save_enabled, enabled, fb_helper->connector_count); |
2515 | mask = (1 << fb_helper->connector_count) - 1; |
2516 | retry: |
2517 | for (i = 0; i < fb_helper->connector_count; i++) { |
2518 | @@ -510,7 +510,7 @@ retry: |
2519 | if (fallback) { |
2520 | bail: |
2521 | DRM_DEBUG_KMS("Not using firmware configuration\n"); |
2522 | - memcpy(enabled, save_enabled, dev->mode_config.num_connector); |
2523 | + memcpy(enabled, save_enabled, fb_helper->connector_count); |
2524 | kfree(save_enabled); |
2525 | return false; |
2526 | } |
2527 | diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c |
2528 | index 1ab6f687f640..3ddb4fac53fa 100644 |
2529 | --- a/drivers/gpu/drm/i915/intel_hdmi.c |
2530 | +++ b/drivers/gpu/drm/i915/intel_hdmi.c |
2531 | @@ -836,6 +836,22 @@ static void hsw_set_infoframes(struct drm_encoder *encoder, |
2532 | intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode); |
2533 | } |
2534 | |
2535 | +void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable) |
2536 | +{ |
2537 | + struct drm_i915_private *dev_priv = to_i915(intel_hdmi_to_dev(hdmi)); |
2538 | + struct i2c_adapter *adapter = |
2539 | + intel_gmbus_get_adapter(dev_priv, hdmi->ddc_bus); |
2540 | + |
2541 | + if (hdmi->dp_dual_mode.type < DRM_DP_DUAL_MODE_TYPE2_DVI) |
2542 | + return; |
2543 | + |
2544 | + DRM_DEBUG_KMS("%s DP dual mode adaptor TMDS output\n", |
2545 | + enable ? "Enabling" : "Disabling"); |
2546 | + |
2547 | + drm_dp_dual_mode_set_tmds_output(hdmi->dp_dual_mode.type, |
2548 | + adapter, enable); |
2549 | +} |
2550 | + |
2551 | static void intel_hdmi_prepare(struct intel_encoder *encoder) |
2552 | { |
2553 | struct drm_device *dev = encoder->base.dev; |
2554 | @@ -845,6 +861,8 @@ static void intel_hdmi_prepare(struct intel_encoder *encoder) |
2555 | const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode; |
2556 | u32 hdmi_val; |
2557 | |
2558 | + intel_dp_dual_mode_set_tmds_output(intel_hdmi, true); |
2559 | + |
2560 | hdmi_val = SDVO_ENCODING_HDMI; |
2561 | if (!HAS_PCH_SPLIT(dev) && crtc->config->limited_color_range) |
2562 | hdmi_val |= HDMI_COLOR_RANGE_16_235; |
2563 | @@ -1143,6 +1161,8 @@ static void intel_disable_hdmi(struct intel_encoder *encoder) |
2564 | } |
2565 | |
2566 | intel_hdmi->set_infoframes(&encoder->base, false, NULL); |
2567 | + |
2568 | + intel_dp_dual_mode_set_tmds_output(intel_hdmi, false); |
2569 | } |
2570 | |
2571 | static void g4x_disable_hdmi(struct intel_encoder *encoder) |
2572 | @@ -1168,27 +1188,42 @@ static void pch_post_disable_hdmi(struct intel_encoder *encoder) |
2573 | intel_disable_hdmi(encoder); |
2574 | } |
2575 | |
2576 | -static int hdmi_port_clock_limit(struct intel_hdmi *hdmi, bool respect_dvi_limit) |
2577 | +static int intel_hdmi_source_max_tmds_clock(struct drm_i915_private *dev_priv) |
2578 | { |
2579 | - struct drm_device *dev = intel_hdmi_to_dev(hdmi); |
2580 | - |
2581 | - if ((respect_dvi_limit && !hdmi->has_hdmi_sink) || IS_G4X(dev)) |
2582 | + if (IS_G4X(dev_priv)) |
2583 | return 165000; |
2584 | - else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8) |
2585 | + else if (IS_HASWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 8) |
2586 | return 300000; |
2587 | else |
2588 | return 225000; |
2589 | } |
2590 | |
2591 | +static int hdmi_port_clock_limit(struct intel_hdmi *hdmi, |
2592 | + bool respect_downstream_limits) |
2593 | +{ |
2594 | + struct drm_device *dev = intel_hdmi_to_dev(hdmi); |
2595 | + int max_tmds_clock = intel_hdmi_source_max_tmds_clock(to_i915(dev)); |
2596 | + |
2597 | + if (respect_downstream_limits) { |
2598 | + if (hdmi->dp_dual_mode.max_tmds_clock) |
2599 | + max_tmds_clock = min(max_tmds_clock, |
2600 | + hdmi->dp_dual_mode.max_tmds_clock); |
2601 | + if (!hdmi->has_hdmi_sink) |
2602 | + max_tmds_clock = min(max_tmds_clock, 165000); |
2603 | + } |
2604 | + |
2605 | + return max_tmds_clock; |
2606 | +} |
2607 | + |
2608 | static enum drm_mode_status |
2609 | hdmi_port_clock_valid(struct intel_hdmi *hdmi, |
2610 | - int clock, bool respect_dvi_limit) |
2611 | + int clock, bool respect_downstream_limits) |
2612 | { |
2613 | struct drm_device *dev = intel_hdmi_to_dev(hdmi); |
2614 | |
2615 | if (clock < 25000) |
2616 | return MODE_CLOCK_LOW; |
2617 | - if (clock > hdmi_port_clock_limit(hdmi, respect_dvi_limit)) |
2618 | + if (clock > hdmi_port_clock_limit(hdmi, respect_downstream_limits)) |
2619 | return MODE_CLOCK_HIGH; |
2620 | |
2621 | /* BXT DPLL can't generate 223-240 MHz */ |
2622 | @@ -1312,7 +1347,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, |
2623 | * within limits. |
2624 | */ |
2625 | if (pipe_config->pipe_bpp > 8*3 && pipe_config->has_hdmi_sink && |
2626 | - hdmi_port_clock_valid(intel_hdmi, clock_12bpc, false) == MODE_OK && |
2627 | + hdmi_port_clock_valid(intel_hdmi, clock_12bpc, true) == MODE_OK && |
2628 | hdmi_12bpc_possible(pipe_config)) { |
2629 | DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n"); |
2630 | desired_bpp = 12*3; |
2631 | @@ -1352,10 +1387,35 @@ intel_hdmi_unset_edid(struct drm_connector *connector) |
2632 | intel_hdmi->has_audio = false; |
2633 | intel_hdmi->rgb_quant_range_selectable = false; |
2634 | |
2635 | + intel_hdmi->dp_dual_mode.type = DRM_DP_DUAL_MODE_NONE; |
2636 | + intel_hdmi->dp_dual_mode.max_tmds_clock = 0; |
2637 | + |
2638 | kfree(to_intel_connector(connector)->detect_edid); |
2639 | to_intel_connector(connector)->detect_edid = NULL; |
2640 | } |
2641 | |
2642 | +static void |
2643 | +intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector) |
2644 | +{ |
2645 | + struct drm_i915_private *dev_priv = to_i915(connector->dev); |
2646 | + struct intel_hdmi *hdmi = intel_attached_hdmi(connector); |
2647 | + struct i2c_adapter *adapter = |
2648 | + intel_gmbus_get_adapter(dev_priv, hdmi->ddc_bus); |
2649 | + enum drm_dp_dual_mode_type type = drm_dp_dual_mode_detect(adapter); |
2650 | + |
2651 | + if (type == DRM_DP_DUAL_MODE_NONE || |
2652 | + type == DRM_DP_DUAL_MODE_UNKNOWN) |
2653 | + return; |
2654 | + |
2655 | + hdmi->dp_dual_mode.type = type; |
2656 | + hdmi->dp_dual_mode.max_tmds_clock = |
2657 | + drm_dp_dual_mode_max_tmds_clock(type, adapter); |
2658 | + |
2659 | + DRM_DEBUG_KMS("DP dual mode adaptor (%s) detected (max TMDS clock: %d kHz)\n", |
2660 | + drm_dp_get_dual_mode_type_name(type), |
2661 | + hdmi->dp_dual_mode.max_tmds_clock); |
2662 | +} |
2663 | + |
2664 | static bool |
2665 | intel_hdmi_set_edid(struct drm_connector *connector, bool force) |
2666 | { |
2667 | @@ -1371,6 +1431,8 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force) |
2668 | intel_gmbus_get_adapter(dev_priv, |
2669 | intel_hdmi->ddc_bus)); |
2670 | |
2671 | + intel_hdmi_dp_dual_mode_detect(connector); |
2672 | + |
2673 | intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS); |
2674 | } |
2675 | |
2676 | diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c |
2677 | index 3425d8e737b3..54ab023427c7 100644 |
2678 | --- a/drivers/gpu/drm/i915/intel_pm.c |
2679 | +++ b/drivers/gpu/drm/i915/intel_pm.c |
2680 | @@ -3845,6 +3845,8 @@ static void ilk_pipe_wm_get_hw_state(struct drm_crtc *crtc) |
2681 | if (IS_HASWELL(dev) || IS_BROADWELL(dev)) |
2682 | hw->wm_linetime[pipe] = I915_READ(PIPE_WM_LINETIME(pipe)); |
2683 | |
2684 | + memset(active, 0, sizeof(*active)); |
2685 | + |
2686 | active->pipe_enabled = intel_crtc->active; |
2687 | |
2688 | if (active->pipe_enabled) { |
2689 | diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c |
2690 | index 0b42ada338c8..bd322d8fba40 100644 |
2691 | --- a/drivers/gpu/drm/i915/intel_psr.c |
2692 | +++ b/drivers/gpu/drm/i915/intel_psr.c |
2693 | @@ -280,7 +280,10 @@ static void hsw_psr_enable_source(struct intel_dp *intel_dp) |
2694 | * with the 5 or 6 idle patterns. |
2695 | */ |
2696 | uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames); |
2697 | - uint32_t val = 0x0; |
2698 | + uint32_t val = EDP_PSR_ENABLE; |
2699 | + |
2700 | + val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT; |
2701 | + val |= idle_frames << EDP_PSR_IDLE_FRAME_SHIFT; |
2702 | |
2703 | if (IS_HASWELL(dev)) |
2704 | val |= EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES; |
2705 | @@ -288,14 +291,50 @@ static void hsw_psr_enable_source(struct intel_dp *intel_dp) |
2706 | if (dev_priv->psr.link_standby) |
2707 | val |= EDP_PSR_LINK_STANDBY; |
2708 | |
2709 | - I915_WRITE(EDP_PSR_CTL, val | |
2710 | - max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT | |
2711 | - idle_frames << EDP_PSR_IDLE_FRAME_SHIFT | |
2712 | - EDP_PSR_ENABLE); |
2713 | + if (dev_priv->vbt.psr.tp1_wakeup_time > 5) |
2714 | + val |= EDP_PSR_TP1_TIME_2500us; |
2715 | + else if (dev_priv->vbt.psr.tp1_wakeup_time > 1) |
2716 | + val |= EDP_PSR_TP1_TIME_500us; |
2717 | + else if (dev_priv->vbt.psr.tp1_wakeup_time > 0) |
2718 | + val |= EDP_PSR_TP1_TIME_100us; |
2719 | + else |
2720 | + val |= EDP_PSR_TP1_TIME_0us; |
2721 | + |
2722 | + if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5) |
2723 | + val |= EDP_PSR_TP2_TP3_TIME_2500us; |
2724 | + else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1) |
2725 | + val |= EDP_PSR_TP2_TP3_TIME_500us; |
2726 | + else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0) |
2727 | + val |= EDP_PSR_TP2_TP3_TIME_100us; |
2728 | + else |
2729 | + val |= EDP_PSR_TP2_TP3_TIME_0us; |
2730 | + |
2731 | + if (intel_dp_source_supports_hbr2(intel_dp) && |
2732 | + drm_dp_tps3_supported(intel_dp->dpcd)) |
2733 | + val |= EDP_PSR_TP1_TP3_SEL; |
2734 | + else |
2735 | + val |= EDP_PSR_TP1_TP2_SEL; |
2736 | + |
2737 | + I915_WRITE(EDP_PSR_CTL, val); |
2738 | + |
2739 | + if (!dev_priv->psr.psr2_support) |
2740 | + return; |
2741 | + |
2742 | + /* FIXME: selective update is probably totally broken because it doesn't |
2743 | + * mesh at all with our frontbuffer tracking. And the hw alone isn't |
2744 | + * good enough. */ |
2745 | + val = EDP_PSR2_ENABLE | EDP_SU_TRACK_ENABLE; |
2746 | + |
2747 | + if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5) |
2748 | + val |= EDP_PSR2_TP2_TIME_2500; |
2749 | + else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1) |
2750 | + val |= EDP_PSR2_TP2_TIME_500; |
2751 | + else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0) |
2752 | + val |= EDP_PSR2_TP2_TIME_100; |
2753 | + else |
2754 | + val |= EDP_PSR2_TP2_TIME_50; |
2755 | |
2756 | - if (dev_priv->psr.psr2_support) |
2757 | - I915_WRITE(EDP_PSR2_CTL, EDP_PSR2_ENABLE | |
2758 | - EDP_SU_TRACK_ENABLE | EDP_PSR2_TP2_TIME_100); |
2759 | + I915_WRITE(EDP_PSR2_CTL, val); |
2760 | } |
2761 | |
2762 | static bool intel_psr_match_conditions(struct intel_dp *intel_dp) |
2763 | diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c |
2764 | index e26dcdec2aba..05229b960e0c 100644 |
2765 | --- a/drivers/gpu/drm/imx/imx-drm-core.c |
2766 | +++ b/drivers/gpu/drm/imx/imx-drm-core.c |
2767 | @@ -25,6 +25,7 @@ |
2768 | #include <drm/drm_fb_cma_helper.h> |
2769 | #include <drm/drm_plane_helper.h> |
2770 | #include <drm/drm_of.h> |
2771 | +#include <video/imx-ipu-v3.h> |
2772 | |
2773 | #include "imx-drm.h" |
2774 | |
2775 | @@ -444,6 +445,13 @@ static int compare_of(struct device *dev, void *data) |
2776 | { |
2777 | struct device_node *np = data; |
2778 | |
2779 | + /* Special case for DI, dev->of_node may not be set yet */ |
2780 | + if (strcmp(dev->driver->name, "imx-ipuv3-crtc") == 0) { |
2781 | + struct ipu_client_platformdata *pdata = dev->platform_data; |
2782 | + |
2783 | + return pdata->of_node == np; |
2784 | + } |
2785 | + |
2786 | /* Special case for LDB, one device for two channels */ |
2787 | if (of_node_cmp(np->name, "lvds-channel") == 0) { |
2788 | np = of_get_parent(np); |
2789 | diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c |
2790 | index dee8e8b3523b..b2c30b8d9816 100644 |
2791 | --- a/drivers/gpu/drm/imx/ipuv3-crtc.c |
2792 | +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c |
2793 | @@ -473,7 +473,7 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, |
2794 | |
2795 | ret = imx_drm_add_crtc(drm, &ipu_crtc->base, &ipu_crtc->imx_crtc, |
2796 | &ipu_crtc->plane[0]->base, &ipu_crtc_helper_funcs, |
2797 | - ipu_crtc->dev->of_node); |
2798 | + pdata->of_node); |
2799 | if (ret) { |
2800 | dev_err(ipu_crtc->dev, "adding crtc failed with %d.\n", ret); |
2801 | goto err_put_resources; |
2802 | diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c |
2803 | index c03b96709179..701c51ed3e7c 100644 |
2804 | --- a/drivers/gpu/drm/msm/msm_drv.c |
2805 | +++ b/drivers/gpu/drm/msm/msm_drv.c |
2806 | @@ -465,7 +465,6 @@ static void msm_preclose(struct drm_device *dev, struct drm_file *file) |
2807 | { |
2808 | struct msm_drm_private *priv = dev->dev_private; |
2809 | struct msm_file_private *ctx = file->driver_priv; |
2810 | - struct msm_kms *kms = priv->kms; |
2811 | |
2812 | mutex_lock(&dev->struct_mutex); |
2813 | if (ctx == priv->lastctx) |
2814 | diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |
2815 | index 6cbb7d4bdd11..f2cf9231872a 100644 |
2816 | --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |
2817 | +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |
2818 | @@ -628,6 +628,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) |
2819 | mutex_init(&dev_priv->cmdbuf_mutex); |
2820 | mutex_init(&dev_priv->release_mutex); |
2821 | mutex_init(&dev_priv->binding_mutex); |
2822 | + mutex_init(&dev_priv->global_kms_state_mutex); |
2823 | rwlock_init(&dev_priv->resource_lock); |
2824 | ttm_lock_init(&dev_priv->reservation_sem); |
2825 | spin_lock_init(&dev_priv->hw_lock); |
2826 | diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |
2827 | index 019a6ca3e8e9..6db358a85b46 100644 |
2828 | --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |
2829 | +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |
2830 | @@ -412,6 +412,7 @@ struct vmw_private { |
2831 | struct drm_property *implicit_placement_property; |
2832 | unsigned num_implicit; |
2833 | struct vmw_framebuffer *implicit_fb; |
2834 | + struct mutex global_kms_state_mutex; |
2835 | |
2836 | /* |
2837 | * Context and surface management. |
2838 | diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |
2839 | index 4742ec4ead27..b07543b5cea4 100644 |
2840 | --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |
2841 | +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |
2842 | @@ -2143,13 +2143,13 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv, |
2843 | void vmw_kms_del_active(struct vmw_private *dev_priv, |
2844 | struct vmw_display_unit *du) |
2845 | { |
2846 | - lockdep_assert_held_once(&dev_priv->dev->mode_config.mutex); |
2847 | - |
2848 | + mutex_lock(&dev_priv->global_kms_state_mutex); |
2849 | if (du->active_implicit) { |
2850 | if (--(dev_priv->num_implicit) == 0) |
2851 | dev_priv->implicit_fb = NULL; |
2852 | du->active_implicit = false; |
2853 | } |
2854 | + mutex_unlock(&dev_priv->global_kms_state_mutex); |
2855 | } |
2856 | |
2857 | /** |
2858 | @@ -2165,8 +2165,7 @@ void vmw_kms_add_active(struct vmw_private *dev_priv, |
2859 | struct vmw_display_unit *du, |
2860 | struct vmw_framebuffer *vfb) |
2861 | { |
2862 | - lockdep_assert_held_once(&dev_priv->dev->mode_config.mutex); |
2863 | - |
2864 | + mutex_lock(&dev_priv->global_kms_state_mutex); |
2865 | WARN_ON_ONCE(!dev_priv->num_implicit && dev_priv->implicit_fb); |
2866 | |
2867 | if (!du->active_implicit && du->is_implicit) { |
2868 | @@ -2174,6 +2173,7 @@ void vmw_kms_add_active(struct vmw_private *dev_priv, |
2869 | du->active_implicit = true; |
2870 | dev_priv->num_implicit++; |
2871 | } |
2872 | + mutex_unlock(&dev_priv->global_kms_state_mutex); |
2873 | } |
2874 | |
2875 | /** |
2876 | @@ -2190,16 +2190,13 @@ bool vmw_kms_crtc_flippable(struct vmw_private *dev_priv, |
2877 | struct drm_crtc *crtc) |
2878 | { |
2879 | struct vmw_display_unit *du = vmw_crtc_to_du(crtc); |
2880 | + bool ret; |
2881 | |
2882 | - lockdep_assert_held_once(&dev_priv->dev->mode_config.mutex); |
2883 | - |
2884 | - if (!du->is_implicit) |
2885 | - return true; |
2886 | - |
2887 | - if (dev_priv->num_implicit != 1) |
2888 | - return false; |
2889 | + mutex_lock(&dev_priv->global_kms_state_mutex); |
2890 | + ret = !du->is_implicit || dev_priv->num_implicit == 1; |
2891 | + mutex_unlock(&dev_priv->global_kms_state_mutex); |
2892 | |
2893 | - return true; |
2894 | + return ret; |
2895 | } |
2896 | |
2897 | /** |
2898 | @@ -2214,16 +2211,18 @@ void vmw_kms_update_implicit_fb(struct vmw_private *dev_priv, |
2899 | struct vmw_display_unit *du = vmw_crtc_to_du(crtc); |
2900 | struct vmw_framebuffer *vfb; |
2901 | |
2902 | - lockdep_assert_held_once(&dev_priv->dev->mode_config.mutex); |
2903 | + mutex_lock(&dev_priv->global_kms_state_mutex); |
2904 | |
2905 | if (!du->is_implicit) |
2906 | - return; |
2907 | + goto out_unlock; |
2908 | |
2909 | vfb = vmw_framebuffer_to_vfb(crtc->primary->fb); |
2910 | WARN_ON_ONCE(dev_priv->num_implicit != 1 && |
2911 | dev_priv->implicit_fb != vfb); |
2912 | |
2913 | dev_priv->implicit_fb = vfb; |
2914 | +out_unlock: |
2915 | + mutex_unlock(&dev_priv->global_kms_state_mutex); |
2916 | } |
2917 | |
2918 | /** |
2919 | diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |
2920 | index 0ea22fd112c9..b74eae2b8594 100644 |
2921 | --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |
2922 | +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |
2923 | @@ -285,14 +285,17 @@ static int vmw_sou_crtc_set_config(struct drm_mode_set *set) |
2924 | } |
2925 | |
2926 | /* Only one active implicit frame-buffer at a time. */ |
2927 | + mutex_lock(&dev_priv->global_kms_state_mutex); |
2928 | if (sou->base.is_implicit && |
2929 | dev_priv->implicit_fb && vfb && |
2930 | !(dev_priv->num_implicit == 1 && |
2931 | sou->base.active_implicit) && |
2932 | dev_priv->implicit_fb != vfb) { |
2933 | + mutex_unlock(&dev_priv->global_kms_state_mutex); |
2934 | DRM_ERROR("Multiple implicit framebuffers not supported.\n"); |
2935 | return -EINVAL; |
2936 | } |
2937 | + mutex_unlock(&dev_priv->global_kms_state_mutex); |
2938 | |
2939 | /* since they always map one to one these are safe */ |
2940 | connector = &sou->base.connector; |
2941 | diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c |
2942 | index b949102ad864..9ca818fb034c 100644 |
2943 | --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c |
2944 | +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c |
2945 | @@ -553,12 +553,15 @@ static int vmw_stdu_crtc_set_config(struct drm_mode_set *set) |
2946 | } |
2947 | |
2948 | /* Only one active implicit frame-buffer at a time. */ |
2949 | + mutex_lock(&dev_priv->global_kms_state_mutex); |
2950 | if (!turning_off && stdu->base.is_implicit && dev_priv->implicit_fb && |
2951 | !(dev_priv->num_implicit == 1 && stdu->base.active_implicit) |
2952 | && dev_priv->implicit_fb != vfb) { |
2953 | + mutex_unlock(&dev_priv->global_kms_state_mutex); |
2954 | DRM_ERROR("Multiple implicit framebuffers not supported.\n"); |
2955 | return -EINVAL; |
2956 | } |
2957 | + mutex_unlock(&dev_priv->global_kms_state_mutex); |
2958 | |
2959 | /* Since they always map one to one these are safe */ |
2960 | connector = &stdu->base.connector; |
2961 | diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c |
2962 | index abb98c77bad2..99dcacf05b99 100644 |
2963 | --- a/drivers/gpu/ipu-v3/ipu-common.c |
2964 | +++ b/drivers/gpu/ipu-v3/ipu-common.c |
2965 | @@ -997,7 +997,7 @@ struct ipu_platform_reg { |
2966 | }; |
2967 | |
2968 | /* These must be in the order of the corresponding device tree port nodes */ |
2969 | -static const struct ipu_platform_reg client_reg[] = { |
2970 | +static struct ipu_platform_reg client_reg[] = { |
2971 | { |
2972 | .pdata = { |
2973 | .csi = 0, |
2974 | @@ -1048,7 +1048,7 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base) |
2975 | mutex_unlock(&ipu_client_id_mutex); |
2976 | |
2977 | for (i = 0; i < ARRAY_SIZE(client_reg); i++) { |
2978 | - const struct ipu_platform_reg *reg = &client_reg[i]; |
2979 | + struct ipu_platform_reg *reg = &client_reg[i]; |
2980 | struct platform_device *pdev; |
2981 | struct device_node *of_node; |
2982 | |
2983 | @@ -1070,6 +1070,7 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base) |
2984 | |
2985 | pdev->dev.parent = dev; |
2986 | |
2987 | + reg->pdata.of_node = of_node; |
2988 | ret = platform_device_add_data(pdev, ®->pdata, |
2989 | sizeof(reg->pdata)); |
2990 | if (!ret) |
2991 | diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c |
2992 | index 6c99ee7bafa3..ee396ff167d9 100644 |
2993 | --- a/drivers/hwmon/ads7828.c |
2994 | +++ b/drivers/hwmon/ads7828.c |
2995 | @@ -120,6 +120,7 @@ static int ads7828_probe(struct i2c_client *client, |
2996 | unsigned int vref_mv = ADS7828_INT_VREF_MV; |
2997 | bool diff_input = false; |
2998 | bool ext_vref = false; |
2999 | + unsigned int regval; |
3000 | |
3001 | data = devm_kzalloc(dev, sizeof(struct ads7828_data), GFP_KERNEL); |
3002 | if (!data) |
3003 | @@ -154,6 +155,15 @@ static int ads7828_probe(struct i2c_client *client, |
3004 | if (!diff_input) |
3005 | data->cmd_byte |= ADS7828_CMD_SD_SE; |
3006 | |
3007 | + /* |
3008 | + * Datasheet specifies internal reference voltage is disabled by |
3009 | + * default. The internal reference voltage needs to be enabled and |
3010 | + * voltage needs to settle before getting valid ADC data. So perform a |
3011 | + * dummy read to enable the internal reference voltage. |
3012 | + */ |
3013 | + if (!ext_vref) |
3014 | + regmap_read(data->regmap, data->cmd_byte, ®val); |
3015 | + |
3016 | hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, |
3017 | data, |
3018 | ads7828_groups); |
3019 | diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c |
3020 | index 1142a93dd90b..ca62a6e11846 100644 |
3021 | --- a/drivers/input/joystick/xpad.c |
3022 | +++ b/drivers/input/joystick/xpad.c |
3023 | @@ -457,6 +457,10 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d |
3024 | static void xpad360_process_packet(struct usb_xpad *xpad, struct input_dev *dev, |
3025 | u16 cmd, unsigned char *data) |
3026 | { |
3027 | + /* valid pad data */ |
3028 | + if (data[0] != 0x00) |
3029 | + return; |
3030 | + |
3031 | /* digital pad */ |
3032 | if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { |
3033 | /* dpad as buttons (left, right, up, down) */ |
3034 | @@ -756,6 +760,7 @@ static bool xpad_prepare_next_out_packet(struct usb_xpad *xpad) |
3035 | if (packet) { |
3036 | memcpy(xpad->odata, packet->data, packet->len); |
3037 | xpad->irq_out->transfer_buffer_length = packet->len; |
3038 | + packet->pending = false; |
3039 | return true; |
3040 | } |
3041 | |
3042 | @@ -797,7 +802,6 @@ static void xpad_irq_out(struct urb *urb) |
3043 | switch (status) { |
3044 | case 0: |
3045 | /* success */ |
3046 | - xpad->out_packets[xpad->last_out_packet].pending = false; |
3047 | xpad->irq_out_active = xpad_prepare_next_out_packet(xpad); |
3048 | break; |
3049 | |
3050 | diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c |
3051 | index abe1a927b332..65ebbd111702 100644 |
3052 | --- a/drivers/input/misc/uinput.c |
3053 | +++ b/drivers/input/misc/uinput.c |
3054 | @@ -981,9 +981,15 @@ static long uinput_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
3055 | } |
3056 | |
3057 | #ifdef CONFIG_COMPAT |
3058 | + |
3059 | +#define UI_SET_PHYS_COMPAT _IOW(UINPUT_IOCTL_BASE, 108, compat_uptr_t) |
3060 | + |
3061 | static long uinput_compat_ioctl(struct file *file, |
3062 | unsigned int cmd, unsigned long arg) |
3063 | { |
3064 | + if (cmd == UI_SET_PHYS_COMPAT) |
3065 | + cmd = UI_SET_PHYS; |
3066 | + |
3067 | return uinput_ioctl_handler(file, cmd, arg, compat_ptr(arg)); |
3068 | } |
3069 | #endif |
3070 | diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c |
3071 | index 019644ff627d..bacecbd68a6d 100644 |
3072 | --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c |
3073 | +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c |
3074 | @@ -280,7 +280,8 @@ static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user |
3075 | static int put_v4l2_create32(struct v4l2_create_buffers *kp, struct v4l2_create_buffers32 __user *up) |
3076 | { |
3077 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_create_buffers32)) || |
3078 | - copy_to_user(up, kp, offsetof(struct v4l2_create_buffers32, format))) |
3079 | + copy_to_user(up, kp, offsetof(struct v4l2_create_buffers32, format)) || |
3080 | + copy_to_user(up->reserved, kp->reserved, sizeof(kp->reserved))) |
3081 | return -EFAULT; |
3082 | return __put_v4l2_format32(&kp->format, &up->format); |
3083 | } |
3084 | diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c |
3085 | index 1bbbe877ba7e..807a3e3ec29a 100644 |
3086 | --- a/drivers/mfd/intel-lpss.c |
3087 | +++ b/drivers/mfd/intel-lpss.c |
3088 | @@ -34,6 +34,7 @@ |
3089 | #define LPSS_DEV_SIZE 0x200 |
3090 | #define LPSS_PRIV_OFFSET 0x200 |
3091 | #define LPSS_PRIV_SIZE 0x100 |
3092 | +#define LPSS_PRIV_REG_COUNT (LPSS_PRIV_SIZE / 4) |
3093 | #define LPSS_IDMA64_OFFSET 0x800 |
3094 | #define LPSS_IDMA64_SIZE 0x800 |
3095 | |
3096 | @@ -76,6 +77,7 @@ struct intel_lpss { |
3097 | struct mfd_cell *cell; |
3098 | struct device *dev; |
3099 | void __iomem *priv; |
3100 | + u32 priv_ctx[LPSS_PRIV_REG_COUNT]; |
3101 | int devid; |
3102 | u32 caps; |
3103 | u32 active_ltr; |
3104 | @@ -493,6 +495,16 @@ EXPORT_SYMBOL_GPL(intel_lpss_prepare); |
3105 | |
3106 | int intel_lpss_suspend(struct device *dev) |
3107 | { |
3108 | + struct intel_lpss *lpss = dev_get_drvdata(dev); |
3109 | + unsigned int i; |
3110 | + |
3111 | + /* Save device context */ |
3112 | + for (i = 0; i < LPSS_PRIV_REG_COUNT; i++) |
3113 | + lpss->priv_ctx[i] = readl(lpss->priv + i * 4); |
3114 | + |
3115 | + /* Put the device into reset state */ |
3116 | + writel(0, lpss->priv + LPSS_PRIV_RESETS); |
3117 | + |
3118 | return 0; |
3119 | } |
3120 | EXPORT_SYMBOL_GPL(intel_lpss_suspend); |
3121 | @@ -500,8 +512,13 @@ EXPORT_SYMBOL_GPL(intel_lpss_suspend); |
3122 | int intel_lpss_resume(struct device *dev) |
3123 | { |
3124 | struct intel_lpss *lpss = dev_get_drvdata(dev); |
3125 | + unsigned int i; |
3126 | |
3127 | - intel_lpss_init_dev(lpss); |
3128 | + intel_lpss_deassert_reset(lpss); |
3129 | + |
3130 | + /* Restore device context */ |
3131 | + for (i = 0; i < LPSS_PRIV_REG_COUNT; i++) |
3132 | + writel(lpss->priv_ctx[i], lpss->priv + i * 4); |
3133 | |
3134 | return 0; |
3135 | } |
3136 | diff --git a/drivers/mfd/intel_quark_i2c_gpio.c b/drivers/mfd/intel_quark_i2c_gpio.c |
3137 | index bdc5e27222c0..7450f5d8770c 100644 |
3138 | --- a/drivers/mfd/intel_quark_i2c_gpio.c |
3139 | +++ b/drivers/mfd/intel_quark_i2c_gpio.c |
3140 | @@ -139,6 +139,7 @@ static int intel_quark_register_i2c_clk(struct intel_quark_mfd *quark_mfd) |
3141 | INTEL_QUARK_I2C_CONTROLLER_CLK); |
3142 | |
3143 | if (!quark_mfd->i2c_clk_lookup) { |
3144 | + clk_unregister(quark_mfd->i2c_clk); |
3145 | dev_err(&pdev->dev, "Fixed clk register failed\n"); |
3146 | return -ENOMEM; |
3147 | } |
3148 | @@ -150,7 +151,7 @@ static void intel_quark_unregister_i2c_clk(struct pci_dev *pdev) |
3149 | { |
3150 | struct intel_quark_mfd *quark_mfd = dev_get_drvdata(&pdev->dev); |
3151 | |
3152 | - if (!quark_mfd->i2c_clk || !quark_mfd->i2c_clk_lookup) |
3153 | + if (!quark_mfd->i2c_clk_lookup) |
3154 | return; |
3155 | |
3156 | clkdev_drop(quark_mfd->i2c_clk_lookup); |
3157 | @@ -246,25 +247,33 @@ static int intel_quark_mfd_probe(struct pci_dev *pdev, |
3158 | quark_mfd = devm_kzalloc(&pdev->dev, sizeof(*quark_mfd), GFP_KERNEL); |
3159 | if (!quark_mfd) |
3160 | return -ENOMEM; |
3161 | + |
3162 | quark_mfd->pdev = pdev; |
3163 | + dev_set_drvdata(&pdev->dev, quark_mfd); |
3164 | |
3165 | ret = intel_quark_register_i2c_clk(quark_mfd); |
3166 | if (ret) |
3167 | return ret; |
3168 | |
3169 | - dev_set_drvdata(&pdev->dev, quark_mfd); |
3170 | - |
3171 | ret = intel_quark_i2c_setup(pdev, &intel_quark_mfd_cells[1]); |
3172 | if (ret) |
3173 | - return ret; |
3174 | + goto err_unregister_i2c_clk; |
3175 | |
3176 | ret = intel_quark_gpio_setup(pdev, &intel_quark_mfd_cells[0]); |
3177 | if (ret) |
3178 | - return ret; |
3179 | + goto err_unregister_i2c_clk; |
3180 | |
3181 | - return mfd_add_devices(&pdev->dev, 0, intel_quark_mfd_cells, |
3182 | - ARRAY_SIZE(intel_quark_mfd_cells), NULL, 0, |
3183 | - NULL); |
3184 | + ret = mfd_add_devices(&pdev->dev, 0, intel_quark_mfd_cells, |
3185 | + ARRAY_SIZE(intel_quark_mfd_cells), NULL, 0, |
3186 | + NULL); |
3187 | + if (ret) |
3188 | + goto err_unregister_i2c_clk; |
3189 | + |
3190 | + return 0; |
3191 | + |
3192 | +err_unregister_i2c_clk: |
3193 | + intel_quark_unregister_i2c_clk(pdev); |
3194 | + return ret; |
3195 | } |
3196 | |
3197 | static void intel_quark_mfd_remove(struct pci_dev *pdev) |
3198 | diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c |
3199 | index d9e15cf7c6c8..12d6ebb4ae5d 100644 |
3200 | --- a/drivers/mfd/intel_soc_pmic_core.c |
3201 | +++ b/drivers/mfd/intel_soc_pmic_core.c |
3202 | @@ -35,6 +35,7 @@ static struct gpiod_lookup_table panel_gpio_table = { |
3203 | .table = { |
3204 | /* Panel EN/DISABLE */ |
3205 | GPIO_LOOKUP("gpio_crystalcove", 94, "panel", GPIO_ACTIVE_HIGH), |
3206 | + { }, |
3207 | }, |
3208 | }; |
3209 | |
3210 | diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c |
3211 | index c84c2d30ef1f..fb793612c7bd 100644 |
3212 | --- a/drivers/net/wireless/ath/ath10k/core.c |
3213 | +++ b/drivers/net/wireless/ath/ath10k/core.c |
3214 | @@ -1723,6 +1723,10 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode) |
3215 | goto err_hif_stop; |
3216 | } |
3217 | |
3218 | + ar->free_vdev_map = (1LL << ar->max_num_vdevs) - 1; |
3219 | + |
3220 | + INIT_LIST_HEAD(&ar->arvifs); |
3221 | + |
3222 | /* we don't care about HTT in UTF mode */ |
3223 | if (mode == ATH10K_FIRMWARE_MODE_NORMAL) { |
3224 | status = ath10k_htt_setup(&ar->htt); |
3225 | @@ -1736,10 +1740,6 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode) |
3226 | if (status) |
3227 | goto err_hif_stop; |
3228 | |
3229 | - ar->free_vdev_map = (1LL << ar->max_num_vdevs) - 1; |
3230 | - |
3231 | - INIT_LIST_HEAD(&ar->arvifs); |
3232 | - |
3233 | return 0; |
3234 | |
3235 | err_hif_stop: |
3236 | diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c |
3237 | index 076d29b53ddf..0f834646e6a7 100644 |
3238 | --- a/drivers/net/wireless/ath/ath10k/debug.c |
3239 | +++ b/drivers/net/wireless/ath/ath10k/debug.c |
3240 | @@ -2019,7 +2019,12 @@ static ssize_t ath10k_write_pktlog_filter(struct file *file, |
3241 | goto out; |
3242 | } |
3243 | |
3244 | - if (filter && (filter != ar->debug.pktlog_filter)) { |
3245 | + if (filter == ar->debug.pktlog_filter) { |
3246 | + ret = count; |
3247 | + goto out; |
3248 | + } |
3249 | + |
3250 | + if (filter) { |
3251 | ret = ath10k_wmi_pdev_pktlog_enable(ar, filter); |
3252 | if (ret) { |
3253 | ath10k_warn(ar, "failed to enable pktlog filter %x: %d\n", |
3254 | diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c |
3255 | index 78999c9de23b..e11160ab44bb 100644 |
3256 | --- a/drivers/net/wireless/ath/ath10k/mac.c |
3257 | +++ b/drivers/net/wireless/ath/ath10k/mac.c |
3258 | @@ -4489,7 +4489,10 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, |
3259 | goto err_vdev_delete; |
3260 | } |
3261 | |
3262 | - if (ar->cfg_tx_chainmask) { |
3263 | + /* Configuring number of spatial stream for monitor interface is causing |
3264 | + * target assert in qca9888 and qca6174. |
3265 | + */ |
3266 | + if (ar->cfg_tx_chainmask && (vif->type != NL80211_IFTYPE_MONITOR)) { |
3267 | u16 nss = get_nss_from_chainmask(ar->cfg_tx_chainmask); |
3268 | |
3269 | vdev_param = ar->wmi.vdev_param->nss; |
3270 | @@ -6450,7 +6453,13 @@ ath10k_mac_update_rx_channel(struct ath10k *ar, |
3271 | def = &vifs[0].new_ctx->def; |
3272 | |
3273 | ar->rx_channel = def->chan; |
3274 | - } else if (ctx && ath10k_mac_num_chanctxs(ar) == 0) { |
3275 | + } else if ((ctx && ath10k_mac_num_chanctxs(ar) == 0) || |
3276 | + (ctx && (ar->state == ATH10K_STATE_RESTARTED))) { |
3277 | + /* During driver restart due to firmware assert, since mac80211 |
3278 | + * already has valid channel context for given radio, channel |
3279 | + * context iteration return num_chanctx > 0. So fix rx_channel |
3280 | + * when restart is in progress. |
3281 | + */ |
3282 | ar->rx_channel = ctx->def.chan; |
3283 | } else { |
3284 | ar->rx_channel = NULL; |
3285 | diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c |
3286 | index 803030fd17d3..6a2a16856763 100644 |
3287 | --- a/drivers/net/wireless/ath/ath5k/led.c |
3288 | +++ b/drivers/net/wireless/ath/ath5k/led.c |
3289 | @@ -77,7 +77,7 @@ static const struct pci_device_id ath5k_led_devices[] = { |
3290 | /* HP Compaq CQ60-206US (ddreggors@jumptv.com) */ |
3291 | { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137a), ATH_LED(3, 1) }, |
3292 | /* HP Compaq C700 (nitrousnrg@gmail.com) */ |
3293 | - { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137b), ATH_LED(3, 1) }, |
3294 | + { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137b), ATH_LED(3, 0) }, |
3295 | /* LiteOn AR5BXB63 (magooz@salug.it) */ |
3296 | { ATH_SDEVICE(PCI_VENDOR_ID_ATHEROS, 0x3067), ATH_LED(3, 0) }, |
3297 | /* IBM-specific AR5212 (all others) */ |
3298 | diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c |
3299 | index 1c226d63bb03..deded2a9a860 100644 |
3300 | --- a/drivers/net/wireless/ath/ath9k/init.c |
3301 | +++ b/drivers/net/wireless/ath/ath9k/init.c |
3302 | @@ -49,6 +49,10 @@ int ath9k_led_blink; |
3303 | module_param_named(blink, ath9k_led_blink, int, 0444); |
3304 | MODULE_PARM_DESC(blink, "Enable LED blink on activity"); |
3305 | |
3306 | +static int ath9k_led_active_high = -1; |
3307 | +module_param_named(led_active_high, ath9k_led_active_high, int, 0444); |
3308 | +MODULE_PARM_DESC(led_active_high, "Invert LED polarity"); |
3309 | + |
3310 | static int ath9k_btcoex_enable; |
3311 | module_param_named(btcoex_enable, ath9k_btcoex_enable, int, 0444); |
3312 | MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence"); |
3313 | @@ -600,6 +604,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, |
3314 | if (ret) |
3315 | return ret; |
3316 | |
3317 | + if (ath9k_led_active_high != -1) |
3318 | + ah->config.led_active_high = ath9k_led_active_high == 1; |
3319 | + |
3320 | /* |
3321 | * Enable WLAN/BT RX Antenna diversity only when: |
3322 | * |
3323 | diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c |
3324 | index e6fef1be9977..7cdaf40c3057 100644 |
3325 | --- a/drivers/net/wireless/ath/ath9k/pci.c |
3326 | +++ b/drivers/net/wireless/ath/ath9k/pci.c |
3327 | @@ -28,6 +28,16 @@ static const struct pci_device_id ath_pci_id_table[] = { |
3328 | { PCI_VDEVICE(ATHEROS, 0x0024) }, /* PCI-E */ |
3329 | { PCI_VDEVICE(ATHEROS, 0x0027) }, /* PCI */ |
3330 | { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI */ |
3331 | + |
3332 | +#ifdef CONFIG_ATH9K_PCOEM |
3333 | + /* Mini PCI AR9220 MB92 cards: Compex WLM200NX, Wistron DNMA-92 */ |
3334 | + { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS, |
3335 | + 0x0029, |
3336 | + PCI_VENDOR_ID_ATHEROS, |
3337 | + 0x2096), |
3338 | + .driver_data = ATH9K_PCI_LED_ACT_HI }, |
3339 | +#endif |
3340 | + |
3341 | { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */ |
3342 | |
3343 | #ifdef CONFIG_ATH9K_PCOEM |
3344 | diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c |
3345 | index 0517a4f2d3f2..7a40d8dffa36 100644 |
3346 | --- a/drivers/net/wireless/realtek/rtlwifi/base.c |
3347 | +++ b/drivers/net/wireless/realtek/rtlwifi/base.c |
3348 | @@ -1660,9 +1660,9 @@ void rtl_watchdog_wq_callback(void *data) |
3349 | if (((rtlpriv->link_info.num_rx_inperiod + |
3350 | rtlpriv->link_info.num_tx_inperiod) > 8) || |
3351 | (rtlpriv->link_info.num_rx_inperiod > 2)) |
3352 | - rtl_lps_enter(hw); |
3353 | - else |
3354 | rtl_lps_leave(hw); |
3355 | + else |
3356 | + rtl_lps_enter(hw); |
3357 | } |
3358 | |
3359 | rtlpriv->link_info.num_rx_inperiod = 0; |
3360 | diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c |
3361 | index c43ab59a690a..77cbd10e807d 100644 |
3362 | --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c |
3363 | +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c |
3364 | @@ -1203,7 +1203,6 @@ static void btc8723b2ant_set_ant_path(struct btc_coexist *btcoexist, |
3365 | |
3366 | /* Force GNT_BT to low */ |
3367 | btcoexist->btc_write_1byte_bitmask(btcoexist, 0x765, 0x18, 0x0); |
3368 | - btcoexist->btc_write_2byte(btcoexist, 0x948, 0x0); |
3369 | |
3370 | if (board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT) { |
3371 | /* tell firmware "no antenna inverse" */ |
3372 | @@ -1211,19 +1210,25 @@ static void btc8723b2ant_set_ant_path(struct btc_coexist *btcoexist, |
3373 | h2c_parameter[1] = 1; /* ext switch type */ |
3374 | btcoexist->btc_fill_h2c(btcoexist, 0x65, 2, |
3375 | h2c_parameter); |
3376 | + btcoexist->btc_write_2byte(btcoexist, 0x948, 0x0); |
3377 | } else { |
3378 | /* tell firmware "antenna inverse" */ |
3379 | h2c_parameter[0] = 1; |
3380 | h2c_parameter[1] = 1; /* ext switch type */ |
3381 | btcoexist->btc_fill_h2c(btcoexist, 0x65, 2, |
3382 | h2c_parameter); |
3383 | + btcoexist->btc_write_2byte(btcoexist, 0x948, 0x280); |
3384 | } |
3385 | } |
3386 | |
3387 | /* ext switch setting */ |
3388 | if (use_ext_switch) { |
3389 | /* fixed internal switch S1->WiFi, S0->BT */ |
3390 | - btcoexist->btc_write_2byte(btcoexist, 0x948, 0x0); |
3391 | + if (board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT) |
3392 | + btcoexist->btc_write_2byte(btcoexist, 0x948, 0x0); |
3393 | + else |
3394 | + btcoexist->btc_write_2byte(btcoexist, 0x948, 0x280); |
3395 | + |
3396 | switch (antpos_type) { |
3397 | case BTC_ANT_WIFI_AT_MAIN: |
3398 | /* ext switch main at wifi */ |
3399 | diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c |
3400 | index b2791c893417..babd1490f20c 100644 |
3401 | --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c |
3402 | +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c |
3403 | @@ -965,13 +965,38 @@ void exhalbtc_set_chip_type(u8 chip_type) |
3404 | } |
3405 | } |
3406 | |
3407 | -void exhalbtc_set_ant_num(u8 type, u8 ant_num) |
3408 | +void exhalbtc_set_ant_num(struct rtl_priv *rtlpriv, u8 type, u8 ant_num) |
3409 | { |
3410 | if (BT_COEX_ANT_TYPE_PG == type) { |
3411 | gl_bt_coexist.board_info.pg_ant_num = ant_num; |
3412 | gl_bt_coexist.board_info.btdm_ant_num = ant_num; |
3413 | + /* The antenna position: |
3414 | + * Main (default) or Aux for pgAntNum=2 && btdmAntNum =1. |
3415 | + * The antenna position should be determined by |
3416 | + * auto-detect mechanism. |
3417 | + * The following is assumed to main, |
3418 | + * and those must be modified |
3419 | + * if y auto-detect mechanism is ready |
3420 | + */ |
3421 | + if ((gl_bt_coexist.board_info.pg_ant_num == 2) && |
3422 | + (gl_bt_coexist.board_info.btdm_ant_num == 1)) |
3423 | + gl_bt_coexist.board_info.btdm_ant_pos = |
3424 | + BTC_ANTENNA_AT_MAIN_PORT; |
3425 | + else |
3426 | + gl_bt_coexist.board_info.btdm_ant_pos = |
3427 | + BTC_ANTENNA_AT_MAIN_PORT; |
3428 | } else if (BT_COEX_ANT_TYPE_ANTDIV == type) { |
3429 | gl_bt_coexist.board_info.btdm_ant_num = ant_num; |
3430 | + gl_bt_coexist.board_info.btdm_ant_pos = |
3431 | + BTC_ANTENNA_AT_MAIN_PORT; |
3432 | + } else if (type == BT_COEX_ANT_TYPE_DETECTED) { |
3433 | + gl_bt_coexist.board_info.btdm_ant_num = ant_num; |
3434 | + if (rtlpriv->cfg->mod_params->ant_sel == 1) |
3435 | + gl_bt_coexist.board_info.btdm_ant_pos = |
3436 | + BTC_ANTENNA_AT_AUX_PORT; |
3437 | + else |
3438 | + gl_bt_coexist.board_info.btdm_ant_pos = |
3439 | + BTC_ANTENNA_AT_MAIN_PORT; |
3440 | } |
3441 | } |
3442 | |
3443 | diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h |
3444 | index 0a903ea179ef..f41ca57dd8a7 100644 |
3445 | --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h |
3446 | +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h |
3447 | @@ -535,7 +535,7 @@ void exhalbtc_set_bt_patch_version(u16 bt_hci_version, u16 bt_patch_version); |
3448 | void exhalbtc_update_min_bt_rssi(char bt_rssi); |
3449 | void exhalbtc_set_bt_exist(bool bt_exist); |
3450 | void exhalbtc_set_chip_type(u8 chip_type); |
3451 | -void exhalbtc_set_ant_num(u8 type, u8 ant_num); |
3452 | +void exhalbtc_set_ant_num(struct rtl_priv *rtlpriv, u8 type, u8 ant_num); |
3453 | void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist); |
3454 | void exhalbtc_signal_compensation(struct btc_coexist *btcoexist, |
3455 | u8 *rssi_wifi, u8 *rssi_bt); |
3456 | diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c |
3457 | index b9b0cb7af8ea..d3fd9211b3a4 100644 |
3458 | --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c |
3459 | +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c |
3460 | @@ -72,7 +72,10 @@ void rtl_btc_init_hal_vars(struct rtl_priv *rtlpriv) |
3461 | __func__, bt_type); |
3462 | exhalbtc_set_chip_type(bt_type); |
3463 | |
3464 | - exhalbtc_set_ant_num(BT_COEX_ANT_TYPE_PG, ant_num); |
3465 | + if (rtlpriv->cfg->mod_params->ant_sel == 1) |
3466 | + exhalbtc_set_ant_num(rtlpriv, BT_COEX_ANT_TYPE_DETECTED, 1); |
3467 | + else |
3468 | + exhalbtc_set_ant_num(rtlpriv, BT_COEX_ANT_TYPE_PG, ant_num); |
3469 | } |
3470 | |
3471 | void rtl_btc_init_hw_config(struct rtl_priv *rtlpriv) |
3472 | diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c |
3473 | index 283d608b9973..e5037d13b772 100644 |
3474 | --- a/drivers/net/wireless/realtek/rtlwifi/pci.c |
3475 | +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c |
3476 | @@ -1573,7 +1573,7 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw) |
3477 | true, |
3478 | HW_DESC_TXBUFF_ADDR), |
3479 | skb->len, PCI_DMA_TODEVICE); |
3480 | - kfree_skb(skb); |
3481 | + dev_kfree_skb_irq(skb); |
3482 | ring->idx = (ring->idx + 1) % ring->entries; |
3483 | } |
3484 | ring->idx = 0; |
3485 | diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c |
3486 | index c983d2fe147f..5a3df9198ddf 100644 |
3487 | --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c |
3488 | +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c |
3489 | @@ -2684,6 +2684,7 @@ void rtl8723be_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, |
3490 | bool auto_load_fail, u8 *hwinfo) |
3491 | { |
3492 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
3493 | + struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params; |
3494 | u8 value; |
3495 | u32 tmpu_32; |
3496 | |
3497 | @@ -2702,6 +2703,10 @@ void rtl8723be_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, |
3498 | rtlpriv->btcoexist.btc_info.ant_num = ANT_X2; |
3499 | } |
3500 | |
3501 | + /* override ant_num / ant_path */ |
3502 | + if (mod_params->ant_sel) |
3503 | + rtlpriv->btcoexist.btc_info.ant_num = |
3504 | + (mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1); |
3505 | } |
3506 | |
3507 | void rtl8723be_bt_reg_init(struct ieee80211_hw *hw) |
3508 | diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c |
3509 | index a78eaeda0008..2101793438ed 100644 |
3510 | --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c |
3511 | +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c |
3512 | @@ -273,6 +273,7 @@ static struct rtl_mod_params rtl8723be_mod_params = { |
3513 | .msi_support = false, |
3514 | .disable_watchdog = false, |
3515 | .debug = DBG_EMERG, |
3516 | + .ant_sel = 0, |
3517 | }; |
3518 | |
3519 | static struct rtl_hal_cfg rtl8723be_hal_cfg = { |
3520 | @@ -394,6 +395,7 @@ module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444); |
3521 | module_param_named(msi, rtl8723be_mod_params.msi_support, bool, 0444); |
3522 | module_param_named(disable_watchdog, rtl8723be_mod_params.disable_watchdog, |
3523 | bool, 0444); |
3524 | +module_param_named(ant_sel, rtl8723be_mod_params.ant_sel, int, 0444); |
3525 | MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); |
3526 | MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); |
3527 | MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); |
3528 | @@ -402,6 +404,7 @@ MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 0)\n"); |
3529 | MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); |
3530 | MODULE_PARM_DESC(disable_watchdog, |
3531 | "Set to 1 to disable the watchdog (default 0)\n"); |
3532 | +MODULE_PARM_DESC(ant_sel, "Set to 1 or 2 to force antenna number (default 0)\n"); |
3533 | |
3534 | static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); |
3535 | |
3536 | diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h |
3537 | index 554d81420f19..93bd7fcd2b61 100644 |
3538 | --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h |
3539 | +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h |
3540 | @@ -2246,6 +2246,9 @@ struct rtl_mod_params { |
3541 | |
3542 | /* default 0: 1 means do not disable interrupts */ |
3543 | bool int_clear; |
3544 | + |
3545 | + /* select antenna */ |
3546 | + int ant_sel; |
3547 | }; |
3548 | |
3549 | struct rtl_hal_usbint_cfg { |
3550 | diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c |
3551 | index 8004f67c57ec..bf8405fb4ace 100644 |
3552 | --- a/drivers/pci/probe.c |
3553 | +++ b/drivers/pci/probe.c |
3554 | @@ -179,9 +179,6 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, |
3555 | u16 orig_cmd; |
3556 | struct pci_bus_region region, inverted_region; |
3557 | |
3558 | - if (dev->non_compliant_bars) |
3559 | - return 0; |
3560 | - |
3561 | mask = type ? PCI_ROM_ADDRESS_MASK : ~0; |
3562 | |
3563 | /* No printks while decoding is disabled! */ |
3564 | @@ -322,6 +319,9 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) |
3565 | { |
3566 | unsigned int pos, reg; |
3567 | |
3568 | + if (dev->non_compliant_bars) |
3569 | + return; |
3570 | + |
3571 | for (pos = 0; pos < howmany; pos++) { |
3572 | struct resource *res = &dev->resource[pos]; |
3573 | reg = PCI_BASE_ADDRESS_0 + (pos << 2); |
3574 | diff --git a/drivers/pinctrl/samsung/pinctrl-exynos5440.c b/drivers/pinctrl/samsung/pinctrl-exynos5440.c |
3575 | index 00ab63abf1d9..dbbdf652c34a 100644 |
3576 | --- a/drivers/pinctrl/samsung/pinctrl-exynos5440.c |
3577 | +++ b/drivers/pinctrl/samsung/pinctrl-exynos5440.c |
3578 | @@ -107,6 +107,7 @@ struct exynos5440_pmx_func { |
3579 | * @nr_groups: number of pin groups available. |
3580 | * @pmx_functions: list of pin functions parsed from device tree. |
3581 | * @nr_functions: number of pin functions available. |
3582 | + * @range: gpio range to register with pinctrl |
3583 | */ |
3584 | struct exynos5440_pinctrl_priv_data { |
3585 | void __iomem *reg_base; |
3586 | @@ -117,6 +118,7 @@ struct exynos5440_pinctrl_priv_data { |
3587 | unsigned int nr_groups; |
3588 | const struct exynos5440_pmx_func *pmx_functions; |
3589 | unsigned int nr_functions; |
3590 | + struct pinctrl_gpio_range range; |
3591 | }; |
3592 | |
3593 | /** |
3594 | @@ -742,7 +744,6 @@ static int exynos5440_pinctrl_register(struct platform_device *pdev, |
3595 | struct pinctrl_desc *ctrldesc; |
3596 | struct pinctrl_dev *pctl_dev; |
3597 | struct pinctrl_pin_desc *pindesc, *pdesc; |
3598 | - struct pinctrl_gpio_range grange; |
3599 | char *pin_names; |
3600 | int pin, ret; |
3601 | |
3602 | @@ -794,12 +795,12 @@ static int exynos5440_pinctrl_register(struct platform_device *pdev, |
3603 | return PTR_ERR(pctl_dev); |
3604 | } |
3605 | |
3606 | - grange.name = "exynos5440-pctrl-gpio-range"; |
3607 | - grange.id = 0; |
3608 | - grange.base = 0; |
3609 | - grange.npins = EXYNOS5440_MAX_PINS; |
3610 | - grange.gc = priv->gc; |
3611 | - pinctrl_add_gpio_range(pctl_dev, &grange); |
3612 | + priv->range.name = "exynos5440-pctrl-gpio-range"; |
3613 | + priv->range.id = 0; |
3614 | + priv->range.base = 0; |
3615 | + priv->range.npins = EXYNOS5440_MAX_PINS; |
3616 | + priv->range.gc = priv->gc; |
3617 | + pinctrl_add_gpio_range(pctl_dev, &priv->range); |
3618 | return 0; |
3619 | } |
3620 | |
3621 | diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
3622 | index e0b764284773..fd0e4e37f4e1 100644 |
3623 | --- a/drivers/regulator/core.c |
3624 | +++ b/drivers/regulator/core.c |
3625 | @@ -3840,6 +3840,11 @@ static void rdev_init_debugfs(struct regulator_dev *rdev) |
3626 | &rdev->bypass_count); |
3627 | } |
3628 | |
3629 | +static int regulator_register_resolve_supply(struct device *dev, void *data) |
3630 | +{ |
3631 | + return regulator_resolve_supply(dev_to_rdev(dev)); |
3632 | +} |
3633 | + |
3634 | /** |
3635 | * regulator_register - register regulator |
3636 | * @regulator_desc: regulator to register |
3637 | @@ -3986,8 +3991,11 @@ regulator_register(const struct regulator_desc *regulator_desc, |
3638 | } |
3639 | |
3640 | rdev_init_debugfs(rdev); |
3641 | -out: |
3642 | mutex_unlock(®ulator_list_mutex); |
3643 | + |
3644 | + /* try to resolve regulators supply since a new one was registered */ |
3645 | + class_for_each_device(®ulator_class, NULL, NULL, |
3646 | + regulator_register_resolve_supply); |
3647 | kfree(config); |
3648 | return rdev; |
3649 | |
3650 | @@ -3998,15 +4006,16 @@ scrub: |
3651 | regulator_ena_gpio_free(rdev); |
3652 | device_unregister(&rdev->dev); |
3653 | /* device core frees rdev */ |
3654 | - rdev = ERR_PTR(ret); |
3655 | goto out; |
3656 | |
3657 | wash: |
3658 | regulator_ena_gpio_free(rdev); |
3659 | clean: |
3660 | kfree(rdev); |
3661 | - rdev = ERR_PTR(ret); |
3662 | - goto out; |
3663 | +out: |
3664 | + mutex_unlock(®ulator_list_mutex); |
3665 | + kfree(config); |
3666 | + return ERR_PTR(ret); |
3667 | } |
3668 | EXPORT_SYMBOL_GPL(regulator_register); |
3669 | |
3670 | diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h |
3671 | index efa493cf1bc6..edc2643df4d6 100644 |
3672 | --- a/drivers/scsi/aacraid/aacraid.h |
3673 | +++ b/drivers/scsi/aacraid/aacraid.h |
3674 | @@ -29,6 +29,7 @@ enum { |
3675 | #define AAC_INT_MODE_MSI (1<<1) |
3676 | #define AAC_INT_MODE_AIF (1<<2) |
3677 | #define AAC_INT_MODE_SYNC (1<<3) |
3678 | +#define AAC_INT_MODE_MSIX (1<<16) |
3679 | |
3680 | #define AAC_INT_ENABLE_TYPE1_INTX 0xfffffffb |
3681 | #define AAC_INT_ENABLE_TYPE1_MSIX 0xfffffffa |
3682 | diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c |
3683 | index 2b4e75380ae6..87397deffb1f 100644 |
3684 | --- a/drivers/scsi/aacraid/comminit.c |
3685 | +++ b/drivers/scsi/aacraid/comminit.c |
3686 | @@ -37,6 +37,7 @@ |
3687 | #include <linux/spinlock.h> |
3688 | #include <linux/slab.h> |
3689 | #include <linux/blkdev.h> |
3690 | +#include <linux/delay.h> |
3691 | #include <linux/completion.h> |
3692 | #include <linux/mm.h> |
3693 | #include <scsi/scsi_host.h> |
3694 | @@ -47,6 +48,20 @@ struct aac_common aac_config = { |
3695 | .irq_mod = 1 |
3696 | }; |
3697 | |
3698 | +static inline int aac_is_msix_mode(struct aac_dev *dev) |
3699 | +{ |
3700 | + u32 status; |
3701 | + |
3702 | + status = src_readl(dev, MUnit.OMR); |
3703 | + return (status & AAC_INT_MODE_MSIX); |
3704 | +} |
3705 | + |
3706 | +static inline void aac_change_to_intx(struct aac_dev *dev) |
3707 | +{ |
3708 | + aac_src_access_devreg(dev, AAC_DISABLE_MSIX); |
3709 | + aac_src_access_devreg(dev, AAC_ENABLE_INTX); |
3710 | +} |
3711 | + |
3712 | static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long commsize, unsigned long commalign) |
3713 | { |
3714 | unsigned char *base; |
3715 | @@ -427,6 +442,15 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev) |
3716 | dev->comm_interface = AAC_COMM_PRODUCER; |
3717 | dev->raw_io_interface = dev->raw_io_64 = 0; |
3718 | |
3719 | + |
3720 | + /* |
3721 | + * Enable INTX mode, if not done already Enabled |
3722 | + */ |
3723 | + if (aac_is_msix_mode(dev)) { |
3724 | + aac_change_to_intx(dev); |
3725 | + dev_info(&dev->pdev->dev, "Changed firmware to INTX mode"); |
3726 | + } |
3727 | + |
3728 | if ((!aac_adapter_sync_cmd(dev, GET_ADAPTER_PROPERTIES, |
3729 | 0, 0, 0, 0, 0, 0, |
3730 | status+0, status+1, status+2, status+3, NULL)) && |
3731 | diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c |
3732 | index 511bbc575062..bb7988d53216 100644 |
3733 | --- a/drivers/scsi/aacraid/commsup.c |
3734 | +++ b/drivers/scsi/aacraid/commsup.c |
3735 | @@ -637,10 +637,10 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, |
3736 | } |
3737 | return -EFAULT; |
3738 | } |
3739 | - /* We used to udelay() here but that absorbed |
3740 | - * a CPU when a timeout occured. Not very |
3741 | - * useful. */ |
3742 | - cpu_relax(); |
3743 | + /* |
3744 | + * Allow other processes / CPUS to use core |
3745 | + */ |
3746 | + schedule(); |
3747 | } |
3748 | } else if (down_interruptible(&fibptr->event_wait)) { |
3749 | /* Do nothing ... satisfy |
3750 | @@ -1996,6 +1996,10 @@ int aac_command_thread(void *data) |
3751 | if (difference <= 0) |
3752 | difference = 1; |
3753 | set_current_state(TASK_INTERRUPTIBLE); |
3754 | + |
3755 | + if (kthread_should_stop()) |
3756 | + break; |
3757 | + |
3758 | schedule_timeout(difference); |
3759 | |
3760 | if (kthread_should_stop()) |
3761 | diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c |
3762 | index ff6caab8cc8b..79a1cec1a51f 100644 |
3763 | --- a/drivers/scsi/aacraid/linit.c |
3764 | +++ b/drivers/scsi/aacraid/linit.c |
3765 | @@ -1431,8 +1431,8 @@ static int aac_acquire_resources(struct aac_dev *dev) |
3766 | /* After EEH recovery or suspend resume, max_msix count |
3767 | * may change, therfore updating in init as well. |
3768 | */ |
3769 | - aac_adapter_start(dev); |
3770 | dev->init->Sa_MSIXVectors = cpu_to_le32(dev->max_msix); |
3771 | + aac_adapter_start(dev); |
3772 | } |
3773 | return 0; |
3774 | |
3775 | diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c |
3776 | index 4fb3581d4614..3fa65338d3f5 100644 |
3777 | --- a/drivers/scsi/lpfc/lpfc_mem.c |
3778 | +++ b/drivers/scsi/lpfc/lpfc_mem.c |
3779 | @@ -231,13 +231,15 @@ lpfc_mem_free(struct lpfc_hba *phba) |
3780 | if (phba->lpfc_hbq_pool) |
3781 | pci_pool_destroy(phba->lpfc_hbq_pool); |
3782 | phba->lpfc_hbq_pool = NULL; |
3783 | - mempool_destroy(phba->rrq_pool); |
3784 | + |
3785 | + if (phba->rrq_pool) |
3786 | + mempool_destroy(phba->rrq_pool); |
3787 | phba->rrq_pool = NULL; |
3788 | |
3789 | /* Free NLP memory pool */ |
3790 | mempool_destroy(phba->nlp_mem_pool); |
3791 | phba->nlp_mem_pool = NULL; |
3792 | - if (phba->sli_rev == LPFC_SLI_REV4) { |
3793 | + if (phba->sli_rev == LPFC_SLI_REV4 && phba->active_rrq_pool) { |
3794 | mempool_destroy(phba->active_rrq_pool); |
3795 | phba->active_rrq_pool = NULL; |
3796 | } |
3797 | diff --git a/drivers/staging/rdma/hfi1/qp.c b/drivers/staging/rdma/hfi1/qp.c |
3798 | index dc9119e1b458..0401955b3b04 100644 |
3799 | --- a/drivers/staging/rdma/hfi1/qp.c |
3800 | +++ b/drivers/staging/rdma/hfi1/qp.c |
3801 | @@ -512,6 +512,7 @@ static void iowait_wakeup(struct iowait *wait, int reason) |
3802 | static void iowait_sdma_drained(struct iowait *wait) |
3803 | { |
3804 | struct rvt_qp *qp = iowait_to_qp(wait); |
3805 | + unsigned long flags; |
3806 | |
3807 | /* |
3808 | * This happens when the send engine notes |
3809 | @@ -519,12 +520,12 @@ static void iowait_sdma_drained(struct iowait *wait) |
3810 | * do the flush work until that QP's |
3811 | * sdma work has finished. |
3812 | */ |
3813 | - spin_lock(&qp->s_lock); |
3814 | + spin_lock_irqsave(&qp->s_lock, flags); |
3815 | if (qp->s_flags & RVT_S_WAIT_DMA) { |
3816 | qp->s_flags &= ~RVT_S_WAIT_DMA; |
3817 | hfi1_schedule_send(qp); |
3818 | } |
3819 | - spin_unlock(&qp->s_lock); |
3820 | + spin_unlock_irqrestore(&qp->s_lock, flags); |
3821 | } |
3822 | |
3823 | /** |
3824 | diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c |
3825 | index 1a7dc3c590b1..481eb2989a1e 100644 |
3826 | --- a/drivers/tty/serial/ucc_uart.c |
3827 | +++ b/drivers/tty/serial/ucc_uart.c |
3828 | @@ -1478,6 +1478,9 @@ static const struct of_device_id ucc_uart_match[] = { |
3829 | .type = "serial", |
3830 | .compatible = "ucc_uart", |
3831 | }, |
3832 | + { |
3833 | + .compatible = "fsl,t1040-ucc-uart", |
3834 | + }, |
3835 | {}, |
3836 | }; |
3837 | MODULE_DEVICE_TABLE(of, ucc_uart_match); |
3838 | diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c |
3839 | index cb7138c97c69..71d49a95f8c0 100644 |
3840 | --- a/drivers/xen/events/events_base.c |
3841 | +++ b/drivers/xen/events/events_base.c |
3842 | @@ -487,7 +487,8 @@ static void eoi_pirq(struct irq_data *data) |
3843 | if (!VALID_EVTCHN(evtchn)) |
3844 | return; |
3845 | |
3846 | - if (unlikely(irqd_is_setaffinity_pending(data))) { |
3847 | + if (unlikely(irqd_is_setaffinity_pending(data)) && |
3848 | + likely(!irqd_irq_disabled(data))) { |
3849 | int masked = test_and_set_mask(evtchn); |
3850 | |
3851 | clear_evtchn(evtchn); |
3852 | @@ -1370,7 +1371,8 @@ static void ack_dynirq(struct irq_data *data) |
3853 | if (!VALID_EVTCHN(evtchn)) |
3854 | return; |
3855 | |
3856 | - if (unlikely(irqd_is_setaffinity_pending(data))) { |
3857 | + if (unlikely(irqd_is_setaffinity_pending(data)) && |
3858 | + likely(!irqd_irq_disabled(data))) { |
3859 | int masked = test_and_set_mask(evtchn); |
3860 | |
3861 | clear_evtchn(evtchn); |
3862 | diff --git a/fs/affs/super.c b/fs/affs/super.c |
3863 | index 2a6713b6b9f4..d6384863192c 100644 |
3864 | --- a/fs/affs/super.c |
3865 | +++ b/fs/affs/super.c |
3866 | @@ -528,7 +528,7 @@ affs_remount(struct super_block *sb, int *flags, char *data) |
3867 | char *prefix = NULL; |
3868 | |
3869 | new_opts = kstrdup(data, GFP_KERNEL); |
3870 | - if (!new_opts) |
3871 | + if (data && !new_opts) |
3872 | return -ENOMEM; |
3873 | |
3874 | pr_debug("%s(flags=0x%x,opts=\"%s\")\n", __func__, *flags, data); |
3875 | @@ -546,7 +546,8 @@ affs_remount(struct super_block *sb, int *flags, char *data) |
3876 | } |
3877 | |
3878 | flush_delayed_work(&sbi->sb_work); |
3879 | - replace_mount_options(sb, new_opts); |
3880 | + if (new_opts) |
3881 | + replace_mount_options(sb, new_opts); |
3882 | |
3883 | sbi->s_flags = mount_flags; |
3884 | sbi->s_mode = mode; |
3885 | diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c |
3886 | index 237b877d316d..3da4cf8d18b6 100644 |
3887 | --- a/fs/ext4/ialloc.c |
3888 | +++ b/fs/ext4/ialloc.c |
3889 | @@ -1150,25 +1150,20 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) |
3890 | unsigned long max_ino = le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count); |
3891 | ext4_group_t block_group; |
3892 | int bit; |
3893 | - struct buffer_head *bitmap_bh; |
3894 | + struct buffer_head *bitmap_bh = NULL; |
3895 | struct inode *inode = NULL; |
3896 | - long err = -EIO; |
3897 | + int err = -EFSCORRUPTED; |
3898 | |
3899 | - /* Error cases - e2fsck has already cleaned up for us */ |
3900 | - if (ino > max_ino) { |
3901 | - ext4_warning(sb, "bad orphan ino %lu! e2fsck was run?", ino); |
3902 | - err = -EFSCORRUPTED; |
3903 | - goto error; |
3904 | - } |
3905 | + if (ino < EXT4_FIRST_INO(sb) || ino > max_ino) |
3906 | + goto bad_orphan; |
3907 | |
3908 | block_group = (ino - 1) / EXT4_INODES_PER_GROUP(sb); |
3909 | bit = (ino - 1) % EXT4_INODES_PER_GROUP(sb); |
3910 | bitmap_bh = ext4_read_inode_bitmap(sb, block_group); |
3911 | if (IS_ERR(bitmap_bh)) { |
3912 | - err = PTR_ERR(bitmap_bh); |
3913 | - ext4_warning(sb, "inode bitmap error %ld for orphan %lu", |
3914 | - ino, err); |
3915 | - goto error; |
3916 | + ext4_error(sb, "inode bitmap error %ld for orphan %lu", |
3917 | + ino, PTR_ERR(bitmap_bh)); |
3918 | + return (struct inode *) bitmap_bh; |
3919 | } |
3920 | |
3921 | /* Having the inode bit set should be a 100% indicator that this |
3922 | @@ -1179,15 +1174,21 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) |
3923 | goto bad_orphan; |
3924 | |
3925 | inode = ext4_iget(sb, ino); |
3926 | - if (IS_ERR(inode)) |
3927 | - goto iget_failed; |
3928 | + if (IS_ERR(inode)) { |
3929 | + err = PTR_ERR(inode); |
3930 | + ext4_error(sb, "couldn't read orphan inode %lu (err %d)", |
3931 | + ino, err); |
3932 | + return inode; |
3933 | + } |
3934 | |
3935 | /* |
3936 | - * If the orphans has i_nlinks > 0 then it should be able to be |
3937 | - * truncated, otherwise it won't be removed from the orphan list |
3938 | - * during processing and an infinite loop will result. |
3939 | + * If the orphans has i_nlinks > 0 then it should be able to |
3940 | + * be truncated, otherwise it won't be removed from the orphan |
3941 | + * list during processing and an infinite loop will result. |
3942 | + * Similarly, it must not be a bad inode. |
3943 | */ |
3944 | - if (inode->i_nlink && !ext4_can_truncate(inode)) |
3945 | + if ((inode->i_nlink && !ext4_can_truncate(inode)) || |
3946 | + is_bad_inode(inode)) |
3947 | goto bad_orphan; |
3948 | |
3949 | if (NEXT_ORPHAN(inode) > max_ino) |
3950 | @@ -1195,29 +1196,25 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) |
3951 | brelse(bitmap_bh); |
3952 | return inode; |
3953 | |
3954 | -iget_failed: |
3955 | - err = PTR_ERR(inode); |
3956 | - inode = NULL; |
3957 | bad_orphan: |
3958 | - ext4_warning(sb, "bad orphan inode %lu! e2fsck was run?", ino); |
3959 | - printk(KERN_WARNING "ext4_test_bit(bit=%d, block=%llu) = %d\n", |
3960 | - bit, (unsigned long long)bitmap_bh->b_blocknr, |
3961 | - ext4_test_bit(bit, bitmap_bh->b_data)); |
3962 | - printk(KERN_WARNING "inode=%p\n", inode); |
3963 | + ext4_error(sb, "bad orphan inode %lu", ino); |
3964 | + if (bitmap_bh) |
3965 | + printk(KERN_ERR "ext4_test_bit(bit=%d, block=%llu) = %d\n", |
3966 | + bit, (unsigned long long)bitmap_bh->b_blocknr, |
3967 | + ext4_test_bit(bit, bitmap_bh->b_data)); |
3968 | if (inode) { |
3969 | - printk(KERN_WARNING "is_bad_inode(inode)=%d\n", |
3970 | + printk(KERN_ERR "is_bad_inode(inode)=%d\n", |
3971 | is_bad_inode(inode)); |
3972 | - printk(KERN_WARNING "NEXT_ORPHAN(inode)=%u\n", |
3973 | + printk(KERN_ERR "NEXT_ORPHAN(inode)=%u\n", |
3974 | NEXT_ORPHAN(inode)); |
3975 | - printk(KERN_WARNING "max_ino=%lu\n", max_ino); |
3976 | - printk(KERN_WARNING "i_nlink=%u\n", inode->i_nlink); |
3977 | + printk(KERN_ERR "max_ino=%lu\n", max_ino); |
3978 | + printk(KERN_ERR "i_nlink=%u\n", inode->i_nlink); |
3979 | /* Avoid freeing blocks if we got a bad deleted inode */ |
3980 | if (inode->i_nlink == 0) |
3981 | inode->i_blocks = 0; |
3982 | iput(inode); |
3983 | } |
3984 | brelse(bitmap_bh); |
3985 | -error: |
3986 | return ERR_PTR(err); |
3987 | } |
3988 | |
3989 | diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
3990 | index 981a1fc30eaa..250c2df04a92 100644 |
3991 | --- a/fs/ext4/inode.c |
3992 | +++ b/fs/ext4/inode.c |
3993 | @@ -684,6 +684,21 @@ out_sem: |
3994 | ret = check_block_validity(inode, map); |
3995 | if (ret != 0) |
3996 | return ret; |
3997 | + |
3998 | + /* |
3999 | + * Inodes with freshly allocated blocks where contents will be |
4000 | + * visible after transaction commit must be on transaction's |
4001 | + * ordered data list. |
4002 | + */ |
4003 | + if (map->m_flags & EXT4_MAP_NEW && |
4004 | + !(map->m_flags & EXT4_MAP_UNWRITTEN) && |
4005 | + !(flags & EXT4_GET_BLOCKS_ZERO) && |
4006 | + !IS_NOQUOTA(inode) && |
4007 | + ext4_should_order_data(inode)) { |
4008 | + ret = ext4_jbd2_file_inode(handle, inode); |
4009 | + if (ret) |
4010 | + return ret; |
4011 | + } |
4012 | } |
4013 | return retval; |
4014 | } |
4015 | @@ -1289,15 +1304,6 @@ static int ext4_write_end(struct file *file, |
4016 | int i_size_changed = 0; |
4017 | |
4018 | trace_ext4_write_end(inode, pos, len, copied); |
4019 | - if (ext4_test_inode_state(inode, EXT4_STATE_ORDERED_MODE)) { |
4020 | - ret = ext4_jbd2_file_inode(handle, inode); |
4021 | - if (ret) { |
4022 | - unlock_page(page); |
4023 | - put_page(page); |
4024 | - goto errout; |
4025 | - } |
4026 | - } |
4027 | - |
4028 | if (ext4_has_inline_data(inode)) { |
4029 | ret = ext4_write_inline_data_end(inode, pos, len, |
4030 | copied, page); |
4031 | diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c |
4032 | index eae5917c534e..0acf8cacb2be 100644 |
4033 | --- a/fs/ext4/ioctl.c |
4034 | +++ b/fs/ext4/ioctl.c |
4035 | @@ -365,7 +365,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid) |
4036 | struct dquot *transfer_to[MAXQUOTAS] = { }; |
4037 | |
4038 | transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid)); |
4039 | - if (transfer_to[PRJQUOTA]) { |
4040 | + if (!IS_ERR(transfer_to[PRJQUOTA])) { |
4041 | err = __dquot_transfer(inode, transfer_to); |
4042 | dqput(transfer_to[PRJQUOTA]); |
4043 | if (err) |
4044 | diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
4045 | index eeeade76012e..9d26fa2188f6 100644 |
4046 | --- a/fs/ext4/mballoc.c |
4047 | +++ b/fs/ext4/mballoc.c |
4048 | @@ -1266,6 +1266,7 @@ static void ext4_mb_unload_buddy(struct ext4_buddy *e4b) |
4049 | static int mb_find_order_for_block(struct ext4_buddy *e4b, int block) |
4050 | { |
4051 | int order = 1; |
4052 | + int bb_incr = 1 << (e4b->bd_blkbits - 1); |
4053 | void *bb; |
4054 | |
4055 | BUG_ON(e4b->bd_bitmap == e4b->bd_buddy); |
4056 | @@ -1278,7 +1279,8 @@ static int mb_find_order_for_block(struct ext4_buddy *e4b, int block) |
4057 | /* this block is part of buddy of order 'order' */ |
4058 | return order; |
4059 | } |
4060 | - bb += 1 << (e4b->bd_blkbits - order); |
4061 | + bb += bb_incr; |
4062 | + bb_incr >>= 1; |
4063 | order++; |
4064 | } |
4065 | return 0; |
4066 | @@ -2583,7 +2585,7 @@ int ext4_mb_init(struct super_block *sb) |
4067 | { |
4068 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
4069 | unsigned i, j; |
4070 | - unsigned offset; |
4071 | + unsigned offset, offset_incr; |
4072 | unsigned max; |
4073 | int ret; |
4074 | |
4075 | @@ -2612,11 +2614,13 @@ int ext4_mb_init(struct super_block *sb) |
4076 | |
4077 | i = 1; |
4078 | offset = 0; |
4079 | + offset_incr = 1 << (sb->s_blocksize_bits - 1); |
4080 | max = sb->s_blocksize << 2; |
4081 | do { |
4082 | sbi->s_mb_offsets[i] = offset; |
4083 | sbi->s_mb_maxs[i] = max; |
4084 | - offset += 1 << (sb->s_blocksize_bits - i); |
4085 | + offset += offset_incr; |
4086 | + offset_incr = offset_incr >> 1; |
4087 | max = max >> 1; |
4088 | i++; |
4089 | } while (i <= sb->s_blocksize_bits + 1); |
4090 | diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
4091 | index 48e4b8907826..fdd151f91522 100644 |
4092 | --- a/fs/ext4/namei.c |
4093 | +++ b/fs/ext4/namei.c |
4094 | @@ -2828,7 +2828,7 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) |
4095 | * list entries can cause panics at unmount time. |
4096 | */ |
4097 | mutex_lock(&sbi->s_orphan_lock); |
4098 | - list_del(&EXT4_I(inode)->i_orphan); |
4099 | + list_del_init(&EXT4_I(inode)->i_orphan); |
4100 | mutex_unlock(&sbi->s_orphan_lock); |
4101 | } |
4102 | } |
4103 | diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c |
4104 | index 5dafb9cef12e..1ca31c8e27ed 100644 |
4105 | --- a/fs/f2fs/data.c |
4106 | +++ b/fs/f2fs/data.c |
4107 | @@ -1480,7 +1480,8 @@ restart: |
4108 | if (pos + len <= MAX_INLINE_DATA) { |
4109 | read_inline_data(page, ipage); |
4110 | set_inode_flag(F2FS_I(inode), FI_DATA_EXIST); |
4111 | - set_inline_node(ipage); |
4112 | + if (inode->i_nlink) |
4113 | + set_inline_node(ipage); |
4114 | } else { |
4115 | err = f2fs_convert_inline_page(&dn, page); |
4116 | if (err) |
4117 | diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c |
4118 | index 4aaed890048f..776dccbc306d 100644 |
4119 | --- a/fs/nfs/pnfs_nfs.c |
4120 | +++ b/fs/nfs/pnfs_nfs.c |
4121 | @@ -246,6 +246,23 @@ void pnfs_fetch_commit_bucket_list(struct list_head *pages, |
4122 | |
4123 | } |
4124 | |
4125 | +/* Helper function for pnfs_generic_commit_pagelist to catch an empty |
4126 | + * page list. This can happen when two commits race. */ |
4127 | +static bool |
4128 | +pnfs_generic_commit_cancel_empty_pagelist(struct list_head *pages, |
4129 | + struct nfs_commit_data *data, |
4130 | + struct nfs_commit_info *cinfo) |
4131 | +{ |
4132 | + if (list_empty(pages)) { |
4133 | + if (atomic_dec_and_test(&cinfo->mds->rpcs_out)) |
4134 | + wake_up_atomic_t(&cinfo->mds->rpcs_out); |
4135 | + nfs_commitdata_release(data); |
4136 | + return true; |
4137 | + } |
4138 | + |
4139 | + return false; |
4140 | +} |
4141 | + |
4142 | /* This follows nfs_commit_list pretty closely */ |
4143 | int |
4144 | pnfs_generic_commit_pagelist(struct inode *inode, struct list_head *mds_pages, |
4145 | @@ -280,6 +297,11 @@ pnfs_generic_commit_pagelist(struct inode *inode, struct list_head *mds_pages, |
4146 | list_for_each_entry_safe(data, tmp, &list, pages) { |
4147 | list_del_init(&data->pages); |
4148 | if (data->ds_commit_index < 0) { |
4149 | + /* another commit raced with us */ |
4150 | + if (pnfs_generic_commit_cancel_empty_pagelist(mds_pages, |
4151 | + data, cinfo)) |
4152 | + continue; |
4153 | + |
4154 | nfs_init_commit(data, mds_pages, NULL, cinfo); |
4155 | nfs_initiate_commit(NFS_CLIENT(inode), data, |
4156 | NFS_PROTO(data->inode), |
4157 | @@ -288,6 +310,12 @@ pnfs_generic_commit_pagelist(struct inode *inode, struct list_head *mds_pages, |
4158 | LIST_HEAD(pages); |
4159 | |
4160 | pnfs_fetch_commit_bucket_list(&pages, data, cinfo); |
4161 | + |
4162 | + /* another commit raced with us */ |
4163 | + if (pnfs_generic_commit_cancel_empty_pagelist(&pages, |
4164 | + data, cinfo)) |
4165 | + continue; |
4166 | + |
4167 | nfs_init_commit(data, &pages, data->lseg, cinfo); |
4168 | initiate_commit(data, how); |
4169 | } |
4170 | diff --git a/fs/nfs/write.c b/fs/nfs/write.c |
4171 | index 5f4fd53e5764..f5e613395fc2 100644 |
4172 | --- a/fs/nfs/write.c |
4173 | +++ b/fs/nfs/write.c |
4174 | @@ -1709,6 +1709,10 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how, |
4175 | { |
4176 | struct nfs_commit_data *data; |
4177 | |
4178 | + /* another commit raced with us */ |
4179 | + if (list_empty(head)) |
4180 | + return 0; |
4181 | + |
4182 | data = nfs_commitdata_alloc(); |
4183 | |
4184 | if (!data) |
4185 | diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c |
4186 | index ee3aaa0a5317..ca0d3eb44925 100644 |
4187 | --- a/fs/xfs/xfs_fsops.c |
4188 | +++ b/fs/xfs/xfs_fsops.c |
4189 | @@ -243,8 +243,8 @@ xfs_growfs_data_private( |
4190 | agf->agf_roots[XFS_BTNUM_CNTi] = cpu_to_be32(XFS_CNT_BLOCK(mp)); |
4191 | agf->agf_levels[XFS_BTNUM_BNOi] = cpu_to_be32(1); |
4192 | agf->agf_levels[XFS_BTNUM_CNTi] = cpu_to_be32(1); |
4193 | - agf->agf_flfirst = 0; |
4194 | - agf->agf_fllast = cpu_to_be32(XFS_AGFL_SIZE(mp) - 1); |
4195 | + agf->agf_flfirst = cpu_to_be32(1); |
4196 | + agf->agf_fllast = 0; |
4197 | agf->agf_flcount = 0; |
4198 | tmpsize = agsize - XFS_PREALLOC_BLOCKS(mp); |
4199 | agf->agf_freeblks = cpu_to_be32(tmpsize); |
4200 | diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c |
4201 | index 96f606deee31..3cbc9031731b 100644 |
4202 | --- a/fs/xfs/xfs_inode.c |
4203 | +++ b/fs/xfs/xfs_inode.c |
4204 | @@ -3205,13 +3205,14 @@ xfs_iflush_cluster( |
4205 | * We need to check under the i_flags_lock for a valid inode |
4206 | * here. Skip it if it is not valid or the wrong inode. |
4207 | */ |
4208 | - spin_lock(&ip->i_flags_lock); |
4209 | - if (!ip->i_ino || |
4210 | + spin_lock(&iq->i_flags_lock); |
4211 | + if (!iq->i_ino || |
4212 | + __xfs_iflags_test(iq, XFS_ISTALE) || |
4213 | (XFS_INO_TO_AGINO(mp, iq->i_ino) & mask) != first_index) { |
4214 | - spin_unlock(&ip->i_flags_lock); |
4215 | + spin_unlock(&iq->i_flags_lock); |
4216 | continue; |
4217 | } |
4218 | - spin_unlock(&ip->i_flags_lock); |
4219 | + spin_unlock(&iq->i_flags_lock); |
4220 | |
4221 | /* |
4222 | * Do an un-protected check to see if the inode is dirty and |
4223 | @@ -3327,7 +3328,7 @@ xfs_iflush( |
4224 | struct xfs_buf **bpp) |
4225 | { |
4226 | struct xfs_mount *mp = ip->i_mount; |
4227 | - struct xfs_buf *bp; |
4228 | + struct xfs_buf *bp = NULL; |
4229 | struct xfs_dinode *dip; |
4230 | int error; |
4231 | |
4232 | @@ -3369,14 +3370,22 @@ xfs_iflush( |
4233 | } |
4234 | |
4235 | /* |
4236 | - * Get the buffer containing the on-disk inode. |
4237 | + * Get the buffer containing the on-disk inode. We are doing a try-lock |
4238 | + * operation here, so we may get an EAGAIN error. In that case, we |
4239 | + * simply want to return with the inode still dirty. |
4240 | + * |
4241 | + * If we get any other error, we effectively have a corruption situation |
4242 | + * and we cannot flush the inode, so we treat it the same as failing |
4243 | + * xfs_iflush_int(). |
4244 | */ |
4245 | error = xfs_imap_to_bp(mp, NULL, &ip->i_imap, &dip, &bp, XBF_TRYLOCK, |
4246 | 0); |
4247 | - if (error || !bp) { |
4248 | + if (error == -EAGAIN) { |
4249 | xfs_ifunlock(ip); |
4250 | return error; |
4251 | } |
4252 | + if (error) |
4253 | + goto corrupt_out; |
4254 | |
4255 | /* |
4256 | * First flush out the inode that xfs_iflush was called with. |
4257 | @@ -3404,7 +3413,8 @@ xfs_iflush( |
4258 | return 0; |
4259 | |
4260 | corrupt_out: |
4261 | - xfs_buf_relse(bp); |
4262 | + if (bp) |
4263 | + xfs_buf_relse(bp); |
4264 | xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); |
4265 | cluster_corrupt_out: |
4266 | error = -EFSCORRUPTED; |
4267 | diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c |
4268 | index 187e14b696c2..cedf601ca0fe 100644 |
4269 | --- a/fs/xfs/xfs_super.c |
4270 | +++ b/fs/xfs/xfs_super.c |
4271 | @@ -928,7 +928,7 @@ xfs_fs_alloc_inode( |
4272 | |
4273 | /* |
4274 | * Now that the generic code is guaranteed not to be accessing |
4275 | - * the linux inode, we can reclaim the inode. |
4276 | + * the linux inode, we can inactivate and reclaim the inode. |
4277 | */ |
4278 | STATIC void |
4279 | xfs_fs_destroy_inode( |
4280 | @@ -938,9 +938,14 @@ xfs_fs_destroy_inode( |
4281 | |
4282 | trace_xfs_destroy_inode(ip); |
4283 | |
4284 | - XFS_STATS_INC(ip->i_mount, vn_reclaim); |
4285 | + ASSERT(!rwsem_is_locked(&ip->i_iolock.mr_lock)); |
4286 | + XFS_STATS_INC(ip->i_mount, vn_rele); |
4287 | + XFS_STATS_INC(ip->i_mount, vn_remove); |
4288 | + |
4289 | + xfs_inactive(ip); |
4290 | |
4291 | ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0); |
4292 | + XFS_STATS_INC(ip->i_mount, vn_reclaim); |
4293 | |
4294 | /* |
4295 | * We should never get here with one of the reclaim flags already set. |
4296 | @@ -987,24 +992,6 @@ xfs_fs_inode_init_once( |
4297 | "xfsino", ip->i_ino); |
4298 | } |
4299 | |
4300 | -STATIC void |
4301 | -xfs_fs_evict_inode( |
4302 | - struct inode *inode) |
4303 | -{ |
4304 | - xfs_inode_t *ip = XFS_I(inode); |
4305 | - |
4306 | - ASSERT(!rwsem_is_locked(&ip->i_iolock.mr_lock)); |
4307 | - |
4308 | - trace_xfs_evict_inode(ip); |
4309 | - |
4310 | - truncate_inode_pages_final(&inode->i_data); |
4311 | - clear_inode(inode); |
4312 | - XFS_STATS_INC(ip->i_mount, vn_rele); |
4313 | - XFS_STATS_INC(ip->i_mount, vn_remove); |
4314 | - |
4315 | - xfs_inactive(ip); |
4316 | -} |
4317 | - |
4318 | /* |
4319 | * We do an unlocked check for XFS_IDONTCACHE here because we are already |
4320 | * serialised against cache hits here via the inode->i_lock and igrab() in |
4321 | @@ -1276,6 +1263,16 @@ xfs_fs_remount( |
4322 | return -EINVAL; |
4323 | } |
4324 | |
4325 | + if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 && |
4326 | + xfs_sb_has_ro_compat_feature(sbp, |
4327 | + XFS_SB_FEAT_RO_COMPAT_UNKNOWN)) { |
4328 | + xfs_warn(mp, |
4329 | +"ro->rw transition prohibited on unknown (0x%x) ro-compat filesystem", |
4330 | + (sbp->sb_features_ro_compat & |
4331 | + XFS_SB_FEAT_RO_COMPAT_UNKNOWN)); |
4332 | + return -EINVAL; |
4333 | + } |
4334 | + |
4335 | mp->m_flags &= ~XFS_MOUNT_RDONLY; |
4336 | |
4337 | /* |
4338 | @@ -1663,7 +1660,6 @@ xfs_fs_free_cached_objects( |
4339 | static const struct super_operations xfs_super_operations = { |
4340 | .alloc_inode = xfs_fs_alloc_inode, |
4341 | .destroy_inode = xfs_fs_destroy_inode, |
4342 | - .evict_inode = xfs_fs_evict_inode, |
4343 | .drop_inode = xfs_fs_drop_inode, |
4344 | .put_super = xfs_fs_put_super, |
4345 | .sync_fs = xfs_fs_sync_fs, |
4346 | diff --git a/include/drm/drm_dp_dual_mode_helper.h b/include/drm/drm_dp_dual_mode_helper.h |
4347 | new file mode 100644 |
4348 | index 000000000000..e8a9dfd0e055 |
4349 | --- /dev/null |
4350 | +++ b/include/drm/drm_dp_dual_mode_helper.h |
4351 | @@ -0,0 +1,92 @@ |
4352 | +/* |
4353 | + * Copyright © 2016 Intel Corporation |
4354 | + * |
4355 | + * Permission is hereby granted, free of charge, to any person obtaining a |
4356 | + * copy of this software and associated documentation files (the "Software"), |
4357 | + * to deal in the Software without restriction, including without limitation |
4358 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
4359 | + * and/or sell copies of the Software, and to permit persons to whom the |
4360 | + * Software is furnished to do so, subject to the following conditions: |
4361 | + * |
4362 | + * The above copyright notice and this permission notice shall be included in |
4363 | + * all copies or substantial portions of the Software. |
4364 | + * |
4365 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
4366 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
4367 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
4368 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
4369 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
4370 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
4371 | + * OTHER DEALINGS IN THE SOFTWARE. |
4372 | + */ |
4373 | + |
4374 | +#ifndef DRM_DP_DUAL_MODE_HELPER_H |
4375 | +#define DRM_DP_DUAL_MODE_HELPER_H |
4376 | + |
4377 | +#include <linux/types.h> |
4378 | + |
4379 | +/* |
4380 | + * Optional for type 1 DVI adaptors |
4381 | + * Mandatory for type 1 HDMI and type 2 adaptors |
4382 | + */ |
4383 | +#define DP_DUAL_MODE_HDMI_ID 0x00 /* 00-0f */ |
4384 | +#define DP_DUAL_MODE_HDMI_ID_LEN 16 |
4385 | +/* |
4386 | + * Optional for type 1 adaptors |
4387 | + * Mandatory for type 2 adaptors |
4388 | + */ |
4389 | +#define DP_DUAL_MODE_ADAPTOR_ID 0x10 |
4390 | +#define DP_DUAL_MODE_REV_MASK 0x07 |
4391 | +#define DP_DUAL_MODE_REV_TYPE2 0x00 |
4392 | +#define DP_DUAL_MODE_TYPE_MASK 0xf0 |
4393 | +#define DP_DUAL_MODE_TYPE_TYPE2 0xa0 |
4394 | +#define DP_DUAL_MODE_IEEE_OUI 0x11 /* 11-13*/ |
4395 | +#define DP_DUAL_IEEE_OUI_LEN 3 |
4396 | +#define DP_DUAL_DEVICE_ID 0x14 /* 14-19 */ |
4397 | +#define DP_DUAL_DEVICE_ID_LEN 6 |
4398 | +#define DP_DUAL_MODE_HARDWARE_REV 0x1a |
4399 | +#define DP_DUAL_MODE_FIRMWARE_MAJOR_REV 0x1b |
4400 | +#define DP_DUAL_MODE_FIRMWARE_MINOR_REV 0x1c |
4401 | +#define DP_DUAL_MODE_MAX_TMDS_CLOCK 0x1d |
4402 | +#define DP_DUAL_MODE_I2C_SPEED_CAP 0x1e |
4403 | +#define DP_DUAL_MODE_TMDS_OEN 0x20 |
4404 | +#define DP_DUAL_MODE_TMDS_DISABLE 0x01 |
4405 | +#define DP_DUAL_MODE_HDMI_PIN_CTRL 0x21 |
4406 | +#define DP_DUAL_MODE_CEC_ENABLE 0x01 |
4407 | +#define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22 |
4408 | + |
4409 | +struct i2c_adapter; |
4410 | + |
4411 | +ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter, |
4412 | + u8 offset, void *buffer, size_t size); |
4413 | +ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter, |
4414 | + u8 offset, const void *buffer, size_t size); |
4415 | + |
4416 | +/** |
4417 | + * enum drm_dp_dual_mode_type - Type of the DP dual mode adaptor |
4418 | + * @DRM_DP_DUAL_MODE_NONE: No DP dual mode adaptor |
4419 | + * @DRM_DP_DUAL_MODE_UNKNOWN: Could be either none or type 1 DVI adaptor |
4420 | + * @DRM_DP_DUAL_MODE_TYPE1_DVI: Type 1 DVI adaptor |
4421 | + * @DRM_DP_DUAL_MODE_TYPE1_HDMI: Type 1 HDMI adaptor |
4422 | + * @DRM_DP_DUAL_MODE_TYPE2_DVI: Type 2 DVI adaptor |
4423 | + * @DRM_DP_DUAL_MODE_TYPE2_HDMI: Type 2 HDMI adaptor |
4424 | + */ |
4425 | +enum drm_dp_dual_mode_type { |
4426 | + DRM_DP_DUAL_MODE_NONE, |
4427 | + DRM_DP_DUAL_MODE_UNKNOWN, |
4428 | + DRM_DP_DUAL_MODE_TYPE1_DVI, |
4429 | + DRM_DP_DUAL_MODE_TYPE1_HDMI, |
4430 | + DRM_DP_DUAL_MODE_TYPE2_DVI, |
4431 | + DRM_DP_DUAL_MODE_TYPE2_HDMI, |
4432 | +}; |
4433 | + |
4434 | +enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter); |
4435 | +int drm_dp_dual_mode_max_tmds_clock(enum drm_dp_dual_mode_type type, |
4436 | + struct i2c_adapter *adapter); |
4437 | +int drm_dp_dual_mode_get_tmds_output(enum drm_dp_dual_mode_type type, |
4438 | + struct i2c_adapter *adapter, bool *enabled); |
4439 | +int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type, |
4440 | + struct i2c_adapter *adapter, bool enable); |
4441 | +const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type); |
4442 | + |
4443 | +#endif |
4444 | diff --git a/include/linux/mm.h b/include/linux/mm.h |
4445 | index 8f468e0d2534..02f7f31e540f 100644 |
4446 | --- a/include/linux/mm.h |
4447 | +++ b/include/linux/mm.h |
4448 | @@ -1782,7 +1782,7 @@ extern void free_highmem_page(struct page *page); |
4449 | extern void adjust_managed_page_count(struct page *page, long count); |
4450 | extern void mem_init_print_info(const char *str); |
4451 | |
4452 | -extern void reserve_bootmem_region(unsigned long start, unsigned long end); |
4453 | +extern void reserve_bootmem_region(phys_addr_t start, phys_addr_t end); |
4454 | |
4455 | /* Free the reserved page into the buddy system, so it gets managed. */ |
4456 | static inline void __free_reserved_page(struct page *page) |
4457 | diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h |
4458 | index ad66589f2ae6..3a2a79401789 100644 |
4459 | --- a/include/video/imx-ipu-v3.h |
4460 | +++ b/include/video/imx-ipu-v3.h |
4461 | @@ -16,6 +16,7 @@ |
4462 | #include <linux/videodev2.h> |
4463 | #include <linux/bitmap.h> |
4464 | #include <linux/fb.h> |
4465 | +#include <linux/of.h> |
4466 | #include <media/v4l2-mediabus.h> |
4467 | #include <video/videomode.h> |
4468 | |
4469 | @@ -345,6 +346,7 @@ struct ipu_client_platformdata { |
4470 | int dc; |
4471 | int dp; |
4472 | int dma[2]; |
4473 | + struct device_node *of_node; |
4474 | }; |
4475 | |
4476 | #endif /* __DRM_IPU_H__ */ |
4477 | diff --git a/kernel/exit.c b/kernel/exit.c |
4478 | index fd90195667e1..79c7e38a203b 100644 |
4479 | --- a/kernel/exit.c |
4480 | +++ b/kernel/exit.c |
4481 | @@ -918,17 +918,28 @@ static int eligible_pid(struct wait_opts *wo, struct task_struct *p) |
4482 | task_pid_type(p, wo->wo_type) == wo->wo_pid; |
4483 | } |
4484 | |
4485 | -static int eligible_child(struct wait_opts *wo, struct task_struct *p) |
4486 | +static int |
4487 | +eligible_child(struct wait_opts *wo, bool ptrace, struct task_struct *p) |
4488 | { |
4489 | if (!eligible_pid(wo, p)) |
4490 | return 0; |
4491 | - /* Wait for all children (clone and not) if __WALL is set; |
4492 | - * otherwise, wait for clone children *only* if __WCLONE is |
4493 | - * set; otherwise, wait for non-clone children *only*. (Note: |
4494 | - * A "clone" child here is one that reports to its parent |
4495 | - * using a signal other than SIGCHLD.) */ |
4496 | - if (((p->exit_signal != SIGCHLD) ^ !!(wo->wo_flags & __WCLONE)) |
4497 | - && !(wo->wo_flags & __WALL)) |
4498 | + |
4499 | + /* |
4500 | + * Wait for all children (clone and not) if __WALL is set or |
4501 | + * if it is traced by us. |
4502 | + */ |
4503 | + if (ptrace || (wo->wo_flags & __WALL)) |
4504 | + return 1; |
4505 | + |
4506 | + /* |
4507 | + * Otherwise, wait for clone children *only* if __WCLONE is set; |
4508 | + * otherwise, wait for non-clone children *only*. |
4509 | + * |
4510 | + * Note: a "clone" child here is one that reports to its parent |
4511 | + * using a signal other than SIGCHLD, or a non-leader thread which |
4512 | + * we can only see if it is traced by us. |
4513 | + */ |
4514 | + if ((p->exit_signal != SIGCHLD) ^ !!(wo->wo_flags & __WCLONE)) |
4515 | return 0; |
4516 | |
4517 | return 1; |
4518 | @@ -1300,7 +1311,7 @@ static int wait_consider_task(struct wait_opts *wo, int ptrace, |
4519 | if (unlikely(exit_state == EXIT_DEAD)) |
4520 | return 0; |
4521 | |
4522 | - ret = eligible_child(wo, p); |
4523 | + ret = eligible_child(wo, ptrace, p); |
4524 | if (!ret) |
4525 | return ret; |
4526 | |
4527 | diff --git a/lib/dma-debug.c b/lib/dma-debug.c |
4528 | index 4a1515f4b452..51a76af25c66 100644 |
4529 | --- a/lib/dma-debug.c |
4530 | +++ b/lib/dma-debug.c |
4531 | @@ -657,9 +657,9 @@ static struct dma_debug_entry *dma_entry_alloc(void) |
4532 | spin_lock_irqsave(&free_entries_lock, flags); |
4533 | |
4534 | if (list_empty(&free_entries)) { |
4535 | - pr_err("DMA-API: debugging out of memory - disabling\n"); |
4536 | global_disable = true; |
4537 | spin_unlock_irqrestore(&free_entries_lock, flags); |
4538 | + pr_err("DMA-API: debugging out of memory - disabling\n"); |
4539 | return NULL; |
4540 | } |
4541 | |
4542 | diff --git a/mm/compaction.c b/mm/compaction.c |
4543 | index 8fa254043801..f8e925eb479b 100644 |
4544 | --- a/mm/compaction.c |
4545 | +++ b/mm/compaction.c |
4546 | @@ -1742,7 +1742,7 @@ static bool kcompactd_node_suitable(pg_data_t *pgdat) |
4547 | struct zone *zone; |
4548 | enum zone_type classzone_idx = pgdat->kcompactd_classzone_idx; |
4549 | |
4550 | - for (zoneid = 0; zoneid < classzone_idx; zoneid++) { |
4551 | + for (zoneid = 0; zoneid <= classzone_idx; zoneid++) { |
4552 | zone = &pgdat->node_zones[zoneid]; |
4553 | |
4554 | if (!populated_zone(zone)) |
4555 | @@ -1777,7 +1777,7 @@ static void kcompactd_do_work(pg_data_t *pgdat) |
4556 | cc.classzone_idx); |
4557 | count_vm_event(KCOMPACTD_WAKE); |
4558 | |
4559 | - for (zoneid = 0; zoneid < cc.classzone_idx; zoneid++) { |
4560 | + for (zoneid = 0; zoneid <= cc.classzone_idx; zoneid++) { |
4561 | int status; |
4562 | |
4563 | zone = &pgdat->node_zones[zoneid]; |
4564 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
4565 | index c1069efcc4d7..898fe3f909f9 100644 |
4566 | --- a/mm/page_alloc.c |
4567 | +++ b/mm/page_alloc.c |
4568 | @@ -1003,7 +1003,7 @@ static inline void init_reserved_page(unsigned long pfn) |
4569 | * marks the pages PageReserved. The remaining valid pages are later |
4570 | * sent to the buddy page allocator. |
4571 | */ |
4572 | -void __meminit reserve_bootmem_region(unsigned long start, unsigned long end) |
4573 | +void __meminit reserve_bootmem_region(phys_addr_t start, phys_addr_t end) |
4574 | { |
4575 | unsigned long start_pfn = PFN_DOWN(start); |
4576 | unsigned long end_pfn = PFN_UP(end); |
4577 | diff --git a/mm/rmap.c b/mm/rmap.c |
4578 | index 307b555024ef..3ebf9c4c2f4d 100644 |
4579 | --- a/mm/rmap.c |
4580 | +++ b/mm/rmap.c |
4581 | @@ -1098,6 +1098,8 @@ void page_move_anon_rmap(struct page *page, |
4582 | |
4583 | VM_BUG_ON_PAGE(!PageLocked(page), page); |
4584 | VM_BUG_ON_VMA(!anon_vma, vma); |
4585 | + if (IS_ENABLED(CONFIG_DEBUG_VM) && PageTransHuge(page)) |
4586 | + address &= HPAGE_PMD_MASK; |
4587 | VM_BUG_ON_PAGE(page->index != linear_page_index(vma, address), page); |
4588 | |
4589 | anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON; |
4590 | diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c |
4591 | index d9bcbe6e7d65..91df28a100f9 100644 |
4592 | --- a/net/batman-adv/bat_v_ogm.c |
4593 | +++ b/net/batman-adv/bat_v_ogm.c |
4594 | @@ -529,8 +529,10 @@ static void batadv_v_ogm_route_update(struct batadv_priv *bat_priv, |
4595 | goto out; |
4596 | } |
4597 | |
4598 | - if (router) |
4599 | + if (router) { |
4600 | batadv_neigh_node_put(router); |
4601 | + router = NULL; |
4602 | + } |
4603 | |
4604 | /* Update routes, and check if the OGM is from the best next hop */ |
4605 | batadv_v_ogm_orig_update(bat_priv, orig_node, neigh_node, ogm2, |
4606 | diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c |
4607 | index 8a4cc2f7f0db..e45cb9155039 100644 |
4608 | --- a/net/bluetooth/6lowpan.c |
4609 | +++ b/net/bluetooth/6lowpan.c |
4610 | @@ -431,15 +431,18 @@ static int setup_header(struct sk_buff *skb, struct net_device *netdev, |
4611 | bdaddr_t *peer_addr, u8 *peer_addr_type) |
4612 | { |
4613 | struct in6_addr ipv6_daddr; |
4614 | + struct ipv6hdr *hdr; |
4615 | struct lowpan_dev *dev; |
4616 | struct lowpan_peer *peer; |
4617 | bdaddr_t addr, *any = BDADDR_ANY; |
4618 | u8 *daddr = any->b; |
4619 | int err, status = 0; |
4620 | |
4621 | + hdr = ipv6_hdr(skb); |
4622 | + |
4623 | dev = lowpan_dev(netdev); |
4624 | |
4625 | - memcpy(&ipv6_daddr, &lowpan_cb(skb)->addr, sizeof(ipv6_daddr)); |
4626 | + memcpy(&ipv6_daddr, &hdr->daddr, sizeof(ipv6_daddr)); |
4627 | |
4628 | if (ipv6_addr_is_multicast(&ipv6_daddr)) { |
4629 | lowpan_cb(skb)->chan = NULL; |
4630 | @@ -489,15 +492,9 @@ static int header_create(struct sk_buff *skb, struct net_device *netdev, |
4631 | unsigned short type, const void *_daddr, |
4632 | const void *_saddr, unsigned int len) |
4633 | { |
4634 | - struct ipv6hdr *hdr; |
4635 | - |
4636 | if (type != ETH_P_IPV6) |
4637 | return -EINVAL; |
4638 | |
4639 | - hdr = ipv6_hdr(skb); |
4640 | - |
4641 | - memcpy(&lowpan_cb(skb)->addr, &hdr->daddr, sizeof(struct in6_addr)); |
4642 | - |
4643 | return 0; |
4644 | } |
4645 | |
4646 | diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c |
4647 | index 1095be9c80ab..4605dc73def6 100644 |
4648 | --- a/net/sunrpc/auth_gss/svcauth_gss.c |
4649 | +++ b/net/sunrpc/auth_gss/svcauth_gss.c |
4650 | @@ -857,8 +857,8 @@ unwrap_integ_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct g |
4651 | goto out; |
4652 | if (svc_getnl(&buf->head[0]) != seq) |
4653 | goto out; |
4654 | - /* trim off the mic at the end before returning */ |
4655 | - xdr_buf_trim(buf, mic.len + 4); |
4656 | + /* trim off the mic and padding at the end before returning */ |
4657 | + xdr_buf_trim(buf, round_up_to_quad(mic.len) + 4); |
4658 | stat = 0; |
4659 | out: |
4660 | kfree(mic.data); |
4661 | diff --git a/scripts/package/Makefile b/scripts/package/Makefile |
4662 | index c2c7389bfbab..71b4a8af9d4d 100644 |
4663 | --- a/scripts/package/Makefile |
4664 | +++ b/scripts/package/Makefile |
4665 | @@ -52,7 +52,7 @@ rpm-pkg rpm: FORCE |
4666 | $(call cmd,src_tar,$(KERNELPATH),kernel.spec) |
4667 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version |
4668 | mv -f $(objtree)/.tmp_version $(objtree)/.version |
4669 | - rpmbuild --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz |
4670 | + rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz |
4671 | rm $(KERNELPATH).tar.gz kernel.spec |
4672 | |
4673 | # binrpm-pkg |
4674 | @@ -63,7 +63,7 @@ binrpm-pkg: FORCE |
4675 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version |
4676 | mv -f $(objtree)/.tmp_version $(objtree)/.version |
4677 | |
4678 | - rpmbuild --define "_builddir $(objtree)" --target \ |
4679 | + rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ |
4680 | $(UTS_MACHINE) -bb $(objtree)/binkernel.spec |
4681 | rm binkernel.spec |
4682 | |
4683 | diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c |
4684 | index cda27c22812a..eb8fe212e163 100644 |
4685 | --- a/sound/soc/codecs/ak4642.c |
4686 | +++ b/sound/soc/codecs/ak4642.c |
4687 | @@ -560,6 +560,7 @@ static const struct regmap_config ak4642_regmap = { |
4688 | .max_register = FIL1_3, |
4689 | .reg_defaults = ak4642_reg, |
4690 | .num_reg_defaults = NUM_AK4642_REG_DEFAULTS, |
4691 | + .cache_type = REGCACHE_RBTREE, |
4692 | }; |
4693 | |
4694 | static const struct regmap_config ak4643_regmap = { |
4695 | @@ -568,6 +569,7 @@ static const struct regmap_config ak4643_regmap = { |
4696 | .max_register = SPK_MS, |
4697 | .reg_defaults = ak4643_reg, |
4698 | .num_reg_defaults = ARRAY_SIZE(ak4643_reg), |
4699 | + .cache_type = REGCACHE_RBTREE, |
4700 | }; |
4701 | |
4702 | static const struct regmap_config ak4648_regmap = { |
4703 | @@ -576,6 +578,7 @@ static const struct regmap_config ak4648_regmap = { |
4704 | .max_register = EQ_FBEQE, |
4705 | .reg_defaults = ak4648_reg, |
4706 | .num_reg_defaults = ARRAY_SIZE(ak4648_reg), |
4707 | + .cache_type = REGCACHE_RBTREE, |
4708 | }; |
4709 | |
4710 | static const struct ak4642_drvdata ak4642_drvdata = { |