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