Contents of /trunk/kernel-alx/patches-5.4/0180-5.4.81-all-fixes.patch
Parent Directory | Revision Log
Revision 3635 -
(show annotations)
(download)
Mon Oct 24 12:34:12 2022 UTC (18 months ago) by niro
File size: 127677 byte(s)
Mon Oct 24 12:34:12 2022 UTC (18 months ago) by niro
File size: 127677 byte(s)
-sync kernel patches
1 | diff --git a/Makefile b/Makefile |
2 | index 7c58e4ce51385..5bbb7607fa55f 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,7 +1,7 @@ |
6 | # SPDX-License-Identifier: GPL-2.0 |
7 | VERSION = 5 |
8 | PATCHLEVEL = 4 |
9 | -SUBLEVEL = 80 |
10 | +SUBLEVEL = 81 |
11 | EXTRAVERSION = |
12 | NAME = Kleptomaniac Octopus |
13 | |
14 | diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h |
15 | index 7addd0301c51a..6bdcf9b495b83 100644 |
16 | --- a/arch/arc/include/asm/pgtable.h |
17 | +++ b/arch/arc/include/asm/pgtable.h |
18 | @@ -135,8 +135,10 @@ |
19 | |
20 | #ifdef CONFIG_ARC_HAS_PAE40 |
21 | #define PTE_BITS_NON_RWX_IN_PD1 (0xff00000000 | PAGE_MASK | _PAGE_CACHEABLE) |
22 | +#define MAX_POSSIBLE_PHYSMEM_BITS 40 |
23 | #else |
24 | #define PTE_BITS_NON_RWX_IN_PD1 (PAGE_MASK | _PAGE_CACHEABLE) |
25 | +#define MAX_POSSIBLE_PHYSMEM_BITS 32 |
26 | #endif |
27 | |
28 | /************************************************************************** |
29 | diff --git a/arch/arm/boot/dts/dra76x.dtsi b/arch/arm/boot/dts/dra76x.dtsi |
30 | index 9f6fbe4c1fee1..859e4382ac4bb 100644 |
31 | --- a/arch/arm/boot/dts/dra76x.dtsi |
32 | +++ b/arch/arm/boot/dts/dra76x.dtsi |
33 | @@ -32,8 +32,8 @@ |
34 | interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>, |
35 | <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>; |
36 | interrupt-names = "int0", "int1"; |
37 | - clocks = <&mcan_clk>, <&l3_iclk_div>; |
38 | - clock-names = "cclk", "hclk"; |
39 | + clocks = <&l3_iclk_div>, <&mcan_clk>; |
40 | + clock-names = "hclk", "cclk"; |
41 | bosch,mram-cfg = <0x0 0 0 32 0 0 1 1>; |
42 | }; |
43 | }; |
44 | diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h |
45 | index 51beec41d48c8..50b51ac91fcbe 100644 |
46 | --- a/arch/arm/include/asm/pgtable-2level.h |
47 | +++ b/arch/arm/include/asm/pgtable-2level.h |
48 | @@ -75,6 +75,8 @@ |
49 | #define PTE_HWTABLE_OFF (PTE_HWTABLE_PTRS * sizeof(pte_t)) |
50 | #define PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(u32)) |
51 | |
52 | +#define MAX_POSSIBLE_PHYSMEM_BITS 32 |
53 | + |
54 | /* |
55 | * PMD_SHIFT determines the size of the area a second-level page table can map |
56 | * PGDIR_SHIFT determines what a third-level page table entry can map |
57 | diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h |
58 | index 5b18295021a03..8006a56cc2ce2 100644 |
59 | --- a/arch/arm/include/asm/pgtable-3level.h |
60 | +++ b/arch/arm/include/asm/pgtable-3level.h |
61 | @@ -25,6 +25,8 @@ |
62 | #define PTE_HWTABLE_OFF (0) |
63 | #define PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(u64)) |
64 | |
65 | +#define MAX_POSSIBLE_PHYSMEM_BITS 40 |
66 | + |
67 | /* |
68 | * PGDIR_SHIFT determines the size a top-level page table entry can map. |
69 | */ |
70 | diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c |
71 | index a92d277f81a08..c8d317fafe2ea 100644 |
72 | --- a/arch/arm/mach-omap2/cpuidle44xx.c |
73 | +++ b/arch/arm/mach-omap2/cpuidle44xx.c |
74 | @@ -175,8 +175,11 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev, |
75 | if (mpuss_can_lose_context) { |
76 | error = cpu_cluster_pm_enter(); |
77 | if (error) { |
78 | - omap_set_pwrdm_state(mpu_pd, PWRDM_POWER_ON); |
79 | - goto cpu_cluster_pm_out; |
80 | + index = 0; |
81 | + cx = state_ptr + index; |
82 | + pwrdm_set_logic_retst(mpu_pd, cx->mpu_logic_state); |
83 | + omap_set_pwrdm_state(mpu_pd, cx->mpu_state); |
84 | + mpuss_can_lose_context = 0; |
85 | } |
86 | } |
87 | } |
88 | @@ -184,7 +187,6 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev, |
89 | omap4_enter_lowpower(dev->cpu, cx->cpu_state); |
90 | cpu_done[dev->cpu] = true; |
91 | |
92 | -cpu_cluster_pm_out: |
93 | /* Wakeup CPU1 only if it is not offlined */ |
94 | if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) { |
95 | |
96 | diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
97 | index 5728255bd0c1a..78f7e6e50beb0 100644 |
98 | --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
99 | +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
100 | @@ -692,7 +692,7 @@ |
101 | |
102 | hsp_aon: hsp@c150000 { |
103 | compatible = "nvidia,tegra194-hsp", "nvidia,tegra186-hsp"; |
104 | - reg = <0x0c150000 0xa0000>; |
105 | + reg = <0x0c150000 0x90000>; |
106 | interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>, |
107 | <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>, |
108 | <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>, |
109 | diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h |
110 | index 41dd4b1f0ccba..69dfc340e71b1 100644 |
111 | --- a/arch/arm64/include/asm/pgtable.h |
112 | +++ b/arch/arm64/include/asm/pgtable.h |
113 | @@ -98,8 +98,6 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
114 | #define pte_valid(pte) (!!(pte_val(pte) & PTE_VALID)) |
115 | #define pte_valid_not_user(pte) \ |
116 | ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID) |
117 | -#define pte_valid_young(pte) \ |
118 | - ((pte_val(pte) & (PTE_VALID | PTE_AF)) == (PTE_VALID | PTE_AF)) |
119 | #define pte_valid_user(pte) \ |
120 | ((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER)) |
121 | |
122 | @@ -107,9 +105,12 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
123 | * Could the pte be present in the TLB? We must check mm_tlb_flush_pending |
124 | * so that we don't erroneously return false for pages that have been |
125 | * remapped as PROT_NONE but are yet to be flushed from the TLB. |
126 | + * Note that we can't make any assumptions based on the state of the access |
127 | + * flag, since ptep_clear_flush_young() elides a DSB when invalidating the |
128 | + * TLB. |
129 | */ |
130 | #define pte_accessible(mm, pte) \ |
131 | - (mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid_young(pte)) |
132 | + (mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid(pte)) |
133 | |
134 | /* |
135 | * p??_access_permitted() is true for valid user mappings (subject to the |
136 | @@ -135,13 +136,6 @@ static inline pte_t set_pte_bit(pte_t pte, pgprot_t prot) |
137 | return pte; |
138 | } |
139 | |
140 | -static inline pte_t pte_wrprotect(pte_t pte) |
141 | -{ |
142 | - pte = clear_pte_bit(pte, __pgprot(PTE_WRITE)); |
143 | - pte = set_pte_bit(pte, __pgprot(PTE_RDONLY)); |
144 | - return pte; |
145 | -} |
146 | - |
147 | static inline pte_t pte_mkwrite(pte_t pte) |
148 | { |
149 | pte = set_pte_bit(pte, __pgprot(PTE_WRITE)); |
150 | @@ -167,6 +161,20 @@ static inline pte_t pte_mkdirty(pte_t pte) |
151 | return pte; |
152 | } |
153 | |
154 | +static inline pte_t pte_wrprotect(pte_t pte) |
155 | +{ |
156 | + /* |
157 | + * If hardware-dirty (PTE_WRITE/DBM bit set and PTE_RDONLY |
158 | + * clear), set the PTE_DIRTY bit. |
159 | + */ |
160 | + if (pte_hw_dirty(pte)) |
161 | + pte = pte_mkdirty(pte); |
162 | + |
163 | + pte = clear_pte_bit(pte, __pgprot(PTE_WRITE)); |
164 | + pte = set_pte_bit(pte, __pgprot(PTE_RDONLY)); |
165 | + return pte; |
166 | +} |
167 | + |
168 | static inline pte_t pte_mkold(pte_t pte) |
169 | { |
170 | return clear_pte_bit(pte, __pgprot(PTE_AF)); |
171 | @@ -782,12 +790,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres |
172 | pte = READ_ONCE(*ptep); |
173 | do { |
174 | old_pte = pte; |
175 | - /* |
176 | - * If hardware-dirty (PTE_WRITE/DBM bit set and PTE_RDONLY |
177 | - * clear), set the PTE_DIRTY bit. |
178 | - */ |
179 | - if (pte_hw_dirty(pte)) |
180 | - pte = pte_mkdirty(pte); |
181 | pte = pte_wrprotect(pte); |
182 | pte_val(pte) = cmpxchg_relaxed(&pte_val(*ptep), |
183 | pte_val(old_pte), pte_val(pte)); |
184 | diff --git a/arch/mips/include/asm/pgtable-32.h b/arch/mips/include/asm/pgtable-32.h |
185 | index ba967148b016b..2604fab8a92dc 100644 |
186 | --- a/arch/mips/include/asm/pgtable-32.h |
187 | +++ b/arch/mips/include/asm/pgtable-32.h |
188 | @@ -155,6 +155,7 @@ static inline void pmd_clear(pmd_t *pmdp) |
189 | |
190 | #if defined(CONFIG_XPA) |
191 | |
192 | +#define MAX_POSSIBLE_PHYSMEM_BITS 40 |
193 | #define pte_pfn(x) (((unsigned long)((x).pte_high >> _PFN_SHIFT)) | (unsigned long)((x).pte_low << _PAGE_PRESENT_SHIFT)) |
194 | static inline pte_t |
195 | pfn_pte(unsigned long pfn, pgprot_t prot) |
196 | @@ -170,6 +171,7 @@ pfn_pte(unsigned long pfn, pgprot_t prot) |
197 | |
198 | #elif defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32) |
199 | |
200 | +#define MAX_POSSIBLE_PHYSMEM_BITS 36 |
201 | #define pte_pfn(x) ((unsigned long)((x).pte_high >> 6)) |
202 | |
203 | static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot) |
204 | @@ -184,6 +186,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot) |
205 | |
206 | #else |
207 | |
208 | +#define MAX_POSSIBLE_PHYSMEM_BITS 32 |
209 | #ifdef CONFIG_CPU_VR41XX |
210 | #define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2))) |
211 | #define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot)) |
212 | diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h |
213 | index 0796533d37dd5..7b6349be621a3 100644 |
214 | --- a/arch/powerpc/include/asm/book3s/32/pgtable.h |
215 | +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h |
216 | @@ -37,8 +37,10 @@ static inline bool pte_user(pte_t pte) |
217 | */ |
218 | #ifdef CONFIG_PTE_64BIT |
219 | #define PTE_RPN_MASK (~((1ULL << PTE_RPN_SHIFT) - 1)) |
220 | +#define MAX_POSSIBLE_PHYSMEM_BITS 36 |
221 | #else |
222 | #define PTE_RPN_MASK (~((1UL << PTE_RPN_SHIFT) - 1)) |
223 | +#define MAX_POSSIBLE_PHYSMEM_BITS 32 |
224 | #endif |
225 | |
226 | /* |
227 | diff --git a/arch/powerpc/include/asm/book3s/64/kup-radix.h b/arch/powerpc/include/asm/book3s/64/kup-radix.h |
228 | index c1e45f510591e..a29b64129a7d4 100644 |
229 | --- a/arch/powerpc/include/asm/book3s/64/kup-radix.h |
230 | +++ b/arch/powerpc/include/asm/book3s/64/kup-radix.h |
231 | @@ -54,6 +54,8 @@ |
232 | |
233 | #else /* !__ASSEMBLY__ */ |
234 | |
235 | +#include <linux/jump_label.h> |
236 | + |
237 | DECLARE_STATIC_KEY_FALSE(uaccess_flush_key); |
238 | |
239 | #ifdef CONFIG_PPC_KUAP |
240 | diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h |
241 | index 552b96eef0c8e..3d32d7103ec8e 100644 |
242 | --- a/arch/powerpc/include/asm/nohash/32/pgtable.h |
243 | +++ b/arch/powerpc/include/asm/nohash/32/pgtable.h |
244 | @@ -148,8 +148,10 @@ int map_kernel_page(unsigned long va, phys_addr_t pa, pgprot_t prot); |
245 | */ |
246 | #if defined(CONFIG_PPC32) && defined(CONFIG_PTE_64BIT) |
247 | #define PTE_RPN_MASK (~((1ULL << PTE_RPN_SHIFT) - 1)) |
248 | +#define MAX_POSSIBLE_PHYSMEM_BITS 36 |
249 | #else |
250 | #define PTE_RPN_MASK (~((1UL << PTE_RPN_SHIFT) - 1)) |
251 | +#define MAX_POSSIBLE_PHYSMEM_BITS 32 |
252 | #endif |
253 | |
254 | /* |
255 | diff --git a/arch/powerpc/kvm/book3s_xive_native.c b/arch/powerpc/kvm/book3s_xive_native.c |
256 | index 235d57d6c205e..d78d8487c1d6b 100644 |
257 | --- a/arch/powerpc/kvm/book3s_xive_native.c |
258 | +++ b/arch/powerpc/kvm/book3s_xive_native.c |
259 | @@ -252,6 +252,13 @@ static vm_fault_t xive_native_esb_fault(struct vm_fault *vmf) |
260 | } |
261 | |
262 | state = &sb->irq_state[src]; |
263 | + |
264 | + /* Some sanity checking */ |
265 | + if (!state->valid) { |
266 | + pr_devel("%s: source %lx invalid !\n", __func__, irq); |
267 | + return VM_FAULT_SIGBUS; |
268 | + } |
269 | + |
270 | kvmppc_xive_select_irq(state, &hw_num, &xd); |
271 | |
272 | arch_spin_lock(&sb->lock); |
273 | diff --git a/arch/riscv/include/asm/pgtable-32.h b/arch/riscv/include/asm/pgtable-32.h |
274 | index b0ab66e5fdb1d..5b2e79e5bfa5b 100644 |
275 | --- a/arch/riscv/include/asm/pgtable-32.h |
276 | +++ b/arch/riscv/include/asm/pgtable-32.h |
277 | @@ -14,4 +14,6 @@ |
278 | #define PGDIR_SIZE (_AC(1, UL) << PGDIR_SHIFT) |
279 | #define PGDIR_MASK (~(PGDIR_SIZE - 1)) |
280 | |
281 | +#define MAX_POSSIBLE_PHYSMEM_BITS 34 |
282 | + |
283 | #endif /* _ASM_RISCV_PGTABLE_32_H */ |
284 | diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c |
285 | index 4814c964692cb..0b50119ea12cc 100644 |
286 | --- a/arch/x86/events/intel/cstate.c |
287 | +++ b/arch/x86/events/intel/cstate.c |
288 | @@ -107,14 +107,14 @@ |
289 | MODULE_LICENSE("GPL"); |
290 | |
291 | #define DEFINE_CSTATE_FORMAT_ATTR(_var, _name, _format) \ |
292 | -static ssize_t __cstate_##_var##_show(struct kobject *kobj, \ |
293 | - struct kobj_attribute *attr, \ |
294 | +static ssize_t __cstate_##_var##_show(struct device *dev, \ |
295 | + struct device_attribute *attr, \ |
296 | char *page) \ |
297 | { \ |
298 | BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ |
299 | return sprintf(page, _format "\n"); \ |
300 | } \ |
301 | -static struct kobj_attribute format_attr_##_var = \ |
302 | +static struct device_attribute format_attr_##_var = \ |
303 | __ATTR(_name, 0444, __cstate_##_var##_show, NULL) |
304 | |
305 | static ssize_t cstate_get_attr_cpumask(struct device *dev, |
306 | diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c |
307 | index 86467f85c3831..a335be03aeef1 100644 |
308 | --- a/arch/x86/events/intel/uncore.c |
309 | +++ b/arch/x86/events/intel/uncore.c |
310 | @@ -92,8 +92,8 @@ end: |
311 | return map; |
312 | } |
313 | |
314 | -ssize_t uncore_event_show(struct kobject *kobj, |
315 | - struct kobj_attribute *attr, char *buf) |
316 | +ssize_t uncore_event_show(struct device *dev, |
317 | + struct device_attribute *attr, char *buf) |
318 | { |
319 | struct uncore_event_desc *event = |
320 | container_of(attr, struct uncore_event_desc, attr); |
321 | diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h |
322 | index bbfdaa720b456..7b964c63e993c 100644 |
323 | --- a/arch/x86/events/intel/uncore.h |
324 | +++ b/arch/x86/events/intel/uncore.h |
325 | @@ -144,7 +144,7 @@ struct intel_uncore_box { |
326 | #define UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS 2 |
327 | |
328 | struct uncore_event_desc { |
329 | - struct kobj_attribute attr; |
330 | + struct device_attribute attr; |
331 | const char *config; |
332 | }; |
333 | |
334 | @@ -165,8 +165,8 @@ struct pci2phy_map { |
335 | struct pci2phy_map *__find_pci2phy_map(int segment); |
336 | int uncore_pcibus_to_physid(struct pci_bus *bus); |
337 | |
338 | -ssize_t uncore_event_show(struct kobject *kobj, |
339 | - struct kobj_attribute *attr, char *buf); |
340 | +ssize_t uncore_event_show(struct device *dev, |
341 | + struct device_attribute *attr, char *buf); |
342 | |
343 | #define INTEL_UNCORE_EVENT_DESC(_name, _config) \ |
344 | { \ |
345 | @@ -175,14 +175,14 @@ ssize_t uncore_event_show(struct kobject *kobj, |
346 | } |
347 | |
348 | #define DEFINE_UNCORE_FORMAT_ATTR(_var, _name, _format) \ |
349 | -static ssize_t __uncore_##_var##_show(struct kobject *kobj, \ |
350 | - struct kobj_attribute *attr, \ |
351 | +static ssize_t __uncore_##_var##_show(struct device *dev, \ |
352 | + struct device_attribute *attr, \ |
353 | char *page) \ |
354 | { \ |
355 | BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ |
356 | return sprintf(page, _format "\n"); \ |
357 | } \ |
358 | -static struct kobj_attribute format_attr_##_var = \ |
359 | +static struct device_attribute format_attr_##_var = \ |
360 | __ATTR(_name, 0444, __uncore_##_var##_show, NULL) |
361 | |
362 | static inline bool uncore_pmc_fixed(int idx) |
363 | diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c |
364 | index 187c72a58e69c..9050d7b8abc5a 100644 |
365 | --- a/arch/x86/events/rapl.c |
366 | +++ b/arch/x86/events/rapl.c |
367 | @@ -93,18 +93,6 @@ static const char *const rapl_domain_names[NR_RAPL_DOMAINS] __initconst = { |
368 | * any other bit is reserved |
369 | */ |
370 | #define RAPL_EVENT_MASK 0xFFULL |
371 | - |
372 | -#define DEFINE_RAPL_FORMAT_ATTR(_var, _name, _format) \ |
373 | -static ssize_t __rapl_##_var##_show(struct kobject *kobj, \ |
374 | - struct kobj_attribute *attr, \ |
375 | - char *page) \ |
376 | -{ \ |
377 | - BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ |
378 | - return sprintf(page, _format "\n"); \ |
379 | -} \ |
380 | -static struct kobj_attribute format_attr_##_var = \ |
381 | - __ATTR(_name, 0444, __rapl_##_var##_show, NULL) |
382 | - |
383 | #define RAPL_CNTR_WIDTH 32 |
384 | |
385 | #define RAPL_EVENT_ATTR_STR(_name, v, str) \ |
386 | @@ -433,7 +421,7 @@ static struct attribute_group rapl_pmu_events_group = { |
387 | .attrs = attrs_empty, |
388 | }; |
389 | |
390 | -DEFINE_RAPL_FORMAT_ATTR(event, event, "config:0-7"); |
391 | +PMU_FORMAT_ATTR(event, "config:0-7"); |
392 | static struct attribute *rapl_formats_attr[] = { |
393 | &format_attr_event.attr, |
394 | NULL, |
395 | diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h |
396 | index c41686641c3fb..c52b7073a5ab5 100644 |
397 | --- a/arch/x86/include/asm/kvm_host.h |
398 | +++ b/arch/x86/include/asm/kvm_host.h |
399 | @@ -1560,6 +1560,7 @@ int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); |
400 | int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); |
401 | int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v); |
402 | int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu); |
403 | +int kvm_cpu_has_extint(struct kvm_vcpu *v); |
404 | int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu); |
405 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); |
406 | void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event); |
407 | diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c |
408 | index bdc1ed7ff6692..fcc4238ee95f8 100644 |
409 | --- a/arch/x86/kernel/cpu/bugs.c |
410 | +++ b/arch/x86/kernel/cpu/bugs.c |
411 | @@ -733,11 +733,13 @@ spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd) |
412 | if (boot_cpu_has(X86_FEATURE_IBPB)) { |
413 | setup_force_cpu_cap(X86_FEATURE_USE_IBPB); |
414 | |
415 | + spectre_v2_user_ibpb = mode; |
416 | switch (cmd) { |
417 | case SPECTRE_V2_USER_CMD_FORCE: |
418 | case SPECTRE_V2_USER_CMD_PRCTL_IBPB: |
419 | case SPECTRE_V2_USER_CMD_SECCOMP_IBPB: |
420 | static_branch_enable(&switch_mm_always_ibpb); |
421 | + spectre_v2_user_ibpb = SPECTRE_V2_USER_STRICT; |
422 | break; |
423 | case SPECTRE_V2_USER_CMD_PRCTL: |
424 | case SPECTRE_V2_USER_CMD_AUTO: |
425 | @@ -751,8 +753,6 @@ spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd) |
426 | pr_info("mitigation: Enabling %s Indirect Branch Prediction Barrier\n", |
427 | static_key_enabled(&switch_mm_always_ibpb) ? |
428 | "always-on" : "conditional"); |
429 | - |
430 | - spectre_v2_user_ibpb = mode; |
431 | } |
432 | |
433 | /* |
434 | diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c |
435 | index 92331de16d70e..c2a9762d278dd 100644 |
436 | --- a/arch/x86/kernel/cpu/mce/core.c |
437 | +++ b/arch/x86/kernel/cpu/mce/core.c |
438 | @@ -1361,8 +1361,10 @@ void do_machine_check(struct pt_regs *regs, long error_code) |
439 | * When there's any problem use only local no_way_out state. |
440 | */ |
441 | if (!lmce) { |
442 | - if (mce_end(order) < 0) |
443 | - no_way_out = worst >= MCE_PANIC_SEVERITY; |
444 | + if (mce_end(order) < 0) { |
445 | + if (!no_way_out) |
446 | + no_way_out = worst >= MCE_PANIC_SEVERITY; |
447 | + } |
448 | } else { |
449 | /* |
450 | * If there was a fatal machine check we should have |
451 | diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c |
452 | index 54b711bc06073..830ccc396e26d 100644 |
453 | --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c |
454 | +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c |
455 | @@ -507,6 +507,24 @@ unlock: |
456 | return ret ?: nbytes; |
457 | } |
458 | |
459 | +/** |
460 | + * rdtgroup_remove - the helper to remove resource group safely |
461 | + * @rdtgrp: resource group to remove |
462 | + * |
463 | + * On resource group creation via a mkdir, an extra kernfs_node reference is |
464 | + * taken to ensure that the rdtgroup structure remains accessible for the |
465 | + * rdtgroup_kn_unlock() calls where it is removed. |
466 | + * |
467 | + * Drop the extra reference here, then free the rdtgroup structure. |
468 | + * |
469 | + * Return: void |
470 | + */ |
471 | +static void rdtgroup_remove(struct rdtgroup *rdtgrp) |
472 | +{ |
473 | + kernfs_put(rdtgrp->kn); |
474 | + kfree(rdtgrp); |
475 | +} |
476 | + |
477 | struct task_move_callback { |
478 | struct callback_head work; |
479 | struct rdtgroup *rdtgrp; |
480 | @@ -529,7 +547,7 @@ static void move_myself(struct callback_head *head) |
481 | (rdtgrp->flags & RDT_DELETED)) { |
482 | current->closid = 0; |
483 | current->rmid = 0; |
484 | - kfree(rdtgrp); |
485 | + rdtgroup_remove(rdtgrp); |
486 | } |
487 | |
488 | preempt_disable(); |
489 | @@ -1618,7 +1636,6 @@ static int rdtgroup_mkdir_info_resdir(struct rdt_resource *r, char *name, |
490 | if (IS_ERR(kn_subdir)) |
491 | return PTR_ERR(kn_subdir); |
492 | |
493 | - kernfs_get(kn_subdir); |
494 | ret = rdtgroup_kn_set_ugid(kn_subdir); |
495 | if (ret) |
496 | return ret; |
497 | @@ -1641,7 +1658,6 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) |
498 | kn_info = kernfs_create_dir(parent_kn, "info", parent_kn->mode, NULL); |
499 | if (IS_ERR(kn_info)) |
500 | return PTR_ERR(kn_info); |
501 | - kernfs_get(kn_info); |
502 | |
503 | ret = rdtgroup_add_files(kn_info, RF_TOP_INFO); |
504 | if (ret) |
505 | @@ -1662,12 +1678,6 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) |
506 | goto out_destroy; |
507 | } |
508 | |
509 | - /* |
510 | - * This extra ref will be put in kernfs_remove() and guarantees |
511 | - * that @rdtgrp->kn is always accessible. |
512 | - */ |
513 | - kernfs_get(kn_info); |
514 | - |
515 | ret = rdtgroup_kn_set_ugid(kn_info); |
516 | if (ret) |
517 | goto out_destroy; |
518 | @@ -1696,12 +1706,6 @@ mongroup_create_dir(struct kernfs_node *parent_kn, struct rdtgroup *prgrp, |
519 | if (dest_kn) |
520 | *dest_kn = kn; |
521 | |
522 | - /* |
523 | - * This extra ref will be put in kernfs_remove() and guarantees |
524 | - * that @rdtgrp->kn is always accessible. |
525 | - */ |
526 | - kernfs_get(kn); |
527 | - |
528 | ret = rdtgroup_kn_set_ugid(kn); |
529 | if (ret) |
530 | goto out_destroy; |
531 | @@ -1928,8 +1932,7 @@ void rdtgroup_kn_unlock(struct kernfs_node *kn) |
532 | rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) |
533 | rdtgroup_pseudo_lock_remove(rdtgrp); |
534 | kernfs_unbreak_active_protection(kn); |
535 | - kernfs_put(rdtgrp->kn); |
536 | - kfree(rdtgrp); |
537 | + rdtgroup_remove(rdtgrp); |
538 | } else { |
539 | kernfs_unbreak_active_protection(kn); |
540 | } |
541 | @@ -1988,13 +1991,11 @@ static int rdt_get_tree(struct fs_context *fc) |
542 | &kn_mongrp); |
543 | if (ret < 0) |
544 | goto out_info; |
545 | - kernfs_get(kn_mongrp); |
546 | |
547 | ret = mkdir_mondata_all(rdtgroup_default.kn, |
548 | &rdtgroup_default, &kn_mondata); |
549 | if (ret < 0) |
550 | goto out_mongrp; |
551 | - kernfs_get(kn_mondata); |
552 | rdtgroup_default.mon.mon_data_kn = kn_mondata; |
553 | } |
554 | |
555 | @@ -2223,7 +2224,7 @@ static void free_all_child_rdtgrp(struct rdtgroup *rdtgrp) |
556 | if (atomic_read(&sentry->waitcount) != 0) |
557 | sentry->flags = RDT_DELETED; |
558 | else |
559 | - kfree(sentry); |
560 | + rdtgroup_remove(sentry); |
561 | } |
562 | } |
563 | |
564 | @@ -2265,7 +2266,7 @@ static void rmdir_all_sub(void) |
565 | if (atomic_read(&rdtgrp->waitcount) != 0) |
566 | rdtgrp->flags = RDT_DELETED; |
567 | else |
568 | - kfree(rdtgrp); |
569 | + rdtgroup_remove(rdtgrp); |
570 | } |
571 | /* Notify online CPUs to update per cpu storage and PQR_ASSOC MSR */ |
572 | update_closid_rmid(cpu_online_mask, &rdtgroup_default); |
573 | @@ -2365,11 +2366,6 @@ static int mkdir_mondata_subdir(struct kernfs_node *parent_kn, |
574 | if (IS_ERR(kn)) |
575 | return PTR_ERR(kn); |
576 | |
577 | - /* |
578 | - * This extra ref will be put in kernfs_remove() and guarantees |
579 | - * that kn is always accessible. |
580 | - */ |
581 | - kernfs_get(kn); |
582 | ret = rdtgroup_kn_set_ugid(kn); |
583 | if (ret) |
584 | goto out_destroy; |
585 | @@ -2705,8 +2701,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, |
586 | /* |
587 | * kernfs_remove() will drop the reference count on "kn" which |
588 | * will free it. But we still need it to stick around for the |
589 | - * rdtgroup_kn_unlock(kn} call below. Take one extra reference |
590 | - * here, which will be dropped inside rdtgroup_kn_unlock(). |
591 | + * rdtgroup_kn_unlock(kn) call. Take one extra reference here, |
592 | + * which will be dropped by kernfs_put() in rdtgroup_remove(). |
593 | */ |
594 | kernfs_get(kn); |
595 | |
596 | @@ -2747,6 +2743,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, |
597 | out_idfree: |
598 | free_rmid(rdtgrp->mon.rmid); |
599 | out_destroy: |
600 | + kernfs_put(rdtgrp->kn); |
601 | kernfs_remove(rdtgrp->kn); |
602 | out_free_rgrp: |
603 | kfree(rdtgrp); |
604 | @@ -2759,7 +2756,7 @@ static void mkdir_rdt_prepare_clean(struct rdtgroup *rgrp) |
605 | { |
606 | kernfs_remove(rgrp->kn); |
607 | free_rmid(rgrp->mon.rmid); |
608 | - kfree(rgrp); |
609 | + rdtgroup_remove(rgrp); |
610 | } |
611 | |
612 | /* |
613 | @@ -2921,11 +2918,6 @@ static int rdtgroup_rmdir_mon(struct kernfs_node *kn, struct rdtgroup *rdtgrp, |
614 | WARN_ON(list_empty(&prdtgrp->mon.crdtgrp_list)); |
615 | list_del(&rdtgrp->mon.crdtgrp_list); |
616 | |
617 | - /* |
618 | - * one extra hold on this, will drop when we kfree(rdtgrp) |
619 | - * in rdtgroup_kn_unlock() |
620 | - */ |
621 | - kernfs_get(kn); |
622 | kernfs_remove(rdtgrp->kn); |
623 | |
624 | return 0; |
625 | @@ -2937,11 +2929,6 @@ static int rdtgroup_ctrl_remove(struct kernfs_node *kn, |
626 | rdtgrp->flags = RDT_DELETED; |
627 | list_del(&rdtgrp->rdtgroup_list); |
628 | |
629 | - /* |
630 | - * one extra hold on this, will drop when we kfree(rdtgrp) |
631 | - * in rdtgroup_kn_unlock() |
632 | - */ |
633 | - kernfs_get(kn); |
634 | kernfs_remove(rdtgrp->kn); |
635 | return 0; |
636 | } |
637 | diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c |
638 | index e330e7d125f72..896db1aa77e7f 100644 |
639 | --- a/arch/x86/kvm/irq.c |
640 | +++ b/arch/x86/kvm/irq.c |
641 | @@ -40,29 +40,10 @@ static int pending_userspace_extint(struct kvm_vcpu *v) |
642 | * check if there is pending interrupt from |
643 | * non-APIC source without intack. |
644 | */ |
645 | -static int kvm_cpu_has_extint(struct kvm_vcpu *v) |
646 | -{ |
647 | - u8 accept = kvm_apic_accept_pic_intr(v); |
648 | - |
649 | - if (accept) { |
650 | - if (irqchip_split(v->kvm)) |
651 | - return pending_userspace_extint(v); |
652 | - else |
653 | - return v->kvm->arch.vpic->output; |
654 | - } else |
655 | - return 0; |
656 | -} |
657 | - |
658 | -/* |
659 | - * check if there is injectable interrupt: |
660 | - * when virtual interrupt delivery enabled, |
661 | - * interrupt from apic will handled by hardware, |
662 | - * we don't need to check it here. |
663 | - */ |
664 | -int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v) |
665 | +int kvm_cpu_has_extint(struct kvm_vcpu *v) |
666 | { |
667 | /* |
668 | - * FIXME: interrupt.injected represents an interrupt that it's |
669 | + * FIXME: interrupt.injected represents an interrupt whose |
670 | * side-effects have already been applied (e.g. bit from IRR |
671 | * already moved to ISR). Therefore, it is incorrect to rely |
672 | * on interrupt.injected to know if there is a pending |
673 | @@ -75,6 +56,23 @@ int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v) |
674 | if (!lapic_in_kernel(v)) |
675 | return v->arch.interrupt.injected; |
676 | |
677 | + if (!kvm_apic_accept_pic_intr(v)) |
678 | + return 0; |
679 | + |
680 | + if (irqchip_split(v->kvm)) |
681 | + return pending_userspace_extint(v); |
682 | + else |
683 | + return v->kvm->arch.vpic->output; |
684 | +} |
685 | + |
686 | +/* |
687 | + * check if there is injectable interrupt: |
688 | + * when virtual interrupt delivery enabled, |
689 | + * interrupt from apic will handled by hardware, |
690 | + * we don't need to check it here. |
691 | + */ |
692 | +int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v) |
693 | +{ |
694 | if (kvm_cpu_has_extint(v)) |
695 | return 1; |
696 | |
697 | @@ -90,20 +88,6 @@ int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v) |
698 | */ |
699 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v) |
700 | { |
701 | - /* |
702 | - * FIXME: interrupt.injected represents an interrupt that it's |
703 | - * side-effects have already been applied (e.g. bit from IRR |
704 | - * already moved to ISR). Therefore, it is incorrect to rely |
705 | - * on interrupt.injected to know if there is a pending |
706 | - * interrupt in the user-mode LAPIC. |
707 | - * This leads to nVMX/nSVM not be able to distinguish |
708 | - * if it should exit from L2 to L1 on EXTERNAL_INTERRUPT on |
709 | - * pending interrupt or should re-inject an injected |
710 | - * interrupt. |
711 | - */ |
712 | - if (!lapic_in_kernel(v)) |
713 | - return v->arch.interrupt.injected; |
714 | - |
715 | if (kvm_cpu_has_extint(v)) |
716 | return 1; |
717 | |
718 | @@ -117,16 +101,21 @@ EXPORT_SYMBOL_GPL(kvm_cpu_has_interrupt); |
719 | */ |
720 | static int kvm_cpu_get_extint(struct kvm_vcpu *v) |
721 | { |
722 | - if (kvm_cpu_has_extint(v)) { |
723 | - if (irqchip_split(v->kvm)) { |
724 | - int vector = v->arch.pending_external_vector; |
725 | - |
726 | - v->arch.pending_external_vector = -1; |
727 | - return vector; |
728 | - } else |
729 | - return kvm_pic_read_irq(v->kvm); /* PIC */ |
730 | - } else |
731 | + if (!kvm_cpu_has_extint(v)) { |
732 | + WARN_ON(!lapic_in_kernel(v)); |
733 | return -1; |
734 | + } |
735 | + |
736 | + if (!lapic_in_kernel(v)) |
737 | + return v->arch.interrupt.nr; |
738 | + |
739 | + if (irqchip_split(v->kvm)) { |
740 | + int vector = v->arch.pending_external_vector; |
741 | + |
742 | + v->arch.pending_external_vector = -1; |
743 | + return vector; |
744 | + } else |
745 | + return kvm_pic_read_irq(v->kvm); /* PIC */ |
746 | } |
747 | |
748 | /* |
749 | @@ -134,13 +123,7 @@ static int kvm_cpu_get_extint(struct kvm_vcpu *v) |
750 | */ |
751 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v) |
752 | { |
753 | - int vector; |
754 | - |
755 | - if (!lapic_in_kernel(v)) |
756 | - return v->arch.interrupt.nr; |
757 | - |
758 | - vector = kvm_cpu_get_extint(v); |
759 | - |
760 | + int vector = kvm_cpu_get_extint(v); |
761 | if (vector != -1) |
762 | return vector; /* PIC */ |
763 | |
764 | diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c |
765 | index 9f793c9649cdf..3f6b866c644d5 100644 |
766 | --- a/arch/x86/kvm/lapic.c |
767 | +++ b/arch/x86/kvm/lapic.c |
768 | @@ -2330,7 +2330,7 @@ int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu) |
769 | struct kvm_lapic *apic = vcpu->arch.apic; |
770 | u32 ppr; |
771 | |
772 | - if (!kvm_apic_hw_enabled(apic)) |
773 | + if (!kvm_apic_present(vcpu)) |
774 | return -1; |
775 | |
776 | __apic_update_ppr(apic, &ppr); |
777 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
778 | index 880a24889291c..b7f86acb8c911 100644 |
779 | --- a/arch/x86/kvm/x86.c |
780 | +++ b/arch/x86/kvm/x86.c |
781 | @@ -3624,21 +3624,23 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu, |
782 | |
783 | static int kvm_cpu_accept_dm_intr(struct kvm_vcpu *vcpu) |
784 | { |
785 | + /* |
786 | + * We can accept userspace's request for interrupt injection |
787 | + * as long as we have a place to store the interrupt number. |
788 | + * The actual injection will happen when the CPU is able to |
789 | + * deliver the interrupt. |
790 | + */ |
791 | + if (kvm_cpu_has_extint(vcpu)) |
792 | + return false; |
793 | + |
794 | + /* Acknowledging ExtINT does not happen if LINT0 is masked. */ |
795 | return (!lapic_in_kernel(vcpu) || |
796 | kvm_apic_accept_pic_intr(vcpu)); |
797 | } |
798 | |
799 | -/* |
800 | - * if userspace requested an interrupt window, check that the |
801 | - * interrupt window is open. |
802 | - * |
803 | - * No need to exit to userspace if we already have an interrupt queued. |
804 | - */ |
805 | static int kvm_vcpu_ready_for_interrupt_injection(struct kvm_vcpu *vcpu) |
806 | { |
807 | return kvm_arch_interrupt_allowed(vcpu) && |
808 | - !kvm_cpu_has_interrupt(vcpu) && |
809 | - !kvm_event_needs_reinjection(vcpu) && |
810 | kvm_cpu_accept_dm_intr(vcpu); |
811 | } |
812 | |
813 | diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c |
814 | index 6deb49094c605..d817b7c862a62 100644 |
815 | --- a/arch/x86/xen/spinlock.c |
816 | +++ b/arch/x86/xen/spinlock.c |
817 | @@ -93,10 +93,20 @@ void xen_init_lock_cpu(int cpu) |
818 | |
819 | void xen_uninit_lock_cpu(int cpu) |
820 | { |
821 | + int irq; |
822 | + |
823 | if (!xen_pvspin) |
824 | return; |
825 | |
826 | - unbind_from_irqhandler(per_cpu(lock_kicker_irq, cpu), NULL); |
827 | + /* |
828 | + * When booting the kernel with 'mitigations=auto,nosmt', the secondary |
829 | + * CPUs are not activated, and lock_kicker_irq is not initialized. |
830 | + */ |
831 | + irq = per_cpu(lock_kicker_irq, cpu); |
832 | + if (irq == -1) |
833 | + return; |
834 | + |
835 | + unbind_from_irqhandler(irq, NULL); |
836 | per_cpu(lock_kicker_irq, cpu) = -1; |
837 | kfree(per_cpu(irq_name, cpu)); |
838 | per_cpu(irq_name, cpu) = NULL; |
839 | diff --git a/arch/xtensa/include/asm/uaccess.h b/arch/xtensa/include/asm/uaccess.h |
840 | index 3f80386f18838..5cb24a789e9e1 100644 |
841 | --- a/arch/xtensa/include/asm/uaccess.h |
842 | +++ b/arch/xtensa/include/asm/uaccess.h |
843 | @@ -300,7 +300,7 @@ strncpy_from_user(char *dst, const char *src, long count) |
844 | return -EFAULT; |
845 | } |
846 | #else |
847 | -long strncpy_from_user(char *dst, const char *src, long count); |
848 | +long strncpy_from_user(char *dst, const char __user *src, long count); |
849 | #endif |
850 | |
851 | /* |
852 | diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c |
853 | index 770a780dfa544..3934ce3385ac3 100644 |
854 | --- a/drivers/bus/ti-sysc.c |
855 | +++ b/drivers/bus/ti-sysc.c |
856 | @@ -192,6 +192,9 @@ static int sysc_wait_softreset(struct sysc *ddata) |
857 | u32 sysc_mask, syss_done, rstval; |
858 | int syss_offset, error = 0; |
859 | |
860 | + if (ddata->cap->regbits->srst_shift < 0) |
861 | + return 0; |
862 | + |
863 | syss_offset = ddata->offsets[SYSC_SYSSTATUS]; |
864 | sysc_mask = BIT(ddata->cap->regbits->srst_shift); |
865 | |
866 | diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c |
867 | index cd81d10974a29..57b6555d6d042 100644 |
868 | --- a/drivers/dma/pl330.c |
869 | +++ b/drivers/dma/pl330.c |
870 | @@ -2793,7 +2793,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, |
871 | * If burst size is smaller than bus width then make sure we only |
872 | * transfer one at a time to avoid a burst stradling an MFIFO entry. |
873 | */ |
874 | - if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width) |
875 | + if (burst * 8 < pl330->pcfg.data_bus_width) |
876 | desc->rqcfg.brst_len = 1; |
877 | |
878 | desc->bytes_requested = len; |
879 | diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c |
880 | index 43acba2a1c0ee..a6abfe702c5a3 100644 |
881 | --- a/drivers/dma/xilinx/xilinx_dma.c |
882 | +++ b/drivers/dma/xilinx/xilinx_dma.c |
883 | @@ -454,8 +454,8 @@ struct xilinx_dma_device { |
884 | #define to_dma_tx_descriptor(tx) \ |
885 | container_of(tx, struct xilinx_dma_tx_descriptor, async_tx) |
886 | #define xilinx_dma_poll_timeout(chan, reg, val, cond, delay_us, timeout_us) \ |
887 | - readl_poll_timeout(chan->xdev->regs + chan->ctrl_offset + reg, val, \ |
888 | - cond, delay_us, timeout_us) |
889 | + readl_poll_timeout_atomic(chan->xdev->regs + chan->ctrl_offset + reg, \ |
890 | + val, cond, delay_us, timeout_us) |
891 | |
892 | /* IO accessors */ |
893 | static inline u32 dma_read(struct xilinx_dma_chan *chan, u32 reg) |
894 | diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig |
895 | index 6a6b412206ec0..3222645c95b33 100644 |
896 | --- a/drivers/firmware/efi/Kconfig |
897 | +++ b/drivers/firmware/efi/Kconfig |
898 | @@ -216,7 +216,7 @@ config EFI_DEV_PATH_PARSER |
899 | |
900 | config EFI_EARLYCON |
901 | def_bool y |
902 | - depends on SERIAL_EARLYCON && !ARM && !IA64 |
903 | + depends on EFI && SERIAL_EARLYCON && !ARM && !IA64 |
904 | select FONT_SUPPORT |
905 | select ARCH_USE_MEMREMAP_PROT |
906 | |
907 | diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c |
908 | index a50ba4a4a1d71..b88f889b3932e 100644 |
909 | --- a/drivers/hid/hid-cypress.c |
910 | +++ b/drivers/hid/hid-cypress.c |
911 | @@ -23,19 +23,17 @@ |
912 | #define CP_2WHEEL_MOUSE_HACK 0x02 |
913 | #define CP_2WHEEL_MOUSE_HACK_ON 0x04 |
914 | |
915 | +#define VA_INVAL_LOGICAL_BOUNDARY 0x08 |
916 | + |
917 | /* |
918 | * Some USB barcode readers from cypress have usage min and usage max in |
919 | * the wrong order |
920 | */ |
921 | -static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
922 | +static __u8 *cp_rdesc_fixup(struct hid_device *hdev, __u8 *rdesc, |
923 | unsigned int *rsize) |
924 | { |
925 | - unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); |
926 | unsigned int i; |
927 | |
928 | - if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX)) |
929 | - return rdesc; |
930 | - |
931 | if (*rsize < 4) |
932 | return rdesc; |
933 | |
934 | @@ -48,6 +46,40 @@ static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
935 | return rdesc; |
936 | } |
937 | |
938 | +static __u8 *va_logical_boundary_fixup(struct hid_device *hdev, __u8 *rdesc, |
939 | + unsigned int *rsize) |
940 | +{ |
941 | + /* |
942 | + * Varmilo VA104M (with VID Cypress and device ID 07B1) incorrectly |
943 | + * reports Logical Minimum of its Consumer Control device as 572 |
944 | + * (0x02 0x3c). Fix this by setting its Logical Minimum to zero. |
945 | + */ |
946 | + if (*rsize == 25 && |
947 | + rdesc[0] == 0x05 && rdesc[1] == 0x0c && |
948 | + rdesc[2] == 0x09 && rdesc[3] == 0x01 && |
949 | + rdesc[6] == 0x19 && rdesc[7] == 0x00 && |
950 | + rdesc[11] == 0x16 && rdesc[12] == 0x3c && rdesc[13] == 0x02) { |
951 | + hid_info(hdev, |
952 | + "fixing up varmilo VA104M consumer control report descriptor\n"); |
953 | + rdesc[12] = 0x00; |
954 | + rdesc[13] = 0x00; |
955 | + } |
956 | + return rdesc; |
957 | +} |
958 | + |
959 | +static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
960 | + unsigned int *rsize) |
961 | +{ |
962 | + unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); |
963 | + |
964 | + if (quirks & CP_RDESC_SWAPPED_MIN_MAX) |
965 | + rdesc = cp_rdesc_fixup(hdev, rdesc, rsize); |
966 | + if (quirks & VA_INVAL_LOGICAL_BOUNDARY) |
967 | + rdesc = va_logical_boundary_fixup(hdev, rdesc, rsize); |
968 | + |
969 | + return rdesc; |
970 | +} |
971 | + |
972 | static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi, |
973 | struct hid_field *field, struct hid_usage *usage, |
974 | unsigned long **bit, int *max) |
975 | @@ -128,6 +160,8 @@ static const struct hid_device_id cp_devices[] = { |
976 | .driver_data = CP_RDESC_SWAPPED_MIN_MAX }, |
977 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE), |
978 | .driver_data = CP_2WHEEL_MOUSE_HACK }, |
979 | + { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_VARMILO_VA104M_07B1), |
980 | + .driver_data = VA_INVAL_LOGICAL_BOUNDARY }, |
981 | { } |
982 | }; |
983 | MODULE_DEVICE_TABLE(hid, cp_devices); |
984 | diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
985 | index 7363d0b488bd8..2aa810665a78c 100644 |
986 | --- a/drivers/hid/hid-ids.h |
987 | +++ b/drivers/hid/hid-ids.h |
988 | @@ -337,6 +337,8 @@ |
989 | #define USB_DEVICE_ID_CYPRESS_BARCODE_4 0xed81 |
990 | #define USB_DEVICE_ID_CYPRESS_TRUETOUCH 0xc001 |
991 | |
992 | +#define USB_DEVICE_ID_CYPRESS_VARMILO_VA104M_07B1 0X07b1 |
993 | + |
994 | #define USB_VENDOR_ID_DATA_MODUL 0x7374 |
995 | #define USB_VENDOR_ID_DATA_MODUL_EASYMAXTOUCH 0x1201 |
996 | |
997 | @@ -449,6 +451,10 @@ |
998 | #define USB_VENDOR_ID_FRUCTEL 0x25B6 |
999 | #define USB_DEVICE_ID_GAMETEL_MT_MODE 0x0002 |
1000 | |
1001 | +#define USB_VENDOR_ID_GAMEVICE 0x27F8 |
1002 | +#define USB_DEVICE_ID_GAMEVICE_GV186 0x0BBE |
1003 | +#define USB_DEVICE_ID_GAMEVICE_KISHI 0x0BBF |
1004 | + |
1005 | #define USB_VENDOR_ID_GAMERON 0x0810 |
1006 | #define USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR 0x0001 |
1007 | #define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002 |
1008 | @@ -487,6 +493,7 @@ |
1009 | #define USB_DEVICE_ID_PENPOWER 0x00f4 |
1010 | |
1011 | #define USB_VENDOR_ID_GREENASIA 0x0e8f |
1012 | +#define USB_DEVICE_ID_GREENASIA_DUAL_SAT_ADAPTOR 0x3010 |
1013 | #define USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD 0x3013 |
1014 | |
1015 | #define USB_VENDOR_ID_GRETAGMACBETH 0x0971 |
1016 | @@ -743,6 +750,7 @@ |
1017 | #define USB_VENDOR_ID_LOGITECH 0x046d |
1018 | #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e |
1019 | #define USB_DEVICE_ID_LOGITECH_T651 0xb00c |
1020 | +#define USB_DEVICE_ID_LOGITECH_DINOVO_EDGE_KBD 0xb309 |
1021 | #define USB_DEVICE_ID_LOGITECH_C007 0xc007 |
1022 | #define USB_DEVICE_ID_LOGITECH_C077 0xc077 |
1023 | #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 |
1024 | @@ -1292,6 +1300,7 @@ |
1025 | |
1026 | #define USB_VENDOR_ID_UGTIZER 0x2179 |
1027 | #define USB_DEVICE_ID_UGTIZER_TABLET_GP0610 0x0053 |
1028 | +#define USB_DEVICE_ID_UGTIZER_TABLET_GT5040 0x0077 |
1029 | |
1030 | #define USB_VENDOR_ID_VIEWSONIC 0x0543 |
1031 | #define USB_DEVICE_ID_VIEWSONIC_PD1011 0xe621 |
1032 | diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c |
1033 | index b2bff932c524f..b2da8476d0d30 100644 |
1034 | --- a/drivers/hid/hid-input.c |
1035 | +++ b/drivers/hid/hid-input.c |
1036 | @@ -319,6 +319,9 @@ static const struct hid_device_id hid_battery_quirks[] = { |
1037 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ASUSTEK, |
1038 | USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD), |
1039 | HID_BATTERY_QUIRK_IGNORE }, |
1040 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, |
1041 | + USB_DEVICE_ID_LOGITECH_DINOVO_EDGE_KBD), |
1042 | + HID_BATTERY_QUIRK_IGNORE }, |
1043 | {} |
1044 | }; |
1045 | |
1046 | diff --git a/drivers/hid/hid-ite.c b/drivers/hid/hid-ite.c |
1047 | index 044a93f3c1178..742c052b0110a 100644 |
1048 | --- a/drivers/hid/hid-ite.c |
1049 | +++ b/drivers/hid/hid-ite.c |
1050 | @@ -11,6 +11,48 @@ |
1051 | |
1052 | #include "hid-ids.h" |
1053 | |
1054 | +#define QUIRK_TOUCHPAD_ON_OFF_REPORT BIT(0) |
1055 | + |
1056 | +static __u8 *ite_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize) |
1057 | +{ |
1058 | + unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); |
1059 | + |
1060 | + if (quirks & QUIRK_TOUCHPAD_ON_OFF_REPORT) { |
1061 | + if (*rsize == 188 && rdesc[162] == 0x81 && rdesc[163] == 0x02) { |
1062 | + hid_info(hdev, "Fixing up ITE keyboard report descriptor\n"); |
1063 | + rdesc[163] = HID_MAIN_ITEM_RELATIVE; |
1064 | + } |
1065 | + } |
1066 | + |
1067 | + return rdesc; |
1068 | +} |
1069 | + |
1070 | +static int ite_input_mapping(struct hid_device *hdev, |
1071 | + struct hid_input *hi, struct hid_field *field, |
1072 | + struct hid_usage *usage, unsigned long **bit, |
1073 | + int *max) |
1074 | +{ |
1075 | + |
1076 | + unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); |
1077 | + |
1078 | + if ((quirks & QUIRK_TOUCHPAD_ON_OFF_REPORT) && |
1079 | + (usage->hid & HID_USAGE_PAGE) == 0x00880000) { |
1080 | + if (usage->hid == 0x00880078) { |
1081 | + /* Touchpad on, userspace expects F22 for this */ |
1082 | + hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_F22); |
1083 | + return 1; |
1084 | + } |
1085 | + if (usage->hid == 0x00880079) { |
1086 | + /* Touchpad off, userspace expects F23 for this */ |
1087 | + hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_F23); |
1088 | + return 1; |
1089 | + } |
1090 | + return -1; |
1091 | + } |
1092 | + |
1093 | + return 0; |
1094 | +} |
1095 | + |
1096 | static int ite_event(struct hid_device *hdev, struct hid_field *field, |
1097 | struct hid_usage *usage, __s32 value) |
1098 | { |
1099 | @@ -37,13 +79,27 @@ static int ite_event(struct hid_device *hdev, struct hid_field *field, |
1100 | return 0; |
1101 | } |
1102 | |
1103 | +static int ite_probe(struct hid_device *hdev, const struct hid_device_id *id) |
1104 | +{ |
1105 | + int ret; |
1106 | + |
1107 | + hid_set_drvdata(hdev, (void *)id->driver_data); |
1108 | + |
1109 | + ret = hid_open_report(hdev); |
1110 | + if (ret) |
1111 | + return ret; |
1112 | + |
1113 | + return hid_hw_start(hdev, HID_CONNECT_DEFAULT); |
1114 | +} |
1115 | + |
1116 | static const struct hid_device_id ite_devices[] = { |
1117 | { HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE8595) }, |
1118 | { HID_USB_DEVICE(USB_VENDOR_ID_258A, USB_DEVICE_ID_258A_6A88) }, |
1119 | /* ITE8595 USB kbd ctlr, with Synaptics touchpad connected to it. */ |
1120 | { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, |
1121 | USB_VENDOR_ID_SYNAPTICS, |
1122 | - USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012) }, |
1123 | + USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012), |
1124 | + .driver_data = QUIRK_TOUCHPAD_ON_OFF_REPORT }, |
1125 | /* ITE8910 USB kbd ctlr, with Synaptics touchpad connected to it. */ |
1126 | { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, |
1127 | USB_VENDOR_ID_SYNAPTICS, |
1128 | @@ -55,6 +111,9 @@ MODULE_DEVICE_TABLE(hid, ite_devices); |
1129 | static struct hid_driver ite_driver = { |
1130 | .name = "itetech", |
1131 | .id_table = ite_devices, |
1132 | + .probe = ite_probe, |
1133 | + .report_fixup = ite_report_fixup, |
1134 | + .input_mapping = ite_input_mapping, |
1135 | .event = ite_event, |
1136 | }; |
1137 | module_hid_driver(ite_driver); |
1138 | diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c |
1139 | index e49d36de07968..919551ed5809c 100644 |
1140 | --- a/drivers/hid/hid-logitech-hidpp.c |
1141 | +++ b/drivers/hid/hid-logitech-hidpp.c |
1142 | @@ -3789,6 +3789,9 @@ static const struct hid_device_id hidpp_devices[] = { |
1143 | { /* Keyboard MX5000 (Bluetooth-receiver in HID proxy mode) */ |
1144 | LDJ_DEVICE(0xb305), |
1145 | .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS }, |
1146 | + { /* Dinovo Edge (Bluetooth-receiver in HID proxy mode) */ |
1147 | + LDJ_DEVICE(0xb309), |
1148 | + .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS }, |
1149 | { /* Keyboard MX5500 (Bluetooth-receiver in HID proxy mode) */ |
1150 | LDJ_DEVICE(0xb30b), |
1151 | .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS }, |
1152 | @@ -3831,6 +3834,9 @@ static const struct hid_device_id hidpp_devices[] = { |
1153 | { /* MX5000 keyboard over Bluetooth */ |
1154 | HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb305), |
1155 | .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS }, |
1156 | + { /* Dinovo Edge keyboard over Bluetooth */ |
1157 | + HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb309), |
1158 | + .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS }, |
1159 | { /* MX5500 keyboard over Bluetooth */ |
1160 | HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb30b), |
1161 | .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS }, |
1162 | diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c |
1163 | index 0440e2f6e8a3c..60d188a704e5e 100644 |
1164 | --- a/drivers/hid/hid-quirks.c |
1165 | +++ b/drivers/hid/hid-quirks.c |
1166 | @@ -83,7 +83,12 @@ static const struct hid_device_id hid_quirks[] = { |
1167 | { HID_USB_DEVICE(USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER), HID_QUIRK_NO_INIT_REPORTS }, |
1168 | { HID_USB_DEVICE(USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28), HID_QUIRK_NOGET }, |
1169 | { HID_USB_DEVICE(USB_VENDOR_ID_FUTABA, USB_DEVICE_ID_LED_DISPLAY), HID_QUIRK_NO_INIT_REPORTS }, |
1170 | + { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_SAT_ADAPTOR), HID_QUIRK_MULTI_INPUT }, |
1171 | { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD), HID_QUIRK_MULTI_INPUT }, |
1172 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_GAMEVICE, USB_DEVICE_ID_GAMEVICE_GV186), |
1173 | + HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
1174 | + { HID_USB_DEVICE(USB_VENDOR_ID_GAMEVICE, USB_DEVICE_ID_GAMEVICE_KISHI), |
1175 | + HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
1176 | { HID_USB_DEVICE(USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING), HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
1177 | { HID_USB_DEVICE(USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING), HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
1178 | { HID_USB_DEVICE(USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING), HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
1179 | diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c |
1180 | index 94c7398b5c279..3dd7d32467378 100644 |
1181 | --- a/drivers/hid/hid-sensor-hub.c |
1182 | +++ b/drivers/hid/hid-sensor-hub.c |
1183 | @@ -483,7 +483,8 @@ static int sensor_hub_raw_event(struct hid_device *hdev, |
1184 | return 1; |
1185 | |
1186 | ptr = raw_data; |
1187 | - ptr++; /* Skip report id */ |
1188 | + if (report->id) |
1189 | + ptr++; /* Skip report id */ |
1190 | |
1191 | spin_lock_irqsave(&pdata->lock, flags); |
1192 | |
1193 | diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c |
1194 | index 86b568037cb8a..8e9c9e646cb7d 100644 |
1195 | --- a/drivers/hid/hid-uclogic-core.c |
1196 | +++ b/drivers/hid/hid-uclogic-core.c |
1197 | @@ -385,6 +385,8 @@ static const struct hid_device_id uclogic_devices[] = { |
1198 | USB_DEVICE_ID_UCLOGIC_DRAWIMAGE_G3) }, |
1199 | { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, |
1200 | USB_DEVICE_ID_UGTIZER_TABLET_GP0610) }, |
1201 | + { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, |
1202 | + USB_DEVICE_ID_UGTIZER_TABLET_GT5040) }, |
1203 | { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, |
1204 | USB_DEVICE_ID_UGEE_TABLET_G5) }, |
1205 | { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, |
1206 | diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c |
1207 | index 78a364ae2f685..e80c812f44a77 100644 |
1208 | --- a/drivers/hid/hid-uclogic-params.c |
1209 | +++ b/drivers/hid/hid-uclogic-params.c |
1210 | @@ -997,6 +997,8 @@ int uclogic_params_init(struct uclogic_params *params, |
1211 | break; |
1212 | case VID_PID(USB_VENDOR_ID_UGTIZER, |
1213 | USB_DEVICE_ID_UGTIZER_TABLET_GP0610): |
1214 | + case VID_PID(USB_VENDOR_ID_UGTIZER, |
1215 | + USB_DEVICE_ID_UGTIZER_TABLET_GT5040): |
1216 | case VID_PID(USB_VENDOR_ID_UGEE, |
1217 | USB_DEVICE_ID_UGEE_XPPEN_TABLET_G540): |
1218 | case VID_PID(USB_VENDOR_ID_UGEE, |
1219 | diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
1220 | index bb75328193957..e8933daab4995 100644 |
1221 | --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
1222 | +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
1223 | @@ -2423,6 +2423,7 @@ static int hns_roce_v2_mw_write_mtpt(void *mb_buf, struct hns_roce_mw *mw) |
1224 | |
1225 | roce_set_bit(mpt_entry->byte_8_mw_cnt_en, V2_MPT_BYTE_8_R_INV_EN_S, 1); |
1226 | roce_set_bit(mpt_entry->byte_8_mw_cnt_en, V2_MPT_BYTE_8_L_INV_EN_S, 1); |
1227 | + roce_set_bit(mpt_entry->byte_8_mw_cnt_en, V2_MPT_BYTE_8_LW_EN_S, 1); |
1228 | |
1229 | roce_set_bit(mpt_entry->byte_12_mw_pa, V2_MPT_BYTE_12_PA_S, 0); |
1230 | roce_set_bit(mpt_entry->byte_12_mw_pa, V2_MPT_BYTE_12_MR_MW_S, 1); |
1231 | @@ -4614,11 +4615,11 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, |
1232 | V2_QPC_BYTE_28_AT_M, |
1233 | V2_QPC_BYTE_28_AT_S); |
1234 | qp_attr->retry_cnt = roce_get_field(context.byte_212_lsn, |
1235 | - V2_QPC_BYTE_212_RETRY_CNT_M, |
1236 | - V2_QPC_BYTE_212_RETRY_CNT_S); |
1237 | + V2_QPC_BYTE_212_RETRY_NUM_INIT_M, |
1238 | + V2_QPC_BYTE_212_RETRY_NUM_INIT_S); |
1239 | qp_attr->rnr_retry = roce_get_field(context.byte_244_rnr_rxack, |
1240 | - V2_QPC_BYTE_244_RNR_CNT_M, |
1241 | - V2_QPC_BYTE_244_RNR_CNT_S); |
1242 | + V2_QPC_BYTE_244_RNR_NUM_INIT_M, |
1243 | + V2_QPC_BYTE_244_RNR_NUM_INIT_S); |
1244 | |
1245 | done: |
1246 | qp_attr->cur_qp_state = qp_attr->qp_state; |
1247 | diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c |
1248 | index c3cfea243af8c..119b2573c9a08 100644 |
1249 | --- a/drivers/infiniband/hw/mthca/mthca_cq.c |
1250 | +++ b/drivers/infiniband/hw/mthca/mthca_cq.c |
1251 | @@ -803,8 +803,10 @@ int mthca_init_cq(struct mthca_dev *dev, int nent, |
1252 | } |
1253 | |
1254 | mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); |
1255 | - if (IS_ERR(mailbox)) |
1256 | + if (IS_ERR(mailbox)) { |
1257 | + err = PTR_ERR(mailbox); |
1258 | goto err_out_arm; |
1259 | + } |
1260 | |
1261 | cq_context = mailbox->buf; |
1262 | |
1263 | @@ -846,9 +848,9 @@ int mthca_init_cq(struct mthca_dev *dev, int nent, |
1264 | } |
1265 | |
1266 | spin_lock_irq(&dev->cq_table.lock); |
1267 | - if (mthca_array_set(&dev->cq_table.cq, |
1268 | - cq->cqn & (dev->limits.num_cqs - 1), |
1269 | - cq)) { |
1270 | + err = mthca_array_set(&dev->cq_table.cq, |
1271 | + cq->cqn & (dev->limits.num_cqs - 1), cq); |
1272 | + if (err) { |
1273 | spin_unlock_irq(&dev->cq_table.lock); |
1274 | goto err_out_free_mr; |
1275 | } |
1276 | diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c |
1277 | index 20ff2bed3917a..5a89c1cfdaa97 100644 |
1278 | --- a/drivers/input/serio/i8042.c |
1279 | +++ b/drivers/input/serio/i8042.c |
1280 | @@ -121,6 +121,7 @@ module_param_named(unmask_kbd_data, i8042_unmask_kbd_data, bool, 0600); |
1281 | MODULE_PARM_DESC(unmask_kbd_data, "Unconditional enable (may reveal sensitive data) of normally sanitize-filtered kbd data traffic debug log [pre-condition: i8042.debug=1 enabled]"); |
1282 | #endif |
1283 | |
1284 | +static bool i8042_present; |
1285 | static bool i8042_bypass_aux_irq_test; |
1286 | static char i8042_kbd_firmware_id[128]; |
1287 | static char i8042_aux_firmware_id[128]; |
1288 | @@ -341,6 +342,9 @@ int i8042_command(unsigned char *param, int command) |
1289 | unsigned long flags; |
1290 | int retval; |
1291 | |
1292 | + if (!i8042_present) |
1293 | + return -1; |
1294 | + |
1295 | spin_lock_irqsave(&i8042_lock, flags); |
1296 | retval = __i8042_command(param, command); |
1297 | spin_unlock_irqrestore(&i8042_lock, flags); |
1298 | @@ -1609,12 +1613,15 @@ static int __init i8042_init(void) |
1299 | |
1300 | err = i8042_platform_init(); |
1301 | if (err) |
1302 | - return err; |
1303 | + return (err == -ENODEV) ? 0 : err; |
1304 | |
1305 | err = i8042_controller_check(); |
1306 | if (err) |
1307 | goto err_platform_exit; |
1308 | |
1309 | + /* Set this before creating the dev to allow i8042_command to work right away */ |
1310 | + i8042_present = true; |
1311 | + |
1312 | pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, NULL, 0); |
1313 | if (IS_ERR(pdev)) { |
1314 | err = PTR_ERR(pdev); |
1315 | @@ -1633,6 +1640,9 @@ static int __init i8042_init(void) |
1316 | |
1317 | static void __exit i8042_exit(void) |
1318 | { |
1319 | + if (!i8042_present) |
1320 | + return; |
1321 | + |
1322 | platform_device_unregister(i8042_platform_device); |
1323 | platform_driver_unregister(&i8042_driver); |
1324 | i8042_platform_exit(); |
1325 | diff --git a/drivers/irqchip/irq-sni-exiu.c b/drivers/irqchip/irq-sni-exiu.c |
1326 | index 1d027623c7760..abd011fcecf4a 100644 |
1327 | --- a/drivers/irqchip/irq-sni-exiu.c |
1328 | +++ b/drivers/irqchip/irq-sni-exiu.c |
1329 | @@ -136,7 +136,7 @@ static int exiu_domain_translate(struct irq_domain *domain, |
1330 | if (fwspec->param_count != 2) |
1331 | return -EINVAL; |
1332 | *hwirq = fwspec->param[0]; |
1333 | - *type = fwspec->param[2] & IRQ_TYPE_SENSE_MASK; |
1334 | + *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; |
1335 | } |
1336 | return 0; |
1337 | } |
1338 | diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c |
1339 | index 246fa2657d744..f9a2a9ecbac9e 100644 |
1340 | --- a/drivers/net/can/m_can/m_can.c |
1341 | +++ b/drivers/net/can/m_can/m_can.c |
1342 | @@ -990,7 +990,7 @@ static const struct can_bittiming_const m_can_bittiming_const_31X = { |
1343 | .name = KBUILD_MODNAME, |
1344 | .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ |
1345 | .tseg1_max = 256, |
1346 | - .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ |
1347 | + .tseg2_min = 2, /* Time segment 2 = phase_seg2 */ |
1348 | .tseg2_max = 128, |
1349 | .sjw_max = 128, |
1350 | .brp_min = 1, |
1351 | @@ -1605,7 +1605,7 @@ static int m_can_open(struct net_device *dev) |
1352 | INIT_WORK(&cdev->tx_work, m_can_tx_work_queue); |
1353 | |
1354 | err = request_threaded_irq(dev->irq, NULL, m_can_isr, |
1355 | - IRQF_ONESHOT | IRQF_TRIGGER_FALLING, |
1356 | + IRQF_ONESHOT, |
1357 | dev->name, dev); |
1358 | } else { |
1359 | err = request_irq(dev->irq, m_can_isr, IRQF_SHARED, dev->name, |
1360 | diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c |
1361 | index a4b4b742c80c3..0ad13d78815c5 100644 |
1362 | --- a/drivers/net/can/usb/gs_usb.c |
1363 | +++ b/drivers/net/can/usb/gs_usb.c |
1364 | @@ -63,21 +63,27 @@ enum gs_can_identify_mode { |
1365 | }; |
1366 | |
1367 | /* data types passed between host and device */ |
1368 | + |
1369 | +/* The firmware on the original USB2CAN by Geschwister Schneider |
1370 | + * Technologie Entwicklungs- und Vertriebs UG exchanges all data |
1371 | + * between the host and the device in host byte order. This is done |
1372 | + * with the struct gs_host_config::byte_order member, which is sent |
1373 | + * first to indicate the desired byte order. |
1374 | + * |
1375 | + * The widely used open source firmware candleLight doesn't support |
1376 | + * this feature and exchanges the data in little endian byte order. |
1377 | + */ |
1378 | struct gs_host_config { |
1379 | - u32 byte_order; |
1380 | + __le32 byte_order; |
1381 | } __packed; |
1382 | -/* All data exchanged between host and device is exchanged in host byte order, |
1383 | - * thanks to the struct gs_host_config byte_order member, which is sent first |
1384 | - * to indicate the desired byte order. |
1385 | - */ |
1386 | |
1387 | struct gs_device_config { |
1388 | u8 reserved1; |
1389 | u8 reserved2; |
1390 | u8 reserved3; |
1391 | u8 icount; |
1392 | - u32 sw_version; |
1393 | - u32 hw_version; |
1394 | + __le32 sw_version; |
1395 | + __le32 hw_version; |
1396 | } __packed; |
1397 | |
1398 | #define GS_CAN_MODE_NORMAL 0 |
1399 | @@ -87,26 +93,26 @@ struct gs_device_config { |
1400 | #define GS_CAN_MODE_ONE_SHOT BIT(3) |
1401 | |
1402 | struct gs_device_mode { |
1403 | - u32 mode; |
1404 | - u32 flags; |
1405 | + __le32 mode; |
1406 | + __le32 flags; |
1407 | } __packed; |
1408 | |
1409 | struct gs_device_state { |
1410 | - u32 state; |
1411 | - u32 rxerr; |
1412 | - u32 txerr; |
1413 | + __le32 state; |
1414 | + __le32 rxerr; |
1415 | + __le32 txerr; |
1416 | } __packed; |
1417 | |
1418 | struct gs_device_bittiming { |
1419 | - u32 prop_seg; |
1420 | - u32 phase_seg1; |
1421 | - u32 phase_seg2; |
1422 | - u32 sjw; |
1423 | - u32 brp; |
1424 | + __le32 prop_seg; |
1425 | + __le32 phase_seg1; |
1426 | + __le32 phase_seg2; |
1427 | + __le32 sjw; |
1428 | + __le32 brp; |
1429 | } __packed; |
1430 | |
1431 | struct gs_identify_mode { |
1432 | - u32 mode; |
1433 | + __le32 mode; |
1434 | } __packed; |
1435 | |
1436 | #define GS_CAN_FEATURE_LISTEN_ONLY BIT(0) |
1437 | @@ -117,23 +123,23 @@ struct gs_identify_mode { |
1438 | #define GS_CAN_FEATURE_IDENTIFY BIT(5) |
1439 | |
1440 | struct gs_device_bt_const { |
1441 | - u32 feature; |
1442 | - u32 fclk_can; |
1443 | - u32 tseg1_min; |
1444 | - u32 tseg1_max; |
1445 | - u32 tseg2_min; |
1446 | - u32 tseg2_max; |
1447 | - u32 sjw_max; |
1448 | - u32 brp_min; |
1449 | - u32 brp_max; |
1450 | - u32 brp_inc; |
1451 | + __le32 feature; |
1452 | + __le32 fclk_can; |
1453 | + __le32 tseg1_min; |
1454 | + __le32 tseg1_max; |
1455 | + __le32 tseg2_min; |
1456 | + __le32 tseg2_max; |
1457 | + __le32 sjw_max; |
1458 | + __le32 brp_min; |
1459 | + __le32 brp_max; |
1460 | + __le32 brp_inc; |
1461 | } __packed; |
1462 | |
1463 | #define GS_CAN_FLAG_OVERFLOW 1 |
1464 | |
1465 | struct gs_host_frame { |
1466 | u32 echo_id; |
1467 | - u32 can_id; |
1468 | + __le32 can_id; |
1469 | |
1470 | u8 can_dlc; |
1471 | u8 channel; |
1472 | @@ -329,13 +335,13 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) |
1473 | if (!skb) |
1474 | return; |
1475 | |
1476 | - cf->can_id = hf->can_id; |
1477 | + cf->can_id = le32_to_cpu(hf->can_id); |
1478 | |
1479 | cf->can_dlc = get_can_dlc(hf->can_dlc); |
1480 | memcpy(cf->data, hf->data, 8); |
1481 | |
1482 | /* ERROR frames tell us information about the controller */ |
1483 | - if (hf->can_id & CAN_ERR_FLAG) |
1484 | + if (le32_to_cpu(hf->can_id) & CAN_ERR_FLAG) |
1485 | gs_update_state(dev, cf); |
1486 | |
1487 | netdev->stats.rx_packets++; |
1488 | @@ -418,11 +424,11 @@ static int gs_usb_set_bittiming(struct net_device *netdev) |
1489 | if (!dbt) |
1490 | return -ENOMEM; |
1491 | |
1492 | - dbt->prop_seg = bt->prop_seg; |
1493 | - dbt->phase_seg1 = bt->phase_seg1; |
1494 | - dbt->phase_seg2 = bt->phase_seg2; |
1495 | - dbt->sjw = bt->sjw; |
1496 | - dbt->brp = bt->brp; |
1497 | + dbt->prop_seg = cpu_to_le32(bt->prop_seg); |
1498 | + dbt->phase_seg1 = cpu_to_le32(bt->phase_seg1); |
1499 | + dbt->phase_seg2 = cpu_to_le32(bt->phase_seg2); |
1500 | + dbt->sjw = cpu_to_le32(bt->sjw); |
1501 | + dbt->brp = cpu_to_le32(bt->brp); |
1502 | |
1503 | /* request bit timings */ |
1504 | rc = usb_control_msg(interface_to_usbdev(intf), |
1505 | @@ -503,7 +509,7 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb, |
1506 | |
1507 | cf = (struct can_frame *)skb->data; |
1508 | |
1509 | - hf->can_id = cf->can_id; |
1510 | + hf->can_id = cpu_to_le32(cf->can_id); |
1511 | hf->can_dlc = cf->can_dlc; |
1512 | memcpy(hf->data, cf->data, cf->can_dlc); |
1513 | |
1514 | @@ -573,6 +579,7 @@ static int gs_can_open(struct net_device *netdev) |
1515 | int rc, i; |
1516 | struct gs_device_mode *dm; |
1517 | u32 ctrlmode; |
1518 | + u32 flags = 0; |
1519 | |
1520 | rc = open_candev(netdev); |
1521 | if (rc) |
1522 | @@ -640,24 +647,24 @@ static int gs_can_open(struct net_device *netdev) |
1523 | |
1524 | /* flags */ |
1525 | ctrlmode = dev->can.ctrlmode; |
1526 | - dm->flags = 0; |
1527 | |
1528 | if (ctrlmode & CAN_CTRLMODE_LOOPBACK) |
1529 | - dm->flags |= GS_CAN_MODE_LOOP_BACK; |
1530 | + flags |= GS_CAN_MODE_LOOP_BACK; |
1531 | else if (ctrlmode & CAN_CTRLMODE_LISTENONLY) |
1532 | - dm->flags |= GS_CAN_MODE_LISTEN_ONLY; |
1533 | + flags |= GS_CAN_MODE_LISTEN_ONLY; |
1534 | |
1535 | /* Controller is not allowed to retry TX |
1536 | * this mode is unavailable on atmels uc3c hardware |
1537 | */ |
1538 | if (ctrlmode & CAN_CTRLMODE_ONE_SHOT) |
1539 | - dm->flags |= GS_CAN_MODE_ONE_SHOT; |
1540 | + flags |= GS_CAN_MODE_ONE_SHOT; |
1541 | |
1542 | if (ctrlmode & CAN_CTRLMODE_3_SAMPLES) |
1543 | - dm->flags |= GS_CAN_MODE_TRIPLE_SAMPLE; |
1544 | + flags |= GS_CAN_MODE_TRIPLE_SAMPLE; |
1545 | |
1546 | /* finally start device */ |
1547 | - dm->mode = GS_CAN_MODE_START; |
1548 | + dm->mode = cpu_to_le32(GS_CAN_MODE_START); |
1549 | + dm->flags = cpu_to_le32(flags); |
1550 | rc = usb_control_msg(interface_to_usbdev(dev->iface), |
1551 | usb_sndctrlpipe(interface_to_usbdev(dev->iface), 0), |
1552 | GS_USB_BREQ_MODE, |
1553 | @@ -737,9 +744,9 @@ static int gs_usb_set_identify(struct net_device *netdev, bool do_identify) |
1554 | return -ENOMEM; |
1555 | |
1556 | if (do_identify) |
1557 | - imode->mode = GS_CAN_IDENTIFY_ON; |
1558 | + imode->mode = cpu_to_le32(GS_CAN_IDENTIFY_ON); |
1559 | else |
1560 | - imode->mode = GS_CAN_IDENTIFY_OFF; |
1561 | + imode->mode = cpu_to_le32(GS_CAN_IDENTIFY_OFF); |
1562 | |
1563 | rc = usb_control_msg(interface_to_usbdev(dev->iface), |
1564 | usb_sndctrlpipe(interface_to_usbdev(dev->iface), |
1565 | @@ -790,6 +797,7 @@ static struct gs_can *gs_make_candev(unsigned int channel, |
1566 | struct net_device *netdev; |
1567 | int rc; |
1568 | struct gs_device_bt_const *bt_const; |
1569 | + u32 feature; |
1570 | |
1571 | bt_const = kmalloc(sizeof(*bt_const), GFP_KERNEL); |
1572 | if (!bt_const) |
1573 | @@ -830,14 +838,14 @@ static struct gs_can *gs_make_candev(unsigned int channel, |
1574 | |
1575 | /* dev settup */ |
1576 | strcpy(dev->bt_const.name, "gs_usb"); |
1577 | - dev->bt_const.tseg1_min = bt_const->tseg1_min; |
1578 | - dev->bt_const.tseg1_max = bt_const->tseg1_max; |
1579 | - dev->bt_const.tseg2_min = bt_const->tseg2_min; |
1580 | - dev->bt_const.tseg2_max = bt_const->tseg2_max; |
1581 | - dev->bt_const.sjw_max = bt_const->sjw_max; |
1582 | - dev->bt_const.brp_min = bt_const->brp_min; |
1583 | - dev->bt_const.brp_max = bt_const->brp_max; |
1584 | - dev->bt_const.brp_inc = bt_const->brp_inc; |
1585 | + dev->bt_const.tseg1_min = le32_to_cpu(bt_const->tseg1_min); |
1586 | + dev->bt_const.tseg1_max = le32_to_cpu(bt_const->tseg1_max); |
1587 | + dev->bt_const.tseg2_min = le32_to_cpu(bt_const->tseg2_min); |
1588 | + dev->bt_const.tseg2_max = le32_to_cpu(bt_const->tseg2_max); |
1589 | + dev->bt_const.sjw_max = le32_to_cpu(bt_const->sjw_max); |
1590 | + dev->bt_const.brp_min = le32_to_cpu(bt_const->brp_min); |
1591 | + dev->bt_const.brp_max = le32_to_cpu(bt_const->brp_max); |
1592 | + dev->bt_const.brp_inc = le32_to_cpu(bt_const->brp_inc); |
1593 | |
1594 | dev->udev = interface_to_usbdev(intf); |
1595 | dev->iface = intf; |
1596 | @@ -854,28 +862,29 @@ static struct gs_can *gs_make_candev(unsigned int channel, |
1597 | |
1598 | /* can settup */ |
1599 | dev->can.state = CAN_STATE_STOPPED; |
1600 | - dev->can.clock.freq = bt_const->fclk_can; |
1601 | + dev->can.clock.freq = le32_to_cpu(bt_const->fclk_can); |
1602 | dev->can.bittiming_const = &dev->bt_const; |
1603 | dev->can.do_set_bittiming = gs_usb_set_bittiming; |
1604 | |
1605 | dev->can.ctrlmode_supported = 0; |
1606 | |
1607 | - if (bt_const->feature & GS_CAN_FEATURE_LISTEN_ONLY) |
1608 | + feature = le32_to_cpu(bt_const->feature); |
1609 | + if (feature & GS_CAN_FEATURE_LISTEN_ONLY) |
1610 | dev->can.ctrlmode_supported |= CAN_CTRLMODE_LISTENONLY; |
1611 | |
1612 | - if (bt_const->feature & GS_CAN_FEATURE_LOOP_BACK) |
1613 | + if (feature & GS_CAN_FEATURE_LOOP_BACK) |
1614 | dev->can.ctrlmode_supported |= CAN_CTRLMODE_LOOPBACK; |
1615 | |
1616 | - if (bt_const->feature & GS_CAN_FEATURE_TRIPLE_SAMPLE) |
1617 | + if (feature & GS_CAN_FEATURE_TRIPLE_SAMPLE) |
1618 | dev->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES; |
1619 | |
1620 | - if (bt_const->feature & GS_CAN_FEATURE_ONE_SHOT) |
1621 | + if (feature & GS_CAN_FEATURE_ONE_SHOT) |
1622 | dev->can.ctrlmode_supported |= CAN_CTRLMODE_ONE_SHOT; |
1623 | |
1624 | SET_NETDEV_DEV(netdev, &intf->dev); |
1625 | |
1626 | - if (dconf->sw_version > 1) |
1627 | - if (bt_const->feature & GS_CAN_FEATURE_IDENTIFY) |
1628 | + if (le32_to_cpu(dconf->sw_version) > 1) |
1629 | + if (feature & GS_CAN_FEATURE_IDENTIFY) |
1630 | netdev->ethtool_ops = &gs_usb_ethtool_ops; |
1631 | |
1632 | kfree(bt_const); |
1633 | @@ -910,7 +919,7 @@ static int gs_usb_probe(struct usb_interface *intf, |
1634 | if (!hconf) |
1635 | return -ENOMEM; |
1636 | |
1637 | - hconf->byte_order = 0x0000beef; |
1638 | + hconf->byte_order = cpu_to_le32(0x0000beef); |
1639 | |
1640 | /* send host config */ |
1641 | rc = usb_control_msg(interface_to_usbdev(intf), |
1642 | diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c |
1643 | index 92e4d140df6fa..469b155df4885 100644 |
1644 | --- a/drivers/net/dsa/mv88e6xxx/chip.c |
1645 | +++ b/drivers/net/dsa/mv88e6xxx/chip.c |
1646 | @@ -2143,6 +2143,8 @@ static void mv88e6xxx_hardware_reset(struct mv88e6xxx_chip *chip) |
1647 | usleep_range(10000, 20000); |
1648 | gpiod_set_value_cansleep(gpiod, 0); |
1649 | usleep_range(10000, 20000); |
1650 | + |
1651 | + mv88e6xxx_g1_wait_eeprom_done(chip); |
1652 | } |
1653 | } |
1654 | |
1655 | diff --git a/drivers/net/dsa/mv88e6xxx/global1.c b/drivers/net/dsa/mv88e6xxx/global1.c |
1656 | index 8a903624fdd7c..938dd146629f1 100644 |
1657 | --- a/drivers/net/dsa/mv88e6xxx/global1.c |
1658 | +++ b/drivers/net/dsa/mv88e6xxx/global1.c |
1659 | @@ -75,6 +75,37 @@ static int mv88e6xxx_g1_wait_init_ready(struct mv88e6xxx_chip *chip) |
1660 | return mv88e6xxx_g1_wait_bit(chip, MV88E6XXX_G1_STS, bit, 1); |
1661 | } |
1662 | |
1663 | +void mv88e6xxx_g1_wait_eeprom_done(struct mv88e6xxx_chip *chip) |
1664 | +{ |
1665 | + const unsigned long timeout = jiffies + 1 * HZ; |
1666 | + u16 val; |
1667 | + int err; |
1668 | + |
1669 | + /* Wait up to 1 second for the switch to finish reading the |
1670 | + * EEPROM. |
1671 | + */ |
1672 | + while (time_before(jiffies, timeout)) { |
1673 | + err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &val); |
1674 | + if (err) { |
1675 | + dev_err(chip->dev, "Error reading status"); |
1676 | + return; |
1677 | + } |
1678 | + |
1679 | + /* If the switch is still resetting, it may not |
1680 | + * respond on the bus, and so MDIO read returns |
1681 | + * 0xffff. Differentiate between that, and waiting for |
1682 | + * the EEPROM to be done by bit 0 being set. |
1683 | + */ |
1684 | + if (val != 0xffff && |
1685 | + val & BIT(MV88E6XXX_G1_STS_IRQ_EEPROM_DONE)) |
1686 | + return; |
1687 | + |
1688 | + usleep_range(1000, 2000); |
1689 | + } |
1690 | + |
1691 | + dev_err(chip->dev, "Timeout waiting for EEPROM done"); |
1692 | +} |
1693 | + |
1694 | /* Offset 0x01: Switch MAC Address Register Bytes 0 & 1 |
1695 | * Offset 0x02: Switch MAC Address Register Bytes 2 & 3 |
1696 | * Offset 0x03: Switch MAC Address Register Bytes 4 & 5 |
1697 | diff --git a/drivers/net/dsa/mv88e6xxx/global1.h b/drivers/net/dsa/mv88e6xxx/global1.h |
1698 | index 0ae96a1e919b6..08d66ef6aace6 100644 |
1699 | --- a/drivers/net/dsa/mv88e6xxx/global1.h |
1700 | +++ b/drivers/net/dsa/mv88e6xxx/global1.h |
1701 | @@ -277,6 +277,7 @@ int mv88e6xxx_g1_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr); |
1702 | int mv88e6185_g1_reset(struct mv88e6xxx_chip *chip); |
1703 | int mv88e6352_g1_reset(struct mv88e6xxx_chip *chip); |
1704 | int mv88e6250_g1_reset(struct mv88e6xxx_chip *chip); |
1705 | +void mv88e6xxx_g1_wait_eeprom_done(struct mv88e6xxx_chip *chip); |
1706 | |
1707 | int mv88e6185_g1_ppu_enable(struct mv88e6xxx_chip *chip); |
1708 | int mv88e6185_g1_ppu_disable(struct mv88e6xxx_chip *chip); |
1709 | diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1710 | index 635345bced313..2e5348ec2a2e9 100644 |
1711 | --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1712 | +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1713 | @@ -2622,16 +2622,9 @@ static int ena_device_init(struct ena_com_dev *ena_dev, struct pci_dev *pdev, |
1714 | goto err_mmio_read_less; |
1715 | } |
1716 | |
1717 | - rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(dma_width)); |
1718 | + rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(dma_width)); |
1719 | if (rc) { |
1720 | - dev_err(dev, "pci_set_dma_mask failed 0x%x\n", rc); |
1721 | - goto err_mmio_read_less; |
1722 | - } |
1723 | - |
1724 | - rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(dma_width)); |
1725 | - if (rc) { |
1726 | - dev_err(dev, "err_pci_set_consistent_dma_mask failed 0x%x\n", |
1727 | - rc); |
1728 | + dev_err(dev, "dma_set_mask_and_coherent failed %d\n", rc); |
1729 | goto err_mmio_read_less; |
1730 | } |
1731 | |
1732 | @@ -3450,6 +3443,12 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
1733 | return rc; |
1734 | } |
1735 | |
1736 | + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(ENA_MAX_PHYS_ADDR_SIZE_BITS)); |
1737 | + if (rc) { |
1738 | + dev_err(&pdev->dev, "dma_set_mask_and_coherent failed %d\n", rc); |
1739 | + goto err_disable_device; |
1740 | + } |
1741 | + |
1742 | pci_set_master(pdev); |
1743 | |
1744 | ena_dev = vzalloc(sizeof(*ena_dev)); |
1745 | diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1746 | index 6f777e9b4b936..7c8187d386756 100644 |
1747 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1748 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1749 | @@ -10826,7 +10826,8 @@ static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev) |
1750 | if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) != 0 && |
1751 | dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) != 0) { |
1752 | dev_err(&pdev->dev, "System does not support DMA, aborting\n"); |
1753 | - goto init_err_disable; |
1754 | + rc = -EIO; |
1755 | + goto init_err_release; |
1756 | } |
1757 | |
1758 | pci_set_master(pdev); |
1759 | @@ -11892,6 +11893,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1760 | create_singlethread_workqueue("bnxt_pf_wq"); |
1761 | if (!bnxt_pf_wq) { |
1762 | dev_err(&pdev->dev, "Unable to create workqueue.\n"); |
1763 | + rc = -ENOMEM; |
1764 | goto init_err_pci_clean; |
1765 | } |
1766 | } |
1767 | diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c |
1768 | index 202af8dc79662..cb50b41cd3df2 100644 |
1769 | --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c |
1770 | +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c |
1771 | @@ -630,7 +630,8 @@ int set_filter_wr(struct adapter *adapter, int fidx) |
1772 | FW_FILTER_WR_OVLAN_VLD_V(f->fs.val.ovlan_vld) | |
1773 | FW_FILTER_WR_IVLAN_VLDM_V(f->fs.mask.ivlan_vld) | |
1774 | FW_FILTER_WR_OVLAN_VLDM_V(f->fs.mask.ovlan_vld)); |
1775 | - fwr->smac_sel = f->smt->idx; |
1776 | + if (f->fs.newsmac) |
1777 | + fwr->smac_sel = f->smt->idx; |
1778 | fwr->rx_chan_rx_rpl_iq = |
1779 | htons(FW_FILTER_WR_RX_CHAN_V(0) | |
1780 | FW_FILTER_WR_RX_RPL_IQ_V(adapter->sge.fw_evtq.abs_id)); |
1781 | diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
1782 | index f357b9cbfee72..e53994ca3142c 100644 |
1783 | --- a/drivers/net/ethernet/ibm/ibmvnic.c |
1784 | +++ b/drivers/net/ethernet/ibm/ibmvnic.c |
1785 | @@ -1994,8 +1994,11 @@ static int do_reset(struct ibmvnic_adapter *adapter, |
1786 | for (i = 0; i < adapter->req_rx_queues; i++) |
1787 | napi_schedule(&adapter->napi[i]); |
1788 | |
1789 | - if (adapter->reset_reason != VNIC_RESET_FAILOVER) |
1790 | + if (adapter->reset_reason == VNIC_RESET_FAILOVER || |
1791 | + adapter->reset_reason == VNIC_RESET_MOBILITY) { |
1792 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, netdev); |
1793 | + call_netdevice_notifiers(NETDEV_RESEND_IGMP, netdev); |
1794 | + } |
1795 | |
1796 | rc = 0; |
1797 | |
1798 | @@ -2065,6 +2068,9 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter, |
1799 | if (rc) |
1800 | return IBMVNIC_OPEN_FAILED; |
1801 | |
1802 | + call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, netdev); |
1803 | + call_netdevice_notifiers(NETDEV_RESEND_IGMP, netdev); |
1804 | + |
1805 | return 0; |
1806 | } |
1807 | |
1808 | @@ -2761,6 +2767,9 @@ static int reset_sub_crq_queues(struct ibmvnic_adapter *adapter) |
1809 | { |
1810 | int i, rc; |
1811 | |
1812 | + if (!adapter->tx_scrq || !adapter->rx_scrq) |
1813 | + return -EINVAL; |
1814 | + |
1815 | for (i = 0; i < adapter->req_tx_queues; i++) { |
1816 | netdev_dbg(adapter->netdev, "Re-setting tx_scrq[%d]\n", i); |
1817 | rc = reset_one_sub_crq_queue(adapter, adapter->tx_scrq[i]); |
1818 | @@ -4768,6 +4777,9 @@ static int ibmvnic_reset_crq(struct ibmvnic_adapter *adapter) |
1819 | } while (rc == H_BUSY || H_IS_LONG_BUSY(rc)); |
1820 | |
1821 | /* Clean out the queue */ |
1822 | + if (!crq->msgs) |
1823 | + return -EINVAL; |
1824 | + |
1825 | memset(crq->msgs, 0, PAGE_SIZE); |
1826 | crq->cur = 0; |
1827 | crq->active = false; |
1828 | diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h |
1829 | index 401304d4d5536..cfe99bae8e362 100644 |
1830 | --- a/drivers/net/ethernet/intel/i40e/i40e.h |
1831 | +++ b/drivers/net/ethernet/intel/i40e/i40e.h |
1832 | @@ -150,6 +150,7 @@ enum i40e_state_t { |
1833 | __I40E_CLIENT_RESET, |
1834 | __I40E_VIRTCHNL_OP_PENDING, |
1835 | __I40E_RECOVERY_MODE, |
1836 | + __I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */ |
1837 | /* This must be last as it determines the size of the BITMAP */ |
1838 | __I40E_STATE_SIZE__, |
1839 | }; |
1840 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
1841 | index b3c3911adfc2e..2b4327416457d 100644 |
1842 | --- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
1843 | +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
1844 | @@ -3988,8 +3988,16 @@ static irqreturn_t i40e_intr(int irq, void *data) |
1845 | } |
1846 | |
1847 | if (icr0 & I40E_PFINT_ICR0_VFLR_MASK) { |
1848 | - ena_mask &= ~I40E_PFINT_ICR0_ENA_VFLR_MASK; |
1849 | - set_bit(__I40E_VFLR_EVENT_PENDING, pf->state); |
1850 | + /* disable any further VFLR event notifications */ |
1851 | + if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) { |
1852 | + u32 reg = rd32(hw, I40E_PFINT_ICR0_ENA); |
1853 | + |
1854 | + reg &= ~I40E_PFINT_ICR0_VFLR_MASK; |
1855 | + wr32(hw, I40E_PFINT_ICR0_ENA, reg); |
1856 | + } else { |
1857 | + ena_mask &= ~I40E_PFINT_ICR0_ENA_VFLR_MASK; |
1858 | + set_bit(__I40E_VFLR_EVENT_PENDING, pf->state); |
1859 | + } |
1860 | } |
1861 | |
1862 | if (icr0 & I40E_PFINT_ICR0_GRST_MASK) { |
1863 | @@ -15345,6 +15353,11 @@ static void i40e_remove(struct pci_dev *pdev) |
1864 | while (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) |
1865 | usleep_range(1000, 2000); |
1866 | |
1867 | + if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { |
1868 | + set_bit(__I40E_VF_RESETS_DISABLED, pf->state); |
1869 | + i40e_free_vfs(pf); |
1870 | + pf->flags &= ~I40E_FLAG_SRIOV_ENABLED; |
1871 | + } |
1872 | /* no more scheduling of any task */ |
1873 | set_bit(__I40E_SUSPENDED, pf->state); |
1874 | set_bit(__I40E_DOWN, pf->state); |
1875 | @@ -15371,11 +15384,6 @@ static void i40e_remove(struct pci_dev *pdev) |
1876 | */ |
1877 | i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false); |
1878 | |
1879 | - if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { |
1880 | - i40e_free_vfs(pf); |
1881 | - pf->flags &= ~I40E_FLAG_SRIOV_ENABLED; |
1882 | - } |
1883 | - |
1884 | i40e_fdir_teardown(pf); |
1885 | |
1886 | /* If there is a switch structure or any orphans, remove them. |
1887 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
1888 | index 38042d610f82c..09ff3f335ffa6 100644 |
1889 | --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
1890 | +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
1891 | @@ -1335,7 +1335,8 @@ static void i40e_cleanup_reset_vf(struct i40e_vf *vf) |
1892 | * @vf: pointer to the VF structure |
1893 | * @flr: VFLR was issued or not |
1894 | * |
1895 | - * Returns true if the VF is reset, false otherwise. |
1896 | + * Returns true if the VF is in reset, resets successfully, or resets |
1897 | + * are disabled and false otherwise. |
1898 | **/ |
1899 | bool i40e_reset_vf(struct i40e_vf *vf, bool flr) |
1900 | { |
1901 | @@ -1345,11 +1346,14 @@ bool i40e_reset_vf(struct i40e_vf *vf, bool flr) |
1902 | u32 reg; |
1903 | int i; |
1904 | |
1905 | + if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) |
1906 | + return true; |
1907 | + |
1908 | /* If the VFs have been disabled, this means something else is |
1909 | * resetting the VF, so we shouldn't continue. |
1910 | */ |
1911 | if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) |
1912 | - return false; |
1913 | + return true; |
1914 | |
1915 | i40e_trigger_vf_reset(vf, flr); |
1916 | |
1917 | @@ -1513,6 +1517,15 @@ void i40e_free_vfs(struct i40e_pf *pf) |
1918 | |
1919 | i40e_notify_client_of_vf_enable(pf, 0); |
1920 | |
1921 | + /* Disable IOV before freeing resources. This lets any VF drivers |
1922 | + * running in the host get themselves cleaned up before we yank |
1923 | + * the carpet out from underneath their feet. |
1924 | + */ |
1925 | + if (!pci_vfs_assigned(pf->pdev)) |
1926 | + pci_disable_sriov(pf->pdev); |
1927 | + else |
1928 | + dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n"); |
1929 | + |
1930 | /* Amortize wait time by stopping all VFs at the same time */ |
1931 | for (i = 0; i < pf->num_alloc_vfs; i++) { |
1932 | if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) |
1933 | @@ -1528,15 +1541,6 @@ void i40e_free_vfs(struct i40e_pf *pf) |
1934 | i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[i].lan_vsi_idx]); |
1935 | } |
1936 | |
1937 | - /* Disable IOV before freeing resources. This lets any VF drivers |
1938 | - * running in the host get themselves cleaned up before we yank |
1939 | - * the carpet out from underneath their feet. |
1940 | - */ |
1941 | - if (!pci_vfs_assigned(pf->pdev)) |
1942 | - pci_disable_sriov(pf->pdev); |
1943 | - else |
1944 | - dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n"); |
1945 | - |
1946 | /* free up VF resources */ |
1947 | tmp = pf->num_alloc_vfs; |
1948 | pf->num_alloc_vfs = 0; |
1949 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
1950 | index 01b26b3327b01..73b8bf0fbf16f 100644 |
1951 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
1952 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
1953 | @@ -3069,6 +3069,9 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, |
1954 | goto out_unlock; |
1955 | } |
1956 | |
1957 | + if (vif->type == NL80211_IFTYPE_STATION) |
1958 | + vif->bss_conf.he_support = sta->he_cap.has_he; |
1959 | + |
1960 | if (sta->tdls && |
1961 | (vif->p2p || |
1962 | iwl_mvm_tdls_sta_count(mvm, NULL) == |
1963 | diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c |
1964 | index e4f7fa00862de..2505abc8ef281 100644 |
1965 | --- a/drivers/nfc/s3fwrn5/i2c.c |
1966 | +++ b/drivers/nfc/s3fwrn5/i2c.c |
1967 | @@ -26,8 +26,8 @@ struct s3fwrn5_i2c_phy { |
1968 | struct i2c_client *i2c_dev; |
1969 | struct nci_dev *ndev; |
1970 | |
1971 | - unsigned int gpio_en; |
1972 | - unsigned int gpio_fw_wake; |
1973 | + int gpio_en; |
1974 | + int gpio_fw_wake; |
1975 | |
1976 | struct mutex mutex; |
1977 | |
1978 | diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
1979 | index f5d12bf109c78..9b1fc8633cfe1 100644 |
1980 | --- a/drivers/nvme/host/pci.c |
1981 | +++ b/drivers/nvme/host/pci.c |
1982 | @@ -271,9 +271,21 @@ static void nvme_dbbuf_init(struct nvme_dev *dev, |
1983 | nvmeq->dbbuf_cq_ei = &dev->dbbuf_eis[cq_idx(qid, dev->db_stride)]; |
1984 | } |
1985 | |
1986 | +static void nvme_dbbuf_free(struct nvme_queue *nvmeq) |
1987 | +{ |
1988 | + if (!nvmeq->qid) |
1989 | + return; |
1990 | + |
1991 | + nvmeq->dbbuf_sq_db = NULL; |
1992 | + nvmeq->dbbuf_cq_db = NULL; |
1993 | + nvmeq->dbbuf_sq_ei = NULL; |
1994 | + nvmeq->dbbuf_cq_ei = NULL; |
1995 | +} |
1996 | + |
1997 | static void nvme_dbbuf_set(struct nvme_dev *dev) |
1998 | { |
1999 | struct nvme_command c; |
2000 | + unsigned int i; |
2001 | |
2002 | if (!dev->dbbuf_dbs) |
2003 | return; |
2004 | @@ -287,6 +299,9 @@ static void nvme_dbbuf_set(struct nvme_dev *dev) |
2005 | dev_warn(dev->ctrl.device, "unable to set dbbuf\n"); |
2006 | /* Free memory and continue on */ |
2007 | nvme_dbbuf_dma_free(dev); |
2008 | + |
2009 | + for (i = 1; i <= dev->online_queues; i++) |
2010 | + nvme_dbbuf_free(&dev->queues[i]); |
2011 | } |
2012 | } |
2013 | |
2014 | diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c |
2015 | index 2ea8497af82a6..bf5d80b97597b 100644 |
2016 | --- a/drivers/phy/tegra/xusb.c |
2017 | +++ b/drivers/phy/tegra/xusb.c |
2018 | @@ -949,6 +949,7 @@ power_down: |
2019 | reset: |
2020 | reset_control_assert(padctl->rst); |
2021 | remove: |
2022 | + platform_set_drvdata(pdev, NULL); |
2023 | soc->ops->remove(padctl); |
2024 | return err; |
2025 | } |
2026 | diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c |
2027 | index abcb336a515a1..5081048f2356e 100644 |
2028 | --- a/drivers/platform/x86/thinkpad_acpi.c |
2029 | +++ b/drivers/platform/x86/thinkpad_acpi.c |
2030 | @@ -4238,6 +4238,7 @@ static void hotkey_resume(void) |
2031 | pr_err("error while attempting to reset the event firmware interface\n"); |
2032 | |
2033 | tpacpi_send_radiosw_update(); |
2034 | + tpacpi_input_send_tabletsw(); |
2035 | hotkey_tablet_mode_notify_change(); |
2036 | hotkey_wakeup_reason_notify_change(); |
2037 | hotkey_wakeup_hotunplug_complete_notify_change(); |
2038 | diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c |
2039 | index a1e6569427c34..71a969fc3b206 100644 |
2040 | --- a/drivers/platform/x86/toshiba_acpi.c |
2041 | +++ b/drivers/platform/x86/toshiba_acpi.c |
2042 | @@ -1485,7 +1485,7 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf, |
2043 | struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file)); |
2044 | char *buffer; |
2045 | char *cmd; |
2046 | - int lcd_out, crt_out, tv_out; |
2047 | + int lcd_out = -1, crt_out = -1, tv_out = -1; |
2048 | int remain = count; |
2049 | int value; |
2050 | int ret; |
2051 | @@ -1517,7 +1517,6 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf, |
2052 | |
2053 | kfree(cmd); |
2054 | |
2055 | - lcd_out = crt_out = tv_out = -1; |
2056 | ret = get_video_status(dev, &video_out); |
2057 | if (!ret) { |
2058 | unsigned int new_video_out = video_out; |
2059 | diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h |
2060 | index 820f2c29376c0..93b4cb156b0bc 100644 |
2061 | --- a/drivers/s390/net/qeth_core.h |
2062 | +++ b/drivers/s390/net/qeth_core.h |
2063 | @@ -436,10 +436,13 @@ enum qeth_qdio_out_buffer_state { |
2064 | QETH_QDIO_BUF_EMPTY, |
2065 | /* Filled by driver; owned by hardware in order to be sent. */ |
2066 | QETH_QDIO_BUF_PRIMED, |
2067 | - /* Identified to be pending in TPQ. */ |
2068 | + /* Discovered by the TX completion code: */ |
2069 | QETH_QDIO_BUF_PENDING, |
2070 | - /* Found in completion queue. */ |
2071 | - QETH_QDIO_BUF_IN_CQ, |
2072 | + /* Finished by the TX completion code: */ |
2073 | + QETH_QDIO_BUF_NEED_QAOB, |
2074 | + /* Received QAOB notification on CQ: */ |
2075 | + QETH_QDIO_BUF_QAOB_OK, |
2076 | + QETH_QDIO_BUF_QAOB_ERROR, |
2077 | /* Handled via transfer pending / completion queue. */ |
2078 | QETH_QDIO_BUF_HANDLED_DELAYED, |
2079 | }; |
2080 | diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c |
2081 | index 5043f0fcf399a..fad1c46d4b0e1 100644 |
2082 | --- a/drivers/s390/net/qeth_core_main.c |
2083 | +++ b/drivers/s390/net/qeth_core_main.c |
2084 | @@ -31,6 +31,7 @@ |
2085 | |
2086 | #include <net/iucv/af_iucv.h> |
2087 | #include <net/dsfield.h> |
2088 | +#include <net/sock.h> |
2089 | |
2090 | #include <asm/ebcdic.h> |
2091 | #include <asm/chpid.h> |
2092 | @@ -425,18 +426,13 @@ static void qeth_cleanup_handled_pending(struct qeth_qdio_out_q *q, int bidx, |
2093 | |
2094 | } |
2095 | } |
2096 | - if (forced_cleanup && (atomic_read(&(q->bufs[bidx]->state)) == |
2097 | - QETH_QDIO_BUF_HANDLED_DELAYED)) { |
2098 | - /* for recovery situations */ |
2099 | - qeth_init_qdio_out_buf(q, bidx); |
2100 | - QETH_CARD_TEXT(q->card, 2, "clprecov"); |
2101 | - } |
2102 | } |
2103 | |
2104 | |
2105 | static void qeth_qdio_handle_aob(struct qeth_card *card, |
2106 | unsigned long phys_aob_addr) |
2107 | { |
2108 | + enum qeth_qdio_out_buffer_state new_state = QETH_QDIO_BUF_QAOB_OK; |
2109 | struct qaob *aob; |
2110 | struct qeth_qdio_out_buffer *buffer; |
2111 | enum iucv_tx_notify notification; |
2112 | @@ -448,22 +444,6 @@ static void qeth_qdio_handle_aob(struct qeth_card *card, |
2113 | buffer = (struct qeth_qdio_out_buffer *) aob->user1; |
2114 | QETH_CARD_TEXT_(card, 5, "%lx", aob->user1); |
2115 | |
2116 | - if (atomic_cmpxchg(&buffer->state, QETH_QDIO_BUF_PRIMED, |
2117 | - QETH_QDIO_BUF_IN_CQ) == QETH_QDIO_BUF_PRIMED) { |
2118 | - notification = TX_NOTIFY_OK; |
2119 | - } else { |
2120 | - WARN_ON_ONCE(atomic_read(&buffer->state) != |
2121 | - QETH_QDIO_BUF_PENDING); |
2122 | - atomic_set(&buffer->state, QETH_QDIO_BUF_IN_CQ); |
2123 | - notification = TX_NOTIFY_DELAYED_OK; |
2124 | - } |
2125 | - |
2126 | - if (aob->aorc != 0) { |
2127 | - QETH_CARD_TEXT_(card, 2, "aorc%02X", aob->aorc); |
2128 | - notification = qeth_compute_cq_notification(aob->aorc, 1); |
2129 | - } |
2130 | - qeth_notify_skbs(buffer->q, buffer, notification); |
2131 | - |
2132 | /* Free dangling allocations. The attached skbs are handled by |
2133 | * qeth_cleanup_handled_pending(). |
2134 | */ |
2135 | @@ -474,7 +454,33 @@ static void qeth_qdio_handle_aob(struct qeth_card *card, |
2136 | kmem_cache_free(qeth_core_header_cache, |
2137 | (void *) aob->sba[i]); |
2138 | } |
2139 | - atomic_set(&buffer->state, QETH_QDIO_BUF_HANDLED_DELAYED); |
2140 | + |
2141 | + if (aob->aorc) { |
2142 | + QETH_CARD_TEXT_(card, 2, "aorc%02X", aob->aorc); |
2143 | + new_state = QETH_QDIO_BUF_QAOB_ERROR; |
2144 | + } |
2145 | + |
2146 | + switch (atomic_xchg(&buffer->state, new_state)) { |
2147 | + case QETH_QDIO_BUF_PRIMED: |
2148 | + /* Faster than TX completion code. */ |
2149 | + notification = qeth_compute_cq_notification(aob->aorc, 0); |
2150 | + qeth_notify_skbs(buffer->q, buffer, notification); |
2151 | + atomic_set(&buffer->state, QETH_QDIO_BUF_HANDLED_DELAYED); |
2152 | + break; |
2153 | + case QETH_QDIO_BUF_PENDING: |
2154 | + /* TX completion code is active and will handle the async |
2155 | + * completion for us. |
2156 | + */ |
2157 | + break; |
2158 | + case QETH_QDIO_BUF_NEED_QAOB: |
2159 | + /* TX completion code is already finished. */ |
2160 | + notification = qeth_compute_cq_notification(aob->aorc, 1); |
2161 | + qeth_notify_skbs(buffer->q, buffer, notification); |
2162 | + atomic_set(&buffer->state, QETH_QDIO_BUF_HANDLED_DELAYED); |
2163 | + break; |
2164 | + default: |
2165 | + WARN_ON_ONCE(1); |
2166 | + } |
2167 | |
2168 | qdio_release_aob(aob); |
2169 | } |
2170 | @@ -1083,7 +1089,7 @@ static void qeth_notify_skbs(struct qeth_qdio_out_q *q, |
2171 | skb_queue_walk(&buf->skb_list, skb) { |
2172 | QETH_CARD_TEXT_(q->card, 5, "skbn%d", notification); |
2173 | QETH_CARD_TEXT_(q->card, 5, "%lx", (long) skb); |
2174 | - if (skb->protocol == htons(ETH_P_AF_IUCV) && skb->sk) |
2175 | + if (skb->sk && skb->sk->sk_family == PF_IUCV) |
2176 | iucv_sk(skb->sk)->sk_txnotify(skb, notification); |
2177 | } |
2178 | } |
2179 | @@ -1094,9 +1100,6 @@ static void qeth_tx_complete_buf(struct qeth_qdio_out_buffer *buf, bool error, |
2180 | struct qeth_qdio_out_q *queue = buf->q; |
2181 | struct sk_buff *skb; |
2182 | |
2183 | - /* release may never happen from within CQ tasklet scope */ |
2184 | - WARN_ON_ONCE(atomic_read(&buf->state) == QETH_QDIO_BUF_IN_CQ); |
2185 | - |
2186 | if (atomic_read(&buf->state) == QETH_QDIO_BUF_PENDING) |
2187 | qeth_notify_skbs(queue, buf, TX_NOTIFY_GENERALERROR); |
2188 | |
2189 | @@ -5223,9 +5226,32 @@ static void qeth_iqd_tx_complete(struct qeth_qdio_out_q *queue, |
2190 | |
2191 | if (atomic_cmpxchg(&buffer->state, QETH_QDIO_BUF_PRIMED, |
2192 | QETH_QDIO_BUF_PENDING) == |
2193 | - QETH_QDIO_BUF_PRIMED) |
2194 | + QETH_QDIO_BUF_PRIMED) { |
2195 | qeth_notify_skbs(queue, buffer, TX_NOTIFY_PENDING); |
2196 | |
2197 | + /* Handle race with qeth_qdio_handle_aob(): */ |
2198 | + switch (atomic_xchg(&buffer->state, |
2199 | + QETH_QDIO_BUF_NEED_QAOB)) { |
2200 | + case QETH_QDIO_BUF_PENDING: |
2201 | + /* No concurrent QAOB notification. */ |
2202 | + break; |
2203 | + case QETH_QDIO_BUF_QAOB_OK: |
2204 | + qeth_notify_skbs(queue, buffer, |
2205 | + TX_NOTIFY_DELAYED_OK); |
2206 | + atomic_set(&buffer->state, |
2207 | + QETH_QDIO_BUF_HANDLED_DELAYED); |
2208 | + break; |
2209 | + case QETH_QDIO_BUF_QAOB_ERROR: |
2210 | + qeth_notify_skbs(queue, buffer, |
2211 | + TX_NOTIFY_DELAYED_GENERALERROR); |
2212 | + atomic_set(&buffer->state, |
2213 | + QETH_QDIO_BUF_HANDLED_DELAYED); |
2214 | + break; |
2215 | + default: |
2216 | + WARN_ON_ONCE(1); |
2217 | + } |
2218 | + } |
2219 | + |
2220 | QETH_CARD_TEXT_(card, 5, "pel%u", bidx); |
2221 | |
2222 | /* prepare the queue slot for re-use: */ |
2223 | diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c |
2224 | index 70b99c0e2e678..f954be3d5ee22 100644 |
2225 | --- a/drivers/scsi/libiscsi.c |
2226 | +++ b/drivers/scsi/libiscsi.c |
2227 | @@ -533,8 +533,8 @@ static void iscsi_complete_task(struct iscsi_task *task, int state) |
2228 | if (conn->task == task) |
2229 | conn->task = NULL; |
2230 | |
2231 | - if (conn->ping_task == task) |
2232 | - conn->ping_task = NULL; |
2233 | + if (READ_ONCE(conn->ping_task) == task) |
2234 | + WRITE_ONCE(conn->ping_task, NULL); |
2235 | |
2236 | /* release get from queueing */ |
2237 | __iscsi_put_task(task); |
2238 | @@ -738,6 +738,9 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, |
2239 | task->conn->session->age); |
2240 | } |
2241 | |
2242 | + if (unlikely(READ_ONCE(conn->ping_task) == INVALID_SCSI_TASK)) |
2243 | + WRITE_ONCE(conn->ping_task, task); |
2244 | + |
2245 | if (!ihost->workq) { |
2246 | if (iscsi_prep_mgmt_task(conn, task)) |
2247 | goto free_task; |
2248 | @@ -941,8 +944,11 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) |
2249 | struct iscsi_nopout hdr; |
2250 | struct iscsi_task *task; |
2251 | |
2252 | - if (!rhdr && conn->ping_task) |
2253 | - return -EINVAL; |
2254 | + if (!rhdr) { |
2255 | + if (READ_ONCE(conn->ping_task)) |
2256 | + return -EINVAL; |
2257 | + WRITE_ONCE(conn->ping_task, INVALID_SCSI_TASK); |
2258 | + } |
2259 | |
2260 | memset(&hdr, 0, sizeof(struct iscsi_nopout)); |
2261 | hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE; |
2262 | @@ -957,11 +963,12 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) |
2263 | |
2264 | task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); |
2265 | if (!task) { |
2266 | + if (!rhdr) |
2267 | + WRITE_ONCE(conn->ping_task, NULL); |
2268 | iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n"); |
2269 | return -EIO; |
2270 | } else if (!rhdr) { |
2271 | /* only track our nops */ |
2272 | - conn->ping_task = task; |
2273 | conn->last_ping = jiffies; |
2274 | } |
2275 | |
2276 | @@ -984,7 +991,7 @@ static int iscsi_nop_out_rsp(struct iscsi_task *task, |
2277 | struct iscsi_conn *conn = task->conn; |
2278 | int rc = 0; |
2279 | |
2280 | - if (conn->ping_task != task) { |
2281 | + if (READ_ONCE(conn->ping_task) != task) { |
2282 | /* |
2283 | * If this is not in response to one of our |
2284 | * nops then it must be from userspace. |
2285 | @@ -1923,7 +1930,7 @@ static void iscsi_start_tx(struct iscsi_conn *conn) |
2286 | */ |
2287 | static int iscsi_has_ping_timed_out(struct iscsi_conn *conn) |
2288 | { |
2289 | - if (conn->ping_task && |
2290 | + if (READ_ONCE(conn->ping_task) && |
2291 | time_before_eq(conn->last_recv + (conn->recv_timeout * HZ) + |
2292 | (conn->ping_timeout * HZ), jiffies)) |
2293 | return 1; |
2294 | @@ -2058,7 +2065,7 @@ enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc) |
2295 | * Checking the transport already or nop from a cmd timeout still |
2296 | * running |
2297 | */ |
2298 | - if (conn->ping_task) { |
2299 | + if (READ_ONCE(conn->ping_task)) { |
2300 | task->have_checked_conn = true; |
2301 | rc = BLK_EH_RESET_TIMER; |
2302 | goto done; |
2303 | diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
2304 | index 0772327f87d93..b6ce880ddd153 100644 |
2305 | --- a/drivers/scsi/ufs/ufshcd.c |
2306 | +++ b/drivers/scsi/ufs/ufshcd.c |
2307 | @@ -8160,11 +8160,7 @@ int ufshcd_shutdown(struct ufs_hba *hba) |
2308 | if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba)) |
2309 | goto out; |
2310 | |
2311 | - if (pm_runtime_suspended(hba->dev)) { |
2312 | - ret = ufshcd_runtime_resume(hba); |
2313 | - if (ret) |
2314 | - goto out; |
2315 | - } |
2316 | + pm_runtime_get_sync(hba->dev); |
2317 | |
2318 | ret = ufshcd_suspend(hba, UFS_SHUTDOWN_PM); |
2319 | out: |
2320 | diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c |
2321 | index d0afe0b1599fd..8a4be34bccfd2 100644 |
2322 | --- a/drivers/spi/spi-bcm-qspi.c |
2323 | +++ b/drivers/spi/spi-bcm-qspi.c |
2324 | @@ -1213,7 +1213,7 @@ int bcm_qspi_probe(struct platform_device *pdev, |
2325 | if (!of_match_node(bcm_qspi_of_match, dev->of_node)) |
2326 | return -ENODEV; |
2327 | |
2328 | - master = spi_alloc_master(dev, sizeof(struct bcm_qspi)); |
2329 | + master = devm_spi_alloc_master(dev, sizeof(struct bcm_qspi)); |
2330 | if (!master) { |
2331 | dev_err(dev, "error allocating spi_master\n"); |
2332 | return -ENOMEM; |
2333 | @@ -1252,21 +1252,17 @@ int bcm_qspi_probe(struct platform_device *pdev, |
2334 | |
2335 | if (res) { |
2336 | qspi->base[MSPI] = devm_ioremap_resource(dev, res); |
2337 | - if (IS_ERR(qspi->base[MSPI])) { |
2338 | - ret = PTR_ERR(qspi->base[MSPI]); |
2339 | - goto qspi_resource_err; |
2340 | - } |
2341 | + if (IS_ERR(qspi->base[MSPI])) |
2342 | + return PTR_ERR(qspi->base[MSPI]); |
2343 | } else { |
2344 | - goto qspi_resource_err; |
2345 | + return 0; |
2346 | } |
2347 | |
2348 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "bspi"); |
2349 | if (res) { |
2350 | qspi->base[BSPI] = devm_ioremap_resource(dev, res); |
2351 | - if (IS_ERR(qspi->base[BSPI])) { |
2352 | - ret = PTR_ERR(qspi->base[BSPI]); |
2353 | - goto qspi_resource_err; |
2354 | - } |
2355 | + if (IS_ERR(qspi->base[BSPI])) |
2356 | + return PTR_ERR(qspi->base[BSPI]); |
2357 | qspi->bspi_mode = true; |
2358 | } else { |
2359 | qspi->bspi_mode = false; |
2360 | @@ -1277,18 +1273,14 @@ int bcm_qspi_probe(struct platform_device *pdev, |
2361 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cs_reg"); |
2362 | if (res) { |
2363 | qspi->base[CHIP_SELECT] = devm_ioremap_resource(dev, res); |
2364 | - if (IS_ERR(qspi->base[CHIP_SELECT])) { |
2365 | - ret = PTR_ERR(qspi->base[CHIP_SELECT]); |
2366 | - goto qspi_resource_err; |
2367 | - } |
2368 | + if (IS_ERR(qspi->base[CHIP_SELECT])) |
2369 | + return PTR_ERR(qspi->base[CHIP_SELECT]); |
2370 | } |
2371 | |
2372 | qspi->dev_ids = kcalloc(num_irqs, sizeof(struct bcm_qspi_dev_id), |
2373 | GFP_KERNEL); |
2374 | - if (!qspi->dev_ids) { |
2375 | - ret = -ENOMEM; |
2376 | - goto qspi_resource_err; |
2377 | - } |
2378 | + if (!qspi->dev_ids) |
2379 | + return -ENOMEM; |
2380 | |
2381 | for (val = 0; val < num_irqs; val++) { |
2382 | irq = -1; |
2383 | @@ -1357,7 +1349,7 @@ int bcm_qspi_probe(struct platform_device *pdev, |
2384 | qspi->xfer_mode.addrlen = -1; |
2385 | qspi->xfer_mode.hp = -1; |
2386 | |
2387 | - ret = devm_spi_register_master(&pdev->dev, master); |
2388 | + ret = spi_register_master(master); |
2389 | if (ret < 0) { |
2390 | dev_err(dev, "can't register master\n"); |
2391 | goto qspi_reg_err; |
2392 | @@ -1370,8 +1362,6 @@ qspi_reg_err: |
2393 | clk_disable_unprepare(qspi->clk); |
2394 | qspi_probe_err: |
2395 | kfree(qspi->dev_ids); |
2396 | -qspi_resource_err: |
2397 | - spi_master_put(master); |
2398 | return ret; |
2399 | } |
2400 | /* probe function to be called by SoC specific platform driver probe */ |
2401 | @@ -1381,10 +1371,10 @@ int bcm_qspi_remove(struct platform_device *pdev) |
2402 | { |
2403 | struct bcm_qspi *qspi = platform_get_drvdata(pdev); |
2404 | |
2405 | + spi_unregister_master(qspi->master); |
2406 | bcm_qspi_hw_uninit(qspi); |
2407 | clk_disable_unprepare(qspi->clk); |
2408 | kfree(qspi->dev_ids); |
2409 | - spi_unregister_master(qspi->master); |
2410 | |
2411 | return 0; |
2412 | } |
2413 | diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c |
2414 | index 9ae1c96f4d3d4..5bc97b22491cd 100644 |
2415 | --- a/drivers/spi/spi-bcm2835.c |
2416 | +++ b/drivers/spi/spi-bcm2835.c |
2417 | @@ -1264,7 +1264,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev) |
2418 | struct bcm2835_spi *bs; |
2419 | int err; |
2420 | |
2421 | - ctlr = spi_alloc_master(&pdev->dev, ALIGN(sizeof(*bs), |
2422 | + ctlr = devm_spi_alloc_master(&pdev->dev, ALIGN(sizeof(*bs), |
2423 | dma_get_cache_alignment())); |
2424 | if (!ctlr) |
2425 | return -ENOMEM; |
2426 | @@ -1284,23 +1284,19 @@ static int bcm2835_spi_probe(struct platform_device *pdev) |
2427 | bs = spi_controller_get_devdata(ctlr); |
2428 | |
2429 | bs->regs = devm_platform_ioremap_resource(pdev, 0); |
2430 | - if (IS_ERR(bs->regs)) { |
2431 | - err = PTR_ERR(bs->regs); |
2432 | - goto out_controller_put; |
2433 | - } |
2434 | + if (IS_ERR(bs->regs)) |
2435 | + return PTR_ERR(bs->regs); |
2436 | |
2437 | bs->clk = devm_clk_get(&pdev->dev, NULL); |
2438 | if (IS_ERR(bs->clk)) { |
2439 | err = PTR_ERR(bs->clk); |
2440 | dev_err(&pdev->dev, "could not get clk: %d\n", err); |
2441 | - goto out_controller_put; |
2442 | + return err; |
2443 | } |
2444 | |
2445 | bs->irq = platform_get_irq(pdev, 0); |
2446 | - if (bs->irq <= 0) { |
2447 | - err = bs->irq ? bs->irq : -ENODEV; |
2448 | - goto out_controller_put; |
2449 | - } |
2450 | + if (bs->irq <= 0) |
2451 | + return bs->irq ? bs->irq : -ENODEV; |
2452 | |
2453 | clk_prepare_enable(bs->clk); |
2454 | |
2455 | @@ -1330,8 +1326,6 @@ static int bcm2835_spi_probe(struct platform_device *pdev) |
2456 | |
2457 | out_clk_disable: |
2458 | clk_disable_unprepare(bs->clk); |
2459 | -out_controller_put: |
2460 | - spi_controller_put(ctlr); |
2461 | return err; |
2462 | } |
2463 | |
2464 | diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c |
2465 | index 1e5aac1581aa4..8211107bfbe82 100644 |
2466 | --- a/drivers/spi/spi-bcm2835aux.c |
2467 | +++ b/drivers/spi/spi-bcm2835aux.c |
2468 | @@ -529,8 +529,9 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev) |
2469 | |
2470 | bs->clk = devm_clk_get(&pdev->dev, NULL); |
2471 | if (IS_ERR(bs->clk)) { |
2472 | + err = PTR_ERR(bs->clk); |
2473 | dev_err(&pdev->dev, "could not get clk: %d\n", err); |
2474 | - return PTR_ERR(bs->clk); |
2475 | + return err; |
2476 | } |
2477 | |
2478 | bs->irq = platform_get_irq(pdev, 0); |
2479 | diff --git a/drivers/staging/ralink-gdma/Kconfig b/drivers/staging/ralink-gdma/Kconfig |
2480 | index 54e8029e6b1af..0017376234e28 100644 |
2481 | --- a/drivers/staging/ralink-gdma/Kconfig |
2482 | +++ b/drivers/staging/ralink-gdma/Kconfig |
2483 | @@ -2,6 +2,7 @@ |
2484 | config DMA_RALINK |
2485 | tristate "RALINK DMA support" |
2486 | depends on RALINK && !SOC_RT288X |
2487 | + depends on DMADEVICES |
2488 | select DMA_ENGINE |
2489 | select DMA_VIRTUAL_CHANNELS |
2490 | |
2491 | diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
2492 | index bca183369ad8b..3403667a9592f 100644 |
2493 | --- a/drivers/target/iscsi/iscsi_target.c |
2494 | +++ b/drivers/target/iscsi/iscsi_target.c |
2495 | @@ -483,8 +483,7 @@ EXPORT_SYMBOL(iscsit_queue_rsp); |
2496 | void iscsit_aborted_task(struct iscsi_conn *conn, struct iscsi_cmd *cmd) |
2497 | { |
2498 | spin_lock_bh(&conn->cmd_lock); |
2499 | - if (!list_empty(&cmd->i_conn_node) && |
2500 | - !(cmd->se_cmd.transport_state & CMD_T_FABRIC_STOP)) |
2501 | + if (!list_empty(&cmd->i_conn_node)) |
2502 | list_del_init(&cmd->i_conn_node); |
2503 | spin_unlock_bh(&conn->cmd_lock); |
2504 | |
2505 | @@ -4082,12 +4081,22 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) |
2506 | spin_lock_bh(&conn->cmd_lock); |
2507 | list_splice_init(&conn->conn_cmd_list, &tmp_list); |
2508 | |
2509 | - list_for_each_entry(cmd, &tmp_list, i_conn_node) { |
2510 | + list_for_each_entry_safe(cmd, cmd_tmp, &tmp_list, i_conn_node) { |
2511 | struct se_cmd *se_cmd = &cmd->se_cmd; |
2512 | |
2513 | if (se_cmd->se_tfo != NULL) { |
2514 | spin_lock_irq(&se_cmd->t_state_lock); |
2515 | - se_cmd->transport_state |= CMD_T_FABRIC_STOP; |
2516 | + if (se_cmd->transport_state & CMD_T_ABORTED) { |
2517 | + /* |
2518 | + * LIO's abort path owns the cleanup for this, |
2519 | + * so put it back on the list and let |
2520 | + * aborted_task handle it. |
2521 | + */ |
2522 | + list_move_tail(&cmd->i_conn_node, |
2523 | + &conn->conn_cmd_list); |
2524 | + } else { |
2525 | + se_cmd->transport_state |= CMD_T_FABRIC_STOP; |
2526 | + } |
2527 | spin_unlock_irq(&se_cmd->t_state_lock); |
2528 | } |
2529 | } |
2530 | diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c |
2531 | index cf2367ba08d63..aadedec3bfe7b 100644 |
2532 | --- a/drivers/tee/optee/call.c |
2533 | +++ b/drivers/tee/optee/call.c |
2534 | @@ -530,7 +530,8 @@ void optee_free_pages_list(void *list, size_t num_entries) |
2535 | static bool is_normal_memory(pgprot_t p) |
2536 | { |
2537 | #if defined(CONFIG_ARM) |
2538 | - return (pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC; |
2539 | + return (((pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC) || |
2540 | + ((pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEBACK)); |
2541 | #elif defined(CONFIG_ARM64) |
2542 | return (pgprot_val(p) & PTE_ATTRINDX_MASK) == PTE_ATTRINDX(MT_NORMAL); |
2543 | #else |
2544 | diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c |
2545 | index e26a6f18f4210..35e89460b9ca8 100644 |
2546 | --- a/drivers/usb/core/devio.c |
2547 | +++ b/drivers/usb/core/devio.c |
2548 | @@ -482,11 +482,11 @@ static void snoop_urb(struct usb_device *udev, |
2549 | |
2550 | if (userurb) { /* Async */ |
2551 | if (when == SUBMIT) |
2552 | - dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, " |
2553 | + dev_info(&udev->dev, "userurb %px, ep%d %s-%s, " |
2554 | "length %u\n", |
2555 | userurb, ep, t, d, length); |
2556 | else |
2557 | - dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, " |
2558 | + dev_info(&udev->dev, "userurb %px, ep%d %s-%s, " |
2559 | "actual_length %u status %d\n", |
2560 | userurb, ep, t, d, length, |
2561 | timeout_or_status); |
2562 | @@ -1992,7 +1992,7 @@ static int proc_reapurb(struct usb_dev_state *ps, void __user *arg) |
2563 | if (as) { |
2564 | int retval; |
2565 | |
2566 | - snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
2567 | + snoop(&ps->dev->dev, "reap %px\n", as->userurb); |
2568 | retval = processcompl(as, (void __user * __user *)arg); |
2569 | free_async(as); |
2570 | return retval; |
2571 | @@ -2009,7 +2009,7 @@ static int proc_reapurbnonblock(struct usb_dev_state *ps, void __user *arg) |
2572 | |
2573 | as = async_getcompleted(ps); |
2574 | if (as) { |
2575 | - snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
2576 | + snoop(&ps->dev->dev, "reap %px\n", as->userurb); |
2577 | retval = processcompl(as, (void __user * __user *)arg); |
2578 | free_async(as); |
2579 | } else { |
2580 | @@ -2139,7 +2139,7 @@ static int proc_reapurb_compat(struct usb_dev_state *ps, void __user *arg) |
2581 | if (as) { |
2582 | int retval; |
2583 | |
2584 | - snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
2585 | + snoop(&ps->dev->dev, "reap %px\n", as->userurb); |
2586 | retval = processcompl_compat(as, (void __user * __user *)arg); |
2587 | free_async(as); |
2588 | return retval; |
2589 | @@ -2156,7 +2156,7 @@ static int proc_reapurbnonblock_compat(struct usb_dev_state *ps, void __user *ar |
2590 | |
2591 | as = async_getcompleted(ps); |
2592 | if (as) { |
2593 | - snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
2594 | + snoop(&ps->dev->dev, "reap %px\n", as->userurb); |
2595 | retval = processcompl_compat(as, (void __user * __user *)arg); |
2596 | free_async(as); |
2597 | } else { |
2598 | @@ -2621,7 +2621,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, |
2599 | #endif |
2600 | |
2601 | case USBDEVFS_DISCARDURB: |
2602 | - snoop(&dev->dev, "%s: DISCARDURB %pK\n", __func__, p); |
2603 | + snoop(&dev->dev, "%s: DISCARDURB %px\n", __func__, p); |
2604 | ret = proc_unlinkurb(ps, p); |
2605 | break; |
2606 | |
2607 | diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
2608 | index 5ad14cdd97623..b55c3a699fc65 100644 |
2609 | --- a/drivers/usb/core/quirks.c |
2610 | +++ b/drivers/usb/core/quirks.c |
2611 | @@ -348,6 +348,10 @@ static const struct usb_device_id usb_quirk_list[] = { |
2612 | /* Guillemot Webcam Hercules Dualpix Exchange*/ |
2613 | { USB_DEVICE(0x06f8, 0x3005), .driver_info = USB_QUIRK_RESET_RESUME }, |
2614 | |
2615 | + /* Guillemot Hercules DJ Console audio card (BZ 208357) */ |
2616 | + { USB_DEVICE(0x06f8, 0xb000), .driver_info = |
2617 | + USB_QUIRK_ENDPOINT_BLACKLIST }, |
2618 | + |
2619 | /* Midiman M-Audio Keystation 88es */ |
2620 | { USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME }, |
2621 | |
2622 | @@ -421,6 +425,10 @@ static const struct usb_device_id usb_quirk_list[] = { |
2623 | { USB_DEVICE(0x1532, 0x0116), .driver_info = |
2624 | USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, |
2625 | |
2626 | + /* Lenovo ThinkCenter A630Z TI024Gen3 usb-audio */ |
2627 | + { USB_DEVICE(0x17ef, 0xa012), .driver_info = |
2628 | + USB_QUIRK_DISCONNECT_SUSPEND }, |
2629 | + |
2630 | /* BUILDWIN Photo Frame */ |
2631 | { USB_DEVICE(0x1908, 0x1315), .driver_info = |
2632 | USB_QUIRK_HONOR_BNUMINTERFACES }, |
2633 | @@ -521,6 +529,8 @@ static const struct usb_device_id usb_amd_resume_quirk_list[] = { |
2634 | * Matched for devices with USB_QUIRK_ENDPOINT_BLACKLIST. |
2635 | */ |
2636 | static const struct usb_device_id usb_endpoint_blacklist[] = { |
2637 | + { USB_DEVICE_INTERFACE_NUMBER(0x06f8, 0xb000, 5), .driver_info = 0x01 }, |
2638 | + { USB_DEVICE_INTERFACE_NUMBER(0x06f8, 0xb000, 5), .driver_info = 0x81 }, |
2639 | { USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0202, 1), .driver_info = 0x85 }, |
2640 | { USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0208, 1), .driver_info = 0x85 }, |
2641 | { } |
2642 | diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c |
2643 | index 46af0aa07e2e3..b2b5b0689667b 100644 |
2644 | --- a/drivers/usb/gadget/function/f_midi.c |
2645 | +++ b/drivers/usb/gadget/function/f_midi.c |
2646 | @@ -1315,7 +1315,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) |
2647 | midi->id = kstrdup(opts->id, GFP_KERNEL); |
2648 | if (opts->id && !midi->id) { |
2649 | status = -ENOMEM; |
2650 | - goto setup_fail; |
2651 | + goto midi_free; |
2652 | } |
2653 | midi->in_ports = opts->in_ports; |
2654 | midi->out_ports = opts->out_ports; |
2655 | @@ -1327,7 +1327,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) |
2656 | |
2657 | status = kfifo_alloc(&midi->in_req_fifo, midi->qlen, GFP_KERNEL); |
2658 | if (status) |
2659 | - goto setup_fail; |
2660 | + goto midi_free; |
2661 | |
2662 | spin_lock_init(&midi->transmit_lock); |
2663 | |
2664 | @@ -1343,9 +1343,13 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) |
2665 | |
2666 | return &midi->func; |
2667 | |
2668 | +midi_free: |
2669 | + if (midi) |
2670 | + kfree(midi->id); |
2671 | + kfree(midi); |
2672 | setup_fail: |
2673 | mutex_unlock(&opts->lock); |
2674 | - kfree(midi); |
2675 | + |
2676 | return ERR_PTR(status); |
2677 | } |
2678 | |
2679 | diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c |
2680 | index 238f555fe494a..cabcbb47f0ac1 100644 |
2681 | --- a/drivers/usb/gadget/legacy/inode.c |
2682 | +++ b/drivers/usb/gadget/legacy/inode.c |
2683 | @@ -2040,6 +2040,9 @@ gadgetfs_fill_super (struct super_block *sb, struct fs_context *fc) |
2684 | return 0; |
2685 | |
2686 | Enomem: |
2687 | + kfree(CHIP); |
2688 | + CHIP = NULL; |
2689 | + |
2690 | return -ENOMEM; |
2691 | } |
2692 | |
2693 | diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c |
2694 | index f63f84a257256..98c484149ac7f 100644 |
2695 | --- a/drivers/vhost/scsi.c |
2696 | +++ b/drivers/vhost/scsi.c |
2697 | @@ -320,7 +320,7 @@ static u32 vhost_scsi_tpg_get_inst_index(struct se_portal_group *se_tpg) |
2698 | return 1; |
2699 | } |
2700 | |
2701 | -static void vhost_scsi_release_cmd(struct se_cmd *se_cmd) |
2702 | +static void vhost_scsi_release_cmd_res(struct se_cmd *se_cmd) |
2703 | { |
2704 | struct vhost_scsi_cmd *tv_cmd = container_of(se_cmd, |
2705 | struct vhost_scsi_cmd, tvc_se_cmd); |
2706 | @@ -340,6 +340,16 @@ static void vhost_scsi_release_cmd(struct se_cmd *se_cmd) |
2707 | target_free_tag(se_sess, se_cmd); |
2708 | } |
2709 | |
2710 | +static void vhost_scsi_release_cmd(struct se_cmd *se_cmd) |
2711 | +{ |
2712 | + struct vhost_scsi_cmd *cmd = container_of(se_cmd, |
2713 | + struct vhost_scsi_cmd, tvc_se_cmd); |
2714 | + struct vhost_scsi *vs = cmd->tvc_vhost; |
2715 | + |
2716 | + llist_add(&cmd->tvc_completion_list, &vs->vs_completion_list); |
2717 | + vhost_work_queue(&vs->dev, &vs->vs_completion_work); |
2718 | +} |
2719 | + |
2720 | static u32 vhost_scsi_sess_get_index(struct se_session *se_sess) |
2721 | { |
2722 | return 0; |
2723 | @@ -362,28 +372,15 @@ static int vhost_scsi_get_cmd_state(struct se_cmd *se_cmd) |
2724 | return 0; |
2725 | } |
2726 | |
2727 | -static void vhost_scsi_complete_cmd(struct vhost_scsi_cmd *cmd) |
2728 | -{ |
2729 | - struct vhost_scsi *vs = cmd->tvc_vhost; |
2730 | - |
2731 | - llist_add(&cmd->tvc_completion_list, &vs->vs_completion_list); |
2732 | - |
2733 | - vhost_work_queue(&vs->dev, &vs->vs_completion_work); |
2734 | -} |
2735 | - |
2736 | static int vhost_scsi_queue_data_in(struct se_cmd *se_cmd) |
2737 | { |
2738 | - struct vhost_scsi_cmd *cmd = container_of(se_cmd, |
2739 | - struct vhost_scsi_cmd, tvc_se_cmd); |
2740 | - vhost_scsi_complete_cmd(cmd); |
2741 | + transport_generic_free_cmd(se_cmd, 0); |
2742 | return 0; |
2743 | } |
2744 | |
2745 | static int vhost_scsi_queue_status(struct se_cmd *se_cmd) |
2746 | { |
2747 | - struct vhost_scsi_cmd *cmd = container_of(se_cmd, |
2748 | - struct vhost_scsi_cmd, tvc_se_cmd); |
2749 | - vhost_scsi_complete_cmd(cmd); |
2750 | + transport_generic_free_cmd(se_cmd, 0); |
2751 | return 0; |
2752 | } |
2753 | |
2754 | @@ -429,15 +426,6 @@ vhost_scsi_allocate_evt(struct vhost_scsi *vs, |
2755 | return evt; |
2756 | } |
2757 | |
2758 | -static void vhost_scsi_free_cmd(struct vhost_scsi_cmd *cmd) |
2759 | -{ |
2760 | - struct se_cmd *se_cmd = &cmd->tvc_se_cmd; |
2761 | - |
2762 | - /* TODO locking against target/backend threads? */ |
2763 | - transport_generic_free_cmd(se_cmd, 0); |
2764 | - |
2765 | -} |
2766 | - |
2767 | static int vhost_scsi_check_stop_free(struct se_cmd *se_cmd) |
2768 | { |
2769 | return target_put_sess_cmd(se_cmd); |
2770 | @@ -556,7 +544,7 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work) |
2771 | } else |
2772 | pr_err("Faulted on virtio_scsi_cmd_resp\n"); |
2773 | |
2774 | - vhost_scsi_free_cmd(cmd); |
2775 | + vhost_scsi_release_cmd_res(se_cmd); |
2776 | } |
2777 | |
2778 | vq = -1; |
2779 | @@ -1088,7 +1076,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) |
2780 | &prot_iter, exp_data_len, |
2781 | &data_iter))) { |
2782 | vq_err(vq, "Failed to map iov to sgl\n"); |
2783 | - vhost_scsi_release_cmd(&cmd->tvc_se_cmd); |
2784 | + vhost_scsi_release_cmd_res(&cmd->tvc_se_cmd); |
2785 | goto err; |
2786 | } |
2787 | } |
2788 | diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c |
2789 | index 2dcb7c58b31e1..81671272aa58f 100644 |
2790 | --- a/drivers/video/fbdev/hyperv_fb.c |
2791 | +++ b/drivers/video/fbdev/hyperv_fb.c |
2792 | @@ -703,7 +703,12 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) |
2793 | goto err1; |
2794 | } |
2795 | |
2796 | - fb_virt = ioremap(par->mem->start, screen_fb_size); |
2797 | + /* |
2798 | + * Map the VRAM cacheable for performance. This is also required for |
2799 | + * VM Connect to display properly for ARM64 Linux VM, as the host also |
2800 | + * maps the VRAM cacheable. |
2801 | + */ |
2802 | + fb_virt = ioremap_cache(par->mem->start, screen_fb_size); |
2803 | if (!fb_virt) |
2804 | goto err2; |
2805 | |
2806 | diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c |
2807 | index 04fd02e6124dd..d9246fb8cea65 100644 |
2808 | --- a/fs/btrfs/qgroup.c |
2809 | +++ b/fs/btrfs/qgroup.c |
2810 | @@ -488,13 +488,13 @@ next2: |
2811 | break; |
2812 | } |
2813 | out: |
2814 | + btrfs_free_path(path); |
2815 | fs_info->qgroup_flags |= flags; |
2816 | if (!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_ON)) |
2817 | clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); |
2818 | else if (fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN && |
2819 | ret >= 0) |
2820 | ret = qgroup_rescan_init(fs_info, rescan_progress, 0); |
2821 | - btrfs_free_path(path); |
2822 | |
2823 | if (ret < 0) { |
2824 | ulist_free(fs_info->qgroup_ulist); |
2825 | diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c |
2826 | index 48e46323d519c..9feb8a1793efb 100644 |
2827 | --- a/fs/btrfs/tree-checker.c |
2828 | +++ b/fs/btrfs/tree-checker.c |
2829 | @@ -913,6 +913,7 @@ static int check_root_item(struct extent_buffer *leaf, struct btrfs_key *key, |
2830 | "invalid root item size, have %u expect %zu or %u", |
2831 | btrfs_item_size_nr(leaf, slot), sizeof(ri), |
2832 | btrfs_legacy_root_item_size()); |
2833 | + return -EUCLEAN; |
2834 | } |
2835 | |
2836 | /* |
2837 | @@ -1268,6 +1269,7 @@ static int check_extent_data_ref(struct extent_buffer *leaf, |
2838 | "invalid item size, have %u expect aligned to %zu for key type %u", |
2839 | btrfs_item_size_nr(leaf, slot), |
2840 | sizeof(*dref), key->type); |
2841 | + return -EUCLEAN; |
2842 | } |
2843 | if (!IS_ALIGNED(key->objectid, leaf->fs_info->sectorsize)) { |
2844 | generic_err(leaf, slot, |
2845 | @@ -1296,6 +1298,7 @@ static int check_extent_data_ref(struct extent_buffer *leaf, |
2846 | extent_err(leaf, slot, |
2847 | "invalid extent data backref offset, have %llu expect aligned to %u", |
2848 | offset, leaf->fs_info->sectorsize); |
2849 | + return -EUCLEAN; |
2850 | } |
2851 | } |
2852 | return 0; |
2853 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
2854 | index 808c5985904ed..457f8f858a3f0 100644 |
2855 | --- a/fs/btrfs/volumes.c |
2856 | +++ b/fs/btrfs/volumes.c |
2857 | @@ -1122,7 +1122,13 @@ static noinline struct btrfs_device *device_list_add(const char *path, |
2858 | if (device->bdev != path_bdev) { |
2859 | bdput(path_bdev); |
2860 | mutex_unlock(&fs_devices->device_list_mutex); |
2861 | - btrfs_warn_in_rcu(device->fs_info, |
2862 | + /* |
2863 | + * device->fs_info may not be reliable here, so |
2864 | + * pass in a NULL instead. This avoids a |
2865 | + * possible use-after-free when the fs_info and |
2866 | + * fs_info->sb are already torn down. |
2867 | + */ |
2868 | + btrfs_warn_in_rcu(NULL, |
2869 | "duplicate device %s devid %llu generation %llu scanned by %s (%d)", |
2870 | path, devid, found_transid, |
2871 | current->comm, |
2872 | diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c |
2873 | index 1619af216677c..1f55072aa3023 100644 |
2874 | --- a/fs/cifs/cifsacl.c |
2875 | +++ b/fs/cifs/cifsacl.c |
2876 | @@ -1198,6 +1198,7 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr, |
2877 | cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc); |
2878 | } else if (mode_from_special_sid) { |
2879 | rc = parse_sec_desc(cifs_sb, pntsd, acllen, fattr, true); |
2880 | + kfree(pntsd); |
2881 | } else { |
2882 | /* get approximated mode from ACL */ |
2883 | rc = parse_sec_desc(cifs_sb, pntsd, acllen, fattr, false); |
2884 | diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c |
2885 | index 776029a57e717..6211f8b731a97 100644 |
2886 | --- a/fs/cifs/smb2ops.c |
2887 | +++ b/fs/cifs/smb2ops.c |
2888 | @@ -259,7 +259,7 @@ smb2_revert_current_mid(struct TCP_Server_Info *server, const unsigned int val) |
2889 | } |
2890 | |
2891 | static struct mid_q_entry * |
2892 | -smb2_find_mid(struct TCP_Server_Info *server, char *buf) |
2893 | +__smb2_find_mid(struct TCP_Server_Info *server, char *buf, bool dequeue) |
2894 | { |
2895 | struct mid_q_entry *mid; |
2896 | struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)buf; |
2897 | @@ -276,6 +276,10 @@ smb2_find_mid(struct TCP_Server_Info *server, char *buf) |
2898 | (mid->mid_state == MID_REQUEST_SUBMITTED) && |
2899 | (mid->command == shdr->Command)) { |
2900 | kref_get(&mid->refcount); |
2901 | + if (dequeue) { |
2902 | + list_del_init(&mid->qhead); |
2903 | + mid->mid_flags |= MID_DELETED; |
2904 | + } |
2905 | spin_unlock(&GlobalMid_Lock); |
2906 | return mid; |
2907 | } |
2908 | @@ -284,6 +288,18 @@ smb2_find_mid(struct TCP_Server_Info *server, char *buf) |
2909 | return NULL; |
2910 | } |
2911 | |
2912 | +static struct mid_q_entry * |
2913 | +smb2_find_mid(struct TCP_Server_Info *server, char *buf) |
2914 | +{ |
2915 | + return __smb2_find_mid(server, buf, false); |
2916 | +} |
2917 | + |
2918 | +static struct mid_q_entry * |
2919 | +smb2_find_dequeue_mid(struct TCP_Server_Info *server, char *buf) |
2920 | +{ |
2921 | + return __smb2_find_mid(server, buf, true); |
2922 | +} |
2923 | + |
2924 | static void |
2925 | smb2_dump_detail(void *buf, struct TCP_Server_Info *server) |
2926 | { |
2927 | @@ -3979,7 +3995,8 @@ init_read_bvec(struct page **pages, unsigned int npages, unsigned int data_size, |
2928 | static int |
2929 | handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, |
2930 | char *buf, unsigned int buf_len, struct page **pages, |
2931 | - unsigned int npages, unsigned int page_data_size) |
2932 | + unsigned int npages, unsigned int page_data_size, |
2933 | + bool is_offloaded) |
2934 | { |
2935 | unsigned int data_offset; |
2936 | unsigned int data_len; |
2937 | @@ -4001,7 +4018,8 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, |
2938 | |
2939 | if (server->ops->is_session_expired && |
2940 | server->ops->is_session_expired(buf)) { |
2941 | - cifs_reconnect(server); |
2942 | + if (!is_offloaded) |
2943 | + cifs_reconnect(server); |
2944 | wake_up(&server->response_q); |
2945 | return -1; |
2946 | } |
2947 | @@ -4026,7 +4044,10 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, |
2948 | cifs_dbg(FYI, "%s: server returned error %d\n", |
2949 | __func__, rdata->result); |
2950 | /* normal error on read response */ |
2951 | - dequeue_mid(mid, false); |
2952 | + if (is_offloaded) |
2953 | + mid->mid_state = MID_RESPONSE_RECEIVED; |
2954 | + else |
2955 | + dequeue_mid(mid, false); |
2956 | return 0; |
2957 | } |
2958 | |
2959 | @@ -4050,7 +4071,10 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, |
2960 | cifs_dbg(FYI, "%s: data offset (%u) beyond end of smallbuf\n", |
2961 | __func__, data_offset); |
2962 | rdata->result = -EIO; |
2963 | - dequeue_mid(mid, rdata->result); |
2964 | + if (is_offloaded) |
2965 | + mid->mid_state = MID_RESPONSE_MALFORMED; |
2966 | + else |
2967 | + dequeue_mid(mid, rdata->result); |
2968 | return 0; |
2969 | } |
2970 | |
2971 | @@ -4066,21 +4090,30 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, |
2972 | cifs_dbg(FYI, "%s: data offset (%u) beyond 1st page of response\n", |
2973 | __func__, data_offset); |
2974 | rdata->result = -EIO; |
2975 | - dequeue_mid(mid, rdata->result); |
2976 | + if (is_offloaded) |
2977 | + mid->mid_state = MID_RESPONSE_MALFORMED; |
2978 | + else |
2979 | + dequeue_mid(mid, rdata->result); |
2980 | return 0; |
2981 | } |
2982 | |
2983 | if (data_len > page_data_size - pad_len) { |
2984 | /* data_len is corrupt -- discard frame */ |
2985 | rdata->result = -EIO; |
2986 | - dequeue_mid(mid, rdata->result); |
2987 | + if (is_offloaded) |
2988 | + mid->mid_state = MID_RESPONSE_MALFORMED; |
2989 | + else |
2990 | + dequeue_mid(mid, rdata->result); |
2991 | return 0; |
2992 | } |
2993 | |
2994 | rdata->result = init_read_bvec(pages, npages, page_data_size, |
2995 | cur_off, &bvec); |
2996 | if (rdata->result != 0) { |
2997 | - dequeue_mid(mid, rdata->result); |
2998 | + if (is_offloaded) |
2999 | + mid->mid_state = MID_RESPONSE_MALFORMED; |
3000 | + else |
3001 | + dequeue_mid(mid, rdata->result); |
3002 | return 0; |
3003 | } |
3004 | |
3005 | @@ -4095,7 +4128,10 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, |
3006 | /* read response payload cannot be in both buf and pages */ |
3007 | WARN_ONCE(1, "buf can not contain only a part of read data"); |
3008 | rdata->result = -EIO; |
3009 | - dequeue_mid(mid, rdata->result); |
3010 | + if (is_offloaded) |
3011 | + mid->mid_state = MID_RESPONSE_MALFORMED; |
3012 | + else |
3013 | + dequeue_mid(mid, rdata->result); |
3014 | return 0; |
3015 | } |
3016 | |
3017 | @@ -4106,7 +4142,10 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, |
3018 | if (length < 0) |
3019 | return length; |
3020 | |
3021 | - dequeue_mid(mid, false); |
3022 | + if (is_offloaded) |
3023 | + mid->mid_state = MID_RESPONSE_RECEIVED; |
3024 | + else |
3025 | + dequeue_mid(mid, false); |
3026 | return length; |
3027 | } |
3028 | |
3029 | @@ -4135,15 +4174,34 @@ static void smb2_decrypt_offload(struct work_struct *work) |
3030 | } |
3031 | |
3032 | dw->server->lstrp = jiffies; |
3033 | - mid = smb2_find_mid(dw->server, dw->buf); |
3034 | + mid = smb2_find_dequeue_mid(dw->server, dw->buf); |
3035 | if (mid == NULL) |
3036 | cifs_dbg(FYI, "mid not found\n"); |
3037 | else { |
3038 | mid->decrypted = true; |
3039 | rc = handle_read_data(dw->server, mid, dw->buf, |
3040 | dw->server->vals->read_rsp_size, |
3041 | - dw->ppages, dw->npages, dw->len); |
3042 | - mid->callback(mid); |
3043 | + dw->ppages, dw->npages, dw->len, |
3044 | + true); |
3045 | + if (rc >= 0) { |
3046 | +#ifdef CONFIG_CIFS_STATS2 |
3047 | + mid->when_received = jiffies; |
3048 | +#endif |
3049 | + mid->callback(mid); |
3050 | + } else { |
3051 | + spin_lock(&GlobalMid_Lock); |
3052 | + if (dw->server->tcpStatus == CifsNeedReconnect) { |
3053 | + mid->mid_state = MID_RETRY_NEEDED; |
3054 | + spin_unlock(&GlobalMid_Lock); |
3055 | + mid->callback(mid); |
3056 | + } else { |
3057 | + mid->mid_state = MID_REQUEST_SUBMITTED; |
3058 | + mid->mid_flags &= ~(MID_DELETED); |
3059 | + list_add_tail(&mid->qhead, |
3060 | + &dw->server->pending_mid_q); |
3061 | + spin_unlock(&GlobalMid_Lock); |
3062 | + } |
3063 | + } |
3064 | cifs_mid_q_entry_release(mid); |
3065 | } |
3066 | |
3067 | @@ -4246,7 +4304,7 @@ non_offloaded_decrypt: |
3068 | (*mid)->decrypted = true; |
3069 | rc = handle_read_data(server, *mid, buf, |
3070 | server->vals->read_rsp_size, |
3071 | - pages, npages, len); |
3072 | + pages, npages, len, false); |
3073 | } |
3074 | |
3075 | free_pages: |
3076 | @@ -4391,7 +4449,7 @@ smb3_handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid) |
3077 | char *buf = server->large_buf ? server->bigbuf : server->smallbuf; |
3078 | |
3079 | return handle_read_data(server, mid, buf, server->pdu_size, |
3080 | - NULL, 0, 0); |
3081 | + NULL, 0, 0, false); |
3082 | } |
3083 | |
3084 | static int |
3085 | diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c |
3086 | index 96c0c86f3fffe..0297ad95eb5cc 100644 |
3087 | --- a/fs/efivarfs/inode.c |
3088 | +++ b/fs/efivarfs/inode.c |
3089 | @@ -7,6 +7,7 @@ |
3090 | #include <linux/efi.h> |
3091 | #include <linux/fs.h> |
3092 | #include <linux/ctype.h> |
3093 | +#include <linux/kmemleak.h> |
3094 | #include <linux/slab.h> |
3095 | #include <linux/uuid.h> |
3096 | |
3097 | @@ -103,6 +104,7 @@ static int efivarfs_create(struct inode *dir, struct dentry *dentry, |
3098 | var->var.VariableName[i] = '\0'; |
3099 | |
3100 | inode->i_private = var; |
3101 | + kmemleak_ignore(var); |
3102 | |
3103 | err = efivar_entry_add(var, &efivarfs_list); |
3104 | if (err) |
3105 | diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c |
3106 | index edcd6769a94b4..9760a52800b42 100644 |
3107 | --- a/fs/efivarfs/super.c |
3108 | +++ b/fs/efivarfs/super.c |
3109 | @@ -21,7 +21,6 @@ LIST_HEAD(efivarfs_list); |
3110 | static void efivarfs_evict_inode(struct inode *inode) |
3111 | { |
3112 | clear_inode(inode); |
3113 | - kfree(inode->i_private); |
3114 | } |
3115 | |
3116 | static const struct super_operations efivarfs_ops = { |
3117 | diff --git a/fs/proc/self.c b/fs/proc/self.c |
3118 | index 32af065397f80..582336862d258 100644 |
3119 | --- a/fs/proc/self.c |
3120 | +++ b/fs/proc/self.c |
3121 | @@ -16,6 +16,13 @@ static const char *proc_self_get_link(struct dentry *dentry, |
3122 | pid_t tgid = task_tgid_nr_ns(current, ns); |
3123 | char *name; |
3124 | |
3125 | + /* |
3126 | + * Not currently supported. Once we can inherit all of struct pid, |
3127 | + * we can allow this. |
3128 | + */ |
3129 | + if (current->flags & PF_KTHREAD) |
3130 | + return ERR_PTR(-EOPNOTSUPP); |
3131 | + |
3132 | if (!tgid) |
3133 | return ERR_PTR(-ENOENT); |
3134 | /* max length of unsigned int in decimal + NULL term */ |
3135 | diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h |
3136 | index ea39a0b54c637..15f77361eb130 100644 |
3137 | --- a/include/asm-generic/pgtable.h |
3138 | +++ b/include/asm-generic/pgtable.h |
3139 | @@ -1159,6 +1159,19 @@ static inline bool arch_has_pfn_modify_check(void) |
3140 | |
3141 | #endif /* !__ASSEMBLY__ */ |
3142 | |
3143 | +#if !defined(MAX_POSSIBLE_PHYSMEM_BITS) && !defined(CONFIG_64BIT) |
3144 | +#ifdef CONFIG_PHYS_ADDR_T_64BIT |
3145 | +/* |
3146 | + * ZSMALLOC needs to know the highest PFN on 32-bit architectures |
3147 | + * with physical address space extension, but falls back to |
3148 | + * BITS_PER_LONG otherwise. |
3149 | + */ |
3150 | +#error Missing MAX_POSSIBLE_PHYSMEM_BITS definition |
3151 | +#else |
3152 | +#define MAX_POSSIBLE_PHYSMEM_BITS 32 |
3153 | +#endif |
3154 | +#endif |
3155 | + |
3156 | #ifndef has_transparent_hugepage |
3157 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
3158 | #define has_transparent_hugepage() 1 |
3159 | diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h |
3160 | index 77ebb61faf486..4c0e6539effdd 100644 |
3161 | --- a/include/linux/netfilter.h |
3162 | +++ b/include/linux/netfilter.h |
3163 | @@ -316,7 +316,7 @@ NF_HOOK_LIST(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, |
3164 | |
3165 | INIT_LIST_HEAD(&sublist); |
3166 | list_for_each_entry_safe(skb, next, head, list) { |
3167 | - list_del(&skb->list); |
3168 | + skb_list_del_init(skb); |
3169 | if (nf_hook(pf, hook, net, sk, skb, in, out, okfn) == 1) |
3170 | list_add_tail(&skb->list, &sublist); |
3171 | } |
3172 | diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h |
3173 | index c25fb86ffae95..b3bbd10eb3f07 100644 |
3174 | --- a/include/scsi/libiscsi.h |
3175 | +++ b/include/scsi/libiscsi.h |
3176 | @@ -132,6 +132,9 @@ struct iscsi_task { |
3177 | void *dd_data; /* driver/transport data */ |
3178 | }; |
3179 | |
3180 | +/* invalid scsi_task pointer */ |
3181 | +#define INVALID_SCSI_TASK (struct iscsi_task *)-1l |
3182 | + |
3183 | static inline int iscsi_task_has_unsol_data(struct iscsi_task *task) |
3184 | { |
3185 | return task->unsol_r2t.data_length > task->unsol_r2t.sent; |
3186 | diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h |
3187 | index 67434278b81dd..a8af22e469ce5 100644 |
3188 | --- a/include/trace/events/writeback.h |
3189 | +++ b/include/trace/events/writeback.h |
3190 | @@ -192,7 +192,7 @@ TRACE_EVENT(inode_foreign_history, |
3191 | ), |
3192 | |
3193 | TP_fast_assign( |
3194 | - strncpy(__entry->name, bdi_dev_name(inode_to_bdi(inode)), 32); |
3195 | + strscpy_pad(__entry->name, bdi_dev_name(inode_to_bdi(inode)), 32); |
3196 | __entry->ino = inode->i_ino; |
3197 | __entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc); |
3198 | __entry->history = history; |
3199 | @@ -221,7 +221,7 @@ TRACE_EVENT(inode_switch_wbs, |
3200 | ), |
3201 | |
3202 | TP_fast_assign( |
3203 | - strncpy(__entry->name, bdi_dev_name(old_wb->bdi), 32); |
3204 | + strscpy_pad(__entry->name, bdi_dev_name(old_wb->bdi), 32); |
3205 | __entry->ino = inode->i_ino; |
3206 | __entry->old_cgroup_ino = __trace_wb_assign_cgroup(old_wb); |
3207 | __entry->new_cgroup_ino = __trace_wb_assign_cgroup(new_wb); |
3208 | @@ -254,7 +254,7 @@ TRACE_EVENT(track_foreign_dirty, |
3209 | struct address_space *mapping = page_mapping(page); |
3210 | struct inode *inode = mapping ? mapping->host : NULL; |
3211 | |
3212 | - strncpy(__entry->name, bdi_dev_name(wb->bdi), 32); |
3213 | + strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); |
3214 | __entry->bdi_id = wb->bdi->id; |
3215 | __entry->ino = inode ? inode->i_ino : 0; |
3216 | __entry->memcg_id = wb->memcg_css->id; |
3217 | @@ -287,7 +287,7 @@ TRACE_EVENT(flush_foreign, |
3218 | ), |
3219 | |
3220 | TP_fast_assign( |
3221 | - strncpy(__entry->name, bdi_dev_name(wb->bdi), 32); |
3222 | + strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); |
3223 | __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); |
3224 | __entry->frn_bdi_id = frn_bdi_id; |
3225 | __entry->frn_memcg_id = frn_memcg_id; |
3226 | diff --git a/include/uapi/linux/wireless.h b/include/uapi/linux/wireless.h |
3227 | index a2c006a364e0b..24f3371ad8262 100644 |
3228 | --- a/include/uapi/linux/wireless.h |
3229 | +++ b/include/uapi/linux/wireless.h |
3230 | @@ -74,7 +74,11 @@ |
3231 | #include <linux/socket.h> /* for "struct sockaddr" et al */ |
3232 | #include <linux/if.h> /* for IFNAMSIZ and co... */ |
3233 | |
3234 | -#include <stddef.h> /* for offsetof */ |
3235 | +#ifdef __KERNEL__ |
3236 | +# include <linux/stddef.h> /* for offsetof */ |
3237 | +#else |
3238 | +# include <stddef.h> /* for offsetof */ |
3239 | +#endif |
3240 | |
3241 | /***************************** VERSION *****************************/ |
3242 | /* |
3243 | diff --git a/include/uapi/sound/skl-tplg-interface.h b/include/uapi/sound/skl-tplg-interface.h |
3244 | index 9eee32f5e4077..a93c0decfdd53 100644 |
3245 | --- a/include/uapi/sound/skl-tplg-interface.h |
3246 | +++ b/include/uapi/sound/skl-tplg-interface.h |
3247 | @@ -18,6 +18,8 @@ |
3248 | */ |
3249 | #define SKL_CONTROL_TYPE_BYTE_TLV 0x100 |
3250 | #define SKL_CONTROL_TYPE_MIC_SELECT 0x102 |
3251 | +#define SKL_CONTROL_TYPE_MULTI_IO_SELECT 0x103 |
3252 | +#define SKL_CONTROL_TYPE_MULTI_IO_SELECT_DMIC 0x104 |
3253 | |
3254 | #define HDA_SST_CFG_MAX 900 /* size of copier cfg*/ |
3255 | #define MAX_IN_QUEUE 8 |
3256 | diff --git a/net/batman-adv/log.c b/net/batman-adv/log.c |
3257 | index 11941cf1adcc9..87f3de3d4e4ca 100644 |
3258 | --- a/net/batman-adv/log.c |
3259 | +++ b/net/batman-adv/log.c |
3260 | @@ -180,6 +180,7 @@ static const struct file_operations batadv_log_fops = { |
3261 | .read = batadv_log_read, |
3262 | .poll = batadv_log_poll, |
3263 | .llseek = no_llseek, |
3264 | + .owner = THIS_MODULE, |
3265 | }; |
3266 | |
3267 | /** |
3268 | diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c |
3269 | index 0a8220d30c992..ed2ab03cf971c 100644 |
3270 | --- a/net/ipv4/fib_frontend.c |
3271 | +++ b/net/ipv4/fib_frontend.c |
3272 | @@ -706,7 +706,7 @@ int fib_gw_from_via(struct fib_config *cfg, struct nlattr *nla, |
3273 | cfg->fc_gw4 = *((__be32 *)via->rtvia_addr); |
3274 | break; |
3275 | case AF_INET6: |
3276 | -#ifdef CONFIG_IPV6 |
3277 | +#if IS_ENABLED(CONFIG_IPV6) |
3278 | if (alen != sizeof(struct in6_addr)) { |
3279 | NL_SET_ERR_MSG(extack, "Invalid IPv6 address in RTA_VIA"); |
3280 | return -EINVAL; |
3281 | diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c |
3282 | index 92a82e6b5fe62..38b9d74940835 100644 |
3283 | --- a/sound/soc/intel/skylake/bxt-sst.c |
3284 | +++ b/sound/soc/intel/skylake/bxt-sst.c |
3285 | @@ -17,7 +17,6 @@ |
3286 | #include "skl.h" |
3287 | |
3288 | #define BXT_BASEFW_TIMEOUT 3000 |
3289 | -#define BXT_INIT_TIMEOUT 300 |
3290 | #define BXT_ROM_INIT_TIMEOUT 70 |
3291 | #define BXT_IPC_PURGE_FW 0x01004000 |
3292 | |
3293 | @@ -38,8 +37,6 @@ |
3294 | /* Delay before scheduling D0i3 entry */ |
3295 | #define BXT_D0I3_DELAY 5000 |
3296 | |
3297 | -#define BXT_FW_ROM_INIT_RETRY 3 |
3298 | - |
3299 | static unsigned int bxt_get_errorcode(struct sst_dsp *ctx) |
3300 | { |
3301 | return sst_dsp_shim_read(ctx, BXT_ADSP_ERROR_CODE); |
3302 | diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c |
3303 | index 4f64f097e9ae3..c6abcd5aa67b9 100644 |
3304 | --- a/sound/soc/intel/skylake/cnl-sst.c |
3305 | +++ b/sound/soc/intel/skylake/cnl-sst.c |
3306 | @@ -57,18 +57,34 @@ static int cnl_prepare_fw(struct sst_dsp *ctx, const void *fwdata, u32 fwsize) |
3307 | ctx->dsp_ops.stream_tag = stream_tag; |
3308 | memcpy(ctx->dmab.area, fwdata, fwsize); |
3309 | |
3310 | + ret = skl_dsp_core_power_up(ctx, SKL_DSP_CORE0_MASK); |
3311 | + if (ret < 0) { |
3312 | + dev_err(ctx->dev, "dsp core0 power up failed\n"); |
3313 | + ret = -EIO; |
3314 | + goto base_fw_load_failed; |
3315 | + } |
3316 | + |
3317 | /* purge FW request */ |
3318 | sst_dsp_shim_write(ctx, CNL_ADSP_REG_HIPCIDR, |
3319 | CNL_ADSP_REG_HIPCIDR_BUSY | (CNL_IPC_PURGE | |
3320 | ((stream_tag - 1) << CNL_ROM_CTRL_DMA_ID))); |
3321 | |
3322 | - ret = cnl_dsp_enable_core(ctx, SKL_DSP_CORE0_MASK); |
3323 | + ret = skl_dsp_start_core(ctx, SKL_DSP_CORE0_MASK); |
3324 | if (ret < 0) { |
3325 | - dev_err(ctx->dev, "dsp boot core failed ret: %d\n", ret); |
3326 | + dev_err(ctx->dev, "Start dsp core failed ret: %d\n", ret); |
3327 | ret = -EIO; |
3328 | goto base_fw_load_failed; |
3329 | } |
3330 | |
3331 | + ret = sst_dsp_register_poll(ctx, CNL_ADSP_REG_HIPCIDA, |
3332 | + CNL_ADSP_REG_HIPCIDA_DONE, |
3333 | + CNL_ADSP_REG_HIPCIDA_DONE, |
3334 | + BXT_INIT_TIMEOUT, "HIPCIDA Done"); |
3335 | + if (ret < 0) { |
3336 | + dev_err(ctx->dev, "timeout for purge request: %d\n", ret); |
3337 | + goto base_fw_load_failed; |
3338 | + } |
3339 | + |
3340 | /* enable interrupt */ |
3341 | cnl_ipc_int_enable(ctx); |
3342 | cnl_ipc_op_int_enable(ctx); |
3343 | @@ -109,7 +125,7 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx) |
3344 | { |
3345 | struct firmware stripped_fw; |
3346 | struct skl_dev *cnl = ctx->thread_context; |
3347 | - int ret; |
3348 | + int ret, i; |
3349 | |
3350 | if (!ctx->fw) { |
3351 | ret = request_firmware(&ctx->fw, ctx->fw_name, ctx->dev); |
3352 | @@ -131,12 +147,16 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx) |
3353 | stripped_fw.size = ctx->fw->size; |
3354 | skl_dsp_strip_extended_manifest(&stripped_fw); |
3355 | |
3356 | - ret = cnl_prepare_fw(ctx, stripped_fw.data, stripped_fw.size); |
3357 | - if (ret < 0) { |
3358 | - dev_err(ctx->dev, "prepare firmware failed: %d\n", ret); |
3359 | - goto cnl_load_base_firmware_failed; |
3360 | + for (i = 0; i < BXT_FW_ROM_INIT_RETRY; i++) { |
3361 | + ret = cnl_prepare_fw(ctx, stripped_fw.data, stripped_fw.size); |
3362 | + if (!ret) |
3363 | + break; |
3364 | + dev_dbg(ctx->dev, "prepare firmware failed: %d\n", ret); |
3365 | } |
3366 | |
3367 | + if (ret < 0) |
3368 | + goto cnl_load_base_firmware_failed; |
3369 | + |
3370 | ret = sst_transfer_fw_host_dma(ctx); |
3371 | if (ret < 0) { |
3372 | dev_err(ctx->dev, "transfer firmware failed: %d\n", ret); |
3373 | @@ -158,6 +178,7 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx) |
3374 | return 0; |
3375 | |
3376 | cnl_load_base_firmware_failed: |
3377 | + dev_err(ctx->dev, "firmware load failed: %d\n", ret); |
3378 | release_firmware(ctx->fw); |
3379 | ctx->fw = NULL; |
3380 | |
3381 | diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c |
3382 | index 19f328d71f244..d9c8f5cb389e3 100644 |
3383 | --- a/sound/soc/intel/skylake/skl-nhlt.c |
3384 | +++ b/sound/soc/intel/skylake/skl-nhlt.c |
3385 | @@ -182,7 +182,8 @@ void skl_nhlt_remove_sysfs(struct skl_dev *skl) |
3386 | { |
3387 | struct device *dev = &skl->pci->dev; |
3388 | |
3389 | - sysfs_remove_file(&dev->kobj, &dev_attr_platform_id.attr); |
3390 | + if (skl->nhlt) |
3391 | + sysfs_remove_file(&dev->kobj, &dev_attr_platform_id.attr); |
3392 | } |
3393 | |
3394 | /* |
3395 | diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h |
3396 | index cdfec0fca5773..1df9ef422f61d 100644 |
3397 | --- a/sound/soc/intel/skylake/skl-sst-dsp.h |
3398 | +++ b/sound/soc/intel/skylake/skl-sst-dsp.h |
3399 | @@ -67,6 +67,8 @@ struct skl_dev; |
3400 | |
3401 | #define SKL_FW_INIT 0x1 |
3402 | #define SKL_FW_RFW_START 0xf |
3403 | +#define BXT_FW_ROM_INIT_RETRY 3 |
3404 | +#define BXT_INIT_TIMEOUT 300 |
3405 | |
3406 | #define SKL_ADSPIC_IPC 1 |
3407 | #define SKL_ADSPIS_IPC 1 |
3408 | diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c |
3409 | index 4b114ece58c61..aa5833001fde5 100644 |
3410 | --- a/sound/soc/intel/skylake/skl-topology.c |
3411 | +++ b/sound/soc/intel/skylake/skl-topology.c |
3412 | @@ -579,6 +579,38 @@ static int skl_tplg_unload_pipe_modules(struct skl_dev *skl, |
3413 | return ret; |
3414 | } |
3415 | |
3416 | +static bool skl_tplg_is_multi_fmt(struct skl_dev *skl, struct skl_pipe *pipe) |
3417 | +{ |
3418 | + struct skl_pipe_fmt *cur_fmt; |
3419 | + struct skl_pipe_fmt *next_fmt; |
3420 | + int i; |
3421 | + |
3422 | + if (pipe->nr_cfgs <= 1) |
3423 | + return false; |
3424 | + |
3425 | + if (pipe->conn_type != SKL_PIPE_CONN_TYPE_FE) |
3426 | + return true; |
3427 | + |
3428 | + for (i = 0; i < pipe->nr_cfgs - 1; i++) { |
3429 | + if (pipe->direction == SNDRV_PCM_STREAM_PLAYBACK) { |
3430 | + cur_fmt = &pipe->configs[i].out_fmt; |
3431 | + next_fmt = &pipe->configs[i + 1].out_fmt; |
3432 | + } else { |
3433 | + cur_fmt = &pipe->configs[i].in_fmt; |
3434 | + next_fmt = &pipe->configs[i + 1].in_fmt; |
3435 | + } |
3436 | + |
3437 | + if (!CHECK_HW_PARAMS(cur_fmt->channels, cur_fmt->freq, |
3438 | + cur_fmt->bps, |
3439 | + next_fmt->channels, |
3440 | + next_fmt->freq, |
3441 | + next_fmt->bps)) |
3442 | + return true; |
3443 | + } |
3444 | + |
3445 | + return false; |
3446 | +} |
3447 | + |
3448 | /* |
3449 | * Here, we select pipe format based on the pipe type and pipe |
3450 | * direction to determine the current config index for the pipeline. |
3451 | @@ -601,6 +633,14 @@ skl_tplg_get_pipe_config(struct skl_dev *skl, struct skl_module_cfg *mconfig) |
3452 | return 0; |
3453 | } |
3454 | |
3455 | + if (skl_tplg_is_multi_fmt(skl, pipe)) { |
3456 | + pipe->cur_config_idx = pipe->pipe_config_idx; |
3457 | + pipe->memory_pages = pconfig->mem_pages; |
3458 | + dev_dbg(skl->dev, "found pipe config idx:%d\n", |
3459 | + pipe->cur_config_idx); |
3460 | + return 0; |
3461 | + } |
3462 | + |
3463 | if (pipe->conn_type == SKL_PIPE_CONN_TYPE_NONE) { |
3464 | dev_dbg(skl->dev, "No conn_type detected, take 0th config\n"); |
3465 | pipe->cur_config_idx = 0; |
3466 | @@ -1315,6 +1355,68 @@ static int skl_tplg_pga_event(struct snd_soc_dapm_widget *w, |
3467 | return 0; |
3468 | } |
3469 | |
3470 | +static int skl_tplg_multi_config_set_get(struct snd_kcontrol *kcontrol, |
3471 | + struct snd_ctl_elem_value *ucontrol, |
3472 | + bool is_set) |
3473 | +{ |
3474 | + struct snd_soc_component *component = |
3475 | + snd_soc_kcontrol_component(kcontrol); |
3476 | + struct hdac_bus *bus = snd_soc_component_get_drvdata(component); |
3477 | + struct skl_dev *skl = bus_to_skl(bus); |
3478 | + struct skl_pipeline *ppl; |
3479 | + struct skl_pipe *pipe = NULL; |
3480 | + struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value; |
3481 | + u32 *pipe_id; |
3482 | + |
3483 | + if (!ec) |
3484 | + return -EINVAL; |
3485 | + |
3486 | + if (is_set && ucontrol->value.enumerated.item[0] > ec->items) |
3487 | + return -EINVAL; |
3488 | + |
3489 | + pipe_id = ec->dobj.private; |
3490 | + |
3491 | + list_for_each_entry(ppl, &skl->ppl_list, node) { |
3492 | + if (ppl->pipe->ppl_id == *pipe_id) { |
3493 | + pipe = ppl->pipe; |
3494 | + break; |
3495 | + } |
3496 | + } |
3497 | + if (!pipe) |
3498 | + return -EIO; |
3499 | + |
3500 | + if (is_set) |
3501 | + pipe->pipe_config_idx = ucontrol->value.enumerated.item[0]; |
3502 | + else |
3503 | + ucontrol->value.enumerated.item[0] = pipe->pipe_config_idx; |
3504 | + |
3505 | + return 0; |
3506 | +} |
3507 | + |
3508 | +static int skl_tplg_multi_config_get(struct snd_kcontrol *kcontrol, |
3509 | + struct snd_ctl_elem_value *ucontrol) |
3510 | +{ |
3511 | + return skl_tplg_multi_config_set_get(kcontrol, ucontrol, false); |
3512 | +} |
3513 | + |
3514 | +static int skl_tplg_multi_config_set(struct snd_kcontrol *kcontrol, |
3515 | + struct snd_ctl_elem_value *ucontrol) |
3516 | +{ |
3517 | + return skl_tplg_multi_config_set_get(kcontrol, ucontrol, true); |
3518 | +} |
3519 | + |
3520 | +static int skl_tplg_multi_config_get_dmic(struct snd_kcontrol *kcontrol, |
3521 | + struct snd_ctl_elem_value *ucontrol) |
3522 | +{ |
3523 | + return skl_tplg_multi_config_set_get(kcontrol, ucontrol, false); |
3524 | +} |
3525 | + |
3526 | +static int skl_tplg_multi_config_set_dmic(struct snd_kcontrol *kcontrol, |
3527 | + struct snd_ctl_elem_value *ucontrol) |
3528 | +{ |
3529 | + return skl_tplg_multi_config_set_get(kcontrol, ucontrol, true); |
3530 | +} |
3531 | + |
3532 | static int skl_tplg_tlv_control_get(struct snd_kcontrol *kcontrol, |
3533 | unsigned int __user *data, unsigned int size) |
3534 | { |
3535 | @@ -1854,6 +1956,16 @@ static const struct snd_soc_tplg_kcontrol_ops skl_tplg_kcontrol_ops[] = { |
3536 | .get = skl_tplg_mic_control_get, |
3537 | .put = skl_tplg_mic_control_set, |
3538 | }, |
3539 | + { |
3540 | + .id = SKL_CONTROL_TYPE_MULTI_IO_SELECT, |
3541 | + .get = skl_tplg_multi_config_get, |
3542 | + .put = skl_tplg_multi_config_set, |
3543 | + }, |
3544 | + { |
3545 | + .id = SKL_CONTROL_TYPE_MULTI_IO_SELECT_DMIC, |
3546 | + .get = skl_tplg_multi_config_get_dmic, |
3547 | + .put = skl_tplg_multi_config_set_dmic, |
3548 | + } |
3549 | }; |
3550 | |
3551 | static int skl_tplg_fill_pipe_cfg(struct device *dev, |
3552 | @@ -3014,12 +3126,21 @@ static int skl_tplg_control_load(struct snd_soc_component *cmpnt, |
3553 | case SND_SOC_TPLG_CTL_ENUM: |
3554 | tplg_ec = container_of(hdr, |
3555 | struct snd_soc_tplg_enum_control, hdr); |
3556 | - if (kctl->access & SNDRV_CTL_ELEM_ACCESS_READWRITE) { |
3557 | + if (kctl->access & SNDRV_CTL_ELEM_ACCESS_READ) { |
3558 | se = (struct soc_enum *)kctl->private_value; |
3559 | if (tplg_ec->priv.size) |
3560 | - return skl_init_enum_data(bus->dev, se, |
3561 | - tplg_ec); |
3562 | + skl_init_enum_data(bus->dev, se, tplg_ec); |
3563 | } |
3564 | + |
3565 | + /* |
3566 | + * now that the control initializations are done, remove |
3567 | + * write permission for the DMIC configuration enums to |
3568 | + * avoid conflicts between NHLT settings and user interaction |
3569 | + */ |
3570 | + |
3571 | + if (hdr->ops.get == SKL_CONTROL_TYPE_MULTI_IO_SELECT_DMIC) |
3572 | + kctl->access = SNDRV_CTL_ELEM_ACCESS_READ; |
3573 | + |
3574 | break; |
3575 | |
3576 | default: |
3577 | @@ -3489,6 +3610,37 @@ static int skl_manifest_load(struct snd_soc_component *cmpnt, int index, |
3578 | return 0; |
3579 | } |
3580 | |
3581 | +static void skl_tplg_complete(struct snd_soc_component *component) |
3582 | +{ |
3583 | + struct snd_soc_dobj *dobj; |
3584 | + struct snd_soc_acpi_mach *mach = |
3585 | + dev_get_platdata(component->card->dev); |
3586 | + int i; |
3587 | + |
3588 | + list_for_each_entry(dobj, &component->dobj_list, list) { |
3589 | + struct snd_kcontrol *kcontrol = dobj->control.kcontrol; |
3590 | + struct soc_enum *se = |
3591 | + (struct soc_enum *)kcontrol->private_value; |
3592 | + char **texts = dobj->control.dtexts; |
3593 | + char chan_text[4]; |
3594 | + |
3595 | + if (dobj->type != SND_SOC_DOBJ_ENUM || |
3596 | + dobj->control.kcontrol->put != |
3597 | + skl_tplg_multi_config_set_dmic) |
3598 | + continue; |
3599 | + sprintf(chan_text, "c%d", mach->mach_params.dmic_num); |
3600 | + |
3601 | + for (i = 0; i < se->items; i++) { |
3602 | + struct snd_ctl_elem_value val; |
3603 | + |
3604 | + if (strstr(texts[i], chan_text)) { |
3605 | + val.value.enumerated.item[0] = i; |
3606 | + kcontrol->put(kcontrol, &val); |
3607 | + } |
3608 | + } |
3609 | + } |
3610 | +} |
3611 | + |
3612 | static struct snd_soc_tplg_ops skl_tplg_ops = { |
3613 | .widget_load = skl_tplg_widget_load, |
3614 | .control_load = skl_tplg_control_load, |
3615 | @@ -3498,6 +3650,7 @@ static struct snd_soc_tplg_ops skl_tplg_ops = { |
3616 | .io_ops_count = ARRAY_SIZE(skl_tplg_kcontrol_ops), |
3617 | .manifest = skl_manifest_load, |
3618 | .dai_load = skl_dai_load, |
3619 | + .complete = skl_tplg_complete, |
3620 | }; |
3621 | |
3622 | /* |
3623 | diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h |
3624 | index e967800dbb623..06576147cc290 100644 |
3625 | --- a/sound/soc/intel/skylake/skl-topology.h |
3626 | +++ b/sound/soc/intel/skylake/skl-topology.h |
3627 | @@ -306,6 +306,7 @@ struct skl_pipe { |
3628 | struct skl_path_config configs[SKL_MAX_PATH_CONFIGS]; |
3629 | struct list_head w_list; |
3630 | bool passthru; |
3631 | + u32 pipe_config_idx; |
3632 | }; |
3633 | |
3634 | enum skl_module_state { |
3635 | diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c |
3636 | index 141dbbf975acd..2e5fbd2209235 100644 |
3637 | --- a/sound/soc/intel/skylake/skl.c |
3638 | +++ b/sound/soc/intel/skylake/skl.c |
3639 | @@ -129,6 +129,7 @@ static int skl_init_chip(struct hdac_bus *bus, bool full_reset) |
3640 | struct hdac_ext_link *hlink; |
3641 | int ret; |
3642 | |
3643 | + snd_hdac_set_codec_wakeup(bus, true); |
3644 | skl_enable_miscbdcge(bus->dev, false); |
3645 | ret = snd_hdac_bus_init_chip(bus, full_reset); |
3646 | |
3647 | @@ -137,6 +138,7 @@ static int skl_init_chip(struct hdac_bus *bus, bool full_reset) |
3648 | writel(0, hlink->ml_addr + AZX_REG_ML_LOSIDV); |
3649 | |
3650 | skl_enable_miscbdcge(bus->dev, true); |
3651 | + snd_hdac_set_codec_wakeup(bus, false); |
3652 | |
3653 | return ret; |
3654 | } |
3655 | @@ -480,13 +482,8 @@ static struct skl_ssp_clk skl_ssp_clks[] = { |
3656 | static struct snd_soc_acpi_mach *skl_find_hda_machine(struct skl_dev *skl, |
3657 | struct snd_soc_acpi_mach *machines) |
3658 | { |
3659 | - struct hdac_bus *bus = skl_to_bus(skl); |
3660 | struct snd_soc_acpi_mach *mach; |
3661 | |
3662 | - /* check if we have any codecs detected on bus */ |
3663 | - if (bus->codec_mask == 0) |
3664 | - return NULL; |
3665 | - |
3666 | /* point to common table */ |
3667 | mach = snd_soc_acpi_intel_hda_machines; |
3668 | |
3669 | @@ -635,6 +632,9 @@ static int skl_clock_device_register(struct skl_dev *skl) |
3670 | struct platform_device_info pdevinfo = {NULL}; |
3671 | struct skl_clk_pdata *clk_pdata; |
3672 | |
3673 | + if (!skl->nhlt) |
3674 | + return 0; |
3675 | + |
3676 | clk_pdata = devm_kzalloc(&skl->pci->dev, sizeof(*clk_pdata), |
3677 | GFP_KERNEL); |
3678 | if (!clk_pdata) |
3679 | @@ -807,6 +807,9 @@ static void skl_probe_work(struct work_struct *work) |
3680 | return; |
3681 | } |
3682 | |
3683 | + skl_init_pci(skl); |
3684 | + skl_dum_set(bus); |
3685 | + |
3686 | err = skl_init_chip(bus, true); |
3687 | if (err < 0) { |
3688 | dev_err(bus->dev, "Init chip failed with err: %d\n", err); |
3689 | @@ -922,8 +925,6 @@ static int skl_first_init(struct hdac_bus *bus) |
3690 | return -ENXIO; |
3691 | } |
3692 | |
3693 | - snd_hdac_bus_reset_link(bus, true); |
3694 | - |
3695 | snd_hdac_bus_parse_capabilities(bus); |
3696 | |
3697 | /* check if PPCAP exists */ |
3698 | @@ -971,11 +972,7 @@ static int skl_first_init(struct hdac_bus *bus) |
3699 | if (err < 0) |
3700 | return err; |
3701 | |
3702 | - /* initialize chip */ |
3703 | - skl_init_pci(skl); |
3704 | - skl_dum_set(bus); |
3705 | - |
3706 | - return skl_init_chip(bus, true); |
3707 | + return 0; |
3708 | } |
3709 | |
3710 | static int skl_probe(struct pci_dev *pci, |
3711 | @@ -1080,8 +1077,6 @@ static int skl_probe(struct pci_dev *pci, |
3712 | if (bus->mlcap) |
3713 | snd_hdac_ext_bus_get_ml_capabilities(bus); |
3714 | |
3715 | - snd_hdac_bus_stop_chip(bus); |
3716 | - |
3717 | /* create device for soc dmic */ |
3718 | err = skl_dmic_device_register(skl); |
3719 | if (err < 0) { |
3720 | @@ -1098,7 +1093,8 @@ out_dsp_free: |
3721 | out_clk_free: |
3722 | skl_clock_device_unregister(skl); |
3723 | out_nhlt_free: |
3724 | - intel_nhlt_free(skl->nhlt); |
3725 | + if (skl->nhlt) |
3726 | + intel_nhlt_free(skl->nhlt); |
3727 | out_free: |
3728 | skl_free(bus); |
3729 | |
3730 | @@ -1147,7 +1143,8 @@ static void skl_remove(struct pci_dev *pci) |
3731 | skl_dmic_device_unregister(skl); |
3732 | skl_clock_device_unregister(skl); |
3733 | skl_nhlt_remove_sysfs(skl); |
3734 | - intel_nhlt_free(skl->nhlt); |
3735 | + if (skl->nhlt) |
3736 | + intel_nhlt_free(skl->nhlt); |
3737 | skl_free(bus); |
3738 | dev_set_drvdata(&pci->dev, NULL); |
3739 | } |
3740 | diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c |
3741 | index 5544bfbd0f6c0..ab34ef2c661f8 100644 |
3742 | --- a/tools/perf/util/dwarf-aux.c |
3743 | +++ b/tools/perf/util/dwarf-aux.c |
3744 | @@ -319,6 +319,7 @@ bool die_is_func_def(Dwarf_Die *dw_die) |
3745 | int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr) |
3746 | { |
3747 | Dwarf_Addr base, end; |
3748 | + Dwarf_Attribute attr; |
3749 | |
3750 | if (!addr) |
3751 | return -EINVAL; |
3752 | @@ -326,6 +327,13 @@ int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr) |
3753 | if (dwarf_entrypc(dw_die, addr) == 0) |
3754 | return 0; |
3755 | |
3756 | + /* |
3757 | + * Since the dwarf_ranges() will return 0 if there is no |
3758 | + * DW_AT_ranges attribute, we should check it first. |
3759 | + */ |
3760 | + if (!dwarf_attr(dw_die, DW_AT_ranges, &attr)) |
3761 | + return -ENOENT; |
3762 | + |
3763 | return dwarf_ranges(dw_die, 0, &base, addr, &end) < 0 ? -ENOENT : 0; |
3764 | } |
3765 | |
3766 | diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c |
3767 | index 373e399e57d28..93147cc40162f 100644 |
3768 | --- a/tools/perf/util/stat-display.c |
3769 | +++ b/tools/perf/util/stat-display.c |
3770 | @@ -316,13 +316,10 @@ static int first_shadow_cpu(struct perf_stat_config *config, |
3771 | struct evlist *evlist = evsel->evlist; |
3772 | int i; |
3773 | |
3774 | - if (!config->aggr_get_id) |
3775 | - return 0; |
3776 | - |
3777 | if (config->aggr_mode == AGGR_NONE) |
3778 | return id; |
3779 | |
3780 | - if (config->aggr_mode == AGGR_GLOBAL) |
3781 | + if (!config->aggr_get_id) |
3782 | return 0; |
3783 | |
3784 | for (i = 0; i < perf_evsel__nr_cpus(evsel); i++) { |
3785 | diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c |
3786 | index 4c5909e38f78a..b1e639ea22e9a 100644 |
3787 | --- a/virt/kvm/arm/vgic/vgic-mmio-v3.c |
3788 | +++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c |
3789 | @@ -223,6 +223,23 @@ static unsigned long vgic_mmio_read_v3r_typer(struct kvm_vcpu *vcpu, |
3790 | return extract_bytes(value, addr & 7, len); |
3791 | } |
3792 | |
3793 | +static unsigned long vgic_uaccess_read_v3r_typer(struct kvm_vcpu *vcpu, |
3794 | + gpa_t addr, unsigned int len) |
3795 | +{ |
3796 | + unsigned long mpidr = kvm_vcpu_get_mpidr_aff(vcpu); |
3797 | + int target_vcpu_id = vcpu->vcpu_id; |
3798 | + u64 value; |
3799 | + |
3800 | + value = (u64)(mpidr & GENMASK(23, 0)) << 32; |
3801 | + value |= ((target_vcpu_id & 0xffff) << 8); |
3802 | + |
3803 | + if (vgic_has_its(vcpu->kvm)) |
3804 | + value |= GICR_TYPER_PLPIS; |
3805 | + |
3806 | + /* reporting of the Last bit is not supported for userspace */ |
3807 | + return extract_bytes(value, addr & 7, len); |
3808 | +} |
3809 | + |
3810 | static unsigned long vgic_mmio_read_v3r_iidr(struct kvm_vcpu *vcpu, |
3811 | gpa_t addr, unsigned int len) |
3812 | { |
3813 | @@ -528,8 +545,9 @@ static const struct vgic_register_region vgic_v3_rd_registers[] = { |
3814 | REGISTER_DESC_WITH_LENGTH(GICR_IIDR, |
3815 | vgic_mmio_read_v3r_iidr, vgic_mmio_write_wi, 4, |
3816 | VGIC_ACCESS_32bit), |
3817 | - REGISTER_DESC_WITH_LENGTH(GICR_TYPER, |
3818 | - vgic_mmio_read_v3r_typer, vgic_mmio_write_wi, 8, |
3819 | + REGISTER_DESC_WITH_LENGTH_UACCESS(GICR_TYPER, |
3820 | + vgic_mmio_read_v3r_typer, vgic_mmio_write_wi, |
3821 | + vgic_uaccess_read_v3r_typer, vgic_mmio_uaccess_write_wi, 8, |
3822 | VGIC_ACCESS_64bit | VGIC_ACCESS_32bit), |
3823 | REGISTER_DESC_WITH_LENGTH(GICR_WAKER, |
3824 | vgic_mmio_read_raz, vgic_mmio_write_wi, 4, |