1 |
commit: 83df79a46f6224f37563b47cc2456896185d048f |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Mar 28 17:01:33 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Mar 28 17:01:33 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=83df79a4 |
7 |
|
8 |
Linux patch 4.14.31 |
9 |
|
10 |
0000_README | 4 + |
11 |
1030_linux-4.14.31.patch | 3861 ++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 3865 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index f410864..74f23dc 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -163,6 +163,10 @@ Patch: 1029_linux-4.14.30.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.14.30 |
21 |
|
22 |
+Patch: 1030_linux-4.14.31.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.14.31 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1030_linux-4.14.31.patch b/1030_linux-4.14.31.patch |
31 |
new file mode 100644 |
32 |
index 0000000..37486ba |
33 |
--- /dev/null |
34 |
+++ b/1030_linux-4.14.31.patch |
35 |
@@ -0,0 +1,3861 @@ |
36 |
+diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio |
37 |
+index 7eead5f97e02..64e65450f483 100644 |
38 |
+--- a/Documentation/ABI/testing/sysfs-bus-iio |
39 |
++++ b/Documentation/ABI/testing/sysfs-bus-iio |
40 |
+@@ -32,7 +32,7 @@ Description: |
41 |
+ Description of the physical chip / device for device X. |
42 |
+ Typically a part number. |
43 |
+ |
44 |
+-What: /sys/bus/iio/devices/iio:deviceX/timestamp_clock |
45 |
++What: /sys/bus/iio/devices/iio:deviceX/current_timestamp_clock |
46 |
+ KernelVersion: 4.5 |
47 |
+ Contact: linux-iio@×××××××××××.org |
48 |
+ Description: |
49 |
+diff --git a/Makefile b/Makefile |
50 |
+index 29fc3c91f3e4..99e31da48422 100644 |
51 |
+--- a/Makefile |
52 |
++++ b/Makefile |
53 |
+@@ -1,7 +1,7 @@ |
54 |
+ # SPDX-License-Identifier: GPL-2.0 |
55 |
+ VERSION = 4 |
56 |
+ PATCHLEVEL = 14 |
57 |
+-SUBLEVEL = 30 |
58 |
++SUBLEVEL = 31 |
59 |
+ EXTRAVERSION = |
60 |
+ NAME = Petit Gorille |
61 |
+ |
62 |
+@@ -805,6 +805,15 @@ KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign) |
63 |
+ # disable invalid "can't wrap" optimizations for signed / pointers |
64 |
+ KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) |
65 |
+ |
66 |
++# clang sets -fmerge-all-constants by default as optimization, but this |
67 |
++# is non-conforming behavior for C and in fact breaks the kernel, so we |
68 |
++# need to disable it here generally. |
69 |
++KBUILD_CFLAGS += $(call cc-option,-fno-merge-all-constants) |
70 |
++ |
71 |
++# for gcc -fno-merge-all-constants disables everything, but it is fine |
72 |
++# to have actual conforming behavior enabled. |
73 |
++KBUILD_CFLAGS += $(call cc-option,-fmerge-constants) |
74 |
++ |
75 |
+ # Make sure -fstack-check isn't enabled (like gentoo apparently did) |
76 |
+ KBUILD_CFLAGS += $(call cc-option,-fno-stack-check,) |
77 |
+ |
78 |
+diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c |
79 |
+index 01bc0688d47d..f6b877d2726d 100644 |
80 |
+--- a/arch/arm64/mm/mmu.c |
81 |
++++ b/arch/arm64/mm/mmu.c |
82 |
+@@ -937,3 +937,13 @@ int pmd_clear_huge(pmd_t *pmd) |
83 |
+ pmd_clear(pmd); |
84 |
+ return 1; |
85 |
+ } |
86 |
++ |
87 |
++int pud_free_pmd_page(pud_t *pud) |
88 |
++{ |
89 |
++ return pud_none(*pud); |
90 |
++} |
91 |
++ |
92 |
++int pmd_free_pte_page(pmd_t *pmd) |
93 |
++{ |
94 |
++ return pmd_none(*pmd); |
95 |
++} |
96 |
+diff --git a/arch/h8300/include/asm/byteorder.h b/arch/h8300/include/asm/byteorder.h |
97 |
+index ecff2d1ca5a3..6eaa7ad5fc2c 100644 |
98 |
+--- a/arch/h8300/include/asm/byteorder.h |
99 |
++++ b/arch/h8300/include/asm/byteorder.h |
100 |
+@@ -2,7 +2,6 @@ |
101 |
+ #ifndef __H8300_BYTEORDER_H__ |
102 |
+ #define __H8300_BYTEORDER_H__ |
103 |
+ |
104 |
+-#define __BIG_ENDIAN __ORDER_BIG_ENDIAN__ |
105 |
+ #include <linux/byteorder/big_endian.h> |
106 |
+ |
107 |
+ #endif |
108 |
+diff --git a/arch/mips/lantiq/Kconfig b/arch/mips/lantiq/Kconfig |
109 |
+index 692ae85a3e3d..8e3a1fc2bc39 100644 |
110 |
+--- a/arch/mips/lantiq/Kconfig |
111 |
++++ b/arch/mips/lantiq/Kconfig |
112 |
+@@ -13,6 +13,8 @@ choice |
113 |
+ config SOC_AMAZON_SE |
114 |
+ bool "Amazon SE" |
115 |
+ select SOC_TYPE_XWAY |
116 |
++ select MFD_SYSCON |
117 |
++ select MFD_CORE |
118 |
+ |
119 |
+ config SOC_XWAY |
120 |
+ bool "XWAY" |
121 |
+diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c |
122 |
+index 7611c3013793..c05bed624075 100644 |
123 |
+--- a/arch/mips/lantiq/xway/sysctrl.c |
124 |
++++ b/arch/mips/lantiq/xway/sysctrl.c |
125 |
+@@ -551,9 +551,9 @@ void __init ltq_soc_init(void) |
126 |
+ clkdev_add_static(ltq_ar9_cpu_hz(), ltq_ar9_fpi_hz(), |
127 |
+ ltq_ar9_fpi_hz(), CLOCK_250M); |
128 |
+ clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 0, PMU_USB0_P); |
129 |
+- clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0); |
130 |
++ clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0 | PMU_AHBM); |
131 |
+ clkdev_add_pmu("1f203034.usb2-phy", "phy", 1, 0, PMU_USB1_P); |
132 |
+- clkdev_add_pmu("1e106000.usb", "otg", 1, 0, PMU_USB1); |
133 |
++ clkdev_add_pmu("1e106000.usb", "otg", 1, 0, PMU_USB1 | PMU_AHBM); |
134 |
+ clkdev_add_pmu("1e180000.etop", "switch", 1, 0, PMU_SWITCH); |
135 |
+ clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO); |
136 |
+ clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU); |
137 |
+@@ -562,7 +562,7 @@ void __init ltq_soc_init(void) |
138 |
+ } else { |
139 |
+ clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(), |
140 |
+ ltq_danube_fpi_hz(), ltq_danube_pp32_hz()); |
141 |
+- clkdev_add_pmu("1f203018.usb2-phy", "ctrl", 1, 0, PMU_USB0); |
142 |
++ clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0 | PMU_AHBM); |
143 |
+ clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 0, PMU_USB0_P); |
144 |
+ clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO); |
145 |
+ clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU); |
146 |
+diff --git a/arch/mips/ralink/mt7621.c b/arch/mips/ralink/mt7621.c |
147 |
+index 1b274742077d..d2718de60b9b 100644 |
148 |
+--- a/arch/mips/ralink/mt7621.c |
149 |
++++ b/arch/mips/ralink/mt7621.c |
150 |
+@@ -170,6 +170,28 @@ void prom_soc_init(struct ralink_soc_info *soc_info) |
151 |
+ u32 n1; |
152 |
+ u32 rev; |
153 |
+ |
154 |
++ /* Early detection of CMP support */ |
155 |
++ mips_cm_probe(); |
156 |
++ mips_cpc_probe(); |
157 |
++ |
158 |
++ if (mips_cps_numiocu(0)) { |
159 |
++ /* |
160 |
++ * mips_cm_probe() wipes out bootloader |
161 |
++ * config for CM regions and we have to configure them |
162 |
++ * again. This SoC cannot talk to pamlbus devices |
163 |
++ * witout proper iocu region set up. |
164 |
++ * |
165 |
++ * FIXME: it would be better to do this with values |
166 |
++ * from DT, but we need this very early because |
167 |
++ * without this we cannot talk to pretty much anything |
168 |
++ * including serial. |
169 |
++ */ |
170 |
++ write_gcr_reg0_base(MT7621_PALMBUS_BASE); |
171 |
++ write_gcr_reg0_mask(~MT7621_PALMBUS_SIZE | |
172 |
++ CM_GCR_REGn_MASK_CMTGT_IOCU0); |
173 |
++ __sync(); |
174 |
++ } |
175 |
++ |
176 |
+ n0 = __raw_readl(sysc + SYSC_REG_CHIP_NAME0); |
177 |
+ n1 = __raw_readl(sysc + SYSC_REG_CHIP_NAME1); |
178 |
+ |
179 |
+@@ -194,26 +216,6 @@ void prom_soc_init(struct ralink_soc_info *soc_info) |
180 |
+ |
181 |
+ rt2880_pinmux_data = mt7621_pinmux_data; |
182 |
+ |
183 |
+- /* Early detection of CMP support */ |
184 |
+- mips_cm_probe(); |
185 |
+- mips_cpc_probe(); |
186 |
+- |
187 |
+- if (mips_cps_numiocu(0)) { |
188 |
+- /* |
189 |
+- * mips_cm_probe() wipes out bootloader |
190 |
+- * config for CM regions and we have to configure them |
191 |
+- * again. This SoC cannot talk to pamlbus devices |
192 |
+- * witout proper iocu region set up. |
193 |
+- * |
194 |
+- * FIXME: it would be better to do this with values |
195 |
+- * from DT, but we need this very early because |
196 |
+- * without this we cannot talk to pretty much anything |
197 |
+- * including serial. |
198 |
+- */ |
199 |
+- write_gcr_reg0_base(MT7621_PALMBUS_BASE); |
200 |
+- write_gcr_reg0_mask(~MT7621_PALMBUS_SIZE | |
201 |
+- CM_GCR_REGn_MASK_CMTGT_IOCU0); |
202 |
+- } |
203 |
+ |
204 |
+ if (!register_cps_smp_ops()) |
205 |
+ return; |
206 |
+diff --git a/arch/mips/ralink/reset.c b/arch/mips/ralink/reset.c |
207 |
+index 64543d66e76b..e9531fea23a2 100644 |
208 |
+--- a/arch/mips/ralink/reset.c |
209 |
++++ b/arch/mips/ralink/reset.c |
210 |
+@@ -96,16 +96,9 @@ static void ralink_restart(char *command) |
211 |
+ unreachable(); |
212 |
+ } |
213 |
+ |
214 |
+-static void ralink_halt(void) |
215 |
+-{ |
216 |
+- local_irq_disable(); |
217 |
+- unreachable(); |
218 |
+-} |
219 |
+- |
220 |
+ static int __init mips_reboot_setup(void) |
221 |
+ { |
222 |
+ _machine_restart = ralink_restart; |
223 |
+- _machine_halt = ralink_halt; |
224 |
+ |
225 |
+ return 0; |
226 |
+ } |
227 |
+diff --git a/arch/x86/Makefile b/arch/x86/Makefile |
228 |
+index 498c1b812300..1c4d012550ec 100644 |
229 |
+--- a/arch/x86/Makefile |
230 |
++++ b/arch/x86/Makefile |
231 |
+@@ -223,6 +223,15 @@ KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) |
232 |
+ |
233 |
+ LDFLAGS := -m elf_$(UTS_MACHINE) |
234 |
+ |
235 |
++# |
236 |
++# The 64-bit kernel must be aligned to 2MB. Pass -z max-page-size=0x200000 to |
237 |
++# the linker to force 2MB page size regardless of the default page size used |
238 |
++# by the linker. |
239 |
++# |
240 |
++ifdef CONFIG_X86_64 |
241 |
++LDFLAGS += $(call ld-option, -z max-page-size=0x200000) |
242 |
++endif |
243 |
++ |
244 |
+ # Speed up the build |
245 |
+ KBUILD_CFLAGS += -pipe |
246 |
+ # Workaround for a gcc prelease that unfortunately was shipped in a suse release |
247 |
+diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c |
248 |
+index 98761a1576ce..252fee320816 100644 |
249 |
+--- a/arch/x86/boot/compressed/misc.c |
250 |
++++ b/arch/x86/boot/compressed/misc.c |
251 |
+@@ -309,6 +309,10 @@ static void parse_elf(void *output) |
252 |
+ |
253 |
+ switch (phdr->p_type) { |
254 |
+ case PT_LOAD: |
255 |
++#ifdef CONFIG_X86_64 |
256 |
++ if ((phdr->p_align % 0x200000) != 0) |
257 |
++ error("Alignment of LOAD segment isn't multiple of 2MB"); |
258 |
++#endif |
259 |
+ #ifdef CONFIG_RELOCATABLE |
260 |
+ dest = output; |
261 |
+ dest += (phdr->p_paddr - LOAD_PHYSICAL_ADDR); |
262 |
+diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S |
263 |
+index 6f3cc15e0c73..f7bfa701219b 100644 |
264 |
+--- a/arch/x86/entry/entry_64.S |
265 |
++++ b/arch/x86/entry/entry_64.S |
266 |
+@@ -1091,7 +1091,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ |
267 |
+ #endif /* CONFIG_HYPERV */ |
268 |
+ |
269 |
+ idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK |
270 |
+-idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK |
271 |
++idtentry int3 do_int3 has_error_code=0 |
272 |
+ idtentry stack_segment do_stack_segment has_error_code=1 |
273 |
+ |
274 |
+ #ifdef CONFIG_XEN |
275 |
+diff --git a/arch/x86/entry/vsyscall/vsyscall_64.c b/arch/x86/entry/vsyscall/vsyscall_64.c |
276 |
+index 577fa8adb785..542392b6aab6 100644 |
277 |
+--- a/arch/x86/entry/vsyscall/vsyscall_64.c |
278 |
++++ b/arch/x86/entry/vsyscall/vsyscall_64.c |
279 |
+@@ -355,7 +355,7 @@ void __init set_vsyscall_pgtable_user_bits(pgd_t *root) |
280 |
+ set_pgd(pgd, __pgd(pgd_val(*pgd) | _PAGE_USER)); |
281 |
+ p4d = p4d_offset(pgd, VSYSCALL_ADDR); |
282 |
+ #if CONFIG_PGTABLE_LEVELS >= 5 |
283 |
+- p4d->p4d |= _PAGE_USER; |
284 |
++ set_p4d(p4d, __p4d(p4d_val(*p4d) | _PAGE_USER)); |
285 |
+ #endif |
286 |
+ pud = pud_offset(p4d, VSYSCALL_ADDR); |
287 |
+ set_pud(pud, __pud(pud_val(*pud) | _PAGE_USER)); |
288 |
+diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
289 |
+index 56457cb73448..9b18a227fff7 100644 |
290 |
+--- a/arch/x86/events/intel/core.c |
291 |
++++ b/arch/x86/events/intel/core.c |
292 |
+@@ -3194,7 +3194,7 @@ static unsigned bdw_limit_period(struct perf_event *event, unsigned left) |
293 |
+ X86_CONFIG(.event=0xc0, .umask=0x01)) { |
294 |
+ if (left < 128) |
295 |
+ left = 128; |
296 |
+- left &= ~0x3fu; |
297 |
++ left &= ~0x3fULL; |
298 |
+ } |
299 |
+ return left; |
300 |
+ } |
301 |
+diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c |
302 |
+index 95cb19f4e06f..8243fdbb9b9c 100644 |
303 |
+--- a/arch/x86/events/intel/uncore_snbep.c |
304 |
++++ b/arch/x86/events/intel/uncore_snbep.c |
305 |
+@@ -3554,24 +3554,27 @@ static struct intel_uncore_type *skx_msr_uncores[] = { |
306 |
+ NULL, |
307 |
+ }; |
308 |
+ |
309 |
++/* |
310 |
++ * To determine the number of CHAs, it should read bits 27:0 in the CAPID6 |
311 |
++ * register which located at Device 30, Function 3, Offset 0x9C. PCI ID 0x2083. |
312 |
++ */ |
313 |
++#define SKX_CAPID6 0x9c |
314 |
++#define SKX_CHA_BIT_MASK GENMASK(27, 0) |
315 |
++ |
316 |
+ static int skx_count_chabox(void) |
317 |
+ { |
318 |
+- struct pci_dev *chabox_dev = NULL; |
319 |
+- int bus, count = 0; |
320 |
++ struct pci_dev *dev = NULL; |
321 |
++ u32 val = 0; |
322 |
+ |
323 |
+- while (1) { |
324 |
+- chabox_dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x208d, chabox_dev); |
325 |
+- if (!chabox_dev) |
326 |
+- break; |
327 |
+- if (count == 0) |
328 |
+- bus = chabox_dev->bus->number; |
329 |
+- if (bus != chabox_dev->bus->number) |
330 |
+- break; |
331 |
+- count++; |
332 |
+- } |
333 |
++ dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x2083, dev); |
334 |
++ if (!dev) |
335 |
++ goto out; |
336 |
+ |
337 |
+- pci_dev_put(chabox_dev); |
338 |
+- return count; |
339 |
++ pci_read_config_dword(dev, SKX_CAPID6, &val); |
340 |
++ val &= SKX_CHA_BIT_MASK; |
341 |
++out: |
342 |
++ pci_dev_put(dev); |
343 |
++ return hweight32(val); |
344 |
+ } |
345 |
+ |
346 |
+ void skx_uncore_cpu_init(void) |
347 |
+@@ -3598,7 +3601,7 @@ static struct intel_uncore_type skx_uncore_imc = { |
348 |
+ }; |
349 |
+ |
350 |
+ static struct attribute *skx_upi_uncore_formats_attr[] = { |
351 |
+- &format_attr_event_ext.attr, |
352 |
++ &format_attr_event.attr, |
353 |
+ &format_attr_umask_ext.attr, |
354 |
+ &format_attr_edge.attr, |
355 |
+ &format_attr_inv.attr, |
356 |
+diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h |
357 |
+index caec8417539f..7c300299e12e 100644 |
358 |
+--- a/arch/x86/include/asm/vmx.h |
359 |
++++ b/arch/x86/include/asm/vmx.h |
360 |
+@@ -352,6 +352,7 @@ enum vmcs_field { |
361 |
+ #define INTR_TYPE_NMI_INTR (2 << 8) /* NMI */ |
362 |
+ #define INTR_TYPE_HARD_EXCEPTION (3 << 8) /* processor exception */ |
363 |
+ #define INTR_TYPE_SOFT_INTR (4 << 8) /* software interrupt */ |
364 |
++#define INTR_TYPE_PRIV_SW_EXCEPTION (5 << 8) /* ICE breakpoint - undocumented */ |
365 |
+ #define INTR_TYPE_SOFT_EXCEPTION (6 << 8) /* software exception */ |
366 |
+ |
367 |
+ /* GUEST_INTERRUPTIBILITY_INFO flags. */ |
368 |
+diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c |
369 |
+index 236917bac5f2..a59624080015 100644 |
370 |
+--- a/arch/x86/kernel/idt.c |
371 |
++++ b/arch/x86/kernel/idt.c |
372 |
+@@ -160,7 +160,6 @@ static const __initconst struct idt_data early_pf_idts[] = { |
373 |
+ */ |
374 |
+ static const __initconst struct idt_data dbg_idts[] = { |
375 |
+ INTG(X86_TRAP_DB, debug), |
376 |
+- INTG(X86_TRAP_BP, int3), |
377 |
+ }; |
378 |
+ #endif |
379 |
+ |
380 |
+@@ -183,7 +182,6 @@ gate_desc debug_idt_table[IDT_ENTRIES] __page_aligned_bss; |
381 |
+ static const __initconst struct idt_data ist_idts[] = { |
382 |
+ ISTG(X86_TRAP_DB, debug, DEBUG_STACK), |
383 |
+ ISTG(X86_TRAP_NMI, nmi, NMI_STACK), |
384 |
+- SISTG(X86_TRAP_BP, int3, DEBUG_STACK), |
385 |
+ ISTG(X86_TRAP_DF, double_fault, DOUBLEFAULT_STACK), |
386 |
+ #ifdef CONFIG_X86_MCE |
387 |
+ ISTG(X86_TRAP_MC, &machine_check, MCE_STACK), |
388 |
+diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c |
389 |
+index a66428dc92ae..ef4efb931efa 100644 |
390 |
+--- a/arch/x86/kernel/traps.c |
391 |
++++ b/arch/x86/kernel/traps.c |
392 |
+@@ -571,7 +571,6 @@ do_general_protection(struct pt_regs *regs, long error_code) |
393 |
+ } |
394 |
+ NOKPROBE_SYMBOL(do_general_protection); |
395 |
+ |
396 |
+-/* May run on IST stack. */ |
397 |
+ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code) |
398 |
+ { |
399 |
+ #ifdef CONFIG_DYNAMIC_FTRACE |
400 |
+@@ -586,6 +585,13 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code) |
401 |
+ if (poke_int3_handler(regs)) |
402 |
+ return; |
403 |
+ |
404 |
++ /* |
405 |
++ * Use ist_enter despite the fact that we don't use an IST stack. |
406 |
++ * We can be called from a kprobe in non-CONTEXT_KERNEL kernel |
407 |
++ * mode or even during context tracking state changes. |
408 |
++ * |
409 |
++ * This means that we can't schedule. That's okay. |
410 |
++ */ |
411 |
+ ist_enter(regs); |
412 |
+ RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU"); |
413 |
+ #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP |
414 |
+@@ -603,15 +609,10 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code) |
415 |
+ SIGTRAP) == NOTIFY_STOP) |
416 |
+ goto exit; |
417 |
+ |
418 |
+- /* |
419 |
+- * Let others (NMI) know that the debug stack is in use |
420 |
+- * as we may switch to the interrupt stack. |
421 |
+- */ |
422 |
+- debug_stack_usage_inc(); |
423 |
+ cond_local_irq_enable(regs); |
424 |
+ do_trap(X86_TRAP_BP, SIGTRAP, "int3", regs, error_code, NULL); |
425 |
+ cond_local_irq_disable(regs); |
426 |
+- debug_stack_usage_dec(); |
427 |
++ |
428 |
+ exit: |
429 |
+ ist_exit(regs); |
430 |
+ } |
431 |
+diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
432 |
+index 315fccb2684b..ae4803b213d0 100644 |
433 |
+--- a/arch/x86/kvm/vmx.c |
434 |
++++ b/arch/x86/kvm/vmx.c |
435 |
+@@ -1071,6 +1071,13 @@ static inline bool is_machine_check(u32 intr_info) |
436 |
+ (INTR_TYPE_HARD_EXCEPTION | MC_VECTOR | INTR_INFO_VALID_MASK); |
437 |
+ } |
438 |
+ |
439 |
++/* Undocumented: icebp/int1 */ |
440 |
++static inline bool is_icebp(u32 intr_info) |
441 |
++{ |
442 |
++ return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VALID_MASK)) |
443 |
++ == (INTR_TYPE_PRIV_SW_EXCEPTION | INTR_INFO_VALID_MASK); |
444 |
++} |
445 |
++ |
446 |
+ static inline bool cpu_has_vmx_msr_bitmap(void) |
447 |
+ { |
448 |
+ return vmcs_config.cpu_based_exec_ctrl & CPU_BASED_USE_MSR_BITMAPS; |
449 |
+@@ -6169,7 +6176,7 @@ static int handle_exception(struct kvm_vcpu *vcpu) |
450 |
+ (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) { |
451 |
+ vcpu->arch.dr6 &= ~15; |
452 |
+ vcpu->arch.dr6 |= dr6 | DR6_RTM; |
453 |
+- if (!(dr6 & ~DR6_RESERVED)) /* icebp */ |
454 |
++ if (is_icebp(intr_info)) |
455 |
+ skip_emulated_instruction(vcpu); |
456 |
+ |
457 |
+ kvm_queue_exception(vcpu, DB_VECTOR); |
458 |
+diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c |
459 |
+index 004abf9ebf12..34cda7e0551b 100644 |
460 |
+--- a/arch/x86/mm/pgtable.c |
461 |
++++ b/arch/x86/mm/pgtable.c |
462 |
+@@ -702,4 +702,52 @@ int pmd_clear_huge(pmd_t *pmd) |
463 |
+ |
464 |
+ return 0; |
465 |
+ } |
466 |
++ |
467 |
++/** |
468 |
++ * pud_free_pmd_page - Clear pud entry and free pmd page. |
469 |
++ * @pud: Pointer to a PUD. |
470 |
++ * |
471 |
++ * Context: The pud range has been unmaped and TLB purged. |
472 |
++ * Return: 1 if clearing the entry succeeded. 0 otherwise. |
473 |
++ */ |
474 |
++int pud_free_pmd_page(pud_t *pud) |
475 |
++{ |
476 |
++ pmd_t *pmd; |
477 |
++ int i; |
478 |
++ |
479 |
++ if (pud_none(*pud)) |
480 |
++ return 1; |
481 |
++ |
482 |
++ pmd = (pmd_t *)pud_page_vaddr(*pud); |
483 |
++ |
484 |
++ for (i = 0; i < PTRS_PER_PMD; i++) |
485 |
++ if (!pmd_free_pte_page(&pmd[i])) |
486 |
++ return 0; |
487 |
++ |
488 |
++ pud_clear(pud); |
489 |
++ free_page((unsigned long)pmd); |
490 |
++ |
491 |
++ return 1; |
492 |
++} |
493 |
++ |
494 |
++/** |
495 |
++ * pmd_free_pte_page - Clear pmd entry and free pte page. |
496 |
++ * @pmd: Pointer to a PMD. |
497 |
++ * |
498 |
++ * Context: The pmd range has been unmaped and TLB purged. |
499 |
++ * Return: 1 if clearing the entry succeeded. 0 otherwise. |
500 |
++ */ |
501 |
++int pmd_free_pte_page(pmd_t *pmd) |
502 |
++{ |
503 |
++ pte_t *pte; |
504 |
++ |
505 |
++ if (pmd_none(*pmd)) |
506 |
++ return 1; |
507 |
++ |
508 |
++ pte = (pte_t *)pmd_page_vaddr(*pmd); |
509 |
++ pmd_clear(pmd); |
510 |
++ free_page((unsigned long)pte); |
511 |
++ |
512 |
++ return 1; |
513 |
++} |
514 |
+ #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */ |
515 |
+diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c |
516 |
+index 940aac70b4da..bb77606d04e0 100644 |
517 |
+--- a/arch/x86/net/bpf_jit_comp.c |
518 |
++++ b/arch/x86/net/bpf_jit_comp.c |
519 |
+@@ -1156,7 +1156,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) |
520 |
+ * may converge on the last pass. In such case do one more |
521 |
+ * pass to emit the final image |
522 |
+ */ |
523 |
+- for (pass = 0; pass < 10 || image; pass++) { |
524 |
++ for (pass = 0; pass < 20 || image; pass++) { |
525 |
+ proglen = do_jit(prog, addrs, image, oldproglen, &ctx); |
526 |
+ if (proglen <= 0) { |
527 |
+ image = NULL; |
528 |
+@@ -1183,6 +1183,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) |
529 |
+ } |
530 |
+ } |
531 |
+ oldproglen = proglen; |
532 |
++ cond_resched(); |
533 |
+ } |
534 |
+ |
535 |
+ if (bpf_jit_enable > 1) |
536 |
+diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c |
537 |
+index ad5d9538f0f9..f7af598c4f55 100644 |
538 |
+--- a/arch/x86/platform/efi/efi_64.c |
539 |
++++ b/arch/x86/platform/efi/efi_64.c |
540 |
+@@ -227,7 +227,7 @@ int __init efi_alloc_page_tables(void) |
541 |
+ if (!pud) { |
542 |
+ if (CONFIG_PGTABLE_LEVELS > 4) |
543 |
+ free_page((unsigned long) pgd_page_vaddr(*pgd)); |
544 |
+- free_page((unsigned long)efi_pgd); |
545 |
++ free_pages((unsigned long)efi_pgd, PGD_ALLOCATION_ORDER); |
546 |
+ return -ENOMEM; |
547 |
+ } |
548 |
+ |
549 |
+diff --git a/drivers/acpi/acpi_watchdog.c b/drivers/acpi/acpi_watchdog.c |
550 |
+index 11b113f8e367..ebb626ffb5fa 100644 |
551 |
+--- a/drivers/acpi/acpi_watchdog.c |
552 |
++++ b/drivers/acpi/acpi_watchdog.c |
553 |
+@@ -74,10 +74,10 @@ void __init acpi_watchdog_init(void) |
554 |
+ res.start = gas->address; |
555 |
+ if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { |
556 |
+ res.flags = IORESOURCE_MEM; |
557 |
+- res.end = res.start + ALIGN(gas->access_width, 4); |
558 |
++ res.end = res.start + ALIGN(gas->access_width, 4) - 1; |
559 |
+ } else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { |
560 |
+ res.flags = IORESOURCE_IO; |
561 |
+- res.end = res.start + gas->access_width; |
562 |
++ res.end = res.start + gas->access_width - 1; |
563 |
+ } else { |
564 |
+ pr_warn("Unsupported address space: %u\n", |
565 |
+ gas->space_id); |
566 |
+diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c |
567 |
+index 917f1cc0fda4..8fb74d9011da 100644 |
568 |
+--- a/drivers/acpi/numa.c |
569 |
++++ b/drivers/acpi/numa.c |
570 |
+@@ -103,25 +103,27 @@ int acpi_map_pxm_to_node(int pxm) |
571 |
+ */ |
572 |
+ int acpi_map_pxm_to_online_node(int pxm) |
573 |
+ { |
574 |
+- int node, n, dist, min_dist; |
575 |
++ int node, min_node; |
576 |
+ |
577 |
+ node = acpi_map_pxm_to_node(pxm); |
578 |
+ |
579 |
+ if (node == NUMA_NO_NODE) |
580 |
+ node = 0; |
581 |
+ |
582 |
++ min_node = node; |
583 |
+ if (!node_online(node)) { |
584 |
+- min_dist = INT_MAX; |
585 |
++ int min_dist = INT_MAX, dist, n; |
586 |
++ |
587 |
+ for_each_online_node(n) { |
588 |
+ dist = node_distance(node, n); |
589 |
+ if (dist < min_dist) { |
590 |
+ min_dist = dist; |
591 |
+- node = n; |
592 |
++ min_node = n; |
593 |
+ } |
594 |
+ } |
595 |
+ } |
596 |
+ |
597 |
+- return node; |
598 |
++ return min_node; |
599 |
+ } |
600 |
+ EXPORT_SYMBOL(acpi_map_pxm_to_online_node); |
601 |
+ |
602 |
+diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c |
603 |
+index bc013f757d5d..18391d0c0cd7 100644 |
604 |
+--- a/drivers/ata/ahci.c |
605 |
++++ b/drivers/ata/ahci.c |
606 |
+@@ -541,7 +541,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { |
607 |
+ .driver_data = board_ahci_yes_fbs }, |
608 |
+ { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230), |
609 |
+ .driver_data = board_ahci_yes_fbs }, |
610 |
+- { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0642), |
611 |
++ { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0642), /* highpoint rocketraid 642L */ |
612 |
++ .driver_data = board_ahci_yes_fbs }, |
613 |
++ { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0645), /* highpoint rocketraid 644L */ |
614 |
+ .driver_data = board_ahci_yes_fbs }, |
615 |
+ |
616 |
+ /* Promise */ |
617 |
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
618 |
+index e7ded346d94b..c6fe2974b336 100644 |
619 |
+--- a/drivers/ata/libata-core.c |
620 |
++++ b/drivers/ata/libata-core.c |
621 |
+@@ -4520,6 +4520,25 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { |
622 |
+ { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER }, |
623 |
+ { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, |
624 |
+ |
625 |
++ /* Crucial BX100 SSD 500GB has broken LPM support */ |
626 |
++ { "CT500BX100SSD1", NULL, ATA_HORKAGE_NOLPM }, |
627 |
++ |
628 |
++ /* 512GB MX100 with MU01 firmware has both queued TRIM and LPM issues */ |
629 |
++ { "Crucial_CT512MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
630 |
++ ATA_HORKAGE_ZERO_AFTER_TRIM | |
631 |
++ ATA_HORKAGE_NOLPM, }, |
632 |
++ /* 512GB MX100 with newer firmware has only LPM issues */ |
633 |
++ { "Crucial_CT512MX100*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM | |
634 |
++ ATA_HORKAGE_NOLPM, }, |
635 |
++ |
636 |
++ /* 480GB+ M500 SSDs have both queued TRIM and LPM issues */ |
637 |
++ { "Crucial_CT480M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
638 |
++ ATA_HORKAGE_ZERO_AFTER_TRIM | |
639 |
++ ATA_HORKAGE_NOLPM, }, |
640 |
++ { "Crucial_CT960M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
641 |
++ ATA_HORKAGE_ZERO_AFTER_TRIM | |
642 |
++ ATA_HORKAGE_NOLPM, }, |
643 |
++ |
644 |
+ /* devices that don't properly handle queued TRIM commands */ |
645 |
+ { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
646 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
647 |
+@@ -4531,7 +4550,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { |
648 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
649 |
+ { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
650 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
651 |
+- { "Samsung SSD 8*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
652 |
++ { "Samsung SSD 840*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
653 |
++ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
654 |
++ { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
655 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
656 |
+ { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
657 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
658 |
+@@ -5391,8 +5412,7 @@ void ata_qc_issue(struct ata_queued_cmd *qc) |
659 |
+ * We guarantee to LLDs that they will have at least one |
660 |
+ * non-zero sg if the command is a data command. |
661 |
+ */ |
662 |
+- if (WARN_ON_ONCE(ata_is_data(prot) && |
663 |
+- (!qc->sg || !qc->n_elem || !qc->nbytes))) |
664 |
++ if (ata_is_data(prot) && (!qc->sg || !qc->n_elem || !qc->nbytes)) |
665 |
+ goto sys_err; |
666 |
+ |
667 |
+ if (ata_is_dma(prot) || (ata_is_pio(prot) && |
668 |
+diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c |
669 |
+index 44ba292f2cd7..4ff69f508e95 100644 |
670 |
+--- a/drivers/ata/libata-scsi.c |
671 |
++++ b/drivers/ata/libata-scsi.c |
672 |
+@@ -3315,6 +3315,12 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc) |
673 |
+ goto invalid_fld; |
674 |
+ } |
675 |
+ |
676 |
++ /* We may not issue NCQ commands to devices not supporting NCQ */ |
677 |
++ if (ata_is_ncq(tf->protocol) && !ata_ncq_enabled(dev)) { |
678 |
++ fp = 1; |
679 |
++ goto invalid_fld; |
680 |
++ } |
681 |
++ |
682 |
+ /* sanity check for pio multi commands */ |
683 |
+ if ((cdb[1] & 0xe0) && !is_multi_taskfile(tf)) { |
684 |
+ fp = 1; |
685 |
+@@ -4308,7 +4314,9 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, |
686 |
+ if (likely((scsi_op != ATA_16) || !atapi_passthru16)) { |
687 |
+ /* relay SCSI command to ATAPI device */ |
688 |
+ int len = COMMAND_SIZE(scsi_op); |
689 |
+- if (unlikely(len > scmd->cmd_len || len > dev->cdb_len)) |
690 |
++ if (unlikely(len > scmd->cmd_len || |
691 |
++ len > dev->cdb_len || |
692 |
++ scmd->cmd_len > ATAPI_CDB_LEN)) |
693 |
+ goto bad_cdb_len; |
694 |
+ |
695 |
+ xlat_func = atapi_xlat; |
696 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
697 |
+index 673698c7b143..b2c0306f97ed 100644 |
698 |
+--- a/drivers/bluetooth/btusb.c |
699 |
++++ b/drivers/bluetooth/btusb.c |
700 |
+@@ -235,7 +235,6 @@ static const struct usb_device_id blacklist_table[] = { |
701 |
+ { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 }, |
702 |
+ { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, |
703 |
+ { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 }, |
704 |
+- { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
705 |
+ { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, |
706 |
+ { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, |
707 |
+ { USB_DEVICE(0x0cf3, 0x311e), .driver_info = BTUSB_ATH3012 }, |
708 |
+@@ -268,6 +267,7 @@ static const struct usb_device_id blacklist_table[] = { |
709 |
+ { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 }, |
710 |
+ |
711 |
+ /* QCA ROME chipset */ |
712 |
++ { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_QCA_ROME }, |
713 |
+ { USB_DEVICE(0x0cf3, 0xe007), .driver_info = BTUSB_QCA_ROME }, |
714 |
+ { USB_DEVICE(0x0cf3, 0xe009), .driver_info = BTUSB_QCA_ROME }, |
715 |
+ { USB_DEVICE(0x0cf3, 0xe300), .driver_info = BTUSB_QCA_ROME }, |
716 |
+@@ -388,10 +388,10 @@ static const struct usb_device_id blacklist_table[] = { |
717 |
+ */ |
718 |
+ static const struct dmi_system_id btusb_needs_reset_resume_table[] = { |
719 |
+ { |
720 |
+- /* Lenovo Yoga 920 (QCA Rome device 0cf3:e300) */ |
721 |
++ /* Dell OptiPlex 3060 (QCA ROME device 0cf3:e007) */ |
722 |
+ .matches = { |
723 |
+- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
724 |
+- DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 920"), |
725 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), |
726 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 3060"), |
727 |
+ }, |
728 |
+ }, |
729 |
+ {} |
730 |
+diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c |
731 |
+index 58ce6af8452d..eec52734d6ac 100644 |
732 |
+--- a/drivers/clk/bcm/clk-bcm2835.c |
733 |
++++ b/drivers/clk/bcm/clk-bcm2835.c |
734 |
+@@ -479,17 +479,17 @@ struct bcm2835_pll_ana_bits { |
735 |
+ static const struct bcm2835_pll_ana_bits bcm2835_ana_default = { |
736 |
+ .mask0 = 0, |
737 |
+ .set0 = 0, |
738 |
+- .mask1 = (u32)~(A2W_PLL_KI_MASK | A2W_PLL_KP_MASK), |
739 |
++ .mask1 = A2W_PLL_KI_MASK | A2W_PLL_KP_MASK, |
740 |
+ .set1 = (2 << A2W_PLL_KI_SHIFT) | (8 << A2W_PLL_KP_SHIFT), |
741 |
+- .mask3 = (u32)~A2W_PLL_KA_MASK, |
742 |
++ .mask3 = A2W_PLL_KA_MASK, |
743 |
+ .set3 = (2 << A2W_PLL_KA_SHIFT), |
744 |
+ .fb_prediv_mask = BIT(14), |
745 |
+ }; |
746 |
+ |
747 |
+ static const struct bcm2835_pll_ana_bits bcm2835_ana_pllh = { |
748 |
+- .mask0 = (u32)~(A2W_PLLH_KA_MASK | A2W_PLLH_KI_LOW_MASK), |
749 |
++ .mask0 = A2W_PLLH_KA_MASK | A2W_PLLH_KI_LOW_MASK, |
750 |
+ .set0 = (2 << A2W_PLLH_KA_SHIFT) | (2 << A2W_PLLH_KI_LOW_SHIFT), |
751 |
+- .mask1 = (u32)~(A2W_PLLH_KI_HIGH_MASK | A2W_PLLH_KP_MASK), |
752 |
++ .mask1 = A2W_PLLH_KI_HIGH_MASK | A2W_PLLH_KP_MASK, |
753 |
+ .set1 = (6 << A2W_PLLH_KP_SHIFT), |
754 |
+ .mask3 = 0, |
755 |
+ .set3 = 0, |
756 |
+@@ -653,8 +653,10 @@ static int bcm2835_pll_on(struct clk_hw *hw) |
757 |
+ ~A2W_PLL_CTRL_PWRDN); |
758 |
+ |
759 |
+ /* Take the PLL out of reset. */ |
760 |
++ spin_lock(&cprman->regs_lock); |
761 |
+ cprman_write(cprman, data->cm_ctrl_reg, |
762 |
+ cprman_read(cprman, data->cm_ctrl_reg) & ~CM_PLL_ANARST); |
763 |
++ spin_unlock(&cprman->regs_lock); |
764 |
+ |
765 |
+ /* Wait for the PLL to lock. */ |
766 |
+ timeout = ktime_add_ns(ktime_get(), LOCK_TIMEOUT_NS); |
767 |
+@@ -731,9 +733,11 @@ static int bcm2835_pll_set_rate(struct clk_hw *hw, |
768 |
+ } |
769 |
+ |
770 |
+ /* Unmask the reference clock from the oscillator. */ |
771 |
++ spin_lock(&cprman->regs_lock); |
772 |
+ cprman_write(cprman, A2W_XOSC_CTRL, |
773 |
+ cprman_read(cprman, A2W_XOSC_CTRL) | |
774 |
+ data->reference_enable_mask); |
775 |
++ spin_unlock(&cprman->regs_lock); |
776 |
+ |
777 |
+ if (do_ana_setup_first) |
778 |
+ bcm2835_pll_write_ana(cprman, data->ana_reg_base, ana); |
779 |
+diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c |
780 |
+index 241fb13f1c06..40d5f74cb2ac 100644 |
781 |
+--- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c |
782 |
++++ b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c |
783 |
+@@ -750,7 +750,7 @@ static struct ccu_mp out_a_clk = { |
784 |
+ .features = CCU_FEATURE_FIXED_PREDIV, |
785 |
+ .hw.init = CLK_HW_INIT_PARENTS("out-a", |
786 |
+ clk_out_parents, |
787 |
+- &ccu_div_ops, |
788 |
++ &ccu_mp_ops, |
789 |
+ 0), |
790 |
+ }, |
791 |
+ }; |
792 |
+@@ -771,7 +771,7 @@ static struct ccu_mp out_b_clk = { |
793 |
+ .features = CCU_FEATURE_FIXED_PREDIV, |
794 |
+ .hw.init = CLK_HW_INIT_PARENTS("out-b", |
795 |
+ clk_out_parents, |
796 |
+- &ccu_div_ops, |
797 |
++ &ccu_mp_ops, |
798 |
+ 0), |
799 |
+ }, |
800 |
+ }; |
801 |
+@@ -792,7 +792,7 @@ static struct ccu_mp out_c_clk = { |
802 |
+ .features = CCU_FEATURE_FIXED_PREDIV, |
803 |
+ .hw.init = CLK_HW_INIT_PARENTS("out-c", |
804 |
+ clk_out_parents, |
805 |
+- &ccu_div_ops, |
806 |
++ &ccu_mp_ops, |
807 |
+ 0), |
808 |
+ }, |
809 |
+ }; |
810 |
+diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c |
811 |
+index dd4727489b84..c21e10c780ac 100644 |
812 |
+--- a/drivers/gpu/drm/drm_framebuffer.c |
813 |
++++ b/drivers/gpu/drm/drm_framebuffer.c |
814 |
+@@ -458,6 +458,12 @@ int drm_mode_getfb(struct drm_device *dev, |
815 |
+ if (!fb) |
816 |
+ return -ENOENT; |
817 |
+ |
818 |
++ /* Multi-planar framebuffers need getfb2. */ |
819 |
++ if (fb->format->num_planes > 1) { |
820 |
++ ret = -EINVAL; |
821 |
++ goto out; |
822 |
++ } |
823 |
++ |
824 |
+ r->height = fb->height; |
825 |
+ r->width = fb->width; |
826 |
+ r->depth = fb->format->depth; |
827 |
+@@ -481,6 +487,7 @@ int drm_mode_getfb(struct drm_device *dev, |
828 |
+ ret = -ENODEV; |
829 |
+ } |
830 |
+ |
831 |
++out: |
832 |
+ drm_framebuffer_put(fb); |
833 |
+ |
834 |
+ return ret; |
835 |
+diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c |
836 |
+index 0422b8c2c2e7..7bcf5702c91c 100644 |
837 |
+--- a/drivers/gpu/drm/drm_syncobj.c |
838 |
++++ b/drivers/gpu/drm/drm_syncobj.c |
839 |
+@@ -328,28 +328,11 @@ static const struct file_operations drm_syncobj_file_fops = { |
840 |
+ .release = drm_syncobj_file_release, |
841 |
+ }; |
842 |
+ |
843 |
+-static int drm_syncobj_alloc_file(struct drm_syncobj *syncobj) |
844 |
+-{ |
845 |
+- struct file *file = anon_inode_getfile("syncobj_file", |
846 |
+- &drm_syncobj_file_fops, |
847 |
+- syncobj, 0); |
848 |
+- if (IS_ERR(file)) |
849 |
+- return PTR_ERR(file); |
850 |
+- |
851 |
+- drm_syncobj_get(syncobj); |
852 |
+- if (cmpxchg(&syncobj->file, NULL, file)) { |
853 |
+- /* lost the race */ |
854 |
+- fput(file); |
855 |
+- } |
856 |
+- |
857 |
+- return 0; |
858 |
+-} |
859 |
+- |
860 |
+ static int drm_syncobj_handle_to_fd(struct drm_file *file_private, |
861 |
+ u32 handle, int *p_fd) |
862 |
+ { |
863 |
+ struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle); |
864 |
+- int ret; |
865 |
++ struct file *file; |
866 |
+ int fd; |
867 |
+ |
868 |
+ if (!syncobj) |
869 |
+@@ -361,46 +344,40 @@ static int drm_syncobj_handle_to_fd(struct drm_file *file_private, |
870 |
+ return fd; |
871 |
+ } |
872 |
+ |
873 |
+- if (!syncobj->file) { |
874 |
+- ret = drm_syncobj_alloc_file(syncobj); |
875 |
+- if (ret) |
876 |
+- goto out_put_fd; |
877 |
++ file = anon_inode_getfile("syncobj_file", |
878 |
++ &drm_syncobj_file_fops, |
879 |
++ syncobj, 0); |
880 |
++ if (IS_ERR(file)) { |
881 |
++ put_unused_fd(fd); |
882 |
++ drm_syncobj_put(syncobj); |
883 |
++ return PTR_ERR(file); |
884 |
+ } |
885 |
+- fd_install(fd, syncobj->file); |
886 |
+- drm_syncobj_put(syncobj); |
887 |
++ |
888 |
++ drm_syncobj_get(syncobj); |
889 |
++ fd_install(fd, file); |
890 |
++ |
891 |
+ *p_fd = fd; |
892 |
+ return 0; |
893 |
+-out_put_fd: |
894 |
+- put_unused_fd(fd); |
895 |
+- drm_syncobj_put(syncobj); |
896 |
+- return ret; |
897 |
+ } |
898 |
+ |
899 |
+-static struct drm_syncobj *drm_syncobj_fdget(int fd) |
900 |
+-{ |
901 |
+- struct file *file = fget(fd); |
902 |
+- |
903 |
+- if (!file) |
904 |
+- return NULL; |
905 |
+- if (file->f_op != &drm_syncobj_file_fops) |
906 |
+- goto err; |
907 |
+- |
908 |
+- return file->private_data; |
909 |
+-err: |
910 |
+- fput(file); |
911 |
+- return NULL; |
912 |
+-}; |
913 |
+- |
914 |
+ static int drm_syncobj_fd_to_handle(struct drm_file *file_private, |
915 |
+ int fd, u32 *handle) |
916 |
+ { |
917 |
+- struct drm_syncobj *syncobj = drm_syncobj_fdget(fd); |
918 |
++ struct drm_syncobj *syncobj; |
919 |
++ struct file *file; |
920 |
+ int ret; |
921 |
+ |
922 |
+- if (!syncobj) |
923 |
++ file = fget(fd); |
924 |
++ if (!file) |
925 |
++ return -EINVAL; |
926 |
++ |
927 |
++ if (file->f_op != &drm_syncobj_file_fops) { |
928 |
++ fput(file); |
929 |
+ return -EINVAL; |
930 |
++ } |
931 |
+ |
932 |
+ /* take a reference to put in the idr */ |
933 |
++ syncobj = file->private_data; |
934 |
+ drm_syncobj_get(syncobj); |
935 |
+ |
936 |
+ idr_preload(GFP_KERNEL); |
937 |
+@@ -409,12 +386,14 @@ static int drm_syncobj_fd_to_handle(struct drm_file *file_private, |
938 |
+ spin_unlock(&file_private->syncobj_table_lock); |
939 |
+ idr_preload_end(); |
940 |
+ |
941 |
+- if (ret < 0) { |
942 |
+- fput(syncobj->file); |
943 |
+- return ret; |
944 |
+- } |
945 |
+- *handle = ret; |
946 |
+- return 0; |
947 |
++ if (ret > 0) { |
948 |
++ *handle = ret; |
949 |
++ ret = 0; |
950 |
++ } else |
951 |
++ drm_syncobj_put(syncobj); |
952 |
++ |
953 |
++ fput(file); |
954 |
++ return ret; |
955 |
+ } |
956 |
+ |
957 |
+ int drm_syncobj_import_sync_file_fence(struct drm_file *file_private, |
958 |
+diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c |
959 |
+index c0da44742988..424cd1b66575 100644 |
960 |
+--- a/drivers/gpu/drm/radeon/radeon_connectors.c |
961 |
++++ b/drivers/gpu/drm/radeon/radeon_connectors.c |
962 |
+@@ -90,25 +90,18 @@ void radeon_connector_hotplug(struct drm_connector *connector) |
963 |
+ /* don't do anything if sink is not display port, i.e., |
964 |
+ * passive dp->(dvi|hdmi) adaptor |
965 |
+ */ |
966 |
+- if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) { |
967 |
+- int saved_dpms = connector->dpms; |
968 |
+- /* Only turn off the display if it's physically disconnected */ |
969 |
+- if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) { |
970 |
+- drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); |
971 |
+- } else if (radeon_dp_needs_link_train(radeon_connector)) { |
972 |
+- /* Don't try to start link training before we |
973 |
+- * have the dpcd */ |
974 |
+- if (!radeon_dp_getdpcd(radeon_connector)) |
975 |
+- return; |
976 |
+- |
977 |
+- /* set it to OFF so that drm_helper_connector_dpms() |
978 |
+- * won't return immediately since the current state |
979 |
+- * is ON at this point. |
980 |
+- */ |
981 |
+- connector->dpms = DRM_MODE_DPMS_OFF; |
982 |
+- drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); |
983 |
+- } |
984 |
+- connector->dpms = saved_dpms; |
985 |
++ if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT && |
986 |
++ radeon_hpd_sense(rdev, radeon_connector->hpd.hpd) && |
987 |
++ radeon_dp_needs_link_train(radeon_connector)) { |
988 |
++ /* Don't start link training before we have the DPCD */ |
989 |
++ if (!radeon_dp_getdpcd(radeon_connector)) |
990 |
++ return; |
991 |
++ |
992 |
++ /* Turn the connector off and back on immediately, which |
993 |
++ * will trigger link training |
994 |
++ */ |
995 |
++ drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); |
996 |
++ drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); |
997 |
+ } |
998 |
+ } |
999 |
+ } |
1000 |
+diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c |
1001 |
+index b5b335c9b2bb..2ebdc6d5a76e 100644 |
1002 |
+--- a/drivers/gpu/drm/udl/udl_fb.c |
1003 |
++++ b/drivers/gpu/drm/udl/udl_fb.c |
1004 |
+@@ -159,10 +159,15 @@ static int udl_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
1005 |
+ { |
1006 |
+ unsigned long start = vma->vm_start; |
1007 |
+ unsigned long size = vma->vm_end - vma->vm_start; |
1008 |
+- unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; |
1009 |
++ unsigned long offset; |
1010 |
+ unsigned long page, pos; |
1011 |
+ |
1012 |
+- if (offset + size > info->fix.smem_len) |
1013 |
++ if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) |
1014 |
++ return -EINVAL; |
1015 |
++ |
1016 |
++ offset = vma->vm_pgoff << PAGE_SHIFT; |
1017 |
++ |
1018 |
++ if (offset > info->fix.smem_len || size > info->fix.smem_len - offset) |
1019 |
+ return -EINVAL; |
1020 |
+ |
1021 |
+ pos = (unsigned long)info->fix.smem_start + offset; |
1022 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |
1023 |
+index 184340d486c3..86d25f18aa99 100644 |
1024 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |
1025 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |
1026 |
+@@ -1337,6 +1337,19 @@ static void __vmw_svga_disable(struct vmw_private *dev_priv) |
1027 |
+ */ |
1028 |
+ void vmw_svga_disable(struct vmw_private *dev_priv) |
1029 |
+ { |
1030 |
++ /* |
1031 |
++ * Disabling SVGA will turn off device modesetting capabilities, so |
1032 |
++ * notify KMS about that so that it doesn't cache atomic state that |
1033 |
++ * isn't valid anymore, for example crtcs turned on. |
1034 |
++ * Strictly we'd want to do this under the SVGA lock (or an SVGA mutex), |
1035 |
++ * but vmw_kms_lost_device() takes the reservation sem and thus we'll |
1036 |
++ * end up with lock order reversal. Thus, a master may actually perform |
1037 |
++ * a new modeset just after we call vmw_kms_lost_device() and race with |
1038 |
++ * vmw_svga_disable(), but that should at worst cause atomic KMS state |
1039 |
++ * to be inconsistent with the device, causing modesetting problems. |
1040 |
++ * |
1041 |
++ */ |
1042 |
++ vmw_kms_lost_device(dev_priv->dev); |
1043 |
+ ttm_write_lock(&dev_priv->reservation_sem, false); |
1044 |
+ spin_lock(&dev_priv->svga_lock); |
1045 |
+ if (dev_priv->bdev.man[TTM_PL_VRAM].use_type) { |
1046 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |
1047 |
+index 7e5f30e234b1..8c65cc3b0dda 100644 |
1048 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |
1049 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |
1050 |
+@@ -938,6 +938,7 @@ int vmw_kms_present(struct vmw_private *dev_priv, |
1051 |
+ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, |
1052 |
+ struct drm_file *file_priv); |
1053 |
+ void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv); |
1054 |
++void vmw_kms_lost_device(struct drm_device *dev); |
1055 |
+ |
1056 |
+ int vmw_dumb_create(struct drm_file *file_priv, |
1057 |
+ struct drm_device *dev, |
1058 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |
1059 |
+index 62c2f4be8012..9e010f8c36a1 100644 |
1060 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |
1061 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |
1062 |
+@@ -31,7 +31,6 @@ |
1063 |
+ #include <drm/drm_atomic_helper.h> |
1064 |
+ #include <drm/drm_rect.h> |
1065 |
+ |
1066 |
+- |
1067 |
+ /* Might need a hrtimer here? */ |
1068 |
+ #define VMWGFX_PRESENT_RATE ((HZ / 60 > 0) ? HZ / 60 : 1) |
1069 |
+ |
1070 |
+@@ -2531,9 +2530,12 @@ void vmw_kms_helper_buffer_finish(struct vmw_private *dev_priv, |
1071 |
+ * Helper to be used if an error forces the caller to undo the actions of |
1072 |
+ * vmw_kms_helper_resource_prepare. |
1073 |
+ */ |
1074 |
+-void vmw_kms_helper_resource_revert(struct vmw_resource *res) |
1075 |
++void vmw_kms_helper_resource_revert(struct vmw_validation_ctx *ctx) |
1076 |
+ { |
1077 |
+- vmw_kms_helper_buffer_revert(res->backup); |
1078 |
++ struct vmw_resource *res = ctx->res; |
1079 |
++ |
1080 |
++ vmw_kms_helper_buffer_revert(ctx->buf); |
1081 |
++ vmw_dmabuf_unreference(&ctx->buf); |
1082 |
+ vmw_resource_unreserve(res, false, NULL, 0); |
1083 |
+ mutex_unlock(&res->dev_priv->cmdbuf_mutex); |
1084 |
+ } |
1085 |
+@@ -2550,10 +2552,14 @@ void vmw_kms_helper_resource_revert(struct vmw_resource *res) |
1086 |
+ * interrupted by a signal. |
1087 |
+ */ |
1088 |
+ int vmw_kms_helper_resource_prepare(struct vmw_resource *res, |
1089 |
+- bool interruptible) |
1090 |
++ bool interruptible, |
1091 |
++ struct vmw_validation_ctx *ctx) |
1092 |
+ { |
1093 |
+ int ret = 0; |
1094 |
+ |
1095 |
++ ctx->buf = NULL; |
1096 |
++ ctx->res = res; |
1097 |
++ |
1098 |
+ if (interruptible) |
1099 |
+ ret = mutex_lock_interruptible(&res->dev_priv->cmdbuf_mutex); |
1100 |
+ else |
1101 |
+@@ -2572,6 +2578,8 @@ int vmw_kms_helper_resource_prepare(struct vmw_resource *res, |
1102 |
+ res->dev_priv->has_mob); |
1103 |
+ if (ret) |
1104 |
+ goto out_unreserve; |
1105 |
++ |
1106 |
++ ctx->buf = vmw_dmabuf_reference(res->backup); |
1107 |
+ } |
1108 |
+ ret = vmw_resource_validate(res); |
1109 |
+ if (ret) |
1110 |
+@@ -2579,7 +2587,7 @@ int vmw_kms_helper_resource_prepare(struct vmw_resource *res, |
1111 |
+ return 0; |
1112 |
+ |
1113 |
+ out_revert: |
1114 |
+- vmw_kms_helper_buffer_revert(res->backup); |
1115 |
++ vmw_kms_helper_buffer_revert(ctx->buf); |
1116 |
+ out_unreserve: |
1117 |
+ vmw_resource_unreserve(res, false, NULL, 0); |
1118 |
+ out_unlock: |
1119 |
+@@ -2595,11 +2603,13 @@ int vmw_kms_helper_resource_prepare(struct vmw_resource *res, |
1120 |
+ * @out_fence: Optional pointer to a fence pointer. If non-NULL, a |
1121 |
+ * ref-counted fence pointer is returned here. |
1122 |
+ */ |
1123 |
+-void vmw_kms_helper_resource_finish(struct vmw_resource *res, |
1124 |
+- struct vmw_fence_obj **out_fence) |
1125 |
++void vmw_kms_helper_resource_finish(struct vmw_validation_ctx *ctx, |
1126 |
++ struct vmw_fence_obj **out_fence) |
1127 |
+ { |
1128 |
+- if (res->backup || out_fence) |
1129 |
+- vmw_kms_helper_buffer_finish(res->dev_priv, NULL, res->backup, |
1130 |
++ struct vmw_resource *res = ctx->res; |
1131 |
++ |
1132 |
++ if (ctx->buf || out_fence) |
1133 |
++ vmw_kms_helper_buffer_finish(res->dev_priv, NULL, ctx->buf, |
1134 |
+ out_fence, NULL); |
1135 |
+ |
1136 |
+ vmw_resource_unreserve(res, false, NULL, 0); |
1137 |
+@@ -2865,3 +2875,14 @@ int vmw_kms_set_config(struct drm_mode_set *set, |
1138 |
+ |
1139 |
+ return drm_atomic_helper_set_config(set, ctx); |
1140 |
+ } |
1141 |
++ |
1142 |
++ |
1143 |
++/** |
1144 |
++ * vmw_kms_lost_device - Notify kms that modesetting capabilities will be lost |
1145 |
++ * |
1146 |
++ * @dev: Pointer to the drm device |
1147 |
++ */ |
1148 |
++void vmw_kms_lost_device(struct drm_device *dev) |
1149 |
++{ |
1150 |
++ drm_atomic_helper_shutdown(dev); |
1151 |
++} |
1152 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h |
1153 |
+index cd9da2dd79af..3d2ca280eaa7 100644 |
1154 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h |
1155 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h |
1156 |
+@@ -240,6 +240,11 @@ struct vmw_display_unit { |
1157 |
+ int set_gui_y; |
1158 |
+ }; |
1159 |
+ |
1160 |
++struct vmw_validation_ctx { |
1161 |
++ struct vmw_resource *res; |
1162 |
++ struct vmw_dma_buffer *buf; |
1163 |
++}; |
1164 |
++ |
1165 |
+ #define vmw_crtc_to_du(x) \ |
1166 |
+ container_of(x, struct vmw_display_unit, crtc) |
1167 |
+ #define vmw_connector_to_du(x) \ |
1168 |
+@@ -296,9 +301,10 @@ void vmw_kms_helper_buffer_finish(struct vmw_private *dev_priv, |
1169 |
+ struct drm_vmw_fence_rep __user * |
1170 |
+ user_fence_rep); |
1171 |
+ int vmw_kms_helper_resource_prepare(struct vmw_resource *res, |
1172 |
+- bool interruptible); |
1173 |
+-void vmw_kms_helper_resource_revert(struct vmw_resource *res); |
1174 |
+-void vmw_kms_helper_resource_finish(struct vmw_resource *res, |
1175 |
++ bool interruptible, |
1176 |
++ struct vmw_validation_ctx *ctx); |
1177 |
++void vmw_kms_helper_resource_revert(struct vmw_validation_ctx *ctx); |
1178 |
++void vmw_kms_helper_resource_finish(struct vmw_validation_ctx *ctx, |
1179 |
+ struct vmw_fence_obj **out_fence); |
1180 |
+ int vmw_kms_readback(struct vmw_private *dev_priv, |
1181 |
+ struct drm_file *file_priv, |
1182 |
+@@ -439,5 +445,4 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv, |
1183 |
+ |
1184 |
+ int vmw_kms_set_config(struct drm_mode_set *set, |
1185 |
+ struct drm_modeset_acquire_ctx *ctx); |
1186 |
+- |
1187 |
+ #endif |
1188 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |
1189 |
+index 7ae38a67388c..aacce4753a62 100644 |
1190 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |
1191 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |
1192 |
+@@ -909,12 +909,13 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv, |
1193 |
+ struct vmw_framebuffer_surface *vfbs = |
1194 |
+ container_of(framebuffer, typeof(*vfbs), base); |
1195 |
+ struct vmw_kms_sou_surface_dirty sdirty; |
1196 |
++ struct vmw_validation_ctx ctx; |
1197 |
+ int ret; |
1198 |
+ |
1199 |
+ if (!srf) |
1200 |
+ srf = &vfbs->surface->res; |
1201 |
+ |
1202 |
+- ret = vmw_kms_helper_resource_prepare(srf, true); |
1203 |
++ ret = vmw_kms_helper_resource_prepare(srf, true, &ctx); |
1204 |
+ if (ret) |
1205 |
+ return ret; |
1206 |
+ |
1207 |
+@@ -933,7 +934,7 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv, |
1208 |
+ ret = vmw_kms_helper_dirty(dev_priv, framebuffer, clips, vclips, |
1209 |
+ dest_x, dest_y, num_clips, inc, |
1210 |
+ &sdirty.base); |
1211 |
+- vmw_kms_helper_resource_finish(srf, out_fence); |
1212 |
++ vmw_kms_helper_resource_finish(&ctx, out_fence); |
1213 |
+ |
1214 |
+ return ret; |
1215 |
+ } |
1216 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c |
1217 |
+index 4dee05b15552..6c576f8df4b2 100644 |
1218 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c |
1219 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c |
1220 |
+@@ -980,12 +980,13 @@ int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv, |
1221 |
+ struct vmw_framebuffer_surface *vfbs = |
1222 |
+ container_of(framebuffer, typeof(*vfbs), base); |
1223 |
+ struct vmw_stdu_dirty sdirty; |
1224 |
++ struct vmw_validation_ctx ctx; |
1225 |
+ int ret; |
1226 |
+ |
1227 |
+ if (!srf) |
1228 |
+ srf = &vfbs->surface->res; |
1229 |
+ |
1230 |
+- ret = vmw_kms_helper_resource_prepare(srf, true); |
1231 |
++ ret = vmw_kms_helper_resource_prepare(srf, true, &ctx); |
1232 |
+ if (ret) |
1233 |
+ return ret; |
1234 |
+ |
1235 |
+@@ -1008,7 +1009,7 @@ int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv, |
1236 |
+ dest_x, dest_y, num_clips, inc, |
1237 |
+ &sdirty.base); |
1238 |
+ out_finish: |
1239 |
+- vmw_kms_helper_resource_finish(srf, out_fence); |
1240 |
++ vmw_kms_helper_resource_finish(&ctx, out_fence); |
1241 |
+ |
1242 |
+ return ret; |
1243 |
+ } |
1244 |
+diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c |
1245 |
+index 12eb8caa4263..3f8dde8d59ba 100644 |
1246 |
+--- a/drivers/hv/ring_buffer.c |
1247 |
++++ b/drivers/hv/ring_buffer.c |
1248 |
+@@ -394,13 +394,24 @@ __hv_pkt_iter_next(struct vmbus_channel *channel, |
1249 |
+ } |
1250 |
+ EXPORT_SYMBOL_GPL(__hv_pkt_iter_next); |
1251 |
+ |
1252 |
++/* How many bytes were read in this iterator cycle */ |
1253 |
++static u32 hv_pkt_iter_bytes_read(const struct hv_ring_buffer_info *rbi, |
1254 |
++ u32 start_read_index) |
1255 |
++{ |
1256 |
++ if (rbi->priv_read_index >= start_read_index) |
1257 |
++ return rbi->priv_read_index - start_read_index; |
1258 |
++ else |
1259 |
++ return rbi->ring_datasize - start_read_index + |
1260 |
++ rbi->priv_read_index; |
1261 |
++} |
1262 |
++ |
1263 |
+ /* |
1264 |
+ * Update host ring buffer after iterating over packets. |
1265 |
+ */ |
1266 |
+ void hv_pkt_iter_close(struct vmbus_channel *channel) |
1267 |
+ { |
1268 |
+ struct hv_ring_buffer_info *rbi = &channel->inbound; |
1269 |
+- u32 orig_write_sz = hv_get_bytes_to_write(rbi); |
1270 |
++ u32 curr_write_sz, pending_sz, bytes_read, start_read_index; |
1271 |
+ |
1272 |
+ /* |
1273 |
+ * Make sure all reads are done before we update the read index since |
1274 |
+@@ -408,8 +419,12 @@ void hv_pkt_iter_close(struct vmbus_channel *channel) |
1275 |
+ * is updated. |
1276 |
+ */ |
1277 |
+ virt_rmb(); |
1278 |
++ start_read_index = rbi->ring_buffer->read_index; |
1279 |
+ rbi->ring_buffer->read_index = rbi->priv_read_index; |
1280 |
+ |
1281 |
++ if (!rbi->ring_buffer->feature_bits.feat_pending_send_sz) |
1282 |
++ return; |
1283 |
++ |
1284 |
+ /* |
1285 |
+ * Issue a full memory barrier before making the signaling decision. |
1286 |
+ * Here is the reason for having this barrier: |
1287 |
+@@ -423,26 +438,29 @@ void hv_pkt_iter_close(struct vmbus_channel *channel) |
1288 |
+ */ |
1289 |
+ virt_mb(); |
1290 |
+ |
1291 |
+- /* If host has disabled notifications then skip */ |
1292 |
+- if (rbi->ring_buffer->interrupt_mask) |
1293 |
++ pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz); |
1294 |
++ if (!pending_sz) |
1295 |
+ return; |
1296 |
+ |
1297 |
+- if (rbi->ring_buffer->feature_bits.feat_pending_send_sz) { |
1298 |
+- u32 pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz); |
1299 |
++ /* |
1300 |
++ * Ensure the read of write_index in hv_get_bytes_to_write() |
1301 |
++ * happens after the read of pending_send_sz. |
1302 |
++ */ |
1303 |
++ virt_rmb(); |
1304 |
++ curr_write_sz = hv_get_bytes_to_write(rbi); |
1305 |
++ bytes_read = hv_pkt_iter_bytes_read(rbi, start_read_index); |
1306 |
+ |
1307 |
+- /* |
1308 |
+- * If there was space before we began iteration, |
1309 |
+- * then host was not blocked. Also handles case where |
1310 |
+- * pending_sz is zero then host has nothing pending |
1311 |
+- * and does not need to be signaled. |
1312 |
+- */ |
1313 |
+- if (orig_write_sz > pending_sz) |
1314 |
+- return; |
1315 |
++ /* |
1316 |
++ * If there was space before we began iteration, |
1317 |
++ * then host was not blocked. |
1318 |
++ */ |
1319 |
+ |
1320 |
+- /* If pending write will not fit, don't give false hope. */ |
1321 |
+- if (hv_get_bytes_to_write(rbi) < pending_sz) |
1322 |
+- return; |
1323 |
+- } |
1324 |
++ if (curr_write_sz - bytes_read > pending_sz) |
1325 |
++ return; |
1326 |
++ |
1327 |
++ /* If pending write will not fit, don't give false hope. */ |
1328 |
++ if (curr_write_sz <= pending_sz) |
1329 |
++ return; |
1330 |
+ |
1331 |
+ vmbus_setevent(channel); |
1332 |
+ } |
1333 |
+diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c |
1334 |
+index 379de1829cdb..bef1f96c177c 100644 |
1335 |
+--- a/drivers/iio/accel/st_accel_core.c |
1336 |
++++ b/drivers/iio/accel/st_accel_core.c |
1337 |
+@@ -794,7 +794,7 @@ int st_accel_common_probe(struct iio_dev *indio_dev) |
1338 |
+ if (!pdata) |
1339 |
+ pdata = (struct st_sensors_platform_data *)&default_accel_pdata; |
1340 |
+ |
1341 |
+- err = st_sensors_init_sensor(indio_dev, adata->dev->platform_data); |
1342 |
++ err = st_sensors_init_sensor(indio_dev, pdata); |
1343 |
+ if (err < 0) |
1344 |
+ goto st_accel_power_off; |
1345 |
+ |
1346 |
+diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c |
1347 |
+index 7dc7d297a0fc..11484cb38b84 100644 |
1348 |
+--- a/drivers/iio/adc/meson_saradc.c |
1349 |
++++ b/drivers/iio/adc/meson_saradc.c |
1350 |
+@@ -462,8 +462,10 @@ static int meson_sar_adc_lock(struct iio_dev *indio_dev) |
1351 |
+ regmap_read(priv->regmap, MESON_SAR_ADC_DELAY, &val); |
1352 |
+ } while (val & MESON_SAR_ADC_DELAY_BL30_BUSY && timeout--); |
1353 |
+ |
1354 |
+- if (timeout < 0) |
1355 |
++ if (timeout < 0) { |
1356 |
++ mutex_unlock(&indio_dev->mlock); |
1357 |
+ return -ETIMEDOUT; |
1358 |
++ } |
1359 |
+ } |
1360 |
+ |
1361 |
+ return 0; |
1362 |
+diff --git a/drivers/iio/chemical/ccs811.c b/drivers/iio/chemical/ccs811.c |
1363 |
+index 8cfac6d1cec4..9dd0e1cd93dd 100644 |
1364 |
+--- a/drivers/iio/chemical/ccs811.c |
1365 |
++++ b/drivers/iio/chemical/ccs811.c |
1366 |
+@@ -128,6 +128,9 @@ static int ccs811_start_sensor_application(struct i2c_client *client) |
1367 |
+ if (ret < 0) |
1368 |
+ return ret; |
1369 |
+ |
1370 |
++ if ((ret & CCS811_STATUS_FW_MODE_APPLICATION)) |
1371 |
++ return 0; |
1372 |
++ |
1373 |
+ if ((ret & CCS811_STATUS_APP_VALID_MASK) != |
1374 |
+ CCS811_STATUS_APP_VALID_LOADED) |
1375 |
+ return -EIO; |
1376 |
+diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c |
1377 |
+index b485540da89e..cce0c93accef 100644 |
1378 |
+--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c |
1379 |
++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c |
1380 |
+@@ -392,7 +392,7 @@ static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_sensor *sensor, |
1381 |
+ |
1382 |
+ st_lsm6dsx_sensor_disable(sensor); |
1383 |
+ |
1384 |
+- *val = (s16)data; |
1385 |
++ *val = (s16)le16_to_cpu(data); |
1386 |
+ |
1387 |
+ return IIO_VAL_INT; |
1388 |
+ } |
1389 |
+diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c |
1390 |
+index ea075fcd5a6f..ec5ca03529b5 100644 |
1391 |
+--- a/drivers/iio/pressure/st_pressure_core.c |
1392 |
++++ b/drivers/iio/pressure/st_pressure_core.c |
1393 |
+@@ -617,7 +617,7 @@ int st_press_common_probe(struct iio_dev *indio_dev) |
1394 |
+ if (!pdata && press_data->sensor_settings->drdy_irq.addr) |
1395 |
+ pdata = (struct st_sensors_platform_data *)&default_press_pdata; |
1396 |
+ |
1397 |
+- err = st_sensors_init_sensor(indio_dev, press_data->dev->platform_data); |
1398 |
++ err = st_sensors_init_sensor(indio_dev, pdata); |
1399 |
+ if (err < 0) |
1400 |
+ goto st_press_power_off; |
1401 |
+ |
1402 |
+diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c |
1403 |
+index cef05ab83496..6d48d8a93b62 100644 |
1404 |
+--- a/drivers/infiniband/hw/mlx5/mr.c |
1405 |
++++ b/drivers/infiniband/hw/mlx5/mr.c |
1406 |
+@@ -838,7 +838,8 @@ static int mr_umem_get(struct ib_pd *pd, u64 start, u64 length, |
1407 |
+ *umem = ib_umem_get(pd->uobject->context, start, length, |
1408 |
+ access_flags, 0); |
1409 |
+ err = PTR_ERR_OR_ZERO(*umem); |
1410 |
+- if (err < 0) { |
1411 |
++ if (err) { |
1412 |
++ *umem = NULL; |
1413 |
+ mlx5_ib_err(dev, "umem get failed (%d)\n", err); |
1414 |
+ return err; |
1415 |
+ } |
1416 |
+@@ -1415,6 +1416,7 @@ int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start, |
1417 |
+ if (err) { |
1418 |
+ mlx5_ib_warn(dev, "Failed to rereg UMR\n"); |
1419 |
+ ib_umem_release(mr->umem); |
1420 |
++ mr->umem = NULL; |
1421 |
+ clean_mr(dev, mr); |
1422 |
+ return err; |
1423 |
+ } |
1424 |
+@@ -1498,14 +1500,11 @@ static int clean_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) |
1425 |
+ u32 key = mr->mmkey.key; |
1426 |
+ |
1427 |
+ err = destroy_mkey(dev, mr); |
1428 |
+- kfree(mr); |
1429 |
+ if (err) { |
1430 |
+ mlx5_ib_warn(dev, "failed to destroy mkey 0x%x (%d)\n", |
1431 |
+ key, err); |
1432 |
+ return err; |
1433 |
+ } |
1434 |
+- } else { |
1435 |
+- mlx5_mr_cache_free(dev, mr); |
1436 |
+ } |
1437 |
+ |
1438 |
+ return 0; |
1439 |
+@@ -1548,6 +1547,11 @@ static int dereg_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) |
1440 |
+ atomic_sub(npages, &dev->mdev->priv.reg_pages); |
1441 |
+ } |
1442 |
+ |
1443 |
++ if (!mr->allocated_from_cache) |
1444 |
++ kfree(mr); |
1445 |
++ else |
1446 |
++ mlx5_mr_cache_free(dev, mr); |
1447 |
++ |
1448 |
+ return 0; |
1449 |
+ } |
1450 |
+ |
1451 |
+diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c |
1452 |
+index 9c6f2ce3b710..4281fdc0a13c 100644 |
1453 |
+--- a/drivers/mmc/core/block.c |
1454 |
++++ b/drivers/mmc/core/block.c |
1455 |
+@@ -65,6 +65,7 @@ MODULE_ALIAS("mmc:block"); |
1456 |
+ #define MMC_BLK_TIMEOUT_MS (10 * 60 * 1000) /* 10 minute timeout */ |
1457 |
+ #define MMC_SANITIZE_REQ_TIMEOUT 240000 |
1458 |
+ #define MMC_EXTRACT_INDEX_FROM_ARG(x) ((x & 0x00FF0000) >> 16) |
1459 |
++#define MMC_EXTRACT_VALUE_FROM_ARG(x) ((x & 0x0000FF00) >> 8) |
1460 |
+ |
1461 |
+ #define mmc_req_rel_wr(req) ((req->cmd_flags & REQ_FUA) && \ |
1462 |
+ (rq_data_dir(req) == WRITE)) |
1463 |
+@@ -538,6 +539,24 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, |
1464 |
+ return data.error; |
1465 |
+ } |
1466 |
+ |
1467 |
++ /* |
1468 |
++ * Make sure the cache of the PARTITION_CONFIG register and |
1469 |
++ * PARTITION_ACCESS bits is updated in case the ioctl ext_csd write |
1470 |
++ * changed it successfully. |
1471 |
++ */ |
1472 |
++ if ((MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_PART_CONFIG) && |
1473 |
++ (cmd.opcode == MMC_SWITCH)) { |
1474 |
++ struct mmc_blk_data *main_md = dev_get_drvdata(&card->dev); |
1475 |
++ u8 value = MMC_EXTRACT_VALUE_FROM_ARG(cmd.arg); |
1476 |
++ |
1477 |
++ /* |
1478 |
++ * Update cache so the next mmc_blk_part_switch call operates |
1479 |
++ * on up-to-date data. |
1480 |
++ */ |
1481 |
++ card->ext_csd.part_config = value; |
1482 |
++ main_md->part_curr = value & EXT_CSD_PART_CONFIG_ACC_MASK; |
1483 |
++ } |
1484 |
++ |
1485 |
+ /* |
1486 |
+ * According to the SD specs, some commands require a delay after |
1487 |
+ * issuing the command. |
1488 |
+diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h |
1489 |
+index 79a5b985ccf5..9c821eedd156 100644 |
1490 |
+--- a/drivers/mmc/core/card.h |
1491 |
++++ b/drivers/mmc/core/card.h |
1492 |
+@@ -82,6 +82,7 @@ struct mmc_fixup { |
1493 |
+ #define CID_MANFID_APACER 0x27 |
1494 |
+ #define CID_MANFID_KINGSTON 0x70 |
1495 |
+ #define CID_MANFID_HYNIX 0x90 |
1496 |
++#define CID_MANFID_NUMONYX 0xFE |
1497 |
+ |
1498 |
+ #define END_FIXUP { NULL } |
1499 |
+ |
1500 |
+diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h |
1501 |
+index 75d317623852..5153577754f0 100644 |
1502 |
+--- a/drivers/mmc/core/quirks.h |
1503 |
++++ b/drivers/mmc/core/quirks.h |
1504 |
+@@ -109,6 +109,12 @@ static const struct mmc_fixup mmc_ext_csd_fixups[] = { |
1505 |
+ */ |
1506 |
+ MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_HYNIX, |
1507 |
+ 0x014a, add_quirk, MMC_QUIRK_BROKEN_HPI, 5), |
1508 |
++ /* |
1509 |
++ * Certain Micron (Numonyx) eMMC 4.5 cards might get broken when HPI |
1510 |
++ * feature is used so disable the HPI feature for such buggy cards. |
1511 |
++ */ |
1512 |
++ MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_NUMONYX, |
1513 |
++ 0x014e, add_quirk, MMC_QUIRK_BROKEN_HPI, 6), |
1514 |
+ |
1515 |
+ END_FIXUP |
1516 |
+ }; |
1517 |
+diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c |
1518 |
+index fa41d9422d57..a84aa3f1ae85 100644 |
1519 |
+--- a/drivers/mmc/host/dw_mmc-exynos.c |
1520 |
++++ b/drivers/mmc/host/dw_mmc-exynos.c |
1521 |
+@@ -165,9 +165,15 @@ static void dw_mci_exynos_set_clksel_timing(struct dw_mci *host, u32 timing) |
1522 |
+ static int dw_mci_exynos_runtime_resume(struct device *dev) |
1523 |
+ { |
1524 |
+ struct dw_mci *host = dev_get_drvdata(dev); |
1525 |
++ int ret; |
1526 |
++ |
1527 |
++ ret = dw_mci_runtime_resume(dev); |
1528 |
++ if (ret) |
1529 |
++ return ret; |
1530 |
+ |
1531 |
+ dw_mci_exynos_config_smu(host); |
1532 |
+- return dw_mci_runtime_resume(dev); |
1533 |
++ |
1534 |
++ return ret; |
1535 |
+ } |
1536 |
+ |
1537 |
+ /** |
1538 |
+diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c |
1539 |
+index 60341a814055..de31e20dc56c 100644 |
1540 |
+--- a/drivers/mmc/host/dw_mmc.c |
1541 |
++++ b/drivers/mmc/host/dw_mmc.c |
1542 |
+@@ -413,7 +413,9 @@ static inline void dw_mci_set_cto(struct dw_mci *host) |
1543 |
+ cto_div = (mci_readl(host, CLKDIV) & 0xff) * 2; |
1544 |
+ if (cto_div == 0) |
1545 |
+ cto_div = 1; |
1546 |
+- cto_ms = DIV_ROUND_UP(MSEC_PER_SEC * cto_clks * cto_div, host->bus_hz); |
1547 |
++ |
1548 |
++ cto_ms = DIV_ROUND_UP_ULL((u64)MSEC_PER_SEC * cto_clks * cto_div, |
1549 |
++ host->bus_hz); |
1550 |
+ |
1551 |
+ /* add a bit spare time */ |
1552 |
+ cto_ms += 10; |
1553 |
+@@ -562,6 +564,7 @@ static int dw_mci_idmac_init(struct dw_mci *host) |
1554 |
+ (sizeof(struct idmac_desc_64addr) * |
1555 |
+ (i + 1))) >> 32; |
1556 |
+ /* Initialize reserved and buffer size fields to "0" */ |
1557 |
++ p->des0 = 0; |
1558 |
+ p->des1 = 0; |
1559 |
+ p->des2 = 0; |
1560 |
+ p->des3 = 0; |
1561 |
+@@ -584,6 +587,7 @@ static int dw_mci_idmac_init(struct dw_mci *host) |
1562 |
+ i++, p++) { |
1563 |
+ p->des3 = cpu_to_le32(host->sg_dma + |
1564 |
+ (sizeof(struct idmac_desc) * (i + 1))); |
1565 |
++ p->des0 = 0; |
1566 |
+ p->des1 = 0; |
1567 |
+ } |
1568 |
+ |
1569 |
+@@ -1799,8 +1803,8 @@ static bool dw_mci_reset(struct dw_mci *host) |
1570 |
+ } |
1571 |
+ |
1572 |
+ if (host->use_dma == TRANS_MODE_IDMAC) |
1573 |
+- /* It is also recommended that we reset and reprogram idmac */ |
1574 |
+- dw_mci_idmac_reset(host); |
1575 |
++ /* It is also required that we reinit idmac */ |
1576 |
++ dw_mci_idmac_init(host); |
1577 |
+ |
1578 |
+ ret = true; |
1579 |
+ |
1580 |
+@@ -1947,8 +1951,9 @@ static void dw_mci_set_drto(struct dw_mci *host) |
1581 |
+ drto_div = (mci_readl(host, CLKDIV) & 0xff) * 2; |
1582 |
+ if (drto_div == 0) |
1583 |
+ drto_div = 1; |
1584 |
+- drto_ms = DIV_ROUND_UP(MSEC_PER_SEC * drto_clks * drto_div, |
1585 |
+- host->bus_hz); |
1586 |
++ |
1587 |
++ drto_ms = DIV_ROUND_UP_ULL((u64)MSEC_PER_SEC * drto_clks * drto_div, |
1588 |
++ host->bus_hz); |
1589 |
+ |
1590 |
+ /* add a bit spare time */ |
1591 |
+ drto_ms += 10; |
1592 |
+diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c |
1593 |
+index 3568294d4854..b25f444c5914 100644 |
1594 |
+--- a/drivers/mtd/mtdchar.c |
1595 |
++++ b/drivers/mtd/mtdchar.c |
1596 |
+@@ -487,7 +487,7 @@ static int shrink_ecclayout(struct mtd_info *mtd, |
1597 |
+ for (i = 0; i < MTD_MAX_ECCPOS_ENTRIES;) { |
1598 |
+ u32 eccpos; |
1599 |
+ |
1600 |
+- ret = mtd_ooblayout_ecc(mtd, section, &oobregion); |
1601 |
++ ret = mtd_ooblayout_ecc(mtd, section++, &oobregion); |
1602 |
+ if (ret < 0) { |
1603 |
+ if (ret != -ERANGE) |
1604 |
+ return ret; |
1605 |
+@@ -534,7 +534,7 @@ static int get_oobinfo(struct mtd_info *mtd, struct nand_oobinfo *to) |
1606 |
+ for (i = 0; i < ARRAY_SIZE(to->eccpos);) { |
1607 |
+ u32 eccpos; |
1608 |
+ |
1609 |
+- ret = mtd_ooblayout_ecc(mtd, section, &oobregion); |
1610 |
++ ret = mtd_ooblayout_ecc(mtd, section++, &oobregion); |
1611 |
+ if (ret < 0) { |
1612 |
+ if (ret != -ERANGE) |
1613 |
+ return ret; |
1614 |
+diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c |
1615 |
+index bbdd68a54d68..4005b427023c 100644 |
1616 |
+--- a/drivers/mtd/nand/fsl_ifc_nand.c |
1617 |
++++ b/drivers/mtd/nand/fsl_ifc_nand.c |
1618 |
+@@ -173,14 +173,9 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob) |
1619 |
+ |
1620 |
+ /* returns nonzero if entire page is blank */ |
1621 |
+ static int check_read_ecc(struct mtd_info *mtd, struct fsl_ifc_ctrl *ctrl, |
1622 |
+- u32 *eccstat, unsigned int bufnum) |
1623 |
++ u32 eccstat, unsigned int bufnum) |
1624 |
+ { |
1625 |
+- u32 reg = eccstat[bufnum / 4]; |
1626 |
+- int errors; |
1627 |
+- |
1628 |
+- errors = (reg >> ((3 - bufnum % 4) * 8)) & 15; |
1629 |
+- |
1630 |
+- return errors; |
1631 |
++ return (eccstat >> ((3 - bufnum % 4) * 8)) & 15; |
1632 |
+ } |
1633 |
+ |
1634 |
+ /* |
1635 |
+@@ -193,7 +188,7 @@ static void fsl_ifc_run_command(struct mtd_info *mtd) |
1636 |
+ struct fsl_ifc_ctrl *ctrl = priv->ctrl; |
1637 |
+ struct fsl_ifc_nand_ctrl *nctrl = ifc_nand_ctrl; |
1638 |
+ struct fsl_ifc_runtime __iomem *ifc = ctrl->rregs; |
1639 |
+- u32 eccstat[4]; |
1640 |
++ u32 eccstat; |
1641 |
+ int i; |
1642 |
+ |
1643 |
+ /* set the chip select for NAND Transaction */ |
1644 |
+@@ -228,19 +223,17 @@ static void fsl_ifc_run_command(struct mtd_info *mtd) |
1645 |
+ if (nctrl->eccread) { |
1646 |
+ int errors; |
1647 |
+ int bufnum = nctrl->page & priv->bufnum_mask; |
1648 |
+- int sector = bufnum * chip->ecc.steps; |
1649 |
+- int sector_end = sector + chip->ecc.steps - 1; |
1650 |
++ int sector_start = bufnum * chip->ecc.steps; |
1651 |
++ int sector_end = sector_start + chip->ecc.steps - 1; |
1652 |
+ __be32 *eccstat_regs; |
1653 |
+ |
1654 |
+- if (ctrl->version >= FSL_IFC_VERSION_2_0_0) |
1655 |
+- eccstat_regs = ifc->ifc_nand.v2_nand_eccstat; |
1656 |
+- else |
1657 |
+- eccstat_regs = ifc->ifc_nand.v1_nand_eccstat; |
1658 |
++ eccstat_regs = ifc->ifc_nand.nand_eccstat; |
1659 |
++ eccstat = ifc_in32(&eccstat_regs[sector_start / 4]); |
1660 |
+ |
1661 |
+- for (i = sector / 4; i <= sector_end / 4; i++) |
1662 |
+- eccstat[i] = ifc_in32(&eccstat_regs[i]); |
1663 |
++ for (i = sector_start; i <= sector_end; i++) { |
1664 |
++ if (i != sector_start && !(i % 4)) |
1665 |
++ eccstat = ifc_in32(&eccstat_regs[i / 4]); |
1666 |
+ |
1667 |
+- for (i = sector; i <= sector_end; i++) { |
1668 |
+ errors = check_read_ecc(mtd, ctrl, eccstat, i); |
1669 |
+ |
1670 |
+ if (errors == 15) { |
1671 |
+@@ -626,6 +619,7 @@ static int fsl_ifc_wait(struct mtd_info *mtd, struct nand_chip *chip) |
1672 |
+ struct fsl_ifc_ctrl *ctrl = priv->ctrl; |
1673 |
+ struct fsl_ifc_runtime __iomem *ifc = ctrl->rregs; |
1674 |
+ u32 nand_fsr; |
1675 |
++ int status; |
1676 |
+ |
1677 |
+ /* Use READ_STATUS command, but wait for the device to be ready */ |
1678 |
+ ifc_out32((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | |
1679 |
+@@ -640,12 +634,12 @@ static int fsl_ifc_wait(struct mtd_info *mtd, struct nand_chip *chip) |
1680 |
+ fsl_ifc_run_command(mtd); |
1681 |
+ |
1682 |
+ nand_fsr = ifc_in32(&ifc->ifc_nand.nand_fsr); |
1683 |
+- |
1684 |
++ status = nand_fsr >> 24; |
1685 |
+ /* |
1686 |
+ * The chip always seems to report that it is |
1687 |
+ * write-protected, even when it is not. |
1688 |
+ */ |
1689 |
+- return nand_fsr | NAND_STATUS_WP; |
1690 |
++ return status | NAND_STATUS_WP; |
1691 |
+ } |
1692 |
+ |
1693 |
+ /* |
1694 |
+diff --git a/drivers/net/can/cc770/cc770.c b/drivers/net/can/cc770/cc770.c |
1695 |
+index 1e37313054f3..6da69af103e6 100644 |
1696 |
+--- a/drivers/net/can/cc770/cc770.c |
1697 |
++++ b/drivers/net/can/cc770/cc770.c |
1698 |
+@@ -390,37 +390,23 @@ static int cc770_get_berr_counter(const struct net_device *dev, |
1699 |
+ return 0; |
1700 |
+ } |
1701 |
+ |
1702 |
+-static netdev_tx_t cc770_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1703 |
++static void cc770_tx(struct net_device *dev, int mo) |
1704 |
+ { |
1705 |
+ struct cc770_priv *priv = netdev_priv(dev); |
1706 |
+- struct net_device_stats *stats = &dev->stats; |
1707 |
+- struct can_frame *cf = (struct can_frame *)skb->data; |
1708 |
+- unsigned int mo = obj2msgobj(CC770_OBJ_TX); |
1709 |
++ struct can_frame *cf = (struct can_frame *)priv->tx_skb->data; |
1710 |
+ u8 dlc, rtr; |
1711 |
+ u32 id; |
1712 |
+ int i; |
1713 |
+ |
1714 |
+- if (can_dropped_invalid_skb(dev, skb)) |
1715 |
+- return NETDEV_TX_OK; |
1716 |
+- |
1717 |
+- if ((cc770_read_reg(priv, |
1718 |
+- msgobj[mo].ctrl1) & TXRQST_UNC) == TXRQST_SET) { |
1719 |
+- netdev_err(dev, "TX register is still occupied!\n"); |
1720 |
+- return NETDEV_TX_BUSY; |
1721 |
+- } |
1722 |
+- |
1723 |
+- netif_stop_queue(dev); |
1724 |
+- |
1725 |
+ dlc = cf->can_dlc; |
1726 |
+ id = cf->can_id; |
1727 |
+- if (cf->can_id & CAN_RTR_FLAG) |
1728 |
+- rtr = 0; |
1729 |
+- else |
1730 |
+- rtr = MSGCFG_DIR; |
1731 |
++ rtr = cf->can_id & CAN_RTR_FLAG ? 0 : MSGCFG_DIR; |
1732 |
++ |
1733 |
++ cc770_write_reg(priv, msgobj[mo].ctrl0, |
1734 |
++ MSGVAL_RES | TXIE_RES | RXIE_RES | INTPND_RES); |
1735 |
+ cc770_write_reg(priv, msgobj[mo].ctrl1, |
1736 |
+ RMTPND_RES | TXRQST_RES | CPUUPD_SET | NEWDAT_RES); |
1737 |
+- cc770_write_reg(priv, msgobj[mo].ctrl0, |
1738 |
+- MSGVAL_SET | TXIE_SET | RXIE_RES | INTPND_RES); |
1739 |
++ |
1740 |
+ if (id & CAN_EFF_FLAG) { |
1741 |
+ id &= CAN_EFF_MASK; |
1742 |
+ cc770_write_reg(priv, msgobj[mo].config, |
1743 |
+@@ -439,22 +425,30 @@ static netdev_tx_t cc770_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1744 |
+ for (i = 0; i < dlc; i++) |
1745 |
+ cc770_write_reg(priv, msgobj[mo].data[i], cf->data[i]); |
1746 |
+ |
1747 |
+- /* Store echo skb before starting the transfer */ |
1748 |
+- can_put_echo_skb(skb, dev, 0); |
1749 |
+- |
1750 |
+ cc770_write_reg(priv, msgobj[mo].ctrl1, |
1751 |
+- RMTPND_RES | TXRQST_SET | CPUUPD_RES | NEWDAT_UNC); |
1752 |
++ RMTPND_UNC | TXRQST_SET | CPUUPD_RES | NEWDAT_UNC); |
1753 |
++ cc770_write_reg(priv, msgobj[mo].ctrl0, |
1754 |
++ MSGVAL_SET | TXIE_SET | RXIE_SET | INTPND_UNC); |
1755 |
++} |
1756 |
+ |
1757 |
+- stats->tx_bytes += dlc; |
1758 |
++static netdev_tx_t cc770_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1759 |
++{ |
1760 |
++ struct cc770_priv *priv = netdev_priv(dev); |
1761 |
++ unsigned int mo = obj2msgobj(CC770_OBJ_TX); |
1762 |
+ |
1763 |
++ if (can_dropped_invalid_skb(dev, skb)) |
1764 |
++ return NETDEV_TX_OK; |
1765 |
+ |
1766 |
+- /* |
1767 |
+- * HM: We had some cases of repeated IRQs so make sure the |
1768 |
+- * INT is acknowledged I know it's already further up, but |
1769 |
+- * doing again fixed the issue |
1770 |
+- */ |
1771 |
+- cc770_write_reg(priv, msgobj[mo].ctrl0, |
1772 |
+- MSGVAL_UNC | TXIE_UNC | RXIE_UNC | INTPND_RES); |
1773 |
++ netif_stop_queue(dev); |
1774 |
++ |
1775 |
++ if ((cc770_read_reg(priv, |
1776 |
++ msgobj[mo].ctrl1) & TXRQST_UNC) == TXRQST_SET) { |
1777 |
++ netdev_err(dev, "TX register is still occupied!\n"); |
1778 |
++ return NETDEV_TX_BUSY; |
1779 |
++ } |
1780 |
++ |
1781 |
++ priv->tx_skb = skb; |
1782 |
++ cc770_tx(dev, mo); |
1783 |
+ |
1784 |
+ return NETDEV_TX_OK; |
1785 |
+ } |
1786 |
+@@ -680,19 +674,46 @@ static void cc770_tx_interrupt(struct net_device *dev, unsigned int o) |
1787 |
+ struct cc770_priv *priv = netdev_priv(dev); |
1788 |
+ struct net_device_stats *stats = &dev->stats; |
1789 |
+ unsigned int mo = obj2msgobj(o); |
1790 |
++ struct can_frame *cf; |
1791 |
++ u8 ctrl1; |
1792 |
++ |
1793 |
++ ctrl1 = cc770_read_reg(priv, msgobj[mo].ctrl1); |
1794 |
+ |
1795 |
+- /* Nothing more to send, switch off interrupts */ |
1796 |
+ cc770_write_reg(priv, msgobj[mo].ctrl0, |
1797 |
+ MSGVAL_RES | TXIE_RES | RXIE_RES | INTPND_RES); |
1798 |
+- /* |
1799 |
+- * We had some cases of repeated IRQ so make sure the |
1800 |
+- * INT is acknowledged |
1801 |
++ cc770_write_reg(priv, msgobj[mo].ctrl1, |
1802 |
++ RMTPND_RES | TXRQST_RES | MSGLST_RES | NEWDAT_RES); |
1803 |
++ |
1804 |
++ if (unlikely(!priv->tx_skb)) { |
1805 |
++ netdev_err(dev, "missing tx skb in tx interrupt\n"); |
1806 |
++ return; |
1807 |
++ } |
1808 |
++ |
1809 |
++ if (unlikely(ctrl1 & MSGLST_SET)) { |
1810 |
++ stats->rx_over_errors++; |
1811 |
++ stats->rx_errors++; |
1812 |
++ } |
1813 |
++ |
1814 |
++ /* When the CC770 is sending an RTR message and it receives a regular |
1815 |
++ * message that matches the id of the RTR message, it will overwrite the |
1816 |
++ * outgoing message in the TX register. When this happens we must |
1817 |
++ * process the received message and try to transmit the outgoing skb |
1818 |
++ * again. |
1819 |
+ */ |
1820 |
+- cc770_write_reg(priv, msgobj[mo].ctrl0, |
1821 |
+- MSGVAL_UNC | TXIE_UNC | RXIE_UNC | INTPND_RES); |
1822 |
++ if (unlikely(ctrl1 & NEWDAT_SET)) { |
1823 |
++ cc770_rx(dev, mo, ctrl1); |
1824 |
++ cc770_tx(dev, mo); |
1825 |
++ return; |
1826 |
++ } |
1827 |
+ |
1828 |
++ cf = (struct can_frame *)priv->tx_skb->data; |
1829 |
++ stats->tx_bytes += cf->can_dlc; |
1830 |
+ stats->tx_packets++; |
1831 |
++ |
1832 |
++ can_put_echo_skb(priv->tx_skb, dev, 0); |
1833 |
+ can_get_echo_skb(dev, 0); |
1834 |
++ priv->tx_skb = NULL; |
1835 |
++ |
1836 |
+ netif_wake_queue(dev); |
1837 |
+ } |
1838 |
+ |
1839 |
+@@ -804,6 +825,7 @@ struct net_device *alloc_cc770dev(int sizeof_priv) |
1840 |
+ priv->can.do_set_bittiming = cc770_set_bittiming; |
1841 |
+ priv->can.do_set_mode = cc770_set_mode; |
1842 |
+ priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; |
1843 |
++ priv->tx_skb = NULL; |
1844 |
+ |
1845 |
+ memcpy(priv->obj_flags, cc770_obj_flags, sizeof(cc770_obj_flags)); |
1846 |
+ |
1847 |
+diff --git a/drivers/net/can/cc770/cc770.h b/drivers/net/can/cc770/cc770.h |
1848 |
+index a1739db98d91..95752e1d1283 100644 |
1849 |
+--- a/drivers/net/can/cc770/cc770.h |
1850 |
++++ b/drivers/net/can/cc770/cc770.h |
1851 |
+@@ -193,6 +193,8 @@ struct cc770_priv { |
1852 |
+ u8 cpu_interface; /* CPU interface register */ |
1853 |
+ u8 clkout; /* Clock out register */ |
1854 |
+ u8 bus_config; /* Bus conffiguration register */ |
1855 |
++ |
1856 |
++ struct sk_buff *tx_skb; |
1857 |
+ }; |
1858 |
+ |
1859 |
+ struct net_device *alloc_cc770dev(int sizeof_priv); |
1860 |
+diff --git a/drivers/net/can/ifi_canfd/ifi_canfd.c b/drivers/net/can/ifi_canfd/ifi_canfd.c |
1861 |
+index 2772d05ff11c..fedd927ba6ed 100644 |
1862 |
+--- a/drivers/net/can/ifi_canfd/ifi_canfd.c |
1863 |
++++ b/drivers/net/can/ifi_canfd/ifi_canfd.c |
1864 |
+@@ -30,6 +30,7 @@ |
1865 |
+ #define IFI_CANFD_STCMD_ERROR_ACTIVE BIT(2) |
1866 |
+ #define IFI_CANFD_STCMD_ERROR_PASSIVE BIT(3) |
1867 |
+ #define IFI_CANFD_STCMD_BUSOFF BIT(4) |
1868 |
++#define IFI_CANFD_STCMD_ERROR_WARNING BIT(5) |
1869 |
+ #define IFI_CANFD_STCMD_BUSMONITOR BIT(16) |
1870 |
+ #define IFI_CANFD_STCMD_LOOPBACK BIT(18) |
1871 |
+ #define IFI_CANFD_STCMD_DISABLE_CANFD BIT(24) |
1872 |
+@@ -52,7 +53,10 @@ |
1873 |
+ #define IFI_CANFD_TXSTCMD_OVERFLOW BIT(13) |
1874 |
+ |
1875 |
+ #define IFI_CANFD_INTERRUPT 0xc |
1876 |
++#define IFI_CANFD_INTERRUPT_ERROR_BUSOFF BIT(0) |
1877 |
+ #define IFI_CANFD_INTERRUPT_ERROR_WARNING BIT(1) |
1878 |
++#define IFI_CANFD_INTERRUPT_ERROR_STATE_CHG BIT(2) |
1879 |
++#define IFI_CANFD_INTERRUPT_ERROR_REC_TEC_INC BIT(3) |
1880 |
+ #define IFI_CANFD_INTERRUPT_ERROR_COUNTER BIT(10) |
1881 |
+ #define IFI_CANFD_INTERRUPT_TXFIFO_EMPTY BIT(16) |
1882 |
+ #define IFI_CANFD_INTERRUPT_TXFIFO_REMOVE BIT(22) |
1883 |
+@@ -61,6 +65,10 @@ |
1884 |
+ #define IFI_CANFD_INTERRUPT_SET_IRQ ((u32)BIT(31)) |
1885 |
+ |
1886 |
+ #define IFI_CANFD_IRQMASK 0x10 |
1887 |
++#define IFI_CANFD_IRQMASK_ERROR_BUSOFF BIT(0) |
1888 |
++#define IFI_CANFD_IRQMASK_ERROR_WARNING BIT(1) |
1889 |
++#define IFI_CANFD_IRQMASK_ERROR_STATE_CHG BIT(2) |
1890 |
++#define IFI_CANFD_IRQMASK_ERROR_REC_TEC_INC BIT(3) |
1891 |
+ #define IFI_CANFD_IRQMASK_SET_ERR BIT(7) |
1892 |
+ #define IFI_CANFD_IRQMASK_SET_TS BIT(15) |
1893 |
+ #define IFI_CANFD_IRQMASK_TXFIFO_EMPTY BIT(16) |
1894 |
+@@ -136,6 +144,8 @@ |
1895 |
+ #define IFI_CANFD_SYSCLOCK 0x50 |
1896 |
+ |
1897 |
+ #define IFI_CANFD_VER 0x54 |
1898 |
++#define IFI_CANFD_VER_REV_MASK 0xff |
1899 |
++#define IFI_CANFD_VER_REV_MIN_SUPPORTED 0x15 |
1900 |
+ |
1901 |
+ #define IFI_CANFD_IP_ID 0x58 |
1902 |
+ #define IFI_CANFD_IP_ID_VALUE 0xD073CAFD |
1903 |
+@@ -220,7 +230,10 @@ static void ifi_canfd_irq_enable(struct net_device *ndev, bool enable) |
1904 |
+ |
1905 |
+ if (enable) { |
1906 |
+ enirq = IFI_CANFD_IRQMASK_TXFIFO_EMPTY | |
1907 |
+- IFI_CANFD_IRQMASK_RXFIFO_NEMPTY; |
1908 |
++ IFI_CANFD_IRQMASK_RXFIFO_NEMPTY | |
1909 |
++ IFI_CANFD_IRQMASK_ERROR_STATE_CHG | |
1910 |
++ IFI_CANFD_IRQMASK_ERROR_WARNING | |
1911 |
++ IFI_CANFD_IRQMASK_ERROR_BUSOFF; |
1912 |
+ if (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) |
1913 |
+ enirq |= IFI_CANFD_INTERRUPT_ERROR_COUNTER; |
1914 |
+ } |
1915 |
+@@ -361,12 +374,13 @@ static int ifi_canfd_handle_lost_msg(struct net_device *ndev) |
1916 |
+ return 1; |
1917 |
+ } |
1918 |
+ |
1919 |
+-static int ifi_canfd_handle_lec_err(struct net_device *ndev, const u32 errctr) |
1920 |
++static int ifi_canfd_handle_lec_err(struct net_device *ndev) |
1921 |
+ { |
1922 |
+ struct ifi_canfd_priv *priv = netdev_priv(ndev); |
1923 |
+ struct net_device_stats *stats = &ndev->stats; |
1924 |
+ struct can_frame *cf; |
1925 |
+ struct sk_buff *skb; |
1926 |
++ u32 errctr = readl(priv->base + IFI_CANFD_ERROR_CTR); |
1927 |
+ const u32 errmask = IFI_CANFD_ERROR_CTR_OVERLOAD_FIRST | |
1928 |
+ IFI_CANFD_ERROR_CTR_ACK_ERROR_FIRST | |
1929 |
+ IFI_CANFD_ERROR_CTR_BIT0_ERROR_FIRST | |
1930 |
+@@ -449,6 +463,11 @@ static int ifi_canfd_handle_state_change(struct net_device *ndev, |
1931 |
+ |
1932 |
+ switch (new_state) { |
1933 |
+ case CAN_STATE_ERROR_ACTIVE: |
1934 |
++ /* error active state */ |
1935 |
++ priv->can.can_stats.error_warning++; |
1936 |
++ priv->can.state = CAN_STATE_ERROR_ACTIVE; |
1937 |
++ break; |
1938 |
++ case CAN_STATE_ERROR_WARNING: |
1939 |
+ /* error warning state */ |
1940 |
+ priv->can.can_stats.error_warning++; |
1941 |
+ priv->can.state = CAN_STATE_ERROR_WARNING; |
1942 |
+@@ -477,7 +496,7 @@ static int ifi_canfd_handle_state_change(struct net_device *ndev, |
1943 |
+ ifi_canfd_get_berr_counter(ndev, &bec); |
1944 |
+ |
1945 |
+ switch (new_state) { |
1946 |
+- case CAN_STATE_ERROR_ACTIVE: |
1947 |
++ case CAN_STATE_ERROR_WARNING: |
1948 |
+ /* error warning state */ |
1949 |
+ cf->can_id |= CAN_ERR_CRTL; |
1950 |
+ cf->data[1] = (bec.txerr > bec.rxerr) ? |
1951 |
+@@ -510,22 +529,21 @@ static int ifi_canfd_handle_state_change(struct net_device *ndev, |
1952 |
+ return 1; |
1953 |
+ } |
1954 |
+ |
1955 |
+-static int ifi_canfd_handle_state_errors(struct net_device *ndev, u32 stcmd) |
1956 |
++static int ifi_canfd_handle_state_errors(struct net_device *ndev) |
1957 |
+ { |
1958 |
+ struct ifi_canfd_priv *priv = netdev_priv(ndev); |
1959 |
++ u32 stcmd = readl(priv->base + IFI_CANFD_STCMD); |
1960 |
+ int work_done = 0; |
1961 |
+- u32 isr; |
1962 |
+ |
1963 |
+- /* |
1964 |
+- * The ErrWarn condition is a little special, since the bit is |
1965 |
+- * located in the INTERRUPT register instead of STCMD register. |
1966 |
+- */ |
1967 |
+- isr = readl(priv->base + IFI_CANFD_INTERRUPT); |
1968 |
+- if ((isr & IFI_CANFD_INTERRUPT_ERROR_WARNING) && |
1969 |
++ if ((stcmd & IFI_CANFD_STCMD_ERROR_ACTIVE) && |
1970 |
++ (priv->can.state != CAN_STATE_ERROR_ACTIVE)) { |
1971 |
++ netdev_dbg(ndev, "Error, entered active state\n"); |
1972 |
++ work_done += ifi_canfd_handle_state_change(ndev, |
1973 |
++ CAN_STATE_ERROR_ACTIVE); |
1974 |
++ } |
1975 |
++ |
1976 |
++ if ((stcmd & IFI_CANFD_STCMD_ERROR_WARNING) && |
1977 |
+ (priv->can.state != CAN_STATE_ERROR_WARNING)) { |
1978 |
+- /* Clear the interrupt */ |
1979 |
+- writel(IFI_CANFD_INTERRUPT_ERROR_WARNING, |
1980 |
+- priv->base + IFI_CANFD_INTERRUPT); |
1981 |
+ netdev_dbg(ndev, "Error, entered warning state\n"); |
1982 |
+ work_done += ifi_canfd_handle_state_change(ndev, |
1983 |
+ CAN_STATE_ERROR_WARNING); |
1984 |
+@@ -552,18 +570,11 @@ static int ifi_canfd_poll(struct napi_struct *napi, int quota) |
1985 |
+ { |
1986 |
+ struct net_device *ndev = napi->dev; |
1987 |
+ struct ifi_canfd_priv *priv = netdev_priv(ndev); |
1988 |
+- const u32 stcmd_state_mask = IFI_CANFD_STCMD_ERROR_PASSIVE | |
1989 |
+- IFI_CANFD_STCMD_BUSOFF; |
1990 |
+- int work_done = 0; |
1991 |
+- |
1992 |
+- u32 stcmd = readl(priv->base + IFI_CANFD_STCMD); |
1993 |
+ u32 rxstcmd = readl(priv->base + IFI_CANFD_RXSTCMD); |
1994 |
+- u32 errctr = readl(priv->base + IFI_CANFD_ERROR_CTR); |
1995 |
++ int work_done = 0; |
1996 |
+ |
1997 |
+ /* Handle bus state changes */ |
1998 |
+- if ((stcmd & stcmd_state_mask) || |
1999 |
+- ((stcmd & IFI_CANFD_STCMD_ERROR_ACTIVE) == 0)) |
2000 |
+- work_done += ifi_canfd_handle_state_errors(ndev, stcmd); |
2001 |
++ work_done += ifi_canfd_handle_state_errors(ndev); |
2002 |
+ |
2003 |
+ /* Handle lost messages on RX */ |
2004 |
+ if (rxstcmd & IFI_CANFD_RXSTCMD_OVERFLOW) |
2005 |
+@@ -571,7 +582,7 @@ static int ifi_canfd_poll(struct napi_struct *napi, int quota) |
2006 |
+ |
2007 |
+ /* Handle lec errors on the bus */ |
2008 |
+ if (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) |
2009 |
+- work_done += ifi_canfd_handle_lec_err(ndev, errctr); |
2010 |
++ work_done += ifi_canfd_handle_lec_err(ndev); |
2011 |
+ |
2012 |
+ /* Handle normal messages on RX */ |
2013 |
+ if (!(rxstcmd & IFI_CANFD_RXSTCMD_EMPTY)) |
2014 |
+@@ -592,12 +603,13 @@ static irqreturn_t ifi_canfd_isr(int irq, void *dev_id) |
2015 |
+ struct net_device_stats *stats = &ndev->stats; |
2016 |
+ const u32 rx_irq_mask = IFI_CANFD_INTERRUPT_RXFIFO_NEMPTY | |
2017 |
+ IFI_CANFD_INTERRUPT_RXFIFO_NEMPTY_PER | |
2018 |
++ IFI_CANFD_INTERRUPT_ERROR_COUNTER | |
2019 |
++ IFI_CANFD_INTERRUPT_ERROR_STATE_CHG | |
2020 |
+ IFI_CANFD_INTERRUPT_ERROR_WARNING | |
2021 |
+- IFI_CANFD_INTERRUPT_ERROR_COUNTER; |
2022 |
++ IFI_CANFD_INTERRUPT_ERROR_BUSOFF; |
2023 |
+ const u32 tx_irq_mask = IFI_CANFD_INTERRUPT_TXFIFO_EMPTY | |
2024 |
+ IFI_CANFD_INTERRUPT_TXFIFO_REMOVE; |
2025 |
+- const u32 clr_irq_mask = ~((u32)(IFI_CANFD_INTERRUPT_SET_IRQ | |
2026 |
+- IFI_CANFD_INTERRUPT_ERROR_WARNING)); |
2027 |
++ const u32 clr_irq_mask = ~((u32)IFI_CANFD_INTERRUPT_SET_IRQ); |
2028 |
+ u32 isr; |
2029 |
+ |
2030 |
+ isr = readl(priv->base + IFI_CANFD_INTERRUPT); |
2031 |
+@@ -933,7 +945,7 @@ static int ifi_canfd_plat_probe(struct platform_device *pdev) |
2032 |
+ struct resource *res; |
2033 |
+ void __iomem *addr; |
2034 |
+ int irq, ret; |
2035 |
+- u32 id; |
2036 |
++ u32 id, rev; |
2037 |
+ |
2038 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2039 |
+ addr = devm_ioremap_resource(dev, res); |
2040 |
+@@ -947,6 +959,13 @@ static int ifi_canfd_plat_probe(struct platform_device *pdev) |
2041 |
+ return -EINVAL; |
2042 |
+ } |
2043 |
+ |
2044 |
++ rev = readl(addr + IFI_CANFD_VER) & IFI_CANFD_VER_REV_MASK; |
2045 |
++ if (rev < IFI_CANFD_VER_REV_MIN_SUPPORTED) { |
2046 |
++ dev_err(dev, "This block is too old (rev %i), minimum supported is rev %i\n", |
2047 |
++ rev, IFI_CANFD_VER_REV_MIN_SUPPORTED); |
2048 |
++ return -EINVAL; |
2049 |
++ } |
2050 |
++ |
2051 |
+ ndev = alloc_candev(sizeof(*priv), 1); |
2052 |
+ if (!ndev) |
2053 |
+ return -ENOMEM; |
2054 |
+diff --git a/drivers/net/can/peak_canfd/peak_canfd.c b/drivers/net/can/peak_canfd/peak_canfd.c |
2055 |
+index 55513411a82e..ed8561d4a90f 100644 |
2056 |
+--- a/drivers/net/can/peak_canfd/peak_canfd.c |
2057 |
++++ b/drivers/net/can/peak_canfd/peak_canfd.c |
2058 |
+@@ -262,7 +262,6 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv, |
2059 |
+ |
2060 |
+ spin_lock_irqsave(&priv->echo_lock, flags); |
2061 |
+ can_get_echo_skb(priv->ndev, msg->client); |
2062 |
+- spin_unlock_irqrestore(&priv->echo_lock, flags); |
2063 |
+ |
2064 |
+ /* count bytes of the echo instead of skb */ |
2065 |
+ stats->tx_bytes += cf_len; |
2066 |
+@@ -271,6 +270,7 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv, |
2067 |
+ /* restart tx queue (a slot is free) */ |
2068 |
+ netif_wake_queue(priv->ndev); |
2069 |
+ |
2070 |
++ spin_unlock_irqrestore(&priv->echo_lock, flags); |
2071 |
+ return 0; |
2072 |
+ } |
2073 |
+ |
2074 |
+@@ -333,7 +333,6 @@ static int pucan_handle_status(struct peak_canfd_priv *priv, |
2075 |
+ |
2076 |
+ /* this STATUS is the CNF of the RX_BARRIER: Tx path can be setup */ |
2077 |
+ if (pucan_status_is_rx_barrier(msg)) { |
2078 |
+- unsigned long flags; |
2079 |
+ |
2080 |
+ if (priv->enable_tx_path) { |
2081 |
+ int err = priv->enable_tx_path(priv); |
2082 |
+@@ -342,16 +341,8 @@ static int pucan_handle_status(struct peak_canfd_priv *priv, |
2083 |
+ return err; |
2084 |
+ } |
2085 |
+ |
2086 |
+- /* restart network queue only if echo skb array is free */ |
2087 |
+- spin_lock_irqsave(&priv->echo_lock, flags); |
2088 |
+- |
2089 |
+- if (!priv->can.echo_skb[priv->echo_idx]) { |
2090 |
+- spin_unlock_irqrestore(&priv->echo_lock, flags); |
2091 |
+- |
2092 |
+- netif_wake_queue(ndev); |
2093 |
+- } else { |
2094 |
+- spin_unlock_irqrestore(&priv->echo_lock, flags); |
2095 |
+- } |
2096 |
++ /* start network queue (echo_skb array is empty) */ |
2097 |
++ netif_start_queue(ndev); |
2098 |
+ |
2099 |
+ return 0; |
2100 |
+ } |
2101 |
+@@ -726,11 +717,6 @@ static netdev_tx_t peak_canfd_start_xmit(struct sk_buff *skb, |
2102 |
+ */ |
2103 |
+ should_stop_tx_queue = !!(priv->can.echo_skb[priv->echo_idx]); |
2104 |
+ |
2105 |
+- spin_unlock_irqrestore(&priv->echo_lock, flags); |
2106 |
+- |
2107 |
+- /* write the skb on the interface */ |
2108 |
+- priv->write_tx_msg(priv, msg); |
2109 |
+- |
2110 |
+ /* stop network tx queue if not enough room to save one more msg too */ |
2111 |
+ if (priv->can.ctrlmode & CAN_CTRLMODE_FD) |
2112 |
+ should_stop_tx_queue |= (room_left < |
2113 |
+@@ -742,6 +728,11 @@ static netdev_tx_t peak_canfd_start_xmit(struct sk_buff *skb, |
2114 |
+ if (should_stop_tx_queue) |
2115 |
+ netif_stop_queue(ndev); |
2116 |
+ |
2117 |
++ spin_unlock_irqrestore(&priv->echo_lock, flags); |
2118 |
++ |
2119 |
++ /* write the skb on the interface */ |
2120 |
++ priv->write_tx_msg(priv, msg); |
2121 |
++ |
2122 |
+ return NETDEV_TX_OK; |
2123 |
+ } |
2124 |
+ |
2125 |
+diff --git a/drivers/net/can/peak_canfd/peak_pciefd_main.c b/drivers/net/can/peak_canfd/peak_pciefd_main.c |
2126 |
+index 788c3464a3b0..3c51a884db87 100644 |
2127 |
+--- a/drivers/net/can/peak_canfd/peak_pciefd_main.c |
2128 |
++++ b/drivers/net/can/peak_canfd/peak_pciefd_main.c |
2129 |
+@@ -349,8 +349,12 @@ static irqreturn_t pciefd_irq_handler(int irq, void *arg) |
2130 |
+ priv->tx_pages_free++; |
2131 |
+ spin_unlock_irqrestore(&priv->tx_lock, flags); |
2132 |
+ |
2133 |
+- /* wake producer up */ |
2134 |
+- netif_wake_queue(priv->ucan.ndev); |
2135 |
++ /* wake producer up (only if enough room in echo_skb array) */ |
2136 |
++ spin_lock_irqsave(&priv->ucan.echo_lock, flags); |
2137 |
++ if (!priv->ucan.can.echo_skb[priv->ucan.echo_idx]) |
2138 |
++ netif_wake_queue(priv->ucan.ndev); |
2139 |
++ |
2140 |
++ spin_unlock_irqrestore(&priv->ucan.echo_lock, flags); |
2141 |
+ } |
2142 |
+ |
2143 |
+ /* re-enable Rx DMA transfer for this CAN */ |
2144 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c |
2145 |
+index 2ce675ab40ef..450f2216fac2 100644 |
2146 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c |
2147 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c |
2148 |
+@@ -462,25 +462,23 @@ static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac) |
2149 |
+ * @dev_addr: optional device address. |
2150 |
+ * |
2151 |
+ * P2P needs mac addresses for P2P device and interface. If no device |
2152 |
+- * address it specified, these are derived from the primary net device, ie. |
2153 |
+- * the permanent ethernet address of the device. |
2154 |
++ * address it specified, these are derived from a random ethernet |
2155 |
++ * address. |
2156 |
+ */ |
2157 |
+ static void brcmf_p2p_generate_bss_mac(struct brcmf_p2p_info *p2p, u8 *dev_addr) |
2158 |
+ { |
2159 |
+- struct brcmf_if *pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; |
2160 |
+- bool local_admin = false; |
2161 |
++ bool random_addr = false; |
2162 |
+ |
2163 |
+- if (!dev_addr || is_zero_ether_addr(dev_addr)) { |
2164 |
+- dev_addr = pri_ifp->mac_addr; |
2165 |
+- local_admin = true; |
2166 |
+- } |
2167 |
++ if (!dev_addr || is_zero_ether_addr(dev_addr)) |
2168 |
++ random_addr = true; |
2169 |
+ |
2170 |
+- /* Generate the P2P Device Address. This consists of the device's |
2171 |
+- * primary MAC address with the locally administered bit set. |
2172 |
++ /* Generate the P2P Device Address obtaining a random ethernet |
2173 |
++ * address with the locally administered bit set. |
2174 |
+ */ |
2175 |
+- memcpy(p2p->dev_addr, dev_addr, ETH_ALEN); |
2176 |
+- if (local_admin) |
2177 |
+- p2p->dev_addr[0] |= 0x02; |
2178 |
++ if (random_addr) |
2179 |
++ eth_random_addr(p2p->dev_addr); |
2180 |
++ else |
2181 |
++ memcpy(p2p->dev_addr, dev_addr, ETH_ALEN); |
2182 |
+ |
2183 |
+ /* Generate the P2P Interface Address. If the discovery and connection |
2184 |
+ * BSSCFGs need to simultaneously co-exist, then this address must be |
2185 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c |
2186 |
+index 4d47b97adfed..0034ebd3e5ba 100644 |
2187 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c |
2188 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c |
2189 |
+@@ -1123,7 +1123,8 @@ static void _rtl8723be_enable_aspm_back_door(struct ieee80211_hw *hw) |
2190 |
+ |
2191 |
+ /* Configuration Space offset 0x70f BIT7 is used to control L0S */ |
2192 |
+ tmp8 = _rtl8723be_dbi_read(rtlpriv, 0x70f); |
2193 |
+- _rtl8723be_dbi_write(rtlpriv, 0x70f, tmp8 | BIT(7)); |
2194 |
++ _rtl8723be_dbi_write(rtlpriv, 0x70f, tmp8 | BIT(7) | |
2195 |
++ ASPM_L1_LATENCY << 3); |
2196 |
+ |
2197 |
+ /* Configuration Space offset 0x719 Bit3 is for L1 |
2198 |
+ * BIT4 is for clock request |
2199 |
+diff --git a/drivers/nvdimm/blk.c b/drivers/nvdimm/blk.c |
2200 |
+index 345acca576b3..1bd7b3734751 100644 |
2201 |
+--- a/drivers/nvdimm/blk.c |
2202 |
++++ b/drivers/nvdimm/blk.c |
2203 |
+@@ -278,8 +278,6 @@ static int nsblk_attach_disk(struct nd_namespace_blk *nsblk) |
2204 |
+ disk->queue = q; |
2205 |
+ disk->flags = GENHD_FL_EXT_DEVT; |
2206 |
+ nvdimm_namespace_disk_name(&nsblk->common, disk->disk_name); |
2207 |
+- set_capacity(disk, 0); |
2208 |
+- device_add_disk(dev, disk); |
2209 |
+ |
2210 |
+ if (devm_add_action_or_reset(dev, nd_blk_release_disk, disk)) |
2211 |
+ return -ENOMEM; |
2212 |
+@@ -292,6 +290,7 @@ static int nsblk_attach_disk(struct nd_namespace_blk *nsblk) |
2213 |
+ } |
2214 |
+ |
2215 |
+ set_capacity(disk, available_disk_size >> SECTOR_SHIFT); |
2216 |
++ device_add_disk(dev, disk); |
2217 |
+ revalidate_disk(disk); |
2218 |
+ return 0; |
2219 |
+ } |
2220 |
+diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c |
2221 |
+index 09428ebd315b..b2feda35966b 100644 |
2222 |
+--- a/drivers/nvdimm/btt.c |
2223 |
++++ b/drivers/nvdimm/btt.c |
2224 |
+@@ -1542,8 +1542,6 @@ static int btt_blk_init(struct btt *btt) |
2225 |
+ queue_flag_set_unlocked(QUEUE_FLAG_NONROT, btt->btt_queue); |
2226 |
+ btt->btt_queue->queuedata = btt; |
2227 |
+ |
2228 |
+- set_capacity(btt->btt_disk, 0); |
2229 |
+- device_add_disk(&btt->nd_btt->dev, btt->btt_disk); |
2230 |
+ if (btt_meta_size(btt)) { |
2231 |
+ int rc = nd_integrity_init(btt->btt_disk, btt_meta_size(btt)); |
2232 |
+ |
2233 |
+@@ -1555,6 +1553,7 @@ static int btt_blk_init(struct btt *btt) |
2234 |
+ } |
2235 |
+ } |
2236 |
+ set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9); |
2237 |
++ device_add_disk(&btt->nd_btt->dev, btt->btt_disk); |
2238 |
+ btt->nd_btt->size = btt->nlba * (u64)btt->sector_size; |
2239 |
+ revalidate_disk(btt->btt_disk); |
2240 |
+ |
2241 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
2242 |
+index d18824772f6c..05fadcc4f9d2 100644 |
2243 |
+--- a/drivers/pci/quirks.c |
2244 |
++++ b/drivers/pci/quirks.c |
2245 |
+@@ -3899,6 +3899,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9230, |
2246 |
+ quirk_dma_func1_alias); |
2247 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0642, |
2248 |
+ quirk_dma_func1_alias); |
2249 |
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0645, |
2250 |
++ quirk_dma_func1_alias); |
2251 |
+ /* https://bugs.gentoo.org/show_bug.cgi?id=497630 */ |
2252 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON, |
2253 |
+ PCI_DEVICE_ID_JMICRON_JMB388_ESD, |
2254 |
+diff --git a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c |
2255 |
+index 071084d3ee9c..92aeea174a56 100644 |
2256 |
+--- a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c |
2257 |
++++ b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c |
2258 |
+@@ -129,7 +129,7 @@ static const struct samsung_pin_bank_data s5pv210_pin_bank[] __initconst = { |
2259 |
+ EXYNOS_PIN_BANK_EINTW(8, 0xc60, "gph3", 0x0c), |
2260 |
+ }; |
2261 |
+ |
2262 |
+-const struct samsung_pin_ctrl s5pv210_pin_ctrl[] __initconst = { |
2263 |
++static const struct samsung_pin_ctrl s5pv210_pin_ctrl[] __initconst = { |
2264 |
+ { |
2265 |
+ /* pin-controller instance 0 data */ |
2266 |
+ .pin_banks = s5pv210_pin_bank, |
2267 |
+@@ -142,6 +142,11 @@ const struct samsung_pin_ctrl s5pv210_pin_ctrl[] __initconst = { |
2268 |
+ }, |
2269 |
+ }; |
2270 |
+ |
2271 |
++const struct samsung_pinctrl_of_match_data s5pv210_of_data __initconst = { |
2272 |
++ .ctrl = s5pv210_pin_ctrl, |
2273 |
++ .num_ctrl = ARRAY_SIZE(s5pv210_pin_ctrl), |
2274 |
++}; |
2275 |
++ |
2276 |
+ /* Pad retention control code for accessing PMU regmap */ |
2277 |
+ static atomic_t exynos_shared_retention_refcnt; |
2278 |
+ |
2279 |
+@@ -204,7 +209,7 @@ static const struct samsung_retention_data exynos3250_retention_data __initconst |
2280 |
+ * Samsung pinctrl driver data for Exynos3250 SoC. Exynos3250 SoC includes |
2281 |
+ * two gpio/pin-mux/pinconfig controllers. |
2282 |
+ */ |
2283 |
+-const struct samsung_pin_ctrl exynos3250_pin_ctrl[] __initconst = { |
2284 |
++static const struct samsung_pin_ctrl exynos3250_pin_ctrl[] __initconst = { |
2285 |
+ { |
2286 |
+ /* pin-controller instance 0 data */ |
2287 |
+ .pin_banks = exynos3250_pin_banks0, |
2288 |
+@@ -225,6 +230,11 @@ const struct samsung_pin_ctrl exynos3250_pin_ctrl[] __initconst = { |
2289 |
+ }, |
2290 |
+ }; |
2291 |
+ |
2292 |
++const struct samsung_pinctrl_of_match_data exynos3250_of_data __initconst = { |
2293 |
++ .ctrl = exynos3250_pin_ctrl, |
2294 |
++ .num_ctrl = ARRAY_SIZE(exynos3250_pin_ctrl), |
2295 |
++}; |
2296 |
++ |
2297 |
+ /* pin banks of exynos4210 pin-controller 0 */ |
2298 |
+ static const struct samsung_pin_bank_data exynos4210_pin_banks0[] __initconst = { |
2299 |
+ EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00), |
2300 |
+@@ -308,7 +318,7 @@ static const struct samsung_retention_data exynos4_audio_retention_data __initco |
2301 |
+ * Samsung pinctrl driver data for Exynos4210 SoC. Exynos4210 SoC includes |
2302 |
+ * three gpio/pin-mux/pinconfig controllers. |
2303 |
+ */ |
2304 |
+-const struct samsung_pin_ctrl exynos4210_pin_ctrl[] __initconst = { |
2305 |
++static const struct samsung_pin_ctrl exynos4210_pin_ctrl[] __initconst = { |
2306 |
+ { |
2307 |
+ /* pin-controller instance 0 data */ |
2308 |
+ .pin_banks = exynos4210_pin_banks0, |
2309 |
+@@ -334,6 +344,11 @@ const struct samsung_pin_ctrl exynos4210_pin_ctrl[] __initconst = { |
2310 |
+ }, |
2311 |
+ }; |
2312 |
+ |
2313 |
++const struct samsung_pinctrl_of_match_data exynos4210_of_data __initconst = { |
2314 |
++ .ctrl = exynos4210_pin_ctrl, |
2315 |
++ .num_ctrl = ARRAY_SIZE(exynos4210_pin_ctrl), |
2316 |
++}; |
2317 |
++ |
2318 |
+ /* pin banks of exynos4x12 pin-controller 0 */ |
2319 |
+ static const struct samsung_pin_bank_data exynos4x12_pin_banks0[] __initconst = { |
2320 |
+ EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00), |
2321 |
+@@ -396,7 +411,7 @@ static const struct samsung_pin_bank_data exynos4x12_pin_banks3[] __initconst = |
2322 |
+ * Samsung pinctrl driver data for Exynos4x12 SoC. Exynos4x12 SoC includes |
2323 |
+ * four gpio/pin-mux/pinconfig controllers. |
2324 |
+ */ |
2325 |
+-const struct samsung_pin_ctrl exynos4x12_pin_ctrl[] __initconst = { |
2326 |
++static const struct samsung_pin_ctrl exynos4x12_pin_ctrl[] __initconst = { |
2327 |
+ { |
2328 |
+ /* pin-controller instance 0 data */ |
2329 |
+ .pin_banks = exynos4x12_pin_banks0, |
2330 |
+@@ -432,6 +447,11 @@ const struct samsung_pin_ctrl exynos4x12_pin_ctrl[] __initconst = { |
2331 |
+ }, |
2332 |
+ }; |
2333 |
+ |
2334 |
++const struct samsung_pinctrl_of_match_data exynos4x12_of_data __initconst = { |
2335 |
++ .ctrl = exynos4x12_pin_ctrl, |
2336 |
++ .num_ctrl = ARRAY_SIZE(exynos4x12_pin_ctrl), |
2337 |
++}; |
2338 |
++ |
2339 |
+ /* pin banks of exynos5250 pin-controller 0 */ |
2340 |
+ static const struct samsung_pin_bank_data exynos5250_pin_banks0[] __initconst = { |
2341 |
+ EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00), |
2342 |
+@@ -492,7 +512,7 @@ static const struct samsung_pin_bank_data exynos5250_pin_banks3[] __initconst = |
2343 |
+ * Samsung pinctrl driver data for Exynos5250 SoC. Exynos5250 SoC includes |
2344 |
+ * four gpio/pin-mux/pinconfig controllers. |
2345 |
+ */ |
2346 |
+-const struct samsung_pin_ctrl exynos5250_pin_ctrl[] __initconst = { |
2347 |
++static const struct samsung_pin_ctrl exynos5250_pin_ctrl[] __initconst = { |
2348 |
+ { |
2349 |
+ /* pin-controller instance 0 data */ |
2350 |
+ .pin_banks = exynos5250_pin_banks0, |
2351 |
+@@ -528,6 +548,11 @@ const struct samsung_pin_ctrl exynos5250_pin_ctrl[] __initconst = { |
2352 |
+ }, |
2353 |
+ }; |
2354 |
+ |
2355 |
++const struct samsung_pinctrl_of_match_data exynos5250_of_data __initconst = { |
2356 |
++ .ctrl = exynos5250_pin_ctrl, |
2357 |
++ .num_ctrl = ARRAY_SIZE(exynos5250_pin_ctrl), |
2358 |
++}; |
2359 |
++ |
2360 |
+ /* pin banks of exynos5260 pin-controller 0 */ |
2361 |
+ static const struct samsung_pin_bank_data exynos5260_pin_banks0[] __initconst = { |
2362 |
+ EXYNOS_PIN_BANK_EINTG(4, 0x000, "gpa0", 0x00), |
2363 |
+@@ -572,7 +597,7 @@ static const struct samsung_pin_bank_data exynos5260_pin_banks2[] __initconst = |
2364 |
+ * Samsung pinctrl driver data for Exynos5260 SoC. Exynos5260 SoC includes |
2365 |
+ * three gpio/pin-mux/pinconfig controllers. |
2366 |
+ */ |
2367 |
+-const struct samsung_pin_ctrl exynos5260_pin_ctrl[] __initconst = { |
2368 |
++static const struct samsung_pin_ctrl exynos5260_pin_ctrl[] __initconst = { |
2369 |
+ { |
2370 |
+ /* pin-controller instance 0 data */ |
2371 |
+ .pin_banks = exynos5260_pin_banks0, |
2372 |
+@@ -592,6 +617,11 @@ const struct samsung_pin_ctrl exynos5260_pin_ctrl[] __initconst = { |
2373 |
+ }, |
2374 |
+ }; |
2375 |
+ |
2376 |
++const struct samsung_pinctrl_of_match_data exynos5260_of_data __initconst = { |
2377 |
++ .ctrl = exynos5260_pin_ctrl, |
2378 |
++ .num_ctrl = ARRAY_SIZE(exynos5260_pin_ctrl), |
2379 |
++}; |
2380 |
++ |
2381 |
+ /* pin banks of exynos5410 pin-controller 0 */ |
2382 |
+ static const struct samsung_pin_bank_data exynos5410_pin_banks0[] __initconst = { |
2383 |
+ EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00), |
2384 |
+@@ -662,7 +692,7 @@ static const struct samsung_pin_bank_data exynos5410_pin_banks3[] __initconst = |
2385 |
+ * Samsung pinctrl driver data for Exynos5410 SoC. Exynos5410 SoC includes |
2386 |
+ * four gpio/pin-mux/pinconfig controllers. |
2387 |
+ */ |
2388 |
+-const struct samsung_pin_ctrl exynos5410_pin_ctrl[] __initconst = { |
2389 |
++static const struct samsung_pin_ctrl exynos5410_pin_ctrl[] __initconst = { |
2390 |
+ { |
2391 |
+ /* pin-controller instance 0 data */ |
2392 |
+ .pin_banks = exynos5410_pin_banks0, |
2393 |
+@@ -695,6 +725,11 @@ const struct samsung_pin_ctrl exynos5410_pin_ctrl[] __initconst = { |
2394 |
+ }, |
2395 |
+ }; |
2396 |
+ |
2397 |
++const struct samsung_pinctrl_of_match_data exynos5410_of_data __initconst = { |
2398 |
++ .ctrl = exynos5410_pin_ctrl, |
2399 |
++ .num_ctrl = ARRAY_SIZE(exynos5410_pin_ctrl), |
2400 |
++}; |
2401 |
++ |
2402 |
+ /* pin banks of exynos5420 pin-controller 0 */ |
2403 |
+ static const struct samsung_pin_bank_data exynos5420_pin_banks0[] __initconst = { |
2404 |
+ EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpy7", 0x00), |
2405 |
+@@ -779,7 +814,7 @@ static const struct samsung_retention_data exynos5420_retention_data __initconst |
2406 |
+ * Samsung pinctrl driver data for Exynos5420 SoC. Exynos5420 SoC includes |
2407 |
+ * four gpio/pin-mux/pinconfig controllers. |
2408 |
+ */ |
2409 |
+-const struct samsung_pin_ctrl exynos5420_pin_ctrl[] __initconst = { |
2410 |
++static const struct samsung_pin_ctrl exynos5420_pin_ctrl[] __initconst = { |
2411 |
+ { |
2412 |
+ /* pin-controller instance 0 data */ |
2413 |
+ .pin_banks = exynos5420_pin_banks0, |
2414 |
+@@ -813,3 +848,8 @@ const struct samsung_pin_ctrl exynos5420_pin_ctrl[] __initconst = { |
2415 |
+ .retention_data = &exynos4_audio_retention_data, |
2416 |
+ }, |
2417 |
+ }; |
2418 |
++ |
2419 |
++const struct samsung_pinctrl_of_match_data exynos5420_of_data __initconst = { |
2420 |
++ .ctrl = exynos5420_pin_ctrl, |
2421 |
++ .num_ctrl = ARRAY_SIZE(exynos5420_pin_ctrl), |
2422 |
++}; |
2423 |
+diff --git a/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c b/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c |
2424 |
+index 08e9fdb58fd2..0ab88fc268ea 100644 |
2425 |
+--- a/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c |
2426 |
++++ b/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c |
2427 |
+@@ -180,7 +180,7 @@ static const struct samsung_retention_data exynos5433_fsys_retention_data __init |
2428 |
+ * Samsung pinctrl driver data for Exynos5433 SoC. Exynos5433 SoC includes |
2429 |
+ * ten gpio/pin-mux/pinconfig controllers. |
2430 |
+ */ |
2431 |
+-const struct samsung_pin_ctrl exynos5433_pin_ctrl[] __initconst = { |
2432 |
++static const struct samsung_pin_ctrl exynos5433_pin_ctrl[] __initconst = { |
2433 |
+ { |
2434 |
+ /* pin-controller instance 0 data */ |
2435 |
+ .pin_banks = exynos5433_pin_banks0, |
2436 |
+@@ -265,6 +265,11 @@ const struct samsung_pin_ctrl exynos5433_pin_ctrl[] __initconst = { |
2437 |
+ }, |
2438 |
+ }; |
2439 |
+ |
2440 |
++const struct samsung_pinctrl_of_match_data exynos5433_of_data __initconst = { |
2441 |
++ .ctrl = exynos5433_pin_ctrl, |
2442 |
++ .num_ctrl = ARRAY_SIZE(exynos5433_pin_ctrl), |
2443 |
++}; |
2444 |
++ |
2445 |
+ /* pin banks of exynos7 pin-controller - ALIVE */ |
2446 |
+ static const struct samsung_pin_bank_data exynos7_pin_banks0[] __initconst = { |
2447 |
+ EXYNOS_PIN_BANK_EINTW(8, 0x000, "gpa0", 0x00), |
2448 |
+@@ -344,7 +349,7 @@ static const struct samsung_pin_bank_data exynos7_pin_banks9[] __initconst = { |
2449 |
+ EXYNOS_PIN_BANK_EINTG(4, 0x020, "gpz1", 0x04), |
2450 |
+ }; |
2451 |
+ |
2452 |
+-const struct samsung_pin_ctrl exynos7_pin_ctrl[] __initconst = { |
2453 |
++static const struct samsung_pin_ctrl exynos7_pin_ctrl[] __initconst = { |
2454 |
+ { |
2455 |
+ /* pin-controller instance 0 Alive data */ |
2456 |
+ .pin_banks = exynos7_pin_banks0, |
2457 |
+@@ -397,3 +402,8 @@ const struct samsung_pin_ctrl exynos7_pin_ctrl[] __initconst = { |
2458 |
+ .eint_gpio_init = exynos_eint_gpio_init, |
2459 |
+ }, |
2460 |
+ }; |
2461 |
++ |
2462 |
++const struct samsung_pinctrl_of_match_data exynos7_of_data __initconst = { |
2463 |
++ .ctrl = exynos7_pin_ctrl, |
2464 |
++ .num_ctrl = ARRAY_SIZE(exynos7_pin_ctrl), |
2465 |
++}; |
2466 |
+diff --git a/drivers/pinctrl/samsung/pinctrl-s3c24xx.c b/drivers/pinctrl/samsung/pinctrl-s3c24xx.c |
2467 |
+index edf27264b603..67da1cf18b68 100644 |
2468 |
+--- a/drivers/pinctrl/samsung/pinctrl-s3c24xx.c |
2469 |
++++ b/drivers/pinctrl/samsung/pinctrl-s3c24xx.c |
2470 |
+@@ -570,7 +570,7 @@ static const struct samsung_pin_bank_data s3c2412_pin_banks[] __initconst = { |
2471 |
+ PIN_BANK_2BIT(13, 0x080, "gpj"), |
2472 |
+ }; |
2473 |
+ |
2474 |
+-const struct samsung_pin_ctrl s3c2412_pin_ctrl[] __initconst = { |
2475 |
++static const struct samsung_pin_ctrl s3c2412_pin_ctrl[] __initconst = { |
2476 |
+ { |
2477 |
+ .pin_banks = s3c2412_pin_banks, |
2478 |
+ .nr_banks = ARRAY_SIZE(s3c2412_pin_banks), |
2479 |
+@@ -578,6 +578,11 @@ const struct samsung_pin_ctrl s3c2412_pin_ctrl[] __initconst = { |
2480 |
+ }, |
2481 |
+ }; |
2482 |
+ |
2483 |
++const struct samsung_pinctrl_of_match_data s3c2412_of_data __initconst = { |
2484 |
++ .ctrl = s3c2412_pin_ctrl, |
2485 |
++ .num_ctrl = ARRAY_SIZE(s3c2412_pin_ctrl), |
2486 |
++}; |
2487 |
++ |
2488 |
+ static const struct samsung_pin_bank_data s3c2416_pin_banks[] __initconst = { |
2489 |
+ PIN_BANK_A(27, 0x000, "gpa"), |
2490 |
+ PIN_BANK_2BIT(11, 0x010, "gpb"), |
2491 |
+@@ -592,7 +597,7 @@ static const struct samsung_pin_bank_data s3c2416_pin_banks[] __initconst = { |
2492 |
+ PIN_BANK_2BIT(2, 0x100, "gpm"), |
2493 |
+ }; |
2494 |
+ |
2495 |
+-const struct samsung_pin_ctrl s3c2416_pin_ctrl[] __initconst = { |
2496 |
++static const struct samsung_pin_ctrl s3c2416_pin_ctrl[] __initconst = { |
2497 |
+ { |
2498 |
+ .pin_banks = s3c2416_pin_banks, |
2499 |
+ .nr_banks = ARRAY_SIZE(s3c2416_pin_banks), |
2500 |
+@@ -600,6 +605,11 @@ const struct samsung_pin_ctrl s3c2416_pin_ctrl[] __initconst = { |
2501 |
+ }, |
2502 |
+ }; |
2503 |
+ |
2504 |
++const struct samsung_pinctrl_of_match_data s3c2416_of_data __initconst = { |
2505 |
++ .ctrl = s3c2416_pin_ctrl, |
2506 |
++ .num_ctrl = ARRAY_SIZE(s3c2416_pin_ctrl), |
2507 |
++}; |
2508 |
++ |
2509 |
+ static const struct samsung_pin_bank_data s3c2440_pin_banks[] __initconst = { |
2510 |
+ PIN_BANK_A(25, 0x000, "gpa"), |
2511 |
+ PIN_BANK_2BIT(11, 0x010, "gpb"), |
2512 |
+@@ -612,7 +622,7 @@ static const struct samsung_pin_bank_data s3c2440_pin_banks[] __initconst = { |
2513 |
+ PIN_BANK_2BIT(13, 0x0d0, "gpj"), |
2514 |
+ }; |
2515 |
+ |
2516 |
+-const struct samsung_pin_ctrl s3c2440_pin_ctrl[] __initconst = { |
2517 |
++static const struct samsung_pin_ctrl s3c2440_pin_ctrl[] __initconst = { |
2518 |
+ { |
2519 |
+ .pin_banks = s3c2440_pin_banks, |
2520 |
+ .nr_banks = ARRAY_SIZE(s3c2440_pin_banks), |
2521 |
+@@ -620,6 +630,11 @@ const struct samsung_pin_ctrl s3c2440_pin_ctrl[] __initconst = { |
2522 |
+ }, |
2523 |
+ }; |
2524 |
+ |
2525 |
++const struct samsung_pinctrl_of_match_data s3c2440_of_data __initconst = { |
2526 |
++ .ctrl = s3c2440_pin_ctrl, |
2527 |
++ .num_ctrl = ARRAY_SIZE(s3c2440_pin_ctrl), |
2528 |
++}; |
2529 |
++ |
2530 |
+ static const struct samsung_pin_bank_data s3c2450_pin_banks[] __initconst = { |
2531 |
+ PIN_BANK_A(28, 0x000, "gpa"), |
2532 |
+ PIN_BANK_2BIT(11, 0x010, "gpb"), |
2533 |
+@@ -635,10 +650,15 @@ static const struct samsung_pin_bank_data s3c2450_pin_banks[] __initconst = { |
2534 |
+ PIN_BANK_2BIT(2, 0x100, "gpm"), |
2535 |
+ }; |
2536 |
+ |
2537 |
+-const struct samsung_pin_ctrl s3c2450_pin_ctrl[] __initconst = { |
2538 |
++static const struct samsung_pin_ctrl s3c2450_pin_ctrl[] __initconst = { |
2539 |
+ { |
2540 |
+ .pin_banks = s3c2450_pin_banks, |
2541 |
+ .nr_banks = ARRAY_SIZE(s3c2450_pin_banks), |
2542 |
+ .eint_wkup_init = s3c24xx_eint_init, |
2543 |
+ }, |
2544 |
+ }; |
2545 |
++ |
2546 |
++const struct samsung_pinctrl_of_match_data s3c2450_of_data __initconst = { |
2547 |
++ .ctrl = s3c2450_pin_ctrl, |
2548 |
++ .num_ctrl = ARRAY_SIZE(s3c2450_pin_ctrl), |
2549 |
++}; |
2550 |
+diff --git a/drivers/pinctrl/samsung/pinctrl-s3c64xx.c b/drivers/pinctrl/samsung/pinctrl-s3c64xx.c |
2551 |
+index e63663b32907..0bdc1e683181 100644 |
2552 |
+--- a/drivers/pinctrl/samsung/pinctrl-s3c64xx.c |
2553 |
++++ b/drivers/pinctrl/samsung/pinctrl-s3c64xx.c |
2554 |
+@@ -794,7 +794,7 @@ static const struct samsung_pin_bank_data s3c64xx_pin_banks0[] __initconst = { |
2555 |
+ * Samsung pinctrl driver data for S3C64xx SoC. S3C64xx SoC includes |
2556 |
+ * one gpio/pin-mux/pinconfig controller. |
2557 |
+ */ |
2558 |
+-const struct samsung_pin_ctrl s3c64xx_pin_ctrl[] __initconst = { |
2559 |
++static const struct samsung_pin_ctrl s3c64xx_pin_ctrl[] __initconst = { |
2560 |
+ { |
2561 |
+ /* pin-controller instance 1 data */ |
2562 |
+ .pin_banks = s3c64xx_pin_banks0, |
2563 |
+@@ -803,3 +803,8 @@ const struct samsung_pin_ctrl s3c64xx_pin_ctrl[] __initconst = { |
2564 |
+ .eint_wkup_init = s3c64xx_eint_eint0_init, |
2565 |
+ }, |
2566 |
+ }; |
2567 |
++ |
2568 |
++const struct samsung_pinctrl_of_match_data s3c64xx_of_data __initconst = { |
2569 |
++ .ctrl = s3c64xx_pin_ctrl, |
2570 |
++ .num_ctrl = ARRAY_SIZE(s3c64xx_pin_ctrl), |
2571 |
++}; |
2572 |
+diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c |
2573 |
+index e04f7fe0a65d..26e8fab736f1 100644 |
2574 |
+--- a/drivers/pinctrl/samsung/pinctrl-samsung.c |
2575 |
++++ b/drivers/pinctrl/samsung/pinctrl-samsung.c |
2576 |
+@@ -947,12 +947,33 @@ static int samsung_gpiolib_register(struct platform_device *pdev, |
2577 |
+ return 0; |
2578 |
+ } |
2579 |
+ |
2580 |
++static const struct samsung_pin_ctrl * |
2581 |
++samsung_pinctrl_get_soc_data_for_of_alias(struct platform_device *pdev) |
2582 |
++{ |
2583 |
++ struct device_node *node = pdev->dev.of_node; |
2584 |
++ const struct samsung_pinctrl_of_match_data *of_data; |
2585 |
++ int id; |
2586 |
++ |
2587 |
++ id = of_alias_get_id(node, "pinctrl"); |
2588 |
++ if (id < 0) { |
2589 |
++ dev_err(&pdev->dev, "failed to get alias id\n"); |
2590 |
++ return NULL; |
2591 |
++ } |
2592 |
++ |
2593 |
++ of_data = of_device_get_match_data(&pdev->dev); |
2594 |
++ if (id >= of_data->num_ctrl) { |
2595 |
++ dev_err(&pdev->dev, "invalid alias id %d\n", id); |
2596 |
++ return NULL; |
2597 |
++ } |
2598 |
++ |
2599 |
++ return &(of_data->ctrl[id]); |
2600 |
++} |
2601 |
++ |
2602 |
+ /* retrieve the soc specific data */ |
2603 |
+ static const struct samsung_pin_ctrl * |
2604 |
+ samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d, |
2605 |
+ struct platform_device *pdev) |
2606 |
+ { |
2607 |
+- int id; |
2608 |
+ struct device_node *node = pdev->dev.of_node; |
2609 |
+ struct device_node *np; |
2610 |
+ const struct samsung_pin_bank_data *bdata; |
2611 |
+@@ -962,13 +983,9 @@ samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d, |
2612 |
+ void __iomem *virt_base[SAMSUNG_PINCTRL_NUM_RESOURCES]; |
2613 |
+ unsigned int i; |
2614 |
+ |
2615 |
+- id = of_alias_get_id(node, "pinctrl"); |
2616 |
+- if (id < 0) { |
2617 |
+- dev_err(&pdev->dev, "failed to get alias id\n"); |
2618 |
++ ctrl = samsung_pinctrl_get_soc_data_for_of_alias(pdev); |
2619 |
++ if (!ctrl) |
2620 |
+ return ERR_PTR(-ENOENT); |
2621 |
+- } |
2622 |
+- ctrl = of_device_get_match_data(&pdev->dev); |
2623 |
+- ctrl += id; |
2624 |
+ |
2625 |
+ d->suspend = ctrl->suspend; |
2626 |
+ d->resume = ctrl->resume; |
2627 |
+@@ -1193,41 +1210,41 @@ static int __maybe_unused samsung_pinctrl_resume(struct device *dev) |
2628 |
+ static const struct of_device_id samsung_pinctrl_dt_match[] = { |
2629 |
+ #ifdef CONFIG_PINCTRL_EXYNOS_ARM |
2630 |
+ { .compatible = "samsung,exynos3250-pinctrl", |
2631 |
+- .data = exynos3250_pin_ctrl }, |
2632 |
++ .data = &exynos3250_of_data }, |
2633 |
+ { .compatible = "samsung,exynos4210-pinctrl", |
2634 |
+- .data = exynos4210_pin_ctrl }, |
2635 |
++ .data = &exynos4210_of_data }, |
2636 |
+ { .compatible = "samsung,exynos4x12-pinctrl", |
2637 |
+- .data = exynos4x12_pin_ctrl }, |
2638 |
++ .data = &exynos4x12_of_data }, |
2639 |
+ { .compatible = "samsung,exynos5250-pinctrl", |
2640 |
+- .data = exynos5250_pin_ctrl }, |
2641 |
++ .data = &exynos5250_of_data }, |
2642 |
+ { .compatible = "samsung,exynos5260-pinctrl", |
2643 |
+- .data = exynos5260_pin_ctrl }, |
2644 |
++ .data = &exynos5260_of_data }, |
2645 |
+ { .compatible = "samsung,exynos5410-pinctrl", |
2646 |
+- .data = exynos5410_pin_ctrl }, |
2647 |
++ .data = &exynos5410_of_data }, |
2648 |
+ { .compatible = "samsung,exynos5420-pinctrl", |
2649 |
+- .data = exynos5420_pin_ctrl }, |
2650 |
++ .data = &exynos5420_of_data }, |
2651 |
+ { .compatible = "samsung,s5pv210-pinctrl", |
2652 |
+- .data = s5pv210_pin_ctrl }, |
2653 |
++ .data = &s5pv210_of_data }, |
2654 |
+ #endif |
2655 |
+ #ifdef CONFIG_PINCTRL_EXYNOS_ARM64 |
2656 |
+ { .compatible = "samsung,exynos5433-pinctrl", |
2657 |
+- .data = exynos5433_pin_ctrl }, |
2658 |
++ .data = &exynos5433_of_data }, |
2659 |
+ { .compatible = "samsung,exynos7-pinctrl", |
2660 |
+- .data = exynos7_pin_ctrl }, |
2661 |
++ .data = &exynos7_of_data }, |
2662 |
+ #endif |
2663 |
+ #ifdef CONFIG_PINCTRL_S3C64XX |
2664 |
+ { .compatible = "samsung,s3c64xx-pinctrl", |
2665 |
+- .data = s3c64xx_pin_ctrl }, |
2666 |
++ .data = &s3c64xx_of_data }, |
2667 |
+ #endif |
2668 |
+ #ifdef CONFIG_PINCTRL_S3C24XX |
2669 |
+ { .compatible = "samsung,s3c2412-pinctrl", |
2670 |
+- .data = s3c2412_pin_ctrl }, |
2671 |
++ .data = &s3c2412_of_data }, |
2672 |
+ { .compatible = "samsung,s3c2416-pinctrl", |
2673 |
+- .data = s3c2416_pin_ctrl }, |
2674 |
++ .data = &s3c2416_of_data }, |
2675 |
+ { .compatible = "samsung,s3c2440-pinctrl", |
2676 |
+- .data = s3c2440_pin_ctrl }, |
2677 |
++ .data = &s3c2440_of_data }, |
2678 |
+ { .compatible = "samsung,s3c2450-pinctrl", |
2679 |
+- .data = s3c2450_pin_ctrl }, |
2680 |
++ .data = &s3c2450_of_data }, |
2681 |
+ #endif |
2682 |
+ {}, |
2683 |
+ }; |
2684 |
+diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.h b/drivers/pinctrl/samsung/pinctrl-samsung.h |
2685 |
+index 9af07af6cad6..ae932e0c05f2 100644 |
2686 |
+--- a/drivers/pinctrl/samsung/pinctrl-samsung.h |
2687 |
++++ b/drivers/pinctrl/samsung/pinctrl-samsung.h |
2688 |
+@@ -285,6 +285,16 @@ struct samsung_pinctrl_drv_data { |
2689 |
+ void (*resume)(struct samsung_pinctrl_drv_data *); |
2690 |
+ }; |
2691 |
+ |
2692 |
++/** |
2693 |
++ * struct samsung_pinctrl_of_match_data: OF match device specific configuration data. |
2694 |
++ * @ctrl: array of pin controller data. |
2695 |
++ * @num_ctrl: size of array @ctrl. |
2696 |
++ */ |
2697 |
++struct samsung_pinctrl_of_match_data { |
2698 |
++ const struct samsung_pin_ctrl *ctrl; |
2699 |
++ unsigned int num_ctrl; |
2700 |
++}; |
2701 |
++ |
2702 |
+ /** |
2703 |
+ * struct samsung_pin_group: represent group of pins of a pinmux function. |
2704 |
+ * @name: name of the pin group, used to lookup the group. |
2705 |
+@@ -313,20 +323,20 @@ struct samsung_pmx_func { |
2706 |
+ }; |
2707 |
+ |
2708 |
+ /* list of all exported SoC specific data */ |
2709 |
+-extern const struct samsung_pin_ctrl exynos3250_pin_ctrl[]; |
2710 |
+-extern const struct samsung_pin_ctrl exynos4210_pin_ctrl[]; |
2711 |
+-extern const struct samsung_pin_ctrl exynos4x12_pin_ctrl[]; |
2712 |
+-extern const struct samsung_pin_ctrl exynos5250_pin_ctrl[]; |
2713 |
+-extern const struct samsung_pin_ctrl exynos5260_pin_ctrl[]; |
2714 |
+-extern const struct samsung_pin_ctrl exynos5410_pin_ctrl[]; |
2715 |
+-extern const struct samsung_pin_ctrl exynos5420_pin_ctrl[]; |
2716 |
+-extern const struct samsung_pin_ctrl exynos5433_pin_ctrl[]; |
2717 |
+-extern const struct samsung_pin_ctrl exynos7_pin_ctrl[]; |
2718 |
+-extern const struct samsung_pin_ctrl s3c64xx_pin_ctrl[]; |
2719 |
+-extern const struct samsung_pin_ctrl s3c2412_pin_ctrl[]; |
2720 |
+-extern const struct samsung_pin_ctrl s3c2416_pin_ctrl[]; |
2721 |
+-extern const struct samsung_pin_ctrl s3c2440_pin_ctrl[]; |
2722 |
+-extern const struct samsung_pin_ctrl s3c2450_pin_ctrl[]; |
2723 |
+-extern const struct samsung_pin_ctrl s5pv210_pin_ctrl[]; |
2724 |
++extern const struct samsung_pinctrl_of_match_data exynos3250_of_data; |
2725 |
++extern const struct samsung_pinctrl_of_match_data exynos4210_of_data; |
2726 |
++extern const struct samsung_pinctrl_of_match_data exynos4x12_of_data; |
2727 |
++extern const struct samsung_pinctrl_of_match_data exynos5250_of_data; |
2728 |
++extern const struct samsung_pinctrl_of_match_data exynos5260_of_data; |
2729 |
++extern const struct samsung_pinctrl_of_match_data exynos5410_of_data; |
2730 |
++extern const struct samsung_pinctrl_of_match_data exynos5420_of_data; |
2731 |
++extern const struct samsung_pinctrl_of_match_data exynos5433_of_data; |
2732 |
++extern const struct samsung_pinctrl_of_match_data exynos7_of_data; |
2733 |
++extern const struct samsung_pinctrl_of_match_data s3c64xx_of_data; |
2734 |
++extern const struct samsung_pinctrl_of_match_data s3c2412_of_data; |
2735 |
++extern const struct samsung_pinctrl_of_match_data s3c2416_of_data; |
2736 |
++extern const struct samsung_pinctrl_of_match_data s3c2440_of_data; |
2737 |
++extern const struct samsung_pinctrl_of_match_data s3c2450_of_data; |
2738 |
++extern const struct samsung_pinctrl_of_match_data s5pv210_of_data; |
2739 |
+ |
2740 |
+ #endif /* __PINCTRL_SAMSUNG_H */ |
2741 |
+diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c |
2742 |
+index 86196ffd2faf..fa3e4b7e0c9f 100644 |
2743 |
+--- a/drivers/staging/android/ion/ion_cma_heap.c |
2744 |
++++ b/drivers/staging/android/ion/ion_cma_heap.c |
2745 |
+@@ -21,6 +21,7 @@ |
2746 |
+ #include <linux/err.h> |
2747 |
+ #include <linux/cma.h> |
2748 |
+ #include <linux/scatterlist.h> |
2749 |
++#include <linux/highmem.h> |
2750 |
+ |
2751 |
+ #include "ion.h" |
2752 |
+ |
2753 |
+@@ -51,6 +52,22 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer, |
2754 |
+ if (!pages) |
2755 |
+ return -ENOMEM; |
2756 |
+ |
2757 |
++ if (PageHighMem(pages)) { |
2758 |
++ unsigned long nr_clear_pages = nr_pages; |
2759 |
++ struct page *page = pages; |
2760 |
++ |
2761 |
++ while (nr_clear_pages > 0) { |
2762 |
++ void *vaddr = kmap_atomic(page); |
2763 |
++ |
2764 |
++ memset(vaddr, 0, PAGE_SIZE); |
2765 |
++ kunmap_atomic(vaddr); |
2766 |
++ page++; |
2767 |
++ nr_clear_pages--; |
2768 |
++ } |
2769 |
++ } else { |
2770 |
++ memset(page_address(pages), 0, size); |
2771 |
++ } |
2772 |
++ |
2773 |
+ table = kmalloc(sizeof(*table), GFP_KERNEL); |
2774 |
+ if (!table) |
2775 |
+ goto err; |
2776 |
+diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c |
2777 |
+index cd7a5391a574..0a3f832095ea 100644 |
2778 |
+--- a/drivers/staging/lustre/lustre/ptlrpc/sec.c |
2779 |
++++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c |
2780 |
+@@ -847,7 +847,7 @@ void sptlrpc_request_out_callback(struct ptlrpc_request *req) |
2781 |
+ if (req->rq_pool || !req->rq_reqbuf) |
2782 |
+ return; |
2783 |
+ |
2784 |
+- kfree(req->rq_reqbuf); |
2785 |
++ kvfree(req->rq_reqbuf); |
2786 |
+ req->rq_reqbuf = NULL; |
2787 |
+ req->rq_reqbuf_len = 0; |
2788 |
+ } |
2789 |
+diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c |
2790 |
+index 2ebaba16f785..5a5813d01cf8 100644 |
2791 |
+--- a/drivers/tty/vt/vt.c |
2792 |
++++ b/drivers/tty/vt/vt.c |
2793 |
+@@ -1725,7 +1725,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear) |
2794 |
+ default_attr(vc); |
2795 |
+ update_attr(vc); |
2796 |
+ |
2797 |
+- vc->vc_tab_stop[0] = 0x01010100; |
2798 |
++ vc->vc_tab_stop[0] = |
2799 |
+ vc->vc_tab_stop[1] = |
2800 |
+ vc->vc_tab_stop[2] = |
2801 |
+ vc->vc_tab_stop[3] = |
2802 |
+@@ -1769,7 +1769,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) |
2803 |
+ vc->vc_pos -= (vc->vc_x << 1); |
2804 |
+ while (vc->vc_x < vc->vc_cols - 1) { |
2805 |
+ vc->vc_x++; |
2806 |
+- if (vc->vc_tab_stop[vc->vc_x >> 5] & (1 << (vc->vc_x & 31))) |
2807 |
++ if (vc->vc_tab_stop[7 & (vc->vc_x >> 5)] & (1 << (vc->vc_x & 31))) |
2808 |
+ break; |
2809 |
+ } |
2810 |
+ vc->vc_pos += (vc->vc_x << 1); |
2811 |
+@@ -1829,7 +1829,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) |
2812 |
+ lf(vc); |
2813 |
+ return; |
2814 |
+ case 'H': |
2815 |
+- vc->vc_tab_stop[vc->vc_x >> 5] |= (1 << (vc->vc_x & 31)); |
2816 |
++ vc->vc_tab_stop[7 & (vc->vc_x >> 5)] |= (1 << (vc->vc_x & 31)); |
2817 |
+ return; |
2818 |
+ case 'Z': |
2819 |
+ respond_ID(tty); |
2820 |
+@@ -2022,7 +2022,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) |
2821 |
+ return; |
2822 |
+ case 'g': |
2823 |
+ if (!vc->vc_par[0]) |
2824 |
+- vc->vc_tab_stop[vc->vc_x >> 5] &= ~(1 << (vc->vc_x & 31)); |
2825 |
++ vc->vc_tab_stop[7 & (vc->vc_x >> 5)] &= ~(1 << (vc->vc_x & 31)); |
2826 |
+ else if (vc->vc_par[0] == 3) { |
2827 |
+ vc->vc_tab_stop[0] = |
2828 |
+ vc->vc_tab_stop[1] = |
2829 |
+diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
2830 |
+index a2336deb5e36..9762333d8d7f 100644 |
2831 |
+--- a/drivers/usb/host/xhci-hub.c |
2832 |
++++ b/drivers/usb/host/xhci-hub.c |
2833 |
+@@ -634,7 +634,10 @@ static int xhci_enter_test_mode(struct xhci_hcd *xhci, |
2834 |
+ xhci_dbg(xhci, "Disable all slots\n"); |
2835 |
+ spin_unlock_irqrestore(&xhci->lock, *flags); |
2836 |
+ for (i = 1; i <= HCS_MAX_SLOTS(xhci->hcs_params1); i++) { |
2837 |
+- retval = xhci_disable_slot(xhci, NULL, i); |
2838 |
++ if (!xhci->devs[i]) |
2839 |
++ continue; |
2840 |
++ |
2841 |
++ retval = xhci_disable_slot(xhci, i); |
2842 |
+ if (retval) |
2843 |
+ xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n", |
2844 |
+ i, retval); |
2845 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
2846 |
+index bad76a7c7f2f..bcf315b32bff 100644 |
2847 |
+--- a/drivers/usb/host/xhci.c |
2848 |
++++ b/drivers/usb/host/xhci.c |
2849 |
+@@ -3523,11 +3523,6 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) |
2850 |
+ struct xhci_virt_device *virt_dev; |
2851 |
+ struct xhci_slot_ctx *slot_ctx; |
2852 |
+ int i, ret; |
2853 |
+- struct xhci_command *command; |
2854 |
+- |
2855 |
+- command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); |
2856 |
+- if (!command) |
2857 |
+- return; |
2858 |
+ |
2859 |
+ #ifndef CONFIG_USB_DEFAULT_PERSIST |
2860 |
+ /* |
2861 |
+@@ -3543,10 +3538,8 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) |
2862 |
+ /* If the host is halted due to driver unload, we still need to free the |
2863 |
+ * device. |
2864 |
+ */ |
2865 |
+- if (ret <= 0 && ret != -ENODEV) { |
2866 |
+- kfree(command); |
2867 |
++ if (ret <= 0 && ret != -ENODEV) |
2868 |
+ return; |
2869 |
+- } |
2870 |
+ |
2871 |
+ virt_dev = xhci->devs[udev->slot_id]; |
2872 |
+ slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->out_ctx); |
2873 |
+@@ -3558,26 +3551,21 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) |
2874 |
+ del_timer_sync(&virt_dev->eps[i].stop_cmd_timer); |
2875 |
+ } |
2876 |
+ |
2877 |
+- xhci_disable_slot(xhci, command, udev->slot_id); |
2878 |
++ xhci_disable_slot(xhci, udev->slot_id); |
2879 |
+ /* |
2880 |
+ * Event command completion handler will free any data structures |
2881 |
+ * associated with the slot. XXX Can free sleep? |
2882 |
+ */ |
2883 |
+ } |
2884 |
+ |
2885 |
+-int xhci_disable_slot(struct xhci_hcd *xhci, struct xhci_command *command, |
2886 |
+- u32 slot_id) |
2887 |
++int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id) |
2888 |
+ { |
2889 |
++ struct xhci_command *command; |
2890 |
+ unsigned long flags; |
2891 |
+ u32 state; |
2892 |
+ int ret = 0; |
2893 |
+- struct xhci_virt_device *virt_dev; |
2894 |
+ |
2895 |
+- virt_dev = xhci->devs[slot_id]; |
2896 |
+- if (!virt_dev) |
2897 |
+- return -EINVAL; |
2898 |
+- if (!command) |
2899 |
+- command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); |
2900 |
++ command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); |
2901 |
+ if (!command) |
2902 |
+ return -ENOMEM; |
2903 |
+ |
2904 |
+@@ -3595,7 +3583,7 @@ int xhci_disable_slot(struct xhci_hcd *xhci, struct xhci_command *command, |
2905 |
+ slot_id); |
2906 |
+ if (ret) { |
2907 |
+ spin_unlock_irqrestore(&xhci->lock, flags); |
2908 |
+- xhci_dbg(xhci, "FIXME: allocate a command ring segment\n"); |
2909 |
++ kfree(command); |
2910 |
+ return ret; |
2911 |
+ } |
2912 |
+ xhci_ring_cmd_db(xhci); |
2913 |
+@@ -3670,6 +3658,8 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) |
2914 |
+ return 0; |
2915 |
+ } |
2916 |
+ |
2917 |
++ xhci_free_command(xhci, command); |
2918 |
++ |
2919 |
+ if ((xhci->quirks & XHCI_EP_LIMIT_QUIRK)) { |
2920 |
+ spin_lock_irqsave(&xhci->lock, flags); |
2921 |
+ ret = xhci_reserve_host_control_ep_resources(xhci); |
2922 |
+@@ -3705,18 +3695,12 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) |
2923 |
+ pm_runtime_get_noresume(hcd->self.controller); |
2924 |
+ #endif |
2925 |
+ |
2926 |
+- |
2927 |
+- xhci_free_command(xhci, command); |
2928 |
+ /* Is this a LS or FS device under a HS hub? */ |
2929 |
+ /* Hub or peripherial? */ |
2930 |
+ return 1; |
2931 |
+ |
2932 |
+ disable_slot: |
2933 |
+- /* Disable slot, if we can do it without mem alloc */ |
2934 |
+- kfree(command->completion); |
2935 |
+- command->completion = NULL; |
2936 |
+- command->status = 0; |
2937 |
+- return xhci_disable_slot(xhci, command, udev->slot_id); |
2938 |
++ return xhci_disable_slot(xhci, udev->slot_id); |
2939 |
+ } |
2940 |
+ |
2941 |
+ /* |
2942 |
+diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
2943 |
+index 2eaf6e1f12ee..f5fb1f4a092c 100644 |
2944 |
+--- a/drivers/usb/host/xhci.h |
2945 |
++++ b/drivers/usb/host/xhci.h |
2946 |
+@@ -2014,8 +2014,7 @@ int xhci_run(struct usb_hcd *hcd); |
2947 |
+ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks); |
2948 |
+ void xhci_init_driver(struct hc_driver *drv, |
2949 |
+ const struct xhci_driver_overrides *over); |
2950 |
+-int xhci_disable_slot(struct xhci_hcd *xhci, |
2951 |
+- struct xhci_command *command, u32 slot_id); |
2952 |
++int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id); |
2953 |
+ |
2954 |
+ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup); |
2955 |
+ int xhci_resume(struct xhci_hcd *xhci, bool hibernated); |
2956 |
+diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c |
2957 |
+index 6d1fbda0f461..0da9943d405f 100644 |
2958 |
+--- a/drivers/watchdog/wdat_wdt.c |
2959 |
++++ b/drivers/watchdog/wdat_wdt.c |
2960 |
+@@ -392,7 +392,7 @@ static int wdat_wdt_probe(struct platform_device *pdev) |
2961 |
+ |
2962 |
+ memset(&r, 0, sizeof(r)); |
2963 |
+ r.start = gas->address; |
2964 |
+- r.end = r.start + gas->access_width; |
2965 |
++ r.end = r.start + gas->access_width - 1; |
2966 |
+ if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { |
2967 |
+ r.flags = IORESOURCE_MEM; |
2968 |
+ } else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { |
2969 |
+diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c |
2970 |
+index ed113ea17aff..3b293d0d1785 100644 |
2971 |
+--- a/fs/hugetlbfs/inode.c |
2972 |
++++ b/fs/hugetlbfs/inode.c |
2973 |
+@@ -118,6 +118,16 @@ static void huge_pagevec_release(struct pagevec *pvec) |
2974 |
+ pagevec_reinit(pvec); |
2975 |
+ } |
2976 |
+ |
2977 |
++/* |
2978 |
++ * Mask used when checking the page offset value passed in via system |
2979 |
++ * calls. This value will be converted to a loff_t which is signed. |
2980 |
++ * Therefore, we want to check the upper PAGE_SHIFT + 1 bits of the |
2981 |
++ * value. The extra bit (- 1 in the shift value) is to take the sign |
2982 |
++ * bit into account. |
2983 |
++ */ |
2984 |
++#define PGOFF_LOFFT_MAX \ |
2985 |
++ (((1UL << (PAGE_SHIFT + 1)) - 1) << (BITS_PER_LONG - (PAGE_SHIFT + 1))) |
2986 |
++ |
2987 |
+ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) |
2988 |
+ { |
2989 |
+ struct inode *inode = file_inode(file); |
2990 |
+@@ -137,12 +147,13 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) |
2991 |
+ vma->vm_ops = &hugetlb_vm_ops; |
2992 |
+ |
2993 |
+ /* |
2994 |
+- * Offset passed to mmap (before page shift) could have been |
2995 |
+- * negative when represented as a (l)off_t. |
2996 |
++ * page based offset in vm_pgoff could be sufficiently large to |
2997 |
++ * overflow a (l)off_t when converted to byte offset. |
2998 |
+ */ |
2999 |
+- if (((loff_t)vma->vm_pgoff << PAGE_SHIFT) < 0) |
3000 |
++ if (vma->vm_pgoff & PGOFF_LOFFT_MAX) |
3001 |
+ return -EINVAL; |
3002 |
+ |
3003 |
++ /* must be huge page aligned */ |
3004 |
+ if (vma->vm_pgoff & (~huge_page_mask(h) >> PAGE_SHIFT)) |
3005 |
+ return -EINVAL; |
3006 |
+ |
3007 |
+diff --git a/fs/ncpfs/ncplib_kernel.c b/fs/ncpfs/ncplib_kernel.c |
3008 |
+index 804adfebba2f..3e047eb4cc7c 100644 |
3009 |
+--- a/fs/ncpfs/ncplib_kernel.c |
3010 |
++++ b/fs/ncpfs/ncplib_kernel.c |
3011 |
+@@ -981,6 +981,10 @@ ncp_read_kernel(struct ncp_server *server, const char *file_id, |
3012 |
+ goto out; |
3013 |
+ } |
3014 |
+ *bytes_read = ncp_reply_be16(server, 0); |
3015 |
++ if (*bytes_read > to_read) { |
3016 |
++ result = -EINVAL; |
3017 |
++ goto out; |
3018 |
++ } |
3019 |
+ source = ncp_reply_data(server, 2 + (offset & 1)); |
3020 |
+ |
3021 |
+ memcpy(target, source, *bytes_read); |
3022 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
3023 |
+index d89e6ccd33ba..3cef6bfa09d4 100644 |
3024 |
+--- a/fs/nfsd/nfs4state.c |
3025 |
++++ b/fs/nfsd/nfs4state.c |
3026 |
+@@ -263,6 +263,35 @@ free_blocked_lock(struct nfsd4_blocked_lock *nbl) |
3027 |
+ kfree(nbl); |
3028 |
+ } |
3029 |
+ |
3030 |
++static void |
3031 |
++remove_blocked_locks(struct nfs4_lockowner *lo) |
3032 |
++{ |
3033 |
++ struct nfs4_client *clp = lo->lo_owner.so_client; |
3034 |
++ struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); |
3035 |
++ struct nfsd4_blocked_lock *nbl; |
3036 |
++ LIST_HEAD(reaplist); |
3037 |
++ |
3038 |
++ /* Dequeue all blocked locks */ |
3039 |
++ spin_lock(&nn->blocked_locks_lock); |
3040 |
++ while (!list_empty(&lo->lo_blocked)) { |
3041 |
++ nbl = list_first_entry(&lo->lo_blocked, |
3042 |
++ struct nfsd4_blocked_lock, |
3043 |
++ nbl_list); |
3044 |
++ list_del_init(&nbl->nbl_list); |
3045 |
++ list_move(&nbl->nbl_lru, &reaplist); |
3046 |
++ } |
3047 |
++ spin_unlock(&nn->blocked_locks_lock); |
3048 |
++ |
3049 |
++ /* Now free them */ |
3050 |
++ while (!list_empty(&reaplist)) { |
3051 |
++ nbl = list_first_entry(&reaplist, struct nfsd4_blocked_lock, |
3052 |
++ nbl_lru); |
3053 |
++ list_del_init(&nbl->nbl_lru); |
3054 |
++ posix_unblock_lock(&nbl->nbl_lock); |
3055 |
++ free_blocked_lock(nbl); |
3056 |
++ } |
3057 |
++} |
3058 |
++ |
3059 |
+ static int |
3060 |
+ nfsd4_cb_notify_lock_done(struct nfsd4_callback *cb, struct rpc_task *task) |
3061 |
+ { |
3062 |
+@@ -1854,6 +1883,7 @@ static __be32 mark_client_expired_locked(struct nfs4_client *clp) |
3063 |
+ static void |
3064 |
+ __destroy_client(struct nfs4_client *clp) |
3065 |
+ { |
3066 |
++ int i; |
3067 |
+ struct nfs4_openowner *oo; |
3068 |
+ struct nfs4_delegation *dp; |
3069 |
+ struct list_head reaplist; |
3070 |
+@@ -1883,6 +1913,16 @@ __destroy_client(struct nfs4_client *clp) |
3071 |
+ nfs4_get_stateowner(&oo->oo_owner); |
3072 |
+ release_openowner(oo); |
3073 |
+ } |
3074 |
++ for (i = 0; i < OWNER_HASH_SIZE; i++) { |
3075 |
++ struct nfs4_stateowner *so, *tmp; |
3076 |
++ |
3077 |
++ list_for_each_entry_safe(so, tmp, &clp->cl_ownerstr_hashtbl[i], |
3078 |
++ so_strhash) { |
3079 |
++ /* Should be no openowners at this point */ |
3080 |
++ WARN_ON_ONCE(so->so_is_open_owner); |
3081 |
++ remove_blocked_locks(lockowner(so)); |
3082 |
++ } |
3083 |
++ } |
3084 |
+ nfsd4_return_all_client_layouts(clp); |
3085 |
+ nfsd4_shutdown_callback(clp); |
3086 |
+ if (clp->cl_cb_conn.cb_xprt) |
3087 |
+@@ -6275,6 +6315,7 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, |
3088 |
+ } |
3089 |
+ spin_unlock(&clp->cl_lock); |
3090 |
+ free_ol_stateid_reaplist(&reaplist); |
3091 |
++ remove_blocked_locks(lo); |
3092 |
+ nfs4_put_stateowner(&lo->lo_owner); |
3093 |
+ |
3094 |
+ return status; |
3095 |
+@@ -7060,6 +7101,8 @@ nfs4_state_destroy_net(struct net *net) |
3096 |
+ } |
3097 |
+ } |
3098 |
+ |
3099 |
++ WARN_ON(!list_empty(&nn->blocked_locks_lru)); |
3100 |
++ |
3101 |
+ for (i = 0; i < CLIENT_HASH_SIZE; i++) { |
3102 |
+ while (!list_empty(&nn->unconf_id_hashtbl[i])) { |
3103 |
+ clp = list_entry(nn->unconf_id_hashtbl[i].next, struct nfs4_client, cl_idhash); |
3104 |
+@@ -7126,7 +7169,6 @@ nfs4_state_shutdown_net(struct net *net) |
3105 |
+ struct nfs4_delegation *dp = NULL; |
3106 |
+ struct list_head *pos, *next, reaplist; |
3107 |
+ struct nfsd_net *nn = net_generic(net, nfsd_net_id); |
3108 |
+- struct nfsd4_blocked_lock *nbl; |
3109 |
+ |
3110 |
+ cancel_delayed_work_sync(&nn->laundromat_work); |
3111 |
+ locks_end_grace(&nn->nfsd4_manager); |
3112 |
+@@ -7147,24 +7189,6 @@ nfs4_state_shutdown_net(struct net *net) |
3113 |
+ nfs4_put_stid(&dp->dl_stid); |
3114 |
+ } |
3115 |
+ |
3116 |
+- BUG_ON(!list_empty(&reaplist)); |
3117 |
+- spin_lock(&nn->blocked_locks_lock); |
3118 |
+- while (!list_empty(&nn->blocked_locks_lru)) { |
3119 |
+- nbl = list_first_entry(&nn->blocked_locks_lru, |
3120 |
+- struct nfsd4_blocked_lock, nbl_lru); |
3121 |
+- list_move(&nbl->nbl_lru, &reaplist); |
3122 |
+- list_del_init(&nbl->nbl_list); |
3123 |
+- } |
3124 |
+- spin_unlock(&nn->blocked_locks_lock); |
3125 |
+- |
3126 |
+- while (!list_empty(&reaplist)) { |
3127 |
+- nbl = list_first_entry(&reaplist, |
3128 |
+- struct nfsd4_blocked_lock, nbl_lru); |
3129 |
+- list_del_init(&nbl->nbl_lru); |
3130 |
+- posix_unblock_lock(&nbl->nbl_lock); |
3131 |
+- free_blocked_lock(nbl); |
3132 |
+- } |
3133 |
+- |
3134 |
+ nfsd4_client_tracking_exit(net); |
3135 |
+ nfs4_state_destroy_net(net); |
3136 |
+ } |
3137 |
+diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h |
3138 |
+index 045a7f52ab3a..77b891a8f191 100644 |
3139 |
+--- a/include/asm-generic/pgtable.h |
3140 |
++++ b/include/asm-generic/pgtable.h |
3141 |
+@@ -976,6 +976,8 @@ int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot); |
3142 |
+ int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot); |
3143 |
+ int pud_clear_huge(pud_t *pud); |
3144 |
+ int pmd_clear_huge(pmd_t *pmd); |
3145 |
++int pud_free_pmd_page(pud_t *pud); |
3146 |
++int pmd_free_pte_page(pmd_t *pmd); |
3147 |
+ #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */ |
3148 |
+ static inline int p4d_set_huge(p4d_t *p4d, phys_addr_t addr, pgprot_t prot) |
3149 |
+ { |
3150 |
+@@ -1001,6 +1003,14 @@ static inline int pmd_clear_huge(pmd_t *pmd) |
3151 |
+ { |
3152 |
+ return 0; |
3153 |
+ } |
3154 |
++static inline int pud_free_pmd_page(pud_t *pud) |
3155 |
++{ |
3156 |
++ return 0; |
3157 |
++} |
3158 |
++static inline int pmd_free_pte_page(pmd_t *pmd) |
3159 |
++{ |
3160 |
++ return 0; |
3161 |
++} |
3162 |
+ #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */ |
3163 |
+ |
3164 |
+ #ifndef __HAVE_ARCH_FLUSH_PMD_TLB_RANGE |
3165 |
+diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h |
3166 |
+index c00fee539822..6d45aae47b2e 100644 |
3167 |
+--- a/include/drm/drm_syncobj.h |
3168 |
++++ b/include/drm/drm_syncobj.h |
3169 |
+@@ -60,11 +60,6 @@ struct drm_syncobj { |
3170 |
+ * locks cb_list and write-locks fence. |
3171 |
+ */ |
3172 |
+ spinlock_t lock; |
3173 |
+- /** |
3174 |
+- * @file: |
3175 |
+- * a file backing for this syncobj. |
3176 |
+- */ |
3177 |
+- struct file *file; |
3178 |
+ }; |
3179 |
+ |
3180 |
+ typedef void (*drm_syncobj_func_t)(struct drm_syncobj *syncobj, |
3181 |
+diff --git a/include/linux/fsl_ifc.h b/include/linux/fsl_ifc.h |
3182 |
+index c332f0a45607..3fdfede2f0f3 100644 |
3183 |
+--- a/include/linux/fsl_ifc.h |
3184 |
++++ b/include/linux/fsl_ifc.h |
3185 |
+@@ -734,11 +734,7 @@ struct fsl_ifc_nand { |
3186 |
+ u32 res19[0x10]; |
3187 |
+ __be32 nand_fsr; |
3188 |
+ u32 res20; |
3189 |
+- /* The V1 nand_eccstat is actually 4 words that overlaps the |
3190 |
+- * V2 nand_eccstat. |
3191 |
+- */ |
3192 |
+- __be32 v1_nand_eccstat[2]; |
3193 |
+- __be32 v2_nand_eccstat[6]; |
3194 |
++ __be32 nand_eccstat[8]; |
3195 |
+ u32 res21[0x1c]; |
3196 |
+ __be32 nanndcr; |
3197 |
+ u32 res22[0x2]; |
3198 |
+diff --git a/include/linux/memblock.h b/include/linux/memblock.h |
3199 |
+index bae11c7e7bf3..2dec2d4b469b 100644 |
3200 |
+--- a/include/linux/memblock.h |
3201 |
++++ b/include/linux/memblock.h |
3202 |
+@@ -187,7 +187,6 @@ int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn, |
3203 |
+ unsigned long *end_pfn); |
3204 |
+ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, |
3205 |
+ unsigned long *out_end_pfn, int *out_nid); |
3206 |
+-unsigned long memblock_next_valid_pfn(unsigned long pfn, unsigned long max_pfn); |
3207 |
+ |
3208 |
+ /** |
3209 |
+ * for_each_mem_pfn_range - early memory pfn range iterator |
3210 |
+diff --git a/include/trace/events/mmc.h b/include/trace/events/mmc.h |
3211 |
+index 200f731be557..7b706ff21335 100644 |
3212 |
+--- a/include/trace/events/mmc.h |
3213 |
++++ b/include/trace/events/mmc.h |
3214 |
+@@ -86,8 +86,8 @@ TRACE_EVENT(mmc_request_start, |
3215 |
+ __entry->stop_flags, __entry->stop_retries, |
3216 |
+ __entry->sbc_opcode, __entry->sbc_arg, |
3217 |
+ __entry->sbc_flags, __entry->sbc_retries, |
3218 |
+- __entry->blocks, __entry->blk_addr, |
3219 |
+- __entry->blksz, __entry->data_flags, __entry->tag, |
3220 |
++ __entry->blocks, __entry->blksz, |
3221 |
++ __entry->blk_addr, __entry->data_flags, __entry->tag, |
3222 |
+ __entry->can_retune, __entry->doing_retune, |
3223 |
+ __entry->retune_now, __entry->need_retune, |
3224 |
+ __entry->hold_retune, __entry->retune_period) |
3225 |
+diff --git a/include/uapi/linux/usb/audio.h b/include/uapi/linux/usb/audio.h |
3226 |
+index 17a022c5b414..da3315ed1bcd 100644 |
3227 |
+--- a/include/uapi/linux/usb/audio.h |
3228 |
++++ b/include/uapi/linux/usb/audio.h |
3229 |
+@@ -370,7 +370,7 @@ static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_d |
3230 |
+ { |
3231 |
+ return (protocol == UAC_VERSION_1) ? |
3232 |
+ desc->baSourceID[desc->bNrInPins + 4] : |
3233 |
+- desc->baSourceID[desc->bNrInPins + 6]; |
3234 |
++ 2; /* in UAC2, this value is constant */ |
3235 |
+ } |
3236 |
+ |
3237 |
+ static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc, |
3238 |
+@@ -378,7 +378,7 @@ static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_de |
3239 |
+ { |
3240 |
+ return (protocol == UAC_VERSION_1) ? |
3241 |
+ &desc->baSourceID[desc->bNrInPins + 5] : |
3242 |
+- &desc->baSourceID[desc->bNrInPins + 7]; |
3243 |
++ &desc->baSourceID[desc->bNrInPins + 6]; |
3244 |
+ } |
3245 |
+ |
3246 |
+ static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc, |
3247 |
+diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c |
3248 |
+index 25d074920a00..4e933219fec6 100644 |
3249 |
+--- a/kernel/bpf/syscall.c |
3250 |
++++ b/kernel/bpf/syscall.c |
3251 |
+@@ -1455,7 +1455,7 @@ SYSCALL_DEFINE3(bpf, int, cmd, union bpf_attr __user *, uattr, unsigned int, siz |
3252 |
+ union bpf_attr attr = {}; |
3253 |
+ int err; |
3254 |
+ |
3255 |
+- if (!capable(CAP_SYS_ADMIN) && sysctl_unprivileged_bpf_disabled) |
3256 |
++ if (sysctl_unprivileged_bpf_disabled && !capable(CAP_SYS_ADMIN)) |
3257 |
+ return -EPERM; |
3258 |
+ |
3259 |
+ err = check_uarg_tail_zero(uattr, sizeof(attr), size); |
3260 |
+diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c |
3261 |
+index 030e4286f14c..76c0ef2cb509 100644 |
3262 |
+--- a/kernel/cgroup/cgroup.c |
3263 |
++++ b/kernel/cgroup/cgroup.c |
3264 |
+@@ -3148,6 +3148,16 @@ static int cgroup_enable_threaded(struct cgroup *cgrp) |
3265 |
+ if (cgroup_is_threaded(cgrp)) |
3266 |
+ return 0; |
3267 |
+ |
3268 |
++ /* |
3269 |
++ * If @cgroup is populated or has domain controllers enabled, it |
3270 |
++ * can't be switched. While the below cgroup_can_be_thread_root() |
3271 |
++ * test can catch the same conditions, that's only when @parent is |
3272 |
++ * not mixable, so let's check it explicitly. |
3273 |
++ */ |
3274 |
++ if (cgroup_is_populated(cgrp) || |
3275 |
++ cgrp->subtree_control & ~cgrp_dfl_threaded_ss_mask) |
3276 |
++ return -EOPNOTSUPP; |
3277 |
++ |
3278 |
+ /* we're joining the parent's domain, ensure its validity */ |
3279 |
+ if (!cgroup_is_valid_domain(dom_cgrp) || |
3280 |
+ !cgroup_can_be_thread_root(dom_cgrp)) |
3281 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
3282 |
+index f42f7c7a8f84..cecd72eb09b8 100644 |
3283 |
+--- a/kernel/events/core.c |
3284 |
++++ b/kernel/events/core.c |
3285 |
+@@ -2322,7 +2322,7 @@ static void ctx_resched(struct perf_cpu_context *cpuctx, |
3286 |
+ struct perf_event_context *task_ctx, |
3287 |
+ enum event_type_t event_type) |
3288 |
+ { |
3289 |
+- enum event_type_t ctx_event_type = event_type & EVENT_ALL; |
3290 |
++ enum event_type_t ctx_event_type; |
3291 |
+ bool cpu_event = !!(event_type & EVENT_CPU); |
3292 |
+ |
3293 |
+ /* |
3294 |
+@@ -2332,6 +2332,8 @@ static void ctx_resched(struct perf_cpu_context *cpuctx, |
3295 |
+ if (event_type & EVENT_PINNED) |
3296 |
+ event_type |= EVENT_FLEXIBLE; |
3297 |
+ |
3298 |
++ ctx_event_type = event_type & EVENT_ALL; |
3299 |
++ |
3300 |
+ perf_pmu_disable(cpuctx->ctx.pmu); |
3301 |
+ if (task_ctx) |
3302 |
+ task_ctx_sched_out(cpuctx, task_ctx, event_type); |
3303 |
+diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c |
3304 |
+index ec999f32c840..708992708332 100644 |
3305 |
+--- a/kernel/time/posix-timers.c |
3306 |
++++ b/kernel/time/posix-timers.c |
3307 |
+@@ -50,6 +50,7 @@ |
3308 |
+ #include <linux/export.h> |
3309 |
+ #include <linux/hashtable.h> |
3310 |
+ #include <linux/compat.h> |
3311 |
++#include <linux/nospec.h> |
3312 |
+ |
3313 |
+ #include "timekeeping.h" |
3314 |
+ #include "posix-timers.h" |
3315 |
+@@ -1346,11 +1347,15 @@ static const struct k_clock * const posix_clocks[] = { |
3316 |
+ |
3317 |
+ static const struct k_clock *clockid_to_kclock(const clockid_t id) |
3318 |
+ { |
3319 |
+- if (id < 0) |
3320 |
++ clockid_t idx = id; |
3321 |
++ |
3322 |
++ if (id < 0) { |
3323 |
+ return (id & CLOCKFD_MASK) == CLOCKFD ? |
3324 |
+ &clock_posix_dynamic : &clock_posix_cpu; |
3325 |
++ } |
3326 |
+ |
3327 |
+- if (id >= ARRAY_SIZE(posix_clocks) || !posix_clocks[id]) |
3328 |
++ if (id >= ARRAY_SIZE(posix_clocks)) |
3329 |
+ return NULL; |
3330 |
+- return posix_clocks[id]; |
3331 |
++ |
3332 |
++ return posix_clocks[array_index_nospec(idx, ARRAY_SIZE(posix_clocks))]; |
3333 |
+ } |
3334 |
+diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c |
3335 |
+index 8a907e12b6b9..f8d3bd974bcc 100644 |
3336 |
+--- a/kernel/trace/trace_kprobe.c |
3337 |
++++ b/kernel/trace/trace_kprobe.c |
3338 |
+@@ -635,7 +635,7 @@ static int create_trace_kprobe(int argc, char **argv) |
3339 |
+ char *symbol = NULL, *event = NULL, *group = NULL; |
3340 |
+ int maxactive = 0; |
3341 |
+ char *arg; |
3342 |
+- unsigned long offset = 0; |
3343 |
++ long offset = 0; |
3344 |
+ void *addr = NULL; |
3345 |
+ char buf[MAX_EVENT_NAME_LEN]; |
3346 |
+ |
3347 |
+@@ -723,7 +723,7 @@ static int create_trace_kprobe(int argc, char **argv) |
3348 |
+ symbol = argv[1]; |
3349 |
+ /* TODO: support .init module functions */ |
3350 |
+ ret = traceprobe_split_symbol_offset(symbol, &offset); |
3351 |
+- if (ret) { |
3352 |
++ if (ret || offset < 0 || offset > UINT_MAX) { |
3353 |
+ pr_info("Failed to parse either an address or a symbol.\n"); |
3354 |
+ return ret; |
3355 |
+ } |
3356 |
+diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c |
3357 |
+index 52478f033f88..fe4513330412 100644 |
3358 |
+--- a/kernel/trace/trace_probe.c |
3359 |
++++ b/kernel/trace/trace_probe.c |
3360 |
+@@ -320,7 +320,7 @@ static fetch_func_t get_fetch_size_function(const struct fetch_type *type, |
3361 |
+ } |
3362 |
+ |
3363 |
+ /* Split symbol and offset. */ |
3364 |
+-int traceprobe_split_symbol_offset(char *symbol, unsigned long *offset) |
3365 |
++int traceprobe_split_symbol_offset(char *symbol, long *offset) |
3366 |
+ { |
3367 |
+ char *tmp; |
3368 |
+ int ret; |
3369 |
+@@ -328,13 +328,11 @@ int traceprobe_split_symbol_offset(char *symbol, unsigned long *offset) |
3370 |
+ if (!offset) |
3371 |
+ return -EINVAL; |
3372 |
+ |
3373 |
+- tmp = strchr(symbol, '+'); |
3374 |
++ tmp = strpbrk(symbol, "+-"); |
3375 |
+ if (tmp) { |
3376 |
+- /* skip sign because kstrtoul doesn't accept '+' */ |
3377 |
+- ret = kstrtoul(tmp + 1, 0, offset); |
3378 |
++ ret = kstrtol(tmp, 0, offset); |
3379 |
+ if (ret) |
3380 |
+ return ret; |
3381 |
+- |
3382 |
+ *tmp = '\0'; |
3383 |
+ } else |
3384 |
+ *offset = 0; |
3385 |
+diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h |
3386 |
+index 903273c93e61..dc39472ca9e4 100644 |
3387 |
+--- a/kernel/trace/trace_probe.h |
3388 |
++++ b/kernel/trace/trace_probe.h |
3389 |
+@@ -354,7 +354,7 @@ extern int traceprobe_conflict_field_name(const char *name, |
3390 |
+ extern void traceprobe_update_arg(struct probe_arg *arg); |
3391 |
+ extern void traceprobe_free_probe_arg(struct probe_arg *arg); |
3392 |
+ |
3393 |
+-extern int traceprobe_split_symbol_offset(char *symbol, unsigned long *offset); |
3394 |
++extern int traceprobe_split_symbol_offset(char *symbol, long *offset); |
3395 |
+ |
3396 |
+ extern ssize_t traceprobe_probes_write(struct file *file, |
3397 |
+ const char __user *buffer, size_t count, loff_t *ppos, |
3398 |
+diff --git a/lib/ioremap.c b/lib/ioremap.c |
3399 |
+index b808a390e4c3..54e5bbaa3200 100644 |
3400 |
+--- a/lib/ioremap.c |
3401 |
++++ b/lib/ioremap.c |
3402 |
+@@ -91,7 +91,8 @@ static inline int ioremap_pmd_range(pud_t *pud, unsigned long addr, |
3403 |
+ |
3404 |
+ if (ioremap_pmd_enabled() && |
3405 |
+ ((next - addr) == PMD_SIZE) && |
3406 |
+- IS_ALIGNED(phys_addr + addr, PMD_SIZE)) { |
3407 |
++ IS_ALIGNED(phys_addr + addr, PMD_SIZE) && |
3408 |
++ pmd_free_pte_page(pmd)) { |
3409 |
+ if (pmd_set_huge(pmd, phys_addr + addr, prot)) |
3410 |
+ continue; |
3411 |
+ } |
3412 |
+@@ -117,7 +118,8 @@ static inline int ioremap_pud_range(p4d_t *p4d, unsigned long addr, |
3413 |
+ |
3414 |
+ if (ioremap_pud_enabled() && |
3415 |
+ ((next - addr) == PUD_SIZE) && |
3416 |
+- IS_ALIGNED(phys_addr + addr, PUD_SIZE)) { |
3417 |
++ IS_ALIGNED(phys_addr + addr, PUD_SIZE) && |
3418 |
++ pud_free_pmd_page(pud)) { |
3419 |
+ if (pud_set_huge(pud, phys_addr + addr, prot)) |
3420 |
+ continue; |
3421 |
+ } |
3422 |
+diff --git a/mm/huge_memory.c b/mm/huge_memory.c |
3423 |
+index eba34cdfc3e5..a403d29da6fd 100644 |
3424 |
+--- a/mm/huge_memory.c |
3425 |
++++ b/mm/huge_memory.c |
3426 |
+@@ -2739,11 +2739,13 @@ static unsigned long deferred_split_scan(struct shrinker *shrink, |
3427 |
+ |
3428 |
+ list_for_each_safe(pos, next, &list) { |
3429 |
+ page = list_entry((void *)pos, struct page, mapping); |
3430 |
+- lock_page(page); |
3431 |
++ if (!trylock_page(page)) |
3432 |
++ goto next; |
3433 |
+ /* split_huge_page() removes page from list on success */ |
3434 |
+ if (!split_huge_page(page)) |
3435 |
+ split++; |
3436 |
+ unlock_page(page); |
3437 |
++next: |
3438 |
+ put_page(page); |
3439 |
+ } |
3440 |
+ |
3441 |
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
3442 |
+index c539941671b4..b1f841a9edd4 100644 |
3443 |
+--- a/mm/hugetlb.c |
3444 |
++++ b/mm/hugetlb.c |
3445 |
+@@ -18,6 +18,7 @@ |
3446 |
+ #include <linux/bootmem.h> |
3447 |
+ #include <linux/sysfs.h> |
3448 |
+ #include <linux/slab.h> |
3449 |
++#include <linux/mmdebug.h> |
3450 |
+ #include <linux/sched/signal.h> |
3451 |
+ #include <linux/rmap.h> |
3452 |
+ #include <linux/string_helpers.h> |
3453 |
+@@ -4344,6 +4345,12 @@ int hugetlb_reserve_pages(struct inode *inode, |
3454 |
+ struct resv_map *resv_map; |
3455 |
+ long gbl_reserve; |
3456 |
+ |
3457 |
++ /* This should never happen */ |
3458 |
++ if (from > to) { |
3459 |
++ VM_WARN(1, "%s called with a negative range\n", __func__); |
3460 |
++ return -EINVAL; |
3461 |
++ } |
3462 |
++ |
3463 |
+ /* |
3464 |
+ * Only apply hugepage reservation if asked. At fault time, an |
3465 |
+ * attempt will be made for VM_NORESERVE to allocate a page |
3466 |
+diff --git a/mm/khugepaged.c b/mm/khugepaged.c |
3467 |
+index 43cb3043311b..2fe26634e1a2 100644 |
3468 |
+--- a/mm/khugepaged.c |
3469 |
++++ b/mm/khugepaged.c |
3470 |
+@@ -530,7 +530,12 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma, |
3471 |
+ goto out; |
3472 |
+ } |
3473 |
+ |
3474 |
+- VM_BUG_ON_PAGE(PageCompound(page), page); |
3475 |
++ /* TODO: teach khugepaged to collapse THP mapped with pte */ |
3476 |
++ if (PageCompound(page)) { |
3477 |
++ result = SCAN_PAGE_COMPOUND; |
3478 |
++ goto out; |
3479 |
++ } |
3480 |
++ |
3481 |
+ VM_BUG_ON_PAGE(!PageAnon(page), page); |
3482 |
+ |
3483 |
+ /* |
3484 |
+diff --git a/mm/memblock.c b/mm/memblock.c |
3485 |
+index 6dd303717a4d..e81d12c544e9 100644 |
3486 |
+--- a/mm/memblock.c |
3487 |
++++ b/mm/memblock.c |
3488 |
+@@ -1101,34 +1101,6 @@ void __init_memblock __next_mem_pfn_range(int *idx, int nid, |
3489 |
+ *out_nid = r->nid; |
3490 |
+ } |
3491 |
+ |
3492 |
+-unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn, |
3493 |
+- unsigned long max_pfn) |
3494 |
+-{ |
3495 |
+- struct memblock_type *type = &memblock.memory; |
3496 |
+- unsigned int right = type->cnt; |
3497 |
+- unsigned int mid, left = 0; |
3498 |
+- phys_addr_t addr = PFN_PHYS(++pfn); |
3499 |
+- |
3500 |
+- do { |
3501 |
+- mid = (right + left) / 2; |
3502 |
+- |
3503 |
+- if (addr < type->regions[mid].base) |
3504 |
+- right = mid; |
3505 |
+- else if (addr >= (type->regions[mid].base + |
3506 |
+- type->regions[mid].size)) |
3507 |
+- left = mid + 1; |
3508 |
+- else { |
3509 |
+- /* addr is within the region, so pfn is valid */ |
3510 |
+- return pfn; |
3511 |
+- } |
3512 |
+- } while (left < right); |
3513 |
+- |
3514 |
+- if (right == type->cnt) |
3515 |
+- return -1UL; |
3516 |
+- else |
3517 |
+- return PHYS_PFN(type->regions[right].base); |
3518 |
+-} |
3519 |
+- |
3520 |
+ /** |
3521 |
+ * memblock_set_node - set node ID on memblock regions |
3522 |
+ * @base: base of area to set node ID for |
3523 |
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
3524 |
+index 6627caeeaf82..1d7693c35424 100644 |
3525 |
+--- a/mm/page_alloc.c |
3526 |
++++ b/mm/page_alloc.c |
3527 |
+@@ -3532,7 +3532,7 @@ static bool __need_fs_reclaim(gfp_t gfp_mask) |
3528 |
+ return false; |
3529 |
+ |
3530 |
+ /* this guy won't enter reclaim */ |
3531 |
+- if ((current->flags & PF_MEMALLOC) && !(gfp_mask & __GFP_NOMEMALLOC)) |
3532 |
++ if (current->flags & PF_MEMALLOC) |
3533 |
+ return false; |
3534 |
+ |
3535 |
+ /* We're only interested __GFP_FS allocations for now */ |
3536 |
+@@ -5302,17 +5302,8 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, |
3537 |
+ if (context != MEMMAP_EARLY) |
3538 |
+ goto not_early; |
3539 |
+ |
3540 |
+- if (!early_pfn_valid(pfn)) { |
3541 |
+-#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP |
3542 |
+- /* |
3543 |
+- * Skip to the pfn preceding the next valid one (or |
3544 |
+- * end_pfn), such that we hit a valid pfn (or end_pfn) |
3545 |
+- * on our next iteration of the loop. |
3546 |
+- */ |
3547 |
+- pfn = memblock_next_valid_pfn(pfn, end_pfn) - 1; |
3548 |
+-#endif |
3549 |
++ if (!early_pfn_valid(pfn)) |
3550 |
+ continue; |
3551 |
+- } |
3552 |
+ if (!early_pfn_in_nid(pfn, nid)) |
3553 |
+ continue; |
3554 |
+ if (!update_defer_init(pgdat, pfn, end_pfn, &nr_initialised)) |
3555 |
+diff --git a/mm/shmem.c b/mm/shmem.c |
3556 |
+index 07a1d22807be..f383298b7280 100644 |
3557 |
+--- a/mm/shmem.c |
3558 |
++++ b/mm/shmem.c |
3559 |
+@@ -493,36 +493,45 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, |
3560 |
+ info = list_entry(pos, struct shmem_inode_info, shrinklist); |
3561 |
+ inode = &info->vfs_inode; |
3562 |
+ |
3563 |
+- if (nr_to_split && split >= nr_to_split) { |
3564 |
+- iput(inode); |
3565 |
+- continue; |
3566 |
+- } |
3567 |
++ if (nr_to_split && split >= nr_to_split) |
3568 |
++ goto leave; |
3569 |
+ |
3570 |
+- page = find_lock_page(inode->i_mapping, |
3571 |
++ page = find_get_page(inode->i_mapping, |
3572 |
+ (inode->i_size & HPAGE_PMD_MASK) >> PAGE_SHIFT); |
3573 |
+ if (!page) |
3574 |
+ goto drop; |
3575 |
+ |
3576 |
++ /* No huge page at the end of the file: nothing to split */ |
3577 |
+ if (!PageTransHuge(page)) { |
3578 |
+- unlock_page(page); |
3579 |
+ put_page(page); |
3580 |
+ goto drop; |
3581 |
+ } |
3582 |
+ |
3583 |
++ /* |
3584 |
++ * Leave the inode on the list if we failed to lock |
3585 |
++ * the page at this time. |
3586 |
++ * |
3587 |
++ * Waiting for the lock may lead to deadlock in the |
3588 |
++ * reclaim path. |
3589 |
++ */ |
3590 |
++ if (!trylock_page(page)) { |
3591 |
++ put_page(page); |
3592 |
++ goto leave; |
3593 |
++ } |
3594 |
++ |
3595 |
+ ret = split_huge_page(page); |
3596 |
+ unlock_page(page); |
3597 |
+ put_page(page); |
3598 |
+ |
3599 |
+- if (ret) { |
3600 |
+- /* split failed: leave it on the list */ |
3601 |
+- iput(inode); |
3602 |
+- continue; |
3603 |
+- } |
3604 |
++ /* If split failed leave the inode on the list */ |
3605 |
++ if (ret) |
3606 |
++ goto leave; |
3607 |
+ |
3608 |
+ split++; |
3609 |
+ drop: |
3610 |
+ list_del_init(&info->shrinklist); |
3611 |
+ removed++; |
3612 |
++leave: |
3613 |
+ iput(inode); |
3614 |
+ } |
3615 |
+ |
3616 |
+diff --git a/mm/vmscan.c b/mm/vmscan.c |
3617 |
+index 441f346fb5e2..a8a3729bfaa9 100644 |
3618 |
+--- a/mm/vmscan.c |
3619 |
++++ b/mm/vmscan.c |
3620 |
+@@ -1846,6 +1846,20 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec, |
3621 |
+ if (stat.nr_writeback && stat.nr_writeback == nr_taken) |
3622 |
+ set_bit(PGDAT_WRITEBACK, &pgdat->flags); |
3623 |
+ |
3624 |
++ /* |
3625 |
++ * If dirty pages are scanned that are not queued for IO, it |
3626 |
++ * implies that flushers are not doing their job. This can |
3627 |
++ * happen when memory pressure pushes dirty pages to the end of |
3628 |
++ * the LRU before the dirty limits are breached and the dirty |
3629 |
++ * data has expired. It can also happen when the proportion of |
3630 |
++ * dirty pages grows not through writes but through memory |
3631 |
++ * pressure reclaiming all the clean cache. And in some cases, |
3632 |
++ * the flushers simply cannot keep up with the allocation |
3633 |
++ * rate. Nudge the flusher threads in case they are asleep. |
3634 |
++ */ |
3635 |
++ if (stat.nr_unqueued_dirty == nr_taken) |
3636 |
++ wakeup_flusher_threads(0, WB_REASON_VMSCAN); |
3637 |
++ |
3638 |
+ /* |
3639 |
+ * Legacy memcg will stall in page writeback so avoid forcibly |
3640 |
+ * stalling here. |
3641 |
+@@ -1858,22 +1872,9 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec, |
3642 |
+ if (stat.nr_dirty && stat.nr_dirty == stat.nr_congested) |
3643 |
+ set_bit(PGDAT_CONGESTED, &pgdat->flags); |
3644 |
+ |
3645 |
+- /* |
3646 |
+- * If dirty pages are scanned that are not queued for IO, it |
3647 |
+- * implies that flushers are not doing their job. This can |
3648 |
+- * happen when memory pressure pushes dirty pages to the end of |
3649 |
+- * the LRU before the dirty limits are breached and the dirty |
3650 |
+- * data has expired. It can also happen when the proportion of |
3651 |
+- * dirty pages grows not through writes but through memory |
3652 |
+- * pressure reclaiming all the clean cache. And in some cases, |
3653 |
+- * the flushers simply cannot keep up with the allocation |
3654 |
+- * rate. Nudge the flusher threads in case they are asleep, but |
3655 |
+- * also allow kswapd to start writing pages during reclaim. |
3656 |
+- */ |
3657 |
+- if (stat.nr_unqueued_dirty == nr_taken) { |
3658 |
+- wakeup_flusher_threads(0, WB_REASON_VMSCAN); |
3659 |
++ /* Allow kswapd to start writing pages during reclaim. */ |
3660 |
++ if (stat.nr_unqueued_dirty == nr_taken) |
3661 |
+ set_bit(PGDAT_DIRTY, &pgdat->flags); |
3662 |
+- } |
3663 |
+ |
3664 |
+ /* |
3665 |
+ * If kswapd scans pages marked marked for immediate |
3666 |
+diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c |
3667 |
+index 386ee829c655..829e2f6bfb73 100644 |
3668 |
+--- a/sound/drivers/aloop.c |
3669 |
++++ b/sound/drivers/aloop.c |
3670 |
+@@ -192,6 +192,11 @@ static inline void loopback_timer_stop(struct loopback_pcm *dpcm) |
3671 |
+ dpcm->timer.expires = 0; |
3672 |
+ } |
3673 |
+ |
3674 |
++static inline void loopback_timer_stop_sync(struct loopback_pcm *dpcm) |
3675 |
++{ |
3676 |
++ del_timer_sync(&dpcm->timer); |
3677 |
++} |
3678 |
++ |
3679 |
+ #define CABLE_VALID_PLAYBACK (1 << SNDRV_PCM_STREAM_PLAYBACK) |
3680 |
+ #define CABLE_VALID_CAPTURE (1 << SNDRV_PCM_STREAM_CAPTURE) |
3681 |
+ #define CABLE_VALID_BOTH (CABLE_VALID_PLAYBACK|CABLE_VALID_CAPTURE) |
3682 |
+@@ -326,6 +331,8 @@ static int loopback_prepare(struct snd_pcm_substream *substream) |
3683 |
+ struct loopback_cable *cable = dpcm->cable; |
3684 |
+ int bps, salign; |
3685 |
+ |
3686 |
++ loopback_timer_stop_sync(dpcm); |
3687 |
++ |
3688 |
+ salign = (snd_pcm_format_width(runtime->format) * |
3689 |
+ runtime->channels) / 8; |
3690 |
+ bps = salign * runtime->rate; |
3691 |
+@@ -659,7 +666,9 @@ static void free_cable(struct snd_pcm_substream *substream) |
3692 |
+ return; |
3693 |
+ if (cable->streams[!substream->stream]) { |
3694 |
+ /* other stream is still alive */ |
3695 |
++ spin_lock_irq(&cable->lock); |
3696 |
+ cable->streams[substream->stream] = NULL; |
3697 |
++ spin_unlock_irq(&cable->lock); |
3698 |
+ } else { |
3699 |
+ /* free the cable */ |
3700 |
+ loopback->cables[substream->number][dev] = NULL; |
3701 |
+@@ -699,7 +708,6 @@ static int loopback_open(struct snd_pcm_substream *substream) |
3702 |
+ loopback->cables[substream->number][dev] = cable; |
3703 |
+ } |
3704 |
+ dpcm->cable = cable; |
3705 |
+- cable->streams[substream->stream] = dpcm; |
3706 |
+ |
3707 |
+ snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); |
3708 |
+ |
3709 |
+@@ -731,6 +739,11 @@ static int loopback_open(struct snd_pcm_substream *substream) |
3710 |
+ runtime->hw = loopback_pcm_hardware; |
3711 |
+ else |
3712 |
+ runtime->hw = cable->hw; |
3713 |
++ |
3714 |
++ spin_lock_irq(&cable->lock); |
3715 |
++ cable->streams[substream->stream] = dpcm; |
3716 |
++ spin_unlock_irq(&cable->lock); |
3717 |
++ |
3718 |
+ unlock: |
3719 |
+ if (err < 0) { |
3720 |
+ free_cable(substream); |
3721 |
+@@ -745,7 +758,7 @@ static int loopback_close(struct snd_pcm_substream *substream) |
3722 |
+ struct loopback *loopback = substream->private_data; |
3723 |
+ struct loopback_pcm *dpcm = substream->runtime->private_data; |
3724 |
+ |
3725 |
+- loopback_timer_stop(dpcm); |
3726 |
++ loopback_timer_stop_sync(dpcm); |
3727 |
+ mutex_lock(&loopback->cable_lock); |
3728 |
+ free_cable(substream); |
3729 |
+ mutex_unlock(&loopback->cable_lock); |
3730 |
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
3731 |
+index d5017adf9feb..c507c69029e3 100644 |
3732 |
+--- a/sound/pci/hda/hda_intel.c |
3733 |
++++ b/sound/pci/hda/hda_intel.c |
3734 |
+@@ -375,6 +375,7 @@ enum { |
3735 |
+ ((pci)->device == 0x160c)) |
3736 |
+ |
3737 |
+ #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98) |
3738 |
++#define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348) |
3739 |
+ |
3740 |
+ static char *driver_short_names[] = { |
3741 |
+ [AZX_DRIVER_ICH] = "HDA Intel", |
3742 |
+@@ -1744,6 +1745,10 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, |
3743 |
+ else |
3744 |
+ chip->bdl_pos_adj = bdl_pos_adj[dev]; |
3745 |
+ |
3746 |
++ /* Workaround for a communication error on CFL (bko#199007) */ |
3747 |
++ if (IS_CFL(pci)) |
3748 |
++ chip->polling_mode = 1; |
3749 |
++ |
3750 |
+ err = azx_bus_init(chip, model[dev], &pci_hda_io_ops); |
3751 |
+ if (err < 0) { |
3752 |
+ kfree(hda); |
3753 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
3754 |
+index 3d19efd2783a..e44a9758f2eb 100644 |
3755 |
+--- a/sound/pci/hda/patch_realtek.c |
3756 |
++++ b/sound/pci/hda/patch_realtek.c |
3757 |
+@@ -3107,6 +3107,8 @@ static void alc256_init(struct hda_codec *codec) |
3758 |
+ |
3759 |
+ alc_update_coef_idx(codec, 0x46, 3 << 12, 0); |
3760 |
+ alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ |
3761 |
++ alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */ |
3762 |
++ alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15); |
3763 |
+ } |
3764 |
+ |
3765 |
+ static void alc256_shutup(struct hda_codec *codec) |
3766 |
+@@ -3486,8 +3488,12 @@ static void alc269_fixup_mic_mute_hook(void *private_data, int enabled) |
3767 |
+ pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid); |
3768 |
+ pinval &= ~AC_PINCTL_VREFEN; |
3769 |
+ pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80; |
3770 |
+- if (spec->mute_led_nid) |
3771 |
++ if (spec->mute_led_nid) { |
3772 |
++ /* temporarily power up/down for setting VREF */ |
3773 |
++ snd_hda_power_up_pm(codec); |
3774 |
+ snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval); |
3775 |
++ snd_hda_power_down_pm(codec); |
3776 |
++ } |
3777 |
+ } |
3778 |
+ |
3779 |
+ /* Make sure the led works even in runtime suspend */ |
3780 |
+@@ -5352,6 +5358,7 @@ enum { |
3781 |
+ ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, |
3782 |
+ ALC298_FIXUP_TPT470_DOCK, |
3783 |
+ ALC255_FIXUP_DUMMY_LINEOUT_VERB, |
3784 |
++ ALC255_FIXUP_DELL_HEADSET_MIC, |
3785 |
+ }; |
3786 |
+ |
3787 |
+ static const struct hda_fixup alc269_fixups[] = { |
3788 |
+@@ -6212,6 +6219,13 @@ static const struct hda_fixup alc269_fixups[] = { |
3789 |
+ .chained = true, |
3790 |
+ .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE |
3791 |
+ }, |
3792 |
++ [ALC255_FIXUP_DELL_HEADSET_MIC] = { |
3793 |
++ .type = HDA_FIXUP_PINS, |
3794 |
++ .v.pins = (const struct hda_pintbl[]) { |
3795 |
++ { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ |
3796 |
++ { } |
3797 |
++ }, |
3798 |
++ }, |
3799 |
+ }; |
3800 |
+ |
3801 |
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
3802 |
+@@ -6266,6 +6280,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
3803 |
+ SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), |
3804 |
+ SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), |
3805 |
+ SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), |
3806 |
++ SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), |
3807 |
++ SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), |
3808 |
+ SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB), |
3809 |
+ SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
3810 |
+ SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
3811 |
+@@ -7004,6 +7020,8 @@ static int patch_alc269(struct hda_codec *codec) |
3812 |
+ break; |
3813 |
+ case 0x10ec0257: |
3814 |
+ spec->codec_variant = ALC269_TYPE_ALC257; |
3815 |
++ spec->shutup = alc256_shutup; |
3816 |
++ spec->init_hook = alc256_init; |
3817 |
+ spec->gen.mixer_nid = 0; |
3818 |
+ break; |
3819 |
+ case 0x10ec0215: |
3820 |
+diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c |
3821 |
+index 69523ed55894..9df0af17e9c2 100644 |
3822 |
+--- a/tools/perf/builtin-stat.c |
3823 |
++++ b/tools/perf/builtin-stat.c |
3824 |
+@@ -922,7 +922,7 @@ static void print_metric_csv(void *ctx, |
3825 |
+ char buf[64], *vals, *ends; |
3826 |
+ |
3827 |
+ if (unit == NULL || fmt == NULL) { |
3828 |
+- fprintf(out, "%s%s%s%s", csv_sep, csv_sep, csv_sep, csv_sep); |
3829 |
++ fprintf(out, "%s%s", csv_sep, csv_sep); |
3830 |
+ return; |
3831 |
+ } |
3832 |
+ snprintf(buf, sizeof(buf), fmt, val); |
3833 |
+diff --git a/tools/testing/selftests/x86/protection_keys.c b/tools/testing/selftests/x86/protection_keys.c |
3834 |
+index 6cbb83b47150..f15aa5a76fe3 100644 |
3835 |
+--- a/tools/testing/selftests/x86/protection_keys.c |
3836 |
++++ b/tools/testing/selftests/x86/protection_keys.c |
3837 |
+@@ -250,7 +250,7 @@ void signal_handler(int signum, siginfo_t *si, void *vucontext) |
3838 |
+ unsigned long ip; |
3839 |
+ char *fpregs; |
3840 |
+ u32 *pkru_ptr; |
3841 |
+- u64 si_pkey; |
3842 |
++ u64 siginfo_pkey; |
3843 |
+ u32 *si_pkey_ptr; |
3844 |
+ int pkru_offset; |
3845 |
+ fpregset_t fpregset; |
3846 |
+@@ -292,9 +292,9 @@ void signal_handler(int signum, siginfo_t *si, void *vucontext) |
3847 |
+ si_pkey_ptr = (u32 *)(((u8 *)si) + si_pkey_offset); |
3848 |
+ dprintf1("si_pkey_ptr: %p\n", si_pkey_ptr); |
3849 |
+ dump_mem(si_pkey_ptr - 8, 24); |
3850 |
+- si_pkey = *si_pkey_ptr; |
3851 |
+- pkey_assert(si_pkey < NR_PKEYS); |
3852 |
+- last_si_pkey = si_pkey; |
3853 |
++ siginfo_pkey = *si_pkey_ptr; |
3854 |
++ pkey_assert(siginfo_pkey < NR_PKEYS); |
3855 |
++ last_si_pkey = siginfo_pkey; |
3856 |
+ |
3857 |
+ if ((si->si_code == SEGV_MAPERR) || |
3858 |
+ (si->si_code == SEGV_ACCERR) || |
3859 |
+@@ -306,7 +306,7 @@ void signal_handler(int signum, siginfo_t *si, void *vucontext) |
3860 |
+ dprintf1("signal pkru from xsave: %08x\n", *pkru_ptr); |
3861 |
+ /* need __rdpkru() version so we do not do shadow_pkru checking */ |
3862 |
+ dprintf1("signal pkru from pkru: %08x\n", __rdpkru()); |
3863 |
+- dprintf1("si_pkey from siginfo: %jx\n", si_pkey); |
3864 |
++ dprintf1("pkey from siginfo: %jx\n", siginfo_pkey); |
3865 |
+ *(u64 *)pkru_ptr = 0x00000000; |
3866 |
+ dprintf1("WARNING: set PRKU=0 to allow faulting instruction to continue\n"); |
3867 |
+ pkru_faults++; |
3868 |
+diff --git a/tools/testing/selftests/x86/ptrace_syscall.c b/tools/testing/selftests/x86/ptrace_syscall.c |
3869 |
+index 1ae1c5a7392e..6f22238f3217 100644 |
3870 |
+--- a/tools/testing/selftests/x86/ptrace_syscall.c |
3871 |
++++ b/tools/testing/selftests/x86/ptrace_syscall.c |
3872 |
+@@ -183,8 +183,10 @@ static void test_ptrace_syscall_restart(void) |
3873 |
+ if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0) |
3874 |
+ err(1, "PTRACE_TRACEME"); |
3875 |
+ |
3876 |
++ pid_t pid = getpid(), tid = syscall(SYS_gettid); |
3877 |
++ |
3878 |
+ printf("\tChild will make one syscall\n"); |
3879 |
+- raise(SIGSTOP); |
3880 |
++ syscall(SYS_tgkill, pid, tid, SIGSTOP); |
3881 |
+ |
3882 |
+ syscall(SYS_gettid, 10, 11, 12, 13, 14, 15); |
3883 |
+ _exit(0); |
3884 |
+@@ -301,9 +303,11 @@ static void test_restart_under_ptrace(void) |
3885 |
+ if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0) |
3886 |
+ err(1, "PTRACE_TRACEME"); |
3887 |
+ |
3888 |
++ pid_t pid = getpid(), tid = syscall(SYS_gettid); |
3889 |
++ |
3890 |
+ printf("\tChild will take a nap until signaled\n"); |
3891 |
+ setsigign(SIGUSR1, SA_RESTART); |
3892 |
+- raise(SIGSTOP); |
3893 |
++ syscall(SYS_tgkill, pid, tid, SIGSTOP); |
3894 |
+ |
3895 |
+ syscall(SYS_pause, 0, 0, 0, 0, 0, 0); |
3896 |
+ _exit(0); |