1 |
commit: 4874450496010d25ec717a0c3b7922413a43de2a |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Nov 21 12:29:59 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 21 12:29:59 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=48744504 |
7 |
|
8 |
proj/linux-patches: Linux patch 4.19.3 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1002_linux-4.19.3.patch | 6344 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 6348 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 6b0adb6..6ce85c3 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -51,6 +51,10 @@ Patch: 1001_linux-4.19.2.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.19.2 |
23 |
|
24 |
+Patch: 1002_linux-4.19.3.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.19.3 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1002_linux-4.19.3.patch b/1002_linux-4.19.3.patch |
33 |
new file mode 100644 |
34 |
index 0000000..3650f86 |
35 |
--- /dev/null |
36 |
+++ b/1002_linux-4.19.3.patch |
37 |
@@ -0,0 +1,6344 @@ |
38 |
+diff --git a/Documentation/filesystems/overlayfs.txt b/Documentation/filesystems/overlayfs.txt |
39 |
+index 51c136c821bf..eef7d9d259e8 100644 |
40 |
+--- a/Documentation/filesystems/overlayfs.txt |
41 |
++++ b/Documentation/filesystems/overlayfs.txt |
42 |
+@@ -286,6 +286,12 @@ pointed by REDIRECT. This should not be possible on local system as setting |
43 |
+ "trusted." xattrs will require CAP_SYS_ADMIN. But it should be possible |
44 |
+ for untrusted layers like from a pen drive. |
45 |
+ |
46 |
++Note: redirect_dir={off|nofollow|follow(*)} conflicts with metacopy=on, and |
47 |
++results in an error. |
48 |
++ |
49 |
++(*) redirect_dir=follow only conflicts with metacopy=on if upperdir=... is |
50 |
++given. |
51 |
++ |
52 |
+ Sharing and copying layers |
53 |
+ -------------------------- |
54 |
+ |
55 |
+diff --git a/Makefile b/Makefile |
56 |
+index c8fe567f18ab..e4064fa16f11 100644 |
57 |
+--- a/Makefile |
58 |
++++ b/Makefile |
59 |
+@@ -1,7 +1,7 @@ |
60 |
+ # SPDX-License-Identifier: GPL-2.0 |
61 |
+ VERSION = 4 |
62 |
+ PATCHLEVEL = 19 |
63 |
+-SUBLEVEL = 2 |
64 |
++SUBLEVEL = 3 |
65 |
+ EXTRAVERSION = |
66 |
+ NAME = "People's Front" |
67 |
+ |
68 |
+diff --git a/arch/alpha/include/asm/termios.h b/arch/alpha/include/asm/termios.h |
69 |
+index 6a8c53dec57e..b7c77bb1bfd2 100644 |
70 |
+--- a/arch/alpha/include/asm/termios.h |
71 |
++++ b/arch/alpha/include/asm/termios.h |
72 |
+@@ -73,9 +73,15 @@ |
73 |
+ }) |
74 |
+ |
75 |
+ #define user_termios_to_kernel_termios(k, u) \ |
76 |
+- copy_from_user(k, u, sizeof(struct termios)) |
77 |
++ copy_from_user(k, u, sizeof(struct termios2)) |
78 |
+ |
79 |
+ #define kernel_termios_to_user_termios(u, k) \ |
80 |
++ copy_to_user(u, k, sizeof(struct termios2)) |
81 |
++ |
82 |
++#define user_termios_to_kernel_termios_1(k, u) \ |
83 |
++ copy_from_user(k, u, sizeof(struct termios)) |
84 |
++ |
85 |
++#define kernel_termios_to_user_termios_1(u, k) \ |
86 |
+ copy_to_user(u, k, sizeof(struct termios)) |
87 |
+ |
88 |
+ #endif /* _ALPHA_TERMIOS_H */ |
89 |
+diff --git a/arch/alpha/include/uapi/asm/ioctls.h b/arch/alpha/include/uapi/asm/ioctls.h |
90 |
+index 3729d92d3fa8..dc8c20ac7191 100644 |
91 |
+--- a/arch/alpha/include/uapi/asm/ioctls.h |
92 |
++++ b/arch/alpha/include/uapi/asm/ioctls.h |
93 |
+@@ -32,6 +32,11 @@ |
94 |
+ #define TCXONC _IO('t', 30) |
95 |
+ #define TCFLSH _IO('t', 31) |
96 |
+ |
97 |
++#define TCGETS2 _IOR('T', 42, struct termios2) |
98 |
++#define TCSETS2 _IOW('T', 43, struct termios2) |
99 |
++#define TCSETSW2 _IOW('T', 44, struct termios2) |
100 |
++#define TCSETSF2 _IOW('T', 45, struct termios2) |
101 |
++ |
102 |
+ #define TIOCSWINSZ _IOW('t', 103, struct winsize) |
103 |
+ #define TIOCGWINSZ _IOR('t', 104, struct winsize) |
104 |
+ #define TIOCSTART _IO('t', 110) /* start output, like ^Q */ |
105 |
+diff --git a/arch/alpha/include/uapi/asm/termbits.h b/arch/alpha/include/uapi/asm/termbits.h |
106 |
+index de6c8360fbe3..4575ba34a0ea 100644 |
107 |
+--- a/arch/alpha/include/uapi/asm/termbits.h |
108 |
++++ b/arch/alpha/include/uapi/asm/termbits.h |
109 |
+@@ -26,6 +26,19 @@ struct termios { |
110 |
+ speed_t c_ospeed; /* output speed */ |
111 |
+ }; |
112 |
+ |
113 |
++/* Alpha has identical termios and termios2 */ |
114 |
++ |
115 |
++struct termios2 { |
116 |
++ tcflag_t c_iflag; /* input mode flags */ |
117 |
++ tcflag_t c_oflag; /* output mode flags */ |
118 |
++ tcflag_t c_cflag; /* control mode flags */ |
119 |
++ tcflag_t c_lflag; /* local mode flags */ |
120 |
++ cc_t c_cc[NCCS]; /* control characters */ |
121 |
++ cc_t c_line; /* line discipline (== c_cc[19]) */ |
122 |
++ speed_t c_ispeed; /* input speed */ |
123 |
++ speed_t c_ospeed; /* output speed */ |
124 |
++}; |
125 |
++ |
126 |
+ /* Alpha has matching termios and ktermios */ |
127 |
+ |
128 |
+ struct ktermios { |
129 |
+@@ -152,6 +165,7 @@ struct ktermios { |
130 |
+ #define B3000000 00034 |
131 |
+ #define B3500000 00035 |
132 |
+ #define B4000000 00036 |
133 |
++#define BOTHER 00037 |
134 |
+ |
135 |
+ #define CSIZE 00001400 |
136 |
+ #define CS5 00000000 |
137 |
+@@ -169,6 +183,9 @@ struct ktermios { |
138 |
+ #define CMSPAR 010000000000 /* mark or space (stick) parity */ |
139 |
+ #define CRTSCTS 020000000000 /* flow control */ |
140 |
+ |
141 |
++#define CIBAUD 07600000 |
142 |
++#define IBSHIFT 16 |
143 |
++ |
144 |
+ /* c_lflag bits */ |
145 |
+ #define ISIG 0x00000080 |
146 |
+ #define ICANON 0x00000100 |
147 |
+diff --git a/arch/arm/boot/dts/imx6ull-pinfunc.h b/arch/arm/boot/dts/imx6ull-pinfunc.h |
148 |
+index fdc46bb09cc1..3c12a6fb0b61 100644 |
149 |
+--- a/arch/arm/boot/dts/imx6ull-pinfunc.h |
150 |
++++ b/arch/arm/boot/dts/imx6ull-pinfunc.h |
151 |
+@@ -14,14 +14,23 @@ |
152 |
+ * The pin function ID is a tuple of |
153 |
+ * <mux_reg conf_reg input_reg mux_mode input_val> |
154 |
+ */ |
155 |
++/* signals common for i.MX6UL and i.MX6ULL */ |
156 |
++#undef MX6UL_PAD_UART5_TX_DATA__UART5_DTE_RX |
157 |
++#define MX6UL_PAD_UART5_TX_DATA__UART5_DTE_RX 0x00BC 0x0348 0x0644 0x0 0x6 |
158 |
++#undef MX6UL_PAD_UART5_RX_DATA__UART5_DCE_RX |
159 |
++#define MX6UL_PAD_UART5_RX_DATA__UART5_DCE_RX 0x00C0 0x034C 0x0644 0x0 0x7 |
160 |
++#undef MX6UL_PAD_ENET1_RX_EN__UART5_DCE_RTS |
161 |
++#define MX6UL_PAD_ENET1_RX_EN__UART5_DCE_RTS 0x00CC 0x0358 0x0640 0x1 0x5 |
162 |
++#undef MX6UL_PAD_ENET1_TX_DATA0__UART5_DTE_RTS |
163 |
++#define MX6UL_PAD_ENET1_TX_DATA0__UART5_DTE_RTS 0x00D0 0x035C 0x0640 0x1 0x6 |
164 |
++#undef MX6UL_PAD_CSI_DATA02__UART5_DCE_RTS |
165 |
++#define MX6UL_PAD_CSI_DATA02__UART5_DCE_RTS 0x01EC 0x0478 0x0640 0x8 0x7 |
166 |
++ |
167 |
++/* signals for i.MX6ULL only */ |
168 |
+ #define MX6ULL_PAD_UART1_TX_DATA__UART5_DTE_RX 0x0084 0x0310 0x0644 0x9 0x4 |
169 |
+ #define MX6ULL_PAD_UART1_RX_DATA__UART5_DCE_RX 0x0088 0x0314 0x0644 0x9 0x5 |
170 |
+ #define MX6ULL_PAD_UART1_CTS_B__UART5_DCE_RTS 0x008C 0x0318 0x0640 0x9 0x3 |
171 |
+ #define MX6ULL_PAD_UART1_RTS_B__UART5_DTE_RTS 0x0090 0x031C 0x0640 0x9 0x4 |
172 |
+-#define MX6ULL_PAD_UART5_TX_DATA__UART5_DTE_RX 0x00BC 0x0348 0x0644 0x0 0x6 |
173 |
+-#define MX6ULL_PAD_UART5_RX_DATA__UART5_DCE_RX 0x00C0 0x034C 0x0644 0x0 0x7 |
174 |
+-#define MX6ULL_PAD_ENET1_RX_EN__UART5_DCE_RTS 0x00CC 0x0358 0x0640 0x1 0x5 |
175 |
+-#define MX6ULL_PAD_ENET1_TX_DATA0__UART5_DTE_RTS 0x00D0 0x035C 0x0640 0x1 0x6 |
176 |
+ #define MX6ULL_PAD_ENET2_RX_DATA0__EPDC_SDDO08 0x00E4 0x0370 0x0000 0x9 0x0 |
177 |
+ #define MX6ULL_PAD_ENET2_RX_DATA1__EPDC_SDDO09 0x00E8 0x0374 0x0000 0x9 0x0 |
178 |
+ #define MX6ULL_PAD_ENET2_RX_EN__EPDC_SDDO10 0x00EC 0x0378 0x0000 0x9 0x0 |
179 |
+@@ -55,7 +64,6 @@ |
180 |
+ #define MX6ULL_PAD_CSI_DATA00__ESAI_TX_HF_CLK 0x01E4 0x0470 0x0000 0x9 0x0 |
181 |
+ #define MX6ULL_PAD_CSI_DATA01__ESAI_RX_HF_CLK 0x01E8 0x0474 0x0000 0x9 0x0 |
182 |
+ #define MX6ULL_PAD_CSI_DATA02__ESAI_RX_FS 0x01EC 0x0478 0x0000 0x9 0x0 |
183 |
+-#define MX6ULL_PAD_CSI_DATA02__UART5_DCE_RTS 0x01EC 0x0478 0x0640 0x8 0x7 |
184 |
+ #define MX6ULL_PAD_CSI_DATA03__ESAI_RX_CLK 0x01F0 0x047C 0x0000 0x9 0x0 |
185 |
+ #define MX6ULL_PAD_CSI_DATA04__ESAI_TX_FS 0x01F4 0x0480 0x0000 0x9 0x0 |
186 |
+ #define MX6ULL_PAD_CSI_DATA05__ESAI_TX_CLK 0x01F8 0x0484 0x0000 0x9 0x0 |
187 |
+diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig |
188 |
+index 7eca43ff69bb..f4c2e993bba3 100644 |
189 |
+--- a/arch/arm/configs/imx_v6_v7_defconfig |
190 |
++++ b/arch/arm/configs/imx_v6_v7_defconfig |
191 |
+@@ -409,6 +409,7 @@ CONFIG_ZISOFS=y |
192 |
+ CONFIG_UDF_FS=m |
193 |
+ CONFIG_MSDOS_FS=m |
194 |
+ CONFIG_VFAT_FS=y |
195 |
++CONFIG_TMPFS_POSIX_ACL=y |
196 |
+ CONFIG_JFFS2_FS=y |
197 |
+ CONFIG_UBIFS_FS=y |
198 |
+ CONFIG_NFS_FS=y |
199 |
+diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S |
200 |
+index 6fe52819e014..339eb17c9808 100644 |
201 |
+--- a/arch/arm/mm/proc-v7.S |
202 |
++++ b/arch/arm/mm/proc-v7.S |
203 |
+@@ -112,7 +112,7 @@ ENTRY(cpu_v7_hvc_switch_mm) |
204 |
+ hvc #0 |
205 |
+ ldmfd sp!, {r0 - r3} |
206 |
+ b cpu_v7_switch_mm |
207 |
+-ENDPROC(cpu_v7_smc_switch_mm) |
208 |
++ENDPROC(cpu_v7_hvc_switch_mm) |
209 |
+ #endif |
210 |
+ ENTRY(cpu_v7_iciallu_switch_mm) |
211 |
+ mov r3, #0 |
212 |
+diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi |
213 |
+index bc6c141d7372..5089aa64088f 100644 |
214 |
+--- a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi |
215 |
++++ b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi |
216 |
+@@ -137,6 +137,9 @@ |
217 |
+ reset-names = "stmmaceth", "stmmaceth-ocp"; |
218 |
+ clocks = <&clkmgr STRATIX10_EMAC0_CLK>; |
219 |
+ clock-names = "stmmaceth"; |
220 |
++ tx-fifo-depth = <16384>; |
221 |
++ rx-fifo-depth = <16384>; |
222 |
++ snps,multicast-filter-bins = <256>; |
223 |
+ status = "disabled"; |
224 |
+ }; |
225 |
+ |
226 |
+@@ -150,6 +153,9 @@ |
227 |
+ reset-names = "stmmaceth", "stmmaceth-ocp"; |
228 |
+ clocks = <&clkmgr STRATIX10_EMAC1_CLK>; |
229 |
+ clock-names = "stmmaceth"; |
230 |
++ tx-fifo-depth = <16384>; |
231 |
++ rx-fifo-depth = <16384>; |
232 |
++ snps,multicast-filter-bins = <256>; |
233 |
+ status = "disabled"; |
234 |
+ }; |
235 |
+ |
236 |
+@@ -163,6 +169,9 @@ |
237 |
+ reset-names = "stmmaceth", "stmmaceth-ocp"; |
238 |
+ clocks = <&clkmgr STRATIX10_EMAC2_CLK>; |
239 |
+ clock-names = "stmmaceth"; |
240 |
++ tx-fifo-depth = <16384>; |
241 |
++ rx-fifo-depth = <16384>; |
242 |
++ snps,multicast-filter-bins = <256>; |
243 |
+ status = "disabled"; |
244 |
+ }; |
245 |
+ |
246 |
+diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts b/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts |
247 |
+index 6edc4fa9fd42..7c661753bfaf 100644 |
248 |
+--- a/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts |
249 |
++++ b/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts |
250 |
+@@ -76,7 +76,7 @@ |
251 |
+ phy-mode = "rgmii"; |
252 |
+ phy-handle = <&phy0>; |
253 |
+ |
254 |
+- max-frame-size = <3800>; |
255 |
++ max-frame-size = <9000>; |
256 |
+ |
257 |
+ mdio0 { |
258 |
+ #address-cells = <1>; |
259 |
+diff --git a/arch/mips/include/asm/mach-loongson64/irq.h b/arch/mips/include/asm/mach-loongson64/irq.h |
260 |
+index 3644b68c0ccc..be9f727a9328 100644 |
261 |
+--- a/arch/mips/include/asm/mach-loongson64/irq.h |
262 |
++++ b/arch/mips/include/asm/mach-loongson64/irq.h |
263 |
+@@ -10,7 +10,7 @@ |
264 |
+ #define MIPS_CPU_IRQ_BASE 56 |
265 |
+ |
266 |
+ #define LOONGSON_UART_IRQ (MIPS_CPU_IRQ_BASE + 2) /* UART */ |
267 |
+-#define LOONGSON_HT1_IRQ (MIPS_CPU_IRQ_BASE + 3) /* HT1 */ |
268 |
++#define LOONGSON_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 3) /* CASCADE */ |
269 |
+ #define LOONGSON_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7) /* CPU Timer */ |
270 |
+ |
271 |
+ #define LOONGSON_HT1_CFG_BASE loongson_sysconf.ht_control_base |
272 |
+diff --git a/arch/mips/kernel/crash.c b/arch/mips/kernel/crash.c |
273 |
+index d455363d51c3..4c07a43a3242 100644 |
274 |
+--- a/arch/mips/kernel/crash.c |
275 |
++++ b/arch/mips/kernel/crash.c |
276 |
+@@ -36,6 +36,9 @@ static void crash_shutdown_secondary(void *passed_regs) |
277 |
+ if (!cpu_online(cpu)) |
278 |
+ return; |
279 |
+ |
280 |
++ /* We won't be sent IPIs any more. */ |
281 |
++ set_cpu_online(cpu, false); |
282 |
++ |
283 |
+ local_irq_disable(); |
284 |
+ if (!cpumask_test_cpu(cpu, &cpus_in_crash)) |
285 |
+ crash_save_cpu(regs, cpu); |
286 |
+diff --git a/arch/mips/kernel/machine_kexec.c b/arch/mips/kernel/machine_kexec.c |
287 |
+index 8b574bcd39ba..4b3726e4fe3a 100644 |
288 |
+--- a/arch/mips/kernel/machine_kexec.c |
289 |
++++ b/arch/mips/kernel/machine_kexec.c |
290 |
+@@ -118,6 +118,9 @@ machine_kexec(struct kimage *image) |
291 |
+ *ptr = (unsigned long) phys_to_virt(*ptr); |
292 |
+ } |
293 |
+ |
294 |
++ /* Mark offline BEFORE disabling local irq. */ |
295 |
++ set_cpu_online(smp_processor_id(), false); |
296 |
++ |
297 |
+ /* |
298 |
+ * we do not want to be bothered. |
299 |
+ */ |
300 |
+diff --git a/arch/mips/loongson64/loongson-3/irq.c b/arch/mips/loongson64/loongson-3/irq.c |
301 |
+index cbeb20f9fc95..5605061f5f98 100644 |
302 |
+--- a/arch/mips/loongson64/loongson-3/irq.c |
303 |
++++ b/arch/mips/loongson64/loongson-3/irq.c |
304 |
+@@ -96,51 +96,8 @@ void mach_irq_dispatch(unsigned int pending) |
305 |
+ } |
306 |
+ } |
307 |
+ |
308 |
+-static struct irqaction cascade_irqaction = { |
309 |
+- .handler = no_action, |
310 |
+- .flags = IRQF_NO_SUSPEND, |
311 |
+- .name = "cascade", |
312 |
+-}; |
313 |
+- |
314 |
+-static inline void mask_loongson_irq(struct irq_data *d) |
315 |
+-{ |
316 |
+- clear_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); |
317 |
+- irq_disable_hazard(); |
318 |
+- |
319 |
+- /* Workaround: UART IRQ may deliver to any core */ |
320 |
+- if (d->irq == LOONGSON_UART_IRQ) { |
321 |
+- int cpu = smp_processor_id(); |
322 |
+- int node_id = cpu_logical_map(cpu) / loongson_sysconf.cores_per_node; |
323 |
+- int core_id = cpu_logical_map(cpu) % loongson_sysconf.cores_per_node; |
324 |
+- u64 intenclr_addr = smp_group[node_id] | |
325 |
+- (u64)(&LOONGSON_INT_ROUTER_INTENCLR); |
326 |
+- u64 introuter_lpc_addr = smp_group[node_id] | |
327 |
+- (u64)(&LOONGSON_INT_ROUTER_LPC); |
328 |
+- |
329 |
+- *(volatile u32 *)intenclr_addr = 1 << 10; |
330 |
+- *(volatile u8 *)introuter_lpc_addr = 0x10 + (1<<core_id); |
331 |
+- } |
332 |
+-} |
333 |
+- |
334 |
+-static inline void unmask_loongson_irq(struct irq_data *d) |
335 |
+-{ |
336 |
+- /* Workaround: UART IRQ may deliver to any core */ |
337 |
+- if (d->irq == LOONGSON_UART_IRQ) { |
338 |
+- int cpu = smp_processor_id(); |
339 |
+- int node_id = cpu_logical_map(cpu) / loongson_sysconf.cores_per_node; |
340 |
+- int core_id = cpu_logical_map(cpu) % loongson_sysconf.cores_per_node; |
341 |
+- u64 intenset_addr = smp_group[node_id] | |
342 |
+- (u64)(&LOONGSON_INT_ROUTER_INTENSET); |
343 |
+- u64 introuter_lpc_addr = smp_group[node_id] | |
344 |
+- (u64)(&LOONGSON_INT_ROUTER_LPC); |
345 |
+- |
346 |
+- *(volatile u32 *)intenset_addr = 1 << 10; |
347 |
+- *(volatile u8 *)introuter_lpc_addr = 0x10 + (1<<core_id); |
348 |
+- } |
349 |
+- |
350 |
+- set_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); |
351 |
+- irq_enable_hazard(); |
352 |
+-} |
353 |
++static inline void mask_loongson_irq(struct irq_data *d) { } |
354 |
++static inline void unmask_loongson_irq(struct irq_data *d) { } |
355 |
+ |
356 |
+ /* For MIPS IRQs which shared by all cores */ |
357 |
+ static struct irq_chip loongson_irq_chip = { |
358 |
+@@ -183,12 +140,11 @@ void __init mach_init_irq(void) |
359 |
+ chip->irq_set_affinity = plat_set_irq_affinity; |
360 |
+ |
361 |
+ irq_set_chip_and_handler(LOONGSON_UART_IRQ, |
362 |
+- &loongson_irq_chip, handle_level_irq); |
363 |
+- |
364 |
+- /* setup HT1 irq */ |
365 |
+- setup_irq(LOONGSON_HT1_IRQ, &cascade_irqaction); |
366 |
++ &loongson_irq_chip, handle_percpu_irq); |
367 |
++ irq_set_chip_and_handler(LOONGSON_BRIDGE_IRQ, |
368 |
++ &loongson_irq_chip, handle_percpu_irq); |
369 |
+ |
370 |
+- set_c0_status(STATUSF_IP2 | STATUSF_IP6); |
371 |
++ set_c0_status(STATUSF_IP2 | STATUSF_IP3 | STATUSF_IP6); |
372 |
+ } |
373 |
+ |
374 |
+ #ifdef CONFIG_HOTPLUG_CPU |
375 |
+diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c |
376 |
+index f1e92bf743c2..3c3b1e6abb53 100644 |
377 |
+--- a/arch/mips/pci/pci-legacy.c |
378 |
++++ b/arch/mips/pci/pci-legacy.c |
379 |
+@@ -127,8 +127,12 @@ static void pcibios_scanbus(struct pci_controller *hose) |
380 |
+ if (pci_has_flag(PCI_PROBE_ONLY)) { |
381 |
+ pci_bus_claim_resources(bus); |
382 |
+ } else { |
383 |
++ struct pci_bus *child; |
384 |
++ |
385 |
+ pci_bus_size_bridges(bus); |
386 |
+ pci_bus_assign_resources(bus); |
387 |
++ list_for_each_entry(child, &bus->children, node) |
388 |
++ pcie_bus_configure_settings(child); |
389 |
+ } |
390 |
+ pci_bus_add_devices(bus); |
391 |
+ } |
392 |
+diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile |
393 |
+index 11a1acba164a..d2824b0cc142 100644 |
394 |
+--- a/arch/powerpc/Makefile |
395 |
++++ b/arch/powerpc/Makefile |
396 |
+@@ -238,7 +238,11 @@ cpu-as-$(CONFIG_4xx) += -Wa,-m405 |
397 |
+ cpu-as-$(CONFIG_ALTIVEC) += $(call as-option,-Wa$(comma)-maltivec) |
398 |
+ cpu-as-$(CONFIG_E200) += -Wa,-me200 |
399 |
+ cpu-as-$(CONFIG_E500) += -Wa,-me500 |
400 |
+-cpu-as-$(CONFIG_PPC_BOOK3S_64) += -Wa,-mpower4 |
401 |
++ |
402 |
++# When using '-many -mpower4' gas will first try and find a matching power4 |
403 |
++# mnemonic and failing that it will allow any valid mnemonic that GAS knows |
404 |
++# about. GCC will pass -many to GAS when assembling, clang does not. |
405 |
++cpu-as-$(CONFIG_PPC_BOOK3S_64) += -Wa,-mpower4 -Wa,-many |
406 |
+ cpu-as-$(CONFIG_PPC_E500MC) += $(call as-option,-Wa$(comma)-me500mc) |
407 |
+ |
408 |
+ KBUILD_AFLAGS += $(cpu-as-y) |
409 |
+diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S |
410 |
+index dcf2f15e6797..32dfe6d083f3 100644 |
411 |
+--- a/arch/powerpc/boot/crt0.S |
412 |
++++ b/arch/powerpc/boot/crt0.S |
413 |
+@@ -47,8 +47,10 @@ p_end: .long _end |
414 |
+ p_pstack: .long _platform_stack_top |
415 |
+ #endif |
416 |
+ |
417 |
+- .weak _zimage_start |
418 |
+ .globl _zimage_start |
419 |
++ /* Clang appears to require the .weak directive to be after the symbol |
420 |
++ * is defined. See https://bugs.llvm.org/show_bug.cgi?id=38921 */ |
421 |
++ .weak _zimage_start |
422 |
+ _zimage_start: |
423 |
+ .globl _zimage_start_lib |
424 |
+ _zimage_start_lib: |
425 |
+diff --git a/arch/powerpc/include/asm/mmu-8xx.h b/arch/powerpc/include/asm/mmu-8xx.h |
426 |
+index 4f547752ae79..193f53116c7a 100644 |
427 |
+--- a/arch/powerpc/include/asm/mmu-8xx.h |
428 |
++++ b/arch/powerpc/include/asm/mmu-8xx.h |
429 |
+@@ -34,20 +34,12 @@ |
430 |
+ * respectively NA for All or X for Supervisor and no access for User. |
431 |
+ * Then we use the APG to say whether accesses are according to Page rules or |
432 |
+ * "all Supervisor" rules (Access to all) |
433 |
+- * We also use the 2nd APG bit for _PAGE_ACCESSED when having SWAP: |
434 |
+- * When that bit is not set access is done iaw "all user" |
435 |
+- * which means no access iaw page rules. |
436 |
+- * Therefore, we define 4 APG groups. lsb is _PMD_USER, 2nd is _PAGE_ACCESSED |
437 |
+- * 0x => No access => 11 (all accesses performed as user iaw page definition) |
438 |
+- * 10 => No user => 01 (all accesses performed according to page definition) |
439 |
+- * 11 => User => 00 (all accesses performed as supervisor iaw page definition) |
440 |
++ * Therefore, we define 2 APG groups. lsb is _PMD_USER |
441 |
++ * 0 => No user => 01 (all accesses performed according to page definition) |
442 |
++ * 1 => User => 00 (all accesses performed as supervisor iaw page definition) |
443 |
+ * We define all 16 groups so that all other bits of APG can take any value |
444 |
+ */ |
445 |
+-#ifdef CONFIG_SWAP |
446 |
+-#define MI_APG_INIT 0xf4f4f4f4 |
447 |
+-#else |
448 |
+ #define MI_APG_INIT 0x44444444 |
449 |
+-#endif |
450 |
+ |
451 |
+ /* The effective page number register. When read, contains the information |
452 |
+ * about the last instruction TLB miss. When MI_RPN is written, bits in |
453 |
+@@ -115,20 +107,12 @@ |
454 |
+ * Supervisor and no access for user and NA for ALL. |
455 |
+ * Then we use the APG to say whether accesses are according to Page rules or |
456 |
+ * "all Supervisor" rules (Access to all) |
457 |
+- * We also use the 2nd APG bit for _PAGE_ACCESSED when having SWAP: |
458 |
+- * When that bit is not set access is done iaw "all user" |
459 |
+- * which means no access iaw page rules. |
460 |
+- * Therefore, we define 4 APG groups. lsb is _PMD_USER, 2nd is _PAGE_ACCESSED |
461 |
+- * 0x => No access => 11 (all accesses performed as user iaw page definition) |
462 |
+- * 10 => No user => 01 (all accesses performed according to page definition) |
463 |
+- * 11 => User => 00 (all accesses performed as supervisor iaw page definition) |
464 |
++ * Therefore, we define 2 APG groups. lsb is _PMD_USER |
465 |
++ * 0 => No user => 01 (all accesses performed according to page definition) |
466 |
++ * 1 => User => 00 (all accesses performed as supervisor iaw page definition) |
467 |
+ * We define all 16 groups so that all other bits of APG can take any value |
468 |
+ */ |
469 |
+-#ifdef CONFIG_SWAP |
470 |
+-#define MD_APG_INIT 0xf4f4f4f4 |
471 |
+-#else |
472 |
+ #define MD_APG_INIT 0x44444444 |
473 |
+-#endif |
474 |
+ |
475 |
+ /* The effective page number register. When read, contains the information |
476 |
+ * about the last instruction TLB miss. When MD_RPN is written, bits in |
477 |
+@@ -180,12 +164,6 @@ |
478 |
+ */ |
479 |
+ #define SPRN_M_TW 799 |
480 |
+ |
481 |
+-/* APGs */ |
482 |
+-#define M_APG0 0x00000000 |
483 |
+-#define M_APG1 0x00000020 |
484 |
+-#define M_APG2 0x00000040 |
485 |
+-#define M_APG3 0x00000060 |
486 |
+- |
487 |
+ #ifdef CONFIG_PPC_MM_SLICES |
488 |
+ #include <asm/nohash/32/slice.h> |
489 |
+ #define SLICE_ARRAY_SIZE (1 << (32 - SLICE_LOW_SHIFT - 1)) |
490 |
+diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c |
491 |
+index 6ebba3e48b01..c72767a5327a 100644 |
492 |
+--- a/arch/powerpc/kernel/eeh.c |
493 |
++++ b/arch/powerpc/kernel/eeh.c |
494 |
+@@ -169,6 +169,11 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len) |
495 |
+ int n = 0, l = 0; |
496 |
+ char buffer[128]; |
497 |
+ |
498 |
++ if (!pdn) { |
499 |
++ pr_warn("EEH: Note: No error log for absent device.\n"); |
500 |
++ return 0; |
501 |
++ } |
502 |
++ |
503 |
+ n += scnprintf(buf+n, len-n, "%04x:%02x:%02x.%01x\n", |
504 |
+ pdn->phb->global_number, pdn->busno, |
505 |
+ PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn)); |
506 |
+diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S |
507 |
+index 6582f824d620..81d4574d1f37 100644 |
508 |
+--- a/arch/powerpc/kernel/head_8xx.S |
509 |
++++ b/arch/powerpc/kernel/head_8xx.S |
510 |
+@@ -353,13 +353,14 @@ _ENTRY(ITLBMiss_cmp) |
511 |
+ #if defined(ITLB_MISS_KERNEL) || defined(CONFIG_HUGETLB_PAGE) |
512 |
+ mtcr r12 |
513 |
+ #endif |
514 |
+- |
515 |
+-#ifdef CONFIG_SWAP |
516 |
+- rlwinm r11, r10, 31, _PAGE_ACCESSED >> 1 |
517 |
+-#endif |
518 |
+ /* Load the MI_TWC with the attributes for this "segment." */ |
519 |
+ mtspr SPRN_MI_TWC, r11 /* Set segment attributes */ |
520 |
+ |
521 |
++#ifdef CONFIG_SWAP |
522 |
++ rlwinm r11, r10, 32-5, _PAGE_PRESENT |
523 |
++ and r11, r11, r10 |
524 |
++ rlwimi r10, r11, 0, _PAGE_PRESENT |
525 |
++#endif |
526 |
+ li r11, RPN_PATTERN | 0x200 |
527 |
+ /* The Linux PTE won't go exactly into the MMU TLB. |
528 |
+ * Software indicator bits 20 and 23 must be clear. |
529 |
+@@ -470,14 +471,22 @@ _ENTRY(DTLBMiss_jmp) |
530 |
+ * above. |
531 |
+ */ |
532 |
+ rlwimi r11, r10, 0, _PAGE_GUARDED |
533 |
+-#ifdef CONFIG_SWAP |
534 |
+- /* _PAGE_ACCESSED has to be set. We use second APG bit for that, 0 |
535 |
+- * on that bit will represent a Non Access group |
536 |
+- */ |
537 |
+- rlwinm r11, r10, 31, _PAGE_ACCESSED >> 1 |
538 |
+-#endif |
539 |
+ mtspr SPRN_MD_TWC, r11 |
540 |
+ |
541 |
++ /* Both _PAGE_ACCESSED and _PAGE_PRESENT has to be set. |
542 |
++ * We also need to know if the insn is a load/store, so: |
543 |
++ * Clear _PAGE_PRESENT and load that which will |
544 |
++ * trap into DTLB Error with store bit set accordinly. |
545 |
++ */ |
546 |
++ /* PRESENT=0x1, ACCESSED=0x20 |
547 |
++ * r11 = ((r10 & PRESENT) & ((r10 & ACCESSED) >> 5)); |
548 |
++ * r10 = (r10 & ~PRESENT) | r11; |
549 |
++ */ |
550 |
++#ifdef CONFIG_SWAP |
551 |
++ rlwinm r11, r10, 32-5, _PAGE_PRESENT |
552 |
++ and r11, r11, r10 |
553 |
++ rlwimi r10, r11, 0, _PAGE_PRESENT |
554 |
++#endif |
555 |
+ /* The Linux PTE won't go exactly into the MMU TLB. |
556 |
+ * Software indicator bits 24, 25, 26, and 27 must be |
557 |
+ * set. All other Linux PTE bits control the behavior |
558 |
+@@ -637,8 +646,8 @@ InstructionBreakpoint: |
559 |
+ */ |
560 |
+ DTLBMissIMMR: |
561 |
+ mtcr r12 |
562 |
+- /* Set 512k byte guarded page and mark it valid and accessed */ |
563 |
+- li r10, MD_PS512K | MD_GUARDED | MD_SVALID | M_APG2 |
564 |
++ /* Set 512k byte guarded page and mark it valid */ |
565 |
++ li r10, MD_PS512K | MD_GUARDED | MD_SVALID |
566 |
+ mtspr SPRN_MD_TWC, r10 |
567 |
+ mfspr r10, SPRN_IMMR /* Get current IMMR */ |
568 |
+ rlwinm r10, r10, 0, 0xfff80000 /* Get 512 kbytes boundary */ |
569 |
+@@ -656,8 +665,8 @@ _ENTRY(dtlb_miss_exit_2) |
570 |
+ |
571 |
+ DTLBMissLinear: |
572 |
+ mtcr r12 |
573 |
+- /* Set 8M byte page and mark it valid and accessed */ |
574 |
+- li r11, MD_PS8MEG | MD_SVALID | M_APG2 |
575 |
++ /* Set 8M byte page and mark it valid */ |
576 |
++ li r11, MD_PS8MEG | MD_SVALID |
577 |
+ mtspr SPRN_MD_TWC, r11 |
578 |
+ rlwinm r10, r10, 0, 0x0f800000 /* 8xx supports max 256Mb RAM */ |
579 |
+ ori r10, r10, 0xf0 | MD_SPS16K | _PAGE_PRIVILEGED | _PAGE_DIRTY | \ |
580 |
+@@ -675,8 +684,8 @@ _ENTRY(dtlb_miss_exit_3) |
581 |
+ #ifndef CONFIG_PIN_TLB_TEXT |
582 |
+ ITLBMissLinear: |
583 |
+ mtcr r12 |
584 |
+- /* Set 8M byte page and mark it valid,accessed */ |
585 |
+- li r11, MI_PS8MEG | MI_SVALID | M_APG2 |
586 |
++ /* Set 8M byte page and mark it valid */ |
587 |
++ li r11, MI_PS8MEG | MI_SVALID |
588 |
+ mtspr SPRN_MI_TWC, r11 |
589 |
+ rlwinm r10, r10, 0, 0x0f800000 /* 8xx supports max 256Mb RAM */ |
590 |
+ ori r10, r10, 0xf0 | MI_SPS16K | _PAGE_PRIVILEGED | _PAGE_DIRTY | \ |
591 |
+@@ -960,7 +969,7 @@ initial_mmu: |
592 |
+ ori r8, r8, MI_EVALID /* Mark it valid */ |
593 |
+ mtspr SPRN_MI_EPN, r8 |
594 |
+ li r8, MI_PS8MEG /* Set 8M byte page */ |
595 |
+- ori r8, r8, MI_SVALID | M_APG2 /* Make it valid, APG 2 */ |
596 |
++ ori r8, r8, MI_SVALID /* Make it valid */ |
597 |
+ mtspr SPRN_MI_TWC, r8 |
598 |
+ li r8, MI_BOOTINIT /* Create RPN for address 0 */ |
599 |
+ mtspr SPRN_MI_RPN, r8 /* Store TLB entry */ |
600 |
+@@ -987,7 +996,7 @@ initial_mmu: |
601 |
+ ori r8, r8, MD_EVALID /* Mark it valid */ |
602 |
+ mtspr SPRN_MD_EPN, r8 |
603 |
+ li r8, MD_PS512K | MD_GUARDED /* Set 512k byte page */ |
604 |
+- ori r8, r8, MD_SVALID | M_APG2 /* Make it valid and accessed */ |
605 |
++ ori r8, r8, MD_SVALID /* Make it valid */ |
606 |
+ mtspr SPRN_MD_TWC, r8 |
607 |
+ mr r8, r9 /* Create paddr for TLB */ |
608 |
+ ori r8, r8, MI_BOOTINIT|0x2 /* Inhibit cache -- Cort */ |
609 |
+diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c |
610 |
+index 2c53de9f3b6a..8661eea78503 100644 |
611 |
+--- a/arch/powerpc/kernel/module_64.c |
612 |
++++ b/arch/powerpc/kernel/module_64.c |
613 |
+@@ -680,7 +680,14 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, |
614 |
+ |
615 |
+ case R_PPC64_REL32: |
616 |
+ /* 32 bits relative (used by relative exception tables) */ |
617 |
+- *(u32 *)location = value - (unsigned long)location; |
618 |
++ /* Convert value to relative */ |
619 |
++ value -= (unsigned long)location; |
620 |
++ if (value + 0x80000000 > 0xffffffff) { |
621 |
++ pr_err("%s: REL32 %li out of range!\n", |
622 |
++ me->name, (long int)value); |
623 |
++ return -ENOEXEC; |
624 |
++ } |
625 |
++ *(u32 *)location = value; |
626 |
+ break; |
627 |
+ |
628 |
+ case R_PPC64_TOCSAVE: |
629 |
+diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c |
630 |
+index c85adb858271..8689a02b7df8 100644 |
631 |
+--- a/arch/powerpc/kernel/traps.c |
632 |
++++ b/arch/powerpc/kernel/traps.c |
633 |
+@@ -767,12 +767,17 @@ void machine_check_exception(struct pt_regs *regs) |
634 |
+ if (check_io_access(regs)) |
635 |
+ goto bail; |
636 |
+ |
637 |
+- die("Machine check", regs, SIGBUS); |
638 |
+- |
639 |
+ /* Must die if the interrupt is not recoverable */ |
640 |
+ if (!(regs->msr & MSR_RI)) |
641 |
+ nmi_panic(regs, "Unrecoverable Machine check"); |
642 |
+ |
643 |
++ if (!nested) |
644 |
++ nmi_exit(); |
645 |
++ |
646 |
++ die("Machine check", regs, SIGBUS); |
647 |
++ |
648 |
++ return; |
649 |
++ |
650 |
+ bail: |
651 |
+ if (!nested) |
652 |
+ nmi_exit(); |
653 |
+diff --git a/arch/powerpc/mm/8xx_mmu.c b/arch/powerpc/mm/8xx_mmu.c |
654 |
+index cf77d755246d..5d53684c2ebd 100644 |
655 |
+--- a/arch/powerpc/mm/8xx_mmu.c |
656 |
++++ b/arch/powerpc/mm/8xx_mmu.c |
657 |
+@@ -79,7 +79,7 @@ void __init MMU_init_hw(void) |
658 |
+ for (; i < 32 && mem >= LARGE_PAGE_SIZE_8M; i++) { |
659 |
+ mtspr(SPRN_MD_CTR, ctr | (i << 8)); |
660 |
+ mtspr(SPRN_MD_EPN, (unsigned long)__va(addr) | MD_EVALID); |
661 |
+- mtspr(SPRN_MD_TWC, MD_PS8MEG | MD_SVALID | M_APG2); |
662 |
++ mtspr(SPRN_MD_TWC, MD_PS8MEG | MD_SVALID); |
663 |
+ mtspr(SPRN_MD_RPN, addr | flags | _PAGE_PRESENT); |
664 |
+ addr += LARGE_PAGE_SIZE_8M; |
665 |
+ mem -= LARGE_PAGE_SIZE_8M; |
666 |
+diff --git a/arch/powerpc/mm/dump_linuxpagetables.c b/arch/powerpc/mm/dump_linuxpagetables.c |
667 |
+index 876e2a3c79f2..bdf33b989f98 100644 |
668 |
+--- a/arch/powerpc/mm/dump_linuxpagetables.c |
669 |
++++ b/arch/powerpc/mm/dump_linuxpagetables.c |
670 |
+@@ -418,12 +418,13 @@ static void walk_pagetables(struct pg_state *st) |
671 |
+ unsigned int i; |
672 |
+ unsigned long addr; |
673 |
+ |
674 |
++ addr = st->start_address; |
675 |
++ |
676 |
+ /* |
677 |
+ * Traverse the linux pagetable structure and dump pages that are in |
678 |
+ * the hash pagetable. |
679 |
+ */ |
680 |
+- for (i = 0; i < PTRS_PER_PGD; i++, pgd++) { |
681 |
+- addr = KERN_VIRT_START + i * PGDIR_SIZE; |
682 |
++ for (i = 0; i < PTRS_PER_PGD; i++, pgd++, addr += PGDIR_SIZE) { |
683 |
+ if (!pgd_none(*pgd) && !pgd_huge(*pgd)) |
684 |
+ /* pgd exists */ |
685 |
+ walk_pud(st, pgd, addr); |
686 |
+@@ -472,9 +473,14 @@ static int ptdump_show(struct seq_file *m, void *v) |
687 |
+ { |
688 |
+ struct pg_state st = { |
689 |
+ .seq = m, |
690 |
+- .start_address = KERN_VIRT_START, |
691 |
+ .marker = address_markers, |
692 |
+ }; |
693 |
++ |
694 |
++ if (radix_enabled()) |
695 |
++ st.start_address = PAGE_OFFSET; |
696 |
++ else |
697 |
++ st.start_address = KERN_VIRT_START; |
698 |
++ |
699 |
+ /* Traverse kernel page tables */ |
700 |
+ walk_pagetables(&st); |
701 |
+ note_page(&st, 0, 0, 0); |
702 |
+diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c |
703 |
+index e87f9ef9115b..7296a42eb62e 100644 |
704 |
+--- a/arch/powerpc/mm/hugetlbpage.c |
705 |
++++ b/arch/powerpc/mm/hugetlbpage.c |
706 |
+@@ -19,6 +19,7 @@ |
707 |
+ #include <linux/moduleparam.h> |
708 |
+ #include <linux/swap.h> |
709 |
+ #include <linux/swapops.h> |
710 |
++#include <linux/kmemleak.h> |
711 |
+ #include <asm/pgtable.h> |
712 |
+ #include <asm/pgalloc.h> |
713 |
+ #include <asm/tlb.h> |
714 |
+@@ -112,6 +113,8 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, |
715 |
+ for (i = i - 1 ; i >= 0; i--, hpdp--) |
716 |
+ *hpdp = __hugepd(0); |
717 |
+ kmem_cache_free(cachep, new); |
718 |
++ } else { |
719 |
++ kmemleak_ignore(new); |
720 |
+ } |
721 |
+ spin_unlock(ptl); |
722 |
+ return 0; |
723 |
+diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c |
724 |
+index 205fe557ca10..4f213ba33491 100644 |
725 |
+--- a/arch/powerpc/mm/slice.c |
726 |
++++ b/arch/powerpc/mm/slice.c |
727 |
+@@ -61,6 +61,13 @@ static void slice_print_mask(const char *label, const struct slice_mask *mask) { |
728 |
+ |
729 |
+ #endif |
730 |
+ |
731 |
++static inline bool slice_addr_is_low(unsigned long addr) |
732 |
++{ |
733 |
++ u64 tmp = (u64)addr; |
734 |
++ |
735 |
++ return tmp < SLICE_LOW_TOP; |
736 |
++} |
737 |
++ |
738 |
+ static void slice_range_to_mask(unsigned long start, unsigned long len, |
739 |
+ struct slice_mask *ret) |
740 |
+ { |
741 |
+@@ -70,7 +77,7 @@ static void slice_range_to_mask(unsigned long start, unsigned long len, |
742 |
+ if (SLICE_NUM_HIGH) |
743 |
+ bitmap_zero(ret->high_slices, SLICE_NUM_HIGH); |
744 |
+ |
745 |
+- if (start < SLICE_LOW_TOP) { |
746 |
++ if (slice_addr_is_low(start)) { |
747 |
+ unsigned long mend = min(end, |
748 |
+ (unsigned long)(SLICE_LOW_TOP - 1)); |
749 |
+ |
750 |
+@@ -78,7 +85,7 @@ static void slice_range_to_mask(unsigned long start, unsigned long len, |
751 |
+ - (1u << GET_LOW_SLICE_INDEX(start)); |
752 |
+ } |
753 |
+ |
754 |
+- if ((start + len) > SLICE_LOW_TOP) { |
755 |
++ if (SLICE_NUM_HIGH && !slice_addr_is_low(end)) { |
756 |
+ unsigned long start_index = GET_HIGH_SLICE_INDEX(start); |
757 |
+ unsigned long align_end = ALIGN(end, (1UL << SLICE_HIGH_SHIFT)); |
758 |
+ unsigned long count = GET_HIGH_SLICE_INDEX(align_end) - start_index; |
759 |
+@@ -133,7 +140,7 @@ static void slice_mask_for_free(struct mm_struct *mm, struct slice_mask *ret, |
760 |
+ if (!slice_low_has_vma(mm, i)) |
761 |
+ ret->low_slices |= 1u << i; |
762 |
+ |
763 |
+- if (high_limit <= SLICE_LOW_TOP) |
764 |
++ if (slice_addr_is_low(high_limit - 1)) |
765 |
+ return; |
766 |
+ |
767 |
+ for (i = 0; i < GET_HIGH_SLICE_INDEX(high_limit); i++) |
768 |
+@@ -182,7 +189,7 @@ static bool slice_check_range_fits(struct mm_struct *mm, |
769 |
+ unsigned long end = start + len - 1; |
770 |
+ u64 low_slices = 0; |
771 |
+ |
772 |
+- if (start < SLICE_LOW_TOP) { |
773 |
++ if (slice_addr_is_low(start)) { |
774 |
+ unsigned long mend = min(end, |
775 |
+ (unsigned long)(SLICE_LOW_TOP - 1)); |
776 |
+ |
777 |
+@@ -192,7 +199,7 @@ static bool slice_check_range_fits(struct mm_struct *mm, |
778 |
+ if ((low_slices & available->low_slices) != low_slices) |
779 |
+ return false; |
780 |
+ |
781 |
+- if (SLICE_NUM_HIGH && ((start + len) > SLICE_LOW_TOP)) { |
782 |
++ if (SLICE_NUM_HIGH && !slice_addr_is_low(end)) { |
783 |
+ unsigned long start_index = GET_HIGH_SLICE_INDEX(start); |
784 |
+ unsigned long align_end = ALIGN(end, (1UL << SLICE_HIGH_SHIFT)); |
785 |
+ unsigned long count = GET_HIGH_SLICE_INDEX(align_end) - start_index; |
786 |
+@@ -303,7 +310,7 @@ static bool slice_scan_available(unsigned long addr, |
787 |
+ int end, unsigned long *boundary_addr) |
788 |
+ { |
789 |
+ unsigned long slice; |
790 |
+- if (addr < SLICE_LOW_TOP) { |
791 |
++ if (slice_addr_is_low(addr)) { |
792 |
+ slice = GET_LOW_SLICE_INDEX(addr); |
793 |
+ *boundary_addr = (slice + end) << SLICE_LOW_SHIFT; |
794 |
+ return !!(available->low_slices & (1u << slice)); |
795 |
+@@ -706,7 +713,7 @@ unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr) |
796 |
+ |
797 |
+ VM_BUG_ON(radix_enabled()); |
798 |
+ |
799 |
+- if (addr < SLICE_LOW_TOP) { |
800 |
++ if (slice_addr_is_low(addr)) { |
801 |
+ psizes = mm->context.low_slices_psize; |
802 |
+ index = GET_LOW_SLICE_INDEX(addr); |
803 |
+ } else { |
804 |
+diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c |
805 |
+index 15fe5f0c8665..ae5d568e267f 100644 |
806 |
+--- a/arch/powerpc/mm/tlb_nohash.c |
807 |
++++ b/arch/powerpc/mm/tlb_nohash.c |
808 |
+@@ -503,6 +503,9 @@ static void setup_page_sizes(void) |
809 |
+ for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) { |
810 |
+ struct mmu_psize_def *def = &mmu_psize_defs[psize]; |
811 |
+ |
812 |
++ if (!def->shift) |
813 |
++ continue; |
814 |
++ |
815 |
+ if (tlb1ps & (1U << (def->shift - 10))) { |
816 |
+ def->flags |= MMU_PAGE_SIZE_DIRECT; |
817 |
+ |
818 |
+diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c |
819 |
+index 51dc398ae3f7..a29fdf8a2e56 100644 |
820 |
+--- a/arch/powerpc/platforms/powernv/memtrace.c |
821 |
++++ b/arch/powerpc/platforms/powernv/memtrace.c |
822 |
+@@ -90,17 +90,15 @@ static bool memtrace_offline_pages(u32 nid, u64 start_pfn, u64 nr_pages) |
823 |
+ walk_memory_range(start_pfn, end_pfn, (void *)MEM_OFFLINE, |
824 |
+ change_memblock_state); |
825 |
+ |
826 |
+- lock_device_hotplug(); |
827 |
+- remove_memory(nid, start_pfn << PAGE_SHIFT, nr_pages << PAGE_SHIFT); |
828 |
+- unlock_device_hotplug(); |
829 |
+ |
830 |
+ return true; |
831 |
+ } |
832 |
+ |
833 |
+ static u64 memtrace_alloc_node(u32 nid, u64 size) |
834 |
+ { |
835 |
+- u64 start_pfn, end_pfn, nr_pages; |
836 |
++ u64 start_pfn, end_pfn, nr_pages, pfn; |
837 |
+ u64 base_pfn; |
838 |
++ u64 bytes = memory_block_size_bytes(); |
839 |
+ |
840 |
+ if (!node_spanned_pages(nid)) |
841 |
+ return 0; |
842 |
+@@ -113,8 +111,21 @@ static u64 memtrace_alloc_node(u32 nid, u64 size) |
843 |
+ end_pfn = round_down(end_pfn - nr_pages, nr_pages); |
844 |
+ |
845 |
+ for (base_pfn = end_pfn; base_pfn > start_pfn; base_pfn -= nr_pages) { |
846 |
+- if (memtrace_offline_pages(nid, base_pfn, nr_pages) == true) |
847 |
++ if (memtrace_offline_pages(nid, base_pfn, nr_pages) == true) { |
848 |
++ /* |
849 |
++ * Remove memory in memory block size chunks so that |
850 |
++ * iomem resources are always split to the same size and |
851 |
++ * we never try to remove memory that spans two iomem |
852 |
++ * resources. |
853 |
++ */ |
854 |
++ lock_device_hotplug(); |
855 |
++ end_pfn = base_pfn + nr_pages; |
856 |
++ for (pfn = base_pfn; pfn < end_pfn; pfn += bytes>> PAGE_SHIFT) { |
857 |
++ remove_memory(nid, pfn << PAGE_SHIFT, bytes); |
858 |
++ } |
859 |
++ unlock_device_hotplug(); |
860 |
+ return base_pfn << PAGE_SHIFT; |
861 |
++ } |
862 |
+ } |
863 |
+ |
864 |
+ return 0; |
865 |
+diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h |
866 |
+index 3a17107594c8..eb786f90f2d3 100644 |
867 |
+--- a/arch/x86/include/asm/mce.h |
868 |
++++ b/arch/x86/include/asm/mce.h |
869 |
+@@ -216,6 +216,8 @@ static inline int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *s |
870 |
+ |
871 |
+ int mce_available(struct cpuinfo_x86 *c); |
872 |
+ bool mce_is_memory_error(struct mce *m); |
873 |
++bool mce_is_correctable(struct mce *m); |
874 |
++int mce_usable_address(struct mce *m); |
875 |
+ |
876 |
+ DECLARE_PER_CPU(unsigned, mce_exception_count); |
877 |
+ DECLARE_PER_CPU(unsigned, mce_poll_count); |
878 |
+diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c |
879 |
+index 953b3ce92dcc..cdbedeb3f3db 100644 |
880 |
+--- a/arch/x86/kernel/cpu/mcheck/mce.c |
881 |
++++ b/arch/x86/kernel/cpu/mcheck/mce.c |
882 |
+@@ -485,7 +485,7 @@ static void mce_report_event(struct pt_regs *regs) |
883 |
+ * be somewhat complicated (e.g. segment offset would require an instruction |
884 |
+ * parser). So only support physical addresses up to page granuality for now. |
885 |
+ */ |
886 |
+-static int mce_usable_address(struct mce *m) |
887 |
++int mce_usable_address(struct mce *m) |
888 |
+ { |
889 |
+ if (!(m->status & MCI_STATUS_ADDRV)) |
890 |
+ return 0; |
891 |
+@@ -505,6 +505,7 @@ static int mce_usable_address(struct mce *m) |
892 |
+ |
893 |
+ return 1; |
894 |
+ } |
895 |
++EXPORT_SYMBOL_GPL(mce_usable_address); |
896 |
+ |
897 |
+ bool mce_is_memory_error(struct mce *m) |
898 |
+ { |
899 |
+@@ -534,7 +535,7 @@ bool mce_is_memory_error(struct mce *m) |
900 |
+ } |
901 |
+ EXPORT_SYMBOL_GPL(mce_is_memory_error); |
902 |
+ |
903 |
+-static bool mce_is_correctable(struct mce *m) |
904 |
++bool mce_is_correctable(struct mce *m) |
905 |
+ { |
906 |
+ if (m->cpuvendor == X86_VENDOR_AMD && m->status & MCI_STATUS_DEFERRED) |
907 |
+ return false; |
908 |
+@@ -544,6 +545,7 @@ static bool mce_is_correctable(struct mce *m) |
909 |
+ |
910 |
+ return true; |
911 |
+ } |
912 |
++EXPORT_SYMBOL_GPL(mce_is_correctable); |
913 |
+ |
914 |
+ static bool cec_add_mce(struct mce *m) |
915 |
+ { |
916 |
+diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c |
917 |
+index ad12733f6058..852e74e48890 100644 |
918 |
+--- a/arch/x86/kernel/cpu/mshyperv.c |
919 |
++++ b/arch/x86/kernel/cpu/mshyperv.c |
920 |
+@@ -20,6 +20,7 @@ |
921 |
+ #include <linux/interrupt.h> |
922 |
+ #include <linux/irq.h> |
923 |
+ #include <linux/kexec.h> |
924 |
++#include <linux/i8253.h> |
925 |
+ #include <asm/processor.h> |
926 |
+ #include <asm/hypervisor.h> |
927 |
+ #include <asm/hyperv-tlfs.h> |
928 |
+@@ -285,6 +286,16 @@ static void __init ms_hyperv_init_platform(void) |
929 |
+ if (efi_enabled(EFI_BOOT)) |
930 |
+ x86_platform.get_nmi_reason = hv_get_nmi_reason; |
931 |
+ |
932 |
++ /* |
933 |
++ * Hyper-V VMs have a PIT emulation quirk such that zeroing the |
934 |
++ * counter register during PIT shutdown restarts the PIT. So it |
935 |
++ * continues to interrupt @18.2 HZ. Setting i8253_clear_counter |
936 |
++ * to false tells pit_shutdown() not to zero the counter so that |
937 |
++ * the PIT really is shutdown. Generation 2 VMs don't have a PIT, |
938 |
++ * and setting this value has no effect. |
939 |
++ */ |
940 |
++ i8253_clear_counter_on_shutdown = false; |
941 |
++ |
942 |
+ #if IS_ENABLED(CONFIG_HYPERV) |
943 |
+ /* |
944 |
+ * Setup the hook to get control post apic initialization. |
945 |
+diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c |
946 |
+index 8e005329648b..d805202c63cd 100644 |
947 |
+--- a/arch/x86/kernel/cpu/vmware.c |
948 |
++++ b/arch/x86/kernel/cpu/vmware.c |
949 |
+@@ -77,7 +77,7 @@ static __init int setup_vmw_sched_clock(char *s) |
950 |
+ } |
951 |
+ early_param("no-vmw-sched-clock", setup_vmw_sched_clock); |
952 |
+ |
953 |
+-static unsigned long long vmware_sched_clock(void) |
954 |
++static unsigned long long notrace vmware_sched_clock(void) |
955 |
+ { |
956 |
+ unsigned long long ns; |
957 |
+ |
958 |
+diff --git a/arch/x86/um/shared/sysdep/ptrace_32.h b/arch/x86/um/shared/sysdep/ptrace_32.h |
959 |
+index b94a108de1dc..ae00d22bce02 100644 |
960 |
+--- a/arch/x86/um/shared/sysdep/ptrace_32.h |
961 |
++++ b/arch/x86/um/shared/sysdep/ptrace_32.h |
962 |
+@@ -10,20 +10,10 @@ |
963 |
+ |
964 |
+ static inline void update_debugregs(int seq) {} |
965 |
+ |
966 |
+-/* syscall emulation path in ptrace */ |
967 |
+- |
968 |
+-#ifndef PTRACE_SYSEMU |
969 |
+-#define PTRACE_SYSEMU 31 |
970 |
+-#endif |
971 |
+- |
972 |
+ void set_using_sysemu(int value); |
973 |
+ int get_using_sysemu(void); |
974 |
+ extern int sysemu_supported; |
975 |
+ |
976 |
+-#ifndef PTRACE_SYSEMU_SINGLESTEP |
977 |
+-#define PTRACE_SYSEMU_SINGLESTEP 32 |
978 |
+-#endif |
979 |
+- |
980 |
+ #define UPT_SYSCALL_ARG1(r) UPT_BX(r) |
981 |
+ #define UPT_SYSCALL_ARG2(r) UPT_CX(r) |
982 |
+ #define UPT_SYSCALL_ARG3(r) UPT_DX(r) |
983 |
+diff --git a/arch/xtensa/boot/Makefile b/arch/xtensa/boot/Makefile |
984 |
+index dc9e0ba7122c..294846117fc2 100644 |
985 |
+--- a/arch/xtensa/boot/Makefile |
986 |
++++ b/arch/xtensa/boot/Makefile |
987 |
+@@ -33,7 +33,7 @@ uImage: $(obj)/uImage |
988 |
+ boot-elf boot-redboot: $(addprefix $(obj)/,$(subdir-y)) |
989 |
+ $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS) |
990 |
+ |
991 |
+-OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary |
992 |
++OBJCOPYFLAGS = --strip-all -R .comment -R .notes -O binary |
993 |
+ |
994 |
+ vmlinux.bin: vmlinux FORCE |
995 |
+ $(call if_changed,objcopy) |
996 |
+diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h |
997 |
+index e4ccb88b7996..677bc76c1d70 100644 |
998 |
+--- a/arch/xtensa/include/asm/processor.h |
999 |
++++ b/arch/xtensa/include/asm/processor.h |
1000 |
+@@ -23,7 +23,11 @@ |
1001 |
+ # error Linux requires the Xtensa Windowed Registers Option. |
1002 |
+ #endif |
1003 |
+ |
1004 |
+-#define ARCH_SLAB_MINALIGN XCHAL_DATA_WIDTH |
1005 |
++/* Xtensa ABI requires stack alignment to be at least 16 */ |
1006 |
++ |
1007 |
++#define STACK_ALIGN (XCHAL_DATA_WIDTH > 16 ? XCHAL_DATA_WIDTH : 16) |
1008 |
++ |
1009 |
++#define ARCH_SLAB_MINALIGN STACK_ALIGN |
1010 |
+ |
1011 |
+ /* |
1012 |
+ * User space process size: 1 GB. |
1013 |
+diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S |
1014 |
+index 2f76118ecf62..9053a5622d2c 100644 |
1015 |
+--- a/arch/xtensa/kernel/head.S |
1016 |
++++ b/arch/xtensa/kernel/head.S |
1017 |
+@@ -88,9 +88,12 @@ _SetupMMU: |
1018 |
+ initialize_mmu |
1019 |
+ #if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY |
1020 |
+ rsr a2, excsave1 |
1021 |
+- movi a3, 0x08000000 |
1022 |
++ movi a3, XCHAL_KSEG_PADDR |
1023 |
++ bltu a2, a3, 1f |
1024 |
++ sub a2, a2, a3 |
1025 |
++ movi a3, XCHAL_KSEG_SIZE |
1026 |
+ bgeu a2, a3, 1f |
1027 |
+- movi a3, 0xd0000000 |
1028 |
++ movi a3, XCHAL_KSEG_CACHED_VADDR |
1029 |
+ add a2, a2, a3 |
1030 |
+ wsr a2, excsave1 |
1031 |
+ 1: |
1032 |
+diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S |
1033 |
+index a1c3edb8ad56..fa926995d2a3 100644 |
1034 |
+--- a/arch/xtensa/kernel/vmlinux.lds.S |
1035 |
++++ b/arch/xtensa/kernel/vmlinux.lds.S |
1036 |
+@@ -131,6 +131,7 @@ SECTIONS |
1037 |
+ .fixup : { *(.fixup) } |
1038 |
+ |
1039 |
+ EXCEPTION_TABLE(16) |
1040 |
++ NOTES |
1041 |
+ /* Data section */ |
1042 |
+ |
1043 |
+ _sdata = .; |
1044 |
+diff --git a/block/blk-core.c b/block/blk-core.c |
1045 |
+index cff0a60ee200..eb8b52241453 100644 |
1046 |
+--- a/block/blk-core.c |
1047 |
++++ b/block/blk-core.c |
1048 |
+@@ -793,9 +793,8 @@ void blk_cleanup_queue(struct request_queue *q) |
1049 |
+ * dispatch may still be in-progress since we dispatch requests |
1050 |
+ * from more than one contexts. |
1051 |
+ * |
1052 |
+- * No need to quiesce queue if it isn't initialized yet since |
1053 |
+- * blk_freeze_queue() should be enough for cases of passthrough |
1054 |
+- * request. |
1055 |
++ * We rely on driver to deal with the race in case that queue |
1056 |
++ * initialization isn't done. |
1057 |
+ */ |
1058 |
+ if (q->mq_ops && blk_queue_init_done(q)) |
1059 |
+ blk_mq_quiesce_queue(q); |
1060 |
+diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c |
1061 |
+index 0e89b5457cab..ceeb2eaf28cf 100644 |
1062 |
+--- a/crypto/crypto_user.c |
1063 |
++++ b/crypto/crypto_user.c |
1064 |
+@@ -83,7 +83,7 @@ static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg) |
1065 |
+ { |
1066 |
+ struct crypto_report_cipher rcipher; |
1067 |
+ |
1068 |
+- strlcpy(rcipher.type, "cipher", sizeof(rcipher.type)); |
1069 |
++ strncpy(rcipher.type, "cipher", sizeof(rcipher.type)); |
1070 |
+ |
1071 |
+ rcipher.blocksize = alg->cra_blocksize; |
1072 |
+ rcipher.min_keysize = alg->cra_cipher.cia_min_keysize; |
1073 |
+@@ -102,7 +102,7 @@ static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg) |
1074 |
+ { |
1075 |
+ struct crypto_report_comp rcomp; |
1076 |
+ |
1077 |
+- strlcpy(rcomp.type, "compression", sizeof(rcomp.type)); |
1078 |
++ strncpy(rcomp.type, "compression", sizeof(rcomp.type)); |
1079 |
+ if (nla_put(skb, CRYPTOCFGA_REPORT_COMPRESS, |
1080 |
+ sizeof(struct crypto_report_comp), &rcomp)) |
1081 |
+ goto nla_put_failure; |
1082 |
+@@ -116,7 +116,7 @@ static int crypto_report_acomp(struct sk_buff *skb, struct crypto_alg *alg) |
1083 |
+ { |
1084 |
+ struct crypto_report_acomp racomp; |
1085 |
+ |
1086 |
+- strlcpy(racomp.type, "acomp", sizeof(racomp.type)); |
1087 |
++ strncpy(racomp.type, "acomp", sizeof(racomp.type)); |
1088 |
+ |
1089 |
+ if (nla_put(skb, CRYPTOCFGA_REPORT_ACOMP, |
1090 |
+ sizeof(struct crypto_report_acomp), &racomp)) |
1091 |
+@@ -131,7 +131,7 @@ static int crypto_report_akcipher(struct sk_buff *skb, struct crypto_alg *alg) |
1092 |
+ { |
1093 |
+ struct crypto_report_akcipher rakcipher; |
1094 |
+ |
1095 |
+- strlcpy(rakcipher.type, "akcipher", sizeof(rakcipher.type)); |
1096 |
++ strncpy(rakcipher.type, "akcipher", sizeof(rakcipher.type)); |
1097 |
+ |
1098 |
+ if (nla_put(skb, CRYPTOCFGA_REPORT_AKCIPHER, |
1099 |
+ sizeof(struct crypto_report_akcipher), &rakcipher)) |
1100 |
+@@ -146,7 +146,7 @@ static int crypto_report_kpp(struct sk_buff *skb, struct crypto_alg *alg) |
1101 |
+ { |
1102 |
+ struct crypto_report_kpp rkpp; |
1103 |
+ |
1104 |
+- strlcpy(rkpp.type, "kpp", sizeof(rkpp.type)); |
1105 |
++ strncpy(rkpp.type, "kpp", sizeof(rkpp.type)); |
1106 |
+ |
1107 |
+ if (nla_put(skb, CRYPTOCFGA_REPORT_KPP, |
1108 |
+ sizeof(struct crypto_report_kpp), &rkpp)) |
1109 |
+@@ -160,10 +160,10 @@ nla_put_failure: |
1110 |
+ static int crypto_report_one(struct crypto_alg *alg, |
1111 |
+ struct crypto_user_alg *ualg, struct sk_buff *skb) |
1112 |
+ { |
1113 |
+- strlcpy(ualg->cru_name, alg->cra_name, sizeof(ualg->cru_name)); |
1114 |
+- strlcpy(ualg->cru_driver_name, alg->cra_driver_name, |
1115 |
++ strncpy(ualg->cru_name, alg->cra_name, sizeof(ualg->cru_name)); |
1116 |
++ strncpy(ualg->cru_driver_name, alg->cra_driver_name, |
1117 |
+ sizeof(ualg->cru_driver_name)); |
1118 |
+- strlcpy(ualg->cru_module_name, module_name(alg->cra_module), |
1119 |
++ strncpy(ualg->cru_module_name, module_name(alg->cra_module), |
1120 |
+ sizeof(ualg->cru_module_name)); |
1121 |
+ |
1122 |
+ ualg->cru_type = 0; |
1123 |
+@@ -176,7 +176,7 @@ static int crypto_report_one(struct crypto_alg *alg, |
1124 |
+ if (alg->cra_flags & CRYPTO_ALG_LARVAL) { |
1125 |
+ struct crypto_report_larval rl; |
1126 |
+ |
1127 |
+- strlcpy(rl.type, "larval", sizeof(rl.type)); |
1128 |
++ strncpy(rl.type, "larval", sizeof(rl.type)); |
1129 |
+ if (nla_put(skb, CRYPTOCFGA_REPORT_LARVAL, |
1130 |
+ sizeof(struct crypto_report_larval), &rl)) |
1131 |
+ goto nla_put_failure; |
1132 |
+diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c |
1133 |
+index 78f9de260d5f..e9fb0bf3c8d2 100644 |
1134 |
+--- a/drivers/acpi/acpica/dsopcode.c |
1135 |
++++ b/drivers/acpi/acpica/dsopcode.c |
1136 |
+@@ -417,10 +417,6 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, |
1137 |
+ ACPI_FORMAT_UINT64(obj_desc->region.address), |
1138 |
+ obj_desc->region.length)); |
1139 |
+ |
1140 |
+- status = acpi_ut_add_address_range(obj_desc->region.space_id, |
1141 |
+- obj_desc->region.address, |
1142 |
+- obj_desc->region.length, node); |
1143 |
+- |
1144 |
+ /* Now the address and length are valid for this opregion */ |
1145 |
+ |
1146 |
+ obj_desc->region.flags |= AOPOBJ_DATA_VALID; |
1147 |
+diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c |
1148 |
+index 19b641208d86..c5d15752dfb3 100644 |
1149 |
+--- a/drivers/acpi/nfit/core.c |
1150 |
++++ b/drivers/acpi/nfit/core.c |
1151 |
+@@ -2845,9 +2845,9 @@ static int acpi_nfit_query_poison(struct acpi_nfit_desc *acpi_desc) |
1152 |
+ return rc; |
1153 |
+ |
1154 |
+ if (ars_status_process_records(acpi_desc)) |
1155 |
+- return -ENOMEM; |
1156 |
++ dev_err(acpi_desc->dev, "Failed to process ARS records\n"); |
1157 |
+ |
1158 |
+- return 0; |
1159 |
++ return rc; |
1160 |
+ } |
1161 |
+ |
1162 |
+ static int ars_register(struct acpi_nfit_desc *acpi_desc, |
1163 |
+diff --git a/drivers/acpi/nfit/mce.c b/drivers/acpi/nfit/mce.c |
1164 |
+index e9626bf6ca29..d6c1b10f6c25 100644 |
1165 |
+--- a/drivers/acpi/nfit/mce.c |
1166 |
++++ b/drivers/acpi/nfit/mce.c |
1167 |
+@@ -25,8 +25,12 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val, |
1168 |
+ struct acpi_nfit_desc *acpi_desc; |
1169 |
+ struct nfit_spa *nfit_spa; |
1170 |
+ |
1171 |
+- /* We only care about memory errors */ |
1172 |
+- if (!mce_is_memory_error(mce)) |
1173 |
++ /* We only care about uncorrectable memory errors */ |
1174 |
++ if (!mce_is_memory_error(mce) || mce_is_correctable(mce)) |
1175 |
++ return NOTIFY_DONE; |
1176 |
++ |
1177 |
++ /* Verify the address reported in the MCE is valid. */ |
1178 |
++ if (!mce_usable_address(mce)) |
1179 |
+ return NOTIFY_DONE; |
1180 |
+ |
1181 |
+ /* |
1182 |
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
1183 |
+index 6e594644cb1d..a7f5202a4815 100644 |
1184 |
+--- a/drivers/ata/libata-core.c |
1185 |
++++ b/drivers/ata/libata-core.c |
1186 |
+@@ -4553,7 +4553,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { |
1187 |
+ /* These specific Samsung models/firmware-revs do not handle LPM well */ |
1188 |
+ { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, }, |
1189 |
+ { "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM, }, |
1190 |
+- { "SAMSUNG MZ7TD256HAFV-000L9", "DXT02L5Q", ATA_HORKAGE_NOLPM, }, |
1191 |
++ { "SAMSUNG MZ7TD256HAFV-000L9", NULL, ATA_HORKAGE_NOLPM, }, |
1192 |
+ |
1193 |
+ /* devices that don't properly handle queued TRIM commands */ |
1194 |
+ { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
1195 |
+diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c |
1196 |
+index a1d6b5597c17..66921427d109 100644 |
1197 |
+--- a/drivers/block/zram/zram_drv.c |
1198 |
++++ b/drivers/block/zram/zram_drv.c |
1199 |
+@@ -1636,6 +1636,11 @@ static const struct attribute_group zram_disk_attr_group = { |
1200 |
+ .attrs = zram_disk_attrs, |
1201 |
+ }; |
1202 |
+ |
1203 |
++static const struct attribute_group *zram_disk_attr_groups[] = { |
1204 |
++ &zram_disk_attr_group, |
1205 |
++ NULL, |
1206 |
++}; |
1207 |
++ |
1208 |
+ /* |
1209 |
+ * Allocate and initialize new zram device. the function returns |
1210 |
+ * '>= 0' device_id upon success, and negative value otherwise. |
1211 |
+@@ -1716,24 +1721,15 @@ static int zram_add(void) |
1212 |
+ |
1213 |
+ zram->disk->queue->backing_dev_info->capabilities |= |
1214 |
+ (BDI_CAP_STABLE_WRITES | BDI_CAP_SYNCHRONOUS_IO); |
1215 |
++ disk_to_dev(zram->disk)->groups = zram_disk_attr_groups; |
1216 |
+ add_disk(zram->disk); |
1217 |
+ |
1218 |
+- ret = sysfs_create_group(&disk_to_dev(zram->disk)->kobj, |
1219 |
+- &zram_disk_attr_group); |
1220 |
+- if (ret < 0) { |
1221 |
+- pr_err("Error creating sysfs group for device %d\n", |
1222 |
+- device_id); |
1223 |
+- goto out_free_disk; |
1224 |
+- } |
1225 |
+ strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor)); |
1226 |
+ |
1227 |
+ zram_debugfs_register(zram); |
1228 |
+ pr_info("Added device: %s\n", zram->disk->disk_name); |
1229 |
+ return device_id; |
1230 |
+ |
1231 |
+-out_free_disk: |
1232 |
+- del_gendisk(zram->disk); |
1233 |
+- put_disk(zram->disk); |
1234 |
+ out_free_queue: |
1235 |
+ blk_cleanup_queue(queue); |
1236 |
+ out_free_idr: |
1237 |
+@@ -1762,16 +1758,6 @@ static int zram_remove(struct zram *zram) |
1238 |
+ mutex_unlock(&bdev->bd_mutex); |
1239 |
+ |
1240 |
+ zram_debugfs_unregister(zram); |
1241 |
+- /* |
1242 |
+- * Remove sysfs first, so no one will perform a disksize |
1243 |
+- * store while we destroy the devices. This also helps during |
1244 |
+- * hot_remove -- zram_reset_device() is the last holder of |
1245 |
+- * ->init_lock, no later/concurrent disksize_store() or any |
1246 |
+- * other sysfs handlers are possible. |
1247 |
+- */ |
1248 |
+- sysfs_remove_group(&disk_to_dev(zram->disk)->kobj, |
1249 |
+- &zram_disk_attr_group); |
1250 |
+- |
1251 |
+ /* Make sure all the pending I/O are finished */ |
1252 |
+ fsync_bdev(bdev); |
1253 |
+ zram_reset_device(zram); |
1254 |
+diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c |
1255 |
+index a5d5a96479bf..10802d1fc554 100644 |
1256 |
+--- a/drivers/cdrom/cdrom.c |
1257 |
++++ b/drivers/cdrom/cdrom.c |
1258 |
+@@ -2445,7 +2445,7 @@ static int cdrom_ioctl_select_disc(struct cdrom_device_info *cdi, |
1259 |
+ return -ENOSYS; |
1260 |
+ |
1261 |
+ if (arg != CDSL_CURRENT && arg != CDSL_NONE) { |
1262 |
+- if ((int)arg >= cdi->capacity) |
1263 |
++ if (arg >= cdi->capacity) |
1264 |
+ return -EINVAL; |
1265 |
+ } |
1266 |
+ |
1267 |
+diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c |
1268 |
+index 72b6091eb7b9..dc7fbc796cb6 100644 |
1269 |
+--- a/drivers/clk/at91/clk-pll.c |
1270 |
++++ b/drivers/clk/at91/clk-pll.c |
1271 |
+@@ -133,6 +133,9 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, |
1272 |
+ { |
1273 |
+ struct clk_pll *pll = to_clk_pll(hw); |
1274 |
+ |
1275 |
++ if (!pll->div || !pll->mul) |
1276 |
++ return 0; |
1277 |
++ |
1278 |
+ return (parent_rate / pll->div) * (pll->mul + 1); |
1279 |
+ } |
1280 |
+ |
1281 |
+diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c |
1282 |
+index d44e0eea31ec..0934d3724495 100644 |
1283 |
+--- a/drivers/clk/clk-s2mps11.c |
1284 |
++++ b/drivers/clk/clk-s2mps11.c |
1285 |
+@@ -245,6 +245,36 @@ static const struct platform_device_id s2mps11_clk_id[] = { |
1286 |
+ }; |
1287 |
+ MODULE_DEVICE_TABLE(platform, s2mps11_clk_id); |
1288 |
+ |
1289 |
++#ifdef CONFIG_OF |
1290 |
++/* |
1291 |
++ * Device is instantiated through parent MFD device and device matching is done |
1292 |
++ * through platform_device_id. |
1293 |
++ * |
1294 |
++ * However if device's DT node contains proper clock compatible and driver is |
1295 |
++ * built as a module, then the *module* matching will be done trough DT aliases. |
1296 |
++ * This requires of_device_id table. In the same time this will not change the |
1297 |
++ * actual *device* matching so do not add .of_match_table. |
1298 |
++ */ |
1299 |
++static const struct of_device_id s2mps11_dt_match[] = { |
1300 |
++ { |
1301 |
++ .compatible = "samsung,s2mps11-clk", |
1302 |
++ .data = (void *)S2MPS11X, |
1303 |
++ }, { |
1304 |
++ .compatible = "samsung,s2mps13-clk", |
1305 |
++ .data = (void *)S2MPS13X, |
1306 |
++ }, { |
1307 |
++ .compatible = "samsung,s2mps14-clk", |
1308 |
++ .data = (void *)S2MPS14X, |
1309 |
++ }, { |
1310 |
++ .compatible = "samsung,s5m8767-clk", |
1311 |
++ .data = (void *)S5M8767X, |
1312 |
++ }, { |
1313 |
++ /* Sentinel */ |
1314 |
++ }, |
1315 |
++}; |
1316 |
++MODULE_DEVICE_TABLE(of, s2mps11_dt_match); |
1317 |
++#endif |
1318 |
++ |
1319 |
+ static struct platform_driver s2mps11_clk_driver = { |
1320 |
+ .driver = { |
1321 |
+ .name = "s2mps11-clk", |
1322 |
+diff --git a/drivers/clk/hisilicon/reset.c b/drivers/clk/hisilicon/reset.c |
1323 |
+index 2a5015c736ce..43e82fa64422 100644 |
1324 |
+--- a/drivers/clk/hisilicon/reset.c |
1325 |
++++ b/drivers/clk/hisilicon/reset.c |
1326 |
+@@ -109,9 +109,8 @@ struct hisi_reset_controller *hisi_reset_init(struct platform_device *pdev) |
1327 |
+ return NULL; |
1328 |
+ |
1329 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1330 |
+- rstc->membase = devm_ioremap(&pdev->dev, |
1331 |
+- res->start, resource_size(res)); |
1332 |
+- if (!rstc->membase) |
1333 |
++ rstc->membase = devm_ioremap_resource(&pdev->dev, res); |
1334 |
++ if (IS_ERR(rstc->membase)) |
1335 |
+ return NULL; |
1336 |
+ |
1337 |
+ spin_lock_init(&rstc->lock); |
1338 |
+diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c |
1339 |
+index 00ce62ad6416..8cf74fc423e6 100644 |
1340 |
+--- a/drivers/clk/meson/axg.c |
1341 |
++++ b/drivers/clk/meson/axg.c |
1342 |
+@@ -319,6 +319,7 @@ static struct clk_regmap axg_fclk_div2 = { |
1343 |
+ .ops = &clk_regmap_gate_ops, |
1344 |
+ .parent_names = (const char *[]){ "fclk_div2_div" }, |
1345 |
+ .num_parents = 1, |
1346 |
++ .flags = CLK_IS_CRITICAL, |
1347 |
+ }, |
1348 |
+ }; |
1349 |
+ |
1350 |
+@@ -343,6 +344,18 @@ static struct clk_regmap axg_fclk_div3 = { |
1351 |
+ .ops = &clk_regmap_gate_ops, |
1352 |
+ .parent_names = (const char *[]){ "fclk_div3_div" }, |
1353 |
+ .num_parents = 1, |
1354 |
++ /* |
1355 |
++ * FIXME: |
1356 |
++ * This clock, as fdiv2, is used by the SCPI FW and is required |
1357 |
++ * by the platform to operate correctly. |
1358 |
++ * Until the following condition are met, we need this clock to |
1359 |
++ * be marked as critical: |
1360 |
++ * a) The SCPI generic driver claims and enable all the clocks |
1361 |
++ * it needs |
1362 |
++ * b) CCF has a clock hand-off mechanism to make the sure the |
1363 |
++ * clock stays on until the proper driver comes along |
1364 |
++ */ |
1365 |
++ .flags = CLK_IS_CRITICAL, |
1366 |
+ }, |
1367 |
+ }; |
1368 |
+ |
1369 |
+diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c |
1370 |
+index 86d3ae58e84c..6435d86118f1 100644 |
1371 |
+--- a/drivers/clk/meson/gxbb.c |
1372 |
++++ b/drivers/clk/meson/gxbb.c |
1373 |
+@@ -522,6 +522,18 @@ static struct clk_regmap gxbb_fclk_div3 = { |
1374 |
+ .ops = &clk_regmap_gate_ops, |
1375 |
+ .parent_names = (const char *[]){ "fclk_div3_div" }, |
1376 |
+ .num_parents = 1, |
1377 |
++ /* |
1378 |
++ * FIXME: |
1379 |
++ * This clock, as fdiv2, is used by the SCPI FW and is required |
1380 |
++ * by the platform to operate correctly. |
1381 |
++ * Until the following condition are met, we need this clock to |
1382 |
++ * be marked as critical: |
1383 |
++ * a) The SCPI generic driver claims and enable all the clocks |
1384 |
++ * it needs |
1385 |
++ * b) CCF has a clock hand-off mechanism to make the sure the |
1386 |
++ * clock stays on until the proper driver comes along |
1387 |
++ */ |
1388 |
++ .flags = CLK_IS_CRITICAL, |
1389 |
+ }, |
1390 |
+ }; |
1391 |
+ |
1392 |
+diff --git a/drivers/clk/rockchip/clk-ddr.c b/drivers/clk/rockchip/clk-ddr.c |
1393 |
+index e8075359366b..ebce5260068b 100644 |
1394 |
+--- a/drivers/clk/rockchip/clk-ddr.c |
1395 |
++++ b/drivers/clk/rockchip/clk-ddr.c |
1396 |
+@@ -80,16 +80,12 @@ static long rockchip_ddrclk_sip_round_rate(struct clk_hw *hw, |
1397 |
+ static u8 rockchip_ddrclk_get_parent(struct clk_hw *hw) |
1398 |
+ { |
1399 |
+ struct rockchip_ddrclk *ddrclk = to_rockchip_ddrclk_hw(hw); |
1400 |
+- int num_parents = clk_hw_get_num_parents(hw); |
1401 |
+ u32 val; |
1402 |
+ |
1403 |
+ val = clk_readl(ddrclk->reg_base + |
1404 |
+ ddrclk->mux_offset) >> ddrclk->mux_shift; |
1405 |
+ val &= GENMASK(ddrclk->mux_width - 1, 0); |
1406 |
+ |
1407 |
+- if (val >= num_parents) |
1408 |
+- return -EINVAL; |
1409 |
+- |
1410 |
+ return val; |
1411 |
+ } |
1412 |
+ |
1413 |
+diff --git a/drivers/clk/rockchip/clk-rk3328.c b/drivers/clk/rockchip/clk-rk3328.c |
1414 |
+index 252366a5231f..2c5426607790 100644 |
1415 |
+--- a/drivers/clk/rockchip/clk-rk3328.c |
1416 |
++++ b/drivers/clk/rockchip/clk-rk3328.c |
1417 |
+@@ -813,22 +813,22 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { |
1418 |
+ MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "clk_sdmmc", |
1419 |
+ RK3328_SDMMC_CON0, 1), |
1420 |
+ MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "clk_sdmmc", |
1421 |
+- RK3328_SDMMC_CON1, 1), |
1422 |
++ RK3328_SDMMC_CON1, 0), |
1423 |
+ |
1424 |
+ MMC(SCLK_SDIO_DRV, "sdio_drv", "clk_sdio", |
1425 |
+ RK3328_SDIO_CON0, 1), |
1426 |
+ MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "clk_sdio", |
1427 |
+- RK3328_SDIO_CON1, 1), |
1428 |
++ RK3328_SDIO_CON1, 0), |
1429 |
+ |
1430 |
+ MMC(SCLK_EMMC_DRV, "emmc_drv", "clk_emmc", |
1431 |
+ RK3328_EMMC_CON0, 1), |
1432 |
+ MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "clk_emmc", |
1433 |
+- RK3328_EMMC_CON1, 1), |
1434 |
++ RK3328_EMMC_CON1, 0), |
1435 |
+ |
1436 |
+ MMC(SCLK_SDMMC_EXT_DRV, "sdmmc_ext_drv", "clk_sdmmc_ext", |
1437 |
+ RK3328_SDMMC_EXT_CON0, 1), |
1438 |
+ MMC(SCLK_SDMMC_EXT_SAMPLE, "sdmmc_ext_sample", "clk_sdmmc_ext", |
1439 |
+- RK3328_SDMMC_EXT_CON1, 1), |
1440 |
++ RK3328_SDMMC_EXT_CON1, 0), |
1441 |
+ }; |
1442 |
+ |
1443 |
+ static const char *const rk3328_critical_clocks[] __initconst = { |
1444 |
+diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c |
1445 |
+index bdbfe78fe133..0f7a0ffd3f70 100644 |
1446 |
+--- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c |
1447 |
++++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c |
1448 |
+@@ -224,7 +224,7 @@ static SUNXI_CCU_MP_WITH_MUX(psi_ahb1_ahb2_clk, "psi-ahb1-ahb2", |
1449 |
+ psi_ahb1_ahb2_parents, |
1450 |
+ 0x510, |
1451 |
+ 0, 5, /* M */ |
1452 |
+- 16, 2, /* P */ |
1453 |
++ 8, 2, /* P */ |
1454 |
+ 24, 2, /* mux */ |
1455 |
+ 0); |
1456 |
+ |
1457 |
+@@ -233,19 +233,19 @@ static const char * const ahb3_apb1_apb2_parents[] = { "osc24M", "osc32k", |
1458 |
+ "pll-periph0" }; |
1459 |
+ static SUNXI_CCU_MP_WITH_MUX(ahb3_clk, "ahb3", ahb3_apb1_apb2_parents, 0x51c, |
1460 |
+ 0, 5, /* M */ |
1461 |
+- 16, 2, /* P */ |
1462 |
++ 8, 2, /* P */ |
1463 |
+ 24, 2, /* mux */ |
1464 |
+ 0); |
1465 |
+ |
1466 |
+ static SUNXI_CCU_MP_WITH_MUX(apb1_clk, "apb1", ahb3_apb1_apb2_parents, 0x520, |
1467 |
+ 0, 5, /* M */ |
1468 |
+- 16, 2, /* P */ |
1469 |
++ 8, 2, /* P */ |
1470 |
+ 24, 2, /* mux */ |
1471 |
+ 0); |
1472 |
+ |
1473 |
+ static SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", ahb3_apb1_apb2_parents, 0x524, |
1474 |
+ 0, 5, /* M */ |
1475 |
+- 16, 2, /* P */ |
1476 |
++ 8, 2, /* P */ |
1477 |
+ 24, 2, /* mux */ |
1478 |
+ 0); |
1479 |
+ |
1480 |
+diff --git a/drivers/clocksource/i8253.c b/drivers/clocksource/i8253.c |
1481 |
+index 9c38895542f4..d4350bb10b83 100644 |
1482 |
+--- a/drivers/clocksource/i8253.c |
1483 |
++++ b/drivers/clocksource/i8253.c |
1484 |
+@@ -20,6 +20,13 @@ |
1485 |
+ DEFINE_RAW_SPINLOCK(i8253_lock); |
1486 |
+ EXPORT_SYMBOL(i8253_lock); |
1487 |
+ |
1488 |
++/* |
1489 |
++ * Handle PIT quirk in pit_shutdown() where zeroing the counter register |
1490 |
++ * restarts the PIT, negating the shutdown. On platforms with the quirk, |
1491 |
++ * platform specific code can set this to false. |
1492 |
++ */ |
1493 |
++bool i8253_clear_counter_on_shutdown __ro_after_init = true; |
1494 |
++ |
1495 |
+ #ifdef CONFIG_CLKSRC_I8253 |
1496 |
+ /* |
1497 |
+ * Since the PIT overflows every tick, its not very useful |
1498 |
+@@ -109,8 +116,11 @@ static int pit_shutdown(struct clock_event_device *evt) |
1499 |
+ raw_spin_lock(&i8253_lock); |
1500 |
+ |
1501 |
+ outb_p(0x30, PIT_MODE); |
1502 |
+- outb_p(0, PIT_CH0); |
1503 |
+- outb_p(0, PIT_CH0); |
1504 |
++ |
1505 |
++ if (i8253_clear_counter_on_shutdown) { |
1506 |
++ outb_p(0, PIT_CH0); |
1507 |
++ outb_p(0, PIT_CH0); |
1508 |
++ } |
1509 |
+ |
1510 |
+ raw_spin_unlock(&i8253_lock); |
1511 |
+ return 0; |
1512 |
+diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c |
1513 |
+index 073557f433eb..df564d783216 100644 |
1514 |
+--- a/drivers/cpuidle/cpuidle-arm.c |
1515 |
++++ b/drivers/cpuidle/cpuidle-arm.c |
1516 |
+@@ -103,13 +103,6 @@ static int __init arm_idle_init_cpu(int cpu) |
1517 |
+ goto out_kfree_drv; |
1518 |
+ } |
1519 |
+ |
1520 |
+- ret = cpuidle_register_driver(drv); |
1521 |
+- if (ret) { |
1522 |
+- if (ret != -EBUSY) |
1523 |
+- pr_err("Failed to register cpuidle driver\n"); |
1524 |
+- goto out_kfree_drv; |
1525 |
+- } |
1526 |
+- |
1527 |
+ /* |
1528 |
+ * Call arch CPU operations in order to initialize |
1529 |
+ * idle states suspend back-end specific data |
1530 |
+@@ -117,15 +110,20 @@ static int __init arm_idle_init_cpu(int cpu) |
1531 |
+ ret = arm_cpuidle_init(cpu); |
1532 |
+ |
1533 |
+ /* |
1534 |
+- * Skip the cpuidle device initialization if the reported |
1535 |
++ * Allow the initialization to continue for other CPUs, if the reported |
1536 |
+ * failure is a HW misconfiguration/breakage (-ENXIO). |
1537 |
+ */ |
1538 |
+- if (ret == -ENXIO) |
1539 |
+- return 0; |
1540 |
+- |
1541 |
+ if (ret) { |
1542 |
+ pr_err("CPU %d failed to init idle CPU ops\n", cpu); |
1543 |
+- goto out_unregister_drv; |
1544 |
++ ret = ret == -ENXIO ? 0 : ret; |
1545 |
++ goto out_kfree_drv; |
1546 |
++ } |
1547 |
++ |
1548 |
++ ret = cpuidle_register_driver(drv); |
1549 |
++ if (ret) { |
1550 |
++ if (ret != -EBUSY) |
1551 |
++ pr_err("Failed to register cpuidle driver\n"); |
1552 |
++ goto out_kfree_drv; |
1553 |
+ } |
1554 |
+ |
1555 |
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
1556 |
+diff --git a/drivers/crypto/hisilicon/sec/sec_algs.c b/drivers/crypto/hisilicon/sec/sec_algs.c |
1557 |
+index f7d6d690116e..cdc4f9a171d9 100644 |
1558 |
+--- a/drivers/crypto/hisilicon/sec/sec_algs.c |
1559 |
++++ b/drivers/crypto/hisilicon/sec/sec_algs.c |
1560 |
+@@ -732,6 +732,7 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, |
1561 |
+ int *splits_in_nents; |
1562 |
+ int *splits_out_nents = NULL; |
1563 |
+ struct sec_request_el *el, *temp; |
1564 |
++ bool split = skreq->src != skreq->dst; |
1565 |
+ |
1566 |
+ mutex_init(&sec_req->lock); |
1567 |
+ sec_req->req_base = &skreq->base; |
1568 |
+@@ -750,7 +751,7 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, |
1569 |
+ if (ret) |
1570 |
+ goto err_free_split_sizes; |
1571 |
+ |
1572 |
+- if (skreq->src != skreq->dst) { |
1573 |
++ if (split) { |
1574 |
+ sec_req->len_out = sg_nents(skreq->dst); |
1575 |
+ ret = sec_map_and_split_sg(skreq->dst, split_sizes, steps, |
1576 |
+ &splits_out, &splits_out_nents, |
1577 |
+@@ -785,8 +786,9 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, |
1578 |
+ split_sizes[i], |
1579 |
+ skreq->src != skreq->dst, |
1580 |
+ splits_in[i], splits_in_nents[i], |
1581 |
+- splits_out[i], |
1582 |
+- splits_out_nents[i], info); |
1583 |
++ split ? splits_out[i] : NULL, |
1584 |
++ split ? splits_out_nents[i] : 0, |
1585 |
++ info); |
1586 |
+ if (IS_ERR(el)) { |
1587 |
+ ret = PTR_ERR(el); |
1588 |
+ goto err_free_elements; |
1589 |
+@@ -806,13 +808,6 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, |
1590 |
+ * more refined but this is unlikely to happen so no need. |
1591 |
+ */ |
1592 |
+ |
1593 |
+- /* Cleanup - all elements in pointer arrays have been coppied */ |
1594 |
+- kfree(splits_in_nents); |
1595 |
+- kfree(splits_in); |
1596 |
+- kfree(splits_out_nents); |
1597 |
+- kfree(splits_out); |
1598 |
+- kfree(split_sizes); |
1599 |
+- |
1600 |
+ /* Grab a big lock for a long time to avoid concurrency issues */ |
1601 |
+ mutex_lock(&queue->queuelock); |
1602 |
+ |
1603 |
+@@ -827,13 +822,13 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, |
1604 |
+ (!queue->havesoftqueue || |
1605 |
+ kfifo_avail(&queue->softqueue) > steps)) || |
1606 |
+ !list_empty(&ctx->backlog)) { |
1607 |
++ ret = -EBUSY; |
1608 |
+ if ((skreq->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)) { |
1609 |
+ list_add_tail(&sec_req->backlog_head, &ctx->backlog); |
1610 |
+ mutex_unlock(&queue->queuelock); |
1611 |
+- return -EBUSY; |
1612 |
++ goto out; |
1613 |
+ } |
1614 |
+ |
1615 |
+- ret = -EBUSY; |
1616 |
+ mutex_unlock(&queue->queuelock); |
1617 |
+ goto err_free_elements; |
1618 |
+ } |
1619 |
+@@ -842,7 +837,15 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, |
1620 |
+ if (ret) |
1621 |
+ goto err_free_elements; |
1622 |
+ |
1623 |
+- return -EINPROGRESS; |
1624 |
++ ret = -EINPROGRESS; |
1625 |
++out: |
1626 |
++ /* Cleanup - all elements in pointer arrays have been copied */ |
1627 |
++ kfree(splits_in_nents); |
1628 |
++ kfree(splits_in); |
1629 |
++ kfree(splits_out_nents); |
1630 |
++ kfree(splits_out); |
1631 |
++ kfree(split_sizes); |
1632 |
++ return ret; |
1633 |
+ |
1634 |
+ err_free_elements: |
1635 |
+ list_for_each_entry_safe(el, temp, &sec_req->elements, head) { |
1636 |
+@@ -854,7 +857,7 @@ err_free_elements: |
1637 |
+ crypto_skcipher_ivsize(atfm), |
1638 |
+ DMA_BIDIRECTIONAL); |
1639 |
+ err_unmap_out_sg: |
1640 |
+- if (skreq->src != skreq->dst) |
1641 |
++ if (split) |
1642 |
+ sec_unmap_sg_on_err(skreq->dst, steps, splits_out, |
1643 |
+ splits_out_nents, sec_req->len_out, |
1644 |
+ info->dev); |
1645 |
+diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c |
1646 |
+index 8830fa601e45..0c0d2312f4a8 100644 |
1647 |
+--- a/drivers/firmware/efi/libstub/fdt.c |
1648 |
++++ b/drivers/firmware/efi/libstub/fdt.c |
1649 |
+@@ -158,6 +158,10 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, |
1650 |
+ return efi_status; |
1651 |
+ } |
1652 |
+ } |
1653 |
++ |
1654 |
++ /* shrink the FDT back to its minimum size */ |
1655 |
++ fdt_pack(fdt); |
1656 |
++ |
1657 |
+ return EFI_SUCCESS; |
1658 |
+ |
1659 |
+ fdt_set_fail: |
1660 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c |
1661 |
+index 353993218f21..f008804f0b97 100644 |
1662 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c |
1663 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c |
1664 |
+@@ -358,7 +358,9 @@ out: |
1665 |
+ * |
1666 |
+ * Checks the acpi event and if it matches an atif event, |
1667 |
+ * handles it. |
1668 |
+- * Returns NOTIFY code |
1669 |
++ * |
1670 |
++ * Returns: |
1671 |
++ * NOTIFY_BAD or NOTIFY_DONE, depending on the event. |
1672 |
+ */ |
1673 |
+ static int amdgpu_atif_handler(struct amdgpu_device *adev, |
1674 |
+ struct acpi_bus_event *event) |
1675 |
+@@ -372,11 +374,16 @@ static int amdgpu_atif_handler(struct amdgpu_device *adev, |
1676 |
+ if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0) |
1677 |
+ return NOTIFY_DONE; |
1678 |
+ |
1679 |
++ /* Is this actually our event? */ |
1680 |
+ if (!atif || |
1681 |
+ !atif->notification_cfg.enabled || |
1682 |
+- event->type != atif->notification_cfg.command_code) |
1683 |
+- /* Not our event */ |
1684 |
+- return NOTIFY_DONE; |
1685 |
++ event->type != atif->notification_cfg.command_code) { |
1686 |
++ /* These events will generate keypresses otherwise */ |
1687 |
++ if (event->type == ACPI_VIDEO_NOTIFY_PROBE) |
1688 |
++ return NOTIFY_BAD; |
1689 |
++ else |
1690 |
++ return NOTIFY_DONE; |
1691 |
++ } |
1692 |
+ |
1693 |
+ if (atif->functions.sbios_requests) { |
1694 |
+ struct atif_sbios_requests req; |
1695 |
+@@ -385,7 +392,7 @@ static int amdgpu_atif_handler(struct amdgpu_device *adev, |
1696 |
+ count = amdgpu_atif_get_sbios_requests(atif, &req); |
1697 |
+ |
1698 |
+ if (count <= 0) |
1699 |
+- return NOTIFY_DONE; |
1700 |
++ return NOTIFY_BAD; |
1701 |
+ |
1702 |
+ DRM_DEBUG_DRIVER("ATIF: %d pending SBIOS requests\n", count); |
1703 |
+ |
1704 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c |
1705 |
+index d472a2c8399f..b80243d3972e 100644 |
1706 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c |
1707 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c |
1708 |
+@@ -67,7 +67,8 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp, |
1709 |
+ unsigned i; |
1710 |
+ int r; |
1711 |
+ |
1712 |
+- if (num_entries > SIZE_MAX / sizeof(struct amdgpu_bo_list_entry)) |
1713 |
++ if (num_entries > (SIZE_MAX - sizeof(struct amdgpu_bo_list)) |
1714 |
++ / sizeof(struct amdgpu_bo_list_entry)) |
1715 |
+ return -EINVAL; |
1716 |
+ |
1717 |
+ size = sizeof(struct amdgpu_bo_list); |
1718 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c |
1719 |
+index 3a072a7a39f0..df9b173c3d0b 100644 |
1720 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c |
1721 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c |
1722 |
+@@ -574,7 +574,7 @@ void amdgpu_vmid_mgr_init(struct amdgpu_device *adev) |
1723 |
+ /* skip over VMID 0, since it is the system VM */ |
1724 |
+ for (j = 1; j < id_mgr->num_ids; ++j) { |
1725 |
+ amdgpu_vmid_reset(adev, i, j); |
1726 |
+- amdgpu_sync_create(&id_mgr->ids[i].active); |
1727 |
++ amdgpu_sync_create(&id_mgr->ids[j].active); |
1728 |
+ list_add_tail(&id_mgr->ids[j].list, &id_mgr->ids_lru); |
1729 |
+ } |
1730 |
+ } |
1731 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c |
1732 |
+index 391e2f7c03aa..f823d4baf044 100644 |
1733 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c |
1734 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c |
1735 |
+@@ -66,6 +66,7 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, |
1736 |
+ amdgpu_sync_create(&(*job)->sync); |
1737 |
+ amdgpu_sync_create(&(*job)->sched_sync); |
1738 |
+ (*job)->vram_lost_counter = atomic_read(&adev->vram_lost_counter); |
1739 |
++ (*job)->vm_pd_addr = AMDGPU_BO_INVALID_OFFSET; |
1740 |
+ |
1741 |
+ return 0; |
1742 |
+ } |
1743 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c |
1744 |
+index f55f72a37ca8..c29d519fa381 100644 |
1745 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c |
1746 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c |
1747 |
+@@ -277,6 +277,7 @@ amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type) |
1748 |
+ case CHIP_PITCAIRN: |
1749 |
+ case CHIP_VERDE: |
1750 |
+ case CHIP_OLAND: |
1751 |
++ case CHIP_HAINAN: |
1752 |
+ return AMDGPU_FW_LOAD_DIRECT; |
1753 |
+ #endif |
1754 |
+ #ifdef CONFIG_DRM_AMDGPU_CIK |
1755 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c |
1756 |
+index b17771dd5ce7..6a84526e20e0 100644 |
1757 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c |
1758 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c |
1759 |
+@@ -714,7 +714,8 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_ |
1760 |
+ } |
1761 |
+ |
1762 |
+ gds_switch_needed &= !!ring->funcs->emit_gds_switch; |
1763 |
+- vm_flush_needed &= !!ring->funcs->emit_vm_flush; |
1764 |
++ vm_flush_needed &= !!ring->funcs->emit_vm_flush && |
1765 |
++ job->vm_pd_addr != AMDGPU_BO_INVALID_OFFSET; |
1766 |
+ pasid_mapping_needed &= adev->gmc.gmc_funcs->emit_pasid_mapping && |
1767 |
+ ring->funcs->emit_wreg; |
1768 |
+ |
1769 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c |
1770 |
+index 6ae050dc3220..9045e6fa0780 100644 |
1771 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc.c |
1772 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc.c |
1773 |
+@@ -1120,9 +1120,6 @@ static enum surface_update_type get_plane_info_update_type(const struct dc_surfa |
1774 |
+ */ |
1775 |
+ update_flags->bits.bpp_change = 1; |
1776 |
+ |
1777 |
+- if (u->gamma && dce_use_lut(u->plane_info->format)) |
1778 |
+- update_flags->bits.gamma_change = 1; |
1779 |
+- |
1780 |
+ if (memcmp(&u->plane_info->tiling_info, &u->surface->tiling_info, |
1781 |
+ sizeof(union dc_tiling_info)) != 0) { |
1782 |
+ update_flags->bits.swizzle_change = 1; |
1783 |
+@@ -1139,7 +1136,6 @@ static enum surface_update_type get_plane_info_update_type(const struct dc_surfa |
1784 |
+ if (update_flags->bits.rotation_change |
1785 |
+ || update_flags->bits.stereo_format_change |
1786 |
+ || update_flags->bits.pixel_format_change |
1787 |
+- || update_flags->bits.gamma_change |
1788 |
+ || update_flags->bits.bpp_change |
1789 |
+ || update_flags->bits.bandwidth_change |
1790 |
+ || update_flags->bits.output_tf_change) |
1791 |
+@@ -1229,13 +1225,26 @@ static enum surface_update_type det_surface_update(const struct dc *dc, |
1792 |
+ if (u->coeff_reduction_factor) |
1793 |
+ update_flags->bits.coeff_reduction_change = 1; |
1794 |
+ |
1795 |
++ if (u->gamma) { |
1796 |
++ enum surface_pixel_format format = SURFACE_PIXEL_FORMAT_GRPH_BEGIN; |
1797 |
++ |
1798 |
++ if (u->plane_info) |
1799 |
++ format = u->plane_info->format; |
1800 |
++ else if (u->surface) |
1801 |
++ format = u->surface->format; |
1802 |
++ |
1803 |
++ if (dce_use_lut(format)) |
1804 |
++ update_flags->bits.gamma_change = 1; |
1805 |
++ } |
1806 |
++ |
1807 |
+ if (update_flags->bits.in_transfer_func_change) { |
1808 |
+ type = UPDATE_TYPE_MED; |
1809 |
+ elevate_update_type(&overall_type, type); |
1810 |
+ } |
1811 |
+ |
1812 |
+ if (update_flags->bits.input_csc_change |
1813 |
+- || update_flags->bits.coeff_reduction_change) { |
1814 |
++ || update_flags->bits.coeff_reduction_change |
1815 |
++ || update_flags->bits.gamma_change) { |
1816 |
+ type = UPDATE_TYPE_FULL; |
1817 |
+ elevate_update_type(&overall_type, type); |
1818 |
+ } |
1819 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c |
1820 |
+index fb1f373d08a1..e798241fae37 100644 |
1821 |
+--- a/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c |
1822 |
++++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c |
1823 |
+@@ -466,6 +466,9 @@ static void dce12_update_clocks(struct dccg *dccg, |
1824 |
+ { |
1825 |
+ struct dm_pp_clock_for_voltage_req clock_voltage_req = {0}; |
1826 |
+ |
1827 |
++ /* TODO: Investigate why this is needed to fix display corruption. */ |
1828 |
++ new_clocks->dispclk_khz = new_clocks->dispclk_khz * 115 / 100; |
1829 |
++ |
1830 |
+ if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, dccg->clks.dispclk_khz)) { |
1831 |
+ clock_voltage_req.clk_type = DM_PP_CLOCK_TYPE_DISPLAY_CLK; |
1832 |
+ clock_voltage_req.clocks_in_khz = new_clocks->dispclk_khz; |
1833 |
+diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
1834 |
+index bf29733958c3..962900932bee 100644 |
1835 |
+--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
1836 |
++++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
1837 |
+@@ -1069,10 +1069,14 @@ static void build_evenly_distributed_points( |
1838 |
+ struct dividers dividers) |
1839 |
+ { |
1840 |
+ struct gamma_pixel *p = points; |
1841 |
+- struct gamma_pixel *p_last = p + numberof_points - 1; |
1842 |
++ struct gamma_pixel *p_last; |
1843 |
+ |
1844 |
+ uint32_t i = 0; |
1845 |
+ |
1846 |
++ // This function should not gets called with 0 as a parameter |
1847 |
++ ASSERT(numberof_points > 0); |
1848 |
++ p_last = p + numberof_points - 1; |
1849 |
++ |
1850 |
+ do { |
1851 |
+ struct fixed31_32 value = dc_fixpt_from_fraction(i, |
1852 |
+ numberof_points - 1); |
1853 |
+@@ -1083,7 +1087,7 @@ static void build_evenly_distributed_points( |
1854 |
+ |
1855 |
+ ++p; |
1856 |
+ ++i; |
1857 |
+- } while (i != numberof_points); |
1858 |
++ } while (i < numberof_points); |
1859 |
+ |
1860 |
+ p->r = dc_fixpt_div(p_last->r, dividers.divider1); |
1861 |
+ p->g = dc_fixpt_div(p_last->g, dividers.divider1); |
1862 |
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c |
1863 |
+index 0adfc5392cd3..c9a15baf2c10 100644 |
1864 |
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c |
1865 |
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c |
1866 |
+@@ -1222,14 +1222,17 @@ static int smu8_dpm_force_dpm_level(struct pp_hwmgr *hwmgr, |
1867 |
+ |
1868 |
+ static int smu8_dpm_powerdown_uvd(struct pp_hwmgr *hwmgr) |
1869 |
+ { |
1870 |
+- if (PP_CAP(PHM_PlatformCaps_UVDPowerGating)) |
1871 |
++ if (PP_CAP(PHM_PlatformCaps_UVDPowerGating)) { |
1872 |
++ smu8_nbdpm_pstate_enable_disable(hwmgr, true, true); |
1873 |
+ return smum_send_msg_to_smc(hwmgr, PPSMC_MSG_UVDPowerOFF); |
1874 |
++ } |
1875 |
+ return 0; |
1876 |
+ } |
1877 |
+ |
1878 |
+ static int smu8_dpm_powerup_uvd(struct pp_hwmgr *hwmgr) |
1879 |
+ { |
1880 |
+ if (PP_CAP(PHM_PlatformCaps_UVDPowerGating)) { |
1881 |
++ smu8_nbdpm_pstate_enable_disable(hwmgr, false, true); |
1882 |
+ return smum_send_msg_to_smc_with_parameter( |
1883 |
+ hwmgr, |
1884 |
+ PPSMC_MSG_UVDPowerON, |
1885 |
+diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
1886 |
+index fbe3ef4ee45c..924788772b07 100644 |
1887 |
+--- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
1888 |
++++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
1889 |
+@@ -2268,11 +2268,13 @@ static uint32_t ci_get_offsetof(uint32_t type, uint32_t member) |
1890 |
+ case DRAM_LOG_BUFF_SIZE: |
1891 |
+ return offsetof(SMU7_SoftRegisters, DRAM_LOG_BUFF_SIZE); |
1892 |
+ } |
1893 |
++ break; |
1894 |
+ case SMU_Discrete_DpmTable: |
1895 |
+ switch (member) { |
1896 |
+ case LowSclkInterruptThreshold: |
1897 |
+ return offsetof(SMU7_Discrete_DpmTable, LowSclkInterruptT); |
1898 |
+ } |
1899 |
++ break; |
1900 |
+ } |
1901 |
+ pr_debug("can't get the offset of type %x member %x\n", type, member); |
1902 |
+ return 0; |
1903 |
+diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c |
1904 |
+index 18048f8e2f13..40df5c2706cc 100644 |
1905 |
+--- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c |
1906 |
++++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c |
1907 |
+@@ -2330,6 +2330,7 @@ static uint32_t fiji_get_offsetof(uint32_t type, uint32_t member) |
1908 |
+ case DRAM_LOG_BUFF_SIZE: |
1909 |
+ return offsetof(SMU73_SoftRegisters, DRAM_LOG_BUFF_SIZE); |
1910 |
+ } |
1911 |
++ break; |
1912 |
+ case SMU_Discrete_DpmTable: |
1913 |
+ switch (member) { |
1914 |
+ case UvdBootLevel: |
1915 |
+@@ -2339,6 +2340,7 @@ static uint32_t fiji_get_offsetof(uint32_t type, uint32_t member) |
1916 |
+ case LowSclkInterruptThreshold: |
1917 |
+ return offsetof(SMU73_Discrete_DpmTable, LowSclkInterruptThreshold); |
1918 |
+ } |
1919 |
++ break; |
1920 |
+ } |
1921 |
+ pr_warn("can't get the offset of type %x member %x\n", type, member); |
1922 |
+ return 0; |
1923 |
+diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c |
1924 |
+index 9299b93aa09a..302ca7745723 100644 |
1925 |
+--- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c |
1926 |
++++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c |
1927 |
+@@ -2236,11 +2236,13 @@ static uint32_t iceland_get_offsetof(uint32_t type, uint32_t member) |
1928 |
+ case DRAM_LOG_BUFF_SIZE: |
1929 |
+ return offsetof(SMU71_SoftRegisters, DRAM_LOG_BUFF_SIZE); |
1930 |
+ } |
1931 |
++ break; |
1932 |
+ case SMU_Discrete_DpmTable: |
1933 |
+ switch (member) { |
1934 |
+ case LowSclkInterruptThreshold: |
1935 |
+ return offsetof(SMU71_Discrete_DpmTable, LowSclkInterruptThreshold); |
1936 |
+ } |
1937 |
++ break; |
1938 |
+ } |
1939 |
+ pr_warn("can't get the offset of type %x member %x\n", type, member); |
1940 |
+ return 0; |
1941 |
+diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c |
1942 |
+index 7dabc6c456e1..697c8d92bd53 100644 |
1943 |
+--- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c |
1944 |
++++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c |
1945 |
+@@ -2618,6 +2618,7 @@ static uint32_t tonga_get_offsetof(uint32_t type, uint32_t member) |
1946 |
+ case DRAM_LOG_BUFF_SIZE: |
1947 |
+ return offsetof(SMU72_SoftRegisters, DRAM_LOG_BUFF_SIZE); |
1948 |
+ } |
1949 |
++ break; |
1950 |
+ case SMU_Discrete_DpmTable: |
1951 |
+ switch (member) { |
1952 |
+ case UvdBootLevel: |
1953 |
+@@ -2627,6 +2628,7 @@ static uint32_t tonga_get_offsetof(uint32_t type, uint32_t member) |
1954 |
+ case LowSclkInterruptThreshold: |
1955 |
+ return offsetof(SMU72_Discrete_DpmTable, LowSclkInterruptThreshold); |
1956 |
+ } |
1957 |
++ break; |
1958 |
+ } |
1959 |
+ pr_warn("can't get the offset of type %x member %x\n", type, member); |
1960 |
+ return 0; |
1961 |
+diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c |
1962 |
+index 57420d7caa4e..59113fdd1c1c 100644 |
1963 |
+--- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c |
1964 |
++++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c |
1965 |
+@@ -2184,6 +2184,7 @@ static uint32_t vegam_get_offsetof(uint32_t type, uint32_t member) |
1966 |
+ case DRAM_LOG_BUFF_SIZE: |
1967 |
+ return offsetof(SMU75_SoftRegisters, DRAM_LOG_BUFF_SIZE); |
1968 |
+ } |
1969 |
++ break; |
1970 |
+ case SMU_Discrete_DpmTable: |
1971 |
+ switch (member) { |
1972 |
+ case UvdBootLevel: |
1973 |
+@@ -2193,6 +2194,7 @@ static uint32_t vegam_get_offsetof(uint32_t type, uint32_t member) |
1974 |
+ case LowSclkInterruptThreshold: |
1975 |
+ return offsetof(SMU75_Discrete_DpmTable, LowSclkInterruptThreshold); |
1976 |
+ } |
1977 |
++ break; |
1978 |
+ } |
1979 |
+ pr_warn("can't get the offset of type %x member %x\n", type, member); |
1980 |
+ return 0; |
1981 |
+diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c |
1982 |
+index 7780567aa669..d708472d93c4 100644 |
1983 |
+--- a/drivers/gpu/drm/drm_dp_mst_topology.c |
1984 |
++++ b/drivers/gpu/drm/drm_dp_mst_topology.c |
1985 |
+@@ -1274,6 +1274,9 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_ |
1986 |
+ mutex_lock(&mgr->lock); |
1987 |
+ mstb = mgr->mst_primary; |
1988 |
+ |
1989 |
++ if (!mstb) |
1990 |
++ goto out; |
1991 |
++ |
1992 |
+ for (i = 0; i < lct - 1; i++) { |
1993 |
+ int shift = (i % 2) ? 0 : 4; |
1994 |
+ int port_num = (rad[i / 2] >> shift) & 0xf; |
1995 |
+diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c |
1996 |
+index fe9c6c731e87..ee4a5e1221f1 100644 |
1997 |
+--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c |
1998 |
++++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c |
1999 |
+@@ -30,6 +30,12 @@ struct drm_dmi_panel_orientation_data { |
2000 |
+ int orientation; |
2001 |
+ }; |
2002 |
+ |
2003 |
++static const struct drm_dmi_panel_orientation_data acer_s1003 = { |
2004 |
++ .width = 800, |
2005 |
++ .height = 1280, |
2006 |
++ .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, |
2007 |
++}; |
2008 |
++ |
2009 |
+ static const struct drm_dmi_panel_orientation_data asus_t100ha = { |
2010 |
+ .width = 800, |
2011 |
+ .height = 1280, |
2012 |
+@@ -67,7 +73,13 @@ static const struct drm_dmi_panel_orientation_data lcd800x1280_rightside_up = { |
2013 |
+ }; |
2014 |
+ |
2015 |
+ static const struct dmi_system_id orientation_data[] = { |
2016 |
+- { /* Asus T100HA */ |
2017 |
++ { /* Acer One 10 (S1003) */ |
2018 |
++ .matches = { |
2019 |
++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"), |
2020 |
++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"), |
2021 |
++ }, |
2022 |
++ .driver_data = (void *)&acer_s1003, |
2023 |
++ }, { /* Asus T100HA */ |
2024 |
+ .matches = { |
2025 |
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
2026 |
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100HAN"), |
2027 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c b/drivers/gpu/drm/etnaviv/etnaviv_sched.c |
2028 |
+index 69e9b431bf1f..e5a9fae31ab7 100644 |
2029 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c |
2030 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c |
2031 |
+@@ -93,7 +93,7 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job) |
2032 |
+ * If the GPU managed to complete this jobs fence, the timout is |
2033 |
+ * spurious. Bail out. |
2034 |
+ */ |
2035 |
+- if (fence_completed(gpu, submit->out_fence->seqno)) |
2036 |
++ if (dma_fence_is_signaled(submit->out_fence)) |
2037 |
+ return; |
2038 |
+ |
2039 |
+ /* |
2040 |
+diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c |
2041 |
+index b92595c477ef..8bd29075ae4e 100644 |
2042 |
+--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c |
2043 |
++++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c |
2044 |
+@@ -122,6 +122,7 @@ static int hibmc_drm_fb_create(struct drm_fb_helper *helper, |
2045 |
+ hi_fbdev->fb = hibmc_framebuffer_init(priv->dev, &mode_cmd, gobj); |
2046 |
+ if (IS_ERR(hi_fbdev->fb)) { |
2047 |
+ ret = PTR_ERR(hi_fbdev->fb); |
2048 |
++ hi_fbdev->fb = NULL; |
2049 |
+ DRM_ERROR("failed to initialize framebuffer: %d\n", ret); |
2050 |
+ goto out_release_fbi; |
2051 |
+ } |
2052 |
+diff --git a/drivers/gpu/drm/i915/gvt/gtt.h b/drivers/gpu/drm/i915/gvt/gtt.h |
2053 |
+index 7a9b36176efb..bfb6f652b09f 100644 |
2054 |
+--- a/drivers/gpu/drm/i915/gvt/gtt.h |
2055 |
++++ b/drivers/gpu/drm/i915/gvt/gtt.h |
2056 |
+@@ -35,7 +35,6 @@ |
2057 |
+ #define _GVT_GTT_H_ |
2058 |
+ |
2059 |
+ #define I915_GTT_PAGE_SHIFT 12 |
2060 |
+-#define I915_GTT_PAGE_MASK (~(I915_GTT_PAGE_SIZE - 1)) |
2061 |
+ |
2062 |
+ struct intel_vgpu_mm; |
2063 |
+ |
2064 |
+diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c |
2065 |
+index fcc73a6ab503..47cc932e23a7 100644 |
2066 |
+--- a/drivers/gpu/drm/i915/i915_gem.c |
2067 |
++++ b/drivers/gpu/drm/i915/i915_gem.c |
2068 |
+@@ -1122,11 +1122,7 @@ i915_gem_shmem_pread(struct drm_i915_gem_object *obj, |
2069 |
+ offset = offset_in_page(args->offset); |
2070 |
+ for (idx = args->offset >> PAGE_SHIFT; remain; idx++) { |
2071 |
+ struct page *page = i915_gem_object_get_page(obj, idx); |
2072 |
+- int length; |
2073 |
+- |
2074 |
+- length = remain; |
2075 |
+- if (offset + length > PAGE_SIZE) |
2076 |
+- length = PAGE_SIZE - offset; |
2077 |
++ unsigned int length = min_t(u64, remain, PAGE_SIZE - offset); |
2078 |
+ |
2079 |
+ ret = shmem_pread(page, offset, length, user_data, |
2080 |
+ page_to_phys(page) & obj_do_bit17_swizzling, |
2081 |
+@@ -1570,11 +1566,7 @@ i915_gem_shmem_pwrite(struct drm_i915_gem_object *obj, |
2082 |
+ offset = offset_in_page(args->offset); |
2083 |
+ for (idx = args->offset >> PAGE_SHIFT; remain; idx++) { |
2084 |
+ struct page *page = i915_gem_object_get_page(obj, idx); |
2085 |
+- int length; |
2086 |
+- |
2087 |
+- length = remain; |
2088 |
+- if (offset + length > PAGE_SIZE) |
2089 |
+- length = PAGE_SIZE - offset; |
2090 |
++ unsigned int length = min_t(u64, remain, PAGE_SIZE - offset); |
2091 |
+ |
2092 |
+ ret = shmem_pwrite(page, offset, length, user_data, |
2093 |
+ page_to_phys(page) & obj_do_bit17_swizzling, |
2094 |
+diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
2095 |
+index 3f0c612d42e7..679bbae52945 100644 |
2096 |
+--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
2097 |
++++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
2098 |
+@@ -458,7 +458,7 @@ eb_validate_vma(struct i915_execbuffer *eb, |
2099 |
+ * any non-page-aligned or non-canonical addresses. |
2100 |
+ */ |
2101 |
+ if (unlikely(entry->flags & EXEC_OBJECT_PINNED && |
2102 |
+- entry->offset != gen8_canonical_addr(entry->offset & PAGE_MASK))) |
2103 |
++ entry->offset != gen8_canonical_addr(entry->offset & I915_GTT_PAGE_MASK))) |
2104 |
+ return -EINVAL; |
2105 |
+ |
2106 |
+ /* pad_to_size was once a reserved field, so sanitize it */ |
2107 |
+diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c |
2108 |
+index f00c7fbef79e..294a143b85f5 100644 |
2109 |
+--- a/drivers/gpu/drm/i915/i915_gem_gtt.c |
2110 |
++++ b/drivers/gpu/drm/i915/i915_gem_gtt.c |
2111 |
+@@ -1768,7 +1768,7 @@ static void gen6_dump_ppgtt(struct i915_hw_ppgtt *base, struct seq_file *m) |
2112 |
+ if (i == 4) |
2113 |
+ continue; |
2114 |
+ |
2115 |
+- seq_printf(m, "\t\t(%03d, %04d) %08lx: ", |
2116 |
++ seq_printf(m, "\t\t(%03d, %04d) %08llx: ", |
2117 |
+ pde, pte, |
2118 |
+ (pde * GEN6_PTES + pte) * PAGE_SIZE); |
2119 |
+ for (i = 0; i < 4; i++) { |
2120 |
+diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h |
2121 |
+index 2a116a91420b..680e0dc5db4b 100644 |
2122 |
+--- a/drivers/gpu/drm/i915/i915_gem_gtt.h |
2123 |
++++ b/drivers/gpu/drm/i915/i915_gem_gtt.h |
2124 |
+@@ -42,13 +42,15 @@ |
2125 |
+ #include "i915_selftest.h" |
2126 |
+ #include "i915_timeline.h" |
2127 |
+ |
2128 |
+-#define I915_GTT_PAGE_SIZE_4K BIT(12) |
2129 |
+-#define I915_GTT_PAGE_SIZE_64K BIT(16) |
2130 |
+-#define I915_GTT_PAGE_SIZE_2M BIT(21) |
2131 |
++#define I915_GTT_PAGE_SIZE_4K BIT_ULL(12) |
2132 |
++#define I915_GTT_PAGE_SIZE_64K BIT_ULL(16) |
2133 |
++#define I915_GTT_PAGE_SIZE_2M BIT_ULL(21) |
2134 |
+ |
2135 |
+ #define I915_GTT_PAGE_SIZE I915_GTT_PAGE_SIZE_4K |
2136 |
+ #define I915_GTT_MAX_PAGE_SIZE I915_GTT_PAGE_SIZE_2M |
2137 |
+ |
2138 |
++#define I915_GTT_PAGE_MASK -I915_GTT_PAGE_SIZE |
2139 |
++ |
2140 |
+ #define I915_GTT_MIN_ALIGNMENT I915_GTT_PAGE_SIZE |
2141 |
+ |
2142 |
+ #define I915_FENCE_REG_NONE -1 |
2143 |
+@@ -662,20 +664,20 @@ int i915_gem_gtt_insert(struct i915_address_space *vm, |
2144 |
+ u64 start, u64 end, unsigned int flags); |
2145 |
+ |
2146 |
+ /* Flags used by pin/bind&friends. */ |
2147 |
+-#define PIN_NONBLOCK BIT(0) |
2148 |
+-#define PIN_MAPPABLE BIT(1) |
2149 |
+-#define PIN_ZONE_4G BIT(2) |
2150 |
+-#define PIN_NONFAULT BIT(3) |
2151 |
+-#define PIN_NOEVICT BIT(4) |
2152 |
+- |
2153 |
+-#define PIN_MBZ BIT(5) /* I915_VMA_PIN_OVERFLOW */ |
2154 |
+-#define PIN_GLOBAL BIT(6) /* I915_VMA_GLOBAL_BIND */ |
2155 |
+-#define PIN_USER BIT(7) /* I915_VMA_LOCAL_BIND */ |
2156 |
+-#define PIN_UPDATE BIT(8) |
2157 |
+- |
2158 |
+-#define PIN_HIGH BIT(9) |
2159 |
+-#define PIN_OFFSET_BIAS BIT(10) |
2160 |
+-#define PIN_OFFSET_FIXED BIT(11) |
2161 |
++#define PIN_NONBLOCK BIT_ULL(0) |
2162 |
++#define PIN_MAPPABLE BIT_ULL(1) |
2163 |
++#define PIN_ZONE_4G BIT_ULL(2) |
2164 |
++#define PIN_NONFAULT BIT_ULL(3) |
2165 |
++#define PIN_NOEVICT BIT_ULL(4) |
2166 |
++ |
2167 |
++#define PIN_MBZ BIT_ULL(5) /* I915_VMA_PIN_OVERFLOW */ |
2168 |
++#define PIN_GLOBAL BIT_ULL(6) /* I915_VMA_GLOBAL_BIND */ |
2169 |
++#define PIN_USER BIT_ULL(7) /* I915_VMA_LOCAL_BIND */ |
2170 |
++#define PIN_UPDATE BIT_ULL(8) |
2171 |
++ |
2172 |
++#define PIN_HIGH BIT_ULL(9) |
2173 |
++#define PIN_OFFSET_BIAS BIT_ULL(10) |
2174 |
++#define PIN_OFFSET_FIXED BIT_ULL(11) |
2175 |
+ #define PIN_OFFSET_MASK (-I915_GTT_PAGE_SIZE) |
2176 |
+ |
2177 |
+ #endif |
2178 |
+diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h |
2179 |
+index 9e63cd47b60f..5b544cb38148 100644 |
2180 |
+--- a/drivers/gpu/drm/i915/i915_reg.h |
2181 |
++++ b/drivers/gpu/drm/i915/i915_reg.h |
2182 |
+@@ -2097,8 +2097,12 @@ enum i915_power_well_id { |
2183 |
+ |
2184 |
+ /* ICL PHY DFLEX registers */ |
2185 |
+ #define PORT_TX_DFLEXDPMLE1 _MMIO(0x1638C0) |
2186 |
+-#define DFLEXDPMLE1_DPMLETC_MASK(n) (0xf << (4 * (n))) |
2187 |
+-#define DFLEXDPMLE1_DPMLETC(n, x) ((x) << (4 * (n))) |
2188 |
++#define DFLEXDPMLE1_DPMLETC_MASK(tc_port) (0xf << (4 * (tc_port))) |
2189 |
++#define DFLEXDPMLE1_DPMLETC_ML0(tc_port) (1 << (4 * (tc_port))) |
2190 |
++#define DFLEXDPMLE1_DPMLETC_ML1_0(tc_port) (3 << (4 * (tc_port))) |
2191 |
++#define DFLEXDPMLE1_DPMLETC_ML3(tc_port) (8 << (4 * (tc_port))) |
2192 |
++#define DFLEXDPMLE1_DPMLETC_ML3_2(tc_port) (12 << (4 * (tc_port))) |
2193 |
++#define DFLEXDPMLE1_DPMLETC_ML3_0(tc_port) (15 << (4 * (tc_port))) |
2194 |
+ |
2195 |
+ /* BXT PHY Ref registers */ |
2196 |
+ #define _PORT_REF_DW3_A 0x16218C |
2197 |
+diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c |
2198 |
+index 769f3f586661..ee3ca2de983b 100644 |
2199 |
+--- a/drivers/gpu/drm/i915/intel_audio.c |
2200 |
++++ b/drivers/gpu/drm/i915/intel_audio.c |
2201 |
+@@ -144,6 +144,9 @@ static const struct { |
2202 |
+ /* HDMI N/CTS table */ |
2203 |
+ #define TMDS_297M 297000 |
2204 |
+ #define TMDS_296M 296703 |
2205 |
++#define TMDS_594M 594000 |
2206 |
++#define TMDS_593M 593407 |
2207 |
++ |
2208 |
+ static const struct { |
2209 |
+ int sample_rate; |
2210 |
+ int clock; |
2211 |
+@@ -164,6 +167,20 @@ static const struct { |
2212 |
+ { 176400, TMDS_297M, 18816, 247500 }, |
2213 |
+ { 192000, TMDS_296M, 23296, 281250 }, |
2214 |
+ { 192000, TMDS_297M, 20480, 247500 }, |
2215 |
++ { 44100, TMDS_593M, 8918, 937500 }, |
2216 |
++ { 44100, TMDS_594M, 9408, 990000 }, |
2217 |
++ { 48000, TMDS_593M, 5824, 562500 }, |
2218 |
++ { 48000, TMDS_594M, 6144, 594000 }, |
2219 |
++ { 32000, TMDS_593M, 5824, 843750 }, |
2220 |
++ { 32000, TMDS_594M, 3072, 445500 }, |
2221 |
++ { 88200, TMDS_593M, 17836, 937500 }, |
2222 |
++ { 88200, TMDS_594M, 18816, 990000 }, |
2223 |
++ { 96000, TMDS_593M, 11648, 562500 }, |
2224 |
++ { 96000, TMDS_594M, 12288, 594000 }, |
2225 |
++ { 176400, TMDS_593M, 35672, 937500 }, |
2226 |
++ { 176400, TMDS_594M, 37632, 990000 }, |
2227 |
++ { 192000, TMDS_593M, 23296, 562500 }, |
2228 |
++ { 192000, TMDS_594M, 24576, 594000 }, |
2229 |
+ }; |
2230 |
+ |
2231 |
+ /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */ |
2232 |
+diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
2233 |
+index d2951096bca0..3bd44d042a1d 100644 |
2234 |
+--- a/drivers/gpu/drm/i915/intel_display.c |
2235 |
++++ b/drivers/gpu/drm/i915/intel_display.c |
2236 |
+@@ -2754,20 +2754,33 @@ intel_set_plane_visible(struct intel_crtc_state *crtc_state, |
2237 |
+ |
2238 |
+ plane_state->base.visible = visible; |
2239 |
+ |
2240 |
+- /* FIXME pre-g4x don't work like this */ |
2241 |
+- if (visible) { |
2242 |
++ if (visible) |
2243 |
+ crtc_state->base.plane_mask |= drm_plane_mask(&plane->base); |
2244 |
+- crtc_state->active_planes |= BIT(plane->id); |
2245 |
+- } else { |
2246 |
++ else |
2247 |
+ crtc_state->base.plane_mask &= ~drm_plane_mask(&plane->base); |
2248 |
+- crtc_state->active_planes &= ~BIT(plane->id); |
2249 |
+- } |
2250 |
+ |
2251 |
+ DRM_DEBUG_KMS("%s active planes 0x%x\n", |
2252 |
+ crtc_state->base.crtc->name, |
2253 |
+ crtc_state->active_planes); |
2254 |
+ } |
2255 |
+ |
2256 |
++static void fixup_active_planes(struct intel_crtc_state *crtc_state) |
2257 |
++{ |
2258 |
++ struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev); |
2259 |
++ struct drm_plane *plane; |
2260 |
++ |
2261 |
++ /* |
2262 |
++ * Active_planes aliases if multiple "primary" or cursor planes |
2263 |
++ * have been used on the same (or wrong) pipe. plane_mask uses |
2264 |
++ * unique ids, hence we can use that to reconstruct active_planes. |
2265 |
++ */ |
2266 |
++ crtc_state->active_planes = 0; |
2267 |
++ |
2268 |
++ drm_for_each_plane_mask(plane, &dev_priv->drm, |
2269 |
++ crtc_state->base.plane_mask) |
2270 |
++ crtc_state->active_planes |= BIT(to_intel_plane(plane)->id); |
2271 |
++} |
2272 |
++ |
2273 |
+ static void intel_plane_disable_noatomic(struct intel_crtc *crtc, |
2274 |
+ struct intel_plane *plane) |
2275 |
+ { |
2276 |
+@@ -2777,6 +2790,7 @@ static void intel_plane_disable_noatomic(struct intel_crtc *crtc, |
2277 |
+ to_intel_plane_state(plane->base.state); |
2278 |
+ |
2279 |
+ intel_set_plane_visible(crtc_state, plane_state, false); |
2280 |
++ fixup_active_planes(crtc_state); |
2281 |
+ |
2282 |
+ if (plane->id == PLANE_PRIMARY) |
2283 |
+ intel_pre_disable_primary_noatomic(&crtc->base); |
2284 |
+@@ -2795,7 +2809,6 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, |
2285 |
+ struct drm_i915_gem_object *obj; |
2286 |
+ struct drm_plane *primary = intel_crtc->base.primary; |
2287 |
+ struct drm_plane_state *plane_state = primary->state; |
2288 |
+- struct drm_crtc_state *crtc_state = intel_crtc->base.state; |
2289 |
+ struct intel_plane *intel_plane = to_intel_plane(primary); |
2290 |
+ struct intel_plane_state *intel_state = |
2291 |
+ to_intel_plane_state(plane_state); |
2292 |
+@@ -2885,10 +2898,6 @@ valid_fb: |
2293 |
+ plane_state->fb = fb; |
2294 |
+ plane_state->crtc = &intel_crtc->base; |
2295 |
+ |
2296 |
+- intel_set_plane_visible(to_intel_crtc_state(crtc_state), |
2297 |
+- to_intel_plane_state(plane_state), |
2298 |
+- true); |
2299 |
+- |
2300 |
+ atomic_or(to_intel_plane(primary)->frontbuffer_bit, |
2301 |
+ &obj->frontbuffer_bits); |
2302 |
+ } |
2303 |
+@@ -12630,17 +12639,12 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) |
2304 |
+ intel_check_cpu_fifo_underruns(dev_priv); |
2305 |
+ intel_check_pch_fifo_underruns(dev_priv); |
2306 |
+ |
2307 |
+- if (!new_crtc_state->active) { |
2308 |
+- /* |
2309 |
+- * Make sure we don't call initial_watermarks |
2310 |
+- * for ILK-style watermark updates. |
2311 |
+- * |
2312 |
+- * No clue what this is supposed to achieve. |
2313 |
+- */ |
2314 |
+- if (INTEL_GEN(dev_priv) >= 9) |
2315 |
+- dev_priv->display.initial_watermarks(intel_state, |
2316 |
+- to_intel_crtc_state(new_crtc_state)); |
2317 |
+- } |
2318 |
++ /* FIXME unify this for all platforms */ |
2319 |
++ if (!new_crtc_state->active && |
2320 |
++ !HAS_GMCH_DISPLAY(dev_priv) && |
2321 |
++ dev_priv->display.initial_watermarks) |
2322 |
++ dev_priv->display.initial_watermarks(intel_state, |
2323 |
++ to_intel_crtc_state(new_crtc_state)); |
2324 |
+ } |
2325 |
+ } |
2326 |
+ |
2327 |
+@@ -14573,7 +14577,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb, |
2328 |
+ fb->height < SKL_MIN_YUV_420_SRC_H || |
2329 |
+ (fb->width % 4) != 0 || (fb->height % 4) != 0)) { |
2330 |
+ DRM_DEBUG_KMS("src dimensions not correct for NV12\n"); |
2331 |
+- return -EINVAL; |
2332 |
++ goto err; |
2333 |
+ } |
2334 |
+ |
2335 |
+ for (i = 0; i < fb->format->num_planes; i++) { |
2336 |
+@@ -15365,17 +15369,6 @@ void i830_disable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe) |
2337 |
+ POSTING_READ(DPLL(pipe)); |
2338 |
+ } |
2339 |
+ |
2340 |
+-static bool intel_plane_mapping_ok(struct intel_crtc *crtc, |
2341 |
+- struct intel_plane *plane) |
2342 |
+-{ |
2343 |
+- enum pipe pipe; |
2344 |
+- |
2345 |
+- if (!plane->get_hw_state(plane, &pipe)) |
2346 |
+- return true; |
2347 |
+- |
2348 |
+- return pipe == crtc->pipe; |
2349 |
+-} |
2350 |
+- |
2351 |
+ static void |
2352 |
+ intel_sanitize_plane_mapping(struct drm_i915_private *dev_priv) |
2353 |
+ { |
2354 |
+@@ -15387,13 +15380,20 @@ intel_sanitize_plane_mapping(struct drm_i915_private *dev_priv) |
2355 |
+ for_each_intel_crtc(&dev_priv->drm, crtc) { |
2356 |
+ struct intel_plane *plane = |
2357 |
+ to_intel_plane(crtc->base.primary); |
2358 |
++ struct intel_crtc *plane_crtc; |
2359 |
++ enum pipe pipe; |
2360 |
+ |
2361 |
+- if (intel_plane_mapping_ok(crtc, plane)) |
2362 |
++ if (!plane->get_hw_state(plane, &pipe)) |
2363 |
++ continue; |
2364 |
++ |
2365 |
++ if (pipe == crtc->pipe) |
2366 |
+ continue; |
2367 |
+ |
2368 |
+ DRM_DEBUG_KMS("%s attached to the wrong pipe, disabling plane\n", |
2369 |
+ plane->base.name); |
2370 |
+- intel_plane_disable_noatomic(crtc, plane); |
2371 |
++ |
2372 |
++ plane_crtc = intel_get_crtc_for_pipe(dev_priv, pipe); |
2373 |
++ intel_plane_disable_noatomic(plane_crtc, plane); |
2374 |
+ } |
2375 |
+ } |
2376 |
+ |
2377 |
+@@ -15441,13 +15441,9 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc, |
2378 |
+ I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK); |
2379 |
+ } |
2380 |
+ |
2381 |
+- /* restore vblank interrupts to correct state */ |
2382 |
+- drm_crtc_vblank_reset(&crtc->base); |
2383 |
+ if (crtc->active) { |
2384 |
+ struct intel_plane *plane; |
2385 |
+ |
2386 |
+- drm_crtc_vblank_on(&crtc->base); |
2387 |
+- |
2388 |
+ /* Disable everything but the primary plane */ |
2389 |
+ for_each_intel_plane_on_crtc(dev, crtc, plane) { |
2390 |
+ const struct intel_plane_state *plane_state = |
2391 |
+@@ -15565,23 +15561,32 @@ void i915_redisable_vga(struct drm_i915_private *dev_priv) |
2392 |
+ } |
2393 |
+ |
2394 |
+ /* FIXME read out full plane state for all planes */ |
2395 |
+-static void readout_plane_state(struct intel_crtc *crtc) |
2396 |
++static void readout_plane_state(struct drm_i915_private *dev_priv) |
2397 |
+ { |
2398 |
+- struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); |
2399 |
+- struct intel_crtc_state *crtc_state = |
2400 |
+- to_intel_crtc_state(crtc->base.state); |
2401 |
+ struct intel_plane *plane; |
2402 |
++ struct intel_crtc *crtc; |
2403 |
+ |
2404 |
+- for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) { |
2405 |
++ for_each_intel_plane(&dev_priv->drm, plane) { |
2406 |
+ struct intel_plane_state *plane_state = |
2407 |
+ to_intel_plane_state(plane->base.state); |
2408 |
+- enum pipe pipe; |
2409 |
++ struct intel_crtc_state *crtc_state; |
2410 |
++ enum pipe pipe = PIPE_A; |
2411 |
+ bool visible; |
2412 |
+ |
2413 |
+ visible = plane->get_hw_state(plane, &pipe); |
2414 |
+ |
2415 |
++ crtc = intel_get_crtc_for_pipe(dev_priv, pipe); |
2416 |
++ crtc_state = to_intel_crtc_state(crtc->base.state); |
2417 |
++ |
2418 |
+ intel_set_plane_visible(crtc_state, plane_state, visible); |
2419 |
+ } |
2420 |
++ |
2421 |
++ for_each_intel_crtc(&dev_priv->drm, crtc) { |
2422 |
++ struct intel_crtc_state *crtc_state = |
2423 |
++ to_intel_crtc_state(crtc->base.state); |
2424 |
++ |
2425 |
++ fixup_active_planes(crtc_state); |
2426 |
++ } |
2427 |
+ } |
2428 |
+ |
2429 |
+ static void intel_modeset_readout_hw_state(struct drm_device *dev) |
2430 |
+@@ -15613,13 +15618,13 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) |
2431 |
+ if (crtc_state->base.active) |
2432 |
+ dev_priv->active_crtcs |= 1 << crtc->pipe; |
2433 |
+ |
2434 |
+- readout_plane_state(crtc); |
2435 |
+- |
2436 |
+ DRM_DEBUG_KMS("[CRTC:%d:%s] hw state readout: %s\n", |
2437 |
+ crtc->base.base.id, crtc->base.name, |
2438 |
+ enableddisabled(crtc_state->base.active)); |
2439 |
+ } |
2440 |
+ |
2441 |
++ readout_plane_state(dev_priv); |
2442 |
++ |
2443 |
+ for (i = 0; i < dev_priv->num_shared_dpll; i++) { |
2444 |
+ struct intel_shared_dpll *pll = &dev_priv->shared_dplls[i]; |
2445 |
+ |
2446 |
+@@ -15789,7 +15794,6 @@ intel_modeset_setup_hw_state(struct drm_device *dev, |
2447 |
+ struct drm_modeset_acquire_ctx *ctx) |
2448 |
+ { |
2449 |
+ struct drm_i915_private *dev_priv = to_i915(dev); |
2450 |
+- enum pipe pipe; |
2451 |
+ struct intel_crtc *crtc; |
2452 |
+ struct intel_encoder *encoder; |
2453 |
+ int i; |
2454 |
+@@ -15800,15 +15804,23 @@ intel_modeset_setup_hw_state(struct drm_device *dev, |
2455 |
+ /* HW state is read out, now we need to sanitize this mess. */ |
2456 |
+ get_encoder_power_domains(dev_priv); |
2457 |
+ |
2458 |
+- intel_sanitize_plane_mapping(dev_priv); |
2459 |
++ /* |
2460 |
++ * intel_sanitize_plane_mapping() may need to do vblank |
2461 |
++ * waits, so we need vblank interrupts restored beforehand. |
2462 |
++ */ |
2463 |
++ for_each_intel_crtc(&dev_priv->drm, crtc) { |
2464 |
++ drm_crtc_vblank_reset(&crtc->base); |
2465 |
+ |
2466 |
+- for_each_intel_encoder(dev, encoder) { |
2467 |
+- intel_sanitize_encoder(encoder); |
2468 |
++ if (crtc->active) |
2469 |
++ drm_crtc_vblank_on(&crtc->base); |
2470 |
+ } |
2471 |
+ |
2472 |
+- for_each_pipe(dev_priv, pipe) { |
2473 |
+- crtc = intel_get_crtc_for_pipe(dev_priv, pipe); |
2474 |
++ intel_sanitize_plane_mapping(dev_priv); |
2475 |
+ |
2476 |
++ for_each_intel_encoder(dev, encoder) |
2477 |
++ intel_sanitize_encoder(encoder); |
2478 |
++ |
2479 |
++ for_each_intel_crtc(&dev_priv->drm, crtc) { |
2480 |
+ intel_sanitize_crtc(crtc, ctx); |
2481 |
+ intel_dump_pipe_config(crtc, crtc->config, |
2482 |
+ "[setup_hw_state]"); |
2483 |
+diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c |
2484 |
+index 1193202766a2..f92079e19de8 100644 |
2485 |
+--- a/drivers/gpu/drm/i915/intel_dp.c |
2486 |
++++ b/drivers/gpu/drm/i915/intel_dp.c |
2487 |
+@@ -401,6 +401,22 @@ static bool intel_dp_link_params_valid(struct intel_dp *intel_dp, int link_rate, |
2488 |
+ return true; |
2489 |
+ } |
2490 |
+ |
2491 |
++static bool intel_dp_can_link_train_fallback_for_edp(struct intel_dp *intel_dp, |
2492 |
++ int link_rate, |
2493 |
++ uint8_t lane_count) |
2494 |
++{ |
2495 |
++ const struct drm_display_mode *fixed_mode = |
2496 |
++ intel_dp->attached_connector->panel.fixed_mode; |
2497 |
++ int mode_rate, max_rate; |
2498 |
++ |
2499 |
++ mode_rate = intel_dp_link_required(fixed_mode->clock, 18); |
2500 |
++ max_rate = intel_dp_max_data_rate(link_rate, lane_count); |
2501 |
++ if (mode_rate > max_rate) |
2502 |
++ return false; |
2503 |
++ |
2504 |
++ return true; |
2505 |
++} |
2506 |
++ |
2507 |
+ int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, |
2508 |
+ int link_rate, uint8_t lane_count) |
2509 |
+ { |
2510 |
+@@ -410,9 +426,23 @@ int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, |
2511 |
+ intel_dp->num_common_rates, |
2512 |
+ link_rate); |
2513 |
+ if (index > 0) { |
2514 |
++ if (intel_dp_is_edp(intel_dp) && |
2515 |
++ !intel_dp_can_link_train_fallback_for_edp(intel_dp, |
2516 |
++ intel_dp->common_rates[index - 1], |
2517 |
++ lane_count)) { |
2518 |
++ DRM_DEBUG_KMS("Retrying Link training for eDP with same parameters\n"); |
2519 |
++ return 0; |
2520 |
++ } |
2521 |
+ intel_dp->max_link_rate = intel_dp->common_rates[index - 1]; |
2522 |
+ intel_dp->max_link_lane_count = lane_count; |
2523 |
+ } else if (lane_count > 1) { |
2524 |
++ if (intel_dp_is_edp(intel_dp) && |
2525 |
++ !intel_dp_can_link_train_fallback_for_edp(intel_dp, |
2526 |
++ intel_dp_max_common_rate(intel_dp), |
2527 |
++ lane_count >> 1)) { |
2528 |
++ DRM_DEBUG_KMS("Retrying Link training for eDP with same parameters\n"); |
2529 |
++ return 0; |
2530 |
++ } |
2531 |
+ intel_dp->max_link_rate = intel_dp_max_common_rate(intel_dp); |
2532 |
+ intel_dp->max_link_lane_count = lane_count >> 1; |
2533 |
+ } else { |
2534 |
+@@ -4709,19 +4739,13 @@ intel_dp_long_pulse(struct intel_connector *connector, |
2535 |
+ */ |
2536 |
+ status = connector_status_disconnected; |
2537 |
+ goto out; |
2538 |
+- } else { |
2539 |
+- /* |
2540 |
+- * If display is now connected check links status, |
2541 |
+- * there has been known issues of link loss triggering |
2542 |
+- * long pulse. |
2543 |
+- * |
2544 |
+- * Some sinks (eg. ASUS PB287Q) seem to perform some |
2545 |
+- * weird HPD ping pong during modesets. So we can apparently |
2546 |
+- * end up with HPD going low during a modeset, and then |
2547 |
+- * going back up soon after. And once that happens we must |
2548 |
+- * retrain the link to get a picture. That's in case no |
2549 |
+- * userspace component reacted to intermittent HPD dip. |
2550 |
+- */ |
2551 |
++ } |
2552 |
++ |
2553 |
++ /* |
2554 |
++ * Some external monitors do not signal loss of link synchronization |
2555 |
++ * with an IRQ_HPD, so force a link status check. |
2556 |
++ */ |
2557 |
++ if (!intel_dp_is_edp(intel_dp)) { |
2558 |
+ struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base; |
2559 |
+ |
2560 |
+ intel_dp_retrain_link(encoder, ctx); |
2561 |
+diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c |
2562 |
+index 4da6e33c7fa1..329309a085cb 100644 |
2563 |
+--- a/drivers/gpu/drm/i915/intel_dp_link_training.c |
2564 |
++++ b/drivers/gpu/drm/i915/intel_dp_link_training.c |
2565 |
+@@ -352,22 +352,14 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) |
2566 |
+ return; |
2567 |
+ |
2568 |
+ failure_handling: |
2569 |
+- /* Dont fallback and prune modes if its eDP */ |
2570 |
+- if (!intel_dp_is_edp(intel_dp)) { |
2571 |
+- DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Link Training failed at link rate = %d, lane count = %d", |
2572 |
+- intel_connector->base.base.id, |
2573 |
+- intel_connector->base.name, |
2574 |
+- intel_dp->link_rate, intel_dp->lane_count); |
2575 |
+- if (!intel_dp_get_link_train_fallback_values(intel_dp, |
2576 |
+- intel_dp->link_rate, |
2577 |
+- intel_dp->lane_count)) |
2578 |
+- /* Schedule a Hotplug Uevent to userspace to start modeset */ |
2579 |
+- schedule_work(&intel_connector->modeset_retry_work); |
2580 |
+- } else { |
2581 |
+- DRM_ERROR("[CONNECTOR:%d:%s] Link Training failed at link rate = %d, lane count = %d", |
2582 |
+- intel_connector->base.base.id, |
2583 |
+- intel_connector->base.name, |
2584 |
+- intel_dp->link_rate, intel_dp->lane_count); |
2585 |
+- } |
2586 |
++ DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Link Training failed at link rate = %d, lane count = %d", |
2587 |
++ intel_connector->base.base.id, |
2588 |
++ intel_connector->base.name, |
2589 |
++ intel_dp->link_rate, intel_dp->lane_count); |
2590 |
++ if (!intel_dp_get_link_train_fallback_values(intel_dp, |
2591 |
++ intel_dp->link_rate, |
2592 |
++ intel_dp->lane_count)) |
2593 |
++ /* Schedule a Hotplug Uevent to userspace to start modeset */ |
2594 |
++ schedule_work(&intel_connector->modeset_retry_work); |
2595 |
+ return; |
2596 |
+ } |
2597 |
+diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c |
2598 |
+index 4ecd65375603..1fec0c71b4d9 100644 |
2599 |
+--- a/drivers/gpu/drm/i915/intel_dp_mst.c |
2600 |
++++ b/drivers/gpu/drm/i915/intel_dp_mst.c |
2601 |
+@@ -38,11 +38,11 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, |
2602 |
+ struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base); |
2603 |
+ struct intel_digital_port *intel_dig_port = intel_mst->primary; |
2604 |
+ struct intel_dp *intel_dp = &intel_dig_port->dp; |
2605 |
+- struct intel_connector *connector = |
2606 |
+- to_intel_connector(conn_state->connector); |
2607 |
++ struct drm_connector *connector = conn_state->connector; |
2608 |
++ void *port = to_intel_connector(connector)->port; |
2609 |
+ struct drm_atomic_state *state = pipe_config->base.state; |
2610 |
+ int bpp; |
2611 |
+- int lane_count, slots; |
2612 |
++ int lane_count, slots = 0; |
2613 |
+ const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; |
2614 |
+ int mst_pbn; |
2615 |
+ bool reduce_m_n = drm_dp_has_quirk(&intel_dp->desc, |
2616 |
+@@ -70,17 +70,23 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, |
2617 |
+ |
2618 |
+ pipe_config->port_clock = intel_dp_max_link_rate(intel_dp); |
2619 |
+ |
2620 |
+- if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, connector->port)) |
2621 |
++ if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, port)) |
2622 |
+ pipe_config->has_audio = true; |
2623 |
+ |
2624 |
+ mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp); |
2625 |
+ pipe_config->pbn = mst_pbn; |
2626 |
+ |
2627 |
+- slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp->mst_mgr, |
2628 |
+- connector->port, mst_pbn); |
2629 |
+- if (slots < 0) { |
2630 |
+- DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", slots); |
2631 |
+- return false; |
2632 |
++ /* Zombie connectors can't have VCPI slots */ |
2633 |
++ if (READ_ONCE(connector->registered)) { |
2634 |
++ slots = drm_dp_atomic_find_vcpi_slots(state, |
2635 |
++ &intel_dp->mst_mgr, |
2636 |
++ port, |
2637 |
++ mst_pbn); |
2638 |
++ if (slots < 0) { |
2639 |
++ DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", |
2640 |
++ slots); |
2641 |
++ return false; |
2642 |
++ } |
2643 |
+ } |
2644 |
+ |
2645 |
+ intel_link_compute_m_n(bpp, lane_count, |
2646 |
+@@ -311,9 +317,8 @@ static int intel_dp_mst_get_ddc_modes(struct drm_connector *connector) |
2647 |
+ struct edid *edid; |
2648 |
+ int ret; |
2649 |
+ |
2650 |
+- if (!intel_dp) { |
2651 |
++ if (!READ_ONCE(connector->registered)) |
2652 |
+ return intel_connector_update_modes(connector, NULL); |
2653 |
+- } |
2654 |
+ |
2655 |
+ edid = drm_dp_mst_get_edid(connector, &intel_dp->mst_mgr, intel_connector->port); |
2656 |
+ ret = intel_connector_update_modes(connector, edid); |
2657 |
+@@ -328,9 +333,10 @@ intel_dp_mst_detect(struct drm_connector *connector, bool force) |
2658 |
+ struct intel_connector *intel_connector = to_intel_connector(connector); |
2659 |
+ struct intel_dp *intel_dp = intel_connector->mst_port; |
2660 |
+ |
2661 |
+- if (!intel_dp) |
2662 |
++ if (!READ_ONCE(connector->registered)) |
2663 |
+ return connector_status_disconnected; |
2664 |
+- return drm_dp_mst_detect_port(connector, &intel_dp->mst_mgr, intel_connector->port); |
2665 |
++ return drm_dp_mst_detect_port(connector, &intel_dp->mst_mgr, |
2666 |
++ intel_connector->port); |
2667 |
+ } |
2668 |
+ |
2669 |
+ static void |
2670 |
+@@ -370,7 +376,7 @@ intel_dp_mst_mode_valid(struct drm_connector *connector, |
2671 |
+ int bpp = 24; /* MST uses fixed bpp */ |
2672 |
+ int max_rate, mode_rate, max_lanes, max_link_clock; |
2673 |
+ |
2674 |
+- if (!intel_dp) |
2675 |
++ if (!READ_ONCE(connector->registered)) |
2676 |
+ return MODE_ERROR; |
2677 |
+ |
2678 |
+ if (mode->flags & DRM_MODE_FLAG_DBLSCAN) |
2679 |
+@@ -402,7 +408,7 @@ static struct drm_encoder *intel_mst_atomic_best_encoder(struct drm_connector *c |
2680 |
+ struct intel_dp *intel_dp = intel_connector->mst_port; |
2681 |
+ struct intel_crtc *crtc = to_intel_crtc(state->crtc); |
2682 |
+ |
2683 |
+- if (!intel_dp) |
2684 |
++ if (!READ_ONCE(connector->registered)) |
2685 |
+ return NULL; |
2686 |
+ return &intel_dp->mst_encoders[crtc->pipe]->base.base; |
2687 |
+ } |
2688 |
+@@ -452,6 +458,10 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo |
2689 |
+ if (!intel_connector) |
2690 |
+ return NULL; |
2691 |
+ |
2692 |
++ intel_connector->get_hw_state = intel_dp_mst_get_hw_state; |
2693 |
++ intel_connector->mst_port = intel_dp; |
2694 |
++ intel_connector->port = port; |
2695 |
++ |
2696 |
+ connector = &intel_connector->base; |
2697 |
+ ret = drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs, |
2698 |
+ DRM_MODE_CONNECTOR_DisplayPort); |
2699 |
+@@ -462,10 +472,6 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo |
2700 |
+ |
2701 |
+ drm_connector_helper_add(connector, &intel_dp_mst_connector_helper_funcs); |
2702 |
+ |
2703 |
+- intel_connector->get_hw_state = intel_dp_mst_get_hw_state; |
2704 |
+- intel_connector->mst_port = intel_dp; |
2705 |
+- intel_connector->port = port; |
2706 |
+- |
2707 |
+ for_each_pipe(dev_priv, pipe) { |
2708 |
+ struct drm_encoder *enc = |
2709 |
+ &intel_dp->mst_encoders[pipe]->base.base; |
2710 |
+@@ -503,7 +509,6 @@ static void intel_dp_register_mst_connector(struct drm_connector *connector) |
2711 |
+ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, |
2712 |
+ struct drm_connector *connector) |
2713 |
+ { |
2714 |
+- struct intel_connector *intel_connector = to_intel_connector(connector); |
2715 |
+ struct drm_i915_private *dev_priv = to_i915(connector->dev); |
2716 |
+ |
2717 |
+ DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, connector->name); |
2718 |
+@@ -512,10 +517,6 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, |
2719 |
+ if (dev_priv->fbdev) |
2720 |
+ drm_fb_helper_remove_one_connector(&dev_priv->fbdev->helper, |
2721 |
+ connector); |
2722 |
+- /* prevent race with the check in ->detect */ |
2723 |
+- drm_modeset_lock(&connector->dev->mode_config.connection_mutex, NULL); |
2724 |
+- intel_connector->mst_port = NULL; |
2725 |
+- drm_modeset_unlock(&connector->dev->mode_config.connection_mutex); |
2726 |
+ |
2727 |
+ drm_connector_put(connector); |
2728 |
+ } |
2729 |
+diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c |
2730 |
+index 648a13c6043c..9a8018130237 100644 |
2731 |
+--- a/drivers/gpu/drm/i915/intel_hotplug.c |
2732 |
++++ b/drivers/gpu/drm/i915/intel_hotplug.c |
2733 |
+@@ -228,7 +228,9 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work) |
2734 |
+ drm_for_each_connector_iter(connector, &conn_iter) { |
2735 |
+ struct intel_connector *intel_connector = to_intel_connector(connector); |
2736 |
+ |
2737 |
+- if (intel_connector->encoder->hpd_pin == pin) { |
2738 |
++ /* Don't check MST ports, they don't have pins */ |
2739 |
++ if (!intel_connector->mst_port && |
2740 |
++ intel_connector->encoder->hpd_pin == pin) { |
2741 |
+ if (connector->polled != intel_connector->polled) |
2742 |
+ DRM_DEBUG_DRIVER("Reenabling HPD on connector %s\n", |
2743 |
+ connector->name); |
2744 |
+@@ -395,37 +397,54 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv, |
2745 |
+ struct intel_encoder *encoder; |
2746 |
+ bool storm_detected = false; |
2747 |
+ bool queue_dig = false, queue_hp = false; |
2748 |
++ u32 long_hpd_pulse_mask = 0; |
2749 |
++ u32 short_hpd_pulse_mask = 0; |
2750 |
++ enum hpd_pin pin; |
2751 |
+ |
2752 |
+ if (!pin_mask) |
2753 |
+ return; |
2754 |
+ |
2755 |
+ spin_lock(&dev_priv->irq_lock); |
2756 |
++ |
2757 |
++ /* |
2758 |
++ * Determine whether ->hpd_pulse() exists for each pin, and |
2759 |
++ * whether we have a short or a long pulse. This is needed |
2760 |
++ * as each pin may have up to two encoders (HDMI and DP) and |
2761 |
++ * only the one of them (DP) will have ->hpd_pulse(). |
2762 |
++ */ |
2763 |
+ for_each_intel_encoder(&dev_priv->drm, encoder) { |
2764 |
+- enum hpd_pin pin = encoder->hpd_pin; |
2765 |
+ bool has_hpd_pulse = intel_encoder_has_hpd_pulse(encoder); |
2766 |
++ enum port port = encoder->port; |
2767 |
++ bool long_hpd; |
2768 |
+ |
2769 |
++ pin = encoder->hpd_pin; |
2770 |
+ if (!(BIT(pin) & pin_mask)) |
2771 |
+ continue; |
2772 |
+ |
2773 |
+- if (has_hpd_pulse) { |
2774 |
+- bool long_hpd = long_mask & BIT(pin); |
2775 |
+- enum port port = encoder->port; |
2776 |
++ if (!has_hpd_pulse) |
2777 |
++ continue; |
2778 |
+ |
2779 |
+- DRM_DEBUG_DRIVER("digital hpd port %c - %s\n", port_name(port), |
2780 |
+- long_hpd ? "long" : "short"); |
2781 |
+- /* |
2782 |
+- * For long HPD pulses we want to have the digital queue happen, |
2783 |
+- * but we still want HPD storm detection to function. |
2784 |
+- */ |
2785 |
+- queue_dig = true; |
2786 |
+- if (long_hpd) { |
2787 |
+- dev_priv->hotplug.long_port_mask |= (1 << port); |
2788 |
+- } else { |
2789 |
+- /* for short HPD just trigger the digital queue */ |
2790 |
+- dev_priv->hotplug.short_port_mask |= (1 << port); |
2791 |
+- continue; |
2792 |
+- } |
2793 |
++ long_hpd = long_mask & BIT(pin); |
2794 |
++ |
2795 |
++ DRM_DEBUG_DRIVER("digital hpd port %c - %s\n", port_name(port), |
2796 |
++ long_hpd ? "long" : "short"); |
2797 |
++ queue_dig = true; |
2798 |
++ |
2799 |
++ if (long_hpd) { |
2800 |
++ long_hpd_pulse_mask |= BIT(pin); |
2801 |
++ dev_priv->hotplug.long_port_mask |= BIT(port); |
2802 |
++ } else { |
2803 |
++ short_hpd_pulse_mask |= BIT(pin); |
2804 |
++ dev_priv->hotplug.short_port_mask |= BIT(port); |
2805 |
+ } |
2806 |
++ } |
2807 |
++ |
2808 |
++ /* Now process each pin just once */ |
2809 |
++ for_each_hpd_pin(pin) { |
2810 |
++ bool long_hpd; |
2811 |
++ |
2812 |
++ if (!(BIT(pin) & pin_mask)) |
2813 |
++ continue; |
2814 |
+ |
2815 |
+ if (dev_priv->hotplug.stats[pin].state == HPD_DISABLED) { |
2816 |
+ /* |
2817 |
+@@ -442,11 +461,22 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv, |
2818 |
+ if (dev_priv->hotplug.stats[pin].state != HPD_ENABLED) |
2819 |
+ continue; |
2820 |
+ |
2821 |
+- if (!has_hpd_pulse) { |
2822 |
++ /* |
2823 |
++ * Delegate to ->hpd_pulse() if one of the encoders for this |
2824 |
++ * pin has it, otherwise let the hotplug_work deal with this |
2825 |
++ * pin directly. |
2826 |
++ */ |
2827 |
++ if (((short_hpd_pulse_mask | long_hpd_pulse_mask) & BIT(pin))) { |
2828 |
++ long_hpd = long_hpd_pulse_mask & BIT(pin); |
2829 |
++ } else { |
2830 |
+ dev_priv->hotplug.event_bits |= BIT(pin); |
2831 |
++ long_hpd = true; |
2832 |
+ queue_hp = true; |
2833 |
+ } |
2834 |
+ |
2835 |
++ if (!long_hpd) |
2836 |
++ continue; |
2837 |
++ |
2838 |
+ if (intel_hpd_irq_storm_detect(dev_priv, pin)) { |
2839 |
+ dev_priv->hotplug.event_bits &= ~BIT(pin); |
2840 |
+ storm_detected = true; |
2841 |
+diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c |
2842 |
+index cdf19553ffac..5d5336fbe7b0 100644 |
2843 |
+--- a/drivers/gpu/drm/i915/intel_lpe_audio.c |
2844 |
++++ b/drivers/gpu/drm/i915/intel_lpe_audio.c |
2845 |
+@@ -297,8 +297,10 @@ void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv) |
2846 |
+ lpe_audio_platdev_destroy(dev_priv); |
2847 |
+ |
2848 |
+ irq_free_desc(dev_priv->lpe_audio.irq); |
2849 |
+-} |
2850 |
+ |
2851 |
++ dev_priv->lpe_audio.irq = -1; |
2852 |
++ dev_priv->lpe_audio.platdev = NULL; |
2853 |
++} |
2854 |
+ |
2855 |
+ /** |
2856 |
+ * intel_lpe_audio_notify() - notify lpe audio event |
2857 |
+diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c |
2858 |
+index 174479232e94..75ea87ebf9b0 100644 |
2859 |
+--- a/drivers/gpu/drm/i915/intel_lrc.c |
2860 |
++++ b/drivers/gpu/drm/i915/intel_lrc.c |
2861 |
+@@ -424,7 +424,8 @@ static u64 execlists_update_context(struct i915_request *rq) |
2862 |
+ |
2863 |
+ reg_state[CTX_RING_TAIL+1] = intel_ring_set_tail(rq->ring, rq->tail); |
2864 |
+ |
2865 |
+- /* True 32b PPGTT with dynamic page allocation: update PDP |
2866 |
++ /* |
2867 |
++ * True 32b PPGTT with dynamic page allocation: update PDP |
2868 |
+ * registers and point the unallocated PDPs to scratch page. |
2869 |
+ * PML4 is allocated during ppgtt init, so this is not needed |
2870 |
+ * in 48-bit mode. |
2871 |
+@@ -432,6 +433,17 @@ static u64 execlists_update_context(struct i915_request *rq) |
2872 |
+ if (ppgtt && !i915_vm_is_48bit(&ppgtt->vm)) |
2873 |
+ execlists_update_context_pdps(ppgtt, reg_state); |
2874 |
+ |
2875 |
++ /* |
2876 |
++ * Make sure the context image is complete before we submit it to HW. |
2877 |
++ * |
2878 |
++ * Ostensibly, writes (including the WCB) should be flushed prior to |
2879 |
++ * an uncached write such as our mmio register access, the empirical |
2880 |
++ * evidence (esp. on Braswell) suggests that the WC write into memory |
2881 |
++ * may not be visible to the HW prior to the completion of the UC |
2882 |
++ * register write and that we may begin execution from the context |
2883 |
++ * before its image is complete leading to invalid PD chasing. |
2884 |
++ */ |
2885 |
++ wmb(); |
2886 |
+ return ce->lrc_desc; |
2887 |
+ } |
2888 |
+ |
2889 |
+diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c |
2890 |
+index 6a8f27d0a742..3b8218dd9bb1 100644 |
2891 |
+--- a/drivers/gpu/drm/i915/intel_ringbuffer.c |
2892 |
++++ b/drivers/gpu/drm/i915/intel_ringbuffer.c |
2893 |
+@@ -91,6 +91,7 @@ static int |
2894 |
+ gen4_render_ring_flush(struct i915_request *rq, u32 mode) |
2895 |
+ { |
2896 |
+ u32 cmd, *cs; |
2897 |
++ int i; |
2898 |
+ |
2899 |
+ /* |
2900 |
+ * read/write caches: |
2901 |
+@@ -127,12 +128,45 @@ gen4_render_ring_flush(struct i915_request *rq, u32 mode) |
2902 |
+ cmd |= MI_INVALIDATE_ISP; |
2903 |
+ } |
2904 |
+ |
2905 |
+- cs = intel_ring_begin(rq, 2); |
2906 |
++ i = 2; |
2907 |
++ if (mode & EMIT_INVALIDATE) |
2908 |
++ i += 20; |
2909 |
++ |
2910 |
++ cs = intel_ring_begin(rq, i); |
2911 |
+ if (IS_ERR(cs)) |
2912 |
+ return PTR_ERR(cs); |
2913 |
+ |
2914 |
+ *cs++ = cmd; |
2915 |
+- *cs++ = MI_NOOP; |
2916 |
++ |
2917 |
++ /* |
2918 |
++ * A random delay to let the CS invalidate take effect? Without this |
2919 |
++ * delay, the GPU relocation path fails as the CS does not see |
2920 |
++ * the updated contents. Just as important, if we apply the flushes |
2921 |
++ * to the EMIT_FLUSH branch (i.e. immediately after the relocation |
2922 |
++ * write and before the invalidate on the next batch), the relocations |
2923 |
++ * still fail. This implies that is a delay following invalidation |
2924 |
++ * that is required to reset the caches as opposed to a delay to |
2925 |
++ * ensure the memory is written. |
2926 |
++ */ |
2927 |
++ if (mode & EMIT_INVALIDATE) { |
2928 |
++ *cs++ = GFX_OP_PIPE_CONTROL(4) | PIPE_CONTROL_QW_WRITE; |
2929 |
++ *cs++ = i915_ggtt_offset(rq->engine->scratch) | |
2930 |
++ PIPE_CONTROL_GLOBAL_GTT; |
2931 |
++ *cs++ = 0; |
2932 |
++ *cs++ = 0; |
2933 |
++ |
2934 |
++ for (i = 0; i < 12; i++) |
2935 |
++ *cs++ = MI_FLUSH; |
2936 |
++ |
2937 |
++ *cs++ = GFX_OP_PIPE_CONTROL(4) | PIPE_CONTROL_QW_WRITE; |
2938 |
++ *cs++ = i915_ggtt_offset(rq->engine->scratch) | |
2939 |
++ PIPE_CONTROL_GLOBAL_GTT; |
2940 |
++ *cs++ = 0; |
2941 |
++ *cs++ = 0; |
2942 |
++ } |
2943 |
++ |
2944 |
++ *cs++ = cmd; |
2945 |
++ |
2946 |
+ intel_ring_advance(rq, cs); |
2947 |
+ |
2948 |
+ return 0; |
2949 |
+diff --git a/drivers/gpu/drm/i915/selftests/huge_pages.c b/drivers/gpu/drm/i915/selftests/huge_pages.c |
2950 |
+index 7efb326badcd..704572c2e6a2 100644 |
2951 |
+--- a/drivers/gpu/drm/i915/selftests/huge_pages.c |
2952 |
++++ b/drivers/gpu/drm/i915/selftests/huge_pages.c |
2953 |
+@@ -549,7 +549,7 @@ static int igt_mock_ppgtt_misaligned_dma(void *arg) |
2954 |
+ err = igt_check_page_sizes(vma); |
2955 |
+ |
2956 |
+ if (vma->page_sizes.gtt != I915_GTT_PAGE_SIZE_4K) { |
2957 |
+- pr_err("page_sizes.gtt=%u, expected %lu\n", |
2958 |
++ pr_err("page_sizes.gtt=%u, expected %llu\n", |
2959 |
+ vma->page_sizes.gtt, I915_GTT_PAGE_SIZE_4K); |
2960 |
+ err = -EINVAL; |
2961 |
+ } |
2962 |
+diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |
2963 |
+index 8e2e269db97e..127d81513671 100644 |
2964 |
+--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |
2965 |
++++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |
2966 |
+@@ -1337,7 +1337,7 @@ static int igt_gtt_reserve(void *arg) |
2967 |
+ GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); |
2968 |
+ if (vma->node.start != total || |
2969 |
+ vma->node.size != 2*I915_GTT_PAGE_SIZE) { |
2970 |
+- pr_err("i915_gem_gtt_reserve (pass 1) placement failed, found (%llx + %llx), expected (%llx + %lx)\n", |
2971 |
++ pr_err("i915_gem_gtt_reserve (pass 1) placement failed, found (%llx + %llx), expected (%llx + %llx)\n", |
2972 |
+ vma->node.start, vma->node.size, |
2973 |
+ total, 2*I915_GTT_PAGE_SIZE); |
2974 |
+ err = -EINVAL; |
2975 |
+@@ -1386,7 +1386,7 @@ static int igt_gtt_reserve(void *arg) |
2976 |
+ GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); |
2977 |
+ if (vma->node.start != total || |
2978 |
+ vma->node.size != 2*I915_GTT_PAGE_SIZE) { |
2979 |
+- pr_err("i915_gem_gtt_reserve (pass 2) placement failed, found (%llx + %llx), expected (%llx + %lx)\n", |
2980 |
++ pr_err("i915_gem_gtt_reserve (pass 2) placement failed, found (%llx + %llx), expected (%llx + %llx)\n", |
2981 |
+ vma->node.start, vma->node.size, |
2982 |
+ total, 2*I915_GTT_PAGE_SIZE); |
2983 |
+ err = -EINVAL; |
2984 |
+@@ -1430,7 +1430,7 @@ static int igt_gtt_reserve(void *arg) |
2985 |
+ GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); |
2986 |
+ if (vma->node.start != offset || |
2987 |
+ vma->node.size != 2*I915_GTT_PAGE_SIZE) { |
2988 |
+- pr_err("i915_gem_gtt_reserve (pass 3) placement failed, found (%llx + %llx), expected (%llx + %lx)\n", |
2989 |
++ pr_err("i915_gem_gtt_reserve (pass 3) placement failed, found (%llx + %llx), expected (%llx + %llx)\n", |
2990 |
+ vma->node.start, vma->node.size, |
2991 |
+ offset, 2*I915_GTT_PAGE_SIZE); |
2992 |
+ err = -EINVAL; |
2993 |
+diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c |
2994 |
+index da1363a0c54d..93d70f4a2154 100644 |
2995 |
+--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c |
2996 |
++++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c |
2997 |
+@@ -633,8 +633,7 @@ static int adreno_get_legacy_pwrlevels(struct device *dev) |
2998 |
+ struct device_node *child, *node; |
2999 |
+ int ret; |
3000 |
+ |
3001 |
+- node = of_find_compatible_node(dev->of_node, NULL, |
3002 |
+- "qcom,gpu-pwrlevels"); |
3003 |
++ node = of_get_compatible_child(dev->of_node, "qcom,gpu-pwrlevels"); |
3004 |
+ if (!node) { |
3005 |
+ dev_err(dev, "Could not find the GPU powerlevels\n"); |
3006 |
+ return -ENXIO; |
3007 |
+@@ -655,6 +654,8 @@ static int adreno_get_legacy_pwrlevels(struct device *dev) |
3008 |
+ dev_pm_opp_add(dev, val, 0); |
3009 |
+ } |
3010 |
+ |
3011 |
++ of_node_put(node); |
3012 |
++ |
3013 |
+ return 0; |
3014 |
+ } |
3015 |
+ |
3016 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |
3017 |
+index 80cbf75bc2ff..cd02eae884cc 100644 |
3018 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |
3019 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |
3020 |
+@@ -1535,8 +1535,7 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, |
3021 |
+ cnt++; |
3022 |
+ |
3023 |
+ dst = drm_plane_state_dest(pstate); |
3024 |
+- if (!drm_rect_intersect(&clip, &dst) || |
3025 |
+- !drm_rect_equals(&clip, &dst)) { |
3026 |
++ if (!drm_rect_intersect(&clip, &dst)) { |
3027 |
+ DPU_ERROR("invalid vertical/horizontal destination\n"); |
3028 |
+ DPU_ERROR("display: " DRM_RECT_FMT " plane: " |
3029 |
+ DRM_RECT_FMT "\n", DRM_RECT_ARG(&crtc_rect), |
3030 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |
3031 |
+index 7dd6bd2d6d37..74cc204b07e8 100644 |
3032 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |
3033 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |
3034 |
+@@ -450,7 +450,7 @@ static void _dpu_kms_initialize_dsi(struct drm_device *dev, |
3035 |
+ int i, rc; |
3036 |
+ |
3037 |
+ /*TODO: Support two independent DSI connectors */ |
3038 |
+- encoder = dpu_encoder_init(dev, DRM_MODE_CONNECTOR_DSI); |
3039 |
++ encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI); |
3040 |
+ if (IS_ERR_OR_NULL(encoder)) { |
3041 |
+ DPU_ERROR("encoder init failed for dsi display\n"); |
3042 |
+ return; |
3043 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c |
3044 |
+index b640e39ebaca..4ac2b0c669b7 100644 |
3045 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c |
3046 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c |
3047 |
+@@ -1254,7 +1254,7 @@ static int dpu_plane_sspp_atomic_update(struct drm_plane *plane, |
3048 |
+ const struct dpu_format *fmt; |
3049 |
+ struct drm_crtc *crtc; |
3050 |
+ struct drm_framebuffer *fb; |
3051 |
+- struct drm_rect src, dst; |
3052 |
++ int ret, min_scale; |
3053 |
+ |
3054 |
+ if (!plane) { |
3055 |
+ DPU_ERROR("invalid plane\n"); |
3056 |
+@@ -1293,21 +1293,29 @@ static int dpu_plane_sspp_atomic_update(struct drm_plane *plane, |
3057 |
+ pdpu->is_rt_pipe = (dpu_crtc_get_client_type(crtc) != NRT_CLIENT); |
3058 |
+ _dpu_plane_set_qos_ctrl(plane, false, DPU_PLANE_QOS_PANIC_CTRL); |
3059 |
+ |
3060 |
+- src.x1 = state->src_x >> 16; |
3061 |
+- src.y1 = state->src_y >> 16; |
3062 |
+- src.x2 = src.x1 + (state->src_w >> 16); |
3063 |
+- src.y2 = src.y1 + (state->src_h >> 16); |
3064 |
++ min_scale = FRAC_16_16(1, pdpu->pipe_sblk->maxdwnscale); |
3065 |
++ ret = drm_atomic_helper_check_plane_state(state, crtc->state, min_scale, |
3066 |
++ pdpu->pipe_sblk->maxupscale << 16, |
3067 |
++ true, false); |
3068 |
++ if (ret) { |
3069 |
++ DPU_ERROR_PLANE(pdpu, "Check plane state failed (%d)\n", ret); |
3070 |
++ return ret; |
3071 |
++ } |
3072 |
+ |
3073 |
+- dst = drm_plane_state_dest(state); |
3074 |
++ DPU_DEBUG_PLANE(pdpu, "FB[%u] " DRM_RECT_FP_FMT "->crtc%u " DRM_RECT_FMT |
3075 |
++ ", %4.4s ubwc %d\n", fb->base.id, DRM_RECT_FP_ARG(&state->src), |
3076 |
++ crtc->base.id, DRM_RECT_ARG(&state->dst), |
3077 |
++ (char *)&fmt->base.pixel_format, DPU_FORMAT_IS_UBWC(fmt)); |
3078 |
+ |
3079 |
+- DPU_DEBUG_PLANE(pdpu, "FB[%u] " DRM_RECT_FMT "->crtc%u " DRM_RECT_FMT |
3080 |
+- ", %4.4s ubwc %d\n", fb->base.id, DRM_RECT_ARG(&src), |
3081 |
+- crtc->base.id, DRM_RECT_ARG(&dst), |
3082 |
+- (char *)&fmt->base.pixel_format, |
3083 |
+- DPU_FORMAT_IS_UBWC(fmt)); |
3084 |
++ pdpu->pipe_cfg.src_rect = state->src; |
3085 |
++ |
3086 |
++ /* state->src is 16.16, src_rect is not */ |
3087 |
++ pdpu->pipe_cfg.src_rect.x1 >>= 16; |
3088 |
++ pdpu->pipe_cfg.src_rect.x2 >>= 16; |
3089 |
++ pdpu->pipe_cfg.src_rect.y1 >>= 16; |
3090 |
++ pdpu->pipe_cfg.src_rect.y2 >>= 16; |
3091 |
+ |
3092 |
+- pdpu->pipe_cfg.src_rect = src; |
3093 |
+- pdpu->pipe_cfg.dst_rect = dst; |
3094 |
++ pdpu->pipe_cfg.dst_rect = state->dst; |
3095 |
+ |
3096 |
+ _dpu_plane_setup_scaler(pdpu, pstate, fmt, false); |
3097 |
+ |
3098 |
+diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c |
3099 |
+index 7d306c5acd09..273cbbe27c2e 100644 |
3100 |
+--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c |
3101 |
++++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c |
3102 |
+@@ -259,7 +259,6 @@ static void mdp5_plane_cleanup_fb(struct drm_plane *plane, |
3103 |
+ msm_framebuffer_cleanup(fb, kms->aspace); |
3104 |
+ } |
3105 |
+ |
3106 |
+-#define FRAC_16_16(mult, div) (((mult) << 16) / (div)) |
3107 |
+ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state, |
3108 |
+ struct drm_plane_state *state) |
3109 |
+ { |
3110 |
+diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h |
3111 |
+index 8e510d5c758a..9d11f321f5a9 100644 |
3112 |
+--- a/drivers/gpu/drm/msm/msm_drv.h |
3113 |
++++ b/drivers/gpu/drm/msm/msm_drv.h |
3114 |
+@@ -62,6 +62,8 @@ struct msm_gem_vma; |
3115 |
+ #define MAX_BRIDGES 8 |
3116 |
+ #define MAX_CONNECTORS 8 |
3117 |
+ |
3118 |
++#define FRAC_16_16(mult, div) (((mult) << 16) / (div)) |
3119 |
++ |
3120 |
+ struct msm_file_private { |
3121 |
+ rwlock_t queuelock; |
3122 |
+ struct list_head submitqueues; |
3123 |
+diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c |
3124 |
+index 5e808cfec345..46e6b82f7b66 100644 |
3125 |
+--- a/drivers/gpu/drm/msm/msm_gpu.c |
3126 |
++++ b/drivers/gpu/drm/msm/msm_gpu.c |
3127 |
+@@ -367,8 +367,8 @@ static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, |
3128 |
+ msm_gpu_devcoredump_read, msm_gpu_devcoredump_free); |
3129 |
+ } |
3130 |
+ #else |
3131 |
+-static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, char *comm, |
3132 |
+- char *cmd) |
3133 |
++static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, |
3134 |
++ struct msm_gem_submit *submit, char *comm, char *cmd) |
3135 |
+ { |
3136 |
+ } |
3137 |
+ #endif |
3138 |
+diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c |
3139 |
+index 041e7daf8a33..faf7009c0a3c 100644 |
3140 |
+--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c |
3141 |
++++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c |
3142 |
+@@ -843,22 +843,16 @@ nv50_mstc_atomic_best_encoder(struct drm_connector *connector, |
3143 |
+ { |
3144 |
+ struct nv50_head *head = nv50_head(connector_state->crtc); |
3145 |
+ struct nv50_mstc *mstc = nv50_mstc(connector); |
3146 |
+- if (mstc->port) { |
3147 |
+- struct nv50_mstm *mstm = mstc->mstm; |
3148 |
+- return &mstm->msto[head->base.index]->encoder; |
3149 |
+- } |
3150 |
+- return NULL; |
3151 |
++ |
3152 |
++ return &mstc->mstm->msto[head->base.index]->encoder; |
3153 |
+ } |
3154 |
+ |
3155 |
+ static struct drm_encoder * |
3156 |
+ nv50_mstc_best_encoder(struct drm_connector *connector) |
3157 |
+ { |
3158 |
+ struct nv50_mstc *mstc = nv50_mstc(connector); |
3159 |
+- if (mstc->port) { |
3160 |
+- struct nv50_mstm *mstm = mstc->mstm; |
3161 |
+- return &mstm->msto[0]->encoder; |
3162 |
+- } |
3163 |
+- return NULL; |
3164 |
++ |
3165 |
++ return &mstc->mstm->msto[0]->encoder; |
3166 |
+ } |
3167 |
+ |
3168 |
+ static enum drm_mode_status |
3169 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c |
3170 |
+index 408b955e5c39..6dd72bc32897 100644 |
3171 |
+--- a/drivers/gpu/drm/nouveau/nouveau_backlight.c |
3172 |
++++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c |
3173 |
+@@ -116,7 +116,7 @@ nv40_backlight_init(struct drm_connector *connector) |
3174 |
+ &nv40_bl_ops, &props); |
3175 |
+ |
3176 |
+ if (IS_ERR(bd)) { |
3177 |
+- if (bl_connector.id > 0) |
3178 |
++ if (bl_connector.id >= 0) |
3179 |
+ ida_simple_remove(&bl_ida, bl_connector.id); |
3180 |
+ return PTR_ERR(bd); |
3181 |
+ } |
3182 |
+@@ -249,7 +249,7 @@ nv50_backlight_init(struct drm_connector *connector) |
3183 |
+ nv_encoder, ops, &props); |
3184 |
+ |
3185 |
+ if (IS_ERR(bd)) { |
3186 |
+- if (bl_connector.id > 0) |
3187 |
++ if (bl_connector.id >= 0) |
3188 |
+ ida_simple_remove(&bl_ida, bl_connector.id); |
3189 |
+ return PTR_ERR(bd); |
3190 |
+ } |
3191 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c |
3192 |
+index d02e183717dc..5c14d6ac855d 100644 |
3193 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c |
3194 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c |
3195 |
+@@ -801,6 +801,7 @@ acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon, |
3196 |
+ bl = acr->hsbl_unload_blob; |
3197 |
+ } else { |
3198 |
+ nvkm_error(_acr->subdev, "invalid secure boot blob!\n"); |
3199 |
++ kfree(bl_desc); |
3200 |
+ return -EINVAL; |
3201 |
+ } |
3202 |
+ |
3203 |
+diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
3204 |
+index f92fe205550b..e884183c018a 100644 |
3205 |
+--- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
3206 |
++++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
3207 |
+@@ -285,6 +285,17 @@ static int dmm_txn_commit(struct dmm_txn *txn, bool wait) |
3208 |
+ } |
3209 |
+ |
3210 |
+ txn->last_pat->next_pa = 0; |
3211 |
++ /* ensure that the written descriptors are visible to DMM */ |
3212 |
++ wmb(); |
3213 |
++ |
3214 |
++ /* |
3215 |
++ * NOTE: the wmb() above should be enough, but there seems to be a bug |
3216 |
++ * in OMAP's memory barrier implementation, which in some rare cases may |
3217 |
++ * cause the writes not to be observable after wmb(). |
3218 |
++ */ |
3219 |
++ |
3220 |
++ /* read back to ensure the data is in RAM */ |
3221 |
++ readl(&txn->last_pat->next_pa); |
3222 |
+ |
3223 |
+ /* write to PAT_DESCR to clear out any pending transaction */ |
3224 |
+ dmm_write(dmm, 0x0, reg[PAT_DESCR][engine->id]); |
3225 |
+diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c |
3226 |
+index f0bc7cc0e913..fb46df56f0c4 100644 |
3227 |
+--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c |
3228 |
++++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c |
3229 |
+@@ -516,12 +516,22 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu) |
3230 |
+ |
3231 |
+ dev->mode_config.min_width = 0; |
3232 |
+ dev->mode_config.min_height = 0; |
3233 |
+- dev->mode_config.max_width = 4095; |
3234 |
+- dev->mode_config.max_height = 2047; |
3235 |
+ dev->mode_config.normalize_zpos = true; |
3236 |
+ dev->mode_config.funcs = &rcar_du_mode_config_funcs; |
3237 |
+ dev->mode_config.helper_private = &rcar_du_mode_config_helper; |
3238 |
+ |
3239 |
++ if (rcdu->info->gen < 3) { |
3240 |
++ dev->mode_config.max_width = 4095; |
3241 |
++ dev->mode_config.max_height = 2047; |
3242 |
++ } else { |
3243 |
++ /* |
3244 |
++ * The Gen3 DU uses the VSP1 for memory access, and is limited |
3245 |
++ * to frame sizes of 8190x8190. |
3246 |
++ */ |
3247 |
++ dev->mode_config.max_width = 8190; |
3248 |
++ dev->mode_config.max_height = 8190; |
3249 |
++ } |
3250 |
++ |
3251 |
+ rcdu->num_crtcs = hweight8(rcdu->info->channels_mask); |
3252 |
+ |
3253 |
+ ret = rcar_du_properties_init(rcdu); |
3254 |
+diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c |
3255 |
+index f814d37b1db2..05368fa4f956 100644 |
3256 |
+--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c |
3257 |
++++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c |
3258 |
+@@ -442,6 +442,11 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev) |
3259 |
+ return 0; |
3260 |
+ } |
3261 |
+ |
3262 |
++static void rockchip_drm_platform_shutdown(struct platform_device *pdev) |
3263 |
++{ |
3264 |
++ rockchip_drm_platform_remove(pdev); |
3265 |
++} |
3266 |
++ |
3267 |
+ static const struct of_device_id rockchip_drm_dt_ids[] = { |
3268 |
+ { .compatible = "rockchip,display-subsystem", }, |
3269 |
+ { /* sentinel */ }, |
3270 |
+@@ -451,6 +456,7 @@ MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids); |
3271 |
+ static struct platform_driver rockchip_drm_platform_driver = { |
3272 |
+ .probe = rockchip_drm_platform_probe, |
3273 |
+ .remove = rockchip_drm_platform_remove, |
3274 |
++ .shutdown = rockchip_drm_platform_shutdown, |
3275 |
+ .driver = { |
3276 |
+ .name = "rockchip-drm", |
3277 |
+ .of_match_table = rockchip_drm_dt_ids, |
3278 |
+diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c |
3279 |
+index 33d51281272b..fcdbac4a56e3 100644 |
3280 |
+--- a/drivers/hwmon/hwmon.c |
3281 |
++++ b/drivers/hwmon/hwmon.c |
3282 |
+@@ -635,8 +635,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, |
3283 |
+ if (info[i]->config[j] & HWMON_T_INPUT) { |
3284 |
+ err = hwmon_thermal_add_sensor(dev, |
3285 |
+ hwdev, j); |
3286 |
+- if (err) |
3287 |
+- goto free_device; |
3288 |
++ if (err) { |
3289 |
++ device_unregister(hdev); |
3290 |
++ goto ida_remove; |
3291 |
++ } |
3292 |
+ } |
3293 |
+ } |
3294 |
+ } |
3295 |
+@@ -644,8 +646,6 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, |
3296 |
+ |
3297 |
+ return hdev; |
3298 |
+ |
3299 |
+-free_device: |
3300 |
+- device_unregister(hdev); |
3301 |
+ free_hwmon: |
3302 |
+ kfree(hwdev); |
3303 |
+ ida_remove: |
3304 |
+diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c |
3305 |
+index 2566b4d8b342..73856c2a8ac0 100644 |
3306 |
+--- a/drivers/input/touchscreen/wm97xx-core.c |
3307 |
++++ b/drivers/input/touchscreen/wm97xx-core.c |
3308 |
+@@ -929,7 +929,8 @@ static int __init wm97xx_init(void) |
3309 |
+ |
3310 |
+ static void __exit wm97xx_exit(void) |
3311 |
+ { |
3312 |
+- driver_unregister(&wm97xx_driver); |
3313 |
++ if (IS_BUILTIN(CONFIG_AC97_BUS)) |
3314 |
++ driver_unregister(&wm97xx_driver); |
3315 |
+ platform_driver_unregister(&wm97xx_mfd_driver); |
3316 |
+ } |
3317 |
+ |
3318 |
+diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c |
3319 |
+index 071f4bc240ca..7b662bd1c7a0 100644 |
3320 |
+--- a/drivers/media/i2c/ov5640.c |
3321 |
++++ b/drivers/media/i2c/ov5640.c |
3322 |
+@@ -223,8 +223,10 @@ struct ov5640_dev { |
3323 |
+ int power_count; |
3324 |
+ |
3325 |
+ struct v4l2_mbus_framefmt fmt; |
3326 |
++ bool pending_fmt_change; |
3327 |
+ |
3328 |
+ const struct ov5640_mode_info *current_mode; |
3329 |
++ const struct ov5640_mode_info *last_mode; |
3330 |
+ enum ov5640_frame_rate current_fr; |
3331 |
+ struct v4l2_fract frame_interval; |
3332 |
+ |
3333 |
+@@ -255,7 +257,7 @@ static inline struct v4l2_subdev *ctrl_to_sd(struct v4l2_ctrl *ctrl) |
3334 |
+ * should be identified and removed to speed register load time |
3335 |
+ * over i2c. |
3336 |
+ */ |
3337 |
+- |
3338 |
++/* YUV422 UYVY VGA@30fps */ |
3339 |
+ static const struct reg_value ov5640_init_setting_30fps_VGA[] = { |
3340 |
+ {0x3103, 0x11, 0, 0}, {0x3008, 0x82, 0, 5}, {0x3008, 0x42, 0, 0}, |
3341 |
+ {0x3103, 0x03, 0, 0}, {0x3017, 0x00, 0, 0}, {0x3018, 0x00, 0, 0}, |
3342 |
+@@ -1613,10 +1615,10 @@ static int ov5640_set_mode_direct(struct ov5640_dev *sensor, |
3343 |
+ return __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, exposure); |
3344 |
+ } |
3345 |
+ |
3346 |
+-static int ov5640_set_mode(struct ov5640_dev *sensor, |
3347 |
+- const struct ov5640_mode_info *orig_mode) |
3348 |
++static int ov5640_set_mode(struct ov5640_dev *sensor) |
3349 |
+ { |
3350 |
+ const struct ov5640_mode_info *mode = sensor->current_mode; |
3351 |
++ const struct ov5640_mode_info *orig_mode = sensor->last_mode; |
3352 |
+ enum ov5640_downsize_mode dn_mode, orig_dn_mode; |
3353 |
+ s32 exposure; |
3354 |
+ int ret; |
3355 |
+@@ -1673,6 +1675,7 @@ static int ov5640_set_mode(struct ov5640_dev *sensor, |
3356 |
+ return ret; |
3357 |
+ |
3358 |
+ sensor->pending_mode_change = false; |
3359 |
++ sensor->last_mode = mode; |
3360 |
+ |
3361 |
+ return 0; |
3362 |
+ } |
3363 |
+@@ -1689,6 +1692,7 @@ static int ov5640_restore_mode(struct ov5640_dev *sensor) |
3364 |
+ ret = ov5640_load_regs(sensor, &ov5640_mode_init_data); |
3365 |
+ if (ret < 0) |
3366 |
+ return ret; |
3367 |
++ sensor->last_mode = &ov5640_mode_init_data; |
3368 |
+ |
3369 |
+ ret = ov5640_mod_reg(sensor, OV5640_REG_SYS_ROOT_DIVIDER, 0x3f, |
3370 |
+ (ilog2(OV5640_SCLK2X_ROOT_DIVIDER_DEFAULT) << 2) | |
3371 |
+@@ -1697,7 +1701,7 @@ static int ov5640_restore_mode(struct ov5640_dev *sensor) |
3372 |
+ return ret; |
3373 |
+ |
3374 |
+ /* now restore the last capture mode */ |
3375 |
+- ret = ov5640_set_mode(sensor, &ov5640_mode_init_data); |
3376 |
++ ret = ov5640_set_mode(sensor); |
3377 |
+ if (ret < 0) |
3378 |
+ return ret; |
3379 |
+ |
3380 |
+@@ -1968,9 +1972,12 @@ static int ov5640_set_fmt(struct v4l2_subdev *sd, |
3381 |
+ |
3382 |
+ if (new_mode != sensor->current_mode) { |
3383 |
+ sensor->current_mode = new_mode; |
3384 |
+- sensor->fmt = *mbus_fmt; |
3385 |
+ sensor->pending_mode_change = true; |
3386 |
+ } |
3387 |
++ if (mbus_fmt->code != sensor->fmt.code) { |
3388 |
++ sensor->fmt = *mbus_fmt; |
3389 |
++ sensor->pending_fmt_change = true; |
3390 |
++ } |
3391 |
+ out: |
3392 |
+ mutex_unlock(&sensor->lock); |
3393 |
+ return ret; |
3394 |
+@@ -2541,13 +2548,16 @@ static int ov5640_s_stream(struct v4l2_subdev *sd, int enable) |
3395 |
+ |
3396 |
+ if (sensor->streaming == !enable) { |
3397 |
+ if (enable && sensor->pending_mode_change) { |
3398 |
+- ret = ov5640_set_mode(sensor, sensor->current_mode); |
3399 |
++ ret = ov5640_set_mode(sensor); |
3400 |
+ if (ret) |
3401 |
+ goto out; |
3402 |
++ } |
3403 |
+ |
3404 |
++ if (enable && sensor->pending_fmt_change) { |
3405 |
+ ret = ov5640_set_framefmt(sensor, &sensor->fmt); |
3406 |
+ if (ret) |
3407 |
+ goto out; |
3408 |
++ sensor->pending_fmt_change = false; |
3409 |
+ } |
3410 |
+ |
3411 |
+ if (sensor->ep.bus_type == V4L2_MBUS_CSI2) |
3412 |
+@@ -2642,9 +2652,14 @@ static int ov5640_probe(struct i2c_client *client, |
3413 |
+ return -ENOMEM; |
3414 |
+ |
3415 |
+ sensor->i2c_client = client; |
3416 |
++ |
3417 |
++ /* |
3418 |
++ * default init sequence initialize sensor to |
3419 |
++ * YUV422 UYVY VGA@30fps |
3420 |
++ */ |
3421 |
+ fmt = &sensor->fmt; |
3422 |
+- fmt->code = ov5640_formats[0].code; |
3423 |
+- fmt->colorspace = ov5640_formats[0].colorspace; |
3424 |
++ fmt->code = MEDIA_BUS_FMT_UYVY8_2X8; |
3425 |
++ fmt->colorspace = V4L2_COLORSPACE_SRGB; |
3426 |
+ fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt->colorspace); |
3427 |
+ fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE; |
3428 |
+ fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(fmt->colorspace); |
3429 |
+@@ -2656,7 +2671,7 @@ static int ov5640_probe(struct i2c_client *client, |
3430 |
+ sensor->current_fr = OV5640_30_FPS; |
3431 |
+ sensor->current_mode = |
3432 |
+ &ov5640_mode_data[OV5640_30_FPS][OV5640_MODE_VGA_640_480]; |
3433 |
+- sensor->pending_mode_change = true; |
3434 |
++ sensor->last_mode = sensor->current_mode; |
3435 |
+ |
3436 |
+ sensor->ae_target = 52; |
3437 |
+ |
3438 |
+diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c |
3439 |
+index 805bd9c65940..8b450fc53202 100644 |
3440 |
+--- a/drivers/media/i2c/tvp5150.c |
3441 |
++++ b/drivers/media/i2c/tvp5150.c |
3442 |
+@@ -901,9 +901,6 @@ static int tvp5150_set_selection(struct v4l2_subdev *sd, |
3443 |
+ |
3444 |
+ /* tvp5150 has some special limits */ |
3445 |
+ rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT); |
3446 |
+- rect.width = clamp_t(unsigned int, rect.width, |
3447 |
+- TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left, |
3448 |
+- TVP5150_H_MAX - rect.left); |
3449 |
+ rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP); |
3450 |
+ |
3451 |
+ /* Calculate height based on current standard */ |
3452 |
+@@ -917,9 +914,16 @@ static int tvp5150_set_selection(struct v4l2_subdev *sd, |
3453 |
+ else |
3454 |
+ hmax = TVP5150_V_MAX_OTHERS; |
3455 |
+ |
3456 |
+- rect.height = clamp_t(unsigned int, rect.height, |
3457 |
++ /* |
3458 |
++ * alignments: |
3459 |
++ * - width = 2 due to UYVY colorspace |
3460 |
++ * - height, image = no special alignment |
3461 |
++ */ |
3462 |
++ v4l_bound_align_image(&rect.width, |
3463 |
++ TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left, |
3464 |
++ TVP5150_H_MAX - rect.left, 1, &rect.height, |
3465 |
+ hmax - TVP5150_MAX_CROP_TOP - rect.top, |
3466 |
+- hmax - rect.top); |
3467 |
++ hmax - rect.top, 0, 0); |
3468 |
+ |
3469 |
+ tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top); |
3470 |
+ tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP, |
3471 |
+diff --git a/drivers/media/pci/cx23885/altera-ci.c b/drivers/media/pci/cx23885/altera-ci.c |
3472 |
+index 62bc8049b320..198c05e83f5c 100644 |
3473 |
+--- a/drivers/media/pci/cx23885/altera-ci.c |
3474 |
++++ b/drivers/media/pci/cx23885/altera-ci.c |
3475 |
+@@ -665,6 +665,10 @@ static int altera_hw_filt_init(struct altera_ci_config *config, int hw_filt_nr) |
3476 |
+ } |
3477 |
+ |
3478 |
+ temp_int = append_internal(inter); |
3479 |
++ if (!temp_int) { |
3480 |
++ ret = -ENOMEM; |
3481 |
++ goto err; |
3482 |
++ } |
3483 |
+ inter->filts_used = 1; |
3484 |
+ inter->dev = config->dev; |
3485 |
+ inter->fpga_rw = config->fpga_rw; |
3486 |
+@@ -699,6 +703,7 @@ err: |
3487 |
+ __func__, ret); |
3488 |
+ |
3489 |
+ kfree(pid_filt); |
3490 |
++ kfree(inter); |
3491 |
+ |
3492 |
+ return ret; |
3493 |
+ } |
3494 |
+@@ -733,6 +738,10 @@ int altera_ci_init(struct altera_ci_config *config, int ci_nr) |
3495 |
+ } |
3496 |
+ |
3497 |
+ temp_int = append_internal(inter); |
3498 |
++ if (!temp_int) { |
3499 |
++ ret = -ENOMEM; |
3500 |
++ goto err; |
3501 |
++ } |
3502 |
+ inter->cis_used = 1; |
3503 |
+ inter->dev = config->dev; |
3504 |
+ inter->fpga_rw = config->fpga_rw; |
3505 |
+@@ -801,6 +810,7 @@ err: |
3506 |
+ ci_dbg_print("%s: Cannot initialize CI: Error %d.\n", __func__, ret); |
3507 |
+ |
3508 |
+ kfree(state); |
3509 |
++ kfree(inter); |
3510 |
+ |
3511 |
+ return ret; |
3512 |
+ } |
3513 |
+diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c |
3514 |
+index 726b3b93a486..bf7b8417c27f 100644 |
3515 |
+--- a/drivers/media/platform/coda/coda-common.c |
3516 |
++++ b/drivers/media/platform/coda/coda-common.c |
3517 |
+@@ -1804,7 +1804,8 @@ static int coda_s_ctrl(struct v4l2_ctrl *ctrl) |
3518 |
+ break; |
3519 |
+ case V4L2_CID_MPEG_VIDEO_H264_PROFILE: |
3520 |
+ /* TODO: switch between baseline and constrained baseline */ |
3521 |
+- ctx->params.h264_profile_idc = 66; |
3522 |
++ if (ctx->inst_type == CODA_INST_ENCODER) |
3523 |
++ ctx->params.h264_profile_idc = 66; |
3524 |
+ break; |
3525 |
+ case V4L2_CID_MPEG_VIDEO_H264_LEVEL: |
3526 |
+ /* nothing to do, this is set by the encoder */ |
3527 |
+diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig |
3528 |
+index e514d57a0419..aa983422aa97 100644 |
3529 |
+--- a/drivers/mtd/devices/Kconfig |
3530 |
++++ b/drivers/mtd/devices/Kconfig |
3531 |
+@@ -207,7 +207,7 @@ comment "Disk-On-Chip Device Drivers" |
3532 |
+ config MTD_DOCG3 |
3533 |
+ tristate "M-Systems Disk-On-Chip G3" |
3534 |
+ select BCH |
3535 |
+- select BCH_CONST_PARAMS |
3536 |
++ select BCH_CONST_PARAMS if !MTD_NAND_BCH |
3537 |
+ select BITREVERSE |
3538 |
+ help |
3539 |
+ This provides an MTD device driver for the M-Systems DiskOnChip |
3540 |
+diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c |
3541 |
+index 8e714fbfa521..6e9cbd1a0b6d 100644 |
3542 |
+--- a/drivers/mtd/spi-nor/cadence-quadspi.c |
3543 |
++++ b/drivers/mtd/spi-nor/cadence-quadspi.c |
3544 |
+@@ -996,7 +996,7 @@ static int cqspi_direct_read_execute(struct spi_nor *nor, u_char *buf, |
3545 |
+ err_unmap: |
3546 |
+ dma_unmap_single(nor->dev, dma_dst, len, DMA_DEV_TO_MEM); |
3547 |
+ |
3548 |
+- return 0; |
3549 |
++ return ret; |
3550 |
+ } |
3551 |
+ |
3552 |
+ static ssize_t cqspi_read(struct spi_nor *nor, loff_t from, |
3553 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
3554 |
+index ee28ec9e0aba..3c597569cfae 100644 |
3555 |
+--- a/drivers/net/bonding/bond_main.c |
3556 |
++++ b/drivers/net/bonding/bond_main.c |
3557 |
+@@ -3111,13 +3111,13 @@ static int bond_slave_netdev_event(unsigned long event, |
3558 |
+ case NETDEV_CHANGE: |
3559 |
+ /* For 802.3ad mode only: |
3560 |
+ * Getting invalid Speed/Duplex values here will put slave |
3561 |
+- * in weird state. So mark it as link-down for the time |
3562 |
++ * in weird state. So mark it as link-fail for the time |
3563 |
+ * being and let link-monitoring (miimon) set it right when |
3564 |
+ * correct speeds/duplex are available. |
3565 |
+ */ |
3566 |
+ if (bond_update_speed_duplex(slave) && |
3567 |
+ BOND_MODE(bond) == BOND_MODE_8023AD) |
3568 |
+- slave->link = BOND_LINK_DOWN; |
3569 |
++ slave->link = BOND_LINK_FAIL; |
3570 |
+ |
3571 |
+ if (BOND_MODE(bond) == BOND_MODE_8023AD) |
3572 |
+ bond_3ad_adapter_speed_duplex_changed(slave); |
3573 |
+diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c |
3574 |
+index 27d9b4bba535..2411ed3c7303 100644 |
3575 |
+--- a/drivers/of/of_numa.c |
3576 |
++++ b/drivers/of/of_numa.c |
3577 |
+@@ -115,9 +115,14 @@ static int __init of_numa_parse_distance_map_v1(struct device_node *map) |
3578 |
+ distance = of_read_number(matrix, 1); |
3579 |
+ matrix++; |
3580 |
+ |
3581 |
++ if ((nodea == nodeb && distance != LOCAL_DISTANCE) || |
3582 |
++ (nodea != nodeb && distance <= LOCAL_DISTANCE)) { |
3583 |
++ pr_err("Invalid distance[node%d -> node%d] = %d\n", |
3584 |
++ nodea, nodeb, distance); |
3585 |
++ return -EINVAL; |
3586 |
++ } |
3587 |
++ |
3588 |
+ numa_set_distance(nodea, nodeb, distance); |
3589 |
+- pr_debug("distance[node%d -> node%d] = %d\n", |
3590 |
+- nodea, nodeb, distance); |
3591 |
+ |
3592 |
+ /* Set default distance of node B->A same as A->B */ |
3593 |
+ if (nodeb > nodea) |
3594 |
+diff --git a/drivers/rtc/hctosys.c b/drivers/rtc/hctosys.c |
3595 |
+index e79f2a181ad2..b9ec4a16db1f 100644 |
3596 |
+--- a/drivers/rtc/hctosys.c |
3597 |
++++ b/drivers/rtc/hctosys.c |
3598 |
+@@ -50,8 +50,10 @@ static int __init rtc_hctosys(void) |
3599 |
+ tv64.tv_sec = rtc_tm_to_time64(&tm); |
3600 |
+ |
3601 |
+ #if BITS_PER_LONG == 32 |
3602 |
+- if (tv64.tv_sec > INT_MAX) |
3603 |
++ if (tv64.tv_sec > INT_MAX) { |
3604 |
++ err = -ERANGE; |
3605 |
+ goto err_read; |
3606 |
++ } |
3607 |
+ #endif |
3608 |
+ |
3609 |
+ err = do_settimeofday64(&tv64); |
3610 |
+diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c |
3611 |
+index c11a89be292c..4a9fd8d944d6 100644 |
3612 |
+--- a/drivers/scsi/qla2xxx/qla_bsg.c |
3613 |
++++ b/drivers/scsi/qla2xxx/qla_bsg.c |
3614 |
+@@ -2487,7 +2487,7 @@ qla24xx_bsg_request(struct bsg_job *bsg_job) |
3615 |
+ vha = shost_priv(host); |
3616 |
+ } |
3617 |
+ |
3618 |
+- if (qla2x00_reset_active(vha)) { |
3619 |
++ if (qla2x00_chip_is_down(vha)) { |
3620 |
+ ql_dbg(ql_dbg_user, vha, 0x709f, |
3621 |
+ "BSG: ISP abort active/needed -- cmd=%d.\n", |
3622 |
+ bsg_request->msgcode); |
3623 |
+diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c |
3624 |
+index a0038d879b9d..de3f2a097451 100644 |
3625 |
+--- a/drivers/scsi/qla2xxx/qla_gs.c |
3626 |
++++ b/drivers/scsi/qla2xxx/qla_gs.c |
3627 |
+@@ -3261,6 +3261,9 @@ static void qla24xx_async_gpsc_sp_done(void *s, int res) |
3628 |
+ "Async done-%s res %x, WWPN %8phC \n", |
3629 |
+ sp->name, res, fcport->port_name); |
3630 |
+ |
3631 |
++ if (res == QLA_FUNCTION_TIMEOUT) |
3632 |
++ return; |
3633 |
++ |
3634 |
+ if (res == (DID_ERROR << 16)) { |
3635 |
+ /* entry status error */ |
3636 |
+ goto done; |
3637 |
+@@ -4444,9 +4447,9 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp) |
3638 |
+ sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout; |
3639 |
+ qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2); |
3640 |
+ |
3641 |
+- rspsz = sizeof(struct ct_sns_gpnft_rsp) + |
3642 |
+- ((vha->hw->max_fibre_devices - 1) * |
3643 |
+- sizeof(struct ct_sns_gpn_ft_data)); |
3644 |
++ rspsz = sp->u.iocb_cmd.u.ctarg.rsp_size; |
3645 |
++ memset(sp->u.iocb_cmd.u.ctarg.rsp, 0, sp->u.iocb_cmd.u.ctarg.rsp_size); |
3646 |
++ memset(sp->u.iocb_cmd.u.ctarg.req, 0, sp->u.iocb_cmd.u.ctarg.req_size); |
3647 |
+ |
3648 |
+ ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.req; |
3649 |
+ /* CT_IU preamble */ |
3650 |
+diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c |
3651 |
+index b934977c5c26..5352c9bbcaf7 100644 |
3652 |
+--- a/drivers/scsi/qla2xxx/qla_init.c |
3653 |
++++ b/drivers/scsi/qla2xxx/qla_init.c |
3654 |
+@@ -52,12 +52,14 @@ qla2x00_sp_timeout(struct timer_list *t) |
3655 |
+ struct srb_iocb *iocb; |
3656 |
+ struct req_que *req; |
3657 |
+ unsigned long flags; |
3658 |
++ struct qla_hw_data *ha = sp->vha->hw; |
3659 |
+ |
3660 |
+- spin_lock_irqsave(sp->qpair->qp_lock_ptr, flags); |
3661 |
++ WARN_ON(irqs_disabled()); |
3662 |
++ spin_lock_irqsave(&ha->hardware_lock, flags); |
3663 |
+ req = sp->qpair->req; |
3664 |
+ req->outstanding_cmds[sp->handle] = NULL; |
3665 |
+ iocb = &sp->u.iocb_cmd; |
3666 |
+- spin_unlock_irqrestore(sp->qpair->qp_lock_ptr, flags); |
3667 |
++ spin_unlock_irqrestore(&ha->hardware_lock, flags); |
3668 |
+ iocb->timeout(sp); |
3669 |
+ } |
3670 |
+ |
3671 |
+@@ -972,6 +974,15 @@ void qla24xx_async_gpdb_sp_done(void *s, int res) |
3672 |
+ |
3673 |
+ fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); |
3674 |
+ |
3675 |
++ if (res == QLA_FUNCTION_TIMEOUT) |
3676 |
++ return; |
3677 |
++ |
3678 |
++ if (res == QLA_FUNCTION_TIMEOUT) { |
3679 |
++ dma_pool_free(sp->vha->hw->s_dma_pool, sp->u.iocb_cmd.u.mbx.in, |
3680 |
++ sp->u.iocb_cmd.u.mbx.in_dma); |
3681 |
++ return; |
3682 |
++ } |
3683 |
++ |
3684 |
+ memset(&ea, 0, sizeof(ea)); |
3685 |
+ ea.event = FCME_GPDB_DONE; |
3686 |
+ ea.fcport = fcport; |
3687 |
+@@ -1788,6 +1799,8 @@ qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait) |
3688 |
+ wait_for_completion(&abt_iocb->u.abt.comp); |
3689 |
+ rval = abt_iocb->u.abt.comp_status == CS_COMPLETE ? |
3690 |
+ QLA_SUCCESS : QLA_FUNCTION_FAILED; |
3691 |
++ } else { |
3692 |
++ goto done; |
3693 |
+ } |
3694 |
+ |
3695 |
+ done_free_sp: |
3696 |
+@@ -1952,25 +1965,15 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea) |
3697 |
+ cid.b.rsvd_1 = 0; |
3698 |
+ |
3699 |
+ ql_dbg(ql_dbg_disc, vha, 0x20ec, |
3700 |
+- "%s %d %8phC LoopID 0x%x in use post gnl\n", |
3701 |
++ "%s %d %8phC lid %#x in use with pid %06x post gnl\n", |
3702 |
+ __func__, __LINE__, ea->fcport->port_name, |
3703 |
+- ea->fcport->loop_id); |
3704 |
++ ea->fcport->loop_id, cid.b24); |
3705 |
+ |
3706 |
+- if (IS_SW_RESV_ADDR(cid)) { |
3707 |
+- set_bit(ea->fcport->loop_id, vha->hw->loop_id_map); |
3708 |
+- ea->fcport->loop_id = FC_NO_LOOP_ID; |
3709 |
+- } else { |
3710 |
+- qla2x00_clear_loop_id(ea->fcport); |
3711 |
+- } |
3712 |
++ set_bit(ea->fcport->loop_id, vha->hw->loop_id_map); |
3713 |
++ ea->fcport->loop_id = FC_NO_LOOP_ID; |
3714 |
+ qla24xx_post_gnl_work(vha, ea->fcport); |
3715 |
+ break; |
3716 |
+ case MBS_PORT_ID_USED: |
3717 |
+- ql_dbg(ql_dbg_disc, vha, 0x20ed, |
3718 |
+- "%s %d %8phC NPortId %02x%02x%02x inuse post gidpn\n", |
3719 |
+- __func__, __LINE__, ea->fcport->port_name, |
3720 |
+- ea->fcport->d_id.b.domain, ea->fcport->d_id.b.area, |
3721 |
+- ea->fcport->d_id.b.al_pa); |
3722 |
+- |
3723 |
+ lid = ea->iop[1] & 0xffff; |
3724 |
+ qlt_find_sess_invalidate_other(vha, |
3725 |
+ wwn_to_u64(ea->fcport->port_name), |
3726 |
+@@ -4711,6 +4714,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags) |
3727 |
+ fcport->loop_id = FC_NO_LOOP_ID; |
3728 |
+ qla2x00_set_fcport_state(fcport, FCS_UNCONFIGURED); |
3729 |
+ fcport->supported_classes = FC_COS_UNSPECIFIED; |
3730 |
++ fcport->fp_speed = PORT_SPEED_UNKNOWN; |
3731 |
+ |
3732 |
+ fcport->ct_desc.ct_sns = dma_alloc_coherent(&vha->hw->pdev->dev, |
3733 |
+ sizeof(struct ct_sns_pkt), &fcport->ct_desc.ct_sns_dma, |
3734 |
+@@ -6682,7 +6686,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) |
3735 |
+ * The next call disables the board |
3736 |
+ * completely. |
3737 |
+ */ |
3738 |
+- ha->isp_ops->reset_adapter(vha); |
3739 |
++ qla2x00_abort_isp_cleanup(vha); |
3740 |
+ vha->flags.online = 0; |
3741 |
+ clear_bit(ISP_ABORT_RETRY, |
3742 |
+ &vha->dpc_flags); |
3743 |
+@@ -7142,7 +7146,6 @@ qla24xx_nvram_config(scsi_qla_host_t *vha) |
3744 |
+ } |
3745 |
+ icb->firmware_options_2 &= cpu_to_le32( |
3746 |
+ ~(BIT_3 | BIT_2 | BIT_1 | BIT_0)); |
3747 |
+- vha->flags.process_response_queue = 0; |
3748 |
+ if (ha->zio_mode != QLA_ZIO_DISABLED) { |
3749 |
+ ha->zio_mode = QLA_ZIO_MODE_6; |
3750 |
+ |
3751 |
+@@ -7153,7 +7156,6 @@ qla24xx_nvram_config(scsi_qla_host_t *vha) |
3752 |
+ icb->firmware_options_2 |= cpu_to_le32( |
3753 |
+ (uint32_t)ha->zio_mode); |
3754 |
+ icb->interrupt_delay_timer = cpu_to_le16(ha->zio_timer); |
3755 |
+- vha->flags.process_response_queue = 1; |
3756 |
+ } |
3757 |
+ |
3758 |
+ if (rval) { |
3759 |
+diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c |
3760 |
+index 42ac8e097419..119927220299 100644 |
3761 |
+--- a/drivers/scsi/qla2xxx/qla_iocb.c |
3762 |
++++ b/drivers/scsi/qla2xxx/qla_iocb.c |
3763 |
+@@ -1526,12 +1526,6 @@ qla24xx_start_scsi(srb_t *sp) |
3764 |
+ |
3765 |
+ /* Set chip new ring index. */ |
3766 |
+ WRT_REG_DWORD(req->req_q_in, req->ring_index); |
3767 |
+- RD_REG_DWORD_RELAXED(&ha->iobase->isp24.hccr); |
3768 |
+- |
3769 |
+- /* Manage unprocessed RIO/ZIO commands in response queue. */ |
3770 |
+- if (vha->flags.process_response_queue && |
3771 |
+- rsp->ring_ptr->signature != RESPONSE_PROCESSED) |
3772 |
+- qla24xx_process_response_queue(vha, rsp); |
3773 |
+ |
3774 |
+ spin_unlock_irqrestore(&ha->hardware_lock, flags); |
3775 |
+ return QLA_SUCCESS; |
3776 |
+@@ -1725,12 +1719,6 @@ qla24xx_dif_start_scsi(srb_t *sp) |
3777 |
+ |
3778 |
+ /* Set chip new ring index. */ |
3779 |
+ WRT_REG_DWORD(req->req_q_in, req->ring_index); |
3780 |
+- RD_REG_DWORD_RELAXED(&ha->iobase->isp24.hccr); |
3781 |
+- |
3782 |
+- /* Manage unprocessed RIO/ZIO commands in response queue. */ |
3783 |
+- if (vha->flags.process_response_queue && |
3784 |
+- rsp->ring_ptr->signature != RESPONSE_PROCESSED) |
3785 |
+- qla24xx_process_response_queue(vha, rsp); |
3786 |
+ |
3787 |
+ spin_unlock_irqrestore(&ha->hardware_lock, flags); |
3788 |
+ |
3789 |
+@@ -1880,11 +1868,6 @@ qla2xxx_start_scsi_mq(srb_t *sp) |
3790 |
+ /* Set chip new ring index. */ |
3791 |
+ WRT_REG_DWORD(req->req_q_in, req->ring_index); |
3792 |
+ |
3793 |
+- /* Manage unprocessed RIO/ZIO commands in response queue. */ |
3794 |
+- if (vha->flags.process_response_queue && |
3795 |
+- rsp->ring_ptr->signature != RESPONSE_PROCESSED) |
3796 |
+- qla24xx_process_response_queue(vha, rsp); |
3797 |
+- |
3798 |
+ spin_unlock_irqrestore(&qpair->qp_lock, flags); |
3799 |
+ return QLA_SUCCESS; |
3800 |
+ |
3801 |
+diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c |
3802 |
+index 596a9b214df1..84f57f075455 100644 |
3803 |
+--- a/drivers/scsi/qla2xxx/qla_mbx.c |
3804 |
++++ b/drivers/scsi/qla2xxx/qla_mbx.c |
3805 |
+@@ -3762,10 +3762,7 @@ qla2x00_set_idma_speed(scsi_qla_host_t *vha, uint16_t loop_id, |
3806 |
+ mcp->mb[0] = MBC_PORT_PARAMS; |
3807 |
+ mcp->mb[1] = loop_id; |
3808 |
+ mcp->mb[2] = BIT_0; |
3809 |
+- if (IS_CNA_CAPABLE(vha->hw)) |
3810 |
+- mcp->mb[3] = port_speed & (BIT_5|BIT_4|BIT_3|BIT_2|BIT_1|BIT_0); |
3811 |
+- else |
3812 |
+- mcp->mb[3] = port_speed & (BIT_2|BIT_1|BIT_0); |
3813 |
++ mcp->mb[3] = port_speed & (BIT_5|BIT_4|BIT_3|BIT_2|BIT_1|BIT_0); |
3814 |
+ mcp->mb[9] = vha->vp_idx; |
3815 |
+ mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0; |
3816 |
+ mcp->in_mb = MBX_3|MBX_1|MBX_0; |
3817 |
+diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c |
3818 |
+index 20d9dc39f0fb..e6545cb9a2c1 100644 |
3819 |
+--- a/drivers/scsi/qla2xxx/qla_nvme.c |
3820 |
++++ b/drivers/scsi/qla2xxx/qla_nvme.c |
3821 |
+@@ -607,7 +607,7 @@ void qla_nvme_abort(struct qla_hw_data *ha, struct srb *sp, int res) |
3822 |
+ { |
3823 |
+ int rval; |
3824 |
+ |
3825 |
+- if (!test_bit(ABORT_ISP_ACTIVE, &sp->vha->dpc_flags)) { |
3826 |
++ if (ha->flags.fw_started) { |
3827 |
+ rval = ha->isp_ops->abort_command(sp); |
3828 |
+ if (!rval && !qla_nvme_wait_on_command(sp)) |
3829 |
+ ql_log(ql_log_warn, NULL, 0x2112, |
3830 |
+@@ -660,9 +660,6 @@ void qla_nvme_delete(struct scsi_qla_host *vha) |
3831 |
+ __func__, fcport); |
3832 |
+ |
3833 |
+ nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, 0); |
3834 |
+- init_completion(&fcport->nvme_del_done); |
3835 |
+- nvme_fc_unregister_remoteport(fcport->nvme_remote_port); |
3836 |
+- wait_for_completion(&fcport->nvme_del_done); |
3837 |
+ } |
3838 |
+ |
3839 |
+ if (vha->nvme_local_port) { |
3840 |
+diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c |
3841 |
+index 42b8f0d3e580..ae9fd2d01004 100644 |
3842 |
+--- a/drivers/scsi/qla2xxx/qla_os.c |
3843 |
++++ b/drivers/scsi/qla2xxx/qla_os.c |
3844 |
+@@ -4808,10 +4808,10 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) |
3845 |
+ fcport->d_id = e->u.new_sess.id; |
3846 |
+ fcport->flags |= FCF_FABRIC_DEVICE; |
3847 |
+ fcport->fw_login_state = DSC_LS_PLOGI_PEND; |
3848 |
+- if (e->u.new_sess.fc4_type == FS_FC4TYPE_FCP) |
3849 |
++ if (e->u.new_sess.fc4_type & FS_FC4TYPE_FCP) |
3850 |
+ fcport->fc4_type = FC4_TYPE_FCP_SCSI; |
3851 |
+ |
3852 |
+- if (e->u.new_sess.fc4_type == FS_FC4TYPE_NVME) { |
3853 |
++ if (e->u.new_sess.fc4_type & FS_FC4TYPE_NVME) { |
3854 |
+ fcport->fc4_type = FC4_TYPE_OTHER; |
3855 |
+ fcport->fc4f_nvme = FC4_TYPE_NVME; |
3856 |
+ } |
3857 |
+diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
3858 |
+index 8c811b251d42..d2888b30a8a3 100644 |
3859 |
+--- a/drivers/scsi/qla2xxx/qla_target.c |
3860 |
++++ b/drivers/scsi/qla2xxx/qla_target.c |
3861 |
+@@ -1261,7 +1261,8 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess) |
3862 |
+ qla24xx_chk_fcp_state(sess); |
3863 |
+ |
3864 |
+ ql_dbg(ql_dbg_tgt, sess->vha, 0xe001, |
3865 |
+- "Scheduling sess %p for deletion\n", sess); |
3866 |
++ "Scheduling sess %p for deletion %8phC\n", |
3867 |
++ sess, sess->port_name); |
3868 |
+ |
3869 |
+ INIT_WORK(&sess->del_work, qla24xx_delete_sess_fn); |
3870 |
+ WARN_ON(!queue_work(sess->vha->hw->wq, &sess->del_work)); |
3871 |
+diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
3872 |
+index e03d12a5f986..64e2d859f633 100644 |
3873 |
+--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
3874 |
++++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
3875 |
+@@ -718,10 +718,6 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd) |
3876 |
+ cmd->sg_cnt = 0; |
3877 |
+ cmd->offset = 0; |
3878 |
+ cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); |
3879 |
+- if (cmd->trc_flags & TRC_XMIT_STATUS) { |
3880 |
+- pr_crit("Multiple calls for status = %p.\n", cmd); |
3881 |
+- dump_stack(); |
3882 |
+- } |
3883 |
+ cmd->trc_flags |= TRC_XMIT_STATUS; |
3884 |
+ |
3885 |
+ if (se_cmd->data_direction == DMA_FROM_DEVICE) { |
3886 |
+diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c |
3887 |
+index eb97d2dd3651..b5f638286037 100644 |
3888 |
+--- a/drivers/scsi/scsi_lib.c |
3889 |
++++ b/drivers/scsi/scsi_lib.c |
3890 |
+@@ -697,6 +697,12 @@ static bool scsi_end_request(struct request *req, blk_status_t error, |
3891 |
+ */ |
3892 |
+ scsi_mq_uninit_cmd(cmd); |
3893 |
+ |
3894 |
++ /* |
3895 |
++ * queue is still alive, so grab the ref for preventing it |
3896 |
++ * from being cleaned up during running queue. |
3897 |
++ */ |
3898 |
++ percpu_ref_get(&q->q_usage_counter); |
3899 |
++ |
3900 |
+ __blk_mq_end_request(req, error); |
3901 |
+ |
3902 |
+ if (scsi_target(sdev)->single_lun || |
3903 |
+@@ -704,6 +710,8 @@ static bool scsi_end_request(struct request *req, blk_status_t error, |
3904 |
+ kblockd_schedule_work(&sdev->requeue_work); |
3905 |
+ else |
3906 |
+ blk_mq_run_hw_queues(q, true); |
3907 |
++ |
3908 |
++ percpu_ref_put(&q->q_usage_counter); |
3909 |
+ } else { |
3910 |
+ unsigned long flags; |
3911 |
+ |
3912 |
+diff --git a/drivers/soc/ti/knav_qmss.h b/drivers/soc/ti/knav_qmss.h |
3913 |
+index 3efc47e82973..bd040c29c4bf 100644 |
3914 |
+--- a/drivers/soc/ti/knav_qmss.h |
3915 |
++++ b/drivers/soc/ti/knav_qmss.h |
3916 |
+@@ -329,8 +329,8 @@ struct knav_range_ops { |
3917 |
+ }; |
3918 |
+ |
3919 |
+ struct knav_irq_info { |
3920 |
+- int irq; |
3921 |
+- u32 cpu_map; |
3922 |
++ int irq; |
3923 |
++ struct cpumask *cpu_mask; |
3924 |
+ }; |
3925 |
+ |
3926 |
+ struct knav_range_info { |
3927 |
+diff --git a/drivers/soc/ti/knav_qmss_acc.c b/drivers/soc/ti/knav_qmss_acc.c |
3928 |
+index 316e82e46f6c..2f7fb2dcc1d6 100644 |
3929 |
+--- a/drivers/soc/ti/knav_qmss_acc.c |
3930 |
++++ b/drivers/soc/ti/knav_qmss_acc.c |
3931 |
+@@ -205,18 +205,18 @@ static int knav_range_setup_acc_irq(struct knav_range_info *range, |
3932 |
+ { |
3933 |
+ struct knav_device *kdev = range->kdev; |
3934 |
+ struct knav_acc_channel *acc; |
3935 |
+- unsigned long cpu_map; |
3936 |
++ struct cpumask *cpu_mask; |
3937 |
+ int ret = 0, irq; |
3938 |
+ u32 old, new; |
3939 |
+ |
3940 |
+ if (range->flags & RANGE_MULTI_QUEUE) { |
3941 |
+ acc = range->acc; |
3942 |
+ irq = range->irqs[0].irq; |
3943 |
+- cpu_map = range->irqs[0].cpu_map; |
3944 |
++ cpu_mask = range->irqs[0].cpu_mask; |
3945 |
+ } else { |
3946 |
+ acc = range->acc + queue; |
3947 |
+ irq = range->irqs[queue].irq; |
3948 |
+- cpu_map = range->irqs[queue].cpu_map; |
3949 |
++ cpu_mask = range->irqs[queue].cpu_mask; |
3950 |
+ } |
3951 |
+ |
3952 |
+ old = acc->open_mask; |
3953 |
+@@ -239,8 +239,8 @@ static int knav_range_setup_acc_irq(struct knav_range_info *range, |
3954 |
+ acc->name, acc->name); |
3955 |
+ ret = request_irq(irq, knav_acc_int_handler, 0, acc->name, |
3956 |
+ range); |
3957 |
+- if (!ret && cpu_map) { |
3958 |
+- ret = irq_set_affinity_hint(irq, to_cpumask(&cpu_map)); |
3959 |
++ if (!ret && cpu_mask) { |
3960 |
++ ret = irq_set_affinity_hint(irq, cpu_mask); |
3961 |
+ if (ret) { |
3962 |
+ dev_warn(range->kdev->dev, |
3963 |
+ "Failed to set IRQ affinity\n"); |
3964 |
+diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c |
3965 |
+index 6755f2af5619..ef36acc0e708 100644 |
3966 |
+--- a/drivers/soc/ti/knav_qmss_queue.c |
3967 |
++++ b/drivers/soc/ti/knav_qmss_queue.c |
3968 |
+@@ -118,19 +118,17 @@ static int knav_queue_setup_irq(struct knav_range_info *range, |
3969 |
+ struct knav_queue_inst *inst) |
3970 |
+ { |
3971 |
+ unsigned queue = inst->id - range->queue_base; |
3972 |
+- unsigned long cpu_map; |
3973 |
+ int ret = 0, irq; |
3974 |
+ |
3975 |
+ if (range->flags & RANGE_HAS_IRQ) { |
3976 |
+ irq = range->irqs[queue].irq; |
3977 |
+- cpu_map = range->irqs[queue].cpu_map; |
3978 |
+ ret = request_irq(irq, knav_queue_int_handler, 0, |
3979 |
+ inst->irq_name, inst); |
3980 |
+ if (ret) |
3981 |
+ return ret; |
3982 |
+ disable_irq(irq); |
3983 |
+- if (cpu_map) { |
3984 |
+- ret = irq_set_affinity_hint(irq, to_cpumask(&cpu_map)); |
3985 |
++ if (range->irqs[queue].cpu_mask) { |
3986 |
++ ret = irq_set_affinity_hint(irq, range->irqs[queue].cpu_mask); |
3987 |
+ if (ret) { |
3988 |
+ dev_warn(range->kdev->dev, |
3989 |
+ "Failed to set IRQ affinity\n"); |
3990 |
+@@ -1262,9 +1260,19 @@ static int knav_setup_queue_range(struct knav_device *kdev, |
3991 |
+ |
3992 |
+ range->num_irqs++; |
3993 |
+ |
3994 |
+- if (IS_ENABLED(CONFIG_SMP) && oirq.args_count == 3) |
3995 |
+- range->irqs[i].cpu_map = |
3996 |
+- (oirq.args[2] & 0x0000ff00) >> 8; |
3997 |
++ if (IS_ENABLED(CONFIG_SMP) && oirq.args_count == 3) { |
3998 |
++ unsigned long mask; |
3999 |
++ int bit; |
4000 |
++ |
4001 |
++ range->irqs[i].cpu_mask = devm_kzalloc(dev, |
4002 |
++ cpumask_size(), GFP_KERNEL); |
4003 |
++ if (!range->irqs[i].cpu_mask) |
4004 |
++ return -ENOMEM; |
4005 |
++ |
4006 |
++ mask = (oirq.args[2] & 0x0000ff00) >> 8; |
4007 |
++ for_each_set_bit(bit, &mask, BITS_PER_LONG) |
4008 |
++ cpumask_set_cpu(bit, range->irqs[i].cpu_mask); |
4009 |
++ } |
4010 |
+ } |
4011 |
+ |
4012 |
+ range->num_irqs = min(range->num_irqs, range->num_queues); |
4013 |
+diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c |
4014 |
+index 8721f0a41d15..14da8cc2246a 100644 |
4015 |
+--- a/drivers/staging/erofs/unzip_vle.c |
4016 |
++++ b/drivers/staging/erofs/unzip_vle.c |
4017 |
+@@ -1490,6 +1490,7 @@ static erofs_off_t vle_get_logical_extent_head( |
4018 |
+ unsigned long long ofs; |
4019 |
+ const unsigned int clusterbits = EROFS_SB(inode->i_sb)->clusterbits; |
4020 |
+ const unsigned int clustersize = 1 << clusterbits; |
4021 |
++ unsigned int delta0; |
4022 |
+ |
4023 |
+ if (page->index != blkaddr) { |
4024 |
+ kunmap_atomic(*kaddr_iter); |
4025 |
+@@ -1504,12 +1505,13 @@ static erofs_off_t vle_get_logical_extent_head( |
4026 |
+ di = *kaddr_iter + vle_extent_blkoff(inode, lcn); |
4027 |
+ switch (vle_cluster_type(di)) { |
4028 |
+ case Z_EROFS_VLE_CLUSTER_TYPE_NONHEAD: |
4029 |
+- BUG_ON(!di->di_u.delta[0]); |
4030 |
+- BUG_ON(lcn < di->di_u.delta[0]); |
4031 |
++ delta0 = le16_to_cpu(di->di_u.delta[0]); |
4032 |
++ DBG_BUGON(!delta0); |
4033 |
++ DBG_BUGON(lcn < delta0); |
4034 |
+ |
4035 |
+ ofs = vle_get_logical_extent_head(inode, |
4036 |
+ page_iter, kaddr_iter, |
4037 |
+- lcn - di->di_u.delta[0], pcn, flags); |
4038 |
++ lcn - delta0, pcn, flags); |
4039 |
+ break; |
4040 |
+ case Z_EROFS_VLE_CLUSTER_TYPE_PLAIN: |
4041 |
+ *flags ^= EROFS_MAP_ZIPPED; |
4042 |
+diff --git a/drivers/staging/iio/adc/ad7606.c b/drivers/staging/iio/adc/ad7606.c |
4043 |
+index 25b9fcd5e3a4..ce3351832fb1 100644 |
4044 |
+--- a/drivers/staging/iio/adc/ad7606.c |
4045 |
++++ b/drivers/staging/iio/adc/ad7606.c |
4046 |
+@@ -26,9 +26,12 @@ |
4047 |
+ |
4048 |
+ #include "ad7606.h" |
4049 |
+ |
4050 |
+-/* Scales are computed as 2.5/2**16 and 5/2**16 respectively */ |
4051 |
++/* |
4052 |
++ * Scales are computed as 5000/32768 and 10000/32768 respectively, |
4053 |
++ * so that when applied to the raw values they provide mV values |
4054 |
++ */ |
4055 |
+ static const unsigned int scale_avail[2][2] = { |
4056 |
+- {0, 38147}, {0, 76294} |
4057 |
++ {0, 152588}, {0, 305176} |
4058 |
+ }; |
4059 |
+ |
4060 |
+ static int ad7606_reset(struct ad7606_state *st) |
4061 |
+diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c |
4062 |
+index cf342eb58e10..ad7e28ab9a4f 100644 |
4063 |
+--- a/drivers/staging/most/video/video.c |
4064 |
++++ b/drivers/staging/most/video/video.c |
4065 |
+@@ -530,7 +530,7 @@ static int comp_disconnect_channel(struct most_interface *iface, |
4066 |
+ return 0; |
4067 |
+ } |
4068 |
+ |
4069 |
+-static struct core_component comp_info = { |
4070 |
++static struct core_component comp = { |
4071 |
+ .name = "video", |
4072 |
+ .probe_channel = comp_probe_channel, |
4073 |
+ .disconnect_channel = comp_disconnect_channel, |
4074 |
+@@ -565,7 +565,7 @@ static void __exit comp_exit(void) |
4075 |
+ } |
4076 |
+ spin_unlock_irq(&list_lock); |
4077 |
+ |
4078 |
+- most_deregister_component(&comp_info); |
4079 |
++ most_deregister_component(&comp); |
4080 |
+ BUG_ON(!list_empty(&video_devices)); |
4081 |
+ } |
4082 |
+ |
4083 |
+diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c |
4084 |
+index 6ab982309e6a..441778100887 100644 |
4085 |
+--- a/drivers/thermal/thermal_core.c |
4086 |
++++ b/drivers/thermal/thermal_core.c |
4087 |
+@@ -1102,8 +1102,9 @@ void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) |
4088 |
+ mutex_unlock(&thermal_list_lock); |
4089 |
+ |
4090 |
+ ida_simple_remove(&thermal_cdev_ida, cdev->id); |
4091 |
+- device_unregister(&cdev->device); |
4092 |
++ device_del(&cdev->device); |
4093 |
+ thermal_cooling_device_destroy_sysfs(cdev); |
4094 |
++ put_device(&cdev->device); |
4095 |
+ } |
4096 |
+ EXPORT_SYMBOL_GPL(thermal_cooling_device_unregister); |
4097 |
+ |
4098 |
+diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c |
4099 |
+index af8beefe9b5c..877fd7f8a8ed 100644 |
4100 |
+--- a/drivers/tty/serial/8250/8250_of.c |
4101 |
++++ b/drivers/tty/serial/8250/8250_of.c |
4102 |
+@@ -58,7 +58,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev, |
4103 |
+ struct resource resource; |
4104 |
+ struct device_node *np = ofdev->dev.of_node; |
4105 |
+ u32 clk, spd, prop; |
4106 |
+- int ret; |
4107 |
++ int ret, irq; |
4108 |
+ |
4109 |
+ memset(port, 0, sizeof *port); |
4110 |
+ |
4111 |
+@@ -143,21 +143,27 @@ static int of_platform_serial_setup(struct platform_device *ofdev, |
4112 |
+ if (ret >= 0) |
4113 |
+ port->line = ret; |
4114 |
+ |
4115 |
+- port->irq = irq_of_parse_and_map(np, 0); |
4116 |
+- if (!port->irq) { |
4117 |
+- ret = -EPROBE_DEFER; |
4118 |
+- goto err_unprepare; |
4119 |
++ irq = of_irq_get(np, 0); |
4120 |
++ if (irq < 0) { |
4121 |
++ if (irq == -EPROBE_DEFER) { |
4122 |
++ ret = -EPROBE_DEFER; |
4123 |
++ goto err_unprepare; |
4124 |
++ } |
4125 |
++ /* IRQ support not mandatory */ |
4126 |
++ irq = 0; |
4127 |
+ } |
4128 |
+ |
4129 |
++ port->irq = irq; |
4130 |
++ |
4131 |
+ info->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL); |
4132 |
+ if (IS_ERR(info->rst)) { |
4133 |
+ ret = PTR_ERR(info->rst); |
4134 |
+- goto err_dispose; |
4135 |
++ goto err_unprepare; |
4136 |
+ } |
4137 |
+ |
4138 |
+ ret = reset_control_deassert(info->rst); |
4139 |
+ if (ret) |
4140 |
+- goto err_dispose; |
4141 |
++ goto err_unprepare; |
4142 |
+ |
4143 |
+ port->type = type; |
4144 |
+ port->uartclk = clk; |
4145 |
+@@ -184,8 +190,6 @@ static int of_platform_serial_setup(struct platform_device *ofdev, |
4146 |
+ port->handle_irq = fsl8250_handle_irq; |
4147 |
+ |
4148 |
+ return 0; |
4149 |
+-err_dispose: |
4150 |
+- irq_dispose_mapping(port->irq); |
4151 |
+ err_unprepare: |
4152 |
+ clk_disable_unprepare(info->clk); |
4153 |
+ err_pmruntime: |
4154 |
+diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c |
4155 |
+index 243c96025053..47b41159a8bc 100644 |
4156 |
+--- a/drivers/tty/serial/sc16is7xx.c |
4157 |
++++ b/drivers/tty/serial/sc16is7xx.c |
4158 |
+@@ -657,7 +657,7 @@ static void sc16is7xx_handle_tx(struct uart_port *port) |
4159 |
+ uart_write_wakeup(port); |
4160 |
+ } |
4161 |
+ |
4162 |
+-static void sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) |
4163 |
++static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) |
4164 |
+ { |
4165 |
+ struct uart_port *port = &s->p[portno].port; |
4166 |
+ |
4167 |
+@@ -666,7 +666,7 @@ static void sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) |
4168 |
+ |
4169 |
+ iir = sc16is7xx_port_read(port, SC16IS7XX_IIR_REG); |
4170 |
+ if (iir & SC16IS7XX_IIR_NO_INT_BIT) |
4171 |
+- break; |
4172 |
++ return false; |
4173 |
+ |
4174 |
+ iir &= SC16IS7XX_IIR_ID_MASK; |
4175 |
+ |
4176 |
+@@ -688,16 +688,23 @@ static void sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) |
4177 |
+ port->line, iir); |
4178 |
+ break; |
4179 |
+ } |
4180 |
+- } while (1); |
4181 |
++ } while (0); |
4182 |
++ return true; |
4183 |
+ } |
4184 |
+ |
4185 |
+ static void sc16is7xx_ist(struct kthread_work *ws) |
4186 |
+ { |
4187 |
+ struct sc16is7xx_port *s = to_sc16is7xx_port(ws, irq_work); |
4188 |
+- int i; |
4189 |
+ |
4190 |
+- for (i = 0; i < s->devtype->nr_uart; ++i) |
4191 |
+- sc16is7xx_port_irq(s, i); |
4192 |
++ while (1) { |
4193 |
++ bool keep_polling = false; |
4194 |
++ int i; |
4195 |
++ |
4196 |
++ for (i = 0; i < s->devtype->nr_uart; ++i) |
4197 |
++ keep_polling |= sc16is7xx_port_irq(s, i); |
4198 |
++ if (!keep_polling) |
4199 |
++ break; |
4200 |
++ } |
4201 |
+ } |
4202 |
+ |
4203 |
+ static irqreturn_t sc16is7xx_irq(int irq, void *dev_id) |
4204 |
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c |
4205 |
+index ab3f6e91853d..3649b83ef863 100644 |
4206 |
+--- a/drivers/tty/serial/sh-sci.c |
4207 |
++++ b/drivers/tty/serial/sh-sci.c |
4208 |
+@@ -3102,6 +3102,7 @@ static struct uart_driver sci_uart_driver = { |
4209 |
+ static int sci_remove(struct platform_device *dev) |
4210 |
+ { |
4211 |
+ struct sci_port *port = platform_get_drvdata(dev); |
4212 |
++ unsigned int type = port->port.type; /* uart_remove_... clears it */ |
4213 |
+ |
4214 |
+ sci_ports_in_use &= ~BIT(port->port.line); |
4215 |
+ uart_remove_one_port(&sci_uart_driver, &port->port); |
4216 |
+@@ -3112,8 +3113,7 @@ static int sci_remove(struct platform_device *dev) |
4217 |
+ sysfs_remove_file(&dev->dev.kobj, |
4218 |
+ &dev_attr_rx_fifo_trigger.attr); |
4219 |
+ } |
4220 |
+- if (port->port.type == PORT_SCIFA || port->port.type == PORT_SCIFB || |
4221 |
+- port->port.type == PORT_HSCIF) { |
4222 |
++ if (type == PORT_SCIFA || type == PORT_SCIFB || type == PORT_HSCIF) { |
4223 |
+ sysfs_remove_file(&dev->dev.kobj, |
4224 |
+ &dev_attr_rx_fifo_timeout.attr); |
4225 |
+ } |
4226 |
+diff --git a/drivers/tty/tty_baudrate.c b/drivers/tty/tty_baudrate.c |
4227 |
+index 7576ceace571..f438eaa68246 100644 |
4228 |
+--- a/drivers/tty/tty_baudrate.c |
4229 |
++++ b/drivers/tty/tty_baudrate.c |
4230 |
+@@ -77,7 +77,7 @@ speed_t tty_termios_baud_rate(struct ktermios *termios) |
4231 |
+ else |
4232 |
+ cbaud += 15; |
4233 |
+ } |
4234 |
+- return baud_table[cbaud]; |
4235 |
++ return cbaud >= n_baud_table ? 0 : baud_table[cbaud]; |
4236 |
+ } |
4237 |
+ EXPORT_SYMBOL(tty_termios_baud_rate); |
4238 |
+ |
4239 |
+@@ -113,7 +113,7 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios) |
4240 |
+ else |
4241 |
+ cbaud += 15; |
4242 |
+ } |
4243 |
+- return baud_table[cbaud]; |
4244 |
++ return cbaud >= n_baud_table ? 0 : baud_table[cbaud]; |
4245 |
+ #else /* IBSHIFT */ |
4246 |
+ return tty_termios_baud_rate(termios); |
4247 |
+ #endif /* IBSHIFT */ |
4248 |
+diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c |
4249 |
+index 5e5da9acaf0a..252eef2c32f9 100644 |
4250 |
+--- a/drivers/tty/tty_io.c |
4251 |
++++ b/drivers/tty/tty_io.c |
4252 |
+@@ -408,7 +408,7 @@ struct tty_driver *tty_find_polling_driver(char *name, int *line) |
4253 |
+ mutex_lock(&tty_mutex); |
4254 |
+ /* Search through the tty devices to look for a match */ |
4255 |
+ list_for_each_entry(p, &tty_drivers, tty_drivers) { |
4256 |
+- if (strncmp(name, p->name, len) != 0) |
4257 |
++ if (!len || strncmp(name, p->name, len) != 0) |
4258 |
+ continue; |
4259 |
+ stp = str; |
4260 |
+ if (*stp == ',') |
4261 |
+diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c |
4262 |
+index c24bb690680b..e7e3ae13516d 100644 |
4263 |
+--- a/drivers/vhost/scsi.c |
4264 |
++++ b/drivers/vhost/scsi.c |
4265 |
+@@ -964,7 +964,8 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) |
4266 |
+ prot_bytes = vhost32_to_cpu(vq, v_req_pi.pi_bytesin); |
4267 |
+ } |
4268 |
+ /* |
4269 |
+- * Set prot_iter to data_iter, and advance past any |
4270 |
++ * Set prot_iter to data_iter and truncate it to |
4271 |
++ * prot_bytes, and advance data_iter past any |
4272 |
+ * preceeding prot_bytes that may be present. |
4273 |
+ * |
4274 |
+ * Also fix up the exp_data_len to reflect only the |
4275 |
+@@ -973,6 +974,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) |
4276 |
+ if (prot_bytes) { |
4277 |
+ exp_data_len -= prot_bytes; |
4278 |
+ prot_iter = data_iter; |
4279 |
++ iov_iter_truncate(&prot_iter, prot_bytes); |
4280 |
+ iov_iter_advance(&data_iter, prot_bytes); |
4281 |
+ } |
4282 |
+ tag = vhost64_to_cpu(vq, v_req_pi.tag); |
4283 |
+diff --git a/drivers/video/fbdev/aty/mach64_accel.c b/drivers/video/fbdev/aty/mach64_accel.c |
4284 |
+index 2541a0e0de76..3ad46255f990 100644 |
4285 |
+--- a/drivers/video/fbdev/aty/mach64_accel.c |
4286 |
++++ b/drivers/video/fbdev/aty/mach64_accel.c |
4287 |
+@@ -127,7 +127,7 @@ void aty_init_engine(struct atyfb_par *par, struct fb_info *info) |
4288 |
+ |
4289 |
+ /* set host attributes */ |
4290 |
+ wait_for_fifo(13, par); |
4291 |
+- aty_st_le32(HOST_CNTL, 0, par); |
4292 |
++ aty_st_le32(HOST_CNTL, HOST_BYTE_ALIGN, par); |
4293 |
+ |
4294 |
+ /* set pattern attributes */ |
4295 |
+ aty_st_le32(PAT_REG0, 0, par); |
4296 |
+@@ -233,7 +233,8 @@ void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) |
4297 |
+ rotation = rotation24bpp(dx, direction); |
4298 |
+ } |
4299 |
+ |
4300 |
+- wait_for_fifo(4, par); |
4301 |
++ wait_for_fifo(5, par); |
4302 |
++ aty_st_le32(DP_PIX_WIDTH, par->crtc.dp_pix_width, par); |
4303 |
+ aty_st_le32(DP_SRC, FRGD_SRC_BLIT, par); |
4304 |
+ aty_st_le32(SRC_Y_X, (sx << 16) | sy, par); |
4305 |
+ aty_st_le32(SRC_HEIGHT1_WIDTH1, (width << 16) | area->height, par); |
4306 |
+@@ -269,7 +270,8 @@ void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
4307 |
+ rotation = rotation24bpp(dx, DST_X_LEFT_TO_RIGHT); |
4308 |
+ } |
4309 |
+ |
4310 |
+- wait_for_fifo(3, par); |
4311 |
++ wait_for_fifo(4, par); |
4312 |
++ aty_st_le32(DP_PIX_WIDTH, par->crtc.dp_pix_width, par); |
4313 |
+ aty_st_le32(DP_FRGD_CLR, color, par); |
4314 |
+ aty_st_le32(DP_SRC, |
4315 |
+ BKGD_SRC_BKGD_CLR | FRGD_SRC_FRGD_CLR | MONO_SRC_ONE, |
4316 |
+@@ -284,7 +286,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) |
4317 |
+ { |
4318 |
+ struct atyfb_par *par = (struct atyfb_par *) info->par; |
4319 |
+ u32 src_bytes, dx = image->dx, dy = image->dy, width = image->width; |
4320 |
+- u32 pix_width_save, pix_width, host_cntl, rotation = 0, src, mix; |
4321 |
++ u32 pix_width, rotation = 0, src, mix; |
4322 |
+ |
4323 |
+ if (par->asleep) |
4324 |
+ return; |
4325 |
+@@ -296,8 +298,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) |
4326 |
+ return; |
4327 |
+ } |
4328 |
+ |
4329 |
+- pix_width = pix_width_save = aty_ld_le32(DP_PIX_WIDTH, par); |
4330 |
+- host_cntl = aty_ld_le32(HOST_CNTL, par) | HOST_BYTE_ALIGN; |
4331 |
++ pix_width = par->crtc.dp_pix_width; |
4332 |
+ |
4333 |
+ switch (image->depth) { |
4334 |
+ case 1: |
4335 |
+@@ -345,7 +346,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) |
4336 |
+ * since Rage 3D IIc we have DP_HOST_TRIPLE_EN bit |
4337 |
+ * this hwaccelerated triple has an issue with not aligned data |
4338 |
+ */ |
4339 |
+- if (M64_HAS(HW_TRIPLE) && image->width % 8 == 0) |
4340 |
++ if (image->depth == 1 && M64_HAS(HW_TRIPLE) && image->width % 8 == 0) |
4341 |
+ pix_width |= DP_HOST_TRIPLE_EN; |
4342 |
+ } |
4343 |
+ |
4344 |
+@@ -370,19 +371,18 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) |
4345 |
+ mix = FRGD_MIX_D_XOR_S | BKGD_MIX_D; |
4346 |
+ } |
4347 |
+ |
4348 |
+- wait_for_fifo(6, par); |
4349 |
+- aty_st_le32(DP_WRITE_MASK, 0xFFFFFFFF, par); |
4350 |
++ wait_for_fifo(5, par); |
4351 |
+ aty_st_le32(DP_PIX_WIDTH, pix_width, par); |
4352 |
+ aty_st_le32(DP_MIX, mix, par); |
4353 |
+ aty_st_le32(DP_SRC, src, par); |
4354 |
+- aty_st_le32(HOST_CNTL, host_cntl, par); |
4355 |
++ aty_st_le32(HOST_CNTL, HOST_BYTE_ALIGN, par); |
4356 |
+ aty_st_le32(DST_CNTL, DST_Y_TOP_TO_BOTTOM | DST_X_LEFT_TO_RIGHT | rotation, par); |
4357 |
+ |
4358 |
+ draw_rect(dx, dy, width, image->height, par); |
4359 |
+ src_bytes = (((image->width * image->depth) + 7) / 8) * image->height; |
4360 |
+ |
4361 |
+ /* manual triple each pixel */ |
4362 |
+- if (info->var.bits_per_pixel == 24 && !(pix_width & DP_HOST_TRIPLE_EN)) { |
4363 |
++ if (image->depth == 1 && info->var.bits_per_pixel == 24 && !(pix_width & DP_HOST_TRIPLE_EN)) { |
4364 |
+ int inbit, outbit, mult24, byte_id_in_dword, width; |
4365 |
+ u8 *pbitmapin = (u8*)image->data, *pbitmapout; |
4366 |
+ u32 hostdword; |
4367 |
+@@ -415,7 +415,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) |
4368 |
+ } |
4369 |
+ } |
4370 |
+ wait_for_fifo(1, par); |
4371 |
+- aty_st_le32(HOST_DATA0, hostdword, par); |
4372 |
++ aty_st_le32(HOST_DATA0, le32_to_cpu(hostdword), par); |
4373 |
+ } |
4374 |
+ } else { |
4375 |
+ u32 *pbitmap, dwords = (src_bytes + 3) / 4; |
4376 |
+@@ -424,8 +424,4 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) |
4377 |
+ aty_st_le32(HOST_DATA0, get_unaligned_le32(pbitmap), par); |
4378 |
+ } |
4379 |
+ } |
4380 |
+- |
4381 |
+- /* restore pix_width */ |
4382 |
+- wait_for_fifo(1, par); |
4383 |
+- aty_st_le32(DP_PIX_WIDTH, pix_width_save, par); |
4384 |
+ } |
4385 |
+diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c |
4386 |
+index 5f2e48d41d72..ab3d5f5dbb00 100644 |
4387 |
+--- a/fs/9p/vfs_file.c |
4388 |
++++ b/fs/9p/vfs_file.c |
4389 |
+@@ -204,6 +204,14 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) |
4390 |
+ break; |
4391 |
+ if (schedule_timeout_interruptible(P9_LOCK_TIMEOUT) != 0) |
4392 |
+ break; |
4393 |
++ /* |
4394 |
++ * p9_client_lock_dotl overwrites flock.client_id with the |
4395 |
++ * server message, free and reuse the client name |
4396 |
++ */ |
4397 |
++ if (flock.client_id != fid->clnt->name) { |
4398 |
++ kfree(flock.client_id); |
4399 |
++ flock.client_id = fid->clnt->name; |
4400 |
++ } |
4401 |
+ } |
4402 |
+ |
4403 |
+ /* map 9p status to VFS status */ |
4404 |
+@@ -235,6 +243,8 @@ out_unlock: |
4405 |
+ locks_lock_file_wait(filp, fl); |
4406 |
+ fl->fl_type = fl_type; |
4407 |
+ } |
4408 |
++ if (flock.client_id != fid->clnt->name) |
4409 |
++ kfree(flock.client_id); |
4410 |
+ out: |
4411 |
+ return res; |
4412 |
+ } |
4413 |
+@@ -269,7 +279,7 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) |
4414 |
+ |
4415 |
+ res = p9_client_getlock_dotl(fid, &glock); |
4416 |
+ if (res < 0) |
4417 |
+- return res; |
4418 |
++ goto out; |
4419 |
+ /* map 9p lock type to os lock type */ |
4420 |
+ switch (glock.type) { |
4421 |
+ case P9_LOCK_TYPE_RDLCK: |
4422 |
+@@ -290,7 +300,9 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) |
4423 |
+ fl->fl_end = glock.start + glock.length - 1; |
4424 |
+ fl->fl_pid = -glock.proc_id; |
4425 |
+ } |
4426 |
+- kfree(glock.client_id); |
4427 |
++out: |
4428 |
++ if (glock.client_id != fid->clnt->name) |
4429 |
++ kfree(glock.client_id); |
4430 |
+ return res; |
4431 |
+ } |
4432 |
+ |
4433 |
+diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c |
4434 |
+index 05dc3c17cb62..dc52ce5e495f 100644 |
4435 |
+--- a/fs/btrfs/disk-io.c |
4436 |
++++ b/fs/btrfs/disk-io.c |
4437 |
+@@ -4359,13 +4359,23 @@ static int btrfs_destroy_pinned_extent(struct btrfs_fs_info *fs_info, |
4438 |
+ unpin = pinned_extents; |
4439 |
+ again: |
4440 |
+ while (1) { |
4441 |
++ /* |
4442 |
++ * The btrfs_finish_extent_commit() may get the same range as |
4443 |
++ * ours between find_first_extent_bit and clear_extent_dirty. |
4444 |
++ * Hence, hold the unused_bg_unpin_mutex to avoid double unpin |
4445 |
++ * the same extent range. |
4446 |
++ */ |
4447 |
++ mutex_lock(&fs_info->unused_bg_unpin_mutex); |
4448 |
+ ret = find_first_extent_bit(unpin, 0, &start, &end, |
4449 |
+ EXTENT_DIRTY, NULL); |
4450 |
+- if (ret) |
4451 |
++ if (ret) { |
4452 |
++ mutex_unlock(&fs_info->unused_bg_unpin_mutex); |
4453 |
+ break; |
4454 |
++ } |
4455 |
+ |
4456 |
+ clear_extent_dirty(unpin, start, end); |
4457 |
+ btrfs_error_unpin_extent_range(fs_info, start, end); |
4458 |
++ mutex_unlock(&fs_info->unused_bg_unpin_mutex); |
4459 |
+ cond_resched(); |
4460 |
+ } |
4461 |
+ |
4462 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
4463 |
+index 83268d8f48c4..7158b5b77c9d 100644 |
4464 |
+--- a/fs/btrfs/inode.c |
4465 |
++++ b/fs/btrfs/inode.c |
4466 |
+@@ -1532,12 +1532,11 @@ out_check: |
4467 |
+ } |
4468 |
+ btrfs_release_path(path); |
4469 |
+ |
4470 |
+- if (cur_offset <= end && cow_start == (u64)-1) { |
4471 |
++ if (cur_offset <= end && cow_start == (u64)-1) |
4472 |
+ cow_start = cur_offset; |
4473 |
+- cur_offset = end; |
4474 |
+- } |
4475 |
+ |
4476 |
+ if (cow_start != (u64)-1) { |
4477 |
++ cur_offset = end; |
4478 |
+ ret = cow_file_range(inode, locked_page, cow_start, end, end, |
4479 |
+ page_started, nr_written, 1, NULL); |
4480 |
+ if (ret) |
4481 |
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c |
4482 |
+index bd4767f562cd..c9152155fcbf 100644 |
4483 |
+--- a/fs/btrfs/ioctl.c |
4484 |
++++ b/fs/btrfs/ioctl.c |
4485 |
+@@ -3489,6 +3489,8 @@ static int btrfs_extent_same_range(struct inode *src, u64 loff, u64 olen, |
4486 |
+ const u64 sz = BTRFS_I(src)->root->fs_info->sectorsize; |
4487 |
+ |
4488 |
+ len = round_down(i_size_read(src), sz) - loff; |
4489 |
++ if (len == 0) |
4490 |
++ return 0; |
4491 |
+ olen = len; |
4492 |
+ } |
4493 |
+ } |
4494 |
+@@ -4278,9 +4280,17 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src, |
4495 |
+ goto out_unlock; |
4496 |
+ if (len == 0) |
4497 |
+ olen = len = src->i_size - off; |
4498 |
+- /* if we extend to eof, continue to block boundary */ |
4499 |
+- if (off + len == src->i_size) |
4500 |
++ /* |
4501 |
++ * If we extend to eof, continue to block boundary if and only if the |
4502 |
++ * destination end offset matches the destination file's size, otherwise |
4503 |
++ * we would be corrupting data by placing the eof block into the middle |
4504 |
++ * of a file. |
4505 |
++ */ |
4506 |
++ if (off + len == src->i_size) { |
4507 |
++ if (!IS_ALIGNED(len, bs) && destoff + len < inode->i_size) |
4508 |
++ goto out_unlock; |
4509 |
+ len = ALIGN(src->i_size, bs) - off; |
4510 |
++ } |
4511 |
+ |
4512 |
+ if (len == 0) { |
4513 |
+ ret = 0; |
4514 |
+diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c |
4515 |
+index db835635372f..d385778b628c 100644 |
4516 |
+--- a/fs/btrfs/tree-checker.c |
4517 |
++++ b/fs/btrfs/tree-checker.c |
4518 |
+@@ -440,7 +440,7 @@ static int check_block_group_item(struct btrfs_fs_info *fs_info, |
4519 |
+ type != (BTRFS_BLOCK_GROUP_METADATA | |
4520 |
+ BTRFS_BLOCK_GROUP_DATA)) { |
4521 |
+ block_group_err(fs_info, leaf, slot, |
4522 |
+-"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llu or 0x%llx", |
4523 |
++"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llx or 0x%llx", |
4524 |
+ type, hweight64(type), |
4525 |
+ BTRFS_BLOCK_GROUP_DATA, BTRFS_BLOCK_GROUP_METADATA, |
4526 |
+ BTRFS_BLOCK_GROUP_SYSTEM, |
4527 |
+diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
4528 |
+index d0bcfbfc0e3a..16ecb76fa53c 100644 |
4529 |
+--- a/fs/btrfs/tree-log.c |
4530 |
++++ b/fs/btrfs/tree-log.c |
4531 |
+@@ -4399,6 +4399,23 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, |
4532 |
+ logged_end = end; |
4533 |
+ |
4534 |
+ list_for_each_entry_safe(em, n, &tree->modified_extents, list) { |
4535 |
++ /* |
4536 |
++ * Skip extents outside our logging range. It's important to do |
4537 |
++ * it for correctness because if we don't ignore them, we may |
4538 |
++ * log them before their ordered extent completes, and therefore |
4539 |
++ * we could log them without logging their respective checksums |
4540 |
++ * (the checksum items are added to the csum tree at the very |
4541 |
++ * end of btrfs_finish_ordered_io()). Also leave such extents |
4542 |
++ * outside of our range in the list, since we may have another |
4543 |
++ * ranged fsync in the near future that needs them. If an extent |
4544 |
++ * outside our range corresponds to a hole, log it to avoid |
4545 |
++ * leaving gaps between extents (fsck will complain when we are |
4546 |
++ * not using the NO_HOLES feature). |
4547 |
++ */ |
4548 |
++ if ((em->start > end || em->start + em->len <= start) && |
4549 |
++ em->block_start != EXTENT_MAP_HOLE) |
4550 |
++ continue; |
4551 |
++ |
4552 |
+ list_del_init(&em->list); |
4553 |
+ /* |
4554 |
+ * Just an arbitrary number, this can be really CPU intensive |
4555 |
+diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c |
4556 |
+index ebc7bdaed2d0..4055ab4d5c52 100644 |
4557 |
+--- a/fs/ceph/inode.c |
4558 |
++++ b/fs/ceph/inode.c |
4559 |
+@@ -1132,8 +1132,12 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in) |
4560 |
+ if (IS_ERR(realdn)) { |
4561 |
+ pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n", |
4562 |
+ PTR_ERR(realdn), dn, in, ceph_vinop(in)); |
4563 |
+- dput(dn); |
4564 |
+- dn = realdn; /* note realdn contains the error */ |
4565 |
++ dn = realdn; |
4566 |
++ /* |
4567 |
++ * Caller should release 'dn' in the case of error. |
4568 |
++ * If 'req->r_dentry' is passed to this function, |
4569 |
++ * caller should leave 'req->r_dentry' untouched. |
4570 |
++ */ |
4571 |
+ goto out; |
4572 |
+ } else if (realdn) { |
4573 |
+ dout("dn %p (%d) spliced with %p (%d) " |
4574 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
4575 |
+index d767e993591d..244531d3065a 100644 |
4576 |
+--- a/fs/ext4/inode.c |
4577 |
++++ b/fs/ext4/inode.c |
4578 |
+@@ -5804,9 +5804,10 @@ int ext4_mark_iloc_dirty(handle_t *handle, |
4579 |
+ { |
4580 |
+ int err = 0; |
4581 |
+ |
4582 |
+- if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) |
4583 |
++ if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) { |
4584 |
++ put_bh(iloc->bh); |
4585 |
+ return -EIO; |
4586 |
+- |
4587 |
++ } |
4588 |
+ if (IS_I_VERSION(inode)) |
4589 |
+ inode_inc_iversion(inode); |
4590 |
+ |
4591 |
+diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
4592 |
+index 377d516c475f..ffa25753e929 100644 |
4593 |
+--- a/fs/ext4/namei.c |
4594 |
++++ b/fs/ext4/namei.c |
4595 |
+@@ -126,6 +126,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode, |
4596 |
+ if (!is_dx_block && type == INDEX) { |
4597 |
+ ext4_error_inode(inode, func, line, block, |
4598 |
+ "directory leaf block found instead of index block"); |
4599 |
++ brelse(bh); |
4600 |
+ return ERR_PTR(-EFSCORRUPTED); |
4601 |
+ } |
4602 |
+ if (!ext4_has_metadata_csum(inode->i_sb) || |
4603 |
+@@ -2811,7 +2812,9 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) |
4604 |
+ list_del_init(&EXT4_I(inode)->i_orphan); |
4605 |
+ mutex_unlock(&sbi->s_orphan_lock); |
4606 |
+ } |
4607 |
+- } |
4608 |
++ } else |
4609 |
++ brelse(iloc.bh); |
4610 |
++ |
4611 |
+ jbd_debug(4, "superblock will point to %lu\n", inode->i_ino); |
4612 |
+ jbd_debug(4, "orphan inode %lu will point to %d\n", |
4613 |
+ inode->i_ino, NEXT_ORPHAN(inode)); |
4614 |
+diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c |
4615 |
+index ebbc663d0798..a5efee34415f 100644 |
4616 |
+--- a/fs/ext4/resize.c |
4617 |
++++ b/fs/ext4/resize.c |
4618 |
+@@ -459,16 +459,18 @@ static int set_flexbg_block_bitmap(struct super_block *sb, handle_t *handle, |
4619 |
+ |
4620 |
+ BUFFER_TRACE(bh, "get_write_access"); |
4621 |
+ err = ext4_journal_get_write_access(handle, bh); |
4622 |
+- if (err) |
4623 |
++ if (err) { |
4624 |
++ brelse(bh); |
4625 |
+ return err; |
4626 |
++ } |
4627 |
+ ext4_debug("mark block bitmap %#04llx (+%llu/%u)\n", |
4628 |
+ first_cluster, first_cluster - start, count2); |
4629 |
+ ext4_set_bits(bh->b_data, first_cluster - start, count2); |
4630 |
+ |
4631 |
+ err = ext4_handle_dirty_metadata(handle, NULL, bh); |
4632 |
++ brelse(bh); |
4633 |
+ if (unlikely(err)) |
4634 |
+ return err; |
4635 |
+- brelse(bh); |
4636 |
+ } |
4637 |
+ |
4638 |
+ return 0; |
4639 |
+@@ -605,7 +607,6 @@ handle_bb: |
4640 |
+ bh = bclean(handle, sb, block); |
4641 |
+ if (IS_ERR(bh)) { |
4642 |
+ err = PTR_ERR(bh); |
4643 |
+- bh = NULL; |
4644 |
+ goto out; |
4645 |
+ } |
4646 |
+ overhead = ext4_group_overhead_blocks(sb, group); |
4647 |
+@@ -618,9 +619,9 @@ handle_bb: |
4648 |
+ ext4_mark_bitmap_end(EXT4_B2C(sbi, group_data[i].blocks_count), |
4649 |
+ sb->s_blocksize * 8, bh->b_data); |
4650 |
+ err = ext4_handle_dirty_metadata(handle, NULL, bh); |
4651 |
++ brelse(bh); |
4652 |
+ if (err) |
4653 |
+ goto out; |
4654 |
+- brelse(bh); |
4655 |
+ |
4656 |
+ handle_ib: |
4657 |
+ if (bg_flags[i] & EXT4_BG_INODE_UNINIT) |
4658 |
+@@ -635,18 +636,16 @@ handle_ib: |
4659 |
+ bh = bclean(handle, sb, block); |
4660 |
+ if (IS_ERR(bh)) { |
4661 |
+ err = PTR_ERR(bh); |
4662 |
+- bh = NULL; |
4663 |
+ goto out; |
4664 |
+ } |
4665 |
+ |
4666 |
+ ext4_mark_bitmap_end(EXT4_INODES_PER_GROUP(sb), |
4667 |
+ sb->s_blocksize * 8, bh->b_data); |
4668 |
+ err = ext4_handle_dirty_metadata(handle, NULL, bh); |
4669 |
++ brelse(bh); |
4670 |
+ if (err) |
4671 |
+ goto out; |
4672 |
+- brelse(bh); |
4673 |
+ } |
4674 |
+- bh = NULL; |
4675 |
+ |
4676 |
+ /* Mark group tables in block bitmap */ |
4677 |
+ for (j = 0; j < GROUP_TABLE_COUNT; j++) { |
4678 |
+@@ -685,7 +684,6 @@ handle_ib: |
4679 |
+ } |
4680 |
+ |
4681 |
+ out: |
4682 |
+- brelse(bh); |
4683 |
+ err2 = ext4_journal_stop(handle); |
4684 |
+ if (err2 && !err) |
4685 |
+ err = err2; |
4686 |
+@@ -873,6 +871,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, |
4687 |
+ err = ext4_handle_dirty_metadata(handle, NULL, gdb_bh); |
4688 |
+ if (unlikely(err)) { |
4689 |
+ ext4_std_error(sb, err); |
4690 |
++ iloc.bh = NULL; |
4691 |
+ goto exit_inode; |
4692 |
+ } |
4693 |
+ brelse(dind); |
4694 |
+@@ -924,6 +923,7 @@ static int add_new_gdb_meta_bg(struct super_block *sb, |
4695 |
+ sizeof(struct buffer_head *), |
4696 |
+ GFP_NOFS); |
4697 |
+ if (!n_group_desc) { |
4698 |
++ brelse(gdb_bh); |
4699 |
+ err = -ENOMEM; |
4700 |
+ ext4_warning(sb, "not enough memory for %lu groups", |
4701 |
+ gdb_num + 1); |
4702 |
+@@ -939,8 +939,6 @@ static int add_new_gdb_meta_bg(struct super_block *sb, |
4703 |
+ kvfree(o_group_desc); |
4704 |
+ BUFFER_TRACE(gdb_bh, "get_write_access"); |
4705 |
+ err = ext4_journal_get_write_access(handle, gdb_bh); |
4706 |
+- if (unlikely(err)) |
4707 |
+- brelse(gdb_bh); |
4708 |
+ return err; |
4709 |
+ } |
4710 |
+ |
4711 |
+@@ -1124,8 +1122,10 @@ static void update_backups(struct super_block *sb, sector_t blk_off, char *data, |
4712 |
+ backup_block, backup_block - |
4713 |
+ ext4_group_first_block_no(sb, group)); |
4714 |
+ BUFFER_TRACE(bh, "get_write_access"); |
4715 |
+- if ((err = ext4_journal_get_write_access(handle, bh))) |
4716 |
++ if ((err = ext4_journal_get_write_access(handle, bh))) { |
4717 |
++ brelse(bh); |
4718 |
+ break; |
4719 |
++ } |
4720 |
+ lock_buffer(bh); |
4721 |
+ memcpy(bh->b_data, data, size); |
4722 |
+ if (rest) |
4723 |
+@@ -2023,7 +2023,7 @@ retry: |
4724 |
+ |
4725 |
+ err = ext4_alloc_flex_bg_array(sb, n_group + 1); |
4726 |
+ if (err) |
4727 |
+- return err; |
4728 |
++ goto out; |
4729 |
+ |
4730 |
+ err = ext4_mb_alloc_groupinfo(sb, n_group + 1); |
4731 |
+ if (err) |
4732 |
+@@ -2059,6 +2059,10 @@ retry: |
4733 |
+ n_blocks_count_retry = 0; |
4734 |
+ free_flex_gd(flex_gd); |
4735 |
+ flex_gd = NULL; |
4736 |
++ if (resize_inode) { |
4737 |
++ iput(resize_inode); |
4738 |
++ resize_inode = NULL; |
4739 |
++ } |
4740 |
+ goto retry; |
4741 |
+ } |
4742 |
+ |
4743 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
4744 |
+index d3d4643ab79b..8a149df1c6a1 100644 |
4745 |
+--- a/fs/ext4/super.c |
4746 |
++++ b/fs/ext4/super.c |
4747 |
+@@ -4074,6 +4074,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) |
4748 |
+ sbi->s_groups_count = blocks_count; |
4749 |
+ sbi->s_blockfile_groups = min_t(ext4_group_t, sbi->s_groups_count, |
4750 |
+ (EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb))); |
4751 |
++ if (((u64)sbi->s_groups_count * sbi->s_inodes_per_group) != |
4752 |
++ le32_to_cpu(es->s_inodes_count)) { |
4753 |
++ ext4_msg(sb, KERN_ERR, "inodes count not valid: %u vs %llu", |
4754 |
++ le32_to_cpu(es->s_inodes_count), |
4755 |
++ ((u64)sbi->s_groups_count * sbi->s_inodes_per_group)); |
4756 |
++ ret = -EINVAL; |
4757 |
++ goto failed_mount; |
4758 |
++ } |
4759 |
+ db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) / |
4760 |
+ EXT4_DESC_PER_BLOCK(sb); |
4761 |
+ if (ext4_has_feature_meta_bg(sb)) { |
4762 |
+@@ -4093,14 +4101,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) |
4763 |
+ ret = -ENOMEM; |
4764 |
+ goto failed_mount; |
4765 |
+ } |
4766 |
+- if (((u64)sbi->s_groups_count * sbi->s_inodes_per_group) != |
4767 |
+- le32_to_cpu(es->s_inodes_count)) { |
4768 |
+- ext4_msg(sb, KERN_ERR, "inodes count not valid: %u vs %llu", |
4769 |
+- le32_to_cpu(es->s_inodes_count), |
4770 |
+- ((u64)sbi->s_groups_count * sbi->s_inodes_per_group)); |
4771 |
+- ret = -EINVAL; |
4772 |
+- goto failed_mount; |
4773 |
+- } |
4774 |
+ |
4775 |
+ bgl_lock_init(sbi->s_blockgroup_lock); |
4776 |
+ |
4777 |
+@@ -4509,6 +4509,7 @@ failed_mount6: |
4778 |
+ percpu_counter_destroy(&sbi->s_freeinodes_counter); |
4779 |
+ percpu_counter_destroy(&sbi->s_dirs_counter); |
4780 |
+ percpu_counter_destroy(&sbi->s_dirtyclusters_counter); |
4781 |
++ percpu_free_rwsem(&sbi->s_journal_flag_rwsem); |
4782 |
+ failed_mount5: |
4783 |
+ ext4_ext_release(sb); |
4784 |
+ ext4_release_system_zone(sb); |
4785 |
+diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c |
4786 |
+index f36fc5d5b257..4380c8630539 100644 |
4787 |
+--- a/fs/ext4/xattr.c |
4788 |
++++ b/fs/ext4/xattr.c |
4789 |
+@@ -1388,6 +1388,12 @@ retry: |
4790 |
+ bh = ext4_getblk(handle, ea_inode, block, 0); |
4791 |
+ if (IS_ERR(bh)) |
4792 |
+ return PTR_ERR(bh); |
4793 |
++ if (!bh) { |
4794 |
++ WARN_ON_ONCE(1); |
4795 |
++ EXT4_ERROR_INODE(ea_inode, |
4796 |
++ "ext4_getblk() return bh = NULL"); |
4797 |
++ return -EFSCORRUPTED; |
4798 |
++ } |
4799 |
+ ret = ext4_journal_get_write_access(handle, bh); |
4800 |
+ if (ret) |
4801 |
+ goto out; |
4802 |
+@@ -2276,8 +2282,10 @@ static struct buffer_head *ext4_xattr_get_block(struct inode *inode) |
4803 |
+ if (!bh) |
4804 |
+ return ERR_PTR(-EIO); |
4805 |
+ error = ext4_xattr_check_block(inode, bh); |
4806 |
+- if (error) |
4807 |
++ if (error) { |
4808 |
++ brelse(bh); |
4809 |
+ return ERR_PTR(error); |
4810 |
++ } |
4811 |
+ return bh; |
4812 |
+ } |
4813 |
+ |
4814 |
+@@ -2397,6 +2405,8 @@ retry_inode: |
4815 |
+ error = ext4_xattr_block_set(handle, inode, &i, &bs); |
4816 |
+ } else if (error == -ENOSPC) { |
4817 |
+ if (EXT4_I(inode)->i_file_acl && !bs.s.base) { |
4818 |
++ brelse(bs.bh); |
4819 |
++ bs.bh = NULL; |
4820 |
+ error = ext4_xattr_block_find(inode, &i, &bs); |
4821 |
+ if (error) |
4822 |
+ goto cleanup; |
4823 |
+@@ -2617,6 +2627,8 @@ out: |
4824 |
+ kfree(buffer); |
4825 |
+ if (is) |
4826 |
+ brelse(is->iloc.bh); |
4827 |
++ if (bs) |
4828 |
++ brelse(bs->bh); |
4829 |
+ kfree(is); |
4830 |
+ kfree(bs); |
4831 |
+ |
4832 |
+@@ -2696,7 +2708,6 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize, |
4833 |
+ struct ext4_inode *raw_inode, handle_t *handle) |
4834 |
+ { |
4835 |
+ struct ext4_xattr_ibody_header *header; |
4836 |
+- struct buffer_head *bh; |
4837 |
+ struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
4838 |
+ static unsigned int mnt_count; |
4839 |
+ size_t min_offs; |
4840 |
+@@ -2737,13 +2748,17 @@ retry: |
4841 |
+ * EA block can hold new_extra_isize bytes. |
4842 |
+ */ |
4843 |
+ if (EXT4_I(inode)->i_file_acl) { |
4844 |
++ struct buffer_head *bh; |
4845 |
++ |
4846 |
+ bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); |
4847 |
+ error = -EIO; |
4848 |
+ if (!bh) |
4849 |
+ goto cleanup; |
4850 |
+ error = ext4_xattr_check_block(inode, bh); |
4851 |
+- if (error) |
4852 |
++ if (error) { |
4853 |
++ brelse(bh); |
4854 |
+ goto cleanup; |
4855 |
++ } |
4856 |
+ base = BHDR(bh); |
4857 |
+ end = bh->b_data + bh->b_size; |
4858 |
+ min_offs = end - base; |
4859 |
+diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c |
4860 |
+index 11ea2c4a38ab..bf0da0382c9e 100644 |
4861 |
+--- a/fs/fuse/dev.c |
4862 |
++++ b/fs/fuse/dev.c |
4863 |
+@@ -129,9 +129,13 @@ static bool fuse_block_alloc(struct fuse_conn *fc, bool for_background) |
4864 |
+ |
4865 |
+ static void fuse_drop_waiting(struct fuse_conn *fc) |
4866 |
+ { |
4867 |
+- if (fc->connected) { |
4868 |
+- atomic_dec(&fc->num_waiting); |
4869 |
+- } else if (atomic_dec_and_test(&fc->num_waiting)) { |
4870 |
++ /* |
4871 |
++ * lockess check of fc->connected is okay, because atomic_dec_and_test() |
4872 |
++ * provides a memory barrier mached with the one in fuse_wait_aborted() |
4873 |
++ * to ensure no wake-up is missed. |
4874 |
++ */ |
4875 |
++ if (atomic_dec_and_test(&fc->num_waiting) && |
4876 |
++ !READ_ONCE(fc->connected)) { |
4877 |
+ /* wake up aborters */ |
4878 |
+ wake_up_all(&fc->blocked_waitq); |
4879 |
+ } |
4880 |
+@@ -391,12 +395,19 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req) |
4881 |
+ if (test_bit(FR_BACKGROUND, &req->flags)) { |
4882 |
+ spin_lock(&fc->lock); |
4883 |
+ clear_bit(FR_BACKGROUND, &req->flags); |
4884 |
+- if (fc->num_background == fc->max_background) |
4885 |
++ if (fc->num_background == fc->max_background) { |
4886 |
+ fc->blocked = 0; |
4887 |
+- |
4888 |
+- /* Wake up next waiter, if any */ |
4889 |
+- if (!fc->blocked && waitqueue_active(&fc->blocked_waitq)) |
4890 |
+ wake_up(&fc->blocked_waitq); |
4891 |
++ } else if (!fc->blocked) { |
4892 |
++ /* |
4893 |
++ * Wake up next waiter, if any. It's okay to use |
4894 |
++ * waitqueue_active(), as we've already synced up |
4895 |
++ * fc->blocked with waiters with the wake_up() call |
4896 |
++ * above. |
4897 |
++ */ |
4898 |
++ if (waitqueue_active(&fc->blocked_waitq)) |
4899 |
++ wake_up(&fc->blocked_waitq); |
4900 |
++ } |
4901 |
+ |
4902 |
+ if (fc->num_background == fc->congestion_threshold && fc->sb) { |
4903 |
+ clear_bdi_congested(fc->sb->s_bdi, BLK_RW_SYNC); |
4904 |
+@@ -1311,12 +1322,14 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, |
4905 |
+ goto out_end; |
4906 |
+ } |
4907 |
+ list_move_tail(&req->list, &fpq->processing); |
4908 |
+- spin_unlock(&fpq->lock); |
4909 |
++ __fuse_get_request(req); |
4910 |
+ set_bit(FR_SENT, &req->flags); |
4911 |
++ spin_unlock(&fpq->lock); |
4912 |
+ /* matches barrier in request_wait_answer() */ |
4913 |
+ smp_mb__after_atomic(); |
4914 |
+ if (test_bit(FR_INTERRUPTED, &req->flags)) |
4915 |
+ queue_interrupt(fiq, req); |
4916 |
++ fuse_put_request(fc, req); |
4917 |
+ |
4918 |
+ return reqsize; |
4919 |
+ |
4920 |
+@@ -1715,8 +1728,10 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, |
4921 |
+ req->in.args[1].size = total_len; |
4922 |
+ |
4923 |
+ err = fuse_request_send_notify_reply(fc, req, outarg->notify_unique); |
4924 |
+- if (err) |
4925 |
++ if (err) { |
4926 |
+ fuse_retrieve_end(fc, req); |
4927 |
++ fuse_put_request(fc, req); |
4928 |
++ } |
4929 |
+ |
4930 |
+ return err; |
4931 |
+ } |
4932 |
+@@ -1875,16 +1890,20 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud, |
4933 |
+ |
4934 |
+ /* Is it an interrupt reply? */ |
4935 |
+ if (req->intr_unique == oh.unique) { |
4936 |
++ __fuse_get_request(req); |
4937 |
+ spin_unlock(&fpq->lock); |
4938 |
+ |
4939 |
+ err = -EINVAL; |
4940 |
+- if (nbytes != sizeof(struct fuse_out_header)) |
4941 |
++ if (nbytes != sizeof(struct fuse_out_header)) { |
4942 |
++ fuse_put_request(fc, req); |
4943 |
+ goto err_finish; |
4944 |
++ } |
4945 |
+ |
4946 |
+ if (oh.error == -ENOSYS) |
4947 |
+ fc->no_interrupt = 1; |
4948 |
+ else if (oh.error == -EAGAIN) |
4949 |
+ queue_interrupt(&fc->iq, req); |
4950 |
++ fuse_put_request(fc, req); |
4951 |
+ |
4952 |
+ fuse_copy_finish(cs); |
4953 |
+ return nbytes; |
4954 |
+@@ -2152,6 +2171,8 @@ EXPORT_SYMBOL_GPL(fuse_abort_conn); |
4955 |
+ |
4956 |
+ void fuse_wait_aborted(struct fuse_conn *fc) |
4957 |
+ { |
4958 |
++ /* matches implicit memory barrier in fuse_drop_waiting() */ |
4959 |
++ smp_mb(); |
4960 |
+ wait_event(fc->blocked_waitq, atomic_read(&fc->num_waiting) == 0); |
4961 |
+ } |
4962 |
+ |
4963 |
+diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
4964 |
+index 32d0b883e74f..a0ffed34b85d 100644 |
4965 |
+--- a/fs/fuse/file.c |
4966 |
++++ b/fs/fuse/file.c |
4967 |
+@@ -2913,10 +2913,12 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) |
4968 |
+ } |
4969 |
+ |
4970 |
+ if (io->async) { |
4971 |
++ bool blocking = io->blocking; |
4972 |
++ |
4973 |
+ fuse_aio_complete(io, ret < 0 ? ret : 0, -1); |
4974 |
+ |
4975 |
+ /* we have a non-extending, async request, so return */ |
4976 |
+- if (!io->blocking) |
4977 |
++ if (!blocking) |
4978 |
+ return -EIOCBQUEUED; |
4979 |
+ |
4980 |
+ wait_for_completion(&wait); |
4981 |
+diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c |
4982 |
+index 84544a4f012d..8748539c04ed 100644 |
4983 |
+--- a/fs/gfs2/bmap.c |
4984 |
++++ b/fs/gfs2/bmap.c |
4985 |
+@@ -1908,10 +1908,16 @@ static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length) |
4986 |
+ if (ret < 0) |
4987 |
+ goto out; |
4988 |
+ |
4989 |
+- /* issue read-ahead on metadata */ |
4990 |
+- if (mp.mp_aheight > 1) { |
4991 |
+- for (; ret > 1; ret--) { |
4992 |
+- metapointer_range(&mp, mp.mp_aheight - ret, |
4993 |
++ /* On the first pass, issue read-ahead on metadata. */ |
4994 |
++ if (mp.mp_aheight > 1 && strip_h == ip->i_height - 1) { |
4995 |
++ unsigned int height = mp.mp_aheight - 1; |
4996 |
++ |
4997 |
++ /* No read-ahead for data blocks. */ |
4998 |
++ if (mp.mp_aheight - 1 == strip_h) |
4999 |
++ height--; |
5000 |
++ |
5001 |
++ for (; height >= mp.mp_aheight - ret; height--) { |
5002 |
++ metapointer_range(&mp, height, |
5003 |
+ start_list, start_aligned, |
5004 |
+ end_list, end_aligned, |
5005 |
+ &start, &end); |
5006 |
+diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c |
5007 |
+index 1ad3256b9cbc..449d0cb45a84 100644 |
5008 |
+--- a/fs/gfs2/rgrp.c |
5009 |
++++ b/fs/gfs2/rgrp.c |
5010 |
+@@ -725,6 +725,7 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp) |
5011 |
+ |
5012 |
+ if (gl) { |
5013 |
+ glock_clear_object(gl, rgd); |
5014 |
++ gfs2_rgrp_brelse(rgd); |
5015 |
+ gfs2_glock_put(gl); |
5016 |
+ } |
5017 |
+ |
5018 |
+@@ -1141,7 +1142,7 @@ static u32 count_unlinked(struct gfs2_rgrpd *rgd) |
5019 |
+ * @rgd: the struct gfs2_rgrpd describing the RG to read in |
5020 |
+ * |
5021 |
+ * Read in all of a Resource Group's header and bitmap blocks. |
5022 |
+- * Caller must eventually call gfs2_rgrp_relse() to free the bitmaps. |
5023 |
++ * Caller must eventually call gfs2_rgrp_brelse() to free the bitmaps. |
5024 |
+ * |
5025 |
+ * Returns: errno |
5026 |
+ */ |
5027 |
+diff --git a/fs/inode.c b/fs/inode.c |
5028 |
+index 42f6d25f32a5..65ae154df760 100644 |
5029 |
+--- a/fs/inode.c |
5030 |
++++ b/fs/inode.c |
5031 |
+@@ -730,8 +730,11 @@ static enum lru_status inode_lru_isolate(struct list_head *item, |
5032 |
+ return LRU_REMOVED; |
5033 |
+ } |
5034 |
+ |
5035 |
+- /* recently referenced inodes get one more pass */ |
5036 |
+- if (inode->i_state & I_REFERENCED) { |
5037 |
++ /* |
5038 |
++ * Recently referenced inodes and inodes with many attached pages |
5039 |
++ * get one more pass. |
5040 |
++ */ |
5041 |
++ if (inode->i_state & I_REFERENCED || inode->i_data.nrpages > 1) { |
5042 |
+ inode->i_state &= ~I_REFERENCED; |
5043 |
+ spin_unlock(&inode->i_lock); |
5044 |
+ return LRU_ROTATE; |
5045 |
+diff --git a/fs/ioctl.c b/fs/ioctl.c |
5046 |
+index 2005529af560..0400297c8d72 100644 |
5047 |
+--- a/fs/ioctl.c |
5048 |
++++ b/fs/ioctl.c |
5049 |
+@@ -669,6 +669,9 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, |
5050 |
+ return ioctl_fiemap(filp, arg); |
5051 |
+ |
5052 |
+ case FIGETBSZ: |
5053 |
++ /* anon_bdev filesystems may not have a block size */ |
5054 |
++ if (!inode->i_sb->s_blocksize) |
5055 |
++ return -EINVAL; |
5056 |
+ return put_user(inode->i_sb->s_blocksize, argp); |
5057 |
+ |
5058 |
+ case FICLONE: |
5059 |
+diff --git a/fs/namespace.c b/fs/namespace.c |
5060 |
+index 99186556f8d3..1fce41ba3535 100644 |
5061 |
+--- a/fs/namespace.c |
5062 |
++++ b/fs/namespace.c |
5063 |
+@@ -695,9 +695,6 @@ static struct mountpoint *lookup_mountpoint(struct dentry *dentry) |
5064 |
+ |
5065 |
+ hlist_for_each_entry(mp, chain, m_hash) { |
5066 |
+ if (mp->m_dentry == dentry) { |
5067 |
+- /* might be worth a WARN_ON() */ |
5068 |
+- if (d_unlinked(dentry)) |
5069 |
+- return ERR_PTR(-ENOENT); |
5070 |
+ mp->m_count++; |
5071 |
+ return mp; |
5072 |
+ } |
5073 |
+@@ -711,6 +708,9 @@ static struct mountpoint *get_mountpoint(struct dentry *dentry) |
5074 |
+ int ret; |
5075 |
+ |
5076 |
+ if (d_mountpoint(dentry)) { |
5077 |
++ /* might be worth a WARN_ON() */ |
5078 |
++ if (d_unlinked(dentry)) |
5079 |
++ return ERR_PTR(-ENOENT); |
5080 |
+ mountpoint: |
5081 |
+ read_seqlock_excl(&mount_lock); |
5082 |
+ mp = lookup_mountpoint(dentry); |
5083 |
+@@ -1540,8 +1540,13 @@ static int do_umount(struct mount *mnt, int flags) |
5084 |
+ |
5085 |
+ namespace_lock(); |
5086 |
+ lock_mount_hash(); |
5087 |
+- event++; |
5088 |
+ |
5089 |
++ /* Recheck MNT_LOCKED with the locks held */ |
5090 |
++ retval = -EINVAL; |
5091 |
++ if (mnt->mnt.mnt_flags & MNT_LOCKED) |
5092 |
++ goto out; |
5093 |
++ |
5094 |
++ event++; |
5095 |
+ if (flags & MNT_DETACH) { |
5096 |
+ if (!list_empty(&mnt->mnt_list)) |
5097 |
+ umount_tree(mnt, UMOUNT_PROPAGATE); |
5098 |
+@@ -1555,6 +1560,7 @@ static int do_umount(struct mount *mnt, int flags) |
5099 |
+ retval = 0; |
5100 |
+ } |
5101 |
+ } |
5102 |
++out: |
5103 |
+ unlock_mount_hash(); |
5104 |
+ namespace_unlock(); |
5105 |
+ return retval; |
5106 |
+@@ -1645,7 +1651,7 @@ int ksys_umount(char __user *name, int flags) |
5107 |
+ goto dput_and_out; |
5108 |
+ if (!check_mnt(mnt)) |
5109 |
+ goto dput_and_out; |
5110 |
+- if (mnt->mnt.mnt_flags & MNT_LOCKED) |
5111 |
++ if (mnt->mnt.mnt_flags & MNT_LOCKED) /* Check optimistically */ |
5112 |
+ goto dput_and_out; |
5113 |
+ retval = -EPERM; |
5114 |
+ if (flags & MNT_FORCE && !capable(CAP_SYS_ADMIN)) |
5115 |
+@@ -1728,8 +1734,14 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, |
5116 |
+ for (s = r; s; s = next_mnt(s, r)) { |
5117 |
+ if (!(flag & CL_COPY_UNBINDABLE) && |
5118 |
+ IS_MNT_UNBINDABLE(s)) { |
5119 |
+- s = skip_mnt_tree(s); |
5120 |
+- continue; |
5121 |
++ if (s->mnt.mnt_flags & MNT_LOCKED) { |
5122 |
++ /* Both unbindable and locked. */ |
5123 |
++ q = ERR_PTR(-EPERM); |
5124 |
++ goto out; |
5125 |
++ } else { |
5126 |
++ s = skip_mnt_tree(s); |
5127 |
++ continue; |
5128 |
++ } |
5129 |
+ } |
5130 |
+ if (!(flag & CL_COPY_MNT_NS_FILE) && |
5131 |
+ is_mnt_ns_file(s->mnt.mnt_root)) { |
5132 |
+@@ -1782,7 +1794,7 @@ void drop_collected_mounts(struct vfsmount *mnt) |
5133 |
+ { |
5134 |
+ namespace_lock(); |
5135 |
+ lock_mount_hash(); |
5136 |
+- umount_tree(real_mount(mnt), UMOUNT_SYNC); |
5137 |
++ umount_tree(real_mount(mnt), 0); |
5138 |
+ unlock_mount_hash(); |
5139 |
+ namespace_unlock(); |
5140 |
+ } |
5141 |
+diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c |
5142 |
+index 40a08cd483f0..18920152da14 100644 |
5143 |
+--- a/fs/nfs/nfs4state.c |
5144 |
++++ b/fs/nfs/nfs4state.c |
5145 |
+@@ -2583,11 +2583,12 @@ static void nfs4_state_manager(struct nfs_client *clp) |
5146 |
+ nfs4_clear_state_manager_bit(clp); |
5147 |
+ /* Did we race with an attempt to give us more work? */ |
5148 |
+ if (clp->cl_state == 0) |
5149 |
+- break; |
5150 |
++ return; |
5151 |
+ if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0) |
5152 |
+- break; |
5153 |
++ return; |
5154 |
+ } while (refcount_read(&clp->cl_count) > 1); |
5155 |
+- return; |
5156 |
++ goto out_drain; |
5157 |
++ |
5158 |
+ out_error: |
5159 |
+ if (strlen(section)) |
5160 |
+ section_sep = ": "; |
5161 |
+@@ -2595,6 +2596,7 @@ out_error: |
5162 |
+ " with error %d\n", section_sep, section, |
5163 |
+ clp->cl_hostname, -status); |
5164 |
+ ssleep(1); |
5165 |
++out_drain: |
5166 |
+ nfs4_end_drain_session(clp); |
5167 |
+ nfs4_clear_state_manager_bit(clp); |
5168 |
+ } |
5169 |
+diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c |
5170 |
+index b7bc6e1a85ac..9d6b4f0f1a25 100644 |
5171 |
+--- a/fs/nfsd/nfs4proc.c |
5172 |
++++ b/fs/nfsd/nfs4proc.c |
5173 |
+@@ -1037,6 +1037,9 @@ nfsd4_verify_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, |
5174 |
+ { |
5175 |
+ __be32 status; |
5176 |
+ |
5177 |
++ if (!cstate->save_fh.fh_dentry) |
5178 |
++ return nfserr_nofilehandle; |
5179 |
++ |
5180 |
+ status = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->save_fh, |
5181 |
+ src_stateid, RD_STATE, src, NULL); |
5182 |
+ if (status) { |
5183 |
+diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c |
5184 |
+index 302cd7caa4a7..7578bd507c70 100644 |
5185 |
+--- a/fs/ocfs2/aops.c |
5186 |
++++ b/fs/ocfs2/aops.c |
5187 |
+@@ -2412,8 +2412,16 @@ static int ocfs2_dio_end_io(struct kiocb *iocb, |
5188 |
+ /* this io's submitter should not have unlocked this before we could */ |
5189 |
+ BUG_ON(!ocfs2_iocb_is_rw_locked(iocb)); |
5190 |
+ |
5191 |
+- if (bytes > 0 && private) |
5192 |
+- ret = ocfs2_dio_end_io_write(inode, private, offset, bytes); |
5193 |
++ if (bytes <= 0) |
5194 |
++ mlog_ratelimited(ML_ERROR, "Direct IO failed, bytes = %lld", |
5195 |
++ (long long)bytes); |
5196 |
++ if (private) { |
5197 |
++ if (bytes > 0) |
5198 |
++ ret = ocfs2_dio_end_io_write(inode, private, offset, |
5199 |
++ bytes); |
5200 |
++ else |
5201 |
++ ocfs2_dio_free_write_ctx(inode, private); |
5202 |
++ } |
5203 |
+ |
5204 |
+ ocfs2_iocb_clear_rw_locked(iocb); |
5205 |
+ |
5206 |
+diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h |
5207 |
+index 308ea0eb35fd..a396096a5099 100644 |
5208 |
+--- a/fs/ocfs2/cluster/masklog.h |
5209 |
++++ b/fs/ocfs2/cluster/masklog.h |
5210 |
+@@ -178,6 +178,15 @@ do { \ |
5211 |
+ ##__VA_ARGS__); \ |
5212 |
+ } while (0) |
5213 |
+ |
5214 |
++#define mlog_ratelimited(mask, fmt, ...) \ |
5215 |
++do { \ |
5216 |
++ static DEFINE_RATELIMIT_STATE(_rs, \ |
5217 |
++ DEFAULT_RATELIMIT_INTERVAL, \ |
5218 |
++ DEFAULT_RATELIMIT_BURST); \ |
5219 |
++ if (__ratelimit(&_rs)) \ |
5220 |
++ mlog(mask, fmt, ##__VA_ARGS__); \ |
5221 |
++} while (0) |
5222 |
++ |
5223 |
+ #define mlog_errno(st) ({ \ |
5224 |
+ int _st = (st); \ |
5225 |
+ if (_st != -ERESTARTSYS && _st != -EINTR && \ |
5226 |
+diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c |
5227 |
+index b048d4fa3959..c121abbdfc7d 100644 |
5228 |
+--- a/fs/ocfs2/dir.c |
5229 |
++++ b/fs/ocfs2/dir.c |
5230 |
+@@ -1897,8 +1897,7 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode, |
5231 |
+ /* On error, skip the f_pos to the |
5232 |
+ next block. */ |
5233 |
+ ctx->pos = (ctx->pos | (sb->s_blocksize - 1)) + 1; |
5234 |
+- brelse(bh); |
5235 |
+- continue; |
5236 |
++ break; |
5237 |
+ } |
5238 |
+ if (le64_to_cpu(de->inode)) { |
5239 |
+ unsigned char d_type = DT_UNKNOWN; |
5240 |
+diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c |
5241 |
+index 276914ae3c60..3bbde0a9f48f 100644 |
5242 |
+--- a/fs/overlayfs/dir.c |
5243 |
++++ b/fs/overlayfs/dir.c |
5244 |
+@@ -463,6 +463,10 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode, |
5245 |
+ if (IS_ERR(upper)) |
5246 |
+ goto out_unlock; |
5247 |
+ |
5248 |
++ err = -ESTALE; |
5249 |
++ if (d_is_negative(upper) || !IS_WHITEOUT(d_inode(upper))) |
5250 |
++ goto out_dput; |
5251 |
++ |
5252 |
+ newdentry = ovl_create_temp(workdir, cattr); |
5253 |
+ err = PTR_ERR(newdentry); |
5254 |
+ if (IS_ERR(newdentry)) |
5255 |
+@@ -663,6 +667,10 @@ static int ovl_link(struct dentry *old, struct inode *newdir, |
5256 |
+ if (err) |
5257 |
+ goto out_drop_write; |
5258 |
+ |
5259 |
++ err = ovl_copy_up(new->d_parent); |
5260 |
++ if (err) |
5261 |
++ goto out_drop_write; |
5262 |
++ |
5263 |
+ if (ovl_is_metacopy_dentry(old)) { |
5264 |
+ err = ovl_set_redirect(old, false); |
5265 |
+ if (err) |
5266 |
+diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c |
5267 |
+index 9c0ca6a7becf..efd372312ef1 100644 |
5268 |
+--- a/fs/overlayfs/namei.c |
5269 |
++++ b/fs/overlayfs/namei.c |
5270 |
+@@ -422,8 +422,10 @@ int ovl_verify_set_fh(struct dentry *dentry, const char *name, |
5271 |
+ |
5272 |
+ fh = ovl_encode_real_fh(real, is_upper); |
5273 |
+ err = PTR_ERR(fh); |
5274 |
+- if (IS_ERR(fh)) |
5275 |
++ if (IS_ERR(fh)) { |
5276 |
++ fh = NULL; |
5277 |
+ goto fail; |
5278 |
++ } |
5279 |
+ |
5280 |
+ err = ovl_verify_fh(dentry, name, fh); |
5281 |
+ if (set && err == -ENODATA) |
5282 |
+diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c |
5283 |
+index 30adc9d408a0..0fb0a59a5e5c 100644 |
5284 |
+--- a/fs/overlayfs/super.c |
5285 |
++++ b/fs/overlayfs/super.c |
5286 |
+@@ -472,6 +472,7 @@ static int ovl_parse_opt(char *opt, struct ovl_config *config) |
5287 |
+ { |
5288 |
+ char *p; |
5289 |
+ int err; |
5290 |
++ bool metacopy_opt = false, redirect_opt = false; |
5291 |
+ |
5292 |
+ config->redirect_mode = kstrdup(ovl_redirect_mode_def(), GFP_KERNEL); |
5293 |
+ if (!config->redirect_mode) |
5294 |
+@@ -516,6 +517,7 @@ static int ovl_parse_opt(char *opt, struct ovl_config *config) |
5295 |
+ config->redirect_mode = match_strdup(&args[0]); |
5296 |
+ if (!config->redirect_mode) |
5297 |
+ return -ENOMEM; |
5298 |
++ redirect_opt = true; |
5299 |
+ break; |
5300 |
+ |
5301 |
+ case OPT_INDEX_ON: |
5302 |
+@@ -548,6 +550,7 @@ static int ovl_parse_opt(char *opt, struct ovl_config *config) |
5303 |
+ |
5304 |
+ case OPT_METACOPY_ON: |
5305 |
+ config->metacopy = true; |
5306 |
++ metacopy_opt = true; |
5307 |
+ break; |
5308 |
+ |
5309 |
+ case OPT_METACOPY_OFF: |
5310 |
+@@ -572,13 +575,32 @@ static int ovl_parse_opt(char *opt, struct ovl_config *config) |
5311 |
+ if (err) |
5312 |
+ return err; |
5313 |
+ |
5314 |
+- /* metacopy feature with upper requires redirect_dir=on */ |
5315 |
+- if (config->upperdir && config->metacopy && !config->redirect_dir) { |
5316 |
+- pr_warn("overlayfs: metadata only copy up requires \"redirect_dir=on\", falling back to metacopy=off.\n"); |
5317 |
+- config->metacopy = false; |
5318 |
+- } else if (config->metacopy && !config->redirect_follow) { |
5319 |
+- pr_warn("overlayfs: metadata only copy up requires \"redirect_dir=follow\" on non-upper mount, falling back to metacopy=off.\n"); |
5320 |
+- config->metacopy = false; |
5321 |
++ /* |
5322 |
++ * This is to make the logic below simpler. It doesn't make any other |
5323 |
++ * difference, since config->redirect_dir is only used for upper. |
5324 |
++ */ |
5325 |
++ if (!config->upperdir && config->redirect_follow) |
5326 |
++ config->redirect_dir = true; |
5327 |
++ |
5328 |
++ /* Resolve metacopy -> redirect_dir dependency */ |
5329 |
++ if (config->metacopy && !config->redirect_dir) { |
5330 |
++ if (metacopy_opt && redirect_opt) { |
5331 |
++ pr_err("overlayfs: conflicting options: metacopy=on,redirect_dir=%s\n", |
5332 |
++ config->redirect_mode); |
5333 |
++ return -EINVAL; |
5334 |
++ } |
5335 |
++ if (redirect_opt) { |
5336 |
++ /* |
5337 |
++ * There was an explicit redirect_dir=... that resulted |
5338 |
++ * in this conflict. |
5339 |
++ */ |
5340 |
++ pr_info("overlayfs: disabling metacopy due to redirect_dir=%s\n", |
5341 |
++ config->redirect_mode); |
5342 |
++ config->metacopy = false; |
5343 |
++ } else { |
5344 |
++ /* Automatically enable redirect otherwise. */ |
5345 |
++ config->redirect_follow = config->redirect_dir = true; |
5346 |
++ } |
5347 |
+ } |
5348 |
+ |
5349 |
+ return 0; |
5350 |
+diff --git a/fs/udf/super.c b/fs/udf/super.c |
5351 |
+index 6f515651a2c2..b997e3116e37 100644 |
5352 |
+--- a/fs/udf/super.c |
5353 |
++++ b/fs/udf/super.c |
5354 |
+@@ -613,14 +613,11 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options) |
5355 |
+ struct udf_options uopt; |
5356 |
+ struct udf_sb_info *sbi = UDF_SB(sb); |
5357 |
+ int error = 0; |
5358 |
+- struct logicalVolIntegrityDescImpUse *lvidiu = udf_sb_lvidiu(sb); |
5359 |
++ |
5360 |
++ if (!(*flags & SB_RDONLY) && UDF_QUERY_FLAG(sb, UDF_FLAG_RW_INCOMPAT)) |
5361 |
++ return -EACCES; |
5362 |
+ |
5363 |
+ sync_filesystem(sb); |
5364 |
+- if (lvidiu) { |
5365 |
+- int write_rev = le16_to_cpu(lvidiu->minUDFWriteRev); |
5366 |
+- if (write_rev > UDF_MAX_WRITE_VERSION && !(*flags & SB_RDONLY)) |
5367 |
+- return -EACCES; |
5368 |
+- } |
5369 |
+ |
5370 |
+ uopt.flags = sbi->s_flags; |
5371 |
+ uopt.uid = sbi->s_uid; |
5372 |
+@@ -1257,6 +1254,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block) |
5373 |
+ ret = -EACCES; |
5374 |
+ goto out_bh; |
5375 |
+ } |
5376 |
++ UDF_SET_FLAG(sb, UDF_FLAG_RW_INCOMPAT); |
5377 |
+ ret = udf_load_vat(sb, i, type1_idx); |
5378 |
+ if (ret < 0) |
5379 |
+ goto out_bh; |
5380 |
+@@ -2155,10 +2153,12 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) |
5381 |
+ UDF_MAX_READ_VERSION); |
5382 |
+ ret = -EINVAL; |
5383 |
+ goto error_out; |
5384 |
+- } else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION && |
5385 |
+- !sb_rdonly(sb)) { |
5386 |
+- ret = -EACCES; |
5387 |
+- goto error_out; |
5388 |
++ } else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION) { |
5389 |
++ if (!sb_rdonly(sb)) { |
5390 |
++ ret = -EACCES; |
5391 |
++ goto error_out; |
5392 |
++ } |
5393 |
++ UDF_SET_FLAG(sb, UDF_FLAG_RW_INCOMPAT); |
5394 |
+ } |
5395 |
+ |
5396 |
+ sbi->s_udfrev = minUDFWriteRev; |
5397 |
+@@ -2176,10 +2176,12 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) |
5398 |
+ } |
5399 |
+ |
5400 |
+ if (sbi->s_partmaps[sbi->s_partition].s_partition_flags & |
5401 |
+- UDF_PART_FLAG_READ_ONLY && |
5402 |
+- !sb_rdonly(sb)) { |
5403 |
+- ret = -EACCES; |
5404 |
+- goto error_out; |
5405 |
++ UDF_PART_FLAG_READ_ONLY) { |
5406 |
++ if (!sb_rdonly(sb)) { |
5407 |
++ ret = -EACCES; |
5408 |
++ goto error_out; |
5409 |
++ } |
5410 |
++ UDF_SET_FLAG(sb, UDF_FLAG_RW_INCOMPAT); |
5411 |
+ } |
5412 |
+ |
5413 |
+ if (udf_find_fileset(sb, &fileset, &rootdir)) { |
5414 |
+diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h |
5415 |
+index 9424d7cab790..d12e507e9eb2 100644 |
5416 |
+--- a/fs/udf/udf_sb.h |
5417 |
++++ b/fs/udf/udf_sb.h |
5418 |
+@@ -30,6 +30,8 @@ |
5419 |
+ #define UDF_FLAG_LASTBLOCK_SET 16 |
5420 |
+ #define UDF_FLAG_BLOCKSIZE_SET 17 |
5421 |
+ #define UDF_FLAG_INCONSISTENT 18 |
5422 |
++#define UDF_FLAG_RW_INCOMPAT 19 /* Set when we find RW incompatible |
5423 |
++ * feature */ |
5424 |
+ |
5425 |
+ #define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001 |
5426 |
+ #define UDF_PART_FLAG_UNALLOC_TABLE 0x0002 |
5427 |
+diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h |
5428 |
+index 49c93b9308d7..68bb09c29ce8 100644 |
5429 |
+--- a/include/linux/ceph/libceph.h |
5430 |
++++ b/include/linux/ceph/libceph.h |
5431 |
+@@ -81,7 +81,13 @@ struct ceph_options { |
5432 |
+ |
5433 |
+ #define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) |
5434 |
+ #define CEPH_MSG_MAX_MIDDLE_LEN (16*1024*1024) |
5435 |
+-#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) |
5436 |
++ |
5437 |
++/* |
5438 |
++ * Handle the largest possible rbd object in one message. |
5439 |
++ * There is no limit on the size of cephfs objects, but it has to obey |
5440 |
++ * rsize and wsize mount options anyway. |
5441 |
++ */ |
5442 |
++#define CEPH_MSG_MAX_DATA_LEN (32*1024*1024) |
5443 |
+ |
5444 |
+ #define CEPH_AUTH_NAME_DEFAULT "guest" |
5445 |
+ |
5446 |
+diff --git a/include/linux/i8253.h b/include/linux/i8253.h |
5447 |
+index e6bb36a97519..8336b2f6f834 100644 |
5448 |
+--- a/include/linux/i8253.h |
5449 |
++++ b/include/linux/i8253.h |
5450 |
+@@ -21,6 +21,7 @@ |
5451 |
+ #define PIT_LATCH ((PIT_TICK_RATE + HZ/2) / HZ) |
5452 |
+ |
5453 |
+ extern raw_spinlock_t i8253_lock; |
5454 |
++extern bool i8253_clear_counter_on_shutdown; |
5455 |
+ extern struct clock_event_device i8253_clockevent; |
5456 |
+ extern void clockevent_i8253_init(bool oneshot); |
5457 |
+ |
5458 |
+diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h |
5459 |
+index abe975c87b90..78b86dea2f29 100644 |
5460 |
+--- a/include/linux/mtd/nand.h |
5461 |
++++ b/include/linux/mtd/nand.h |
5462 |
+@@ -324,9 +324,8 @@ static inline unsigned int nanddev_ntargets(const struct nand_device *nand) |
5463 |
+ */ |
5464 |
+ static inline unsigned int nanddev_neraseblocks(const struct nand_device *nand) |
5465 |
+ { |
5466 |
+- return (u64)nand->memorg.luns_per_target * |
5467 |
+- nand->memorg.eraseblocks_per_lun * |
5468 |
+- nand->memorg.pages_per_eraseblock; |
5469 |
++ return nand->memorg.ntargets * nand->memorg.luns_per_target * |
5470 |
++ nand->memorg.eraseblocks_per_lun; |
5471 |
+ } |
5472 |
+ |
5473 |
+ /** |
5474 |
+diff --git a/include/linux/nmi.h b/include/linux/nmi.h |
5475 |
+index 08f9247e9827..9003e29cde46 100644 |
5476 |
+--- a/include/linux/nmi.h |
5477 |
++++ b/include/linux/nmi.h |
5478 |
+@@ -119,6 +119,8 @@ static inline int hardlockup_detector_perf_init(void) { return 0; } |
5479 |
+ void watchdog_nmi_stop(void); |
5480 |
+ void watchdog_nmi_start(void); |
5481 |
+ int watchdog_nmi_probe(void); |
5482 |
++int watchdog_nmi_enable(unsigned int cpu); |
5483 |
++void watchdog_nmi_disable(unsigned int cpu); |
5484 |
+ |
5485 |
+ /** |
5486 |
+ * touch_nmi_watchdog - restart NMI watchdog timeout. |
5487 |
+diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h |
5488 |
+index 01674b56e14f..71a87c36e2b6 100644 |
5489 |
+--- a/include/uapi/linux/kfd_ioctl.h |
5490 |
++++ b/include/uapi/linux/kfd_ioctl.h |
5491 |
+@@ -247,10 +247,10 @@ struct kfd_hsa_memory_exception_data { |
5492 |
+ |
5493 |
+ /* hw exception data */ |
5494 |
+ struct kfd_hsa_hw_exception_data { |
5495 |
+- uint32_t reset_type; |
5496 |
+- uint32_t reset_cause; |
5497 |
+- uint32_t memory_lost; |
5498 |
+- uint32_t gpu_id; |
5499 |
++ __u32 reset_type; |
5500 |
++ __u32 reset_cause; |
5501 |
++ __u32 memory_lost; |
5502 |
++ __u32 gpu_id; |
5503 |
+ }; |
5504 |
+ |
5505 |
+ /* Event data */ |
5506 |
+diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h |
5507 |
+index fd18c974a619..f6e798d42069 100644 |
5508 |
+--- a/include/xen/xen-ops.h |
5509 |
++++ b/include/xen/xen-ops.h |
5510 |
+@@ -41,7 +41,7 @@ int xen_setup_shutdown_event(void); |
5511 |
+ |
5512 |
+ extern unsigned long *xen_contiguous_bitmap; |
5513 |
+ |
5514 |
+-#ifdef CONFIG_XEN_PV |
5515 |
++#if defined(CONFIG_XEN_PV) || defined(CONFIG_ARM) || defined(CONFIG_ARM64) |
5516 |
+ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, |
5517 |
+ unsigned int address_bits, |
5518 |
+ dma_addr_t *dma_handle); |
5519 |
+diff --git a/kernel/debug/kdb/kdb_bt.c b/kernel/debug/kdb/kdb_bt.c |
5520 |
+index 6ad4a9fcbd6f..7921ae4fca8d 100644 |
5521 |
+--- a/kernel/debug/kdb/kdb_bt.c |
5522 |
++++ b/kernel/debug/kdb/kdb_bt.c |
5523 |
+@@ -179,14 +179,14 @@ kdb_bt(int argc, const char **argv) |
5524 |
+ kdb_printf("no process for cpu %ld\n", cpu); |
5525 |
+ return 0; |
5526 |
+ } |
5527 |
+- sprintf(buf, "btt 0x%p\n", KDB_TSK(cpu)); |
5528 |
++ sprintf(buf, "btt 0x%px\n", KDB_TSK(cpu)); |
5529 |
+ kdb_parse(buf); |
5530 |
+ return 0; |
5531 |
+ } |
5532 |
+ kdb_printf("btc: cpu status: "); |
5533 |
+ kdb_parse("cpu\n"); |
5534 |
+ for_each_online_cpu(cpu) { |
5535 |
+- sprintf(buf, "btt 0x%p\n", KDB_TSK(cpu)); |
5536 |
++ sprintf(buf, "btt 0x%px\n", KDB_TSK(cpu)); |
5537 |
+ kdb_parse(buf); |
5538 |
+ touch_nmi_watchdog(); |
5539 |
+ } |
5540 |
+diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c |
5541 |
+index 2ddfce8f1e8f..f338d23b112b 100644 |
5542 |
+--- a/kernel/debug/kdb/kdb_main.c |
5543 |
++++ b/kernel/debug/kdb/kdb_main.c |
5544 |
+@@ -1192,7 +1192,7 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs, |
5545 |
+ if (reason == KDB_REASON_DEBUG) { |
5546 |
+ /* special case below */ |
5547 |
+ } else { |
5548 |
+- kdb_printf("\nEntering kdb (current=0x%p, pid %d) ", |
5549 |
++ kdb_printf("\nEntering kdb (current=0x%px, pid %d) ", |
5550 |
+ kdb_current, kdb_current ? kdb_current->pid : 0); |
5551 |
+ #if defined(CONFIG_SMP) |
5552 |
+ kdb_printf("on processor %d ", raw_smp_processor_id()); |
5553 |
+@@ -1208,7 +1208,7 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs, |
5554 |
+ */ |
5555 |
+ switch (db_result) { |
5556 |
+ case KDB_DB_BPT: |
5557 |
+- kdb_printf("\nEntering kdb (0x%p, pid %d) ", |
5558 |
++ kdb_printf("\nEntering kdb (0x%px, pid %d) ", |
5559 |
+ kdb_current, kdb_current->pid); |
5560 |
+ #if defined(CONFIG_SMP) |
5561 |
+ kdb_printf("on processor %d ", raw_smp_processor_id()); |
5562 |
+@@ -2048,7 +2048,7 @@ static int kdb_lsmod(int argc, const char **argv) |
5563 |
+ if (mod->state == MODULE_STATE_UNFORMED) |
5564 |
+ continue; |
5565 |
+ |
5566 |
+- kdb_printf("%-20s%8u 0x%p ", mod->name, |
5567 |
++ kdb_printf("%-20s%8u 0x%px ", mod->name, |
5568 |
+ mod->core_layout.size, (void *)mod); |
5569 |
+ #ifdef CONFIG_MODULE_UNLOAD |
5570 |
+ kdb_printf("%4d ", module_refcount(mod)); |
5571 |
+@@ -2059,7 +2059,7 @@ static int kdb_lsmod(int argc, const char **argv) |
5572 |
+ kdb_printf(" (Loading)"); |
5573 |
+ else |
5574 |
+ kdb_printf(" (Live)"); |
5575 |
+- kdb_printf(" 0x%p", mod->core_layout.base); |
5576 |
++ kdb_printf(" 0x%px", mod->core_layout.base); |
5577 |
+ |
5578 |
+ #ifdef CONFIG_MODULE_UNLOAD |
5579 |
+ { |
5580 |
+@@ -2341,7 +2341,7 @@ void kdb_ps1(const struct task_struct *p) |
5581 |
+ return; |
5582 |
+ |
5583 |
+ cpu = kdb_process_cpu(p); |
5584 |
+- kdb_printf("0x%p %8d %8d %d %4d %c 0x%p %c%s\n", |
5585 |
++ kdb_printf("0x%px %8d %8d %d %4d %c 0x%px %c%s\n", |
5586 |
+ (void *)p, p->pid, p->parent->pid, |
5587 |
+ kdb_task_has_cpu(p), kdb_process_cpu(p), |
5588 |
+ kdb_task_state_char(p), |
5589 |
+@@ -2354,7 +2354,7 @@ void kdb_ps1(const struct task_struct *p) |
5590 |
+ } else { |
5591 |
+ if (KDB_TSK(cpu) != p) |
5592 |
+ kdb_printf(" Error: does not match running " |
5593 |
+- "process table (0x%p)\n", KDB_TSK(cpu)); |
5594 |
++ "process table (0x%px)\n", KDB_TSK(cpu)); |
5595 |
+ } |
5596 |
+ } |
5597 |
+ } |
5598 |
+@@ -2692,7 +2692,7 @@ int kdb_register_flags(char *cmd, |
5599 |
+ for_each_kdbcmd(kp, i) { |
5600 |
+ if (kp->cmd_name && (strcmp(kp->cmd_name, cmd) == 0)) { |
5601 |
+ kdb_printf("Duplicate kdb command registered: " |
5602 |
+- "%s, func %p help %s\n", cmd, func, help); |
5603 |
++ "%s, func %px help %s\n", cmd, func, help); |
5604 |
+ return 1; |
5605 |
+ } |
5606 |
+ } |
5607 |
+diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c |
5608 |
+index 990b3cc526c8..987eb73284d2 100644 |
5609 |
+--- a/kernel/debug/kdb/kdb_support.c |
5610 |
++++ b/kernel/debug/kdb/kdb_support.c |
5611 |
+@@ -40,7 +40,7 @@ |
5612 |
+ int kdbgetsymval(const char *symname, kdb_symtab_t *symtab) |
5613 |
+ { |
5614 |
+ if (KDB_DEBUG(AR)) |
5615 |
+- kdb_printf("kdbgetsymval: symname=%s, symtab=%p\n", symname, |
5616 |
++ kdb_printf("kdbgetsymval: symname=%s, symtab=%px\n", symname, |
5617 |
+ symtab); |
5618 |
+ memset(symtab, 0, sizeof(*symtab)); |
5619 |
+ symtab->sym_start = kallsyms_lookup_name(symname); |
5620 |
+@@ -88,7 +88,7 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab) |
5621 |
+ char *knt1 = NULL; |
5622 |
+ |
5623 |
+ if (KDB_DEBUG(AR)) |
5624 |
+- kdb_printf("kdbnearsym: addr=0x%lx, symtab=%p\n", addr, symtab); |
5625 |
++ kdb_printf("kdbnearsym: addr=0x%lx, symtab=%px\n", addr, symtab); |
5626 |
+ memset(symtab, 0, sizeof(*symtab)); |
5627 |
+ |
5628 |
+ if (addr < 4096) |
5629 |
+@@ -149,7 +149,7 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab) |
5630 |
+ symtab->mod_name = "kernel"; |
5631 |
+ if (KDB_DEBUG(AR)) |
5632 |
+ kdb_printf("kdbnearsym: returns %d symtab->sym_start=0x%lx, " |
5633 |
+- "symtab->mod_name=%p, symtab->sym_name=%p (%s)\n", ret, |
5634 |
++ "symtab->mod_name=%px, symtab->sym_name=%px (%s)\n", ret, |
5635 |
+ symtab->sym_start, symtab->mod_name, symtab->sym_name, |
5636 |
+ symtab->sym_name); |
5637 |
+ |
5638 |
+@@ -887,13 +887,13 @@ void debug_kusage(void) |
5639 |
+ __func__, dah_first); |
5640 |
+ if (dah_first) { |
5641 |
+ h_used = (struct debug_alloc_header *)debug_alloc_pool; |
5642 |
+- kdb_printf("%s: h_used %p size %d\n", __func__, h_used, |
5643 |
++ kdb_printf("%s: h_used %px size %d\n", __func__, h_used, |
5644 |
+ h_used->size); |
5645 |
+ } |
5646 |
+ do { |
5647 |
+ h_used = (struct debug_alloc_header *) |
5648 |
+ ((char *)h_free + dah_overhead + h_free->size); |
5649 |
+- kdb_printf("%s: h_used %p size %d caller %p\n", |
5650 |
++ kdb_printf("%s: h_used %px size %d caller %px\n", |
5651 |
+ __func__, h_used, h_used->size, h_used->caller); |
5652 |
+ h_free = (struct debug_alloc_header *) |
5653 |
+ (debug_alloc_pool + h_free->next); |
5654 |
+@@ -902,7 +902,7 @@ void debug_kusage(void) |
5655 |
+ ((char *)h_free + dah_overhead + h_free->size); |
5656 |
+ if ((char *)h_used - debug_alloc_pool != |
5657 |
+ sizeof(debug_alloc_pool_aligned)) |
5658 |
+- kdb_printf("%s: h_used %p size %d caller %p\n", |
5659 |
++ kdb_printf("%s: h_used %px size %d caller %px\n", |
5660 |
+ __func__, h_used, h_used->size, h_used->caller); |
5661 |
+ out: |
5662 |
+ spin_unlock(&dap_lock); |
5663 |
+diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c |
5664 |
+index c30032367aab..f9a0cd094b81 100644 |
5665 |
+--- a/kernel/trace/trace_kprobe.c |
5666 |
++++ b/kernel/trace/trace_kprobe.c |
5667 |
+@@ -61,9 +61,23 @@ static nokprobe_inline bool trace_kprobe_within_module(struct trace_kprobe *tk, |
5668 |
+ return strncmp(mod->name, name, len) == 0 && name[len] == ':'; |
5669 |
+ } |
5670 |
+ |
5671 |
+-static nokprobe_inline bool trace_kprobe_is_on_module(struct trace_kprobe *tk) |
5672 |
++static nokprobe_inline bool trace_kprobe_module_exist(struct trace_kprobe *tk) |
5673 |
+ { |
5674 |
+- return !!strchr(trace_kprobe_symbol(tk), ':'); |
5675 |
++ char *p; |
5676 |
++ bool ret; |
5677 |
++ |
5678 |
++ if (!tk->symbol) |
5679 |
++ return false; |
5680 |
++ p = strchr(tk->symbol, ':'); |
5681 |
++ if (!p) |
5682 |
++ return true; |
5683 |
++ *p = '\0'; |
5684 |
++ mutex_lock(&module_mutex); |
5685 |
++ ret = !!find_module(tk->symbol); |
5686 |
++ mutex_unlock(&module_mutex); |
5687 |
++ *p = ':'; |
5688 |
++ |
5689 |
++ return ret; |
5690 |
+ } |
5691 |
+ |
5692 |
+ static nokprobe_inline unsigned long trace_kprobe_nhit(struct trace_kprobe *tk) |
5693 |
+@@ -554,19 +568,13 @@ static int __register_trace_kprobe(struct trace_kprobe *tk) |
5694 |
+ else |
5695 |
+ ret = register_kprobe(&tk->rp.kp); |
5696 |
+ |
5697 |
+- if (ret == 0) |
5698 |
++ if (ret == 0) { |
5699 |
+ tk->tp.flags |= TP_FLAG_REGISTERED; |
5700 |
+- else { |
5701 |
+- if (ret == -ENOENT && trace_kprobe_is_on_module(tk)) { |
5702 |
+- pr_warn("This probe might be able to register after target module is loaded. Continue.\n"); |
5703 |
+- ret = 0; |
5704 |
+- } else if (ret == -EILSEQ) { |
5705 |
+- pr_warn("Probing address(0x%p) is not an instruction boundary.\n", |
5706 |
+- tk->rp.kp.addr); |
5707 |
+- ret = -EINVAL; |
5708 |
+- } |
5709 |
++ } else if (ret == -EILSEQ) { |
5710 |
++ pr_warn("Probing address(0x%p) is not an instruction boundary.\n", |
5711 |
++ tk->rp.kp.addr); |
5712 |
++ ret = -EINVAL; |
5713 |
+ } |
5714 |
+- |
5715 |
+ return ret; |
5716 |
+ } |
5717 |
+ |
5718 |
+@@ -629,6 +637,11 @@ static int register_trace_kprobe(struct trace_kprobe *tk) |
5719 |
+ |
5720 |
+ /* Register k*probe */ |
5721 |
+ ret = __register_trace_kprobe(tk); |
5722 |
++ if (ret == -ENOENT && !trace_kprobe_module_exist(tk)) { |
5723 |
++ pr_warn("This probe might be able to register after target module is loaded. Continue.\n"); |
5724 |
++ ret = 0; |
5725 |
++ } |
5726 |
++ |
5727 |
+ if (ret < 0) |
5728 |
+ unregister_kprobe_event(tk); |
5729 |
+ else |
5730 |
+diff --git a/lib/ubsan.c b/lib/ubsan.c |
5731 |
+index 59fee96c29a0..e4162f59a81c 100644 |
5732 |
+--- a/lib/ubsan.c |
5733 |
++++ b/lib/ubsan.c |
5734 |
+@@ -427,8 +427,7 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, |
5735 |
+ EXPORT_SYMBOL(__ubsan_handle_shift_out_of_bounds); |
5736 |
+ |
5737 |
+ |
5738 |
+-void __noreturn |
5739 |
+-__ubsan_handle_builtin_unreachable(struct unreachable_data *data) |
5740 |
++void __ubsan_handle_builtin_unreachable(struct unreachable_data *data) |
5741 |
+ { |
5742 |
+ unsigned long flags; |
5743 |
+ |
5744 |
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
5745 |
+index 7b5c0ad9a6bd..1931a3d9b282 100644 |
5746 |
+--- a/mm/hugetlb.c |
5747 |
++++ b/mm/hugetlb.c |
5748 |
+@@ -3233,7 +3233,7 @@ static int is_hugetlb_entry_hwpoisoned(pte_t pte) |
5749 |
+ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, |
5750 |
+ struct vm_area_struct *vma) |
5751 |
+ { |
5752 |
+- pte_t *src_pte, *dst_pte, entry; |
5753 |
++ pte_t *src_pte, *dst_pte, entry, dst_entry; |
5754 |
+ struct page *ptepage; |
5755 |
+ unsigned long addr; |
5756 |
+ int cow; |
5757 |
+@@ -3261,15 +3261,30 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, |
5758 |
+ break; |
5759 |
+ } |
5760 |
+ |
5761 |
+- /* If the pagetables are shared don't copy or take references */ |
5762 |
+- if (dst_pte == src_pte) |
5763 |
++ /* |
5764 |
++ * If the pagetables are shared don't copy or take references. |
5765 |
++ * dst_pte == src_pte is the common case of src/dest sharing. |
5766 |
++ * |
5767 |
++ * However, src could have 'unshared' and dst shares with |
5768 |
++ * another vma. If dst_pte !none, this implies sharing. |
5769 |
++ * Check here before taking page table lock, and once again |
5770 |
++ * after taking the lock below. |
5771 |
++ */ |
5772 |
++ dst_entry = huge_ptep_get(dst_pte); |
5773 |
++ if ((dst_pte == src_pte) || !huge_pte_none(dst_entry)) |
5774 |
+ continue; |
5775 |
+ |
5776 |
+ dst_ptl = huge_pte_lock(h, dst, dst_pte); |
5777 |
+ src_ptl = huge_pte_lockptr(h, src, src_pte); |
5778 |
+ spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING); |
5779 |
+ entry = huge_ptep_get(src_pte); |
5780 |
+- if (huge_pte_none(entry)) { /* skip none entry */ |
5781 |
++ dst_entry = huge_ptep_get(dst_pte); |
5782 |
++ if (huge_pte_none(entry) || !huge_pte_none(dst_entry)) { |
5783 |
++ /* |
5784 |
++ * Skip if src entry none. Also, skip in the |
5785 |
++ * unlikely case dst entry !none as this implies |
5786 |
++ * sharing with another vma. |
5787 |
++ */ |
5788 |
+ ; |
5789 |
+ } else if (unlikely(is_hugetlb_entry_migration(entry) || |
5790 |
+ is_hugetlb_entry_hwpoisoned(entry))) { |
5791 |
+diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c |
5792 |
+index 38d94b703e9d..f3f919728f5c 100644 |
5793 |
+--- a/mm/memory_hotplug.c |
5794 |
++++ b/mm/memory_hotplug.c |
5795 |
+@@ -587,6 +587,7 @@ int __remove_pages(struct zone *zone, unsigned long phys_start_pfn, |
5796 |
+ for (i = 0; i < sections_to_remove; i++) { |
5797 |
+ unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION; |
5798 |
+ |
5799 |
++ cond_resched(); |
5800 |
+ ret = __remove_section(zone, __pfn_to_section(pfn), map_offset, |
5801 |
+ altmap); |
5802 |
+ map_offset = 0; |
5803 |
+diff --git a/mm/mempolicy.c b/mm/mempolicy.c |
5804 |
+index da858f794eb6..149b6f4cf023 100644 |
5805 |
+--- a/mm/mempolicy.c |
5806 |
++++ b/mm/mempolicy.c |
5807 |
+@@ -2046,8 +2046,36 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, |
5808 |
+ nmask = policy_nodemask(gfp, pol); |
5809 |
+ if (!nmask || node_isset(hpage_node, *nmask)) { |
5810 |
+ mpol_cond_put(pol); |
5811 |
+- page = __alloc_pages_node(hpage_node, |
5812 |
+- gfp | __GFP_THISNODE, order); |
5813 |
++ /* |
5814 |
++ * We cannot invoke reclaim if __GFP_THISNODE |
5815 |
++ * is set. Invoking reclaim with |
5816 |
++ * __GFP_THISNODE set, would cause THP |
5817 |
++ * allocations to trigger heavy swapping |
5818 |
++ * despite there may be tons of free memory |
5819 |
++ * (including potentially plenty of THP |
5820 |
++ * already available in the buddy) on all the |
5821 |
++ * other NUMA nodes. |
5822 |
++ * |
5823 |
++ * At most we could invoke compaction when |
5824 |
++ * __GFP_THISNODE is set (but we would need to |
5825 |
++ * refrain from invoking reclaim even if |
5826 |
++ * compaction returned COMPACT_SKIPPED because |
5827 |
++ * there wasn't not enough memory to succeed |
5828 |
++ * compaction). For now just avoid |
5829 |
++ * __GFP_THISNODE instead of limiting the |
5830 |
++ * allocation path to a strict and single |
5831 |
++ * compaction invocation. |
5832 |
++ * |
5833 |
++ * Supposedly if direct reclaim was enabled by |
5834 |
++ * the caller, the app prefers THP regardless |
5835 |
++ * of the node it comes from so this would be |
5836 |
++ * more desiderable behavior than only |
5837 |
++ * providing THP originated from the local |
5838 |
++ * node in such case. |
5839 |
++ */ |
5840 |
++ if (!(gfp & __GFP_DIRECT_RECLAIM)) |
5841 |
++ gfp |= __GFP_THISNODE; |
5842 |
++ page = __alloc_pages_node(hpage_node, gfp, order); |
5843 |
+ goto out; |
5844 |
+ } |
5845 |
+ } |
5846 |
+diff --git a/mm/swapfile.c b/mm/swapfile.c |
5847 |
+index d954b71c4f9c..8810a6d7d67f 100644 |
5848 |
+--- a/mm/swapfile.c |
5849 |
++++ b/mm/swapfile.c |
5850 |
+@@ -2820,7 +2820,7 @@ static struct swap_info_struct *alloc_swap_info(void) |
5851 |
+ unsigned int type; |
5852 |
+ int i; |
5853 |
+ |
5854 |
+- p = kzalloc(sizeof(*p), GFP_KERNEL); |
5855 |
++ p = kvzalloc(sizeof(*p), GFP_KERNEL); |
5856 |
+ if (!p) |
5857 |
+ return ERR_PTR(-ENOMEM); |
5858 |
+ |
5859 |
+@@ -2831,7 +2831,7 @@ static struct swap_info_struct *alloc_swap_info(void) |
5860 |
+ } |
5861 |
+ if (type >= MAX_SWAPFILES) { |
5862 |
+ spin_unlock(&swap_lock); |
5863 |
+- kfree(p); |
5864 |
++ kvfree(p); |
5865 |
+ return ERR_PTR(-EPERM); |
5866 |
+ } |
5867 |
+ if (type >= nr_swapfiles) { |
5868 |
+@@ -2845,7 +2845,7 @@ static struct swap_info_struct *alloc_swap_info(void) |
5869 |
+ smp_wmb(); |
5870 |
+ nr_swapfiles++; |
5871 |
+ } else { |
5872 |
+- kfree(p); |
5873 |
++ kvfree(p); |
5874 |
+ p = swap_info[type]; |
5875 |
+ /* |
5876 |
+ * Do not memset this entry: a racing procfs swap_next() |
5877 |
+diff --git a/net/9p/protocol.c b/net/9p/protocol.c |
5878 |
+index 4a1e1dd30b52..ee32bbf12675 100644 |
5879 |
+--- a/net/9p/protocol.c |
5880 |
++++ b/net/9p/protocol.c |
5881 |
+@@ -46,10 +46,15 @@ p9pdu_writef(struct p9_fcall *pdu, int proto_version, const char *fmt, ...); |
5882 |
+ void p9stat_free(struct p9_wstat *stbuf) |
5883 |
+ { |
5884 |
+ kfree(stbuf->name); |
5885 |
++ stbuf->name = NULL; |
5886 |
+ kfree(stbuf->uid); |
5887 |
++ stbuf->uid = NULL; |
5888 |
+ kfree(stbuf->gid); |
5889 |
++ stbuf->gid = NULL; |
5890 |
+ kfree(stbuf->muid); |
5891 |
++ stbuf->muid = NULL; |
5892 |
+ kfree(stbuf->extension); |
5893 |
++ stbuf->extension = NULL; |
5894 |
+ } |
5895 |
+ EXPORT_SYMBOL(p9stat_free); |
5896 |
+ |
5897 |
+diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c |
5898 |
+index a676d5f76bdc..277d02a8cac8 100644 |
5899 |
+--- a/net/netfilter/nf_conntrack_core.c |
5900 |
++++ b/net/netfilter/nf_conntrack_core.c |
5901 |
+@@ -1073,19 +1073,22 @@ static unsigned int early_drop_list(struct net *net, |
5902 |
+ return drops; |
5903 |
+ } |
5904 |
+ |
5905 |
+-static noinline int early_drop(struct net *net, unsigned int _hash) |
5906 |
++static noinline int early_drop(struct net *net, unsigned int hash) |
5907 |
+ { |
5908 |
+- unsigned int i; |
5909 |
++ unsigned int i, bucket; |
5910 |
+ |
5911 |
+ for (i = 0; i < NF_CT_EVICTION_RANGE; i++) { |
5912 |
+ struct hlist_nulls_head *ct_hash; |
5913 |
+- unsigned int hash, hsize, drops; |
5914 |
++ unsigned int hsize, drops; |
5915 |
+ |
5916 |
+ rcu_read_lock(); |
5917 |
+ nf_conntrack_get_ht(&ct_hash, &hsize); |
5918 |
+- hash = reciprocal_scale(_hash++, hsize); |
5919 |
++ if (!i) |
5920 |
++ bucket = reciprocal_scale(hash, hsize); |
5921 |
++ else |
5922 |
++ bucket = (bucket + 1) % hsize; |
5923 |
+ |
5924 |
+- drops = early_drop_list(net, &ct_hash[hash]); |
5925 |
++ drops = early_drop_list(net, &ct_hash[bucket]); |
5926 |
+ rcu_read_unlock(); |
5927 |
+ |
5928 |
+ if (drops) { |
5929 |
+diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c |
5930 |
+index 30afbd236656..b53cc0960b5d 100644 |
5931 |
+--- a/net/sunrpc/xdr.c |
5932 |
++++ b/net/sunrpc/xdr.c |
5933 |
+@@ -639,11 +639,10 @@ void xdr_truncate_encode(struct xdr_stream *xdr, size_t len) |
5934 |
+ WARN_ON_ONCE(xdr->iov); |
5935 |
+ return; |
5936 |
+ } |
5937 |
+- if (fraglen) { |
5938 |
++ if (fraglen) |
5939 |
+ xdr->end = head->iov_base + head->iov_len; |
5940 |
+- xdr->page_ptr--; |
5941 |
+- } |
5942 |
+ /* (otherwise assume xdr->end is already set) */ |
5943 |
++ xdr->page_ptr--; |
5944 |
+ head->iov_len = len; |
5945 |
+ buf->len = len; |
5946 |
+ xdr->p = head->iov_base + head->iov_len; |
5947 |
+diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py |
5948 |
+index 839e190bbd7a..5056fb3b897d 100755 |
5949 |
+--- a/scripts/spdxcheck.py |
5950 |
++++ b/scripts/spdxcheck.py |
5951 |
+@@ -168,7 +168,6 @@ class id_parser(object): |
5952 |
+ self.curline = 0 |
5953 |
+ try: |
5954 |
+ for line in fd: |
5955 |
+- line = line.decode(locale.getpreferredencoding(False), errors='ignore') |
5956 |
+ self.curline += 1 |
5957 |
+ if self.curline > maxlines: |
5958 |
+ break |
5959 |
+diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
5960 |
+index 18b98b5e1e3c..fe251c6f09f1 100644 |
5961 |
+--- a/security/selinux/hooks.c |
5962 |
++++ b/security/selinux/hooks.c |
5963 |
+@@ -5318,6 +5318,9 @@ static int selinux_sctp_bind_connect(struct sock *sk, int optname, |
5964 |
+ addr_buf = address; |
5965 |
+ |
5966 |
+ while (walk_size < addrlen) { |
5967 |
++ if (walk_size + sizeof(sa_family_t) > addrlen) |
5968 |
++ return -EINVAL; |
5969 |
++ |
5970 |
+ addr = addr_buf; |
5971 |
+ switch (addr->sa_family) { |
5972 |
+ case AF_UNSPEC: |
5973 |
+diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c |
5974 |
+index 2ae640257fdb..ca577658e890 100644 |
5975 |
+--- a/tools/perf/util/cs-etm.c |
5976 |
++++ b/tools/perf/util/cs-etm.c |
5977 |
+@@ -244,6 +244,27 @@ static void cs_etm__free(struct perf_session *session) |
5978 |
+ zfree(&aux); |
5979 |
+ } |
5980 |
+ |
5981 |
++static u8 cs_etm__cpu_mode(struct cs_etm_queue *etmq, u64 address) |
5982 |
++{ |
5983 |
++ struct machine *machine; |
5984 |
++ |
5985 |
++ machine = etmq->etm->machine; |
5986 |
++ |
5987 |
++ if (address >= etmq->etm->kernel_start) { |
5988 |
++ if (machine__is_host(machine)) |
5989 |
++ return PERF_RECORD_MISC_KERNEL; |
5990 |
++ else |
5991 |
++ return PERF_RECORD_MISC_GUEST_KERNEL; |
5992 |
++ } else { |
5993 |
++ if (machine__is_host(machine)) |
5994 |
++ return PERF_RECORD_MISC_USER; |
5995 |
++ else if (perf_guest) |
5996 |
++ return PERF_RECORD_MISC_GUEST_USER; |
5997 |
++ else |
5998 |
++ return PERF_RECORD_MISC_HYPERVISOR; |
5999 |
++ } |
6000 |
++} |
6001 |
++ |
6002 |
+ static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u64 address, |
6003 |
+ size_t size, u8 *buffer) |
6004 |
+ { |
6005 |
+@@ -258,10 +279,7 @@ static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u64 address, |
6006 |
+ return -1; |
6007 |
+ |
6008 |
+ machine = etmq->etm->machine; |
6009 |
+- if (address >= etmq->etm->kernel_start) |
6010 |
+- cpumode = PERF_RECORD_MISC_KERNEL; |
6011 |
+- else |
6012 |
+- cpumode = PERF_RECORD_MISC_USER; |
6013 |
++ cpumode = cs_etm__cpu_mode(etmq, address); |
6014 |
+ |
6015 |
+ thread = etmq->thread; |
6016 |
+ if (!thread) { |
6017 |
+@@ -653,7 +671,7 @@ static int cs_etm__synth_instruction_sample(struct cs_etm_queue *etmq, |
6018 |
+ struct perf_sample sample = {.ip = 0,}; |
6019 |
+ |
6020 |
+ event->sample.header.type = PERF_RECORD_SAMPLE; |
6021 |
+- event->sample.header.misc = PERF_RECORD_MISC_USER; |
6022 |
++ event->sample.header.misc = cs_etm__cpu_mode(etmq, addr); |
6023 |
+ event->sample.header.size = sizeof(struct perf_event_header); |
6024 |
+ |
6025 |
+ sample.ip = addr; |
6026 |
+@@ -665,7 +683,7 @@ static int cs_etm__synth_instruction_sample(struct cs_etm_queue *etmq, |
6027 |
+ sample.cpu = etmq->packet->cpu; |
6028 |
+ sample.flags = 0; |
6029 |
+ sample.insn_len = 1; |
6030 |
+- sample.cpumode = event->header.misc; |
6031 |
++ sample.cpumode = event->sample.header.misc; |
6032 |
+ |
6033 |
+ if (etm->synth_opts.last_branch) { |
6034 |
+ cs_etm__copy_last_branch_rb(etmq); |
6035 |
+@@ -706,12 +724,15 @@ static int cs_etm__synth_branch_sample(struct cs_etm_queue *etmq) |
6036 |
+ u64 nr; |
6037 |
+ struct branch_entry entries; |
6038 |
+ } dummy_bs; |
6039 |
++ u64 ip; |
6040 |
++ |
6041 |
++ ip = cs_etm__last_executed_instr(etmq->prev_packet); |
6042 |
+ |
6043 |
+ event->sample.header.type = PERF_RECORD_SAMPLE; |
6044 |
+- event->sample.header.misc = PERF_RECORD_MISC_USER; |
6045 |
++ event->sample.header.misc = cs_etm__cpu_mode(etmq, ip); |
6046 |
+ event->sample.header.size = sizeof(struct perf_event_header); |
6047 |
+ |
6048 |
+- sample.ip = cs_etm__last_executed_instr(etmq->prev_packet); |
6049 |
++ sample.ip = ip; |
6050 |
+ sample.pid = etmq->pid; |
6051 |
+ sample.tid = etmq->tid; |
6052 |
+ sample.addr = cs_etm__first_executed_instr(etmq->packet); |
6053 |
+@@ -720,7 +741,7 @@ static int cs_etm__synth_branch_sample(struct cs_etm_queue *etmq) |
6054 |
+ sample.period = 1; |
6055 |
+ sample.cpu = etmq->packet->cpu; |
6056 |
+ sample.flags = 0; |
6057 |
+- sample.cpumode = PERF_RECORD_MISC_USER; |
6058 |
++ sample.cpumode = event->sample.header.misc; |
6059 |
+ |
6060 |
+ /* |
6061 |
+ * perf report cannot handle events without a branch stack |
6062 |
+diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c |
6063 |
+index 7f0c83b6332b..7127bc917fc5 100644 |
6064 |
+--- a/tools/perf/util/intel-bts.c |
6065 |
++++ b/tools/perf/util/intel-bts.c |
6066 |
+@@ -269,6 +269,13 @@ static int intel_bts_do_fix_overlap(struct auxtrace_queue *queue, |
6067 |
+ return 0; |
6068 |
+ } |
6069 |
+ |
6070 |
++static inline u8 intel_bts_cpumode(struct intel_bts *bts, uint64_t ip) |
6071 |
++{ |
6072 |
++ return machine__kernel_ip(bts->machine, ip) ? |
6073 |
++ PERF_RECORD_MISC_KERNEL : |
6074 |
++ PERF_RECORD_MISC_USER; |
6075 |
++} |
6076 |
++ |
6077 |
+ static int intel_bts_synth_branch_sample(struct intel_bts_queue *btsq, |
6078 |
+ struct branch *branch) |
6079 |
+ { |
6080 |
+@@ -281,12 +288,8 @@ static int intel_bts_synth_branch_sample(struct intel_bts_queue *btsq, |
6081 |
+ bts->num_events++ <= bts->synth_opts.initial_skip) |
6082 |
+ return 0; |
6083 |
+ |
6084 |
+- event.sample.header.type = PERF_RECORD_SAMPLE; |
6085 |
+- event.sample.header.misc = PERF_RECORD_MISC_USER; |
6086 |
+- event.sample.header.size = sizeof(struct perf_event_header); |
6087 |
+- |
6088 |
+- sample.cpumode = PERF_RECORD_MISC_USER; |
6089 |
+ sample.ip = le64_to_cpu(branch->from); |
6090 |
++ sample.cpumode = intel_bts_cpumode(bts, sample.ip); |
6091 |
+ sample.pid = btsq->pid; |
6092 |
+ sample.tid = btsq->tid; |
6093 |
+ sample.addr = le64_to_cpu(branch->to); |
6094 |
+@@ -298,6 +301,10 @@ static int intel_bts_synth_branch_sample(struct intel_bts_queue *btsq, |
6095 |
+ sample.insn_len = btsq->intel_pt_insn.length; |
6096 |
+ memcpy(sample.insn, btsq->intel_pt_insn.buf, INTEL_PT_INSN_BUF_SZ); |
6097 |
+ |
6098 |
++ event.sample.header.type = PERF_RECORD_SAMPLE; |
6099 |
++ event.sample.header.misc = sample.cpumode; |
6100 |
++ event.sample.header.size = sizeof(struct perf_event_header); |
6101 |
++ |
6102 |
+ if (bts->synth_opts.inject) { |
6103 |
+ event.sample.header.size = bts->branches_event_size; |
6104 |
+ ret = perf_event__synthesize_sample(&event, |
6105 |
+diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c |
6106 |
+index aec68908d604..4f48bc11a29c 100644 |
6107 |
+--- a/tools/perf/util/intel-pt.c |
6108 |
++++ b/tools/perf/util/intel-pt.c |
6109 |
+@@ -407,6 +407,13 @@ intel_pt_cache_lookup(struct dso *dso, struct machine *machine, u64 offset) |
6110 |
+ return auxtrace_cache__lookup(dso->auxtrace_cache, offset); |
6111 |
+ } |
6112 |
+ |
6113 |
++static inline u8 intel_pt_cpumode(struct intel_pt *pt, uint64_t ip) |
6114 |
++{ |
6115 |
++ return ip >= pt->kernel_start ? |
6116 |
++ PERF_RECORD_MISC_KERNEL : |
6117 |
++ PERF_RECORD_MISC_USER; |
6118 |
++} |
6119 |
++ |
6120 |
+ static int intel_pt_walk_next_insn(struct intel_pt_insn *intel_pt_insn, |
6121 |
+ uint64_t *insn_cnt_ptr, uint64_t *ip, |
6122 |
+ uint64_t to_ip, uint64_t max_insn_cnt, |
6123 |
+@@ -429,10 +436,7 @@ static int intel_pt_walk_next_insn(struct intel_pt_insn *intel_pt_insn, |
6124 |
+ if (to_ip && *ip == to_ip) |
6125 |
+ goto out_no_cache; |
6126 |
+ |
6127 |
+- if (*ip >= ptq->pt->kernel_start) |
6128 |
+- cpumode = PERF_RECORD_MISC_KERNEL; |
6129 |
+- else |
6130 |
+- cpumode = PERF_RECORD_MISC_USER; |
6131 |
++ cpumode = intel_pt_cpumode(ptq->pt, *ip); |
6132 |
+ |
6133 |
+ thread = ptq->thread; |
6134 |
+ if (!thread) { |
6135 |
+@@ -759,7 +763,8 @@ static struct intel_pt_queue *intel_pt_alloc_queue(struct intel_pt *pt, |
6136 |
+ if (pt->synth_opts.callchain) { |
6137 |
+ size_t sz = sizeof(struct ip_callchain); |
6138 |
+ |
6139 |
+- sz += pt->synth_opts.callchain_sz * sizeof(u64); |
6140 |
++ /* Add 1 to callchain_sz for callchain context */ |
6141 |
++ sz += (pt->synth_opts.callchain_sz + 1) * sizeof(u64); |
6142 |
+ ptq->chain = zalloc(sz); |
6143 |
+ if (!ptq->chain) |
6144 |
+ goto out_free; |
6145 |
+@@ -1053,15 +1058,11 @@ static void intel_pt_prep_b_sample(struct intel_pt *pt, |
6146 |
+ union perf_event *event, |
6147 |
+ struct perf_sample *sample) |
6148 |
+ { |
6149 |
+- event->sample.header.type = PERF_RECORD_SAMPLE; |
6150 |
+- event->sample.header.misc = PERF_RECORD_MISC_USER; |
6151 |
+- event->sample.header.size = sizeof(struct perf_event_header); |
6152 |
+- |
6153 |
+ if (!pt->timeless_decoding) |
6154 |
+ sample->time = tsc_to_perf_time(ptq->timestamp, &pt->tc); |
6155 |
+ |
6156 |
+- sample->cpumode = PERF_RECORD_MISC_USER; |
6157 |
+ sample->ip = ptq->state->from_ip; |
6158 |
++ sample->cpumode = intel_pt_cpumode(pt, sample->ip); |
6159 |
+ sample->pid = ptq->pid; |
6160 |
+ sample->tid = ptq->tid; |
6161 |
+ sample->addr = ptq->state->to_ip; |
6162 |
+@@ -1070,6 +1071,10 @@ static void intel_pt_prep_b_sample(struct intel_pt *pt, |
6163 |
+ sample->flags = ptq->flags; |
6164 |
+ sample->insn_len = ptq->insn_len; |
6165 |
+ memcpy(sample->insn, ptq->insn, INTEL_PT_INSN_BUF_SZ); |
6166 |
++ |
6167 |
++ event->sample.header.type = PERF_RECORD_SAMPLE; |
6168 |
++ event->sample.header.misc = sample->cpumode; |
6169 |
++ event->sample.header.size = sizeof(struct perf_event_header); |
6170 |
+ } |
6171 |
+ |
6172 |
+ static int intel_pt_inject_event(union perf_event *event, |
6173 |
+@@ -1155,7 +1160,8 @@ static void intel_pt_prep_sample(struct intel_pt *pt, |
6174 |
+ |
6175 |
+ if (pt->synth_opts.callchain) { |
6176 |
+ thread_stack__sample(ptq->thread, ptq->chain, |
6177 |
+- pt->synth_opts.callchain_sz, sample->ip); |
6178 |
++ pt->synth_opts.callchain_sz + 1, |
6179 |
++ sample->ip, pt->kernel_start); |
6180 |
+ sample->callchain = ptq->chain; |
6181 |
+ } |
6182 |
+ |
6183 |
+diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c |
6184 |
+index 111ae858cbcb..8ee8ab39d8ac 100644 |
6185 |
+--- a/tools/perf/util/machine.c |
6186 |
++++ b/tools/perf/util/machine.c |
6187 |
+@@ -2140,6 +2140,27 @@ static int resolve_lbr_callchain_sample(struct thread *thread, |
6188 |
+ return 0; |
6189 |
+ } |
6190 |
+ |
6191 |
++static int find_prev_cpumode(struct ip_callchain *chain, struct thread *thread, |
6192 |
++ struct callchain_cursor *cursor, |
6193 |
++ struct symbol **parent, |
6194 |
++ struct addr_location *root_al, |
6195 |
++ u8 *cpumode, int ent) |
6196 |
++{ |
6197 |
++ int err = 0; |
6198 |
++ |
6199 |
++ while (--ent >= 0) { |
6200 |
++ u64 ip = chain->ips[ent]; |
6201 |
++ |
6202 |
++ if (ip >= PERF_CONTEXT_MAX) { |
6203 |
++ err = add_callchain_ip(thread, cursor, parent, |
6204 |
++ root_al, cpumode, ip, |
6205 |
++ false, NULL, NULL, 0); |
6206 |
++ break; |
6207 |
++ } |
6208 |
++ } |
6209 |
++ return err; |
6210 |
++} |
6211 |
++ |
6212 |
+ static int thread__resolve_callchain_sample(struct thread *thread, |
6213 |
+ struct callchain_cursor *cursor, |
6214 |
+ struct perf_evsel *evsel, |
6215 |
+@@ -2246,6 +2267,12 @@ static int thread__resolve_callchain_sample(struct thread *thread, |
6216 |
+ } |
6217 |
+ |
6218 |
+ check_calls: |
6219 |
++ if (callchain_param.order != ORDER_CALLEE) { |
6220 |
++ err = find_prev_cpumode(chain, thread, cursor, parent, root_al, |
6221 |
++ &cpumode, chain->nr - first_call); |
6222 |
++ if (err) |
6223 |
++ return (err < 0) ? err : 0; |
6224 |
++ } |
6225 |
+ for (i = first_call, nr_entries = 0; |
6226 |
+ i < chain_nr && nr_entries < max_stack; i++) { |
6227 |
+ u64 ip; |
6228 |
+@@ -2260,9 +2287,15 @@ check_calls: |
6229 |
+ continue; |
6230 |
+ #endif |
6231 |
+ ip = chain->ips[j]; |
6232 |
+- |
6233 |
+ if (ip < PERF_CONTEXT_MAX) |
6234 |
+ ++nr_entries; |
6235 |
++ else if (callchain_param.order != ORDER_CALLEE) { |
6236 |
++ err = find_prev_cpumode(chain, thread, cursor, parent, |
6237 |
++ root_al, &cpumode, j); |
6238 |
++ if (err) |
6239 |
++ return (err < 0) ? err : 0; |
6240 |
++ continue; |
6241 |
++ } |
6242 |
+ |
6243 |
+ err = add_callchain_ip(thread, cursor, parent, |
6244 |
+ root_al, &cpumode, ip, |
6245 |
+diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c |
6246 |
+index 7799788f662f..7e49baad304d 100644 |
6247 |
+--- a/tools/perf/util/pmu.c |
6248 |
++++ b/tools/perf/util/pmu.c |
6249 |
+@@ -773,7 +773,7 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) |
6250 |
+ |
6251 |
+ if (!is_arm_pmu_core(name)) { |
6252 |
+ pname = pe->pmu ? pe->pmu : "cpu"; |
6253 |
+- if (strncmp(pname, name, strlen(pname))) |
6254 |
++ if (strcmp(pname, name)) |
6255 |
+ continue; |
6256 |
+ } |
6257 |
+ |
6258 |
+diff --git a/tools/perf/util/thread-stack.c b/tools/perf/util/thread-stack.c |
6259 |
+index dd17d6a38d3a..a5669d05e91f 100644 |
6260 |
+--- a/tools/perf/util/thread-stack.c |
6261 |
++++ b/tools/perf/util/thread-stack.c |
6262 |
+@@ -285,20 +285,46 @@ void thread_stack__free(struct thread *thread) |
6263 |
+ } |
6264 |
+ } |
6265 |
+ |
6266 |
++static inline u64 callchain_context(u64 ip, u64 kernel_start) |
6267 |
++{ |
6268 |
++ return ip < kernel_start ? PERF_CONTEXT_USER : PERF_CONTEXT_KERNEL; |
6269 |
++} |
6270 |
++ |
6271 |
+ void thread_stack__sample(struct thread *thread, struct ip_callchain *chain, |
6272 |
+- size_t sz, u64 ip) |
6273 |
++ size_t sz, u64 ip, u64 kernel_start) |
6274 |
+ { |
6275 |
+- size_t i; |
6276 |
++ u64 context = callchain_context(ip, kernel_start); |
6277 |
++ u64 last_context; |
6278 |
++ size_t i, j; |
6279 |
+ |
6280 |
+- if (!thread || !thread->ts) |
6281 |
+- chain->nr = 1; |
6282 |
+- else |
6283 |
+- chain->nr = min(sz, thread->ts->cnt + 1); |
6284 |
++ if (sz < 2) { |
6285 |
++ chain->nr = 0; |
6286 |
++ return; |
6287 |
++ } |
6288 |
+ |
6289 |
+- chain->ips[0] = ip; |
6290 |
++ chain->ips[0] = context; |
6291 |
++ chain->ips[1] = ip; |
6292 |
++ |
6293 |
++ if (!thread || !thread->ts) { |
6294 |
++ chain->nr = 2; |
6295 |
++ return; |
6296 |
++ } |
6297 |
++ |
6298 |
++ last_context = context; |
6299 |
++ |
6300 |
++ for (i = 2, j = 1; i < sz && j <= thread->ts->cnt; i++, j++) { |
6301 |
++ ip = thread->ts->stack[thread->ts->cnt - j].ret_addr; |
6302 |
++ context = callchain_context(ip, kernel_start); |
6303 |
++ if (context != last_context) { |
6304 |
++ if (i >= sz - 1) |
6305 |
++ break; |
6306 |
++ chain->ips[i++] = context; |
6307 |
++ last_context = context; |
6308 |
++ } |
6309 |
++ chain->ips[i] = ip; |
6310 |
++ } |
6311 |
+ |
6312 |
+- for (i = 1; i < chain->nr; i++) |
6313 |
+- chain->ips[i] = thread->ts->stack[thread->ts->cnt - i].ret_addr; |
6314 |
++ chain->nr = i; |
6315 |
+ } |
6316 |
+ |
6317 |
+ struct call_return_processor * |
6318 |
+diff --git a/tools/perf/util/thread-stack.h b/tools/perf/util/thread-stack.h |
6319 |
+index b7e41c4ebfdd..f97c00a8c251 100644 |
6320 |
+--- a/tools/perf/util/thread-stack.h |
6321 |
++++ b/tools/perf/util/thread-stack.h |
6322 |
+@@ -84,7 +84,7 @@ int thread_stack__event(struct thread *thread, u32 flags, u64 from_ip, |
6323 |
+ u64 to_ip, u16 insn_len, u64 trace_nr); |
6324 |
+ void thread_stack__set_trace_nr(struct thread *thread, u64 trace_nr); |
6325 |
+ void thread_stack__sample(struct thread *thread, struct ip_callchain *chain, |
6326 |
+- size_t sz, u64 ip); |
6327 |
++ size_t sz, u64 ip, u64 kernel_start); |
6328 |
+ int thread_stack__flush(struct thread *thread); |
6329 |
+ void thread_stack__free(struct thread *thread); |
6330 |
+ size_t thread_stack__depth(struct thread *thread); |
6331 |
+diff --git a/tools/testing/selftests/powerpc/tm/tm-tmspr.c b/tools/testing/selftests/powerpc/tm/tm-tmspr.c |
6332 |
+index 2bda81c7bf23..df1d7d4b1c89 100644 |
6333 |
+--- a/tools/testing/selftests/powerpc/tm/tm-tmspr.c |
6334 |
++++ b/tools/testing/selftests/powerpc/tm/tm-tmspr.c |
6335 |
+@@ -98,7 +98,7 @@ void texasr(void *in) |
6336 |
+ |
6337 |
+ int test_tmspr() |
6338 |
+ { |
6339 |
+- pthread_t thread; |
6340 |
++ pthread_t *thread; |
6341 |
+ int thread_num; |
6342 |
+ unsigned long i; |
6343 |
+ |
6344 |
+@@ -107,21 +107,28 @@ int test_tmspr() |
6345 |
+ /* To cause some context switching */ |
6346 |
+ thread_num = 10 * sysconf(_SC_NPROCESSORS_ONLN); |
6347 |
+ |
6348 |
++ thread = malloc(thread_num * sizeof(pthread_t)); |
6349 |
++ if (thread == NULL) |
6350 |
++ return EXIT_FAILURE; |
6351 |
++ |
6352 |
+ /* Test TFIAR and TFHAR */ |
6353 |
+- for (i = 0 ; i < thread_num ; i += 2){ |
6354 |
+- if (pthread_create(&thread, NULL, (void*)tfiar_tfhar, (void *)i)) |
6355 |
++ for (i = 0; i < thread_num; i += 2) { |
6356 |
++ if (pthread_create(&thread[i], NULL, (void *)tfiar_tfhar, |
6357 |
++ (void *)i)) |
6358 |
+ return EXIT_FAILURE; |
6359 |
+ } |
6360 |
+- if (pthread_join(thread, NULL) != 0) |
6361 |
+- return EXIT_FAILURE; |
6362 |
+- |
6363 |
+ /* Test TEXASR */ |
6364 |
+- for (i = 0 ; i < thread_num ; i++){ |
6365 |
+- if (pthread_create(&thread, NULL, (void*)texasr, (void *)i)) |
6366 |
++ for (i = 1; i < thread_num; i += 2) { |
6367 |
++ if (pthread_create(&thread[i], NULL, (void *)texasr, (void *)i)) |
6368 |
+ return EXIT_FAILURE; |
6369 |
+ } |
6370 |
+- if (pthread_join(thread, NULL) != 0) |
6371 |
+- return EXIT_FAILURE; |
6372 |
++ |
6373 |
++ for (i = 0; i < thread_num; i++) { |
6374 |
++ if (pthread_join(thread[i], NULL) != 0) |
6375 |
++ return EXIT_FAILURE; |
6376 |
++ } |
6377 |
++ |
6378 |
++ free(thread); |
6379 |
+ |
6380 |
+ if (passed) |
6381 |
+ return 0; |