1 |
commit: 42c0079efa9fff84d8c63842c360060aad2f75cb |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Dec 11 14:31:16 2015 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Dec 11 14:31:16 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=42c0079e |
7 |
|
8 |
Linux patch 4.2.7 |
9 |
|
10 |
0000_README | 4 + |
11 |
1006_linux-4.2.7.patch | 4131 ++++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 4135 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 8190b77..2299001 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -67,6 +67,10 @@ Patch: 1005_linux-4.2.6.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.2.6 |
21 |
|
22 |
+Patch: 1006_linux-4.2.7.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.2.7 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1006_linux-4.2.7.patch b/1006_linux-4.2.7.patch |
31 |
new file mode 100644 |
32 |
index 0000000..35ba2e4 |
33 |
--- /dev/null |
34 |
+++ b/1006_linux-4.2.7.patch |
35 |
@@ -0,0 +1,4131 @@ |
36 |
+diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt |
37 |
+index 0815eac5b185..e12f3448846a 100644 |
38 |
+--- a/Documentation/devicetree/bindings/usb/dwc3.txt |
39 |
++++ b/Documentation/devicetree/bindings/usb/dwc3.txt |
40 |
+@@ -35,6 +35,8 @@ Optional properties: |
41 |
+ LTSSM during USB3 Compliance mode. |
42 |
+ - snps,dis_u3_susphy_quirk: when set core will disable USB3 suspend phy. |
43 |
+ - snps,dis_u2_susphy_quirk: when set core will disable USB2 suspend phy. |
44 |
++ - snps,dis_enblslpm_quirk: when set clears the enblslpm in GUSB2PHYCFG, |
45 |
++ disabling the suspend signal to the PHY. |
46 |
+ - snps,is-utmi-l1-suspend: true when DWC3 asserts output signal |
47 |
+ utmi_l1_suspend_n, false when asserts utmi_sleep_n |
48 |
+ - snps,hird-threshold: HIRD threshold |
49 |
+diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt |
50 |
+index 6f7fafde0884..3e2844eca266 100644 |
51 |
+--- a/Documentation/filesystems/proc.txt |
52 |
++++ b/Documentation/filesystems/proc.txt |
53 |
+@@ -140,7 +140,8 @@ Table 1-1: Process specific entries in /proc |
54 |
+ stat Process status |
55 |
+ statm Process memory status information |
56 |
+ status Process status in human readable form |
57 |
+- wchan If CONFIG_KALLSYMS is set, a pre-decoded wchan |
58 |
++ wchan Present with CONFIG_KALLSYMS=y: it shows the kernel function |
59 |
++ symbol the task is blocked in - or "0" if not blocked. |
60 |
+ pagemap Page table |
61 |
+ stack Report full stack trace, enable via CONFIG_STACKTRACE |
62 |
+ smaps a extension based on maps, showing the memory consumption of |
63 |
+@@ -310,7 +311,7 @@ Table 1-4: Contents of the stat files (as of 2.6.30-rc7) |
64 |
+ blocked bitmap of blocked signals |
65 |
+ sigign bitmap of ignored signals |
66 |
+ sigcatch bitmap of caught signals |
67 |
+- wchan address where process went to sleep |
68 |
++ 0 (place holder, used to be the wchan address, use /proc/PID/wchan instead) |
69 |
+ 0 (place holder) |
70 |
+ 0 (place holder) |
71 |
+ exit_signal signal to send to parent thread on exit |
72 |
+diff --git a/Makefile b/Makefile |
73 |
+index 9ef37399b4e8..f5014eaf2532 100644 |
74 |
+--- a/Makefile |
75 |
++++ b/Makefile |
76 |
+@@ -1,6 +1,6 @@ |
77 |
+ VERSION = 4 |
78 |
+ PATCHLEVEL = 2 |
79 |
+-SUBLEVEL = 6 |
80 |
++SUBLEVEL = 7 |
81 |
+ EXTRAVERSION = |
82 |
+ NAME = Hurr durr I'ma sheep |
83 |
+ |
84 |
+diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi |
85 |
+index b69be5c499cf..8c603fdf9da1 100644 |
86 |
+--- a/arch/arm/boot/dts/imx27.dtsi |
87 |
++++ b/arch/arm/boot/dts/imx27.dtsi |
88 |
+@@ -477,7 +477,10 @@ |
89 |
+ compatible = "fsl,imx27-usb"; |
90 |
+ reg = <0x10024000 0x200>; |
91 |
+ interrupts = <56>; |
92 |
+- clocks = <&clks IMX27_CLK_USB_IPG_GATE>; |
93 |
++ clocks = <&clks IMX27_CLK_USB_IPG_GATE>, |
94 |
++ <&clks IMX27_CLK_USB_AHB_GATE>, |
95 |
++ <&clks IMX27_CLK_USB_DIV>; |
96 |
++ clock-names = "ipg", "ahb", "per"; |
97 |
+ fsl,usbmisc = <&usbmisc 0>; |
98 |
+ status = "disabled"; |
99 |
+ }; |
100 |
+@@ -486,7 +489,10 @@ |
101 |
+ compatible = "fsl,imx27-usb"; |
102 |
+ reg = <0x10024200 0x200>; |
103 |
+ interrupts = <54>; |
104 |
+- clocks = <&clks IMX27_CLK_USB_IPG_GATE>; |
105 |
++ clocks = <&clks IMX27_CLK_USB_IPG_GATE>, |
106 |
++ <&clks IMX27_CLK_USB_AHB_GATE>, |
107 |
++ <&clks IMX27_CLK_USB_DIV>; |
108 |
++ clock-names = "ipg", "ahb", "per"; |
109 |
+ fsl,usbmisc = <&usbmisc 1>; |
110 |
+ dr_mode = "host"; |
111 |
+ status = "disabled"; |
112 |
+@@ -496,7 +502,10 @@ |
113 |
+ compatible = "fsl,imx27-usb"; |
114 |
+ reg = <0x10024400 0x200>; |
115 |
+ interrupts = <55>; |
116 |
+- clocks = <&clks IMX27_CLK_USB_IPG_GATE>; |
117 |
++ clocks = <&clks IMX27_CLK_USB_IPG_GATE>, |
118 |
++ <&clks IMX27_CLK_USB_AHB_GATE>, |
119 |
++ <&clks IMX27_CLK_USB_DIV>; |
120 |
++ clock-names = "ipg", "ahb", "per"; |
121 |
+ fsl,usbmisc = <&usbmisc 2>; |
122 |
+ dr_mode = "host"; |
123 |
+ status = "disabled"; |
124 |
+@@ -506,7 +515,6 @@ |
125 |
+ #index-cells = <1>; |
126 |
+ compatible = "fsl,imx27-usbmisc"; |
127 |
+ reg = <0x10024600 0x200>; |
128 |
+- clocks = <&clks IMX27_CLK_USB_AHB_GATE>; |
129 |
+ }; |
130 |
+ |
131 |
+ sahara2: sahara@10025000 { |
132 |
+diff --git a/arch/arm/boot/dts/omap5-uevm.dts b/arch/arm/boot/dts/omap5-uevm.dts |
133 |
+index 5771a149ce4a..23d645daeac1 100644 |
134 |
+--- a/arch/arm/boot/dts/omap5-uevm.dts |
135 |
++++ b/arch/arm/boot/dts/omap5-uevm.dts |
136 |
+@@ -31,6 +31,24 @@ |
137 |
+ regulator-max-microvolt = <3000000>; |
138 |
+ }; |
139 |
+ |
140 |
++ mmc3_pwrseq: sdhci0_pwrseq { |
141 |
++ compatible = "mmc-pwrseq-simple"; |
142 |
++ clocks = <&clk32kgaudio>; |
143 |
++ clock-names = "ext_clock"; |
144 |
++ }; |
145 |
++ |
146 |
++ vmmcsdio_fixed: fixedregulator-mmcsdio { |
147 |
++ compatible = "regulator-fixed"; |
148 |
++ regulator-name = "vmmcsdio_fixed"; |
149 |
++ regulator-min-microvolt = <1800000>; |
150 |
++ regulator-max-microvolt = <1800000>; |
151 |
++ gpio = <&gpio5 12 GPIO_ACTIVE_HIGH>; /* gpio140 WLAN_EN */ |
152 |
++ enable-active-high; |
153 |
++ startup-delay-us = <70000>; |
154 |
++ pinctrl-names = "default"; |
155 |
++ pinctrl-0 = <&wlan_pins>; |
156 |
++ }; |
157 |
++ |
158 |
+ /* HS USB Host PHY on PORT 2 */ |
159 |
+ hsusb2_phy: hsusb2_phy { |
160 |
+ compatible = "usb-nop-xceiv"; |
161 |
+@@ -197,12 +215,20 @@ |
162 |
+ >; |
163 |
+ }; |
164 |
+ |
165 |
+- mcspi4_pins: pinmux_mcspi4_pins { |
166 |
++ mmc3_pins: pinmux_mmc3_pins { |
167 |
++ pinctrl-single,pins = < |
168 |
++ OMAP5_IOPAD(0x01a4, PIN_INPUT_PULLUP | MUX_MODE0) /* wlsdio_clk */ |
169 |
++ OMAP5_IOPAD(0x01a6, PIN_INPUT_PULLUP | MUX_MODE0) /* wlsdio_cmd */ |
170 |
++ OMAP5_IOPAD(0x01a8, PIN_INPUT_PULLUP | MUX_MODE0) /* wlsdio_data0 */ |
171 |
++ OMAP5_IOPAD(0x01aa, PIN_INPUT_PULLUP | MUX_MODE0) /* wlsdio_data1 */ |
172 |
++ OMAP5_IOPAD(0x01ac, PIN_INPUT_PULLUP | MUX_MODE0) /* wlsdio_data2 */ |
173 |
++ OMAP5_IOPAD(0x01ae, PIN_INPUT_PULLUP | MUX_MODE0) /* wlsdio_data3 */ |
174 |
++ >; |
175 |
++ }; |
176 |
++ |
177 |
++ wlan_pins: pinmux_wlan_pins { |
178 |
+ pinctrl-single,pins = < |
179 |
+- 0x164 (PIN_INPUT | MUX_MODE1) /* mcspi4_clk */ |
180 |
+- 0x168 (PIN_INPUT | MUX_MODE1) /* mcspi4_simo */ |
181 |
+- 0x16a (PIN_INPUT | MUX_MODE1) /* mcspi4_somi */ |
182 |
+- 0x16c (PIN_INPUT | MUX_MODE1) /* mcspi4_cs0 */ |
183 |
++ OMAP5_IOPAD(0x1bc, PIN_OUTPUT | MUX_MODE6) /* mcspi1_clk.gpio5_140 */ |
184 |
+ >; |
185 |
+ }; |
186 |
+ |
187 |
+@@ -276,6 +302,12 @@ |
188 |
+ 0x1A (PIN_OUTPUT | MUX_MODE0) /* fref_clk1_out, USB hub clk */ |
189 |
+ >; |
190 |
+ }; |
191 |
++ |
192 |
++ wlcore_irq_pin: pinmux_wlcore_irq_pin { |
193 |
++ pinctrl-single,pins = < |
194 |
++ OMAP5_IOPAD(0x040, WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE6) /* llia_wakereqin.gpio1_wk14 */ |
195 |
++ >; |
196 |
++ }; |
197 |
+ }; |
198 |
+ |
199 |
+ &mmc1 { |
200 |
+@@ -290,8 +322,25 @@ |
201 |
+ }; |
202 |
+ |
203 |
+ &mmc3 { |
204 |
++ vmmc-supply = <&vmmcsdio_fixed>; |
205 |
++ mmc-pwrseq = <&mmc3_pwrseq>; |
206 |
+ bus-width = <4>; |
207 |
+- ti,non-removable; |
208 |
++ non-removable; |
209 |
++ cap-power-off-card; |
210 |
++ pinctrl-names = "default"; |
211 |
++ pinctrl-0 = <&mmc3_pins &wlcore_irq_pin>; |
212 |
++ interrupts-extended = <&gic GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH |
213 |
++ &omap5_pmx_core 0x168>; |
214 |
++ |
215 |
++ #address-cells = <1>; |
216 |
++ #size-cells = <0>; |
217 |
++ wlcore: wlcore@2 { |
218 |
++ compatible = "ti,wl1271"; |
219 |
++ reg = <2>; |
220 |
++ interrupt-parent = <&gpio1>; |
221 |
++ interrupts = <14 IRQ_TYPE_LEVEL_HIGH>; /* gpio 14 */ |
222 |
++ ref-clock-frequency = <26000000>; |
223 |
++ }; |
224 |
+ }; |
225 |
+ |
226 |
+ &mmc4 { |
227 |
+@@ -591,11 +640,6 @@ |
228 |
+ pinctrl-0 = <&mcspi3_pins>; |
229 |
+ }; |
230 |
+ |
231 |
+-&mcspi4 { |
232 |
+- pinctrl-names = "default"; |
233 |
+- pinctrl-0 = <&mcspi4_pins>; |
234 |
+-}; |
235 |
+- |
236 |
+ &uart1 { |
237 |
+ pinctrl-names = "default"; |
238 |
+ pinctrl-0 = <&uart1_pins>; |
239 |
+diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi |
240 |
+index 3ee22ee13c5a..1ba10e495f21 100644 |
241 |
+--- a/arch/arm/boot/dts/sama5d4.dtsi |
242 |
++++ b/arch/arm/boot/dts/sama5d4.dtsi |
243 |
+@@ -939,11 +939,11 @@ |
244 |
+ reg = <0xf8018000 0x4000>; |
245 |
+ interrupts = <33 IRQ_TYPE_LEVEL_HIGH 6>; |
246 |
+ dmas = <&dma1 |
247 |
+- (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)) |
248 |
+- AT91_XDMAC_DT_PERID(4)>, |
249 |
++ (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
250 |
++ | AT91_XDMAC_DT_PERID(4))>, |
251 |
+ <&dma1 |
252 |
+- (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)) |
253 |
+- AT91_XDMAC_DT_PERID(5)>; |
254 |
++ (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
255 |
++ | AT91_XDMAC_DT_PERID(5))>; |
256 |
+ dma-names = "tx", "rx"; |
257 |
+ pinctrl-names = "default"; |
258 |
+ pinctrl-0 = <&pinctrl_i2c1>; |
259 |
+diff --git a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts |
260 |
+index d0cfadac0691..18f26ca4e375 100644 |
261 |
+--- a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts |
262 |
++++ b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts |
263 |
+@@ -184,18 +184,18 @@ |
264 |
+ regulator-name = "vcc-3v0"; |
265 |
+ }; |
266 |
+ |
267 |
+- vdd_cpu: dcdc2 { |
268 |
++ vdd_gpu: dcdc2 { |
269 |
+ regulator-always-on; |
270 |
+ regulator-min-microvolt = <700000>; |
271 |
+ regulator-max-microvolt = <1320000>; |
272 |
+- regulator-name = "vdd-cpu"; |
273 |
++ regulator-name = "vdd-gpu"; |
274 |
+ }; |
275 |
+ |
276 |
+- vdd_gpu: dcdc3 { |
277 |
++ vdd_cpu: dcdc3 { |
278 |
+ regulator-always-on; |
279 |
+ regulator-min-microvolt = <700000>; |
280 |
+ regulator-max-microvolt = <1320000>; |
281 |
+- regulator-name = "vdd-gpu"; |
282 |
++ regulator-name = "vdd-cpu"; |
283 |
+ }; |
284 |
+ |
285 |
+ vdd_sys_dll: dcdc4 { |
286 |
+diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c |
287 |
+index 873dbfcc7dc9..56fc339571f9 100644 |
288 |
+--- a/arch/arm/common/edma.c |
289 |
++++ b/arch/arm/common/edma.c |
290 |
+@@ -406,7 +406,8 @@ static irqreturn_t dma_irq_handler(int irq, void *data) |
291 |
+ BIT(slot)); |
292 |
+ if (edma_cc[ctlr]->intr_data[channel].callback) |
293 |
+ edma_cc[ctlr]->intr_data[channel].callback( |
294 |
+- channel, EDMA_DMA_COMPLETE, |
295 |
++ EDMA_CTLR_CHAN(ctlr, channel), |
296 |
++ EDMA_DMA_COMPLETE, |
297 |
+ edma_cc[ctlr]->intr_data[channel].data); |
298 |
+ } |
299 |
+ } while (sh_ipr); |
300 |
+@@ -460,7 +461,8 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data) |
301 |
+ if (edma_cc[ctlr]->intr_data[k]. |
302 |
+ callback) { |
303 |
+ edma_cc[ctlr]->intr_data[k]. |
304 |
+- callback(k, |
305 |
++ callback( |
306 |
++ EDMA_CTLR_CHAN(ctlr, k), |
307 |
+ EDMA_DMA_CC_ERROR, |
308 |
+ edma_cc[ctlr]->intr_data |
309 |
+ [k].data); |
310 |
+diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h |
311 |
+index 53c15dec7af6..6a9851ea6a60 100644 |
312 |
+--- a/arch/arm/include/asm/irq.h |
313 |
++++ b/arch/arm/include/asm/irq.h |
314 |
+@@ -35,6 +35,11 @@ extern void (*handle_arch_irq)(struct pt_regs *); |
315 |
+ extern void set_handle_irq(void (*handle_irq)(struct pt_regs *)); |
316 |
+ #endif |
317 |
+ |
318 |
++static inline int nr_legacy_irqs(void) |
319 |
++{ |
320 |
++ return NR_IRQS_LEGACY; |
321 |
++} |
322 |
++ |
323 |
+ #endif |
324 |
+ |
325 |
+ #endif |
326 |
+diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S |
327 |
+index 0d95f488b47a..a25defda3d22 100644 |
328 |
+--- a/arch/arm/mach-at91/pm_suspend.S |
329 |
++++ b/arch/arm/mach-at91/pm_suspend.S |
330 |
+@@ -80,6 +80,8 @@ tmp2 .req r5 |
331 |
+ * @r2: base address of second SDRAM Controller or 0 if not present |
332 |
+ * @r3: pm information |
333 |
+ */ |
334 |
++/* at91_pm_suspend_in_sram must be 8-byte aligned per the requirements of fncpy() */ |
335 |
++ .align 3 |
336 |
+ ENTRY(at91_pm_suspend_in_sram) |
337 |
+ /* Save registers on stack */ |
338 |
+ stmfd sp!, {r4 - r12, lr} |
339 |
+diff --git a/arch/arm/mach-pxa/include/mach/pxa27x.h b/arch/arm/mach-pxa/include/mach/pxa27x.h |
340 |
+index 599b925a657c..1a4291936c58 100644 |
341 |
+--- a/arch/arm/mach-pxa/include/mach/pxa27x.h |
342 |
++++ b/arch/arm/mach-pxa/include/mach/pxa27x.h |
343 |
+@@ -19,7 +19,7 @@ |
344 |
+ #define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */ |
345 |
+ #define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */ |
346 |
+ |
347 |
+-extern int __init pxa27x_set_pwrmode(unsigned int mode); |
348 |
++extern int pxa27x_set_pwrmode(unsigned int mode); |
349 |
+ extern void pxa27x_cpu_pm_enter(suspend_state_t state); |
350 |
+ |
351 |
+ #endif /* __MACH_PXA27x_H */ |
352 |
+diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c |
353 |
+index b5abdeb5bb2d..aa97547099fb 100644 |
354 |
+--- a/arch/arm/mach-pxa/pxa27x.c |
355 |
++++ b/arch/arm/mach-pxa/pxa27x.c |
356 |
+@@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(pxa27x_configure_ac97reset); |
357 |
+ */ |
358 |
+ static unsigned int pwrmode = PWRMODE_SLEEP; |
359 |
+ |
360 |
+-int __init pxa27x_set_pwrmode(unsigned int mode) |
361 |
++int pxa27x_set_pwrmode(unsigned int mode) |
362 |
+ { |
363 |
+ switch (mode) { |
364 |
+ case PWRMODE_SLEEP: |
365 |
+diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c |
366 |
+index fbe74c6806f3..49d1110cff53 100644 |
367 |
+--- a/arch/arm/mach-tegra/board-paz00.c |
368 |
++++ b/arch/arm/mach-tegra/board-paz00.c |
369 |
+@@ -39,8 +39,8 @@ static struct platform_device wifi_rfkill_device = { |
370 |
+ static struct gpiod_lookup_table wifi_gpio_lookup = { |
371 |
+ .dev_id = "rfkill_gpio", |
372 |
+ .table = { |
373 |
+- GPIO_LOOKUP_IDX("tegra-gpio", 25, NULL, 0, 0), |
374 |
+- GPIO_LOOKUP_IDX("tegra-gpio", 85, NULL, 1, 0), |
375 |
++ GPIO_LOOKUP("tegra-gpio", 25, "reset", 0), |
376 |
++ GPIO_LOOKUP("tegra-gpio", 85, "shutdown", 0), |
377 |
+ { }, |
378 |
+ }, |
379 |
+ }; |
380 |
+diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c |
381 |
+index cba12f34ff77..25ecc6afec4c 100644 |
382 |
+--- a/arch/arm/mm/dma-mapping.c |
383 |
++++ b/arch/arm/mm/dma-mapping.c |
384 |
+@@ -1413,12 +1413,19 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma, |
385 |
+ unsigned long uaddr = vma->vm_start; |
386 |
+ unsigned long usize = vma->vm_end - vma->vm_start; |
387 |
+ struct page **pages = __iommu_get_pages(cpu_addr, attrs); |
388 |
++ unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT; |
389 |
++ unsigned long off = vma->vm_pgoff; |
390 |
+ |
391 |
+ vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot); |
392 |
+ |
393 |
+ if (!pages) |
394 |
+ return -ENXIO; |
395 |
+ |
396 |
++ if (off >= nr_pages || (usize >> PAGE_SHIFT) > nr_pages - off) |
397 |
++ return -ENXIO; |
398 |
++ |
399 |
++ pages += off; |
400 |
++ |
401 |
+ do { |
402 |
+ int ret = vm_insert_page(vma, uaddr, *pages++); |
403 |
+ if (ret) { |
404 |
+diff --git a/arch/arm64/include/asm/irq.h b/arch/arm64/include/asm/irq.h |
405 |
+index bbb251b14746..8b9bf54105b3 100644 |
406 |
+--- a/arch/arm64/include/asm/irq.h |
407 |
++++ b/arch/arm64/include/asm/irq.h |
408 |
+@@ -21,4 +21,9 @@ static inline void acpi_irq_init(void) |
409 |
+ } |
410 |
+ #define acpi_irq_init acpi_irq_init |
411 |
+ |
412 |
++static inline int nr_legacy_irqs(void) |
413 |
++{ |
414 |
++ return 0; |
415 |
++} |
416 |
++ |
417 |
+ #endif |
418 |
+diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h |
419 |
+index d6dd9fdbc3be..d4264bb0a409 100644 |
420 |
+--- a/arch/arm64/include/asm/ptrace.h |
421 |
++++ b/arch/arm64/include/asm/ptrace.h |
422 |
+@@ -83,14 +83,14 @@ |
423 |
+ #define compat_sp regs[13] |
424 |
+ #define compat_lr regs[14] |
425 |
+ #define compat_sp_hyp regs[15] |
426 |
+-#define compat_sp_irq regs[16] |
427 |
+-#define compat_lr_irq regs[17] |
428 |
+-#define compat_sp_svc regs[18] |
429 |
+-#define compat_lr_svc regs[19] |
430 |
+-#define compat_sp_abt regs[20] |
431 |
+-#define compat_lr_abt regs[21] |
432 |
+-#define compat_sp_und regs[22] |
433 |
+-#define compat_lr_und regs[23] |
434 |
++#define compat_lr_irq regs[16] |
435 |
++#define compat_sp_irq regs[17] |
436 |
++#define compat_lr_svc regs[18] |
437 |
++#define compat_sp_svc regs[19] |
438 |
++#define compat_lr_abt regs[20] |
439 |
++#define compat_sp_abt regs[21] |
440 |
++#define compat_lr_und regs[22] |
441 |
++#define compat_sp_und regs[23] |
442 |
+ #define compat_r8_fiq regs[24] |
443 |
+ #define compat_r9_fiq regs[25] |
444 |
+ #define compat_r10_fiq regs[26] |
445 |
+diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S |
446 |
+index 98073332e2d0..4d77757b5894 100644 |
447 |
+--- a/arch/arm64/kernel/vmlinux.lds.S |
448 |
++++ b/arch/arm64/kernel/vmlinux.lds.S |
449 |
+@@ -60,9 +60,12 @@ PECOFF_FILE_ALIGNMENT = 0x200; |
450 |
+ #define PECOFF_EDATA_PADDING |
451 |
+ #endif |
452 |
+ |
453 |
+-#ifdef CONFIG_DEBUG_ALIGN_RODATA |
454 |
++#if defined(CONFIG_DEBUG_ALIGN_RODATA) |
455 |
+ #define ALIGN_DEBUG_RO . = ALIGN(1<<SECTION_SHIFT); |
456 |
+ #define ALIGN_DEBUG_RO_MIN(min) ALIGN_DEBUG_RO |
457 |
++#elif defined(CONFIG_DEBUG_RODATA) |
458 |
++#define ALIGN_DEBUG_RO . = ALIGN(1<<PAGE_SHIFT); |
459 |
++#define ALIGN_DEBUG_RO_MIN(min) ALIGN_DEBUG_RO |
460 |
+ #else |
461 |
+ #define ALIGN_DEBUG_RO |
462 |
+ #define ALIGN_DEBUG_RO_MIN(min) . = ALIGN(min); |
463 |
+diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c |
464 |
+index 1ba21204ebe0..9a0013703579 100644 |
465 |
+--- a/arch/mips/ath79/setup.c |
466 |
++++ b/arch/mips/ath79/setup.c |
467 |
+@@ -216,9 +216,9 @@ void __init plat_mem_setup(void) |
468 |
+ AR71XX_RESET_SIZE); |
469 |
+ ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE, |
470 |
+ AR71XX_PLL_SIZE); |
471 |
++ ath79_detect_sys_type(); |
472 |
+ ath79_ddr_ctrl_init(); |
473 |
+ |
474 |
+- ath79_detect_sys_type(); |
475 |
+ if (mips_machtype != ATH79_MACH_GENERIC_OF) |
476 |
+ detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); |
477 |
+ |
478 |
+diff --git a/arch/mips/include/asm/cdmm.h b/arch/mips/include/asm/cdmm.h |
479 |
+index 16e22ce9719f..85dc4ce401ad 100644 |
480 |
+--- a/arch/mips/include/asm/cdmm.h |
481 |
++++ b/arch/mips/include/asm/cdmm.h |
482 |
+@@ -84,6 +84,17 @@ void mips_cdmm_driver_unregister(struct mips_cdmm_driver *); |
483 |
+ module_driver(__mips_cdmm_driver, mips_cdmm_driver_register, \ |
484 |
+ mips_cdmm_driver_unregister) |
485 |
+ |
486 |
++/* |
487 |
++ * builtin_mips_cdmm_driver() - Helper macro for drivers that don't do anything |
488 |
++ * special in init and have no exit. This eliminates some boilerplate. Each |
489 |
++ * driver may only use this macro once, and calling it replaces device_initcall |
490 |
++ * (or in some cases, the legacy __initcall). This is meant to be a direct |
491 |
++ * parallel of module_mips_cdmm_driver() above but without the __exit stuff that |
492 |
++ * is not used for builtin cases. |
493 |
++ */ |
494 |
++#define builtin_mips_cdmm_driver(__mips_cdmm_driver) \ |
495 |
++ builtin_driver(__mips_cdmm_driver, mips_cdmm_driver_register) |
496 |
++ |
497 |
+ /* drivers/tty/mips_ejtag_fdc.c */ |
498 |
+ |
499 |
+ #ifdef CONFIG_MIPS_EJTAG_FDC_EARLYCON |
500 |
+diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c |
501 |
+index d5fa3eaf39a1..41b1b090f56f 100644 |
502 |
+--- a/arch/mips/kvm/emulate.c |
503 |
++++ b/arch/mips/kvm/emulate.c |
504 |
+@@ -1581,7 +1581,7 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, |
505 |
+ |
506 |
+ base = (inst >> 21) & 0x1f; |
507 |
+ op_inst = (inst >> 16) & 0x1f; |
508 |
+- offset = inst & 0xffff; |
509 |
++ offset = (int16_t)inst; |
510 |
+ cache = (inst >> 16) & 0x3; |
511 |
+ op = (inst >> 18) & 0x7; |
512 |
+ |
513 |
+diff --git a/arch/mips/kvm/locore.S b/arch/mips/kvm/locore.S |
514 |
+index c567240386a0..d1ee95a7f7dd 100644 |
515 |
+--- a/arch/mips/kvm/locore.S |
516 |
++++ b/arch/mips/kvm/locore.S |
517 |
+@@ -165,9 +165,11 @@ FEXPORT(__kvm_mips_vcpu_run) |
518 |
+ |
519 |
+ FEXPORT(__kvm_mips_load_asid) |
520 |
+ /* Set the ASID for the Guest Kernel */ |
521 |
+- INT_SLL t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */ |
522 |
+- /* addresses shift to 0x80000000 */ |
523 |
+- bltz t0, 1f /* If kernel */ |
524 |
++ PTR_L t0, VCPU_COP0(k1) |
525 |
++ LONG_L t0, COP0_STATUS(t0) |
526 |
++ andi t0, KSU_USER | ST0_ERL | ST0_EXL |
527 |
++ xori t0, KSU_USER |
528 |
++ bnez t0, 1f /* If kernel */ |
529 |
+ INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */ |
530 |
+ INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */ |
531 |
+ 1: |
532 |
+@@ -482,9 +484,11 @@ __kvm_mips_return_to_guest: |
533 |
+ mtc0 t0, CP0_EPC |
534 |
+ |
535 |
+ /* Set the ASID for the Guest Kernel */ |
536 |
+- INT_SLL t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */ |
537 |
+- /* addresses shift to 0x80000000 */ |
538 |
+- bltz t0, 1f /* If kernel */ |
539 |
++ PTR_L t0, VCPU_COP0(k1) |
540 |
++ LONG_L t0, COP0_STATUS(t0) |
541 |
++ andi t0, KSU_USER | ST0_ERL | ST0_EXL |
542 |
++ xori t0, KSU_USER |
543 |
++ bnez t0, 1f /* If kernel */ |
544 |
+ INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */ |
545 |
+ INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */ |
546 |
+ 1: |
547 |
+diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c |
548 |
+index cd4c129ce743..bafb32b4c6b4 100644 |
549 |
+--- a/arch/mips/kvm/mips.c |
550 |
++++ b/arch/mips/kvm/mips.c |
551 |
+@@ -278,7 +278,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) |
552 |
+ |
553 |
+ if (!gebase) { |
554 |
+ err = -ENOMEM; |
555 |
+- goto out_free_cpu; |
556 |
++ goto out_uninit_cpu; |
557 |
+ } |
558 |
+ kvm_debug("Allocated %d bytes for KVM Exception Handlers @ %p\n", |
559 |
+ ALIGN(size, PAGE_SIZE), gebase); |
560 |
+@@ -342,6 +342,9 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) |
561 |
+ out_free_gebase: |
562 |
+ kfree(gebase); |
563 |
+ |
564 |
++out_uninit_cpu: |
565 |
++ kvm_vcpu_uninit(vcpu); |
566 |
++ |
567 |
+ out_free_cpu: |
568 |
+ kfree(vcpu); |
569 |
+ |
570 |
+diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c |
571 |
+index 3fc2e6d70c77..a0706fd4ce0a 100644 |
572 |
+--- a/arch/mips/lantiq/clk.c |
573 |
++++ b/arch/mips/lantiq/clk.c |
574 |
+@@ -99,6 +99,23 @@ int clk_set_rate(struct clk *clk, unsigned long rate) |
575 |
+ } |
576 |
+ EXPORT_SYMBOL(clk_set_rate); |
577 |
+ |
578 |
++long clk_round_rate(struct clk *clk, unsigned long rate) |
579 |
++{ |
580 |
++ if (unlikely(!clk_good(clk))) |
581 |
++ return 0; |
582 |
++ if (clk->rates && *clk->rates) { |
583 |
++ unsigned long *r = clk->rates; |
584 |
++ |
585 |
++ while (*r && (*r != rate)) |
586 |
++ r++; |
587 |
++ if (!*r) { |
588 |
++ return clk->rate; |
589 |
++ } |
590 |
++ } |
591 |
++ return rate; |
592 |
++} |
593 |
++EXPORT_SYMBOL(clk_round_rate); |
594 |
++ |
595 |
+ int clk_enable(struct clk *clk) |
596 |
+ { |
597 |
+ if (unlikely(!clk_good(clk))) |
598 |
+diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c |
599 |
+index c98d89708e99..cbee788d9625 100644 |
600 |
+--- a/arch/s390/kvm/interrupt.c |
601 |
++++ b/arch/s390/kvm/interrupt.c |
602 |
+@@ -1051,8 +1051,7 @@ static int __inject_extcall(struct kvm_vcpu *vcpu, struct kvm_s390_irq *irq) |
603 |
+ src_id, 0, 2); |
604 |
+ |
605 |
+ /* sending vcpu invalid */ |
606 |
+- if (src_id >= KVM_MAX_VCPUS || |
607 |
+- kvm_get_vcpu(vcpu->kvm, src_id) == NULL) |
608 |
++ if (kvm_get_vcpu_by_id(vcpu->kvm, src_id) == NULL) |
609 |
+ return -EINVAL; |
610 |
+ |
611 |
+ if (sclp.has_sigpif) |
612 |
+@@ -1131,6 +1130,10 @@ static int __inject_sigp_emergency(struct kvm_vcpu *vcpu, |
613 |
+ trace_kvm_s390_inject_vcpu(vcpu->vcpu_id, KVM_S390_INT_EMERGENCY, |
614 |
+ irq->u.emerg.code, 0, 2); |
615 |
+ |
616 |
++ /* sending vcpu invalid */ |
617 |
++ if (kvm_get_vcpu_by_id(vcpu->kvm, irq->u.emerg.code) == NULL) |
618 |
++ return -EINVAL; |
619 |
++ |
620 |
+ set_bit(irq->u.emerg.code, li->sigp_emerg_pending); |
621 |
+ set_bit(IRQ_PEND_EXT_EMERGENCY, &li->pending_irqs); |
622 |
+ atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags); |
623 |
+diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c |
624 |
+index f32f843a3631..4a001c1b5a1a 100644 |
625 |
+--- a/arch/s390/kvm/kvm-s390.c |
626 |
++++ b/arch/s390/kvm/kvm-s390.c |
627 |
+@@ -289,12 +289,16 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap) |
628 |
+ r = 0; |
629 |
+ break; |
630 |
+ case KVM_CAP_S390_VECTOR_REGISTERS: |
631 |
+- if (MACHINE_HAS_VX) { |
632 |
++ mutex_lock(&kvm->lock); |
633 |
++ if (atomic_read(&kvm->online_vcpus)) { |
634 |
++ r = -EBUSY; |
635 |
++ } else if (MACHINE_HAS_VX) { |
636 |
+ set_kvm_facility(kvm->arch.model.fac->mask, 129); |
637 |
+ set_kvm_facility(kvm->arch.model.fac->list, 129); |
638 |
+ r = 0; |
639 |
+ } else |
640 |
+ r = -EINVAL; |
641 |
++ mutex_unlock(&kvm->lock); |
642 |
+ break; |
643 |
+ case KVM_CAP_S390_USER_STSI: |
644 |
+ kvm->arch.user_stsi = 1; |
645 |
+@@ -1037,7 +1041,9 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) |
646 |
+ if (!kvm->arch.sca) |
647 |
+ goto out_err; |
648 |
+ spin_lock(&kvm_lock); |
649 |
+- sca_offset = (sca_offset + 16) & 0x7f0; |
650 |
++ sca_offset += 16; |
651 |
++ if (sca_offset + sizeof(struct sca_block) > PAGE_SIZE) |
652 |
++ sca_offset = 0; |
653 |
+ kvm->arch.sca = (struct sca_block *) ((char *) kvm->arch.sca + sca_offset); |
654 |
+ spin_unlock(&kvm_lock); |
655 |
+ |
656 |
+diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c |
657 |
+index 72e58bd2bee7..7171056fc24d 100644 |
658 |
+--- a/arch/s390/kvm/sigp.c |
659 |
++++ b/arch/s390/kvm/sigp.c |
660 |
+@@ -294,12 +294,8 @@ static int handle_sigp_dst(struct kvm_vcpu *vcpu, u8 order_code, |
661 |
+ u16 cpu_addr, u32 parameter, u64 *status_reg) |
662 |
+ { |
663 |
+ int rc; |
664 |
+- struct kvm_vcpu *dst_vcpu; |
665 |
++ struct kvm_vcpu *dst_vcpu = kvm_get_vcpu_by_id(vcpu->kvm, cpu_addr); |
666 |
+ |
667 |
+- if (cpu_addr >= KVM_MAX_VCPUS) |
668 |
+- return SIGP_CC_NOT_OPERATIONAL; |
669 |
+- |
670 |
+- dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr); |
671 |
+ if (!dst_vcpu) |
672 |
+ return SIGP_CC_NOT_OPERATIONAL; |
673 |
+ |
674 |
+@@ -481,7 +477,7 @@ int kvm_s390_handle_sigp_pei(struct kvm_vcpu *vcpu) |
675 |
+ trace_kvm_s390_handle_sigp_pei(vcpu, order_code, cpu_addr); |
676 |
+ |
677 |
+ if (order_code == SIGP_EXTERNAL_CALL) { |
678 |
+- dest_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr); |
679 |
++ dest_vcpu = kvm_get_vcpu_by_id(vcpu->kvm, cpu_addr); |
680 |
+ BUG_ON(dest_vcpu == NULL); |
681 |
+ |
682 |
+ kvm_s390_vcpu_wakeup(dest_vcpu); |
683 |
+diff --git a/arch/tile/kernel/usb.c b/arch/tile/kernel/usb.c |
684 |
+index f0da5a237e94..9f1e05e12255 100644 |
685 |
+--- a/arch/tile/kernel/usb.c |
686 |
++++ b/arch/tile/kernel/usb.c |
687 |
+@@ -22,6 +22,7 @@ |
688 |
+ #include <linux/platform_device.h> |
689 |
+ #include <linux/usb/tilegx.h> |
690 |
+ #include <linux/init.h> |
691 |
++#include <linux/module.h> |
692 |
+ #include <linux/types.h> |
693 |
+ |
694 |
+ static u64 ehci_dmamask = DMA_BIT_MASK(32); |
695 |
+diff --git a/arch/x86/include/asm/i8259.h b/arch/x86/include/asm/i8259.h |
696 |
+index ccffa53750a8..39bcefc20de7 100644 |
697 |
+--- a/arch/x86/include/asm/i8259.h |
698 |
++++ b/arch/x86/include/asm/i8259.h |
699 |
+@@ -60,6 +60,7 @@ struct legacy_pic { |
700 |
+ void (*mask_all)(void); |
701 |
+ void (*restore_mask)(void); |
702 |
+ void (*init)(int auto_eoi); |
703 |
++ int (*probe)(void); |
704 |
+ int (*irq_pending)(unsigned int irq); |
705 |
+ void (*make_irq)(unsigned int irq); |
706 |
+ }; |
707 |
+diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h |
708 |
+index e16466ec473c..e9cd7befcb76 100644 |
709 |
+--- a/arch/x86/include/asm/kvm_emulate.h |
710 |
++++ b/arch/x86/include/asm/kvm_emulate.h |
711 |
+@@ -112,6 +112,16 @@ struct x86_emulate_ops { |
712 |
+ struct x86_exception *fault); |
713 |
+ |
714 |
+ /* |
715 |
++ * read_phys: Read bytes of standard (non-emulated/special) memory. |
716 |
++ * Used for descriptor reading. |
717 |
++ * @addr: [IN ] Physical address from which to read. |
718 |
++ * @val: [OUT] Value read from memory. |
719 |
++ * @bytes: [IN ] Number of bytes to read from memory. |
720 |
++ */ |
721 |
++ int (*read_phys)(struct x86_emulate_ctxt *ctxt, unsigned long addr, |
722 |
++ void *val, unsigned int bytes); |
723 |
++ |
724 |
++ /* |
725 |
+ * write_std: Write bytes of standard (non-emulated/special) memory. |
726 |
+ * Used for descriptor writing. |
727 |
+ * @addr: [IN ] Linear address to which to write. |
728 |
+diff --git a/arch/x86/include/uapi/asm/svm.h b/arch/x86/include/uapi/asm/svm.h |
729 |
+index b5d7640abc5d..8a4add8e4639 100644 |
730 |
+--- a/arch/x86/include/uapi/asm/svm.h |
731 |
++++ b/arch/x86/include/uapi/asm/svm.h |
732 |
+@@ -100,6 +100,7 @@ |
733 |
+ { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, \ |
734 |
+ { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, \ |
735 |
+ { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, \ |
736 |
++ { SVM_EXIT_EXCP_BASE + AC_VECTOR, "AC excp" }, \ |
737 |
+ { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, \ |
738 |
+ { SVM_EXIT_INTR, "interrupt" }, \ |
739 |
+ { SVM_EXIT_NMI, "nmi" }, \ |
740 |
+diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c |
741 |
+index 2683f36e4e0a..ea4ba83ca0cf 100644 |
742 |
+--- a/arch/x86/kernel/apic/vector.c |
743 |
++++ b/arch/x86/kernel/apic/vector.c |
744 |
+@@ -360,7 +360,11 @@ int __init arch_probe_nr_irqs(void) |
745 |
+ if (nr < nr_irqs) |
746 |
+ nr_irqs = nr; |
747 |
+ |
748 |
+- return nr_legacy_irqs(); |
749 |
++ /* |
750 |
++ * We don't know if PIC is present at this point so we need to do |
751 |
++ * probe() to get the right number of legacy IRQs. |
752 |
++ */ |
753 |
++ return legacy_pic->probe(); |
754 |
+ } |
755 |
+ |
756 |
+ #ifdef CONFIG_X86_IO_APIC |
757 |
+diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c |
758 |
+index cb9e5df42dd2..e4f929d97c42 100644 |
759 |
+--- a/arch/x86/kernel/cpu/common.c |
760 |
++++ b/arch/x86/kernel/cpu/common.c |
761 |
+@@ -272,10 +272,9 @@ __setup("nosmap", setup_disable_smap); |
762 |
+ |
763 |
+ static __always_inline void setup_smap(struct cpuinfo_x86 *c) |
764 |
+ { |
765 |
+- unsigned long eflags; |
766 |
++ unsigned long eflags = native_save_fl(); |
767 |
+ |
768 |
+ /* This should have been cleared long ago */ |
769 |
+- raw_local_save_flags(eflags); |
770 |
+ BUG_ON(eflags & X86_EFLAGS_AC); |
771 |
+ |
772 |
+ if (cpu_has(c, X86_FEATURE_SMAP)) { |
773 |
+diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c |
774 |
+index 50ec9af1bd51..6545e6ddbfb1 100644 |
775 |
+--- a/arch/x86/kernel/fpu/signal.c |
776 |
++++ b/arch/x86/kernel/fpu/signal.c |
777 |
+@@ -385,20 +385,19 @@ fpu__alloc_mathframe(unsigned long sp, int ia32_frame, |
778 |
+ */ |
779 |
+ void fpu__init_prepare_fx_sw_frame(void) |
780 |
+ { |
781 |
+- int fsave_header_size = sizeof(struct fregs_state); |
782 |
+ int size = xstate_size + FP_XSTATE_MAGIC2_SIZE; |
783 |
+ |
784 |
+- if (config_enabled(CONFIG_X86_32)) |
785 |
+- size += fsave_header_size; |
786 |
+- |
787 |
+ fx_sw_reserved.magic1 = FP_XSTATE_MAGIC1; |
788 |
+ fx_sw_reserved.extended_size = size; |
789 |
+ fx_sw_reserved.xfeatures = xfeatures_mask; |
790 |
+ fx_sw_reserved.xstate_size = xstate_size; |
791 |
+ |
792 |
+- if (config_enabled(CONFIG_IA32_EMULATION)) { |
793 |
++ if (config_enabled(CONFIG_IA32_EMULATION) || |
794 |
++ config_enabled(CONFIG_X86_32)) { |
795 |
++ int fsave_header_size = sizeof(struct fregs_state); |
796 |
++ |
797 |
+ fx_sw_reserved_ia32 = fx_sw_reserved; |
798 |
+- fx_sw_reserved_ia32.extended_size += fsave_header_size; |
799 |
++ fx_sw_reserved_ia32.extended_size = size + fsave_header_size; |
800 |
+ } |
801 |
+ } |
802 |
+ |
803 |
+diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c |
804 |
+index 62fc001c7846..2c4ac072a702 100644 |
805 |
+--- a/arch/x86/kernel/fpu/xstate.c |
806 |
++++ b/arch/x86/kernel/fpu/xstate.c |
807 |
+@@ -402,7 +402,6 @@ void *get_xsave_addr(struct xregs_state *xsave, int xstate_feature) |
808 |
+ if (!boot_cpu_has(X86_FEATURE_XSAVE)) |
809 |
+ return NULL; |
810 |
+ |
811 |
+- xsave = ¤t->thread.fpu.state.xsave; |
812 |
+ /* |
813 |
+ * We should not ever be requesting features that we |
814 |
+ * have not enabled. Remember that pcntxt_mask is |
815 |
+diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S |
816 |
+index 1d40ca8a73f2..ffdc0e860390 100644 |
817 |
+--- a/arch/x86/kernel/head_64.S |
818 |
++++ b/arch/x86/kernel/head_64.S |
819 |
+@@ -65,6 +65,9 @@ startup_64: |
820 |
+ * tables and then reload them. |
821 |
+ */ |
822 |
+ |
823 |
++ /* Sanitize CPU configuration */ |
824 |
++ call verify_cpu |
825 |
++ |
826 |
+ /* |
827 |
+ * Compute the delta between the address I am compiled to run at and the |
828 |
+ * address I am actually running at. |
829 |
+@@ -174,6 +177,9 @@ ENTRY(secondary_startup_64) |
830 |
+ * after the boot processor executes this code. |
831 |
+ */ |
832 |
+ |
833 |
++ /* Sanitize CPU configuration */ |
834 |
++ call verify_cpu |
835 |
++ |
836 |
+ movq $(init_level4_pgt - __START_KERNEL_map), %rax |
837 |
+ 1: |
838 |
+ |
839 |
+@@ -288,6 +294,8 @@ ENTRY(secondary_startup_64) |
840 |
+ pushq %rax # target address in negative space |
841 |
+ lretq |
842 |
+ |
843 |
++#include "verify_cpu.S" |
844 |
++ |
845 |
+ #ifdef CONFIG_HOTPLUG_CPU |
846 |
+ /* |
847 |
+ * Boot CPU0 entry point. It's called from play_dead(). Everything has been set |
848 |
+diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c |
849 |
+index 16cb827a5b27..be22f5a2192e 100644 |
850 |
+--- a/arch/x86/kernel/i8259.c |
851 |
++++ b/arch/x86/kernel/i8259.c |
852 |
+@@ -295,16 +295,11 @@ static void unmask_8259A(void) |
853 |
+ raw_spin_unlock_irqrestore(&i8259A_lock, flags); |
854 |
+ } |
855 |
+ |
856 |
+-static void init_8259A(int auto_eoi) |
857 |
++static int probe_8259A(void) |
858 |
+ { |
859 |
+ unsigned long flags; |
860 |
+ unsigned char probe_val = ~(1 << PIC_CASCADE_IR); |
861 |
+ unsigned char new_val; |
862 |
+- |
863 |
+- i8259A_auto_eoi = auto_eoi; |
864 |
+- |
865 |
+- raw_spin_lock_irqsave(&i8259A_lock, flags); |
866 |
+- |
867 |
+ /* |
868 |
+ * Check to see if we have a PIC. |
869 |
+ * Mask all except the cascade and read |
870 |
+@@ -312,16 +307,28 @@ static void init_8259A(int auto_eoi) |
871 |
+ * have a PIC, we will read 0xff as opposed to the |
872 |
+ * value we wrote. |
873 |
+ */ |
874 |
++ raw_spin_lock_irqsave(&i8259A_lock, flags); |
875 |
++ |
876 |
+ outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */ |
877 |
+ outb(probe_val, PIC_MASTER_IMR); |
878 |
+ new_val = inb(PIC_MASTER_IMR); |
879 |
+ if (new_val != probe_val) { |
880 |
+ printk(KERN_INFO "Using NULL legacy PIC\n"); |
881 |
+ legacy_pic = &null_legacy_pic; |
882 |
+- raw_spin_unlock_irqrestore(&i8259A_lock, flags); |
883 |
+- return; |
884 |
+ } |
885 |
+ |
886 |
++ raw_spin_unlock_irqrestore(&i8259A_lock, flags); |
887 |
++ return nr_legacy_irqs(); |
888 |
++} |
889 |
++ |
890 |
++static void init_8259A(int auto_eoi) |
891 |
++{ |
892 |
++ unsigned long flags; |
893 |
++ |
894 |
++ i8259A_auto_eoi = auto_eoi; |
895 |
++ |
896 |
++ raw_spin_lock_irqsave(&i8259A_lock, flags); |
897 |
++ |
898 |
+ outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */ |
899 |
+ |
900 |
+ /* |
901 |
+@@ -379,6 +386,10 @@ static int legacy_pic_irq_pending_noop(unsigned int irq) |
902 |
+ { |
903 |
+ return 0; |
904 |
+ } |
905 |
++static int legacy_pic_probe(void) |
906 |
++{ |
907 |
++ return 0; |
908 |
++} |
909 |
+ |
910 |
+ struct legacy_pic null_legacy_pic = { |
911 |
+ .nr_legacy_irqs = 0, |
912 |
+@@ -388,6 +399,7 @@ struct legacy_pic null_legacy_pic = { |
913 |
+ .mask_all = legacy_pic_noop, |
914 |
+ .restore_mask = legacy_pic_noop, |
915 |
+ .init = legacy_pic_int_noop, |
916 |
++ .probe = legacy_pic_probe, |
917 |
+ .irq_pending = legacy_pic_irq_pending_noop, |
918 |
+ .make_irq = legacy_pic_uint_noop, |
919 |
+ }; |
920 |
+@@ -400,6 +412,7 @@ struct legacy_pic default_legacy_pic = { |
921 |
+ .mask_all = mask_8259A, |
922 |
+ .restore_mask = unmask_8259A, |
923 |
+ .init = init_8259A, |
924 |
++ .probe = probe_8259A, |
925 |
+ .irq_pending = i8259A_irq_pending, |
926 |
+ .make_irq = make_8259A_irq, |
927 |
+ }; |
928 |
+diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c |
929 |
+index 80f874bf999e..1e6f70f1f251 100644 |
930 |
+--- a/arch/x86/kernel/setup.c |
931 |
++++ b/arch/x86/kernel/setup.c |
932 |
+@@ -1198,6 +1198,14 @@ void __init setup_arch(char **cmdline_p) |
933 |
+ clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, |
934 |
+ swapper_pg_dir + KERNEL_PGD_BOUNDARY, |
935 |
+ KERNEL_PGD_PTRS); |
936 |
++ |
937 |
++ /* |
938 |
++ * sync back low identity map too. It is used for example |
939 |
++ * in the 32-bit EFI stub. |
940 |
++ */ |
941 |
++ clone_pgd_range(initial_page_table, |
942 |
++ swapper_pg_dir + KERNEL_PGD_BOUNDARY, |
943 |
++ min(KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY)); |
944 |
+ #endif |
945 |
+ |
946 |
+ tboot_probe(); |
947 |
+diff --git a/arch/x86/kernel/verify_cpu.S b/arch/x86/kernel/verify_cpu.S |
948 |
+index b9242bacbe59..4cf401f581e7 100644 |
949 |
+--- a/arch/x86/kernel/verify_cpu.S |
950 |
++++ b/arch/x86/kernel/verify_cpu.S |
951 |
+@@ -34,10 +34,11 @@ |
952 |
+ #include <asm/msr-index.h> |
953 |
+ |
954 |
+ verify_cpu: |
955 |
+- pushfl # Save caller passed flags |
956 |
+- pushl $0 # Kill any dangerous flags |
957 |
+- popfl |
958 |
++ pushf # Save caller passed flags |
959 |
++ push $0 # Kill any dangerous flags |
960 |
++ popf |
961 |
+ |
962 |
++#ifndef __x86_64__ |
963 |
+ pushfl # standard way to check for cpuid |
964 |
+ popl %eax |
965 |
+ movl %eax,%ebx |
966 |
+@@ -48,6 +49,7 @@ verify_cpu: |
967 |
+ popl %eax |
968 |
+ cmpl %eax,%ebx |
969 |
+ jz verify_cpu_no_longmode # cpu has no cpuid |
970 |
++#endif |
971 |
+ |
972 |
+ movl $0x0,%eax # See if cpuid 1 is implemented |
973 |
+ cpuid |
974 |
+@@ -130,10 +132,10 @@ verify_cpu_sse_test: |
975 |
+ jmp verify_cpu_sse_test # try again |
976 |
+ |
977 |
+ verify_cpu_no_longmode: |
978 |
+- popfl # Restore caller passed flags |
979 |
++ popf # Restore caller passed flags |
980 |
+ movl $1,%eax |
981 |
+ ret |
982 |
+ verify_cpu_sse_ok: |
983 |
+- popfl # Restore caller passed flags |
984 |
++ popf # Restore caller passed flags |
985 |
+ xorl %eax, %eax |
986 |
+ ret |
987 |
+diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c |
988 |
+index 2392541a96e6..f17c342355f6 100644 |
989 |
+--- a/arch/x86/kvm/emulate.c |
990 |
++++ b/arch/x86/kvm/emulate.c |
991 |
+@@ -2272,8 +2272,8 @@ static int emulator_has_longmode(struct x86_emulate_ctxt *ctxt) |
992 |
+ #define GET_SMSTATE(type, smbase, offset) \ |
993 |
+ ({ \ |
994 |
+ type __val; \ |
995 |
+- int r = ctxt->ops->read_std(ctxt, smbase + offset, &__val, \ |
996 |
+- sizeof(__val), NULL); \ |
997 |
++ int r = ctxt->ops->read_phys(ctxt, smbase + offset, &__val, \ |
998 |
++ sizeof(__val)); \ |
999 |
+ if (r != X86EMUL_CONTINUE) \ |
1000 |
+ return X86EMUL_UNHANDLEABLE; \ |
1001 |
+ __val; \ |
1002 |
+@@ -2484,17 +2484,36 @@ static int em_rsm(struct x86_emulate_ctxt *ctxt) |
1003 |
+ |
1004 |
+ /* |
1005 |
+ * Get back to real mode, to prepare a safe state in which to load |
1006 |
+- * CR0/CR3/CR4/EFER. Also this will ensure that addresses passed |
1007 |
+- * to read_std/write_std are not virtual. |
1008 |
+- * |
1009 |
+- * CR4.PCIDE must be zero, because it is a 64-bit mode only feature. |
1010 |
++ * CR0/CR3/CR4/EFER. It's all a bit more complicated if the vCPU |
1011 |
++ * supports long mode. |
1012 |
+ */ |
1013 |
++ cr4 = ctxt->ops->get_cr(ctxt, 4); |
1014 |
++ if (emulator_has_longmode(ctxt)) { |
1015 |
++ struct desc_struct cs_desc; |
1016 |
++ |
1017 |
++ /* Zero CR4.PCIDE before CR0.PG. */ |
1018 |
++ if (cr4 & X86_CR4_PCIDE) { |
1019 |
++ ctxt->ops->set_cr(ctxt, 4, cr4 & ~X86_CR4_PCIDE); |
1020 |
++ cr4 &= ~X86_CR4_PCIDE; |
1021 |
++ } |
1022 |
++ |
1023 |
++ /* A 32-bit code segment is required to clear EFER.LMA. */ |
1024 |
++ memset(&cs_desc, 0, sizeof(cs_desc)); |
1025 |
++ cs_desc.type = 0xb; |
1026 |
++ cs_desc.s = cs_desc.g = cs_desc.p = 1; |
1027 |
++ ctxt->ops->set_segment(ctxt, 0, &cs_desc, 0, VCPU_SREG_CS); |
1028 |
++ } |
1029 |
++ |
1030 |
++ /* For the 64-bit case, this will clear EFER.LMA. */ |
1031 |
+ cr0 = ctxt->ops->get_cr(ctxt, 0); |
1032 |
+ if (cr0 & X86_CR0_PE) |
1033 |
+ ctxt->ops->set_cr(ctxt, 0, cr0 & ~(X86_CR0_PG | X86_CR0_PE)); |
1034 |
+- cr4 = ctxt->ops->get_cr(ctxt, 4); |
1035 |
++ |
1036 |
++ /* Now clear CR4.PAE (which must be done before clearing EFER.LME). */ |
1037 |
+ if (cr4 & X86_CR4_PAE) |
1038 |
+ ctxt->ops->set_cr(ctxt, 4, cr4 & ~X86_CR4_PAE); |
1039 |
++ |
1040 |
++ /* And finally go back to 32-bit mode. */ |
1041 |
+ efer = 0; |
1042 |
+ ctxt->ops->set_msr(ctxt, MSR_EFER, efer); |
1043 |
+ |
1044 |
+@@ -4455,7 +4474,7 @@ static const struct opcode twobyte_table[256] = { |
1045 |
+ F(DstMem | SrcReg | Src2CL | ModRM, em_shld), N, N, |
1046 |
+ /* 0xA8 - 0xAF */ |
1047 |
+ I(Stack | Src2GS, em_push_sreg), I(Stack | Src2GS, em_pop_sreg), |
1048 |
+- II(No64 | EmulateOnUD | ImplicitOps, em_rsm, rsm), |
1049 |
++ II(EmulateOnUD | ImplicitOps, em_rsm, rsm), |
1050 |
+ F(DstMem | SrcReg | ModRM | BitOp | Lock | PageTable, em_bts), |
1051 |
+ F(DstMem | SrcReg | Src2ImmByte | ModRM, em_shrd), |
1052 |
+ F(DstMem | SrcReg | Src2CL | ModRM, em_shrd), |
1053 |
+diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c |
1054 |
+index 2a5ca97c263b..236e346584c3 100644 |
1055 |
+--- a/arch/x86/kvm/lapic.c |
1056 |
++++ b/arch/x86/kvm/lapic.c |
1057 |
+@@ -348,6 +348,8 @@ void kvm_apic_update_irr(struct kvm_vcpu *vcpu, u32 *pir) |
1058 |
+ struct kvm_lapic *apic = vcpu->arch.apic; |
1059 |
+ |
1060 |
+ __kvm_apic_update_irr(pir, apic->regs); |
1061 |
++ |
1062 |
++ kvm_make_request(KVM_REQ_EVENT, vcpu); |
1063 |
+ } |
1064 |
+ EXPORT_SYMBOL_GPL(kvm_apic_update_irr); |
1065 |
+ |
1066 |
+diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
1067 |
+index 2d32b67a1043..00da6e85a27f 100644 |
1068 |
+--- a/arch/x86/kvm/svm.c |
1069 |
++++ b/arch/x86/kvm/svm.c |
1070 |
+@@ -1085,7 +1085,7 @@ static u64 svm_compute_tsc_offset(struct kvm_vcpu *vcpu, u64 target_tsc) |
1071 |
+ return target_tsc - tsc; |
1072 |
+ } |
1073 |
+ |
1074 |
+-static void init_vmcb(struct vcpu_svm *svm, bool init_event) |
1075 |
++static void init_vmcb(struct vcpu_svm *svm) |
1076 |
+ { |
1077 |
+ struct vmcb_control_area *control = &svm->vmcb->control; |
1078 |
+ struct vmcb_save_area *save = &svm->vmcb->save; |
1079 |
+@@ -1106,6 +1106,7 @@ static void init_vmcb(struct vcpu_svm *svm, bool init_event) |
1080 |
+ set_exception_intercept(svm, PF_VECTOR); |
1081 |
+ set_exception_intercept(svm, UD_VECTOR); |
1082 |
+ set_exception_intercept(svm, MC_VECTOR); |
1083 |
++ set_exception_intercept(svm, AC_VECTOR); |
1084 |
+ |
1085 |
+ set_intercept(svm, INTERCEPT_INTR); |
1086 |
+ set_intercept(svm, INTERCEPT_NMI); |
1087 |
+@@ -1156,8 +1157,7 @@ static void init_vmcb(struct vcpu_svm *svm, bool init_event) |
1088 |
+ init_sys_seg(&save->ldtr, SEG_TYPE_LDT); |
1089 |
+ init_sys_seg(&save->tr, SEG_TYPE_BUSY_TSS16); |
1090 |
+ |
1091 |
+- if (!init_event) |
1092 |
+- svm_set_efer(&svm->vcpu, 0); |
1093 |
++ svm_set_efer(&svm->vcpu, 0); |
1094 |
+ save->dr6 = 0xffff0ff0; |
1095 |
+ kvm_set_rflags(&svm->vcpu, 2); |
1096 |
+ save->rip = 0x0000fff0; |
1097 |
+@@ -1211,7 +1211,7 @@ static void svm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) |
1098 |
+ if (kvm_vcpu_is_reset_bsp(&svm->vcpu)) |
1099 |
+ svm->vcpu.arch.apic_base |= MSR_IA32_APICBASE_BSP; |
1100 |
+ } |
1101 |
+- init_vmcb(svm, init_event); |
1102 |
++ init_vmcb(svm); |
1103 |
+ |
1104 |
+ kvm_cpuid(vcpu, &eax, &dummy, &dummy, &dummy); |
1105 |
+ kvm_register_write(vcpu, VCPU_REGS_RDX, eax); |
1106 |
+@@ -1267,7 +1267,7 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) |
1107 |
+ clear_page(svm->vmcb); |
1108 |
+ svm->vmcb_pa = page_to_pfn(page) << PAGE_SHIFT; |
1109 |
+ svm->asid_generation = 0; |
1110 |
+- init_vmcb(svm, false); |
1111 |
++ init_vmcb(svm); |
1112 |
+ |
1113 |
+ svm_init_osvw(&svm->vcpu); |
1114 |
+ |
1115 |
+@@ -1795,6 +1795,12 @@ static int ud_interception(struct vcpu_svm *svm) |
1116 |
+ return 1; |
1117 |
+ } |
1118 |
+ |
1119 |
++static int ac_interception(struct vcpu_svm *svm) |
1120 |
++{ |
1121 |
++ kvm_queue_exception_e(&svm->vcpu, AC_VECTOR, 0); |
1122 |
++ return 1; |
1123 |
++} |
1124 |
++ |
1125 |
+ static void svm_fpu_activate(struct kvm_vcpu *vcpu) |
1126 |
+ { |
1127 |
+ struct vcpu_svm *svm = to_svm(vcpu); |
1128 |
+@@ -1889,7 +1895,7 @@ static int shutdown_interception(struct vcpu_svm *svm) |
1129 |
+ * so reinitialize it. |
1130 |
+ */ |
1131 |
+ clear_page(svm->vmcb); |
1132 |
+- init_vmcb(svm, false); |
1133 |
++ init_vmcb(svm); |
1134 |
+ |
1135 |
+ kvm_run->exit_reason = KVM_EXIT_SHUTDOWN; |
1136 |
+ return 0; |
1137 |
+@@ -3369,6 +3375,7 @@ static int (*const svm_exit_handlers[])(struct vcpu_svm *svm) = { |
1138 |
+ [SVM_EXIT_EXCP_BASE + PF_VECTOR] = pf_interception, |
1139 |
+ [SVM_EXIT_EXCP_BASE + NM_VECTOR] = nm_interception, |
1140 |
+ [SVM_EXIT_EXCP_BASE + MC_VECTOR] = mc_interception, |
1141 |
++ [SVM_EXIT_EXCP_BASE + AC_VECTOR] = ac_interception, |
1142 |
+ [SVM_EXIT_INTR] = intr_interception, |
1143 |
+ [SVM_EXIT_NMI] = nmi_interception, |
1144 |
+ [SVM_EXIT_SMI] = nop_on_interception, |
1145 |
+diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
1146 |
+index aa9e8229571d..e77d75b8772a 100644 |
1147 |
+--- a/arch/x86/kvm/vmx.c |
1148 |
++++ b/arch/x86/kvm/vmx.c |
1149 |
+@@ -1567,7 +1567,7 @@ static void update_exception_bitmap(struct kvm_vcpu *vcpu) |
1150 |
+ u32 eb; |
1151 |
+ |
1152 |
+ eb = (1u << PF_VECTOR) | (1u << UD_VECTOR) | (1u << MC_VECTOR) | |
1153 |
+- (1u << NM_VECTOR) | (1u << DB_VECTOR); |
1154 |
++ (1u << NM_VECTOR) | (1u << DB_VECTOR) | (1u << AC_VECTOR); |
1155 |
+ if ((vcpu->guest_debug & |
1156 |
+ (KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP)) == |
1157 |
+ (KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP)) |
1158 |
+@@ -4780,8 +4780,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) |
1159 |
+ vmx_set_cr0(vcpu, cr0); /* enter rmode */ |
1160 |
+ vmx->vcpu.arch.cr0 = cr0; |
1161 |
+ vmx_set_cr4(vcpu, 0); |
1162 |
+- if (!init_event) |
1163 |
+- vmx_set_efer(vcpu, 0); |
1164 |
++ vmx_set_efer(vcpu, 0); |
1165 |
+ vmx_fpu_activate(vcpu); |
1166 |
+ update_exception_bitmap(vcpu); |
1167 |
+ |
1168 |
+@@ -5118,6 +5117,9 @@ static int handle_exception(struct kvm_vcpu *vcpu) |
1169 |
+ return handle_rmode_exception(vcpu, ex_no, error_code); |
1170 |
+ |
1171 |
+ switch (ex_no) { |
1172 |
++ case AC_VECTOR: |
1173 |
++ kvm_queue_exception_e(vcpu, AC_VECTOR, error_code); |
1174 |
++ return 1; |
1175 |
+ case DB_VECTOR: |
1176 |
+ dr6 = vmcs_readl(EXIT_QUALIFICATION); |
1177 |
+ if (!(vcpu->guest_debug & |
1178 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
1179 |
+index 373328b71599..2781e2b0201d 100644 |
1180 |
+--- a/arch/x86/kvm/x86.c |
1181 |
++++ b/arch/x86/kvm/x86.c |
1182 |
+@@ -621,7 +621,9 @@ int kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) |
1183 |
+ if ((cr0 ^ old_cr0) & update_bits) |
1184 |
+ kvm_mmu_reset_context(vcpu); |
1185 |
+ |
1186 |
+- if ((cr0 ^ old_cr0) & X86_CR0_CD) |
1187 |
++ if (((cr0 ^ old_cr0) & X86_CR0_CD) && |
1188 |
++ kvm_arch_has_noncoherent_dma(vcpu->kvm) && |
1189 |
++ !kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_CD_NW_CLEARED)) |
1190 |
+ kvm_zap_gfn_range(vcpu->kvm, 0, ~0ULL); |
1191 |
+ |
1192 |
+ return 0; |
1193 |
+@@ -4260,6 +4262,15 @@ static int kvm_read_guest_virt_system(struct x86_emulate_ctxt *ctxt, |
1194 |
+ return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, 0, exception); |
1195 |
+ } |
1196 |
+ |
1197 |
++static int kvm_read_guest_phys_system(struct x86_emulate_ctxt *ctxt, |
1198 |
++ unsigned long addr, void *val, unsigned int bytes) |
1199 |
++{ |
1200 |
++ struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt); |
1201 |
++ int r = kvm_vcpu_read_guest(vcpu, addr, val, bytes); |
1202 |
++ |
1203 |
++ return r < 0 ? X86EMUL_IO_NEEDED : X86EMUL_CONTINUE; |
1204 |
++} |
1205 |
++ |
1206 |
+ int kvm_write_guest_virt_system(struct x86_emulate_ctxt *ctxt, |
1207 |
+ gva_t addr, void *val, |
1208 |
+ unsigned int bytes, |
1209 |
+@@ -4995,6 +5006,7 @@ static const struct x86_emulate_ops emulate_ops = { |
1210 |
+ .write_gpr = emulator_write_gpr, |
1211 |
+ .read_std = kvm_read_guest_virt_system, |
1212 |
+ .write_std = kvm_write_guest_virt_system, |
1213 |
++ .read_phys = kvm_read_guest_phys_system, |
1214 |
+ .fetch = kvm_fetch_guest_virt, |
1215 |
+ .read_emulated = emulator_read_emulated, |
1216 |
+ .write_emulated = emulator_write_emulated, |
1217 |
+diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c |
1218 |
+index db1b0bc5017c..c28f6185f8a4 100644 |
1219 |
+--- a/arch/x86/mm/mpx.c |
1220 |
++++ b/arch/x86/mm/mpx.c |
1221 |
+@@ -622,6 +622,29 @@ static unsigned long mpx_bd_entry_to_bt_addr(struct mm_struct *mm, |
1222 |
+ } |
1223 |
+ |
1224 |
+ /* |
1225 |
++ * We only want to do a 4-byte get_user() on 32-bit. Otherwise, |
1226 |
++ * we might run off the end of the bounds table if we are on |
1227 |
++ * a 64-bit kernel and try to get 8 bytes. |
1228 |
++ */ |
1229 |
++int get_user_bd_entry(struct mm_struct *mm, unsigned long *bd_entry_ret, |
1230 |
++ long __user *bd_entry_ptr) |
1231 |
++{ |
1232 |
++ u32 bd_entry_32; |
1233 |
++ int ret; |
1234 |
++ |
1235 |
++ if (is_64bit_mm(mm)) |
1236 |
++ return get_user(*bd_entry_ret, bd_entry_ptr); |
1237 |
++ |
1238 |
++ /* |
1239 |
++ * Note that get_user() uses the type of the *pointer* to |
1240 |
++ * establish the size of the get, not the destination. |
1241 |
++ */ |
1242 |
++ ret = get_user(bd_entry_32, (u32 __user *)bd_entry_ptr); |
1243 |
++ *bd_entry_ret = bd_entry_32; |
1244 |
++ return ret; |
1245 |
++} |
1246 |
++ |
1247 |
++/* |
1248 |
+ * Get the base of bounds tables pointed by specific bounds |
1249 |
+ * directory entry. |
1250 |
+ */ |
1251 |
+@@ -641,7 +664,7 @@ static int get_bt_addr(struct mm_struct *mm, |
1252 |
+ int need_write = 0; |
1253 |
+ |
1254 |
+ pagefault_disable(); |
1255 |
+- ret = get_user(bd_entry, bd_entry_ptr); |
1256 |
++ ret = get_user_bd_entry(mm, &bd_entry, bd_entry_ptr); |
1257 |
+ pagefault_enable(); |
1258 |
+ if (!ret) |
1259 |
+ break; |
1260 |
+@@ -736,11 +759,23 @@ static unsigned long mpx_get_bt_entry_offset_bytes(struct mm_struct *mm, |
1261 |
+ */ |
1262 |
+ static inline unsigned long bd_entry_virt_space(struct mm_struct *mm) |
1263 |
+ { |
1264 |
+- unsigned long long virt_space = (1ULL << boot_cpu_data.x86_virt_bits); |
1265 |
+- if (is_64bit_mm(mm)) |
1266 |
+- return virt_space / MPX_BD_NR_ENTRIES_64; |
1267 |
+- else |
1268 |
+- return virt_space / MPX_BD_NR_ENTRIES_32; |
1269 |
++ unsigned long long virt_space; |
1270 |
++ unsigned long long GB = (1ULL << 30); |
1271 |
++ |
1272 |
++ /* |
1273 |
++ * This covers 32-bit emulation as well as 32-bit kernels |
1274 |
++ * running on 64-bit harware. |
1275 |
++ */ |
1276 |
++ if (!is_64bit_mm(mm)) |
1277 |
++ return (4ULL * GB) / MPX_BD_NR_ENTRIES_32; |
1278 |
++ |
1279 |
++ /* |
1280 |
++ * 'x86_virt_bits' returns what the hardware is capable |
1281 |
++ * of, and returns the full >32-bit adddress space when |
1282 |
++ * running 32-bit kernels on 64-bit hardware. |
1283 |
++ */ |
1284 |
++ virt_space = (1ULL << boot_cpu_data.x86_virt_bits); |
1285 |
++ return virt_space / MPX_BD_NR_ENTRIES_64; |
1286 |
+ } |
1287 |
+ |
1288 |
+ /* |
1289 |
+diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c |
1290 |
+index e527a3e13939..fa893c3ec408 100644 |
1291 |
+--- a/drivers/bluetooth/ath3k.c |
1292 |
++++ b/drivers/bluetooth/ath3k.c |
1293 |
+@@ -93,6 +93,7 @@ static const struct usb_device_id ath3k_table[] = { |
1294 |
+ { USB_DEVICE(0x04CA, 0x300f) }, |
1295 |
+ { USB_DEVICE(0x04CA, 0x3010) }, |
1296 |
+ { USB_DEVICE(0x0930, 0x0219) }, |
1297 |
++ { USB_DEVICE(0x0930, 0x021c) }, |
1298 |
+ { USB_DEVICE(0x0930, 0x0220) }, |
1299 |
+ { USB_DEVICE(0x0930, 0x0227) }, |
1300 |
+ { USB_DEVICE(0x0b05, 0x17d0) }, |
1301 |
+@@ -104,6 +105,7 @@ static const struct usb_device_id ath3k_table[] = { |
1302 |
+ { USB_DEVICE(0x0CF3, 0x311F) }, |
1303 |
+ { USB_DEVICE(0x0cf3, 0x3121) }, |
1304 |
+ { USB_DEVICE(0x0CF3, 0x817a) }, |
1305 |
++ { USB_DEVICE(0x0CF3, 0x817b) }, |
1306 |
+ { USB_DEVICE(0x0cf3, 0xe003) }, |
1307 |
+ { USB_DEVICE(0x0CF3, 0xE004) }, |
1308 |
+ { USB_DEVICE(0x0CF3, 0xE005) }, |
1309 |
+@@ -153,6 +155,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { |
1310 |
+ { USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 }, |
1311 |
+ { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, |
1312 |
+ { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
1313 |
++ { USB_DEVICE(0x0930, 0x021c), .driver_info = BTUSB_ATH3012 }, |
1314 |
+ { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, |
1315 |
+ { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 }, |
1316 |
+ { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, |
1317 |
+@@ -164,6 +167,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { |
1318 |
+ { USB_DEVICE(0x0cf3, 0x311F), .driver_info = BTUSB_ATH3012 }, |
1319 |
+ { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, |
1320 |
+ { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 }, |
1321 |
++ { USB_DEVICE(0x0CF3, 0x817b), .driver_info = BTUSB_ATH3012 }, |
1322 |
+ { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
1323 |
+ { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, |
1324 |
+ { USB_DEVICE(0x0cf3, 0xe006), .driver_info = BTUSB_ATH3012 }, |
1325 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
1326 |
+index b4cf8d9c9dac..7d9b09f4158c 100644 |
1327 |
+--- a/drivers/bluetooth/btusb.c |
1328 |
++++ b/drivers/bluetooth/btusb.c |
1329 |
+@@ -192,6 +192,7 @@ static const struct usb_device_id blacklist_table[] = { |
1330 |
+ { USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 }, |
1331 |
+ { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, |
1332 |
+ { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
1333 |
++ { USB_DEVICE(0x0930, 0x021c), .driver_info = BTUSB_ATH3012 }, |
1334 |
+ { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, |
1335 |
+ { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 }, |
1336 |
+ { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, |
1337 |
+@@ -203,6 +204,7 @@ static const struct usb_device_id blacklist_table[] = { |
1338 |
+ { USB_DEVICE(0x0cf3, 0x311f), .driver_info = BTUSB_ATH3012 }, |
1339 |
+ { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, |
1340 |
+ { USB_DEVICE(0x0cf3, 0x817a), .driver_info = BTUSB_ATH3012 }, |
1341 |
++ { USB_DEVICE(0x0cf3, 0x817b), .driver_info = BTUSB_ATH3012 }, |
1342 |
+ { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, |
1343 |
+ { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
1344 |
+ { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, |
1345 |
+diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c |
1346 |
+index 2dda4e8295a9..d679ab869653 100644 |
1347 |
+--- a/drivers/clk/bcm/clk-iproc-pll.c |
1348 |
++++ b/drivers/clk/bcm/clk-iproc-pll.c |
1349 |
+@@ -345,8 +345,8 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw, |
1350 |
+ struct iproc_pll *pll = clk->pll; |
1351 |
+ const struct iproc_pll_ctrl *ctrl = pll->ctrl; |
1352 |
+ u32 val; |
1353 |
+- u64 ndiv; |
1354 |
+- unsigned int ndiv_int, ndiv_frac, pdiv; |
1355 |
++ u64 ndiv, ndiv_int, ndiv_frac; |
1356 |
++ unsigned int pdiv; |
1357 |
+ |
1358 |
+ if (parent_rate == 0) |
1359 |
+ return 0; |
1360 |
+@@ -366,22 +366,19 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw, |
1361 |
+ val = readl(pll->pll_base + ctrl->ndiv_int.offset); |
1362 |
+ ndiv_int = (val >> ctrl->ndiv_int.shift) & |
1363 |
+ bit_mask(ctrl->ndiv_int.width); |
1364 |
+- ndiv = (u64)ndiv_int << ctrl->ndiv_int.shift; |
1365 |
++ ndiv = ndiv_int << 20; |
1366 |
+ |
1367 |
+ if (ctrl->flags & IPROC_CLK_PLL_HAS_NDIV_FRAC) { |
1368 |
+ val = readl(pll->pll_base + ctrl->ndiv_frac.offset); |
1369 |
+ ndiv_frac = (val >> ctrl->ndiv_frac.shift) & |
1370 |
+ bit_mask(ctrl->ndiv_frac.width); |
1371 |
+- |
1372 |
+- if (ndiv_frac != 0) |
1373 |
+- ndiv = ((u64)ndiv_int << ctrl->ndiv_int.shift) | |
1374 |
+- ndiv_frac; |
1375 |
++ ndiv += ndiv_frac; |
1376 |
+ } |
1377 |
+ |
1378 |
+ val = readl(pll->pll_base + ctrl->pdiv.offset); |
1379 |
+ pdiv = (val >> ctrl->pdiv.shift) & bit_mask(ctrl->pdiv.width); |
1380 |
+ |
1381 |
+- clk->rate = (ndiv * parent_rate) >> ctrl->ndiv_int.shift; |
1382 |
++ clk->rate = (ndiv * parent_rate) >> 20; |
1383 |
+ |
1384 |
+ if (pdiv == 0) |
1385 |
+ clk->rate *= 2; |
1386 |
+diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c |
1387 |
+index bc96f103bd7c..9064636a867f 100644 |
1388 |
+--- a/drivers/clk/versatile/clk-icst.c |
1389 |
++++ b/drivers/clk/versatile/clk-icst.c |
1390 |
+@@ -156,8 +156,10 @@ struct clk *icst_clk_register(struct device *dev, |
1391 |
+ icst->lockreg = base + desc->lock_offset; |
1392 |
+ |
1393 |
+ clk = clk_register(dev, &icst->hw); |
1394 |
+- if (IS_ERR(clk)) |
1395 |
++ if (IS_ERR(clk)) { |
1396 |
++ kfree(pclone); |
1397 |
+ kfree(icst); |
1398 |
++ } |
1399 |
+ |
1400 |
+ return clk; |
1401 |
+ } |
1402 |
+diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c |
1403 |
+index c5265c1262c5..6aacd205a774 100644 |
1404 |
+--- a/drivers/mfd/twl6040.c |
1405 |
++++ b/drivers/mfd/twl6040.c |
1406 |
+@@ -647,6 +647,8 @@ static int twl6040_probe(struct i2c_client *client, |
1407 |
+ |
1408 |
+ twl6040->clk32k = devm_clk_get(&client->dev, "clk32k"); |
1409 |
+ if (IS_ERR(twl6040->clk32k)) { |
1410 |
++ if (PTR_ERR(twl6040->clk32k) == -EPROBE_DEFER) |
1411 |
++ return -EPROBE_DEFER; |
1412 |
+ dev_info(&client->dev, "clk32k is not handled\n"); |
1413 |
+ twl6040->clk32k = NULL; |
1414 |
+ } |
1415 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
1416 |
+index a98dd4f1b0e3..cbbb1c93386d 100644 |
1417 |
+--- a/drivers/net/bonding/bond_main.c |
1418 |
++++ b/drivers/net/bonding/bond_main.c |
1419 |
+@@ -1751,6 +1751,7 @@ err_undo_flags: |
1420 |
+ slave_dev->dev_addr)) |
1421 |
+ eth_hw_addr_random(bond_dev); |
1422 |
+ if (bond_dev->type != ARPHRD_ETHER) { |
1423 |
++ dev_close(bond_dev); |
1424 |
+ ether_setup(bond_dev); |
1425 |
+ bond_dev->flags |= IFF_MASTER; |
1426 |
+ bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
1427 |
+diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c |
1428 |
+index aede704605c6..141c2a42d7ed 100644 |
1429 |
+--- a/drivers/net/can/dev.c |
1430 |
++++ b/drivers/net/can/dev.c |
1431 |
+@@ -915,7 +915,7 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) |
1432 |
+ nla_put(skb, IFLA_CAN_BITTIMING_CONST, |
1433 |
+ sizeof(*priv->bittiming_const), priv->bittiming_const)) || |
1434 |
+ |
1435 |
+- nla_put(skb, IFLA_CAN_CLOCK, sizeof(cm), &priv->clock) || |
1436 |
++ nla_put(skb, IFLA_CAN_CLOCK, sizeof(priv->clock), &priv->clock) || |
1437 |
+ nla_put_u32(skb, IFLA_CAN_STATE, state) || |
1438 |
+ nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) || |
1439 |
+ nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) || |
1440 |
+diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c |
1441 |
+index 7b92e911a616..f10834be48a5 100644 |
1442 |
+--- a/drivers/net/can/sja1000/sja1000.c |
1443 |
++++ b/drivers/net/can/sja1000/sja1000.c |
1444 |
+@@ -218,6 +218,9 @@ static void sja1000_start(struct net_device *dev) |
1445 |
+ priv->write_reg(priv, SJA1000_RXERR, 0x0); |
1446 |
+ priv->read_reg(priv, SJA1000_ECC); |
1447 |
+ |
1448 |
++ /* clear interrupt flags */ |
1449 |
++ priv->read_reg(priv, SJA1000_IR); |
1450 |
++ |
1451 |
+ /* leave reset mode */ |
1452 |
+ set_normal_mode(dev); |
1453 |
+ } |
1454 |
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c |
1455 |
+index a4473d8ff4fa..f672dba345f7 100644 |
1456 |
+--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c |
1457 |
++++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c |
1458 |
+@@ -1595,7 +1595,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) |
1459 |
+ packet->rdesc_count, 1); |
1460 |
+ |
1461 |
+ /* Make sure ownership is written to the descriptor */ |
1462 |
+- dma_wmb(); |
1463 |
++ smp_wmb(); |
1464 |
+ |
1465 |
+ ring->cur = cur_index + 1; |
1466 |
+ if (!packet->skb->xmit_more || |
1467 |
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c |
1468 |
+index aae9d5ecd182..dde0486667e0 100644 |
1469 |
+--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c |
1470 |
++++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c |
1471 |
+@@ -1807,6 +1807,7 @@ static int xgbe_tx_poll(struct xgbe_channel *channel) |
1472 |
+ struct netdev_queue *txq; |
1473 |
+ int processed = 0; |
1474 |
+ unsigned int tx_packets = 0, tx_bytes = 0; |
1475 |
++ unsigned int cur; |
1476 |
+ |
1477 |
+ DBGPR("-->xgbe_tx_poll\n"); |
1478 |
+ |
1479 |
+@@ -1814,10 +1815,15 @@ static int xgbe_tx_poll(struct xgbe_channel *channel) |
1480 |
+ if (!ring) |
1481 |
+ return 0; |
1482 |
+ |
1483 |
++ cur = ring->cur; |
1484 |
++ |
1485 |
++ /* Be sure we get ring->cur before accessing descriptor data */ |
1486 |
++ smp_rmb(); |
1487 |
++ |
1488 |
+ txq = netdev_get_tx_queue(netdev, channel->queue_index); |
1489 |
+ |
1490 |
+ while ((processed < XGBE_TX_DESC_MAX_PROC) && |
1491 |
+- (ring->dirty != ring->cur)) { |
1492 |
++ (ring->dirty != cur)) { |
1493 |
+ rdata = XGBE_GET_DESC_DATA(ring, ring->dirty); |
1494 |
+ rdesc = rdata->rdesc; |
1495 |
+ |
1496 |
+diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c |
1497 |
+index de63266de16b..5d1dde3f3540 100644 |
1498 |
+--- a/drivers/net/ethernet/freescale/fec_main.c |
1499 |
++++ b/drivers/net/ethernet/freescale/fec_main.c |
1500 |
+@@ -1775,7 +1775,7 @@ static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum) |
1501 |
+ int ret = 0; |
1502 |
+ |
1503 |
+ ret = pm_runtime_get_sync(dev); |
1504 |
+- if (IS_ERR_VALUE(ret)) |
1505 |
++ if (ret < 0) |
1506 |
+ return ret; |
1507 |
+ |
1508 |
+ fep->mii_timeout = 0; |
1509 |
+@@ -1811,11 +1811,13 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum, |
1510 |
+ struct fec_enet_private *fep = bus->priv; |
1511 |
+ struct device *dev = &fep->pdev->dev; |
1512 |
+ unsigned long time_left; |
1513 |
+- int ret = 0; |
1514 |
++ int ret; |
1515 |
+ |
1516 |
+ ret = pm_runtime_get_sync(dev); |
1517 |
+- if (IS_ERR_VALUE(ret)) |
1518 |
++ if (ret < 0) |
1519 |
+ return ret; |
1520 |
++ else |
1521 |
++ ret = 0; |
1522 |
+ |
1523 |
+ fep->mii_timeout = 0; |
1524 |
+ reinit_completion(&fep->mdio_done); |
1525 |
+@@ -2866,7 +2868,7 @@ fec_enet_open(struct net_device *ndev) |
1526 |
+ int ret; |
1527 |
+ |
1528 |
+ ret = pm_runtime_get_sync(&fep->pdev->dev); |
1529 |
+- if (IS_ERR_VALUE(ret)) |
1530 |
++ if (ret < 0) |
1531 |
+ return ret; |
1532 |
+ |
1533 |
+ pinctrl_pm_select_default_state(&fep->pdev->dev); |
1534 |
+diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c |
1535 |
+index 09ec32e33076..7e788073c154 100644 |
1536 |
+--- a/drivers/net/ethernet/marvell/mvneta.c |
1537 |
++++ b/drivers/net/ethernet/marvell/mvneta.c |
1538 |
+@@ -949,7 +949,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp) |
1539 |
+ /* Set CPU queue access map - all CPUs have access to all RX |
1540 |
+ * queues and to all TX queues |
1541 |
+ */ |
1542 |
+- for (cpu = 0; cpu < CONFIG_NR_CPUS; cpu++) |
1543 |
++ for_each_present_cpu(cpu) |
1544 |
+ mvreg_write(pp, MVNETA_CPU_MAP(cpu), |
1545 |
+ (MVNETA_CPU_RXQ_ACCESS_ALL_MASK | |
1546 |
+ MVNETA_CPU_TXQ_ACCESS_ALL_MASK)); |
1547 |
+@@ -1533,12 +1533,16 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, |
1548 |
+ } |
1549 |
+ |
1550 |
+ skb = build_skb(data, pp->frag_size > PAGE_SIZE ? 0 : pp->frag_size); |
1551 |
+- if (!skb) |
1552 |
+- goto err_drop_frame; |
1553 |
+ |
1554 |
++ /* After refill old buffer has to be unmapped regardless |
1555 |
++ * the skb is successfully built or not. |
1556 |
++ */ |
1557 |
+ dma_unmap_single(dev->dev.parent, phys_addr, |
1558 |
+ MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE); |
1559 |
+ |
1560 |
++ if (!skb) |
1561 |
++ goto err_drop_frame; |
1562 |
++ |
1563 |
+ rcvd_pkts++; |
1564 |
+ rcvd_bytes += rx_bytes; |
1565 |
+ |
1566 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c |
1567 |
+index 0a3202047569..2177e56ed0be 100644 |
1568 |
+--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c |
1569 |
++++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c |
1570 |
+@@ -2398,7 +2398,7 @@ int mlx4_multi_func_init(struct mlx4_dev *dev) |
1571 |
+ } |
1572 |
+ } |
1573 |
+ |
1574 |
+- memset(&priv->mfunc.master.cmd_eqe, 0, dev->caps.eqe_size); |
1575 |
++ memset(&priv->mfunc.master.cmd_eqe, 0, sizeof(struct mlx4_eqe)); |
1576 |
+ priv->mfunc.master.cmd_eqe.type = MLX4_EVENT_TYPE_CMD; |
1577 |
+ INIT_WORK(&priv->mfunc.master.comm_work, |
1578 |
+ mlx4_master_comm_channel); |
1579 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c |
1580 |
+index 8e81e53c370e..ad8f95df4310 100644 |
1581 |
+--- a/drivers/net/ethernet/mellanox/mlx4/eq.c |
1582 |
++++ b/drivers/net/ethernet/mellanox/mlx4/eq.c |
1583 |
+@@ -196,7 +196,7 @@ static void slave_event(struct mlx4_dev *dev, u8 slave, struct mlx4_eqe *eqe) |
1584 |
+ return; |
1585 |
+ } |
1586 |
+ |
1587 |
+- memcpy(s_eqe, eqe, dev->caps.eqe_size - 1); |
1588 |
++ memcpy(s_eqe, eqe, sizeof(struct mlx4_eqe) - 1); |
1589 |
+ s_eqe->slave_id = slave; |
1590 |
+ /* ensure all information is written before setting the ownersip bit */ |
1591 |
+ dma_wmb(); |
1592 |
+diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c |
1593 |
+index b1a4ea21c91c..4dd18f4bb5ae 100644 |
1594 |
+--- a/drivers/net/ethernet/sfc/ef10.c |
1595 |
++++ b/drivers/net/ethernet/sfc/ef10.c |
1596 |
+@@ -1809,7 +1809,9 @@ static void efx_ef10_tx_write(struct efx_tx_queue *tx_queue) |
1597 |
+ unsigned int write_ptr; |
1598 |
+ efx_qword_t *txd; |
1599 |
+ |
1600 |
+- BUG_ON(tx_queue->write_count == tx_queue->insert_count); |
1601 |
++ tx_queue->xmit_more_available = false; |
1602 |
++ if (unlikely(tx_queue->write_count == tx_queue->insert_count)) |
1603 |
++ return; |
1604 |
+ |
1605 |
+ do { |
1606 |
+ write_ptr = tx_queue->write_count & tx_queue->ptr_mask; |
1607 |
+diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c |
1608 |
+index f08266f0eca2..5a1c5a8f278a 100644 |
1609 |
+--- a/drivers/net/ethernet/sfc/farch.c |
1610 |
++++ b/drivers/net/ethernet/sfc/farch.c |
1611 |
+@@ -321,7 +321,9 @@ void efx_farch_tx_write(struct efx_tx_queue *tx_queue) |
1612 |
+ unsigned write_ptr; |
1613 |
+ unsigned old_write_count = tx_queue->write_count; |
1614 |
+ |
1615 |
+- BUG_ON(tx_queue->write_count == tx_queue->insert_count); |
1616 |
++ tx_queue->xmit_more_available = false; |
1617 |
++ if (unlikely(tx_queue->write_count == tx_queue->insert_count)) |
1618 |
++ return; |
1619 |
+ |
1620 |
+ do { |
1621 |
+ write_ptr = tx_queue->write_count & tx_queue->ptr_mask; |
1622 |
+diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h |
1623 |
+index 47d1e3a96522..b8e8ce1caf0f 100644 |
1624 |
+--- a/drivers/net/ethernet/sfc/net_driver.h |
1625 |
++++ b/drivers/net/ethernet/sfc/net_driver.h |
1626 |
+@@ -219,6 +219,7 @@ struct efx_tx_buffer { |
1627 |
+ * @tso_packets: Number of packets via the TSO xmit path |
1628 |
+ * @pushes: Number of times the TX push feature has been used |
1629 |
+ * @pio_packets: Number of times the TX PIO feature has been used |
1630 |
++ * @xmit_more_available: Are any packets waiting to be pushed to the NIC |
1631 |
+ * @empty_read_count: If the completion path has seen the queue as empty |
1632 |
+ * and the transmission path has not yet checked this, the value of |
1633 |
+ * @read_count bitwise-added to %EFX_EMPTY_COUNT_VALID; otherwise 0. |
1634 |
+@@ -253,6 +254,7 @@ struct efx_tx_queue { |
1635 |
+ unsigned int tso_packets; |
1636 |
+ unsigned int pushes; |
1637 |
+ unsigned int pio_packets; |
1638 |
++ bool xmit_more_available; |
1639 |
+ /* Statistics to supplement MAC stats */ |
1640 |
+ unsigned long tx_packets; |
1641 |
+ |
1642 |
+diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c |
1643 |
+index 1833a0146571..67f6afaa022f 100644 |
1644 |
+--- a/drivers/net/ethernet/sfc/tx.c |
1645 |
++++ b/drivers/net/ethernet/sfc/tx.c |
1646 |
+@@ -431,8 +431,20 @@ finish_packet: |
1647 |
+ efx_tx_maybe_stop_queue(tx_queue); |
1648 |
+ |
1649 |
+ /* Pass off to hardware */ |
1650 |
+- if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) |
1651 |
++ if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) { |
1652 |
++ struct efx_tx_queue *txq2 = efx_tx_queue_partner(tx_queue); |
1653 |
++ |
1654 |
++ /* There could be packets left on the partner queue if those |
1655 |
++ * SKBs had skb->xmit_more set. If we do not push those they |
1656 |
++ * could be left for a long time and cause a netdev watchdog. |
1657 |
++ */ |
1658 |
++ if (txq2->xmit_more_available) |
1659 |
++ efx_nic_push_buffers(txq2); |
1660 |
++ |
1661 |
+ efx_nic_push_buffers(tx_queue); |
1662 |
++ } else { |
1663 |
++ tx_queue->xmit_more_available = skb->xmit_more; |
1664 |
++ } |
1665 |
+ |
1666 |
+ tx_queue->tx_packets++; |
1667 |
+ |
1668 |
+@@ -722,6 +734,7 @@ void efx_init_tx_queue(struct efx_tx_queue *tx_queue) |
1669 |
+ tx_queue->read_count = 0; |
1670 |
+ tx_queue->old_read_count = 0; |
1671 |
+ tx_queue->empty_read_count = 0 | EFX_EMPTY_COUNT_VALID; |
1672 |
++ tx_queue->xmit_more_available = false; |
1673 |
+ |
1674 |
+ /* Set up TX descriptor ring */ |
1675 |
+ efx_nic_init_tx(tx_queue); |
1676 |
+@@ -747,6 +760,7 @@ void efx_fini_tx_queue(struct efx_tx_queue *tx_queue) |
1677 |
+ |
1678 |
+ ++tx_queue->read_count; |
1679 |
+ } |
1680 |
++ tx_queue->xmit_more_available = false; |
1681 |
+ netdev_tx_reset_queue(tx_queue->core_txq); |
1682 |
+ } |
1683 |
+ |
1684 |
+@@ -1302,8 +1316,20 @@ static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue, |
1685 |
+ efx_tx_maybe_stop_queue(tx_queue); |
1686 |
+ |
1687 |
+ /* Pass off to hardware */ |
1688 |
+- if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) |
1689 |
++ if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) { |
1690 |
++ struct efx_tx_queue *txq2 = efx_tx_queue_partner(tx_queue); |
1691 |
++ |
1692 |
++ /* There could be packets left on the partner queue if those |
1693 |
++ * SKBs had skb->xmit_more set. If we do not push those they |
1694 |
++ * could be left for a long time and cause a netdev watchdog. |
1695 |
++ */ |
1696 |
++ if (txq2->xmit_more_available) |
1697 |
++ efx_nic_push_buffers(txq2); |
1698 |
++ |
1699 |
+ efx_nic_push_buffers(tx_queue); |
1700 |
++ } else { |
1701 |
++ tx_queue->xmit_more_available = skb->xmit_more; |
1702 |
++ } |
1703 |
+ |
1704 |
+ tx_queue->tso_bursts++; |
1705 |
+ return NETDEV_TX_OK; |
1706 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
1707 |
+index 771cda2a48b2..2e51b816a7e8 100644 |
1708 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
1709 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
1710 |
+@@ -721,10 +721,13 @@ static int stmmac_get_ts_info(struct net_device *dev, |
1711 |
+ { |
1712 |
+ struct stmmac_priv *priv = netdev_priv(dev); |
1713 |
+ |
1714 |
+- if ((priv->hwts_tx_en) && (priv->hwts_rx_en)) { |
1715 |
++ if ((priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) { |
1716 |
+ |
1717 |
+- info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | |
1718 |
++ info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE | |
1719 |
++ SOF_TIMESTAMPING_TX_HARDWARE | |
1720 |
++ SOF_TIMESTAMPING_RX_SOFTWARE | |
1721 |
+ SOF_TIMESTAMPING_RX_HARDWARE | |
1722 |
++ SOF_TIMESTAMPING_SOFTWARE | |
1723 |
+ SOF_TIMESTAMPING_RAW_HARDWARE; |
1724 |
+ |
1725 |
+ if (priv->ptp_clock) |
1726 |
+diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c |
1727 |
+index 248478c6f6e4..197c93937c2d 100644 |
1728 |
+--- a/drivers/net/macvtap.c |
1729 |
++++ b/drivers/net/macvtap.c |
1730 |
+@@ -137,7 +137,7 @@ static const struct proto_ops macvtap_socket_ops; |
1731 |
+ #define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \ |
1732 |
+ NETIF_F_TSO6 | NETIF_F_UFO) |
1733 |
+ #define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO) |
1734 |
+-#define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG) |
1735 |
++#define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG | NETIF_F_FRAGLIST) |
1736 |
+ |
1737 |
+ static struct macvlan_dev *macvtap_get_vlan_rcu(const struct net_device *dev) |
1738 |
+ { |
1739 |
+diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c |
1740 |
+index 2ed75060da50..5e0b43283bce 100644 |
1741 |
+--- a/drivers/net/ppp/pppoe.c |
1742 |
++++ b/drivers/net/ppp/pppoe.c |
1743 |
+@@ -589,7 +589,7 @@ static int pppoe_release(struct socket *sock) |
1744 |
+ |
1745 |
+ po = pppox_sk(sk); |
1746 |
+ |
1747 |
+- if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { |
1748 |
++ if (po->pppoe_dev) { |
1749 |
+ dev_put(po->pppoe_dev); |
1750 |
+ po->pppoe_dev = NULL; |
1751 |
+ } |
1752 |
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
1753 |
+index 64a60afbe50c..8f1738c3b3c5 100644 |
1754 |
+--- a/drivers/net/usb/qmi_wwan.c |
1755 |
++++ b/drivers/net/usb/qmi_wwan.c |
1756 |
+@@ -765,6 +765,10 @@ static const struct usb_device_id products[] = { |
1757 |
+ {QMI_FIXED_INTF(0x1199, 0x9056, 8)}, /* Sierra Wireless Modem */ |
1758 |
+ {QMI_FIXED_INTF(0x1199, 0x9057, 8)}, |
1759 |
+ {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */ |
1760 |
++ {QMI_FIXED_INTF(0x1199, 0x9070, 8)}, /* Sierra Wireless MC74xx/EM74xx */ |
1761 |
++ {QMI_FIXED_INTF(0x1199, 0x9070, 10)}, /* Sierra Wireless MC74xx/EM74xx */ |
1762 |
++ {QMI_FIXED_INTF(0x1199, 0x9071, 8)}, /* Sierra Wireless MC74xx/EM74xx */ |
1763 |
++ {QMI_FIXED_INTF(0x1199, 0x9071, 10)}, /* Sierra Wireless MC74xx/EM74xx */ |
1764 |
+ {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ |
1765 |
+ {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */ |
1766 |
+ {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ |
1767 |
+diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c |
1768 |
+index 0d3c474ff76d..a5ea8a984c53 100644 |
1769 |
+--- a/drivers/net/wireless/ath/ath10k/mac.c |
1770 |
++++ b/drivers/net/wireless/ath/ath10k/mac.c |
1771 |
+@@ -2070,7 +2070,8 @@ static void ath10k_peer_assoc_h_ht(struct ath10k *ar, |
1772 |
+ enum ieee80211_band band; |
1773 |
+ const u8 *ht_mcs_mask; |
1774 |
+ const u16 *vht_mcs_mask; |
1775 |
+- int i, n, max_nss; |
1776 |
++ int i, n; |
1777 |
++ u8 max_nss; |
1778 |
+ u32 stbc; |
1779 |
+ |
1780 |
+ lockdep_assert_held(&ar->conf_mutex); |
1781 |
+@@ -2155,7 +2156,7 @@ static void ath10k_peer_assoc_h_ht(struct ath10k *ar, |
1782 |
+ arg->peer_ht_rates.rates[i] = i; |
1783 |
+ } else { |
1784 |
+ arg->peer_ht_rates.num_rates = n; |
1785 |
+- arg->peer_num_spatial_streams = max_nss; |
1786 |
++ arg->peer_num_spatial_streams = min(sta->rx_nss, max_nss); |
1787 |
+ } |
1788 |
+ |
1789 |
+ ath10k_dbg(ar, ATH10K_DBG_MAC, "mac ht peer %pM mcs cnt %d nss %d\n", |
1790 |
+@@ -4021,7 +4022,7 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed) |
1791 |
+ |
1792 |
+ static u32 get_nss_from_chainmask(u16 chain_mask) |
1793 |
+ { |
1794 |
+- if ((chain_mask & 0x15) == 0x15) |
1795 |
++ if ((chain_mask & 0xf) == 0xf) |
1796 |
+ return 4; |
1797 |
+ else if ((chain_mask & 0x7) == 0x7) |
1798 |
+ return 3; |
1799 |
+diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c |
1800 |
+index 865d578dee82..fd6aef7d4496 100644 |
1801 |
+--- a/drivers/net/wireless/iwlwifi/pcie/drv.c |
1802 |
++++ b/drivers/net/wireless/iwlwifi/pcie/drv.c |
1803 |
+@@ -423,14 +423,21 @@ static const struct pci_device_id iwl_hw_card_ids[] = { |
1804 |
+ /* 8000 Series */ |
1805 |
+ {IWL_PCI_DEVICE(0x24F3, 0x0010, iwl8260_2ac_cfg)}, |
1806 |
+ {IWL_PCI_DEVICE(0x24F3, 0x1010, iwl8260_2ac_cfg)}, |
1807 |
++ {IWL_PCI_DEVICE(0x24F3, 0x0130, iwl8260_2ac_cfg)}, |
1808 |
++ {IWL_PCI_DEVICE(0x24F3, 0x1130, iwl8260_2ac_cfg)}, |
1809 |
++ {IWL_PCI_DEVICE(0x24F3, 0x0132, iwl8260_2ac_cfg)}, |
1810 |
++ {IWL_PCI_DEVICE(0x24F3, 0x1132, iwl8260_2ac_cfg)}, |
1811 |
+ {IWL_PCI_DEVICE(0x24F3, 0x0110, iwl8260_2ac_cfg)}, |
1812 |
++ {IWL_PCI_DEVICE(0x24F3, 0x01F0, iwl8260_2ac_cfg)}, |
1813 |
++ {IWL_PCI_DEVICE(0x24F3, 0x0012, iwl8260_2ac_cfg)}, |
1814 |
++ {IWL_PCI_DEVICE(0x24F3, 0x1012, iwl8260_2ac_cfg)}, |
1815 |
+ {IWL_PCI_DEVICE(0x24F3, 0x1110, iwl8260_2ac_cfg)}, |
1816 |
+ {IWL_PCI_DEVICE(0x24F3, 0x0050, iwl8260_2ac_cfg)}, |
1817 |
+ {IWL_PCI_DEVICE(0x24F3, 0x0250, iwl8260_2ac_cfg)}, |
1818 |
+ {IWL_PCI_DEVICE(0x24F3, 0x1050, iwl8260_2ac_cfg)}, |
1819 |
+ {IWL_PCI_DEVICE(0x24F3, 0x0150, iwl8260_2ac_cfg)}, |
1820 |
++ {IWL_PCI_DEVICE(0x24F3, 0x1150, iwl8260_2ac_cfg)}, |
1821 |
+ {IWL_PCI_DEVICE(0x24F4, 0x0030, iwl8260_2ac_cfg)}, |
1822 |
+- {IWL_PCI_DEVICE(0x24F4, 0x1130, iwl8260_2ac_cfg)}, |
1823 |
+ {IWL_PCI_DEVICE(0x24F4, 0x1030, iwl8260_2ac_cfg)}, |
1824 |
+ {IWL_PCI_DEVICE(0x24F3, 0xC010, iwl8260_2ac_cfg)}, |
1825 |
+ {IWL_PCI_DEVICE(0x24F3, 0xC110, iwl8260_2ac_cfg)}, |
1826 |
+@@ -438,18 +445,28 @@ static const struct pci_device_id iwl_hw_card_ids[] = { |
1827 |
+ {IWL_PCI_DEVICE(0x24F3, 0xC050, iwl8260_2ac_cfg)}, |
1828 |
+ {IWL_PCI_DEVICE(0x24F3, 0xD050, iwl8260_2ac_cfg)}, |
1829 |
+ {IWL_PCI_DEVICE(0x24F3, 0x8010, iwl8260_2ac_cfg)}, |
1830 |
++ {IWL_PCI_DEVICE(0x24F3, 0x8110, iwl8260_2ac_cfg)}, |
1831 |
+ {IWL_PCI_DEVICE(0x24F3, 0x9010, iwl8260_2ac_cfg)}, |
1832 |
++ {IWL_PCI_DEVICE(0x24F3, 0x9110, iwl8260_2ac_cfg)}, |
1833 |
+ {IWL_PCI_DEVICE(0x24F4, 0x8030, iwl8260_2ac_cfg)}, |
1834 |
+ {IWL_PCI_DEVICE(0x24F4, 0x9030, iwl8260_2ac_cfg)}, |
1835 |
++ {IWL_PCI_DEVICE(0x24F3, 0x8130, iwl8260_2ac_cfg)}, |
1836 |
++ {IWL_PCI_DEVICE(0x24F3, 0x9130, iwl8260_2ac_cfg)}, |
1837 |
++ {IWL_PCI_DEVICE(0x24F3, 0x8132, iwl8260_2ac_cfg)}, |
1838 |
++ {IWL_PCI_DEVICE(0x24F3, 0x9132, iwl8260_2ac_cfg)}, |
1839 |
+ {IWL_PCI_DEVICE(0x24F3, 0x8050, iwl8260_2ac_cfg)}, |
1840 |
++ {IWL_PCI_DEVICE(0x24F3, 0x8150, iwl8260_2ac_cfg)}, |
1841 |
+ {IWL_PCI_DEVICE(0x24F3, 0x9050, iwl8260_2ac_cfg)}, |
1842 |
++ {IWL_PCI_DEVICE(0x24F3, 0x9150, iwl8260_2ac_cfg)}, |
1843 |
+ {IWL_PCI_DEVICE(0x24F3, 0x0004, iwl8260_2n_cfg)}, |
1844 |
++ {IWL_PCI_DEVICE(0x24F3, 0x0044, iwl8260_2n_cfg)}, |
1845 |
+ {IWL_PCI_DEVICE(0x24F5, 0x0010, iwl4165_2ac_cfg)}, |
1846 |
+ {IWL_PCI_DEVICE(0x24F6, 0x0030, iwl4165_2ac_cfg)}, |
1847 |
+ {IWL_PCI_DEVICE(0x24F3, 0x0810, iwl8260_2ac_cfg)}, |
1848 |
+ {IWL_PCI_DEVICE(0x24F3, 0x0910, iwl8260_2ac_cfg)}, |
1849 |
+ {IWL_PCI_DEVICE(0x24F3, 0x0850, iwl8260_2ac_cfg)}, |
1850 |
+ {IWL_PCI_DEVICE(0x24F3, 0x0950, iwl8260_2ac_cfg)}, |
1851 |
++ {IWL_PCI_DEVICE(0x24F3, 0x0930, iwl8260_2ac_cfg)}, |
1852 |
+ #endif /* CONFIG_IWLMVM */ |
1853 |
+ |
1854 |
+ {0} |
1855 |
+diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c |
1856 |
+index 9e144e71da0b..dab9b91b3f3d 100644 |
1857 |
+--- a/drivers/net/wireless/iwlwifi/pcie/trans.c |
1858 |
++++ b/drivers/net/wireless/iwlwifi/pcie/trans.c |
1859 |
+@@ -592,10 +592,8 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) |
1860 |
+ |
1861 |
+ do { |
1862 |
+ ret = iwl_pcie_set_hw_ready(trans); |
1863 |
+- if (ret >= 0) { |
1864 |
+- ret = 0; |
1865 |
+- goto out; |
1866 |
+- } |
1867 |
++ if (ret >= 0) |
1868 |
++ return 0; |
1869 |
+ |
1870 |
+ usleep_range(200, 1000); |
1871 |
+ t += 200; |
1872 |
+@@ -605,10 +603,6 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) |
1873 |
+ |
1874 |
+ IWL_ERR(trans, "Couldn't prepare the card\n"); |
1875 |
+ |
1876 |
+-out: |
1877 |
+- iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, |
1878 |
+- CSR_RESET_LINK_PWR_MGMT_DISABLED); |
1879 |
+- |
1880 |
+ return ret; |
1881 |
+ } |
1882 |
+ |
1883 |
+diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c |
1884 |
+index 5a0636d43a1b..5583856fc5c4 100644 |
1885 |
+--- a/drivers/net/wireless/mwifiex/debugfs.c |
1886 |
++++ b/drivers/net/wireless/mwifiex/debugfs.c |
1887 |
+@@ -731,7 +731,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf, |
1888 |
+ (struct mwifiex_private *) file->private_data; |
1889 |
+ unsigned long addr = get_zeroed_page(GFP_KERNEL); |
1890 |
+ char *buf = (char *) addr; |
1891 |
+- int pos = 0, ret = 0, i; |
1892 |
++ int pos, ret, i; |
1893 |
+ u8 value[MAX_EEPROM_DATA]; |
1894 |
+ |
1895 |
+ if (!buf) |
1896 |
+@@ -739,7 +739,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf, |
1897 |
+ |
1898 |
+ if (saved_offset == -1) { |
1899 |
+ /* No command has been given */ |
1900 |
+- pos += snprintf(buf, PAGE_SIZE, "0"); |
1901 |
++ pos = snprintf(buf, PAGE_SIZE, "0"); |
1902 |
+ goto done; |
1903 |
+ } |
1904 |
+ |
1905 |
+@@ -748,17 +748,17 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf, |
1906 |
+ (u16) saved_bytes, value); |
1907 |
+ if (ret) { |
1908 |
+ ret = -EINVAL; |
1909 |
+- goto done; |
1910 |
++ goto out_free; |
1911 |
+ } |
1912 |
+ |
1913 |
+- pos += snprintf(buf, PAGE_SIZE, "%d %d ", saved_offset, saved_bytes); |
1914 |
++ pos = snprintf(buf, PAGE_SIZE, "%d %d ", saved_offset, saved_bytes); |
1915 |
+ |
1916 |
+ for (i = 0; i < saved_bytes; i++) |
1917 |
+- pos += snprintf(buf + strlen(buf), PAGE_SIZE, "%d ", value[i]); |
1918 |
+- |
1919 |
+- ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos); |
1920 |
++ pos += scnprintf(buf + pos, PAGE_SIZE - pos, "%d ", value[i]); |
1921 |
+ |
1922 |
+ done: |
1923 |
++ ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos); |
1924 |
++out_free: |
1925 |
+ free_page(addr); |
1926 |
+ return ret; |
1927 |
+ } |
1928 |
+diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h |
1929 |
+index a9c9a077c77d..bc3d907fd20f 100644 |
1930 |
+--- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h |
1931 |
++++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h |
1932 |
+@@ -680,7 +680,7 @@ void lnet_debug_peer(lnet_nid_t nid); |
1933 |
+ static inline void |
1934 |
+ lnet_peer_set_alive(lnet_peer_t *lp) |
1935 |
+ { |
1936 |
+- lp->lp_last_alive = lp->lp_last_query = get_seconds(); |
1937 |
++ lp->lp_last_alive = lp->lp_last_query = jiffies; |
1938 |
+ if (!lp->lp_alive) |
1939 |
+ lnet_notify_locked(lp, 0, 1, lp->lp_last_alive); |
1940 |
+ } |
1941 |
+diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c |
1942 |
+index f8b5b332e7c3..943a0e204532 100644 |
1943 |
+--- a/drivers/staging/rtl8712/usb_intf.c |
1944 |
++++ b/drivers/staging/rtl8712/usb_intf.c |
1945 |
+@@ -144,6 +144,7 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = { |
1946 |
+ {USB_DEVICE(0x0DF6, 0x0058)}, |
1947 |
+ {USB_DEVICE(0x0DF6, 0x0049)}, |
1948 |
+ {USB_DEVICE(0x0DF6, 0x004C)}, |
1949 |
++ {USB_DEVICE(0x0DF6, 0x006C)}, |
1950 |
+ {USB_DEVICE(0x0DF6, 0x0064)}, |
1951 |
+ /* Skyworth */ |
1952 |
+ {USB_DEVICE(0x14b2, 0x3300)}, |
1953 |
+diff --git a/drivers/tty/mips_ejtag_fdc.c b/drivers/tty/mips_ejtag_fdc.c |
1954 |
+index 358323c83b4f..43a2ba0c0fe9 100644 |
1955 |
+--- a/drivers/tty/mips_ejtag_fdc.c |
1956 |
++++ b/drivers/tty/mips_ejtag_fdc.c |
1957 |
+@@ -1045,38 +1045,6 @@ err_destroy_ports: |
1958 |
+ return ret; |
1959 |
+ } |
1960 |
+ |
1961 |
+-static int mips_ejtag_fdc_tty_remove(struct mips_cdmm_device *dev) |
1962 |
+-{ |
1963 |
+- struct mips_ejtag_fdc_tty *priv = mips_cdmm_get_drvdata(dev); |
1964 |
+- struct mips_ejtag_fdc_tty_port *dport; |
1965 |
+- int nport; |
1966 |
+- unsigned int cfg; |
1967 |
+- |
1968 |
+- if (priv->irq >= 0) { |
1969 |
+- raw_spin_lock_irq(&priv->lock); |
1970 |
+- cfg = mips_ejtag_fdc_read(priv, REG_FDCFG); |
1971 |
+- /* Disable interrupts */ |
1972 |
+- cfg &= ~(REG_FDCFG_TXINTTHRES | REG_FDCFG_RXINTTHRES); |
1973 |
+- cfg |= REG_FDCFG_TXINTTHRES_DISABLED; |
1974 |
+- cfg |= REG_FDCFG_RXINTTHRES_DISABLED; |
1975 |
+- mips_ejtag_fdc_write(priv, REG_FDCFG, cfg); |
1976 |
+- raw_spin_unlock_irq(&priv->lock); |
1977 |
+- } else { |
1978 |
+- priv->removing = true; |
1979 |
+- del_timer_sync(&priv->poll_timer); |
1980 |
+- } |
1981 |
+- kthread_stop(priv->thread); |
1982 |
+- if (dev->cpu == 0) |
1983 |
+- mips_ejtag_fdc_con.tty_drv = NULL; |
1984 |
+- tty_unregister_driver(priv->driver); |
1985 |
+- for (nport = 0; nport < NUM_TTY_CHANNELS; nport++) { |
1986 |
+- dport = &priv->ports[nport]; |
1987 |
+- tty_port_destroy(&dport->port); |
1988 |
+- } |
1989 |
+- put_tty_driver(priv->driver); |
1990 |
+- return 0; |
1991 |
+-} |
1992 |
+- |
1993 |
+ static int mips_ejtag_fdc_tty_cpu_down(struct mips_cdmm_device *dev) |
1994 |
+ { |
1995 |
+ struct mips_ejtag_fdc_tty *priv = mips_cdmm_get_drvdata(dev); |
1996 |
+@@ -1149,12 +1117,11 @@ static struct mips_cdmm_driver mips_ejtag_fdc_tty_driver = { |
1997 |
+ .name = "mips_ejtag_fdc", |
1998 |
+ }, |
1999 |
+ .probe = mips_ejtag_fdc_tty_probe, |
2000 |
+- .remove = mips_ejtag_fdc_tty_remove, |
2001 |
+ .cpu_down = mips_ejtag_fdc_tty_cpu_down, |
2002 |
+ .cpu_up = mips_ejtag_fdc_tty_cpu_up, |
2003 |
+ .id_table = mips_ejtag_fdc_tty_ids, |
2004 |
+ }; |
2005 |
+-module_mips_cdmm_driver(mips_ejtag_fdc_tty_driver); |
2006 |
++builtin_mips_cdmm_driver(mips_ejtag_fdc_tty_driver); |
2007 |
+ |
2008 |
+ static int __init mips_ejtag_fdc_init_console(void) |
2009 |
+ { |
2010 |
+diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c |
2011 |
+index afc1879f66e0..dedac8ab85bf 100644 |
2012 |
+--- a/drivers/tty/n_tty.c |
2013 |
++++ b/drivers/tty/n_tty.c |
2014 |
+@@ -169,7 +169,7 @@ static inline int tty_copy_to_user(struct tty_struct *tty, |
2015 |
+ { |
2016 |
+ struct n_tty_data *ldata = tty->disc_data; |
2017 |
+ |
2018 |
+- tty_audit_add_data(tty, to, n, ldata->icanon); |
2019 |
++ tty_audit_add_data(tty, from, n, ldata->icanon); |
2020 |
+ return copy_to_user(to, from, n); |
2021 |
+ } |
2022 |
+ |
2023 |
+diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c |
2024 |
+index 90ca082935f6..3d245cd3d8e6 100644 |
2025 |
+--- a/drivers/tty/tty_audit.c |
2026 |
++++ b/drivers/tty/tty_audit.c |
2027 |
+@@ -265,7 +265,7 @@ static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty, |
2028 |
+ * |
2029 |
+ * Audit @data of @size from @tty, if necessary. |
2030 |
+ */ |
2031 |
+-void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, |
2032 |
++void tty_audit_add_data(struct tty_struct *tty, const void *data, |
2033 |
+ size_t size, unsigned icanon) |
2034 |
+ { |
2035 |
+ struct tty_audit_buf *buf; |
2036 |
+diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c |
2037 |
+index 774df354af55..1aa028638120 100644 |
2038 |
+--- a/drivers/tty/tty_io.c |
2039 |
++++ b/drivers/tty/tty_io.c |
2040 |
+@@ -1279,18 +1279,22 @@ int tty_send_xchar(struct tty_struct *tty, char ch) |
2041 |
+ int was_stopped = tty->stopped; |
2042 |
+ |
2043 |
+ if (tty->ops->send_xchar) { |
2044 |
++ down_read(&tty->termios_rwsem); |
2045 |
+ tty->ops->send_xchar(tty, ch); |
2046 |
++ up_read(&tty->termios_rwsem); |
2047 |
+ return 0; |
2048 |
+ } |
2049 |
+ |
2050 |
+ if (tty_write_lock(tty, 0) < 0) |
2051 |
+ return -ERESTARTSYS; |
2052 |
+ |
2053 |
++ down_read(&tty->termios_rwsem); |
2054 |
+ if (was_stopped) |
2055 |
+ start_tty(tty); |
2056 |
+ tty->ops->write(tty, &ch, 1); |
2057 |
+ if (was_stopped) |
2058 |
+ stop_tty(tty); |
2059 |
++ up_read(&tty->termios_rwsem); |
2060 |
+ tty_write_unlock(tty); |
2061 |
+ return 0; |
2062 |
+ } |
2063 |
+diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c |
2064 |
+index 5232fb60b0b1..043e332e7423 100644 |
2065 |
+--- a/drivers/tty/tty_ioctl.c |
2066 |
++++ b/drivers/tty/tty_ioctl.c |
2067 |
+@@ -1142,16 +1142,12 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, |
2068 |
+ spin_unlock_irq(&tty->flow_lock); |
2069 |
+ break; |
2070 |
+ case TCIOFF: |
2071 |
+- down_read(&tty->termios_rwsem); |
2072 |
+ if (STOP_CHAR(tty) != __DISABLED_CHAR) |
2073 |
+ retval = tty_send_xchar(tty, STOP_CHAR(tty)); |
2074 |
+- up_read(&tty->termios_rwsem); |
2075 |
+ break; |
2076 |
+ case TCION: |
2077 |
+- down_read(&tty->termios_rwsem); |
2078 |
+ if (START_CHAR(tty) != __DISABLED_CHAR) |
2079 |
+ retval = tty_send_xchar(tty, START_CHAR(tty)); |
2080 |
+- up_read(&tty->termios_rwsem); |
2081 |
+ break; |
2082 |
+ default: |
2083 |
+ return -EINVAL; |
2084 |
+diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c |
2085 |
+index fa774323ebda..846ceb91ec14 100644 |
2086 |
+--- a/drivers/usb/chipidea/ci_hdrc_imx.c |
2087 |
++++ b/drivers/usb/chipidea/ci_hdrc_imx.c |
2088 |
+@@ -68,6 +68,12 @@ struct ci_hdrc_imx_data { |
2089 |
+ struct imx_usbmisc_data *usbmisc_data; |
2090 |
+ bool supports_runtime_pm; |
2091 |
+ bool in_lpm; |
2092 |
++ /* SoC before i.mx6 (except imx23/imx28) needs three clks */ |
2093 |
++ bool need_three_clks; |
2094 |
++ struct clk *clk_ipg; |
2095 |
++ struct clk *clk_ahb; |
2096 |
++ struct clk *clk_per; |
2097 |
++ /* --------------------------------- */ |
2098 |
+ }; |
2099 |
+ |
2100 |
+ /* Common functions shared by usbmisc drivers */ |
2101 |
+@@ -119,6 +125,102 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev) |
2102 |
+ } |
2103 |
+ |
2104 |
+ /* End of common functions shared by usbmisc drivers*/ |
2105 |
++static int imx_get_clks(struct device *dev) |
2106 |
++{ |
2107 |
++ struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); |
2108 |
++ int ret = 0; |
2109 |
++ |
2110 |
++ data->clk_ipg = devm_clk_get(dev, "ipg"); |
2111 |
++ if (IS_ERR(data->clk_ipg)) { |
2112 |
++ /* If the platform only needs one clocks */ |
2113 |
++ data->clk = devm_clk_get(dev, NULL); |
2114 |
++ if (IS_ERR(data->clk)) { |
2115 |
++ ret = PTR_ERR(data->clk); |
2116 |
++ dev_err(dev, |
2117 |
++ "Failed to get clks, err=%ld,%ld\n", |
2118 |
++ PTR_ERR(data->clk), PTR_ERR(data->clk_ipg)); |
2119 |
++ return ret; |
2120 |
++ } |
2121 |
++ return ret; |
2122 |
++ } |
2123 |
++ |
2124 |
++ data->clk_ahb = devm_clk_get(dev, "ahb"); |
2125 |
++ if (IS_ERR(data->clk_ahb)) { |
2126 |
++ ret = PTR_ERR(data->clk_ahb); |
2127 |
++ dev_err(dev, |
2128 |
++ "Failed to get ahb clock, err=%d\n", ret); |
2129 |
++ return ret; |
2130 |
++ } |
2131 |
++ |
2132 |
++ data->clk_per = devm_clk_get(dev, "per"); |
2133 |
++ if (IS_ERR(data->clk_per)) { |
2134 |
++ ret = PTR_ERR(data->clk_per); |
2135 |
++ dev_err(dev, |
2136 |
++ "Failed to get per clock, err=%d\n", ret); |
2137 |
++ return ret; |
2138 |
++ } |
2139 |
++ |
2140 |
++ data->need_three_clks = true; |
2141 |
++ return ret; |
2142 |
++} |
2143 |
++ |
2144 |
++static int imx_prepare_enable_clks(struct device *dev) |
2145 |
++{ |
2146 |
++ struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); |
2147 |
++ int ret = 0; |
2148 |
++ |
2149 |
++ if (data->need_three_clks) { |
2150 |
++ ret = clk_prepare_enable(data->clk_ipg); |
2151 |
++ if (ret) { |
2152 |
++ dev_err(dev, |
2153 |
++ "Failed to prepare/enable ipg clk, err=%d\n", |
2154 |
++ ret); |
2155 |
++ return ret; |
2156 |
++ } |
2157 |
++ |
2158 |
++ ret = clk_prepare_enable(data->clk_ahb); |
2159 |
++ if (ret) { |
2160 |
++ dev_err(dev, |
2161 |
++ "Failed to prepare/enable ahb clk, err=%d\n", |
2162 |
++ ret); |
2163 |
++ clk_disable_unprepare(data->clk_ipg); |
2164 |
++ return ret; |
2165 |
++ } |
2166 |
++ |
2167 |
++ ret = clk_prepare_enable(data->clk_per); |
2168 |
++ if (ret) { |
2169 |
++ dev_err(dev, |
2170 |
++ "Failed to prepare/enable per clk, err=%d\n", |
2171 |
++ ret); |
2172 |
++ clk_disable_unprepare(data->clk_ahb); |
2173 |
++ clk_disable_unprepare(data->clk_ipg); |
2174 |
++ return ret; |
2175 |
++ } |
2176 |
++ } else { |
2177 |
++ ret = clk_prepare_enable(data->clk); |
2178 |
++ if (ret) { |
2179 |
++ dev_err(dev, |
2180 |
++ "Failed to prepare/enable clk, err=%d\n", |
2181 |
++ ret); |
2182 |
++ return ret; |
2183 |
++ } |
2184 |
++ } |
2185 |
++ |
2186 |
++ return ret; |
2187 |
++} |
2188 |
++ |
2189 |
++static void imx_disable_unprepare_clks(struct device *dev) |
2190 |
++{ |
2191 |
++ struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); |
2192 |
++ |
2193 |
++ if (data->need_three_clks) { |
2194 |
++ clk_disable_unprepare(data->clk_per); |
2195 |
++ clk_disable_unprepare(data->clk_ahb); |
2196 |
++ clk_disable_unprepare(data->clk_ipg); |
2197 |
++ } else { |
2198 |
++ clk_disable_unprepare(data->clk); |
2199 |
++ } |
2200 |
++} |
2201 |
+ |
2202 |
+ static int ci_hdrc_imx_probe(struct platform_device *pdev) |
2203 |
+ { |
2204 |
+@@ -137,23 +239,18 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) |
2205 |
+ if (!data) |
2206 |
+ return -ENOMEM; |
2207 |
+ |
2208 |
++ platform_set_drvdata(pdev, data); |
2209 |
+ data->usbmisc_data = usbmisc_get_init_data(&pdev->dev); |
2210 |
+ if (IS_ERR(data->usbmisc_data)) |
2211 |
+ return PTR_ERR(data->usbmisc_data); |
2212 |
+ |
2213 |
+- data->clk = devm_clk_get(&pdev->dev, NULL); |
2214 |
+- if (IS_ERR(data->clk)) { |
2215 |
+- dev_err(&pdev->dev, |
2216 |
+- "Failed to get clock, err=%ld\n", PTR_ERR(data->clk)); |
2217 |
+- return PTR_ERR(data->clk); |
2218 |
+- } |
2219 |
++ ret = imx_get_clks(&pdev->dev); |
2220 |
++ if (ret) |
2221 |
++ return ret; |
2222 |
+ |
2223 |
+- ret = clk_prepare_enable(data->clk); |
2224 |
+- if (ret) { |
2225 |
+- dev_err(&pdev->dev, |
2226 |
+- "Failed to prepare or enable clock, err=%d\n", ret); |
2227 |
++ ret = imx_prepare_enable_clks(&pdev->dev); |
2228 |
++ if (ret) |
2229 |
+ return ret; |
2230 |
+- } |
2231 |
+ |
2232 |
+ data->phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0); |
2233 |
+ if (IS_ERR(data->phy)) { |
2234 |
+@@ -196,8 +293,6 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) |
2235 |
+ goto disable_device; |
2236 |
+ } |
2237 |
+ |
2238 |
+- platform_set_drvdata(pdev, data); |
2239 |
+- |
2240 |
+ if (data->supports_runtime_pm) { |
2241 |
+ pm_runtime_set_active(&pdev->dev); |
2242 |
+ pm_runtime_enable(&pdev->dev); |
2243 |
+@@ -210,7 +305,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) |
2244 |
+ disable_device: |
2245 |
+ ci_hdrc_remove_device(data->ci_pdev); |
2246 |
+ err_clk: |
2247 |
+- clk_disable_unprepare(data->clk); |
2248 |
++ imx_disable_unprepare_clks(&pdev->dev); |
2249 |
+ return ret; |
2250 |
+ } |
2251 |
+ |
2252 |
+@@ -224,7 +319,7 @@ static int ci_hdrc_imx_remove(struct platform_device *pdev) |
2253 |
+ pm_runtime_put_noidle(&pdev->dev); |
2254 |
+ } |
2255 |
+ ci_hdrc_remove_device(data->ci_pdev); |
2256 |
+- clk_disable_unprepare(data->clk); |
2257 |
++ imx_disable_unprepare_clks(&pdev->dev); |
2258 |
+ |
2259 |
+ return 0; |
2260 |
+ } |
2261 |
+@@ -236,7 +331,7 @@ static int imx_controller_suspend(struct device *dev) |
2262 |
+ |
2263 |
+ dev_dbg(dev, "at %s\n", __func__); |
2264 |
+ |
2265 |
+- clk_disable_unprepare(data->clk); |
2266 |
++ imx_disable_unprepare_clks(dev); |
2267 |
+ data->in_lpm = true; |
2268 |
+ |
2269 |
+ return 0; |
2270 |
+@@ -254,7 +349,7 @@ static int imx_controller_resume(struct device *dev) |
2271 |
+ return 0; |
2272 |
+ } |
2273 |
+ |
2274 |
+- ret = clk_prepare_enable(data->clk); |
2275 |
++ ret = imx_prepare_enable_clks(dev); |
2276 |
+ if (ret) |
2277 |
+ return ret; |
2278 |
+ |
2279 |
+@@ -269,7 +364,7 @@ static int imx_controller_resume(struct device *dev) |
2280 |
+ return 0; |
2281 |
+ |
2282 |
+ clk_disable: |
2283 |
+- clk_disable_unprepare(data->clk); |
2284 |
++ imx_disable_unprepare_clks(dev); |
2285 |
+ return ret; |
2286 |
+ } |
2287 |
+ |
2288 |
+diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c |
2289 |
+index 6e53c24fa1cb..92937c14f818 100644 |
2290 |
+--- a/drivers/usb/chipidea/udc.c |
2291 |
++++ b/drivers/usb/chipidea/udc.c |
2292 |
+@@ -1730,6 +1730,22 @@ static int ci_udc_start(struct usb_gadget *gadget, |
2293 |
+ return retval; |
2294 |
+ } |
2295 |
+ |
2296 |
++static void ci_udc_stop_for_otg_fsm(struct ci_hdrc *ci) |
2297 |
++{ |
2298 |
++ if (!ci_otg_is_fsm_mode(ci)) |
2299 |
++ return; |
2300 |
++ |
2301 |
++ mutex_lock(&ci->fsm.lock); |
2302 |
++ if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) { |
2303 |
++ ci->fsm.a_bidl_adis_tmout = 1; |
2304 |
++ ci_hdrc_otg_fsm_start(ci); |
2305 |
++ } else if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) { |
2306 |
++ ci->fsm.protocol = PROTO_UNDEF; |
2307 |
++ ci->fsm.otg->state = OTG_STATE_UNDEFINED; |
2308 |
++ } |
2309 |
++ mutex_unlock(&ci->fsm.lock); |
2310 |
++} |
2311 |
++ |
2312 |
+ /** |
2313 |
+ * ci_udc_stop: unregister a gadget driver |
2314 |
+ */ |
2315 |
+@@ -1754,6 +1770,7 @@ static int ci_udc_stop(struct usb_gadget *gadget) |
2316 |
+ ci->driver = NULL; |
2317 |
+ spin_unlock_irqrestore(&ci->lock, flags); |
2318 |
+ |
2319 |
++ ci_udc_stop_for_otg_fsm(ci); |
2320 |
+ return 0; |
2321 |
+ } |
2322 |
+ |
2323 |
+diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c |
2324 |
+index f38e875a3fb1..8218ba7eb263 100644 |
2325 |
+--- a/drivers/usb/class/usblp.c |
2326 |
++++ b/drivers/usb/class/usblp.c |
2327 |
+@@ -873,11 +873,11 @@ static int usblp_wwait(struct usblp *usblp, int nonblock) |
2328 |
+ |
2329 |
+ add_wait_queue(&usblp->wwait, &waita); |
2330 |
+ for (;;) { |
2331 |
+- set_current_state(TASK_INTERRUPTIBLE); |
2332 |
+ if (mutex_lock_interruptible(&usblp->mut)) { |
2333 |
+ rc = -EINTR; |
2334 |
+ break; |
2335 |
+ } |
2336 |
++ set_current_state(TASK_INTERRUPTIBLE); |
2337 |
+ rc = usblp_wtest(usblp, nonblock); |
2338 |
+ mutex_unlock(&usblp->mut); |
2339 |
+ if (rc <= 0) |
2340 |
+diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c |
2341 |
+index ff5773c66b84..c0566ecd9977 100644 |
2342 |
+--- a/drivers/usb/dwc3/core.c |
2343 |
++++ b/drivers/usb/dwc3/core.c |
2344 |
+@@ -490,6 +490,9 @@ static int dwc3_phy_setup(struct dwc3 *dwc) |
2345 |
+ if (dwc->dis_u2_susphy_quirk) |
2346 |
+ reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; |
2347 |
+ |
2348 |
++ if (dwc->dis_enblslpm_quirk) |
2349 |
++ reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM; |
2350 |
++ |
2351 |
+ dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); |
2352 |
+ |
2353 |
+ return 0; |
2354 |
+@@ -509,12 +512,18 @@ static int dwc3_core_init(struct dwc3 *dwc) |
2355 |
+ |
2356 |
+ reg = dwc3_readl(dwc->regs, DWC3_GSNPSID); |
2357 |
+ /* This should read as U3 followed by revision number */ |
2358 |
+- if ((reg & DWC3_GSNPSID_MASK) != 0x55330000) { |
2359 |
++ if ((reg & DWC3_GSNPSID_MASK) == 0x55330000) { |
2360 |
++ /* Detected DWC_usb3 IP */ |
2361 |
++ dwc->revision = reg; |
2362 |
++ } else if ((reg & DWC3_GSNPSID_MASK) == 0x33310000) { |
2363 |
++ /* Detected DWC_usb31 IP */ |
2364 |
++ dwc->revision = dwc3_readl(dwc->regs, DWC3_VER_NUMBER); |
2365 |
++ dwc->revision |= DWC3_REVISION_IS_DWC31; |
2366 |
++ } else { |
2367 |
+ dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n"); |
2368 |
+ ret = -ENODEV; |
2369 |
+ goto err0; |
2370 |
+ } |
2371 |
+- dwc->revision = reg; |
2372 |
+ |
2373 |
+ /* |
2374 |
+ * Write Linux Version Code to our GUID register so it's easy to figure |
2375 |
+@@ -881,6 +890,8 @@ static int dwc3_probe(struct platform_device *pdev) |
2376 |
+ "snps,dis_u3_susphy_quirk"); |
2377 |
+ dwc->dis_u2_susphy_quirk = of_property_read_bool(node, |
2378 |
+ "snps,dis_u2_susphy_quirk"); |
2379 |
++ dwc->dis_enblslpm_quirk = device_property_read_bool(dev, |
2380 |
++ "snps,dis_enblslpm_quirk"); |
2381 |
+ |
2382 |
+ dwc->tx_de_emphasis_quirk = of_property_read_bool(node, |
2383 |
+ "snps,tx_de_emphasis_quirk"); |
2384 |
+@@ -911,6 +922,7 @@ static int dwc3_probe(struct platform_device *pdev) |
2385 |
+ dwc->rx_detect_poll_quirk = pdata->rx_detect_poll_quirk; |
2386 |
+ dwc->dis_u3_susphy_quirk = pdata->dis_u3_susphy_quirk; |
2387 |
+ dwc->dis_u2_susphy_quirk = pdata->dis_u2_susphy_quirk; |
2388 |
++ dwc->dis_enblslpm_quirk = pdata->dis_enblslpm_quirk; |
2389 |
+ |
2390 |
+ dwc->tx_de_emphasis_quirk = pdata->tx_de_emphasis_quirk; |
2391 |
+ if (pdata->tx_de_emphasis) |
2392 |
+diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h |
2393 |
+index 044778884585..6e53ce9ce320 100644 |
2394 |
+--- a/drivers/usb/dwc3/core.h |
2395 |
++++ b/drivers/usb/dwc3/core.h |
2396 |
+@@ -108,6 +108,9 @@ |
2397 |
+ #define DWC3_GPRTBIMAP_FS0 0xc188 |
2398 |
+ #define DWC3_GPRTBIMAP_FS1 0xc18c |
2399 |
+ |
2400 |
++#define DWC3_VER_NUMBER 0xc1a0 |
2401 |
++#define DWC3_VER_TYPE 0xc1a4 |
2402 |
++ |
2403 |
+ #define DWC3_GUSB2PHYCFG(n) (0xc200 + (n * 0x04)) |
2404 |
+ #define DWC3_GUSB2I2CCTL(n) (0xc240 + (n * 0x04)) |
2405 |
+ |
2406 |
+@@ -175,6 +178,7 @@ |
2407 |
+ #define DWC3_GUSB2PHYCFG_PHYSOFTRST (1 << 31) |
2408 |
+ #define DWC3_GUSB2PHYCFG_SUSPHY (1 << 6) |
2409 |
+ #define DWC3_GUSB2PHYCFG_ULPI_UTMI (1 << 4) |
2410 |
++#define DWC3_GUSB2PHYCFG_ENBLSLPM (1 << 8) |
2411 |
+ |
2412 |
+ /* Global USB2 PHY Vendor Control Register */ |
2413 |
+ #define DWC3_GUSB2PHYACC_NEWREGREQ (1 << 25) |
2414 |
+@@ -712,6 +716,8 @@ struct dwc3_scratchpad_array { |
2415 |
+ * @rx_detect_poll_quirk: set if we enable rx_detect to polling lfps quirk |
2416 |
+ * @dis_u3_susphy_quirk: set if we disable usb3 suspend phy |
2417 |
+ * @dis_u2_susphy_quirk: set if we disable usb2 suspend phy |
2418 |
++ * @dis_enblslpm_quirk: set if we clear enblslpm in GUSB2PHYCFG, |
2419 |
++ * disabling the suspend signal to the PHY. |
2420 |
+ * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk |
2421 |
+ * @tx_de_emphasis: Tx de-emphasis value |
2422 |
+ * 0 - -6dB de-emphasis |
2423 |
+@@ -766,6 +772,14 @@ struct dwc3 { |
2424 |
+ u32 num_event_buffers; |
2425 |
+ u32 u1u2; |
2426 |
+ u32 maximum_speed; |
2427 |
++ |
2428 |
++ /* |
2429 |
++ * All 3.1 IP version constants are greater than the 3.0 IP |
2430 |
++ * version constants. This works for most version checks in |
2431 |
++ * dwc3. However, in the future, this may not apply as |
2432 |
++ * features may be developed on newer versions of the 3.0 IP |
2433 |
++ * that are not in the 3.1 IP. |
2434 |
++ */ |
2435 |
+ u32 revision; |
2436 |
+ |
2437 |
+ #define DWC3_REVISION_173A 0x5533173a |
2438 |
+@@ -788,6 +802,13 @@ struct dwc3 { |
2439 |
+ #define DWC3_REVISION_270A 0x5533270a |
2440 |
+ #define DWC3_REVISION_280A 0x5533280a |
2441 |
+ |
2442 |
++/* |
2443 |
++ * NOTICE: we're using bit 31 as a "is usb 3.1" flag. This is really |
2444 |
++ * just so dwc31 revisions are always larger than dwc3. |
2445 |
++ */ |
2446 |
++#define DWC3_REVISION_IS_DWC31 0x80000000 |
2447 |
++#define DWC3_USB31_REVISION_110A (0x3131302a | DWC3_REVISION_IS_USB31) |
2448 |
++ |
2449 |
+ enum dwc3_ep0_next ep0_next_event; |
2450 |
+ enum dwc3_ep0_state ep0state; |
2451 |
+ enum dwc3_link_state link_state; |
2452 |
+@@ -841,6 +862,7 @@ struct dwc3 { |
2453 |
+ unsigned rx_detect_poll_quirk:1; |
2454 |
+ unsigned dis_u3_susphy_quirk:1; |
2455 |
+ unsigned dis_u2_susphy_quirk:1; |
2456 |
++ unsigned dis_enblslpm_quirk:1; |
2457 |
+ |
2458 |
+ unsigned tx_de_emphasis_quirk:1; |
2459 |
+ unsigned tx_de_emphasis:2; |
2460 |
+diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c |
2461 |
+index 27e4fc896e9d..04b87ebe6f94 100644 |
2462 |
+--- a/drivers/usb/dwc3/dwc3-pci.c |
2463 |
++++ b/drivers/usb/dwc3/dwc3-pci.c |
2464 |
+@@ -27,6 +27,8 @@ |
2465 |
+ #include "platform_data.h" |
2466 |
+ |
2467 |
+ #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd |
2468 |
++#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI 0xabce |
2469 |
++#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31 0xabcf |
2470 |
+ #define PCI_DEVICE_ID_INTEL_BYT 0x0f37 |
2471 |
+ #define PCI_DEVICE_ID_INTEL_MRFLD 0x119e |
2472 |
+ #define PCI_DEVICE_ID_INTEL_BSW 0x22B7 |
2473 |
+@@ -100,6 +102,22 @@ static int dwc3_pci_quirks(struct pci_dev *pdev) |
2474 |
+ } |
2475 |
+ } |
2476 |
+ |
2477 |
++ if (pdev->vendor == PCI_VENDOR_ID_SYNOPSYS && |
2478 |
++ (pdev->device == PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 || |
2479 |
++ pdev->device == PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI || |
2480 |
++ pdev->device == PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31)) { |
2481 |
++ |
2482 |
++ struct dwc3_platform_data pdata; |
2483 |
++ |
2484 |
++ memset(&pdata, 0, sizeof(pdata)); |
2485 |
++ pdata.usb3_lpm_capable = true; |
2486 |
++ pdata.has_lpm_erratum = true; |
2487 |
++ pdata.dis_enblslpm_quirk = true; |
2488 |
++ |
2489 |
++ return platform_device_add_data(pci_get_drvdata(pdev), &pdata, |
2490 |
++ sizeof(pdata)); |
2491 |
++ } |
2492 |
++ |
2493 |
+ return 0; |
2494 |
+ } |
2495 |
+ |
2496 |
+@@ -172,6 +190,14 @@ static const struct pci_device_id dwc3_pci_id_table[] = { |
2497 |
+ PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, |
2498 |
+ PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3), |
2499 |
+ }, |
2500 |
++ { |
2501 |
++ PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, |
2502 |
++ PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI), |
2503 |
++ }, |
2504 |
++ { |
2505 |
++ PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, |
2506 |
++ PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31), |
2507 |
++ }, |
2508 |
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), }, |
2509 |
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, |
2510 |
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), }, |
2511 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
2512 |
+index 333a7c0078fc..6fbf461d523c 100644 |
2513 |
+--- a/drivers/usb/dwc3/gadget.c |
2514 |
++++ b/drivers/usb/dwc3/gadget.c |
2515 |
+@@ -1859,27 +1859,32 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep, |
2516 |
+ unsigned int i; |
2517 |
+ int ret; |
2518 |
+ |
2519 |
+- req = next_request(&dep->req_queued); |
2520 |
+- if (!req) { |
2521 |
+- WARN_ON_ONCE(1); |
2522 |
+- return 1; |
2523 |
+- } |
2524 |
+- i = 0; |
2525 |
+ do { |
2526 |
+- slot = req->start_slot + i; |
2527 |
+- if ((slot == DWC3_TRB_NUM - 1) && |
2528 |
++ req = next_request(&dep->req_queued); |
2529 |
++ if (!req) { |
2530 |
++ WARN_ON_ONCE(1); |
2531 |
++ return 1; |
2532 |
++ } |
2533 |
++ i = 0; |
2534 |
++ do { |
2535 |
++ slot = req->start_slot + i; |
2536 |
++ if ((slot == DWC3_TRB_NUM - 1) && |
2537 |
+ usb_endpoint_xfer_isoc(dep->endpoint.desc)) |
2538 |
+- slot++; |
2539 |
+- slot %= DWC3_TRB_NUM; |
2540 |
+- trb = &dep->trb_pool[slot]; |
2541 |
++ slot++; |
2542 |
++ slot %= DWC3_TRB_NUM; |
2543 |
++ trb = &dep->trb_pool[slot]; |
2544 |
++ |
2545 |
++ ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb, |
2546 |
++ event, status); |
2547 |
++ if (ret) |
2548 |
++ break; |
2549 |
++ } while (++i < req->request.num_mapped_sgs); |
2550 |
++ |
2551 |
++ dwc3_gadget_giveback(dep, req, status); |
2552 |
+ |
2553 |
+- ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb, |
2554 |
+- event, status); |
2555 |
+ if (ret) |
2556 |
+ break; |
2557 |
+- } while (++i < req->request.num_mapped_sgs); |
2558 |
+- |
2559 |
+- dwc3_gadget_giveback(dep, req, status); |
2560 |
++ } while (1); |
2561 |
+ |
2562 |
+ if (usb_endpoint_xfer_isoc(dep->endpoint.desc) && |
2563 |
+ list_empty(&dep->req_queued)) { |
2564 |
+@@ -2709,12 +2714,34 @@ int dwc3_gadget_init(struct dwc3 *dwc) |
2565 |
+ } |
2566 |
+ |
2567 |
+ dwc->gadget.ops = &dwc3_gadget_ops; |
2568 |
+- dwc->gadget.max_speed = USB_SPEED_SUPER; |
2569 |
+ dwc->gadget.speed = USB_SPEED_UNKNOWN; |
2570 |
+ dwc->gadget.sg_supported = true; |
2571 |
+ dwc->gadget.name = "dwc3-gadget"; |
2572 |
+ |
2573 |
+ /* |
2574 |
++ * FIXME We might be setting max_speed to <SUPER, however versions |
2575 |
++ * <2.20a of dwc3 have an issue with metastability (documented |
2576 |
++ * elsewhere in this driver) which tells us we can't set max speed to |
2577 |
++ * anything lower than SUPER. |
2578 |
++ * |
2579 |
++ * Because gadget.max_speed is only used by composite.c and function |
2580 |
++ * drivers (i.e. it won't go into dwc3's registers) we are allowing this |
2581 |
++ * to happen so we avoid sending SuperSpeed Capability descriptor |
2582 |
++ * together with our BOS descriptor as that could confuse host into |
2583 |
++ * thinking we can handle super speed. |
2584 |
++ * |
2585 |
++ * Note that, in fact, we won't even support GetBOS requests when speed |
2586 |
++ * is less than super speed because we don't have means, yet, to tell |
2587 |
++ * composite.c that we are USB 2.0 + LPM ECN. |
2588 |
++ */ |
2589 |
++ if (dwc->revision < DWC3_REVISION_220A) |
2590 |
++ dwc3_trace(trace_dwc3_gadget, |
2591 |
++ "Changing max_speed on rev %08x\n", |
2592 |
++ dwc->revision); |
2593 |
++ |
2594 |
++ dwc->gadget.max_speed = dwc->maximum_speed; |
2595 |
++ |
2596 |
++ /* |
2597 |
+ * Per databook, DWC3 needs buffer size to be aligned to MaxPacketSize |
2598 |
+ * on ep out. |
2599 |
+ */ |
2600 |
+diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h |
2601 |
+index d3614ecbb9ca..db2938002260 100644 |
2602 |
+--- a/drivers/usb/dwc3/platform_data.h |
2603 |
++++ b/drivers/usb/dwc3/platform_data.h |
2604 |
+@@ -42,6 +42,7 @@ struct dwc3_platform_data { |
2605 |
+ unsigned rx_detect_poll_quirk:1; |
2606 |
+ unsigned dis_u3_susphy_quirk:1; |
2607 |
+ unsigned dis_u2_susphy_quirk:1; |
2608 |
++ unsigned dis_enblslpm_quirk:1; |
2609 |
+ |
2610 |
+ unsigned tx_de_emphasis_quirk:1; |
2611 |
+ unsigned tx_de_emphasis:2; |
2612 |
+diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c |
2613 |
+index 4095cce05e6a..35fff450bdc8 100644 |
2614 |
+--- a/drivers/usb/gadget/udc/atmel_usba_udc.c |
2615 |
++++ b/drivers/usb/gadget/udc/atmel_usba_udc.c |
2616 |
+@@ -1634,7 +1634,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) |
2617 |
+ spin_lock(&udc->lock); |
2618 |
+ |
2619 |
+ int_enb = usba_int_enb_get(udc); |
2620 |
+- status = usba_readl(udc, INT_STA) & int_enb; |
2621 |
++ status = usba_readl(udc, INT_STA) & (int_enb | USBA_HIGH_SPEED); |
2622 |
+ DBG(DBG_INT, "irq, status=%#08x\n", status); |
2623 |
+ |
2624 |
+ if (status & USBA_DET_SUSPEND) { |
2625 |
+diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c |
2626 |
+index 2bee912ca65b..baa0191666aa 100644 |
2627 |
+--- a/drivers/usb/gadget/udc/net2280.c |
2628 |
++++ b/drivers/usb/gadget/udc/net2280.c |
2629 |
+@@ -1846,7 +1846,7 @@ static void defect7374_disable_data_eps(struct net2280 *dev) |
2630 |
+ |
2631 |
+ for (i = 1; i < 5; i++) { |
2632 |
+ ep = &dev->ep[i]; |
2633 |
+- writel(0, &ep->cfg->ep_cfg); |
2634 |
++ writel(i, &ep->cfg->ep_cfg); |
2635 |
+ } |
2636 |
+ |
2637 |
+ /* CSROUT, CSRIN, PCIOUT, PCIIN, STATIN, RCIN */ |
2638 |
+diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c |
2639 |
+index bfcbb9aa8816..ee8d5faa0194 100644 |
2640 |
+--- a/drivers/usb/host/ehci-orion.c |
2641 |
++++ b/drivers/usb/host/ehci-orion.c |
2642 |
+@@ -224,7 +224,8 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) |
2643 |
+ priv->phy = devm_phy_optional_get(&pdev->dev, "usb"); |
2644 |
+ if (IS_ERR(priv->phy)) { |
2645 |
+ err = PTR_ERR(priv->phy); |
2646 |
+- goto err_phy_get; |
2647 |
++ if (err != -ENOSYS) |
2648 |
++ goto err_phy_get; |
2649 |
+ } else { |
2650 |
+ err = phy_init(priv->phy); |
2651 |
+ if (err) |
2652 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
2653 |
+index d7b9f484d4e9..6062996d35a6 100644 |
2654 |
+--- a/drivers/usb/host/xhci.c |
2655 |
++++ b/drivers/usb/host/xhci.c |
2656 |
+@@ -175,6 +175,16 @@ int xhci_reset(struct xhci_hcd *xhci) |
2657 |
+ command |= CMD_RESET; |
2658 |
+ writel(command, &xhci->op_regs->command); |
2659 |
+ |
2660 |
++ /* Existing Intel xHCI controllers require a delay of 1 mS, |
2661 |
++ * after setting the CMD_RESET bit, and before accessing any |
2662 |
++ * HC registers. This allows the HC to complete the |
2663 |
++ * reset operation and be ready for HC register access. |
2664 |
++ * Without this delay, the subsequent HC register access, |
2665 |
++ * may result in a system hang very rarely. |
2666 |
++ */ |
2667 |
++ if (xhci->quirks & XHCI_INTEL_HOST) |
2668 |
++ udelay(1000); |
2669 |
++ |
2670 |
+ ret = xhci_handshake(&xhci->op_regs->command, |
2671 |
+ CMD_RESET, 0, 10 * 1000 * 1000); |
2672 |
+ if (ret) |
2673 |
+diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c |
2674 |
+index 514a6cdaeff6..2fe6d263eb6b 100644 |
2675 |
+--- a/drivers/usb/musb/musb_core.c |
2676 |
++++ b/drivers/usb/musb/musb_core.c |
2677 |
+@@ -132,7 +132,7 @@ static inline struct musb *dev_to_musb(struct device *dev) |
2678 |
+ /*-------------------------------------------------------------------------*/ |
2679 |
+ |
2680 |
+ #ifndef CONFIG_BLACKFIN |
2681 |
+-static int musb_ulpi_read(struct usb_phy *phy, u32 offset) |
2682 |
++static int musb_ulpi_read(struct usb_phy *phy, u32 reg) |
2683 |
+ { |
2684 |
+ void __iomem *addr = phy->io_priv; |
2685 |
+ int i = 0; |
2686 |
+@@ -151,7 +151,7 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset) |
2687 |
+ * ULPICarKitControlDisableUTMI after clearing POWER_SUSPENDM. |
2688 |
+ */ |
2689 |
+ |
2690 |
+- musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)offset); |
2691 |
++ musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)reg); |
2692 |
+ musb_writeb(addr, MUSB_ULPI_REG_CONTROL, |
2693 |
+ MUSB_ULPI_REG_REQ | MUSB_ULPI_RDN_WR); |
2694 |
+ |
2695 |
+@@ -176,7 +176,7 @@ out: |
2696 |
+ return ret; |
2697 |
+ } |
2698 |
+ |
2699 |
+-static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) |
2700 |
++static int musb_ulpi_write(struct usb_phy *phy, u32 val, u32 reg) |
2701 |
+ { |
2702 |
+ void __iomem *addr = phy->io_priv; |
2703 |
+ int i = 0; |
2704 |
+@@ -191,8 +191,8 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) |
2705 |
+ power &= ~MUSB_POWER_SUSPENDM; |
2706 |
+ musb_writeb(addr, MUSB_POWER, power); |
2707 |
+ |
2708 |
+- musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)offset); |
2709 |
+- musb_writeb(addr, MUSB_ULPI_REG_DATA, (u8)data); |
2710 |
++ musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)reg); |
2711 |
++ musb_writeb(addr, MUSB_ULPI_REG_DATA, (u8)val); |
2712 |
+ musb_writeb(addr, MUSB_ULPI_REG_CONTROL, MUSB_ULPI_REG_REQ); |
2713 |
+ |
2714 |
+ while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) |
2715 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
2716 |
+index 7c8eb4c4c175..4021846139c9 100644 |
2717 |
+--- a/drivers/usb/serial/option.c |
2718 |
++++ b/drivers/usb/serial/option.c |
2719 |
+@@ -162,6 +162,7 @@ static void option_instat_callback(struct urb *urb); |
2720 |
+ #define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED 0x9001 |
2721 |
+ #define NOVATELWIRELESS_PRODUCT_E362 0x9010 |
2722 |
+ #define NOVATELWIRELESS_PRODUCT_E371 0x9011 |
2723 |
++#define NOVATELWIRELESS_PRODUCT_U620L 0x9022 |
2724 |
+ #define NOVATELWIRELESS_PRODUCT_G2 0xA010 |
2725 |
+ #define NOVATELWIRELESS_PRODUCT_MC551 0xB001 |
2726 |
+ |
2727 |
+@@ -357,6 +358,7 @@ static void option_instat_callback(struct urb *urb); |
2728 |
+ /* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick * |
2729 |
+ * It seems to contain a Qualcomm QSC6240/6290 chipset */ |
2730 |
+ #define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603 |
2731 |
++#define FOUR_G_SYSTEMS_PRODUCT_W100 0x9b01 |
2732 |
+ |
2733 |
+ /* iBall 3.5G connect wireless modem */ |
2734 |
+ #define IBALL_3_5G_CONNECT 0x9605 |
2735 |
+@@ -522,6 +524,11 @@ static const struct option_blacklist_info four_g_w14_blacklist = { |
2736 |
+ .sendsetup = BIT(0) | BIT(1), |
2737 |
+ }; |
2738 |
+ |
2739 |
++static const struct option_blacklist_info four_g_w100_blacklist = { |
2740 |
++ .sendsetup = BIT(1) | BIT(2), |
2741 |
++ .reserved = BIT(3), |
2742 |
++}; |
2743 |
++ |
2744 |
+ static const struct option_blacklist_info alcatel_x200_blacklist = { |
2745 |
+ .sendsetup = BIT(0) | BIT(1), |
2746 |
+ .reserved = BIT(4), |
2747 |
+@@ -1060,6 +1067,7 @@ static const struct usb_device_id option_ids[] = { |
2748 |
+ { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) }, |
2749 |
+ { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E362, 0xff, 0xff, 0xff) }, |
2750 |
+ { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E371, 0xff, 0xff, 0xff) }, |
2751 |
++ { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U620L, 0xff, 0x00, 0x00) }, |
2752 |
+ |
2753 |
+ { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, |
2754 |
+ { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, |
2755 |
+@@ -1653,6 +1661,9 @@ static const struct usb_device_id option_ids[] = { |
2756 |
+ { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), |
2757 |
+ .driver_info = (kernel_ulong_t)&four_g_w14_blacklist |
2758 |
+ }, |
2759 |
++ { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W100), |
2760 |
++ .driver_info = (kernel_ulong_t)&four_g_w100_blacklist |
2761 |
++ }, |
2762 |
+ { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) }, |
2763 |
+ { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, |
2764 |
+ { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, |
2765 |
+diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c |
2766 |
+index f49d262e926b..514fa91cf74e 100644 |
2767 |
+--- a/drivers/usb/serial/qcserial.c |
2768 |
++++ b/drivers/usb/serial/qcserial.c |
2769 |
+@@ -22,6 +22,8 @@ |
2770 |
+ #define DRIVER_AUTHOR "Qualcomm Inc" |
2771 |
+ #define DRIVER_DESC "Qualcomm USB Serial driver" |
2772 |
+ |
2773 |
++#define QUECTEL_EC20_PID 0x9215 |
2774 |
++ |
2775 |
+ /* standard device layouts supported by this driver */ |
2776 |
+ enum qcserial_layouts { |
2777 |
+ QCSERIAL_G2K = 0, /* Gobi 2000 */ |
2778 |
+@@ -169,6 +171,38 @@ static const struct usb_device_id id_table[] = { |
2779 |
+ }; |
2780 |
+ MODULE_DEVICE_TABLE(usb, id_table); |
2781 |
+ |
2782 |
++static int handle_quectel_ec20(struct device *dev, int ifnum) |
2783 |
++{ |
2784 |
++ int altsetting = 0; |
2785 |
++ |
2786 |
++ /* |
2787 |
++ * Quectel EC20 Mini PCIe LTE module layout: |
2788 |
++ * 0: DM/DIAG (use libqcdm from ModemManager for communication) |
2789 |
++ * 1: NMEA |
2790 |
++ * 2: AT-capable modem port |
2791 |
++ * 3: Modem interface |
2792 |
++ * 4: NDIS |
2793 |
++ */ |
2794 |
++ switch (ifnum) { |
2795 |
++ case 0: |
2796 |
++ dev_dbg(dev, "Quectel EC20 DM/DIAG interface found\n"); |
2797 |
++ break; |
2798 |
++ case 1: |
2799 |
++ dev_dbg(dev, "Quectel EC20 NMEA GPS interface found\n"); |
2800 |
++ break; |
2801 |
++ case 2: |
2802 |
++ case 3: |
2803 |
++ dev_dbg(dev, "Quectel EC20 Modem port found\n"); |
2804 |
++ break; |
2805 |
++ case 4: |
2806 |
++ /* Don't claim the QMI/net interface */ |
2807 |
++ altsetting = -1; |
2808 |
++ break; |
2809 |
++ } |
2810 |
++ |
2811 |
++ return altsetting; |
2812 |
++} |
2813 |
++ |
2814 |
+ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
2815 |
+ { |
2816 |
+ struct usb_host_interface *intf = serial->interface->cur_altsetting; |
2817 |
+@@ -178,6 +212,10 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
2818 |
+ __u8 ifnum; |
2819 |
+ int altsetting = -1; |
2820 |
+ |
2821 |
++ /* we only support vendor specific functions */ |
2822 |
++ if (intf->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC) |
2823 |
++ goto done; |
2824 |
++ |
2825 |
+ nintf = serial->dev->actconfig->desc.bNumInterfaces; |
2826 |
+ dev_dbg(dev, "Num Interfaces = %d\n", nintf); |
2827 |
+ ifnum = intf->desc.bInterfaceNumber; |
2828 |
+@@ -237,6 +275,12 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
2829 |
+ altsetting = -1; |
2830 |
+ break; |
2831 |
+ case QCSERIAL_G2K: |
2832 |
++ /* handle non-standard layouts */ |
2833 |
++ if (nintf == 5 && id->idProduct == QUECTEL_EC20_PID) { |
2834 |
++ altsetting = handle_quectel_ec20(dev, ifnum); |
2835 |
++ goto done; |
2836 |
++ } |
2837 |
++ |
2838 |
+ /* |
2839 |
+ * Gobi 2K+ USB layout: |
2840 |
+ * 0: QMI/net |
2841 |
+@@ -297,29 +341,39 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
2842 |
+ break; |
2843 |
+ case QCSERIAL_HWI: |
2844 |
+ /* |
2845 |
+- * Huawei layout: |
2846 |
+- * 0: AT-capable modem port |
2847 |
+- * 1: DM/DIAG |
2848 |
+- * 2: AT-capable modem port |
2849 |
+- * 3: CCID-compatible PCSC interface |
2850 |
+- * 4: QMI/net |
2851 |
+- * 5: NMEA |
2852 |
++ * Huawei devices map functions by subclass + protocol |
2853 |
++ * instead of interface numbers. The protocol identify |
2854 |
++ * a specific function, while the subclass indicate a |
2855 |
++ * specific firmware source |
2856 |
++ * |
2857 |
++ * This is a blacklist of functions known to be |
2858 |
++ * non-serial. The rest are assumed to be serial and |
2859 |
++ * will be handled by this driver |
2860 |
+ */ |
2861 |
+- switch (ifnum) { |
2862 |
+- case 0: |
2863 |
+- case 2: |
2864 |
+- dev_dbg(dev, "Modem port found\n"); |
2865 |
+- break; |
2866 |
+- case 1: |
2867 |
+- dev_dbg(dev, "DM/DIAG interface found\n"); |
2868 |
+- break; |
2869 |
+- case 5: |
2870 |
+- dev_dbg(dev, "NMEA GPS interface found\n"); |
2871 |
+- break; |
2872 |
+- default: |
2873 |
+- /* don't claim any unsupported interface */ |
2874 |
++ switch (intf->desc.bInterfaceProtocol) { |
2875 |
++ /* QMI combined (qmi_wwan) */ |
2876 |
++ case 0x07: |
2877 |
++ case 0x37: |
2878 |
++ case 0x67: |
2879 |
++ /* QMI data (qmi_wwan) */ |
2880 |
++ case 0x08: |
2881 |
++ case 0x38: |
2882 |
++ case 0x68: |
2883 |
++ /* QMI control (qmi_wwan) */ |
2884 |
++ case 0x09: |
2885 |
++ case 0x39: |
2886 |
++ case 0x69: |
2887 |
++ /* NCM like (huawei_cdc_ncm) */ |
2888 |
++ case 0x16: |
2889 |
++ case 0x46: |
2890 |
++ case 0x76: |
2891 |
+ altsetting = -1; |
2892 |
+ break; |
2893 |
++ default: |
2894 |
++ dev_dbg(dev, "Huawei type serial port found (%02x/%02x/%02x)\n", |
2895 |
++ intf->desc.bInterfaceClass, |
2896 |
++ intf->desc.bInterfaceSubClass, |
2897 |
++ intf->desc.bInterfaceProtocol); |
2898 |
+ } |
2899 |
+ break; |
2900 |
+ default: |
2901 |
+diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c |
2902 |
+index e9da41d9fe7f..2694df2f4559 100644 |
2903 |
+--- a/drivers/usb/serial/ti_usb_3410_5052.c |
2904 |
++++ b/drivers/usb/serial/ti_usb_3410_5052.c |
2905 |
+@@ -159,6 +159,7 @@ static const struct usb_device_id ti_id_table_3410[] = { |
2906 |
+ { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_ID) }, |
2907 |
+ { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) }, |
2908 |
+ { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) }, |
2909 |
++ { USB_DEVICE(HONEYWELL_VENDOR_ID, HONEYWELL_HGI80_PRODUCT_ID) }, |
2910 |
+ { } /* terminator */ |
2911 |
+ }; |
2912 |
+ |
2913 |
+@@ -191,6 +192,7 @@ static const struct usb_device_id ti_id_table_combined[] = { |
2914 |
+ { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) }, |
2915 |
+ { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) }, |
2916 |
+ { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) }, |
2917 |
++ { USB_DEVICE(HONEYWELL_VENDOR_ID, HONEYWELL_HGI80_PRODUCT_ID) }, |
2918 |
+ { } /* terminator */ |
2919 |
+ }; |
2920 |
+ |
2921 |
+diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h |
2922 |
+index 4a2423e84d55..98f35c656c02 100644 |
2923 |
+--- a/drivers/usb/serial/ti_usb_3410_5052.h |
2924 |
++++ b/drivers/usb/serial/ti_usb_3410_5052.h |
2925 |
+@@ -56,6 +56,10 @@ |
2926 |
+ #define ABBOTT_PRODUCT_ID ABBOTT_STEREO_PLUG_ID |
2927 |
+ #define ABBOTT_STRIP_PORT_ID 0x3420 |
2928 |
+ |
2929 |
++/* Honeywell vendor and product IDs */ |
2930 |
++#define HONEYWELL_VENDOR_ID 0x10ac |
2931 |
++#define HONEYWELL_HGI80_PRODUCT_ID 0x0102 /* Honeywell HGI80 */ |
2932 |
++ |
2933 |
+ /* Commands */ |
2934 |
+ #define TI_GET_VERSION 0x01 |
2935 |
+ #define TI_GET_PORT_STATUS 0x02 |
2936 |
+diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c |
2937 |
+index 96093ae369a5..cdc3d3360764 100644 |
2938 |
+--- a/drivers/xen/events/events_base.c |
2939 |
++++ b/drivers/xen/events/events_base.c |
2940 |
+@@ -39,6 +39,7 @@ |
2941 |
+ #include <asm/irq.h> |
2942 |
+ #include <asm/idle.h> |
2943 |
+ #include <asm/io_apic.h> |
2944 |
++#include <asm/i8259.h> |
2945 |
+ #include <asm/xen/pci.h> |
2946 |
+ #include <xen/page.h> |
2947 |
+ #endif |
2948 |
+@@ -420,7 +421,7 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi) |
2949 |
+ return xen_allocate_irq_dynamic(); |
2950 |
+ |
2951 |
+ /* Legacy IRQ descriptors are already allocated by the arch. */ |
2952 |
+- if (gsi < NR_IRQS_LEGACY) |
2953 |
++ if (gsi < nr_legacy_irqs()) |
2954 |
+ irq = gsi; |
2955 |
+ else |
2956 |
+ irq = irq_alloc_desc_at(gsi, -1); |
2957 |
+@@ -446,7 +447,7 @@ static void xen_free_irq(unsigned irq) |
2958 |
+ kfree(info); |
2959 |
+ |
2960 |
+ /* Legacy IRQ descriptors are managed by the arch. */ |
2961 |
+- if (irq < NR_IRQS_LEGACY) |
2962 |
++ if (irq < nr_legacy_irqs()) |
2963 |
+ return; |
2964 |
+ |
2965 |
+ irq_free_desc(irq); |
2966 |
+diff --git a/fs/proc/array.c b/fs/proc/array.c |
2967 |
+index ce065cf3104f..57fde2dfd4af 100644 |
2968 |
+--- a/fs/proc/array.c |
2969 |
++++ b/fs/proc/array.c |
2970 |
+@@ -372,7 +372,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, |
2971 |
+ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, |
2972 |
+ struct pid *pid, struct task_struct *task, int whole) |
2973 |
+ { |
2974 |
+- unsigned long vsize, eip, esp, wchan = ~0UL; |
2975 |
++ unsigned long vsize, eip, esp, wchan = 0; |
2976 |
+ int priority, nice; |
2977 |
+ int tty_pgrp = -1, tty_nr = 0; |
2978 |
+ sigset_t sigign, sigcatch; |
2979 |
+@@ -504,7 +504,19 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, |
2980 |
+ seq_put_decimal_ull(m, ' ', task->blocked.sig[0] & 0x7fffffffUL); |
2981 |
+ seq_put_decimal_ull(m, ' ', sigign.sig[0] & 0x7fffffffUL); |
2982 |
+ seq_put_decimal_ull(m, ' ', sigcatch.sig[0] & 0x7fffffffUL); |
2983 |
+- seq_put_decimal_ull(m, ' ', wchan); |
2984 |
++ |
2985 |
++ /* |
2986 |
++ * We used to output the absolute kernel address, but that's an |
2987 |
++ * information leak - so instead we show a 0/1 flag here, to signal |
2988 |
++ * to user-space whether there's a wchan field in /proc/PID/wchan. |
2989 |
++ * |
2990 |
++ * This works with older implementations of procps as well. |
2991 |
++ */ |
2992 |
++ if (wchan) |
2993 |
++ seq_puts(m, " 1"); |
2994 |
++ else |
2995 |
++ seq_puts(m, " 0"); |
2996 |
++ |
2997 |
+ seq_put_decimal_ull(m, ' ', 0); |
2998 |
+ seq_put_decimal_ull(m, ' ', 0); |
2999 |
+ seq_put_decimal_ll(m, ' ', task->exit_signal); |
3000 |
+diff --git a/fs/proc/base.c b/fs/proc/base.c |
3001 |
+index aa50d1ac28fc..83a43c131e9d 100644 |
3002 |
+--- a/fs/proc/base.c |
3003 |
++++ b/fs/proc/base.c |
3004 |
+@@ -430,13 +430,10 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns, |
3005 |
+ |
3006 |
+ wchan = get_wchan(task); |
3007 |
+ |
3008 |
+- if (lookup_symbol_name(wchan, symname) < 0) { |
3009 |
+- if (!ptrace_may_access(task, PTRACE_MODE_READ)) |
3010 |
+- return 0; |
3011 |
+- seq_printf(m, "%lu", wchan); |
3012 |
+- } else { |
3013 |
++ if (wchan && ptrace_may_access(task, PTRACE_MODE_READ) && !lookup_symbol_name(wchan, symname)) |
3014 |
+ seq_printf(m, "%s", symname); |
3015 |
+- } |
3016 |
++ else |
3017 |
++ seq_putc(m, '0'); |
3018 |
+ |
3019 |
+ return 0; |
3020 |
+ } |
3021 |
+diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h |
3022 |
+index 05e99b8ef465..053f122b592d 100644 |
3023 |
+--- a/include/linux/kvm_host.h |
3024 |
++++ b/include/linux/kvm_host.h |
3025 |
+@@ -436,6 +436,17 @@ static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i) |
3026 |
+ (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \ |
3027 |
+ idx++) |
3028 |
+ |
3029 |
++static inline struct kvm_vcpu *kvm_get_vcpu_by_id(struct kvm *kvm, int id) |
3030 |
++{ |
3031 |
++ struct kvm_vcpu *vcpu; |
3032 |
++ int i; |
3033 |
++ |
3034 |
++ kvm_for_each_vcpu(i, vcpu, kvm) |
3035 |
++ if (vcpu->vcpu_id == id) |
3036 |
++ return vcpu; |
3037 |
++ return NULL; |
3038 |
++} |
3039 |
++ |
3040 |
+ #define kvm_for_each_memslot(memslot, slots) \ |
3041 |
+ for (memslot = &slots->memslots[0]; \ |
3042 |
+ memslot < slots->memslots + KVM_MEM_SLOTS_NUM && memslot->npages;\ |
3043 |
+diff --git a/include/linux/tty.h b/include/linux/tty.h |
3044 |
+index ad6c8913aa3e..342a760d5729 100644 |
3045 |
+--- a/include/linux/tty.h |
3046 |
++++ b/include/linux/tty.h |
3047 |
+@@ -605,7 +605,7 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops); |
3048 |
+ |
3049 |
+ /* tty_audit.c */ |
3050 |
+ #ifdef CONFIG_AUDIT |
3051 |
+-extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, |
3052 |
++extern void tty_audit_add_data(struct tty_struct *tty, const void *data, |
3053 |
+ size_t size, unsigned icanon); |
3054 |
+ extern void tty_audit_exit(void); |
3055 |
+ extern void tty_audit_fork(struct signal_struct *sig); |
3056 |
+@@ -613,8 +613,8 @@ extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); |
3057 |
+ extern void tty_audit_push(struct tty_struct *tty); |
3058 |
+ extern int tty_audit_push_current(void); |
3059 |
+ #else |
3060 |
+-static inline void tty_audit_add_data(struct tty_struct *tty, |
3061 |
+- unsigned char *data, size_t size, unsigned icanon) |
3062 |
++static inline void tty_audit_add_data(struct tty_struct *tty, const void *data, |
3063 |
++ size_t size, unsigned icanon) |
3064 |
+ { |
3065 |
+ } |
3066 |
+ static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch) |
3067 |
+diff --git a/include/net/inet_common.h b/include/net/inet_common.h |
3068 |
+index 279f83591971..109e3ee9108c 100644 |
3069 |
+--- a/include/net/inet_common.h |
3070 |
++++ b/include/net/inet_common.h |
3071 |
+@@ -41,7 +41,8 @@ int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, |
3072 |
+ |
3073 |
+ static inline void inet_ctl_sock_destroy(struct sock *sk) |
3074 |
+ { |
3075 |
+- sock_release(sk->sk_socket); |
3076 |
++ if (sk) |
3077 |
++ sock_release(sk->sk_socket); |
3078 |
+ } |
3079 |
+ |
3080 |
+ #endif |
3081 |
+diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h |
3082 |
+index 5fa643b4e891..ff6d78ff68df 100644 |
3083 |
+--- a/include/net/ip_fib.h |
3084 |
++++ b/include/net/ip_fib.h |
3085 |
+@@ -306,7 +306,7 @@ void fib_flush_external(struct net *net); |
3086 |
+ |
3087 |
+ /* Exported by fib_semantics.c */ |
3088 |
+ int ip_fib_check_default(__be32 gw, struct net_device *dev); |
3089 |
+-int fib_sync_down_dev(struct net_device *dev, unsigned long event); |
3090 |
++int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force); |
3091 |
+ int fib_sync_down_addr(struct net *net, __be32 local); |
3092 |
+ int fib_sync_up(struct net_device *dev, unsigned int nh_flags); |
3093 |
+ void fib_select_multipath(struct fib_result *res); |
3094 |
+diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c |
3095 |
+index f1a117f8cad2..0bec4588c3c8 100644 |
3096 |
+--- a/net/bluetooth/hidp/core.c |
3097 |
++++ b/net/bluetooth/hidp/core.c |
3098 |
+@@ -401,6 +401,20 @@ static void hidp_idle_timeout(unsigned long arg) |
3099 |
+ { |
3100 |
+ struct hidp_session *session = (struct hidp_session *) arg; |
3101 |
+ |
3102 |
++ /* The HIDP user-space API only contains calls to add and remove |
3103 |
++ * devices. There is no way to forward events of any kind. Therefore, |
3104 |
++ * we have to forcefully disconnect a device on idle-timeouts. This is |
3105 |
++ * unfortunate and weird API design, but it is spec-compliant and |
3106 |
++ * required for backwards-compatibility. Hence, on idle-timeout, we |
3107 |
++ * signal driver-detach events, so poll() will be woken up with an |
3108 |
++ * error-condition on both sockets. |
3109 |
++ */ |
3110 |
++ |
3111 |
++ session->intr_sock->sk->sk_err = EUNATCH; |
3112 |
++ session->ctrl_sock->sk->sk_err = EUNATCH; |
3113 |
++ wake_up_interruptible(sk_sleep(session->intr_sock->sk)); |
3114 |
++ wake_up_interruptible(sk_sleep(session->ctrl_sock->sk)); |
3115 |
++ |
3116 |
+ hidp_session_terminate(session); |
3117 |
+ } |
3118 |
+ |
3119 |
+diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c |
3120 |
+index 92720f3fe573..e32a9e4910da 100644 |
3121 |
+--- a/net/bluetooth/mgmt.c |
3122 |
++++ b/net/bluetooth/mgmt.c |
3123 |
+@@ -3090,6 +3090,11 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data, |
3124 |
+ } else { |
3125 |
+ u8 addr_type; |
3126 |
+ |
3127 |
++ if (cp->addr.type == BDADDR_LE_PUBLIC) |
3128 |
++ addr_type = ADDR_LE_DEV_PUBLIC; |
3129 |
++ else |
3130 |
++ addr_type = ADDR_LE_DEV_RANDOM; |
3131 |
++ |
3132 |
+ conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, |
3133 |
+ &cp->addr.bdaddr); |
3134 |
+ if (conn) { |
3135 |
+@@ -3105,13 +3110,10 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data, |
3136 |
+ */ |
3137 |
+ if (!cp->disconnect) |
3138 |
+ conn = NULL; |
3139 |
++ } else { |
3140 |
++ hci_conn_params_del(hdev, &cp->addr.bdaddr, addr_type); |
3141 |
+ } |
3142 |
+ |
3143 |
+- if (cp->addr.type == BDADDR_LE_PUBLIC) |
3144 |
+- addr_type = ADDR_LE_DEV_PUBLIC; |
3145 |
+- else |
3146 |
+- addr_type = ADDR_LE_DEV_RANDOM; |
3147 |
+- |
3148 |
+ hci_remove_irk(hdev, &cp->addr.bdaddr, addr_type); |
3149 |
+ |
3150 |
+ err = hci_remove_ltk(hdev, &cp->addr.bdaddr, addr_type); |
3151 |
+diff --git a/net/core/dst.c b/net/core/dst.c |
3152 |
+index 002144bea935..cc4a086ae09c 100644 |
3153 |
+--- a/net/core/dst.c |
3154 |
++++ b/net/core/dst.c |
3155 |
+@@ -287,7 +287,7 @@ void dst_release(struct dst_entry *dst) |
3156 |
+ if (unlikely(newrefcnt < 0)) |
3157 |
+ net_warn_ratelimited("%s: dst:%p refcnt:%d\n", |
3158 |
+ __func__, dst, newrefcnt); |
3159 |
+- if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) |
3160 |
++ if (!newrefcnt && unlikely(dst->flags & DST_NOCACHE)) |
3161 |
+ call_rcu(&dst->rcu_head, dst_destroy_rcu); |
3162 |
+ } |
3163 |
+ } |
3164 |
+diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c |
3165 |
+index 6bbc54940eb4..d7116cf4eba4 100644 |
3166 |
+--- a/net/ipv4/fib_frontend.c |
3167 |
++++ b/net/ipv4/fib_frontend.c |
3168 |
+@@ -1063,9 +1063,10 @@ static void nl_fib_lookup_exit(struct net *net) |
3169 |
+ net->ipv4.fibnl = NULL; |
3170 |
+ } |
3171 |
+ |
3172 |
+-static void fib_disable_ip(struct net_device *dev, unsigned long event) |
3173 |
++static void fib_disable_ip(struct net_device *dev, unsigned long event, |
3174 |
++ bool force) |
3175 |
+ { |
3176 |
+- if (fib_sync_down_dev(dev, event)) |
3177 |
++ if (fib_sync_down_dev(dev, event, force)) |
3178 |
+ fib_flush(dev_net(dev)); |
3179 |
+ rt_cache_flush(dev_net(dev)); |
3180 |
+ arp_ifdown(dev); |
3181 |
+@@ -1093,7 +1094,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, |
3182 |
+ /* Last address was deleted from this interface. |
3183 |
+ * Disable IP. |
3184 |
+ */ |
3185 |
+- fib_disable_ip(dev, event); |
3186 |
++ fib_disable_ip(dev, event, true); |
3187 |
+ } else { |
3188 |
+ rt_cache_flush(dev_net(dev)); |
3189 |
+ } |
3190 |
+@@ -1110,7 +1111,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo |
3191 |
+ unsigned int flags; |
3192 |
+ |
3193 |
+ if (event == NETDEV_UNREGISTER) { |
3194 |
+- fib_disable_ip(dev, event); |
3195 |
++ fib_disable_ip(dev, event, true); |
3196 |
+ rt_flush_dev(dev); |
3197 |
+ return NOTIFY_DONE; |
3198 |
+ } |
3199 |
+@@ -1131,14 +1132,14 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo |
3200 |
+ rt_cache_flush(net); |
3201 |
+ break; |
3202 |
+ case NETDEV_DOWN: |
3203 |
+- fib_disable_ip(dev, event); |
3204 |
++ fib_disable_ip(dev, event, false); |
3205 |
+ break; |
3206 |
+ case NETDEV_CHANGE: |
3207 |
+ flags = dev_get_flags(dev); |
3208 |
+ if (flags & (IFF_RUNNING | IFF_LOWER_UP)) |
3209 |
+ fib_sync_up(dev, RTNH_F_LINKDOWN); |
3210 |
+ else |
3211 |
+- fib_sync_down_dev(dev, event); |
3212 |
++ fib_sync_down_dev(dev, event, false); |
3213 |
+ /* fall through */ |
3214 |
+ case NETDEV_CHANGEMTU: |
3215 |
+ rt_cache_flush(net); |
3216 |
+diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c |
3217 |
+index 3a06586b170c..71bad5c82445 100644 |
3218 |
+--- a/net/ipv4/fib_semantics.c |
3219 |
++++ b/net/ipv4/fib_semantics.c |
3220 |
+@@ -1132,7 +1132,13 @@ int fib_sync_down_addr(struct net *net, __be32 local) |
3221 |
+ return ret; |
3222 |
+ } |
3223 |
+ |
3224 |
+-int fib_sync_down_dev(struct net_device *dev, unsigned long event) |
3225 |
++/* Event force Flags Description |
3226 |
++ * NETDEV_CHANGE 0 LINKDOWN Carrier OFF, not for scope host |
3227 |
++ * NETDEV_DOWN 0 LINKDOWN|DEAD Link down, not for scope host |
3228 |
++ * NETDEV_DOWN 1 LINKDOWN|DEAD Last address removed |
3229 |
++ * NETDEV_UNREGISTER 1 LINKDOWN|DEAD Device removed |
3230 |
++ */ |
3231 |
++int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force) |
3232 |
+ { |
3233 |
+ int ret = 0; |
3234 |
+ int scope = RT_SCOPE_NOWHERE; |
3235 |
+@@ -1141,8 +1147,7 @@ int fib_sync_down_dev(struct net_device *dev, unsigned long event) |
3236 |
+ struct hlist_head *head = &fib_info_devhash[hash]; |
3237 |
+ struct fib_nh *nh; |
3238 |
+ |
3239 |
+- if (event == NETDEV_UNREGISTER || |
3240 |
+- event == NETDEV_DOWN) |
3241 |
++ if (force) |
3242 |
+ scope = -1; |
3243 |
+ |
3244 |
+ hlist_for_each_entry(nh, head, nh_hash) { |
3245 |
+@@ -1291,6 +1296,13 @@ int fib_sync_up(struct net_device *dev, unsigned int nh_flags) |
3246 |
+ if (!(dev->flags & IFF_UP)) |
3247 |
+ return 0; |
3248 |
+ |
3249 |
++ if (nh_flags & RTNH_F_DEAD) { |
3250 |
++ unsigned int flags = dev_get_flags(dev); |
3251 |
++ |
3252 |
++ if (flags & (IFF_RUNNING | IFF_LOWER_UP)) |
3253 |
++ nh_flags |= RTNH_F_LINKDOWN; |
3254 |
++ } |
3255 |
++ |
3256 |
+ prev_fi = NULL; |
3257 |
+ hash = fib_devindex_hashfn(dev->ifindex); |
3258 |
+ head = &fib_info_devhash[hash]; |
3259 |
+diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c |
3260 |
+index b0c6258ffb79..ea3aedb7dd0e 100644 |
3261 |
+--- a/net/ipv4/fib_trie.c |
3262 |
++++ b/net/ipv4/fib_trie.c |
3263 |
+@@ -1561,7 +1561,7 @@ static struct key_vector *leaf_walk_rcu(struct key_vector **tn, t_key key) |
3264 |
+ do { |
3265 |
+ /* record parent and next child index */ |
3266 |
+ pn = n; |
3267 |
+- cindex = key ? get_index(key, pn) : 0; |
3268 |
++ cindex = (key > pn->key) ? get_index(key, pn) : 0; |
3269 |
+ |
3270 |
+ if (cindex >> pn->bits) |
3271 |
+ break; |
3272 |
+diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c |
3273 |
+index 5aa46d4b44ef..5a8ee3282550 100644 |
3274 |
+--- a/net/ipv4/gre_offload.c |
3275 |
++++ b/net/ipv4/gre_offload.c |
3276 |
+@@ -36,7 +36,8 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, |
3277 |
+ SKB_GSO_TCP_ECN | |
3278 |
+ SKB_GSO_GRE | |
3279 |
+ SKB_GSO_GRE_CSUM | |
3280 |
+- SKB_GSO_IPIP))) |
3281 |
++ SKB_GSO_IPIP | |
3282 |
++ SKB_GSO_SIT))) |
3283 |
+ goto out; |
3284 |
+ |
3285 |
+ if (!skb->encapsulation) |
3286 |
+diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c |
3287 |
+index 3a2c0162c3ba..df28693f32e1 100644 |
3288 |
+--- a/net/ipv4/ipmr.c |
3289 |
++++ b/net/ipv4/ipmr.c |
3290 |
+@@ -1683,8 +1683,8 @@ static inline int ipmr_forward_finish(struct sock *sk, struct sk_buff *skb) |
3291 |
+ { |
3292 |
+ struct ip_options *opt = &(IPCB(skb)->opt); |
3293 |
+ |
3294 |
+- IP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS); |
3295 |
+- IP_ADD_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTOCTETS, skb->len); |
3296 |
++ IP_INC_STATS(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS); |
3297 |
++ IP_ADD_STATS(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTOCTETS, skb->len); |
3298 |
+ |
3299 |
+ if (unlikely(opt->optlen)) |
3300 |
+ ip_forward_options(skb); |
3301 |
+@@ -1746,7 +1746,7 @@ static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt, |
3302 |
+ * to blackhole. |
3303 |
+ */ |
3304 |
+ |
3305 |
+- IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_FRAGFAILS); |
3306 |
++ IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS); |
3307 |
+ ip_rt_put(rt); |
3308 |
+ goto out_free; |
3309 |
+ } |
3310 |
+diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c |
3311 |
+index 0330ab2e2b63..a1442c5a3e0c 100644 |
3312 |
+--- a/net/ipv4/sysctl_net_ipv4.c |
3313 |
++++ b/net/ipv4/sysctl_net_ipv4.c |
3314 |
+@@ -47,14 +47,14 @@ static void set_local_port_range(struct net *net, int range[2]) |
3315 |
+ { |
3316 |
+ bool same_parity = !((range[0] ^ range[1]) & 1); |
3317 |
+ |
3318 |
+- write_seqlock(&net->ipv4.ip_local_ports.lock); |
3319 |
++ write_seqlock_bh(&net->ipv4.ip_local_ports.lock); |
3320 |
+ if (same_parity && !net->ipv4.ip_local_ports.warned) { |
3321 |
+ net->ipv4.ip_local_ports.warned = true; |
3322 |
+ pr_err_ratelimited("ip_local_port_range: prefer different parity for start/end values.\n"); |
3323 |
+ } |
3324 |
+ net->ipv4.ip_local_ports.range[0] = range[0]; |
3325 |
+ net->ipv4.ip_local_ports.range[1] = range[1]; |
3326 |
+- write_sequnlock(&net->ipv4.ip_local_ports.lock); |
3327 |
++ write_sequnlock_bh(&net->ipv4.ip_local_ports.lock); |
3328 |
+ } |
3329 |
+ |
3330 |
+ /* Validate changes from /proc interface. */ |
3331 |
+diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c |
3332 |
+index b7dedd9d36d8..747a4c47e070 100644 |
3333 |
+--- a/net/ipv4/tcp_output.c |
3334 |
++++ b/net/ipv4/tcp_output.c |
3335 |
+@@ -3406,7 +3406,7 @@ static int tcp_xmit_probe_skb(struct sock *sk, int urgent, int mib) |
3336 |
+ */ |
3337 |
+ tcp_init_nondata_skb(skb, tp->snd_una - !urgent, TCPHDR_ACK); |
3338 |
+ skb_mstamp_get(&skb->skb_mstamp); |
3339 |
+- NET_INC_STATS_BH(sock_net(sk), mib); |
3340 |
++ NET_INC_STATS(sock_net(sk), mib); |
3341 |
+ return tcp_transmit_skb(sk, skb, 0, GFP_ATOMIC); |
3342 |
+ } |
3343 |
+ |
3344 |
+diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c |
3345 |
+index 21c2c818df3b..c8c1fea06003 100644 |
3346 |
+--- a/net/ipv6/addrconf.c |
3347 |
++++ b/net/ipv6/addrconf.c |
3348 |
+@@ -411,6 +411,7 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev) |
3349 |
+ if (err) { |
3350 |
+ ipv6_mc_destroy_dev(ndev); |
3351 |
+ del_timer(&ndev->regen_timer); |
3352 |
++ snmp6_unregister_dev(ndev); |
3353 |
+ goto err_release; |
3354 |
+ } |
3355 |
+ /* protected by rtnl_lock */ |
3356 |
+diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c |
3357 |
+index ac35a28599be..85c4b2fff504 100644 |
3358 |
+--- a/net/ipv6/sit.c |
3359 |
++++ b/net/ipv6/sit.c |
3360 |
+@@ -1394,34 +1394,20 @@ static int ipip6_tunnel_init(struct net_device *dev) |
3361 |
+ return 0; |
3362 |
+ } |
3363 |
+ |
3364 |
+-static int __net_init ipip6_fb_tunnel_init(struct net_device *dev) |
3365 |
++static void __net_init ipip6_fb_tunnel_init(struct net_device *dev) |
3366 |
+ { |
3367 |
+ struct ip_tunnel *tunnel = netdev_priv(dev); |
3368 |
+ struct iphdr *iph = &tunnel->parms.iph; |
3369 |
+ struct net *net = dev_net(dev); |
3370 |
+ struct sit_net *sitn = net_generic(net, sit_net_id); |
3371 |
+ |
3372 |
+- tunnel->dev = dev; |
3373 |
+- tunnel->net = dev_net(dev); |
3374 |
+- |
3375 |
+ iph->version = 4; |
3376 |
+ iph->protocol = IPPROTO_IPV6; |
3377 |
+ iph->ihl = 5; |
3378 |
+ iph->ttl = 64; |
3379 |
+ |
3380 |
+- dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); |
3381 |
+- if (!dev->tstats) |
3382 |
+- return -ENOMEM; |
3383 |
+- |
3384 |
+- tunnel->dst_cache = alloc_percpu(struct ip_tunnel_dst); |
3385 |
+- if (!tunnel->dst_cache) { |
3386 |
+- free_percpu(dev->tstats); |
3387 |
+- return -ENOMEM; |
3388 |
+- } |
3389 |
+- |
3390 |
+ dev_hold(dev); |
3391 |
+ rcu_assign_pointer(sitn->tunnels_wc[0], tunnel); |
3392 |
+- return 0; |
3393 |
+ } |
3394 |
+ |
3395 |
+ static int ipip6_validate(struct nlattr *tb[], struct nlattr *data[]) |
3396 |
+@@ -1831,23 +1817,19 @@ static int __net_init sit_init_net(struct net *net) |
3397 |
+ */ |
3398 |
+ sitn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL; |
3399 |
+ |
3400 |
+- err = ipip6_fb_tunnel_init(sitn->fb_tunnel_dev); |
3401 |
+- if (err) |
3402 |
+- goto err_dev_free; |
3403 |
+- |
3404 |
+- ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn); |
3405 |
+ err = register_netdev(sitn->fb_tunnel_dev); |
3406 |
+ if (err) |
3407 |
+ goto err_reg_dev; |
3408 |
+ |
3409 |
++ ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn); |
3410 |
++ ipip6_fb_tunnel_init(sitn->fb_tunnel_dev); |
3411 |
++ |
3412 |
+ t = netdev_priv(sitn->fb_tunnel_dev); |
3413 |
+ |
3414 |
+ strcpy(t->parms.name, sitn->fb_tunnel_dev->name); |
3415 |
+ return 0; |
3416 |
+ |
3417 |
+ err_reg_dev: |
3418 |
+- dev_put(sitn->fb_tunnel_dev); |
3419 |
+-err_dev_free: |
3420 |
+ ipip6_dev_free(sitn->fb_tunnel_dev); |
3421 |
+ err_alloc_dev: |
3422 |
+ return err; |
3423 |
+diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c |
3424 |
+index a26c401ef4a4..43964594aa12 100644 |
3425 |
+--- a/net/irda/irlmp.c |
3426 |
++++ b/net/irda/irlmp.c |
3427 |
+@@ -1839,7 +1839,7 @@ static void *irlmp_seq_hb_idx(struct irlmp_iter_state *iter, loff_t *off) |
3428 |
+ for (element = hashbin_get_first(iter->hashbin); |
3429 |
+ element != NULL; |
3430 |
+ element = hashbin_get_next(iter->hashbin)) { |
3431 |
+- if (!off || *off-- == 0) { |
3432 |
++ if (!off || (*off)-- == 0) { |
3433 |
+ /* NB: hashbin left locked */ |
3434 |
+ return element; |
3435 |
+ } |
3436 |
+diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
3437 |
+index 9b2cc278ac2a..33bf779df350 100644 |
3438 |
+--- a/net/mac80211/mlme.c |
3439 |
++++ b/net/mac80211/mlme.c |
3440 |
+@@ -3378,7 +3378,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, |
3441 |
+ |
3442 |
+ if (ifmgd->rssi_min_thold != ifmgd->rssi_max_thold && |
3443 |
+ ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { |
3444 |
+- int sig = ifmgd->ave_beacon_signal; |
3445 |
++ int sig = ifmgd->ave_beacon_signal / 16; |
3446 |
+ int last_sig = ifmgd->last_ave_beacon_signal; |
3447 |
+ struct ieee80211_event event = { |
3448 |
+ .type = RSSI_EVENT, |
3449 |
+@@ -4999,6 +4999,25 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, |
3450 |
+ return 0; |
3451 |
+ } |
3452 |
+ |
3453 |
++ if (ifmgd->assoc_data && |
3454 |
++ ether_addr_equal(ifmgd->assoc_data->bss->bssid, req->bssid)) { |
3455 |
++ sdata_info(sdata, |
3456 |
++ "aborting association with %pM by local choice (Reason: %u=%s)\n", |
3457 |
++ req->bssid, req->reason_code, |
3458 |
++ ieee80211_get_reason_code_string(req->reason_code)); |
3459 |
++ |
3460 |
++ drv_mgd_prepare_tx(sdata->local, sdata); |
3461 |
++ ieee80211_send_deauth_disassoc(sdata, req->bssid, |
3462 |
++ IEEE80211_STYPE_DEAUTH, |
3463 |
++ req->reason_code, tx, |
3464 |
++ frame_buf); |
3465 |
++ ieee80211_destroy_assoc_data(sdata, false); |
3466 |
++ ieee80211_report_disconnect(sdata, frame_buf, |
3467 |
++ sizeof(frame_buf), true, |
3468 |
++ req->reason_code); |
3469 |
++ return 0; |
3470 |
++ } |
3471 |
++ |
3472 |
+ if (ifmgd->associated && |
3473 |
+ ether_addr_equal(ifmgd->associated->bssid, req->bssid)) { |
3474 |
+ sdata_info(sdata, |
3475 |
+diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h |
3476 |
+index 6f14591d8ca9..0b13bfa6f32f 100644 |
3477 |
+--- a/net/mac80211/trace.h |
3478 |
++++ b/net/mac80211/trace.h |
3479 |
+@@ -33,11 +33,11 @@ |
3480 |
+ __field(u32, chan_width) \ |
3481 |
+ __field(u32, center_freq1) \ |
3482 |
+ __field(u32, center_freq2) |
3483 |
+-#define CHANDEF_ASSIGN(c) \ |
3484 |
+- __entry->control_freq = (c)->chan ? (c)->chan->center_freq : 0; \ |
3485 |
+- __entry->chan_width = (c)->width; \ |
3486 |
+- __entry->center_freq1 = (c)->center_freq1; \ |
3487 |
+- __entry->center_freq2 = (c)->center_freq2; |
3488 |
++#define CHANDEF_ASSIGN(c) \ |
3489 |
++ __entry->control_freq = (c) ? ((c)->chan ? (c)->chan->center_freq : 0) : 0; \ |
3490 |
++ __entry->chan_width = (c) ? (c)->width : 0; \ |
3491 |
++ __entry->center_freq1 = (c) ? (c)->center_freq1 : 0; \ |
3492 |
++ __entry->center_freq2 = (c) ? (c)->center_freq2 : 0; |
3493 |
+ #define CHANDEF_PR_FMT " control:%d MHz width:%d center: %d/%d MHz" |
3494 |
+ #define CHANDEF_PR_ARG __entry->control_freq, __entry->chan_width, \ |
3495 |
+ __entry->center_freq1, __entry->center_freq2 |
3496 |
+diff --git a/net/mac80211/util.c b/net/mac80211/util.c |
3497 |
+index 43e5aadd7a89..f5fa8c09cb42 100644 |
3498 |
+--- a/net/mac80211/util.c |
3499 |
++++ b/net/mac80211/util.c |
3500 |
+@@ -2984,6 +2984,13 @@ ieee80211_extend_noa_desc(struct ieee80211_noa_data *data, u32 tsf, int i) |
3501 |
+ if (end > 0) |
3502 |
+ return false; |
3503 |
+ |
3504 |
++ /* One shot NOA */ |
3505 |
++ if (data->count[i] == 1) |
3506 |
++ return false; |
3507 |
++ |
3508 |
++ if (data->desc[i].interval == 0) |
3509 |
++ return false; |
3510 |
++ |
3511 |
+ /* End time is in the past, check for repetitions */ |
3512 |
+ skip = DIV_ROUND_UP(-end, data->desc[i].interval); |
3513 |
+ if (data->count[i] < 255) { |
3514 |
+diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c |
3515 |
+index a133d16eb053..8b158f71bff6 100644 |
3516 |
+--- a/net/netlink/af_netlink.c |
3517 |
++++ b/net/netlink/af_netlink.c |
3518 |
+@@ -2346,7 +2346,7 @@ static int netlink_getsockopt(struct socket *sock, int level, int optname, |
3519 |
+ int pos, idx, shift; |
3520 |
+ |
3521 |
+ err = 0; |
3522 |
+- netlink_table_grab(); |
3523 |
++ netlink_lock_table(); |
3524 |
+ for (pos = 0; pos * 8 < nlk->ngroups; pos += sizeof(u32)) { |
3525 |
+ if (len - pos < sizeof(u32)) |
3526 |
+ break; |
3527 |
+@@ -2361,7 +2361,7 @@ static int netlink_getsockopt(struct socket *sock, int level, int optname, |
3528 |
+ } |
3529 |
+ if (put_user(ALIGN(nlk->ngroups / 8, sizeof(u32)), optlen)) |
3530 |
+ err = -EFAULT; |
3531 |
+- netlink_table_ungrab(); |
3532 |
++ netlink_unlock_table(); |
3533 |
+ break; |
3534 |
+ } |
3535 |
+ default: |
3536 |
+diff --git a/net/nfc/nci/hci.c b/net/nfc/nci/hci.c |
3537 |
+index 609f92283d1b..30b09f04c142 100644 |
3538 |
+--- a/net/nfc/nci/hci.c |
3539 |
++++ b/net/nfc/nci/hci.c |
3540 |
+@@ -101,6 +101,20 @@ struct nci_hcp_packet { |
3541 |
+ #define NCI_HCP_MSG_GET_CMD(header) (header & 0x3f) |
3542 |
+ #define NCI_HCP_MSG_GET_PIPE(header) (header & 0x7f) |
3543 |
+ |
3544 |
++static int nci_hci_result_to_errno(u8 result) |
3545 |
++{ |
3546 |
++ switch (result) { |
3547 |
++ case NCI_HCI_ANY_OK: |
3548 |
++ return 0; |
3549 |
++ case NCI_HCI_ANY_E_REG_PAR_UNKNOWN: |
3550 |
++ return -EOPNOTSUPP; |
3551 |
++ case NCI_HCI_ANY_E_TIMEOUT: |
3552 |
++ return -ETIME; |
3553 |
++ default: |
3554 |
++ return -1; |
3555 |
++ } |
3556 |
++} |
3557 |
++ |
3558 |
+ /* HCI core */ |
3559 |
+ static void nci_hci_reset_pipes(struct nci_hci_dev *hdev) |
3560 |
+ { |
3561 |
+@@ -146,18 +160,18 @@ static int nci_hci_send_data(struct nci_dev *ndev, u8 pipe, |
3562 |
+ if (!conn_info) |
3563 |
+ return -EPROTO; |
3564 |
+ |
3565 |
+- skb = nci_skb_alloc(ndev, 2 + conn_info->max_pkt_payload_len + |
3566 |
++ i = 0; |
3567 |
++ skb = nci_skb_alloc(ndev, conn_info->max_pkt_payload_len + |
3568 |
+ NCI_DATA_HDR_SIZE, GFP_KERNEL); |
3569 |
+ if (!skb) |
3570 |
+ return -ENOMEM; |
3571 |
+ |
3572 |
+- skb_reserve(skb, 2 + NCI_DATA_HDR_SIZE); |
3573 |
++ skb_reserve(skb, NCI_DATA_HDR_SIZE + 2); |
3574 |
+ *skb_push(skb, 1) = data_type; |
3575 |
+ |
3576 |
+- i = 0; |
3577 |
+- len = conn_info->max_pkt_payload_len; |
3578 |
+- |
3579 |
+ do { |
3580 |
++ len = conn_info->max_pkt_payload_len; |
3581 |
++ |
3582 |
+ /* If last packet add NCI_HFP_NO_CHAINING */ |
3583 |
+ if (i + conn_info->max_pkt_payload_len - |
3584 |
+ (skb->len + 1) >= data_len) { |
3585 |
+@@ -177,9 +191,15 @@ static int nci_hci_send_data(struct nci_dev *ndev, u8 pipe, |
3586 |
+ return r; |
3587 |
+ |
3588 |
+ i += len; |
3589 |
++ |
3590 |
+ if (i < data_len) { |
3591 |
+- skb_trim(skb, 0); |
3592 |
+- skb_pull(skb, len); |
3593 |
++ skb = nci_skb_alloc(ndev, |
3594 |
++ conn_info->max_pkt_payload_len + |
3595 |
++ NCI_DATA_HDR_SIZE, GFP_KERNEL); |
3596 |
++ if (!skb) |
3597 |
++ return -ENOMEM; |
3598 |
++ |
3599 |
++ skb_reserve(skb, NCI_DATA_HDR_SIZE + 1); |
3600 |
+ } |
3601 |
+ } while (i < data_len); |
3602 |
+ |
3603 |
+@@ -212,7 +232,8 @@ int nci_hci_send_cmd(struct nci_dev *ndev, u8 gate, u8 cmd, |
3604 |
+ const u8 *param, size_t param_len, |
3605 |
+ struct sk_buff **skb) |
3606 |
+ { |
3607 |
+- struct nci_conn_info *conn_info; |
3608 |
++ struct nci_hcp_message *message; |
3609 |
++ struct nci_conn_info *conn_info; |
3610 |
+ struct nci_data data; |
3611 |
+ int r; |
3612 |
+ u8 pipe = ndev->hci_dev->gate2pipe[gate]; |
3613 |
+@@ -232,9 +253,15 @@ int nci_hci_send_cmd(struct nci_dev *ndev, u8 gate, u8 cmd, |
3614 |
+ |
3615 |
+ r = nci_request(ndev, nci_hci_send_data_req, (unsigned long)&data, |
3616 |
+ msecs_to_jiffies(NCI_DATA_TIMEOUT)); |
3617 |
+- |
3618 |
+- if (r == NCI_STATUS_OK && skb) |
3619 |
+- *skb = conn_info->rx_skb; |
3620 |
++ if (r == NCI_STATUS_OK) { |
3621 |
++ message = (struct nci_hcp_message *)conn_info->rx_skb->data; |
3622 |
++ r = nci_hci_result_to_errno( |
3623 |
++ NCI_HCP_MSG_GET_CMD(message->header)); |
3624 |
++ skb_pull(conn_info->rx_skb, NCI_HCI_HCP_MESSAGE_HEADER_LEN); |
3625 |
++ |
3626 |
++ if (!r && skb) |
3627 |
++ *skb = conn_info->rx_skb; |
3628 |
++ } |
3629 |
+ |
3630 |
+ return r; |
3631 |
+ } |
3632 |
+@@ -328,9 +355,6 @@ static void nci_hci_resp_received(struct nci_dev *ndev, u8 pipe, |
3633 |
+ struct nci_conn_info *conn_info; |
3634 |
+ u8 status = result; |
3635 |
+ |
3636 |
+- if (result != NCI_HCI_ANY_OK) |
3637 |
+- goto exit; |
3638 |
+- |
3639 |
+ conn_info = ndev->hci_dev->conn_info; |
3640 |
+ if (!conn_info) { |
3641 |
+ status = NCI_STATUS_REJECTED; |
3642 |
+@@ -340,7 +364,7 @@ static void nci_hci_resp_received(struct nci_dev *ndev, u8 pipe, |
3643 |
+ conn_info->rx_skb = skb; |
3644 |
+ |
3645 |
+ exit: |
3646 |
+- nci_req_complete(ndev, status); |
3647 |
++ nci_req_complete(ndev, NCI_STATUS_OK); |
3648 |
+ } |
3649 |
+ |
3650 |
+ /* Receive hcp message for pipe, with type and cmd. |
3651 |
+@@ -378,7 +402,7 @@ static void nci_hci_msg_rx_work(struct work_struct *work) |
3652 |
+ u8 pipe, type, instruction; |
3653 |
+ |
3654 |
+ while ((skb = skb_dequeue(&hdev->msg_rx_queue)) != NULL) { |
3655 |
+- pipe = skb->data[0]; |
3656 |
++ pipe = NCI_HCP_MSG_GET_PIPE(skb->data[0]); |
3657 |
+ skb_pull(skb, NCI_HCI_HCP_PACKET_HEADER_LEN); |
3658 |
+ message = (struct nci_hcp_message *)skb->data; |
3659 |
+ type = NCI_HCP_MSG_GET_TYPE(message->header); |
3660 |
+@@ -395,7 +419,7 @@ void nci_hci_data_received_cb(void *context, |
3661 |
+ { |
3662 |
+ struct nci_dev *ndev = (struct nci_dev *)context; |
3663 |
+ struct nci_hcp_packet *packet; |
3664 |
+- u8 pipe, type, instruction; |
3665 |
++ u8 pipe, type; |
3666 |
+ struct sk_buff *hcp_skb; |
3667 |
+ struct sk_buff *frag_skb; |
3668 |
+ int msg_len; |
3669 |
+@@ -415,7 +439,7 @@ void nci_hci_data_received_cb(void *context, |
3670 |
+ |
3671 |
+ /* it's the last fragment. Does it need re-aggregation? */ |
3672 |
+ if (skb_queue_len(&ndev->hci_dev->rx_hcp_frags)) { |
3673 |
+- pipe = packet->header & NCI_HCI_FRAGMENT; |
3674 |
++ pipe = NCI_HCP_MSG_GET_PIPE(packet->header); |
3675 |
+ skb_queue_tail(&ndev->hci_dev->rx_hcp_frags, skb); |
3676 |
+ |
3677 |
+ msg_len = 0; |
3678 |
+@@ -434,7 +458,7 @@ void nci_hci_data_received_cb(void *context, |
3679 |
+ *skb_put(hcp_skb, NCI_HCI_HCP_PACKET_HEADER_LEN) = pipe; |
3680 |
+ |
3681 |
+ skb_queue_walk(&ndev->hci_dev->rx_hcp_frags, frag_skb) { |
3682 |
+- msg_len = frag_skb->len - NCI_HCI_HCP_PACKET_HEADER_LEN; |
3683 |
++ msg_len = frag_skb->len - NCI_HCI_HCP_PACKET_HEADER_LEN; |
3684 |
+ memcpy(skb_put(hcp_skb, msg_len), frag_skb->data + |
3685 |
+ NCI_HCI_HCP_PACKET_HEADER_LEN, msg_len); |
3686 |
+ } |
3687 |
+@@ -452,11 +476,10 @@ void nci_hci_data_received_cb(void *context, |
3688 |
+ packet = (struct nci_hcp_packet *)hcp_skb->data; |
3689 |
+ type = NCI_HCP_MSG_GET_TYPE(packet->message.header); |
3690 |
+ if (type == NCI_HCI_HCP_RESPONSE) { |
3691 |
+- pipe = packet->header; |
3692 |
+- instruction = NCI_HCP_MSG_GET_CMD(packet->message.header); |
3693 |
+- skb_pull(hcp_skb, NCI_HCI_HCP_PACKET_HEADER_LEN + |
3694 |
+- NCI_HCI_HCP_MESSAGE_HEADER_LEN); |
3695 |
+- nci_hci_hcp_message_rx(ndev, pipe, type, instruction, hcp_skb); |
3696 |
++ pipe = NCI_HCP_MSG_GET_PIPE(packet->header); |
3697 |
++ skb_pull(hcp_skb, NCI_HCI_HCP_PACKET_HEADER_LEN); |
3698 |
++ nci_hci_hcp_message_rx(ndev, pipe, type, |
3699 |
++ NCI_STATUS_OK, hcp_skb); |
3700 |
+ } else { |
3701 |
+ skb_queue_tail(&ndev->hci_dev->msg_rx_queue, hcp_skb); |
3702 |
+ schedule_work(&ndev->hci_dev->msg_rx_work); |
3703 |
+@@ -488,6 +511,7 @@ EXPORT_SYMBOL(nci_hci_open_pipe); |
3704 |
+ int nci_hci_set_param(struct nci_dev *ndev, u8 gate, u8 idx, |
3705 |
+ const u8 *param, size_t param_len) |
3706 |
+ { |
3707 |
++ struct nci_hcp_message *message; |
3708 |
+ struct nci_conn_info *conn_info; |
3709 |
+ struct nci_data data; |
3710 |
+ int r; |
3711 |
+@@ -520,6 +544,12 @@ int nci_hci_set_param(struct nci_dev *ndev, u8 gate, u8 idx, |
3712 |
+ r = nci_request(ndev, nci_hci_send_data_req, |
3713 |
+ (unsigned long)&data, |
3714 |
+ msecs_to_jiffies(NCI_DATA_TIMEOUT)); |
3715 |
++ if (r == NCI_STATUS_OK) { |
3716 |
++ message = (struct nci_hcp_message *)conn_info->rx_skb->data; |
3717 |
++ r = nci_hci_result_to_errno( |
3718 |
++ NCI_HCP_MSG_GET_CMD(message->header)); |
3719 |
++ skb_pull(conn_info->rx_skb, NCI_HCI_HCP_MESSAGE_HEADER_LEN); |
3720 |
++ } |
3721 |
+ |
3722 |
+ kfree(tmp); |
3723 |
+ return r; |
3724 |
+@@ -529,6 +559,7 @@ EXPORT_SYMBOL(nci_hci_set_param); |
3725 |
+ int nci_hci_get_param(struct nci_dev *ndev, u8 gate, u8 idx, |
3726 |
+ struct sk_buff **skb) |
3727 |
+ { |
3728 |
++ struct nci_hcp_message *message; |
3729 |
+ struct nci_conn_info *conn_info; |
3730 |
+ struct nci_data data; |
3731 |
+ int r; |
3732 |
+@@ -553,8 +584,15 @@ int nci_hci_get_param(struct nci_dev *ndev, u8 gate, u8 idx, |
3733 |
+ r = nci_request(ndev, nci_hci_send_data_req, (unsigned long)&data, |
3734 |
+ msecs_to_jiffies(NCI_DATA_TIMEOUT)); |
3735 |
+ |
3736 |
+- if (r == NCI_STATUS_OK) |
3737 |
+- *skb = conn_info->rx_skb; |
3738 |
++ if (r == NCI_STATUS_OK) { |
3739 |
++ message = (struct nci_hcp_message *)conn_info->rx_skb->data; |
3740 |
++ r = nci_hci_result_to_errno( |
3741 |
++ NCI_HCP_MSG_GET_CMD(message->header)); |
3742 |
++ skb_pull(conn_info->rx_skb, NCI_HCI_HCP_MESSAGE_HEADER_LEN); |
3743 |
++ |
3744 |
++ if (!r && skb) |
3745 |
++ *skb = conn_info->rx_skb; |
3746 |
++ } |
3747 |
+ |
3748 |
+ return r; |
3749 |
+ } |
3750 |
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
3751 |
+index 7851b1222a36..71cb085e16fd 100644 |
3752 |
+--- a/net/packet/af_packet.c |
3753 |
++++ b/net/packet/af_packet.c |
3754 |
+@@ -2784,22 +2784,40 @@ static int packet_release(struct socket *sock) |
3755 |
+ * Attach a packet hook. |
3756 |
+ */ |
3757 |
+ |
3758 |
+-static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) |
3759 |
++static int packet_do_bind(struct sock *sk, const char *name, int ifindex, |
3760 |
++ __be16 proto) |
3761 |
+ { |
3762 |
+ struct packet_sock *po = pkt_sk(sk); |
3763 |
+ struct net_device *dev_curr; |
3764 |
+ __be16 proto_curr; |
3765 |
+ bool need_rehook; |
3766 |
++ struct net_device *dev = NULL; |
3767 |
++ int ret = 0; |
3768 |
++ bool unlisted = false; |
3769 |
+ |
3770 |
+- if (po->fanout) { |
3771 |
+- if (dev) |
3772 |
+- dev_put(dev); |
3773 |
+- |
3774 |
++ if (po->fanout) |
3775 |
+ return -EINVAL; |
3776 |
+- } |
3777 |
+ |
3778 |
+ lock_sock(sk); |
3779 |
+ spin_lock(&po->bind_lock); |
3780 |
++ rcu_read_lock(); |
3781 |
++ |
3782 |
++ if (name) { |
3783 |
++ dev = dev_get_by_name_rcu(sock_net(sk), name); |
3784 |
++ if (!dev) { |
3785 |
++ ret = -ENODEV; |
3786 |
++ goto out_unlock; |
3787 |
++ } |
3788 |
++ } else if (ifindex) { |
3789 |
++ dev = dev_get_by_index_rcu(sock_net(sk), ifindex); |
3790 |
++ if (!dev) { |
3791 |
++ ret = -ENODEV; |
3792 |
++ goto out_unlock; |
3793 |
++ } |
3794 |
++ } |
3795 |
++ |
3796 |
++ if (dev) |
3797 |
++ dev_hold(dev); |
3798 |
+ |
3799 |
+ proto_curr = po->prot_hook.type; |
3800 |
+ dev_curr = po->prot_hook.dev; |
3801 |
+@@ -2807,14 +2825,29 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) |
3802 |
+ need_rehook = proto_curr != proto || dev_curr != dev; |
3803 |
+ |
3804 |
+ if (need_rehook) { |
3805 |
+- unregister_prot_hook(sk, true); |
3806 |
++ if (po->running) { |
3807 |
++ rcu_read_unlock(); |
3808 |
++ __unregister_prot_hook(sk, true); |
3809 |
++ rcu_read_lock(); |
3810 |
++ dev_curr = po->prot_hook.dev; |
3811 |
++ if (dev) |
3812 |
++ unlisted = !dev_get_by_index_rcu(sock_net(sk), |
3813 |
++ dev->ifindex); |
3814 |
++ } |
3815 |
+ |
3816 |
+ po->num = proto; |
3817 |
+ po->prot_hook.type = proto; |
3818 |
+- po->prot_hook.dev = dev; |
3819 |
+ |
3820 |
+- po->ifindex = dev ? dev->ifindex : 0; |
3821 |
+- packet_cached_dev_assign(po, dev); |
3822 |
++ if (unlikely(unlisted)) { |
3823 |
++ dev_put(dev); |
3824 |
++ po->prot_hook.dev = NULL; |
3825 |
++ po->ifindex = -1; |
3826 |
++ packet_cached_dev_reset(po); |
3827 |
++ } else { |
3828 |
++ po->prot_hook.dev = dev; |
3829 |
++ po->ifindex = dev ? dev->ifindex : 0; |
3830 |
++ packet_cached_dev_assign(po, dev); |
3831 |
++ } |
3832 |
+ } |
3833 |
+ if (dev_curr) |
3834 |
+ dev_put(dev_curr); |
3835 |
+@@ -2822,7 +2855,7 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) |
3836 |
+ if (proto == 0 || !need_rehook) |
3837 |
+ goto out_unlock; |
3838 |
+ |
3839 |
+- if (!dev || (dev->flags & IFF_UP)) { |
3840 |
++ if (!unlisted && (!dev || (dev->flags & IFF_UP))) { |
3841 |
+ register_prot_hook(sk); |
3842 |
+ } else { |
3843 |
+ sk->sk_err = ENETDOWN; |
3844 |
+@@ -2831,9 +2864,10 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) |
3845 |
+ } |
3846 |
+ |
3847 |
+ out_unlock: |
3848 |
++ rcu_read_unlock(); |
3849 |
+ spin_unlock(&po->bind_lock); |
3850 |
+ release_sock(sk); |
3851 |
+- return 0; |
3852 |
++ return ret; |
3853 |
+ } |
3854 |
+ |
3855 |
+ /* |
3856 |
+@@ -2845,8 +2879,6 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, |
3857 |
+ { |
3858 |
+ struct sock *sk = sock->sk; |
3859 |
+ char name[15]; |
3860 |
+- struct net_device *dev; |
3861 |
+- int err = -ENODEV; |
3862 |
+ |
3863 |
+ /* |
3864 |
+ * Check legality |
3865 |
+@@ -2856,19 +2888,13 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, |
3866 |
+ return -EINVAL; |
3867 |
+ strlcpy(name, uaddr->sa_data, sizeof(name)); |
3868 |
+ |
3869 |
+- dev = dev_get_by_name(sock_net(sk), name); |
3870 |
+- if (dev) |
3871 |
+- err = packet_do_bind(sk, dev, pkt_sk(sk)->num); |
3872 |
+- return err; |
3873 |
++ return packet_do_bind(sk, name, 0, pkt_sk(sk)->num); |
3874 |
+ } |
3875 |
+ |
3876 |
+ static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
3877 |
+ { |
3878 |
+ struct sockaddr_ll *sll = (struct sockaddr_ll *)uaddr; |
3879 |
+ struct sock *sk = sock->sk; |
3880 |
+- struct net_device *dev = NULL; |
3881 |
+- int err; |
3882 |
+- |
3883 |
+ |
3884 |
+ /* |
3885 |
+ * Check legality |
3886 |
+@@ -2879,16 +2905,8 @@ static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len |
3887 |
+ if (sll->sll_family != AF_PACKET) |
3888 |
+ return -EINVAL; |
3889 |
+ |
3890 |
+- if (sll->sll_ifindex) { |
3891 |
+- err = -ENODEV; |
3892 |
+- dev = dev_get_by_index(sock_net(sk), sll->sll_ifindex); |
3893 |
+- if (dev == NULL) |
3894 |
+- goto out; |
3895 |
+- } |
3896 |
+- err = packet_do_bind(sk, dev, sll->sll_protocol ? : pkt_sk(sk)->num); |
3897 |
+- |
3898 |
+-out: |
3899 |
+- return err; |
3900 |
++ return packet_do_bind(sk, NULL, sll->sll_ifindex, |
3901 |
++ sll->sll_protocol ? : pkt_sk(sk)->num); |
3902 |
+ } |
3903 |
+ |
3904 |
+ static struct proto packet_proto = { |
3905 |
+diff --git a/net/rds/connection.c b/net/rds/connection.c |
3906 |
+index da6da57e5f36..9d66705f9d41 100644 |
3907 |
+--- a/net/rds/connection.c |
3908 |
++++ b/net/rds/connection.c |
3909 |
+@@ -187,6 +187,12 @@ new_conn: |
3910 |
+ } |
3911 |
+ } |
3912 |
+ |
3913 |
++ if (trans == NULL) { |
3914 |
++ kmem_cache_free(rds_conn_slab, conn); |
3915 |
++ conn = ERR_PTR(-ENODEV); |
3916 |
++ goto out; |
3917 |
++ } |
3918 |
++ |
3919 |
+ conn->c_trans = trans; |
3920 |
+ |
3921 |
+ ret = trans->conn_alloc(conn, gfp); |
3922 |
+diff --git a/net/rds/tcp_recv.c b/net/rds/tcp_recv.c |
3923 |
+index fbc5ef88bc0e..27a992154804 100644 |
3924 |
+--- a/net/rds/tcp_recv.c |
3925 |
++++ b/net/rds/tcp_recv.c |
3926 |
+@@ -214,8 +214,15 @@ static int rds_tcp_data_recv(read_descriptor_t *desc, struct sk_buff *skb, |
3927 |
+ } |
3928 |
+ |
3929 |
+ to_copy = min(tc->t_tinc_data_rem, left); |
3930 |
+- pskb_pull(clone, offset); |
3931 |
+- pskb_trim(clone, to_copy); |
3932 |
++ if (!pskb_pull(clone, offset) || |
3933 |
++ pskb_trim(clone, to_copy)) { |
3934 |
++ pr_warn("rds_tcp_data_recv: pull/trim failed " |
3935 |
++ "left %zu data_rem %zu skb_len %d\n", |
3936 |
++ left, tc->t_tinc_data_rem, skb->len); |
3937 |
++ kfree_skb(clone); |
3938 |
++ desc->error = -ENOMEM; |
3939 |
++ goto out; |
3940 |
++ } |
3941 |
+ skb_queue_tail(&tinc->ti_skb_list, clone); |
3942 |
+ |
3943 |
+ rdsdebug("skb %p data %p len %d off %u to_copy %zu -> " |
3944 |
+diff --git a/net/tipc/msg.c b/net/tipc/msg.c |
3945 |
+index 08b4cc7d496d..b3a393104b17 100644 |
3946 |
+--- a/net/tipc/msg.c |
3947 |
++++ b/net/tipc/msg.c |
3948 |
+@@ -121,7 +121,7 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) |
3949 |
+ { |
3950 |
+ struct sk_buff *head = *headbuf; |
3951 |
+ struct sk_buff *frag = *buf; |
3952 |
+- struct sk_buff *tail; |
3953 |
++ struct sk_buff *tail = NULL; |
3954 |
+ struct tipc_msg *msg; |
3955 |
+ u32 fragid; |
3956 |
+ int delta; |
3957 |
+@@ -141,9 +141,15 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) |
3958 |
+ if (unlikely(skb_unclone(frag, GFP_ATOMIC))) |
3959 |
+ goto err; |
3960 |
+ head = *headbuf = frag; |
3961 |
+- skb_frag_list_init(head); |
3962 |
+- TIPC_SKB_CB(head)->tail = NULL; |
3963 |
+ *buf = NULL; |
3964 |
++ TIPC_SKB_CB(head)->tail = NULL; |
3965 |
++ if (skb_is_nonlinear(head)) { |
3966 |
++ skb_walk_frags(head, tail) { |
3967 |
++ TIPC_SKB_CB(head)->tail = tail; |
3968 |
++ } |
3969 |
++ } else { |
3970 |
++ skb_frag_list_init(head); |
3971 |
++ } |
3972 |
+ return 0; |
3973 |
+ } |
3974 |
+ |
3975 |
+diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c |
3976 |
+index 66deebc66aa1..f8dfee5072c0 100644 |
3977 |
+--- a/net/tipc/udp_media.c |
3978 |
++++ b/net/tipc/udp_media.c |
3979 |
+@@ -48,6 +48,7 @@ |
3980 |
+ #include <linux/tipc_netlink.h> |
3981 |
+ #include "core.h" |
3982 |
+ #include "bearer.h" |
3983 |
++#include "msg.h" |
3984 |
+ |
3985 |
+ /* IANA assigned UDP port */ |
3986 |
+ #define UDP_PORT_DEFAULT 6118 |
3987 |
+@@ -216,6 +217,10 @@ static int tipc_udp_recv(struct sock *sk, struct sk_buff *skb) |
3988 |
+ { |
3989 |
+ struct udp_bearer *ub; |
3990 |
+ struct tipc_bearer *b; |
3991 |
++ int usr = msg_user(buf_msg(skb)); |
3992 |
++ |
3993 |
++ if ((usr == LINK_PROTOCOL) || (usr == NAME_DISTRIBUTOR)) |
3994 |
++ skb_linearize(skb); |
3995 |
+ |
3996 |
+ ub = rcu_dereference_sk_user_data(sk); |
3997 |
+ if (!ub) { |
3998 |
+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
3999 |
+index 76b41578a838..d059cf31d754 100644 |
4000 |
+--- a/net/wireless/nl80211.c |
4001 |
++++ b/net/wireless/nl80211.c |
4002 |
+@@ -3408,12 +3408,6 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) |
4003 |
+ wdev->iftype)) |
4004 |
+ return -EINVAL; |
4005 |
+ |
4006 |
+- if (info->attrs[NL80211_ATTR_ACL_POLICY]) { |
4007 |
+- params.acl = parse_acl_data(&rdev->wiphy, info); |
4008 |
+- if (IS_ERR(params.acl)) |
4009 |
+- return PTR_ERR(params.acl); |
4010 |
+- } |
4011 |
+- |
4012 |
+ if (info->attrs[NL80211_ATTR_SMPS_MODE]) { |
4013 |
+ params.smps_mode = |
4014 |
+ nla_get_u8(info->attrs[NL80211_ATTR_SMPS_MODE]); |
4015 |
+@@ -3437,6 +3431,12 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) |
4016 |
+ params.smps_mode = NL80211_SMPS_OFF; |
4017 |
+ } |
4018 |
+ |
4019 |
++ if (info->attrs[NL80211_ATTR_ACL_POLICY]) { |
4020 |
++ params.acl = parse_acl_data(&rdev->wiphy, info); |
4021 |
++ if (IS_ERR(params.acl)) |
4022 |
++ return PTR_ERR(params.acl); |
4023 |
++ } |
4024 |
++ |
4025 |
+ wdev_lock(wdev); |
4026 |
+ err = rdev_start_ap(rdev, dev, ¶ms); |
4027 |
+ if (!err) { |
4028 |
+diff --git a/sound/usb/midi.c b/sound/usb/midi.c |
4029 |
+index 417ebb11cf48..bec63e0d2605 100644 |
4030 |
+--- a/sound/usb/midi.c |
4031 |
++++ b/sound/usb/midi.c |
4032 |
+@@ -174,6 +174,8 @@ struct snd_usb_midi_in_endpoint { |
4033 |
+ u8 running_status_length; |
4034 |
+ } ports[0x10]; |
4035 |
+ u8 seen_f5; |
4036 |
++ bool in_sysex; |
4037 |
++ u8 last_cin; |
4038 |
+ u8 error_resubmit; |
4039 |
+ int current_port; |
4040 |
+ }; |
4041 |
+@@ -468,6 +470,39 @@ static void snd_usbmidi_maudio_broken_running_status_input( |
4042 |
+ } |
4043 |
+ |
4044 |
+ /* |
4045 |
++ * QinHeng CH345 is buggy: every second packet inside a SysEx has not CIN 4 |
4046 |
++ * but the previously seen CIN, but still with three data bytes. |
4047 |
++ */ |
4048 |
++static void ch345_broken_sysex_input(struct snd_usb_midi_in_endpoint *ep, |
4049 |
++ uint8_t *buffer, int buffer_length) |
4050 |
++{ |
4051 |
++ unsigned int i, cin, length; |
4052 |
++ |
4053 |
++ for (i = 0; i + 3 < buffer_length; i += 4) { |
4054 |
++ if (buffer[i] == 0 && i > 0) |
4055 |
++ break; |
4056 |
++ cin = buffer[i] & 0x0f; |
4057 |
++ if (ep->in_sysex && |
4058 |
++ cin == ep->last_cin && |
4059 |
++ (buffer[i + 1 + (cin == 0x6)] & 0x80) == 0) |
4060 |
++ cin = 0x4; |
4061 |
++#if 0 |
4062 |
++ if (buffer[i + 1] == 0x90) { |
4063 |
++ /* |
4064 |
++ * Either a corrupted running status or a real note-on |
4065 |
++ * message; impossible to detect reliably. |
4066 |
++ */ |
4067 |
++ } |
4068 |
++#endif |
4069 |
++ length = snd_usbmidi_cin_length[cin]; |
4070 |
++ snd_usbmidi_input_data(ep, 0, &buffer[i + 1], length); |
4071 |
++ ep->in_sysex = cin == 0x4; |
4072 |
++ if (!ep->in_sysex) |
4073 |
++ ep->last_cin = cin; |
4074 |
++ } |
4075 |
++} |
4076 |
++ |
4077 |
++/* |
4078 |
+ * CME protocol: like the standard protocol, but SysEx commands are sent as a |
4079 |
+ * single USB packet preceded by a 0x0F byte. |
4080 |
+ */ |
4081 |
+@@ -660,6 +695,12 @@ static struct usb_protocol_ops snd_usbmidi_cme_ops = { |
4082 |
+ .output_packet = snd_usbmidi_output_standard_packet, |
4083 |
+ }; |
4084 |
+ |
4085 |
++static struct usb_protocol_ops snd_usbmidi_ch345_broken_sysex_ops = { |
4086 |
++ .input = ch345_broken_sysex_input, |
4087 |
++ .output = snd_usbmidi_standard_output, |
4088 |
++ .output_packet = snd_usbmidi_output_standard_packet, |
4089 |
++}; |
4090 |
++ |
4091 |
+ /* |
4092 |
+ * AKAI MPD16 protocol: |
4093 |
+ * |
4094 |
+@@ -1341,6 +1382,7 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi *umidi, |
4095 |
+ * Various chips declare a packet size larger than 4 bytes, but |
4096 |
+ * do not actually work with larger packets: |
4097 |
+ */ |
4098 |
++ case USB_ID(0x0a67, 0x5011): /* Medeli DD305 */ |
4099 |
+ case USB_ID(0x0a92, 0x1020): /* ESI M4U */ |
4100 |
+ case USB_ID(0x1430, 0x474b): /* RedOctane GH MIDI INTERFACE */ |
4101 |
+ case USB_ID(0x15ca, 0x0101): /* Textech USB Midi Cable */ |
4102 |
+@@ -2375,6 +2417,10 @@ int snd_usbmidi_create(struct snd_card *card, |
4103 |
+ |
4104 |
+ err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
4105 |
+ break; |
4106 |
++ case QUIRK_MIDI_CH345: |
4107 |
++ umidi->usb_protocol_ops = &snd_usbmidi_ch345_broken_sysex_ops; |
4108 |
++ err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
4109 |
++ break; |
4110 |
+ default: |
4111 |
+ dev_err(&umidi->dev->dev, "invalid quirk type %d\n", |
4112 |
+ quirk->type); |
4113 |
+diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
4114 |
+index e4756651a52c..ecc2a4ea014d 100644 |
4115 |
+--- a/sound/usb/quirks-table.h |
4116 |
++++ b/sound/usb/quirks-table.h |
4117 |
+@@ -2820,6 +2820,17 @@ YAMAHA_DEVICE(0x7010, "UB99"), |
4118 |
+ .idProduct = 0x1020, |
4119 |
+ }, |
4120 |
+ |
4121 |
++/* QinHeng devices */ |
4122 |
++{ |
4123 |
++ USB_DEVICE(0x1a86, 0x752d), |
4124 |
++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { |
4125 |
++ .vendor_name = "QinHeng", |
4126 |
++ .product_name = "CH345", |
4127 |
++ .ifnum = 1, |
4128 |
++ .type = QUIRK_MIDI_CH345 |
4129 |
++ } |
4130 |
++}, |
4131 |
++ |
4132 |
+ /* KeithMcMillen Stringport */ |
4133 |
+ { |
4134 |
+ USB_DEVICE(0x1f38, 0x0001), |
4135 |
+diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
4136 |
+index 00ebc0ca008e..eef9b8e4b949 100644 |
4137 |
+--- a/sound/usb/quirks.c |
4138 |
++++ b/sound/usb/quirks.c |
4139 |
+@@ -535,6 +535,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip, |
4140 |
+ [QUIRK_MIDI_CME] = create_any_midi_quirk, |
4141 |
+ [QUIRK_MIDI_AKAI] = create_any_midi_quirk, |
4142 |
+ [QUIRK_MIDI_FTDI] = create_any_midi_quirk, |
4143 |
++ [QUIRK_MIDI_CH345] = create_any_midi_quirk, |
4144 |
+ [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, |
4145 |
+ [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, |
4146 |
+ [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, |
4147 |
+@@ -1271,6 +1272,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, |
4148 |
+ case USB_ID(0x20b1, 0x000a): /* Gustard DAC-X20U */ |
4149 |
+ case USB_ID(0x20b1, 0x2009): /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */ |
4150 |
+ case USB_ID(0x20b1, 0x2023): /* JLsounds I2SoverUSB */ |
4151 |
++ case USB_ID(0x20b1, 0x3023): /* Aune X1S 32BIT/384 DSD DAC */ |
4152 |
+ if (fp->altsetting == 3) |
4153 |
+ return SNDRV_PCM_FMTBIT_DSD_U32_BE; |
4154 |
+ break; |
4155 |
+diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h |
4156 |
+index 91d0380431b4..991aa84491cd 100644 |
4157 |
+--- a/sound/usb/usbaudio.h |
4158 |
++++ b/sound/usb/usbaudio.h |
4159 |
+@@ -94,6 +94,7 @@ enum quirk_type { |
4160 |
+ QUIRK_MIDI_AKAI, |
4161 |
+ QUIRK_MIDI_US122L, |
4162 |
+ QUIRK_MIDI_FTDI, |
4163 |
++ QUIRK_MIDI_CH345, |
4164 |
+ QUIRK_AUDIO_STANDARD_INTERFACE, |
4165 |
+ QUIRK_AUDIO_FIXED_ENDPOINT, |
4166 |
+ QUIRK_AUDIO_EDIROL_UAXX, |