Magellan Linux

Annotation of /trunk/kernel-alx/patches-4.4/0105-4.4.6-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2797 - (hide annotations) (download)
Mon May 30 12:45:49 2016 UTC (7 years, 11 months ago) by niro
File size: 62189 byte(s)
-linux-4.4.6
1 niro 2797 diff --git a/Documentation/devicetree/bindings/arm/omap/omap.txt b/Documentation/devicetree/bindings/arm/omap/omap.txt
2     index 9f4e5136e568..12af302bca6a 100644
3     --- a/Documentation/devicetree/bindings/arm/omap/omap.txt
4     +++ b/Documentation/devicetree/bindings/arm/omap/omap.txt
5     @@ -23,6 +23,7 @@ Optional properties:
6     during suspend.
7     - ti,no-reset-on-init: When present, the module should not be reset at init
8     - ti,no-idle-on-init: When present, the module should not be idled at init
9     +- ti,no-idle: When present, the module is never allowed to idle.
10    
11     Example:
12    
13     diff --git a/Documentation/virtual/kvm/mmu.txt b/Documentation/virtual/kvm/mmu.txt
14     index 3a4d681c3e98..b653641d4261 100644
15     --- a/Documentation/virtual/kvm/mmu.txt
16     +++ b/Documentation/virtual/kvm/mmu.txt
17     @@ -358,7 +358,8 @@ In the first case there are two additional complications:
18     - if CR4.SMEP is enabled: since we've turned the page into a kernel page,
19     the kernel may now execute it. We handle this by also setting spte.nx.
20     If we get a user fetch or read fault, we'll change spte.u=1 and
21     - spte.nx=gpte.nx back.
22     + spte.nx=gpte.nx back. For this to work, KVM forces EFER.NX to 1 when
23     + shadow paging is in use.
24     - if CR4.SMAP is disabled: since the page has been changed to a kernel
25     page, it can not be reused when CR4.SMAP is enabled. We set
26     CR4.SMAP && !CR0.WP into shadow page's role to avoid this case. Note,
27     diff --git a/Makefile b/Makefile
28     index d13322ade3a0..87d12b44ab66 100644
29     --- a/Makefile
30     +++ b/Makefile
31     @@ -1,6 +1,6 @@
32     VERSION = 4
33     PATCHLEVEL = 4
34     -SUBLEVEL = 5
35     +SUBLEVEL = 6
36     EXTRAVERSION =
37     NAME = Blurry Fish Butt
38    
39     diff --git a/arch/arm/boot/dts/armada-xp-axpwifiap.dts b/arch/arm/boot/dts/armada-xp-axpwifiap.dts
40     index 23fc670c0427..5c21b236721f 100644
41     --- a/arch/arm/boot/dts/armada-xp-axpwifiap.dts
42     +++ b/arch/arm/boot/dts/armada-xp-axpwifiap.dts
43     @@ -70,8 +70,8 @@
44     soc {
45     ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000
46     MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000
47     - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000
48     - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>;
49     + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000
50     + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>;
51    
52     pcie-controller {
53     status = "okay";
54     diff --git a/arch/arm/boot/dts/armada-xp-db.dts b/arch/arm/boot/dts/armada-xp-db.dts
55     index f774101416a5..ebe1d267406d 100644
56     --- a/arch/arm/boot/dts/armada-xp-db.dts
57     +++ b/arch/arm/boot/dts/armada-xp-db.dts
58     @@ -76,8 +76,8 @@
59     ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000
60     MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000
61     MBUS_ID(0x01, 0x2f) 0 0 0xf0000000 0x1000000
62     - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000
63     - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>;
64     + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000
65     + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>;
66    
67     devbus-bootcs {
68     status = "okay";
69     diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
70     index 4878d7353069..5730b875c4f5 100644
71     --- a/arch/arm/boot/dts/armada-xp-gp.dts
72     +++ b/arch/arm/boot/dts/armada-xp-gp.dts
73     @@ -95,8 +95,8 @@
74     ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000
75     MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000
76     MBUS_ID(0x01, 0x2f) 0 0 0xf0000000 0x1000000
77     - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000
78     - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>;
79     + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000
80     + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>;
81    
82     devbus-bootcs {
83     status = "okay";
84     diff --git a/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts b/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts
85     index 58b500873bfd..d960fef77ca1 100644
86     --- a/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts
87     +++ b/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts
88     @@ -65,8 +65,8 @@
89     soc {
90     ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000
91     MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000
92     - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000
93     - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>;
94     + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000
95     + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>;
96    
97     pcie-controller {
98     status = "okay";
99     diff --git a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
100     index 6e9820e141f8..b89e6cf1271a 100644
101     --- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
102     +++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
103     @@ -70,8 +70,8 @@
104     soc {
105     ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000
106     MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000
107     - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000
108     - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>;
109     + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000
110     + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>;
111    
112     pcie-controller {
113     status = "okay";
114     diff --git a/arch/arm/boot/dts/armada-xp-matrix.dts b/arch/arm/boot/dts/armada-xp-matrix.dts
115     index 6ab33837a2b6..6522b04f4a8e 100644
116     --- a/arch/arm/boot/dts/armada-xp-matrix.dts
117     +++ b/arch/arm/boot/dts/armada-xp-matrix.dts
118     @@ -68,8 +68,8 @@
119     soc {
120     ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000
121     MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000
122     - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000
123     - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>;
124     + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000
125     + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>;
126    
127     internal-regs {
128     serial@12000 {
129     diff --git a/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
130     index 6fe8972de0a2..db54c7158a36 100644
131     --- a/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
132     +++ b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
133     @@ -64,8 +64,8 @@
134     soc {
135     ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000
136     MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000
137     - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000
138     - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>;
139     + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000
140     + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>;
141    
142     pcie-controller {
143     status = "okay";
144     diff --git a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
145     index a5db17782e08..853bd392a4fe 100644
146     --- a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
147     +++ b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
148     @@ -65,9 +65,9 @@
149     soc {
150     ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000
151     MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000
152     - MBUS_ID(0x01, 0x2f) 0 0 0xf0000000 0x8000000
153     - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000
154     - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>;
155     + MBUS_ID(0x01, 0x2f) 0 0 0xe8000000 0x8000000
156     + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000
157     + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>;
158    
159     devbus-bootcs {
160     status = "okay";
161     diff --git a/arch/arm/boot/dts/armada-xp-synology-ds414.dts b/arch/arm/boot/dts/armada-xp-synology-ds414.dts
162     index 2391b11dc546..d17dab0a6f51 100644
163     --- a/arch/arm/boot/dts/armada-xp-synology-ds414.dts
164     +++ b/arch/arm/boot/dts/armada-xp-synology-ds414.dts
165     @@ -78,8 +78,8 @@
166     soc {
167     ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000
168     MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000
169     - MBUS_ID(0x09, 0x09) 0 0 0xf8100000 0x10000
170     - MBUS_ID(0x09, 0x05) 0 0 0xf8110000 0x10000>;
171     + MBUS_ID(0x09, 0x09) 0 0 0xf1100000 0x10000
172     + MBUS_ID(0x09, 0x05) 0 0 0xf1110000 0x10000>;
173    
174     pcie-controller {
175     status = "okay";
176     diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
177     index fe99231cbde5..c2a03c740e79 100644
178     --- a/arch/arm/boot/dts/dra7.dtsi
179     +++ b/arch/arm/boot/dts/dra7.dtsi
180     @@ -1497,6 +1497,16 @@
181     0x48485200 0x2E00>;
182     #address-cells = <1>;
183     #size-cells = <1>;
184     +
185     + /*
186     + * Do not allow gating of cpsw clock as workaround
187     + * for errata i877. Keeping internal clock disabled
188     + * causes the device switching characteristics
189     + * to degrade over time and eventually fail to meet
190     + * the data manual delay time/skew specs.
191     + */
192     + ti,no-idle;
193     +
194     /*
195     * rx_thresh_pend
196     * rx_pend
197     diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
198     index 48495ad82aba..8e0bd5939e5a 100644
199     --- a/arch/arm/mach-omap2/omap_hwmod.c
200     +++ b/arch/arm/mach-omap2/omap_hwmod.c
201     @@ -2200,6 +2200,11 @@ static int _enable(struct omap_hwmod *oh)
202     */
203     static int _idle(struct omap_hwmod *oh)
204     {
205     + if (oh->flags & HWMOD_NO_IDLE) {
206     + oh->_int_flags |= _HWMOD_SKIP_ENABLE;
207     + return 0;
208     + }
209     +
210     pr_debug("omap_hwmod: %s: idling\n", oh->name);
211    
212     if (oh->_state != _HWMOD_STATE_ENABLED) {
213     @@ -2504,6 +2509,8 @@ static int __init _init(struct omap_hwmod *oh, void *data)
214     oh->flags |= HWMOD_INIT_NO_RESET;
215     if (of_find_property(np, "ti,no-idle-on-init", NULL))
216     oh->flags |= HWMOD_INIT_NO_IDLE;
217     + if (of_find_property(np, "ti,no-idle", NULL))
218     + oh->flags |= HWMOD_NO_IDLE;
219     }
220    
221     oh->_state = _HWMOD_STATE_INITIALIZED;
222     @@ -2630,7 +2637,7 @@ static void __init _setup_postsetup(struct omap_hwmod *oh)
223     * XXX HWMOD_INIT_NO_IDLE does not belong in hwmod data -
224     * it should be set by the core code as a runtime flag during startup
225     */
226     - if ((oh->flags & HWMOD_INIT_NO_IDLE) &&
227     + if ((oh->flags & (HWMOD_INIT_NO_IDLE | HWMOD_NO_IDLE)) &&
228     (postsetup_state == _HWMOD_STATE_IDLE)) {
229     oh->_int_flags |= _HWMOD_SKIP_ENABLE;
230     postsetup_state = _HWMOD_STATE_ENABLED;
231     diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
232     index 76bce11c85a4..7c7a31169475 100644
233     --- a/arch/arm/mach-omap2/omap_hwmod.h
234     +++ b/arch/arm/mach-omap2/omap_hwmod.h
235     @@ -525,6 +525,8 @@ struct omap_hwmod_omap4_prcm {
236     * or idled.
237     * HWMOD_OPT_CLKS_NEEDED: The optional clocks are needed for the module to
238     * operate and they need to be handled at the same time as the main_clk.
239     + * HWMOD_NO_IDLE: Do not idle the hwmod at all. Useful to handle certain
240     + * IPs like CPSW on DRA7, where clocks to this module cannot be disabled.
241     */
242     #define HWMOD_SWSUP_SIDLE (1 << 0)
243     #define HWMOD_SWSUP_MSTANDBY (1 << 1)
244     @@ -541,6 +543,7 @@ struct omap_hwmod_omap4_prcm {
245     #define HWMOD_SWSUP_SIDLE_ACT (1 << 12)
246     #define HWMOD_RECONFIG_IO_CHAIN (1 << 13)
247     #define HWMOD_OPT_CLKS_NEEDED (1 << 14)
248     +#define HWMOD_NO_IDLE (1 << 15)
249    
250     /*
251     * omap_hwmod._int_flags definitions
252     diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
253     index fc9f7ef2f4ab..eaa9cabf4066 100644
254     --- a/arch/arm64/include/asm/pgtable.h
255     +++ b/arch/arm64/include/asm/pgtable.h
256     @@ -40,7 +40,7 @@
257     * VMALLOC_END: extends to the available space below vmmemmap, PCI I/O space,
258     * fixed mappings and modules
259     */
260     -#define VMEMMAP_SIZE ALIGN((1UL << (VA_BITS - PAGE_SHIFT - 1)) * sizeof(struct page), PUD_SIZE)
261     +#define VMEMMAP_SIZE ALIGN((1UL << (VA_BITS - PAGE_SHIFT)) * sizeof(struct page), PUD_SIZE)
262    
263     #ifndef CONFIG_KASAN
264     #define VMALLOC_START (VA_START)
265     @@ -52,7 +52,8 @@
266     #define VMALLOC_END (PAGE_OFFSET - PUD_SIZE - VMEMMAP_SIZE - SZ_64K)
267    
268     #define VMEMMAP_START (VMALLOC_END + SZ_64K)
269     -#define vmemmap ((struct page *)VMEMMAP_START - (memstart_addr >> PAGE_SHIFT))
270     +#define vmemmap ((struct page *)VMEMMAP_START - \
271     + SECTION_ALIGN_DOWN(memstart_addr >> PAGE_SHIFT))
272    
273     #define FIRST_USER_ADDRESS 0UL
274    
275     diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
276     index 71683a853372..db459612de44 100644
277     --- a/arch/mips/Kconfig
278     +++ b/arch/mips/Kconfig
279     @@ -2155,7 +2155,7 @@ config MIPS_MT_SMP
280     select CPU_MIPSR2_IRQ_VI
281     select CPU_MIPSR2_IRQ_EI
282     select SYNC_R4K
283     - select MIPS_GIC_IPI
284     + select MIPS_GIC_IPI if MIPS_GIC
285     select MIPS_MT
286     select SMP
287     select SMP_UP
288     @@ -2253,7 +2253,7 @@ config MIPS_VPE_APSP_API_MT
289     config MIPS_CMP
290     bool "MIPS CMP framework support (DEPRECATED)"
291     depends on SYS_SUPPORTS_MIPS_CMP && !CPU_MIPSR6
292     - select MIPS_GIC_IPI
293     + select MIPS_GIC_IPI if MIPS_GIC
294     select SMP
295     select SYNC_R4K
296     select SYS_SUPPORTS_SMP
297     @@ -2273,7 +2273,7 @@ config MIPS_CPS
298     select MIPS_CM
299     select MIPS_CPC
300     select MIPS_CPS_PM if HOTPLUG_CPU
301     - select MIPS_GIC_IPI
302     + select MIPS_GIC_IPI if MIPS_GIC
303     select SMP
304     select SYNC_R4K if (CEVT_R4K || CSRC_R4K)
305     select SYS_SUPPORTS_HOTPLUG_CPU
306     @@ -2292,6 +2292,7 @@ config MIPS_CPS_PM
307     bool
308    
309     config MIPS_GIC_IPI
310     + depends on MIPS_GIC
311     bool
312    
313     config MIPS_CM
314     diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
315     index bd4385a8e6e8..2b521e07b860 100644
316     --- a/arch/mips/kernel/smp.c
317     +++ b/arch/mips/kernel/smp.c
318     @@ -121,6 +121,7 @@ static inline void calculate_cpu_foreign_map(void)
319     cpumask_t temp_foreign_map;
320    
321     /* Re-calculate the mask */
322     + cpumask_clear(&temp_foreign_map);
323     for_each_online_cpu(i) {
324     core_present = 0;
325     for_each_cpu(k, &temp_foreign_map)
326     diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h
327     index 8374afed9d0a..f8faaaeeca1e 100644
328     --- a/arch/powerpc/include/asm/opal-api.h
329     +++ b/arch/powerpc/include/asm/opal-api.h
330     @@ -157,7 +157,8 @@
331     #define OPAL_LEDS_GET_INDICATOR 114
332     #define OPAL_LEDS_SET_INDICATOR 115
333     #define OPAL_CEC_REBOOT2 116
334     -#define OPAL_LAST 116
335     +#define OPAL_CONSOLE_FLUSH 117
336     +#define OPAL_LAST 117
337    
338     /* Device tree flags */
339    
340     diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
341     index 800115910e43..07a99e638449 100644
342     --- a/arch/powerpc/include/asm/opal.h
343     +++ b/arch/powerpc/include/asm/opal.h
344     @@ -35,6 +35,7 @@ int64_t opal_console_read(int64_t term_number, __be64 *length,
345     uint8_t *buffer);
346     int64_t opal_console_write_buffer_space(int64_t term_number,
347     __be64 *length);
348     +int64_t opal_console_flush(int64_t term_number);
349     int64_t opal_rtc_read(__be32 *year_month_day,
350     __be64 *hour_minute_second_millisecond);
351     int64_t opal_rtc_write(uint32_t year_month_day,
352     @@ -262,6 +263,8 @@ extern int opal_resync_timebase(void);
353    
354     extern void opal_lpc_init(void);
355    
356     +extern void opal_kmsg_init(void);
357     +
358     extern int opal_event_request(unsigned int opal_event_nr);
359    
360     struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr,
361     diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
362     index 59663af9315f..e4f7d4eed20c 100644
363     --- a/arch/powerpc/kernel/module_64.c
364     +++ b/arch/powerpc/kernel/module_64.c
365     @@ -335,7 +335,7 @@ static void dedotify(Elf64_Sym *syms, unsigned int numsyms, char *strtab)
366     if (syms[i].st_shndx == SHN_UNDEF) {
367     char *name = strtab + syms[i].st_name;
368     if (name[0] == '.')
369     - memmove(name, name+1, strlen(name));
370     + syms[i].st_name++;
371     }
372     }
373     }
374     diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
375     index e57cc383e5da..463af88c95a2 100644
376     --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
377     +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
378     @@ -1370,6 +1370,20 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
379     std r6, VCPU_ACOP(r9)
380     stw r7, VCPU_GUEST_PID(r9)
381     std r8, VCPU_WORT(r9)
382     + /*
383     + * Restore various registers to 0, where non-zero values
384     + * set by the guest could disrupt the host.
385     + */
386     + li r0, 0
387     + mtspr SPRN_IAMR, r0
388     + mtspr SPRN_CIABR, r0
389     + mtspr SPRN_DAWRX, r0
390     + mtspr SPRN_TCSCR, r0
391     + mtspr SPRN_WORT, r0
392     + /* Set MMCRS to 1<<31 to freeze and disable the SPMC counters */
393     + li r0, 1
394     + sldi r0, r0, 31
395     + mtspr SPRN_MMCRS, r0
396     8:
397    
398     /* Save and reset AMR and UAMOR before turning on the MMU */
399     diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile
400     index 1c8cdb6250e7..b9de7ef48849 100644
401     --- a/arch/powerpc/platforms/powernv/Makefile
402     +++ b/arch/powerpc/platforms/powernv/Makefile
403     @@ -2,6 +2,7 @@ obj-y += setup.o opal-wrappers.o opal.o opal-async.o idle.o
404     obj-y += opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o
405     obj-y += rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o
406     obj-y += opal-msglog.o opal-hmi.o opal-power.o opal-irqchip.o
407     +obj-y += opal-kmsg.o
408    
409     obj-$(CONFIG_SMP) += smp.o subcore.o subcore-asm.o
410     obj-$(CONFIG_PCI) += pci.o pci-p5ioc2.o pci-ioda.o
411     diff --git a/arch/powerpc/platforms/powernv/opal-kmsg.c b/arch/powerpc/platforms/powernv/opal-kmsg.c
412     new file mode 100644
413     index 000000000000..6f1214d4de92
414     --- /dev/null
415     +++ b/arch/powerpc/platforms/powernv/opal-kmsg.c
416     @@ -0,0 +1,75 @@
417     +/*
418     + * kmsg dumper that ensures the OPAL console fully flushes panic messages
419     + *
420     + * Author: Russell Currey <ruscur@russell.cc>
421     + *
422     + * Copyright 2015 IBM Corporation.
423     + *
424     + * This program is free software; you can redistribute it and/or modify it
425     + * under the terms of the GNU General Public License as published by the
426     + * Free Software Foundation; either version 2 of the License, or (at your
427     + * option) any later version.
428     + */
429     +
430     +#include <linux/kmsg_dump.h>
431     +
432     +#include <asm/opal.h>
433     +#include <asm/opal-api.h>
434     +
435     +/*
436     + * Console output is controlled by OPAL firmware. The kernel regularly calls
437     + * OPAL_POLL_EVENTS, which flushes some console output. In a panic state,
438     + * however, the kernel no longer calls OPAL_POLL_EVENTS and the panic message
439     + * may not be completely printed. This function does not actually dump the
440     + * message, it just ensures that OPAL completely flushes the console buffer.
441     + */
442     +static void force_opal_console_flush(struct kmsg_dumper *dumper,
443     + enum kmsg_dump_reason reason)
444     +{
445     + int i;
446     + int64_t ret;
447     +
448     + /*
449     + * Outside of a panic context the pollers will continue to run,
450     + * so we don't need to do any special flushing.
451     + */
452     + if (reason != KMSG_DUMP_PANIC)
453     + return;
454     +
455     + if (opal_check_token(OPAL_CONSOLE_FLUSH)) {
456     + ret = opal_console_flush(0);
457     +
458     + if (ret == OPAL_UNSUPPORTED || ret == OPAL_PARAMETER)
459     + return;
460     +
461     + /* Incrementally flush until there's nothing left */
462     + while (opal_console_flush(0) != OPAL_SUCCESS);
463     + } else {
464     + /*
465     + * If OPAL_CONSOLE_FLUSH is not implemented in the firmware,
466     + * the console can still be flushed by calling the polling
467     + * function enough times to flush the buffer. We don't know
468     + * how much output still needs to be flushed, but we can be
469     + * generous since the kernel is in panic and doesn't need
470     + * to do much else.
471     + */
472     + printk(KERN_NOTICE "opal: OPAL_CONSOLE_FLUSH missing.\n");
473     + for (i = 0; i < 1024; i++) {
474     + opal_poll_events(NULL);
475     + }
476     + }
477     +}
478     +
479     +static struct kmsg_dumper opal_kmsg_dumper = {
480     + .dump = force_opal_console_flush
481     +};
482     +
483     +void __init opal_kmsg_init(void)
484     +{
485     + int rc;
486     +
487     + /* Add our dumper to the list */
488     + rc = kmsg_dump_register(&opal_kmsg_dumper);
489     + if (rc != 0)
490     + pr_err("opal: kmsg_dump_register failed; returned %d\n", rc);
491     +}
492     diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
493     index b7a464fef7a7..e45b88a5d7e0 100644
494     --- a/arch/powerpc/platforms/powernv/opal-wrappers.S
495     +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
496     @@ -301,3 +301,4 @@ OPAL_CALL(opal_flash_erase, OPAL_FLASH_ERASE);
497     OPAL_CALL(opal_prd_msg, OPAL_PRD_MSG);
498     OPAL_CALL(opal_leds_get_ind, OPAL_LEDS_GET_INDICATOR);
499     OPAL_CALL(opal_leds_set_ind, OPAL_LEDS_SET_INDICATOR);
500     +OPAL_CALL(opal_console_flush, OPAL_CONSOLE_FLUSH);
501     diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
502     index 57cffb80bc36..ae29eaf85e9e 100644
503     --- a/arch/powerpc/platforms/powernv/opal.c
504     +++ b/arch/powerpc/platforms/powernv/opal.c
505     @@ -758,6 +758,9 @@ static int __init opal_init(void)
506     opal_pdev_init(opal_node, "ibm,opal-flash");
507     opal_pdev_init(opal_node, "ibm,opal-prd");
508    
509     + /* Initialise OPAL kmsg dumper for flushing console on panic */
510     + opal_kmsg_init();
511     +
512     return 0;
513     }
514     machine_subsys_initcall(powernv, opal_init);
515     diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
516     index fb1b93ea3e3f..e485817f7b1a 100644
517     --- a/arch/s390/include/asm/mmu_context.h
518     +++ b/arch/s390/include/asm/mmu_context.h
519     @@ -15,17 +15,25 @@
520     static inline int init_new_context(struct task_struct *tsk,
521     struct mm_struct *mm)
522     {
523     + spin_lock_init(&mm->context.list_lock);
524     + INIT_LIST_HEAD(&mm->context.pgtable_list);
525     + INIT_LIST_HEAD(&mm->context.gmap_list);
526     cpumask_clear(&mm->context.cpu_attach_mask);
527     atomic_set(&mm->context.attach_count, 0);
528     mm->context.flush_mm = 0;
529     - mm->context.asce_bits = _ASCE_TABLE_LENGTH | _ASCE_USER_BITS;
530     - mm->context.asce_bits |= _ASCE_TYPE_REGION3;
531     #ifdef CONFIG_PGSTE
532     mm->context.alloc_pgste = page_table_allocate_pgste;
533     mm->context.has_pgste = 0;
534     mm->context.use_skey = 0;
535     #endif
536     - mm->context.asce_limit = STACK_TOP_MAX;
537     + if (mm->context.asce_limit == 0) {
538     + /* context created by exec, set asce limit to 4TB */
539     + mm->context.asce_bits = _ASCE_TABLE_LENGTH |
540     + _ASCE_USER_BITS | _ASCE_TYPE_REGION3;
541     + mm->context.asce_limit = STACK_TOP_MAX;
542     + } else if (mm->context.asce_limit == (1UL << 31)) {
543     + mm_inc_nr_pmds(mm);
544     + }
545     crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm));
546     return 0;
547     }
548     @@ -111,8 +119,6 @@ static inline void activate_mm(struct mm_struct *prev,
549     static inline void arch_dup_mmap(struct mm_struct *oldmm,
550     struct mm_struct *mm)
551     {
552     - if (oldmm->context.asce_limit < mm->context.asce_limit)
553     - crst_table_downgrade(mm, oldmm->context.asce_limit);
554     }
555    
556     static inline void arch_exit_mmap(struct mm_struct *mm)
557     diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h
558     index 7b7858f158b4..d7cc79fb6191 100644
559     --- a/arch/s390/include/asm/pgalloc.h
560     +++ b/arch/s390/include/asm/pgalloc.h
561     @@ -100,12 +100,26 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
562    
563     static inline pgd_t *pgd_alloc(struct mm_struct *mm)
564     {
565     - spin_lock_init(&mm->context.list_lock);
566     - INIT_LIST_HEAD(&mm->context.pgtable_list);
567     - INIT_LIST_HEAD(&mm->context.gmap_list);
568     - return (pgd_t *) crst_table_alloc(mm);
569     + unsigned long *table = crst_table_alloc(mm);
570     +
571     + if (!table)
572     + return NULL;
573     + if (mm->context.asce_limit == (1UL << 31)) {
574     + /* Forking a compat process with 2 page table levels */
575     + if (!pgtable_pmd_page_ctor(virt_to_page(table))) {
576     + crst_table_free(mm, table);
577     + return NULL;
578     + }
579     + }
580     + return (pgd_t *) table;
581     +}
582     +
583     +static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
584     +{
585     + if (mm->context.asce_limit == (1UL << 31))
586     + pgtable_pmd_page_dtor(virt_to_page(pgd));
587     + crst_table_free(mm, (unsigned long *) pgd);
588     }
589     -#define pgd_free(mm, pgd) crst_table_free(mm, (unsigned long *) pgd)
590    
591     static inline void pmd_populate(struct mm_struct *mm,
592     pmd_t *pmd, pgtable_t pte)
593     diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
594     index a08d0afd5ff6..575dc123bda2 100644
595     --- a/arch/s390/kvm/kvm-s390.c
596     +++ b/arch/s390/kvm/kvm-s390.c
597     @@ -2249,7 +2249,7 @@ int kvm_s390_store_status_unloaded(struct kvm_vcpu *vcpu, unsigned long gpa)
598    
599     /* manually convert vector registers if necessary */
600     if (MACHINE_HAS_VX) {
601     - convert_vx_to_fp(fprs, current->thread.fpu.vxrs);
602     + convert_vx_to_fp(fprs, (__vector128 *) vcpu->run->s.regs.vrs);
603     rc = write_guest_abs(vcpu, gpa + __LC_FPREGS_SAVE_AREA,
604     fprs, 128);
605     } else {
606     diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
607     index e7c2c1428a69..8eb8a934b531 100644
608     --- a/arch/x86/kvm/mmu.c
609     +++ b/arch/x86/kvm/mmu.c
610     @@ -3754,13 +3754,15 @@ static void reset_rsvds_bits_mask_ept(struct kvm_vcpu *vcpu,
611     void
612     reset_shadow_zero_bits_mask(struct kvm_vcpu *vcpu, struct kvm_mmu *context)
613     {
614     + bool uses_nx = context->nx || context->base_role.smep_andnot_wp;
615     +
616     /*
617     * Passing "true" to the last argument is okay; it adds a check
618     * on bit 8 of the SPTEs which KVM doesn't use anyway.
619     */
620     __reset_rsvds_bits_mask(vcpu, &context->shadow_zero_check,
621     boot_cpu_data.x86_phys_bits,
622     - context->shadow_root_level, context->nx,
623     + context->shadow_root_level, uses_nx,
624     guest_cpuid_has_gbpages(vcpu), is_pse(vcpu),
625     true);
626     }
627     diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
628     index 5fd846cd6e0e..0958fa2b7cb7 100644
629     --- a/arch/x86/kvm/vmx.c
630     +++ b/arch/x86/kvm/vmx.c
631     @@ -1748,6 +1748,13 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr,
632     return;
633     }
634     break;
635     + case MSR_IA32_PEBS_ENABLE:
636     + /* PEBS needs a quiescent period after being disabled (to write
637     + * a record). Disabling PEBS through VMX MSR swapping doesn't
638     + * provide that period, so a CPU could write host's record into
639     + * guest's memory.
640     + */
641     + wrmsrl(MSR_IA32_PEBS_ENABLE, 0);
642     }
643    
644     for (i = 0; i < m->nr; ++i)
645     @@ -1785,26 +1792,31 @@ static void reload_tss(void)
646    
647     static bool update_transition_efer(struct vcpu_vmx *vmx, int efer_offset)
648     {
649     - u64 guest_efer;
650     - u64 ignore_bits;
651     + u64 guest_efer = vmx->vcpu.arch.efer;
652     + u64 ignore_bits = 0;
653    
654     - guest_efer = vmx->vcpu.arch.efer;
655     + if (!enable_ept) {
656     + /*
657     + * NX is needed to handle CR0.WP=1, CR4.SMEP=1. Testing
658     + * host CPUID is more efficient than testing guest CPUID
659     + * or CR4. Host SMEP is anyway a requirement for guest SMEP.
660     + */
661     + if (boot_cpu_has(X86_FEATURE_SMEP))
662     + guest_efer |= EFER_NX;
663     + else if (!(guest_efer & EFER_NX))
664     + ignore_bits |= EFER_NX;
665     + }
666    
667     /*
668     - * NX is emulated; LMA and LME handled by hardware; SCE meaningless
669     - * outside long mode
670     + * LMA and LME handled by hardware; SCE meaningless outside long mode.
671     */
672     - ignore_bits = EFER_NX | EFER_SCE;
673     + ignore_bits |= EFER_SCE;
674     #ifdef CONFIG_X86_64
675     ignore_bits |= EFER_LMA | EFER_LME;
676     /* SCE is meaningful only in long mode on Intel */
677     if (guest_efer & EFER_LMA)
678     ignore_bits &= ~(u64)EFER_SCE;
679     #endif
680     - guest_efer &= ~ignore_bits;
681     - guest_efer |= host_efer & ignore_bits;
682     - vmx->guest_msrs[efer_offset].data = guest_efer;
683     - vmx->guest_msrs[efer_offset].mask = ~ignore_bits;
684    
685     clear_atomic_switch_msr(vmx, MSR_EFER);
686    
687     @@ -1815,16 +1827,21 @@ static bool update_transition_efer(struct vcpu_vmx *vmx, int efer_offset)
688     */
689     if (cpu_has_load_ia32_efer ||
690     (enable_ept && ((vmx->vcpu.arch.efer ^ host_efer) & EFER_NX))) {
691     - guest_efer = vmx->vcpu.arch.efer;
692     if (!(guest_efer & EFER_LMA))
693     guest_efer &= ~EFER_LME;
694     if (guest_efer != host_efer)
695     add_atomic_switch_msr(vmx, MSR_EFER,
696     guest_efer, host_efer);
697     return false;
698     - }
699     + } else {
700     + guest_efer &= ~ignore_bits;
701     + guest_efer |= host_efer & ignore_bits;
702    
703     - return true;
704     + vmx->guest_msrs[efer_offset].data = guest_efer;
705     + vmx->guest_msrs[efer_offset].mask = ~ignore_bits;
706     +
707     + return true;
708     + }
709     }
710    
711     static unsigned long segment_base(u16 selector)
712     diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
713     index db20ee9a413a..b599a780a5a9 100644
714     --- a/arch/x86/mm/pageattr.c
715     +++ b/arch/x86/mm/pageattr.c
716     @@ -414,24 +414,30 @@ pmd_t *lookup_pmd_address(unsigned long address)
717     phys_addr_t slow_virt_to_phys(void *__virt_addr)
718     {
719     unsigned long virt_addr = (unsigned long)__virt_addr;
720     - unsigned long phys_addr, offset;
721     + phys_addr_t phys_addr;
722     + unsigned long offset;
723     enum pg_level level;
724     pte_t *pte;
725    
726     pte = lookup_address(virt_addr, &level);
727     BUG_ON(!pte);
728    
729     + /*
730     + * pXX_pfn() returns unsigned long, which must be cast to phys_addr_t
731     + * before being left-shifted PAGE_SHIFT bits -- this trick is to
732     + * make 32-PAE kernel work correctly.
733     + */
734     switch (level) {
735     case PG_LEVEL_1G:
736     - phys_addr = pud_pfn(*(pud_t *)pte) << PAGE_SHIFT;
737     + phys_addr = (phys_addr_t)pud_pfn(*(pud_t *)pte) << PAGE_SHIFT;
738     offset = virt_addr & ~PUD_PAGE_MASK;
739     break;
740     case PG_LEVEL_2M:
741     - phys_addr = pmd_pfn(*(pmd_t *)pte) << PAGE_SHIFT;
742     + phys_addr = (phys_addr_t)pmd_pfn(*(pmd_t *)pte) << PAGE_SHIFT;
743     offset = virt_addr & ~PMD_PAGE_MASK;
744     break;
745     default:
746     - phys_addr = pte_pfn(*pte) << PAGE_SHIFT;
747     + phys_addr = (phys_addr_t)pte_pfn(*pte) << PAGE_SHIFT;
748     offset = virt_addr & ~PAGE_MASK;
749     }
750    
751     diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
752     index fa00f3a186da..02f9aa4ebe05 100644
753     --- a/drivers/dma/at_xdmac.c
754     +++ b/drivers/dma/at_xdmac.c
755     @@ -176,6 +176,7 @@
756     #define AT_XDMAC_MAX_CHAN 0x20
757     #define AT_XDMAC_MAX_CSIZE 16 /* 16 data */
758     #define AT_XDMAC_MAX_DWIDTH 8 /* 64 bits */
759     +#define AT_XDMAC_RESIDUE_MAX_RETRIES 5
760    
761     #define AT_XDMAC_DMA_BUSWIDTHS\
762     (BIT(DMA_SLAVE_BUSWIDTH_UNDEFINED) |\
763     @@ -1383,8 +1384,8 @@ at_xdmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
764     struct at_xdmac_desc *desc, *_desc;
765     struct list_head *descs_list;
766     enum dma_status ret;
767     - int residue;
768     - u32 cur_nda, mask, value;
769     + int residue, retry;
770     + u32 cur_nda, check_nda, cur_ubc, mask, value;
771     u8 dwidth = 0;
772     unsigned long flags;
773    
774     @@ -1421,7 +1422,42 @@ at_xdmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
775     cpu_relax();
776     }
777    
778     + /*
779     + * When processing the residue, we need to read two registers but we
780     + * can't do it in an atomic way. AT_XDMAC_CNDA is used to find where
781     + * we stand in the descriptor list and AT_XDMAC_CUBC is used
782     + * to know how many data are remaining for the current descriptor.
783     + * Since the dma channel is not paused to not loose data, between the
784     + * AT_XDMAC_CNDA and AT_XDMAC_CUBC read, we may have change of
785     + * descriptor.
786     + * For that reason, after reading AT_XDMAC_CUBC, we check if we are
787     + * still using the same descriptor by reading a second time
788     + * AT_XDMAC_CNDA. If AT_XDMAC_CNDA has changed, it means we have to
789     + * read again AT_XDMAC_CUBC.
790     + * Memory barriers are used to ensure the read order of the registers.
791     + * A max number of retries is set because unlikely it can never ends if
792     + * we are transferring a lot of data with small buffers.
793     + */
794     cur_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc;
795     + rmb();
796     + cur_ubc = at_xdmac_chan_read(atchan, AT_XDMAC_CUBC);
797     + for (retry = 0; retry < AT_XDMAC_RESIDUE_MAX_RETRIES; retry++) {
798     + rmb();
799     + check_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc;
800     +
801     + if (likely(cur_nda == check_nda))
802     + break;
803     +
804     + cur_nda = check_nda;
805     + rmb();
806     + cur_ubc = at_xdmac_chan_read(atchan, AT_XDMAC_CUBC);
807     + }
808     +
809     + if (unlikely(retry >= AT_XDMAC_RESIDUE_MAX_RETRIES)) {
810     + ret = DMA_ERROR;
811     + goto spin_unlock;
812     + }
813     +
814     /*
815     * Remove size of all microblocks already transferred and the current
816     * one. Then add the remaining size to transfer of the current
817     @@ -1434,7 +1470,7 @@ at_xdmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
818     if ((desc->lld.mbr_nda & 0xfffffffc) == cur_nda)
819     break;
820     }
821     - residue += at_xdmac_chan_read(atchan, AT_XDMAC_CUBC) << dwidth;
822     + residue += cur_ubc << dwidth;
823    
824     dma_set_residue(txstate, residue);
825    
826     diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
827     index 0c713a908304..82903ca78529 100644
828     --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
829     +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
830     @@ -96,7 +96,7 @@ static void amdgpu_flip_work_func(struct work_struct *__work)
831     * In practice this won't execute very often unless on very fast
832     * machines because the time window for this to happen is very small.
833     */
834     - while (amdgpuCrtc->enabled && repcnt--) {
835     + while (amdgpuCrtc->enabled && --repcnt) {
836     /* GET_DISTANCE_TO_VBLANKSTART returns distance to real vblank
837     * start in hpos, and to the "fudged earlier" vblank start in
838     * vpos.
839     @@ -112,13 +112,13 @@ static void amdgpu_flip_work_func(struct work_struct *__work)
840     break;
841    
842     /* Sleep at least until estimated real start of hw vblank */
843     - spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
844     min_udelay = (-hpos + 1) * max(vblank->linedur_ns / 1000, 5);
845     if (min_udelay > vblank->framedur_ns / 2000) {
846     /* Don't wait ridiculously long - something is wrong */
847     repcnt = 0;
848     break;
849     }
850     + spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
851     usleep_range(min_udelay, 2 * min_udelay);
852     spin_lock_irqsave(&crtc->dev->event_lock, flags);
853     };
854     diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
855     index d690df545b4d..c566993a2ec3 100644
856     --- a/drivers/gpu/drm/radeon/radeon_device.c
857     +++ b/drivers/gpu/drm/radeon/radeon_device.c
858     @@ -1744,7 +1744,6 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
859     }
860    
861     drm_kms_helper_poll_enable(dev);
862     - drm_helper_hpd_irq_event(dev);
863    
864     /* set the power state here in case we are a PX system or headless */
865     if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled)
866     diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
867     index 13767d21835f..3645b223aa37 100644
868     --- a/drivers/gpu/drm/radeon/radeon_display.c
869     +++ b/drivers/gpu/drm/radeon/radeon_display.c
870     @@ -455,7 +455,7 @@ static void radeon_flip_work_func(struct work_struct *__work)
871     * In practice this won't execute very often unless on very fast
872     * machines because the time window for this to happen is very small.
873     */
874     - while (radeon_crtc->enabled && repcnt--) {
875     + while (radeon_crtc->enabled && --repcnt) {
876     /* GET_DISTANCE_TO_VBLANKSTART returns distance to real vblank
877     * start in hpos, and to the "fudged earlier" vblank start in
878     * vpos.
879     @@ -471,13 +471,13 @@ static void radeon_flip_work_func(struct work_struct *__work)
880     break;
881    
882     /* Sleep at least until estimated real start of hw vblank */
883     - spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
884     min_udelay = (-hpos + 1) * max(vblank->linedur_ns / 1000, 5);
885     if (min_udelay > vblank->framedur_ns / 2000) {
886     /* Don't wait ridiculously long - something is wrong */
887     repcnt = 0;
888     break;
889     }
890     + spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
891     usleep_range(min_udelay, 2 * min_udelay);
892     spin_lock_irqsave(&crtc->dev->event_lock, flags);
893     };
894     diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
895     index 1fa81215cea1..60ab31517153 100644
896     --- a/drivers/gpu/drm/radeon/radeon_pm.c
897     +++ b/drivers/gpu/drm/radeon/radeon_pm.c
898     @@ -1075,6 +1075,8 @@ force:
899    
900     /* update display watermarks based on new power state */
901     radeon_bandwidth_update(rdev);
902     + /* update displays */
903     + radeon_dpm_display_configuration_changed(rdev);
904    
905     /* wait for the rings to drain */
906     for (i = 0; i < RADEON_NUM_RINGS; i++) {
907     @@ -1091,9 +1093,6 @@ force:
908    
909     radeon_dpm_post_set_power_state(rdev);
910    
911     - /* update displays */
912     - radeon_dpm_display_configuration_changed(rdev);
913     -
914     rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs;
915     rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count;
916     rdev->pm.dpm.single_display = single_display;
917     diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
918     index f2e13eb8339f..a0e28f3a278d 100644
919     --- a/drivers/gpu/ipu-v3/ipu-common.c
920     +++ b/drivers/gpu/ipu-v3/ipu-common.c
921     @@ -1050,6 +1050,17 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
922     for (i = 0; i < ARRAY_SIZE(client_reg); i++) {
923     const struct ipu_platform_reg *reg = &client_reg[i];
924     struct platform_device *pdev;
925     + struct device_node *of_node;
926     +
927     + /* Associate subdevice with the corresponding port node */
928     + of_node = of_graph_get_port_by_id(dev->of_node, i);
929     + if (!of_node) {
930     + dev_info(dev,
931     + "no port@%d node in %s, not using %s%d\n",
932     + i, dev->of_node->full_name,
933     + (i / 2) ? "DI" : "CSI", i % 2);
934     + continue;
935     + }
936    
937     pdev = platform_device_alloc(reg->name, id++);
938     if (!pdev) {
939     @@ -1057,17 +1068,9 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
940     goto err_register;
941     }
942    
943     + pdev->dev.of_node = of_node;
944     pdev->dev.parent = dev;
945    
946     - /* Associate subdevice with the corresponding port node */
947     - pdev->dev.of_node = of_graph_get_port_by_id(dev->of_node, i);
948     - if (!pdev->dev.of_node) {
949     - dev_err(dev, "missing port@%d node in %s\n", i,
950     - dev->of_node->full_name);
951     - ret = -ENODEV;
952     - goto err_register;
953     - }
954     -
955     ret = platform_device_add_data(pdev, &reg->pdata,
956     sizeof(reg->pdata));
957     if (!ret)
958     diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
959     index 5eee62badf45..cbc99d5649af 100644
960     --- a/drivers/net/can/usb/gs_usb.c
961     +++ b/drivers/net/can/usb/gs_usb.c
962     @@ -826,9 +826,8 @@ static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface
963     static void gs_destroy_candev(struct gs_can *dev)
964     {
965     unregister_candev(dev->netdev);
966     - free_candev(dev->netdev);
967     usb_kill_anchored_urbs(&dev->tx_submitted);
968     - kfree(dev);
969     + free_candev(dev->netdev);
970     }
971    
972     static int gs_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
973     @@ -913,12 +912,15 @@ static int gs_usb_probe(struct usb_interface *intf, const struct usb_device_id *
974     for (i = 0; i < icount; i++) {
975     dev->canch[i] = gs_make_candev(i, intf);
976     if (IS_ERR_OR_NULL(dev->canch[i])) {
977     + /* save error code to return later */
978     + rc = PTR_ERR(dev->canch[i]);
979     +
980     /* on failure destroy previously created candevs */
981     icount = i;
982     - for (i = 0; i < icount; i++) {
983     + for (i = 0; i < icount; i++)
984     gs_destroy_candev(dev->canch[i]);
985     - dev->canch[i] = NULL;
986     - }
987     +
988     + usb_kill_anchored_urbs(&dev->rx_submitted);
989     kfree(dev);
990     return rc;
991     }
992     @@ -939,16 +941,12 @@ static void gs_usb_disconnect(struct usb_interface *intf)
993     return;
994     }
995    
996     - for (i = 0; i < GS_MAX_INTF; i++) {
997     - struct gs_can *can = dev->canch[i];
998     -
999     - if (!can)
1000     - continue;
1001     -
1002     - gs_destroy_candev(can);
1003     - }
1004     + for (i = 0; i < GS_MAX_INTF; i++)
1005     + if (dev->canch[i])
1006     + gs_destroy_candev(dev->canch[i]);
1007    
1008     usb_kill_anchored_urbs(&dev->rx_submitted);
1009     + kfree(dev);
1010     }
1011    
1012     static const struct usb_device_id gs_usb_table[] = {
1013     diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c
1014     index c652a66be803..6743edf43aa8 100644
1015     --- a/drivers/net/wireless/iwlwifi/mvm/tx.c
1016     +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
1017     @@ -421,6 +421,15 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb)
1018     return -1;
1019     }
1020    
1021     + /*
1022     + * Increase the pending frames counter, so that later when a reply comes
1023     + * in and the counter is decreased - we don't start getting negative
1024     + * values.
1025     + * Note that we don't need to make sure it isn't agg'd, since we're
1026     + * TXing non-sta
1027     + */
1028     + atomic_inc(&mvm->pending_frames[sta_id]);
1029     +
1030     return 0;
1031     }
1032    
1033     diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
1034     index 314db8c1047a..42d8617352ae 100644
1035     --- a/drivers/pci/pci.c
1036     +++ b/drivers/pci/pci.c
1037     @@ -4772,8 +4772,10 @@ int pci_get_new_domain_nr(void)
1038     void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
1039     {
1040     static int use_dt_domains = -1;
1041     - int domain = of_get_pci_domain_nr(parent->of_node);
1042     + int domain = -1;
1043    
1044     + if (parent)
1045     + domain = of_get_pci_domain_nr(parent->of_node);
1046     /*
1047     * Check DT domain and use_dt_domains values.
1048     *
1049     diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c
1050     index cb61f300f8b5..277b5c8c825c 100644
1051     --- a/drivers/s390/block/dasd_diag.c
1052     +++ b/drivers/s390/block/dasd_diag.c
1053     @@ -67,7 +67,7 @@ static const u8 DASD_DIAG_CMS1[] = { 0xc3, 0xd4, 0xe2, 0xf1 };/* EBCDIC CMS1 */
1054     * and function code cmd.
1055     * In case of an exception return 3. Otherwise return result of bitwise OR of
1056     * resulting condition code and DIAG return code. */
1057     -static inline int dia250(void *iob, int cmd)
1058     +static inline int __dia250(void *iob, int cmd)
1059     {
1060     register unsigned long reg2 asm ("2") = (unsigned long) iob;
1061     typedef union {
1062     @@ -77,7 +77,6 @@ static inline int dia250(void *iob, int cmd)
1063     int rc;
1064    
1065     rc = 3;
1066     - diag_stat_inc(DIAG_STAT_X250);
1067     asm volatile(
1068     " diag 2,%2,0x250\n"
1069     "0: ipm %0\n"
1070     @@ -91,6 +90,12 @@ static inline int dia250(void *iob, int cmd)
1071     return rc;
1072     }
1073    
1074     +static inline int dia250(void *iob, int cmd)
1075     +{
1076     + diag_stat_inc(DIAG_STAT_X250);
1077     + return __dia250(iob, cmd);
1078     +}
1079     +
1080     /* Initialize block I/O to DIAG device using the specified blocksize and
1081     * block offset. On success, return zero and set end_block to contain the
1082     * number of blocks on the device minus the specified offset. Return non-zero
1083     diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
1084     index 88029cc6de5e..46b1991fbb50 100644
1085     --- a/drivers/target/target_core_tmr.c
1086     +++ b/drivers/target/target_core_tmr.c
1087     @@ -177,7 +177,6 @@ void core_tmr_abort_task(
1088    
1089     if (!__target_check_io_state(se_cmd, se_sess, 0)) {
1090     spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
1091     - target_put_sess_cmd(se_cmd);
1092     goto out;
1093     }
1094     list_del_init(&se_cmd->se_cmd_list);
1095     diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
1096     index d211b8e18566..30c4c9ebb693 100644
1097     --- a/fs/jffs2/dir.c
1098     +++ b/fs/jffs2/dir.c
1099     @@ -843,9 +843,14 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
1100    
1101     pr_notice("%s(): Link succeeded, unlink failed (err %d). You now have a hard link\n",
1102     __func__, ret);
1103     - /* Might as well let the VFS know */
1104     - d_instantiate(new_dentry, d_inode(old_dentry));
1105     - ihold(d_inode(old_dentry));
1106     + /*
1107     + * We can't keep the target in dcache after that.
1108     + * For one thing, we can't afford dentry aliases for directories.
1109     + * For another, if there was a victim, we _can't_ set new inode
1110     + * for that sucker and we have to trigger mount eviction - the
1111     + * caller won't do it on its own since we are returning an error.
1112     + */
1113     + d_invalidate(new_dentry);
1114     new_dir_i->i_mtime = new_dir_i->i_ctime = ITIME(now);
1115     return ret;
1116     }
1117     diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
1118     index f0e3e9e747dd..03446c5a3ec1 100644
1119     --- a/fs/ncpfs/dir.c
1120     +++ b/fs/ncpfs/dir.c
1121     @@ -633,7 +633,7 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx,
1122     d_rehash(newdent);
1123     } else {
1124     spin_lock(&dentry->d_lock);
1125     - NCP_FINFO(inode)->flags &= ~NCPI_DIR_CACHE;
1126     + NCP_FINFO(dir)->flags &= ~NCPI_DIR_CACHE;
1127     spin_unlock(&dentry->d_lock);
1128     }
1129     } else {
1130     diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
1131     index 692ceda3bc21..a2b1d7ce3e1a 100644
1132     --- a/fs/overlayfs/dir.c
1133     +++ b/fs/overlayfs/dir.c
1134     @@ -618,7 +618,8 @@ static int ovl_remove_upper(struct dentry *dentry, bool is_dir)
1135     * sole user of this dentry. Too tricky... Just unhash for
1136     * now.
1137     */
1138     - d_drop(dentry);
1139     + if (!err)
1140     + d_drop(dentry);
1141     mutex_unlock(&dir->i_mutex);
1142    
1143     return err;
1144     @@ -903,6 +904,13 @@ static int ovl_rename2(struct inode *olddir, struct dentry *old,
1145     if (!overwrite && new_is_dir && !old_opaque && new_opaque)
1146     ovl_remove_opaque(newdentry);
1147    
1148     + /*
1149     + * Old dentry now lives in different location. Dentries in
1150     + * lowerstack are stale. We cannot drop them here because
1151     + * access to them is lockless. This could be only pure upper
1152     + * or opaque directory - numlower is zero. Or upper non-dir
1153     + * entry - its pureness is tracked by flag opaque.
1154     + */
1155     if (old_opaque != new_opaque) {
1156     ovl_dentry_set_opaque(old, new_opaque);
1157     if (!overwrite)
1158     diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
1159     index b29036aa8d7c..05ac9a95e881 100644
1160     --- a/fs/overlayfs/inode.c
1161     +++ b/fs/overlayfs/inode.c
1162     @@ -65,6 +65,8 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr)
1163    
1164     mutex_lock(&upperdentry->d_inode->i_mutex);
1165     err = notify_change(upperdentry, attr, NULL);
1166     + if (!err)
1167     + ovl_copyattr(upperdentry->d_inode, dentry->d_inode);
1168     mutex_unlock(&upperdentry->d_inode->i_mutex);
1169     }
1170     ovl_drop_write(dentry);
1171     diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
1172     index f42c9407fbad..000b2ed05c29 100644
1173     --- a/fs/overlayfs/super.c
1174     +++ b/fs/overlayfs/super.c
1175     @@ -76,12 +76,14 @@ enum ovl_path_type ovl_path_type(struct dentry *dentry)
1176     if (oe->__upperdentry) {
1177     type = __OVL_PATH_UPPER;
1178    
1179     - if (oe->numlower) {
1180     - if (S_ISDIR(dentry->d_inode->i_mode))
1181     - type |= __OVL_PATH_MERGE;
1182     - } else if (!oe->opaque) {
1183     + /*
1184     + * Non-dir dentry can hold lower dentry from previous
1185     + * location. Its purity depends only on opaque flag.
1186     + */
1187     + if (oe->numlower && S_ISDIR(dentry->d_inode->i_mode))
1188     + type |= __OVL_PATH_MERGE;
1189     + else if (!oe->opaque)
1190     type |= __OVL_PATH_PURE;
1191     - }
1192     } else {
1193     if (oe->numlower > 1)
1194     type |= __OVL_PATH_MERGE;
1195     @@ -322,6 +324,7 @@ static const struct dentry_operations ovl_dentry_operations = {
1196    
1197     static const struct dentry_operations ovl_reval_dentry_operations = {
1198     .d_release = ovl_dentry_release,
1199     + .d_select_inode = ovl_d_select_inode,
1200     .d_revalidate = ovl_dentry_revalidate,
1201     .d_weak_revalidate = ovl_dentry_weak_revalidate,
1202     };
1203     diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
1204     index 50311703135b..66cdb44616d5 100644
1205     --- a/fs/userfaultfd.c
1206     +++ b/fs/userfaultfd.c
1207     @@ -287,6 +287,12 @@ int handle_userfault(struct vm_area_struct *vma, unsigned long address,
1208     goto out;
1209    
1210     /*
1211     + * We don't do userfault handling for the final child pid update.
1212     + */
1213     + if (current->flags & PF_EXITING)
1214     + goto out;
1215     +
1216     + /*
1217     * Check that we can return VM_FAULT_RETRY.
1218     *
1219     * NOTE: it should become possible to return VM_FAULT_RETRY
1220     diff --git a/include/linux/bio.h b/include/linux/bio.h
1221     index 79cfaeef1b0d..fbe47bc700bd 100644
1222     --- a/include/linux/bio.h
1223     +++ b/include/linux/bio.h
1224     @@ -320,11 +320,6 @@ static inline void bio_get_last_bvec(struct bio *bio, struct bio_vec *bv)
1225     struct bvec_iter iter = bio->bi_iter;
1226     int idx;
1227    
1228     - if (!bio_flagged(bio, BIO_CLONED)) {
1229     - *bv = bio->bi_io_vec[bio->bi_vcnt - 1];
1230     - return;
1231     - }
1232     -
1233     if (unlikely(!bio_multiple_segments(bio))) {
1234     *bv = bio_iovec(bio);
1235     return;
1236     diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
1237     index 03c7efb60c91..27e32b2b602f 100644
1238     --- a/include/linux/tracepoint.h
1239     +++ b/include/linux/tracepoint.h
1240     @@ -148,9 +148,6 @@ extern void syscall_unregfunc(void);
1241     void *it_func; \
1242     void *__data; \
1243     \
1244     - if (!cpu_online(raw_smp_processor_id())) \
1245     - return; \
1246     - \
1247     if (!(cond)) \
1248     return; \
1249     prercu; \
1250     @@ -357,15 +354,19 @@ extern void syscall_unregfunc(void);
1251     * "void *__data, proto" as the callback prototype.
1252     */
1253     #define DECLARE_TRACE_NOARGS(name) \
1254     - __DECLARE_TRACE(name, void, , 1, void *__data, __data)
1255     + __DECLARE_TRACE(name, void, , \
1256     + cpu_online(raw_smp_processor_id()), \
1257     + void *__data, __data)
1258    
1259     #define DECLARE_TRACE(name, proto, args) \
1260     - __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), 1, \
1261     - PARAMS(void *__data, proto), \
1262     - PARAMS(__data, args))
1263     + __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
1264     + cpu_online(raw_smp_processor_id()), \
1265     + PARAMS(void *__data, proto), \
1266     + PARAMS(__data, args))
1267    
1268     #define DECLARE_TRACE_CONDITION(name, proto, args, cond) \
1269     - __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), PARAMS(cond), \
1270     + __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
1271     + cpu_online(raw_smp_processor_id()) && (PARAMS(cond)), \
1272     PARAMS(void *__data, proto), \
1273     PARAMS(__data, args))
1274    
1275     diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
1276     index 8f81bbbc38fc..e0f4109e64c6 100644
1277     --- a/include/net/iw_handler.h
1278     +++ b/include/net/iw_handler.h
1279     @@ -439,6 +439,12 @@ int dev_get_wireless_info(char *buffer, char **start, off_t offset, int length);
1280     /* Send a single event to user space */
1281     void wireless_send_event(struct net_device *dev, unsigned int cmd,
1282     union iwreq_data *wrqu, const char *extra);
1283     +#ifdef CONFIG_WEXT_CORE
1284     +/* flush all previous wext events - if work is done from netdev notifiers */
1285     +void wireless_nlevent_flush(void);
1286     +#else
1287     +static inline void wireless_nlevent_flush(void) {}
1288     +#endif
1289    
1290     /* We may need a function to send a stream of events to user space.
1291     * More on that later... */
1292     diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
1293     index 10ad4ac1fa0b..367784be5df2 100644
1294     --- a/net/mac80211/agg-rx.c
1295     +++ b/net/mac80211/agg-rx.c
1296     @@ -291,7 +291,7 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta,
1297     }
1298    
1299     /* prepare A-MPDU MLME for Rx aggregation */
1300     - tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
1301     + tid_agg_rx = kzalloc(sizeof(*tid_agg_rx), GFP_KERNEL);
1302     if (!tid_agg_rx)
1303     goto end;
1304    
1305     diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
1306     index 5322b4c71630..6837a46ca4a2 100644
1307     --- a/net/mac80211/ieee80211_i.h
1308     +++ b/net/mac80211/ieee80211_i.h
1309     @@ -92,7 +92,7 @@ struct ieee80211_fragment_entry {
1310     u16 extra_len;
1311     u16 last_frag;
1312     u8 rx_queue;
1313     - bool ccmp; /* Whether fragments were encrypted with CCMP */
1314     + bool check_sequential_pn; /* needed for CCMP/GCMP */
1315     u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
1316     };
1317    
1318     diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
1319     index 3ece7d1034c8..b54f398cda5d 100644
1320     --- a/net/mac80211/rc80211_minstrel.c
1321     +++ b/net/mac80211/rc80211_minstrel.c
1322     @@ -711,7 +711,7 @@ static u32 minstrel_get_expected_throughput(void *priv_sta)
1323     * computing cur_tp
1324     */
1325     tmp_mrs = &mi->r[idx].stats;
1326     - tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma);
1327     + tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10;
1328     tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024;
1329    
1330     return tmp_cur_tp;
1331     diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
1332     index 3928dbd24e25..239ed6e92b89 100644
1333     --- a/net/mac80211/rc80211_minstrel_ht.c
1334     +++ b/net/mac80211/rc80211_minstrel_ht.c
1335     @@ -691,7 +691,7 @@ minstrel_aggr_check(struct ieee80211_sta *pubsta, struct sk_buff *skb)
1336     if (likely(sta->ampdu_mlme.tid_tx[tid]))
1337     return;
1338    
1339     - ieee80211_start_tx_ba_session(pubsta, tid, 5000);
1340     + ieee80211_start_tx_ba_session(pubsta, tid, 0);
1341     }
1342    
1343     static void
1344     @@ -871,7 +871,7 @@ minstrel_ht_set_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
1345     * - if station is in dynamic SMPS (and streams > 1)
1346     * - for fallback rates, to increase chances of getting through
1347     */
1348     - if (offset > 0 &&
1349     + if (offset > 0 ||
1350     (mi->sta->smps_mode == IEEE80211_SMPS_DYNAMIC &&
1351     group->streams > 1)) {
1352     ratetbl->rate[offset].count = ratetbl->rate[offset].count_rts;
1353     @@ -1334,7 +1334,8 @@ static u32 minstrel_ht_get_expected_throughput(void *priv_sta)
1354     prob = mi->groups[i].rates[j].prob_ewma;
1355    
1356     /* convert tp_avg from pkt per second in kbps */
1357     - tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024;
1358     + tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10;
1359     + tp_avg = tp_avg * AVG_PKT_SIZE * 8 / 1024;
1360    
1361     return tp_avg;
1362     }
1363     diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
1364     index 82af407fea7a..4cbf36cae806 100644
1365     --- a/net/mac80211/rx.c
1366     +++ b/net/mac80211/rx.c
1367     @@ -1754,7 +1754,7 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata,
1368     entry->seq = seq;
1369     entry->rx_queue = rx_queue;
1370     entry->last_frag = frag;
1371     - entry->ccmp = 0;
1372     + entry->check_sequential_pn = false;
1373     entry->extra_len = 0;
1374    
1375     return entry;
1376     @@ -1850,15 +1850,27 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
1377     rx->seqno_idx, &(rx->skb));
1378     if (rx->key &&
1379     (rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP ||
1380     - rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP_256) &&
1381     + rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP_256 ||
1382     + rx->key->conf.cipher == WLAN_CIPHER_SUITE_GCMP ||
1383     + rx->key->conf.cipher == WLAN_CIPHER_SUITE_GCMP_256) &&
1384     ieee80211_has_protected(fc)) {
1385     int queue = rx->security_idx;
1386     - /* Store CCMP PN so that we can verify that the next
1387     - * fragment has a sequential PN value. */
1388     - entry->ccmp = 1;
1389     +
1390     + /* Store CCMP/GCMP PN so that we can verify that the
1391     + * next fragment has a sequential PN value.
1392     + */
1393     + entry->check_sequential_pn = true;
1394     memcpy(entry->last_pn,
1395     rx->key->u.ccmp.rx_pn[queue],
1396     IEEE80211_CCMP_PN_LEN);
1397     + BUILD_BUG_ON(offsetof(struct ieee80211_key,
1398     + u.ccmp.rx_pn) !=
1399     + offsetof(struct ieee80211_key,
1400     + u.gcmp.rx_pn));
1401     + BUILD_BUG_ON(sizeof(rx->key->u.ccmp.rx_pn[queue]) !=
1402     + sizeof(rx->key->u.gcmp.rx_pn[queue]));
1403     + BUILD_BUG_ON(IEEE80211_CCMP_PN_LEN !=
1404     + IEEE80211_GCMP_PN_LEN);
1405     }
1406     return RX_QUEUED;
1407     }
1408     @@ -1873,15 +1885,21 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
1409     return RX_DROP_MONITOR;
1410     }
1411    
1412     - /* Verify that MPDUs within one MSDU have sequential PN values.
1413     - * (IEEE 802.11i, 8.3.3.4.5) */
1414     - if (entry->ccmp) {
1415     + /* "The receiver shall discard MSDUs and MMPDUs whose constituent
1416     + * MPDU PN values are not incrementing in steps of 1."
1417     + * see IEEE P802.11-REVmc/D5.0, 12.5.3.4.4, item d (for CCMP)
1418     + * and IEEE P802.11-REVmc/D5.0, 12.5.5.4.4, item d (for GCMP)
1419     + */
1420     + if (entry->check_sequential_pn) {
1421     int i;
1422     u8 pn[IEEE80211_CCMP_PN_LEN], *rpn;
1423     int queue;
1424     +
1425     if (!rx->key ||
1426     (rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP &&
1427     - rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP_256))
1428     + rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP_256 &&
1429     + rx->key->conf.cipher != WLAN_CIPHER_SUITE_GCMP &&
1430     + rx->key->conf.cipher != WLAN_CIPHER_SUITE_GCMP_256))
1431     return RX_DROP_UNUSABLE;
1432     memcpy(pn, entry->last_pn, IEEE80211_CCMP_PN_LEN);
1433     for (i = IEEE80211_CCMP_PN_LEN - 1; i >= 0; i--) {
1434     @@ -3367,6 +3385,7 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)
1435     return false;
1436     /* ignore action frames to TDLS-peers */
1437     if (ieee80211_is_action(hdr->frame_control) &&
1438     + !is_broadcast_ether_addr(bssid) &&
1439     !ether_addr_equal(bssid, hdr->addr1))
1440     return false;
1441     }
1442     diff --git a/net/wireless/core.c b/net/wireless/core.c
1443     index b0915515640e..8f0bac7e03c4 100644
1444     --- a/net/wireless/core.c
1445     +++ b/net/wireless/core.c
1446     @@ -1147,6 +1147,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
1447     return NOTIFY_DONE;
1448     }
1449    
1450     + wireless_nlevent_flush();
1451     +
1452     return NOTIFY_OK;
1453     }
1454    
1455     diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
1456     index c8717c1d082e..b50ee5d622e1 100644
1457     --- a/net/wireless/wext-core.c
1458     +++ b/net/wireless/wext-core.c
1459     @@ -342,6 +342,40 @@ static const int compat_event_type_size[] = {
1460    
1461     /* IW event code */
1462    
1463     +void wireless_nlevent_flush(void)
1464     +{
1465     + struct sk_buff *skb;
1466     + struct net *net;
1467     +
1468     + ASSERT_RTNL();
1469     +
1470     + for_each_net(net) {
1471     + while ((skb = skb_dequeue(&net->wext_nlevents)))
1472     + rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL,
1473     + GFP_KERNEL);
1474     + }
1475     +}
1476     +EXPORT_SYMBOL_GPL(wireless_nlevent_flush);
1477     +
1478     +static int wext_netdev_notifier_call(struct notifier_block *nb,
1479     + unsigned long state, void *ptr)
1480     +{
1481     + /*
1482     + * When a netdev changes state in any way, flush all pending messages
1483     + * to avoid them going out in a strange order, e.g. RTM_NEWLINK after
1484     + * RTM_DELLINK, or with IFF_UP after without IFF_UP during dev_close()
1485     + * or similar - all of which could otherwise happen due to delays from
1486     + * schedule_work().
1487     + */
1488     + wireless_nlevent_flush();
1489     +
1490     + return NOTIFY_OK;
1491     +}
1492     +
1493     +static struct notifier_block wext_netdev_notifier = {
1494     + .notifier_call = wext_netdev_notifier_call,
1495     +};
1496     +
1497     static int __net_init wext_pernet_init(struct net *net)
1498     {
1499     skb_queue_head_init(&net->wext_nlevents);
1500     @@ -360,7 +394,12 @@ static struct pernet_operations wext_pernet_ops = {
1501    
1502     static int __init wireless_nlevent_init(void)
1503     {
1504     - return register_pernet_subsys(&wext_pernet_ops);
1505     + int err = register_pernet_subsys(&wext_pernet_ops);
1506     +
1507     + if (err)
1508     + return err;
1509     +
1510     + return register_netdevice_notifier(&wext_netdev_notifier);
1511     }
1512    
1513     subsys_initcall(wireless_nlevent_init);
1514     @@ -368,17 +407,8 @@ subsys_initcall(wireless_nlevent_init);
1515     /* Process events generated by the wireless layer or the driver. */
1516     static void wireless_nlevent_process(struct work_struct *work)
1517     {
1518     - struct sk_buff *skb;
1519     - struct net *net;
1520     -
1521     rtnl_lock();
1522     -
1523     - for_each_net(net) {
1524     - while ((skb = skb_dequeue(&net->wext_nlevents)))
1525     - rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL,
1526     - GFP_KERNEL);
1527     - }
1528     -
1529     + wireless_nlevent_flush();
1530     rtnl_unlock();
1531     }
1532    
1533     diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh
1534     index 198580d245e0..1659b409ef10 100755
1535     --- a/scripts/ld-version.sh
1536     +++ b/scripts/ld-version.sh
1537     @@ -1,7 +1,7 @@
1538     #!/usr/bin/awk -f
1539     # extract linker version number from stdin and turn into single number
1540     {
1541     - gsub(".*)", "");
1542     + gsub(".*\\)", "");
1543     split($1,a, ".");
1544     print a[1]*10000000 + a[2]*100000 + a[3]*10000 + a[4]*100 + a[5];
1545     exit
1546     diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c
1547     index c799cca5abeb..6b864c0fc2b6 100644
1548     --- a/sound/soc/codecs/wm8958-dsp2.c
1549     +++ b/sound/soc/codecs/wm8958-dsp2.c
1550     @@ -459,7 +459,7 @@ static int wm8958_put_mbc_enum(struct snd_kcontrol *kcontrol,
1551     struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
1552     struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1553     struct wm8994 *control = wm8994->wm8994;
1554     - int value = ucontrol->value.integer.value[0];
1555     + int value = ucontrol->value.enumerated.item[0];
1556     int reg;
1557    
1558     /* Don't allow on the fly reconfiguration */
1559     @@ -549,7 +549,7 @@ static int wm8958_put_vss_enum(struct snd_kcontrol *kcontrol,
1560     struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
1561     struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1562     struct wm8994 *control = wm8994->wm8994;
1563     - int value = ucontrol->value.integer.value[0];
1564     + int value = ucontrol->value.enumerated.item[0];
1565     int reg;
1566    
1567     /* Don't allow on the fly reconfiguration */
1568     @@ -582,7 +582,7 @@ static int wm8958_put_vss_hpf_enum(struct snd_kcontrol *kcontrol,
1569     struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
1570     struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1571     struct wm8994 *control = wm8994->wm8994;
1572     - int value = ucontrol->value.integer.value[0];
1573     + int value = ucontrol->value.enumerated.item[0];
1574     int reg;
1575    
1576     /* Don't allow on the fly reconfiguration */
1577     @@ -749,7 +749,7 @@ static int wm8958_put_enh_eq_enum(struct snd_kcontrol *kcontrol,
1578     struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
1579     struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1580     struct wm8994 *control = wm8994->wm8994;
1581     - int value = ucontrol->value.integer.value[0];
1582     + int value = ucontrol->value.enumerated.item[0];
1583     int reg;
1584    
1585     /* Don't allow on the fly reconfiguration */
1586     diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
1587     index 2ccbb322df77..a18aecb49935 100644
1588     --- a/sound/soc/codecs/wm8994.c
1589     +++ b/sound/soc/codecs/wm8994.c
1590     @@ -362,7 +362,7 @@ static int wm8994_put_drc_enum(struct snd_kcontrol *kcontrol,
1591     struct wm8994 *control = wm8994->wm8994;
1592     struct wm8994_pdata *pdata = &control->pdata;
1593     int drc = wm8994_get_drc(kcontrol->id.name);
1594     - int value = ucontrol->value.integer.value[0];
1595     + int value = ucontrol->value.enumerated.item[0];
1596    
1597     if (drc < 0)
1598     return drc;
1599     @@ -469,7 +469,7 @@ static int wm8994_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
1600     struct wm8994 *control = wm8994->wm8994;
1601     struct wm8994_pdata *pdata = &control->pdata;
1602     int block = wm8994_get_retune_mobile_block(kcontrol->id.name);
1603     - int value = ucontrol->value.integer.value[0];
1604     + int value = ucontrol->value.enumerated.item[0];
1605    
1606     if (block < 0)
1607     return block;
1608     diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
1609     index ea4ab374a223..7dbf899b2af2 100644
1610     --- a/sound/soc/samsung/i2s.c
1611     +++ b/sound/soc/samsung/i2s.c
1612     @@ -480,10 +480,11 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
1613     unsigned int cdcon_mask = 1 << i2s_regs->cdclkcon_off;
1614     unsigned int rsrc_mask = 1 << i2s_regs->rclksrc_off;
1615     u32 mod, mask, val = 0;
1616     + unsigned long flags;
1617    
1618     - spin_lock(i2s->lock);
1619     + spin_lock_irqsave(i2s->lock, flags);
1620     mod = readl(i2s->addr + I2SMOD);
1621     - spin_unlock(i2s->lock);
1622     + spin_unlock_irqrestore(i2s->lock, flags);
1623    
1624     switch (clk_id) {
1625     case SAMSUNG_I2S_OPCLK:
1626     @@ -574,11 +575,11 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
1627     return -EINVAL;
1628     }
1629    
1630     - spin_lock(i2s->lock);
1631     + spin_lock_irqsave(i2s->lock, flags);
1632     mod = readl(i2s->addr + I2SMOD);
1633     mod = (mod & ~mask) | val;
1634     writel(mod, i2s->addr + I2SMOD);
1635     - spin_unlock(i2s->lock);
1636     + spin_unlock_irqrestore(i2s->lock, flags);
1637    
1638     return 0;
1639     }
1640     @@ -589,6 +590,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai,
1641     struct i2s_dai *i2s = to_info(dai);
1642     int lrp_shift, sdf_shift, sdf_mask, lrp_rlow, mod_slave;
1643     u32 mod, tmp = 0;
1644     + unsigned long flags;
1645    
1646     lrp_shift = i2s->variant_regs->lrp_off;
1647     sdf_shift = i2s->variant_regs->sdf_off;
1648     @@ -648,7 +650,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai,
1649     return -EINVAL;
1650     }
1651    
1652     - spin_lock(i2s->lock);
1653     + spin_lock_irqsave(i2s->lock, flags);
1654     mod = readl(i2s->addr + I2SMOD);
1655     /*
1656     * Don't change the I2S mode if any controller is active on this
1657     @@ -656,7 +658,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai,
1658     */
1659     if (any_active(i2s) &&
1660     ((mod & (sdf_mask | lrp_rlow | mod_slave)) != tmp)) {
1661     - spin_unlock(i2s->lock);
1662     + spin_unlock_irqrestore(i2s->lock, flags);
1663     dev_err(&i2s->pdev->dev,
1664     "%s:%d Other DAI busy\n", __func__, __LINE__);
1665     return -EAGAIN;
1666     @@ -665,7 +667,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai,
1667     mod &= ~(sdf_mask | lrp_rlow | mod_slave);
1668     mod |= tmp;
1669     writel(mod, i2s->addr + I2SMOD);
1670     - spin_unlock(i2s->lock);
1671     + spin_unlock_irqrestore(i2s->lock, flags);
1672    
1673     return 0;
1674     }
1675     @@ -675,6 +677,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
1676     {
1677     struct i2s_dai *i2s = to_info(dai);
1678     u32 mod, mask = 0, val = 0;
1679     + unsigned long flags;
1680    
1681     if (!is_secondary(i2s))
1682     mask |= (MOD_DC2_EN | MOD_DC1_EN);
1683     @@ -743,11 +746,11 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
1684     return -EINVAL;
1685     }
1686    
1687     - spin_lock(i2s->lock);
1688     + spin_lock_irqsave(i2s->lock, flags);
1689     mod = readl(i2s->addr + I2SMOD);
1690     mod = (mod & ~mask) | val;
1691     writel(mod, i2s->addr + I2SMOD);
1692     - spin_unlock(i2s->lock);
1693     + spin_unlock_irqrestore(i2s->lock, flags);
1694    
1695     samsung_asoc_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture);
1696    
1697     diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
1698     index 7d009428934a..416514fe9e63 100644
1699     --- a/sound/soc/soc-dapm.c
1700     +++ b/sound/soc/soc-dapm.c
1701     @@ -3568,7 +3568,7 @@ static int snd_soc_dapm_dai_link_get(struct snd_kcontrol *kcontrol,
1702     {
1703     struct snd_soc_dapm_widget *w = snd_kcontrol_chip(kcontrol);
1704    
1705     - ucontrol->value.integer.value[0] = w->params_select;
1706     + ucontrol->value.enumerated.item[0] = w->params_select;
1707    
1708     return 0;
1709     }
1710     @@ -3582,13 +3582,13 @@ static int snd_soc_dapm_dai_link_put(struct snd_kcontrol *kcontrol,
1711     if (w->power)
1712     return -EBUSY;
1713    
1714     - if (ucontrol->value.integer.value[0] == w->params_select)
1715     + if (ucontrol->value.enumerated.item[0] == w->params_select)
1716     return 0;
1717    
1718     - if (ucontrol->value.integer.value[0] >= w->num_params)
1719     + if (ucontrol->value.enumerated.item[0] >= w->num_params)
1720     return -EINVAL;
1721    
1722     - w->params_select = ucontrol->value.integer.value[0];
1723     + w->params_select = ucontrol->value.enumerated.item[0];
1724    
1725     return 0;
1726     }
1727     diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
1728     index 484079efea5b..7338e30421d8 100644
1729     --- a/virt/kvm/kvm_main.c
1730     +++ b/virt/kvm/kvm_main.c
1731     @@ -1961,6 +1961,9 @@ static void grow_halt_poll_ns(struct kvm_vcpu *vcpu)
1732     else
1733     val *= halt_poll_ns_grow;
1734    
1735     + if (val > halt_poll_ns)
1736     + val = halt_poll_ns;
1737     +
1738     vcpu->halt_poll_ns = val;
1739     trace_kvm_halt_poll_ns_grow(vcpu->vcpu_id, val, old);
1740     }