Contents of /trunk/kernel-magellan/patches-3.13/0101-3.13.2-all-fixes.patch
Parent Directory | Revision Log
Revision 2407 -
(show annotations)
(download)
Wed Feb 12 09:25:37 2014 UTC (10 years, 7 months ago) by niro
File size: 197959 byte(s)
Wed Feb 12 09:25:37 2014 UTC (10 years, 7 months ago) by niro
File size: 197959 byte(s)
-linux-3.13.2
1 | diff --git a/Documentation/devicetree/bindings/ata/marvell.txt b/Documentation/devicetree/bindings/ata/marvell.txt |
2 | index b5cdd20cde9c..1c8351604d38 100644 |
3 | --- a/Documentation/devicetree/bindings/ata/marvell.txt |
4 | +++ b/Documentation/devicetree/bindings/ata/marvell.txt |
5 | @@ -1,7 +1,7 @@ |
6 | * Marvell Orion SATA |
7 | |
8 | Required Properties: |
9 | -- compatibility : "marvell,orion-sata" |
10 | +- compatibility : "marvell,orion-sata" or "marvell,armada-370-sata" |
11 | - reg : Address range of controller |
12 | - interrupts : Interrupt controller is using |
13 | - nr-ports : Number of SATA ports in use. |
14 | diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt |
15 | index 82e8f6f17179..582b4652a82a 100644 |
16 | --- a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt |
17 | +++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt |
18 | @@ -5,7 +5,11 @@ Required properties : |
19 | |
20 | - reg : Offset and length of the register set for the device |
21 | - compatible : Should be "marvell,mv64xxx-i2c" or "allwinner,sun4i-i2c" |
22 | - or "marvell,mv78230-i2c" |
23 | + or "marvell,mv78230-i2c" or "marvell,mv78230-a0-i2c" |
24 | + Note: Only use "marvell,mv78230-a0-i2c" for a very rare, |
25 | + initial version of the SoC which had broken offload |
26 | + support. Linux auto-detects this and sets it |
27 | + appropriately. |
28 | - interrupts : The interrupt number |
29 | |
30 | Optional properties : |
31 | diff --git a/Documentation/i2c/busses/i2c-piix4 b/Documentation/i2c/busses/i2c-piix4 |
32 | index c097e0f020fe..aa959fd22450 100644 |
33 | --- a/Documentation/i2c/busses/i2c-piix4 |
34 | +++ b/Documentation/i2c/busses/i2c-piix4 |
35 | @@ -13,7 +13,7 @@ Supported adapters: |
36 | * AMD SP5100 (SB700 derivative found on some server mainboards) |
37 | Datasheet: Publicly available at the AMD website |
38 | http://support.amd.com/us/Embedded_TechDocs/44413.pdf |
39 | - * AMD Hudson-2, CZ |
40 | + * AMD Hudson-2, ML, CZ |
41 | Datasheet: Not publicly available |
42 | * Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge |
43 | Datasheet: Publicly available at the SMSC website http://www.smsc.com |
44 | diff --git a/Makefile b/Makefile |
45 | index de4cda986be2..a7fd5d9e752f 100644 |
46 | --- a/Makefile |
47 | +++ b/Makefile |
48 | @@ -1,6 +1,6 @@ |
49 | VERSION = 3 |
50 | PATCHLEVEL = 13 |
51 | -SUBLEVEL = 1 |
52 | +SUBLEVEL = 2 |
53 | EXTRAVERSION = |
54 | NAME = One Giant Leap for Frogkind |
55 | |
56 | diff --git a/arch/alpha/lib/csum_partial_copy.c b/arch/alpha/lib/csum_partial_copy.c |
57 | index ff3c10721caf..5675dca8dbb1 100644 |
58 | --- a/arch/alpha/lib/csum_partial_copy.c |
59 | +++ b/arch/alpha/lib/csum_partial_copy.c |
60 | @@ -378,6 +378,11 @@ csum_partial_copy_from_user(const void __user *src, void *dst, int len, |
61 | __wsum |
62 | csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) |
63 | { |
64 | - return csum_partial_copy_from_user((__force const void __user *)src, |
65 | - dst, len, sum, NULL); |
66 | + __wsum checksum; |
67 | + mm_segment_t oldfs = get_fs(); |
68 | + set_fs(KERNEL_DS); |
69 | + checksum = csum_partial_copy_from_user((__force const void __user *)src, |
70 | + dst, len, sum, NULL); |
71 | + set_fs(oldfs); |
72 | + return checksum; |
73 | } |
74 | diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi |
75 | index 7f10f627ae5b..80ffacd128f8 100644 |
76 | --- a/arch/arm/boot/dts/armada-370-xp.dtsi |
77 | +++ b/arch/arm/boot/dts/armada-370-xp.dtsi |
78 | @@ -152,7 +152,7 @@ |
79 | }; |
80 | |
81 | sata@a0000 { |
82 | - compatible = "marvell,orion-sata"; |
83 | + compatible = "marvell,armada-370-sata"; |
84 | reg = <0xa0000 0x5000>; |
85 | interrupts = <55>; |
86 | clocks = <&gateclk 15>, <&gateclk 30>; |
87 | diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi |
88 | index c3e514837074..cf7de80377f1 100644 |
89 | --- a/arch/arm/boot/dts/at91sam9g45.dtsi |
90 | +++ b/arch/arm/boot/dts/at91sam9g45.dtsi |
91 | @@ -618,6 +618,7 @@ |
92 | compatible = "atmel,hsmci"; |
93 | reg = <0xfff80000 0x600>; |
94 | interrupts = <11 IRQ_TYPE_LEVEL_HIGH 0>; |
95 | + pinctrl-names = "default"; |
96 | dmas = <&dma 1 AT91_DMA_CFG_PER_ID(0)>; |
97 | dma-names = "rxtx"; |
98 | #address-cells = <1>; |
99 | @@ -629,6 +630,7 @@ |
100 | compatible = "atmel,hsmci"; |
101 | reg = <0xfffd0000 0x600>; |
102 | interrupts = <29 IRQ_TYPE_LEVEL_HIGH 0>; |
103 | + pinctrl-names = "default"; |
104 | dmas = <&dma 1 AT91_DMA_CFG_PER_ID(13)>; |
105 | dma-names = "rxtx"; |
106 | #address-cells = <1>; |
107 | diff --git a/arch/arm/mach-at91/sam9_smc.c b/arch/arm/mach-at91/sam9_smc.c |
108 | index 99a0a1d2b7dc..b26156bf15db 100644 |
109 | --- a/arch/arm/mach-at91/sam9_smc.c |
110 | +++ b/arch/arm/mach-at91/sam9_smc.c |
111 | @@ -101,7 +101,7 @@ static void sam9_smc_cs_read(void __iomem *base, |
112 | /* Pulse register */ |
113 | val = __raw_readl(base + AT91_SMC_PULSE); |
114 | |
115 | - config->nwe_setup = val & AT91_SMC_NWEPULSE; |
116 | + config->nwe_pulse = val & AT91_SMC_NWEPULSE; |
117 | config->ncs_write_pulse = (val & AT91_SMC_NCS_WRPULSE) >> 8; |
118 | config->nrd_pulse = (val & AT91_SMC_NRDPULSE) >> 16; |
119 | config->ncs_read_pulse = (val & AT91_SMC_NCS_RDPULSE) >> 24; |
120 | diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile |
121 | index 2d04f0e21870..878aebe98dcc 100644 |
122 | --- a/arch/arm/mach-mvebu/Makefile |
123 | +++ b/arch/arm/mach-mvebu/Makefile |
124 | @@ -3,7 +3,7 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \ |
125 | |
126 | AFLAGS_coherency_ll.o := -Wa,-march=armv7-a |
127 | |
128 | -obj-y += system-controller.o |
129 | +obj-y += system-controller.o mvebu-soc-id.o |
130 | obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o |
131 | obj-$(CONFIG_ARCH_MVEBU) += coherency.o coherency_ll.o pmsu.o |
132 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o |
133 | diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c |
134 | index e2acff98e750..f6c9d1d85c14 100644 |
135 | --- a/arch/arm/mach-mvebu/armada-370-xp.c |
136 | +++ b/arch/arm/mach-mvebu/armada-370-xp.c |
137 | @@ -21,6 +21,7 @@ |
138 | #include <linux/clocksource.h> |
139 | #include <linux/dma-mapping.h> |
140 | #include <linux/mbus.h> |
141 | +#include <linux/slab.h> |
142 | #include <asm/hardware/cache-l2x0.h> |
143 | #include <asm/mach/arch.h> |
144 | #include <asm/mach/map.h> |
145 | @@ -28,6 +29,7 @@ |
146 | #include "armada-370-xp.h" |
147 | #include "common.h" |
148 | #include "coherency.h" |
149 | +#include "mvebu-soc-id.h" |
150 | |
151 | static void __init armada_370_xp_map_io(void) |
152 | { |
153 | @@ -45,8 +47,38 @@ static void __init armada_370_xp_timer_and_clk_init(void) |
154 | #endif |
155 | } |
156 | |
157 | +static void __init i2c_quirk(void) |
158 | +{ |
159 | + struct device_node *np; |
160 | + u32 dev, rev; |
161 | + |
162 | + /* |
163 | + * Only revisons more recent than A0 support the offload |
164 | + * mechanism. We can exit only if we are sure that we can |
165 | + * get the SoC revision and it is more recent than A0. |
166 | + */ |
167 | + if (mvebu_get_soc_id(&rev, &dev) == 0 && dev > MV78XX0_A0_REV) |
168 | + return; |
169 | + |
170 | + for_each_compatible_node(np, NULL, "marvell,mv78230-i2c") { |
171 | + struct property *new_compat; |
172 | + |
173 | + new_compat = kzalloc(sizeof(*new_compat), GFP_KERNEL); |
174 | + |
175 | + new_compat->name = kstrdup("compatible", GFP_KERNEL); |
176 | + new_compat->length = sizeof("marvell,mv78230-a0-i2c"); |
177 | + new_compat->value = kstrdup("marvell,mv78230-a0-i2c", |
178 | + GFP_KERNEL); |
179 | + |
180 | + of_update_property(np, new_compat); |
181 | + } |
182 | + return; |
183 | +} |
184 | + |
185 | static void __init armada_370_xp_dt_init(void) |
186 | { |
187 | + if (of_machine_is_compatible("plathome,openblocks-ax3-4")) |
188 | + i2c_quirk(); |
189 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
190 | } |
191 | |
192 | diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.c b/arch/arm/mach-mvebu/mvebu-soc-id.c |
193 | new file mode 100644 |
194 | index 000000000000..fe4fc1cbdfaf |
195 | --- /dev/null |
196 | +++ b/arch/arm/mach-mvebu/mvebu-soc-id.c |
197 | @@ -0,0 +1,119 @@ |
198 | +/* |
199 | + * ID and revision information for mvebu SoCs |
200 | + * |
201 | + * Copyright (C) 2014 Marvell |
202 | + * |
203 | + * Gregory CLEMENT <gregory.clement@free-electrons.com> |
204 | + * |
205 | + * This file is licensed under the terms of the GNU General Public |
206 | + * License version 2. This program is licensed "as is" without any |
207 | + * warranty of any kind, whether express or implied. |
208 | + * |
209 | + * All the mvebu SoCs have information related to their variant and |
210 | + * revision that can be read from the PCI control register. This is |
211 | + * done before the PCI initialization to avoid any conflict. Once the |
212 | + * ID and revision are retrieved, the mapping is freed. |
213 | + */ |
214 | + |
215 | +#define pr_fmt(fmt) "mvebu-soc-id: " fmt |
216 | + |
217 | +#include <linux/clk.h> |
218 | +#include <linux/init.h> |
219 | +#include <linux/io.h> |
220 | +#include <linux/kernel.h> |
221 | +#include <linux/of.h> |
222 | +#include <linux/of_address.h> |
223 | +#include "mvebu-soc-id.h" |
224 | + |
225 | +#define PCIE_DEV_ID_OFF 0x0 |
226 | +#define PCIE_DEV_REV_OFF 0x8 |
227 | + |
228 | +#define SOC_ID_MASK 0xFFFF0000 |
229 | +#define SOC_REV_MASK 0xFF |
230 | + |
231 | +static u32 soc_dev_id; |
232 | +static u32 soc_rev; |
233 | +static bool is_id_valid; |
234 | + |
235 | +static const struct of_device_id mvebu_pcie_of_match_table[] = { |
236 | + { .compatible = "marvell,armada-xp-pcie", }, |
237 | + { .compatible = "marvell,armada-370-pcie", }, |
238 | + {}, |
239 | +}; |
240 | + |
241 | +int mvebu_get_soc_id(u32 *dev, u32 *rev) |
242 | +{ |
243 | + if (is_id_valid) { |
244 | + *dev = soc_dev_id; |
245 | + *rev = soc_rev; |
246 | + return 0; |
247 | + } else |
248 | + return -1; |
249 | +} |
250 | + |
251 | +static int __init mvebu_soc_id_init(void) |
252 | +{ |
253 | + struct device_node *np; |
254 | + int ret = 0; |
255 | + void __iomem *pci_base; |
256 | + struct clk *clk; |
257 | + struct device_node *child; |
258 | + |
259 | + np = of_find_matching_node(NULL, mvebu_pcie_of_match_table); |
260 | + if (!np) |
261 | + return ret; |
262 | + |
263 | + /* |
264 | + * ID and revision are available from any port, so we |
265 | + * just pick the first one |
266 | + */ |
267 | + child = of_get_next_child(np, NULL); |
268 | + if (child == NULL) { |
269 | + pr_err("cannot get pci node\n"); |
270 | + ret = -ENOMEM; |
271 | + goto clk_err; |
272 | + } |
273 | + |
274 | + clk = of_clk_get_by_name(child, NULL); |
275 | + if (IS_ERR(clk)) { |
276 | + pr_err("cannot get clock\n"); |
277 | + ret = -ENOMEM; |
278 | + goto clk_err; |
279 | + } |
280 | + |
281 | + ret = clk_prepare_enable(clk); |
282 | + if (ret) { |
283 | + pr_err("cannot enable clock\n"); |
284 | + goto clk_err; |
285 | + } |
286 | + |
287 | + pci_base = of_iomap(child, 0); |
288 | + if (IS_ERR(pci_base)) { |
289 | + pr_err("cannot map registers\n"); |
290 | + ret = -ENOMEM; |
291 | + goto res_ioremap; |
292 | + } |
293 | + |
294 | + /* SoC ID */ |
295 | + soc_dev_id = readl(pci_base + PCIE_DEV_ID_OFF) >> 16; |
296 | + |
297 | + /* SoC revision */ |
298 | + soc_rev = readl(pci_base + PCIE_DEV_REV_OFF) & SOC_REV_MASK; |
299 | + |
300 | + is_id_valid = true; |
301 | + |
302 | + pr_info("MVEBU SoC ID=0x%X, Rev=0x%X\n", soc_dev_id, soc_rev); |
303 | + |
304 | + iounmap(pci_base); |
305 | + |
306 | +res_ioremap: |
307 | + clk_disable_unprepare(clk); |
308 | + |
309 | +clk_err: |
310 | + of_node_put(child); |
311 | + of_node_put(np); |
312 | + |
313 | + return ret; |
314 | +} |
315 | +core_initcall(mvebu_soc_id_init); |
316 | + |
317 | diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.h b/arch/arm/mach-mvebu/mvebu-soc-id.h |
318 | new file mode 100644 |
319 | index 000000000000..31654252fe35 |
320 | --- /dev/null |
321 | +++ b/arch/arm/mach-mvebu/mvebu-soc-id.h |
322 | @@ -0,0 +1,32 @@ |
323 | +/* |
324 | + * Marvell EBU SoC ID and revision definitions. |
325 | + * |
326 | + * Copyright (C) 2014 Marvell Semiconductor |
327 | + * |
328 | + * This file is licensed under the terms of the GNU General Public |
329 | + * License version 2. This program is licensed "as is" without any |
330 | + * warranty of any kind, whether express or implied. |
331 | + */ |
332 | + |
333 | +#ifndef __LINUX_MVEBU_SOC_ID_H |
334 | +#define __LINUX_MVEBU_SOC_ID_H |
335 | + |
336 | +/* Armada XP ID */ |
337 | +#define MV78230_DEV_ID 0x7823 |
338 | +#define MV78260_DEV_ID 0x7826 |
339 | +#define MV78460_DEV_ID 0x7846 |
340 | + |
341 | +/* Armada XP Revision */ |
342 | +#define MV78XX0_A0_REV 0x1 |
343 | +#define MV78XX0_B0_REV 0x2 |
344 | + |
345 | +#ifdef CONFIG_ARCH_MVEBU |
346 | +int mvebu_get_soc_id(u32 *dev, u32 *rev); |
347 | +#else |
348 | +static inline int mvebu_get_soc_id(u32 *dev, u32 *rev) |
349 | +{ |
350 | + return -1; |
351 | +} |
352 | +#endif |
353 | + |
354 | +#endif /* __LINUX_MVEBU_SOC_ID_H */ |
355 | diff --git a/arch/parisc/include/asm/cacheflush.h b/arch/parisc/include/asm/cacheflush.h |
356 | index 2f9b751878ba..de65f66ea64e 100644 |
357 | --- a/arch/parisc/include/asm/cacheflush.h |
358 | +++ b/arch/parisc/include/asm/cacheflush.h |
359 | @@ -132,7 +132,6 @@ void mark_rodata_ro(void); |
360 | static inline void *kmap(struct page *page) |
361 | { |
362 | might_sleep(); |
363 | - flush_dcache_page(page); |
364 | return page_address(page); |
365 | } |
366 | |
367 | @@ -144,7 +143,6 @@ static inline void kunmap(struct page *page) |
368 | static inline void *kmap_atomic(struct page *page) |
369 | { |
370 | pagefault_disable(); |
371 | - flush_dcache_page(page); |
372 | return page_address(page); |
373 | } |
374 | |
375 | diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h |
376 | index c53fc63149e8..637fe031aa84 100644 |
377 | --- a/arch/parisc/include/asm/page.h |
378 | +++ b/arch/parisc/include/asm/page.h |
379 | @@ -29,7 +29,8 @@ struct page; |
380 | void clear_page_asm(void *page); |
381 | void copy_page_asm(void *to, void *from); |
382 | #define clear_user_page(vto, vaddr, page) clear_page_asm(vto) |
383 | -#define copy_user_page(vto, vfrom, vaddr, page) copy_page_asm(vto, vfrom) |
384 | +void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, |
385 | + struct page *pg); |
386 | |
387 | /* #define CONFIG_PARISC_TMPALIAS */ |
388 | |
389 | diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c |
390 | index a72545554a31..ac87a40502e6 100644 |
391 | --- a/arch/parisc/kernel/cache.c |
392 | +++ b/arch/parisc/kernel/cache.c |
393 | @@ -388,6 +388,20 @@ void flush_kernel_dcache_page_addr(void *addr) |
394 | } |
395 | EXPORT_SYMBOL(flush_kernel_dcache_page_addr); |
396 | |
397 | +void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, |
398 | + struct page *pg) |
399 | +{ |
400 | + /* Copy using kernel mapping. No coherency is needed (all in |
401 | + kunmap) for the `to' page. However, the `from' page needs to |
402 | + be flushed through a mapping equivalent to the user mapping |
403 | + before it can be accessed through the kernel mapping. */ |
404 | + preempt_disable(); |
405 | + flush_dcache_page_asm(__pa(vfrom), vaddr); |
406 | + preempt_enable(); |
407 | + copy_page_asm(vto, vfrom); |
408 | +} |
409 | +EXPORT_SYMBOL(copy_user_page); |
410 | + |
411 | void purge_tlb_entries(struct mm_struct *mm, unsigned long addr) |
412 | { |
413 | unsigned long flags; |
414 | diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h |
415 | index 89e3ef2496ac..d0b5fca6b077 100644 |
416 | --- a/arch/powerpc/include/asm/topology.h |
417 | +++ b/arch/powerpc/include/asm/topology.h |
418 | @@ -22,7 +22,15 @@ struct device_node; |
419 | |
420 | static inline int cpu_to_node(int cpu) |
421 | { |
422 | - return numa_cpu_lookup_table[cpu]; |
423 | + int nid; |
424 | + |
425 | + nid = numa_cpu_lookup_table[cpu]; |
426 | + |
427 | + /* |
428 | + * During early boot, the numa-cpu lookup table might not have been |
429 | + * setup for all CPUs yet. In such cases, default to node 0. |
430 | + */ |
431 | + return (nid < 0) ? 0 : nid; |
432 | } |
433 | |
434 | #define parent_node(node) (node) |
435 | diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c |
436 | index 654932727873..bfb82365bc7a 100644 |
437 | --- a/arch/powerpc/kernel/cacheinfo.c |
438 | +++ b/arch/powerpc/kernel/cacheinfo.c |
439 | @@ -794,6 +794,9 @@ static void remove_cache_dir(struct cache_dir *cache_dir) |
440 | { |
441 | remove_index_dirs(cache_dir); |
442 | |
443 | + /* Remove cache dir from sysfs */ |
444 | + kobject_del(cache_dir->kobj); |
445 | + |
446 | kobject_put(cache_dir->kobj); |
447 | |
448 | kfree(cache_dir); |
449 | diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c |
450 | index b51d5db78068..edeac10a5c3b 100644 |
451 | --- a/arch/powerpc/kvm/book3s_hv.c |
452 | +++ b/arch/powerpc/kvm/book3s_hv.c |
453 | @@ -85,10 +85,13 @@ static void kvmppc_fast_vcpu_kick_hv(struct kvm_vcpu *vcpu) |
454 | |
455 | /* CPU points to the first thread of the core */ |
456 | if (cpu != me && cpu >= 0 && cpu < nr_cpu_ids) { |
457 | +#ifdef CONFIG_KVM_XICS |
458 | int real_cpu = cpu + vcpu->arch.ptid; |
459 | if (paca[real_cpu].kvm_hstate.xics_phys) |
460 | xics_wake_cpu(real_cpu); |
461 | - else if (cpu_online(cpu)) |
462 | + else |
463 | +#endif |
464 | + if (cpu_online(cpu)) |
465 | smp_send_reschedule(cpu); |
466 | } |
467 | put_cpu(); |
468 | @@ -1189,7 +1192,9 @@ static void kvmppc_start_thread(struct kvm_vcpu *vcpu) |
469 | smp_wmb(); |
470 | #if defined(CONFIG_PPC_ICP_NATIVE) && defined(CONFIG_SMP) |
471 | if (vcpu->arch.ptid) { |
472 | +#ifdef CONFIG_KVM_XICS |
473 | xics_wake_cpu(cpu); |
474 | +#endif |
475 | ++vc->n_woken; |
476 | } |
477 | #endif |
478 | diff --git a/arch/powerpc/kvm/e500_mmu.c b/arch/powerpc/kvm/e500_mmu.c |
479 | index ebca6b88ea5e..50860e919cb8 100644 |
480 | --- a/arch/powerpc/kvm/e500_mmu.c |
481 | +++ b/arch/powerpc/kvm/e500_mmu.c |
482 | @@ -127,7 +127,7 @@ static int kvmppc_e500_tlb_index(struct kvmppc_vcpu_e500 *vcpu_e500, |
483 | } |
484 | |
485 | static inline void kvmppc_e500_deliver_tlb_miss(struct kvm_vcpu *vcpu, |
486 | - unsigned int eaddr, int as) |
487 | + gva_t eaddr, int as) |
488 | { |
489 | struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); |
490 | unsigned int victim, tsized; |
491 | diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c |
492 | index 078d3e00a616..6847d509162f 100644 |
493 | --- a/arch/powerpc/mm/numa.c |
494 | +++ b/arch/powerpc/mm/numa.c |
495 | @@ -31,6 +31,8 @@ |
496 | #include <asm/sparsemem.h> |
497 | #include <asm/prom.h> |
498 | #include <asm/smp.h> |
499 | +#include <asm/cputhreads.h> |
500 | +#include <asm/topology.h> |
501 | #include <asm/firmware.h> |
502 | #include <asm/paca.h> |
503 | #include <asm/hvcall.h> |
504 | @@ -152,9 +154,22 @@ static void __init get_node_active_region(unsigned long pfn, |
505 | } |
506 | } |
507 | |
508 | -static void map_cpu_to_node(int cpu, int node) |
509 | +static void reset_numa_cpu_lookup_table(void) |
510 | +{ |
511 | + unsigned int cpu; |
512 | + |
513 | + for_each_possible_cpu(cpu) |
514 | + numa_cpu_lookup_table[cpu] = -1; |
515 | +} |
516 | + |
517 | +static void update_numa_cpu_lookup_table(unsigned int cpu, int node) |
518 | { |
519 | numa_cpu_lookup_table[cpu] = node; |
520 | +} |
521 | + |
522 | +static void map_cpu_to_node(int cpu, int node) |
523 | +{ |
524 | + update_numa_cpu_lookup_table(cpu, node); |
525 | |
526 | dbg("adding cpu %d to node %d\n", cpu, node); |
527 | |
528 | @@ -522,11 +537,24 @@ static int of_drconf_to_nid_single(struct of_drconf_cell *drmem, |
529 | */ |
530 | static int numa_setup_cpu(unsigned long lcpu) |
531 | { |
532 | - int nid = 0; |
533 | - struct device_node *cpu = of_get_cpu_node(lcpu, NULL); |
534 | + int nid; |
535 | + struct device_node *cpu; |
536 | + |
537 | + /* |
538 | + * If a valid cpu-to-node mapping is already available, use it |
539 | + * directly instead of querying the firmware, since it represents |
540 | + * the most recent mapping notified to us by the platform (eg: VPHN). |
541 | + */ |
542 | + if ((nid = numa_cpu_lookup_table[lcpu]) >= 0) { |
543 | + map_cpu_to_node(lcpu, nid); |
544 | + return nid; |
545 | + } |
546 | + |
547 | + cpu = of_get_cpu_node(lcpu, NULL); |
548 | |
549 | if (!cpu) { |
550 | WARN_ON(1); |
551 | + nid = 0; |
552 | goto out; |
553 | } |
554 | |
555 | @@ -1067,6 +1095,7 @@ void __init do_init_bootmem(void) |
556 | */ |
557 | setup_node_to_cpumask_map(); |
558 | |
559 | + reset_numa_cpu_lookup_table(); |
560 | register_cpu_notifier(&ppc64_numa_nb); |
561 | cpu_numa_callback(&ppc64_numa_nb, CPU_UP_PREPARE, |
562 | (void *)(unsigned long)boot_cpuid); |
563 | @@ -1445,6 +1474,33 @@ static int update_cpu_topology(void *data) |
564 | return 0; |
565 | } |
566 | |
567 | +static int update_lookup_table(void *data) |
568 | +{ |
569 | + struct topology_update_data *update; |
570 | + |
571 | + if (!data) |
572 | + return -EINVAL; |
573 | + |
574 | + /* |
575 | + * Upon topology update, the numa-cpu lookup table needs to be updated |
576 | + * for all threads in the core, including offline CPUs, to ensure that |
577 | + * future hotplug operations respect the cpu-to-node associativity |
578 | + * properly. |
579 | + */ |
580 | + for (update = data; update; update = update->next) { |
581 | + int nid, base, j; |
582 | + |
583 | + nid = update->new_nid; |
584 | + base = cpu_first_thread_sibling(update->cpu); |
585 | + |
586 | + for (j = 0; j < threads_per_core; j++) { |
587 | + update_numa_cpu_lookup_table(base + j, nid); |
588 | + } |
589 | + } |
590 | + |
591 | + return 0; |
592 | +} |
593 | + |
594 | /* |
595 | * Update the node maps and sysfs entries for each cpu whose home node |
596 | * has changed. Returns 1 when the topology has changed, and 0 otherwise. |
597 | @@ -1513,6 +1569,14 @@ int arch_update_cpu_topology(void) |
598 | |
599 | stop_machine(update_cpu_topology, &updates[0], &updated_cpus); |
600 | |
601 | + /* |
602 | + * Update the numa-cpu lookup table with the new mappings, even for |
603 | + * offline CPUs. It is best to perform this update from the stop- |
604 | + * machine context. |
605 | + */ |
606 | + stop_machine(update_lookup_table, &updates[0], |
607 | + cpumask_of(raw_smp_processor_id())); |
608 | + |
609 | for (ud = &updates[0]; ud; ud = ud->next) { |
610 | unregister_cpu_under_node(ud->cpu, ud->old_nid); |
611 | register_cpu_under_node(ud->cpu, ud->new_nid); |
612 | diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h |
613 | index 4bf9da03591e..5d7e8cf83bd6 100644 |
614 | --- a/arch/s390/include/asm/compat.h |
615 | +++ b/arch/s390/include/asm/compat.h |
616 | @@ -38,7 +38,8 @@ |
617 | |
618 | #define PSW32_USER_BITS (PSW32_MASK_DAT | PSW32_MASK_IO | PSW32_MASK_EXT | \ |
619 | PSW32_DEFAULT_KEY | PSW32_MASK_BASE | \ |
620 | - PSW32_MASK_MCHECK | PSW32_MASK_PSTATE | PSW32_ASC_HOME) |
621 | + PSW32_MASK_MCHECK | PSW32_MASK_PSTATE | \ |
622 | + PSW32_ASC_PRIMARY) |
623 | |
624 | #define COMPAT_USER_HZ 100 |
625 | #define COMPAT_UTS_MACHINE "s390\0\0\0\0" |
626 | diff --git a/arch/s390/include/uapi/asm/statfs.h b/arch/s390/include/uapi/asm/statfs.h |
627 | index a61d538756f2..471eb09184d4 100644 |
628 | --- a/arch/s390/include/uapi/asm/statfs.h |
629 | +++ b/arch/s390/include/uapi/asm/statfs.h |
630 | @@ -35,11 +35,11 @@ struct statfs { |
631 | struct statfs64 { |
632 | unsigned int f_type; |
633 | unsigned int f_bsize; |
634 | - unsigned long f_blocks; |
635 | - unsigned long f_bfree; |
636 | - unsigned long f_bavail; |
637 | - unsigned long f_files; |
638 | - unsigned long f_ffree; |
639 | + unsigned long long f_blocks; |
640 | + unsigned long long f_bfree; |
641 | + unsigned long long f_bavail; |
642 | + unsigned long long f_files; |
643 | + unsigned long long f_ffree; |
644 | __kernel_fsid_t f_fsid; |
645 | unsigned int f_namelen; |
646 | unsigned int f_frsize; |
647 | diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c |
648 | index 78d967f180f4..8216c0e0b2e2 100644 |
649 | --- a/arch/s390/kvm/diag.c |
650 | +++ b/arch/s390/kvm/diag.c |
651 | @@ -121,7 +121,7 @@ static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu) |
652 | * - gpr 4 contains the index on the bus (optionally) |
653 | */ |
654 | ret = kvm_io_bus_write_cookie(vcpu->kvm, KVM_VIRTIO_CCW_NOTIFY_BUS, |
655 | - vcpu->run->s.regs.gprs[2], |
656 | + vcpu->run->s.regs.gprs[2] & 0xffffffff, |
657 | 8, &vcpu->run->s.regs.gprs[3], |
658 | vcpu->run->s.regs.gprs[4]); |
659 | |
660 | @@ -137,7 +137,7 @@ static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu) |
661 | |
662 | int kvm_s390_handle_diag(struct kvm_vcpu *vcpu) |
663 | { |
664 | - int code = (vcpu->arch.sie_block->ipb & 0xfff0000) >> 16; |
665 | + int code = kvm_s390_get_base_disp_rs(vcpu) & 0xffff; |
666 | |
667 | if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) |
668 | return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); |
669 | diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c |
670 | index 569494e01ec6..bb383df32400 100644 |
671 | --- a/arch/s390/kvm/kvm-s390.c |
672 | +++ b/arch/s390/kvm/kvm-s390.c |
673 | @@ -885,7 +885,7 @@ static int __guestcopy(struct kvm_vcpu *vcpu, u64 guestdest, void *from, |
674 | * KVM_S390_STORE_STATUS_NOADDR: -> 0x1200 on 64 bit |
675 | * KVM_S390_STORE_STATUS_PREFIXED: -> prefix |
676 | */ |
677 | -int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr) |
678 | +int kvm_s390_store_status_unloaded(struct kvm_vcpu *vcpu, unsigned long addr) |
679 | { |
680 | unsigned char archmode = 1; |
681 | int prefix; |
682 | @@ -903,15 +903,6 @@ int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr) |
683 | } else |
684 | prefix = 0; |
685 | |
686 | - /* |
687 | - * The guest FPRS and ACRS are in the host FPRS/ACRS due to the lazy |
688 | - * copying in vcpu load/put. Lets update our copies before we save |
689 | - * it into the save area |
690 | - */ |
691 | - save_fp_ctl(&vcpu->arch.guest_fpregs.fpc); |
692 | - save_fp_regs(vcpu->arch.guest_fpregs.fprs); |
693 | - save_access_regs(vcpu->run->s.regs.acrs); |
694 | - |
695 | if (__guestcopy(vcpu, addr + offsetof(struct save_area, fp_regs), |
696 | vcpu->arch.guest_fpregs.fprs, 128, prefix)) |
697 | return -EFAULT; |
698 | @@ -956,6 +947,20 @@ int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr) |
699 | return 0; |
700 | } |
701 | |
702 | +int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr) |
703 | +{ |
704 | + /* |
705 | + * The guest FPRS and ACRS are in the host FPRS/ACRS due to the lazy |
706 | + * copying in vcpu load/put. Lets update our copies before we save |
707 | + * it into the save area |
708 | + */ |
709 | + save_fp_ctl(&vcpu->arch.guest_fpregs.fpc); |
710 | + save_fp_regs(vcpu->arch.guest_fpregs.fprs); |
711 | + save_access_regs(vcpu->run->s.regs.acrs); |
712 | + |
713 | + return kvm_s390_store_status_unloaded(vcpu, addr); |
714 | +} |
715 | + |
716 | static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu, |
717 | struct kvm_enable_cap *cap) |
718 | { |
719 | diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h |
720 | index b44912a32949..72c1391bd25a 100644 |
721 | --- a/arch/s390/kvm/kvm-s390.h |
722 | +++ b/arch/s390/kvm/kvm-s390.h |
723 | @@ -150,8 +150,8 @@ int kvm_s390_handle_eb(struct kvm_vcpu *vcpu); |
724 | int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu); |
725 | |
726 | /* implemented in kvm-s390.c */ |
727 | -int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, |
728 | - unsigned long addr); |
729 | +int kvm_s390_store_status_unloaded(struct kvm_vcpu *vcpu, unsigned long addr); |
730 | +int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr); |
731 | void s390_vcpu_block(struct kvm_vcpu *vcpu); |
732 | void s390_vcpu_unblock(struct kvm_vcpu *vcpu); |
733 | void exit_sie(struct kvm_vcpu *vcpu); |
734 | diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c |
735 | index bec398c57acf..6805601262e0 100644 |
736 | --- a/arch/s390/kvm/sigp.c |
737 | +++ b/arch/s390/kvm/sigp.c |
738 | @@ -130,6 +130,7 @@ unlock: |
739 | static int __inject_sigp_stop(struct kvm_s390_local_interrupt *li, int action) |
740 | { |
741 | struct kvm_s390_interrupt_info *inti; |
742 | + int rc = SIGP_CC_ORDER_CODE_ACCEPTED; |
743 | |
744 | inti = kzalloc(sizeof(*inti), GFP_ATOMIC); |
745 | if (!inti) |
746 | @@ -139,6 +140,8 @@ static int __inject_sigp_stop(struct kvm_s390_local_interrupt *li, int action) |
747 | spin_lock_bh(&li->lock); |
748 | if ((atomic_read(li->cpuflags) & CPUSTAT_STOPPED)) { |
749 | kfree(inti); |
750 | + if ((action & ACTION_STORE_ON_STOP) != 0) |
751 | + rc = -ESHUTDOWN; |
752 | goto out; |
753 | } |
754 | list_add_tail(&inti->list, &li->list); |
755 | @@ -150,7 +153,7 @@ static int __inject_sigp_stop(struct kvm_s390_local_interrupt *li, int action) |
756 | out: |
757 | spin_unlock_bh(&li->lock); |
758 | |
759 | - return SIGP_CC_ORDER_CODE_ACCEPTED; |
760 | + return rc; |
761 | } |
762 | |
763 | static int __sigp_stop(struct kvm_vcpu *vcpu, u16 cpu_addr, int action) |
764 | @@ -174,6 +177,16 @@ static int __sigp_stop(struct kvm_vcpu *vcpu, u16 cpu_addr, int action) |
765 | unlock: |
766 | spin_unlock(&fi->lock); |
767 | VCPU_EVENT(vcpu, 4, "sent sigp stop to cpu %x", cpu_addr); |
768 | + |
769 | + if ((action & ACTION_STORE_ON_STOP) != 0 && rc == -ESHUTDOWN) { |
770 | + /* If the CPU has already been stopped, we still have |
771 | + * to save the status when doing stop-and-store. This |
772 | + * has to be done after unlocking all spinlocks. */ |
773 | + struct kvm_vcpu *dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr); |
774 | + rc = kvm_s390_store_status_unloaded(dst_vcpu, |
775 | + KVM_S390_STORE_STATUS_NOADDR); |
776 | + } |
777 | + |
778 | return rc; |
779 | } |
780 | |
781 | diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h |
782 | index 1df115909758..c7678e43465b 100644 |
783 | --- a/arch/x86/include/asm/kvm_para.h |
784 | +++ b/arch/x86/include/asm/kvm_para.h |
785 | @@ -85,28 +85,9 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1, |
786 | return ret; |
787 | } |
788 | |
789 | -static inline uint32_t kvm_cpuid_base(void) |
790 | -{ |
791 | - if (boot_cpu_data.cpuid_level < 0) |
792 | - return 0; /* So we don't blow up on old processors */ |
793 | - |
794 | - if (cpu_has_hypervisor) |
795 | - return hypervisor_cpuid_base("KVMKVMKVM\0\0\0", 0); |
796 | - |
797 | - return 0; |
798 | -} |
799 | - |
800 | -static inline bool kvm_para_available(void) |
801 | -{ |
802 | - return kvm_cpuid_base() != 0; |
803 | -} |
804 | - |
805 | -static inline unsigned int kvm_arch_para_features(void) |
806 | -{ |
807 | - return cpuid_eax(KVM_CPUID_FEATURES); |
808 | -} |
809 | - |
810 | #ifdef CONFIG_KVM_GUEST |
811 | +bool kvm_para_available(void); |
812 | +unsigned int kvm_arch_para_features(void); |
813 | void __init kvm_guest_init(void); |
814 | void kvm_async_pf_task_wait(u32 token); |
815 | void kvm_async_pf_task_wake(u32 token); |
816 | @@ -126,6 +107,16 @@ static inline void kvm_spinlock_init(void) |
817 | #define kvm_async_pf_task_wait(T) do {} while(0) |
818 | #define kvm_async_pf_task_wake(T) do {} while(0) |
819 | |
820 | +static inline bool kvm_para_available(void) |
821 | +{ |
822 | + return 0; |
823 | +} |
824 | + |
825 | +static inline unsigned int kvm_arch_para_features(void) |
826 | +{ |
827 | + return 0; |
828 | +} |
829 | + |
830 | static inline u32 kvm_read_and_reset_pf_reason(void) |
831 | { |
832 | return 0; |
833 | diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h |
834 | index 37813b5ddc37..59cea185ad1d 100644 |
835 | --- a/arch/x86/include/uapi/asm/msr-index.h |
836 | +++ b/arch/x86/include/uapi/asm/msr-index.h |
837 | @@ -184,6 +184,7 @@ |
838 | #define MSR_AMD64_PATCH_LOADER 0xc0010020 |
839 | #define MSR_AMD64_OSVW_ID_LENGTH 0xc0010140 |
840 | #define MSR_AMD64_OSVW_STATUS 0xc0010141 |
841 | +#define MSR_AMD64_LS_CFG 0xc0011020 |
842 | #define MSR_AMD64_DC_CFG 0xc0011022 |
843 | #define MSR_AMD64_BU_CFG2 0xc001102a |
844 | #define MSR_AMD64_IBSFETCHCTL 0xc0011030 |
845 | diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c |
846 | index bca023bdd6b2..59bfebc8c805 100644 |
847 | --- a/arch/x86/kernel/cpu/amd.c |
848 | +++ b/arch/x86/kernel/cpu/amd.c |
849 | @@ -508,6 +508,16 @@ static void early_init_amd(struct cpuinfo_x86 *c) |
850 | set_cpu_cap(c, X86_FEATURE_EXTD_APICID); |
851 | } |
852 | #endif |
853 | + |
854 | + /* F16h erratum 793, CVE-2013-6885 */ |
855 | + if (c->x86 == 0x16 && c->x86_model <= 0xf) { |
856 | + u64 val; |
857 | + |
858 | + rdmsrl(MSR_AMD64_LS_CFG, val); |
859 | + if (!(val & BIT(15))) |
860 | + wrmsrl(MSR_AMD64_LS_CFG, val | BIT(15)); |
861 | + } |
862 | + |
863 | } |
864 | |
865 | static const int amd_erratum_383[]; |
866 | diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c |
867 | index 6dd802c6d780..f81cadebcc0e 100644 |
868 | --- a/arch/x86/kernel/kvm.c |
869 | +++ b/arch/x86/kernel/kvm.c |
870 | @@ -500,6 +500,38 @@ void __init kvm_guest_init(void) |
871 | #endif |
872 | } |
873 | |
874 | +static noinline uint32_t __kvm_cpuid_base(void) |
875 | +{ |
876 | + if (boot_cpu_data.cpuid_level < 0) |
877 | + return 0; /* So we don't blow up on old processors */ |
878 | + |
879 | + if (cpu_has_hypervisor) |
880 | + return hypervisor_cpuid_base("KVMKVMKVM\0\0\0", 0); |
881 | + |
882 | + return 0; |
883 | +} |
884 | + |
885 | +static inline uint32_t kvm_cpuid_base(void) |
886 | +{ |
887 | + static int kvm_cpuid_base = -1; |
888 | + |
889 | + if (kvm_cpuid_base == -1) |
890 | + kvm_cpuid_base = __kvm_cpuid_base(); |
891 | + |
892 | + return kvm_cpuid_base; |
893 | +} |
894 | + |
895 | +bool kvm_para_available(void) |
896 | +{ |
897 | + return kvm_cpuid_base() != 0; |
898 | +} |
899 | +EXPORT_SYMBOL_GPL(kvm_para_available); |
900 | + |
901 | +unsigned int kvm_arch_para_features(void) |
902 | +{ |
903 | + return cpuid_eax(kvm_cpuid_base() | KVM_CPUID_FEATURES); |
904 | +} |
905 | + |
906 | static uint32_t __init kvm_detect(void) |
907 | { |
908 | return kvm_cpuid_base(); |
909 | diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c |
910 | index 412a5aa0ef94..518d86471b76 100644 |
911 | --- a/arch/x86/kvm/i8254.c |
912 | +++ b/arch/x86/kvm/i8254.c |
913 | @@ -37,6 +37,7 @@ |
914 | |
915 | #include "irq.h" |
916 | #include "i8254.h" |
917 | +#include "x86.h" |
918 | |
919 | #ifndef CONFIG_X86_64 |
920 | #define mod_64(x, y) ((x) - (y) * div64_u64(x, y)) |
921 | @@ -349,6 +350,23 @@ static void create_pit_timer(struct kvm *kvm, u32 val, int is_period) |
922 | atomic_set(&ps->pending, 0); |
923 | ps->irq_ack = 1; |
924 | |
925 | + /* |
926 | + * Do not allow the guest to program periodic timers with small |
927 | + * interval, since the hrtimers are not throttled by the host |
928 | + * scheduler. |
929 | + */ |
930 | + if (ps->is_periodic) { |
931 | + s64 min_period = min_timer_period_us * 1000LL; |
932 | + |
933 | + if (ps->period < min_period) { |
934 | + pr_info_ratelimited( |
935 | + "kvm: requested %lld ns " |
936 | + "i8254 timer period limited to %lld ns\n", |
937 | + ps->period, min_period); |
938 | + ps->period = min_period; |
939 | + } |
940 | + } |
941 | + |
942 | hrtimer_start(&ps->timer, ktime_add_ns(ktime_get(), interval), |
943 | HRTIMER_MODE_ABS); |
944 | } |
945 | diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c |
946 | index 775702f649ca..d86ff15fc89f 100644 |
947 | --- a/arch/x86/kvm/lapic.c |
948 | +++ b/arch/x86/kvm/lapic.c |
949 | @@ -71,9 +71,6 @@ |
950 | #define VEC_POS(v) ((v) & (32 - 1)) |
951 | #define REG_POS(v) (((v) >> 5) << 4) |
952 | |
953 | -static unsigned int min_timer_period_us = 500; |
954 | -module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR); |
955 | - |
956 | static inline void apic_set_reg(struct kvm_lapic *apic, int reg_off, u32 val) |
957 | { |
958 | *((u32 *) (apic->regs + reg_off)) = val; |
959 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
960 | index 5d004da1e35d..d89d51b3abf6 100644 |
961 | --- a/arch/x86/kvm/x86.c |
962 | +++ b/arch/x86/kvm/x86.c |
963 | @@ -94,6 +94,9 @@ EXPORT_SYMBOL_GPL(kvm_x86_ops); |
964 | static bool ignore_msrs = 0; |
965 | module_param(ignore_msrs, bool, S_IRUGO | S_IWUSR); |
966 | |
967 | +unsigned int min_timer_period_us = 500; |
968 | +module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR); |
969 | + |
970 | bool kvm_has_tsc_control; |
971 | EXPORT_SYMBOL_GPL(kvm_has_tsc_control); |
972 | u32 kvm_max_guest_tsc_khz; |
973 | diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h |
974 | index 587fb9ede436..8da5823bcde6 100644 |
975 | --- a/arch/x86/kvm/x86.h |
976 | +++ b/arch/x86/kvm/x86.h |
977 | @@ -125,5 +125,7 @@ int kvm_write_guest_virt_system(struct x86_emulate_ctxt *ctxt, |
978 | #define KVM_SUPPORTED_XCR0 (XSTATE_FP | XSTATE_SSE | XSTATE_YMM) |
979 | extern u64 host_xcr0; |
980 | |
981 | +extern unsigned int min_timer_period_us; |
982 | + |
983 | extern struct static_key kvm_no_apic_vcpu; |
984 | #endif |
985 | diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c |
986 | index cceb813044ef..30075f91040c 100644 |
987 | --- a/arch/x86/platform/efi/efi.c |
988 | +++ b/arch/x86/platform/efi/efi.c |
989 | @@ -436,7 +436,7 @@ void __init efi_reserve_boot_services(void) |
990 | * - Not within any part of the kernel |
991 | * - Not the bios reserved area |
992 | */ |
993 | - if ((start+size >= __pa_symbol(_text) |
994 | + if ((start + size > __pa_symbol(_text) |
995 | && start <= __pa_symbol(_end)) || |
996 | !e820_all_mapped(start, start+size, E820_RAM) || |
997 | memblock_is_region_reserved(start, size)) { |
998 | diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
999 | index 1393a5890ed5..1a3dbd1b196e 100644 |
1000 | --- a/drivers/ata/libata-core.c |
1001 | +++ b/drivers/ata/libata-core.c |
1002 | @@ -2222,6 +2222,16 @@ int ata_dev_configure(struct ata_device *dev) |
1003 | if (rc) |
1004 | return rc; |
1005 | |
1006 | + /* some WD SATA-1 drives have issues with LPM, turn on NOLPM for them */ |
1007 | + if ((dev->horkage & ATA_HORKAGE_WD_BROKEN_LPM) && |
1008 | + (id[ATA_ID_SATA_CAPABILITY] & 0xe) == 0x2) |
1009 | + dev->horkage |= ATA_HORKAGE_NOLPM; |
1010 | + |
1011 | + if (dev->horkage & ATA_HORKAGE_NOLPM) { |
1012 | + ata_dev_warn(dev, "LPM support broken, forcing max_power\n"); |
1013 | + dev->link->ap->target_lpm_policy = ATA_LPM_MAX_POWER; |
1014 | + } |
1015 | + |
1016 | /* let ACPI work its magic */ |
1017 | rc = ata_acpi_on_devcfg(dev); |
1018 | if (rc) |
1019 | @@ -4216,6 +4226,23 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { |
1020 | { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
1021 | { "Crucial_CT???M500SSD1", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
1022 | |
1023 | + /* |
1024 | + * Some WD SATA-I drives spin up and down erratically when the link |
1025 | + * is put into the slumber mode. We don't have full list of the |
1026 | + * affected devices. Disable LPM if the device matches one of the |
1027 | + * known prefixes and is SATA-1. As a side effect LPM partial is |
1028 | + * lost too. |
1029 | + * |
1030 | + * https://bugzilla.kernel.org/show_bug.cgi?id=57211 |
1031 | + */ |
1032 | + { "WDC WD800JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM }, |
1033 | + { "WDC WD1200JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM }, |
1034 | + { "WDC WD1600JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM }, |
1035 | + { "WDC WD2000JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM }, |
1036 | + { "WDC WD2500JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM }, |
1037 | + { "WDC WD3000JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM }, |
1038 | + { "WDC WD3200JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM }, |
1039 | + |
1040 | /* End Marker */ |
1041 | { } |
1042 | }; |
1043 | diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c |
1044 | index 377eb889f555..ef8567de6a75 100644 |
1045 | --- a/drivers/ata/libata-scsi.c |
1046 | +++ b/drivers/ata/libata-scsi.c |
1047 | @@ -111,12 +111,14 @@ static const char *ata_lpm_policy_names[] = { |
1048 | [ATA_LPM_MIN_POWER] = "min_power", |
1049 | }; |
1050 | |
1051 | -static ssize_t ata_scsi_lpm_store(struct device *dev, |
1052 | +static ssize_t ata_scsi_lpm_store(struct device *device, |
1053 | struct device_attribute *attr, |
1054 | const char *buf, size_t count) |
1055 | { |
1056 | - struct Scsi_Host *shost = class_to_shost(dev); |
1057 | + struct Scsi_Host *shost = class_to_shost(device); |
1058 | struct ata_port *ap = ata_shost_to_port(shost); |
1059 | + struct ata_link *link; |
1060 | + struct ata_device *dev; |
1061 | enum ata_lpm_policy policy; |
1062 | unsigned long flags; |
1063 | |
1064 | @@ -132,10 +134,20 @@ static ssize_t ata_scsi_lpm_store(struct device *dev, |
1065 | return -EINVAL; |
1066 | |
1067 | spin_lock_irqsave(ap->lock, flags); |
1068 | + |
1069 | + ata_for_each_link(link, ap, EDGE) { |
1070 | + ata_for_each_dev(dev, &ap->link, ENABLED) { |
1071 | + if (dev->horkage & ATA_HORKAGE_NOLPM) { |
1072 | + count = -EOPNOTSUPP; |
1073 | + goto out_unlock; |
1074 | + } |
1075 | + } |
1076 | + } |
1077 | + |
1078 | ap->target_lpm_policy = policy; |
1079 | ata_port_schedule_eh(ap); |
1080 | +out_unlock: |
1081 | spin_unlock_irqrestore(ap->lock, flags); |
1082 | - |
1083 | return count; |
1084 | } |
1085 | |
1086 | diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c |
1087 | index 56be31819897..dc9d4b1ea4ec 100644 |
1088 | --- a/drivers/ata/sata_mv.c |
1089 | +++ b/drivers/ata/sata_mv.c |
1090 | @@ -304,6 +304,7 @@ enum { |
1091 | MV5_LTMODE = 0x30, |
1092 | MV5_PHY_CTL = 0x0C, |
1093 | SATA_IFCFG = 0x050, |
1094 | + LP_PHY_CTL = 0x058, |
1095 | |
1096 | MV_M2_PREAMP_MASK = 0x7e0, |
1097 | |
1098 | @@ -431,6 +432,7 @@ enum { |
1099 | MV_HP_CUT_THROUGH = (1 << 10), /* can use EDMA cut-through */ |
1100 | MV_HP_FLAG_SOC = (1 << 11), /* SystemOnChip, no PCI */ |
1101 | MV_HP_QUIRK_LED_BLINK_EN = (1 << 12), /* is led blinking enabled? */ |
1102 | + MV_HP_FIX_LP_PHY_CTL = (1 << 13), /* fix speed in LP_PHY_CTL ? */ |
1103 | |
1104 | /* Port private flags (pp_flags) */ |
1105 | MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */ |
1106 | @@ -1358,6 +1360,7 @@ static int mv_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val) |
1107 | |
1108 | if (ofs != 0xffffffffU) { |
1109 | void __iomem *addr = mv_ap_base(link->ap) + ofs; |
1110 | + struct mv_host_priv *hpriv = link->ap->host->private_data; |
1111 | if (sc_reg_in == SCR_CONTROL) { |
1112 | /* |
1113 | * Workaround for 88SX60x1 FEr SATA#26: |
1114 | @@ -1374,6 +1377,18 @@ static int mv_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val) |
1115 | */ |
1116 | if ((val & 0xf) == 1 || (readl(addr) & 0xf) == 1) |
1117 | val |= 0xf000; |
1118 | + |
1119 | + if (hpriv->hp_flags & MV_HP_FIX_LP_PHY_CTL) { |
1120 | + void __iomem *lp_phy_addr = |
1121 | + mv_ap_base(link->ap) + LP_PHY_CTL; |
1122 | + /* |
1123 | + * Set PHY speed according to SControl speed. |
1124 | + */ |
1125 | + if ((val & 0xf0) == 0x10) |
1126 | + writelfl(0x7, lp_phy_addr); |
1127 | + else |
1128 | + writelfl(0x227, lp_phy_addr); |
1129 | + } |
1130 | } |
1131 | writelfl(val, addr); |
1132 | return 0; |
1133 | @@ -4110,6 +4125,15 @@ static int mv_platform_probe(struct platform_device *pdev) |
1134 | if (rc) |
1135 | goto err; |
1136 | |
1137 | + /* |
1138 | + * To allow disk hotplug on Armada 370/XP SoCs, the PHY speed must be |
1139 | + * updated in the LP_PHY_CTL register. |
1140 | + */ |
1141 | + if (pdev->dev.of_node && |
1142 | + of_device_is_compatible(pdev->dev.of_node, |
1143 | + "marvell,armada-370-sata")) |
1144 | + hpriv->hp_flags |= MV_HP_FIX_LP_PHY_CTL; |
1145 | + |
1146 | /* initialize adapter */ |
1147 | rc = mv_init_host(host); |
1148 | if (rc) |
1149 | @@ -4209,6 +4233,7 @@ static int mv_platform_resume(struct platform_device *pdev) |
1150 | |
1151 | #ifdef CONFIG_OF |
1152 | static struct of_device_id mv_sata_dt_ids[] = { |
1153 | + { .compatible = "marvell,armada-370-sata", }, |
1154 | { .compatible = "marvell,orion-sata", }, |
1155 | {}, |
1156 | }; |
1157 | diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c |
1158 | index a0d6ceb5d005..cf6840385483 100644 |
1159 | --- a/drivers/char/tpm/tpm_i2c_stm_st33.c |
1160 | +++ b/drivers/char/tpm/tpm_i2c_stm_st33.c |
1161 | @@ -410,6 +410,8 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count) |
1162 | &chip->vendor.read_queue) |
1163 | == 0) { |
1164 | burstcnt = get_burstcount(chip); |
1165 | + if (burstcnt < 0) |
1166 | + return burstcnt; |
1167 | len = min_t(int, burstcnt, count - size); |
1168 | I2C_READ_DATA(client, TPM_DATA_FIFO, buf + size, len); |
1169 | size += len; |
1170 | @@ -451,7 +453,8 @@ static irqreturn_t tpm_ioserirq_handler(int irq, void *dev_id) |
1171 | static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf, |
1172 | size_t len) |
1173 | { |
1174 | - u32 status, burstcnt = 0, i, size; |
1175 | + u32 status, i, size; |
1176 | + int burstcnt = 0; |
1177 | int ret; |
1178 | u8 data; |
1179 | struct i2c_client *client; |
1180 | @@ -482,6 +485,8 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf, |
1181 | |
1182 | for (i = 0; i < len - 1;) { |
1183 | burstcnt = get_burstcount(chip); |
1184 | + if (burstcnt < 0) |
1185 | + return burstcnt; |
1186 | size = min_t(int, len - i - 1, burstcnt); |
1187 | ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf, size); |
1188 | if (ret < 0) |
1189 | diff --git a/drivers/char/tpm/tpm_ppi.c b/drivers/char/tpm/tpm_ppi.c |
1190 | index e1f3337a0cf9..2db4419831be 100644 |
1191 | --- a/drivers/char/tpm/tpm_ppi.c |
1192 | +++ b/drivers/char/tpm/tpm_ppi.c |
1193 | @@ -172,7 +172,7 @@ static ssize_t tpm_store_ppi_request(struct device *dev, |
1194 | * is updated with function index from SUBREQ to SUBREQ2 since PPI |
1195 | * version 1.1 |
1196 | */ |
1197 | - if (strcmp(version, "1.1") == -1) |
1198 | + if (strcmp(version, "1.1") < 0) |
1199 | params[2].integer.value = TPM_PPI_FN_SUBREQ; |
1200 | else |
1201 | params[2].integer.value = TPM_PPI_FN_SUBREQ2; |
1202 | @@ -182,7 +182,7 @@ static ssize_t tpm_store_ppi_request(struct device *dev, |
1203 | * string/package type. For PPI version 1.0 and 1.1, use buffer type |
1204 | * for compatibility, and use package type since 1.2 according to spec. |
1205 | */ |
1206 | - if (strcmp(version, "1.2") == -1) { |
1207 | + if (strcmp(version, "1.2") < 0) { |
1208 | params[3].type = ACPI_TYPE_BUFFER; |
1209 | params[3].buffer.length = sizeof(req); |
1210 | sscanf(buf, "%d", &req); |
1211 | @@ -248,7 +248,7 @@ static ssize_t tpm_show_ppi_transition_action(struct device *dev, |
1212 | * (e.g. Capella with PPI 1.0) need integer/string/buffer type, so for |
1213 | * compatibility, define params[3].type as buffer, if PPI version < 1.2 |
1214 | */ |
1215 | - if (strcmp(version, "1.2") == -1) { |
1216 | + if (strcmp(version, "1.2") < 0) { |
1217 | params[3].type = ACPI_TYPE_BUFFER; |
1218 | params[3].buffer.length = 0; |
1219 | params[3].buffer.pointer = NULL; |
1220 | @@ -390,7 +390,7 @@ static ssize_t show_ppi_operations(char *buf, u32 start, u32 end) |
1221 | kfree(output.pointer); |
1222 | output.length = ACPI_ALLOCATE_BUFFER; |
1223 | output.pointer = NULL; |
1224 | - if (strcmp(version, "1.2") == -1) |
1225 | + if (strcmp(version, "1.2") < 0) |
1226 | return -EPERM; |
1227 | |
1228 | params[2].integer.value = TPM_PPI_FN_GETOPR; |
1229 | diff --git a/drivers/edac/e752x_edac.c b/drivers/edac/e752x_edac.c |
1230 | index 644fec54681f..f1e9d7bd131f 100644 |
1231 | --- a/drivers/edac/e752x_edac.c |
1232 | +++ b/drivers/edac/e752x_edac.c |
1233 | @@ -1182,9 +1182,11 @@ static int e752x_get_devs(struct pci_dev *pdev, int dev_idx, |
1234 | pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL, |
1235 | pvt->dev_info->err_dev, pvt->bridge_ck); |
1236 | |
1237 | - if (pvt->bridge_ck == NULL) |
1238 | + if (pvt->bridge_ck == NULL) { |
1239 | pvt->bridge_ck = pci_scan_single_device(pdev->bus, |
1240 | PCI_DEVFN(0, 1)); |
1241 | + pci_dev_get(pvt->bridge_ck); |
1242 | + } |
1243 | |
1244 | if (pvt->bridge_ck == NULL) { |
1245 | e752x_printk(KERN_ERR, "error reporting device not found:" |
1246 | diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c |
1247 | index d65f3fd895dd..758774f4454c 100644 |
1248 | --- a/drivers/hwmon/k10temp.c |
1249 | +++ b/drivers/hwmon/k10temp.c |
1250 | @@ -210,6 +210,7 @@ static DEFINE_PCI_DEVICE_TABLE(k10temp_id_table) = { |
1251 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, |
1252 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) }, |
1253 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M10H_F3) }, |
1254 | + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F3) }, |
1255 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, |
1256 | {} |
1257 | }; |
1258 | diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig |
1259 | index 3b26129f6055..faa3e8e56f6c 100644 |
1260 | --- a/drivers/i2c/busses/Kconfig |
1261 | +++ b/drivers/i2c/busses/Kconfig |
1262 | @@ -152,6 +152,7 @@ config I2C_PIIX4 |
1263 | ATI SB700/SP5100 |
1264 | ATI SB800 |
1265 | AMD Hudson-2 |
1266 | + AMD ML |
1267 | AMD CZ |
1268 | Serverworks OSB4 |
1269 | Serverworks CSB5 |
1270 | diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c |
1271 | index 8be7e42aa4de..b8c5187b9ee0 100644 |
1272 | --- a/drivers/i2c/busses/i2c-mv64xxx.c |
1273 | +++ b/drivers/i2c/busses/i2c-mv64xxx.c |
1274 | @@ -692,6 +692,7 @@ static const struct of_device_id mv64xxx_i2c_of_match_table[] = { |
1275 | { .compatible = "allwinner,sun4i-i2c", .data = &mv64xxx_i2c_regs_sun4i}, |
1276 | { .compatible = "marvell,mv64xxx-i2c", .data = &mv64xxx_i2c_regs_mv64xxx}, |
1277 | { .compatible = "marvell,mv78230-i2c", .data = &mv64xxx_i2c_regs_mv64xxx}, |
1278 | + { .compatible = "marvell,mv78230-a0-i2c", .data = &mv64xxx_i2c_regs_mv64xxx}, |
1279 | {} |
1280 | }; |
1281 | MODULE_DEVICE_TABLE(of, mv64xxx_i2c_of_match_table); |
1282 | @@ -783,6 +784,10 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, |
1283 | drv_data->errata_delay = true; |
1284 | } |
1285 | |
1286 | + if (of_device_is_compatible(np, "marvell,mv78230-a0-i2c")) { |
1287 | + drv_data->offload_enabled = false; |
1288 | + drv_data->errata_delay = true; |
1289 | + } |
1290 | out: |
1291 | return rc; |
1292 | #endif |
1293 | diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c |
1294 | index a028617b8f13..f71b4d381c00 100644 |
1295 | --- a/drivers/i2c/busses/i2c-piix4.c |
1296 | +++ b/drivers/i2c/busses/i2c-piix4.c |
1297 | @@ -22,7 +22,7 @@ |
1298 | Intel PIIX4, 440MX |
1299 | Serverworks OSB4, CSB5, CSB6, HT-1000, HT-1100 |
1300 | ATI IXP200, IXP300, IXP400, SB600, SB700/SP5100, SB800 |
1301 | - AMD Hudson-2, CZ |
1302 | + AMD Hudson-2, ML, CZ |
1303 | SMSC Victory66 |
1304 | |
1305 | Note: we assume there can only be one device, with one or more |
1306 | @@ -235,7 +235,8 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, |
1307 | { |
1308 | unsigned short piix4_smba; |
1309 | unsigned short smba_idx = 0xcd6; |
1310 | - u8 smba_en_lo, smba_en_hi, i2ccfg, i2ccfg_offset = 0x10, smb_en; |
1311 | + u8 smba_en_lo, smba_en_hi, smb_en, smb_en_status; |
1312 | + u8 i2ccfg, i2ccfg_offset = 0x10; |
1313 | |
1314 | /* SB800 and later SMBus does not support forcing address */ |
1315 | if (force || force_addr) { |
1316 | @@ -245,7 +246,15 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, |
1317 | } |
1318 | |
1319 | /* Determine the address of the SMBus areas */ |
1320 | - smb_en = (aux) ? 0x28 : 0x2c; |
1321 | + if ((PIIX4_dev->vendor == PCI_VENDOR_ID_AMD && |
1322 | + PIIX4_dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS && |
1323 | + PIIX4_dev->revision >= 0x41) || |
1324 | + (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD && |
1325 | + PIIX4_dev->device == 0x790b && |
1326 | + PIIX4_dev->revision >= 0x49)) |
1327 | + smb_en = 0x00; |
1328 | + else |
1329 | + smb_en = (aux) ? 0x28 : 0x2c; |
1330 | |
1331 | if (!request_region(smba_idx, 2, "smba_idx")) { |
1332 | dev_err(&PIIX4_dev->dev, "SMBus base address index region " |
1333 | @@ -258,13 +267,22 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, |
1334 | smba_en_hi = inb_p(smba_idx + 1); |
1335 | release_region(smba_idx, 2); |
1336 | |
1337 | - if ((smba_en_lo & 1) == 0) { |
1338 | + if (!smb_en) { |
1339 | + smb_en_status = smba_en_lo & 0x10; |
1340 | + piix4_smba = smba_en_hi << 8; |
1341 | + if (aux) |
1342 | + piix4_smba |= 0x20; |
1343 | + } else { |
1344 | + smb_en_status = smba_en_lo & 0x01; |
1345 | + piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0; |
1346 | + } |
1347 | + |
1348 | + if (!smb_en_status) { |
1349 | dev_err(&PIIX4_dev->dev, |
1350 | "Host SMBus controller not enabled!\n"); |
1351 | return -ENODEV; |
1352 | } |
1353 | |
1354 | - piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0; |
1355 | if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) |
1356 | return -ENODEV; |
1357 | |
1358 | diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c |
1359 | index 7d388b8bb50e..16958704af3b 100644 |
1360 | --- a/drivers/md/bcache/bset.c |
1361 | +++ b/drivers/md/bcache/bset.c |
1362 | @@ -955,7 +955,7 @@ static void sort_key_next(struct btree_iter *iter, |
1363 | *i = iter->data[--iter->used]; |
1364 | } |
1365 | |
1366 | -static void btree_sort_fixup(struct btree_iter *iter) |
1367 | +static struct bkey *btree_sort_fixup(struct btree_iter *iter, struct bkey *tmp) |
1368 | { |
1369 | while (iter->used > 1) { |
1370 | struct btree_iter_set *top = iter->data, *i = top + 1; |
1371 | @@ -983,9 +983,22 @@ static void btree_sort_fixup(struct btree_iter *iter) |
1372 | } else { |
1373 | /* can't happen because of comparison func */ |
1374 | BUG_ON(!bkey_cmp(&START_KEY(top->k), &START_KEY(i->k))); |
1375 | - bch_cut_back(&START_KEY(i->k), top->k); |
1376 | + |
1377 | + if (bkey_cmp(i->k, top->k) < 0) { |
1378 | + bkey_copy(tmp, top->k); |
1379 | + |
1380 | + bch_cut_back(&START_KEY(i->k), tmp); |
1381 | + bch_cut_front(i->k, top->k); |
1382 | + heap_sift(iter, 0, btree_iter_cmp); |
1383 | + |
1384 | + return tmp; |
1385 | + } else { |
1386 | + bch_cut_back(&START_KEY(i->k), top->k); |
1387 | + } |
1388 | } |
1389 | } |
1390 | + |
1391 | + return NULL; |
1392 | } |
1393 | |
1394 | static void btree_mergesort(struct btree *b, struct bset *out, |
1395 | @@ -993,15 +1006,20 @@ static void btree_mergesort(struct btree *b, struct bset *out, |
1396 | bool fixup, bool remove_stale) |
1397 | { |
1398 | struct bkey *k, *last = NULL; |
1399 | + BKEY_PADDED(k) tmp; |
1400 | bool (*bad)(struct btree *, const struct bkey *) = remove_stale |
1401 | ? bch_ptr_bad |
1402 | : bch_ptr_invalid; |
1403 | |
1404 | while (!btree_iter_end(iter)) { |
1405 | if (fixup && !b->level) |
1406 | - btree_sort_fixup(iter); |
1407 | + k = btree_sort_fixup(iter, &tmp.k); |
1408 | + else |
1409 | + k = NULL; |
1410 | + |
1411 | + if (!k) |
1412 | + k = bch_btree_iter_next(iter); |
1413 | |
1414 | - k = bch_btree_iter_next(iter); |
1415 | if (bad(b, k)) |
1416 | continue; |
1417 | |
1418 | diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c |
1419 | index 34520cbe8afb..12b3ae3aa7c5 100644 |
1420 | --- a/drivers/mfd/max77686.c |
1421 | +++ b/drivers/mfd/max77686.c |
1422 | @@ -104,7 +104,7 @@ static int max77686_i2c_probe(struct i2c_client *i2c, |
1423 | max77686->irq_gpio = pdata->irq_gpio; |
1424 | max77686->irq = i2c->irq; |
1425 | |
1426 | - max77686->regmap = regmap_init_i2c(i2c, &max77686_regmap_config); |
1427 | + max77686->regmap = devm_regmap_init_i2c(i2c, &max77686_regmap_config); |
1428 | if (IS_ERR(max77686->regmap)) { |
1429 | ret = PTR_ERR(max77686->regmap); |
1430 | dev_err(max77686->dev, "Failed to allocate register map: %d\n", |
1431 | diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c |
1432 | index 9b3a0fb7f265..5d9e687a866c 100644 |
1433 | --- a/drivers/misc/mei/hbm.c |
1434 | +++ b/drivers/misc/mei/hbm.c |
1435 | @@ -128,6 +128,17 @@ static bool is_treat_specially_client(struct mei_cl *cl, |
1436 | return false; |
1437 | } |
1438 | |
1439 | +/** |
1440 | + * mei_hbm_idle - set hbm to idle state |
1441 | + * |
1442 | + * @dev: the device structure |
1443 | + */ |
1444 | +void mei_hbm_idle(struct mei_device *dev) |
1445 | +{ |
1446 | + dev->init_clients_timer = 0; |
1447 | + dev->hbm_state = MEI_HBM_IDLE; |
1448 | +} |
1449 | + |
1450 | int mei_hbm_start_wait(struct mei_device *dev) |
1451 | { |
1452 | int ret; |
1453 | @@ -577,6 +588,14 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) |
1454 | mei_read_slots(dev, dev->rd_msg_buf, hdr->length); |
1455 | mei_msg = (struct mei_bus_message *)dev->rd_msg_buf; |
1456 | |
1457 | + /* ignore spurious message and prevent reset nesting |
1458 | + * hbm is put to idle during system reset |
1459 | + */ |
1460 | + if (dev->hbm_state == MEI_HBM_IDLE) { |
1461 | + dev_dbg(&dev->pdev->dev, "hbm: state is idle ignore spurious messages\n"); |
1462 | + return 0; |
1463 | + } |
1464 | + |
1465 | switch (mei_msg->hbm_cmd) { |
1466 | case HOST_START_RES_CMD: |
1467 | version_res = (struct hbm_host_version_response *)mei_msg; |
1468 | diff --git a/drivers/misc/mei/hbm.h b/drivers/misc/mei/hbm.h |
1469 | index 4ae2e56e404f..210757701207 100644 |
1470 | --- a/drivers/misc/mei/hbm.h |
1471 | +++ b/drivers/misc/mei/hbm.h |
1472 | @@ -49,6 +49,7 @@ static inline void mei_hbm_hdr(struct mei_msg_hdr *hdr, size_t length) |
1473 | hdr->reserved = 0; |
1474 | } |
1475 | |
1476 | +void mei_hbm_idle(struct mei_device *dev); |
1477 | int mei_hbm_start_req(struct mei_device *dev); |
1478 | int mei_hbm_start_wait(struct mei_device *dev); |
1479 | int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl); |
1480 | diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c |
1481 | index f7f3abbe12b6..53a93908e030 100644 |
1482 | --- a/drivers/misc/mei/init.c |
1483 | +++ b/drivers/misc/mei/init.c |
1484 | @@ -151,14 +151,19 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) |
1485 | dev_warn(&dev->pdev->dev, "unexpected reset: dev_state = %s\n", |
1486 | mei_dev_state_str(dev->dev_state)); |
1487 | |
1488 | + /* we're already in reset, cancel the init timer |
1489 | + * if the reset was called due the hbm protocol error |
1490 | + * we need to call it before hw start |
1491 | + * so the hbm watchdog won't kick in |
1492 | + */ |
1493 | + mei_hbm_idle(dev); |
1494 | + |
1495 | ret = mei_hw_reset(dev, interrupts_enabled); |
1496 | if (ret) { |
1497 | dev_err(&dev->pdev->dev, "hw reset failed disabling the device\n"); |
1498 | interrupts_enabled = false; |
1499 | - dev->dev_state = MEI_DEV_DISABLED; |
1500 | } |
1501 | |
1502 | - dev->hbm_state = MEI_HBM_IDLE; |
1503 | |
1504 | if (dev->dev_state != MEI_DEV_INITIALIZING && |
1505 | dev->dev_state != MEI_DEV_POWER_UP) { |
1506 | @@ -182,8 +187,6 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) |
1507 | memset(&dev->wr_ext_msg, 0, sizeof(dev->wr_ext_msg)); |
1508 | } |
1509 | |
1510 | - /* we're already in reset, cancel the init timer */ |
1511 | - dev->init_clients_timer = 0; |
1512 | |
1513 | dev->me_clients_num = 0; |
1514 | dev->rd_msg_hdr = 0; |
1515 | @@ -191,6 +194,7 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) |
1516 | |
1517 | if (!interrupts_enabled) { |
1518 | dev_dbg(&dev->pdev->dev, "intr not enabled end of reset\n"); |
1519 | + dev->dev_state = MEI_DEV_DISABLED; |
1520 | return; |
1521 | } |
1522 | |
1523 | diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c |
1524 | index 7a95c07e59a6..6ce63f531fa2 100644 |
1525 | --- a/drivers/misc/mei/interrupt.c |
1526 | +++ b/drivers/misc/mei/interrupt.c |
1527 | @@ -533,7 +533,6 @@ EXPORT_SYMBOL_GPL(mei_irq_write_handler); |
1528 | * |
1529 | * @work: pointer to the work_struct structure |
1530 | * |
1531 | - * NOTE: This function is called by timer interrupt work |
1532 | */ |
1533 | void mei_timer(struct work_struct *work) |
1534 | { |
1535 | @@ -548,18 +547,24 @@ void mei_timer(struct work_struct *work) |
1536 | |
1537 | |
1538 | mutex_lock(&dev->device_lock); |
1539 | - if (dev->dev_state != MEI_DEV_ENABLED) { |
1540 | - if (dev->dev_state == MEI_DEV_INIT_CLIENTS) { |
1541 | - if (dev->init_clients_timer) { |
1542 | - if (--dev->init_clients_timer == 0) { |
1543 | - dev_err(&dev->pdev->dev, "reset: init clients timeout hbm_state = %d.\n", |
1544 | - dev->hbm_state); |
1545 | - mei_reset(dev, 1); |
1546 | - } |
1547 | + |
1548 | + /* Catch interrupt stalls during HBM init handshake */ |
1549 | + if (dev->dev_state == MEI_DEV_INIT_CLIENTS && |
1550 | + dev->hbm_state != MEI_HBM_IDLE) { |
1551 | + |
1552 | + if (dev->init_clients_timer) { |
1553 | + if (--dev->init_clients_timer == 0) { |
1554 | + dev_err(&dev->pdev->dev, "timer: init clients timeout hbm_state = %d.\n", |
1555 | + dev->hbm_state); |
1556 | + mei_reset(dev, 1); |
1557 | + goto out; |
1558 | } |
1559 | } |
1560 | - goto out; |
1561 | } |
1562 | + |
1563 | + if (dev->dev_state != MEI_DEV_ENABLED) |
1564 | + goto out; |
1565 | + |
1566 | /*** connect/disconnect timeouts ***/ |
1567 | list_for_each_entry_safe(cl_pos, cl_next, &dev->file_list, link) { |
1568 | if (cl_pos->timer_count) { |
1569 | diff --git a/drivers/misc/mic/host/mic_device.h b/drivers/misc/mic/host/mic_device.h |
1570 | index 3574cc375bb9..b2da289320c9 100644 |
1571 | --- a/drivers/misc/mic/host/mic_device.h |
1572 | +++ b/drivers/misc/mic/host/mic_device.h |
1573 | @@ -134,6 +134,8 @@ struct mic_device { |
1574 | * @send_intr: Send an interrupt for a particular doorbell on the card. |
1575 | * @ack_interrupt: Hardware specific operations to ack the h/w on |
1576 | * receipt of an interrupt. |
1577 | + * @intr_workarounds: Hardware specific workarounds needed after |
1578 | + * handling an interrupt. |
1579 | * @reset: Reset the remote processor. |
1580 | * @reset_fw_ready: Reset firmware ready field. |
1581 | * @is_fw_ready: Check if firmware is ready for OS download. |
1582 | @@ -149,6 +151,7 @@ struct mic_hw_ops { |
1583 | void (*write_spad)(struct mic_device *mdev, unsigned int idx, u32 val); |
1584 | void (*send_intr)(struct mic_device *mdev, int doorbell); |
1585 | u32 (*ack_interrupt)(struct mic_device *mdev); |
1586 | + void (*intr_workarounds)(struct mic_device *mdev); |
1587 | void (*reset)(struct mic_device *mdev); |
1588 | void (*reset_fw_ready)(struct mic_device *mdev); |
1589 | bool (*is_fw_ready)(struct mic_device *mdev); |
1590 | diff --git a/drivers/misc/mic/host/mic_main.c b/drivers/misc/mic/host/mic_main.c |
1591 | index ad838c7651c4..c04a021e20c7 100644 |
1592 | --- a/drivers/misc/mic/host/mic_main.c |
1593 | +++ b/drivers/misc/mic/host/mic_main.c |
1594 | @@ -115,7 +115,7 @@ static irqreturn_t mic_shutdown_db(int irq, void *data) |
1595 | struct mic_device *mdev = data; |
1596 | struct mic_bootparam *bootparam = mdev->dp; |
1597 | |
1598 | - mdev->ops->ack_interrupt(mdev); |
1599 | + mdev->ops->intr_workarounds(mdev); |
1600 | |
1601 | switch (bootparam->shutdown_status) { |
1602 | case MIC_HALTED: |
1603 | diff --git a/drivers/misc/mic/host/mic_virtio.c b/drivers/misc/mic/host/mic_virtio.c |
1604 | index e04bb4fe6823..752ff873f891 100644 |
1605 | --- a/drivers/misc/mic/host/mic_virtio.c |
1606 | +++ b/drivers/misc/mic/host/mic_virtio.c |
1607 | @@ -369,7 +369,7 @@ static irqreturn_t mic_virtio_intr_handler(int irq, void *data) |
1608 | struct mic_vdev *mvdev = data; |
1609 | struct mic_device *mdev = mvdev->mdev; |
1610 | |
1611 | - mdev->ops->ack_interrupt(mdev); |
1612 | + mdev->ops->intr_workarounds(mdev); |
1613 | schedule_work(&mvdev->virtio_bh_work); |
1614 | return IRQ_HANDLED; |
1615 | } |
1616 | diff --git a/drivers/misc/mic/host/mic_x100.c b/drivers/misc/mic/host/mic_x100.c |
1617 | index 0dfa8a81436e..5562fdd3ef4e 100644 |
1618 | --- a/drivers/misc/mic/host/mic_x100.c |
1619 | +++ b/drivers/misc/mic/host/mic_x100.c |
1620 | @@ -174,35 +174,38 @@ static void mic_x100_send_intr(struct mic_device *mdev, int doorbell) |
1621 | } |
1622 | |
1623 | /** |
1624 | - * mic_ack_interrupt - Device specific interrupt handling. |
1625 | - * @mdev: pointer to mic_device instance |
1626 | + * mic_x100_ack_interrupt - Read the interrupt sources register and |
1627 | + * clear it. This function will be called in the MSI/INTx case. |
1628 | + * @mdev: Pointer to mic_device instance. |
1629 | * |
1630 | - * Returns: bitmask of doorbell events triggered. |
1631 | + * Returns: bitmask of interrupt sources triggered. |
1632 | */ |
1633 | static u32 mic_x100_ack_interrupt(struct mic_device *mdev) |
1634 | { |
1635 | - u32 reg = 0; |
1636 | - struct mic_mw *mw = &mdev->mmio; |
1637 | u32 sicr0 = MIC_X100_SBOX_BASE_ADDRESS + MIC_X100_SBOX_SICR0; |
1638 | + u32 reg = mic_mmio_read(&mdev->mmio, sicr0); |
1639 | + mic_mmio_write(&mdev->mmio, reg, sicr0); |
1640 | + return reg; |
1641 | +} |
1642 | + |
1643 | +/** |
1644 | + * mic_x100_intr_workarounds - These hardware specific workarounds are |
1645 | + * to be invoked everytime an interrupt is handled. |
1646 | + * @mdev: Pointer to mic_device instance. |
1647 | + * |
1648 | + * Returns: none |
1649 | + */ |
1650 | +static void mic_x100_intr_workarounds(struct mic_device *mdev) |
1651 | +{ |
1652 | + struct mic_mw *mw = &mdev->mmio; |
1653 | |
1654 | /* Clear pending bit array. */ |
1655 | if (MIC_A0_STEP == mdev->stepping) |
1656 | mic_mmio_write(mw, 1, MIC_X100_SBOX_BASE_ADDRESS + |
1657 | MIC_X100_SBOX_MSIXPBACR); |
1658 | |
1659 | - if (mdev->irq_info.num_vectors <= 1) { |
1660 | - reg = mic_mmio_read(mw, sicr0); |
1661 | - |
1662 | - if (unlikely(!reg)) |
1663 | - goto done; |
1664 | - |
1665 | - mic_mmio_write(mw, reg, sicr0); |
1666 | - } |
1667 | - |
1668 | if (mdev->stepping >= MIC_B0_STEP) |
1669 | mdev->intr_ops->enable_interrupts(mdev); |
1670 | -done: |
1671 | - return reg; |
1672 | } |
1673 | |
1674 | /** |
1675 | @@ -553,6 +556,7 @@ struct mic_hw_ops mic_x100_ops = { |
1676 | .write_spad = mic_x100_write_spad, |
1677 | .send_intr = mic_x100_send_intr, |
1678 | .ack_interrupt = mic_x100_ack_interrupt, |
1679 | + .intr_workarounds = mic_x100_intr_workarounds, |
1680 | .reset = mic_x100_hw_reset, |
1681 | .reset_fw_ready = mic_x100_reset_fw_ready, |
1682 | .is_fw_ready = mic_x100_is_fw_ready, |
1683 | diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c |
1684 | index 461a4c3f4ef7..1dcaf8a32be7 100644 |
1685 | --- a/drivers/mmc/host/sdhci-esdhc-imx.c |
1686 | +++ b/drivers/mmc/host/sdhci-esdhc-imx.c |
1687 | @@ -558,19 +558,17 @@ static unsigned int esdhc_pltfm_get_max_clock(struct sdhci_host *host) |
1688 | struct pltfm_imx_data *imx_data = pltfm_host->priv; |
1689 | struct esdhc_platform_data *boarddata = &imx_data->boarddata; |
1690 | |
1691 | - u32 f_host = clk_get_rate(pltfm_host->clk); |
1692 | - |
1693 | - if (boarddata->f_max && (boarddata->f_max < f_host)) |
1694 | + if (boarddata->f_max && (boarddata->f_max < pltfm_host->clock)) |
1695 | return boarddata->f_max; |
1696 | else |
1697 | - return f_host; |
1698 | + return pltfm_host->clock; |
1699 | } |
1700 | |
1701 | static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host) |
1702 | { |
1703 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); |
1704 | |
1705 | - return clk_get_rate(pltfm_host->clk) / 256 / 16; |
1706 | + return pltfm_host->clock / 256 / 16; |
1707 | } |
1708 | |
1709 | static inline void esdhc_pltfm_set_clock(struct sdhci_host *host, |
1710 | @@ -578,7 +576,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host, |
1711 | { |
1712 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); |
1713 | struct pltfm_imx_data *imx_data = pltfm_host->priv; |
1714 | - unsigned int host_clock = clk_get_rate(pltfm_host->clk); |
1715 | + unsigned int host_clock = pltfm_host->clock; |
1716 | int pre_div = 2; |
1717 | int div = 1; |
1718 | u32 temp, val; |
1719 | @@ -976,7 +974,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) |
1720 | } |
1721 | |
1722 | pltfm_host->clk = imx_data->clk_per; |
1723 | - |
1724 | + pltfm_host->clock = clk_get_rate(pltfm_host->clk); |
1725 | clk_prepare_enable(imx_data->clk_per); |
1726 | clk_prepare_enable(imx_data->clk_ipg); |
1727 | clk_prepare_enable(imx_data->clk_ahb); |
1728 | diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c |
1729 | index 8f753811fc7a..c377c16ab0a2 100644 |
1730 | --- a/drivers/mmc/host/sdhci-pci.c |
1731 | +++ b/drivers/mmc/host/sdhci-pci.c |
1732 | @@ -381,6 +381,7 @@ static int intel_mrfl_mmc_probe_slot(struct sdhci_pci_slot *slot) |
1733 | |
1734 | static const struct sdhci_pci_fixes sdhci_intel_mrfl_mmc = { |
1735 | .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC, |
1736 | + .quirks2 = SDHCI_QUIRK2_BROKEN_HS200, |
1737 | .probe_slot = intel_mrfl_mmc_probe_slot, |
1738 | }; |
1739 | |
1740 | diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c |
1741 | index bd8a0982aec3..3c719209c2cc 100644 |
1742 | --- a/drivers/mmc/host/sdhci.c |
1743 | +++ b/drivers/mmc/host/sdhci.c |
1744 | @@ -1845,12 +1845,12 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) |
1745 | unsigned long timeout; |
1746 | int err = 0; |
1747 | bool requires_tuning_nonuhs = false; |
1748 | + unsigned long flags; |
1749 | |
1750 | host = mmc_priv(mmc); |
1751 | |
1752 | sdhci_runtime_pm_get(host); |
1753 | - disable_irq(host->irq); |
1754 | - spin_lock(&host->lock); |
1755 | + spin_lock_irqsave(&host->lock, flags); |
1756 | |
1757 | ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2); |
1758 | |
1759 | @@ -1870,15 +1870,13 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) |
1760 | requires_tuning_nonuhs) |
1761 | ctrl |= SDHCI_CTRL_EXEC_TUNING; |
1762 | else { |
1763 | - spin_unlock(&host->lock); |
1764 | - enable_irq(host->irq); |
1765 | + spin_unlock_irqrestore(&host->lock, flags); |
1766 | sdhci_runtime_pm_put(host); |
1767 | return 0; |
1768 | } |
1769 | |
1770 | if (host->ops->platform_execute_tuning) { |
1771 | - spin_unlock(&host->lock); |
1772 | - enable_irq(host->irq); |
1773 | + spin_unlock_irqrestore(&host->lock, flags); |
1774 | err = host->ops->platform_execute_tuning(host, opcode); |
1775 | sdhci_runtime_pm_put(host); |
1776 | return err; |
1777 | @@ -1951,15 +1949,12 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) |
1778 | host->cmd = NULL; |
1779 | host->mrq = NULL; |
1780 | |
1781 | - spin_unlock(&host->lock); |
1782 | - enable_irq(host->irq); |
1783 | - |
1784 | + spin_unlock_irqrestore(&host->lock, flags); |
1785 | /* Wait for Buffer Read Ready interrupt */ |
1786 | wait_event_interruptible_timeout(host->buf_ready_int, |
1787 | (host->tuning_done == 1), |
1788 | msecs_to_jiffies(50)); |
1789 | - disable_irq(host->irq); |
1790 | - spin_lock(&host->lock); |
1791 | + spin_lock_irqsave(&host->lock, flags); |
1792 | |
1793 | if (!host->tuning_done) { |
1794 | pr_info(DRIVER_NAME ": Timeout waiting for " |
1795 | @@ -2034,8 +2029,7 @@ out: |
1796 | err = 0; |
1797 | |
1798 | sdhci_clear_set_irqs(host, SDHCI_INT_DATA_AVAIL, ier); |
1799 | - spin_unlock(&host->lock); |
1800 | - enable_irq(host->irq); |
1801 | + spin_unlock_irqrestore(&host->lock, flags); |
1802 | sdhci_runtime_pm_put(host); |
1803 | |
1804 | return err; |
1805 | @@ -3004,7 +2998,8 @@ int sdhci_add_host(struct sdhci_host *host) |
1806 | /* SD3.0: SDR104 is supported so (for eMMC) the caps2 |
1807 | * field can be promoted to support HS200. |
1808 | */ |
1809 | - mmc->caps2 |= MMC_CAP2_HS200; |
1810 | + if (!(host->quirks2 & SDHCI_QUIRK2_BROKEN_HS200)) |
1811 | + mmc->caps2 |= MMC_CAP2_HS200; |
1812 | } else if (caps[1] & SDHCI_SUPPORT_SDR50) |
1813 | mmc->caps |= MMC_CAP_UHS_SDR50; |
1814 | |
1815 | diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c |
1816 | index ed384fee76ac..02479739eaa0 100644 |
1817 | --- a/drivers/net/vxlan.c |
1818 | +++ b/drivers/net/vxlan.c |
1819 | @@ -1047,6 +1047,15 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb) |
1820 | if (!vs) |
1821 | goto drop; |
1822 | |
1823 | + /* If the NIC driver gave us an encapsulated packet |
1824 | + * with the encapsulation mark, the device checksummed it |
1825 | + * for us. Otherwise force the upper layers to verify it. |
1826 | + */ |
1827 | + if (skb->ip_summed != CHECKSUM_UNNECESSARY || !skb->encapsulation) |
1828 | + skb->ip_summed = CHECKSUM_NONE; |
1829 | + |
1830 | + skb->encapsulation = 0; |
1831 | + |
1832 | vs->rcv(vs, skb, vxh->vx_vni); |
1833 | return 0; |
1834 | |
1835 | @@ -1105,17 +1114,6 @@ static void vxlan_rcv(struct vxlan_sock *vs, |
1836 | |
1837 | skb_reset_network_header(skb); |
1838 | |
1839 | - /* If the NIC driver gave us an encapsulated packet with |
1840 | - * CHECKSUM_UNNECESSARY and Rx checksum feature is enabled, |
1841 | - * leave the CHECKSUM_UNNECESSARY, the device checksummed it |
1842 | - * for us. Otherwise force the upper layers to verify it. |
1843 | - */ |
1844 | - if (skb->ip_summed != CHECKSUM_UNNECESSARY || !skb->encapsulation || |
1845 | - !(vxlan->dev->features & NETIF_F_RXCSUM)) |
1846 | - skb->ip_summed = CHECKSUM_NONE; |
1847 | - |
1848 | - skb->encapsulation = 0; |
1849 | - |
1850 | if (oip6) |
1851 | err = IP6_ECN_decapsulate(oip6, skb); |
1852 | if (oip) |
1853 | diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c |
1854 | index 8918035da3a3..e79a2cffb4fe 100644 |
1855 | --- a/drivers/net/wireless/ath/ath9k/hw.c |
1856 | +++ b/drivers/net/wireless/ath/ath9k/hw.c |
1857 | @@ -2608,13 +2608,6 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) |
1858 | ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) |
1859 | pCap->hw_caps |= ATH9K_HW_CAP_PAPRD; |
1860 | |
1861 | - /* |
1862 | - * Fast channel change across bands is available |
1863 | - * only for AR9462 and AR9565. |
1864 | - */ |
1865 | - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) |
1866 | - pCap->hw_caps |= ATH9K_HW_CAP_FCC_BAND_SWITCH; |
1867 | - |
1868 | return 0; |
1869 | } |
1870 | |
1871 | diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c |
1872 | index 95ddca5495d4..102060332dde 100644 |
1873 | --- a/drivers/net/wireless/ath/ath9k/recv.c |
1874 | +++ b/drivers/net/wireless/ath/ath9k/recv.c |
1875 | @@ -851,20 +851,15 @@ static int ath9k_process_rate(struct ath_common *common, |
1876 | enum ieee80211_band band; |
1877 | unsigned int i = 0; |
1878 | struct ath_softc __maybe_unused *sc = common->priv; |
1879 | + struct ath_hw *ah = sc->sc_ah; |
1880 | |
1881 | - band = hw->conf.chandef.chan->band; |
1882 | + band = ah->curchan->chan->band; |
1883 | sband = hw->wiphy->bands[band]; |
1884 | |
1885 | - switch (hw->conf.chandef.width) { |
1886 | - case NL80211_CHAN_WIDTH_5: |
1887 | + if (IS_CHAN_QUARTER_RATE(ah->curchan)) |
1888 | rxs->flag |= RX_FLAG_5MHZ; |
1889 | - break; |
1890 | - case NL80211_CHAN_WIDTH_10: |
1891 | + else if (IS_CHAN_HALF_RATE(ah->curchan)) |
1892 | rxs->flag |= RX_FLAG_10MHZ; |
1893 | - break; |
1894 | - default: |
1895 | - break; |
1896 | - } |
1897 | |
1898 | if (rx_stats->rs_rate & 0x80) { |
1899 | /* HT rate */ |
1900 | @@ -1248,6 +1243,14 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, |
1901 | ath_start_rx_poll(sc, 3); |
1902 | } |
1903 | |
1904 | + /* |
1905 | + * This shouldn't happen, but have a safety check anyway. |
1906 | + */ |
1907 | + if (WARN_ON(!ah->curchan)) { |
1908 | + ret = -EINVAL; |
1909 | + goto exit; |
1910 | + } |
1911 | + |
1912 | if (ath9k_process_rate(common, hw, rx_stats, rx_status)) { |
1913 | ret =-EINVAL; |
1914 | goto exit; |
1915 | @@ -1255,8 +1258,8 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, |
1916 | |
1917 | ath9k_process_rssi(common, hw, rx_stats, rx_status); |
1918 | |
1919 | - rx_status->band = hw->conf.chandef.chan->band; |
1920 | - rx_status->freq = hw->conf.chandef.chan->center_freq; |
1921 | + rx_status->band = ah->curchan->chan->band; |
1922 | + rx_status->freq = ah->curchan->chan->center_freq; |
1923 | rx_status->antenna = rx_stats->rs_antenna; |
1924 | rx_status->flag |= RX_FLAG_MACTIME_END; |
1925 | |
1926 | diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h |
1927 | index 7f3d461f7e8d..54376fddfaf9 100644 |
1928 | --- a/drivers/net/wireless/b43/b43.h |
1929 | +++ b/drivers/net/wireless/b43/b43.h |
1930 | @@ -731,8 +731,6 @@ enum b43_firmware_file_type { |
1931 | struct b43_request_fw_context { |
1932 | /* The device we are requesting the fw for. */ |
1933 | struct b43_wldev *dev; |
1934 | - /* a completion event structure needed if this call is asynchronous */ |
1935 | - struct completion fw_load_complete; |
1936 | /* a pointer to the firmware object */ |
1937 | const struct firmware *blob; |
1938 | /* The type of firmware to request. */ |
1939 | @@ -809,6 +807,8 @@ enum { |
1940 | struct b43_wldev { |
1941 | struct b43_bus_dev *dev; |
1942 | struct b43_wl *wl; |
1943 | + /* a completion event structure needed if this call is asynchronous */ |
1944 | + struct completion fw_load_complete; |
1945 | |
1946 | /* The device initialization status. |
1947 | * Use b43_status() to query. */ |
1948 | diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c |
1949 | index ccd24f0acb8d..c75237eb55a1 100644 |
1950 | --- a/drivers/net/wireless/b43/main.c |
1951 | +++ b/drivers/net/wireless/b43/main.c |
1952 | @@ -2070,6 +2070,7 @@ void b43_do_release_fw(struct b43_firmware_file *fw) |
1953 | |
1954 | static void b43_release_firmware(struct b43_wldev *dev) |
1955 | { |
1956 | + complete(&dev->fw_load_complete); |
1957 | b43_do_release_fw(&dev->fw.ucode); |
1958 | b43_do_release_fw(&dev->fw.pcm); |
1959 | b43_do_release_fw(&dev->fw.initvals); |
1960 | @@ -2095,7 +2096,7 @@ static void b43_fw_cb(const struct firmware *firmware, void *context) |
1961 | struct b43_request_fw_context *ctx = context; |
1962 | |
1963 | ctx->blob = firmware; |
1964 | - complete(&ctx->fw_load_complete); |
1965 | + complete(&ctx->dev->fw_load_complete); |
1966 | } |
1967 | |
1968 | int b43_do_request_fw(struct b43_request_fw_context *ctx, |
1969 | @@ -2142,7 +2143,7 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx, |
1970 | } |
1971 | if (async) { |
1972 | /* do this part asynchronously */ |
1973 | - init_completion(&ctx->fw_load_complete); |
1974 | + init_completion(&ctx->dev->fw_load_complete); |
1975 | err = request_firmware_nowait(THIS_MODULE, 1, ctx->fwname, |
1976 | ctx->dev->dev->dev, GFP_KERNEL, |
1977 | ctx, b43_fw_cb); |
1978 | @@ -2150,12 +2151,11 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx, |
1979 | pr_err("Unable to load firmware\n"); |
1980 | return err; |
1981 | } |
1982 | - /* stall here until fw ready */ |
1983 | - wait_for_completion(&ctx->fw_load_complete); |
1984 | + wait_for_completion(&ctx->dev->fw_load_complete); |
1985 | if (ctx->blob) |
1986 | goto fw_ready; |
1987 | /* On some ARM systems, the async request will fail, but the next sync |
1988 | - * request works. For this reason, we dall through here |
1989 | + * request works. For this reason, we fall through here |
1990 | */ |
1991 | } |
1992 | err = request_firmware(&ctx->blob, ctx->fwname, |
1993 | @@ -2424,6 +2424,7 @@ error: |
1994 | |
1995 | static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl); |
1996 | static void b43_one_core_detach(struct b43_bus_dev *dev); |
1997 | +static int b43_rng_init(struct b43_wl *wl); |
1998 | |
1999 | static void b43_request_firmware(struct work_struct *work) |
2000 | { |
2001 | @@ -2475,6 +2476,10 @@ start_ieee80211: |
2002 | goto err_one_core_detach; |
2003 | wl->hw_registred = true; |
2004 | b43_leds_register(wl->current_dev); |
2005 | + |
2006 | + /* Register HW RNG driver */ |
2007 | + b43_rng_init(wl); |
2008 | + |
2009 | goto out; |
2010 | |
2011 | err_one_core_detach: |
2012 | @@ -4636,9 +4641,6 @@ static void b43_wireless_core_exit(struct b43_wldev *dev) |
2013 | if (!dev || b43_status(dev) != B43_STAT_INITIALIZED) |
2014 | return; |
2015 | |
2016 | - /* Unregister HW RNG driver */ |
2017 | - b43_rng_exit(dev->wl); |
2018 | - |
2019 | b43_set_status(dev, B43_STAT_UNINIT); |
2020 | |
2021 | /* Stop the microcode PSM. */ |
2022 | @@ -4795,9 +4797,6 @@ static int b43_wireless_core_init(struct b43_wldev *dev) |
2023 | |
2024 | b43_set_status(dev, B43_STAT_INITIALIZED); |
2025 | |
2026 | - /* Register HW RNG driver */ |
2027 | - b43_rng_init(dev->wl); |
2028 | - |
2029 | out: |
2030 | return err; |
2031 | |
2032 | @@ -5464,6 +5463,9 @@ static void b43_bcma_remove(struct bcma_device *core) |
2033 | |
2034 | b43_one_core_detach(wldev->dev); |
2035 | |
2036 | + /* Unregister HW RNG driver */ |
2037 | + b43_rng_exit(wl); |
2038 | + |
2039 | b43_leds_unregister(wl); |
2040 | |
2041 | ieee80211_free_hw(wl->hw); |
2042 | @@ -5541,6 +5543,9 @@ static void b43_ssb_remove(struct ssb_device *sdev) |
2043 | |
2044 | b43_one_core_detach(dev); |
2045 | |
2046 | + /* Unregister HW RNG driver */ |
2047 | + b43_rng_exit(wl); |
2048 | + |
2049 | if (list_empty(&wl->devlist)) { |
2050 | b43_leds_unregister(wl); |
2051 | /* Last core on the chip unregistered. |
2052 | diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c |
2053 | index 4ae63f4ddfb2..50e5ddb12fb3 100644 |
2054 | --- a/drivers/net/wireless/b43/xmit.c |
2055 | +++ b/drivers/net/wireless/b43/xmit.c |
2056 | @@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) |
2057 | * channel number in b43. */ |
2058 | if (chanstat & B43_RX_CHAN_5GHZ) { |
2059 | status.band = IEEE80211_BAND_5GHZ; |
2060 | - status.freq = b43_freq_to_channel_5ghz(chanid); |
2061 | + status.freq = b43_channel_to_freq_5ghz(chanid); |
2062 | } else { |
2063 | status.band = IEEE80211_BAND_2GHZ; |
2064 | - status.freq = b43_freq_to_channel_2ghz(chanid); |
2065 | + status.freq = b43_channel_to_freq_2ghz(chanid); |
2066 | } |
2067 | break; |
2068 | default: |
2069 | diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c |
2070 | index 572668821862..349c77605231 100644 |
2071 | --- a/drivers/net/wireless/b43legacy/main.c |
2072 | +++ b/drivers/net/wireless/b43legacy/main.c |
2073 | @@ -3919,6 +3919,7 @@ static void b43legacy_remove(struct ssb_device *dev) |
2074 | * as the ieee80211 unreg will destroy the workqueue. */ |
2075 | cancel_work_sync(&wldev->restart_work); |
2076 | cancel_work_sync(&wl->firmware_load); |
2077 | + complete(&wldev->fw_load_complete); |
2078 | |
2079 | B43legacy_WARN_ON(!wl); |
2080 | if (!wldev->fw.ucode) |
2081 | diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h |
2082 | index a70c7b9d9bad..07867c60bd63 100644 |
2083 | --- a/drivers/net/wireless/iwlwifi/iwl-prph.h |
2084 | +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h |
2085 | @@ -274,4 +274,8 @@ static inline unsigned int SCD_QUEUE_STATUS_BITS(unsigned int chnl) |
2086 | |
2087 | /*********************** END TX SCHEDULER *************************************/ |
2088 | |
2089 | +/* Oscillator clock */ |
2090 | +#define OSC_CLK (0xa04068) |
2091 | +#define OSC_CLK_FORCE_CONTROL (0x8) |
2092 | + |
2093 | #endif /* __iwl_prph_h__ */ |
2094 | diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c |
2095 | index d86083c6f445..bb5834200194 100644 |
2096 | --- a/drivers/net/wireless/iwlwifi/mvm/ops.c |
2097 | +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c |
2098 | @@ -470,6 +470,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, |
2099 | |
2100 | out_unregister: |
2101 | ieee80211_unregister_hw(mvm->hw); |
2102 | + iwl_mvm_leds_exit(mvm); |
2103 | out_free: |
2104 | iwl_phy_db_free(mvm->phy_db); |
2105 | kfree(mvm->scan_cmd); |
2106 | diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c |
2107 | index cde9c16f6e4f..f53ef83a6fd4 100644 |
2108 | --- a/drivers/net/wireless/iwlwifi/pcie/trans.c |
2109 | +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c |
2110 | @@ -206,6 +206,28 @@ static int iwl_pcie_apm_init(struct iwl_trans *trans) |
2111 | goto out; |
2112 | } |
2113 | |
2114 | + if (trans->cfg->host_interrupt_operation_mode) { |
2115 | + /* |
2116 | + * This is a bit of an abuse - This is needed for 7260 / 3160 |
2117 | + * only check host_interrupt_operation_mode even if this is |
2118 | + * not related to host_interrupt_operation_mode. |
2119 | + * |
2120 | + * Enable the oscillator to count wake up time for L1 exit. This |
2121 | + * consumes slightly more power (100uA) - but allows to be sure |
2122 | + * that we wake up from L1 on time. |
2123 | + * |
2124 | + * This looks weird: read twice the same register, discard the |
2125 | + * value, set a bit, and yet again, read that same register |
2126 | + * just to discard the value. But that's the way the hardware |
2127 | + * seems to like it. |
2128 | + */ |
2129 | + iwl_read_prph(trans, OSC_CLK); |
2130 | + iwl_read_prph(trans, OSC_CLK); |
2131 | + iwl_set_bits_prph(trans, OSC_CLK, OSC_CLK_FORCE_CONTROL); |
2132 | + iwl_read_prph(trans, OSC_CLK); |
2133 | + iwl_read_prph(trans, OSC_CLK); |
2134 | + } |
2135 | + |
2136 | /* |
2137 | * Enable DMA clock and wait for it to stabilize. |
2138 | * |
2139 | diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h |
2140 | index c8385ec77a86..7099b0e8add7 100644 |
2141 | --- a/drivers/net/wireless/mwifiex/fw.h |
2142 | +++ b/drivers/net/wireless/mwifiex/fw.h |
2143 | @@ -226,7 +226,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { |
2144 | |
2145 | /* HW_SPEC fw_cap_info */ |
2146 | |
2147 | -#define ISSUPP_11ACENABLED(fw_cap_info) (fw_cap_info & (BIT(13)|BIT(14))) |
2148 | +#define ISSUPP_11ACENABLED(fw_cap_info) (fw_cap_info & (BIT(12)|BIT(13))) |
2149 | |
2150 | #define GET_VHTCAP_CHWDSET(vht_cap_info) ((vht_cap_info >> 2) & 0x3) |
2151 | #define GET_VHTNSSMCS(mcs_mapset, nss) ((mcs_mapset >> (2 * (nss - 1))) & 0x3) |
2152 | diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c |
2153 | index 8cf7d50a7603..ba48e64673d9 100644 |
2154 | --- a/drivers/net/wireless/mwifiex/scan.c |
2155 | +++ b/drivers/net/wireless/mwifiex/scan.c |
2156 | @@ -1681,7 +1681,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, |
2157 | const u8 *ie_buf; |
2158 | size_t ie_len; |
2159 | u16 channel = 0; |
2160 | - u64 fw_tsf = 0; |
2161 | + __le64 fw_tsf = 0; |
2162 | u16 beacon_size = 0; |
2163 | u32 curr_bcn_bytes; |
2164 | u32 freq; |
2165 | @@ -1815,7 +1815,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, |
2166 | ie_buf, ie_len, rssi, GFP_KERNEL); |
2167 | bss_priv = (struct mwifiex_bss_priv *)bss->priv; |
2168 | bss_priv->band = band; |
2169 | - bss_priv->fw_tsf = fw_tsf; |
2170 | + bss_priv->fw_tsf = le64_to_cpu(fw_tsf); |
2171 | if (priv->media_connected && |
2172 | !memcmp(bssid, |
2173 | priv->curr_bss_params.bss_descriptor |
2174 | diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c |
2175 | index ff784072fb42..fcf9b621918c 100644 |
2176 | --- a/drivers/net/wireless/rtlwifi/base.c |
2177 | +++ b/drivers/net/wireless/rtlwifi/base.c |
2178 | @@ -1437,7 +1437,8 @@ void rtl_watchdog_wq_callback(void *data) |
2179 | /* if we can't recv beacon for 6s, we should |
2180 | * reconnect this AP |
2181 | */ |
2182 | - if (rtlpriv->link_info.roam_times >= 3) { |
2183 | + if ((rtlpriv->link_info.roam_times >= 3) && |
2184 | + !is_zero_ether_addr(rtlpriv->mac80211.bssid)) { |
2185 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, |
2186 | "AP off, try to reconnect now\n"); |
2187 | rtlpriv->link_info.roam_times = 0; |
2188 | diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c |
2189 | index 210ce7cd94d8..2d337a0c3df0 100644 |
2190 | --- a/drivers/net/wireless/rtlwifi/core.c |
2191 | +++ b/drivers/net/wireless/rtlwifi/core.c |
2192 | @@ -46,10 +46,20 @@ void rtl_fw_cb(const struct firmware *firmware, void *context) |
2193 | "Firmware callback routine entered!\n"); |
2194 | complete(&rtlpriv->firmware_loading_complete); |
2195 | if (!firmware) { |
2196 | + if (rtlpriv->cfg->alt_fw_name) { |
2197 | + err = request_firmware(&firmware, |
2198 | + rtlpriv->cfg->alt_fw_name, |
2199 | + rtlpriv->io.dev); |
2200 | + pr_info("Loading alternative firmware %s\n", |
2201 | + rtlpriv->cfg->alt_fw_name); |
2202 | + if (!err) |
2203 | + goto found_alt; |
2204 | + } |
2205 | pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name); |
2206 | rtlpriv->max_fw_size = 0; |
2207 | return; |
2208 | } |
2209 | +found_alt: |
2210 | if (firmware->size > rtlpriv->max_fw_size) { |
2211 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, |
2212 | "Firmware is too big!\n"); |
2213 | @@ -184,6 +194,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw, |
2214 | rtlpriv->cfg->maps |
2215 | [RTL_IBSS_INT_MASKS]); |
2216 | } |
2217 | + mac->link_state = MAC80211_LINKED; |
2218 | break; |
2219 | case NL80211_IFTYPE_ADHOC: |
2220 | RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, |
2221 | diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/dm.c b/drivers/net/wireless/rtlwifi/rtl8188ee/dm.c |
2222 | index 21a5cf060677..a6184b6e1d57 100644 |
2223 | --- a/drivers/net/wireless/rtlwifi/rtl8188ee/dm.c |
2224 | +++ b/drivers/net/wireless/rtlwifi/rtl8188ee/dm.c |
2225 | @@ -1078,7 +1078,7 @@ static void rtl88e_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw |
2226 | rtldm->swing_flag_ofdm = true; |
2227 | } |
2228 | |
2229 | - if (rtldm->swing_idx_cck != rtldm->swing_idx_cck) { |
2230 | + if (rtldm->swing_idx_cck_cur != rtldm->swing_idx_cck) { |
2231 | rtldm->swing_idx_cck_cur = rtldm->swing_idx_cck; |
2232 | rtldm->swing_flag_cck = true; |
2233 | } |
2234 | diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c |
2235 | index e9caa5d4cff0..fd7e4a7c94de 100644 |
2236 | --- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c |
2237 | +++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c |
2238 | @@ -158,6 +158,42 @@ static const u8 cckswing_table_ch14[CCK_TABLE_SIZE][8] = { |
2239 | {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00} |
2240 | }; |
2241 | |
2242 | +static u32 power_index_reg[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a}; |
2243 | + |
2244 | +void dm_restorepowerindex(struct ieee80211_hw *hw) |
2245 | +{ |
2246 | + struct rtl_priv *rtlpriv = rtl_priv(hw); |
2247 | + u8 index; |
2248 | + |
2249 | + for (index = 0; index < 6; index++) |
2250 | + rtl_write_byte(rtlpriv, power_index_reg[index], |
2251 | + rtlpriv->dm.powerindex_backup[index]); |
2252 | +} |
2253 | +EXPORT_SYMBOL_GPL(dm_restorepowerindex); |
2254 | + |
2255 | +void dm_writepowerindex(struct ieee80211_hw *hw, u8 value) |
2256 | +{ |
2257 | + struct rtl_priv *rtlpriv = rtl_priv(hw); |
2258 | + u8 index; |
2259 | + |
2260 | + for (index = 0; index < 6; index++) |
2261 | + rtl_write_byte(rtlpriv, power_index_reg[index], value); |
2262 | +} |
2263 | +EXPORT_SYMBOL_GPL(dm_writepowerindex); |
2264 | + |
2265 | +void dm_savepowerindex(struct ieee80211_hw *hw) |
2266 | +{ |
2267 | + struct rtl_priv *rtlpriv = rtl_priv(hw); |
2268 | + u8 index; |
2269 | + u8 tmp; |
2270 | + |
2271 | + for (index = 0; index < 6; index++) { |
2272 | + tmp = rtl_read_byte(rtlpriv, power_index_reg[index]); |
2273 | + rtlpriv->dm.powerindex_backup[index] = tmp; |
2274 | + } |
2275 | +} |
2276 | +EXPORT_SYMBOL_GPL(dm_savepowerindex); |
2277 | + |
2278 | static void rtl92c_dm_diginit(struct ieee80211_hw *hw) |
2279 | { |
2280 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
2281 | @@ -180,7 +216,12 @@ static void rtl92c_dm_diginit(struct ieee80211_hw *hw) |
2282 | dm_digtable->back_range_max = DM_DIG_BACKOFF_MAX; |
2283 | dm_digtable->back_range_min = DM_DIG_BACKOFF_MIN; |
2284 | dm_digtable->pre_cck_pd_state = CCK_PD_STAGE_MAX; |
2285 | - dm_digtable->cur_cck_pd_state = CCK_PD_STAGE_MAX; |
2286 | + dm_digtable->cur_cck_pd_state = CCK_PD_STAGE_LowRssi; |
2287 | + |
2288 | + dm_digtable->forbidden_igi = DM_DIG_MIN; |
2289 | + dm_digtable->large_fa_hit = 0; |
2290 | + dm_digtable->recover_cnt = 0; |
2291 | + dm_digtable->dig_dynamic_min = 0x25; |
2292 | } |
2293 | |
2294 | static u8 rtl92c_dm_initial_gain_min_pwdb(struct ieee80211_hw *hw) |
2295 | @@ -206,7 +247,9 @@ static u8 rtl92c_dm_initial_gain_min_pwdb(struct ieee80211_hw *hw) |
2296 | rssi_val_min = rtlpriv->dm.entry_min_undec_sm_pwdb; |
2297 | } |
2298 | |
2299 | - return (u8) rssi_val_min; |
2300 | + if (rssi_val_min > 100) |
2301 | + rssi_val_min = 100; |
2302 | + return (u8)rssi_val_min; |
2303 | } |
2304 | |
2305 | static void rtl92c_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) |
2306 | @@ -224,9 +267,17 @@ static void rtl92c_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) |
2307 | |
2308 | ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER3, MASKDWORD); |
2309 | falsealm_cnt->cnt_mcs_fail = (ret_value & 0xffff); |
2310 | + |
2311 | + ret_value = rtl_get_bbreg(hw, ROFDM0_FRAMESYNC, MASKDWORD); |
2312 | + falsealm_cnt->cnt_fast_fsync_fail = (ret_value & 0xffff); |
2313 | + falsealm_cnt->cnt_sb_search_fail = ((ret_value & 0xffff0000) >> 16); |
2314 | + |
2315 | falsealm_cnt->cnt_ofdm_fail = falsealm_cnt->cnt_parity_fail + |
2316 | - falsealm_cnt->cnt_rate_illegal + |
2317 | - falsealm_cnt->cnt_crc8_fail + falsealm_cnt->cnt_mcs_fail; |
2318 | + falsealm_cnt->cnt_rate_illegal + |
2319 | + falsealm_cnt->cnt_crc8_fail + |
2320 | + falsealm_cnt->cnt_mcs_fail + |
2321 | + falsealm_cnt->cnt_fast_fsync_fail + |
2322 | + falsealm_cnt->cnt_sb_search_fail; |
2323 | |
2324 | rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, BIT(14), 1); |
2325 | ret_value = rtl_get_bbreg(hw, RCCK0_FACOUNTERLOWER, MASKBYTE0); |
2326 | @@ -271,12 +322,14 @@ static void rtl92c_dm_ctrl_initgain_by_fa(struct ieee80211_hw *hw) |
2327 | value_igi++; |
2328 | else if (rtlpriv->falsealm_cnt.cnt_all >= DM_DIG_FA_TH2) |
2329 | value_igi += 2; |
2330 | + |
2331 | if (value_igi > DM_DIG_FA_UPPER) |
2332 | value_igi = DM_DIG_FA_UPPER; |
2333 | else if (value_igi < DM_DIG_FA_LOWER) |
2334 | value_igi = DM_DIG_FA_LOWER; |
2335 | + |
2336 | if (rtlpriv->falsealm_cnt.cnt_all > 10000) |
2337 | - value_igi = 0x32; |
2338 | + value_igi = DM_DIG_FA_UPPER; |
2339 | |
2340 | dm_digtable->cur_igvalue = value_igi; |
2341 | rtl92c_dm_write_dig(hw); |
2342 | @@ -286,32 +339,80 @@ static void rtl92c_dm_ctrl_initgain_by_rssi(struct ieee80211_hw *hw) |
2343 | { |
2344 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
2345 | struct dig_t *digtable = &rtlpriv->dm_digtable; |
2346 | + u32 isbt; |
2347 | + |
2348 | + /* modify DIG lower bound, deal with abnorally large false alarm */ |
2349 | + if (rtlpriv->falsealm_cnt.cnt_all > 10000) { |
2350 | + digtable->large_fa_hit++; |
2351 | + if (digtable->forbidden_igi < digtable->cur_igvalue) { |
2352 | + digtable->forbidden_igi = digtable->cur_igvalue; |
2353 | + digtable->large_fa_hit = 1; |
2354 | + } |
2355 | |
2356 | - if (rtlpriv->falsealm_cnt.cnt_all > digtable->fa_highthresh) { |
2357 | - if ((digtable->back_val - 2) < digtable->back_range_min) |
2358 | - digtable->back_val = digtable->back_range_min; |
2359 | - else |
2360 | - digtable->back_val -= 2; |
2361 | - } else if (rtlpriv->falsealm_cnt.cnt_all < digtable->fa_lowthresh) { |
2362 | - if ((digtable->back_val + 2) > digtable->back_range_max) |
2363 | - digtable->back_val = digtable->back_range_max; |
2364 | - else |
2365 | - digtable->back_val += 2; |
2366 | + if (digtable->large_fa_hit >= 3) { |
2367 | + if ((digtable->forbidden_igi + 1) > |
2368 | + digtable->rx_gain_max) |
2369 | + digtable->rx_gain_min = digtable->rx_gain_max; |
2370 | + else |
2371 | + digtable->rx_gain_min = (digtable->forbidden_igi + 1); |
2372 | + digtable->recover_cnt = 3600; /* 3600=2hr */ |
2373 | + } |
2374 | + } else { |
2375 | + /* Recovery mechanism for IGI lower bound */ |
2376 | + if (digtable->recover_cnt != 0) { |
2377 | + digtable->recover_cnt--; |
2378 | + } else { |
2379 | + if (digtable->large_fa_hit == 0) { |
2380 | + if ((digtable->forbidden_igi-1) < DM_DIG_MIN) { |
2381 | + digtable->forbidden_igi = DM_DIG_MIN; |
2382 | + digtable->rx_gain_min = DM_DIG_MIN; |
2383 | + } else { |
2384 | + digtable->forbidden_igi--; |
2385 | + digtable->rx_gain_min = digtable->forbidden_igi + 1; |
2386 | + } |
2387 | + } else if (digtable->large_fa_hit == 3) { |
2388 | + digtable->large_fa_hit = 0; |
2389 | + } |
2390 | + } |
2391 | + } |
2392 | + if (rtlpriv->falsealm_cnt.cnt_all < 250) { |
2393 | + isbt = rtl_read_byte(rtlpriv, 0x4fd) & 0x01; |
2394 | + |
2395 | + if (!isbt) { |
2396 | + if (rtlpriv->falsealm_cnt.cnt_all > |
2397 | + digtable->fa_lowthresh) { |
2398 | + if ((digtable->back_val - 2) < |
2399 | + digtable->back_range_min) |
2400 | + digtable->back_val = digtable->back_range_min; |
2401 | + else |
2402 | + digtable->back_val -= 2; |
2403 | + } else if (rtlpriv->falsealm_cnt.cnt_all < |
2404 | + digtable->fa_lowthresh) { |
2405 | + if ((digtable->back_val + 2) > |
2406 | + digtable->back_range_max) |
2407 | + digtable->back_val = digtable->back_range_max; |
2408 | + else |
2409 | + digtable->back_val += 2; |
2410 | + } |
2411 | + } else { |
2412 | + digtable->back_val = DM_DIG_BACKOFF_DEFAULT; |
2413 | + } |
2414 | + } else { |
2415 | + /* Adjust initial gain by false alarm */ |
2416 | + if (rtlpriv->falsealm_cnt.cnt_all > 1000) |
2417 | + digtable->cur_igvalue = digtable->pre_igvalue + 2; |
2418 | + else if (rtlpriv->falsealm_cnt.cnt_all > 750) |
2419 | + digtable->cur_igvalue = digtable->pre_igvalue + 1; |
2420 | + else if (rtlpriv->falsealm_cnt.cnt_all < 500) |
2421 | + digtable->cur_igvalue = digtable->pre_igvalue - 1; |
2422 | } |
2423 | |
2424 | - if ((digtable->rssi_val_min + 10 - digtable->back_val) > |
2425 | - digtable->rx_gain_max) |
2426 | + /* Check initial gain by upper/lower bound */ |
2427 | + if (digtable->cur_igvalue > digtable->rx_gain_max) |
2428 | digtable->cur_igvalue = digtable->rx_gain_max; |
2429 | - else if ((digtable->rssi_val_min + 10 - |
2430 | - digtable->back_val) < digtable->rx_gain_min) |
2431 | - digtable->cur_igvalue = digtable->rx_gain_min; |
2432 | - else |
2433 | - digtable->cur_igvalue = digtable->rssi_val_min + 10 - |
2434 | - digtable->back_val; |
2435 | |
2436 | - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, |
2437 | - "rssi_val_min = %x back_val %x\n", |
2438 | - digtable->rssi_val_min, digtable->back_val); |
2439 | + if (digtable->cur_igvalue < digtable->rx_gain_min) |
2440 | + digtable->cur_igvalue = digtable->rx_gain_min; |
2441 | |
2442 | rtl92c_dm_write_dig(hw); |
2443 | } |
2444 | @@ -329,7 +430,7 @@ static void rtl92c_dm_initial_gain_multi_sta(struct ieee80211_hw *hw) |
2445 | multi_sta = true; |
2446 | |
2447 | if (!multi_sta || |
2448 | - dm_digtable->cursta_cstate != DIG_STA_DISCONNECT) { |
2449 | + dm_digtable->cursta_cstate == DIG_STA_DISCONNECT) { |
2450 | initialized = false; |
2451 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; |
2452 | return; |
2453 | @@ -375,7 +476,6 @@ static void rtl92c_dm_initial_gain_sta(struct ieee80211_hw *hw) |
2454 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, |
2455 | "presta_cstate = %x, cursta_cstate = %x\n", |
2456 | dm_digtable->presta_cstate, dm_digtable->cursta_cstate); |
2457 | - |
2458 | if (dm_digtable->presta_cstate == dm_digtable->cursta_cstate || |
2459 | dm_digtable->cursta_cstate == DIG_STA_BEFORE_CONNECT || |
2460 | dm_digtable->cursta_cstate == DIG_STA_CONNECT) { |
2461 | @@ -383,6 +483,8 @@ static void rtl92c_dm_initial_gain_sta(struct ieee80211_hw *hw) |
2462 | if (dm_digtable->cursta_cstate != DIG_STA_DISCONNECT) { |
2463 | dm_digtable->rssi_val_min = |
2464 | rtl92c_dm_initial_gain_min_pwdb(hw); |
2465 | + if (dm_digtable->rssi_val_min > 100) |
2466 | + dm_digtable->rssi_val_min = 100; |
2467 | rtl92c_dm_ctrl_initgain_by_rssi(hw); |
2468 | } |
2469 | } else { |
2470 | @@ -398,11 +500,12 @@ static void rtl92c_dm_initial_gain_sta(struct ieee80211_hw *hw) |
2471 | static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) |
2472 | { |
2473 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
2474 | - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
2475 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; |
2476 | |
2477 | if (dm_digtable->cursta_cstate == DIG_STA_CONNECT) { |
2478 | dm_digtable->rssi_val_min = rtl92c_dm_initial_gain_min_pwdb(hw); |
2479 | + if (dm_digtable->rssi_val_min > 100) |
2480 | + dm_digtable->rssi_val_min = 100; |
2481 | |
2482 | if (dm_digtable->pre_cck_pd_state == CCK_PD_STAGE_LowRssi) { |
2483 | if (dm_digtable->rssi_val_min <= 25) |
2484 | @@ -424,48 +527,14 @@ static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) |
2485 | } |
2486 | |
2487 | if (dm_digtable->pre_cck_pd_state != dm_digtable->cur_cck_pd_state) { |
2488 | - if (dm_digtable->cur_cck_pd_state == CCK_PD_STAGE_LowRssi) { |
2489 | - if (rtlpriv->falsealm_cnt.cnt_cck_fail > 800) |
2490 | - dm_digtable->cur_cck_fa_state = |
2491 | - CCK_FA_STAGE_High; |
2492 | - else |
2493 | - dm_digtable->cur_cck_fa_state = CCK_FA_STAGE_Low; |
2494 | - |
2495 | - if (dm_digtable->pre_cck_fa_state != |
2496 | - dm_digtable->cur_cck_fa_state) { |
2497 | - if (dm_digtable->cur_cck_fa_state == |
2498 | - CCK_FA_STAGE_Low) |
2499 | - rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, |
2500 | - 0x83); |
2501 | - else |
2502 | - rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, |
2503 | - 0xcd); |
2504 | - |
2505 | - dm_digtable->pre_cck_fa_state = |
2506 | - dm_digtable->cur_cck_fa_state; |
2507 | - } |
2508 | - |
2509 | - rtl_set_bbreg(hw, RCCK0_SYSTEM, MASKBYTE1, 0x40); |
2510 | - |
2511 | - if (IS_92C_SERIAL(rtlhal->version)) |
2512 | - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, |
2513 | - MASKBYTE2, 0xd7); |
2514 | - } else { |
2515 | + if ((dm_digtable->cur_cck_pd_state == CCK_PD_STAGE_LowRssi) || |
2516 | + (dm_digtable->cur_cck_pd_state == CCK_PD_STAGE_MAX)) |
2517 | + rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, 0x83); |
2518 | + else |
2519 | rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, 0xcd); |
2520 | - rtl_set_bbreg(hw, RCCK0_SYSTEM, MASKBYTE1, 0x47); |
2521 | |
2522 | - if (IS_92C_SERIAL(rtlhal->version)) |
2523 | - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, |
2524 | - MASKBYTE2, 0xd3); |
2525 | - } |
2526 | dm_digtable->pre_cck_pd_state = dm_digtable->cur_cck_pd_state; |
2527 | } |
2528 | - |
2529 | - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "CCKPDStage=%x\n", |
2530 | - dm_digtable->cur_cck_pd_state); |
2531 | - |
2532 | - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "is92C=%x\n", |
2533 | - IS_92C_SERIAL(rtlhal->version)); |
2534 | } |
2535 | |
2536 | static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw) |
2537 | @@ -482,6 +551,8 @@ static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw) |
2538 | else |
2539 | dm_digtable->cursta_cstate = DIG_STA_DISCONNECT; |
2540 | |
2541 | + dm_digtable->curmultista_cstate = DIG_MULTISTA_DISCONNECT; |
2542 | + |
2543 | rtl92c_dm_initial_gain_sta(hw); |
2544 | rtl92c_dm_initial_gain_multi_sta(hw); |
2545 | rtl92c_dm_cck_packet_detection_thresh(hw); |
2546 | @@ -493,23 +564,26 @@ static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw) |
2547 | static void rtl92c_dm_dig(struct ieee80211_hw *hw) |
2548 | { |
2549 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
2550 | - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; |
2551 | |
2552 | if (rtlpriv->dm.dm_initialgain_enable == false) |
2553 | return; |
2554 | - if (dm_digtable->dig_enable_flag == false) |
2555 | + if (!rtlpriv->dm.dm_flag & DYNAMIC_FUNC_DIG) |
2556 | return; |
2557 | |
2558 | rtl92c_dm_ctrl_initgain_by_twoport(hw); |
2559 | - |
2560 | } |
2561 | |
2562 | static void rtl92c_dm_init_dynamic_txpower(struct ieee80211_hw *hw) |
2563 | { |
2564 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
2565 | |
2566 | - rtlpriv->dm.dynamic_txpower_enable = false; |
2567 | - |
2568 | + if (rtlpriv->rtlhal.interface == INTF_USB && |
2569 | + rtlpriv->rtlhal.board_type & 0x1) { |
2570 | + dm_savepowerindex(hw); |
2571 | + rtlpriv->dm.dynamic_txpower_enable = true; |
2572 | + } else { |
2573 | + rtlpriv->dm.dynamic_txpower_enable = false; |
2574 | + } |
2575 | rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; |
2576 | rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; |
2577 | } |
2578 | @@ -524,9 +598,14 @@ void rtl92c_dm_write_dig(struct ieee80211_hw *hw) |
2579 | dm_digtable->cur_igvalue, dm_digtable->pre_igvalue, |
2580 | dm_digtable->back_val); |
2581 | |
2582 | - dm_digtable->cur_igvalue += 2; |
2583 | - if (dm_digtable->cur_igvalue > 0x3f) |
2584 | - dm_digtable->cur_igvalue = 0x3f; |
2585 | + if (rtlpriv->rtlhal.interface == INTF_USB && |
2586 | + !dm_digtable->dig_enable_flag) { |
2587 | + dm_digtable->pre_igvalue = 0x17; |
2588 | + return; |
2589 | + } |
2590 | + dm_digtable->cur_igvalue -= 1; |
2591 | + if (dm_digtable->cur_igvalue < DM_DIG_MIN) |
2592 | + dm_digtable->cur_igvalue = DM_DIG_MIN; |
2593 | |
2594 | if (dm_digtable->pre_igvalue != dm_digtable->cur_igvalue) { |
2595 | rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, |
2596 | @@ -536,11 +615,47 @@ void rtl92c_dm_write_dig(struct ieee80211_hw *hw) |
2597 | |
2598 | dm_digtable->pre_igvalue = dm_digtable->cur_igvalue; |
2599 | } |
2600 | + RT_TRACE(rtlpriv, COMP_DIG, DBG_WARNING, |
2601 | + "dig values 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", |
2602 | + dm_digtable->cur_igvalue, dm_digtable->pre_igvalue, |
2603 | + dm_digtable->rssi_val_min, dm_digtable->back_val, |
2604 | + dm_digtable->rx_gain_max, dm_digtable->rx_gain_min, |
2605 | + dm_digtable->large_fa_hit, dm_digtable->forbidden_igi); |
2606 | } |
2607 | EXPORT_SYMBOL(rtl92c_dm_write_dig); |
2608 | |
2609 | static void rtl92c_dm_pwdb_monitor(struct ieee80211_hw *hw) |
2610 | { |
2611 | + struct rtl_priv *rtlpriv = rtl_priv(hw); |
2612 | + struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
2613 | + long tmpentry_max_pwdb = 0, tmpentry_min_pwdb = 0xff; |
2614 | + |
2615 | + if (mac->link_state != MAC80211_LINKED) |
2616 | + return; |
2617 | + |
2618 | + if (mac->opmode == NL80211_IFTYPE_ADHOC || |
2619 | + mac->opmode == NL80211_IFTYPE_AP) { |
2620 | + /* TODO: Handle ADHOC and AP Mode */ |
2621 | + } |
2622 | + |
2623 | + if (tmpentry_max_pwdb != 0) |
2624 | + rtlpriv->dm.entry_max_undec_sm_pwdb = tmpentry_max_pwdb; |
2625 | + else |
2626 | + rtlpriv->dm.entry_max_undec_sm_pwdb = 0; |
2627 | + |
2628 | + if (tmpentry_min_pwdb != 0xff) |
2629 | + rtlpriv->dm.entry_min_undec_sm_pwdb = tmpentry_min_pwdb; |
2630 | + else |
2631 | + rtlpriv->dm.entry_min_undec_sm_pwdb = 0; |
2632 | + |
2633 | +/* TODO: |
2634 | + * if (mac->opmode == NL80211_IFTYPE_STATION) { |
2635 | + * if (rtlpriv->rtlhal.fw_ready) { |
2636 | + * u32 param = (u32)(rtlpriv->dm.undec_sm_pwdb << 16); |
2637 | + * rtl8192c_set_rssi_cmd(hw, param); |
2638 | + * } |
2639 | + * } |
2640 | + */ |
2641 | } |
2642 | |
2643 | void rtl92c_dm_init_edca_turbo(struct ieee80211_hw *hw) |
2644 | @@ -750,6 +865,7 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw |
2645 | rtlpriv->dm.ofdm_index[i] = ofdm_index_old[i]; |
2646 | rtlpriv->dm.cck_index = cck_index_old; |
2647 | } |
2648 | + /* Handle USB High PA boards */ |
2649 | |
2650 | delta = (thermalvalue > rtlpriv->dm.thermalvalue) ? |
2651 | (thermalvalue - rtlpriv->dm.thermalvalue) : |
2652 | @@ -1140,22 +1256,22 @@ void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal) |
2653 | { |
2654 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
2655 | struct ps_t *dm_pstable = &rtlpriv->dm_pstable; |
2656 | - static u8 initialize; |
2657 | - static u32 reg_874, reg_c70, reg_85c, reg_a74; |
2658 | |
2659 | - if (initialize == 0) { |
2660 | - reg_874 = (rtl_get_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, |
2661 | - MASKDWORD) & 0x1CC000) >> 14; |
2662 | + if (!rtlpriv->reg_init) { |
2663 | + rtlpriv->reg_874 = (rtl_get_bbreg(hw, |
2664 | + RFPGA0_XCD_RFINTERFACESW, |
2665 | + MASKDWORD) & 0x1CC000) >> 14; |
2666 | |
2667 | - reg_c70 = (rtl_get_bbreg(hw, ROFDM0_AGCPARAMETER1, |
2668 | - MASKDWORD) & BIT(3)) >> 3; |
2669 | + rtlpriv->reg_c70 = (rtl_get_bbreg(hw, ROFDM0_AGCPARAMETER1, |
2670 | + MASKDWORD) & BIT(3)) >> 3; |
2671 | |
2672 | - reg_85c = (rtl_get_bbreg(hw, RFPGA0_XCD_SWITCHCONTROL, |
2673 | - MASKDWORD) & 0xFF000000) >> 24; |
2674 | + rtlpriv->reg_85c = (rtl_get_bbreg(hw, RFPGA0_XCD_SWITCHCONTROL, |
2675 | + MASKDWORD) & 0xFF000000) >> 24; |
2676 | |
2677 | - reg_a74 = (rtl_get_bbreg(hw, 0xa74, MASKDWORD) & 0xF000) >> 12; |
2678 | + rtlpriv->reg_a74 = (rtl_get_bbreg(hw, 0xa74, MASKDWORD) & |
2679 | + 0xF000) >> 12; |
2680 | |
2681 | - initialize = 1; |
2682 | + rtlpriv->reg_init = true; |
2683 | } |
2684 | |
2685 | if (!bforce_in_normal) { |
2686 | @@ -1192,12 +1308,12 @@ void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal) |
2687 | rtl_set_bbreg(hw, 0x818, BIT(28), 0x1); |
2688 | } else { |
2689 | rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, |
2690 | - 0x1CC000, reg_874); |
2691 | + 0x1CC000, rtlpriv->reg_874); |
2692 | rtl_set_bbreg(hw, ROFDM0_AGCPARAMETER1, BIT(3), |
2693 | - reg_c70); |
2694 | + rtlpriv->reg_c70); |
2695 | rtl_set_bbreg(hw, RFPGA0_XCD_SWITCHCONTROL, 0xFF000000, |
2696 | - reg_85c); |
2697 | - rtl_set_bbreg(hw, 0xa74, 0xF000, reg_a74); |
2698 | + rtlpriv->reg_85c); |
2699 | + rtl_set_bbreg(hw, 0xa74, 0xF000, rtlpriv->reg_a74); |
2700 | rtl_set_bbreg(hw, 0x818, BIT(28), 0x0); |
2701 | } |
2702 | |
2703 | @@ -1213,6 +1329,7 @@ static void rtl92c_dm_dynamic_bb_powersaving(struct ieee80211_hw *hw) |
2704 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
2705 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
2706 | |
2707 | + /* Determine the minimum RSSI */ |
2708 | if (((mac->link_state == MAC80211_NOLINK)) && |
2709 | (rtlpriv->dm.entry_min_undec_sm_pwdb == 0)) { |
2710 | dm_pstable->rssi_val_min = 0; |
2711 | @@ -1241,6 +1358,7 @@ static void rtl92c_dm_dynamic_bb_powersaving(struct ieee80211_hw *hw) |
2712 | dm_pstable->rssi_val_min); |
2713 | } |
2714 | |
2715 | + /* Power Saving for 92C */ |
2716 | if (IS_92C_SERIAL(rtlhal->version)) |
2717 | ;/* rtl92c_dm_1r_cca(hw); */ |
2718 | else |
2719 | @@ -1252,12 +1370,23 @@ void rtl92c_dm_init(struct ieee80211_hw *hw) |
2720 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
2721 | |
2722 | rtlpriv->dm.dm_type = DM_TYPE_BYDRIVER; |
2723 | + rtlpriv->dm.dm_flag = DYNAMIC_FUNC_DISABLE | DYNAMIC_FUNC_DIG; |
2724 | + rtlpriv->dm.undec_sm_pwdb = -1; |
2725 | + rtlpriv->dm.undec_sm_cck = -1; |
2726 | + rtlpriv->dm.dm_initialgain_enable = true; |
2727 | rtl92c_dm_diginit(hw); |
2728 | + |
2729 | + rtlpriv->dm.dm_flag |= HAL_DM_HIPWR_DISABLE; |
2730 | rtl92c_dm_init_dynamic_txpower(hw); |
2731 | + |
2732 | rtl92c_dm_init_edca_turbo(hw); |
2733 | rtl92c_dm_init_rate_adaptive_mask(hw); |
2734 | + rtlpriv->dm.dm_flag |= DYNAMIC_FUNC_SS; |
2735 | rtl92c_dm_initialize_txpower_tracking(hw); |
2736 | rtl92c_dm_init_dynamic_bb_powersaving(hw); |
2737 | + |
2738 | + rtlpriv->dm.ofdm_pkt_cnt = 0; |
2739 | + rtlpriv->dm.dm_rssi_sel = RSSI_DEFAULT; |
2740 | } |
2741 | EXPORT_SYMBOL(rtl92c_dm_init); |
2742 | |
2743 | @@ -1308,7 +1437,7 @@ void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw) |
2744 | } |
2745 | |
2746 | if (undec_sm_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) { |
2747 | - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; |
2748 | + rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL2; |
2749 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
2750 | "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n"); |
2751 | } else if ((undec_sm_pwdb < (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) && |
2752 | @@ -1328,8 +1457,16 @@ void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw) |
2753 | "PHY_SetTxPowerLevel8192S() Channel = %d\n", |
2754 | rtlphy->current_channel); |
2755 | rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel); |
2756 | + if (rtlpriv->dm.dynamic_txhighpower_lvl == |
2757 | + TXHIGHPWRLEVEL_NORMAL) |
2758 | + dm_restorepowerindex(hw); |
2759 | + else if (rtlpriv->dm.dynamic_txhighpower_lvl == |
2760 | + TXHIGHPWRLEVEL_LEVEL1) |
2761 | + dm_writepowerindex(hw, 0x14); |
2762 | + else if (rtlpriv->dm.dynamic_txhighpower_lvl == |
2763 | + TXHIGHPWRLEVEL_LEVEL2) |
2764 | + dm_writepowerindex(hw, 0x10); |
2765 | } |
2766 | - |
2767 | rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl; |
2768 | } |
2769 | |
2770 | @@ -1400,12 +1537,6 @@ u8 rtl92c_bt_rssi_state_change(struct ieee80211_hw *hw) |
2771 | else |
2772 | curr_bt_rssi_state &= (~BT_RSSI_STATE_SPECIAL_LOW); |
2773 | |
2774 | - /* Set Tx Power according to BT status. */ |
2775 | - if (undec_sm_pwdb >= 30) |
2776 | - curr_bt_rssi_state |= BT_RSSI_STATE_TXPOWER_LOW; |
2777 | - else if (undec_sm_pwdb < 25) |
2778 | - curr_bt_rssi_state &= (~BT_RSSI_STATE_TXPOWER_LOW); |
2779 | - |
2780 | /* Check BT state related to BT_Idle in B/G mode. */ |
2781 | if (undec_sm_pwdb < 15) |
2782 | curr_bt_rssi_state |= BT_RSSI_STATE_BG_EDCA_LOW; |
2783 | diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h |
2784 | index 518e208c0180..4f232a063636 100644 |
2785 | --- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h |
2786 | +++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h |
2787 | @@ -91,6 +91,17 @@ |
2788 | #define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 |
2789 | #define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 |
2790 | |
2791 | +#define DYNAMIC_FUNC_DISABLE 0x0 |
2792 | +#define DYNAMIC_FUNC_DIG BIT(0) |
2793 | +#define DYNAMIC_FUNC_HP BIT(1) |
2794 | +#define DYNAMIC_FUNC_SS BIT(2) /*Tx Power Tracking*/ |
2795 | +#define DYNAMIC_FUNC_BT BIT(3) |
2796 | +#define DYNAMIC_FUNC_ANT_DIV BIT(4) |
2797 | + |
2798 | +#define RSSI_CCK 0 |
2799 | +#define RSSI_OFDM 1 |
2800 | +#define RSSI_DEFAULT 2 |
2801 | + |
2802 | struct swat_t { |
2803 | u8 failure_cnt; |
2804 | u8 try_flag; |
2805 | @@ -167,5 +178,8 @@ void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); |
2806 | void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery); |
2807 | void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw); |
2808 | void rtl92c_dm_bt_coexist(struct ieee80211_hw *hw); |
2809 | +void dm_savepowerindex(struct ieee80211_hw *hw); |
2810 | +void dm_writepowerindex(struct ieee80211_hw *hw, u8 value); |
2811 | +void dm_restorepowerindex(struct ieee80211_hw *hw); |
2812 | |
2813 | #endif |
2814 | diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c |
2815 | index 16a0b9e59acf..c16209a336ea 100644 |
2816 | --- a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c |
2817 | +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c |
2818 | @@ -101,6 +101,15 @@ void rtl92cu_dm_dynamic_txpower(struct ieee80211_hw *hw) |
2819 | "PHY_SetTxPowerLevel8192S() Channel = %d\n", |
2820 | rtlphy->current_channel); |
2821 | rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel); |
2822 | + if (rtlpriv->dm.dynamic_txhighpower_lvl == |
2823 | + TXHIGHPWRLEVEL_NORMAL) |
2824 | + dm_restorepowerindex(hw); |
2825 | + else if (rtlpriv->dm.dynamic_txhighpower_lvl == |
2826 | + TXHIGHPWRLEVEL_LEVEL1) |
2827 | + dm_writepowerindex(hw, 0x14); |
2828 | + else if (rtlpriv->dm.dynamic_txhighpower_lvl == |
2829 | + TXHIGHPWRLEVEL_LEVEL2) |
2830 | + dm_writepowerindex(hw, 0x10); |
2831 | } |
2832 | |
2833 | rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl; |
2834 | diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h |
2835 | index d947e7d350bb..fafa6bac2a3f 100644 |
2836 | --- a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h |
2837 | +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h |
2838 | @@ -30,3 +30,6 @@ |
2839 | #include "../rtl8192ce/dm.h" |
2840 | |
2841 | void rtl92cu_dm_dynamic_txpower(struct ieee80211_hw *hw); |
2842 | +void dm_savepowerindex(struct ieee80211_hw *hw); |
2843 | +void dm_writepowerindex(struct ieee80211_hw *hw, u8 value); |
2844 | +void dm_restorepowerindex(struct ieee80211_hw *hw); |
2845 | diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c |
2846 | index 2119313a737b..b878d56d2f4d 100644 |
2847 | --- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c |
2848 | +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c |
2849 | @@ -85,17 +85,15 @@ void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, |
2850 | if (mac->act_scanning) { |
2851 | tx_agc[RF90_PATH_A] = 0x3f3f3f3f; |
2852 | tx_agc[RF90_PATH_B] = 0x3f3f3f3f; |
2853 | - if (turbo_scanoff) { |
2854 | - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { |
2855 | - tx_agc[idx1] = ppowerlevel[idx1] | |
2856 | - (ppowerlevel[idx1] << 8) | |
2857 | - (ppowerlevel[idx1] << 16) | |
2858 | - (ppowerlevel[idx1] << 24); |
2859 | - if (rtlhal->interface == INTF_USB) { |
2860 | - if (tx_agc[idx1] > 0x20 && |
2861 | - rtlefuse->external_pa) |
2862 | - tx_agc[idx1] = 0x20; |
2863 | - } |
2864 | + for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { |
2865 | + tx_agc[idx1] = ppowerlevel[idx1] | |
2866 | + (ppowerlevel[idx1] << 8) | |
2867 | + (ppowerlevel[idx1] << 16) | |
2868 | + (ppowerlevel[idx1] << 24); |
2869 | + if (rtlhal->interface == INTF_USB) { |
2870 | + if (tx_agc[idx1] > 0x20 && |
2871 | + rtlefuse->external_pa) |
2872 | + tx_agc[idx1] = 0x20; |
2873 | } |
2874 | } |
2875 | } else { |
2876 | @@ -107,7 +105,7 @@ void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, |
2877 | TXHIGHPWRLEVEL_LEVEL2) { |
2878 | tx_agc[RF90_PATH_A] = 0x00000000; |
2879 | tx_agc[RF90_PATH_B] = 0x00000000; |
2880 | - } else{ |
2881 | + } else { |
2882 | for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { |
2883 | tx_agc[idx1] = ppowerlevel[idx1] | |
2884 | (ppowerlevel[idx1] << 8) | |
2885 | @@ -373,7 +371,12 @@ static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw, |
2886 | regoffset == RTXAGC_B_MCS07_MCS04) |
2887 | regoffset = 0xc98; |
2888 | for (i = 0; i < 3; i++) { |
2889 | - writeVal = (writeVal > 6) ? (writeVal - 6) : 0; |
2890 | + if (i != 2) |
2891 | + writeVal = (writeVal > 8) ? |
2892 | + (writeVal - 8) : 0; |
2893 | + else |
2894 | + writeVal = (writeVal > 6) ? |
2895 | + (writeVal - 6) : 0; |
2896 | rtl_write_byte(rtlpriv, (u32)(regoffset + i), |
2897 | (u8)writeVal); |
2898 | } |
2899 | diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c |
2900 | index 9936de716ad5..c61311084d7e 100644 |
2901 | --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c |
2902 | +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c |
2903 | @@ -50,6 +50,9 @@ MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>"); |
2904 | MODULE_LICENSE("GPL"); |
2905 | MODULE_DESCRIPTION("Realtek 8192C/8188C 802.11n USB wireless"); |
2906 | MODULE_FIRMWARE("rtlwifi/rtl8192cufw.bin"); |
2907 | +MODULE_FIRMWARE("rtlwifi/rtl8192cufw_A.bin"); |
2908 | +MODULE_FIRMWARE("rtlwifi/rtl8192cufw_B.bin"); |
2909 | +MODULE_FIRMWARE("rtlwifi/rtl8192cufw_TMSC.bin"); |
2910 | |
2911 | static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw) |
2912 | { |
2913 | @@ -69,14 +72,21 @@ static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw) |
2914 | "Can't alloc buffer for fw\n"); |
2915 | return 1; |
2916 | } |
2917 | - |
2918 | + if (IS_VENDOR_UMC_A_CUT(rtlpriv->rtlhal.version) && |
2919 | + !IS_92C_SERIAL(rtlpriv->rtlhal.version)) { |
2920 | + rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cufw_A.bin"; |
2921 | + } else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlpriv->rtlhal.version)) { |
2922 | + rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cufw_B.bin"; |
2923 | + } else { |
2924 | + rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cufw_TMSC.bin"; |
2925 | + } |
2926 | + /* provide name of alternative file */ |
2927 | + rtlpriv->cfg->alt_fw_name = "rtlwifi/rtl8192cufw.bin"; |
2928 | pr_info("Loading firmware %s\n", rtlpriv->cfg->fw_name); |
2929 | rtlpriv->max_fw_size = 0x4000; |
2930 | err = request_firmware_nowait(THIS_MODULE, 1, |
2931 | rtlpriv->cfg->fw_name, rtlpriv->io.dev, |
2932 | GFP_KERNEL, hw, rtl_fw_cb); |
2933 | - |
2934 | - |
2935 | return err; |
2936 | } |
2937 | |
2938 | @@ -307,6 +317,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { |
2939 | {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ |
2940 | {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ |
2941 | {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ |
2942 | + {RTL_USB_DEVICE(0x0df6, 0x0077, rtl92cu_hal_cfg)}, /*Sitecom-WLA2100V2*/ |
2943 | {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ |
2944 | {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/ |
2945 | /* HP - Lite-On ,8188CUS Slim Combo */ |
2946 | diff --git a/drivers/net/wireless/rtlwifi/stats.c b/drivers/net/wireless/rtlwifi/stats.c |
2947 | index 8ed31744a054..4f083fc1d360 100644 |
2948 | --- a/drivers/net/wireless/rtlwifi/stats.c |
2949 | +++ b/drivers/net/wireless/rtlwifi/stats.c |
2950 | @@ -176,6 +176,7 @@ static void rtl_process_pwdb(struct ieee80211_hw *hw, struct rtl_stats *pstatus) |
2951 | struct rtl_sta_info *drv_priv = NULL; |
2952 | struct ieee80211_sta *sta = NULL; |
2953 | long undec_sm_pwdb; |
2954 | + long undec_sm_cck; |
2955 | |
2956 | rcu_read_lock(); |
2957 | if (rtlpriv->mac80211.opmode != NL80211_IFTYPE_STATION) |
2958 | @@ -185,12 +186,16 @@ static void rtl_process_pwdb(struct ieee80211_hw *hw, struct rtl_stats *pstatus) |
2959 | if (sta) { |
2960 | drv_priv = (struct rtl_sta_info *) sta->drv_priv; |
2961 | undec_sm_pwdb = drv_priv->rssi_stat.undec_sm_pwdb; |
2962 | + undec_sm_cck = drv_priv->rssi_stat.undec_sm_cck; |
2963 | } else { |
2964 | undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb; |
2965 | + undec_sm_cck = rtlpriv->dm.undec_sm_cck; |
2966 | } |
2967 | |
2968 | if (undec_sm_pwdb < 0) |
2969 | undec_sm_pwdb = pstatus->rx_pwdb_all; |
2970 | + if (undec_sm_cck < 0) |
2971 | + undec_sm_cck = pstatus->rx_pwdb_all; |
2972 | if (pstatus->rx_pwdb_all > (u32) undec_sm_pwdb) { |
2973 | undec_sm_pwdb = (((undec_sm_pwdb) * |
2974 | (RX_SMOOTH_FACTOR - 1)) + |
2975 | @@ -200,6 +205,15 @@ static void rtl_process_pwdb(struct ieee80211_hw *hw, struct rtl_stats *pstatus) |
2976 | undec_sm_pwdb = (((undec_sm_pwdb) * (RX_SMOOTH_FACTOR - 1)) + |
2977 | (pstatus->rx_pwdb_all)) / (RX_SMOOTH_FACTOR); |
2978 | } |
2979 | + if (pstatus->rx_pwdb_all > (u32) undec_sm_cck) { |
2980 | + undec_sm_cck = (((undec_sm_pwdb) * |
2981 | + (RX_SMOOTH_FACTOR - 1)) + |
2982 | + (pstatus->rx_pwdb_all)) / (RX_SMOOTH_FACTOR); |
2983 | + undec_sm_cck = undec_sm_cck + 1; |
2984 | + } else { |
2985 | + undec_sm_pwdb = (((undec_sm_cck) * (RX_SMOOTH_FACTOR - 1)) + |
2986 | + (pstatus->rx_pwdb_all)) / (RX_SMOOTH_FACTOR); |
2987 | + } |
2988 | |
2989 | if (sta) { |
2990 | drv_priv->rssi_stat.undec_sm_pwdb = undec_sm_pwdb; |
2991 | diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c |
2992 | index 6e2b5c5c83c8..2d56d90c5c53 100644 |
2993 | --- a/drivers/net/wireless/rtlwifi/usb.c |
2994 | +++ b/drivers/net/wireless/rtlwifi/usb.c |
2995 | @@ -483,6 +483,8 @@ static void _rtl_usb_rx_process_agg(struct ieee80211_hw *hw, |
2996 | if (unicast) |
2997 | rtlpriv->link_info.num_rx_inperiod++; |
2998 | } |
2999 | + /* static bcn for roaming */ |
3000 | + rtl_beacon_statistic(hw, skb); |
3001 | } |
3002 | } |
3003 | |
3004 | @@ -553,7 +555,7 @@ static void _rtl_rx_pre_process(struct ieee80211_hw *hw, struct sk_buff *skb) |
3005 | } |
3006 | } |
3007 | |
3008 | -#define __RX_SKB_MAX_QUEUED 32 |
3009 | +#define __RX_SKB_MAX_QUEUED 64 |
3010 | |
3011 | static void _rtl_rx_work(unsigned long param) |
3012 | { |
3013 | diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h |
3014 | index 0c65386fa30d..8c647391bedf 100644 |
3015 | --- a/drivers/net/wireless/rtlwifi/wifi.h |
3016 | +++ b/drivers/net/wireless/rtlwifi/wifi.h |
3017 | @@ -1033,6 +1033,7 @@ struct rtl_ht_agg { |
3018 | |
3019 | struct rssi_sta { |
3020 | long undec_sm_pwdb; |
3021 | + long undec_sm_cck; |
3022 | }; |
3023 | |
3024 | struct rtl_tid_data { |
3025 | @@ -1323,8 +1324,10 @@ struct fast_ant_training { |
3026 | struct rtl_dm { |
3027 | /*PHY status for Dynamic Management */ |
3028 | long entry_min_undec_sm_pwdb; |
3029 | + long undec_sm_cck; |
3030 | long undec_sm_pwdb; /*out dm */ |
3031 | long entry_max_undec_sm_pwdb; |
3032 | + s32 ofdm_pkt_cnt; |
3033 | bool dm_initialgain_enable; |
3034 | bool dynamic_txpower_enable; |
3035 | bool current_turbo_edca; |
3036 | @@ -1339,6 +1342,7 @@ struct rtl_dm { |
3037 | bool inform_fw_driverctrldm; |
3038 | bool current_mrc_switch; |
3039 | u8 txpowercount; |
3040 | + u8 powerindex_backup[6]; |
3041 | |
3042 | u8 thermalvalue_rxgain; |
3043 | u8 thermalvalue_iqk; |
3044 | @@ -1350,7 +1354,9 @@ struct rtl_dm { |
3045 | bool done_txpower; |
3046 | u8 dynamic_txhighpower_lvl; /*Tx high power level */ |
3047 | u8 dm_flag; /*Indicate each dynamic mechanism's status. */ |
3048 | + u8 dm_flag_tmp; |
3049 | u8 dm_type; |
3050 | + u8 dm_rssi_sel; |
3051 | u8 txpower_track_control; |
3052 | bool interrupt_migration; |
3053 | bool disable_tx_int; |
3054 | @@ -1804,6 +1810,7 @@ struct rtl_hal_cfg { |
3055 | bool write_readback; |
3056 | char *name; |
3057 | char *fw_name; |
3058 | + char *alt_fw_name; |
3059 | struct rtl_hal_ops *ops; |
3060 | struct rtl_mod_params *mod_params; |
3061 | struct rtl_hal_usbint_cfg *usb_interface_cfg; |
3062 | @@ -1948,6 +1955,7 @@ struct dig_t { |
3063 | u8 pre_ccastate; |
3064 | u8 cur_ccasate; |
3065 | u8 large_fa_hit; |
3066 | + u8 dig_dynamic_min; |
3067 | u8 forbidden_igi; |
3068 | u8 dig_state; |
3069 | u8 dig_highpwrstate; |
3070 | @@ -2028,22 +2036,15 @@ struct rtl_priv { |
3071 | struct dig_t dm_digtable; |
3072 | struct ps_t dm_pstable; |
3073 | |
3074 | - /* section shared by individual drivers */ |
3075 | - union { |
3076 | - struct { /* data buffer pointer for USB reads */ |
3077 | - __le32 *usb_data; |
3078 | - int usb_data_index; |
3079 | - bool initialized; |
3080 | - }; |
3081 | - struct { /* section for 8723ae */ |
3082 | - bool reg_init; /* true if regs saved */ |
3083 | - u32 reg_874; |
3084 | - u32 reg_c70; |
3085 | - u32 reg_85c; |
3086 | - u32 reg_a74; |
3087 | - bool bt_operation_on; |
3088 | - }; |
3089 | - }; |
3090 | + u32 reg_874; |
3091 | + u32 reg_c70; |
3092 | + u32 reg_85c; |
3093 | + u32 reg_a74; |
3094 | + bool reg_init; /* true if regs saved */ |
3095 | + bool bt_operation_on; |
3096 | + __le32 *usb_data; |
3097 | + int usb_data_index; |
3098 | + bool initialized; |
3099 | bool enter_ps; /* true when entering PS */ |
3100 | u8 rate_mask[5]; |
3101 | |
3102 | diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c |
3103 | index e59acb1daa23..657f7c588d17 100644 |
3104 | --- a/drivers/net/xen-netfront.c |
3105 | +++ b/drivers/net/xen-netfront.c |
3106 | @@ -117,6 +117,7 @@ struct netfront_info { |
3107 | } tx_skbs[NET_TX_RING_SIZE]; |
3108 | grant_ref_t gref_tx_head; |
3109 | grant_ref_t grant_tx_ref[NET_TX_RING_SIZE]; |
3110 | + struct page *grant_tx_page[NET_TX_RING_SIZE]; |
3111 | unsigned tx_skb_freelist; |
3112 | |
3113 | spinlock_t rx_lock ____cacheline_aligned_in_smp; |
3114 | @@ -396,6 +397,7 @@ static void xennet_tx_buf_gc(struct net_device *dev) |
3115 | gnttab_release_grant_reference( |
3116 | &np->gref_tx_head, np->grant_tx_ref[id]); |
3117 | np->grant_tx_ref[id] = GRANT_INVALID_REF; |
3118 | + np->grant_tx_page[id] = NULL; |
3119 | add_id_to_freelist(&np->tx_skb_freelist, np->tx_skbs, id); |
3120 | dev_kfree_skb_irq(skb); |
3121 | } |
3122 | @@ -452,6 +454,7 @@ static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev, |
3123 | gnttab_grant_foreign_access_ref(ref, np->xbdev->otherend_id, |
3124 | mfn, GNTMAP_readonly); |
3125 | |
3126 | + np->grant_tx_page[id] = virt_to_page(data); |
3127 | tx->gref = np->grant_tx_ref[id] = ref; |
3128 | tx->offset = offset; |
3129 | tx->size = len; |
3130 | @@ -497,6 +500,7 @@ static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev, |
3131 | np->xbdev->otherend_id, |
3132 | mfn, GNTMAP_readonly); |
3133 | |
3134 | + np->grant_tx_page[id] = page; |
3135 | tx->gref = np->grant_tx_ref[id] = ref; |
3136 | tx->offset = offset; |
3137 | tx->size = bytes; |
3138 | @@ -596,6 +600,7 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) |
3139 | mfn = virt_to_mfn(data); |
3140 | gnttab_grant_foreign_access_ref( |
3141 | ref, np->xbdev->otherend_id, mfn, GNTMAP_readonly); |
3142 | + np->grant_tx_page[id] = virt_to_page(data); |
3143 | tx->gref = np->grant_tx_ref[id] = ref; |
3144 | tx->offset = offset; |
3145 | tx->size = len; |
3146 | @@ -1122,10 +1127,11 @@ static void xennet_release_tx_bufs(struct netfront_info *np) |
3147 | continue; |
3148 | |
3149 | skb = np->tx_skbs[i].skb; |
3150 | - gnttab_end_foreign_access_ref(np->grant_tx_ref[i], |
3151 | - GNTMAP_readonly); |
3152 | - gnttab_release_grant_reference(&np->gref_tx_head, |
3153 | - np->grant_tx_ref[i]); |
3154 | + get_page(np->grant_tx_page[i]); |
3155 | + gnttab_end_foreign_access(np->grant_tx_ref[i], |
3156 | + GNTMAP_readonly, |
3157 | + (unsigned long)page_address(np->grant_tx_page[i])); |
3158 | + np->grant_tx_page[i] = NULL; |
3159 | np->grant_tx_ref[i] = GRANT_INVALID_REF; |
3160 | add_id_to_freelist(&np->tx_skb_freelist, np->tx_skbs, i); |
3161 | dev_kfree_skb_irq(skb); |
3162 | @@ -1134,78 +1140,35 @@ static void xennet_release_tx_bufs(struct netfront_info *np) |
3163 | |
3164 | static void xennet_release_rx_bufs(struct netfront_info *np) |
3165 | { |
3166 | - struct mmu_update *mmu = np->rx_mmu; |
3167 | - struct multicall_entry *mcl = np->rx_mcl; |
3168 | - struct sk_buff_head free_list; |
3169 | - struct sk_buff *skb; |
3170 | - unsigned long mfn; |
3171 | - int xfer = 0, noxfer = 0, unused = 0; |
3172 | int id, ref; |
3173 | |
3174 | - dev_warn(&np->netdev->dev, "%s: fix me for copying receiver.\n", |
3175 | - __func__); |
3176 | - return; |
3177 | - |
3178 | - skb_queue_head_init(&free_list); |
3179 | - |
3180 | spin_lock_bh(&np->rx_lock); |
3181 | |
3182 | for (id = 0; id < NET_RX_RING_SIZE; id++) { |
3183 | - ref = np->grant_rx_ref[id]; |
3184 | - if (ref == GRANT_INVALID_REF) { |
3185 | - unused++; |
3186 | - continue; |
3187 | - } |
3188 | + struct sk_buff *skb; |
3189 | + struct page *page; |
3190 | |
3191 | skb = np->rx_skbs[id]; |
3192 | - mfn = gnttab_end_foreign_transfer_ref(ref); |
3193 | - gnttab_release_grant_reference(&np->gref_rx_head, ref); |
3194 | - np->grant_rx_ref[id] = GRANT_INVALID_REF; |
3195 | - |
3196 | - if (0 == mfn) { |
3197 | - skb_shinfo(skb)->nr_frags = 0; |
3198 | - dev_kfree_skb(skb); |
3199 | - noxfer++; |
3200 | + if (!skb) |
3201 | continue; |
3202 | - } |
3203 | |
3204 | - if (!xen_feature(XENFEAT_auto_translated_physmap)) { |
3205 | - /* Remap the page. */ |
3206 | - const struct page *page = |
3207 | - skb_frag_page(&skb_shinfo(skb)->frags[0]); |
3208 | - unsigned long pfn = page_to_pfn(page); |
3209 | - void *vaddr = page_address(page); |
3210 | + ref = np->grant_rx_ref[id]; |
3211 | + if (ref == GRANT_INVALID_REF) |
3212 | + continue; |
3213 | |
3214 | - MULTI_update_va_mapping(mcl, (unsigned long)vaddr, |
3215 | - mfn_pte(mfn, PAGE_KERNEL), |
3216 | - 0); |
3217 | - mcl++; |
3218 | - mmu->ptr = ((u64)mfn << PAGE_SHIFT) |
3219 | - | MMU_MACHPHYS_UPDATE; |
3220 | - mmu->val = pfn; |
3221 | - mmu++; |
3222 | + page = skb_frag_page(&skb_shinfo(skb)->frags[0]); |
3223 | |
3224 | - set_phys_to_machine(pfn, mfn); |
3225 | - } |
3226 | - __skb_queue_tail(&free_list, skb); |
3227 | - xfer++; |
3228 | - } |
3229 | - |
3230 | - dev_info(&np->netdev->dev, "%s: %d xfer, %d noxfer, %d unused\n", |
3231 | - __func__, xfer, noxfer, unused); |
3232 | + /* gnttab_end_foreign_access() needs a page ref until |
3233 | + * foreign access is ended (which may be deferred). |
3234 | + */ |
3235 | + get_page(page); |
3236 | + gnttab_end_foreign_access(ref, 0, |
3237 | + (unsigned long)page_address(page)); |
3238 | + np->grant_rx_ref[id] = GRANT_INVALID_REF; |
3239 | |
3240 | - if (xfer) { |
3241 | - if (!xen_feature(XENFEAT_auto_translated_physmap)) { |
3242 | - /* Do all the remapping work and M2P updates. */ |
3243 | - MULTI_mmu_update(mcl, np->rx_mmu, mmu - np->rx_mmu, |
3244 | - NULL, DOMID_SELF); |
3245 | - mcl++; |
3246 | - HYPERVISOR_multicall(np->rx_mcl, mcl - np->rx_mcl); |
3247 | - } |
3248 | + kfree_skb(skb); |
3249 | } |
3250 | |
3251 | - __skb_queue_purge(&free_list); |
3252 | - |
3253 | spin_unlock_bh(&np->rx_lock); |
3254 | } |
3255 | |
3256 | @@ -1358,6 +1321,7 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) |
3257 | for (i = 0; i < NET_RX_RING_SIZE; i++) { |
3258 | np->rx_skbs[i] = NULL; |
3259 | np->grant_rx_ref[i] = GRANT_INVALID_REF; |
3260 | + np->grant_tx_page[i] = NULL; |
3261 | } |
3262 | |
3263 | /* A grant for every tx ring slot */ |
3264 | diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c |
3265 | index 963761526229..bb665478cc4b 100644 |
3266 | --- a/drivers/parport/parport_pc.c |
3267 | +++ b/drivers/parport/parport_pc.c |
3268 | @@ -2600,8 +2600,6 @@ enum parport_pc_pci_cards { |
3269 | syba_2p_epp, |
3270 | syba_1p_ecp, |
3271 | titan_010l, |
3272 | - titan_1284p1, |
3273 | - titan_1284p2, |
3274 | avlab_1p, |
3275 | avlab_2p, |
3276 | oxsemi_952, |
3277 | @@ -2660,8 +2658,6 @@ static struct parport_pc_pci { |
3278 | /* syba_2p_epp AP138B */ { 2, { { 0, 0x078 }, { 0, 0x178 }, } }, |
3279 | /* syba_1p_ecp W83787 */ { 1, { { 0, 0x078 }, } }, |
3280 | /* titan_010l */ { 1, { { 3, -1 }, } }, |
3281 | - /* titan_1284p1 */ { 1, { { 0, 1 }, } }, |
3282 | - /* titan_1284p2 */ { 2, { { 0, 1 }, { 2, 3 }, } }, |
3283 | /* avlab_1p */ { 1, { { 0, 1}, } }, |
3284 | /* avlab_2p */ { 2, { { 0, 1}, { 2, 3 },} }, |
3285 | /* The Oxford Semi cards are unusual: 954 doesn't support ECP, |
3286 | @@ -2677,8 +2673,8 @@ static struct parport_pc_pci { |
3287 | /* netmos_9705 */ { 1, { { 0, -1 }, } }, |
3288 | /* netmos_9715 */ { 2, { { 0, 1 }, { 2, 3 },} }, |
3289 | /* netmos_9755 */ { 2, { { 0, 1 }, { 2, 3 },} }, |
3290 | - /* netmos_9805 */ { 1, { { 0, -1 }, } }, |
3291 | - /* netmos_9815 */ { 2, { { 0, -1 }, { 2, -1 }, } }, |
3292 | + /* netmos_9805 */ { 1, { { 0, 1 }, } }, |
3293 | + /* netmos_9815 */ { 2, { { 0, 1 }, { 2, 3 }, } }, |
3294 | /* netmos_9901 */ { 1, { { 0, -1 }, } }, |
3295 | /* netmos_9865 */ { 1, { { 0, -1 }, } }, |
3296 | /* quatech_sppxp100 */ { 1, { { 0, 1 }, } }, |
3297 | @@ -2722,8 +2718,6 @@ static const struct pci_device_id parport_pc_pci_tbl[] = { |
3298 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, syba_1p_ecp }, |
3299 | { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_010L, |
3300 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, titan_010l }, |
3301 | - { 0x9710, 0x9805, 0x1000, 0x0010, 0, 0, titan_1284p1 }, |
3302 | - { 0x9710, 0x9815, 0x1000, 0x0020, 0, 0, titan_1284p2 }, |
3303 | /* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/ |
3304 | /* AFAVLAB_TK9902 */ |
3305 | { 0x14db, 0x2120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1p}, |
3306 | diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c |
3307 | index 119d2ddedfe7..6ebf3067bde4 100644 |
3308 | --- a/drivers/pinctrl/pinctrl-sunxi.c |
3309 | +++ b/drivers/pinctrl/pinctrl-sunxi.c |
3310 | @@ -469,12 +469,6 @@ static int sunxi_pinctrl_gpio_get(struct gpio_chip *chip, unsigned offset) |
3311 | return val; |
3312 | } |
3313 | |
3314 | -static int sunxi_pinctrl_gpio_direction_output(struct gpio_chip *chip, |
3315 | - unsigned offset, int value) |
3316 | -{ |
3317 | - return pinctrl_gpio_direction_output(chip->base + offset); |
3318 | -} |
3319 | - |
3320 | static void sunxi_pinctrl_gpio_set(struct gpio_chip *chip, |
3321 | unsigned offset, int value) |
3322 | { |
3323 | @@ -498,6 +492,13 @@ static void sunxi_pinctrl_gpio_set(struct gpio_chip *chip, |
3324 | spin_unlock_irqrestore(&pctl->lock, flags); |
3325 | } |
3326 | |
3327 | +static int sunxi_pinctrl_gpio_direction_output(struct gpio_chip *chip, |
3328 | + unsigned offset, int value) |
3329 | +{ |
3330 | + sunxi_pinctrl_gpio_set(chip, offset, value); |
3331 | + return pinctrl_gpio_direction_output(chip->base + offset); |
3332 | +} |
3333 | + |
3334 | static int sunxi_pinctrl_gpio_of_xlate(struct gpio_chip *gc, |
3335 | const struct of_phandle_args *gpiospec, |
3336 | u32 *flags) |
3337 | diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c |
3338 | index a8e43cf70fac..0ed96df20162 100644 |
3339 | --- a/drivers/platform/x86/hp_accel.c |
3340 | +++ b/drivers/platform/x86/hp_accel.c |
3341 | @@ -77,6 +77,7 @@ static inline void delayed_sysfs_set(struct led_classdev *led_cdev, |
3342 | static struct acpi_device_id lis3lv02d_device_ids[] = { |
3343 | {"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */ |
3344 | {"HPQ6000", 0}, /* HP Mobile Data Protection System PNP */ |
3345 | + {"HPQ6007", 0}, /* HP Mobile Data Protection System PNP */ |
3346 | {"", 0}, |
3347 | }; |
3348 | MODULE_DEVICE_TABLE(acpi, lis3lv02d_device_ids); |
3349 | diff --git a/drivers/rtc/rtc-max8907.c b/drivers/rtc/rtc-max8907.c |
3350 | index 8e45b3c4aa2f..3032178bd9e6 100644 |
3351 | --- a/drivers/rtc/rtc-max8907.c |
3352 | +++ b/drivers/rtc/rtc-max8907.c |
3353 | @@ -51,7 +51,7 @@ static irqreturn_t max8907_irq_handler(int irq, void *data) |
3354 | { |
3355 | struct max8907_rtc *rtc = data; |
3356 | |
3357 | - regmap_update_bits(rtc->regmap, MAX8907_REG_ALARM0_CNTL, 0x7f, 0); |
3358 | + regmap_write(rtc->regmap, MAX8907_REG_ALARM0_CNTL, 0); |
3359 | |
3360 | rtc_update_irq(rtc->rtc_dev, 1, RTC_IRQF | RTC_AF); |
3361 | |
3362 | @@ -64,7 +64,7 @@ static void regs_to_tm(u8 *regs, struct rtc_time *tm) |
3363 | bcd2bin(regs[RTC_YEAR1]) - 1900; |
3364 | tm->tm_mon = bcd2bin(regs[RTC_MONTH] & 0x1f) - 1; |
3365 | tm->tm_mday = bcd2bin(regs[RTC_DATE] & 0x3f); |
3366 | - tm->tm_wday = (regs[RTC_WEEKDAY] & 0x07) - 1; |
3367 | + tm->tm_wday = (regs[RTC_WEEKDAY] & 0x07); |
3368 | if (regs[RTC_HOUR] & HOUR_12) { |
3369 | tm->tm_hour = bcd2bin(regs[RTC_HOUR] & 0x01f); |
3370 | if (tm->tm_hour == 12) |
3371 | @@ -88,7 +88,7 @@ static void tm_to_regs(struct rtc_time *tm, u8 *regs) |
3372 | regs[RTC_YEAR1] = bin2bcd(low); |
3373 | regs[RTC_MONTH] = bin2bcd(tm->tm_mon + 1); |
3374 | regs[RTC_DATE] = bin2bcd(tm->tm_mday); |
3375 | - regs[RTC_WEEKDAY] = tm->tm_wday + 1; |
3376 | + regs[RTC_WEEKDAY] = tm->tm_wday; |
3377 | regs[RTC_HOUR] = bin2bcd(tm->tm_hour); |
3378 | regs[RTC_MIN] = bin2bcd(tm->tm_min); |
3379 | regs[RTC_SEC] = bin2bcd(tm->tm_sec); |
3380 | @@ -153,7 +153,7 @@ static int max8907_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
3381 | tm_to_regs(&alrm->time, regs); |
3382 | |
3383 | /* Disable alarm while we update the target time */ |
3384 | - ret = regmap_update_bits(rtc->regmap, MAX8907_REG_ALARM0_CNTL, 0x7f, 0); |
3385 | + ret = regmap_write(rtc->regmap, MAX8907_REG_ALARM0_CNTL, 0); |
3386 | if (ret < 0) |
3387 | return ret; |
3388 | |
3389 | @@ -163,8 +163,7 @@ static int max8907_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
3390 | return ret; |
3391 | |
3392 | if (alrm->enabled) |
3393 | - ret = regmap_update_bits(rtc->regmap, MAX8907_REG_ALARM0_CNTL, |
3394 | - 0x7f, 0x7f); |
3395 | + ret = regmap_write(rtc->regmap, MAX8907_REG_ALARM0_CNTL, 0x77); |
3396 | |
3397 | return ret; |
3398 | } |
3399 | diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c |
3400 | index fc80a325a1e6..27e270e00a10 100644 |
3401 | --- a/drivers/scsi/bfa/bfad.c |
3402 | +++ b/drivers/scsi/bfa/bfad.c |
3403 | @@ -1802,7 +1802,7 @@ out: |
3404 | static u32 * |
3405 | bfad_load_fwimg(struct pci_dev *pdev) |
3406 | { |
3407 | - if (pdev->device == BFA_PCI_DEVICE_ID_CT2) { |
3408 | + if (bfa_asic_id_ct2(pdev->device)) { |
3409 | if (bfi_image_ct2_size == 0) |
3410 | bfad_read_firmware(pdev, &bfi_image_ct2, |
3411 | &bfi_image_ct2_size, BFAD_FW_FILE_CT2); |
3412 | @@ -1812,12 +1812,14 @@ bfad_load_fwimg(struct pci_dev *pdev) |
3413 | bfad_read_firmware(pdev, &bfi_image_ct, |
3414 | &bfi_image_ct_size, BFAD_FW_FILE_CT); |
3415 | return bfi_image_ct; |
3416 | - } else { |
3417 | + } else if (bfa_asic_id_cb(pdev->device)) { |
3418 | if (bfi_image_cb_size == 0) |
3419 | bfad_read_firmware(pdev, &bfi_image_cb, |
3420 | &bfi_image_cb_size, BFAD_FW_FILE_CB); |
3421 | return bfi_image_cb; |
3422 | } |
3423 | + |
3424 | + return NULL; |
3425 | } |
3426 | |
3427 | static void |
3428 | diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c |
3429 | index a28d5e624aab..cf174a4ffa84 100644 |
3430 | --- a/drivers/scsi/qla4xxx/ql4_os.c |
3431 | +++ b/drivers/scsi/qla4xxx/ql4_os.c |
3432 | @@ -802,6 +802,7 @@ static int qla4xxx_set_chap_entry(struct Scsi_Host *shost, void *data, int len) |
3433 | int type; |
3434 | int rem = len; |
3435 | int rc = 0; |
3436 | + int size; |
3437 | |
3438 | memset(&chap_rec, 0, sizeof(chap_rec)); |
3439 | |
3440 | @@ -816,12 +817,14 @@ static int qla4xxx_set_chap_entry(struct Scsi_Host *shost, void *data, int len) |
3441 | chap_rec.chap_type = param_info->value[0]; |
3442 | break; |
3443 | case ISCSI_CHAP_PARAM_USERNAME: |
3444 | - memcpy(chap_rec.username, param_info->value, |
3445 | - param_info->len); |
3446 | + size = min_t(size_t, sizeof(chap_rec.username), |
3447 | + param_info->len); |
3448 | + memcpy(chap_rec.username, param_info->value, size); |
3449 | break; |
3450 | case ISCSI_CHAP_PARAM_PASSWORD: |
3451 | - memcpy(chap_rec.password, param_info->value, |
3452 | - param_info->len); |
3453 | + size = min_t(size_t, sizeof(chap_rec.password), |
3454 | + param_info->len); |
3455 | + memcpy(chap_rec.password, param_info->value, size); |
3456 | break; |
3457 | case ISCSI_CHAP_PARAM_PASSWORD_LEN: |
3458 | chap_rec.password_length = param_info->value[0]; |
3459 | diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c |
3460 | index c3173dced870..16bfd50cd3fe 100644 |
3461 | --- a/drivers/scsi/virtio_scsi.c |
3462 | +++ b/drivers/scsi/virtio_scsi.c |
3463 | @@ -956,6 +956,10 @@ static void virtscsi_remove(struct virtio_device *vdev) |
3464 | #ifdef CONFIG_PM_SLEEP |
3465 | static int virtscsi_freeze(struct virtio_device *vdev) |
3466 | { |
3467 | + struct Scsi_Host *sh = virtio_scsi_host(vdev); |
3468 | + struct virtio_scsi *vscsi = shost_priv(sh); |
3469 | + |
3470 | + unregister_hotcpu_notifier(&vscsi->nb); |
3471 | virtscsi_remove_vqs(vdev); |
3472 | return 0; |
3473 | } |
3474 | @@ -964,8 +968,17 @@ static int virtscsi_restore(struct virtio_device *vdev) |
3475 | { |
3476 | struct Scsi_Host *sh = virtio_scsi_host(vdev); |
3477 | struct virtio_scsi *vscsi = shost_priv(sh); |
3478 | + int err; |
3479 | + |
3480 | + err = virtscsi_init(vdev, vscsi); |
3481 | + if (err) |
3482 | + return err; |
3483 | + |
3484 | + err = register_hotcpu_notifier(&vscsi->nb); |
3485 | + if (err) |
3486 | + vdev->config->del_vqs(vdev); |
3487 | |
3488 | - return virtscsi_init(vdev, vscsi); |
3489 | + return err; |
3490 | } |
3491 | #endif |
3492 | |
3493 | diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c |
3494 | index a0e009717a5a..d6047b9535ae 100644 |
3495 | --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c |
3496 | +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c |
3497 | @@ -179,7 +179,7 @@ int ptlrpc_register_bulk(struct ptlrpc_request *req) |
3498 | LNET_UNLINK, LNET_INS_AFTER, &me_h); |
3499 | if (rc != 0) { |
3500 | CERROR("%s: LNetMEAttach failed x"LPU64"/%d: rc = %d\n", |
3501 | - desc->bd_export->exp_obd->obd_name, xid, |
3502 | + desc->bd_import->imp_obd->obd_name, xid, |
3503 | posted_md, rc); |
3504 | break; |
3505 | } |
3506 | @@ -189,7 +189,7 @@ int ptlrpc_register_bulk(struct ptlrpc_request *req) |
3507 | &desc->bd_mds[posted_md]); |
3508 | if (rc != 0) { |
3509 | CERROR("%s: LNetMDAttach failed x"LPU64"/%d: rc = %d\n", |
3510 | - desc->bd_export->exp_obd->obd_name, xid, |
3511 | + desc->bd_import->imp_obd->obd_name, xid, |
3512 | posted_md, rc); |
3513 | rc2 = LNetMEUnlink(me_h); |
3514 | LASSERT(rc2 == 0); |
3515 | @@ -219,7 +219,7 @@ int ptlrpc_register_bulk(struct ptlrpc_request *req) |
3516 | /* Holler if peer manages to touch buffers before he knows the xid */ |
3517 | if (desc->bd_md_count != total_md) |
3518 | CWARN("%s: Peer %s touched %d buffers while I registered\n", |
3519 | - desc->bd_export->exp_obd->obd_name, libcfs_id2str(peer), |
3520 | + desc->bd_import->imp_obd->obd_name, libcfs_id2str(peer), |
3521 | total_md - desc->bd_md_count); |
3522 | spin_unlock(&desc->bd_lock); |
3523 | |
3524 | diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c |
3525 | index dbefa43e4c2c..bbd5888e316b 100644 |
3526 | --- a/drivers/staging/rtl8712/usb_intf.c |
3527 | +++ b/drivers/staging/rtl8712/usb_intf.c |
3528 | @@ -353,6 +353,10 @@ static void disable_ht_for_spec_devid(const struct usb_device_id *pdid, |
3529 | } |
3530 | } |
3531 | |
3532 | +static const struct device_type wlan_type = { |
3533 | + .name = "wlan", |
3534 | +}; |
3535 | + |
3536 | /* |
3537 | * drv_init() - a device potentially for us |
3538 | * |
3539 | @@ -388,6 +392,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf, |
3540 | padapter->pusb_intf = pusb_intf; |
3541 | usb_set_intfdata(pusb_intf, pnetdev); |
3542 | SET_NETDEV_DEV(pnetdev, &pusb_intf->dev); |
3543 | + pnetdev->dev.type = &wlan_type; |
3544 | /* step 2. */ |
3545 | padapter->dvobj_init = &r8712_usb_dvobj_init; |
3546 | padapter->dvobj_deinit = &r8712_usb_dvobj_deinit; |
3547 | diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c |
3548 | index 4aa5ef54b683..22e117440f94 100644 |
3549 | --- a/drivers/staging/vt6656/baseband.c |
3550 | +++ b/drivers/staging/vt6656/baseband.c |
3551 | @@ -1464,7 +1464,6 @@ void BBvUpdatePreEDThreshold(struct vnt_private *pDevice, int bScanning) |
3552 | |
3553 | if( bScanning ) |
3554 | { // need Max sensitivity //RSSI -69, -70,.... |
3555 | - if(pDevice->byBBPreEDIndex == 0) break; |
3556 | pDevice->byBBPreEDIndex = 0; |
3557 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) |
3558 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x30); //CR206(0xCE) |
3559 | @@ -1607,7 +1606,6 @@ void BBvUpdatePreEDThreshold(struct vnt_private *pDevice, int bScanning) |
3560 | |
3561 | if( bScanning ) |
3562 | { // need Max sensitivity //RSSI -69, -70, ... |
3563 | - if(pDevice->byBBPreEDIndex == 0) break; |
3564 | pDevice->byBBPreEDIndex = 0; |
3565 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) |
3566 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x24); //CR206(0xCE) |
3567 | @@ -1759,7 +1757,6 @@ void BBvUpdatePreEDThreshold(struct vnt_private *pDevice, int bScanning) |
3568 | case RF_VT3342A0: //RobertYu:20060627, testing table |
3569 | if( bScanning ) |
3570 | { // need Max sensitivity //RSSI -67, -68, ... |
3571 | - if(pDevice->byBBPreEDIndex == 0) break; |
3572 | pDevice->byBBPreEDIndex = 0; |
3573 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0x00); //CR201(0xC9) |
3574 | ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xCE, 0x38); //CR206(0xCE) |
3575 | diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c |
3576 | index 19d3cf451b88..34a24b78c1a7 100644 |
3577 | --- a/drivers/staging/vt6656/card.c |
3578 | +++ b/drivers/staging/vt6656/card.c |
3579 | @@ -731,7 +731,7 @@ u64 CARDqGetNextTBTT(u64 qwTSF, u16 wBeaconInterval) |
3580 | |
3581 | uBeaconInterval = wBeaconInterval * 1024; |
3582 | // Next TBTT = ((local_current_TSF / beacon_interval) + 1 ) * beacon_interval |
3583 | - uLowNextTBTT = ((qwTSF & 0xffffffffU) >> 10) << 10; |
3584 | + uLowNextTBTT = ((qwTSF & 0xffffffffULL) >> 10) << 10; |
3585 | uLowRemain = (uLowNextTBTT) % uBeaconInterval; |
3586 | uHighRemain = ((0x80000000 % uBeaconInterval) * 2 * (u32)(qwTSF >> 32)) |
3587 | % uBeaconInterval; |
3588 | diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c |
3589 | index 3277d9838f4e..bfbfe579d896 100644 |
3590 | --- a/drivers/staging/zram/zram_drv.c |
3591 | +++ b/drivers/staging/zram/zram_drv.c |
3592 | @@ -552,14 +552,14 @@ static void zram_reset_device(struct zram *zram, bool reset_capacity) |
3593 | size_t index; |
3594 | struct zram_meta *meta; |
3595 | |
3596 | - flush_work(&zram->free_work); |
3597 | - |
3598 | down_write(&zram->init_lock); |
3599 | if (!zram->init_done) { |
3600 | up_write(&zram->init_lock); |
3601 | return; |
3602 | } |
3603 | |
3604 | + flush_work(&zram->free_work); |
3605 | + |
3606 | meta = zram->meta; |
3607 | zram->init_done = 0; |
3608 | |
3609 | diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
3610 | index 00867190413c..5049db4651c5 100644 |
3611 | --- a/drivers/target/iscsi/iscsi_target.c |
3612 | +++ b/drivers/target/iscsi/iscsi_target.c |
3613 | @@ -52,7 +52,7 @@ |
3614 | static LIST_HEAD(g_tiqn_list); |
3615 | static LIST_HEAD(g_np_list); |
3616 | static DEFINE_SPINLOCK(tiqn_lock); |
3617 | -static DEFINE_SPINLOCK(np_lock); |
3618 | +static DEFINE_MUTEX(np_lock); |
3619 | |
3620 | static struct idr tiqn_idr; |
3621 | struct idr sess_idr; |
3622 | @@ -307,6 +307,9 @@ bool iscsit_check_np_match( |
3623 | return false; |
3624 | } |
3625 | |
3626 | +/* |
3627 | + * Called with mutex np_lock held |
3628 | + */ |
3629 | static struct iscsi_np *iscsit_get_np( |
3630 | struct __kernel_sockaddr_storage *sockaddr, |
3631 | int network_transport) |
3632 | @@ -314,11 +317,10 @@ static struct iscsi_np *iscsit_get_np( |
3633 | struct iscsi_np *np; |
3634 | bool match; |
3635 | |
3636 | - spin_lock_bh(&np_lock); |
3637 | list_for_each_entry(np, &g_np_list, np_list) { |
3638 | - spin_lock(&np->np_thread_lock); |
3639 | + spin_lock_bh(&np->np_thread_lock); |
3640 | if (np->np_thread_state != ISCSI_NP_THREAD_ACTIVE) { |
3641 | - spin_unlock(&np->np_thread_lock); |
3642 | + spin_unlock_bh(&np->np_thread_lock); |
3643 | continue; |
3644 | } |
3645 | |
3646 | @@ -330,13 +332,11 @@ static struct iscsi_np *iscsit_get_np( |
3647 | * while iscsi_tpg_add_network_portal() is called. |
3648 | */ |
3649 | np->np_exports++; |
3650 | - spin_unlock(&np->np_thread_lock); |
3651 | - spin_unlock_bh(&np_lock); |
3652 | + spin_unlock_bh(&np->np_thread_lock); |
3653 | return np; |
3654 | } |
3655 | - spin_unlock(&np->np_thread_lock); |
3656 | + spin_unlock_bh(&np->np_thread_lock); |
3657 | } |
3658 | - spin_unlock_bh(&np_lock); |
3659 | |
3660 | return NULL; |
3661 | } |
3662 | @@ -350,16 +350,22 @@ struct iscsi_np *iscsit_add_np( |
3663 | struct sockaddr_in6 *sock_in6; |
3664 | struct iscsi_np *np; |
3665 | int ret; |
3666 | + |
3667 | + mutex_lock(&np_lock); |
3668 | + |
3669 | /* |
3670 | * Locate the existing struct iscsi_np if already active.. |
3671 | */ |
3672 | np = iscsit_get_np(sockaddr, network_transport); |
3673 | - if (np) |
3674 | + if (np) { |
3675 | + mutex_unlock(&np_lock); |
3676 | return np; |
3677 | + } |
3678 | |
3679 | np = kzalloc(sizeof(struct iscsi_np), GFP_KERNEL); |
3680 | if (!np) { |
3681 | pr_err("Unable to allocate memory for struct iscsi_np\n"); |
3682 | + mutex_unlock(&np_lock); |
3683 | return ERR_PTR(-ENOMEM); |
3684 | } |
3685 | |
3686 | @@ -382,6 +388,7 @@ struct iscsi_np *iscsit_add_np( |
3687 | ret = iscsi_target_setup_login_socket(np, sockaddr); |
3688 | if (ret != 0) { |
3689 | kfree(np); |
3690 | + mutex_unlock(&np_lock); |
3691 | return ERR_PTR(ret); |
3692 | } |
3693 | |
3694 | @@ -390,6 +397,7 @@ struct iscsi_np *iscsit_add_np( |
3695 | pr_err("Unable to create kthread: iscsi_np\n"); |
3696 | ret = PTR_ERR(np->np_thread); |
3697 | kfree(np); |
3698 | + mutex_unlock(&np_lock); |
3699 | return ERR_PTR(ret); |
3700 | } |
3701 | /* |
3702 | @@ -400,10 +408,10 @@ struct iscsi_np *iscsit_add_np( |
3703 | * point because iscsi_np has not been added to g_np_list yet. |
3704 | */ |
3705 | np->np_exports = 1; |
3706 | + np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; |
3707 | |
3708 | - spin_lock_bh(&np_lock); |
3709 | list_add_tail(&np->np_list, &g_np_list); |
3710 | - spin_unlock_bh(&np_lock); |
3711 | + mutex_unlock(&np_lock); |
3712 | |
3713 | pr_debug("CORE[0] - Added Network Portal: %s:%hu on %s\n", |
3714 | np->np_ip, np->np_port, np->np_transport->name); |
3715 | @@ -470,9 +478,9 @@ int iscsit_del_np(struct iscsi_np *np) |
3716 | |
3717 | np->np_transport->iscsit_free_np(np); |
3718 | |
3719 | - spin_lock_bh(&np_lock); |
3720 | + mutex_lock(&np_lock); |
3721 | list_del(&np->np_list); |
3722 | - spin_unlock_bh(&np_lock); |
3723 | + mutex_unlock(&np_lock); |
3724 | |
3725 | pr_debug("CORE[0] - Removed Network Portal: %s:%hu on %s\n", |
3726 | np->np_ip, np->np_port, np->np_transport->name); |
3727 | diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c |
3728 | index 83c965c65386..582ba84075ec 100644 |
3729 | --- a/drivers/target/iscsi/iscsi_target_nego.c |
3730 | +++ b/drivers/target/iscsi/iscsi_target_nego.c |
3731 | @@ -1192,7 +1192,7 @@ get_target: |
3732 | */ |
3733 | alloc_tags: |
3734 | tag_num = max_t(u32, ISCSIT_MIN_TAGS, queue_depth); |
3735 | - tag_num += (tag_num / 2) + ISCSIT_EXTRA_TAGS; |
3736 | + tag_num = (tag_num * 2) + ISCSIT_EXTRA_TAGS; |
3737 | tag_size = sizeof(struct iscsi_cmd) + conn->conn_transport->priv_size; |
3738 | |
3739 | ret = transport_alloc_session_tags(sess->se_sess, tag_num, tag_size); |
3740 | diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig |
3741 | index 978db344bda0..b24aa010f68c 100644 |
3742 | --- a/drivers/tty/Kconfig |
3743 | +++ b/drivers/tty/Kconfig |
3744 | @@ -366,7 +366,7 @@ config TRACE_SINK |
3745 | "Trace data router for MIPI P1149.7 cJTAG standard". |
3746 | |
3747 | config PPC_EPAPR_HV_BYTECHAN |
3748 | - tristate "ePAPR hypervisor byte channel driver" |
3749 | + bool "ePAPR hypervisor byte channel driver" |
3750 | depends on PPC |
3751 | select EPAPR_PARAVIRT |
3752 | help |
3753 | diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c |
3754 | index e33d38cb170f..61ecd709a722 100644 |
3755 | --- a/drivers/tty/serial/8250/8250_core.c |
3756 | +++ b/drivers/tty/serial/8250/8250_core.c |
3757 | @@ -2670,6 +2670,10 @@ static void serial8250_config_port(struct uart_port *port, int flags) |
3758 | if (port->type == PORT_16550A && port->iotype == UPIO_AU) |
3759 | up->bugs |= UART_BUG_NOMSR; |
3760 | |
3761 | + /* HW bugs may trigger IRQ while IIR == NO_INT */ |
3762 | + if (port->type == PORT_TEGRA) |
3763 | + up->bugs |= UART_BUG_NOMSR; |
3764 | + |
3765 | if (port->type != PORT_UNKNOWN && flags & UART_CONFIG_IRQ) |
3766 | autoconfig_irq(up); |
3767 | |
3768 | diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c |
3769 | index 4697a514b80a..77d0aca9050a 100644 |
3770 | --- a/drivers/tty/serial/8250/8250_pci.c |
3771 | +++ b/drivers/tty/serial/8250/8250_pci.c |
3772 | @@ -1259,10 +1259,10 @@ static int pci_quatech_init(struct pci_dev *dev) |
3773 | unsigned long base = pci_resource_start(dev, 0); |
3774 | if (base) { |
3775 | u32 tmp; |
3776 | - outl(inl(base + 0x38), base + 0x38); |
3777 | + outl(inl(base + 0x38) | 0x00002000, base + 0x38); |
3778 | tmp = inl(base + 0x3c); |
3779 | outl(tmp | 0x01000000, base + 0x3c); |
3780 | - outl(tmp, base + 0x3c); |
3781 | + outl(tmp &= ~0x01000000, base + 0x3c); |
3782 | } |
3783 | } |
3784 | return 0; |
3785 | @@ -1744,6 +1744,7 @@ pci_wch_ch353_setup(struct serial_private *priv, |
3786 | #define PCI_DEVICE_ID_TITAN_800E 0xA014 |
3787 | #define PCI_DEVICE_ID_TITAN_200EI 0xA016 |
3788 | #define PCI_DEVICE_ID_TITAN_200EISI 0xA017 |
3789 | +#define PCI_DEVICE_ID_TITAN_200V3 0xA306 |
3790 | #define PCI_DEVICE_ID_TITAN_400V3 0xA310 |
3791 | #define PCI_DEVICE_ID_TITAN_410V3 0xA312 |
3792 | #define PCI_DEVICE_ID_TITAN_800V3 0xA314 |
3793 | @@ -4427,6 +4428,9 @@ static struct pci_device_id serial_pci_tbl[] = { |
3794 | { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200EISI, |
3795 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
3796 | pbn_oxsemi_2_4000000 }, |
3797 | + { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200V3, |
3798 | + PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
3799 | + pbn_b0_bt_2_921600 }, |
3800 | { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400V3, |
3801 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
3802 | pbn_b0_4_921600 }, |
3803 | diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c |
3804 | index c7d99af46a96..a49f10d269b2 100644 |
3805 | --- a/drivers/tty/serial/atmel_serial.c |
3806 | +++ b/drivers/tty/serial/atmel_serial.c |
3807 | @@ -825,9 +825,6 @@ static void atmel_release_rx_dma(struct uart_port *port) |
3808 | atmel_port->desc_rx = NULL; |
3809 | atmel_port->chan_rx = NULL; |
3810 | atmel_port->cookie_rx = -EINVAL; |
3811 | - |
3812 | - if (!atmel_port->is_usart) |
3813 | - del_timer_sync(&atmel_port->uart_timer); |
3814 | } |
3815 | |
3816 | static void atmel_rx_from_dma(struct uart_port *port) |
3817 | @@ -1229,9 +1226,6 @@ static void atmel_release_rx_pdc(struct uart_port *port) |
3818 | DMA_FROM_DEVICE); |
3819 | kfree(pdc->buf); |
3820 | } |
3821 | - |
3822 | - if (!atmel_port->is_usart) |
3823 | - del_timer_sync(&atmel_port->uart_timer); |
3824 | } |
3825 | |
3826 | static void atmel_rx_from_pdc(struct uart_port *port) |
3827 | @@ -1604,12 +1598,13 @@ static int atmel_startup(struct uart_port *port) |
3828 | /* enable xmit & rcvr */ |
3829 | UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN); |
3830 | |
3831 | + setup_timer(&atmel_port->uart_timer, |
3832 | + atmel_uart_timer_callback, |
3833 | + (unsigned long)port); |
3834 | + |
3835 | if (atmel_use_pdc_rx(port)) { |
3836 | /* set UART timeout */ |
3837 | if (!atmel_port->is_usart) { |
3838 | - setup_timer(&atmel_port->uart_timer, |
3839 | - atmel_uart_timer_callback, |
3840 | - (unsigned long)port); |
3841 | mod_timer(&atmel_port->uart_timer, |
3842 | jiffies + uart_poll_timeout(port)); |
3843 | /* set USART timeout */ |
3844 | @@ -1624,9 +1619,6 @@ static int atmel_startup(struct uart_port *port) |
3845 | } else if (atmel_use_dma_rx(port)) { |
3846 | /* set UART timeout */ |
3847 | if (!atmel_port->is_usart) { |
3848 | - setup_timer(&atmel_port->uart_timer, |
3849 | - atmel_uart_timer_callback, |
3850 | - (unsigned long)port); |
3851 | mod_timer(&atmel_port->uart_timer, |
3852 | jiffies + uart_poll_timeout(port)); |
3853 | /* set USART timeout */ |
3854 | @@ -1650,12 +1642,30 @@ static int atmel_startup(struct uart_port *port) |
3855 | static void atmel_shutdown(struct uart_port *port) |
3856 | { |
3857 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
3858 | + |
3859 | /* |
3860 | - * Ensure everything is stopped. |
3861 | + * Prevent any tasklets being scheduled during |
3862 | + * cleanup |
3863 | + */ |
3864 | + del_timer_sync(&atmel_port->uart_timer); |
3865 | + |
3866 | + /* |
3867 | + * Clear out any scheduled tasklets before |
3868 | + * we destroy the buffers |
3869 | + */ |
3870 | + tasklet_kill(&atmel_port->tasklet); |
3871 | + |
3872 | + /* |
3873 | + * Ensure everything is stopped and |
3874 | + * disable all interrupts, port and break condition. |
3875 | */ |
3876 | atmel_stop_rx(port); |
3877 | atmel_stop_tx(port); |
3878 | |
3879 | + UART_PUT_CR(port, ATMEL_US_RSTSTA); |
3880 | + UART_PUT_IDR(port, -1); |
3881 | + |
3882 | + |
3883 | /* |
3884 | * Shut-down the DMA. |
3885 | */ |
3886 | @@ -1665,10 +1675,10 @@ static void atmel_shutdown(struct uart_port *port) |
3887 | atmel_port->release_tx(port); |
3888 | |
3889 | /* |
3890 | - * Disable all interrupts, port and break condition. |
3891 | + * Reset ring buffer pointers |
3892 | */ |
3893 | - UART_PUT_CR(port, ATMEL_US_RSTSTA); |
3894 | - UART_PUT_IDR(port, -1); |
3895 | + atmel_port->rx_ring.head = 0; |
3896 | + atmel_port->rx_ring.tail = 0; |
3897 | |
3898 | /* |
3899 | * Free the interrupt |
3900 | @@ -2441,11 +2451,12 @@ static int atmel_serial_remove(struct platform_device *pdev) |
3901 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
3902 | int ret = 0; |
3903 | |
3904 | + tasklet_kill(&atmel_port->tasklet); |
3905 | + |
3906 | device_init_wakeup(&pdev->dev, 0); |
3907 | |
3908 | ret = uart_remove_one_port(&atmel_uart, port); |
3909 | |
3910 | - tasklet_kill(&atmel_port->tasklet); |
3911 | kfree(atmel_port->rx_ring.buf); |
3912 | |
3913 | /* "port" is allocated statically, so we shouldn't free it */ |
3914 | diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c |
3915 | index f7beb6eb40c7..a673e5b6a2e0 100644 |
3916 | --- a/drivers/uio/uio.c |
3917 | +++ b/drivers/uio/uio.c |
3918 | @@ -847,7 +847,7 @@ int __uio_register_device(struct module *owner, |
3919 | info->uio_dev = idev; |
3920 | |
3921 | if (info->irq && (info->irq != UIO_IRQ_CUSTOM)) { |
3922 | - ret = devm_request_irq(parent, info->irq, uio_interrupt, |
3923 | + ret = devm_request_irq(idev->dev, info->irq, uio_interrupt, |
3924 | info->irq_flags, info->name, idev); |
3925 | if (ret) |
3926 | goto err_request_irq; |
3927 | diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h |
3928 | index 1c94fc5257f4..5ad448d0fb7d 100644 |
3929 | --- a/drivers/usb/chipidea/ci.h |
3930 | +++ b/drivers/usb/chipidea/ci.h |
3931 | @@ -135,6 +135,7 @@ struct hw_bank { |
3932 | * @id_event: indicates there is an id event, and handled at ci_otg_work |
3933 | * @b_sess_valid_event: indicates there is a vbus event, and handled |
3934 | * at ci_otg_work |
3935 | + * @imx28_write_fix: Freescale imx28 needs swp instruction for writing |
3936 | */ |
3937 | struct ci_hdrc { |
3938 | struct device *dev; |
3939 | @@ -173,6 +174,7 @@ struct ci_hdrc { |
3940 | struct dentry *debugfs; |
3941 | bool id_event; |
3942 | bool b_sess_valid_event; |
3943 | + bool imx28_write_fix; |
3944 | }; |
3945 | |
3946 | static inline struct ci_role_driver *ci_role(struct ci_hdrc *ci) |
3947 | @@ -253,6 +255,26 @@ static inline u32 hw_read(struct ci_hdrc *ci, enum ci_hw_regs reg, u32 mask) |
3948 | return ioread32(ci->hw_bank.regmap[reg]) & mask; |
3949 | } |
3950 | |
3951 | +#ifdef CONFIG_SOC_IMX28 |
3952 | +static inline void imx28_ci_writel(u32 val, volatile void __iomem *addr) |
3953 | +{ |
3954 | + __asm__ ("swp %0, %0, [%1]" : : "r"(val), "r"(addr)); |
3955 | +} |
3956 | +#else |
3957 | +static inline void imx28_ci_writel(u32 val, volatile void __iomem *addr) |
3958 | +{ |
3959 | +} |
3960 | +#endif |
3961 | + |
3962 | +static inline void __hw_write(struct ci_hdrc *ci, u32 val, |
3963 | + void __iomem *addr) |
3964 | +{ |
3965 | + if (ci->imx28_write_fix) |
3966 | + imx28_ci_writel(val, addr); |
3967 | + else |
3968 | + iowrite32(val, addr); |
3969 | +} |
3970 | + |
3971 | /** |
3972 | * hw_write: writes to a hw register |
3973 | * @reg: register index |
3974 | @@ -266,7 +288,7 @@ static inline void hw_write(struct ci_hdrc *ci, enum ci_hw_regs reg, |
3975 | data = (ioread32(ci->hw_bank.regmap[reg]) & ~mask) |
3976 | | (data & mask); |
3977 | |
3978 | - iowrite32(data, ci->hw_bank.regmap[reg]); |
3979 | + __hw_write(ci, data, ci->hw_bank.regmap[reg]); |
3980 | } |
3981 | |
3982 | /** |
3983 | @@ -281,7 +303,7 @@ static inline u32 hw_test_and_clear(struct ci_hdrc *ci, enum ci_hw_regs reg, |
3984 | { |
3985 | u32 val = ioread32(ci->hw_bank.regmap[reg]) & mask; |
3986 | |
3987 | - iowrite32(val, ci->hw_bank.regmap[reg]); |
3988 | + __hw_write(ci, val, ci->hw_bank.regmap[reg]); |
3989 | return val; |
3990 | } |
3991 | |
3992 | diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c |
3993 | index bb5d976e5b81..c00f77257d36 100644 |
3994 | --- a/drivers/usb/chipidea/ci_hdrc_imx.c |
3995 | +++ b/drivers/usb/chipidea/ci_hdrc_imx.c |
3996 | @@ -23,6 +23,26 @@ |
3997 | #include "ci.h" |
3998 | #include "ci_hdrc_imx.h" |
3999 | |
4000 | +#define CI_HDRC_IMX_IMX28_WRITE_FIX BIT(0) |
4001 | + |
4002 | +struct ci_hdrc_imx_platform_flag { |
4003 | + unsigned int flags; |
4004 | +}; |
4005 | + |
4006 | +static const struct ci_hdrc_imx_platform_flag imx27_usb_data = { |
4007 | +}; |
4008 | + |
4009 | +static const struct ci_hdrc_imx_platform_flag imx28_usb_data = { |
4010 | + .flags = CI_HDRC_IMX_IMX28_WRITE_FIX, |
4011 | +}; |
4012 | + |
4013 | +static const struct of_device_id ci_hdrc_imx_dt_ids[] = { |
4014 | + { .compatible = "fsl,imx28-usb", .data = &imx28_usb_data}, |
4015 | + { .compatible = "fsl,imx27-usb", .data = &imx27_usb_data}, |
4016 | + { /* sentinel */ } |
4017 | +}; |
4018 | +MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids); |
4019 | + |
4020 | struct ci_hdrc_imx_data { |
4021 | struct usb_phy *phy; |
4022 | struct platform_device *ci_pdev; |
4023 | @@ -82,6 +102,9 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) |
4024 | CI_HDRC_DISABLE_STREAMING, |
4025 | }; |
4026 | int ret; |
4027 | + const struct of_device_id *of_id = |
4028 | + of_match_device(ci_hdrc_imx_dt_ids, &pdev->dev); |
4029 | + const struct ci_hdrc_imx_platform_flag *imx_platform_flag = of_id->data; |
4030 | |
4031 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); |
4032 | if (!data) { |
4033 | @@ -115,6 +138,9 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) |
4034 | |
4035 | pdata.phy = data->phy; |
4036 | |
4037 | + if (imx_platform_flag->flags & CI_HDRC_IMX_IMX28_WRITE_FIX) |
4038 | + pdata.flags |= CI_HDRC_IMX28_WRITE_FIX; |
4039 | + |
4040 | ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
4041 | if (ret) |
4042 | goto err_clk; |
4043 | @@ -173,12 +199,6 @@ static int ci_hdrc_imx_remove(struct platform_device *pdev) |
4044 | return 0; |
4045 | } |
4046 | |
4047 | -static const struct of_device_id ci_hdrc_imx_dt_ids[] = { |
4048 | - { .compatible = "fsl,imx27-usb", }, |
4049 | - { /* sentinel */ } |
4050 | -}; |
4051 | -MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids); |
4052 | - |
4053 | static struct platform_driver ci_hdrc_imx_driver = { |
4054 | .probe = ci_hdrc_imx_probe, |
4055 | .remove = ci_hdrc_imx_remove, |
4056 | diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c |
4057 | index 6e73f8cd60e5..5efdc9b45f89 100644 |
4058 | --- a/drivers/usb/chipidea/core.c |
4059 | +++ b/drivers/usb/chipidea/core.c |
4060 | @@ -554,6 +554,8 @@ static int ci_hdrc_probe(struct platform_device *pdev) |
4061 | |
4062 | ci->dev = dev; |
4063 | ci->platdata = dev->platform_data; |
4064 | + ci->imx28_write_fix = !!(ci->platdata->flags & |
4065 | + CI_HDRC_IMX28_WRITE_FIX); |
4066 | |
4067 | ret = hw_device_init(ci, base); |
4068 | if (ret < 0) { |
4069 | diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c |
4070 | index 526cd77563d8..a8ac6c16dac9 100644 |
4071 | --- a/drivers/usb/chipidea/host.c |
4072 | +++ b/drivers/usb/chipidea/host.c |
4073 | @@ -65,6 +65,7 @@ static int host_start(struct ci_hdrc *ci) |
4074 | ehci->caps = ci->hw_bank.cap; |
4075 | ehci->has_hostpc = ci->hw_bank.lpm; |
4076 | ehci->has_tdi_phy_lpm = ci->hw_bank.lpm; |
4077 | + ehci->imx28_write_fix = ci->imx28_write_fix; |
4078 | |
4079 | if (ci->platdata->reg_vbus) { |
4080 | ret = regulator_enable(ci->platdata->reg_vbus); |
4081 | diff --git a/drivers/usb/chipidea/otg.h b/drivers/usb/chipidea/otg.h |
4082 | index 2d9f090733bc..449bee07f4fe 100644 |
4083 | --- a/drivers/usb/chipidea/otg.h |
4084 | +++ b/drivers/usb/chipidea/otg.h |
4085 | @@ -1,5 +1,5 @@ |
4086 | /* |
4087 | - * Copyright (C) 2013 Freescale Semiconductor, Inc. |
4088 | + * Copyright (C) 2013-2014 Freescale Semiconductor, Inc. |
4089 | * |
4090 | * Author: Peter Chen |
4091 | * |
4092 | @@ -19,12 +19,12 @@ static inline void ci_clear_otg_interrupt(struct ci_hdrc *ci, u32 bits) |
4093 | |
4094 | static inline void ci_enable_otg_interrupt(struct ci_hdrc *ci, u32 bits) |
4095 | { |
4096 | - hw_write(ci, OP_OTGSC, bits, bits); |
4097 | + hw_write(ci, OP_OTGSC, bits | OTGSC_INT_STATUS_BITS, bits); |
4098 | } |
4099 | |
4100 | static inline void ci_disable_otg_interrupt(struct ci_hdrc *ci, u32 bits) |
4101 | { |
4102 | - hw_write(ci, OP_OTGSC, bits, 0); |
4103 | + hw_write(ci, OP_OTGSC, bits | OTGSC_INT_STATUS_BITS, 0); |
4104 | } |
4105 | |
4106 | int ci_hdrc_otg_init(struct ci_hdrc *ci); |
4107 | diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c |
4108 | index 69d20fbb38a2..5875c2a8daf1 100644 |
4109 | --- a/drivers/usb/chipidea/udc.c |
4110 | +++ b/drivers/usb/chipidea/udc.c |
4111 | @@ -393,6 +393,14 @@ static int add_td_to_list(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq, |
4112 | node->ptr->token = cpu_to_le32(length << __ffs(TD_TOTAL_BYTES)); |
4113 | node->ptr->token &= cpu_to_le32(TD_TOTAL_BYTES); |
4114 | node->ptr->token |= cpu_to_le32(TD_STATUS_ACTIVE); |
4115 | + if (hwep->type == USB_ENDPOINT_XFER_ISOC && hwep->dir == TX) { |
4116 | + u32 mul = hwreq->req.length / hwep->ep.maxpacket; |
4117 | + |
4118 | + if (hwreq->req.length == 0 |
4119 | + || hwreq->req.length % hwep->ep.maxpacket) |
4120 | + mul++; |
4121 | + node->ptr->token |= mul << __ffs(TD_MULTO); |
4122 | + } |
4123 | |
4124 | temp = (u32) (hwreq->req.dma + hwreq->req.actual); |
4125 | if (length) { |
4126 | @@ -515,10 +523,11 @@ static int _hardware_enqueue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq) |
4127 | hwep->qh.ptr->td.token &= |
4128 | cpu_to_le32(~(TD_STATUS_HALTED|TD_STATUS_ACTIVE)); |
4129 | |
4130 | - if (hwep->type == USB_ENDPOINT_XFER_ISOC) { |
4131 | + if (hwep->type == USB_ENDPOINT_XFER_ISOC && hwep->dir == RX) { |
4132 | u32 mul = hwreq->req.length / hwep->ep.maxpacket; |
4133 | |
4134 | - if (hwreq->req.length % hwep->ep.maxpacket) |
4135 | + if (hwreq->req.length == 0 |
4136 | + || hwreq->req.length % hwep->ep.maxpacket) |
4137 | mul++; |
4138 | hwep->qh.ptr->cap |= mul << __ffs(QH_MULT); |
4139 | } |
4140 | @@ -1173,6 +1182,12 @@ static int ep_enable(struct usb_ep *ep, |
4141 | if (hwep->num) |
4142 | cap |= QH_ZLT; |
4143 | cap |= (hwep->ep.maxpacket << __ffs(QH_MAX_PKT)) & QH_MAX_PKT; |
4144 | + /* |
4145 | + * For ISO-TX, we set mult at QH as the largest value, and use |
4146 | + * MultO at TD as real mult value. |
4147 | + */ |
4148 | + if (hwep->type == USB_ENDPOINT_XFER_ISOC && hwep->dir == TX) |
4149 | + cap |= 3 << __ffs(QH_MULT); |
4150 | |
4151 | hwep->qh.ptr->cap = cpu_to_le32(cap); |
4152 | |
4153 | diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c |
4154 | index 0b23a8639311..a051a7a2b1bd 100644 |
4155 | --- a/drivers/usb/class/cdc-wdm.c |
4156 | +++ b/drivers/usb/class/cdc-wdm.c |
4157 | @@ -432,6 +432,38 @@ outnl: |
4158 | return rv < 0 ? rv : count; |
4159 | } |
4160 | |
4161 | +/* |
4162 | + * clear WDM_READ flag and possibly submit the read urb if resp_count |
4163 | + * is non-zero. |
4164 | + * |
4165 | + * Called with desc->iuspin locked |
4166 | + */ |
4167 | +static int clear_wdm_read_flag(struct wdm_device *desc) |
4168 | +{ |
4169 | + int rv = 0; |
4170 | + |
4171 | + clear_bit(WDM_READ, &desc->flags); |
4172 | + |
4173 | + /* submit read urb only if the device is waiting for it */ |
4174 | + if (!desc->resp_count || !--desc->resp_count) |
4175 | + goto out; |
4176 | + |
4177 | + set_bit(WDM_RESPONDING, &desc->flags); |
4178 | + spin_unlock_irq(&desc->iuspin); |
4179 | + rv = usb_submit_urb(desc->response, GFP_KERNEL); |
4180 | + spin_lock_irq(&desc->iuspin); |
4181 | + if (rv) { |
4182 | + dev_err(&desc->intf->dev, |
4183 | + "usb_submit_urb failed with result %d\n", rv); |
4184 | + |
4185 | + /* make sure the next notification trigger a submit */ |
4186 | + clear_bit(WDM_RESPONDING, &desc->flags); |
4187 | + desc->resp_count = 0; |
4188 | + } |
4189 | +out: |
4190 | + return rv; |
4191 | +} |
4192 | + |
4193 | static ssize_t wdm_read |
4194 | (struct file *file, char __user *buffer, size_t count, loff_t *ppos) |
4195 | { |
4196 | @@ -503,8 +535,10 @@ retry: |
4197 | |
4198 | if (!desc->reslength) { /* zero length read */ |
4199 | dev_dbg(&desc->intf->dev, "%s: zero length - clearing WDM_READ\n", __func__); |
4200 | - clear_bit(WDM_READ, &desc->flags); |
4201 | + rv = clear_wdm_read_flag(desc); |
4202 | spin_unlock_irq(&desc->iuspin); |
4203 | + if (rv < 0) |
4204 | + goto err; |
4205 | goto retry; |
4206 | } |
4207 | cntr = desc->length; |
4208 | @@ -526,37 +560,9 @@ retry: |
4209 | |
4210 | desc->length -= cntr; |
4211 | /* in case we had outstanding data */ |
4212 | - if (!desc->length) { |
4213 | - clear_bit(WDM_READ, &desc->flags); |
4214 | - |
4215 | - if (--desc->resp_count) { |
4216 | - set_bit(WDM_RESPONDING, &desc->flags); |
4217 | - spin_unlock_irq(&desc->iuspin); |
4218 | - |
4219 | - rv = usb_submit_urb(desc->response, GFP_KERNEL); |
4220 | - if (rv) { |
4221 | - dev_err(&desc->intf->dev, |
4222 | - "%s: usb_submit_urb failed with result %d\n", |
4223 | - __func__, rv); |
4224 | - spin_lock_irq(&desc->iuspin); |
4225 | - clear_bit(WDM_RESPONDING, &desc->flags); |
4226 | - spin_unlock_irq(&desc->iuspin); |
4227 | - |
4228 | - if (rv == -ENOMEM) { |
4229 | - rv = schedule_work(&desc->rxwork); |
4230 | - if (rv) |
4231 | - dev_err(&desc->intf->dev, "Cannot schedule work\n"); |
4232 | - } else { |
4233 | - spin_lock_irq(&desc->iuspin); |
4234 | - desc->resp_count = 0; |
4235 | - spin_unlock_irq(&desc->iuspin); |
4236 | - } |
4237 | - } |
4238 | - } else |
4239 | - spin_unlock_irq(&desc->iuspin); |
4240 | - } else |
4241 | - spin_unlock_irq(&desc->iuspin); |
4242 | - |
4243 | + if (!desc->length) |
4244 | + clear_wdm_read_flag(desc); |
4245 | + spin_unlock_irq(&desc->iuspin); |
4246 | rv = cntr; |
4247 | |
4248 | err: |
4249 | diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c |
4250 | index a6b2cabe7930..548d1996590f 100644 |
4251 | --- a/drivers/usb/core/config.c |
4252 | +++ b/drivers/usb/core/config.c |
4253 | @@ -651,10 +651,6 @@ void usb_destroy_configuration(struct usb_device *dev) |
4254 | * |
4255 | * hub-only!! ... and only in reset path, or usb_new_device() |
4256 | * (used by real hubs and virtual root hubs) |
4257 | - * |
4258 | - * NOTE: if this is a WUSB device and is not authorized, we skip the |
4259 | - * whole thing. A non-authorized USB device has no |
4260 | - * configurations. |
4261 | */ |
4262 | int usb_get_configuration(struct usb_device *dev) |
4263 | { |
4264 | @@ -666,8 +662,6 @@ int usb_get_configuration(struct usb_device *dev) |
4265 | struct usb_config_descriptor *desc; |
4266 | |
4267 | cfgno = 0; |
4268 | - if (dev->authorized == 0) /* Not really an error */ |
4269 | - goto out_not_authorized; |
4270 | result = -ENOMEM; |
4271 | if (ncfg > USB_MAXCONFIG) { |
4272 | dev_warn(ddev, "too many configurations: %d, " |
4273 | @@ -751,7 +745,6 @@ int usb_get_configuration(struct usb_device *dev) |
4274 | |
4275 | err: |
4276 | kfree(desc); |
4277 | -out_not_authorized: |
4278 | dev->descriptor.bNumConfigurations = cfgno; |
4279 | err2: |
4280 | if (result == -ENOMEM) |
4281 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
4282 | index bd9dc3504b51..07e66542ff24 100644 |
4283 | --- a/drivers/usb/core/hub.c |
4284 | +++ b/drivers/usb/core/hub.c |
4285 | @@ -1607,7 +1607,7 @@ static void hub_disconnect(struct usb_interface *intf) |
4286 | { |
4287 | struct usb_hub *hub = usb_get_intfdata(intf); |
4288 | struct usb_device *hdev = interface_to_usbdev(intf); |
4289 | - int i; |
4290 | + int port1; |
4291 | |
4292 | /* Take the hub off the event list and don't let it be added again */ |
4293 | spin_lock_irq(&hub_event_lock); |
4294 | @@ -1622,11 +1622,15 @@ static void hub_disconnect(struct usb_interface *intf) |
4295 | hub->error = 0; |
4296 | hub_quiesce(hub, HUB_DISCONNECT); |
4297 | |
4298 | - usb_set_intfdata (intf, NULL); |
4299 | + /* Avoid races with recursively_mark_NOTATTACHED() */ |
4300 | + spin_lock_irq(&device_state_lock); |
4301 | + port1 = hdev->maxchild; |
4302 | + hdev->maxchild = 0; |
4303 | + usb_set_intfdata(intf, NULL); |
4304 | + spin_unlock_irq(&device_state_lock); |
4305 | |
4306 | - for (i = 0; i < hdev->maxchild; i++) |
4307 | - usb_hub_remove_port_device(hub, i + 1); |
4308 | - hub->hdev->maxchild = 0; |
4309 | + for (; port1 > 0; --port1) |
4310 | + usb_hub_remove_port_device(hub, port1); |
4311 | |
4312 | if (hub->hdev->speed == USB_SPEED_HIGH) |
4313 | highspeed_hubs--; |
4314 | @@ -2235,17 +2239,13 @@ static int usb_enumerate_device(struct usb_device *udev) |
4315 | return err; |
4316 | } |
4317 | } |
4318 | - if (udev->wusb == 1 && udev->authorized == 0) { |
4319 | - udev->product = kstrdup("n/a (unauthorized)", GFP_KERNEL); |
4320 | - udev->manufacturer = kstrdup("n/a (unauthorized)", GFP_KERNEL); |
4321 | - udev->serial = kstrdup("n/a (unauthorized)", GFP_KERNEL); |
4322 | - } else { |
4323 | - /* read the standard strings and cache them if present */ |
4324 | - udev->product = usb_cache_string(udev, udev->descriptor.iProduct); |
4325 | - udev->manufacturer = usb_cache_string(udev, |
4326 | - udev->descriptor.iManufacturer); |
4327 | - udev->serial = usb_cache_string(udev, udev->descriptor.iSerialNumber); |
4328 | - } |
4329 | + |
4330 | + /* read the standard strings and cache them if present */ |
4331 | + udev->product = usb_cache_string(udev, udev->descriptor.iProduct); |
4332 | + udev->manufacturer = usb_cache_string(udev, |
4333 | + udev->descriptor.iManufacturer); |
4334 | + udev->serial = usb_cache_string(udev, udev->descriptor.iSerialNumber); |
4335 | + |
4336 | err = usb_enumerate_device_otg(udev); |
4337 | if (err < 0) |
4338 | return err; |
4339 | @@ -2427,16 +2427,6 @@ int usb_deauthorize_device(struct usb_device *usb_dev) |
4340 | usb_dev->authorized = 0; |
4341 | usb_set_configuration(usb_dev, -1); |
4342 | |
4343 | - kfree(usb_dev->product); |
4344 | - usb_dev->product = kstrdup("n/a (unauthorized)", GFP_KERNEL); |
4345 | - kfree(usb_dev->manufacturer); |
4346 | - usb_dev->manufacturer = kstrdup("n/a (unauthorized)", GFP_KERNEL); |
4347 | - kfree(usb_dev->serial); |
4348 | - usb_dev->serial = kstrdup("n/a (unauthorized)", GFP_KERNEL); |
4349 | - |
4350 | - usb_destroy_configuration(usb_dev); |
4351 | - usb_dev->descriptor.bNumConfigurations = 0; |
4352 | - |
4353 | out_unauthorized: |
4354 | usb_unlock_device(usb_dev); |
4355 | return 0; |
4356 | @@ -2464,17 +2454,7 @@ int usb_authorize_device(struct usb_device *usb_dev) |
4357 | goto error_device_descriptor; |
4358 | } |
4359 | |
4360 | - kfree(usb_dev->product); |
4361 | - usb_dev->product = NULL; |
4362 | - kfree(usb_dev->manufacturer); |
4363 | - usb_dev->manufacturer = NULL; |
4364 | - kfree(usb_dev->serial); |
4365 | - usb_dev->serial = NULL; |
4366 | - |
4367 | usb_dev->authorized = 1; |
4368 | - result = usb_enumerate_device(usb_dev); |
4369 | - if (result < 0) |
4370 | - goto error_enumerate; |
4371 | /* Choose and set the configuration. This registers the interfaces |
4372 | * with the driver core and lets interface drivers bind to them. |
4373 | */ |
4374 | @@ -2490,7 +2470,6 @@ int usb_authorize_device(struct usb_device *usb_dev) |
4375 | } |
4376 | dev_info(&usb_dev->dev, "authorized to connect\n"); |
4377 | |
4378 | -error_enumerate: |
4379 | error_device_descriptor: |
4380 | usb_autosuspend_device(usb_dev); |
4381 | error_autoresume: |
4382 | diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c |
4383 | index 8b20c70d91e7..28c8ad79f5e6 100644 |
4384 | --- a/drivers/usb/dwc3/dwc3-exynos.c |
4385 | +++ b/drivers/usb/dwc3/dwc3-exynos.c |
4386 | @@ -50,6 +50,7 @@ static int dwc3_exynos_register_phys(struct dwc3_exynos *exynos) |
4387 | |
4388 | exynos->usb2_phy = pdev; |
4389 | pdata.type = USB_PHY_TYPE_USB2; |
4390 | + pdata.gpio_reset = -1; |
4391 | |
4392 | ret = platform_device_add_data(exynos->usb2_phy, &pdata, sizeof(pdata)); |
4393 | if (ret) |
4394 | diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c |
4395 | index 31443aeedcdb..7e71bfa09b54 100644 |
4396 | --- a/drivers/usb/dwc3/dwc3-pci.c |
4397 | +++ b/drivers/usb/dwc3/dwc3-pci.c |
4398 | @@ -52,6 +52,7 @@ static int dwc3_pci_register_phys(struct dwc3_pci *glue) |
4399 | |
4400 | glue->usb2_phy = pdev; |
4401 | pdata.type = USB_PHY_TYPE_USB2; |
4402 | + pdata.gpio_reset = -1; |
4403 | |
4404 | ret = platform_device_add_data(glue->usb2_phy, &pdata, sizeof(pdata)); |
4405 | if (ret) |
4406 | diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h |
4407 | index e8f41c5e771b..bf4555abdd06 100644 |
4408 | --- a/drivers/usb/host/ehci.h |
4409 | +++ b/drivers/usb/host/ehci.h |
4410 | @@ -225,6 +225,7 @@ struct ehci_hcd { /* one per controller */ |
4411 | unsigned has_synopsys_hc_bug:1; /* Synopsys HC */ |
4412 | unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */ |
4413 | unsigned need_oc_pp_cycle:1; /* MPC834X port power */ |
4414 | + unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ |
4415 | |
4416 | /* required for usb32 quirk */ |
4417 | #define OHCI_CTRL_HCFS (3 << 6) |
4418 | @@ -728,6 +729,18 @@ static inline unsigned int ehci_readl(const struct ehci_hcd *ehci, |
4419 | #endif |
4420 | } |
4421 | |
4422 | +#ifdef CONFIG_SOC_IMX28 |
4423 | +static inline void imx28_ehci_writel(const unsigned int val, |
4424 | + volatile __u32 __iomem *addr) |
4425 | +{ |
4426 | + __asm__ ("swp %0, %0, [%1]" : : "r"(val), "r"(addr)); |
4427 | +} |
4428 | +#else |
4429 | +static inline void imx28_ehci_writel(const unsigned int val, |
4430 | + volatile __u32 __iomem *addr) |
4431 | +{ |
4432 | +} |
4433 | +#endif |
4434 | static inline void ehci_writel(const struct ehci_hcd *ehci, |
4435 | const unsigned int val, __u32 __iomem *regs) |
4436 | { |
4437 | @@ -736,7 +749,10 @@ static inline void ehci_writel(const struct ehci_hcd *ehci, |
4438 | writel_be(val, regs) : |
4439 | writel(val, regs); |
4440 | #else |
4441 | - writel(val, regs); |
4442 | + if (ehci->imx28_write_fix) |
4443 | + imx28_ehci_writel(val, regs); |
4444 | + else |
4445 | + writel(val, regs); |
4446 | #endif |
4447 | } |
4448 | |
4449 | diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c |
4450 | index 53c2e296467f..64c36fe1ea6a 100644 |
4451 | --- a/drivers/usb/host/xhci-ring.c |
4452 | +++ b/drivers/usb/host/xhci-ring.c |
4453 | @@ -3008,7 +3008,7 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring, |
4454 | if (num_trbs >= TRBS_PER_SEGMENT) { |
4455 | xhci_err(xhci, "Too many fragments %d, max %d\n", |
4456 | num_trbs, TRBS_PER_SEGMENT - 1); |
4457 | - return -ENOMEM; |
4458 | + return -EINVAL; |
4459 | } |
4460 | |
4461 | nop_cmd = cpu_to_le32(TRB_TYPE(TRB_TR_NOOP) | |
4462 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
4463 | index 4265b48856f6..cfa5995c7e1f 100644 |
4464 | --- a/drivers/usb/host/xhci.c |
4465 | +++ b/drivers/usb/host/xhci.c |
4466 | @@ -321,6 +321,9 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci) |
4467 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
4468 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); |
4469 | |
4470 | + if (xhci->quirks & XHCI_PLAT) |
4471 | + return; |
4472 | + |
4473 | xhci_free_irq(xhci); |
4474 | |
4475 | if (xhci->msix_entries) { |
4476 | @@ -4713,8 +4716,8 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) |
4477 | struct device *dev = hcd->self.controller; |
4478 | int retval; |
4479 | |
4480 | - /* Accept arbitrarily long scatter-gather lists */ |
4481 | - hcd->self.sg_tablesize = ~0; |
4482 | + /* Limit the block layer scatter-gather lists to half a segment. */ |
4483 | + hcd->self.sg_tablesize = TRBS_PER_SEGMENT / 2; |
4484 | |
4485 | /* support to build packet from discontinuous buffers */ |
4486 | hcd->self.no_sg_constraint = 1; |
4487 | diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
4488 | index 03c74b7965f8..c283cf183c48 100644 |
4489 | --- a/drivers/usb/host/xhci.h |
4490 | +++ b/drivers/usb/host/xhci.h |
4491 | @@ -1260,7 +1260,7 @@ union xhci_trb { |
4492 | * since the command ring is 64-byte aligned. |
4493 | * It must also be greater than 16. |
4494 | */ |
4495 | -#define TRBS_PER_SEGMENT 64 |
4496 | +#define TRBS_PER_SEGMENT 256 |
4497 | /* Allow two commands + a link TRB, along with any reserved command TRBs */ |
4498 | #define MAX_RSVD_CMD_TRBS (TRBS_PER_SEGMENT - 3) |
4499 | #define TRB_SEGMENT_SIZE (TRBS_PER_SEGMENT*16) |
4500 | diff --git a/drivers/usb/serial/cypress_m8.h b/drivers/usb/serial/cypress_m8.h |
4501 | index b461311a2ae7..ce13e61b7d55 100644 |
4502 | --- a/drivers/usb/serial/cypress_m8.h |
4503 | +++ b/drivers/usb/serial/cypress_m8.h |
4504 | @@ -63,7 +63,7 @@ |
4505 | #define UART_DSR 0x20 /* data set ready - flow control - device to host */ |
4506 | #define CONTROL_RTS 0x10 /* request to send - flow control - host to device */ |
4507 | #define UART_CTS 0x10 /* clear to send - flow control - device to host */ |
4508 | -#define UART_RI 0x10 /* ring indicator - modem - device to host */ |
4509 | +#define UART_RI 0x80 /* ring indicator - modem - device to host */ |
4510 | #define UART_CD 0x40 /* carrier detect - modem - device to host */ |
4511 | #define CYP_ERROR 0x08 /* received from input report - device to host */ |
4512 | /* Note - the below has nothing to do with the "feature report" reset */ |
4513 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
4514 | index fb0d537435eb..8c204a52d534 100644 |
4515 | --- a/drivers/usb/serial/ftdi_sio.c |
4516 | +++ b/drivers/usb/serial/ftdi_sio.c |
4517 | @@ -2124,10 +2124,20 @@ static void ftdi_set_termios(struct tty_struct *tty, |
4518 | } |
4519 | |
4520 | /* |
4521 | - * All FTDI UART chips are limited to CS7/8. We won't pretend to |
4522 | + * All FTDI UART chips are limited to CS7/8. We shouldn't pretend to |
4523 | * support CS5/6 and revert the CSIZE setting instead. |
4524 | + * |
4525 | + * CS5 however is used to control some smartcard readers which abuse |
4526 | + * this limitation to switch modes. Original FTDI chips fall back to |
4527 | + * eight data bits. |
4528 | + * |
4529 | + * TODO: Implement a quirk to only allow this with mentioned |
4530 | + * readers. One I know of (Argolis Smartreader V1) |
4531 | + * returns "USB smartcard server" as iInterface string. |
4532 | + * The vendor didn't bother with a custom VID/PID of |
4533 | + * course. |
4534 | */ |
4535 | - if ((C_CSIZE(tty) != CS8) && (C_CSIZE(tty) != CS7)) { |
4536 | + if (C_CSIZE(tty) == CS6) { |
4537 | dev_warn(ddev, "requested CSIZE setting not supported\n"); |
4538 | |
4539 | termios->c_cflag &= ~CSIZE; |
4540 | @@ -2174,6 +2184,9 @@ no_skip: |
4541 | urb_value |= FTDI_SIO_SET_DATA_PARITY_NONE; |
4542 | } |
4543 | switch (cflag & CSIZE) { |
4544 | + case CS5: |
4545 | + dev_dbg(ddev, "Setting CS5 quirk\n"); |
4546 | + break; |
4547 | case CS7: |
4548 | urb_value |= 7; |
4549 | dev_dbg(ddev, "Setting CS7\n"); |
4550 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
4551 | index cc7a24154490..5c86f57e4afa 100644 |
4552 | --- a/drivers/usb/serial/option.c |
4553 | +++ b/drivers/usb/serial/option.c |
4554 | @@ -320,6 +320,9 @@ static void option_instat_callback(struct urb *urb); |
4555 | * It seems to contain a Qualcomm QSC6240/6290 chipset */ |
4556 | #define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603 |
4557 | |
4558 | +/* iBall 3.5G connect wireless modem */ |
4559 | +#define IBALL_3_5G_CONNECT 0x9605 |
4560 | + |
4561 | /* Zoom */ |
4562 | #define ZOOM_PRODUCT_4597 0x9607 |
4563 | |
4564 | @@ -1447,6 +1450,17 @@ static const struct usb_device_id option_ids[] = { |
4565 | .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, |
4566 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff), |
4567 | .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, |
4568 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffe9, 0xff, 0xff, 0xff) }, |
4569 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8b, 0xff, 0xff, 0xff) }, |
4570 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8c, 0xff, 0xff, 0xff) }, |
4571 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8d, 0xff, 0xff, 0xff) }, |
4572 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8e, 0xff, 0xff, 0xff) }, |
4573 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8f, 0xff, 0xff, 0xff) }, |
4574 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff90, 0xff, 0xff, 0xff) }, |
4575 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff91, 0xff, 0xff, 0xff) }, |
4576 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff92, 0xff, 0xff, 0xff) }, |
4577 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff93, 0xff, 0xff, 0xff) }, |
4578 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff94, 0xff, 0xff, 0xff) }, |
4579 | |
4580 | /* NOTE: most ZTE CDMA devices should be driven by zte_ev, not option */ |
4581 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff), |
4582 | @@ -1489,6 +1503,7 @@ static const struct usb_device_id option_ids[] = { |
4583 | .driver_info = (kernel_ulong_t)&four_g_w14_blacklist |
4584 | }, |
4585 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, |
4586 | + { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, |
4587 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, |
4588 | /* Pirelli */ |
4589 | { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1, 0xff) }, |
4590 | diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c |
4591 | index 1e3318dfa1cb..beb8edce4ef2 100644 |
4592 | --- a/drivers/usb/serial/pl2303.c |
4593 | +++ b/drivers/usb/serial/pl2303.c |
4594 | @@ -142,6 +142,8 @@ struct pl2303_private { |
4595 | spinlock_t lock; |
4596 | u8 line_control; |
4597 | u8 line_status; |
4598 | + |
4599 | + u8 line_settings[7]; |
4600 | }; |
4601 | |
4602 | static int pl2303_vendor_read(__u16 value, __u16 index, |
4603 | @@ -339,11 +341,6 @@ static void pl2303_set_termios(struct tty_struct *tty, |
4604 | int i; |
4605 | u8 control; |
4606 | |
4607 | - /* |
4608 | - * The PL2303 is reported to lose bytes if you change serial settings |
4609 | - * even to the same values as before. Thus we actually need to filter |
4610 | - * in this specific case. |
4611 | - */ |
4612 | if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios)) |
4613 | return; |
4614 | |
4615 | @@ -428,10 +425,29 @@ static void pl2303_set_termios(struct tty_struct *tty, |
4616 | dev_dbg(&port->dev, "parity = none\n"); |
4617 | } |
4618 | |
4619 | - i = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
4620 | - SET_LINE_REQUEST, SET_LINE_REQUEST_TYPE, |
4621 | - 0, 0, buf, 7, 100); |
4622 | - dev_dbg(&port->dev, "0x21:0x20:0:0 %d\n", i); |
4623 | + /* |
4624 | + * Some PL2303 are known to lose bytes if you change serial settings |
4625 | + * even to the same values as before. Thus we actually need to filter |
4626 | + * in this specific case. |
4627 | + * |
4628 | + * Note that the tty_termios_hw_change check above is not sufficient |
4629 | + * as a previously requested baud rate may differ from the one |
4630 | + * actually used (and stored in old_termios). |
4631 | + * |
4632 | + * NOTE: No additional locking needed for line_settings as it is |
4633 | + * only used in set_termios, which is serialised against itself. |
4634 | + */ |
4635 | + if (!old_termios || memcmp(buf, priv->line_settings, 7)) { |
4636 | + i = usb_control_msg(serial->dev, |
4637 | + usb_sndctrlpipe(serial->dev, 0), |
4638 | + SET_LINE_REQUEST, SET_LINE_REQUEST_TYPE, |
4639 | + 0, 0, buf, 7, 100); |
4640 | + |
4641 | + dev_dbg(&port->dev, "0x21:0x20:0:0 %d\n", i); |
4642 | + |
4643 | + if (i == 7) |
4644 | + memcpy(priv->line_settings, buf, 7); |
4645 | + } |
4646 | |
4647 | /* change control lines if we are switching to or from B0 */ |
4648 | spin_lock_irqsave(&priv->lock, flags); |
4649 | diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
4650 | index de32cfa5bfa6..ad06255c2ade 100644 |
4651 | --- a/drivers/usb/storage/unusual_devs.h |
4652 | +++ b/drivers/usb/storage/unusual_devs.h |
4653 | @@ -234,6 +234,13 @@ UNUSUAL_DEV( 0x0421, 0x0495, 0x0370, 0x0370, |
4654 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
4655 | US_FL_MAX_SECTORS_64 ), |
4656 | |
4657 | +/* Patch submitted by Mikhail Zolotaryov <lebon@lebon.org.ua> */ |
4658 | +UNUSUAL_DEV( 0x0421, 0x06aa, 0x1110, 0x1110, |
4659 | + "Nokia", |
4660 | + "502", |
4661 | + USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
4662 | + US_FL_MAX_SECTORS_64 ), |
4663 | + |
4664 | #ifdef NO_SDDR09 |
4665 | UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100, |
4666 | "Microtech", |
4667 | diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c |
4668 | index 4ad24f2c6472..cecd3de01c24 100644 |
4669 | --- a/drivers/video/console/sticore.c |
4670 | +++ b/drivers/video/console/sticore.c |
4671 | @@ -488,7 +488,7 @@ static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address, |
4672 | return 0; |
4673 | } |
4674 | |
4675 | -#ifdef CONFIG_FONTS |
4676 | +#ifdef CONFIG_FONT_SUPPORT |
4677 | static struct sti_cooked_font * |
4678 | sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) |
4679 | { |
4680 | diff --git a/drivers/xen/pci.c b/drivers/xen/pci.c |
4681 | index 188825122aae..dd9c249ea311 100644 |
4682 | --- a/drivers/xen/pci.c |
4683 | +++ b/drivers/xen/pci.c |
4684 | @@ -26,7 +26,9 @@ |
4685 | #include <asm/xen/hypervisor.h> |
4686 | #include <asm/xen/hypercall.h> |
4687 | #include "../pci/pci.h" |
4688 | +#ifdef CONFIG_PCI_MMCONFIG |
4689 | #include <asm/pci_x86.h> |
4690 | +#endif |
4691 | |
4692 | static bool __read_mostly pci_seg_supported = true; |
4693 | |
4694 | diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
4695 | index 9c01509dd8ab..72d7307151c9 100644 |
4696 | --- a/fs/btrfs/extent-tree.c |
4697 | +++ b/fs/btrfs/extent-tree.c |
4698 | @@ -7779,7 +7779,7 @@ out: |
4699 | */ |
4700 | if (!for_reloc && root_dropped == false) |
4701 | btrfs_add_dead_root(root); |
4702 | - if (err) |
4703 | + if (err && err != -EAGAIN) |
4704 | btrfs_std_error(root->fs_info, err); |
4705 | return err; |
4706 | } |
4707 | diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
4708 | index f1a77449d032..34ee498ff1ce 100644 |
4709 | --- a/fs/btrfs/inode.c |
4710 | +++ b/fs/btrfs/inode.c |
4711 | @@ -60,7 +60,7 @@ |
4712 | #include "hash.h" |
4713 | |
4714 | struct btrfs_iget_args { |
4715 | - u64 ino; |
4716 | + struct btrfs_key *location; |
4717 | struct btrfs_root *root; |
4718 | }; |
4719 | |
4720 | @@ -4818,7 +4818,9 @@ again: |
4721 | static int btrfs_init_locked_inode(struct inode *inode, void *p) |
4722 | { |
4723 | struct btrfs_iget_args *args = p; |
4724 | - inode->i_ino = args->ino; |
4725 | + inode->i_ino = args->location->objectid; |
4726 | + memcpy(&BTRFS_I(inode)->location, args->location, |
4727 | + sizeof(*args->location)); |
4728 | BTRFS_I(inode)->root = args->root; |
4729 | return 0; |
4730 | } |
4731 | @@ -4826,19 +4828,19 @@ static int btrfs_init_locked_inode(struct inode *inode, void *p) |
4732 | static int btrfs_find_actor(struct inode *inode, void *opaque) |
4733 | { |
4734 | struct btrfs_iget_args *args = opaque; |
4735 | - return args->ino == btrfs_ino(inode) && |
4736 | + return args->location->objectid == BTRFS_I(inode)->location.objectid && |
4737 | args->root == BTRFS_I(inode)->root; |
4738 | } |
4739 | |
4740 | static struct inode *btrfs_iget_locked(struct super_block *s, |
4741 | - u64 objectid, |
4742 | + struct btrfs_key *location, |
4743 | struct btrfs_root *root) |
4744 | { |
4745 | struct inode *inode; |
4746 | struct btrfs_iget_args args; |
4747 | - unsigned long hashval = btrfs_inode_hash(objectid, root); |
4748 | + unsigned long hashval = btrfs_inode_hash(location->objectid, root); |
4749 | |
4750 | - args.ino = objectid; |
4751 | + args.location = location; |
4752 | args.root = root; |
4753 | |
4754 | inode = iget5_locked(s, hashval, btrfs_find_actor, |
4755 | @@ -4855,13 +4857,11 @@ struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location, |
4756 | { |
4757 | struct inode *inode; |
4758 | |
4759 | - inode = btrfs_iget_locked(s, location->objectid, root); |
4760 | + inode = btrfs_iget_locked(s, location, root); |
4761 | if (!inode) |
4762 | return ERR_PTR(-ENOMEM); |
4763 | |
4764 | if (inode->i_state & I_NEW) { |
4765 | - BTRFS_I(inode)->root = root; |
4766 | - memcpy(&BTRFS_I(inode)->location, location, sizeof(*location)); |
4767 | btrfs_read_locked_inode(inode); |
4768 | if (!is_bad_inode(inode)) { |
4769 | inode_tree_add(inode); |
4770 | diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c |
4771 | index 21da5762b0b1..9f831bb3dbee 100644 |
4772 | --- a/fs/btrfs/ioctl.c |
4773 | +++ b/fs/btrfs/ioctl.c |
4774 | @@ -1545,6 +1545,12 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file, |
4775 | printk(KERN_INFO "btrfs: Snapshot src from " |
4776 | "another FS\n"); |
4777 | ret = -EINVAL; |
4778 | + } else if (!inode_owner_or_capable(src_inode)) { |
4779 | + /* |
4780 | + * Subvolume creation is not restricted, but snapshots |
4781 | + * are limited to own subvolumes only |
4782 | + */ |
4783 | + ret = -EPERM; |
4784 | } else { |
4785 | ret = btrfs_mksubvol(&file->f_path, name, namelen, |
4786 | BTRFS_I(src_inode)->root, |
4787 | diff --git a/fs/dcache.c b/fs/dcache.c |
4788 | index cb4a10690868..fdbe23027810 100644 |
4789 | --- a/fs/dcache.c |
4790 | +++ b/fs/dcache.c |
4791 | @@ -3135,7 +3135,6 @@ restart: |
4792 | read_seqbegin_or_lock(&rename_lock, &seq); |
4793 | while (!IS_ROOT(dentry)) { |
4794 | struct dentry *parent = dentry->d_parent; |
4795 | - int error; |
4796 | |
4797 | prefetch(parent); |
4798 | error = prepend_name(&end, &len, &dentry->d_name); |
4799 | diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c |
4800 | index bae987549dc3..7f032085cbf1 100644 |
4801 | --- a/fs/ext4/inline.c |
4802 | +++ b/fs/ext4/inline.c |
4803 | @@ -1924,9 +1924,11 @@ void ext4_inline_data_truncate(struct inode *inode, int *has_inline) |
4804 | } |
4805 | |
4806 | /* Clear the content within i_blocks. */ |
4807 | - if (i_size < EXT4_MIN_INLINE_DATA_SIZE) |
4808 | - memset(ext4_raw_inode(&is.iloc)->i_block + i_size, 0, |
4809 | - EXT4_MIN_INLINE_DATA_SIZE - i_size); |
4810 | + if (i_size < EXT4_MIN_INLINE_DATA_SIZE) { |
4811 | + void *p = (void *) ext4_raw_inode(&is.iloc)->i_block; |
4812 | + memset(p + i_size, 0, |
4813 | + EXT4_MIN_INLINE_DATA_SIZE - i_size); |
4814 | + } |
4815 | |
4816 | EXT4_I(inode)->i_inline_size = i_size < |
4817 | EXT4_MIN_INLINE_DATA_SIZE ? |
4818 | diff --git a/fs/hpfs/alloc.c b/fs/hpfs/alloc.c |
4819 | index cdb84a838068..58b5106186d0 100644 |
4820 | --- a/fs/hpfs/alloc.c |
4821 | +++ b/fs/hpfs/alloc.c |
4822 | @@ -8,6 +8,58 @@ |
4823 | |
4824 | #include "hpfs_fn.h" |
4825 | |
4826 | +static void hpfs_claim_alloc(struct super_block *s, secno sec) |
4827 | +{ |
4828 | + struct hpfs_sb_info *sbi = hpfs_sb(s); |
4829 | + if (sbi->sb_n_free != (unsigned)-1) { |
4830 | + if (unlikely(!sbi->sb_n_free)) { |
4831 | + hpfs_error(s, "free count underflow, allocating sector %08x", sec); |
4832 | + sbi->sb_n_free = -1; |
4833 | + return; |
4834 | + } |
4835 | + sbi->sb_n_free--; |
4836 | + } |
4837 | +} |
4838 | + |
4839 | +static void hpfs_claim_free(struct super_block *s, secno sec) |
4840 | +{ |
4841 | + struct hpfs_sb_info *sbi = hpfs_sb(s); |
4842 | + if (sbi->sb_n_free != (unsigned)-1) { |
4843 | + if (unlikely(sbi->sb_n_free >= sbi->sb_fs_size)) { |
4844 | + hpfs_error(s, "free count overflow, freeing sector %08x", sec); |
4845 | + sbi->sb_n_free = -1; |
4846 | + return; |
4847 | + } |
4848 | + sbi->sb_n_free++; |
4849 | + } |
4850 | +} |
4851 | + |
4852 | +static void hpfs_claim_dirband_alloc(struct super_block *s, secno sec) |
4853 | +{ |
4854 | + struct hpfs_sb_info *sbi = hpfs_sb(s); |
4855 | + if (sbi->sb_n_free_dnodes != (unsigned)-1) { |
4856 | + if (unlikely(!sbi->sb_n_free_dnodes)) { |
4857 | + hpfs_error(s, "dirband free count underflow, allocating sector %08x", sec); |
4858 | + sbi->sb_n_free_dnodes = -1; |
4859 | + return; |
4860 | + } |
4861 | + sbi->sb_n_free_dnodes--; |
4862 | + } |
4863 | +} |
4864 | + |
4865 | +static void hpfs_claim_dirband_free(struct super_block *s, secno sec) |
4866 | +{ |
4867 | + struct hpfs_sb_info *sbi = hpfs_sb(s); |
4868 | + if (sbi->sb_n_free_dnodes != (unsigned)-1) { |
4869 | + if (unlikely(sbi->sb_n_free_dnodes >= sbi->sb_dirband_size / 4)) { |
4870 | + hpfs_error(s, "dirband free count overflow, freeing sector %08x", sec); |
4871 | + sbi->sb_n_free_dnodes = -1; |
4872 | + return; |
4873 | + } |
4874 | + sbi->sb_n_free_dnodes++; |
4875 | + } |
4876 | +} |
4877 | + |
4878 | /* |
4879 | * Check if a sector is allocated in bitmap |
4880 | * This is really slow. Turned on only if chk==2 |
4881 | @@ -203,9 +255,15 @@ secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forwa |
4882 | } |
4883 | sec = 0; |
4884 | ret: |
4885 | + if (sec) { |
4886 | + i = 0; |
4887 | + do |
4888 | + hpfs_claim_alloc(s, sec + i); |
4889 | + while (unlikely(++i < n)); |
4890 | + } |
4891 | if (sec && f_p) { |
4892 | for (i = 0; i < forward; i++) { |
4893 | - if (!hpfs_alloc_if_possible(s, sec + i + 1)) { |
4894 | + if (!hpfs_alloc_if_possible(s, sec + n + i)) { |
4895 | hpfs_error(s, "Prealloc doesn't work! Wanted %d, allocated at %08x, can't allocate %d", forward, sec, i); |
4896 | sec = 0; |
4897 | break; |
4898 | @@ -228,6 +286,7 @@ static secno alloc_in_dirband(struct super_block *s, secno near) |
4899 | nr >>= 2; |
4900 | sec = alloc_in_bmp(s, (~0x3fff) | nr, 1, 0); |
4901 | if (!sec) return 0; |
4902 | + hpfs_claim_dirband_alloc(s, sec); |
4903 | return ((sec & 0x3fff) << 2) + sbi->sb_dirband_start; |
4904 | } |
4905 | |
4906 | @@ -242,6 +301,7 @@ int hpfs_alloc_if_possible(struct super_block *s, secno sec) |
4907 | bmp[(sec & 0x3fff) >> 5] &= cpu_to_le32(~(1 << (sec & 0x1f))); |
4908 | hpfs_mark_4buffers_dirty(&qbh); |
4909 | hpfs_brelse4(&qbh); |
4910 | + hpfs_claim_alloc(s, sec); |
4911 | return 1; |
4912 | } |
4913 | hpfs_brelse4(&qbh); |
4914 | @@ -275,6 +335,7 @@ void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n) |
4915 | return; |
4916 | } |
4917 | bmp[(sec & 0x3fff) >> 5] |= cpu_to_le32(1 << (sec & 0x1f)); |
4918 | + hpfs_claim_free(s, sec); |
4919 | if (!--n) { |
4920 | hpfs_mark_4buffers_dirty(&qbh); |
4921 | hpfs_brelse4(&qbh); |
4922 | @@ -359,6 +420,7 @@ void hpfs_free_dnode(struct super_block *s, dnode_secno dno) |
4923 | bmp[ssec >> 5] |= cpu_to_le32(1 << (ssec & 0x1f)); |
4924 | hpfs_mark_4buffers_dirty(&qbh); |
4925 | hpfs_brelse4(&qbh); |
4926 | + hpfs_claim_dirband_free(s, dno); |
4927 | } |
4928 | } |
4929 | |
4930 | @@ -366,7 +428,7 @@ struct dnode *hpfs_alloc_dnode(struct super_block *s, secno near, |
4931 | dnode_secno *dno, struct quad_buffer_head *qbh) |
4932 | { |
4933 | struct dnode *d; |
4934 | - if (hpfs_count_one_bitmap(s, hpfs_sb(s)->sb_dmap) > FREE_DNODES_ADD) { |
4935 | + if (hpfs_get_free_dnodes(s) > FREE_DNODES_ADD) { |
4936 | if (!(*dno = alloc_in_dirband(s, near))) |
4937 | if (!(*dno = hpfs_alloc_sector(s, near, 4, 0))) return NULL; |
4938 | } else { |
4939 | diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h |
4940 | index 6797bf80f6e2..3ba49c080e42 100644 |
4941 | --- a/fs/hpfs/hpfs_fn.h |
4942 | +++ b/fs/hpfs/hpfs_fn.h |
4943 | @@ -312,7 +312,7 @@ static inline struct hpfs_sb_info *hpfs_sb(struct super_block *sb) |
4944 | __printf(2, 3) |
4945 | void hpfs_error(struct super_block *, const char *, ...); |
4946 | int hpfs_stop_cycles(struct super_block *, int, int *, int *, char *); |
4947 | -unsigned hpfs_count_one_bitmap(struct super_block *, secno); |
4948 | +unsigned hpfs_get_free_dnodes(struct super_block *); |
4949 | |
4950 | /* |
4951 | * local time (HPFS) to GMT (Unix) |
4952 | diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c |
4953 | index b8d01ef6f531..4534ff688b76 100644 |
4954 | --- a/fs/hpfs/super.c |
4955 | +++ b/fs/hpfs/super.c |
4956 | @@ -121,7 +121,7 @@ static void hpfs_put_super(struct super_block *s) |
4957 | call_rcu(&hpfs_sb(s)->rcu, lazy_free_sbi); |
4958 | } |
4959 | |
4960 | -unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno) |
4961 | +static unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno) |
4962 | { |
4963 | struct quad_buffer_head qbh; |
4964 | unsigned long *bits; |
4965 | @@ -129,7 +129,7 @@ unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno) |
4966 | |
4967 | bits = hpfs_map_4sectors(s, secno, &qbh, 0); |
4968 | if (!bits) |
4969 | - return 0; |
4970 | + return (unsigned)-1; |
4971 | count = bitmap_weight(bits, 2048 * BITS_PER_BYTE); |
4972 | hpfs_brelse4(&qbh); |
4973 | return count; |
4974 | @@ -144,30 +144,45 @@ static unsigned count_bitmaps(struct super_block *s) |
4975 | hpfs_prefetch_bitmap(s, n); |
4976 | } |
4977 | for (n = 0; n < n_bands; n++) { |
4978 | + unsigned c; |
4979 | hpfs_prefetch_bitmap(s, n + COUNT_RD_AHEAD); |
4980 | - count += hpfs_count_one_bitmap(s, le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[n])); |
4981 | + c = hpfs_count_one_bitmap(s, le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[n])); |
4982 | + if (c != (unsigned)-1) |
4983 | + count += c; |
4984 | } |
4985 | return count; |
4986 | } |
4987 | |
4988 | +unsigned hpfs_get_free_dnodes(struct super_block *s) |
4989 | +{ |
4990 | + struct hpfs_sb_info *sbi = hpfs_sb(s); |
4991 | + if (sbi->sb_n_free_dnodes == (unsigned)-1) { |
4992 | + unsigned c = hpfs_count_one_bitmap(s, sbi->sb_dmap); |
4993 | + if (c == (unsigned)-1) |
4994 | + return 0; |
4995 | + sbi->sb_n_free_dnodes = c; |
4996 | + } |
4997 | + return sbi->sb_n_free_dnodes; |
4998 | +} |
4999 | + |
5000 | static int hpfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
5001 | { |
5002 | struct super_block *s = dentry->d_sb; |
5003 | struct hpfs_sb_info *sbi = hpfs_sb(s); |
5004 | u64 id = huge_encode_dev(s->s_bdev->bd_dev); |
5005 | + |
5006 | hpfs_lock(s); |
5007 | |
5008 | - /*if (sbi->sb_n_free == -1) {*/ |
5009 | + if (sbi->sb_n_free == (unsigned)-1) |
5010 | sbi->sb_n_free = count_bitmaps(s); |
5011 | - sbi->sb_n_free_dnodes = hpfs_count_one_bitmap(s, sbi->sb_dmap); |
5012 | - /*}*/ |
5013 | + |
5014 | buf->f_type = s->s_magic; |
5015 | buf->f_bsize = 512; |
5016 | buf->f_blocks = sbi->sb_fs_size; |
5017 | buf->f_bfree = sbi->sb_n_free; |
5018 | buf->f_bavail = sbi->sb_n_free; |
5019 | buf->f_files = sbi->sb_dirband_size / 4; |
5020 | - buf->f_ffree = sbi->sb_n_free_dnodes; |
5021 | + buf->f_ffree = hpfs_get_free_dnodes(s); |
5022 | buf->f_fsid.val[0] = (u32)id; |
5023 | buf->f_fsid.val[1] = (u32)(id >> 32); |
5024 | buf->f_namelen = 254; |
5025 | diff --git a/fs/mount.h b/fs/mount.h |
5026 | index d64c594be6c4..a17458ca6f29 100644 |
5027 | --- a/fs/mount.h |
5028 | +++ b/fs/mount.h |
5029 | @@ -74,7 +74,7 @@ static inline int mnt_has_parent(struct mount *mnt) |
5030 | static inline int is_mounted(struct vfsmount *mnt) |
5031 | { |
5032 | /* neither detached nor internal? */ |
5033 | - return !IS_ERR_OR_NULL(real_mount(mnt)); |
5034 | + return !IS_ERR_OR_NULL(real_mount(mnt)->mnt_ns); |
5035 | } |
5036 | |
5037 | extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *); |
5038 | diff --git a/include/linux/libata.h b/include/linux/libata.h |
5039 | index 9b503376738f..bec6dbe939a0 100644 |
5040 | --- a/include/linux/libata.h |
5041 | +++ b/include/linux/libata.h |
5042 | @@ -419,6 +419,8 @@ enum { |
5043 | ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17), /* Set max sects to 65535 */ |
5044 | ATA_HORKAGE_ATAPI_DMADIR = (1 << 18), /* device requires dmadir */ |
5045 | ATA_HORKAGE_NO_NCQ_TRIM = (1 << 19), /* don't use queued TRIM */ |
5046 | + ATA_HORKAGE_NOLPM = (1 << 20), /* don't use LPM */ |
5047 | + ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */ |
5048 | |
5049 | /* DMA mask for user DMA control: User visible values; DO NOT |
5050 | renumber */ |
5051 | diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h |
5052 | index 3e781b8c0be7..362927c48f97 100644 |
5053 | --- a/include/linux/mmc/sdhci.h |
5054 | +++ b/include/linux/mmc/sdhci.h |
5055 | @@ -98,6 +98,8 @@ struct sdhci_host { |
5056 | #define SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON (1<<4) |
5057 | /* Controller has a non-standard host control register */ |
5058 | #define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1<<5) |
5059 | +/* Controller does not support HS200 */ |
5060 | +#define SDHCI_QUIRK2_BROKEN_HS200 (1<<6) |
5061 | |
5062 | int irq; /* Device IRQ */ |
5063 | void __iomem *ioaddr; /* Mapped address */ |
5064 | diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h |
5065 | index 7d399671a566..708bd119627f 100644 |
5066 | --- a/include/linux/usb/chipidea.h |
5067 | +++ b/include/linux/usb/chipidea.h |
5068 | @@ -24,6 +24,7 @@ struct ci_hdrc_platform_data { |
5069 | * but otg is not supported (no register otgsc). |
5070 | */ |
5071 | #define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4) |
5072 | +#define CI_HDRC_IMX28_WRITE_FIX BIT(5) |
5073 | enum usb_dr_mode dr_mode; |
5074 | #define CI_HDRC_CONTROLLER_RESET_EVENT 0 |
5075 | #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 |
5076 | diff --git a/lib/fonts/Kconfig b/lib/fonts/Kconfig |
5077 | index 34fd931b54b5..4dc1b990aa23 100644 |
5078 | --- a/lib/fonts/Kconfig |
5079 | +++ b/lib/fonts/Kconfig |
5080 | @@ -9,7 +9,7 @@ if FONT_SUPPORT |
5081 | |
5082 | config FONTS |
5083 | bool "Select compiled-in fonts" |
5084 | - depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE |
5085 | + depends on FRAMEBUFFER_CONSOLE |
5086 | help |
5087 | Say Y here if you would like to use fonts other than the default |
5088 | your frame buffer console usually use. |
5089 | @@ -22,7 +22,7 @@ config FONTS |
5090 | |
5091 | config FONT_8x8 |
5092 | bool "VGA 8x8 font" if FONTS |
5093 | - depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE |
5094 | + depends on FRAMEBUFFER_CONSOLE |
5095 | default y if !SPARC && !FONTS |
5096 | help |
5097 | This is the "high resolution" font for the VGA frame buffer (the one |
5098 | @@ -45,7 +45,7 @@ config FONT_8x16 |
5099 | |
5100 | config FONT_6x11 |
5101 | bool "Mac console 6x11 font (not supported by all drivers)" if FONTS |
5102 | - depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE |
5103 | + depends on FRAMEBUFFER_CONSOLE |
5104 | default y if !SPARC && !FONTS && MAC |
5105 | help |
5106 | Small console font with Macintosh-style high-half glyphs. Some Mac |
5107 | diff --git a/mm/mempolicy.c b/mm/mempolicy.c |
5108 | index 0cd2c4d4e270..e1bd99778b9d 100644 |
5109 | --- a/mm/mempolicy.c |
5110 | +++ b/mm/mempolicy.c |
5111 | @@ -2928,7 +2928,7 @@ void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol) |
5112 | unsigned short mode = MPOL_DEFAULT; |
5113 | unsigned short flags = 0; |
5114 | |
5115 | - if (pol && pol != &default_policy) { |
5116 | + if (pol && pol != &default_policy && !(pol->flags & MPOL_F_MORON)) { |
5117 | mode = pol->mode; |
5118 | flags = pol->flags; |
5119 | } |
5120 | diff --git a/net/compat.c b/net/compat.c |
5121 | index dd32e34c1e2c..f50161fb812e 100644 |
5122 | --- a/net/compat.c |
5123 | +++ b/net/compat.c |
5124 | @@ -780,21 +780,16 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, |
5125 | if (flags & MSG_CMSG_COMPAT) |
5126 | return -EINVAL; |
5127 | |
5128 | - if (COMPAT_USE_64BIT_TIME) |
5129 | - return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, |
5130 | - flags | MSG_CMSG_COMPAT, |
5131 | - (struct timespec *) timeout); |
5132 | - |
5133 | if (timeout == NULL) |
5134 | return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, |
5135 | flags | MSG_CMSG_COMPAT, NULL); |
5136 | |
5137 | - if (get_compat_timespec(&ktspec, timeout)) |
5138 | + if (compat_get_timespec(&ktspec, timeout)) |
5139 | return -EFAULT; |
5140 | |
5141 | datagrams = __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, |
5142 | flags | MSG_CMSG_COMPAT, &ktspec); |
5143 | - if (datagrams > 0 && put_compat_timespec(&ktspec, timeout)) |
5144 | + if (datagrams > 0 && compat_put_timespec(&ktspec, timeout)) |
5145 | datagrams = -EFAULT; |
5146 | |
5147 | return datagrams; |
5148 | diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c |
5149 | index d846304b7b89..c7539e22868b 100644 |
5150 | --- a/net/ipv4/fib_frontend.c |
5151 | +++ b/net/ipv4/fib_frontend.c |
5152 | @@ -1047,6 +1047,8 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo |
5153 | } |
5154 | |
5155 | in_dev = __in_dev_get_rtnl(dev); |
5156 | + if (!in_dev) |
5157 | + return NOTIFY_DONE; |
5158 | |
5159 | switch (event) { |
5160 | case NETDEV_UP: |
5161 | diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c |
5162 | index e560ef34cf4b..d30636080a11 100644 |
5163 | --- a/net/ipv4/ip_gre.c |
5164 | +++ b/net/ipv4/ip_gre.c |
5165 | @@ -178,7 +178,7 @@ static int ipgre_err(struct sk_buff *skb, u32 info, |
5166 | else |
5167 | itn = net_generic(net, ipgre_net_id); |
5168 | |
5169 | - iph = (const struct iphdr *)skb->data; |
5170 | + iph = (const struct iphdr *)(icmp_hdr(skb) + 1); |
5171 | t = ip_tunnel_lookup(itn, skb->dev->ifindex, tpi->flags, |
5172 | iph->daddr, iph->saddr, tpi->key); |
5173 | |
5174 | diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c |
5175 | index 054a3e97d822..3d4da2c16b6a 100644 |
5176 | --- a/net/ipv4/ip_input.c |
5177 | +++ b/net/ipv4/ip_input.c |
5178 | @@ -314,7 +314,7 @@ static int ip_rcv_finish(struct sk_buff *skb) |
5179 | const struct iphdr *iph = ip_hdr(skb); |
5180 | struct rtable *rt; |
5181 | |
5182 | - if (sysctl_ip_early_demux && !skb_dst(skb)) { |
5183 | + if (sysctl_ip_early_demux && !skb_dst(skb) && skb->sk == NULL) { |
5184 | const struct net_protocol *ipprot; |
5185 | int protocol = iph->protocol; |
5186 | |
5187 | diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c |
5188 | index 90ff9570d7d4..471c8c1f3b67 100644 |
5189 | --- a/net/ipv4/ip_tunnel.c |
5190 | +++ b/net/ipv4/ip_tunnel.c |
5191 | @@ -618,6 +618,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, |
5192 | tunnel->err_time + IPTUNNEL_ERR_TIMEO)) { |
5193 | tunnel->err_count--; |
5194 | |
5195 | + memset(IPCB(skb), 0, sizeof(*IPCB(skb))); |
5196 | dst_link_failure(skb); |
5197 | } else |
5198 | tunnel->err_count = 0; |
5199 | diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c |
5200 | index 302d6fb1ff2b..51d54dc376f3 100644 |
5201 | --- a/net/ipv6/ip6_input.c |
5202 | +++ b/net/ipv6/ip6_input.c |
5203 | @@ -49,7 +49,7 @@ |
5204 | |
5205 | int ip6_rcv_finish(struct sk_buff *skb) |
5206 | { |
5207 | - if (sysctl_ip_early_demux && !skb_dst(skb)) { |
5208 | + if (sysctl_ip_early_demux && !skb_dst(skb) && skb->sk == NULL) { |
5209 | const struct inet6_protocol *ipprot; |
5210 | |
5211 | ipprot = rcu_dereference(inet6_protos[ipv6_hdr(skb)->nexthdr]); |
5212 | diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c |
5213 | index c38adcc910fb..1c2a63412656 100644 |
5214 | --- a/security/integrity/ima/ima_template_lib.c |
5215 | +++ b/security/integrity/ima/ima_template_lib.c |
5216 | @@ -255,7 +255,7 @@ int ima_eventdigest_ng_init(struct integrity_iint_cache *iint, |
5217 | struct evm_ima_xattr_data *xattr_value, |
5218 | int xattr_len, struct ima_field_data *field_data) |
5219 | { |
5220 | - u8 *cur_digest = NULL, hash_algo = HASH_ALGO__LAST; |
5221 | + u8 *cur_digest = NULL, hash_algo = HASH_ALGO_SHA1; |
5222 | u32 cur_digestsize = 0; |
5223 | |
5224 | /* If iint is NULL, we are recording a violation. */ |
5225 | diff --git a/sound/core/init.c b/sound/core/init.c |
5226 | index 1351f22f651c..e3c93cd77ee7 100644 |
5227 | --- a/sound/core/init.c |
5228 | +++ b/sound/core/init.c |
5229 | @@ -170,7 +170,7 @@ int snd_card_create(int idx, const char *xid, |
5230 | if (idx < 0) { |
5231 | for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++) { |
5232 | /* idx == -1 == 0xffff means: take any free slot */ |
5233 | - if (idx2 < sizeof(int) && !(idx & (1U << idx2))) |
5234 | + if (idx2 < 32 && !(idx & (1U << idx2))) |
5235 | continue; |
5236 | if (!test_bit(idx2, snd_cards_lock)) { |
5237 | if (module_slot_match(module, idx2)) { |
5238 | @@ -183,7 +183,7 @@ int snd_card_create(int idx, const char *xid, |
5239 | if (idx < 0) { |
5240 | for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++) { |
5241 | /* idx == -1 == 0xffff means: take any free slot */ |
5242 | - if (idx2 < sizeof(int) && !(idx & (1U << idx2))) |
5243 | + if (idx2 < 32 && !(idx & (1U << idx2))) |
5244 | continue; |
5245 | if (!test_bit(idx2, snd_cards_lock)) { |
5246 | if (!slots[idx2] || !*slots[idx2]) { |
5247 | diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig |
5248 | index 46ed9e8ae0fd..cc9fd67a50df 100644 |
5249 | --- a/sound/pci/Kconfig |
5250 | +++ b/sound/pci/Kconfig |
5251 | @@ -25,6 +25,7 @@ config SND_ALS300 |
5252 | select SND_PCM |
5253 | select SND_AC97_CODEC |
5254 | select SND_OPL3_LIB |
5255 | + select ZONE_DMA |
5256 | help |
5257 | Say 'Y' or 'M' to include support for Avance Logic ALS300/ALS300+ |
5258 | |
5259 | @@ -49,6 +50,7 @@ config SND_ALI5451 |
5260 | tristate "ALi M5451 PCI Audio Controller" |
5261 | select SND_MPU401_UART |
5262 | select SND_AC97_CODEC |
5263 | + select ZONE_DMA |
5264 | help |
5265 | Say Y here to include support for the integrated AC97 sound |
5266 | device on motherboards using the ALi M5451 Audio Controller |
5267 | @@ -153,6 +155,7 @@ config SND_AZT3328 |
5268 | select SND_PCM |
5269 | select SND_RAWMIDI |
5270 | select SND_AC97_CODEC |
5271 | + select ZONE_DMA |
5272 | help |
5273 | Say Y here to include support for Aztech AZF3328 (PCI168) |
5274 | soundcards. |
5275 | @@ -458,6 +461,7 @@ config SND_EMU10K1 |
5276 | select SND_HWDEP |
5277 | select SND_RAWMIDI |
5278 | select SND_AC97_CODEC |
5279 | + select ZONE_DMA |
5280 | help |
5281 | Say Y to include support for Sound Blaster PCI 512, Live!, |
5282 | Audigy and E-mu APS (partially supported) soundcards. |
5283 | @@ -473,6 +477,7 @@ config SND_EMU10K1X |
5284 | tristate "Emu10k1X (Dell OEM Version)" |
5285 | select SND_AC97_CODEC |
5286 | select SND_RAWMIDI |
5287 | + select ZONE_DMA |
5288 | help |
5289 | Say Y here to include support for the Dell OEM version of the |
5290 | Sound Blaster Live!. |
5291 | @@ -506,6 +511,7 @@ config SND_ES1938 |
5292 | select SND_OPL3_LIB |
5293 | select SND_MPU401_UART |
5294 | select SND_AC97_CODEC |
5295 | + select ZONE_DMA |
5296 | help |
5297 | Say Y here to include support for soundcards based on ESS Solo-1 |
5298 | (ES1938, ES1946, ES1969) chips. |
5299 | @@ -517,6 +523,7 @@ config SND_ES1968 |
5300 | tristate "ESS ES1968/1978 (Maestro-1/2/2E)" |
5301 | select SND_MPU401_UART |
5302 | select SND_AC97_CODEC |
5303 | + select ZONE_DMA |
5304 | help |
5305 | Say Y here to include support for soundcards based on ESS Maestro |
5306 | 1/2/2E chips. |
5307 | @@ -605,6 +612,7 @@ config SND_ICE1712 |
5308 | select SND_MPU401_UART |
5309 | select SND_AC97_CODEC |
5310 | select BITREVERSE |
5311 | + select ZONE_DMA |
5312 | help |
5313 | Say Y here to include support for soundcards based on the |
5314 | ICE1712 (Envy24) chip. |
5315 | @@ -692,6 +700,7 @@ config SND_LX6464ES |
5316 | config SND_MAESTRO3 |
5317 | tristate "ESS Allegro/Maestro3" |
5318 | select SND_AC97_CODEC |
5319 | + select ZONE_DMA |
5320 | help |
5321 | Say Y here to include support for soundcards based on ESS Maestro 3 |
5322 | (Allegro) chips. |
5323 | @@ -788,6 +797,7 @@ config SND_SIS7019 |
5324 | tristate "SiS 7019 Audio Accelerator" |
5325 | depends on X86 && !X86_64 |
5326 | select SND_AC97_CODEC |
5327 | + select ZONE_DMA |
5328 | help |
5329 | Say Y here to include support for the SiS 7019 Audio Accelerator. |
5330 | |
5331 | @@ -799,6 +809,7 @@ config SND_SONICVIBES |
5332 | select SND_OPL3_LIB |
5333 | select SND_MPU401_UART |
5334 | select SND_AC97_CODEC |
5335 | + select ZONE_DMA |
5336 | help |
5337 | Say Y here to include support for soundcards based on the S3 |
5338 | SonicVibes chip. |
5339 | @@ -810,6 +821,7 @@ config SND_TRIDENT |
5340 | tristate "Trident 4D-Wave DX/NX; SiS 7018" |
5341 | select SND_MPU401_UART |
5342 | select SND_AC97_CODEC |
5343 | + select ZONE_DMA |
5344 | help |
5345 | Say Y here to include support for soundcards based on Trident |
5346 | 4D-Wave DX/NX or SiS 7018 chips. |
5347 | diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c |
5348 | index c7f6d1cab606..7d4ccfa48008 100644 |
5349 | --- a/sound/pci/hda/hda_generic.c |
5350 | +++ b/sound/pci/hda/hda_generic.c |
5351 | @@ -2857,9 +2857,11 @@ static bool look_for_mix_leaf_ctls(struct hda_codec *codec, hda_nid_t mix_nid, |
5352 | if (num_conns < idx) |
5353 | return false; |
5354 | nid = list[idx]; |
5355 | - if (!*mix_val && nid_has_volume(codec, nid, HDA_OUTPUT)) |
5356 | + if (!*mix_val && nid_has_volume(codec, nid, HDA_OUTPUT) && |
5357 | + !is_ctl_associated(codec, nid, HDA_OUTPUT, 0, NID_PATH_VOL_CTL)) |
5358 | *mix_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
5359 | - if (!*mute_val && nid_has_mute(codec, nid, HDA_OUTPUT)) |
5360 | + if (!*mute_val && nid_has_mute(codec, nid, HDA_OUTPUT) && |
5361 | + !is_ctl_associated(codec, nid, HDA_OUTPUT, 0, NID_PATH_MUTE_CTL)) |
5362 | *mute_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
5363 | |
5364 | return *mix_val || *mute_val; |
5365 | diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c |
5366 | index 699262a3e07a..0170318eb220 100644 |
5367 | --- a/sound/pci/hda/patch_analog.c |
5368 | +++ b/sound/pci/hda/patch_analog.c |
5369 | @@ -185,7 +185,7 @@ static const struct hda_codec_ops ad198x_auto_patch_ops = { |
5370 | }; |
5371 | |
5372 | |
5373 | -static int ad198x_parse_auto_config(struct hda_codec *codec) |
5374 | +static int ad198x_parse_auto_config(struct hda_codec *codec, bool indep_hp) |
5375 | { |
5376 | struct ad198x_spec *spec = codec->spec; |
5377 | struct auto_pin_cfg *cfg = &spec->gen.autocfg; |
5378 | @@ -195,7 +195,7 @@ static int ad198x_parse_auto_config(struct hda_codec *codec) |
5379 | codec->no_trigger_sense = 1; |
5380 | codec->no_sticky_stream = 1; |
5381 | |
5382 | - spec->gen.indep_hp = 1; |
5383 | + spec->gen.indep_hp = indep_hp; |
5384 | |
5385 | err = snd_hda_parse_pin_defcfg(codec, cfg, NULL, 0); |
5386 | if (err < 0) |
5387 | @@ -280,11 +280,11 @@ static const struct hda_fixup ad1986a_fixups[] = { |
5388 | .v.pins = (const struct hda_pintbl[]) { |
5389 | { 0x1a, 0x02214021 }, /* headphone */ |
5390 | { 0x1b, 0x01014011 }, /* front */ |
5391 | - { 0x1c, 0x01013012 }, /* surround */ |
5392 | - { 0x1d, 0x01019015 }, /* clfe */ |
5393 | + { 0x1c, 0x01813030 }, /* line-in */ |
5394 | + { 0x1d, 0x01a19020 }, /* rear mic */ |
5395 | { 0x1e, 0x411111f0 }, /* N/A */ |
5396 | { 0x1f, 0x02a190f0 }, /* mic */ |
5397 | - { 0x20, 0x018130f0 }, /* line-in */ |
5398 | + { 0x20, 0x411111f0 }, /* N/A */ |
5399 | {} |
5400 | }, |
5401 | }, |
5402 | @@ -378,7 +378,7 @@ static int patch_ad1986a(struct hda_codec *codec) |
5403 | ad1986a_fixups); |
5404 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
5405 | |
5406 | - err = ad198x_parse_auto_config(codec); |
5407 | + err = ad198x_parse_auto_config(codec, false); |
5408 | if (err < 0) { |
5409 | snd_hda_gen_free(codec); |
5410 | return err; |
5411 | @@ -480,7 +480,7 @@ static int patch_ad1983(struct hda_codec *codec) |
5412 | |
5413 | spec->gen.beep_nid = 0x10; |
5414 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); |
5415 | - err = ad198x_parse_auto_config(codec); |
5416 | + err = ad198x_parse_auto_config(codec, false); |
5417 | if (err < 0) |
5418 | goto error; |
5419 | err = ad1983_add_spdif_mux_ctl(codec); |
5420 | @@ -567,7 +567,7 @@ static int patch_ad1981(struct hda_codec *codec) |
5421 | snd_hda_pick_fixup(codec, NULL, ad1981_fixup_tbl, ad1981_fixups); |
5422 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
5423 | |
5424 | - err = ad198x_parse_auto_config(codec); |
5425 | + err = ad198x_parse_auto_config(codec, false); |
5426 | if (err < 0) |
5427 | goto error; |
5428 | err = ad1983_add_spdif_mux_ctl(codec); |
5429 | @@ -893,7 +893,7 @@ static int patch_ad1988(struct hda_codec *codec) |
5430 | snd_hda_pick_fixup(codec, ad1988_fixup_models, NULL, ad1988_fixups); |
5431 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
5432 | |
5433 | - err = ad198x_parse_auto_config(codec); |
5434 | + err = ad198x_parse_auto_config(codec, true); |
5435 | if (err < 0) |
5436 | goto error; |
5437 | err = ad1988_add_spdif_mux_ctl(codec); |
5438 | @@ -1070,7 +1070,7 @@ static int patch_ad1884(struct hda_codec *codec) |
5439 | snd_hda_pick_fixup(codec, NULL, ad1884_fixup_tbl, ad1884_fixups); |
5440 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
5441 | |
5442 | - err = ad198x_parse_auto_config(codec); |
5443 | + err = ad198x_parse_auto_config(codec, true); |
5444 | if (err < 0) |
5445 | goto error; |
5446 | err = ad1983_add_spdif_mux_ctl(codec); |
5447 | @@ -1112,7 +1112,7 @@ static int patch_ad1882(struct hda_codec *codec) |
5448 | spec->gen.mixer_merge_nid = 0x21; |
5449 | spec->gen.beep_nid = 0x10; |
5450 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); |
5451 | - err = ad198x_parse_auto_config(codec); |
5452 | + err = ad198x_parse_auto_config(codec, true); |
5453 | if (err < 0) |
5454 | goto error; |
5455 | err = ad1988_add_spdif_mux_ctl(codec); |
5456 | diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
5457 | index 314b77eb1216..6baac4400076 100644 |
5458 | --- a/sound/pci/hda/patch_hdmi.c |
5459 | +++ b/sound/pci/hda/patch_hdmi.c |
5460 | @@ -129,6 +129,9 @@ struct hdmi_spec { |
5461 | |
5462 | struct hdmi_eld temp_eld; |
5463 | struct hdmi_ops ops; |
5464 | + |
5465 | + bool dyn_pin_out; |
5466 | + |
5467 | /* |
5468 | * Non-generic VIA/NVIDIA specific |
5469 | */ |
5470 | @@ -497,15 +500,25 @@ static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t pin_nid, |
5471 | |
5472 | static void hdmi_init_pin(struct hda_codec *codec, hda_nid_t pin_nid) |
5473 | { |
5474 | + struct hdmi_spec *spec = codec->spec; |
5475 | + int pin_out; |
5476 | + |
5477 | /* Unmute */ |
5478 | if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) |
5479 | snd_hda_codec_write(codec, pin_nid, 0, |
5480 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
5481 | - /* Enable pin out: some machines with GM965 gets broken output when |
5482 | - * the pin is disabled or changed while using with HDMI |
5483 | - */ |
5484 | + |
5485 | + if (spec->dyn_pin_out) |
5486 | + /* Disable pin out until stream is active */ |
5487 | + pin_out = 0; |
5488 | + else |
5489 | + /* Enable pin out: some machines with GM965 gets broken output |
5490 | + * when the pin is disabled or changed while using with HDMI |
5491 | + */ |
5492 | + pin_out = PIN_OUT; |
5493 | + |
5494 | snd_hda_codec_write(codec, pin_nid, 0, |
5495 | - AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
5496 | + AC_VERB_SET_PIN_WIDGET_CONTROL, pin_out); |
5497 | } |
5498 | |
5499 | static int hdmi_get_channel_count(struct hda_codec *codec, hda_nid_t cvt_nid) |
5500 | @@ -1747,6 +1760,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
5501 | struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); |
5502 | hda_nid_t pin_nid = per_pin->pin_nid; |
5503 | bool non_pcm; |
5504 | + int pinctl; |
5505 | |
5506 | non_pcm = check_non_pcm_per_cvt(codec, cvt_nid); |
5507 | mutex_lock(&per_pin->lock); |
5508 | @@ -1756,6 +1770,14 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
5509 | hdmi_setup_audio_infoframe(codec, per_pin, non_pcm); |
5510 | mutex_unlock(&per_pin->lock); |
5511 | |
5512 | + if (spec->dyn_pin_out) { |
5513 | + pinctl = snd_hda_codec_read(codec, pin_nid, 0, |
5514 | + AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
5515 | + snd_hda_codec_write(codec, pin_nid, 0, |
5516 | + AC_VERB_SET_PIN_WIDGET_CONTROL, |
5517 | + pinctl | PIN_OUT); |
5518 | + } |
5519 | + |
5520 | return spec->ops.setup_stream(codec, cvt_nid, pin_nid, stream_tag, format); |
5521 | } |
5522 | |
5523 | @@ -1775,6 +1797,7 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, |
5524 | int cvt_idx, pin_idx; |
5525 | struct hdmi_spec_per_cvt *per_cvt; |
5526 | struct hdmi_spec_per_pin *per_pin; |
5527 | + int pinctl; |
5528 | |
5529 | if (hinfo->nid) { |
5530 | cvt_idx = cvt_nid_to_cvt_index(spec, hinfo->nid); |
5531 | @@ -1791,6 +1814,14 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, |
5532 | return -EINVAL; |
5533 | per_pin = get_pin(spec, pin_idx); |
5534 | |
5535 | + if (spec->dyn_pin_out) { |
5536 | + pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0, |
5537 | + AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
5538 | + snd_hda_codec_write(codec, per_pin->pin_nid, 0, |
5539 | + AC_VERB_SET_PIN_WIDGET_CONTROL, |
5540 | + pinctl & ~PIN_OUT); |
5541 | + } |
5542 | + |
5543 | snd_hda_spdif_ctls_unassign(codec, pin_idx); |
5544 | |
5545 | mutex_lock(&per_pin->lock); |
5546 | @@ -2848,6 +2879,7 @@ static int patch_nvhdmi(struct hda_codec *codec) |
5547 | return err; |
5548 | |
5549 | spec = codec->spec; |
5550 | + spec->dyn_pin_out = true; |
5551 | |
5552 | spec->ops.chmap_cea_alloc_validate_get_type = |
5553 | nvhdmi_chmap_cea_alloc_validate_get_type; |
5554 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
5555 | index c5646941539a..864e6dfaa7a4 100644 |
5556 | --- a/sound/pci/hda/patch_realtek.c |
5557 | +++ b/sound/pci/hda/patch_realtek.c |
5558 | @@ -1780,6 +1780,7 @@ enum { |
5559 | ALC889_FIXUP_DAC_ROUTE, |
5560 | ALC889_FIXUP_MBP_VREF, |
5561 | ALC889_FIXUP_IMAC91_VREF, |
5562 | + ALC889_FIXUP_MBA11_VREF, |
5563 | ALC889_FIXUP_MBA21_VREF, |
5564 | ALC882_FIXUP_INV_DMIC, |
5565 | ALC882_FIXUP_NO_PRIMARY_HP, |
5566 | @@ -1910,6 +1911,16 @@ static void alc889_fixup_imac91_vref(struct hda_codec *codec, |
5567 | alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); |
5568 | } |
5569 | |
5570 | +/* Set VREF on speaker pins on mba11 */ |
5571 | +static void alc889_fixup_mba11_vref(struct hda_codec *codec, |
5572 | + const struct hda_fixup *fix, int action) |
5573 | +{ |
5574 | + static hda_nid_t nids[1] = { 0x18 }; |
5575 | + |
5576 | + if (action == HDA_FIXUP_ACT_INIT) |
5577 | + alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); |
5578 | +} |
5579 | + |
5580 | /* Set VREF on speaker pins on mba21 */ |
5581 | static void alc889_fixup_mba21_vref(struct hda_codec *codec, |
5582 | const struct hda_fixup *fix, int action) |
5583 | @@ -2119,6 +2130,12 @@ static const struct hda_fixup alc882_fixups[] = { |
5584 | .chained = true, |
5585 | .chain_id = ALC882_FIXUP_GPIO1, |
5586 | }, |
5587 | + [ALC889_FIXUP_MBA11_VREF] = { |
5588 | + .type = HDA_FIXUP_FUNC, |
5589 | + .v.func = alc889_fixup_mba11_vref, |
5590 | + .chained = true, |
5591 | + .chain_id = ALC889_FIXUP_MBP_VREF, |
5592 | + }, |
5593 | [ALC889_FIXUP_MBA21_VREF] = { |
5594 | .type = HDA_FIXUP_FUNC, |
5595 | .v.func = alc889_fixup_mba21_vref, |
5596 | @@ -2194,7 +2211,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
5597 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF), |
5598 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF), |
5599 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), |
5600 | - SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBP_VREF), |
5601 | + SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF), |
5602 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF), |
5603 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF), |
5604 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF), |
5605 | @@ -3526,6 +3543,15 @@ static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, |
5606 | alc_fixup_headset_mode(codec, fix, action); |
5607 | } |
5608 | |
5609 | +static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, |
5610 | + const struct hda_fixup *fix, int action) |
5611 | +{ |
5612 | + if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
5613 | + struct alc_spec *spec = codec->spec; |
5614 | + spec->gen.auto_mute_via_amp = 1; |
5615 | + } |
5616 | +} |
5617 | + |
5618 | static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, |
5619 | const struct hda_fixup *fix, int action) |
5620 | { |
5621 | @@ -4247,7 +4273,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
5622 | SND_PCI_QUIRK(0x1028, 0x0606, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
5623 | SND_PCI_QUIRK(0x1028, 0x0608, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
5624 | SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
5625 | - SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
5626 | + SND_PCI_QUIRK(0x1028, 0x060f, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE), |
5627 | + SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE), |
5628 | SND_PCI_QUIRK(0x1028, 0x0613, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
5629 | SND_PCI_QUIRK(0x1028, 0x0614, "Dell Inspiron 3135", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
5630 | SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_MONO_SPEAKERS), |
5631 | @@ -4257,6 +4284,12 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
5632 | SND_PCI_QUIRK(0x1028, 0x063e, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
5633 | SND_PCI_QUIRK(0x1028, 0x063f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), |
5634 | SND_PCI_QUIRK(0x1028, 0x0640, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), |
5635 | + SND_PCI_QUIRK(0x1028, 0x064d, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), |
5636 | + SND_PCI_QUIRK(0x1028, 0x0651, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), |
5637 | + SND_PCI_QUIRK(0x1028, 0x0652, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), |
5638 | + SND_PCI_QUIRK(0x1028, 0x0653, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), |
5639 | + SND_PCI_QUIRK(0x1028, 0x0658, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
5640 | + SND_PCI_QUIRK(0x1028, 0x0662, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), |
5641 | SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), |
5642 | SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), |
5643 | SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), |
5644 | @@ -4841,6 +4874,7 @@ enum { |
5645 | ALC662_FIXUP_BASS_CHMAP, |
5646 | ALC662_FIXUP_BASS_1A, |
5647 | ALC662_FIXUP_BASS_1A_CHMAP, |
5648 | + ALC668_FIXUP_AUTO_MUTE, |
5649 | }; |
5650 | |
5651 | static const struct hda_fixup alc662_fixups[] = { |
5652 | @@ -5001,6 +5035,12 @@ static const struct hda_fixup alc662_fixups[] = { |
5653 | .type = HDA_FIXUP_FUNC, |
5654 | .v.func = alc_fixup_inv_dmic_0x12, |
5655 | }, |
5656 | + [ALC668_FIXUP_AUTO_MUTE] = { |
5657 | + .type = HDA_FIXUP_FUNC, |
5658 | + .v.func = alc_fixup_auto_mute_via_amp, |
5659 | + .chained = true, |
5660 | + .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE |
5661 | + }, |
5662 | [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = { |
5663 | .type = HDA_FIXUP_PINS, |
5664 | .v.pins = (const struct hda_pintbl[]) { |
5665 | @@ -5046,11 +5086,12 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
5666 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
5667 | SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5668 | SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5669 | - SND_PCI_QUIRK(0x1028, 0x0623, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5670 | - SND_PCI_QUIRK(0x1028, 0x0624, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5671 | + SND_PCI_QUIRK(0x1028, 0x0623, "Dell", ALC668_FIXUP_AUTO_MUTE), |
5672 | + SND_PCI_QUIRK(0x1028, 0x0624, "Dell", ALC668_FIXUP_AUTO_MUTE), |
5673 | SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5674 | SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5675 | - SND_PCI_QUIRK(0x1028, 0x0628, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5676 | + SND_PCI_QUIRK(0x1028, 0x0628, "Dell", ALC668_FIXUP_AUTO_MUTE), |
5677 | + SND_PCI_QUIRK(0x1028, 0x064e, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5678 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), |
5679 | SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A_CHMAP), |
5680 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_CHMAP), |
5681 | diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c |
5682 | index b96d9e1adf6d..3717f2dd30be 100644 |
5683 | --- a/sound/pci/rme9652/rme9652.c |
5684 | +++ b/sound/pci/rme9652/rme9652.c |
5685 | @@ -285,7 +285,7 @@ static char channel_map_9636_ds[26] = { |
5686 | /* ADAT channels are remapped */ |
5687 | 1, 3, 5, 7, 9, 11, 13, 15, |
5688 | /* channels 8 and 9 are S/PDIF */ |
5689 | - 24, 25 |
5690 | + 24, 25, |
5691 | /* others don't exist */ |
5692 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 |
5693 | }; |
5694 | diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c |
5695 | index ebff1128be59..adee866f463f 100644 |
5696 | --- a/sound/soc/codecs/adau1701.c |
5697 | +++ b/sound/soc/codecs/adau1701.c |
5698 | @@ -71,7 +71,7 @@ |
5699 | |
5700 | #define ADAU1701_SEROCTL_WORD_LEN_24 0x0000 |
5701 | #define ADAU1701_SEROCTL_WORD_LEN_20 0x0001 |
5702 | -#define ADAU1701_SEROCTL_WORD_LEN_16 0x0010 |
5703 | +#define ADAU1701_SEROCTL_WORD_LEN_16 0x0002 |
5704 | #define ADAU1701_SEROCTL_WORD_LEN_MASK 0x0003 |
5705 | |
5706 | #define ADAU1701_AUXNPOW_VBPD 0x40 |
5707 | diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c |
5708 | index 18cdcca9014c..385dec16eb8a 100644 |
5709 | --- a/sound/soc/codecs/tlv320aic32x4.c |
5710 | +++ b/sound/soc/codecs/tlv320aic32x4.c |
5711 | @@ -267,8 +267,8 @@ static const struct regmap_range_cfg aic32x4_regmap_pages[] = { |
5712 | .selector_mask = 0xff, |
5713 | .window_start = 0, |
5714 | .window_len = 128, |
5715 | - .range_min = AIC32X4_PAGE1, |
5716 | - .range_max = AIC32X4_PAGE1 + 127, |
5717 | + .range_min = 0, |
5718 | + .range_max = AIC32X4_RMICPGAVOL, |
5719 | }, |
5720 | }; |
5721 | |
5722 | diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c |
5723 | index 0ab2dc296474..c4c9ed7acd78 100644 |
5724 | --- a/sound/soc/codecs/wm5110.c |
5725 | +++ b/sound/soc/codecs/wm5110.c |
5726 | @@ -43,6 +43,54 @@ static const struct reg_default wm5110_sysclk_revd_patch[] = { |
5727 | { 0x3133, 0x1201 }, |
5728 | { 0x3183, 0x1501 }, |
5729 | { 0x31D3, 0x1401 }, |
5730 | + { 0x0049, 0x01ea }, |
5731 | + { 0x004a, 0x01f2 }, |
5732 | + { 0x0057, 0x01e7 }, |
5733 | + { 0x0058, 0x01fb }, |
5734 | + { 0x33ce, 0xc4f5 }, |
5735 | + { 0x33cf, 0x1361 }, |
5736 | + { 0x33d0, 0x0402 }, |
5737 | + { 0x33d1, 0x4700 }, |
5738 | + { 0x33d2, 0x026d }, |
5739 | + { 0x33d3, 0xff00 }, |
5740 | + { 0x33d4, 0x026d }, |
5741 | + { 0x33d5, 0x0101 }, |
5742 | + { 0x33d6, 0xc4f5 }, |
5743 | + { 0x33d7, 0x0361 }, |
5744 | + { 0x33d8, 0x0402 }, |
5745 | + { 0x33d9, 0x6701 }, |
5746 | + { 0x33da, 0xc4f5 }, |
5747 | + { 0x33db, 0x136f }, |
5748 | + { 0x33dc, 0xc4f5 }, |
5749 | + { 0x33dd, 0x134f }, |
5750 | + { 0x33de, 0xc4f5 }, |
5751 | + { 0x33df, 0x131f }, |
5752 | + { 0x33e0, 0x026d }, |
5753 | + { 0x33e1, 0x4f01 }, |
5754 | + { 0x33e2, 0x026d }, |
5755 | + { 0x33e3, 0xf100 }, |
5756 | + { 0x33e4, 0x026d }, |
5757 | + { 0x33e5, 0x0001 }, |
5758 | + { 0x33e6, 0xc4f5 }, |
5759 | + { 0x33e7, 0x0361 }, |
5760 | + { 0x33e8, 0x0402 }, |
5761 | + { 0x33e9, 0x6601 }, |
5762 | + { 0x33ea, 0xc4f5 }, |
5763 | + { 0x33eb, 0x136f }, |
5764 | + { 0x33ec, 0xc4f5 }, |
5765 | + { 0x33ed, 0x134f }, |
5766 | + { 0x33ee, 0xc4f5 }, |
5767 | + { 0x33ef, 0x131f }, |
5768 | + { 0x33f0, 0x026d }, |
5769 | + { 0x33f1, 0x4e01 }, |
5770 | + { 0x33f2, 0x026d }, |
5771 | + { 0x33f3, 0xf000 }, |
5772 | + { 0x33f6, 0xc4f5 }, |
5773 | + { 0x33f7, 0x1361 }, |
5774 | + { 0x33f8, 0x0402 }, |
5775 | + { 0x33f9, 0x4600 }, |
5776 | + { 0x33fa, 0x026d }, |
5777 | + { 0x33fb, 0xfe00 }, |
5778 | }; |
5779 | |
5780 | static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w, |
5781 | diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c |
5782 | index f36d24a02445..6bee5f6dfa37 100644 |
5783 | --- a/tools/perf/util/session.c |
5784 | +++ b/tools/perf/util/session.c |
5785 | @@ -851,6 +851,7 @@ static struct machine * |
5786 | struct perf_sample *sample) |
5787 | { |
5788 | const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; |
5789 | + struct machine *machine; |
5790 | |
5791 | if (perf_guest && |
5792 | ((cpumode == PERF_RECORD_MISC_GUEST_KERNEL) || |
5793 | @@ -863,7 +864,11 @@ static struct machine * |
5794 | else |
5795 | pid = sample->pid; |
5796 | |
5797 | - return perf_session__findnew_machine(session, pid); |
5798 | + machine = perf_session__find_machine(session, pid); |
5799 | + if (!machine) |
5800 | + machine = perf_session__findnew_machine(session, |
5801 | + DEFAULT_GUEST_KERNEL_ID); |
5802 | + return machine; |
5803 | } |
5804 | |
5805 | return &session->machines.host; |