Annotation of /trunk/kernel-alx/patches-4.19/0169-4.19.70-all-fixes.patch
Parent Directory | Revision Log
Revision 3466 -
(hide annotations)
(download)
Tue Oct 29 10:31:27 2019 UTC (4 years, 7 months ago) by niro
File size: 100216 byte(s)
Tue Oct 29 10:31:27 2019 UTC (4 years, 7 months ago) by niro
File size: 100216 byte(s)
-linux-4.19.70
1 | niro | 3466 | diff --git a/Makefile b/Makefile |
2 | index 677341239449..ecf8806cb71f 100644 | ||
3 | --- a/Makefile | ||
4 | +++ b/Makefile | ||
5 | @@ -1,7 +1,7 @@ | ||
6 | # SPDX-License-Identifier: GPL-2.0 | ||
7 | VERSION = 4 | ||
8 | PATCHLEVEL = 19 | ||
9 | -SUBLEVEL = 69 | ||
10 | +SUBLEVEL = 70 | ||
11 | EXTRAVERSION = | ||
12 | NAME = "People's Front" | ||
13 | |||
14 | diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c | ||
15 | index bce06083685d..94babc3d0ec2 100644 | ||
16 | --- a/arch/arm64/kernel/cpufeature.c | ||
17 | +++ b/arch/arm64/kernel/cpufeature.c | ||
18 | @@ -165,9 +165,17 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = { | ||
19 | }; | ||
20 | |||
21 | static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = { | ||
22 | - S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN4_SHIFT, 4, ID_AA64MMFR0_TGRAN4_NI), | ||
23 | - S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN64_SHIFT, 4, ID_AA64MMFR0_TGRAN64_NI), | ||
24 | - ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN16_SHIFT, 4, ID_AA64MMFR0_TGRAN16_NI), | ||
25 | + /* | ||
26 | + * We already refuse to boot CPUs that don't support our configured | ||
27 | + * page size, so we can only detect mismatches for a page size other | ||
28 | + * than the one we're currently using. Unfortunately, SoCs like this | ||
29 | + * exist in the wild so, even though we don't like it, we'll have to go | ||
30 | + * along with it and treat them as non-strict. | ||
31 | + */ | ||
32 | + S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN4_SHIFT, 4, ID_AA64MMFR0_TGRAN4_NI), | ||
33 | + S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN64_SHIFT, 4, ID_AA64MMFR0_TGRAN64_NI), | ||
34 | + ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN16_SHIFT, 4, ID_AA64MMFR0_TGRAN16_NI), | ||
35 | + | ||
36 | ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_BIGENDEL0_SHIFT, 4, 0), | ||
37 | /* Linux shouldn't care about secure memory */ | ||
38 | ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_SNSMEM_SHIFT, 4, 0), | ||
39 | diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c | ||
40 | index 9a3f2646ecc7..07a8004c3c23 100644 | ||
41 | --- a/arch/powerpc/kvm/book3s_64_vio.c | ||
42 | +++ b/arch/powerpc/kvm/book3s_64_vio.c | ||
43 | @@ -602,8 +602,10 @@ long kvmppc_h_put_tce_indirect(struct kvm_vcpu *vcpu, | ||
44 | |||
45 | if (kvmppc_gpa_to_ua(vcpu->kvm, | ||
46 | tce & ~(TCE_PCI_READ | TCE_PCI_WRITE), | ||
47 | - &ua, NULL)) | ||
48 | - return H_PARAMETER; | ||
49 | + &ua, NULL)) { | ||
50 | + ret = H_PARAMETER; | ||
51 | + goto unlock_exit; | ||
52 | + } | ||
53 | |||
54 | list_for_each_entry_lockless(stit, &stt->iommu_tables, next) { | ||
55 | ret = kvmppc_tce_iommu_map(vcpu->kvm, stt, | ||
56 | diff --git a/arch/powerpc/kvm/book3s_64_vio_hv.c b/arch/powerpc/kvm/book3s_64_vio_hv.c | ||
57 | index 6821ead4b4eb..eb8b11515a7f 100644 | ||
58 | --- a/arch/powerpc/kvm/book3s_64_vio_hv.c | ||
59 | +++ b/arch/powerpc/kvm/book3s_64_vio_hv.c | ||
60 | @@ -528,8 +528,10 @@ long kvmppc_rm_h_put_tce_indirect(struct kvm_vcpu *vcpu, | ||
61 | ua = 0; | ||
62 | if (kvmppc_gpa_to_ua(vcpu->kvm, | ||
63 | tce & ~(TCE_PCI_READ | TCE_PCI_WRITE), | ||
64 | - &ua, NULL)) | ||
65 | - return H_PARAMETER; | ||
66 | + &ua, NULL)) { | ||
67 | + ret = H_PARAMETER; | ||
68 | + goto unlock_exit; | ||
69 | + } | ||
70 | |||
71 | list_for_each_entry_lockless(stit, &stt->iommu_tables, next) { | ||
72 | ret = kvmppc_rm_tce_iommu_map(vcpu->kvm, stt, | ||
73 | diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c | ||
74 | index b316bd61a6ac..90be3a1506d3 100644 | ||
75 | --- a/arch/x86/kernel/apic/apic.c | ||
76 | +++ b/arch/x86/kernel/apic/apic.c | ||
77 | @@ -1140,6 +1140,10 @@ void clear_local_APIC(void) | ||
78 | apic_write(APIC_LVT0, v | APIC_LVT_MASKED); | ||
79 | v = apic_read(APIC_LVT1); | ||
80 | apic_write(APIC_LVT1, v | APIC_LVT_MASKED); | ||
81 | + if (!x2apic_enabled()) { | ||
82 | + v = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | ||
83 | + apic_write(APIC_LDR, v); | ||
84 | + } | ||
85 | if (maxlvt >= 4) { | ||
86 | v = apic_read(APIC_LVTPC); | ||
87 | apic_write(APIC_LVTPC, v | APIC_LVT_MASKED); | ||
88 | diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c | ||
89 | index afee386ff711..caedd8d60d36 100644 | ||
90 | --- a/arch/x86/kernel/apic/bigsmp_32.c | ||
91 | +++ b/arch/x86/kernel/apic/bigsmp_32.c | ||
92 | @@ -38,32 +38,12 @@ static int bigsmp_early_logical_apicid(int cpu) | ||
93 | return early_per_cpu(x86_cpu_to_apicid, cpu); | ||
94 | } | ||
95 | |||
96 | -static inline unsigned long calculate_ldr(int cpu) | ||
97 | -{ | ||
98 | - unsigned long val, id; | ||
99 | - | ||
100 | - val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | ||
101 | - id = per_cpu(x86_bios_cpu_apicid, cpu); | ||
102 | - val |= SET_APIC_LOGICAL_ID(id); | ||
103 | - | ||
104 | - return val; | ||
105 | -} | ||
106 | - | ||
107 | /* | ||
108 | - * Set up the logical destination ID. | ||
109 | - * | ||
110 | - * Intel recommends to set DFR, LDR and TPR before enabling | ||
111 | - * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
112 | - * document number 292116). So here it goes... | ||
113 | + * bigsmp enables physical destination mode | ||
114 | + * and doesn't use LDR and DFR | ||
115 | */ | ||
116 | static void bigsmp_init_apic_ldr(void) | ||
117 | { | ||
118 | - unsigned long val; | ||
119 | - int cpu = smp_processor_id(); | ||
120 | - | ||
121 | - apic_write(APIC_DFR, APIC_DFR_FLAT); | ||
122 | - val = calculate_ldr(cpu); | ||
123 | - apic_write(APIC_LDR, val); | ||
124 | } | ||
125 | |||
126 | static void bigsmp_setup_apic_routing(void) | ||
127 | diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c | ||
128 | index aeba77881d85..516ec7586a5f 100644 | ||
129 | --- a/arch/x86/kernel/ptrace.c | ||
130 | +++ b/arch/x86/kernel/ptrace.c | ||
131 | @@ -652,11 +652,10 @@ static unsigned long ptrace_get_debugreg(struct task_struct *tsk, int n) | ||
132 | { | ||
133 | struct thread_struct *thread = &tsk->thread; | ||
134 | unsigned long val = 0; | ||
135 | - int index = n; | ||
136 | |||
137 | if (n < HBP_NUM) { | ||
138 | + int index = array_index_nospec(n, HBP_NUM); | ||
139 | struct perf_event *bp = thread->ptrace_bps[index]; | ||
140 | - index = array_index_nospec(index, HBP_NUM); | ||
141 | |||
142 | if (bp) | ||
143 | val = bp->hw.info.address; | ||
144 | diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c | ||
145 | index deb576b23b7c..9119859ba787 100644 | ||
146 | --- a/arch/x86/kernel/uprobes.c | ||
147 | +++ b/arch/x86/kernel/uprobes.c | ||
148 | @@ -521,9 +521,12 @@ struct uprobe_xol_ops { | ||
149 | void (*abort)(struct arch_uprobe *, struct pt_regs *); | ||
150 | }; | ||
151 | |||
152 | -static inline int sizeof_long(void) | ||
153 | +static inline int sizeof_long(struct pt_regs *regs) | ||
154 | { | ||
155 | - return in_ia32_syscall() ? 4 : 8; | ||
156 | + /* | ||
157 | + * Check registers for mode as in_xxx_syscall() does not apply here. | ||
158 | + */ | ||
159 | + return user_64bit_mode(regs) ? 8 : 4; | ||
160 | } | ||
161 | |||
162 | static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) | ||
163 | @@ -534,9 +537,9 @@ static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) | ||
164 | |||
165 | static int emulate_push_stack(struct pt_regs *regs, unsigned long val) | ||
166 | { | ||
167 | - unsigned long new_sp = regs->sp - sizeof_long(); | ||
168 | + unsigned long new_sp = regs->sp - sizeof_long(regs); | ||
169 | |||
170 | - if (copy_to_user((void __user *)new_sp, &val, sizeof_long())) | ||
171 | + if (copy_to_user((void __user *)new_sp, &val, sizeof_long(regs))) | ||
172 | return -EFAULT; | ||
173 | |||
174 | regs->sp = new_sp; | ||
175 | @@ -569,7 +572,7 @@ static int default_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs | ||
176 | long correction = utask->vaddr - utask->xol_vaddr; | ||
177 | regs->ip += correction; | ||
178 | } else if (auprobe->defparam.fixups & UPROBE_FIX_CALL) { | ||
179 | - regs->sp += sizeof_long(); /* Pop incorrect return address */ | ||
180 | + regs->sp += sizeof_long(regs); /* Pop incorrect return address */ | ||
181 | if (emulate_push_stack(regs, utask->vaddr + auprobe->defparam.ilen)) | ||
182 | return -ERESTART; | ||
183 | } | ||
184 | @@ -688,7 +691,7 @@ static int branch_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) | ||
185 | * "call" insn was executed out-of-line. Just restore ->sp and restart. | ||
186 | * We could also restore ->ip and try to call branch_emulate_op() again. | ||
187 | */ | ||
188 | - regs->sp += sizeof_long(); | ||
189 | + regs->sp += sizeof_long(regs); | ||
190 | return -ERESTART; | ||
191 | } | ||
192 | |||
193 | @@ -1068,7 +1071,7 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) | ||
194 | unsigned long | ||
195 | arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs) | ||
196 | { | ||
197 | - int rasize = sizeof_long(), nleft; | ||
198 | + int rasize = sizeof_long(regs), nleft; | ||
199 | unsigned long orig_ret_vaddr = 0; /* clear high bits for 32-bit apps */ | ||
200 | |||
201 | if (copy_from_user(&orig_ret_vaddr, (void __user *)regs->sp, rasize)) | ||
202 | diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c | ||
203 | index 031bd7f91f98..5f5bc5976804 100644 | ||
204 | --- a/arch/x86/kvm/lapic.c | ||
205 | +++ b/arch/x86/kvm/lapic.c | ||
206 | @@ -209,6 +209,9 @@ static void recalculate_apic_map(struct kvm *kvm) | ||
207 | if (!apic_x2apic_mode(apic) && !new->phys_map[xapic_id]) | ||
208 | new->phys_map[xapic_id] = apic; | ||
209 | |||
210 | + if (!kvm_apic_sw_enabled(apic)) | ||
211 | + continue; | ||
212 | + | ||
213 | ldr = kvm_lapic_get_reg(apic, APIC_LDR); | ||
214 | |||
215 | if (apic_x2apic_mode(apic)) { | ||
216 | @@ -252,6 +255,8 @@ static inline void apic_set_spiv(struct kvm_lapic *apic, u32 val) | ||
217 | recalculate_apic_map(apic->vcpu->kvm); | ||
218 | } else | ||
219 | static_key_slow_inc(&apic_sw_disabled.key); | ||
220 | + | ||
221 | + recalculate_apic_map(apic->vcpu->kvm); | ||
222 | } | ||
223 | } | ||
224 | |||
225 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c | ||
226 | index e10a7a42449b..c27ce6059090 100644 | ||
227 | --- a/arch/x86/kvm/x86.c | ||
228 | +++ b/arch/x86/kvm/x86.c | ||
229 | @@ -6308,12 +6308,13 @@ restart: | ||
230 | unsigned long rflags = kvm_x86_ops->get_rflags(vcpu); | ||
231 | toggle_interruptibility(vcpu, ctxt->interruptibility); | ||
232 | vcpu->arch.emulate_regs_need_sync_to_vcpu = false; | ||
233 | - kvm_rip_write(vcpu, ctxt->eip); | ||
234 | - if (r == EMULATE_DONE && ctxt->tf) | ||
235 | - kvm_vcpu_do_singlestep(vcpu, &r); | ||
236 | if (!ctxt->have_exception || | ||
237 | - exception_type(ctxt->exception.vector) == EXCPT_TRAP) | ||
238 | + exception_type(ctxt->exception.vector) == EXCPT_TRAP) { | ||
239 | + kvm_rip_write(vcpu, ctxt->eip); | ||
240 | + if (r == EMULATE_DONE && ctxt->tf) | ||
241 | + kvm_vcpu_do_singlestep(vcpu, &r); | ||
242 | __kvm_set_rflags(vcpu, ctxt->eflags); | ||
243 | + } | ||
244 | |||
245 | /* | ||
246 | * For STI, interrupts are shadowed; so KVM_REQ_EVENT will | ||
247 | diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c | ||
248 | index 3b25a643058c..0b8e2a7d6e93 100644 | ||
249 | --- a/drivers/auxdisplay/panel.c | ||
250 | +++ b/drivers/auxdisplay/panel.c | ||
251 | @@ -1618,6 +1618,8 @@ static void panel_attach(struct parport *port) | ||
252 | return; | ||
253 | |||
254 | err_lcd_unreg: | ||
255 | + if (scan_timer.function) | ||
256 | + del_timer_sync(&scan_timer); | ||
257 | if (lcd.enabled) | ||
258 | charlcd_unregister(lcd.charlcd); | ||
259 | err_unreg_device: | ||
260 | diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c | ||
261 | index a4bc74e72c39..55869b362fdf 100644 | ||
262 | --- a/drivers/block/xen-blkback/xenbus.c | ||
263 | +++ b/drivers/block/xen-blkback/xenbus.c | ||
264 | @@ -974,6 +974,7 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir) | ||
265 | } | ||
266 | blkif->nr_ring_pages = nr_grefs; | ||
267 | |||
268 | + err = -ENOMEM; | ||
269 | for (i = 0; i < nr_grefs * XEN_BLKIF_REQS_PER_PAGE; i++) { | ||
270 | req = kzalloc(sizeof(*req), GFP_KERNEL); | ||
271 | if (!req) | ||
272 | @@ -996,7 +997,7 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir) | ||
273 | err = xen_blkif_map(ring, ring_ref, nr_grefs, evtchn); | ||
274 | if (err) { | ||
275 | xenbus_dev_fatal(dev, err, "mapping ring-ref port %u", evtchn); | ||
276 | - return err; | ||
277 | + goto fail; | ||
278 | } | ||
279 | |||
280 | return 0; | ||
281 | @@ -1016,8 +1017,7 @@ fail: | ||
282 | } | ||
283 | kfree(req); | ||
284 | } | ||
285 | - return -ENOMEM; | ||
286 | - | ||
287 | + return err; | ||
288 | } | ||
289 | |||
290 | static int connect_ring(struct backend_info *be) | ||
291 | diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c | ||
292 | index d5f85455fa62..e31c02dc7770 100644 | ||
293 | --- a/drivers/bus/hisi_lpc.c | ||
294 | +++ b/drivers/bus/hisi_lpc.c | ||
295 | @@ -456,6 +456,17 @@ struct hisi_lpc_acpi_cell { | ||
296 | size_t pdata_size; | ||
297 | }; | ||
298 | |||
299 | +static void hisi_lpc_acpi_remove(struct device *hostdev) | ||
300 | +{ | ||
301 | + struct acpi_device *adev = ACPI_COMPANION(hostdev); | ||
302 | + struct acpi_device *child; | ||
303 | + | ||
304 | + device_for_each_child(hostdev, NULL, hisi_lpc_acpi_remove_subdev); | ||
305 | + | ||
306 | + list_for_each_entry(child, &adev->children, node) | ||
307 | + acpi_device_clear_enumerated(child); | ||
308 | +} | ||
309 | + | ||
310 | /* | ||
311 | * hisi_lpc_acpi_probe - probe children for ACPI FW | ||
312 | * @hostdev: LPC host device pointer | ||
313 | @@ -556,8 +567,7 @@ static int hisi_lpc_acpi_probe(struct device *hostdev) | ||
314 | return 0; | ||
315 | |||
316 | fail: | ||
317 | - device_for_each_child(hostdev, NULL, | ||
318 | - hisi_lpc_acpi_remove_subdev); | ||
319 | + hisi_lpc_acpi_remove(hostdev); | ||
320 | return ret; | ||
321 | } | ||
322 | |||
323 | @@ -570,6 +580,10 @@ static int hisi_lpc_acpi_probe(struct device *dev) | ||
324 | { | ||
325 | return -ENODEV; | ||
326 | } | ||
327 | + | ||
328 | +static void hisi_lpc_acpi_remove(struct device *hostdev) | ||
329 | +{ | ||
330 | +} | ||
331 | #endif // CONFIG_ACPI | ||
332 | |||
333 | /* | ||
334 | @@ -607,24 +621,27 @@ static int hisi_lpc_probe(struct platform_device *pdev) | ||
335 | range->fwnode = dev->fwnode; | ||
336 | range->flags = LOGIC_PIO_INDIRECT; | ||
337 | range->size = PIO_INDIRECT_SIZE; | ||
338 | + range->hostdata = lpcdev; | ||
339 | + range->ops = &hisi_lpc_ops; | ||
340 | + lpcdev->io_host = range; | ||
341 | |||
342 | ret = logic_pio_register_range(range); | ||
343 | if (ret) { | ||
344 | dev_err(dev, "register IO range failed (%d)!\n", ret); | ||
345 | return ret; | ||
346 | } | ||
347 | - lpcdev->io_host = range; | ||
348 | |||
349 | /* register the LPC host PIO resources */ | ||
350 | if (acpi_device) | ||
351 | ret = hisi_lpc_acpi_probe(dev); | ||
352 | else | ||
353 | ret = of_platform_populate(dev->of_node, NULL, NULL, dev); | ||
354 | - if (ret) | ||
355 | + if (ret) { | ||
356 | + logic_pio_unregister_range(range); | ||
357 | return ret; | ||
358 | + } | ||
359 | |||
360 | - lpcdev->io_host->hostdata = lpcdev; | ||
361 | - lpcdev->io_host->ops = &hisi_lpc_ops; | ||
362 | + dev_set_drvdata(dev, lpcdev); | ||
363 | |||
364 | io_end = lpcdev->io_host->io_start + lpcdev->io_host->size; | ||
365 | dev_info(dev, "registered range [%pa - %pa]\n", | ||
366 | @@ -633,6 +650,23 @@ static int hisi_lpc_probe(struct platform_device *pdev) | ||
367 | return ret; | ||
368 | } | ||
369 | |||
370 | +static int hisi_lpc_remove(struct platform_device *pdev) | ||
371 | +{ | ||
372 | + struct device *dev = &pdev->dev; | ||
373 | + struct acpi_device *acpi_device = ACPI_COMPANION(dev); | ||
374 | + struct hisi_lpc_dev *lpcdev = dev_get_drvdata(dev); | ||
375 | + struct logic_pio_hwaddr *range = lpcdev->io_host; | ||
376 | + | ||
377 | + if (acpi_device) | ||
378 | + hisi_lpc_acpi_remove(dev); | ||
379 | + else | ||
380 | + of_platform_depopulate(dev); | ||
381 | + | ||
382 | + logic_pio_unregister_range(range); | ||
383 | + | ||
384 | + return 0; | ||
385 | +} | ||
386 | + | ||
387 | static const struct of_device_id hisi_lpc_of_match[] = { | ||
388 | { .compatible = "hisilicon,hip06-lpc", }, | ||
389 | { .compatible = "hisilicon,hip07-lpc", }, | ||
390 | @@ -646,5 +680,6 @@ static struct platform_driver hisi_lpc_driver = { | ||
391 | .acpi_match_table = ACPI_PTR(hisi_lpc_acpi_match), | ||
392 | }, | ||
393 | .probe = hisi_lpc_probe, | ||
394 | + .remove = hisi_lpc_remove, | ||
395 | }; | ||
396 | builtin_platform_driver(hisi_lpc_driver); | ||
397 | diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c | ||
398 | index 9b6d8972a565..b8c94a01cfc9 100644 | ||
399 | --- a/drivers/crypto/ccp/ccp-dev.c | ||
400 | +++ b/drivers/crypto/ccp/ccp-dev.c | ||
401 | @@ -543,6 +543,10 @@ int ccp_dev_suspend(struct sp_device *sp, pm_message_t state) | ||
402 | unsigned long flags; | ||
403 | unsigned int i; | ||
404 | |||
405 | + /* If there's no device there's nothing to do */ | ||
406 | + if (!ccp) | ||
407 | + return 0; | ||
408 | + | ||
409 | spin_lock_irqsave(&ccp->cmd_lock, flags); | ||
410 | |||
411 | ccp->suspending = 1; | ||
412 | @@ -567,6 +571,10 @@ int ccp_dev_resume(struct sp_device *sp) | ||
413 | unsigned long flags; | ||
414 | unsigned int i; | ||
415 | |||
416 | + /* If there's no device there's nothing to do */ | ||
417 | + if (!ccp) | ||
418 | + return 0; | ||
419 | + | ||
420 | spin_lock_irqsave(&ccp->cmd_lock, flags); | ||
421 | |||
422 | ccp->suspending = 0; | ||
423 | diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c | ||
424 | index f4edfc56f34e..3d55405c49ca 100644 | ||
425 | --- a/drivers/dma/ste_dma40.c | ||
426 | +++ b/drivers/dma/ste_dma40.c | ||
427 | @@ -142,7 +142,7 @@ enum d40_events { | ||
428 | * when the DMA hw is powered off. | ||
429 | * TODO: Add save/restore of D40_DREG_GCC on dma40 v3 or later, if that works. | ||
430 | */ | ||
431 | -static u32 d40_backup_regs[] = { | ||
432 | +static __maybe_unused u32 d40_backup_regs[] = { | ||
433 | D40_DREG_LCPA, | ||
434 | D40_DREG_LCLA, | ||
435 | D40_DREG_PRMSE, | ||
436 | @@ -211,7 +211,7 @@ static u32 d40_backup_regs_v4b[] = { | ||
437 | |||
438 | #define BACKUP_REGS_SZ_V4B ARRAY_SIZE(d40_backup_regs_v4b) | ||
439 | |||
440 | -static u32 d40_backup_regs_chan[] = { | ||
441 | +static __maybe_unused u32 d40_backup_regs_chan[] = { | ||
442 | D40_CHAN_REG_SSCFG, | ||
443 | D40_CHAN_REG_SSELT, | ||
444 | D40_CHAN_REG_SSPTR, | ||
445 | diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c | ||
446 | index 06dd1725375e..8c3c3e5b812a 100644 | ||
447 | --- a/drivers/dma/stm32-mdma.c | ||
448 | +++ b/drivers/dma/stm32-mdma.c | ||
449 | @@ -1376,7 +1376,7 @@ static irqreturn_t stm32_mdma_irq_handler(int irq, void *devid) | ||
450 | |||
451 | chan = &dmadev->chan[id]; | ||
452 | if (!chan) { | ||
453 | - dev_err(chan2dev(chan), "MDMA channel not initialized\n"); | ||
454 | + dev_dbg(mdma2dev(dmadev), "MDMA channel not initialized\n"); | ||
455 | goto exit; | ||
456 | } | ||
457 | |||
458 | diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c | ||
459 | index a4a931ddf6f6..aeb9c29e5255 100644 | ||
460 | --- a/drivers/dma/ti/omap-dma.c | ||
461 | +++ b/drivers/dma/ti/omap-dma.c | ||
462 | @@ -1237,7 +1237,7 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_interleaved( | ||
463 | if (src_icg) { | ||
464 | d->ccr |= CCR_SRC_AMODE_DBLIDX; | ||
465 | d->ei = 1; | ||
466 | - d->fi = src_icg; | ||
467 | + d->fi = src_icg + 1; | ||
468 | } else if (xt->src_inc) { | ||
469 | d->ccr |= CCR_SRC_AMODE_POSTINC; | ||
470 | d->fi = 0; | ||
471 | @@ -1252,7 +1252,7 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_interleaved( | ||
472 | if (dst_icg) { | ||
473 | d->ccr |= CCR_DST_AMODE_DBLIDX; | ||
474 | sg->ei = 1; | ||
475 | - sg->fi = dst_icg; | ||
476 | + sg->fi = dst_icg + 1; | ||
477 | } else if (xt->dst_inc) { | ||
478 | d->ccr |= CCR_DST_AMODE_POSTINC; | ||
479 | sg->fi = 0; | ||
480 | diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c | ||
481 | index df94021dd9d1..fdc0e458dbaa 100644 | ||
482 | --- a/drivers/fsi/fsi-scom.c | ||
483 | +++ b/drivers/fsi/fsi-scom.c | ||
484 | @@ -47,8 +47,7 @@ | ||
485 | #define SCOM_STATUS_PIB_RESP_MASK 0x00007000 | ||
486 | #define SCOM_STATUS_PIB_RESP_SHIFT 12 | ||
487 | |||
488 | -#define SCOM_STATUS_ANY_ERR (SCOM_STATUS_ERR_SUMMARY | \ | ||
489 | - SCOM_STATUS_PROTECTION | \ | ||
490 | +#define SCOM_STATUS_ANY_ERR (SCOM_STATUS_PROTECTION | \ | ||
491 | SCOM_STATUS_PARITY | \ | ||
492 | SCOM_STATUS_PIB_ABORT | \ | ||
493 | SCOM_STATUS_PIB_RESP_MASK) | ||
494 | @@ -260,11 +259,6 @@ static int handle_fsi2pib_status(struct scom_device *scom, uint32_t status) | ||
495 | /* Return -EBUSY on PIB abort to force a retry */ | ||
496 | if (status & SCOM_STATUS_PIB_ABORT) | ||
497 | return -EBUSY; | ||
498 | - if (status & SCOM_STATUS_ERR_SUMMARY) { | ||
499 | - fsi_device_write(scom->fsi_dev, SCOM_FSI2PIB_RESET_REG, &dummy, | ||
500 | - sizeof(uint32_t)); | ||
501 | - return -EIO; | ||
502 | - } | ||
503 | return 0; | ||
504 | } | ||
505 | |||
506 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | ||
507 | index 92b11de19581..354c8b6106dc 100644 | ||
508 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | ||
509 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | ||
510 | @@ -575,6 +575,7 @@ static const struct amdgpu_px_quirk amdgpu_px_quirk_list[] = { | ||
511 | { 0x1002, 0x6900, 0x1002, 0x0124, AMDGPU_PX_QUIRK_FORCE_ATPX }, | ||
512 | { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX }, | ||
513 | { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX }, | ||
514 | + { 0x1002, 0x699f, 0x1028, 0x0814, AMDGPU_PX_QUIRK_FORCE_ATPX }, | ||
515 | { 0x1002, 0x6900, 0x1025, 0x125A, AMDGPU_PX_QUIRK_FORCE_ATPX }, | ||
516 | { 0x1002, 0x6900, 0x17AA, 0x3806, AMDGPU_PX_QUIRK_FORCE_ATPX }, | ||
517 | { 0, 0, 0, 0, 0 }, | ||
518 | diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c | ||
519 | index 373700c05a00..224fa1ef87ff 100644 | ||
520 | --- a/drivers/gpu/drm/ast/ast_main.c | ||
521 | +++ b/drivers/gpu/drm/ast/ast_main.c | ||
522 | @@ -131,8 +131,8 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) | ||
523 | |||
524 | |||
525 | /* Enable extended register access */ | ||
526 | - ast_enable_mmio(dev); | ||
527 | ast_open_key(ast); | ||
528 | + ast_enable_mmio(dev); | ||
529 | |||
530 | /* Find out whether P2A works or whether to use device-tree */ | ||
531 | ast_detect_config_mode(dev, &scu_rev); | ||
532 | @@ -576,6 +576,9 @@ void ast_driver_unload(struct drm_device *dev) | ||
533 | { | ||
534 | struct ast_private *ast = dev->dev_private; | ||
535 | |||
536 | + /* enable standard VGA decode */ | ||
537 | + ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04); | ||
538 | + | ||
539 | ast_release_firmware(dev); | ||
540 | kfree(ast->dp501_fw_addr); | ||
541 | ast_mode_fini(dev); | ||
542 | diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c | ||
543 | index 8bb355d5d43d..9d92d2d2fcfc 100644 | ||
544 | --- a/drivers/gpu/drm/ast/ast_mode.c | ||
545 | +++ b/drivers/gpu/drm/ast/ast_mode.c | ||
546 | @@ -600,7 +600,7 @@ static int ast_crtc_mode_set(struct drm_crtc *crtc, | ||
547 | return -EINVAL; | ||
548 | ast_open_key(ast); | ||
549 | |||
550 | - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x04); | ||
551 | + ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06); | ||
552 | |||
553 | ast_set_std_reg(crtc, adjusted_mode, &vbios_mode); | ||
554 | ast_set_crtc_reg(crtc, adjusted_mode, &vbios_mode); | ||
555 | diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c | ||
556 | index f7d421359d56..c1d1ac51d1c2 100644 | ||
557 | --- a/drivers/gpu/drm/ast/ast_post.c | ||
558 | +++ b/drivers/gpu/drm/ast/ast_post.c | ||
559 | @@ -46,7 +46,7 @@ void ast_enable_mmio(struct drm_device *dev) | ||
560 | { | ||
561 | struct ast_private *ast = dev->dev_private; | ||
562 | |||
563 | - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x04); | ||
564 | + ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06); | ||
565 | } | ||
566 | |||
567 | |||
568 | diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c | ||
569 | index c3e32138c6bb..9dc109df0808 100644 | ||
570 | --- a/drivers/gpu/drm/bridge/ti-tfp410.c | ||
571 | +++ b/drivers/gpu/drm/bridge/ti-tfp410.c | ||
572 | @@ -64,7 +64,12 @@ static int tfp410_get_modes(struct drm_connector *connector) | ||
573 | |||
574 | drm_connector_update_edid_property(connector, edid); | ||
575 | |||
576 | - return drm_add_edid_modes(connector, edid); | ||
577 | + ret = drm_add_edid_modes(connector, edid); | ||
578 | + | ||
579 | + kfree(edid); | ||
580 | + | ||
581 | + return ret; | ||
582 | + | ||
583 | fallback: | ||
584 | /* No EDID, fallback on the XGA standard modes */ | ||
585 | ret = drm_add_modes_noedid(connector, 1920, 1200); | ||
586 | diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c | ||
587 | index f8cfd16be534..a4b4ab7b9f8e 100644 | ||
588 | --- a/drivers/gpu/drm/i915/i915_drv.c | ||
589 | +++ b/drivers/gpu/drm/i915/i915_drv.c | ||
590 | @@ -1120,6 +1120,12 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv) | ||
591 | |||
592 | pci_set_master(pdev); | ||
593 | |||
594 | + /* | ||
595 | + * We don't have a max segment size, so set it to the max so sg's | ||
596 | + * debugging layer doesn't complain | ||
597 | + */ | ||
598 | + dma_set_max_seg_size(&pdev->dev, UINT_MAX); | ||
599 | + | ||
600 | /* overlay on gen2 is broken and can't address above 1G */ | ||
601 | if (IS_GEN2(dev_priv)) { | ||
602 | ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(30)); | ||
603 | diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c | ||
604 | index 869cf4a3b6de..a6cb3e034dd5 100644 | ||
605 | --- a/drivers/gpu/drm/i915/i915_vgpu.c | ||
606 | +++ b/drivers/gpu/drm/i915/i915_vgpu.c | ||
607 | @@ -100,6 +100,9 @@ static struct _balloon_info_ bl_info; | ||
608 | static void vgt_deballoon_space(struct i915_ggtt *ggtt, | ||
609 | struct drm_mm_node *node) | ||
610 | { | ||
611 | + if (!drm_mm_node_allocated(node)) | ||
612 | + return; | ||
613 | + | ||
614 | DRM_DEBUG_DRIVER("deballoon space: range [0x%llx - 0x%llx] %llu KiB.\n", | ||
615 | node->start, | ||
616 | node->start + node->size, | ||
617 | diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c | ||
618 | index 0ef0c6448d53..01fa98299bae 100644 | ||
619 | --- a/drivers/gpu/drm/i915/intel_device_info.c | ||
620 | +++ b/drivers/gpu/drm/i915/intel_device_info.c | ||
621 | @@ -474,7 +474,7 @@ static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv) | ||
622 | u8 eu_disabled_mask; | ||
623 | u32 n_disabled; | ||
624 | |||
625 | - if (!(sseu->subslice_mask[ss] & BIT(ss))) | ||
626 | + if (!(sseu->subslice_mask[s] & BIT(ss))) | ||
627 | /* skip disabled subslice */ | ||
628 | continue; | ||
629 | |||
630 | diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c | ||
631 | index 0fb300d41a09..e1868776da25 100644 | ||
632 | --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c | ||
633 | +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c | ||
634 | @@ -184,6 +184,12 @@ static void tilcdc_fini(struct drm_device *dev) | ||
635 | { | ||
636 | struct tilcdc_drm_private *priv = dev->dev_private; | ||
637 | |||
638 | +#ifdef CONFIG_CPU_FREQ | ||
639 | + if (priv->freq_transition.notifier_call) | ||
640 | + cpufreq_unregister_notifier(&priv->freq_transition, | ||
641 | + CPUFREQ_TRANSITION_NOTIFIER); | ||
642 | +#endif | ||
643 | + | ||
644 | if (priv->crtc) | ||
645 | tilcdc_crtc_shutdown(priv->crtc); | ||
646 | |||
647 | @@ -198,12 +204,6 @@ static void tilcdc_fini(struct drm_device *dev) | ||
648 | drm_mode_config_cleanup(dev); | ||
649 | tilcdc_remove_external_device(dev); | ||
650 | |||
651 | -#ifdef CONFIG_CPU_FREQ | ||
652 | - if (priv->freq_transition.notifier_call) | ||
653 | - cpufreq_unregister_notifier(&priv->freq_transition, | ||
654 | - CPUFREQ_TRANSITION_NOTIFIER); | ||
655 | -#endif | ||
656 | - | ||
657 | if (priv->clk) | ||
658 | clk_put(priv->clk); | ||
659 | |||
660 | @@ -274,17 +274,6 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev) | ||
661 | goto init_failed; | ||
662 | } | ||
663 | |||
664 | -#ifdef CONFIG_CPU_FREQ | ||
665 | - priv->freq_transition.notifier_call = cpufreq_transition; | ||
666 | - ret = cpufreq_register_notifier(&priv->freq_transition, | ||
667 | - CPUFREQ_TRANSITION_NOTIFIER); | ||
668 | - if (ret) { | ||
669 | - dev_err(dev, "failed to register cpufreq notifier\n"); | ||
670 | - priv->freq_transition.notifier_call = NULL; | ||
671 | - goto init_failed; | ||
672 | - } | ||
673 | -#endif | ||
674 | - | ||
675 | if (of_property_read_u32(node, "max-bandwidth", &priv->max_bandwidth)) | ||
676 | priv->max_bandwidth = TILCDC_DEFAULT_MAX_BANDWIDTH; | ||
677 | |||
678 | @@ -361,6 +350,17 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev) | ||
679 | } | ||
680 | modeset_init(ddev); | ||
681 | |||
682 | +#ifdef CONFIG_CPU_FREQ | ||
683 | + priv->freq_transition.notifier_call = cpufreq_transition; | ||
684 | + ret = cpufreq_register_notifier(&priv->freq_transition, | ||
685 | + CPUFREQ_TRANSITION_NOTIFIER); | ||
686 | + if (ret) { | ||
687 | + dev_err(dev, "failed to register cpufreq notifier\n"); | ||
688 | + priv->freq_transition.notifier_call = NULL; | ||
689 | + goto init_failed; | ||
690 | + } | ||
691 | +#endif | ||
692 | + | ||
693 | if (priv->is_componentized) { | ||
694 | ret = component_bind_all(dev, ddev); | ||
695 | if (ret < 0) | ||
696 | diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c | ||
697 | index e759ac0d48be..968319f4e5f1 100644 | ||
698 | --- a/drivers/hwtracing/intel_th/pci.c | ||
699 | +++ b/drivers/hwtracing/intel_th/pci.c | ||
700 | @@ -140,6 +140,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { | ||
701 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa1a6), | ||
702 | .driver_data = (kernel_ulong_t)0, | ||
703 | }, | ||
704 | + { | ||
705 | + /* Lewisburg PCH */ | ||
706 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa226), | ||
707 | + .driver_data = (kernel_ulong_t)0, | ||
708 | + }, | ||
709 | { | ||
710 | /* Gemini Lake */ | ||
711 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x318e), | ||
712 | @@ -175,6 +180,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { | ||
713 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x45c5), | ||
714 | .driver_data = (kernel_ulong_t)&intel_th_2x, | ||
715 | }, | ||
716 | + { | ||
717 | + /* Tiger Lake PCH */ | ||
718 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa0a6), | ||
719 | + .driver_data = (kernel_ulong_t)&intel_th_2x, | ||
720 | + }, | ||
721 | { 0 }, | ||
722 | }; | ||
723 | |||
724 | diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c | ||
725 | index 9ec9197edffa..eeba421dc823 100644 | ||
726 | --- a/drivers/hwtracing/stm/core.c | ||
727 | +++ b/drivers/hwtracing/stm/core.c | ||
728 | @@ -1098,7 +1098,6 @@ int stm_source_register_device(struct device *parent, | ||
729 | |||
730 | err: | ||
731 | put_device(&src->dev); | ||
732 | - kfree(src); | ||
733 | |||
734 | return err; | ||
735 | } | ||
736 | diff --git a/drivers/i2c/busses/i2c-emev2.c b/drivers/i2c/busses/i2c-emev2.c | ||
737 | index 35b302d983e0..959d4912ec0d 100644 | ||
738 | --- a/drivers/i2c/busses/i2c-emev2.c | ||
739 | +++ b/drivers/i2c/busses/i2c-emev2.c | ||
740 | @@ -69,6 +69,7 @@ struct em_i2c_device { | ||
741 | struct completion msg_done; | ||
742 | struct clk *sclk; | ||
743 | struct i2c_client *slave; | ||
744 | + int irq; | ||
745 | }; | ||
746 | |||
747 | static inline void em_clear_set_bit(struct em_i2c_device *priv, u8 clear, u8 set, u8 reg) | ||
748 | @@ -339,6 +340,12 @@ static int em_i2c_unreg_slave(struct i2c_client *slave) | ||
749 | |||
750 | writeb(0, priv->base + I2C_OFS_SVA0); | ||
751 | |||
752 | + /* | ||
753 | + * Wait for interrupt to finish. New slave irqs cannot happen because we | ||
754 | + * cleared the slave address and, thus, only extension codes will be | ||
755 | + * detected which do not use the slave ptr. | ||
756 | + */ | ||
757 | + synchronize_irq(priv->irq); | ||
758 | priv->slave = NULL; | ||
759 | |||
760 | return 0; | ||
761 | @@ -355,7 +362,7 @@ static int em_i2c_probe(struct platform_device *pdev) | ||
762 | { | ||
763 | struct em_i2c_device *priv; | ||
764 | struct resource *r; | ||
765 | - int irq, ret; | ||
766 | + int ret; | ||
767 | |||
768 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); | ||
769 | if (!priv) | ||
770 | @@ -390,8 +397,8 @@ static int em_i2c_probe(struct platform_device *pdev) | ||
771 | |||
772 | em_i2c_reset(&priv->adap); | ||
773 | |||
774 | - irq = platform_get_irq(pdev, 0); | ||
775 | - ret = devm_request_irq(&pdev->dev, irq, em_i2c_irq_handler, 0, | ||
776 | + priv->irq = platform_get_irq(pdev, 0); | ||
777 | + ret = devm_request_irq(&pdev->dev, priv->irq, em_i2c_irq_handler, 0, | ||
778 | "em_i2c", priv); | ||
779 | if (ret) | ||
780 | goto err_clk; | ||
781 | @@ -401,7 +408,8 @@ static int em_i2c_probe(struct platform_device *pdev) | ||
782 | if (ret) | ||
783 | goto err_clk; | ||
784 | |||
785 | - dev_info(&pdev->dev, "Added i2c controller %d, irq %d\n", priv->adap.nr, irq); | ||
786 | + dev_info(&pdev->dev, "Added i2c controller %d, irq %d\n", priv->adap.nr, | ||
787 | + priv->irq); | ||
788 | |||
789 | return 0; | ||
790 | |||
791 | diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c | ||
792 | index 90946a8b9a75..9ff3371ec385 100644 | ||
793 | --- a/drivers/i2c/busses/i2c-piix4.c | ||
794 | +++ b/drivers/i2c/busses/i2c-piix4.c | ||
795 | @@ -98,7 +98,7 @@ | ||
796 | #define SB800_PIIX4_PORT_IDX_MASK 0x06 | ||
797 | #define SB800_PIIX4_PORT_IDX_SHIFT 1 | ||
798 | |||
799 | -/* On kerncz, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */ | ||
800 | +/* On kerncz and Hudson2, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */ | ||
801 | #define SB800_PIIX4_PORT_IDX_KERNCZ 0x02 | ||
802 | #define SB800_PIIX4_PORT_IDX_MASK_KERNCZ 0x18 | ||
803 | #define SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ 3 | ||
804 | @@ -362,18 +362,16 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, | ||
805 | |||
806 | /* Find which register is used for port selection */ | ||
807 | if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD) { | ||
808 | - switch (PIIX4_dev->device) { | ||
809 | - case PCI_DEVICE_ID_AMD_KERNCZ_SMBUS: | ||
810 | + if (PIIX4_dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS || | ||
811 | + (PIIX4_dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS && | ||
812 | + PIIX4_dev->revision >= 0x1F)) { | ||
813 | piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_KERNCZ; | ||
814 | piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK_KERNCZ; | ||
815 | piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ; | ||
816 | - break; | ||
817 | - case PCI_DEVICE_ID_AMD_HUDSON2_SMBUS: | ||
818 | - default: | ||
819 | + } else { | ||
820 | piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_ALT; | ||
821 | piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK; | ||
822 | piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT; | ||
823 | - break; | ||
824 | } | ||
825 | } else { | ||
826 | if (!request_muxed_region(SB800_PIIX4_SMB_IDX, 2, | ||
827 | diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c | ||
828 | index 254e6219e538..2c29f901d309 100644 | ||
829 | --- a/drivers/i2c/busses/i2c-rcar.c | ||
830 | +++ b/drivers/i2c/busses/i2c-rcar.c | ||
831 | @@ -139,6 +139,7 @@ struct rcar_i2c_priv { | ||
832 | enum dma_data_direction dma_direction; | ||
833 | |||
834 | struct reset_control *rstc; | ||
835 | + int irq; | ||
836 | }; | ||
837 | |||
838 | #define rcar_i2c_priv_to_dev(p) ((p)->adap.dev.parent) | ||
839 | @@ -859,9 +860,11 @@ static int rcar_unreg_slave(struct i2c_client *slave) | ||
840 | |||
841 | WARN_ON(!priv->slave); | ||
842 | |||
843 | + /* disable irqs and ensure none is running before clearing ptr */ | ||
844 | rcar_i2c_write(priv, ICSIER, 0); | ||
845 | rcar_i2c_write(priv, ICSCR, 0); | ||
846 | |||
847 | + synchronize_irq(priv->irq); | ||
848 | priv->slave = NULL; | ||
849 | |||
850 | pm_runtime_put(rcar_i2c_priv_to_dev(priv)); | ||
851 | @@ -916,7 +919,7 @@ static int rcar_i2c_probe(struct platform_device *pdev) | ||
852 | struct i2c_adapter *adap; | ||
853 | struct device *dev = &pdev->dev; | ||
854 | struct i2c_timings i2c_t; | ||
855 | - int irq, ret; | ||
856 | + int ret; | ||
857 | |||
858 | priv = devm_kzalloc(dev, sizeof(struct rcar_i2c_priv), GFP_KERNEL); | ||
859 | if (!priv) | ||
860 | @@ -979,10 +982,10 @@ static int rcar_i2c_probe(struct platform_device *pdev) | ||
861 | pm_runtime_put(dev); | ||
862 | |||
863 | |||
864 | - irq = platform_get_irq(pdev, 0); | ||
865 | - ret = devm_request_irq(dev, irq, rcar_i2c_irq, 0, dev_name(dev), priv); | ||
866 | + priv->irq = platform_get_irq(pdev, 0); | ||
867 | + ret = devm_request_irq(dev, priv->irq, rcar_i2c_irq, 0, dev_name(dev), priv); | ||
868 | if (ret < 0) { | ||
869 | - dev_err(dev, "cannot get irq %d\n", irq); | ||
870 | + dev_err(dev, "cannot get irq %d\n", priv->irq); | ||
871 | goto out_pm_disable; | ||
872 | } | ||
873 | |||
874 | diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c | ||
875 | index 511ff9a1d6d9..f9dbb064f957 100644 | ||
876 | --- a/drivers/iommu/dma-iommu.c | ||
877 | +++ b/drivers/iommu/dma-iommu.c | ||
878 | @@ -675,7 +675,7 @@ static int __finalise_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
879 | * - and wouldn't make the resulting output segment too long | ||
880 | */ | ||
881 | if (cur_len && !s_iova_off && (dma_addr & seg_mask) && | ||
882 | - (cur_len + s_length <= max_len)) { | ||
883 | + (max_len - cur_len >= s_length)) { | ||
884 | /* ...then concatenate it with the previous one */ | ||
885 | cur_len += s_length; | ||
886 | } else { | ||
887 | diff --git a/drivers/media/platform/omap/omap_vout_vrfb.c b/drivers/media/platform/omap/omap_vout_vrfb.c | ||
888 | index 29e3f5da59c1..11ec048929e8 100644 | ||
889 | --- a/drivers/media/platform/omap/omap_vout_vrfb.c | ||
890 | +++ b/drivers/media/platform/omap/omap_vout_vrfb.c | ||
891 | @@ -253,8 +253,7 @@ int omap_vout_prepare_vrfb(struct omap_vout_device *vout, | ||
892 | */ | ||
893 | |||
894 | pixsize = vout->bpp * vout->vrfb_bpp; | ||
895 | - dst_icg = ((MAX_PIXELS_PER_LINE * pixsize) - | ||
896 | - (vout->pix.width * vout->bpp)) + 1; | ||
897 | + dst_icg = MAX_PIXELS_PER_LINE * pixsize - vout->pix.width * vout->bpp; | ||
898 | |||
899 | xt->src_start = vout->buf_phy_addr[vb->i]; | ||
900 | xt->dst_start = vout->vrfb_context[vb->i].paddr[0]; | ||
901 | diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h | ||
902 | index 225373e4a9ef..cdd7af16d5ee 100644 | ||
903 | --- a/drivers/misc/mei/hw-me-regs.h | ||
904 | +++ b/drivers/misc/mei/hw-me-regs.h | ||
905 | @@ -141,6 +141,8 @@ | ||
906 | |||
907 | #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */ | ||
908 | |||
909 | +#define MEI_DEV_ID_TGP_LP 0xA0E0 /* Tiger Lake Point LP */ | ||
910 | + | ||
911 | #define MEI_DEV_ID_MCC 0x4B70 /* Mule Creek Canyon (EHL) */ | ||
912 | #define MEI_DEV_ID_MCC_4 0x4B75 /* Mule Creek Canyon 4 (EHL) */ | ||
913 | |||
914 | diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c | ||
915 | index a66ebceea408..e41f9e0a3fdf 100644 | ||
916 | --- a/drivers/misc/mei/pci-me.c | ||
917 | +++ b/drivers/misc/mei/pci-me.c | ||
918 | @@ -107,6 +107,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = { | ||
919 | |||
920 | {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)}, | ||
921 | |||
922 | + {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH12_CFG)}, | ||
923 | + | ||
924 | {MEI_PCI_DEVICE(MEI_DEV_ID_MCC, MEI_ME_PCH12_CFG)}, | ||
925 | {MEI_PCI_DEVICE(MEI_DEV_ID_MCC_4, MEI_ME_PCH8_CFG)}, | ||
926 | |||
927 | diff --git a/drivers/misc/vmw_vmci/vmci_doorbell.c b/drivers/misc/vmw_vmci/vmci_doorbell.c | ||
928 | index b3fa738ae005..f005206d9033 100644 | ||
929 | --- a/drivers/misc/vmw_vmci/vmci_doorbell.c | ||
930 | +++ b/drivers/misc/vmw_vmci/vmci_doorbell.c | ||
931 | @@ -318,7 +318,8 @@ int vmci_dbell_host_context_notify(u32 src_cid, struct vmci_handle handle) | ||
932 | |||
933 | entry = container_of(resource, struct dbell_entry, resource); | ||
934 | if (entry->run_delayed) { | ||
935 | - schedule_work(&entry->work); | ||
936 | + if (!schedule_work(&entry->work)) | ||
937 | + vmci_resource_put(resource); | ||
938 | } else { | ||
939 | entry->notify_cb(entry->client_data); | ||
940 | vmci_resource_put(resource); | ||
941 | @@ -366,7 +367,8 @@ static void dbell_fire_entries(u32 notify_idx) | ||
942 | atomic_read(&dbell->active) == 1) { | ||
943 | if (dbell->run_delayed) { | ||
944 | vmci_resource_get(&dbell->resource); | ||
945 | - schedule_work(&dbell->work); | ||
946 | + if (!schedule_work(&dbell->work)) | ||
947 | + vmci_resource_put(&dbell->resource); | ||
948 | } else { | ||
949 | dbell->notify_cb(dbell->client_data); | ||
950 | } | ||
951 | diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c | ||
952 | index cfb8ee24eaba..04738359ec02 100644 | ||
953 | --- a/drivers/mmc/core/sd.c | ||
954 | +++ b/drivers/mmc/core/sd.c | ||
955 | @@ -1277,6 +1277,12 @@ int mmc_attach_sd(struct mmc_host *host) | ||
956 | goto err; | ||
957 | } | ||
958 | |||
959 | + /* | ||
960 | + * Some SD cards claims an out of spec VDD voltage range. Let's treat | ||
961 | + * these bits as being in-valid and especially also bit7. | ||
962 | + */ | ||
963 | + ocr &= ~0x7FFF; | ||
964 | + | ||
965 | rocr = mmc_select_voltage(host, ocr); | ||
966 | |||
967 | /* | ||
968 | diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c | ||
969 | index 682c573e20a7..e284102c16e9 100644 | ||
970 | --- a/drivers/mmc/host/sdhci-of-at91.c | ||
971 | +++ b/drivers/mmc/host/sdhci-of-at91.c | ||
972 | @@ -365,6 +365,9 @@ static int sdhci_at91_probe(struct platform_device *pdev) | ||
973 | pm_runtime_set_autosuspend_delay(&pdev->dev, 50); | ||
974 | pm_runtime_use_autosuspend(&pdev->dev); | ||
975 | |||
976 | + /* HS200 is broken at this moment */ | ||
977 | + host->quirks2 = SDHCI_QUIRK2_BROKEN_HS200; | ||
978 | + | ||
979 | ret = sdhci_add_host(host); | ||
980 | if (ret) | ||
981 | goto pm_runtime_disable; | ||
982 | diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c | ||
983 | index 0a3e046d78db..da2ba51dec35 100644 | ||
984 | --- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c | ||
985 | +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c | ||
986 | @@ -369,7 +369,7 @@ static void mt76x0_stop_hardware(struct mt76x0_dev *dev) | ||
987 | mt76x0_chip_onoff(dev, false, false); | ||
988 | } | ||
989 | |||
990 | -int mt76x0_init_hardware(struct mt76x0_dev *dev) | ||
991 | +int mt76x0_init_hardware(struct mt76x0_dev *dev, bool reset) | ||
992 | { | ||
993 | static const u16 beacon_offsets[16] = { | ||
994 | /* 512 byte per beacon */ | ||
995 | @@ -382,7 +382,7 @@ int mt76x0_init_hardware(struct mt76x0_dev *dev) | ||
996 | |||
997 | dev->beacon_offsets = beacon_offsets; | ||
998 | |||
999 | - mt76x0_chip_onoff(dev, true, true); | ||
1000 | + mt76x0_chip_onoff(dev, true, reset); | ||
1001 | |||
1002 | ret = mt76x0_wait_asic_ready(dev); | ||
1003 | if (ret) | ||
1004 | diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | ||
1005 | index fc9857f61771..f9dfe5097b09 100644 | ||
1006 | --- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | ||
1007 | +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | ||
1008 | @@ -279,7 +279,7 @@ void mt76x0_addr_wr(struct mt76x0_dev *dev, const u32 offset, const u8 *addr); | ||
1009 | |||
1010 | /* Init */ | ||
1011 | struct mt76x0_dev *mt76x0_alloc_device(struct device *dev); | ||
1012 | -int mt76x0_init_hardware(struct mt76x0_dev *dev); | ||
1013 | +int mt76x0_init_hardware(struct mt76x0_dev *dev, bool reset); | ||
1014 | int mt76x0_register_device(struct mt76x0_dev *dev); | ||
1015 | void mt76x0_cleanup(struct mt76x0_dev *dev); | ||
1016 | void mt76x0_chip_onoff(struct mt76x0_dev *dev, bool enable, bool reset); | ||
1017 | diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c | ||
1018 | index 54ae1f113be2..5aacb1f6a841 100644 | ||
1019 | --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c | ||
1020 | +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c | ||
1021 | @@ -300,7 +300,7 @@ static int mt76x0_probe(struct usb_interface *usb_intf, | ||
1022 | if (!(mt76_rr(dev, MT_EFUSE_CTRL) & MT_EFUSE_CTRL_SEL)) | ||
1023 | dev_warn(dev->mt76.dev, "Warning: eFUSE not present\n"); | ||
1024 | |||
1025 | - ret = mt76x0_init_hardware(dev); | ||
1026 | + ret = mt76x0_init_hardware(dev, true); | ||
1027 | if (ret) | ||
1028 | goto err; | ||
1029 | |||
1030 | @@ -354,7 +354,7 @@ static int mt76x0_resume(struct usb_interface *usb_intf) | ||
1031 | struct mt76x0_dev *dev = usb_get_intfdata(usb_intf); | ||
1032 | int ret; | ||
1033 | |||
1034 | - ret = mt76x0_init_hardware(dev); | ||
1035 | + ret = mt76x0_init_hardware(dev, false); | ||
1036 | if (ret) | ||
1037 | return ret; | ||
1038 | |||
1039 | diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c | ||
1040 | index e26d1191c5ad..ae0b01059fc6 100644 | ||
1041 | --- a/drivers/nvme/host/core.c | ||
1042 | +++ b/drivers/nvme/host/core.c | ||
1043 | @@ -1183,6 +1183,9 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, | ||
1044 | */ | ||
1045 | if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { | ||
1046 | mutex_lock(&ctrl->scan_lock); | ||
1047 | + mutex_lock(&ctrl->subsys->lock); | ||
1048 | + nvme_mpath_start_freeze(ctrl->subsys); | ||
1049 | + nvme_mpath_wait_freeze(ctrl->subsys); | ||
1050 | nvme_start_freeze(ctrl); | ||
1051 | nvme_wait_freeze(ctrl); | ||
1052 | } | ||
1053 | @@ -1213,6 +1216,8 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects) | ||
1054 | nvme_update_formats(ctrl); | ||
1055 | if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { | ||
1056 | nvme_unfreeze(ctrl); | ||
1057 | + nvme_mpath_unfreeze(ctrl->subsys); | ||
1058 | + mutex_unlock(&ctrl->subsys->lock); | ||
1059 | mutex_unlock(&ctrl->scan_lock); | ||
1060 | } | ||
1061 | if (effects & NVME_CMD_EFFECTS_CCC) | ||
1062 | @@ -1557,6 +1562,7 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) | ||
1063 | if (ns->head->disk) { | ||
1064 | nvme_update_disk_info(ns->head->disk, ns, id); | ||
1065 | blk_queue_stack_limits(ns->head->disk->queue, ns->queue); | ||
1066 | + revalidate_disk(ns->head->disk); | ||
1067 | } | ||
1068 | #endif | ||
1069 | } | ||
1070 | diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c | ||
1071 | index a11e210d173e..05d6371c7f38 100644 | ||
1072 | --- a/drivers/nvme/host/multipath.c | ||
1073 | +++ b/drivers/nvme/host/multipath.c | ||
1074 | @@ -20,6 +20,36 @@ module_param(multipath, bool, 0444); | ||
1075 | MODULE_PARM_DESC(multipath, | ||
1076 | "turn on native support for multiple controllers per subsystem"); | ||
1077 | |||
1078 | +void nvme_mpath_unfreeze(struct nvme_subsystem *subsys) | ||
1079 | +{ | ||
1080 | + struct nvme_ns_head *h; | ||
1081 | + | ||
1082 | + lockdep_assert_held(&subsys->lock); | ||
1083 | + list_for_each_entry(h, &subsys->nsheads, entry) | ||
1084 | + if (h->disk) | ||
1085 | + blk_mq_unfreeze_queue(h->disk->queue); | ||
1086 | +} | ||
1087 | + | ||
1088 | +void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys) | ||
1089 | +{ | ||
1090 | + struct nvme_ns_head *h; | ||
1091 | + | ||
1092 | + lockdep_assert_held(&subsys->lock); | ||
1093 | + list_for_each_entry(h, &subsys->nsheads, entry) | ||
1094 | + if (h->disk) | ||
1095 | + blk_mq_freeze_queue_wait(h->disk->queue); | ||
1096 | +} | ||
1097 | + | ||
1098 | +void nvme_mpath_start_freeze(struct nvme_subsystem *subsys) | ||
1099 | +{ | ||
1100 | + struct nvme_ns_head *h; | ||
1101 | + | ||
1102 | + lockdep_assert_held(&subsys->lock); | ||
1103 | + list_for_each_entry(h, &subsys->nsheads, entry) | ||
1104 | + if (h->disk) | ||
1105 | + blk_freeze_queue_start(h->disk->queue); | ||
1106 | +} | ||
1107 | + | ||
1108 | /* | ||
1109 | * If multipathing is enabled we need to always use the subsystem instance | ||
1110 | * number for numbering our devices to avoid conflicts between subsystems that | ||
1111 | diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h | ||
1112 | index d5e29b57eb34..2653e1f4196d 100644 | ||
1113 | --- a/drivers/nvme/host/nvme.h | ||
1114 | +++ b/drivers/nvme/host/nvme.h | ||
1115 | @@ -469,6 +469,9 @@ static inline bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl) | ||
1116 | return ctrl->ana_log_buf != NULL; | ||
1117 | } | ||
1118 | |||
1119 | +void nvme_mpath_unfreeze(struct nvme_subsystem *subsys); | ||
1120 | +void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys); | ||
1121 | +void nvme_mpath_start_freeze(struct nvme_subsystem *subsys); | ||
1122 | void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns, | ||
1123 | struct nvme_ctrl *ctrl, int *flags); | ||
1124 | void nvme_failover_req(struct request *req); | ||
1125 | @@ -553,6 +556,15 @@ static inline void nvme_mpath_uninit(struct nvme_ctrl *ctrl) | ||
1126 | static inline void nvme_mpath_stop(struct nvme_ctrl *ctrl) | ||
1127 | { | ||
1128 | } | ||
1129 | +static inline void nvme_mpath_unfreeze(struct nvme_subsystem *subsys) | ||
1130 | +{ | ||
1131 | +} | ||
1132 | +static inline void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys) | ||
1133 | +{ | ||
1134 | +} | ||
1135 | +static inline void nvme_mpath_start_freeze(struct nvme_subsystem *subsys) | ||
1136 | +{ | ||
1137 | +} | ||
1138 | #endif /* CONFIG_NVME_MULTIPATH */ | ||
1139 | |||
1140 | #ifdef CONFIG_NVM | ||
1141 | diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c | ||
1142 | index 0a5d064f82ca..a64a8bca0d5b 100644 | ||
1143 | --- a/drivers/nvme/host/pci.c | ||
1144 | +++ b/drivers/nvme/host/pci.c | ||
1145 | @@ -2468,7 +2468,7 @@ static void nvme_async_probe(void *data, async_cookie_t cookie) | ||
1146 | { | ||
1147 | struct nvme_dev *dev = data; | ||
1148 | |||
1149 | - nvme_reset_ctrl_sync(&dev->ctrl); | ||
1150 | + flush_work(&dev->ctrl.reset_work); | ||
1151 | flush_work(&dev->ctrl.scan_work); | ||
1152 | nvme_put_ctrl(&dev->ctrl); | ||
1153 | } | ||
1154 | @@ -2535,6 +2535,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) | ||
1155 | |||
1156 | dev_info(dev->ctrl.device, "pci function %s\n", dev_name(&pdev->dev)); | ||
1157 | |||
1158 | + nvme_reset_ctrl(&dev->ctrl); | ||
1159 | nvme_get_ctrl(&dev->ctrl); | ||
1160 | async_schedule(nvme_async_probe, dev); | ||
1161 | |||
1162 | diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c | ||
1163 | index 9908082b32c4..137a27fa369c 100644 | ||
1164 | --- a/drivers/nvme/target/loop.c | ||
1165 | +++ b/drivers/nvme/target/loop.c | ||
1166 | @@ -678,6 +678,14 @@ static void nvme_loop_remove_port(struct nvmet_port *port) | ||
1167 | mutex_lock(&nvme_loop_ports_mutex); | ||
1168 | list_del_init(&port->entry); | ||
1169 | mutex_unlock(&nvme_loop_ports_mutex); | ||
1170 | + | ||
1171 | + /* | ||
1172 | + * Ensure any ctrls that are in the process of being | ||
1173 | + * deleted are in fact deleted before we return | ||
1174 | + * and free the port. This is to prevent active | ||
1175 | + * ctrls from using a port after it's freed. | ||
1176 | + */ | ||
1177 | + flush_workqueue(nvme_delete_wq); | ||
1178 | } | ||
1179 | |||
1180 | static const struct nvmet_fabrics_ops nvme_loop_ops = { | ||
1181 | diff --git a/drivers/scsi/ufs/unipro.h b/drivers/scsi/ufs/unipro.h | ||
1182 | index 23129d7b2678..c77e36526447 100644 | ||
1183 | --- a/drivers/scsi/ufs/unipro.h | ||
1184 | +++ b/drivers/scsi/ufs/unipro.h | ||
1185 | @@ -52,7 +52,7 @@ | ||
1186 | #define RX_HS_UNTERMINATED_ENABLE 0x00A6 | ||
1187 | #define RX_ENTER_HIBERN8 0x00A7 | ||
1188 | #define RX_BYPASS_8B10B_ENABLE 0x00A8 | ||
1189 | -#define RX_TERMINATION_FORCE_ENABLE 0x0089 | ||
1190 | +#define RX_TERMINATION_FORCE_ENABLE 0x00A9 | ||
1191 | #define RX_MIN_ACTIVATETIME_CAPABILITY 0x008F | ||
1192 | #define RX_HIBERN8TIME_CAPABILITY 0x0092 | ||
1193 | #define RX_REFCLKFREQ 0x00EB | ||
1194 | diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c | ||
1195 | index cb6a331f448a..70f78eda037e 100644 | ||
1196 | --- a/drivers/soundwire/cadence_master.c | ||
1197 | +++ b/drivers/soundwire/cadence_master.c | ||
1198 | @@ -81,8 +81,8 @@ | ||
1199 | |||
1200 | #define CDNS_MCP_INTSET 0x4C | ||
1201 | |||
1202 | -#define CDNS_SDW_SLAVE_STAT 0x50 | ||
1203 | -#define CDNS_MCP_SLAVE_STAT_MASK BIT(1, 0) | ||
1204 | +#define CDNS_MCP_SLAVE_STAT 0x50 | ||
1205 | +#define CDNS_MCP_SLAVE_STAT_MASK GENMASK(1, 0) | ||
1206 | |||
1207 | #define CDNS_MCP_SLAVE_INTSTAT0 0x54 | ||
1208 | #define CDNS_MCP_SLAVE_INTSTAT1 0x58 | ||
1209 | @@ -96,8 +96,8 @@ | ||
1210 | #define CDNS_MCP_SLAVE_INTMASK0 0x5C | ||
1211 | #define CDNS_MCP_SLAVE_INTMASK1 0x60 | ||
1212 | |||
1213 | -#define CDNS_MCP_SLAVE_INTMASK0_MASK GENMASK(30, 0) | ||
1214 | -#define CDNS_MCP_SLAVE_INTMASK1_MASK GENMASK(16, 0) | ||
1215 | +#define CDNS_MCP_SLAVE_INTMASK0_MASK GENMASK(31, 0) | ||
1216 | +#define CDNS_MCP_SLAVE_INTMASK1_MASK GENMASK(15, 0) | ||
1217 | |||
1218 | #define CDNS_MCP_PORT_INTSTAT 0x64 | ||
1219 | #define CDNS_MCP_PDI_STAT 0x6C | ||
1220 | diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c | ||
1221 | index cc7c856126df..169ccfacfc75 100644 | ||
1222 | --- a/drivers/usb/chipidea/udc.c | ||
1223 | +++ b/drivers/usb/chipidea/udc.c | ||
1224 | @@ -708,12 +708,6 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | ||
1225 | struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget); | ||
1226 | unsigned long flags; | ||
1227 | |||
1228 | - spin_lock_irqsave(&ci->lock, flags); | ||
1229 | - ci->gadget.speed = USB_SPEED_UNKNOWN; | ||
1230 | - ci->remote_wakeup = 0; | ||
1231 | - ci->suspended = 0; | ||
1232 | - spin_unlock_irqrestore(&ci->lock, flags); | ||
1233 | - | ||
1234 | /* flush all endpoints */ | ||
1235 | gadget_for_each_ep(ep, gadget) { | ||
1236 | usb_ep_fifo_flush(ep); | ||
1237 | @@ -731,6 +725,12 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | ||
1238 | ci->status = NULL; | ||
1239 | } | ||
1240 | |||
1241 | + spin_lock_irqsave(&ci->lock, flags); | ||
1242 | + ci->gadget.speed = USB_SPEED_UNKNOWN; | ||
1243 | + ci->remote_wakeup = 0; | ||
1244 | + ci->suspended = 0; | ||
1245 | + spin_unlock_irqrestore(&ci->lock, flags); | ||
1246 | + | ||
1247 | return 0; | ||
1248 | } | ||
1249 | |||
1250 | @@ -1302,6 +1302,10 @@ static int ep_disable(struct usb_ep *ep) | ||
1251 | return -EBUSY; | ||
1252 | |||
1253 | spin_lock_irqsave(hwep->lock, flags); | ||
1254 | + if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) { | ||
1255 | + spin_unlock_irqrestore(hwep->lock, flags); | ||
1256 | + return 0; | ||
1257 | + } | ||
1258 | |||
1259 | /* only internal SW should disable ctrl endpts */ | ||
1260 | |||
1261 | @@ -1391,6 +1395,10 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, | ||
1262 | return -EINVAL; | ||
1263 | |||
1264 | spin_lock_irqsave(hwep->lock, flags); | ||
1265 | + if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) { | ||
1266 | + spin_unlock_irqrestore(hwep->lock, flags); | ||
1267 | + return 0; | ||
1268 | + } | ||
1269 | retval = _ep_queue(ep, req, gfp_flags); | ||
1270 | spin_unlock_irqrestore(hwep->lock, flags); | ||
1271 | return retval; | ||
1272 | @@ -1414,8 +1422,8 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | ||
1273 | return -EINVAL; | ||
1274 | |||
1275 | spin_lock_irqsave(hwep->lock, flags); | ||
1276 | - | ||
1277 | - hw_ep_flush(hwep->ci, hwep->num, hwep->dir); | ||
1278 | + if (hwep->ci->gadget.speed != USB_SPEED_UNKNOWN) | ||
1279 | + hw_ep_flush(hwep->ci, hwep->num, hwep->dir); | ||
1280 | |||
1281 | list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { | ||
1282 | dma_pool_free(hwep->td_pool, node->ptr, node->dma); | ||
1283 | @@ -1486,6 +1494,10 @@ static void ep_fifo_flush(struct usb_ep *ep) | ||
1284 | } | ||
1285 | |||
1286 | spin_lock_irqsave(hwep->lock, flags); | ||
1287 | + if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) { | ||
1288 | + spin_unlock_irqrestore(hwep->lock, flags); | ||
1289 | + return; | ||
1290 | + } | ||
1291 | |||
1292 | hw_ep_flush(hwep->ci, hwep->num, hwep->dir); | ||
1293 | |||
1294 | @@ -1558,6 +1570,10 @@ static int ci_udc_wakeup(struct usb_gadget *_gadget) | ||
1295 | int ret = 0; | ||
1296 | |||
1297 | spin_lock_irqsave(&ci->lock, flags); | ||
1298 | + if (ci->gadget.speed == USB_SPEED_UNKNOWN) { | ||
1299 | + spin_unlock_irqrestore(&ci->lock, flags); | ||
1300 | + return 0; | ||
1301 | + } | ||
1302 | if (!ci->remote_wakeup) { | ||
1303 | ret = -EOPNOTSUPP; | ||
1304 | goto out; | ||
1305 | diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c | ||
1306 | index bec581fb7c63..b8a1fdefb515 100644 | ||
1307 | --- a/drivers/usb/class/cdc-wdm.c | ||
1308 | +++ b/drivers/usb/class/cdc-wdm.c | ||
1309 | @@ -587,10 +587,20 @@ static int wdm_flush(struct file *file, fl_owner_t id) | ||
1310 | { | ||
1311 | struct wdm_device *desc = file->private_data; | ||
1312 | |||
1313 | - wait_event(desc->wait, !test_bit(WDM_IN_USE, &desc->flags)); | ||
1314 | + wait_event(desc->wait, | ||
1315 | + /* | ||
1316 | + * needs both flags. We cannot do with one | ||
1317 | + * because resetting it would cause a race | ||
1318 | + * with write() yet we need to signal | ||
1319 | + * a disconnect | ||
1320 | + */ | ||
1321 | + !test_bit(WDM_IN_USE, &desc->flags) || | ||
1322 | + test_bit(WDM_DISCONNECTING, &desc->flags)); | ||
1323 | |||
1324 | /* cannot dereference desc->intf if WDM_DISCONNECTING */ | ||
1325 | - if (desc->werr < 0 && !test_bit(WDM_DISCONNECTING, &desc->flags)) | ||
1326 | + if (test_bit(WDM_DISCONNECTING, &desc->flags)) | ||
1327 | + return -ENODEV; | ||
1328 | + if (desc->werr < 0) | ||
1329 | dev_err(&desc->intf->dev, "Error in flush path: %d\n", | ||
1330 | desc->werr); | ||
1331 | |||
1332 | @@ -974,8 +984,6 @@ static void wdm_disconnect(struct usb_interface *intf) | ||
1333 | spin_lock_irqsave(&desc->iuspin, flags); | ||
1334 | set_bit(WDM_DISCONNECTING, &desc->flags); | ||
1335 | set_bit(WDM_READ, &desc->flags); | ||
1336 | - /* to terminate pending flushes */ | ||
1337 | - clear_bit(WDM_IN_USE, &desc->flags); | ||
1338 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
1339 | wake_up_all(&desc->wait); | ||
1340 | mutex_lock(&desc->rlock); | ||
1341 | diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c | ||
1342 | index 03432467b05f..7537681355f6 100644 | ||
1343 | --- a/drivers/usb/core/hcd-pci.c | ||
1344 | +++ b/drivers/usb/core/hcd-pci.c | ||
1345 | @@ -216,17 +216,18 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | ||
1346 | /* EHCI, OHCI */ | ||
1347 | hcd->rsrc_start = pci_resource_start(dev, 0); | ||
1348 | hcd->rsrc_len = pci_resource_len(dev, 0); | ||
1349 | - if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, | ||
1350 | - driver->description)) { | ||
1351 | + if (!devm_request_mem_region(&dev->dev, hcd->rsrc_start, | ||
1352 | + hcd->rsrc_len, driver->description)) { | ||
1353 | dev_dbg(&dev->dev, "controller already in use\n"); | ||
1354 | retval = -EBUSY; | ||
1355 | goto put_hcd; | ||
1356 | } | ||
1357 | - hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); | ||
1358 | + hcd->regs = devm_ioremap_nocache(&dev->dev, hcd->rsrc_start, | ||
1359 | + hcd->rsrc_len); | ||
1360 | if (hcd->regs == NULL) { | ||
1361 | dev_dbg(&dev->dev, "error mapping memory\n"); | ||
1362 | retval = -EFAULT; | ||
1363 | - goto release_mem_region; | ||
1364 | + goto put_hcd; | ||
1365 | } | ||
1366 | |||
1367 | } else { | ||
1368 | @@ -240,8 +241,8 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | ||
1369 | |||
1370 | hcd->rsrc_start = pci_resource_start(dev, region); | ||
1371 | hcd->rsrc_len = pci_resource_len(dev, region); | ||
1372 | - if (request_region(hcd->rsrc_start, hcd->rsrc_len, | ||
1373 | - driver->description)) | ||
1374 | + if (devm_request_region(&dev->dev, hcd->rsrc_start, | ||
1375 | + hcd->rsrc_len, driver->description)) | ||
1376 | break; | ||
1377 | } | ||
1378 | if (region == PCI_ROM_RESOURCE) { | ||
1379 | @@ -275,20 +276,13 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | ||
1380 | } | ||
1381 | |||
1382 | if (retval != 0) | ||
1383 | - goto unmap_registers; | ||
1384 | + goto put_hcd; | ||
1385 | device_wakeup_enable(hcd->self.controller); | ||
1386 | |||
1387 | if (pci_dev_run_wake(dev)) | ||
1388 | pm_runtime_put_noidle(&dev->dev); | ||
1389 | return retval; | ||
1390 | |||
1391 | -unmap_registers: | ||
1392 | - if (driver->flags & HCD_MEMORY) { | ||
1393 | - iounmap(hcd->regs); | ||
1394 | -release_mem_region: | ||
1395 | - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
1396 | - } else | ||
1397 | - release_region(hcd->rsrc_start, hcd->rsrc_len); | ||
1398 | put_hcd: | ||
1399 | usb_put_hcd(hcd); | ||
1400 | disable_pci: | ||
1401 | @@ -347,14 +341,6 @@ void usb_hcd_pci_remove(struct pci_dev *dev) | ||
1402 | dev_set_drvdata(&dev->dev, NULL); | ||
1403 | up_read(&companions_rwsem); | ||
1404 | } | ||
1405 | - | ||
1406 | - if (hcd->driver->flags & HCD_MEMORY) { | ||
1407 | - iounmap(hcd->regs); | ||
1408 | - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
1409 | - } else { | ||
1410 | - release_region(hcd->rsrc_start, hcd->rsrc_len); | ||
1411 | - } | ||
1412 | - | ||
1413 | usb_put_hcd(hcd); | ||
1414 | pci_disable_device(dev); | ||
1415 | } | ||
1416 | diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c | ||
1417 | index b8a15840b4ff..dfcabadeed01 100644 | ||
1418 | --- a/drivers/usb/gadget/composite.c | ||
1419 | +++ b/drivers/usb/gadget/composite.c | ||
1420 | @@ -1976,6 +1976,7 @@ void composite_disconnect(struct usb_gadget *gadget) | ||
1421 | * disconnect callbacks? | ||
1422 | */ | ||
1423 | spin_lock_irqsave(&cdev->lock, flags); | ||
1424 | + cdev->suspended = 0; | ||
1425 | if (cdev->config) | ||
1426 | reset_config(cdev); | ||
1427 | if (cdev->driver->disconnect) | ||
1428 | diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c | ||
1429 | index 1074cb82ec17..0b7b4d09785b 100644 | ||
1430 | --- a/drivers/usb/gadget/function/f_mass_storage.c | ||
1431 | +++ b/drivers/usb/gadget/function/f_mass_storage.c | ||
1432 | @@ -261,7 +261,7 @@ struct fsg_common; | ||
1433 | struct fsg_common { | ||
1434 | struct usb_gadget *gadget; | ||
1435 | struct usb_composite_dev *cdev; | ||
1436 | - struct fsg_dev *fsg, *new_fsg; | ||
1437 | + struct fsg_dev *fsg; | ||
1438 | wait_queue_head_t io_wait; | ||
1439 | wait_queue_head_t fsg_wait; | ||
1440 | |||
1441 | @@ -290,6 +290,7 @@ struct fsg_common { | ||
1442 | unsigned int bulk_out_maxpacket; | ||
1443 | enum fsg_state state; /* For exception handling */ | ||
1444 | unsigned int exception_req_tag; | ||
1445 | + void *exception_arg; | ||
1446 | |||
1447 | enum data_direction data_dir; | ||
1448 | u32 data_size; | ||
1449 | @@ -391,7 +392,8 @@ static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep) | ||
1450 | |||
1451 | /* These routines may be called in process context or in_irq */ | ||
1452 | |||
1453 | -static void raise_exception(struct fsg_common *common, enum fsg_state new_state) | ||
1454 | +static void __raise_exception(struct fsg_common *common, enum fsg_state new_state, | ||
1455 | + void *arg) | ||
1456 | { | ||
1457 | unsigned long flags; | ||
1458 | |||
1459 | @@ -404,6 +406,7 @@ static void raise_exception(struct fsg_common *common, enum fsg_state new_state) | ||
1460 | if (common->state <= new_state) { | ||
1461 | common->exception_req_tag = common->ep0_req_tag; | ||
1462 | common->state = new_state; | ||
1463 | + common->exception_arg = arg; | ||
1464 | if (common->thread_task) | ||
1465 | send_sig_info(SIGUSR1, SEND_SIG_FORCED, | ||
1466 | common->thread_task); | ||
1467 | @@ -411,6 +414,10 @@ static void raise_exception(struct fsg_common *common, enum fsg_state new_state) | ||
1468 | spin_unlock_irqrestore(&common->lock, flags); | ||
1469 | } | ||
1470 | |||
1471 | +static void raise_exception(struct fsg_common *common, enum fsg_state new_state) | ||
1472 | +{ | ||
1473 | + __raise_exception(common, new_state, NULL); | ||
1474 | +} | ||
1475 | |||
1476 | /*-------------------------------------------------------------------------*/ | ||
1477 | |||
1478 | @@ -2285,16 +2292,16 @@ reset: | ||
1479 | static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | ||
1480 | { | ||
1481 | struct fsg_dev *fsg = fsg_from_func(f); | ||
1482 | - fsg->common->new_fsg = fsg; | ||
1483 | - raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); | ||
1484 | + | ||
1485 | + __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, fsg); | ||
1486 | return USB_GADGET_DELAYED_STATUS; | ||
1487 | } | ||
1488 | |||
1489 | static void fsg_disable(struct usb_function *f) | ||
1490 | { | ||
1491 | struct fsg_dev *fsg = fsg_from_func(f); | ||
1492 | - fsg->common->new_fsg = NULL; | ||
1493 | - raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); | ||
1494 | + | ||
1495 | + __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, NULL); | ||
1496 | } | ||
1497 | |||
1498 | |||
1499 | @@ -2307,6 +2314,7 @@ static void handle_exception(struct fsg_common *common) | ||
1500 | enum fsg_state old_state; | ||
1501 | struct fsg_lun *curlun; | ||
1502 | unsigned int exception_req_tag; | ||
1503 | + struct fsg_dev *new_fsg; | ||
1504 | |||
1505 | /* | ||
1506 | * Clear the existing signals. Anything but SIGUSR1 is converted | ||
1507 | @@ -2360,6 +2368,7 @@ static void handle_exception(struct fsg_common *common) | ||
1508 | common->next_buffhd_to_fill = &common->buffhds[0]; | ||
1509 | common->next_buffhd_to_drain = &common->buffhds[0]; | ||
1510 | exception_req_tag = common->exception_req_tag; | ||
1511 | + new_fsg = common->exception_arg; | ||
1512 | old_state = common->state; | ||
1513 | common->state = FSG_STATE_NORMAL; | ||
1514 | |||
1515 | @@ -2413,8 +2422,8 @@ static void handle_exception(struct fsg_common *common) | ||
1516 | break; | ||
1517 | |||
1518 | case FSG_STATE_CONFIG_CHANGE: | ||
1519 | - do_set_interface(common, common->new_fsg); | ||
1520 | - if (common->new_fsg) | ||
1521 | + do_set_interface(common, new_fsg); | ||
1522 | + if (new_fsg) | ||
1523 | usb_composite_setup_continue(common->cdev); | ||
1524 | break; | ||
1525 | |||
1526 | @@ -2989,8 +2998,7 @@ static void fsg_unbind(struct usb_configuration *c, struct usb_function *f) | ||
1527 | |||
1528 | DBG(fsg, "unbind\n"); | ||
1529 | if (fsg->common->fsg == fsg) { | ||
1530 | - fsg->common->new_fsg = NULL; | ||
1531 | - raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); | ||
1532 | + __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, NULL); | ||
1533 | /* FIXME: make interruptible or killable somehow? */ | ||
1534 | wait_event(common->fsg_wait, common->fsg != fsg); | ||
1535 | } | ||
1536 | diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c | ||
1537 | index e64eb47770c8..2d5a72c15069 100644 | ||
1538 | --- a/drivers/usb/host/fotg210-hcd.c | ||
1539 | +++ b/drivers/usb/host/fotg210-hcd.c | ||
1540 | @@ -1627,6 +1627,10 @@ static int fotg210_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | ||
1541 | /* see what we found out */ | ||
1542 | temp = check_reset_complete(fotg210, wIndex, status_reg, | ||
1543 | fotg210_readl(fotg210, status_reg)); | ||
1544 | + | ||
1545 | + /* restart schedule */ | ||
1546 | + fotg210->command |= CMD_RUN; | ||
1547 | + fotg210_writel(fotg210, fotg210->command, &fotg210->regs->command); | ||
1548 | } | ||
1549 | |||
1550 | if (!(temp & (PORT_RESUME|PORT_RESET))) { | ||
1551 | diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c | ||
1552 | index 210181fd98d2..af11887f5f9e 100644 | ||
1553 | --- a/drivers/usb/host/ohci-hcd.c | ||
1554 | +++ b/drivers/usb/host/ohci-hcd.c | ||
1555 | @@ -418,8 +418,7 @@ static void ohci_usb_reset (struct ohci_hcd *ohci) | ||
1556 | * other cases where the next software may expect clean state from the | ||
1557 | * "firmware". this is bus-neutral, unlike shutdown() methods. | ||
1558 | */ | ||
1559 | -static void | ||
1560 | -ohci_shutdown (struct usb_hcd *hcd) | ||
1561 | +static void _ohci_shutdown(struct usb_hcd *hcd) | ||
1562 | { | ||
1563 | struct ohci_hcd *ohci; | ||
1564 | |||
1565 | @@ -435,6 +434,16 @@ ohci_shutdown (struct usb_hcd *hcd) | ||
1566 | ohci->rh_state = OHCI_RH_HALTED; | ||
1567 | } | ||
1568 | |||
1569 | +static void ohci_shutdown(struct usb_hcd *hcd) | ||
1570 | +{ | ||
1571 | + struct ohci_hcd *ohci = hcd_to_ohci(hcd); | ||
1572 | + unsigned long flags; | ||
1573 | + | ||
1574 | + spin_lock_irqsave(&ohci->lock, flags); | ||
1575 | + _ohci_shutdown(hcd); | ||
1576 | + spin_unlock_irqrestore(&ohci->lock, flags); | ||
1577 | +} | ||
1578 | + | ||
1579 | /*-------------------------------------------------------------------------* | ||
1580 | * HC functions | ||
1581 | *-------------------------------------------------------------------------*/ | ||
1582 | @@ -752,7 +761,7 @@ static void io_watchdog_func(struct timer_list *t) | ||
1583 | died: | ||
1584 | usb_hc_died(ohci_to_hcd(ohci)); | ||
1585 | ohci_dump(ohci); | ||
1586 | - ohci_shutdown(ohci_to_hcd(ohci)); | ||
1587 | + _ohci_shutdown(ohci_to_hcd(ohci)); | ||
1588 | goto done; | ||
1589 | } else { | ||
1590 | /* No write back because the done queue was empty */ | ||
1591 | diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c | ||
1592 | index 8616c52849c6..2b0ccd150209 100644 | ||
1593 | --- a/drivers/usb/host/xhci-rcar.c | ||
1594 | +++ b/drivers/usb/host/xhci-rcar.c | ||
1595 | @@ -104,7 +104,7 @@ static int xhci_rcar_is_gen2(struct device *dev) | ||
1596 | return of_device_is_compatible(node, "renesas,xhci-r8a7790") || | ||
1597 | of_device_is_compatible(node, "renesas,xhci-r8a7791") || | ||
1598 | of_device_is_compatible(node, "renesas,xhci-r8a7793") || | ||
1599 | - of_device_is_compatible(node, "renensas,rcar-gen2-xhci"); | ||
1600 | + of_device_is_compatible(node, "renesas,rcar-gen2-xhci"); | ||
1601 | } | ||
1602 | |||
1603 | static int xhci_rcar_is_gen3(struct device *dev) | ||
1604 | diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c | ||
1605 | index cc794e25a0b6..1d9ce9cbc831 100644 | ||
1606 | --- a/drivers/usb/storage/realtek_cr.c | ||
1607 | +++ b/drivers/usb/storage/realtek_cr.c | ||
1608 | @@ -38,7 +38,7 @@ MODULE_LICENSE("GPL"); | ||
1609 | |||
1610 | static int auto_delink_en = 1; | ||
1611 | module_param(auto_delink_en, int, S_IRUGO | S_IWUSR); | ||
1612 | -MODULE_PARM_DESC(auto_delink_en, "enable auto delink"); | ||
1613 | +MODULE_PARM_DESC(auto_delink_en, "auto delink mode (0=firmware, 1=software [default])"); | ||
1614 | |||
1615 | #ifdef CONFIG_REALTEK_AUTOPM | ||
1616 | static int ss_en = 1; | ||
1617 | @@ -996,12 +996,15 @@ static int init_realtek_cr(struct us_data *us) | ||
1618 | goto INIT_FAIL; | ||
1619 | } | ||
1620 | |||
1621 | - if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) || | ||
1622 | - CHECK_FW_VER(chip, 0x5901)) | ||
1623 | - SET_AUTO_DELINK(chip); | ||
1624 | - if (STATUS_LEN(chip) == 16) { | ||
1625 | - if (SUPPORT_AUTO_DELINK(chip)) | ||
1626 | + if (CHECK_PID(chip, 0x0138) || CHECK_PID(chip, 0x0158) || | ||
1627 | + CHECK_PID(chip, 0x0159)) { | ||
1628 | + if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) || | ||
1629 | + CHECK_FW_VER(chip, 0x5901)) | ||
1630 | SET_AUTO_DELINK(chip); | ||
1631 | + if (STATUS_LEN(chip) == 16) { | ||
1632 | + if (SUPPORT_AUTO_DELINK(chip)) | ||
1633 | + SET_AUTO_DELINK(chip); | ||
1634 | + } | ||
1635 | } | ||
1636 | #ifdef CONFIG_REALTEK_AUTOPM | ||
1637 | if (ss_en) | ||
1638 | diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h | ||
1639 | index ea0d27a94afe..1cd9b6305b06 100644 | ||
1640 | --- a/drivers/usb/storage/unusual_devs.h | ||
1641 | +++ b/drivers/usb/storage/unusual_devs.h | ||
1642 | @@ -2100,7 +2100,7 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201, | ||
1643 | US_FL_IGNORE_RESIDUE ), | ||
1644 | |||
1645 | /* Reported by Michael Büsch <m@bues.ch> */ | ||
1646 | -UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0116, | ||
1647 | +UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0117, | ||
1648 | "JMicron", | ||
1649 | "USB to ATA/ATAPI Bridge", | ||
1650 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
1651 | diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c | ||
1652 | index 5f29ce8d6c3f..fb20aa974ae1 100644 | ||
1653 | --- a/drivers/usb/typec/tcpm.c | ||
1654 | +++ b/drivers/usb/typec/tcpm.c | ||
1655 | @@ -1445,7 +1445,7 @@ static enum pdo_err tcpm_caps_err(struct tcpm_port *port, const u32 *pdo, | ||
1656 | else if ((pdo_min_voltage(pdo[i]) == | ||
1657 | pdo_min_voltage(pdo[i - 1])) && | ||
1658 | (pdo_max_voltage(pdo[i]) == | ||
1659 | - pdo_min_voltage(pdo[i - 1]))) | ||
1660 | + pdo_max_voltage(pdo[i - 1]))) | ||
1661 | return PDO_ERR_DUPE_PDO; | ||
1662 | break; | ||
1663 | /* | ||
1664 | diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c | ||
1665 | index ed05514cc2dc..e6c27b71b136 100644 | ||
1666 | --- a/drivers/watchdog/bcm2835_wdt.c | ||
1667 | +++ b/drivers/watchdog/bcm2835_wdt.c | ||
1668 | @@ -249,6 +249,7 @@ module_param(nowayout, bool, 0); | ||
1669 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | ||
1670 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | ||
1671 | |||
1672 | +MODULE_ALIAS("platform:bcm2835-wdt"); | ||
1673 | MODULE_AUTHOR("Lubomir Rintel <lkundrak@v3.sk>"); | ||
1674 | MODULE_DESCRIPTION("Driver for Broadcom BCM2835 watchdog timer"); | ||
1675 | MODULE_LICENSE("GPL"); | ||
1676 | diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c | ||
1677 | index 9e51d6fe7e8f..40c6860d4c63 100644 | ||
1678 | --- a/fs/afs/cmservice.c | ||
1679 | +++ b/fs/afs/cmservice.c | ||
1680 | @@ -423,18 +423,14 @@ static void SRXAFSCB_ProbeUuid(struct work_struct *work) | ||
1681 | struct afs_call *call = container_of(work, struct afs_call, work); | ||
1682 | struct afs_uuid *r = call->request; | ||
1683 | |||
1684 | - struct { | ||
1685 | - __be32 match; | ||
1686 | - } reply; | ||
1687 | - | ||
1688 | _enter(""); | ||
1689 | |||
1690 | if (memcmp(r, &call->net->uuid, sizeof(call->net->uuid)) == 0) | ||
1691 | - reply.match = htonl(0); | ||
1692 | + afs_send_empty_reply(call); | ||
1693 | else | ||
1694 | - reply.match = htonl(1); | ||
1695 | + rxrpc_kernel_abort_call(call->net->socket, call->rxcall, | ||
1696 | + 1, 1, "K-1"); | ||
1697 | |||
1698 | - afs_send_simple_reply(call, &reply, sizeof(reply)); | ||
1699 | afs_put_call(call); | ||
1700 | _leave(""); | ||
1701 | } | ||
1702 | diff --git a/fs/afs/dir.c b/fs/afs/dir.c | ||
1703 | index 855bf2b79fed..54e7f6f1405e 100644 | ||
1704 | --- a/fs/afs/dir.c | ||
1705 | +++ b/fs/afs/dir.c | ||
1706 | @@ -937,7 +937,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) | ||
1707 | dir_version = (long)dir->status.data_version; | ||
1708 | de_version = (long)dentry->d_fsdata; | ||
1709 | if (de_version == dir_version) | ||
1710 | - goto out_valid; | ||
1711 | + goto out_valid_noupdate; | ||
1712 | |||
1713 | dir_version = (long)dir->invalid_before; | ||
1714 | if (de_version - dir_version >= 0) | ||
1715 | @@ -1001,6 +1001,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) | ||
1716 | |||
1717 | out_valid: | ||
1718 | dentry->d_fsdata = (void *)dir_version; | ||
1719 | +out_valid_noupdate: | ||
1720 | dput(parent); | ||
1721 | key_put(key); | ||
1722 | _leave(" = 1 [valid]"); | ||
1723 | diff --git a/fs/afs/file.c b/fs/afs/file.c | ||
1724 | index 7d4f26198573..843d3b970b84 100644 | ||
1725 | --- a/fs/afs/file.c | ||
1726 | +++ b/fs/afs/file.c | ||
1727 | @@ -193,11 +193,13 @@ void afs_put_read(struct afs_read *req) | ||
1728 | int i; | ||
1729 | |||
1730 | if (refcount_dec_and_test(&req->usage)) { | ||
1731 | - for (i = 0; i < req->nr_pages; i++) | ||
1732 | - if (req->pages[i]) | ||
1733 | - put_page(req->pages[i]); | ||
1734 | - if (req->pages != req->array) | ||
1735 | - kfree(req->pages); | ||
1736 | + if (req->pages) { | ||
1737 | + for (i = 0; i < req->nr_pages; i++) | ||
1738 | + if (req->pages[i]) | ||
1739 | + put_page(req->pages[i]); | ||
1740 | + if (req->pages != req->array) | ||
1741 | + kfree(req->pages); | ||
1742 | + } | ||
1743 | kfree(req); | ||
1744 | } | ||
1745 | } | ||
1746 | diff --git a/fs/afs/vlclient.c b/fs/afs/vlclient.c | ||
1747 | index c3b740813fc7..c7dd47eaff29 100644 | ||
1748 | --- a/fs/afs/vlclient.c | ||
1749 | +++ b/fs/afs/vlclient.c | ||
1750 | @@ -60,23 +60,24 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call) | ||
1751 | struct afs_uuid__xdr *xdr; | ||
1752 | struct afs_uuid *uuid; | ||
1753 | int j; | ||
1754 | + int n = entry->nr_servers; | ||
1755 | |||
1756 | tmp = ntohl(uvldb->serverFlags[i]); | ||
1757 | if (tmp & AFS_VLSF_DONTUSE || | ||
1758 | (new_only && !(tmp & AFS_VLSF_NEWREPSITE))) | ||
1759 | continue; | ||
1760 | if (tmp & AFS_VLSF_RWVOL) { | ||
1761 | - entry->fs_mask[i] |= AFS_VOL_VTM_RW; | ||
1762 | + entry->fs_mask[n] |= AFS_VOL_VTM_RW; | ||
1763 | if (vlflags & AFS_VLF_BACKEXISTS) | ||
1764 | - entry->fs_mask[i] |= AFS_VOL_VTM_BAK; | ||
1765 | + entry->fs_mask[n] |= AFS_VOL_VTM_BAK; | ||
1766 | } | ||
1767 | if (tmp & AFS_VLSF_ROVOL) | ||
1768 | - entry->fs_mask[i] |= AFS_VOL_VTM_RO; | ||
1769 | - if (!entry->fs_mask[i]) | ||
1770 | + entry->fs_mask[n] |= AFS_VOL_VTM_RO; | ||
1771 | + if (!entry->fs_mask[n]) | ||
1772 | continue; | ||
1773 | |||
1774 | xdr = &uvldb->serverNumber[i]; | ||
1775 | - uuid = (struct afs_uuid *)&entry->fs_server[i]; | ||
1776 | + uuid = (struct afs_uuid *)&entry->fs_server[n]; | ||
1777 | uuid->time_low = xdr->time_low; | ||
1778 | uuid->time_mid = htons(ntohl(xdr->time_mid)); | ||
1779 | uuid->time_hi_and_version = htons(ntohl(xdr->time_hi_and_version)); | ||
1780 | diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c | ||
1781 | index 33824a0a57bf..f516ace8f45d 100644 | ||
1782 | --- a/fs/nfs/direct.c | ||
1783 | +++ b/fs/nfs/direct.c | ||
1784 | @@ -400,15 +400,21 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr) | ||
1785 | unsigned long bytes = 0; | ||
1786 | struct nfs_direct_req *dreq = hdr->dreq; | ||
1787 | |||
1788 | - if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) | ||
1789 | - goto out_put; | ||
1790 | - | ||
1791 | spin_lock(&dreq->lock); | ||
1792 | - if (test_bit(NFS_IOHDR_ERROR, &hdr->flags) && (hdr->good_bytes == 0)) | ||
1793 | + if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) | ||
1794 | dreq->error = hdr->error; | ||
1795 | - else | ||
1796 | + | ||
1797 | + if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) { | ||
1798 | + spin_unlock(&dreq->lock); | ||
1799 | + goto out_put; | ||
1800 | + } | ||
1801 | + | ||
1802 | + if (hdr->good_bytes != 0) | ||
1803 | nfs_direct_good_bytes(dreq, hdr); | ||
1804 | |||
1805 | + if (test_bit(NFS_IOHDR_EOF, &hdr->flags)) | ||
1806 | + dreq->error = 0; | ||
1807 | + | ||
1808 | spin_unlock(&dreq->lock); | ||
1809 | |||
1810 | while (!list_empty(&hdr->pages)) { | ||
1811 | @@ -428,7 +434,7 @@ out_put: | ||
1812 | hdr->release(hdr); | ||
1813 | } | ||
1814 | |||
1815 | -static void nfs_read_sync_pgio_error(struct list_head *head) | ||
1816 | +static void nfs_read_sync_pgio_error(struct list_head *head, int error) | ||
1817 | { | ||
1818 | struct nfs_page *req; | ||
1819 | |||
1820 | @@ -664,8 +670,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) | ||
1821 | |||
1822 | list_for_each_entry_safe(req, tmp, &reqs, wb_list) { | ||
1823 | if (!nfs_pageio_add_request(&desc, req)) { | ||
1824 | - nfs_list_remove_request(req); | ||
1825 | - nfs_list_add_request(req, &failed); | ||
1826 | + nfs_list_move_request(req, &failed); | ||
1827 | spin_lock(&cinfo.inode->i_lock); | ||
1828 | dreq->flags = 0; | ||
1829 | if (desc.pg_error < 0) | ||
1830 | @@ -775,16 +780,19 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr) | ||
1831 | bool request_commit = false; | ||
1832 | struct nfs_page *req = nfs_list_entry(hdr->pages.next); | ||
1833 | |||
1834 | - if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) | ||
1835 | - goto out_put; | ||
1836 | - | ||
1837 | nfs_init_cinfo_from_dreq(&cinfo, dreq); | ||
1838 | |||
1839 | spin_lock(&dreq->lock); | ||
1840 | |||
1841 | if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) | ||
1842 | dreq->error = hdr->error; | ||
1843 | - if (dreq->error == 0) { | ||
1844 | + | ||
1845 | + if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) { | ||
1846 | + spin_unlock(&dreq->lock); | ||
1847 | + goto out_put; | ||
1848 | + } | ||
1849 | + | ||
1850 | + if (hdr->good_bytes != 0) { | ||
1851 | nfs_direct_good_bytes(dreq, hdr); | ||
1852 | if (nfs_write_need_commit(hdr)) { | ||
1853 | if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES) | ||
1854 | @@ -821,7 +829,7 @@ out_put: | ||
1855 | hdr->release(hdr); | ||
1856 | } | ||
1857 | |||
1858 | -static void nfs_write_sync_pgio_error(struct list_head *head) | ||
1859 | +static void nfs_write_sync_pgio_error(struct list_head *head, int error) | ||
1860 | { | ||
1861 | struct nfs_page *req; | ||
1862 | |||
1863 | diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c | ||
1864 | index 0ec6bce3dd69..d23ea74b5d20 100644 | ||
1865 | --- a/fs/nfs/pagelist.c | ||
1866 | +++ b/fs/nfs/pagelist.c | ||
1867 | @@ -769,8 +769,7 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc, | ||
1868 | pageused = 0; | ||
1869 | while (!list_empty(head)) { | ||
1870 | req = nfs_list_entry(head->next); | ||
1871 | - nfs_list_remove_request(req); | ||
1872 | - nfs_list_add_request(req, &hdr->pages); | ||
1873 | + nfs_list_move_request(req, &hdr->pages); | ||
1874 | |||
1875 | if (!last_page || last_page != req->wb_page) { | ||
1876 | pageused++; | ||
1877 | @@ -962,8 +961,7 @@ static int nfs_pageio_do_add_request(struct nfs_pageio_descriptor *desc, | ||
1878 | } | ||
1879 | if (!nfs_can_coalesce_requests(prev, req, desc)) | ||
1880 | return 0; | ||
1881 | - nfs_list_remove_request(req); | ||
1882 | - nfs_list_add_request(req, &mirror->pg_list); | ||
1883 | + nfs_list_move_request(req, &mirror->pg_list); | ||
1884 | mirror->pg_count += req->wb_bytes; | ||
1885 | return 1; | ||
1886 | } | ||
1887 | @@ -995,9 +993,8 @@ nfs_pageio_cleanup_request(struct nfs_pageio_descriptor *desc, | ||
1888 | { | ||
1889 | LIST_HEAD(head); | ||
1890 | |||
1891 | - nfs_list_remove_request(req); | ||
1892 | - nfs_list_add_request(req, &head); | ||
1893 | - desc->pg_completion_ops->error_cleanup(&head); | ||
1894 | + nfs_list_move_request(req, &head); | ||
1895 | + desc->pg_completion_ops->error_cleanup(&head, desc->pg_error); | ||
1896 | } | ||
1897 | |||
1898 | /** | ||
1899 | @@ -1133,7 +1130,8 @@ static void nfs_pageio_error_cleanup(struct nfs_pageio_descriptor *desc) | ||
1900 | |||
1901 | for (midx = 0; midx < desc->pg_mirror_count; midx++) { | ||
1902 | mirror = &desc->pg_mirrors[midx]; | ||
1903 | - desc->pg_completion_ops->error_cleanup(&mirror->pg_list); | ||
1904 | + desc->pg_completion_ops->error_cleanup(&mirror->pg_list, | ||
1905 | + desc->pg_error); | ||
1906 | } | ||
1907 | } | ||
1908 | |||
1909 | @@ -1235,21 +1233,23 @@ static void nfs_pageio_complete_mirror(struct nfs_pageio_descriptor *desc, | ||
1910 | int nfs_pageio_resend(struct nfs_pageio_descriptor *desc, | ||
1911 | struct nfs_pgio_header *hdr) | ||
1912 | { | ||
1913 | - LIST_HEAD(failed); | ||
1914 | + LIST_HEAD(pages); | ||
1915 | |||
1916 | desc->pg_io_completion = hdr->io_completion; | ||
1917 | desc->pg_dreq = hdr->dreq; | ||
1918 | - while (!list_empty(&hdr->pages)) { | ||
1919 | - struct nfs_page *req = nfs_list_entry(hdr->pages.next); | ||
1920 | + list_splice_init(&hdr->pages, &pages); | ||
1921 | + while (!list_empty(&pages)) { | ||
1922 | + struct nfs_page *req = nfs_list_entry(pages.next); | ||
1923 | |||
1924 | - nfs_list_remove_request(req); | ||
1925 | if (!nfs_pageio_add_request(desc, req)) | ||
1926 | - nfs_list_add_request(req, &failed); | ||
1927 | + break; | ||
1928 | } | ||
1929 | nfs_pageio_complete(desc); | ||
1930 | - if (!list_empty(&failed)) { | ||
1931 | - list_move(&failed, &hdr->pages); | ||
1932 | - return desc->pg_error < 0 ? desc->pg_error : -EIO; | ||
1933 | + if (!list_empty(&pages)) { | ||
1934 | + int err = desc->pg_error < 0 ? desc->pg_error : -EIO; | ||
1935 | + hdr->completion_ops->error_cleanup(&pages, err); | ||
1936 | + nfs_set_pgio_error(hdr, err, hdr->io_start); | ||
1937 | + return err; | ||
1938 | } | ||
1939 | return 0; | ||
1940 | } | ||
1941 | diff --git a/fs/nfs/read.c b/fs/nfs/read.c | ||
1942 | index 48d7277c60a9..09d5c282f50e 100644 | ||
1943 | --- a/fs/nfs/read.c | ||
1944 | +++ b/fs/nfs/read.c | ||
1945 | @@ -205,7 +205,7 @@ static void nfs_initiate_read(struct nfs_pgio_header *hdr, | ||
1946 | } | ||
1947 | |||
1948 | static void | ||
1949 | -nfs_async_read_error(struct list_head *head) | ||
1950 | +nfs_async_read_error(struct list_head *head, int error) | ||
1951 | { | ||
1952 | struct nfs_page *req; | ||
1953 | |||
1954 | diff --git a/fs/nfs/write.c b/fs/nfs/write.c | ||
1955 | index 51d0b7913c04..5ab997912d8d 100644 | ||
1956 | --- a/fs/nfs/write.c | ||
1957 | +++ b/fs/nfs/write.c | ||
1958 | @@ -1394,20 +1394,27 @@ static void nfs_redirty_request(struct nfs_page *req) | ||
1959 | nfs_release_request(req); | ||
1960 | } | ||
1961 | |||
1962 | -static void nfs_async_write_error(struct list_head *head) | ||
1963 | +static void nfs_async_write_error(struct list_head *head, int error) | ||
1964 | { | ||
1965 | struct nfs_page *req; | ||
1966 | |||
1967 | while (!list_empty(head)) { | ||
1968 | req = nfs_list_entry(head->next); | ||
1969 | nfs_list_remove_request(req); | ||
1970 | + if (nfs_error_is_fatal(error)) { | ||
1971 | + nfs_context_set_write_error(req->wb_context, error); | ||
1972 | + if (nfs_error_is_fatal_on_server(error)) { | ||
1973 | + nfs_write_error_remove_page(req); | ||
1974 | + continue; | ||
1975 | + } | ||
1976 | + } | ||
1977 | nfs_redirty_request(req); | ||
1978 | } | ||
1979 | } | ||
1980 | |||
1981 | static void nfs_async_write_reschedule_io(struct nfs_pgio_header *hdr) | ||
1982 | { | ||
1983 | - nfs_async_write_error(&hdr->pages); | ||
1984 | + nfs_async_write_error(&hdr->pages, 0); | ||
1985 | filemap_fdatawrite_range(hdr->inode->i_mapping, hdr->args.offset, | ||
1986 | hdr->args.offset + hdr->args.count - 1); | ||
1987 | } | ||
1988 | diff --git a/include/linux/logic_pio.h b/include/linux/logic_pio.h | ||
1989 | index cbd9d8495690..88e1e6304a71 100644 | ||
1990 | --- a/include/linux/logic_pio.h | ||
1991 | +++ b/include/linux/logic_pio.h | ||
1992 | @@ -117,6 +117,7 @@ struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode); | ||
1993 | unsigned long logic_pio_trans_hwaddr(struct fwnode_handle *fwnode, | ||
1994 | resource_size_t hw_addr, resource_size_t size); | ||
1995 | int logic_pio_register_range(struct logic_pio_hwaddr *newrange); | ||
1996 | +void logic_pio_unregister_range(struct logic_pio_hwaddr *range); | ||
1997 | resource_size_t logic_pio_to_hwaddr(unsigned long pio); | ||
1998 | unsigned long logic_pio_trans_cpuaddr(resource_size_t hw_addr); | ||
1999 | |||
2000 | diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h | ||
2001 | index e27572d30d97..ad69430fd0eb 100644 | ||
2002 | --- a/include/linux/nfs_page.h | ||
2003 | +++ b/include/linux/nfs_page.h | ||
2004 | @@ -164,6 +164,16 @@ nfs_list_add_request(struct nfs_page *req, struct list_head *head) | ||
2005 | list_add_tail(&req->wb_list, head); | ||
2006 | } | ||
2007 | |||
2008 | +/** | ||
2009 | + * nfs_list_move_request - Move a request to a new list | ||
2010 | + * @req: request | ||
2011 | + * @head: head of list into which to insert the request. | ||
2012 | + */ | ||
2013 | +static inline void | ||
2014 | +nfs_list_move_request(struct nfs_page *req, struct list_head *head) | ||
2015 | +{ | ||
2016 | + list_move_tail(&req->wb_list, head); | ||
2017 | +} | ||
2018 | |||
2019 | /** | ||
2020 | * nfs_list_remove_request - Remove a request from its wb_list | ||
2021 | diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h | ||
2022 | index bd1c889a9ed9..cab24a127feb 100644 | ||
2023 | --- a/include/linux/nfs_xdr.h | ||
2024 | +++ b/include/linux/nfs_xdr.h | ||
2025 | @@ -1539,7 +1539,7 @@ struct nfs_commit_data { | ||
2026 | }; | ||
2027 | |||
2028 | struct nfs_pgio_completion_ops { | ||
2029 | - void (*error_cleanup)(struct list_head *head); | ||
2030 | + void (*error_cleanup)(struct list_head *head, int); | ||
2031 | void (*init_hdr)(struct nfs_pgio_header *hdr); | ||
2032 | void (*completion)(struct nfs_pgio_header *hdr); | ||
2033 | void (*reschedule_io)(struct nfs_pgio_header *hdr); | ||
2034 | diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c | ||
2035 | index d9dd709b3c12..7e215dac9693 100644 | ||
2036 | --- a/kernel/trace/ftrace.c | ||
2037 | +++ b/kernel/trace/ftrace.c | ||
2038 | @@ -3112,6 +3112,14 @@ t_probe_next(struct seq_file *m, loff_t *pos) | ||
2039 | hnd = &iter->probe_entry->hlist; | ||
2040 | |||
2041 | hash = iter->probe->ops.func_hash->filter_hash; | ||
2042 | + | ||
2043 | + /* | ||
2044 | + * A probe being registered may temporarily have an empty hash | ||
2045 | + * and it's at the end of the func_probes list. | ||
2046 | + */ | ||
2047 | + if (!hash || hash == EMPTY_HASH) | ||
2048 | + return NULL; | ||
2049 | + | ||
2050 | size = 1 << hash->size_bits; | ||
2051 | |||
2052 | retry: | ||
2053 | @@ -4307,12 +4315,21 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr, | ||
2054 | |||
2055 | mutex_unlock(&ftrace_lock); | ||
2056 | |||
2057 | + /* | ||
2058 | + * Note, there's a small window here that the func_hash->filter_hash | ||
2059 | + * may be NULL or empty. Need to be carefule when reading the loop. | ||
2060 | + */ | ||
2061 | mutex_lock(&probe->ops.func_hash->regex_lock); | ||
2062 | |||
2063 | orig_hash = &probe->ops.func_hash->filter_hash; | ||
2064 | old_hash = *orig_hash; | ||
2065 | hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash); | ||
2066 | |||
2067 | + if (!hash) { | ||
2068 | + ret = -ENOMEM; | ||
2069 | + goto out; | ||
2070 | + } | ||
2071 | + | ||
2072 | ret = ftrace_match_records(hash, glob, strlen(glob)); | ||
2073 | |||
2074 | /* Nothing found? */ | ||
2075 | diff --git a/lib/logic_pio.c b/lib/logic_pio.c | ||
2076 | index feea48fd1a0d..905027574e5d 100644 | ||
2077 | --- a/lib/logic_pio.c | ||
2078 | +++ b/lib/logic_pio.c | ||
2079 | @@ -35,7 +35,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range) | ||
2080 | struct logic_pio_hwaddr *range; | ||
2081 | resource_size_t start; | ||
2082 | resource_size_t end; | ||
2083 | - resource_size_t mmio_sz = 0; | ||
2084 | + resource_size_t mmio_end = 0; | ||
2085 | resource_size_t iio_sz = MMIO_UPPER_LIMIT; | ||
2086 | int ret = 0; | ||
2087 | |||
2088 | @@ -46,7 +46,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range) | ||
2089 | end = new_range->hw_start + new_range->size; | ||
2090 | |||
2091 | mutex_lock(&io_range_mutex); | ||
2092 | - list_for_each_entry_rcu(range, &io_range_list, list) { | ||
2093 | + list_for_each_entry(range, &io_range_list, list) { | ||
2094 | if (range->fwnode == new_range->fwnode) { | ||
2095 | /* range already there */ | ||
2096 | goto end_register; | ||
2097 | @@ -56,7 +56,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range) | ||
2098 | /* for MMIO ranges we need to check for overlap */ | ||
2099 | if (start >= range->hw_start + range->size || | ||
2100 | end < range->hw_start) { | ||
2101 | - mmio_sz += range->size; | ||
2102 | + mmio_end = range->io_start + range->size; | ||
2103 | } else { | ||
2104 | ret = -EFAULT; | ||
2105 | goto end_register; | ||
2106 | @@ -69,16 +69,16 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range) | ||
2107 | |||
2108 | /* range not registered yet, check for available space */ | ||
2109 | if (new_range->flags == LOGIC_PIO_CPU_MMIO) { | ||
2110 | - if (mmio_sz + new_range->size - 1 > MMIO_UPPER_LIMIT) { | ||
2111 | + if (mmio_end + new_range->size - 1 > MMIO_UPPER_LIMIT) { | ||
2112 | /* if it's too big check if 64K space can be reserved */ | ||
2113 | - if (mmio_sz + SZ_64K - 1 > MMIO_UPPER_LIMIT) { | ||
2114 | + if (mmio_end + SZ_64K - 1 > MMIO_UPPER_LIMIT) { | ||
2115 | ret = -E2BIG; | ||
2116 | goto end_register; | ||
2117 | } | ||
2118 | new_range->size = SZ_64K; | ||
2119 | pr_warn("Requested IO range too big, new size set to 64K\n"); | ||
2120 | } | ||
2121 | - new_range->io_start = mmio_sz; | ||
2122 | + new_range->io_start = mmio_end; | ||
2123 | } else if (new_range->flags == LOGIC_PIO_INDIRECT) { | ||
2124 | if (iio_sz + new_range->size - 1 > IO_SPACE_LIMIT) { | ||
2125 | ret = -E2BIG; | ||
2126 | @@ -98,6 +98,20 @@ end_register: | ||
2127 | return ret; | ||
2128 | } | ||
2129 | |||
2130 | +/** | ||
2131 | + * logic_pio_unregister_range - unregister a logical PIO range for a host | ||
2132 | + * @range: pointer to the IO range which has been already registered. | ||
2133 | + * | ||
2134 | + * Unregister a previously-registered IO range node. | ||
2135 | + */ | ||
2136 | +void logic_pio_unregister_range(struct logic_pio_hwaddr *range) | ||
2137 | +{ | ||
2138 | + mutex_lock(&io_range_mutex); | ||
2139 | + list_del_rcu(&range->list); | ||
2140 | + mutex_unlock(&io_range_mutex); | ||
2141 | + synchronize_rcu(); | ||
2142 | +} | ||
2143 | + | ||
2144 | /** | ||
2145 | * find_io_range_by_fwnode - find logical PIO range for given FW node | ||
2146 | * @fwnode: FW node handle associated with logical PIO range | ||
2147 | @@ -108,26 +122,38 @@ end_register: | ||
2148 | */ | ||
2149 | struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode) | ||
2150 | { | ||
2151 | - struct logic_pio_hwaddr *range; | ||
2152 | + struct logic_pio_hwaddr *range, *found_range = NULL; | ||
2153 | |||
2154 | + rcu_read_lock(); | ||
2155 | list_for_each_entry_rcu(range, &io_range_list, list) { | ||
2156 | - if (range->fwnode == fwnode) | ||
2157 | - return range; | ||
2158 | + if (range->fwnode == fwnode) { | ||
2159 | + found_range = range; | ||
2160 | + break; | ||
2161 | + } | ||
2162 | } | ||
2163 | - return NULL; | ||
2164 | + rcu_read_unlock(); | ||
2165 | + | ||
2166 | + return found_range; | ||
2167 | } | ||
2168 | |||
2169 | /* Return a registered range given an input PIO token */ | ||
2170 | static struct logic_pio_hwaddr *find_io_range(unsigned long pio) | ||
2171 | { | ||
2172 | - struct logic_pio_hwaddr *range; | ||
2173 | + struct logic_pio_hwaddr *range, *found_range = NULL; | ||
2174 | |||
2175 | + rcu_read_lock(); | ||
2176 | list_for_each_entry_rcu(range, &io_range_list, list) { | ||
2177 | - if (in_range(pio, range->io_start, range->size)) | ||
2178 | - return range; | ||
2179 | + if (in_range(pio, range->io_start, range->size)) { | ||
2180 | + found_range = range; | ||
2181 | + break; | ||
2182 | + } | ||
2183 | } | ||
2184 | - pr_err("PIO entry token %lx invalid\n", pio); | ||
2185 | - return NULL; | ||
2186 | + rcu_read_unlock(); | ||
2187 | + | ||
2188 | + if (!found_range) | ||
2189 | + pr_err("PIO entry token 0x%lx invalid\n", pio); | ||
2190 | + | ||
2191 | + return found_range; | ||
2192 | } | ||
2193 | |||
2194 | /** | ||
2195 | @@ -180,14 +206,23 @@ unsigned long logic_pio_trans_cpuaddr(resource_size_t addr) | ||
2196 | { | ||
2197 | struct logic_pio_hwaddr *range; | ||
2198 | |||
2199 | + rcu_read_lock(); | ||
2200 | list_for_each_entry_rcu(range, &io_range_list, list) { | ||
2201 | if (range->flags != LOGIC_PIO_CPU_MMIO) | ||
2202 | continue; | ||
2203 | - if (in_range(addr, range->hw_start, range->size)) | ||
2204 | - return addr - range->hw_start + range->io_start; | ||
2205 | + if (in_range(addr, range->hw_start, range->size)) { | ||
2206 | + unsigned long cpuaddr; | ||
2207 | + | ||
2208 | + cpuaddr = addr - range->hw_start + range->io_start; | ||
2209 | + | ||
2210 | + rcu_read_unlock(); | ||
2211 | + return cpuaddr; | ||
2212 | + } | ||
2213 | } | ||
2214 | - pr_err("addr %llx not registered in io_range_list\n", | ||
2215 | - (unsigned long long) addr); | ||
2216 | + rcu_read_unlock(); | ||
2217 | + | ||
2218 | + pr_err("addr %pa not registered in io_range_list\n", &addr); | ||
2219 | + | ||
2220 | return ~0UL; | ||
2221 | } | ||
2222 | |||
2223 | diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c | ||
2224 | index c2c4f739da8f..4b9063d12b93 100644 | ||
2225 | --- a/mm/zsmalloc.c | ||
2226 | +++ b/mm/zsmalloc.c | ||
2227 | @@ -2432,7 +2432,9 @@ struct zs_pool *zs_create_pool(const char *name) | ||
2228 | if (!pool->name) | ||
2229 | goto err; | ||
2230 | |||
2231 | +#ifdef CONFIG_COMPACTION | ||
2232 | init_waitqueue_head(&pool->migration_wait); | ||
2233 | +#endif | ||
2234 | |||
2235 | if (create_cache(pool)) | ||
2236 | goto err; | ||
2237 | diff --git a/net/core/stream.c b/net/core/stream.c | ||
2238 | index 7d329fb1f553..7f5eaa95a675 100644 | ||
2239 | --- a/net/core/stream.c | ||
2240 | +++ b/net/core/stream.c | ||
2241 | @@ -120,7 +120,6 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) | ||
2242 | int err = 0; | ||
2243 | long vm_wait = 0; | ||
2244 | long current_timeo = *timeo_p; | ||
2245 | - bool noblock = (*timeo_p ? false : true); | ||
2246 | DEFINE_WAIT_FUNC(wait, woken_wake_function); | ||
2247 | |||
2248 | if (sk_stream_memory_free(sk)) | ||
2249 | @@ -133,11 +132,8 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) | ||
2250 | |||
2251 | if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN)) | ||
2252 | goto do_error; | ||
2253 | - if (!*timeo_p) { | ||
2254 | - if (noblock) | ||
2255 | - set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); | ||
2256 | - goto do_nonblock; | ||
2257 | - } | ||
2258 | + if (!*timeo_p) | ||
2259 | + goto do_eagain; | ||
2260 | if (signal_pending(current)) | ||
2261 | goto do_interrupted; | ||
2262 | sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk); | ||
2263 | @@ -169,7 +165,13 @@ out: | ||
2264 | do_error: | ||
2265 | err = -EPIPE; | ||
2266 | goto out; | ||
2267 | -do_nonblock: | ||
2268 | +do_eagain: | ||
2269 | + /* Make sure that whenever EAGAIN is returned, EPOLLOUT event can | ||
2270 | + * be generated later. | ||
2271 | + * When TCP receives ACK packets that make room, tcp_check_space() | ||
2272 | + * only calls tcp_new_space() if SOCK_NOSPACE is set. | ||
2273 | + */ | ||
2274 | + set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); | ||
2275 | err = -EAGAIN; | ||
2276 | goto out; | ||
2277 | do_interrupted: | ||
2278 | diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c | ||
2279 | index ad75c468ecfb..0167e23d1c8f 100644 | ||
2280 | --- a/net/ipv4/icmp.c | ||
2281 | +++ b/net/ipv4/icmp.c | ||
2282 | @@ -587,7 +587,13 @@ void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info, | ||
2283 | |||
2284 | if (!rt) | ||
2285 | goto out; | ||
2286 | - net = dev_net(rt->dst.dev); | ||
2287 | + | ||
2288 | + if (rt->dst.dev) | ||
2289 | + net = dev_net(rt->dst.dev); | ||
2290 | + else if (skb_in->dev) | ||
2291 | + net = dev_net(skb_in->dev); | ||
2292 | + else | ||
2293 | + goto out; | ||
2294 | |||
2295 | /* | ||
2296 | * Find the original header. It is expected to be valid, of course. | ||
2297 | diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c | ||
2298 | index c57efd5c5b38..49e2f6dac646 100644 | ||
2299 | --- a/net/ipv6/addrconf.c | ||
2300 | +++ b/net/ipv6/addrconf.c | ||
2301 | @@ -995,7 +995,8 @@ ipv6_add_addr(struct inet6_dev *idev, struct ifa6_config *cfg, | ||
2302 | int err = 0; | ||
2303 | |||
2304 | if (addr_type == IPV6_ADDR_ANY || | ||
2305 | - addr_type & IPV6_ADDR_MULTICAST || | ||
2306 | + (addr_type & IPV6_ADDR_MULTICAST && | ||
2307 | + !(cfg->ifa_flags & IFA_F_MCAUTOJOIN)) || | ||
2308 | (!(idev->dev->flags & IFF_LOOPBACK) && | ||
2309 | addr_type & IPV6_ADDR_LOOPBACK)) | ||
2310 | return ERR_PTR(-EADDRNOTAVAIL); | ||
2311 | diff --git a/net/ipv6/route.c b/net/ipv6/route.c | ||
2312 | index 81220077d62f..c88586380134 100644 | ||
2313 | --- a/net/ipv6/route.c | ||
2314 | +++ b/net/ipv6/route.c | ||
2315 | @@ -3109,7 +3109,7 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg, | ||
2316 | rt->fib6_metric = cfg->fc_metric; | ||
2317 | rt->fib6_nh.nh_weight = 1; | ||
2318 | |||
2319 | - rt->fib6_type = cfg->fc_type; | ||
2320 | + rt->fib6_type = cfg->fc_type ? : RTN_UNICAST; | ||
2321 | |||
2322 | /* We cannot add true routes via loopback here, | ||
2323 | they would result in kernel looping; promote them to reject routes | ||
2324 | diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c | ||
2325 | index 40c510223467..a48e83b19cfa 100644 | ||
2326 | --- a/net/mac80211/cfg.c | ||
2327 | +++ b/net/mac80211/cfg.c | ||
2328 | @@ -1471,6 +1471,11 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, | ||
2329 | if (is_multicast_ether_addr(mac)) | ||
2330 | return -EINVAL; | ||
2331 | |||
2332 | + if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER) && | ||
2333 | + sdata->vif.type == NL80211_IFTYPE_STATION && | ||
2334 | + !sdata->u.mgd.associated) | ||
2335 | + return -EINVAL; | ||
2336 | + | ||
2337 | sta = sta_info_alloc(sdata, mac, GFP_KERNEL); | ||
2338 | if (!sta) | ||
2339 | return -ENOMEM; | ||
2340 | @@ -1478,10 +1483,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, | ||
2341 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) | ||
2342 | sta->sta.tdls = true; | ||
2343 | |||
2344 | - if (sta->sta.tdls && sdata->vif.type == NL80211_IFTYPE_STATION && | ||
2345 | - !sdata->u.mgd.associated) | ||
2346 | - return -EINVAL; | ||
2347 | - | ||
2348 | err = sta_apply_parameters(local, sta, params); | ||
2349 | if (err) { | ||
2350 | sta_info_free(local, sta); | ||
2351 | diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c | ||
2352 | index 7523d995ea8a..b12f23c996f4 100644 | ||
2353 | --- a/net/mac80211/rx.c | ||
2354 | +++ b/net/mac80211/rx.c | ||
2355 | @@ -2372,11 +2372,13 @@ static void ieee80211_deliver_skb_to_local_stack(struct sk_buff *skb, | ||
2356 | skb->protocol == cpu_to_be16(ETH_P_PREAUTH)) && | ||
2357 | sdata->control_port_over_nl80211)) { | ||
2358 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | ||
2359 | - bool noencrypt = status->flag & RX_FLAG_DECRYPTED; | ||
2360 | + bool noencrypt = !(status->flag & RX_FLAG_DECRYPTED); | ||
2361 | |||
2362 | cfg80211_rx_control_port(dev, skb, noencrypt); | ||
2363 | dev_kfree_skb(skb); | ||
2364 | } else { | ||
2365 | + memset(skb->cb, 0, sizeof(skb->cb)); | ||
2366 | + | ||
2367 | /* deliver to local stack */ | ||
2368 | if (rx->napi) | ||
2369 | napi_gro_receive(rx->napi, skb); | ||
2370 | @@ -2470,8 +2472,6 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | ||
2371 | |||
2372 | if (skb) { | ||
2373 | skb->protocol = eth_type_trans(skb, dev); | ||
2374 | - memset(skb->cb, 0, sizeof(skb->cb)); | ||
2375 | - | ||
2376 | ieee80211_deliver_skb_to_local_stack(skb, rx); | ||
2377 | } | ||
2378 | |||
2379 | diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c | ||
2380 | index d8366ed51757..28361aef9982 100644 | ||
2381 | --- a/net/smc/smc_tx.c | ||
2382 | +++ b/net/smc/smc_tx.c | ||
2383 | @@ -75,13 +75,11 @@ static int smc_tx_wait(struct smc_sock *smc, int flags) | ||
2384 | DEFINE_WAIT_FUNC(wait, woken_wake_function); | ||
2385 | struct smc_connection *conn = &smc->conn; | ||
2386 | struct sock *sk = &smc->sk; | ||
2387 | - bool noblock; | ||
2388 | long timeo; | ||
2389 | int rc = 0; | ||
2390 | |||
2391 | /* similar to sk_stream_wait_memory */ | ||
2392 | timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); | ||
2393 | - noblock = timeo ? false : true; | ||
2394 | add_wait_queue(sk_sleep(sk), &wait); | ||
2395 | while (1) { | ||
2396 | sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); | ||
2397 | @@ -96,8 +94,8 @@ static int smc_tx_wait(struct smc_sock *smc, int flags) | ||
2398 | break; | ||
2399 | } | ||
2400 | if (!timeo) { | ||
2401 | - if (noblock) | ||
2402 | - set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); | ||
2403 | + /* ensure EPOLLOUT is subsequently generated */ | ||
2404 | + set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); | ||
2405 | rc = -EAGAIN; | ||
2406 | break; | ||
2407 | } | ||
2408 | diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c | ||
2409 | index 4c0ac79f82d4..3288bdff9889 100644 | ||
2410 | --- a/net/tls/tls_main.c | ||
2411 | +++ b/net/tls/tls_main.c | ||
2412 | @@ -301,6 +301,8 @@ static void tls_sk_proto_close(struct sock *sk, long timeout) | ||
2413 | #else | ||
2414 | { | ||
2415 | #endif | ||
2416 | + if (sk->sk_write_space == tls_write_space) | ||
2417 | + sk->sk_write_space = ctx->sk_write_space; | ||
2418 | tls_ctx_free(ctx); | ||
2419 | ctx = NULL; | ||
2420 | } | ||
2421 | diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c | ||
2422 | index 6848a8196711..bbb2da70e870 100644 | ||
2423 | --- a/net/tls/tls_sw.c | ||
2424 | +++ b/net/tls/tls_sw.c | ||
2425 | @@ -354,7 +354,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) | ||
2426 | { | ||
2427 | struct tls_context *tls_ctx = tls_get_ctx(sk); | ||
2428 | struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx); | ||
2429 | - int ret = 0; | ||
2430 | + int ret; | ||
2431 | int required_size; | ||
2432 | long timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); | ||
2433 | bool eor = !(msg->msg_flags & MSG_MORE); | ||
2434 | @@ -370,7 +370,8 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) | ||
2435 | |||
2436 | lock_sock(sk); | ||
2437 | |||
2438 | - if (tls_complete_pending_work(sk, tls_ctx, msg->msg_flags, &timeo)) | ||
2439 | + ret = tls_complete_pending_work(sk, tls_ctx, msg->msg_flags, &timeo); | ||
2440 | + if (ret) | ||
2441 | goto send_end; | ||
2442 | |||
2443 | if (unlikely(msg->msg_controllen)) { | ||
2444 | @@ -505,7 +506,7 @@ int tls_sw_sendpage(struct sock *sk, struct page *page, | ||
2445 | { | ||
2446 | struct tls_context *tls_ctx = tls_get_ctx(sk); | ||
2447 | struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx); | ||
2448 | - int ret = 0; | ||
2449 | + int ret; | ||
2450 | long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); | ||
2451 | bool eor; | ||
2452 | size_t orig_size = size; | ||
2453 | @@ -525,7 +526,8 @@ int tls_sw_sendpage(struct sock *sk, struct page *page, | ||
2454 | |||
2455 | sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk); | ||
2456 | |||
2457 | - if (tls_complete_pending_work(sk, tls_ctx, flags, &timeo)) | ||
2458 | + ret = tls_complete_pending_work(sk, tls_ctx, flags, &timeo); | ||
2459 | + if (ret) | ||
2460 | goto sendpage_end; | ||
2461 | |||
2462 | /* Call the sk_stream functions to manage the sndbuf mem. */ | ||
2463 | diff --git a/net/wireless/reg.c b/net/wireless/reg.c | ||
2464 | index 8a47297ff206..d8ebf4f0ef6e 100644 | ||
2465 | --- a/net/wireless/reg.c | ||
2466 | +++ b/net/wireless/reg.c | ||
2467 | @@ -2777,7 +2777,7 @@ static void reg_process_pending_hints(void) | ||
2468 | |||
2469 | /* When last_request->processed becomes true this will be rescheduled */ | ||
2470 | if (lr && !lr->processed) { | ||
2471 | - reg_process_hint(lr); | ||
2472 | + pr_debug("Pending regulatory request, waiting for it to be processed...\n"); | ||
2473 | return; | ||
2474 | } | ||
2475 | |||
2476 | diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c | ||
2477 | index bbf91a5a938b..bd3d68e0489d 100644 | ||
2478 | --- a/sound/core/seq/seq_clientmgr.c | ||
2479 | +++ b/sound/core/seq/seq_clientmgr.c | ||
2480 | @@ -1818,8 +1818,7 @@ static int snd_seq_ioctl_get_client_pool(struct snd_seq_client *client, | ||
2481 | if (cptr->type == USER_CLIENT) { | ||
2482 | info->input_pool = cptr->data.user.fifo_pool_size; | ||
2483 | info->input_free = info->input_pool; | ||
2484 | - if (cptr->data.user.fifo) | ||
2485 | - info->input_free = snd_seq_unused_cells(cptr->data.user.fifo->pool); | ||
2486 | + info->input_free = snd_seq_fifo_unused_cells(cptr->data.user.fifo); | ||
2487 | } else { | ||
2488 | info->input_pool = 0; | ||
2489 | info->input_free = 0; | ||
2490 | diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c | ||
2491 | index 72c0302a55d2..6a24732704fc 100644 | ||
2492 | --- a/sound/core/seq/seq_fifo.c | ||
2493 | +++ b/sound/core/seq/seq_fifo.c | ||
2494 | @@ -280,3 +280,20 @@ int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize) | ||
2495 | |||
2496 | return 0; | ||
2497 | } | ||
2498 | + | ||
2499 | +/* get the number of unused cells safely */ | ||
2500 | +int snd_seq_fifo_unused_cells(struct snd_seq_fifo *f) | ||
2501 | +{ | ||
2502 | + unsigned long flags; | ||
2503 | + int cells; | ||
2504 | + | ||
2505 | + if (!f) | ||
2506 | + return 0; | ||
2507 | + | ||
2508 | + snd_use_lock_use(&f->use_lock); | ||
2509 | + spin_lock_irqsave(&f->lock, flags); | ||
2510 | + cells = snd_seq_unused_cells(f->pool); | ||
2511 | + spin_unlock_irqrestore(&f->lock, flags); | ||
2512 | + snd_use_lock_free(&f->use_lock); | ||
2513 | + return cells; | ||
2514 | +} | ||
2515 | diff --git a/sound/core/seq/seq_fifo.h b/sound/core/seq/seq_fifo.h | ||
2516 | index 062c446e7867..5d38a0d7f0cd 100644 | ||
2517 | --- a/sound/core/seq/seq_fifo.h | ||
2518 | +++ b/sound/core/seq/seq_fifo.h | ||
2519 | @@ -68,5 +68,7 @@ int snd_seq_fifo_poll_wait(struct snd_seq_fifo *f, struct file *file, poll_table | ||
2520 | /* resize pool in fifo */ | ||
2521 | int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize); | ||
2522 | |||
2523 | +/* get the number of unused cells safely */ | ||
2524 | +int snd_seq_fifo_unused_cells(struct snd_seq_fifo *f); | ||
2525 | |||
2526 | #endif | ||
2527 | diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c | ||
2528 | index 6f17b256fcd0..ae8fde4c1a12 100644 | ||
2529 | --- a/sound/pci/hda/patch_conexant.c | ||
2530 | +++ b/sound/pci/hda/patch_conexant.c | ||
2531 | @@ -624,18 +624,20 @@ static void cxt_fixup_hp_gate_mic_jack(struct hda_codec *codec, | ||
2532 | |||
2533 | /* update LED status via GPIO */ | ||
2534 | static void cxt_update_gpio_led(struct hda_codec *codec, unsigned int mask, | ||
2535 | - bool enabled) | ||
2536 | + bool led_on) | ||
2537 | { | ||
2538 | struct conexant_spec *spec = codec->spec; | ||
2539 | unsigned int oldval = spec->gpio_led; | ||
2540 | |||
2541 | if (spec->mute_led_polarity) | ||
2542 | - enabled = !enabled; | ||
2543 | + led_on = !led_on; | ||
2544 | |||
2545 | - if (enabled) | ||
2546 | - spec->gpio_led &= ~mask; | ||
2547 | - else | ||
2548 | + if (led_on) | ||
2549 | spec->gpio_led |= mask; | ||
2550 | + else | ||
2551 | + spec->gpio_led &= ~mask; | ||
2552 | + codec_dbg(codec, "mask:%d enabled:%d gpio_led:%d\n", | ||
2553 | + mask, led_on, spec->gpio_led); | ||
2554 | if (spec->gpio_led != oldval) | ||
2555 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, | ||
2556 | spec->gpio_led); | ||
2557 | @@ -646,8 +648,8 @@ static void cxt_fixup_gpio_mute_hook(void *private_data, int enabled) | ||
2558 | { | ||
2559 | struct hda_codec *codec = private_data; | ||
2560 | struct conexant_spec *spec = codec->spec; | ||
2561 | - | ||
2562 | - cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled); | ||
2563 | + /* muted -> LED on */ | ||
2564 | + cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, !enabled); | ||
2565 | } | ||
2566 | |||
2567 | /* turn on/off mic-mute LED via GPIO per capture hook */ | ||
2568 | @@ -669,7 +671,6 @@ static void cxt_fixup_mute_led_gpio(struct hda_codec *codec, | ||
2569 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03 }, | ||
2570 | {} | ||
2571 | }; | ||
2572 | - codec_info(codec, "action: %d gpio_led: %d\n", action, spec->gpio_led); | ||
2573 | |||
2574 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
2575 | spec->gen.vmaster_mute.hook = cxt_fixup_gpio_mute_hook; | ||
2576 | diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c | ||
2577 | index dafc3b7f8d72..62aa320c2070 100644 | ||
2578 | --- a/sound/soc/soc-core.c | ||
2579 | +++ b/sound/soc/soc-core.c | ||
2580 | @@ -1513,11 +1513,8 @@ static int soc_probe_link_dais(struct snd_soc_card *card, | ||
2581 | } | ||
2582 | } | ||
2583 | |||
2584 | - if (dai_link->dai_fmt) { | ||
2585 | - ret = snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt); | ||
2586 | - if (ret) | ||
2587 | - return ret; | ||
2588 | - } | ||
2589 | + if (dai_link->dai_fmt) | ||
2590 | + snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt); | ||
2591 | |||
2592 | ret = soc_post_component_init(rtd, dai_link->name); | ||
2593 | if (ret) | ||
2594 | diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c | ||
2595 | index 78c2d6cab3b5..531564269444 100644 | ||
2596 | --- a/sound/usb/line6/pcm.c | ||
2597 | +++ b/sound/usb/line6/pcm.c | ||
2598 | @@ -554,6 +554,15 @@ int line6_init_pcm(struct usb_line6 *line6, | ||
2599 | line6pcm->volume_monitor = 255; | ||
2600 | line6pcm->line6 = line6; | ||
2601 | |||
2602 | + spin_lock_init(&line6pcm->out.lock); | ||
2603 | + spin_lock_init(&line6pcm->in.lock); | ||
2604 | + line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD; | ||
2605 | + | ||
2606 | + line6->line6pcm = line6pcm; | ||
2607 | + | ||
2608 | + pcm->private_data = line6pcm; | ||
2609 | + pcm->private_free = line6_cleanup_pcm; | ||
2610 | + | ||
2611 | line6pcm->max_packet_size_in = | ||
2612 | usb_maxpacket(line6->usbdev, | ||
2613 | usb_rcvisocpipe(line6->usbdev, ep_read), 0); | ||
2614 | @@ -566,15 +575,6 @@ int line6_init_pcm(struct usb_line6 *line6, | ||
2615 | return -EINVAL; | ||
2616 | } | ||
2617 | |||
2618 | - spin_lock_init(&line6pcm->out.lock); | ||
2619 | - spin_lock_init(&line6pcm->in.lock); | ||
2620 | - line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD; | ||
2621 | - | ||
2622 | - line6->line6pcm = line6pcm; | ||
2623 | - | ||
2624 | - pcm->private_data = line6pcm; | ||
2625 | - pcm->private_free = line6_cleanup_pcm; | ||
2626 | - | ||
2627 | err = line6_create_audio_out_urbs(line6pcm); | ||
2628 | if (err < 0) | ||
2629 | return err; | ||
2630 | diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c | ||
2631 | index 4b3e1c48ca2f..b0c5d4ef6137 100644 | ||
2632 | --- a/sound/usb/mixer.c | ||
2633 | +++ b/sound/usb/mixer.c | ||
2634 | @@ -754,7 +754,6 @@ static int uac_mixer_unit_get_channels(struct mixer_build *state, | ||
2635 | struct uac_mixer_unit_descriptor *desc) | ||
2636 | { | ||
2637 | int mu_channels; | ||
2638 | - void *c; | ||
2639 | |||
2640 | if (desc->bLength < sizeof(*desc)) | ||
2641 | return -EINVAL; | ||
2642 | @@ -777,13 +776,6 @@ static int uac_mixer_unit_get_channels(struct mixer_build *state, | ||
2643 | break; | ||
2644 | } | ||
2645 | |||
2646 | - if (!mu_channels) | ||
2647 | - return 0; | ||
2648 | - | ||
2649 | - c = uac_mixer_unit_bmControls(desc, state->mixer->protocol); | ||
2650 | - if (c - (void *)desc + (mu_channels - 1) / 8 >= desc->bLength) | ||
2651 | - return 0; /* no bmControls -> skip */ | ||
2652 | - | ||
2653 | return mu_channels; | ||
2654 | } | ||
2655 | |||
2656 | @@ -2028,6 +2020,31 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, | ||
2657 | * Mixer Unit | ||
2658 | */ | ||
2659 | |||
2660 | +/* check whether the given in/out overflows bmMixerControls matrix */ | ||
2661 | +static bool mixer_bitmap_overflow(struct uac_mixer_unit_descriptor *desc, | ||
2662 | + int protocol, int num_ins, int num_outs) | ||
2663 | +{ | ||
2664 | + u8 *hdr = (u8 *)desc; | ||
2665 | + u8 *c = uac_mixer_unit_bmControls(desc, protocol); | ||
2666 | + size_t rest; /* remaining bytes after bmMixerControls */ | ||
2667 | + | ||
2668 | + switch (protocol) { | ||
2669 | + case UAC_VERSION_1: | ||
2670 | + default: | ||
2671 | + rest = 1; /* iMixer */ | ||
2672 | + break; | ||
2673 | + case UAC_VERSION_2: | ||
2674 | + rest = 2; /* bmControls + iMixer */ | ||
2675 | + break; | ||
2676 | + case UAC_VERSION_3: | ||
2677 | + rest = 6; /* bmControls + wMixerDescrStr */ | ||
2678 | + break; | ||
2679 | + } | ||
2680 | + | ||
2681 | + /* overflow? */ | ||
2682 | + return c + (num_ins * num_outs + 7) / 8 + rest > hdr + hdr[0]; | ||
2683 | +} | ||
2684 | + | ||
2685 | /* | ||
2686 | * build a mixer unit control | ||
2687 | * | ||
2688 | @@ -2156,6 +2173,9 @@ static int parse_audio_mixer_unit(struct mixer_build *state, int unitid, | ||
2689 | if (err < 0) | ||
2690 | return err; | ||
2691 | num_ins += iterm.channels; | ||
2692 | + if (mixer_bitmap_overflow(desc, state->mixer->protocol, | ||
2693 | + num_ins, num_outs)) | ||
2694 | + break; | ||
2695 | for (; ich < num_ins; ich++) { | ||
2696 | int och, ich_has_controls = 0; | ||
2697 | |||
2698 | diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c | ||
2699 | index 5b342fe30c75..10c6971cf477 100644 | ||
2700 | --- a/sound/usb/mixer_quirks.c | ||
2701 | +++ b/sound/usb/mixer_quirks.c | ||
2702 | @@ -1167,17 +1167,17 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip, | ||
2703 | { | ||
2704 | struct usb_mixer_interface *mixer; | ||
2705 | struct usb_mixer_elem_info *cval; | ||
2706 | - int unitid = 12; /* SamleRate ExtensionUnit ID */ | ||
2707 | + int unitid = 12; /* SampleRate ExtensionUnit ID */ | ||
2708 | |||
2709 | list_for_each_entry(mixer, &chip->mixer_list, list) { | ||
2710 | - cval = mixer_elem_list_to_info(mixer->id_elems[unitid]); | ||
2711 | - if (cval) { | ||
2712 | + if (mixer->id_elems[unitid]) { | ||
2713 | + cval = mixer_elem_list_to_info(mixer->id_elems[unitid]); | ||
2714 | snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR, | ||
2715 | cval->control << 8, | ||
2716 | samplerate_id); | ||
2717 | snd_usb_mixer_notify_id(mixer, unitid); | ||
2718 | + break; | ||
2719 | } | ||
2720 | - break; | ||
2721 | } | ||
2722 | } | ||
2723 | |||
2724 | diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c | ||
2725 | index db114f3977e0..35c57a4204a8 100644 | ||
2726 | --- a/sound/usb/pcm.c | ||
2727 | +++ b/sound/usb/pcm.c | ||
2728 | @@ -350,6 +350,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, | ||
2729 | ep = 0x81; | ||
2730 | ifnum = 2; | ||
2731 | goto add_sync_ep_from_ifnum; | ||
2732 | + case USB_ID(0x1397, 0x0001): /* Behringer UFX1604 */ | ||
2733 | case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */ | ||
2734 | ep = 0x81; | ||
2735 | ifnum = 1; | ||
2736 | diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c | ||
2737 | index d7e06fe0270e..0ce50c319cfd 100644 | ||
2738 | --- a/tools/hv/hv_kvp_daemon.c | ||
2739 | +++ b/tools/hv/hv_kvp_daemon.c | ||
2740 | @@ -1386,6 +1386,8 @@ int main(int argc, char *argv[]) | ||
2741 | daemonize = 0; | ||
2742 | break; | ||
2743 | case 'h': | ||
2744 | + print_usage(argv); | ||
2745 | + exit(0); | ||
2746 | default: | ||
2747 | print_usage(argv); | ||
2748 | exit(EXIT_FAILURE); | ||
2749 | diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c | ||
2750 | index b13300172762..c2bb8a360177 100644 | ||
2751 | --- a/tools/hv/hv_vss_daemon.c | ||
2752 | +++ b/tools/hv/hv_vss_daemon.c | ||
2753 | @@ -229,6 +229,8 @@ int main(int argc, char *argv[]) | ||
2754 | daemonize = 0; | ||
2755 | break; | ||
2756 | case 'h': | ||
2757 | + print_usage(argv); | ||
2758 | + exit(0); | ||
2759 | default: | ||
2760 | print_usage(argv); | ||
2761 | exit(EXIT_FAILURE); | ||
2762 | diff --git a/tools/hv/lsvmbus b/tools/hv/lsvmbus | ||
2763 | index 55e7374bade0..099f2c44dbed 100644 | ||
2764 | --- a/tools/hv/lsvmbus | ||
2765 | +++ b/tools/hv/lsvmbus | ||
2766 | @@ -4,10 +4,10 @@ | ||
2767 | import os | ||
2768 | from optparse import OptionParser | ||
2769 | |||
2770 | +help_msg = "print verbose messages. Try -vv, -vvv for more verbose messages" | ||
2771 | parser = OptionParser() | ||
2772 | -parser.add_option("-v", "--verbose", dest="verbose", | ||
2773 | - help="print verbose messages. Try -vv, -vvv for \ | ||
2774 | - more verbose messages", action="count") | ||
2775 | +parser.add_option( | ||
2776 | + "-v", "--verbose", dest="verbose", help=help_msg, action="count") | ||
2777 | |||
2778 | (options, args) = parser.parse_args() | ||
2779 | |||
2780 | @@ -21,27 +21,28 @@ if not os.path.isdir(vmbus_sys_path): | ||
2781 | exit(-1) | ||
2782 | |||
2783 | vmbus_dev_dict = { | ||
2784 | - '{0e0b6031-5213-4934-818b-38d90ced39db}' : '[Operating system shutdown]', | ||
2785 | - '{9527e630-d0ae-497b-adce-e80ab0175caf}' : '[Time Synchronization]', | ||
2786 | - '{57164f39-9115-4e78-ab55-382f3bd5422d}' : '[Heartbeat]', | ||
2787 | - '{a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}' : '[Data Exchange]', | ||
2788 | - '{35fa2e29-ea23-4236-96ae-3a6ebacba440}' : '[Backup (volume checkpoint)]', | ||
2789 | - '{34d14be3-dee4-41c8-9ae7-6b174977c192}' : '[Guest services]', | ||
2790 | - '{525074dc-8985-46e2-8057-a307dc18a502}' : '[Dynamic Memory]', | ||
2791 | - '{cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}' : 'Synthetic mouse', | ||
2792 | - '{f912ad6d-2b17-48ea-bd65-f927a61c7684}' : 'Synthetic keyboard', | ||
2793 | - '{da0a7802-e377-4aac-8e77-0558eb1073f8}' : 'Synthetic framebuffer adapter', | ||
2794 | - '{f8615163-df3e-46c5-913f-f2d2f965ed0e}' : 'Synthetic network adapter', | ||
2795 | - '{32412632-86cb-44a2-9b5c-50d1417354f5}' : 'Synthetic IDE Controller', | ||
2796 | - '{ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}' : 'Synthetic SCSI Controller', | ||
2797 | - '{2f9bcc4a-0069-4af3-b76b-6fd0be528cda}' : 'Synthetic fiber channel adapter', | ||
2798 | - '{8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}' : 'Synthetic RDMA adapter', | ||
2799 | - '{44c4f61d-4444-4400-9d52-802e27ede19f}' : 'PCI Express pass-through', | ||
2800 | - '{276aacf4-ac15-426c-98dd-7521ad3f01fe}' : '[Reserved system device]', | ||
2801 | - '{f8e65716-3cb3-4a06-9a60-1889c5cccab5}' : '[Reserved system device]', | ||
2802 | - '{3375baf4-9e15-4b30-b765-67acb10d607b}' : '[Reserved system device]', | ||
2803 | + '{0e0b6031-5213-4934-818b-38d90ced39db}': '[Operating system shutdown]', | ||
2804 | + '{9527e630-d0ae-497b-adce-e80ab0175caf}': '[Time Synchronization]', | ||
2805 | + '{57164f39-9115-4e78-ab55-382f3bd5422d}': '[Heartbeat]', | ||
2806 | + '{a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}': '[Data Exchange]', | ||
2807 | + '{35fa2e29-ea23-4236-96ae-3a6ebacba440}': '[Backup (volume checkpoint)]', | ||
2808 | + '{34d14be3-dee4-41c8-9ae7-6b174977c192}': '[Guest services]', | ||
2809 | + '{525074dc-8985-46e2-8057-a307dc18a502}': '[Dynamic Memory]', | ||
2810 | + '{cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}': 'Synthetic mouse', | ||
2811 | + '{f912ad6d-2b17-48ea-bd65-f927a61c7684}': 'Synthetic keyboard', | ||
2812 | + '{da0a7802-e377-4aac-8e77-0558eb1073f8}': 'Synthetic framebuffer adapter', | ||
2813 | + '{f8615163-df3e-46c5-913f-f2d2f965ed0e}': 'Synthetic network adapter', | ||
2814 | + '{32412632-86cb-44a2-9b5c-50d1417354f5}': 'Synthetic IDE Controller', | ||
2815 | + '{ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}': 'Synthetic SCSI Controller', | ||
2816 | + '{2f9bcc4a-0069-4af3-b76b-6fd0be528cda}': 'Synthetic fiber channel adapter', | ||
2817 | + '{8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}': 'Synthetic RDMA adapter', | ||
2818 | + '{44c4f61d-4444-4400-9d52-802e27ede19f}': 'PCI Express pass-through', | ||
2819 | + '{276aacf4-ac15-426c-98dd-7521ad3f01fe}': '[Reserved system device]', | ||
2820 | + '{f8e65716-3cb3-4a06-9a60-1889c5cccab5}': '[Reserved system device]', | ||
2821 | + '{3375baf4-9e15-4b30-b765-67acb10d607b}': '[Reserved system device]', | ||
2822 | } | ||
2823 | |||
2824 | + | ||
2825 | def get_vmbus_dev_attr(dev_name, attr): | ||
2826 | try: | ||
2827 | f = open('%s/%s/%s' % (vmbus_sys_path, dev_name, attr), 'r') | ||
2828 | @@ -52,6 +53,7 @@ def get_vmbus_dev_attr(dev_name, attr): | ||
2829 | |||
2830 | return lines | ||
2831 | |||
2832 | + | ||
2833 | class VMBus_Dev: | ||
2834 | pass | ||
2835 | |||
2836 | @@ -66,12 +68,13 @@ for f in os.listdir(vmbus_sys_path): | ||
2837 | |||
2838 | chn_vp_mapping = get_vmbus_dev_attr(f, 'channel_vp_mapping') | ||
2839 | chn_vp_mapping = [c.strip() for c in chn_vp_mapping] | ||
2840 | - chn_vp_mapping = sorted(chn_vp_mapping, | ||
2841 | - key = lambda c : int(c.split(':')[0])) | ||
2842 | + chn_vp_mapping = sorted( | ||
2843 | + chn_vp_mapping, key=lambda c: int(c.split(':')[0])) | ||
2844 | |||
2845 | - chn_vp_mapping = ['\tRel_ID=%s, target_cpu=%s' % | ||
2846 | - (c.split(':')[0], c.split(':')[1]) | ||
2847 | - for c in chn_vp_mapping] | ||
2848 | + chn_vp_mapping = [ | ||
2849 | + '\tRel_ID=%s, target_cpu=%s' % | ||
2850 | + (c.split(':')[0], c.split(':')[1]) for c in chn_vp_mapping | ||
2851 | + ] | ||
2852 | d = VMBus_Dev() | ||
2853 | d.sysfs_path = '%s/%s' % (vmbus_sys_path, f) | ||
2854 | d.vmbus_id = vmbus_id | ||
2855 | @@ -85,7 +88,7 @@ for f in os.listdir(vmbus_sys_path): | ||
2856 | vmbus_dev_list.append(d) | ||
2857 | |||
2858 | |||
2859 | -vmbus_dev_list = sorted(vmbus_dev_list, key = lambda d : int(d.vmbus_id)) | ||
2860 | +vmbus_dev_list = sorted(vmbus_dev_list, key=lambda d: int(d.vmbus_id)) | ||
2861 | |||
2862 | format0 = '%2s: %s' | ||
2863 | format1 = '%2s: Class_ID = %s - %s\n%s' | ||
2864 | @@ -95,9 +98,15 @@ for d in vmbus_dev_list: | ||
2865 | if verbose == 0: | ||
2866 | print(('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc)) | ||
2867 | elif verbose == 1: | ||
2868 | - print (('VMBUS ID ' + format1) % \ | ||
2869 | - (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping)) | ||
2870 | + print( | ||
2871 | + ('VMBUS ID ' + format1) % | ||
2872 | + (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping) | ||
2873 | + ) | ||
2874 | else: | ||
2875 | - print (('VMBUS ID ' + format2) % \ | ||
2876 | - (d.vmbus_id, d.class_id, d.dev_desc, \ | ||
2877 | - d.device_id, d.sysfs_path, d.chn_vp_mapping)) | ||
2878 | + print( | ||
2879 | + ('VMBUS ID ' + format2) % | ||
2880 | + ( | ||
2881 | + d.vmbus_id, d.class_id, d.dev_desc, | ||
2882 | + d.device_id, d.sysfs_path, d.chn_vp_mapping | ||
2883 | + ) | ||
2884 | + ) | ||
2885 | diff --git a/virt/kvm/arm/vgic/vgic-mmio.c b/virt/kvm/arm/vgic/vgic-mmio.c | ||
2886 | index ceeda7e04a4d..762f81900529 100644 | ||
2887 | --- a/virt/kvm/arm/vgic/vgic-mmio.c | ||
2888 | +++ b/virt/kvm/arm/vgic/vgic-mmio.c | ||
2889 | @@ -203,6 +203,12 @@ static void vgic_hw_irq_spending(struct kvm_vcpu *vcpu, struct vgic_irq *irq, | ||
2890 | vgic_irq_set_phys_active(irq, true); | ||
2891 | } | ||
2892 | |||
2893 | +static bool is_vgic_v2_sgi(struct kvm_vcpu *vcpu, struct vgic_irq *irq) | ||
2894 | +{ | ||
2895 | + return (vgic_irq_is_sgi(irq->intid) && | ||
2896 | + vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V2); | ||
2897 | +} | ||
2898 | + | ||
2899 | void vgic_mmio_write_spending(struct kvm_vcpu *vcpu, | ||
2900 | gpa_t addr, unsigned int len, | ||
2901 | unsigned long val) | ||
2902 | @@ -215,6 +221,12 @@ void vgic_mmio_write_spending(struct kvm_vcpu *vcpu, | ||
2903 | for_each_set_bit(i, &val, len * 8) { | ||
2904 | struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); | ||
2905 | |||
2906 | + /* GICD_ISPENDR0 SGI bits are WI */ | ||
2907 | + if (is_vgic_v2_sgi(vcpu, irq)) { | ||
2908 | + vgic_put_irq(vcpu->kvm, irq); | ||
2909 | + continue; | ||
2910 | + } | ||
2911 | + | ||
2912 | spin_lock_irqsave(&irq->irq_lock, flags); | ||
2913 | if (irq->hw) | ||
2914 | vgic_hw_irq_spending(vcpu, irq, is_uaccess); | ||
2915 | @@ -262,6 +274,12 @@ void vgic_mmio_write_cpending(struct kvm_vcpu *vcpu, | ||
2916 | for_each_set_bit(i, &val, len * 8) { | ||
2917 | struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); | ||
2918 | |||
2919 | + /* GICD_ICPENDR0 SGI bits are WI */ | ||
2920 | + if (is_vgic_v2_sgi(vcpu, irq)) { | ||
2921 | + vgic_put_irq(vcpu->kvm, irq); | ||
2922 | + continue; | ||
2923 | + } | ||
2924 | + | ||
2925 | spin_lock_irqsave(&irq->irq_lock, flags); | ||
2926 | |||
2927 | if (irq->hw) | ||
2928 | diff --git a/virt/kvm/arm/vgic/vgic-v2.c b/virt/kvm/arm/vgic/vgic-v2.c | ||
2929 | index 57281c1594d0..91b14dfacd1d 100644 | ||
2930 | --- a/virt/kvm/arm/vgic/vgic-v2.c | ||
2931 | +++ b/virt/kvm/arm/vgic/vgic-v2.c | ||
2932 | @@ -195,7 +195,10 @@ void vgic_v2_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr) | ||
2933 | if (vgic_irq_is_sgi(irq->intid)) { | ||
2934 | u32 src = ffs(irq->source); | ||
2935 | |||
2936 | - BUG_ON(!src); | ||
2937 | + if (WARN_RATELIMIT(!src, "No SGI source for INTID %d\n", | ||
2938 | + irq->intid)) | ||
2939 | + return; | ||
2940 | + | ||
2941 | val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT; | ||
2942 | irq->source &= ~(1 << (src - 1)); | ||
2943 | if (irq->source) { | ||
2944 | diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c | ||
2945 | index 5c55995a1a16..8b958ed05306 100644 | ||
2946 | --- a/virt/kvm/arm/vgic/vgic-v3.c | ||
2947 | +++ b/virt/kvm/arm/vgic/vgic-v3.c | ||
2948 | @@ -179,7 +179,10 @@ void vgic_v3_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr) | ||
2949 | model == KVM_DEV_TYPE_ARM_VGIC_V2) { | ||
2950 | u32 src = ffs(irq->source); | ||
2951 | |||
2952 | - BUG_ON(!src); | ||
2953 | + if (WARN_RATELIMIT(!src, "No SGI source for INTID %d\n", | ||
2954 | + irq->intid)) | ||
2955 | + return; | ||
2956 | + | ||
2957 | val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT; | ||
2958 | irq->source &= ~(1 << (src - 1)); | ||
2959 | if (irq->source) { | ||
2960 | diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c | ||
2961 | index 250cd72c95a5..4040a33cdc90 100644 | ||
2962 | --- a/virt/kvm/arm/vgic/vgic.c | ||
2963 | +++ b/virt/kvm/arm/vgic/vgic.c | ||
2964 | @@ -244,6 +244,13 @@ static int vgic_irq_cmp(void *priv, struct list_head *a, struct list_head *b) | ||
2965 | bool penda, pendb; | ||
2966 | int ret; | ||
2967 | |||
2968 | + /* | ||
2969 | + * list_sort may call this function with the same element when | ||
2970 | + * the list is fairly long. | ||
2971 | + */ | ||
2972 | + if (unlikely(irqa == irqb)) | ||
2973 | + return 0; | ||
2974 | + | ||
2975 | spin_lock(&irqa->irq_lock); | ||
2976 | spin_lock_nested(&irqb->irq_lock, SINGLE_DEPTH_NESTING); | ||
2977 |