Magellan Linux

Annotation of /trunk/kernel-alx/patches-4.9/0182-4.9.83-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3202 - (hide annotations) (download)
Wed Aug 8 14:26:01 2018 UTC (5 years, 9 months ago) by niro
File size: 113514 byte(s)
-linux-4.9.83
1 niro 3202 diff --git a/Documentation/devicetree/bindings/dma/snps-dma.txt b/Documentation/devicetree/bindings/dma/snps-dma.txt
2     index 0f5583293c9c..633481e2a4ec 100644
3     --- a/Documentation/devicetree/bindings/dma/snps-dma.txt
4     +++ b/Documentation/devicetree/bindings/dma/snps-dma.txt
5     @@ -63,6 +63,6 @@ Example:
6     interrupts = <0 35 0x4>;
7     status = "disabled";
8     dmas = <&dmahost 12 0 1>,
9     - <&dmahost 13 0 1 0>;
10     + <&dmahost 13 1 0>;
11     dma-names = "rx", "rx";
12     };
13     diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
14     index 6c0108eb0137..2139ea253142 100644
15     --- a/Documentation/filesystems/ext4.txt
16     +++ b/Documentation/filesystems/ext4.txt
17     @@ -233,7 +233,7 @@ data_err=ignore(*) Just print an error message if an error occurs
18     data_err=abort Abort the journal if an error occurs in a file
19     data buffer in ordered mode.
20    
21     -grpid Give objects the same group ID as their creator.
22     +grpid New objects have the group ID of their parent.
23     bsdgroups
24    
25     nogrpid (*) New objects have the group ID of their creator.
26     diff --git a/Makefile b/Makefile
27     index d338530540e0..cfae9b823d2b 100644
28     --- a/Makefile
29     +++ b/Makefile
30     @@ -1,6 +1,6 @@
31     VERSION = 4
32     PATCHLEVEL = 9
33     -SUBLEVEL = 82
34     +SUBLEVEL = 83
35     EXTRAVERSION =
36     NAME = Roaring Lionus
37    
38     diff --git a/arch/arm/boot/dts/arm-realview-eb-mp.dtsi b/arch/arm/boot/dts/arm-realview-eb-mp.dtsi
39     index 7b8d90b7aeea..29b636fce23f 100644
40     --- a/arch/arm/boot/dts/arm-realview-eb-mp.dtsi
41     +++ b/arch/arm/boot/dts/arm-realview-eb-mp.dtsi
42     @@ -150,11 +150,6 @@
43     interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>;
44     };
45    
46     -&charlcd {
47     - interrupt-parent = <&intc>;
48     - interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
49     -};
50     -
51     &serial0 {
52     interrupt-parent = <&intc>;
53     interrupts = <0 4 IRQ_TYPE_LEVEL_HIGH>;
54     diff --git a/arch/arm/boot/dts/exynos5410.dtsi b/arch/arm/boot/dts/exynos5410.dtsi
55     index 137f48464f8b..bb59fee072c0 100644
56     --- a/arch/arm/boot/dts/exynos5410.dtsi
57     +++ b/arch/arm/boot/dts/exynos5410.dtsi
58     @@ -274,7 +274,6 @@
59     &rtc {
60     clocks = <&clock CLK_RTC>;
61     clock-names = "rtc";
62     - interrupt-parent = <&pmu_system_controller>;
63     status = "disabled";
64     };
65    
66     diff --git a/arch/arm/boot/dts/lpc3250-ea3250.dts b/arch/arm/boot/dts/lpc3250-ea3250.dts
67     index 52b3ed10283a..e2bc731079be 100644
68     --- a/arch/arm/boot/dts/lpc3250-ea3250.dts
69     +++ b/arch/arm/boot/dts/lpc3250-ea3250.dts
70     @@ -156,8 +156,8 @@
71     uda1380: uda1380@18 {
72     compatible = "nxp,uda1380";
73     reg = <0x18>;
74     - power-gpio = <&gpio 0x59 0>;
75     - reset-gpio = <&gpio 0x51 0>;
76     + power-gpio = <&gpio 3 10 0>;
77     + reset-gpio = <&gpio 3 2 0>;
78     dac-clk = "wspll";
79     };
80    
81     diff --git a/arch/arm/boot/dts/lpc3250-phy3250.dts b/arch/arm/boot/dts/lpc3250-phy3250.dts
82     index fd95e2b10357..b7bd3a110a8d 100644
83     --- a/arch/arm/boot/dts/lpc3250-phy3250.dts
84     +++ b/arch/arm/boot/dts/lpc3250-phy3250.dts
85     @@ -81,8 +81,8 @@
86     uda1380: uda1380@18 {
87     compatible = "nxp,uda1380";
88     reg = <0x18>;
89     - power-gpio = <&gpio 0x59 0>;
90     - reset-gpio = <&gpio 0x51 0>;
91     + power-gpio = <&gpio 3 10 0>;
92     + reset-gpio = <&gpio 3 2 0>;
93     dac-clk = "wspll";
94     };
95    
96     diff --git a/arch/arm/boot/dts/mt2701.dtsi b/arch/arm/boot/dts/mt2701.dtsi
97     index 77c6b931dc24..23fe0497f708 100644
98     --- a/arch/arm/boot/dts/mt2701.dtsi
99     +++ b/arch/arm/boot/dts/mt2701.dtsi
100     @@ -197,12 +197,14 @@
101     compatible = "mediatek,mt2701-hifsys", "syscon";
102     reg = <0 0x1a000000 0 0x1000>;
103     #clock-cells = <1>;
104     + #reset-cells = <1>;
105     };
106    
107     ethsys: syscon@1b000000 {
108     compatible = "mediatek,mt2701-ethsys", "syscon";
109     reg = <0 0x1b000000 0 0x1000>;
110     #clock-cells = <1>;
111     + #reset-cells = <1>;
112     };
113    
114     bdpsys: syscon@1c000000 {
115     diff --git a/arch/arm/boot/dts/s5pv210.dtsi b/arch/arm/boot/dts/s5pv210.dtsi
116     index a853918be43f..0c10ba517cd0 100644
117     --- a/arch/arm/boot/dts/s5pv210.dtsi
118     +++ b/arch/arm/boot/dts/s5pv210.dtsi
119     @@ -463,6 +463,7 @@
120     compatible = "samsung,exynos4210-ohci";
121     reg = <0xec300000 0x100>;
122     interrupts = <23>;
123     + interrupt-parent = <&vic1>;
124     clocks = <&clocks CLK_USB_HOST>;
125     clock-names = "usbhost";
126     #address-cells = <1>;
127     diff --git a/arch/arm/boot/dts/spear1310-evb.dts b/arch/arm/boot/dts/spear1310-evb.dts
128     index 84101e4eebbf..0f5f379323a8 100644
129     --- a/arch/arm/boot/dts/spear1310-evb.dts
130     +++ b/arch/arm/boot/dts/spear1310-evb.dts
131     @@ -349,7 +349,7 @@
132     spi0: spi@e0100000 {
133     status = "okay";
134     num-cs = <3>;
135     - cs-gpios = <&gpio1 7 0>, <&spics 0>, <&spics 1>;
136     + cs-gpios = <&gpio1 7 0>, <&spics 0 0>, <&spics 1 0>;
137    
138     stmpe610@0 {
139     compatible = "st,stmpe610";
140     diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi
141     index df2232d767ed..6361cbfcbe5e 100644
142     --- a/arch/arm/boot/dts/spear1340.dtsi
143     +++ b/arch/arm/boot/dts/spear1340.dtsi
144     @@ -141,8 +141,8 @@
145     reg = <0xb4100000 0x1000>;
146     interrupts = <0 105 0x4>;
147     status = "disabled";
148     - dmas = <&dwdma0 0x600 0 0 1>, /* 0xC << 11 */
149     - <&dwdma0 0x680 0 1 0>; /* 0xD << 7 */
150     + dmas = <&dwdma0 12 0 1>,
151     + <&dwdma0 13 1 0>;
152     dma-names = "tx", "rx";
153     };
154    
155     diff --git a/arch/arm/boot/dts/spear13xx.dtsi b/arch/arm/boot/dts/spear13xx.dtsi
156     index 449acf0d8272..9564337c1815 100644
157     --- a/arch/arm/boot/dts/spear13xx.dtsi
158     +++ b/arch/arm/boot/dts/spear13xx.dtsi
159     @@ -100,7 +100,7 @@
160     reg = <0xb2800000 0x1000>;
161     interrupts = <0 29 0x4>;
162     status = "disabled";
163     - dmas = <&dwdma0 0 0 0 0>;
164     + dmas = <&dwdma0 0 0 0>;
165     dma-names = "data";
166     };
167    
168     @@ -288,8 +288,8 @@
169     #size-cells = <0>;
170     interrupts = <0 31 0x4>;
171     status = "disabled";
172     - dmas = <&dwdma0 0x2000 0 0 0>, /* 0x4 << 11 */
173     - <&dwdma0 0x0280 0 0 0>; /* 0x5 << 7 */
174     + dmas = <&dwdma0 4 0 0>,
175     + <&dwdma0 5 0 0>;
176     dma-names = "tx", "rx";
177     };
178    
179     diff --git a/arch/arm/boot/dts/spear600.dtsi b/arch/arm/boot/dts/spear600.dtsi
180     index 9f60a7b6a42b..bd379034993c 100644
181     --- a/arch/arm/boot/dts/spear600.dtsi
182     +++ b/arch/arm/boot/dts/spear600.dtsi
183     @@ -194,6 +194,7 @@
184     rtc@fc900000 {
185     compatible = "st,spear600-rtc";
186     reg = <0xfc900000 0x1000>;
187     + interrupt-parent = <&vic0>;
188     interrupts = <10>;
189     status = "disabled";
190     };
191     diff --git a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
192     index adb1c0998b81..1077ceebb2d6 100644
193     --- a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
194     +++ b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
195     @@ -749,6 +749,7 @@
196     reg = <0x10120000 0x1000>;
197     interrupt-names = "combined";
198     interrupts = <14>;
199     + interrupt-parent = <&vica>;
200     clocks = <&clcdclk>, <&hclkclcd>;
201     clock-names = "clcdclk", "apb_pclk";
202     status = "disabled";
203     diff --git a/arch/arm/boot/dts/stih407.dtsi b/arch/arm/boot/dts/stih407.dtsi
204     index 291ffacbd2e0..fe043d313ccd 100644
205     --- a/arch/arm/boot/dts/stih407.dtsi
206     +++ b/arch/arm/boot/dts/stih407.dtsi
207     @@ -8,6 +8,7 @@
208     */
209     #include "stih407-clock.dtsi"
210     #include "stih407-family.dtsi"
211     +#include <dt-bindings/gpio/gpio.h>
212     / {
213     soc {
214     sti-display-subsystem {
215     @@ -122,7 +123,7 @@
216     <&clk_s_d2_quadfs 0>,
217     <&clk_s_d2_quadfs 1>;
218    
219     - hdmi,hpd-gpio = <&pio5 3>;
220     + hdmi,hpd-gpio = <&pio5 3 GPIO_ACTIVE_LOW>;
221     reset-names = "hdmi";
222     resets = <&softreset STIH407_HDMI_TX_PHY_SOFTRESET>;
223     ddc = <&hdmiddc>;
224     diff --git a/arch/arm/boot/dts/stih410.dtsi b/arch/arm/boot/dts/stih410.dtsi
225     index 4d329b2908be..3c118fc2bf61 100644
226     --- a/arch/arm/boot/dts/stih410.dtsi
227     +++ b/arch/arm/boot/dts/stih410.dtsi
228     @@ -9,6 +9,7 @@
229     #include "stih410-clock.dtsi"
230     #include "stih407-family.dtsi"
231     #include "stih410-pinctrl.dtsi"
232     +#include <dt-bindings/gpio/gpio.h>
233     / {
234     aliases {
235     bdisp0 = &bdisp0;
236     @@ -213,7 +214,7 @@
237     <&clk_s_d2_quadfs 0>,
238     <&clk_s_d2_quadfs 1>;
239    
240     - hdmi,hpd-gpio = <&pio5 3>;
241     + hdmi,hpd-gpio = <&pio5 3 GPIO_ACTIVE_LOW>;
242     reset-names = "hdmi";
243     resets = <&softreset STIH407_HDMI_TX_PHY_SOFTRESET>;
244     ddc = <&hdmiddc>;
245     diff --git a/arch/arm/mach-pxa/tosa-bt.c b/arch/arm/mach-pxa/tosa-bt.c
246     index 107f37210fb9..83606087edc7 100644
247     --- a/arch/arm/mach-pxa/tosa-bt.c
248     +++ b/arch/arm/mach-pxa/tosa-bt.c
249     @@ -132,3 +132,7 @@ static struct platform_driver tosa_bt_driver = {
250     },
251     };
252     module_platform_driver(tosa_bt_driver);
253     +
254     +MODULE_LICENSE("GPL");
255     +MODULE_AUTHOR("Dmitry Baryshkov");
256     +MODULE_DESCRIPTION("Bluetooth built-in chip control");
257     diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi
258     index 466ca5705c99..08b88f6791be 100644
259     --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi
260     +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi
261     @@ -796,6 +796,7 @@
262     "dsi_phy_regulator";
263    
264     #clock-cells = <1>;
265     + #phy-cells = <0>;
266    
267     clocks = <&gcc GCC_MDSS_AHB_CLK>;
268     clock-names = "iface_clk";
269     @@ -906,8 +907,8 @@
270     #address-cells = <1>;
271     #size-cells = <0>;
272    
273     - qcom,ipc-1 = <&apcs 0 13>;
274     - qcom,ipc-6 = <&apcs 0 19>;
275     + qcom,ipc-1 = <&apcs 8 13>;
276     + qcom,ipc-3 = <&apcs 8 19>;
277    
278     apps_smsm: apps@0 {
279     reg = <0>;
280     diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
281     index 5e844f68e847..2d2fd79ced9d 100644
282     --- a/arch/mips/Kconfig
283     +++ b/arch/mips/Kconfig
284     @@ -112,12 +112,12 @@ config MIPS_GENERIC
285     select SYS_SUPPORTS_MULTITHREADING
286     select SYS_SUPPORTS_RELOCATABLE
287     select SYS_SUPPORTS_SMARTMIPS
288     - select USB_EHCI_BIG_ENDIAN_DESC if BIG_ENDIAN
289     - select USB_EHCI_BIG_ENDIAN_MMIO if BIG_ENDIAN
290     - select USB_OHCI_BIG_ENDIAN_DESC if BIG_ENDIAN
291     - select USB_OHCI_BIG_ENDIAN_MMIO if BIG_ENDIAN
292     - select USB_UHCI_BIG_ENDIAN_DESC if BIG_ENDIAN
293     - select USB_UHCI_BIG_ENDIAN_MMIO if BIG_ENDIAN
294     + select USB_EHCI_BIG_ENDIAN_DESC if CPU_BIG_ENDIAN
295     + select USB_EHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
296     + select USB_OHCI_BIG_ENDIAN_DESC if CPU_BIG_ENDIAN
297     + select USB_OHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
298     + select USB_UHCI_BIG_ENDIAN_DESC if CPU_BIG_ENDIAN
299     + select USB_UHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
300     select USE_OF
301     help
302     Select this to build a kernel which aims to support multiple boards,
303     diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
304     index c33b69d10919..9121b9a35c8a 100644
305     --- a/arch/powerpc/kernel/entry_64.S
306     +++ b/arch/powerpc/kernel/entry_64.S
307     @@ -39,6 +39,11 @@
308     #include <asm/tm.h>
309     #include <asm/ppc-opcode.h>
310     #include <asm/export.h>
311     +#ifdef CONFIG_PPC_BOOK3S
312     +#include <asm/exception-64s.h>
313     +#else
314     +#include <asm/exception-64e.h>
315     +#endif
316    
317     /*
318     * System calls.
319     diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
320     index f06a9a0063f1..d0724a924184 100644
321     --- a/arch/s390/kernel/compat_linux.c
322     +++ b/arch/s390/kernel/compat_linux.c
323     @@ -110,7 +110,7 @@ COMPAT_SYSCALL_DEFINE2(s390_setregid16, u16, rgid, u16, egid)
324    
325     COMPAT_SYSCALL_DEFINE1(s390_setgid16, u16, gid)
326     {
327     - return sys_setgid((gid_t)gid);
328     + return sys_setgid(low2highgid(gid));
329     }
330    
331     COMPAT_SYSCALL_DEFINE2(s390_setreuid16, u16, ruid, u16, euid)
332     @@ -120,7 +120,7 @@ COMPAT_SYSCALL_DEFINE2(s390_setreuid16, u16, ruid, u16, euid)
333    
334     COMPAT_SYSCALL_DEFINE1(s390_setuid16, u16, uid)
335     {
336     - return sys_setuid((uid_t)uid);
337     + return sys_setuid(low2highuid(uid));
338     }
339    
340     COMPAT_SYSCALL_DEFINE3(s390_setresuid16, u16, ruid, u16, euid, u16, suid)
341     @@ -173,12 +173,12 @@ COMPAT_SYSCALL_DEFINE3(s390_getresgid16, u16 __user *, rgidp,
342    
343     COMPAT_SYSCALL_DEFINE1(s390_setfsuid16, u16, uid)
344     {
345     - return sys_setfsuid((uid_t)uid);
346     + return sys_setfsuid(low2highuid(uid));
347     }
348    
349     COMPAT_SYSCALL_DEFINE1(s390_setfsgid16, u16, gid)
350     {
351     - return sys_setfsgid((gid_t)gid);
352     + return sys_setfsgid(low2highgid(gid));
353     }
354    
355     static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info)
356     diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S
357     index d76a97653980..92c55738d543 100644
358     --- a/arch/x86/entry/entry_64_compat.S
359     +++ b/arch/x86/entry/entry_64_compat.S
360     @@ -83,15 +83,25 @@ ENTRY(entry_SYSENTER_compat)
361     pushq %rcx /* pt_regs->cx */
362     pushq $-ENOSYS /* pt_regs->ax */
363     pushq $0 /* pt_regs->r8 = 0 */
364     + xorq %r8, %r8 /* nospec r8 */
365     pushq $0 /* pt_regs->r9 = 0 */
366     + xorq %r9, %r9 /* nospec r9 */
367     pushq $0 /* pt_regs->r10 = 0 */
368     + xorq %r10, %r10 /* nospec r10 */
369     pushq $0 /* pt_regs->r11 = 0 */
370     + xorq %r11, %r11 /* nospec r11 */
371     pushq %rbx /* pt_regs->rbx */
372     + xorl %ebx, %ebx /* nospec rbx */
373     pushq %rbp /* pt_regs->rbp (will be overwritten) */
374     + xorl %ebp, %ebp /* nospec rbp */
375     pushq $0 /* pt_regs->r12 = 0 */
376     + xorq %r12, %r12 /* nospec r12 */
377     pushq $0 /* pt_regs->r13 = 0 */
378     + xorq %r13, %r13 /* nospec r13 */
379     pushq $0 /* pt_regs->r14 = 0 */
380     + xorq %r14, %r14 /* nospec r14 */
381     pushq $0 /* pt_regs->r15 = 0 */
382     + xorq %r15, %r15 /* nospec r15 */
383     cld
384    
385     /*
386     @@ -209,15 +219,25 @@ ENTRY(entry_SYSCALL_compat)
387     pushq %rbp /* pt_regs->cx (stashed in bp) */
388     pushq $-ENOSYS /* pt_regs->ax */
389     pushq $0 /* pt_regs->r8 = 0 */
390     + xorq %r8, %r8 /* nospec r8 */
391     pushq $0 /* pt_regs->r9 = 0 */
392     + xorq %r9, %r9 /* nospec r9 */
393     pushq $0 /* pt_regs->r10 = 0 */
394     + xorq %r10, %r10 /* nospec r10 */
395     pushq $0 /* pt_regs->r11 = 0 */
396     + xorq %r11, %r11 /* nospec r11 */
397     pushq %rbx /* pt_regs->rbx */
398     + xorl %ebx, %ebx /* nospec rbx */
399     pushq %rbp /* pt_regs->rbp (will be overwritten) */
400     + xorl %ebp, %ebp /* nospec rbp */
401     pushq $0 /* pt_regs->r12 = 0 */
402     + xorq %r12, %r12 /* nospec r12 */
403     pushq $0 /* pt_regs->r13 = 0 */
404     + xorq %r13, %r13 /* nospec r13 */
405     pushq $0 /* pt_regs->r14 = 0 */
406     + xorq %r14, %r14 /* nospec r14 */
407     pushq $0 /* pt_regs->r15 = 0 */
408     + xorq %r15, %r15 /* nospec r15 */
409    
410     /*
411     * User mode is traced as though IRQs are on, and SYSENTER
412     @@ -320,15 +340,25 @@ ENTRY(entry_INT80_compat)
413     pushq %rcx /* pt_regs->cx */
414     pushq $-ENOSYS /* pt_regs->ax */
415     pushq $0 /* pt_regs->r8 = 0 */
416     + xorq %r8, %r8 /* nospec r8 */
417     pushq $0 /* pt_regs->r9 = 0 */
418     + xorq %r9, %r9 /* nospec r9 */
419     pushq $0 /* pt_regs->r10 = 0 */
420     + xorq %r10, %r10 /* nospec r10 */
421     pushq $0 /* pt_regs->r11 = 0 */
422     + xorq %r11, %r11 /* nospec r11 */
423     pushq %rbx /* pt_regs->rbx */
424     + xorl %ebx, %ebx /* nospec rbx */
425     pushq %rbp /* pt_regs->rbp */
426     + xorl %ebp, %ebp /* nospec rbp */
427     pushq %r12 /* pt_regs->r12 */
428     + xorq %r12, %r12 /* nospec r12 */
429     pushq %r13 /* pt_regs->r13 */
430     + xorq %r13, %r13 /* nospec r13 */
431     pushq %r14 /* pt_regs->r14 */
432     + xorq %r14, %r14 /* nospec r14 */
433     pushq %r15 /* pt_regs->r15 */
434     + xorq %r15, %r15 /* nospec r15 */
435     cld
436    
437     /*
438     diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
439     index f0f197f459b5..0bd0c1cc3228 100644
440     --- a/arch/x86/events/intel/core.c
441     +++ b/arch/x86/events/intel/core.c
442     @@ -3363,7 +3363,7 @@ static int intel_snb_pebs_broken(int cpu)
443     break;
444    
445     case INTEL_FAM6_SANDYBRIDGE_X:
446     - switch (cpu_data(cpu).x86_mask) {
447     + switch (cpu_data(cpu).x86_stepping) {
448     case 6: rev = 0x618; break;
449     case 7: rev = 0x70c; break;
450     }
451     diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c
452     index f924629836a8..5d103a87e984 100644
453     --- a/arch/x86/events/intel/lbr.c
454     +++ b/arch/x86/events/intel/lbr.c
455     @@ -1131,7 +1131,7 @@ void __init intel_pmu_lbr_init_atom(void)
456     * on PMU interrupt
457     */
458     if (boot_cpu_data.x86_model == 28
459     - && boot_cpu_data.x86_mask < 10) {
460     + && boot_cpu_data.x86_stepping < 10) {
461     pr_cont("LBR disabled due to erratum");
462     return;
463     }
464     diff --git a/arch/x86/events/intel/p6.c b/arch/x86/events/intel/p6.c
465     index 1f5c47ab4c65..c5e441baccc7 100644
466     --- a/arch/x86/events/intel/p6.c
467     +++ b/arch/x86/events/intel/p6.c
468     @@ -233,7 +233,7 @@ static __initconst const struct x86_pmu p6_pmu = {
469    
470     static __init void p6_pmu_rdpmc_quirk(void)
471     {
472     - if (boot_cpu_data.x86_mask < 9) {
473     + if (boot_cpu_data.x86_stepping < 9) {
474     /*
475     * PPro erratum 26; fixed in stepping 9 and above.
476     */
477     diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
478     index 5391b0ae7cc3..d32bab65de70 100644
479     --- a/arch/x86/include/asm/acpi.h
480     +++ b/arch/x86/include/asm/acpi.h
481     @@ -92,7 +92,7 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
482     if (boot_cpu_data.x86 == 0x0F &&
483     boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
484     boot_cpu_data.x86_model <= 0x05 &&
485     - boot_cpu_data.x86_mask < 0x0A)
486     + boot_cpu_data.x86_stepping < 0x0A)
487     return 1;
488     else if (amd_e400_c1e_detected)
489     return 1;
490     diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h
491     index 857590390397..78d1c6a3d221 100644
492     --- a/arch/x86/include/asm/barrier.h
493     +++ b/arch/x86/include/asm/barrier.h
494     @@ -39,7 +39,7 @@ static inline unsigned long array_index_mask_nospec(unsigned long index,
495    
496     asm ("cmp %1,%2; sbb %0,%0;"
497     :"=r" (mask)
498     - :"r"(size),"r" (index)
499     + :"g"(size),"r" (index)
500     :"cc");
501     return mask;
502     }
503     diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
504     index 300cc159b4a0..76b058533e47 100644
505     --- a/arch/x86/include/asm/nospec-branch.h
506     +++ b/arch/x86/include/asm/nospec-branch.h
507     @@ -6,6 +6,7 @@
508     #include <asm/alternative.h>
509     #include <asm/alternative-asm.h>
510     #include <asm/cpufeatures.h>
511     +#include <asm/msr-index.h>
512    
513     #ifdef __ASSEMBLY__
514    
515     diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
516     index cb866ae1bc5d..ec15ca2b32d0 100644
517     --- a/arch/x86/include/asm/processor.h
518     +++ b/arch/x86/include/asm/processor.h
519     @@ -88,7 +88,7 @@ struct cpuinfo_x86 {
520     __u8 x86; /* CPU family */
521     __u8 x86_vendor; /* CPU vendor */
522     __u8 x86_model;
523     - __u8 x86_mask;
524     + __u8 x86_stepping;
525     #ifdef CONFIG_X86_32
526     char wp_works_ok; /* It doesn't on 386's */
527    
528     @@ -113,7 +113,7 @@ struct cpuinfo_x86 {
529     char x86_vendor_id[16];
530     char x86_model_id[64];
531     /* in KB - valid for CPUS which support this call: */
532     - int x86_cache_size;
533     + unsigned int x86_cache_size;
534     int x86_cache_alignment; /* In bytes */
535     /* Cache QoS architectural values: */
536     int x86_cache_max_rmid; /* max index */
537     diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c
538     index 4fdf6230d93c..8462e2d4ed94 100644
539     --- a/arch/x86/kernel/amd_nb.c
540     +++ b/arch/x86/kernel/amd_nb.c
541     @@ -105,7 +105,7 @@ int amd_cache_northbridges(void)
542     if (boot_cpu_data.x86 == 0x10 &&
543     boot_cpu_data.x86_model >= 0x8 &&
544     (boot_cpu_data.x86_model > 0x9 ||
545     - boot_cpu_data.x86_mask >= 0x1))
546     + boot_cpu_data.x86_stepping >= 0x1))
547     amd_northbridges.flags |= AMD_NB_L3_INDEX_DISABLE;
548    
549     if (boot_cpu_data.x86 == 0x15)
550     diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
551     index 880aa093268d..36ebb6de1a03 100644
552     --- a/arch/x86/kernel/asm-offsets_32.c
553     +++ b/arch/x86/kernel/asm-offsets_32.c
554     @@ -20,7 +20,7 @@ void foo(void)
555     OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
556     OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
557     OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
558     - OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
559     + OFFSET(CPUINFO_x86_stepping, cpuinfo_x86, x86_stepping);
560     OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
561     OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
562     OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
563     diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
564     index 1b89f0c4251e..c375bc672f82 100644
565     --- a/arch/x86/kernel/cpu/amd.c
566     +++ b/arch/x86/kernel/cpu/amd.c
567     @@ -118,7 +118,7 @@ static void init_amd_k6(struct cpuinfo_x86 *c)
568     return;
569     }
570    
571     - if (c->x86_model == 6 && c->x86_mask == 1) {
572     + if (c->x86_model == 6 && c->x86_stepping == 1) {
573     const int K6_BUG_LOOP = 1000000;
574     int n;
575     void (*f_vide)(void);
576     @@ -147,7 +147,7 @@ static void init_amd_k6(struct cpuinfo_x86 *c)
577    
578     /* K6 with old style WHCR */
579     if (c->x86_model < 8 ||
580     - (c->x86_model == 8 && c->x86_mask < 8)) {
581     + (c->x86_model == 8 && c->x86_stepping < 8)) {
582     /* We can only write allocate on the low 508Mb */
583     if (mbytes > 508)
584     mbytes = 508;
585     @@ -166,7 +166,7 @@ static void init_amd_k6(struct cpuinfo_x86 *c)
586     return;
587     }
588    
589     - if ((c->x86_model == 8 && c->x86_mask > 7) ||
590     + if ((c->x86_model == 8 && c->x86_stepping > 7) ||
591     c->x86_model == 9 || c->x86_model == 13) {
592     /* The more serious chips .. */
593    
594     @@ -219,7 +219,7 @@ static void init_amd_k7(struct cpuinfo_x86 *c)
595     * are more robust with CLK_CTL set to 200xxxxx instead of 600xxxxx
596     * As per AMD technical note 27212 0.2
597     */
598     - if ((c->x86_model == 8 && c->x86_mask >= 1) || (c->x86_model > 8)) {
599     + if ((c->x86_model == 8 && c->x86_stepping >= 1) || (c->x86_model > 8)) {
600     rdmsr(MSR_K7_CLK_CTL, l, h);
601     if ((l & 0xfff00000) != 0x20000000) {
602     pr_info("CPU: CLK_CTL MSR was %x. Reprogramming to %x\n",
603     @@ -239,12 +239,12 @@ static void init_amd_k7(struct cpuinfo_x86 *c)
604     * but they are not certified as MP capable.
605     */
606     /* Athlon 660/661 is valid. */
607     - if ((c->x86_model == 6) && ((c->x86_mask == 0) ||
608     - (c->x86_mask == 1)))
609     + if ((c->x86_model == 6) && ((c->x86_stepping == 0) ||
610     + (c->x86_stepping == 1)))
611     return;
612    
613     /* Duron 670 is valid */
614     - if ((c->x86_model == 7) && (c->x86_mask == 0))
615     + if ((c->x86_model == 7) && (c->x86_stepping == 0))
616     return;
617    
618     /*
619     @@ -254,8 +254,8 @@ static void init_amd_k7(struct cpuinfo_x86 *c)
620     * See http://www.heise.de/newsticker/data/jow-18.10.01-000 for
621     * more.
622     */
623     - if (((c->x86_model == 6) && (c->x86_mask >= 2)) ||
624     - ((c->x86_model == 7) && (c->x86_mask >= 1)) ||
625     + if (((c->x86_model == 6) && (c->x86_stepping >= 2)) ||
626     + ((c->x86_model == 7) && (c->x86_stepping >= 1)) ||
627     (c->x86_model > 7))
628     if (cpu_has(c, X86_FEATURE_MP))
629     return;
630     @@ -569,7 +569,7 @@ static void early_init_amd(struct cpuinfo_x86 *c)
631     /* Set MTRR capability flag if appropriate */
632     if (c->x86 == 5)
633     if (c->x86_model == 13 || c->x86_model == 9 ||
634     - (c->x86_model == 8 && c->x86_mask >= 8))
635     + (c->x86_model == 8 && c->x86_stepping >= 8))
636     set_cpu_cap(c, X86_FEATURE_K6_MTRR);
637     #endif
638     #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_PCI)
639     @@ -834,11 +834,11 @@ static unsigned int amd_size_cache(struct cpuinfo_x86 *c, unsigned int size)
640     /* AMD errata T13 (order #21922) */
641     if ((c->x86 == 6)) {
642     /* Duron Rev A0 */
643     - if (c->x86_model == 3 && c->x86_mask == 0)
644     + if (c->x86_model == 3 && c->x86_stepping == 0)
645     size = 64;
646     /* Tbird rev A1/A2 */
647     if (c->x86_model == 4 &&
648     - (c->x86_mask == 0 || c->x86_mask == 1))
649     + (c->x86_stepping == 0 || c->x86_stepping == 1))
650     size = 256;
651     }
652     return size;
653     @@ -975,7 +975,7 @@ static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum)
654     }
655    
656     /* OSVW unavailable or ID unknown, match family-model-stepping range */
657     - ms = (cpu->x86_model << 4) | cpu->x86_mask;
658     + ms = (cpu->x86_model << 4) | cpu->x86_stepping;
659     while ((range = *erratum++))
660     if ((cpu->x86 == AMD_MODEL_RANGE_FAMILY(range)) &&
661     (ms >= AMD_MODEL_RANGE_START(range)) &&
662     diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
663     index 957ad443b786..baddc9ed3454 100644
664     --- a/arch/x86/kernel/cpu/bugs.c
665     +++ b/arch/x86/kernel/cpu/bugs.c
666     @@ -161,8 +161,7 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
667     if (cmdline_find_option_bool(boot_command_line, "nospectre_v2"))
668     return SPECTRE_V2_CMD_NONE;
669     else {
670     - ret = cmdline_find_option(boot_command_line, "spectre_v2", arg,
671     - sizeof(arg));
672     + ret = cmdline_find_option(boot_command_line, "spectre_v2", arg, sizeof(arg));
673     if (ret < 0)
674     return SPECTRE_V2_CMD_AUTO;
675    
676     @@ -174,8 +173,7 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
677     }
678    
679     if (i >= ARRAY_SIZE(mitigation_options)) {
680     - pr_err("unknown option (%s). Switching to AUTO select\n",
681     - mitigation_options[i].option);
682     + pr_err("unknown option (%s). Switching to AUTO select\n", arg);
683     return SPECTRE_V2_CMD_AUTO;
684     }
685     }
686     @@ -184,8 +182,7 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
687     cmd == SPECTRE_V2_CMD_RETPOLINE_AMD ||
688     cmd == SPECTRE_V2_CMD_RETPOLINE_GENERIC) &&
689     !IS_ENABLED(CONFIG_RETPOLINE)) {
690     - pr_err("%s selected but not compiled in. Switching to AUTO select\n",
691     - mitigation_options[i].option);
692     + pr_err("%s selected but not compiled in. Switching to AUTO select\n", mitigation_options[i].option);
693     return SPECTRE_V2_CMD_AUTO;
694     }
695    
696     @@ -255,14 +252,14 @@ static void __init spectre_v2_select_mitigation(void)
697     goto retpoline_auto;
698     break;
699     }
700     - pr_err("kernel not compiled with retpoline; no mitigation available!");
701     + pr_err("Spectre mitigation: kernel not compiled with retpoline; no mitigation available!");
702     return;
703    
704     retpoline_auto:
705     if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
706     retpoline_amd:
707     if (!boot_cpu_has(X86_FEATURE_LFENCE_RDTSC)) {
708     - pr_err("LFENCE not serializing. Switching to generic retpoline\n");
709     + pr_err("Spectre mitigation: LFENCE not serializing, switching to generic retpoline\n");
710     goto retpoline_generic;
711     }
712     mode = retp_compiler() ? SPECTRE_V2_RETPOLINE_AMD :
713     @@ -280,7 +277,7 @@ static void __init spectre_v2_select_mitigation(void)
714     pr_info("%s\n", spectre_v2_strings[mode]);
715    
716     /*
717     - * If neither SMEP or KPTI are available, there is a risk of
718     + * If neither SMEP nor PTI are available, there is a risk of
719     * hitting userspace addresses in the RSB after a context switch
720     * from a shallow call stack to a deeper one. To prevent this fill
721     * the entire RSB, even when using IBRS.
722     @@ -294,21 +291,20 @@ static void __init spectre_v2_select_mitigation(void)
723     if ((!boot_cpu_has(X86_FEATURE_KAISER) &&
724     !boot_cpu_has(X86_FEATURE_SMEP)) || is_skylake_era()) {
725     setup_force_cpu_cap(X86_FEATURE_RSB_CTXSW);
726     - pr_info("Filling RSB on context switch\n");
727     + pr_info("Spectre v2 mitigation: Filling RSB on context switch\n");
728     }
729    
730     /* Initialize Indirect Branch Prediction Barrier if supported */
731     if (boot_cpu_has(X86_FEATURE_IBPB)) {
732     setup_force_cpu_cap(X86_FEATURE_USE_IBPB);
733     - pr_info("Enabling Indirect Branch Prediction Barrier\n");
734     + pr_info("Spectre v2 mitigation: Enabling Indirect Branch Prediction Barrier\n");
735     }
736     }
737    
738     #undef pr_fmt
739    
740     #ifdef CONFIG_SYSFS
741     -ssize_t cpu_show_meltdown(struct device *dev,
742     - struct device_attribute *attr, char *buf)
743     +ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf)
744     {
745     if (!boot_cpu_has_bug(X86_BUG_CPU_MELTDOWN))
746     return sprintf(buf, "Not affected\n");
747     @@ -317,16 +313,14 @@ ssize_t cpu_show_meltdown(struct device *dev,
748     return sprintf(buf, "Vulnerable\n");
749     }
750    
751     -ssize_t cpu_show_spectre_v1(struct device *dev,
752     - struct device_attribute *attr, char *buf)
753     +ssize_t cpu_show_spectre_v1(struct device *dev, struct device_attribute *attr, char *buf)
754     {
755     if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V1))
756     return sprintf(buf, "Not affected\n");
757     return sprintf(buf, "Mitigation: __user pointer sanitization\n");
758     }
759    
760     -ssize_t cpu_show_spectre_v2(struct device *dev,
761     - struct device_attribute *attr, char *buf)
762     +ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute *attr, char *buf)
763     {
764     if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2))
765     return sprintf(buf, "Not affected\n");
766     diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c
767     index 1661d8ec9280..4d2f61f92fed 100644
768     --- a/arch/x86/kernel/cpu/centaur.c
769     +++ b/arch/x86/kernel/cpu/centaur.c
770     @@ -134,7 +134,7 @@ static void init_centaur(struct cpuinfo_x86 *c)
771     clear_cpu_cap(c, X86_FEATURE_TSC);
772     break;
773     case 8:
774     - switch (c->x86_mask) {
775     + switch (c->x86_stepping) {
776     default:
777     name = "2";
778     break;
779     @@ -209,7 +209,7 @@ centaur_size_cache(struct cpuinfo_x86 *c, unsigned int size)
780     * - Note, it seems this may only be in engineering samples.
781     */
782     if ((c->x86 == 6) && (c->x86_model == 9) &&
783     - (c->x86_mask == 1) && (size == 65))
784     + (c->x86_stepping == 1) && (size == 65))
785     size -= 1;
786     return size;
787     }
788     diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
789     index 08e89ed6aa87..301bbd1f2373 100644
790     --- a/arch/x86/kernel/cpu/common.c
791     +++ b/arch/x86/kernel/cpu/common.c
792     @@ -699,7 +699,7 @@ void cpu_detect(struct cpuinfo_x86 *c)
793     cpuid(0x00000001, &tfms, &misc, &junk, &cap0);
794     c->x86 = x86_family(tfms);
795     c->x86_model = x86_model(tfms);
796     - c->x86_mask = x86_stepping(tfms);
797     + c->x86_stepping = x86_stepping(tfms);
798    
799     if (cap0 & (1<<19)) {
800     c->x86_clflush_size = ((misc >> 8) & 0xff) * 8;
801     @@ -1144,9 +1144,9 @@ static void identify_cpu(struct cpuinfo_x86 *c)
802     int i;
803    
804     c->loops_per_jiffy = loops_per_jiffy;
805     - c->x86_cache_size = -1;
806     + c->x86_cache_size = 0;
807     c->x86_vendor = X86_VENDOR_UNKNOWN;
808     - c->x86_model = c->x86_mask = 0; /* So far unknown... */
809     + c->x86_model = c->x86_stepping = 0; /* So far unknown... */
810     c->x86_vendor_id[0] = '\0'; /* Unset */
811     c->x86_model_id[0] = '\0'; /* Unset */
812     c->x86_max_cores = 1;
813     @@ -1391,8 +1391,8 @@ void print_cpu_info(struct cpuinfo_x86 *c)
814    
815     pr_cont(" (family: 0x%x, model: 0x%x", c->x86, c->x86_model);
816    
817     - if (c->x86_mask || c->cpuid_level >= 0)
818     - pr_cont(", stepping: 0x%x)\n", c->x86_mask);
819     + if (c->x86_stepping || c->cpuid_level >= 0)
820     + pr_cont(", stepping: 0x%x)\n", c->x86_stepping);
821     else
822     pr_cont(")\n");
823    
824     diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c
825     index bd9dcd6b712d..455d8ada9b9a 100644
826     --- a/arch/x86/kernel/cpu/cyrix.c
827     +++ b/arch/x86/kernel/cpu/cyrix.c
828     @@ -212,7 +212,7 @@ static void init_cyrix(struct cpuinfo_x86 *c)
829    
830     /* common case step number/rev -- exceptions handled below */
831     c->x86_model = (dir1 >> 4) + 1;
832     - c->x86_mask = dir1 & 0xf;
833     + c->x86_stepping = dir1 & 0xf;
834    
835     /* Now cook; the original recipe is by Channing Corn, from Cyrix.
836     * We do the same thing for each generation: we work out
837     diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
838     index 4097b43cba2d..6ed206bd9071 100644
839     --- a/arch/x86/kernel/cpu/intel.c
840     +++ b/arch/x86/kernel/cpu/intel.c
841     @@ -75,14 +75,13 @@ struct sku_microcode {
842     u32 microcode;
843     };
844     static const struct sku_microcode spectre_bad_microcodes[] = {
845     - { INTEL_FAM6_KABYLAKE_DESKTOP, 0x0B, 0x84 },
846     - { INTEL_FAM6_KABYLAKE_DESKTOP, 0x0A, 0x84 },
847     - { INTEL_FAM6_KABYLAKE_DESKTOP, 0x09, 0x84 },
848     - { INTEL_FAM6_KABYLAKE_MOBILE, 0x0A, 0x84 },
849     - { INTEL_FAM6_KABYLAKE_MOBILE, 0x09, 0x84 },
850     + { INTEL_FAM6_KABYLAKE_DESKTOP, 0x0B, 0x80 },
851     + { INTEL_FAM6_KABYLAKE_DESKTOP, 0x0A, 0x80 },
852     + { INTEL_FAM6_KABYLAKE_DESKTOP, 0x09, 0x80 },
853     + { INTEL_FAM6_KABYLAKE_MOBILE, 0x0A, 0x80 },
854     + { INTEL_FAM6_KABYLAKE_MOBILE, 0x09, 0x80 },
855     { INTEL_FAM6_SKYLAKE_X, 0x03, 0x0100013e },
856     { INTEL_FAM6_SKYLAKE_X, 0x04, 0x0200003c },
857     - { INTEL_FAM6_SKYLAKE_MOBILE, 0x03, 0xc2 },
858     { INTEL_FAM6_SKYLAKE_DESKTOP, 0x03, 0xc2 },
859     { INTEL_FAM6_BROADWELL_CORE, 0x04, 0x28 },
860     { INTEL_FAM6_BROADWELL_GT3E, 0x01, 0x1b },
861     @@ -95,8 +94,6 @@ static const struct sku_microcode spectre_bad_microcodes[] = {
862     { INTEL_FAM6_HASWELL_X, 0x02, 0x3b },
863     { INTEL_FAM6_HASWELL_X, 0x04, 0x10 },
864     { INTEL_FAM6_IVYBRIDGE_X, 0x04, 0x42a },
865     - /* Updated in the 20180108 release; blacklist until we know otherwise */
866     - { INTEL_FAM6_ATOM_GEMINI_LAKE, 0x01, 0x22 },
867     /* Observed in the wild */
868     { INTEL_FAM6_SANDYBRIDGE_X, 0x06, 0x61b },
869     { INTEL_FAM6_SANDYBRIDGE_X, 0x07, 0x712 },
870     @@ -108,7 +105,7 @@ static bool bad_spectre_microcode(struct cpuinfo_x86 *c)
871    
872     for (i = 0; i < ARRAY_SIZE(spectre_bad_microcodes); i++) {
873     if (c->x86_model == spectre_bad_microcodes[i].model &&
874     - c->x86_mask == spectre_bad_microcodes[i].stepping)
875     + c->x86_stepping == spectre_bad_microcodes[i].stepping)
876     return (c->microcode <= spectre_bad_microcodes[i].microcode);
877     }
878     return false;
879     @@ -161,7 +158,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
880     * need the microcode to have already been loaded... so if it is
881     * not, recommend a BIOS update and disable large pages.
882     */
883     - if (c->x86 == 6 && c->x86_model == 0x1c && c->x86_mask <= 2 &&
884     + if (c->x86 == 6 && c->x86_model == 0x1c && c->x86_stepping <= 2 &&
885     c->microcode < 0x20e) {
886     pr_warn("Atom PSE erratum detected, BIOS microcode update recommended\n");
887     clear_cpu_cap(c, X86_FEATURE_PSE);
888     @@ -177,7 +174,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
889    
890     /* CPUID workaround for 0F33/0F34 CPU */
891     if (c->x86 == 0xF && c->x86_model == 0x3
892     - && (c->x86_mask == 0x3 || c->x86_mask == 0x4))
893     + && (c->x86_stepping == 0x3 || c->x86_stepping == 0x4))
894     c->x86_phys_bits = 36;
895    
896     /*
897     @@ -292,7 +289,7 @@ int ppro_with_ram_bug(void)
898     if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
899     boot_cpu_data.x86 == 6 &&
900     boot_cpu_data.x86_model == 1 &&
901     - boot_cpu_data.x86_mask < 8) {
902     + boot_cpu_data.x86_stepping < 8) {
903     pr_info("Pentium Pro with Errata#50 detected. Taking evasive action.\n");
904     return 1;
905     }
906     @@ -309,7 +306,7 @@ static void intel_smp_check(struct cpuinfo_x86 *c)
907     * Mask B, Pentium, but not Pentium MMX
908     */
909     if (c->x86 == 5 &&
910     - c->x86_mask >= 1 && c->x86_mask <= 4 &&
911     + c->x86_stepping >= 1 && c->x86_stepping <= 4 &&
912     c->x86_model <= 3) {
913     /*
914     * Remember we have B step Pentia with bugs
915     @@ -352,7 +349,7 @@ static void intel_workarounds(struct cpuinfo_x86 *c)
916     * SEP CPUID bug: Pentium Pro reports SEP but doesn't have it until
917     * model 3 mask 3
918     */
919     - if ((c->x86<<8 | c->x86_model<<4 | c->x86_mask) < 0x633)
920     + if ((c->x86<<8 | c->x86_model<<4 | c->x86_stepping) < 0x633)
921     clear_cpu_cap(c, X86_FEATURE_SEP);
922    
923     /*
924     @@ -370,7 +367,7 @@ static void intel_workarounds(struct cpuinfo_x86 *c)
925     * P4 Xeon erratum 037 workaround.
926     * Hardware prefetcher may cause stale data to be loaded into the cache.
927     */
928     - if ((c->x86 == 15) && (c->x86_model == 1) && (c->x86_mask == 1)) {
929     + if ((c->x86 == 15) && (c->x86_model == 1) && (c->x86_stepping == 1)) {
930     if (msr_set_bit(MSR_IA32_MISC_ENABLE,
931     MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE_BIT) > 0) {
932     pr_info("CPU: C0 stepping P4 Xeon detected.\n");
933     @@ -385,7 +382,7 @@ static void intel_workarounds(struct cpuinfo_x86 *c)
934     * Specification Update").
935     */
936     if (boot_cpu_has(X86_FEATURE_APIC) && (c->x86<<8 | c->x86_model<<4) == 0x520 &&
937     - (c->x86_mask < 0x6 || c->x86_mask == 0xb))
938     + (c->x86_stepping < 0x6 || c->x86_stepping == 0xb))
939     set_cpu_bug(c, X86_BUG_11AP);
940    
941    
942     @@ -604,7 +601,7 @@ static void init_intel(struct cpuinfo_x86 *c)
943     case 6:
944     if (l2 == 128)
945     p = "Celeron (Mendocino)";
946     - else if (c->x86_mask == 0 || c->x86_mask == 5)
947     + else if (c->x86_stepping == 0 || c->x86_stepping == 5)
948     p = "Celeron-A";
949     break;
950    
951     diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
952     index f90f17610f62..4bcd30c87531 100644
953     --- a/arch/x86/kernel/cpu/microcode/intel.c
954     +++ b/arch/x86/kernel/cpu/microcode/intel.c
955     @@ -1062,7 +1062,7 @@ static bool is_blacklisted(unsigned int cpu)
956     */
957     if (c->x86 == 6 &&
958     c->x86_model == INTEL_FAM6_BROADWELL_X &&
959     - c->x86_mask == 0x01 &&
960     + c->x86_stepping == 0x01 &&
961     llc_size_per_core > 2621440 &&
962     c->microcode < 0x0b000021) {
963     pr_err_once("Erratum BDF90: late loading with revision < 0x0b000021 (0x%x) disabled.\n", c->microcode);
964     @@ -1085,7 +1085,7 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device,
965     return UCODE_NFOUND;
966    
967     sprintf(name, "intel-ucode/%02x-%02x-%02x",
968     - c->x86, c->x86_model, c->x86_mask);
969     + c->x86, c->x86_model, c->x86_stepping);
970    
971     if (request_firmware_direct(&firmware, name, device)) {
972     pr_debug("data file %s load failed\n", name);
973     @@ -1132,7 +1132,7 @@ static struct microcode_ops microcode_intel_ops = {
974    
975     static int __init calc_llc_size_per_core(struct cpuinfo_x86 *c)
976     {
977     - u64 llc_size = c->x86_cache_size * 1024;
978     + u64 llc_size = c->x86_cache_size * 1024ULL;
979    
980     do_div(llc_size, c->x86_max_cores);
981    
982     diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
983     index fdc55215d44d..e12ee86906c6 100644
984     --- a/arch/x86/kernel/cpu/mtrr/generic.c
985     +++ b/arch/x86/kernel/cpu/mtrr/generic.c
986     @@ -859,7 +859,7 @@ int generic_validate_add_page(unsigned long base, unsigned long size,
987     */
988     if (is_cpu(INTEL) && boot_cpu_data.x86 == 6 &&
989     boot_cpu_data.x86_model == 1 &&
990     - boot_cpu_data.x86_mask <= 7) {
991     + boot_cpu_data.x86_stepping <= 7) {
992     if (base & ((1 << (22 - PAGE_SHIFT)) - 1)) {
993     pr_warn("mtrr: base(0x%lx000) is not 4 MiB aligned\n", base);
994     return -EINVAL;
995     diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
996     index 24e87e74990d..fae740c22657 100644
997     --- a/arch/x86/kernel/cpu/mtrr/main.c
998     +++ b/arch/x86/kernel/cpu/mtrr/main.c
999     @@ -699,8 +699,8 @@ void __init mtrr_bp_init(void)
1000     if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
1001     boot_cpu_data.x86 == 0xF &&
1002     boot_cpu_data.x86_model == 0x3 &&
1003     - (boot_cpu_data.x86_mask == 0x3 ||
1004     - boot_cpu_data.x86_mask == 0x4))
1005     + (boot_cpu_data.x86_stepping == 0x3 ||
1006     + boot_cpu_data.x86_stepping == 0x4))
1007     phys_addr = 36;
1008    
1009     size_or_mask = SIZE_OR_MASK_BITS(phys_addr);
1010     diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
1011     index 18ca99f2798b..c4f772d3f35c 100644
1012     --- a/arch/x86/kernel/cpu/proc.c
1013     +++ b/arch/x86/kernel/cpu/proc.c
1014     @@ -70,8 +70,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1015     c->x86_model,
1016     c->x86_model_id[0] ? c->x86_model_id : "unknown");
1017    
1018     - if (c->x86_mask || c->cpuid_level >= 0)
1019     - seq_printf(m, "stepping\t: %d\n", c->x86_mask);
1020     + if (c->x86_stepping || c->cpuid_level >= 0)
1021     + seq_printf(m, "stepping\t: %d\n", c->x86_stepping);
1022     else
1023     seq_puts(m, "stepping\t: unknown\n");
1024     if (c->microcode)
1025     @@ -87,8 +87,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1026     }
1027    
1028     /* Cache size */
1029     - if (c->x86_cache_size >= 0)
1030     - seq_printf(m, "cache size\t: %d KB\n", c->x86_cache_size);
1031     + if (c->x86_cache_size)
1032     + seq_printf(m, "cache size\t: %u KB\n", c->x86_cache_size);
1033    
1034     show_cpuinfo_core(m, c, cpu);
1035     show_cpuinfo_misc(m, c);
1036     diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
1037     index 2dabea46f039..82155d0cc310 100644
1038     --- a/arch/x86/kernel/head_32.S
1039     +++ b/arch/x86/kernel/head_32.S
1040     @@ -35,7 +35,7 @@
1041     #define X86 new_cpu_data+CPUINFO_x86
1042     #define X86_VENDOR new_cpu_data+CPUINFO_x86_vendor
1043     #define X86_MODEL new_cpu_data+CPUINFO_x86_model
1044     -#define X86_MASK new_cpu_data+CPUINFO_x86_mask
1045     +#define X86_STEPPING new_cpu_data+CPUINFO_x86_stepping
1046     #define X86_HARD_MATH new_cpu_data+CPUINFO_hard_math
1047     #define X86_CPUID new_cpu_data+CPUINFO_cpuid_level
1048     #define X86_CAPABILITY new_cpu_data+CPUINFO_x86_capability
1049     @@ -441,7 +441,7 @@ enable_paging:
1050     shrb $4,%al
1051     movb %al,X86_MODEL
1052     andb $0x0f,%cl # mask mask revision
1053     - movb %cl,X86_MASK
1054     + movb %cl,X86_STEPPING
1055     movl %edx,X86_CAPABILITY
1056    
1057     is486:
1058     diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
1059     index 0f8d20497383..d0fb941330c6 100644
1060     --- a/arch/x86/kernel/mpparse.c
1061     +++ b/arch/x86/kernel/mpparse.c
1062     @@ -406,7 +406,7 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
1063     processor.apicver = mpc_default_type > 4 ? 0x10 : 0x01;
1064     processor.cpuflag = CPU_ENABLED;
1065     processor.cpufeature = (boot_cpu_data.x86 << 8) |
1066     - (boot_cpu_data.x86_model << 4) | boot_cpu_data.x86_mask;
1067     + (boot_cpu_data.x86_model << 4) | boot_cpu_data.x86_stepping;
1068     processor.featureflag = boot_cpu_data.x86_capability[CPUID_1_EDX];
1069     processor.reserved[0] = 0;
1070     processor.reserved[1] = 0;
1071     diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
1072     index 0a324e120942..a16c06604a56 100644
1073     --- a/arch/x86/kvm/mmu.c
1074     +++ b/arch/x86/kvm/mmu.c
1075     @@ -4640,7 +4640,7 @@ void kvm_mmu_uninit_vm(struct kvm *kvm)
1076     typedef bool (*slot_level_handler) (struct kvm *kvm, struct kvm_rmap_head *rmap_head);
1077    
1078     /* The caller should hold mmu-lock before calling this function. */
1079     -static bool
1080     +static __always_inline bool
1081     slot_handle_level_range(struct kvm *kvm, struct kvm_memory_slot *memslot,
1082     slot_level_handler fn, int start_level, int end_level,
1083     gfn_t start_gfn, gfn_t end_gfn, bool lock_flush_tlb)
1084     @@ -4670,7 +4670,7 @@ slot_handle_level_range(struct kvm *kvm, struct kvm_memory_slot *memslot,
1085     return flush;
1086     }
1087    
1088     -static bool
1089     +static __always_inline bool
1090     slot_handle_level(struct kvm *kvm, struct kvm_memory_slot *memslot,
1091     slot_level_handler fn, int start_level, int end_level,
1092     bool lock_flush_tlb)
1093     @@ -4681,7 +4681,7 @@ slot_handle_level(struct kvm *kvm, struct kvm_memory_slot *memslot,
1094     lock_flush_tlb);
1095     }
1096    
1097     -static bool
1098     +static __always_inline bool
1099     slot_handle_all_level(struct kvm *kvm, struct kvm_memory_slot *memslot,
1100     slot_level_handler fn, bool lock_flush_tlb)
1101     {
1102     @@ -4689,7 +4689,7 @@ slot_handle_all_level(struct kvm *kvm, struct kvm_memory_slot *memslot,
1103     PT_MAX_HUGEPAGE_LEVEL, lock_flush_tlb);
1104     }
1105    
1106     -static bool
1107     +static __always_inline bool
1108     slot_handle_large_level(struct kvm *kvm, struct kvm_memory_slot *memslot,
1109     slot_level_handler fn, bool lock_flush_tlb)
1110     {
1111     @@ -4697,7 +4697,7 @@ slot_handle_large_level(struct kvm *kvm, struct kvm_memory_slot *memslot,
1112     PT_MAX_HUGEPAGE_LEVEL, lock_flush_tlb);
1113     }
1114    
1115     -static bool
1116     +static __always_inline bool
1117     slot_handle_leaf(struct kvm *kvm, struct kvm_memory_slot *memslot,
1118     slot_level_handler fn, bool lock_flush_tlb)
1119     {
1120     diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
1121     index d66224e695cf..1e16821c1378 100644
1122     --- a/arch/x86/kvm/vmx.c
1123     +++ b/arch/x86/kvm/vmx.c
1124     @@ -9606,8 +9606,8 @@ static inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu,
1125     * updated to reflect this when L1 (or its L2s) actually write to
1126     * the MSR.
1127     */
1128     - bool pred_cmd = msr_write_intercepted_l01(vcpu, MSR_IA32_PRED_CMD);
1129     - bool spec_ctrl = msr_write_intercepted_l01(vcpu, MSR_IA32_SPEC_CTRL);
1130     + bool pred_cmd = !msr_write_intercepted_l01(vcpu, MSR_IA32_PRED_CMD);
1131     + bool spec_ctrl = !msr_write_intercepted_l01(vcpu, MSR_IA32_SPEC_CTRL);
1132    
1133     if (!nested_cpu_has_virt_x2apic_mode(vmcs12) &&
1134     !pred_cmd && !spec_ctrl)
1135     diff --git a/arch/x86/lib/cpu.c b/arch/x86/lib/cpu.c
1136     index d6f848d1211d..2dd1fe13a37b 100644
1137     --- a/arch/x86/lib/cpu.c
1138     +++ b/arch/x86/lib/cpu.c
1139     @@ -18,7 +18,7 @@ unsigned int x86_model(unsigned int sig)
1140     {
1141     unsigned int fam, model;
1142    
1143     - fam = x86_family(sig);
1144     + fam = x86_family(sig);
1145    
1146     model = (sig >> 4) & 0xf;
1147    
1148     diff --git a/drivers/char/hw_random/via-rng.c b/drivers/char/hw_random/via-rng.c
1149     index 44ce80606944..e278125ddf41 100644
1150     --- a/drivers/char/hw_random/via-rng.c
1151     +++ b/drivers/char/hw_random/via-rng.c
1152     @@ -166,7 +166,7 @@ static int via_rng_init(struct hwrng *rng)
1153     /* Enable secondary noise source on CPUs where it is present. */
1154    
1155     /* Nehemiah stepping 8 and higher */
1156     - if ((c->x86_model == 9) && (c->x86_mask > 7))
1157     + if ((c->x86_model == 9) && (c->x86_stepping > 7))
1158     lo |= VIA_NOISESRC2;
1159    
1160     /* Esther */
1161     diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
1162     index 297e9128fe9f..1ee3674a99bb 100644
1163     --- a/drivers/cpufreq/acpi-cpufreq.c
1164     +++ b/drivers/cpufreq/acpi-cpufreq.c
1165     @@ -648,7 +648,7 @@ static int acpi_cpufreq_blacklist(struct cpuinfo_x86 *c)
1166     if (c->x86_vendor == X86_VENDOR_INTEL) {
1167     if ((c->x86 == 15) &&
1168     (c->x86_model == 6) &&
1169     - (c->x86_mask == 8)) {
1170     + (c->x86_stepping == 8)) {
1171     pr_info("Intel(R) Xeon(R) 7100 Errata AL30, processors may lock up on frequency changes: disabling acpi-cpufreq\n");
1172     return -ENODEV;
1173     }
1174     diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c
1175     index c46a12df40dd..d5e27bc7585a 100644
1176     --- a/drivers/cpufreq/longhaul.c
1177     +++ b/drivers/cpufreq/longhaul.c
1178     @@ -775,7 +775,7 @@ static int longhaul_cpu_init(struct cpufreq_policy *policy)
1179     break;
1180    
1181     case 7:
1182     - switch (c->x86_mask) {
1183     + switch (c->x86_stepping) {
1184     case 0:
1185     longhaul_version = TYPE_LONGHAUL_V1;
1186     cpu_model = CPU_SAMUEL2;
1187     @@ -787,7 +787,7 @@ static int longhaul_cpu_init(struct cpufreq_policy *policy)
1188     break;
1189     case 1 ... 15:
1190     longhaul_version = TYPE_LONGHAUL_V2;
1191     - if (c->x86_mask < 8) {
1192     + if (c->x86_stepping < 8) {
1193     cpu_model = CPU_SAMUEL2;
1194     cpuname = "C3 'Samuel 2' [C5B]";
1195     } else {
1196     @@ -814,7 +814,7 @@ static int longhaul_cpu_init(struct cpufreq_policy *policy)
1197     numscales = 32;
1198     memcpy(mults, nehemiah_mults, sizeof(nehemiah_mults));
1199     memcpy(eblcr, nehemiah_eblcr, sizeof(nehemiah_eblcr));
1200     - switch (c->x86_mask) {
1201     + switch (c->x86_stepping) {
1202     case 0 ... 1:
1203     cpu_model = CPU_NEHEMIAH;
1204     cpuname = "C3 'Nehemiah A' [C5XLOE]";
1205     diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c
1206     index fd77812313f3..a25741b1281b 100644
1207     --- a/drivers/cpufreq/p4-clockmod.c
1208     +++ b/drivers/cpufreq/p4-clockmod.c
1209     @@ -168,7 +168,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
1210     #endif
1211    
1212     /* Errata workaround */
1213     - cpuid = (c->x86 << 8) | (c->x86_model << 4) | c->x86_mask;
1214     + cpuid = (c->x86 << 8) | (c->x86_model << 4) | c->x86_stepping;
1215     switch (cpuid) {
1216     case 0x0f07:
1217     case 0x0f0a:
1218     diff --git a/drivers/cpufreq/powernow-k7.c b/drivers/cpufreq/powernow-k7.c
1219     index 9f013ed42977..ef276f6a8c46 100644
1220     --- a/drivers/cpufreq/powernow-k7.c
1221     +++ b/drivers/cpufreq/powernow-k7.c
1222     @@ -131,7 +131,7 @@ static int check_powernow(void)
1223     return 0;
1224     }
1225    
1226     - if ((c->x86_model == 6) && (c->x86_mask == 0)) {
1227     + if ((c->x86_model == 6) && (c->x86_stepping == 0)) {
1228     pr_info("K7 660[A0] core detected, enabling errata workarounds\n");
1229     have_a0 = 1;
1230     }
1231     diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c
1232     index a84724eabfb8..6fb3cd24c1b6 100644
1233     --- a/drivers/cpufreq/powernv-cpufreq.c
1234     +++ b/drivers/cpufreq/powernv-cpufreq.c
1235     @@ -260,9 +260,9 @@ static int init_powernv_pstates(void)
1236    
1237     if (id == pstate_max)
1238     powernv_pstate_info.max = i;
1239     - else if (id == pstate_nominal)
1240     + if (id == pstate_nominal)
1241     powernv_pstate_info.nominal = i;
1242     - else if (id == pstate_min)
1243     + if (id == pstate_min)
1244     powernv_pstate_info.min = i;
1245     }
1246    
1247     diff --git a/drivers/cpufreq/speedstep-centrino.c b/drivers/cpufreq/speedstep-centrino.c
1248     index 41bc5397f4bb..4fa5adf16c70 100644
1249     --- a/drivers/cpufreq/speedstep-centrino.c
1250     +++ b/drivers/cpufreq/speedstep-centrino.c
1251     @@ -37,7 +37,7 @@ struct cpu_id
1252     {
1253     __u8 x86; /* CPU family */
1254     __u8 x86_model; /* model */
1255     - __u8 x86_mask; /* stepping */
1256     + __u8 x86_stepping; /* stepping */
1257     };
1258    
1259     enum {
1260     @@ -277,7 +277,7 @@ static int centrino_verify_cpu_id(const struct cpuinfo_x86 *c,
1261     {
1262     if ((c->x86 == x->x86) &&
1263     (c->x86_model == x->x86_model) &&
1264     - (c->x86_mask == x->x86_mask))
1265     + (c->x86_stepping == x->x86_stepping))
1266     return 1;
1267     return 0;
1268     }
1269     diff --git a/drivers/cpufreq/speedstep-lib.c b/drivers/cpufreq/speedstep-lib.c
1270     index 1b8062182c81..ade98a219cc1 100644
1271     --- a/drivers/cpufreq/speedstep-lib.c
1272     +++ b/drivers/cpufreq/speedstep-lib.c
1273     @@ -272,9 +272,9 @@ unsigned int speedstep_detect_processor(void)
1274     ebx = cpuid_ebx(0x00000001);
1275     ebx &= 0x000000FF;
1276    
1277     - pr_debug("ebx value is %x, x86_mask is %x\n", ebx, c->x86_mask);
1278     + pr_debug("ebx value is %x, x86_stepping is %x\n", ebx, c->x86_stepping);
1279    
1280     - switch (c->x86_mask) {
1281     + switch (c->x86_stepping) {
1282     case 4:
1283     /*
1284     * B-stepping [M-P4-M]
1285     @@ -361,7 +361,7 @@ unsigned int speedstep_detect_processor(void)
1286     msr_lo, msr_hi);
1287     if ((msr_hi & (1<<18)) &&
1288     (relaxed_check ? 1 : (msr_hi & (3<<24)))) {
1289     - if (c->x86_mask == 0x01) {
1290     + if (c->x86_stepping == 0x01) {
1291     pr_debug("early PIII version\n");
1292     return SPEEDSTEP_CPU_PIII_C_EARLY;
1293     } else
1294     diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
1295     index 441e86b23571..9126627cbf4d 100644
1296     --- a/drivers/crypto/padlock-aes.c
1297     +++ b/drivers/crypto/padlock-aes.c
1298     @@ -531,7 +531,7 @@ static int __init padlock_init(void)
1299    
1300     printk(KERN_NOTICE PFX "Using VIA PadLock ACE for AES algorithm.\n");
1301    
1302     - if (c->x86 == 6 && c->x86_model == 15 && c->x86_mask == 2) {
1303     + if (c->x86 == 6 && c->x86_model == 15 && c->x86_stepping == 2) {
1304     ecb_fetch_blocks = MAX_ECB_FETCH_BLOCKS;
1305     cbc_fetch_blocks = MAX_CBC_FETCH_BLOCKS;
1306     printk(KERN_NOTICE PFX "VIA Nano stepping 2 detected: enabling workaround.\n");
1307     diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
1308     index a2449d77af07..9e5674c5a07b 100644
1309     --- a/drivers/devfreq/devfreq.c
1310     +++ b/drivers/devfreq/devfreq.c
1311     @@ -684,7 +684,7 @@ struct devfreq *devm_devfreq_add_device(struct device *dev,
1312     devfreq = devfreq_add_device(dev, profile, governor_name, data);
1313     if (IS_ERR(devfreq)) {
1314     devres_free(ptr);
1315     - return ERR_PTR(-ENOMEM);
1316     + return devfreq;
1317     }
1318    
1319     *ptr = devfreq;
1320     diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
1321     index 6e197c1c213d..1c5f23224b3c 100644
1322     --- a/drivers/edac/amd64_edac.c
1323     +++ b/drivers/edac/amd64_edac.c
1324     @@ -2719,7 +2719,7 @@ static struct amd64_family_type *per_family_init(struct amd64_pvt *pvt)
1325     struct amd64_family_type *fam_type = NULL;
1326    
1327     pvt->ext_model = boot_cpu_data.x86_model >> 4;
1328     - pvt->stepping = boot_cpu_data.x86_mask;
1329     + pvt->stepping = boot_cpu_data.x86_stepping;
1330     pvt->model = boot_cpu_data.x86_model;
1331     pvt->fam = boot_cpu_data.x86;
1332    
1333     diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
1334     index 7db692ed3dea..ac0c6c83b6d6 100644
1335     --- a/drivers/edac/mce_amd.c
1336     +++ b/drivers/edac/mce_amd.c
1337     @@ -948,7 +948,7 @@ int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
1338    
1339     pr_emerg(HW_ERR "CPU:%d (%x:%x:%x) MC%d_STATUS[%s|%s|%s|%s|%s",
1340     m->extcpu,
1341     - c->x86, c->x86_model, c->x86_mask,
1342     + c->x86, c->x86_model, c->x86_stepping,
1343     m->bank,
1344     ((m->status & MCI_STATUS_OVER) ? "Over" : "-"),
1345     ((m->status & MCI_STATUS_UC) ? "UE" :
1346     diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
1347     index 0cd0e7bdee55..16239b07ce45 100644
1348     --- a/drivers/gpu/drm/radeon/radeon_uvd.c
1349     +++ b/drivers/gpu/drm/radeon/radeon_uvd.c
1350     @@ -995,7 +995,7 @@ int radeon_uvd_calc_upll_dividers(struct radeon_device *rdev,
1351     /* calc dclk divider with current vco freq */
1352     dclk_div = radeon_uvd_calc_upll_post_div(vco_freq, dclk,
1353     pd_min, pd_even);
1354     - if (vclk_div > pd_max)
1355     + if (dclk_div > pd_max)
1356     break; /* vco is too big, it has to stop */
1357    
1358     /* calc score with current vco freq */
1359     diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
1360     index 8bd9e6c371d1..574ab0016a57 100644
1361     --- a/drivers/gpu/drm/radeon/si_dpm.c
1362     +++ b/drivers/gpu/drm/radeon/si_dpm.c
1363     @@ -3029,6 +3029,11 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev,
1364     max_sclk = 75000;
1365     max_mclk = 80000;
1366     }
1367     + if ((rdev->pdev->revision == 0xC3) ||
1368     + (rdev->pdev->device == 0x6665)) {
1369     + max_sclk = 60000;
1370     + max_mclk = 80000;
1371     + }
1372     } else if (rdev->family == CHIP_OLAND) {
1373     if ((rdev->pdev->revision == 0xC7) ||
1374     (rdev->pdev->revision == 0x80) ||
1375     diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
1376     index 6a27eb2fed17..be1e380fa1c3 100644
1377     --- a/drivers/hwmon/coretemp.c
1378     +++ b/drivers/hwmon/coretemp.c
1379     @@ -269,13 +269,13 @@ static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
1380     for (i = 0; i < ARRAY_SIZE(tjmax_model_table); i++) {
1381     const struct tjmax_model *tm = &tjmax_model_table[i];
1382     if (c->x86_model == tm->model &&
1383     - (tm->mask == ANY || c->x86_mask == tm->mask))
1384     + (tm->mask == ANY || c->x86_stepping == tm->mask))
1385     return tm->tjmax;
1386     }
1387    
1388     /* Early chips have no MSR for TjMax */
1389    
1390     - if (c->x86_model == 0xf && c->x86_mask < 4)
1391     + if (c->x86_model == 0xf && c->x86_stepping < 4)
1392     usemsr_ee = 0;
1393    
1394     if (c->x86_model > 0xe && usemsr_ee) {
1395     @@ -426,7 +426,7 @@ static int chk_ucode_version(unsigned int cpu)
1396     * Readings might stop update when processor visited too deep sleep,
1397     * fixed for stepping D0 (6EC).
1398     */
1399     - if (c->x86_model == 0xe && c->x86_mask < 0xc && c->microcode < 0x39) {
1400     + if (c->x86_model == 0xe && c->x86_stepping < 0xc && c->microcode < 0x39) {
1401     pr_err("Errata AE18 not fixed, update BIOS or microcode of the CPU!\n");
1402     return -ENODEV;
1403     }
1404     diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c
1405     index ef91b8a67549..84e91286fc4f 100644
1406     --- a/drivers/hwmon/hwmon-vid.c
1407     +++ b/drivers/hwmon/hwmon-vid.c
1408     @@ -293,7 +293,7 @@ u8 vid_which_vrm(void)
1409     if (c->x86 < 6) /* Any CPU with family lower than 6 */
1410     return 0; /* doesn't have VID */
1411    
1412     - vrm_ret = find_vrm(c->x86, c->x86_model, c->x86_mask, c->x86_vendor);
1413     + vrm_ret = find_vrm(c->x86, c->x86_model, c->x86_stepping, c->x86_vendor);
1414     if (vrm_ret == 134)
1415     vrm_ret = get_via_model_d_vrm();
1416     if (vrm_ret == 0)
1417     diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
1418     index 9cdfde6515ad..0124584a6a6d 100644
1419     --- a/drivers/hwmon/k10temp.c
1420     +++ b/drivers/hwmon/k10temp.c
1421     @@ -179,7 +179,7 @@ static bool has_erratum_319(struct pci_dev *pdev)
1422     * and AM3 formats, but that's the best we can do.
1423     */
1424     return boot_cpu_data.x86_model < 4 ||
1425     - (boot_cpu_data.x86_model == 4 && boot_cpu_data.x86_mask <= 2);
1426     + (boot_cpu_data.x86_model == 4 && boot_cpu_data.x86_stepping <= 2);
1427     }
1428    
1429     static int k10temp_probe(struct pci_dev *pdev,
1430     diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c
1431     index 734d55d48cc8..486502798fc5 100644
1432     --- a/drivers/hwmon/k8temp.c
1433     +++ b/drivers/hwmon/k8temp.c
1434     @@ -187,7 +187,7 @@ static int k8temp_probe(struct pci_dev *pdev,
1435     return -ENOMEM;
1436    
1437     model = boot_cpu_data.x86_model;
1438     - stepping = boot_cpu_data.x86_mask;
1439     + stepping = boot_cpu_data.x86_stepping;
1440    
1441     /* feature available since SH-C0, exclude older revisions */
1442     if ((model == 4 && stepping == 0) ||
1443     diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
1444     index 8059b7eaf3a8..c41c8d0a4ac0 100644
1445     --- a/drivers/infiniband/hw/mlx4/main.c
1446     +++ b/drivers/infiniband/hw/mlx4/main.c
1447     @@ -2928,9 +2928,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
1448     kfree(ibdev->ib_uc_qpns_bitmap);
1449    
1450     err_steer_qp_release:
1451     - if (ibdev->steering_support == MLX4_STEERING_MODE_DEVICE_MANAGED)
1452     - mlx4_qp_release_range(dev, ibdev->steer_qpn_base,
1453     - ibdev->steer_qpn_count);
1454     + mlx4_qp_release_range(dev, ibdev->steer_qpn_base,
1455     + ibdev->steer_qpn_count);
1456     err_counter:
1457     for (i = 0; i < ibdev->num_ports; ++i)
1458     mlx4_ib_delete_counters_table(ibdev, &ibdev->counters_table[i]);
1459     @@ -3035,11 +3034,9 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr)
1460     ibdev->iboe.nb.notifier_call = NULL;
1461     }
1462    
1463     - if (ibdev->steering_support == MLX4_STEERING_MODE_DEVICE_MANAGED) {
1464     - mlx4_qp_release_range(dev, ibdev->steer_qpn_base,
1465     - ibdev->steer_qpn_count);
1466     - kfree(ibdev->ib_uc_qpns_bitmap);
1467     - }
1468     + mlx4_qp_release_range(dev, ibdev->steer_qpn_base,
1469     + ibdev->steer_qpn_count);
1470     + kfree(ibdev->ib_uc_qpns_bitmap);
1471    
1472     iounmap(ibdev->uar_map);
1473     for (p = 0; p < ibdev->num_ports; ++p)
1474     diff --git a/drivers/infiniband/hw/qib/qib_rc.c b/drivers/infiniband/hw/qib/qib_rc.c
1475     index c1523f9a3c12..e4d4f5c44afe 100644
1476     --- a/drivers/infiniband/hw/qib/qib_rc.c
1477     +++ b/drivers/infiniband/hw/qib/qib_rc.c
1478     @@ -443,13 +443,13 @@ int qib_make_rc_req(struct rvt_qp *qp, unsigned long *flags)
1479     qp->s_state = OP(COMPARE_SWAP);
1480     put_ib_ateth_swap(wqe->atomic_wr.swap,
1481     &ohdr->u.atomic_eth);
1482     - put_ib_ateth_swap(wqe->atomic_wr.compare_add,
1483     - &ohdr->u.atomic_eth);
1484     + put_ib_ateth_compare(wqe->atomic_wr.compare_add,
1485     + &ohdr->u.atomic_eth);
1486     } else {
1487     qp->s_state = OP(FETCH_ADD);
1488     put_ib_ateth_swap(wqe->atomic_wr.compare_add,
1489     &ohdr->u.atomic_eth);
1490     - put_ib_ateth_swap(0, &ohdr->u.atomic_eth);
1491     + put_ib_ateth_compare(0, &ohdr->u.atomic_eth);
1492     }
1493     put_ib_ateth_vaddr(wqe->atomic_wr.remote_addr,
1494     &ohdr->u.atomic_eth);
1495     diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
1496     index 19841c863daf..59f37f412a7f 100644
1497     --- a/drivers/infiniband/sw/rxe/rxe_verbs.c
1498     +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
1499     @@ -848,6 +848,8 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, struct ib_send_wr *wr,
1500     (queue_count(qp->sq.queue) > 1);
1501    
1502     rxe_run_task(&qp->req.task, must_sched);
1503     + if (unlikely(qp->req.state == QP_STATE_ERROR))
1504     + rxe_run_task(&qp->comp.task, 1);
1505    
1506     return err;
1507     }
1508     diff --git a/drivers/md/dm.c b/drivers/md/dm.c
1509     index c5522551122f..2ffe7db75acb 100644
1510     --- a/drivers/md/dm.c
1511     +++ b/drivers/md/dm.c
1512     @@ -809,7 +809,8 @@ static void dec_pending(struct dm_io *io, int error)
1513     } else {
1514     /* done with normal IO or empty flush */
1515     trace_block_bio_complete(md->queue, bio, io_error);
1516     - bio->bi_error = io_error;
1517     + if (io_error)
1518     + bio->bi_error = io_error;
1519     bio_endio(bio);
1520     }
1521     }
1522     diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c
1523     index 08dca40356d2..006dac6e8940 100644
1524     --- a/drivers/media/tuners/r820t.c
1525     +++ b/drivers/media/tuners/r820t.c
1526     @@ -396,9 +396,11 @@ static int r820t_write(struct r820t_priv *priv, u8 reg, const u8 *val,
1527     return 0;
1528     }
1529    
1530     -static int r820t_write_reg(struct r820t_priv *priv, u8 reg, u8 val)
1531     +static inline int r820t_write_reg(struct r820t_priv *priv, u8 reg, u8 val)
1532     {
1533     - return r820t_write(priv, reg, &val, 1);
1534     + u8 tmp = val; /* work around GCC PR81715 with asan-stack=1 */
1535     +
1536     + return r820t_write(priv, reg, &tmp, 1);
1537     }
1538    
1539     static int r820t_read_cache_reg(struct r820t_priv *priv, int reg)
1540     @@ -411,17 +413,18 @@ static int r820t_read_cache_reg(struct r820t_priv *priv, int reg)
1541     return -EINVAL;
1542     }
1543    
1544     -static int r820t_write_reg_mask(struct r820t_priv *priv, u8 reg, u8 val,
1545     +static inline int r820t_write_reg_mask(struct r820t_priv *priv, u8 reg, u8 val,
1546     u8 bit_mask)
1547     {
1548     + u8 tmp = val;
1549     int rc = r820t_read_cache_reg(priv, reg);
1550    
1551     if (rc < 0)
1552     return rc;
1553    
1554     - val = (rc & ~bit_mask) | (val & bit_mask);
1555     + tmp = (rc & ~bit_mask) | (tmp & bit_mask);
1556    
1557     - return r820t_write(priv, reg, &val, 1);
1558     + return r820t_write(priv, reg, &tmp, 1);
1559     }
1560    
1561     static int r820t_read(struct r820t_priv *priv, u8 reg, u8 *val, int len)
1562     diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c
1563     index 3ad514c44dcb..ddc629e3f63a 100644
1564     --- a/drivers/mtd/nand/vf610_nfc.c
1565     +++ b/drivers/mtd/nand/vf610_nfc.c
1566     @@ -752,10 +752,8 @@ static int vf610_nfc_probe(struct platform_device *pdev)
1567     if (mtd->oobsize > 64)
1568     mtd->oobsize = 64;
1569    
1570     - /*
1571     - * mtd->ecclayout is not specified here because we're using the
1572     - * default large page ECC layout defined in NAND core.
1573     - */
1574     + /* Use default large page ECC layout defined in NAND core */
1575     + mtd_set_ooblayout(mtd, &nand_ooblayout_lp_ops);
1576     if (chip->ecc.strength == 32) {
1577     nfc->ecc_mode = ECC_60_BYTE;
1578     chip->ecc.bytes = 60;
1579     diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
1580     index ed6fae964ec5..7e2ebfc565ee 100644
1581     --- a/drivers/net/ethernet/marvell/mvpp2.c
1582     +++ b/drivers/net/ethernet/marvell/mvpp2.c
1583     @@ -5657,6 +5657,7 @@ static void mvpp2_set_rx_mode(struct net_device *dev)
1584     int id = port->id;
1585     bool allmulti = dev->flags & IFF_ALLMULTI;
1586    
1587     +retry:
1588     mvpp2_prs_mac_promisc_set(priv, id, dev->flags & IFF_PROMISC);
1589     mvpp2_prs_mac_multi_set(priv, id, MVPP2_PE_MAC_MC_ALL, allmulti);
1590     mvpp2_prs_mac_multi_set(priv, id, MVPP2_PE_MAC_MC_IP6, allmulti);
1591     @@ -5664,9 +5665,13 @@ static void mvpp2_set_rx_mode(struct net_device *dev)
1592     /* Remove all port->id's mcast enries */
1593     mvpp2_prs_mcast_del_all(priv, id);
1594    
1595     - if (allmulti && !netdev_mc_empty(dev)) {
1596     - netdev_for_each_mc_addr(ha, dev)
1597     - mvpp2_prs_mac_da_accept(priv, id, ha->addr, true);
1598     + if (!allmulti) {
1599     + netdev_for_each_mc_addr(ha, dev) {
1600     + if (mvpp2_prs_mac_da_accept(priv, id, ha->addr, true)) {
1601     + allmulti = true;
1602     + goto retry;
1603     + }
1604     + }
1605     }
1606     }
1607    
1608     diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
1609     index d1cd9c32a9ae..6143113a7fef 100644
1610     --- a/drivers/net/ethernet/mellanox/mlx4/qp.c
1611     +++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
1612     @@ -286,6 +286,9 @@ void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt)
1613     u64 in_param = 0;
1614     int err;
1615    
1616     + if (!cnt)
1617     + return;
1618     +
1619     if (mlx4_is_mfunc(dev)) {
1620     set_param_l(&in_param, base_qpn);
1621     set_param_h(&in_param, cnt);
1622     diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
1623     index 82d53895ce4d..0c3fe177fd14 100644
1624     --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
1625     +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
1626     @@ -1128,7 +1128,7 @@ static u8 _rtl8821ae_dbi_read(struct rtl_priv *rtlpriv, u16 addr)
1627     }
1628     if (0 == tmp) {
1629     read_addr = REG_DBI_RDATA + addr % 4;
1630     - ret = rtl_read_word(rtlpriv, read_addr);
1631     + ret = rtl_read_byte(rtlpriv, read_addr);
1632     }
1633     return ret;
1634     }
1635     @@ -1170,7 +1170,8 @@ static void _rtl8821ae_enable_aspm_back_door(struct ieee80211_hw *hw)
1636     }
1637    
1638     tmp = _rtl8821ae_dbi_read(rtlpriv, 0x70f);
1639     - _rtl8821ae_dbi_write(rtlpriv, 0x70f, tmp | BIT(7));
1640     + _rtl8821ae_dbi_write(rtlpriv, 0x70f, tmp | BIT(7) |
1641     + ASPM_L1_LATENCY << 3);
1642    
1643     tmp = _rtl8821ae_dbi_read(rtlpriv, 0x719);
1644     _rtl8821ae_dbi_write(rtlpriv, 0x719, tmp | BIT(3) | BIT(4));
1645     diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
1646     index dafe486f8448..340e7b324ef8 100644
1647     --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
1648     +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
1649     @@ -99,6 +99,7 @@
1650     #define RTL_USB_MAX_RX_COUNT 100
1651     #define QBSS_LOAD_SIZE 5
1652     #define MAX_WMMELE_LENGTH 64
1653     +#define ASPM_L1_LATENCY 7
1654    
1655     #define TOTAL_CAM_ENTRY 32
1656    
1657     diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c
1658     index 043c19a05da1..eac0a1238e9d 100644
1659     --- a/drivers/pci/host/pci-keystone.c
1660     +++ b/drivers/pci/host/pci-keystone.c
1661     @@ -181,7 +181,7 @@ static int ks_pcie_get_irq_controller_info(struct keystone_pcie *ks_pcie,
1662     }
1663    
1664     /* interrupt controller is in a child node */
1665     - *np_temp = of_find_node_by_name(np_pcie, controller);
1666     + *np_temp = of_get_child_by_name(np_pcie, controller);
1667     if (!(*np_temp)) {
1668     dev_err(dev, "Node for %s is absent\n", controller);
1669     return -EINVAL;
1670     @@ -190,6 +190,7 @@ static int ks_pcie_get_irq_controller_info(struct keystone_pcie *ks_pcie,
1671     temp = of_irq_count(*np_temp);
1672     if (!temp) {
1673     dev_err(dev, "No IRQ entries in %s\n", controller);
1674     + of_node_put(*np_temp);
1675     return -EINVAL;
1676     }
1677    
1678     @@ -207,6 +208,8 @@ static int ks_pcie_get_irq_controller_info(struct keystone_pcie *ks_pcie,
1679     break;
1680     }
1681    
1682     + of_node_put(*np_temp);
1683     +
1684     if (temp) {
1685     *num_irqs = temp;
1686     return 0;
1687     diff --git a/drivers/rtc/rtc-opal.c b/drivers/rtc/rtc-opal.c
1688     index ea20f627dabe..e4324dcf9508 100644
1689     --- a/drivers/rtc/rtc-opal.c
1690     +++ b/drivers/rtc/rtc-opal.c
1691     @@ -58,6 +58,7 @@ static void tm_to_opal(struct rtc_time *tm, u32 *y_m_d, u64 *h_m_s_ms)
1692     static int opal_get_rtc_time(struct device *dev, struct rtc_time *tm)
1693     {
1694     long rc = OPAL_BUSY;
1695     + int retries = 10;
1696     u32 y_m_d;
1697     u64 h_m_s_ms;
1698     __be32 __y_m_d;
1699     @@ -67,8 +68,11 @@ static int opal_get_rtc_time(struct device *dev, struct rtc_time *tm)
1700     rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms);
1701     if (rc == OPAL_BUSY_EVENT)
1702     opal_poll_events(NULL);
1703     - else
1704     + else if (retries-- && (rc == OPAL_HARDWARE
1705     + || rc == OPAL_INTERNAL_ERROR))
1706     msleep(10);
1707     + else if (rc != OPAL_BUSY && rc != OPAL_BUSY_EVENT)
1708     + break;
1709     }
1710    
1711     if (rc != OPAL_SUCCESS)
1712     @@ -84,6 +88,7 @@ static int opal_get_rtc_time(struct device *dev, struct rtc_time *tm)
1713     static int opal_set_rtc_time(struct device *dev, struct rtc_time *tm)
1714     {
1715     long rc = OPAL_BUSY;
1716     + int retries = 10;
1717     u32 y_m_d = 0;
1718     u64 h_m_s_ms = 0;
1719    
1720     @@ -92,8 +97,11 @@ static int opal_set_rtc_time(struct device *dev, struct rtc_time *tm)
1721     rc = opal_rtc_write(y_m_d, h_m_s_ms);
1722     if (rc == OPAL_BUSY_EVENT)
1723     opal_poll_events(NULL);
1724     - else
1725     + else if (retries-- && (rc == OPAL_HARDWARE
1726     + || rc == OPAL_INTERNAL_ERROR))
1727     msleep(10);
1728     + else if (rc != OPAL_BUSY && rc != OPAL_BUSY_EVENT)
1729     + break;
1730     }
1731    
1732     return rc == OPAL_SUCCESS ? 0 : -EIO;
1733     diff --git a/drivers/scsi/smartpqi/Makefile b/drivers/scsi/smartpqi/Makefile
1734     index 0f42a225a664..e6b779930230 100644
1735     --- a/drivers/scsi/smartpqi/Makefile
1736     +++ b/drivers/scsi/smartpqi/Makefile
1737     @@ -1,3 +1,3 @@
1738     ccflags-y += -I.
1739     -obj-m += smartpqi.o
1740     +obj-$(CONFIG_SCSI_SMARTPQI) += smartpqi.o
1741     smartpqi-objs := smartpqi_init.o smartpqi_sis.o smartpqi_sas_transport.o
1742     diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c
1743     index e116f0e845c0..98f75e5811c8 100644
1744     --- a/drivers/target/iscsi/iscsi_target_auth.c
1745     +++ b/drivers/target/iscsi/iscsi_target_auth.c
1746     @@ -413,7 +413,8 @@ static int chap_server_compute_md5(
1747     auth_ret = 0;
1748     out:
1749     kzfree(desc);
1750     - crypto_free_shash(tfm);
1751     + if (tfm)
1752     + crypto_free_shash(tfm);
1753     kfree(challenge);
1754     kfree(challenge_binhex);
1755     return auth_ret;
1756     diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
1757     index 644e978cbd3e..0103f777b97a 100644
1758     --- a/drivers/usb/Kconfig
1759     +++ b/drivers/usb/Kconfig
1760     @@ -19,6 +19,14 @@ config USB_EHCI_BIG_ENDIAN_MMIO
1761     config USB_EHCI_BIG_ENDIAN_DESC
1762     bool
1763    
1764     +config USB_UHCI_BIG_ENDIAN_MMIO
1765     + bool
1766     + default y if SPARC_LEON
1767     +
1768     +config USB_UHCI_BIG_ENDIAN_DESC
1769     + bool
1770     + default y if SPARC_LEON
1771     +
1772     menuconfig USB_SUPPORT
1773     bool "USB support"
1774     depends on HAS_IOMEM
1775     diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
1776     index eb121b2a55d4..0e7cc71b34a9 100644
1777     --- a/drivers/usb/host/Kconfig
1778     +++ b/drivers/usb/host/Kconfig
1779     @@ -628,14 +628,6 @@ config USB_UHCI_PLATFORM
1780     bool
1781     default y if ARCH_VT8500
1782    
1783     -config USB_UHCI_BIG_ENDIAN_MMIO
1784     - bool
1785     - default y if SPARC_LEON
1786     -
1787     -config USB_UHCI_BIG_ENDIAN_DESC
1788     - bool
1789     - default y if SPARC_LEON
1790     -
1791     config USB_FHCI_HCD
1792     tristate "Freescale QE USB Host Controller support"
1793     depends on OF_GPIO && QE_GPIO && QUICC_ENGINE
1794     diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
1795     index 9269d5685239..b90ef96e43d6 100644
1796     --- a/drivers/video/console/dummycon.c
1797     +++ b/drivers/video/console/dummycon.c
1798     @@ -67,7 +67,6 @@ const struct consw dummy_con = {
1799     .con_switch = DUMMY,
1800     .con_blank = DUMMY,
1801     .con_font_set = DUMMY,
1802     - .con_font_get = DUMMY,
1803     .con_font_default = DUMMY,
1804     .con_font_copy = DUMMY,
1805     };
1806     diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
1807     index 669ecc755fa9..8f439fd58db6 100644
1808     --- a/drivers/video/fbdev/atmel_lcdfb.c
1809     +++ b/drivers/video/fbdev/atmel_lcdfb.c
1810     @@ -1119,7 +1119,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
1811     goto put_display_node;
1812     }
1813    
1814     - timings_np = of_find_node_by_name(display_np, "display-timings");
1815     + timings_np = of_get_child_by_name(display_np, "display-timings");
1816     if (!timings_np) {
1817     dev_err(dev, "failed to find display-timings node\n");
1818     ret = -ENODEV;
1819     @@ -1140,6 +1140,12 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
1820     fb_add_videomode(&fb_vm, &info->modelist);
1821     }
1822    
1823     + /*
1824     + * FIXME: Make sure we are not referencing any fields in display_np
1825     + * and timings_np and drop our references to them before returning to
1826     + * avoid leaking the nodes on probe deferral and driver unbind.
1827     + */
1828     +
1829     return 0;
1830    
1831     put_timings_node:
1832     diff --git a/drivers/video/fbdev/geode/video_gx.c b/drivers/video/fbdev/geode/video_gx.c
1833     index 6082f653c68a..67773e8bbb95 100644
1834     --- a/drivers/video/fbdev/geode/video_gx.c
1835     +++ b/drivers/video/fbdev/geode/video_gx.c
1836     @@ -127,7 +127,7 @@ void gx_set_dclk_frequency(struct fb_info *info)
1837     int timeout = 1000;
1838    
1839     /* Rev. 1 Geode GXs use a 14 MHz reference clock instead of 48 MHz. */
1840     - if (cpu_data(0).x86_mask == 1) {
1841     + if (cpu_data(0).x86_stepping == 1) {
1842     pll_table = gx_pll_table_14MHz;
1843     pll_table_len = ARRAY_SIZE(gx_pll_table_14MHz);
1844     } else {
1845     diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
1846     index a8a1fb40e258..d196ce4be31c 100644
1847     --- a/fs/btrfs/inode.c
1848     +++ b/fs/btrfs/inode.c
1849     @@ -1320,8 +1320,11 @@ static noinline int run_delalloc_nocow(struct inode *inode,
1850     leaf = path->nodes[0];
1851     if (path->slots[0] >= btrfs_header_nritems(leaf)) {
1852     ret = btrfs_next_leaf(root, path);
1853     - if (ret < 0)
1854     + if (ret < 0) {
1855     + if (cow_start != (u64)-1)
1856     + cur_offset = cow_start;
1857     goto error;
1858     + }
1859     if (ret > 0)
1860     break;
1861     leaf = path->nodes[0];
1862     @@ -5226,7 +5229,7 @@ void btrfs_evict_inode(struct inode *inode)
1863     trace_btrfs_inode_evict(inode);
1864    
1865     if (!root) {
1866     - kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
1867     + clear_inode(inode);
1868     return;
1869     }
1870    
1871     diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
1872     index 309313b71617..5539f0b95efa 100644
1873     --- a/fs/btrfs/tree-log.c
1874     +++ b/fs/btrfs/tree-log.c
1875     @@ -28,6 +28,7 @@
1876     #include "hash.h"
1877     #include "compression.h"
1878     #include "qgroup.h"
1879     +#include "inode-map.h"
1880    
1881     /* magic values for the inode_only field in btrfs_log_inode:
1882     *
1883     @@ -2463,6 +2464,9 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
1884     next);
1885     btrfs_wait_tree_block_writeback(next);
1886     btrfs_tree_unlock(next);
1887     + } else {
1888     + if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &next->bflags))
1889     + clear_extent_buffer_dirty(next);
1890     }
1891    
1892     WARN_ON(root_owner !=
1893     @@ -2542,6 +2546,9 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
1894     next);
1895     btrfs_wait_tree_block_writeback(next);
1896     btrfs_tree_unlock(next);
1897     + } else {
1898     + if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &next->bflags))
1899     + clear_extent_buffer_dirty(next);
1900     }
1901    
1902     WARN_ON(root_owner != BTRFS_TREE_LOG_OBJECTID);
1903     @@ -2618,6 +2625,9 @@ static int walk_log_tree(struct btrfs_trans_handle *trans,
1904     clean_tree_block(trans, log->fs_info, next);
1905     btrfs_wait_tree_block_writeback(next);
1906     btrfs_tree_unlock(next);
1907     + } else {
1908     + if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &next->bflags))
1909     + clear_extent_buffer_dirty(next);
1910     }
1911    
1912     WARN_ON(log->root_key.objectid !=
1913     @@ -3004,13 +3014,14 @@ static void free_log_tree(struct btrfs_trans_handle *trans,
1914    
1915     while (1) {
1916     ret = find_first_extent_bit(&log->dirty_log_pages,
1917     - 0, &start, &end, EXTENT_DIRTY | EXTENT_NEW,
1918     + 0, &start, &end,
1919     + EXTENT_DIRTY | EXTENT_NEW | EXTENT_NEED_WAIT,
1920     NULL);
1921     if (ret)
1922     break;
1923    
1924     clear_extent_bits(&log->dirty_log_pages, start, end,
1925     - EXTENT_DIRTY | EXTENT_NEW);
1926     + EXTENT_DIRTY | EXTENT_NEW | EXTENT_NEED_WAIT);
1927     }
1928    
1929     /*
1930     @@ -5651,6 +5662,23 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
1931     path);
1932     }
1933    
1934     + if (!ret && wc.stage == LOG_WALK_REPLAY_ALL) {
1935     + struct btrfs_root *root = wc.replay_dest;
1936     +
1937     + btrfs_release_path(path);
1938     +
1939     + /*
1940     + * We have just replayed everything, and the highest
1941     + * objectid of fs roots probably has changed in case
1942     + * some inode_item's got replayed.
1943     + *
1944     + * root->objectid_mutex is not acquired as log replay
1945     + * could only happen during mount.
1946     + */
1947     + ret = btrfs_find_highest_objectid(root,
1948     + &root->highest_objectid);
1949     + }
1950     +
1951     key.offset = found_key.offset - 1;
1952     wc.replay_dest->log_root = NULL;
1953     free_extent_buffer(log->node);
1954     diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
1955     index ec28e8ebb984..5cccec68a0a5 100644
1956     --- a/fs/ext4/inode.c
1957     +++ b/fs/ext4/inode.c
1958     @@ -3526,10 +3526,18 @@ static ssize_t ext4_direct_IO_write(struct kiocb *iocb, struct iov_iter *iter)
1959     /* Credits for sb + inode write */
1960     handle = ext4_journal_start(inode, EXT4_HT_INODE, 2);
1961     if (IS_ERR(handle)) {
1962     - /* This is really bad luck. We've written the data
1963     - * but cannot extend i_size. Bail out and pretend
1964     - * the write failed... */
1965     - ret = PTR_ERR(handle);
1966     + /*
1967     + * We wrote the data but cannot extend
1968     + * i_size. Bail out. In async io case, we do
1969     + * not return error here because we have
1970     + * already submmitted the corresponding
1971     + * bio. Returning error here makes the caller
1972     + * think that this IO is done and failed
1973     + * resulting in race with bio's completion
1974     + * handler.
1975     + */
1976     + if (!ret)
1977     + ret = PTR_ERR(handle);
1978     if (inode->i_nlink)
1979     ext4_orphan_del(NULL, inode);
1980    
1981     diff --git a/fs/ext4/super.c b/fs/ext4/super.c
1982     index 1f581791b39d..1ec4b6e34747 100644
1983     --- a/fs/ext4/super.c
1984     +++ b/fs/ext4/super.c
1985     @@ -720,6 +720,7 @@ __acquires(bitlock)
1986     }
1987    
1988     ext4_unlock_group(sb, grp);
1989     + ext4_commit_super(sb, 1);
1990     ext4_handle_error(sb);
1991     /*
1992     * We only get here in the ERRORS_RO case; relocking the group
1993     diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
1994     index 5e659ee08d6a..4e5c6103b76c 100644
1995     --- a/fs/jbd2/transaction.c
1996     +++ b/fs/jbd2/transaction.c
1997     @@ -488,8 +488,10 @@ void jbd2_journal_free_reserved(handle_t *handle)
1998     EXPORT_SYMBOL(jbd2_journal_free_reserved);
1999    
2000     /**
2001     - * int jbd2_journal_start_reserved(handle_t *handle) - start reserved handle
2002     + * int jbd2_journal_start_reserved() - start reserved handle
2003     * @handle: handle to start
2004     + * @type: for handle statistics
2005     + * @line_no: for handle statistics
2006     *
2007     * Start handle that has been previously reserved with jbd2_journal_reserve().
2008     * This attaches @handle to the running transaction (or creates one if there's
2009     @@ -619,6 +621,7 @@ int jbd2_journal_extend(handle_t *handle, int nblocks)
2010     * int jbd2_journal_restart() - restart a handle .
2011     * @handle: handle to restart
2012     * @nblocks: nr credits requested
2013     + * @gfp_mask: memory allocation flags (for start_this_handle)
2014     *
2015     * Restart a handle for a multi-transaction filesystem
2016     * operation.
2017     diff --git a/fs/mbcache.c b/fs/mbcache.c
2018     index c5bd19ffa326..27e6bf6f09c6 100644
2019     --- a/fs/mbcache.c
2020     +++ b/fs/mbcache.c
2021     @@ -93,6 +93,7 @@ int mb_cache_entry_create(struct mb_cache *cache, gfp_t mask, u32 key,
2022     entry->e_key = key;
2023     entry->e_block = block;
2024     entry->e_reusable = reusable;
2025     + entry->e_referenced = 0;
2026     head = mb_cache_entry_head(cache, key);
2027     hlist_bl_lock(head);
2028     hlist_bl_for_each_entry(dup, dup_node, head, e_hash_list) {
2029     diff --git a/fs/namei.c b/fs/namei.c
2030     index e7d125c23aa6..6cfb45f262aa 100644
2031     --- a/fs/namei.c
2032     +++ b/fs/namei.c
2033     @@ -2138,6 +2138,9 @@ static const char *path_init(struct nameidata *nd, unsigned flags)
2034     int retval = 0;
2035     const char *s = nd->name->name;
2036    
2037     + if (!*s)
2038     + flags &= ~LOOKUP_RCU;
2039     +
2040     nd->last_type = LAST_ROOT; /* if there are only slashes... */
2041     nd->flags = flags | LOOKUP_JUMPED | LOOKUP_PARENT;
2042     nd->depth = 0;
2043     diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
2044     index 8dce4099a6ca..785fcc29d85d 100644
2045     --- a/fs/ocfs2/dlmglue.c
2046     +++ b/fs/ocfs2/dlmglue.c
2047     @@ -2485,6 +2485,15 @@ int ocfs2_inode_lock_with_page(struct inode *inode,
2048     ret = ocfs2_inode_lock_full(inode, ret_bh, ex, OCFS2_LOCK_NONBLOCK);
2049     if (ret == -EAGAIN) {
2050     unlock_page(page);
2051     + /*
2052     + * If we can't get inode lock immediately, we should not return
2053     + * directly here, since this will lead to a softlockup problem.
2054     + * The method is to get a blocking lock and immediately unlock
2055     + * before returning, this can avoid CPU resource waste due to
2056     + * lots of retries, and benefits fairness in getting lock.
2057     + */
2058     + if (ocfs2_inode_lock(inode, ret_bh, ex) == 0)
2059     + ocfs2_inode_unlock(inode, ex);
2060     ret = AOP_TRUNCATED_PAGE;
2061     }
2062    
2063     diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
2064     index 928e5ca0caee..eb0ed31193a3 100644
2065     --- a/include/linux/compiler-gcc.h
2066     +++ b/include/linux/compiler-gcc.h
2067     @@ -187,6 +187,10 @@
2068     #endif /* __CHECKER__ */
2069     #endif /* GCC_VERSION >= 40300 */
2070    
2071     +#if GCC_VERSION >= 40400
2072     +#define __optimize(level) __attribute__((__optimize__(level)))
2073     +#endif /* GCC_VERSION >= 40400 */
2074     +
2075     #if GCC_VERSION >= 40500
2076    
2077     #ifndef __CHECKER__
2078     diff --git a/include/linux/compiler.h b/include/linux/compiler.h
2079     index cf0fa5d86059..5ce911db7d88 100644
2080     --- a/include/linux/compiler.h
2081     +++ b/include/linux/compiler.h
2082     @@ -469,6 +469,10 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
2083     # define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
2084     #endif
2085    
2086     +#ifndef __optimize
2087     +# define __optimize(level)
2088     +#endif
2089     +
2090     /* Compile time object size, -1 for unknown */
2091     #ifndef __compiletime_object_size
2092     # define __compiletime_object_size(obj) -1
2093     diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
2094     index dfaa1f4dcb0c..d073470cb342 100644
2095     --- a/include/linux/jbd2.h
2096     +++ b/include/linux/jbd2.h
2097     @@ -418,26 +418,41 @@ static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
2098     #define JI_WAIT_DATA (1 << __JI_WAIT_DATA)
2099    
2100     /**
2101     - * struct jbd_inode is the structure linking inodes in ordered mode
2102     - * present in a transaction so that we can sync them during commit.
2103     + * struct jbd_inode - The jbd_inode type is the structure linking inodes in
2104     + * ordered mode present in a transaction so that we can sync them during commit.
2105     */
2106     struct jbd2_inode {
2107     - /* Which transaction does this inode belong to? Either the running
2108     - * transaction or the committing one. [j_list_lock] */
2109     + /**
2110     + * @i_transaction:
2111     + *
2112     + * Which transaction does this inode belong to? Either the running
2113     + * transaction or the committing one. [j_list_lock]
2114     + */
2115     transaction_t *i_transaction;
2116    
2117     - /* Pointer to the running transaction modifying inode's data in case
2118     - * there is already a committing transaction touching it. [j_list_lock] */
2119     + /**
2120     + * @i_next_transaction:
2121     + *
2122     + * Pointer to the running transaction modifying inode's data in case
2123     + * there is already a committing transaction touching it. [j_list_lock]
2124     + */
2125     transaction_t *i_next_transaction;
2126    
2127     - /* List of inodes in the i_transaction [j_list_lock] */
2128     + /**
2129     + * @i_list: List of inodes in the i_transaction [j_list_lock]
2130     + */
2131     struct list_head i_list;
2132    
2133     - /* VFS inode this inode belongs to [constant during the lifetime
2134     - * of the structure] */
2135     + /**
2136     + * @i_vfs_inode:
2137     + *
2138     + * VFS inode this inode belongs to [constant for lifetime of structure]
2139     + */
2140     struct inode *i_vfs_inode;
2141    
2142     - /* Flags of inode [j_list_lock] */
2143     + /**
2144     + * @i_flags: Flags of inode [j_list_lock]
2145     + */
2146     unsigned long i_flags;
2147     };
2148    
2149     @@ -447,12 +462,20 @@ struct jbd2_revoke_table_s;
2150     * struct handle_s - The handle_s type is the concrete type associated with
2151     * handle_t.
2152     * @h_transaction: Which compound transaction is this update a part of?
2153     + * @h_journal: Which journal handle belongs to - used iff h_reserved set.
2154     + * @h_rsv_handle: Handle reserved for finishing the logical operation.
2155     * @h_buffer_credits: Number of remaining buffers we are allowed to dirty.
2156     - * @h_ref: Reference count on this handle
2157     - * @h_err: Field for caller's use to track errors through large fs operations
2158     - * @h_sync: flag for sync-on-close
2159     - * @h_jdata: flag to force data journaling
2160     - * @h_aborted: flag indicating fatal error on handle
2161     + * @h_ref: Reference count on this handle.
2162     + * @h_err: Field for caller's use to track errors through large fs operations.
2163     + * @h_sync: Flag for sync-on-close.
2164     + * @h_jdata: Flag to force data journaling.
2165     + * @h_reserved: Flag for handle for reserved credits.
2166     + * @h_aborted: Flag indicating fatal error on handle.
2167     + * @h_type: For handle statistics.
2168     + * @h_line_no: For handle statistics.
2169     + * @h_start_jiffies: Handle Start time.
2170     + * @h_requested_credits: Holds @h_buffer_credits after handle is started.
2171     + * @saved_alloc_context: Saved context while transaction is open.
2172     **/
2173    
2174     /* Docbook can't yet cope with the bit fields, but will leave the documentation
2175     @@ -462,32 +485,23 @@ struct jbd2_revoke_table_s;
2176     struct jbd2_journal_handle
2177     {
2178     union {
2179     - /* Which compound transaction is this update a part of? */
2180     transaction_t *h_transaction;
2181     /* Which journal handle belongs to - used iff h_reserved set */
2182     journal_t *h_journal;
2183     };
2184    
2185     - /* Handle reserved for finishing the logical operation */
2186     handle_t *h_rsv_handle;
2187     -
2188     - /* Number of remaining buffers we are allowed to dirty: */
2189     int h_buffer_credits;
2190     -
2191     - /* Reference count on this handle */
2192     int h_ref;
2193     -
2194     - /* Field for caller's use to track errors through large fs */
2195     - /* operations */
2196     int h_err;
2197    
2198     /* Flags [no locking] */
2199     - unsigned int h_sync: 1; /* sync-on-close */
2200     - unsigned int h_jdata: 1; /* force data journaling */
2201     - unsigned int h_reserved: 1; /* handle with reserved credits */
2202     - unsigned int h_aborted: 1; /* fatal error on handle */
2203     - unsigned int h_type: 8; /* for handle statistics */
2204     - unsigned int h_line_no: 16; /* for handle statistics */
2205     + unsigned int h_sync: 1;
2206     + unsigned int h_jdata: 1;
2207     + unsigned int h_reserved: 1;
2208     + unsigned int h_aborted: 1;
2209     + unsigned int h_type: 8;
2210     + unsigned int h_line_no: 16;
2211    
2212     unsigned long h_start_jiffies;
2213     unsigned int h_requested_credits;
2214     @@ -727,228 +741,253 @@ jbd2_time_diff(unsigned long start, unsigned long end)
2215     /**
2216     * struct journal_s - The journal_s type is the concrete type associated with
2217     * journal_t.
2218     - * @j_flags: General journaling state flags
2219     - * @j_errno: Is there an outstanding uncleared error on the journal (from a
2220     - * prior abort)?
2221     - * @j_sb_buffer: First part of superblock buffer
2222     - * @j_superblock: Second part of superblock buffer
2223     - * @j_format_version: Version of the superblock format
2224     - * @j_state_lock: Protect the various scalars in the journal
2225     - * @j_barrier_count: Number of processes waiting to create a barrier lock
2226     - * @j_barrier: The barrier lock itself
2227     - * @j_running_transaction: The current running transaction..
2228     - * @j_committing_transaction: the transaction we are pushing to disk
2229     - * @j_checkpoint_transactions: a linked circular list of all transactions
2230     - * waiting for checkpointing
2231     - * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction
2232     - * to start committing, or for a barrier lock to be released
2233     - * @j_wait_done_commit: Wait queue for waiting for commit to complete
2234     - * @j_wait_commit: Wait queue to trigger commit
2235     - * @j_wait_updates: Wait queue to wait for updates to complete
2236     - * @j_wait_reserved: Wait queue to wait for reserved buffer credits to drop
2237     - * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints
2238     - * @j_head: Journal head - identifies the first unused block in the journal
2239     - * @j_tail: Journal tail - identifies the oldest still-used block in the
2240     - * journal.
2241     - * @j_free: Journal free - how many free blocks are there in the journal?
2242     - * @j_first: The block number of the first usable block
2243     - * @j_last: The block number one beyond the last usable block
2244     - * @j_dev: Device where we store the journal
2245     - * @j_blocksize: blocksize for the location where we store the journal.
2246     - * @j_blk_offset: starting block offset for into the device where we store the
2247     - * journal
2248     - * @j_fs_dev: Device which holds the client fs. For internal journal this will
2249     - * be equal to j_dev
2250     - * @j_reserved_credits: Number of buffers reserved from the running transaction
2251     - * @j_maxlen: Total maximum capacity of the journal region on disk.
2252     - * @j_list_lock: Protects the buffer lists and internal buffer state.
2253     - * @j_inode: Optional inode where we store the journal. If present, all journal
2254     - * block numbers are mapped into this inode via bmap().
2255     - * @j_tail_sequence: Sequence number of the oldest transaction in the log
2256     - * @j_transaction_sequence: Sequence number of the next transaction to grant
2257     - * @j_commit_sequence: Sequence number of the most recently committed
2258     - * transaction
2259     - * @j_commit_request: Sequence number of the most recent transaction wanting
2260     - * commit
2261     - * @j_uuid: Uuid of client object.
2262     - * @j_task: Pointer to the current commit thread for this journal
2263     - * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a
2264     - * single compound commit transaction
2265     - * @j_commit_interval: What is the maximum transaction lifetime before we begin
2266     - * a commit?
2267     - * @j_commit_timer: The timer used to wakeup the commit thread
2268     - * @j_revoke_lock: Protect the revoke table
2269     - * @j_revoke: The revoke table - maintains the list of revoked blocks in the
2270     - * current transaction.
2271     - * @j_revoke_table: alternate revoke tables for j_revoke
2272     - * @j_wbuf: array of buffer_heads for jbd2_journal_commit_transaction
2273     - * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
2274     - * number that will fit in j_blocksize
2275     - * @j_last_sync_writer: most recent pid which did a synchronous write
2276     - * @j_history_lock: Protect the transactions statistics history
2277     - * @j_proc_entry: procfs entry for the jbd statistics directory
2278     - * @j_stats: Overall statistics
2279     - * @j_private: An opaque pointer to fs-private information.
2280     - * @j_trans_commit_map: Lockdep entity to track transaction commit dependencies
2281     */
2282     -
2283     struct journal_s
2284     {
2285     - /* General journaling state flags [j_state_lock] */
2286     + /**
2287     + * @j_flags: General journaling state flags [j_state_lock]
2288     + */
2289     unsigned long j_flags;
2290    
2291     - /*
2292     + /**
2293     + * @j_errno:
2294     + *
2295     * Is there an outstanding uncleared error on the journal (from a prior
2296     * abort)? [j_state_lock]
2297     */
2298     int j_errno;
2299    
2300     - /* The superblock buffer */
2301     + /**
2302     + * @j_sb_buffer: The first part of the superblock buffer.
2303     + */
2304     struct buffer_head *j_sb_buffer;
2305     +
2306     + /**
2307     + * @j_superblock: The second part of the superblock buffer.
2308     + */
2309     journal_superblock_t *j_superblock;
2310    
2311     - /* Version of the superblock format */
2312     + /**
2313     + * @j_format_version: Version of the superblock format.
2314     + */
2315     int j_format_version;
2316    
2317     - /*
2318     - * Protect the various scalars in the journal
2319     + /**
2320     + * @j_state_lock: Protect the various scalars in the journal.
2321     */
2322     rwlock_t j_state_lock;
2323    
2324     - /*
2325     + /**
2326     + * @j_barrier_count:
2327     + *
2328     * Number of processes waiting to create a barrier lock [j_state_lock]
2329     */
2330     int j_barrier_count;
2331    
2332     - /* The barrier lock itself */
2333     + /**
2334     + * @j_barrier: The barrier lock itself.
2335     + */
2336     struct mutex j_barrier;
2337    
2338     - /*
2339     + /**
2340     + * @j_running_transaction:
2341     + *
2342     * Transactions: The current running transaction...
2343     * [j_state_lock] [caller holding open handle]
2344     */
2345     transaction_t *j_running_transaction;
2346    
2347     - /*
2348     + /**
2349     + * @j_committing_transaction:
2350     + *
2351     * the transaction we are pushing to disk
2352     * [j_state_lock] [caller holding open handle]
2353     */
2354     transaction_t *j_committing_transaction;
2355    
2356     - /*
2357     + /**
2358     + * @j_checkpoint_transactions:
2359     + *
2360     * ... and a linked circular list of all transactions waiting for
2361     * checkpointing. [j_list_lock]
2362     */
2363     transaction_t *j_checkpoint_transactions;
2364    
2365     - /*
2366     + /**
2367     + * @j_wait_transaction_locked:
2368     + *
2369     * Wait queue for waiting for a locked transaction to start committing,
2370     - * or for a barrier lock to be released
2371     + * or for a barrier lock to be released.
2372     */
2373     wait_queue_head_t j_wait_transaction_locked;
2374    
2375     - /* Wait queue for waiting for commit to complete */
2376     + /**
2377     + * @j_wait_done_commit: Wait queue for waiting for commit to complete.
2378     + */
2379     wait_queue_head_t j_wait_done_commit;
2380    
2381     - /* Wait queue to trigger commit */
2382     + /**
2383     + * @j_wait_commit: Wait queue to trigger commit.
2384     + */
2385     wait_queue_head_t j_wait_commit;
2386    
2387     - /* Wait queue to wait for updates to complete */
2388     + /**
2389     + * @j_wait_updates: Wait queue to wait for updates to complete.
2390     + */
2391     wait_queue_head_t j_wait_updates;
2392    
2393     - /* Wait queue to wait for reserved buffer credits to drop */
2394     + /**
2395     + * @j_wait_reserved:
2396     + *
2397     + * Wait queue to wait for reserved buffer credits to drop.
2398     + */
2399     wait_queue_head_t j_wait_reserved;
2400    
2401     - /* Semaphore for locking against concurrent checkpoints */
2402     + /**
2403     + * @j_checkpoint_mutex:
2404     + *
2405     + * Semaphore for locking against concurrent checkpoints.
2406     + */
2407     struct mutex j_checkpoint_mutex;
2408    
2409     - /*
2410     + /**
2411     + * @j_chkpt_bhs:
2412     + *
2413     * List of buffer heads used by the checkpoint routine. This
2414     * was moved from jbd2_log_do_checkpoint() to reduce stack
2415     * usage. Access to this array is controlled by the
2416     - * j_checkpoint_mutex. [j_checkpoint_mutex]
2417     + * @j_checkpoint_mutex. [j_checkpoint_mutex]
2418     */
2419     struct buffer_head *j_chkpt_bhs[JBD2_NR_BATCH];
2420     -
2421     - /*
2422     +
2423     + /**
2424     + * @j_head:
2425     + *
2426     * Journal head: identifies the first unused block in the journal.
2427     * [j_state_lock]
2428     */
2429     unsigned long j_head;
2430    
2431     - /*
2432     + /**
2433     + * @j_tail:
2434     + *
2435     * Journal tail: identifies the oldest still-used block in the journal.
2436     * [j_state_lock]
2437     */
2438     unsigned long j_tail;
2439    
2440     - /*
2441     + /**
2442     + * @j_free:
2443     + *
2444     * Journal free: how many free blocks are there in the journal?
2445     * [j_state_lock]
2446     */
2447     unsigned long j_free;
2448    
2449     - /*
2450     - * Journal start and end: the block numbers of the first usable block
2451     - * and one beyond the last usable block in the journal. [j_state_lock]
2452     + /**
2453     + * @j_first:
2454     + *
2455     + * The block number of the first usable block in the journal
2456     + * [j_state_lock].
2457     */
2458     unsigned long j_first;
2459     +
2460     + /**
2461     + * @j_last:
2462     + *
2463     + * The block number one beyond the last usable block in the journal
2464     + * [j_state_lock].
2465     + */
2466     unsigned long j_last;
2467    
2468     - /*
2469     - * Device, blocksize and starting block offset for the location where we
2470     - * store the journal.
2471     + /**
2472     + * @j_dev: Device where we store the journal.
2473     */
2474     struct block_device *j_dev;
2475     +
2476     + /**
2477     + * @j_blocksize: Block size for the location where we store the journal.
2478     + */
2479     int j_blocksize;
2480     +
2481     + /**
2482     + * @j_blk_offset:
2483     + *
2484     + * Starting block offset into the device where we store the journal.
2485     + */
2486     unsigned long long j_blk_offset;
2487     +
2488     + /**
2489     + * @j_devname: Journal device name.
2490     + */
2491     char j_devname[BDEVNAME_SIZE+24];
2492    
2493     - /*
2494     + /**
2495     + * @j_fs_dev:
2496     + *
2497     * Device which holds the client fs. For internal journal this will be
2498     * equal to j_dev.
2499     */
2500     struct block_device *j_fs_dev;
2501    
2502     - /* Total maximum capacity of the journal region on disk. */
2503     + /**
2504     + * @j_maxlen: Total maximum capacity of the journal region on disk.
2505     + */
2506     unsigned int j_maxlen;
2507    
2508     - /* Number of buffers reserved from the running transaction */
2509     + /**
2510     + * @j_reserved_credits:
2511     + *
2512     + * Number of buffers reserved from the running transaction.
2513     + */
2514     atomic_t j_reserved_credits;
2515    
2516     - /*
2517     - * Protects the buffer lists and internal buffer state.
2518     + /**
2519     + * @j_list_lock: Protects the buffer lists and internal buffer state.
2520     */
2521     spinlock_t j_list_lock;
2522    
2523     - /* Optional inode where we store the journal. If present, all */
2524     - /* journal block numbers are mapped into this inode via */
2525     - /* bmap(). */
2526     + /**
2527     + * @j_inode:
2528     + *
2529     + * Optional inode where we store the journal. If present, all
2530     + * journal block numbers are mapped into this inode via bmap().
2531     + */
2532     struct inode *j_inode;
2533    
2534     - /*
2535     + /**
2536     + * @j_tail_sequence:
2537     + *
2538     * Sequence number of the oldest transaction in the log [j_state_lock]
2539     */
2540     tid_t j_tail_sequence;
2541    
2542     - /*
2543     + /**
2544     + * @j_transaction_sequence:
2545     + *
2546     * Sequence number of the next transaction to grant [j_state_lock]
2547     */
2548     tid_t j_transaction_sequence;
2549    
2550     - /*
2551     + /**
2552     + * @j_commit_sequence:
2553     + *
2554     * Sequence number of the most recently committed transaction
2555     * [j_state_lock].
2556     */
2557     tid_t j_commit_sequence;
2558    
2559     - /*
2560     + /**
2561     + * @j_commit_request:
2562     + *
2563     * Sequence number of the most recent transaction wanting commit
2564     * [j_state_lock]
2565     */
2566     tid_t j_commit_request;
2567    
2568     - /*
2569     + /**
2570     + * @j_uuid:
2571     + *
2572     * Journal uuid: identifies the object (filesystem, LVM volume etc)
2573     * backed by this journal. This will eventually be replaced by an array
2574     * of uuids, allowing us to index multiple devices within a single
2575     @@ -956,85 +995,151 @@ struct journal_s
2576     */
2577     __u8 j_uuid[16];
2578    
2579     - /* Pointer to the current commit thread for this journal */
2580     + /**
2581     + * @j_task: Pointer to the current commit thread for this journal.
2582     + */
2583     struct task_struct *j_task;
2584    
2585     - /*
2586     + /**
2587     + * @j_max_transaction_buffers:
2588     + *
2589     * Maximum number of metadata buffers to allow in a single compound
2590     - * commit transaction
2591     + * commit transaction.
2592     */
2593     int j_max_transaction_buffers;
2594    
2595     - /*
2596     + /**
2597     + * @j_commit_interval:
2598     + *
2599     * What is the maximum transaction lifetime before we begin a commit?
2600     */
2601     unsigned long j_commit_interval;
2602    
2603     - /* The timer used to wakeup the commit thread: */
2604     + /**
2605     + * @j_commit_timer: The timer used to wakeup the commit thread.
2606     + */
2607     struct timer_list j_commit_timer;
2608    
2609     - /*
2610     - * The revoke table: maintains the list of revoked blocks in the
2611     - * current transaction. [j_revoke_lock]
2612     + /**
2613     + * @j_revoke_lock: Protect the revoke table.
2614     */
2615     spinlock_t j_revoke_lock;
2616     +
2617     + /**
2618     + * @j_revoke:
2619     + *
2620     + * The revoke table - maintains the list of revoked blocks in the
2621     + * current transaction.
2622     + */
2623     struct jbd2_revoke_table_s *j_revoke;
2624     +
2625     + /**
2626     + * @j_revoke_table: Alternate revoke tables for j_revoke.
2627     + */
2628     struct jbd2_revoke_table_s *j_revoke_table[2];
2629    
2630     - /*
2631     - * array of bhs for jbd2_journal_commit_transaction
2632     + /**
2633     + * @j_wbuf: Array of bhs for jbd2_journal_commit_transaction.
2634     */
2635     struct buffer_head **j_wbuf;
2636     +
2637     + /**
2638     + * @j_wbufsize:
2639     + *
2640     + * Size of @j_wbuf array.
2641     + */
2642     int j_wbufsize;
2643    
2644     - /*
2645     - * this is the pid of hte last person to run a synchronous operation
2646     - * through the journal
2647     + /**
2648     + * @j_last_sync_writer:
2649     + *
2650     + * The pid of the last person to run a synchronous operation
2651     + * through the journal.
2652     */
2653     pid_t j_last_sync_writer;
2654    
2655     - /*
2656     - * the average amount of time in nanoseconds it takes to commit a
2657     + /**
2658     + * @j_average_commit_time:
2659     + *
2660     + * The average amount of time in nanoseconds it takes to commit a
2661     * transaction to disk. [j_state_lock]
2662     */
2663     u64 j_average_commit_time;
2664    
2665     - /*
2666     - * minimum and maximum times that we should wait for
2667     - * additional filesystem operations to get batched into a
2668     - * synchronous handle in microseconds
2669     + /**
2670     + * @j_min_batch_time:
2671     + *
2672     + * Minimum time that we should wait for additional filesystem operations
2673     + * to get batched into a synchronous handle in microseconds.
2674     */
2675     u32 j_min_batch_time;
2676     +
2677     + /**
2678     + * @j_max_batch_time:
2679     + *
2680     + * Maximum time that we should wait for additional filesystem operations
2681     + * to get batched into a synchronous handle in microseconds.
2682     + */
2683     u32 j_max_batch_time;
2684    
2685     - /* This function is called when a transaction is closed */
2686     + /**
2687     + * @j_commit_callback:
2688     + *
2689     + * This function is called when a transaction is closed.
2690     + */
2691     void (*j_commit_callback)(journal_t *,
2692     transaction_t *);
2693    
2694     /*
2695     * Journal statistics
2696     */
2697     +
2698     + /**
2699     + * @j_history_lock: Protect the transactions statistics history.
2700     + */
2701     spinlock_t j_history_lock;
2702     +
2703     + /**
2704     + * @j_proc_entry: procfs entry for the jbd statistics directory.
2705     + */
2706     struct proc_dir_entry *j_proc_entry;
2707     +
2708     + /**
2709     + * @j_stats: Overall statistics.
2710     + */
2711     struct transaction_stats_s j_stats;
2712    
2713     - /* Failed journal commit ID */
2714     + /**
2715     + * @j_failed_commit: Failed journal commit ID.
2716     + */
2717     unsigned int j_failed_commit;
2718    
2719     - /*
2720     + /**
2721     + * @j_private:
2722     + *
2723     * An opaque pointer to fs-private information. ext3 puts its
2724     - * superblock pointer here
2725     + * superblock pointer here.
2726     */
2727     void *j_private;
2728    
2729     - /* Reference to checksum algorithm driver via cryptoapi */
2730     + /**
2731     + * @j_chksum_driver:
2732     + *
2733     + * Reference to checksum algorithm driver via cryptoapi.
2734     + */
2735     struct crypto_shash *j_chksum_driver;
2736    
2737     - /* Precomputed journal UUID checksum for seeding other checksums */
2738     + /**
2739     + * @j_csum_seed:
2740     + *
2741     + * Precomputed journal UUID checksum for seeding other checksums.
2742     + */
2743     __u32 j_csum_seed;
2744    
2745     #ifdef CONFIG_DEBUG_LOCK_ALLOC
2746     - /*
2747     + /**
2748     + * @j_trans_commit_map:
2749     + *
2750     * Lockdep entity to track transaction commit dependencies. Handles
2751     * hold this "lock" for read, when we wait for commit, we acquire the
2752     * "lock" for writing. This matches the properties of jbd2 journalling
2753     diff --git a/include/linux/kaiser.h b/include/linux/kaiser.h
2754     index 58c55b1589d0..b56c19010480 100644
2755     --- a/include/linux/kaiser.h
2756     +++ b/include/linux/kaiser.h
2757     @@ -32,7 +32,7 @@ static inline void kaiser_init(void)
2758     {
2759     }
2760     static inline int kaiser_add_mapping(unsigned long addr,
2761     - unsigned long size, unsigned long flags)
2762     + unsigned long size, u64 flags)
2763     {
2764     return 0;
2765     }
2766     diff --git a/include/linux/nospec.h b/include/linux/nospec.h
2767     index b99bced39ac2..fbc98e2c8228 100644
2768     --- a/include/linux/nospec.h
2769     +++ b/include/linux/nospec.h
2770     @@ -19,20 +19,6 @@
2771     static inline unsigned long array_index_mask_nospec(unsigned long index,
2772     unsigned long size)
2773     {
2774     - /*
2775     - * Warn developers about inappropriate array_index_nospec() usage.
2776     - *
2777     - * Even if the CPU speculates past the WARN_ONCE branch, the
2778     - * sign bit of @index is taken into account when generating the
2779     - * mask.
2780     - *
2781     - * This warning is compiled out when the compiler can infer that
2782     - * @index and @size are less than LONG_MAX.
2783     - */
2784     - if (WARN_ONCE(index > LONG_MAX || size > LONG_MAX,
2785     - "array_index_nospec() limited to range of [0, LONG_MAX]\n"))
2786     - return 0;
2787     -
2788     /*
2789     * Always calculate and emit the mask even if the compiler
2790     * thinks the mask is not needed. The compiler does not take
2791     @@ -43,6 +29,26 @@ static inline unsigned long array_index_mask_nospec(unsigned long index,
2792     }
2793     #endif
2794    
2795     +/*
2796     + * Warn developers about inappropriate array_index_nospec() usage.
2797     + *
2798     + * Even if the CPU speculates past the WARN_ONCE branch, the
2799     + * sign bit of @index is taken into account when generating the
2800     + * mask.
2801     + *
2802     + * This warning is compiled out when the compiler can infer that
2803     + * @index and @size are less than LONG_MAX.
2804     + */
2805     +#define array_index_mask_nospec_check(index, size) \
2806     +({ \
2807     + if (WARN_ONCE(index > LONG_MAX || size > LONG_MAX, \
2808     + "array_index_nospec() limited to range of [0, LONG_MAX]\n")) \
2809     + _mask = 0; \
2810     + else \
2811     + _mask = array_index_mask_nospec(index, size); \
2812     + _mask; \
2813     +})
2814     +
2815     /*
2816     * array_index_nospec - sanitize an array index after a bounds check
2817     *
2818     @@ -61,7 +67,7 @@ static inline unsigned long array_index_mask_nospec(unsigned long index,
2819     ({ \
2820     typeof(index) _i = (index); \
2821     typeof(size) _s = (size); \
2822     - unsigned long _mask = array_index_mask_nospec(_i, _s); \
2823     + unsigned long _mask = array_index_mask_nospec_check(_i, _s); \
2824     \
2825     BUILD_BUG_ON(sizeof(_i) > sizeof(long)); \
2826     BUILD_BUG_ON(sizeof(_s) > sizeof(long)); \
2827     diff --git a/kernel/memremap.c b/kernel/memremap.c
2828     index 06123234f118..426547a21a0c 100644
2829     --- a/kernel/memremap.c
2830     +++ b/kernel/memremap.c
2831     @@ -245,7 +245,8 @@ static void devm_memremap_pages_release(struct device *dev, void *data)
2832    
2833     /* pages are dead and unused, undo the arch mapping */
2834     align_start = res->start & ~(SECTION_SIZE - 1);
2835     - align_size = ALIGN(resource_size(res), SECTION_SIZE);
2836     + align_size = ALIGN(res->start + resource_size(res), SECTION_SIZE)
2837     + - align_start;
2838    
2839     lock_device_hotplug();
2840     mem_hotplug_begin();
2841     diff --git a/mm/memory.c b/mm/memory.c
2842     index 1aa63e7dd790..e2e68767a373 100644
2843     --- a/mm/memory.c
2844     +++ b/mm/memory.c
2845     @@ -75,7 +75,7 @@
2846    
2847     #include "internal.h"
2848    
2849     -#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS
2850     +#if defined(LAST_CPUPID_NOT_IN_PAGE_FLAGS) && !defined(CONFIG_COMPILE_TEST)
2851     #warning Unfortunate NUMA and NUMA Balancing config, growing page-frame for last_cpupid.
2852     #endif
2853    
2854     diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
2855     index f3a4efcf1456..3aa5a93ad107 100644
2856     --- a/net/9p/trans_virtio.c
2857     +++ b/net/9p/trans_virtio.c
2858     @@ -160,7 +160,8 @@ static void req_done(struct virtqueue *vq)
2859     spin_unlock_irqrestore(&chan->lock, flags);
2860     /* Wakeup if anyone waiting for VirtIO ring space. */
2861     wake_up(chan->vc_wq);
2862     - p9_client_cb(chan->client, req, REQ_STATUS_RCVD);
2863     + if (len)
2864     + p9_client_cb(chan->client, req, REQ_STATUS_RCVD);
2865     }
2866     }
2867    
2868     diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
2869     index 16580a82e1c8..0b408617b2c9 100644
2870     --- a/sound/core/seq/seq_clientmgr.c
2871     +++ b/sound/core/seq/seq_clientmgr.c
2872     @@ -999,7 +999,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,
2873     {
2874     struct snd_seq_client *client = file->private_data;
2875     int written = 0, len;
2876     - int err = -EINVAL;
2877     + int err;
2878     struct snd_seq_event event;
2879    
2880     if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_OUTPUT))
2881     @@ -1014,11 +1014,15 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,
2882    
2883     /* allocate the pool now if the pool is not allocated yet */
2884     if (client->pool->size > 0 && !snd_seq_write_pool_allocated(client)) {
2885     - if (snd_seq_pool_init(client->pool) < 0)
2886     + mutex_lock(&client->ioctl_mutex);
2887     + err = snd_seq_pool_init(client->pool);
2888     + mutex_unlock(&client->ioctl_mutex);
2889     + if (err < 0)
2890     return -ENOMEM;
2891     }
2892    
2893     /* only process whole events */
2894     + err = -EINVAL;
2895     while (count >= sizeof(struct snd_seq_event)) {
2896     /* Read in the event header from the user */
2897     len = sizeof(event);
2898     diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2899     index 71a058fcf884..89c166b97e81 100644
2900     --- a/sound/pci/hda/patch_realtek.c
2901     +++ b/sound/pci/hda/patch_realtek.c
2902     @@ -3130,6 +3130,19 @@ static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
2903     spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
2904     }
2905    
2906     +static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
2907     + const struct hda_fixup *fix,
2908     + int action)
2909     +{
2910     + unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
2911     + unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
2912     +
2913     + if (cfg_headphone && cfg_headset_mic == 0x411111f0)
2914     + snd_hda_codec_set_pincfg(codec, 0x19,
2915     + (cfg_headphone & ~AC_DEFCFG_DEVICE) |
2916     + (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
2917     +}
2918     +
2919     static void alc269_fixup_hweq(struct hda_codec *codec,
2920     const struct hda_fixup *fix, int action)
2921     {
2922     @@ -4455,6 +4468,28 @@ static void alc_fixup_tpt440_dock(struct hda_codec *codec,
2923     }
2924     }
2925    
2926     +static void alc_fixup_tpt470_dock(struct hda_codec *codec,
2927     + const struct hda_fixup *fix, int action)
2928     +{
2929     + static const struct hda_pintbl pincfgs[] = {
2930     + { 0x17, 0x21211010 }, /* dock headphone */
2931     + { 0x19, 0x21a11010 }, /* dock mic */
2932     + { }
2933     + };
2934     + struct alc_spec *spec = codec->spec;
2935     +
2936     + if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2937     + spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
2938     + /* Enable DOCK device */
2939     + snd_hda_codec_write(codec, 0x17, 0,
2940     + AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
2941     + /* Enable DOCK device */
2942     + snd_hda_codec_write(codec, 0x19, 0,
2943     + AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
2944     + snd_hda_apply_pincfgs(codec, pincfgs);
2945     + }
2946     +}
2947     +
2948     static void alc_shutup_dell_xps13(struct hda_codec *codec)
2949     {
2950     struct alc_spec *spec = codec->spec;
2951     @@ -4797,6 +4832,7 @@ enum {
2952     ALC269_FIXUP_LIFEBOOK_EXTMIC,
2953     ALC269_FIXUP_LIFEBOOK_HP_PIN,
2954     ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
2955     + ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
2956     ALC269_FIXUP_AMIC,
2957     ALC269_FIXUP_DMIC,
2958     ALC269VB_FIXUP_AMIC,
2959     @@ -4877,6 +4913,7 @@ enum {
2960     ALC292_FIXUP_TPT460,
2961     ALC298_FIXUP_SPK_VOLUME,
2962     ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
2963     + ALC298_FIXUP_TPT470_DOCK,
2964     };
2965    
2966     static const struct hda_fixup alc269_fixups[] = {
2967     @@ -4987,6 +5024,10 @@ static const struct hda_fixup alc269_fixups[] = {
2968     .type = HDA_FIXUP_FUNC,
2969     .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
2970     },
2971     + [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
2972     + .type = HDA_FIXUP_FUNC,
2973     + .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
2974     + },
2975     [ALC269_FIXUP_AMIC] = {
2976     .type = HDA_FIXUP_PINS,
2977     .v.pins = (const struct hda_pintbl[]) {
2978     @@ -5568,6 +5609,12 @@ static const struct hda_fixup alc269_fixups[] = {
2979     .chained = true,
2980     .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
2981     },
2982     + [ALC298_FIXUP_TPT470_DOCK] = {
2983     + .type = HDA_FIXUP_FUNC,
2984     + .v.func = alc_fixup_tpt470_dock,
2985     + .chained = true,
2986     + .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
2987     + },
2988     };
2989    
2990     static const struct snd_pci_quirk alc269_fixup_tbl[] = {
2991     @@ -5704,6 +5751,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
2992     SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
2993     SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
2994     SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
2995     + SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
2996     SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
2997     SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
2998     SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
2999     @@ -5729,8 +5777,16 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3000     SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
3001     SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
3002     SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
3003     + SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
3004     + SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
3005     SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
3006     SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
3007     + SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
3008     + SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
3009     + SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
3010     + SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
3011     + SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
3012     + SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
3013     SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
3014     SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
3015     SND_PCI_QUIRK(0x17aa, 0x3112, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
3016     @@ -5749,7 +5805,12 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3017     SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
3018     SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
3019     SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
3020     + SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
3021     + SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
3022     + SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
3023     SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
3024     + SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
3025     + SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
3026     SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
3027     SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
3028     SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
3029     @@ -5993,6 +6054,11 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
3030     {0x12, 0xb7a60130},
3031     {0x14, 0x90170110},
3032     {0x21, 0x02211020}),
3033     + SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
3034     + {0x12, 0x90a60130},
3035     + {0x14, 0x90170110},
3036     + {0x14, 0x01011020},
3037     + {0x21, 0x0221101f}),
3038     SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
3039     ALC256_STANDARD_PINS),
3040     SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
3041     @@ -6049,6 +6115,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
3042     {0x12, 0x90a60120},
3043     {0x14, 0x90170110},
3044     {0x21, 0x0321101f}),
3045     + SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
3046     + {0x12, 0xb7a60130},
3047     + {0x14, 0x90170110},
3048     + {0x21, 0x04211020}),
3049     SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
3050     ALC290_STANDARD_PINS,
3051     {0x15, 0x04211040},
3052     diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
3053     index 08015c139116..dedf8eb4570e 100644
3054     --- a/sound/usb/mixer.c
3055     +++ b/sound/usb/mixer.c
3056     @@ -344,17 +344,20 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request,
3057     int validx, int *value_ret)
3058     {
3059     struct snd_usb_audio *chip = cval->head.mixer->chip;
3060     - unsigned char buf[4 + 3 * sizeof(__u32)]; /* enough space for one range */
3061     + /* enough space for one range */
3062     + unsigned char buf[sizeof(__u16) + 3 * sizeof(__u32)];
3063     unsigned char *val;
3064     - int idx = 0, ret, size;
3065     + int idx = 0, ret, val_size, size;
3066     __u8 bRequest;
3067    
3068     + val_size = uac2_ctl_value_size(cval->val_type);
3069     +
3070     if (request == UAC_GET_CUR) {
3071     bRequest = UAC2_CS_CUR;
3072     - size = uac2_ctl_value_size(cval->val_type);
3073     + size = val_size;
3074     } else {
3075     bRequest = UAC2_CS_RANGE;
3076     - size = sizeof(buf);
3077     + size = sizeof(__u16) + 3 * val_size;
3078     }
3079    
3080     memset(buf, 0, sizeof(buf));
3081     @@ -387,16 +390,17 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request,
3082     val = buf + sizeof(__u16);
3083     break;
3084     case UAC_GET_MAX:
3085     - val = buf + sizeof(__u16) * 2;
3086     + val = buf + sizeof(__u16) + val_size;
3087     break;
3088     case UAC_GET_RES:
3089     - val = buf + sizeof(__u16) * 3;
3090     + val = buf + sizeof(__u16) + val_size * 2;
3091     break;
3092     default:
3093     return -EINVAL;
3094     }
3095    
3096     - *value_ret = convert_signed_value(cval, snd_usb_combine_bytes(val, sizeof(__u16)));
3097     + *value_ret = convert_signed_value(cval,
3098     + snd_usb_combine_bytes(val, val_size));
3099    
3100     return 0;
3101     }
3102     diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
3103     index cf8459a6fad8..c5dfe82beb24 100644
3104     --- a/sound/usb/pcm.c
3105     +++ b/sound/usb/pcm.c
3106     @@ -352,6 +352,15 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
3107     ep = 0x86;
3108     iface = usb_ifnum_to_if(dev, 2);
3109    
3110     + if (!iface || iface->num_altsetting == 0)
3111     + return -EINVAL;
3112     +
3113     + alts = &iface->altsetting[1];
3114     + goto add_sync_ep;
3115     + case USB_ID(0x1397, 0x0002):
3116     + ep = 0x81;
3117     + iface = usb_ifnum_to_if(dev, 1);
3118     +
3119     if (!iface || iface->num_altsetting == 0)
3120     return -EINVAL;
3121    
3122     diff --git a/tools/testing/selftests/vm/compaction_test.c b/tools/testing/selftests/vm/compaction_test.c
3123     index 6d1437f895b8..298f69e2834c 100644
3124     --- a/tools/testing/selftests/vm/compaction_test.c
3125     +++ b/tools/testing/selftests/vm/compaction_test.c
3126     @@ -136,6 +136,8 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)
3127     printf("No of huge pages allocated = %d\n",
3128     (atoi(nr_hugepages)));
3129    
3130     + lseek(fd, 0, SEEK_SET);
3131     +
3132     if (write(fd, initial_nr_hugepages, strlen(initial_nr_hugepages))
3133     != strlen(initial_nr_hugepages)) {
3134     perror("Failed to write value to /proc/sys/vm/nr_hugepages\n");
3135     diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
3136     index 4af37bfe4aea..6eb50152baf0 100644
3137     --- a/tools/testing/selftests/x86/Makefile
3138     +++ b/tools/testing/selftests/x86/Makefile
3139     @@ -26,11 +26,13 @@ CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c)
3140     ifeq ($(CAN_BUILD_I386),1)
3141     all: all_32
3142     TEST_PROGS += $(BINARIES_32)
3143     +EXTRA_CFLAGS += -DCAN_BUILD_32
3144     endif
3145    
3146     ifeq ($(CAN_BUILD_X86_64),1)
3147     all: all_64
3148     TEST_PROGS += $(BINARIES_64)
3149     +EXTRA_CFLAGS += -DCAN_BUILD_64
3150     endif
3151    
3152     all_32: $(BINARIES_32)
3153     diff --git a/tools/testing/selftests/x86/mpx-mini-test.c b/tools/testing/selftests/x86/mpx-mini-test.c
3154     index 616ee9673339..79e1d13d1cda 100644
3155     --- a/tools/testing/selftests/x86/mpx-mini-test.c
3156     +++ b/tools/testing/selftests/x86/mpx-mini-test.c
3157     @@ -315,11 +315,39 @@ static inline void *__si_bounds_upper(siginfo_t *si)
3158     return si->si_upper;
3159     }
3160     #else
3161     +
3162     +/*
3163     + * This deals with old version of _sigfault in some distros:
3164     + *
3165     +
3166     +old _sigfault:
3167     + struct {
3168     + void *si_addr;
3169     + } _sigfault;
3170     +
3171     +new _sigfault:
3172     + struct {
3173     + void __user *_addr;
3174     + int _trapno;
3175     + short _addr_lsb;
3176     + union {
3177     + struct {
3178     + void __user *_lower;
3179     + void __user *_upper;
3180     + } _addr_bnd;
3181     + __u32 _pkey;
3182     + };
3183     + } _sigfault;
3184     + *
3185     + */
3186     +
3187     static inline void **__si_bounds_hack(siginfo_t *si)
3188     {
3189     void *sigfault = &si->_sifields._sigfault;
3190     void *end_sigfault = sigfault + sizeof(si->_sifields._sigfault);
3191     - void **__si_lower = end_sigfault;
3192     + int *trapno = (int*)end_sigfault;
3193     + /* skip _trapno and _addr_lsb */
3194     + void **__si_lower = (void**)(trapno + 2);
3195    
3196     return __si_lower;
3197     }
3198     @@ -331,7 +359,7 @@ static inline void *__si_bounds_lower(siginfo_t *si)
3199    
3200     static inline void *__si_bounds_upper(siginfo_t *si)
3201     {
3202     - return (*__si_bounds_hack(si)) + sizeof(void *);
3203     + return *(__si_bounds_hack(si) + 1);
3204     }
3205     #endif
3206    
3207     diff --git a/tools/testing/selftests/x86/protection_keys.c b/tools/testing/selftests/x86/protection_keys.c
3208     index bdd58c78902e..2842a5fa22b3 100644
3209     --- a/tools/testing/selftests/x86/protection_keys.c
3210     +++ b/tools/testing/selftests/x86/protection_keys.c
3211     @@ -381,34 +381,6 @@ pid_t fork_lazy_child(void)
3212     return forkret;
3213     }
3214    
3215     -void davecmp(void *_a, void *_b, int len)
3216     -{
3217     - int i;
3218     - unsigned long *a = _a;
3219     - unsigned long *b = _b;
3220     -
3221     - for (i = 0; i < len / sizeof(*a); i++) {
3222     - if (a[i] == b[i])
3223     - continue;
3224     -
3225     - dprintf3("[%3d]: a: %016lx b: %016lx\n", i, a[i], b[i]);
3226     - }
3227     -}
3228     -
3229     -void dumpit(char *f)
3230     -{
3231     - int fd = open(f, O_RDONLY);
3232     - char buf[100];
3233     - int nr_read;
3234     -
3235     - dprintf2("maps fd: %d\n", fd);
3236     - do {
3237     - nr_read = read(fd, &buf[0], sizeof(buf));
3238     - write(1, buf, nr_read);
3239     - } while (nr_read > 0);
3240     - close(fd);
3241     -}
3242     -
3243     #define PKEY_DISABLE_ACCESS 0x1
3244     #define PKEY_DISABLE_WRITE 0x2
3245    
3246     diff --git a/tools/testing/selftests/x86/single_step_syscall.c b/tools/testing/selftests/x86/single_step_syscall.c
3247     index a48da95c18fd..ddfdd635de16 100644
3248     --- a/tools/testing/selftests/x86/single_step_syscall.c
3249     +++ b/tools/testing/selftests/x86/single_step_syscall.c
3250     @@ -119,7 +119,9 @@ static void check_result(void)
3251    
3252     int main()
3253     {
3254     +#ifdef CAN_BUILD_32
3255     int tmp;
3256     +#endif
3257    
3258     sethandler(SIGTRAP, sigtrap, 0);
3259    
3260     @@ -139,12 +141,13 @@ int main()
3261     : : "c" (post_nop) : "r11");
3262     check_result();
3263     #endif
3264     -
3265     +#ifdef CAN_BUILD_32
3266     printf("[RUN]\tSet TF and check int80\n");
3267     set_eflags(get_eflags() | X86_EFLAGS_TF);
3268     asm volatile ("int $0x80" : "=a" (tmp) : "a" (SYS_getpid)
3269     : INT80_CLOBBERS);
3270     check_result();
3271     +#endif
3272    
3273     /*
3274     * This test is particularly interesting if fast syscalls use
3275     diff --git a/tools/testing/selftests/x86/test_mremap_vdso.c b/tools/testing/selftests/x86/test_mremap_vdso.c
3276     index bf0d687c7db7..64f11c8d9b76 100644
3277     --- a/tools/testing/selftests/x86/test_mremap_vdso.c
3278     +++ b/tools/testing/selftests/x86/test_mremap_vdso.c
3279     @@ -90,8 +90,12 @@ int main(int argc, char **argv, char **envp)
3280     vdso_size += PAGE_SIZE;
3281     }
3282    
3283     +#ifdef __i386__
3284     /* Glibc is likely to explode now - exit with raw syscall */
3285     asm volatile ("int $0x80" : : "a" (__NR_exit), "b" (!!ret));
3286     +#else /* __x86_64__ */
3287     + syscall(SYS_exit, ret);
3288     +#endif
3289     } else {
3290     int status;
3291