diff options
author | Brian Norris <computersforpeace@gmail.com> | 2017-06-01 13:53:55 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2017-06-01 13:53:55 -0400 |
commit | 05e97a9eda72d58dba293857df6aac62584ef99a (patch) | |
tree | e86e692f26d4879ff2210c54722e2b7780210249 | |
parent | 2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff) | |
parent | d4ed3b9015b5eebc90d629579d9e7944607cbae5 (diff) |
Merge tag 'nand/fixes-for-4.12-rc3' of git://git.infradead.org/linux-mtd into MTD
From Boris:
"""
This pull request contains several fixes to the core and the tango
driver.
tango fixes:
* Add missing MODULE_DEVICE_TABLE() in tango_nand.c
* Update the number of corrected bitflips
core fixes:
* Fix a long standing memory leak in nand_scan_tail()
* Fix several bugs introduced by the per-vendor init/detection
infrastructure (introduced in 4.12)
* Add a static specifier to nand_ooblayout_lp_hamming_ops definition
"""
411 files changed, 3512 insertions, 1564 deletions
diff --git a/Documentation/devicetree/bindings/staging/ion/hi6220-ion.txt b/Documentation/devicetree/bindings/staging/ion/hi6220-ion.txt deleted file mode 100644 index c59e27c632c1..000000000000 --- a/Documentation/devicetree/bindings/staging/ion/hi6220-ion.txt +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | Hi6220 SoC ION | ||
2 | =================================================================== | ||
3 | Required properties: | ||
4 | - compatible : "hisilicon,hi6220-ion" | ||
5 | - list of the ION heaps | ||
6 | - heap name : maybe heap_sys_user@0 | ||
7 | - heap id : id should be unique in the system. | ||
8 | - heap base : base ddr address of the heap,0 means that | ||
9 | it is dynamic. | ||
10 | - heap size : memory size and 0 means it is dynamic. | ||
11 | - heap type : the heap type of the heap, please also | ||
12 | see the define in ion.h(drivers/staging/android/uapi/ion.h) | ||
13 | ------------------------------------------------------------------- | ||
14 | Example: | ||
15 | hi6220-ion { | ||
16 | compatible = "hisilicon,hi6220-ion"; | ||
17 | heap_sys_user@0 { | ||
18 | heap-name = "sys_user"; | ||
19 | heap-id = <0x0>; | ||
20 | heap-base = <0x0>; | ||
21 | heap-size = <0x0>; | ||
22 | heap-type = "ion_system"; | ||
23 | }; | ||
24 | heap_sys_contig@0 { | ||
25 | heap-name = "sys_contig"; | ||
26 | heap-id = <0x1>; | ||
27 | heap-base = <0x0>; | ||
28 | heap-size = <0x0>; | ||
29 | heap-type = "ion_system_contig"; | ||
30 | }; | ||
31 | }; | ||
diff --git a/Documentation/usb/typec.rst b/Documentation/usb/typec.rst index b67a46779de9..8a7249f2ff04 100644 --- a/Documentation/usb/typec.rst +++ b/Documentation/usb/typec.rst | |||
@@ -114,8 +114,7 @@ the details during registration. The class offers the following API for | |||
114 | registering/unregistering cables and their plugs: | 114 | registering/unregistering cables and their plugs: |
115 | 115 | ||
116 | .. kernel-doc:: drivers/usb/typec/typec.c | 116 | .. kernel-doc:: drivers/usb/typec/typec.c |
117 | :functions: typec_register_cable typec_unregister_cable typec_register_plug | 117 | :functions: typec_register_cable typec_unregister_cable typec_register_plug typec_unregister_plug |
118 | typec_unregister_plug | ||
119 | 118 | ||
120 | The class will provide a handle to struct typec_cable and struct typec_plug if | 119 | The class will provide a handle to struct typec_cable and struct typec_plug if |
121 | the registration is successful, or NULL if it isn't. | 120 | the registration is successful, or NULL if it isn't. |
@@ -137,8 +136,7 @@ during connection of a partner or cable, the port driver must use the following | |||
137 | APIs to report it to the class: | 136 | APIs to report it to the class: |
138 | 137 | ||
139 | .. kernel-doc:: drivers/usb/typec/typec.c | 138 | .. kernel-doc:: drivers/usb/typec/typec.c |
140 | :functions: typec_set_data_role typec_set_pwr_role typec_set_vconn_role | 139 | :functions: typec_set_data_role typec_set_pwr_role typec_set_vconn_role typec_set_pwr_opmode |
141 | typec_set_pwr_opmode | ||
142 | 140 | ||
143 | Alternate Modes | 141 | Alternate Modes |
144 | ~~~~~~~~~~~~~~~ | 142 | ~~~~~~~~~~~~~~~ |
diff --git a/Documentation/watchdog/watchdog-parameters.txt b/Documentation/watchdog/watchdog-parameters.txt index 4f7d86dd0a5d..914518aeb972 100644 --- a/Documentation/watchdog/watchdog-parameters.txt +++ b/Documentation/watchdog/watchdog-parameters.txt | |||
@@ -117,7 +117,7 @@ nowayout: Watchdog cannot be stopped once started | |||
117 | ------------------------------------------------- | 117 | ------------------------------------------------- |
118 | iTCO_wdt: | 118 | iTCO_wdt: |
119 | heartbeat: Watchdog heartbeat in seconds. | 119 | heartbeat: Watchdog heartbeat in seconds. |
120 | (2<heartbeat<39 (TCO v1) or 613 (TCO v2), default=30) | 120 | (5<=heartbeat<=74 (TCO v1) or 1226 (TCO v2), default=30) |
121 | nowayout: Watchdog cannot be stopped once started | 121 | nowayout: Watchdog cannot be stopped once started |
122 | (default=kernel config parameter) | 122 | (default=kernel config parameter) |
123 | ------------------------------------------------- | 123 | ------------------------------------------------- |
diff --git a/MAINTAINERS b/MAINTAINERS index f7d568b8f133..9e984645c4b0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -846,7 +846,6 @@ M: Laura Abbott <labbott@redhat.com> | |||
846 | M: Sumit Semwal <sumit.semwal@linaro.org> | 846 | M: Sumit Semwal <sumit.semwal@linaro.org> |
847 | L: devel@driverdev.osuosl.org | 847 | L: devel@driverdev.osuosl.org |
848 | S: Supported | 848 | S: Supported |
849 | F: Documentation/devicetree/bindings/staging/ion/ | ||
850 | F: drivers/staging/android/ion | 849 | F: drivers/staging/android/ion |
851 | F: drivers/staging/android/uapi/ion.h | 850 | F: drivers/staging/android/uapi/ion.h |
852 | F: drivers/staging/android/uapi/ion_test.h | 851 | F: drivers/staging/android/uapi/ion_test.h |
@@ -3116,6 +3115,14 @@ F: drivers/net/ieee802154/cc2520.c | |||
3116 | F: include/linux/spi/cc2520.h | 3115 | F: include/linux/spi/cc2520.h |
3117 | F: Documentation/devicetree/bindings/net/ieee802154/cc2520.txt | 3116 | F: Documentation/devicetree/bindings/net/ieee802154/cc2520.txt |
3118 | 3117 | ||
3118 | CCREE ARM TRUSTZONE CRYPTOCELL 700 REE DRIVER | ||
3119 | M: Gilad Ben-Yossef <gilad@benyossef.com> | ||
3120 | L: linux-crypto@vger.kernel.org | ||
3121 | L: driverdev-devel@linuxdriverproject.org | ||
3122 | S: Supported | ||
3123 | F: drivers/staging/ccree/ | ||
3124 | W: https://developer.arm.com/products/system-ip/trustzone-cryptocell/cryptocell-700-family | ||
3125 | |||
3119 | CEC FRAMEWORK | 3126 | CEC FRAMEWORK |
3120 | M: Hans Verkuil <hans.verkuil@cisco.com> | 3127 | M: Hans Verkuil <hans.verkuil@cisco.com> |
3121 | L: linux-media@vger.kernel.org | 3128 | L: linux-media@vger.kernel.org |
@@ -5695,7 +5702,7 @@ M: Alex Elder <elder@kernel.org> | |||
5695 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 5702 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
5696 | S: Maintained | 5703 | S: Maintained |
5697 | F: drivers/staging/greybus/ | 5704 | F: drivers/staging/greybus/ |
5698 | L: greybus-dev@lists.linaro.org | 5705 | L: greybus-dev@lists.linaro.org (moderated for non-subscribers) |
5699 | 5706 | ||
5700 | GREYBUS AUDIO PROTOCOLS DRIVERS | 5707 | GREYBUS AUDIO PROTOCOLS DRIVERS |
5701 | M: Vaibhav Agarwal <vaibhav.sr@gmail.com> | 5708 | M: Vaibhav Agarwal <vaibhav.sr@gmail.com> |
@@ -9553,10 +9560,6 @@ F: drivers/net/wireless/intersil/orinoco/ | |||
9553 | 9560 | ||
9554 | OSD LIBRARY and FILESYSTEM | 9561 | OSD LIBRARY and FILESYSTEM |
9555 | M: Boaz Harrosh <ooo@electrozaur.com> | 9562 | M: Boaz Harrosh <ooo@electrozaur.com> |
9556 | M: Benny Halevy <bhalevy@primarydata.com> | ||
9557 | L: osd-dev@open-osd.org | ||
9558 | W: http://open-osd.org | ||
9559 | T: git git://git.open-osd.org/open-osd.git | ||
9560 | S: Maintained | 9563 | S: Maintained |
9561 | F: drivers/scsi/osd/ | 9564 | F: drivers/scsi/osd/ |
9562 | F: include/scsi/osd_* | 9565 | F: include/scsi/osd_* |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 4 | 1 | VERSION = 4 |
2 | PATCHLEVEL = 12 | 2 | PATCHLEVEL = 12 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc1 | 4 | EXTRAVERSION = -rc2 |
5 | NAME = Fearless Coyote | 5 | NAME = Fearless Coyote |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
@@ -1172,7 +1172,7 @@ headers_check_all: headers_install_all | |||
1172 | PHONY += headers_check | 1172 | PHONY += headers_check |
1173 | headers_check: headers_install | 1173 | headers_check: headers_install |
1174 | $(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1 | 1174 | $(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1 |
1175 | $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/ $(hdr-dst) HDRCHECK=1 | 1175 | $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst) HDRCHECK=1 |
1176 | 1176 | ||
1177 | # --------------------------------------------------------------------------- | 1177 | # --------------------------------------------------------------------------- |
1178 | # Kernel selftest | 1178 | # Kernel selftest |
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index 9ec56dc97374..ce93124a850b 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c | |||
@@ -1201,8 +1201,10 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, | |||
1201 | if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) | 1201 | if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) |
1202 | return -EFAULT; | 1202 | return -EFAULT; |
1203 | 1203 | ||
1204 | err = 0; | 1204 | err = put_user(status, ustatus); |
1205 | err |= put_user(status, ustatus); | 1205 | if (ret < 0) |
1206 | return err ? err : ret; | ||
1207 | |||
1206 | err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); | 1208 | err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); |
1207 | err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); | 1209 | err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); |
1208 | err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec); | 1210 | err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec); |
diff --git a/arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi b/arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi index 12c981e51134..9a0599f711ff 100644 --- a/arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi +++ b/arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi | |||
@@ -1,6 +1,6 @@ | |||
1 | / { | 1 | / { |
2 | aliases { | 2 | aliases { |
3 | ethernet = ðernet; | 3 | ethernet0 = ðernet; |
4 | }; | 4 | }; |
5 | }; | 5 | }; |
6 | 6 | ||
diff --git a/arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi b/arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi index 3f0a56ebcf1f..dc7ae776db5f 100644 --- a/arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi +++ b/arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi | |||
@@ -1,6 +1,6 @@ | |||
1 | / { | 1 | / { |
2 | aliases { | 2 | aliases { |
3 | ethernet = ðernet; | 3 | ethernet0 = ðernet; |
4 | }; | 4 | }; |
5 | }; | 5 | }; |
6 | 6 | ||
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi index 35cea3fcaf5c..561f27d8d922 100644 --- a/arch/arm/boot/dts/bcm283x.dtsi +++ b/arch/arm/boot/dts/bcm283x.dtsi | |||
@@ -198,8 +198,8 @@ | |||
198 | brcm,pins = <0 1>; | 198 | brcm,pins = <0 1>; |
199 | brcm,function = <BCM2835_FSEL_ALT0>; | 199 | brcm,function = <BCM2835_FSEL_ALT0>; |
200 | }; | 200 | }; |
201 | i2c0_gpio32: i2c0_gpio32 { | 201 | i2c0_gpio28: i2c0_gpio28 { |
202 | brcm,pins = <32 34>; | 202 | brcm,pins = <28 29>; |
203 | brcm,function = <BCM2835_FSEL_ALT0>; | 203 | brcm,function = <BCM2835_FSEL_ALT0>; |
204 | }; | 204 | }; |
205 | i2c0_gpio44: i2c0_gpio44 { | 205 | i2c0_gpio44: i2c0_gpio44 { |
@@ -295,20 +295,28 @@ | |||
295 | /* Separate from the uart0_gpio14 group | 295 | /* Separate from the uart0_gpio14 group |
296 | * because it conflicts with spi1_gpio16, and | 296 | * because it conflicts with spi1_gpio16, and |
297 | * people often run uart0 on the two pins | 297 | * people often run uart0 on the two pins |
298 | * without flow contrl. | 298 | * without flow control. |
299 | */ | 299 | */ |
300 | uart0_ctsrts_gpio16: uart0_ctsrts_gpio16 { | 300 | uart0_ctsrts_gpio16: uart0_ctsrts_gpio16 { |
301 | brcm,pins = <16 17>; | 301 | brcm,pins = <16 17>; |
302 | brcm,function = <BCM2835_FSEL_ALT3>; | 302 | brcm,function = <BCM2835_FSEL_ALT3>; |
303 | }; | 303 | }; |
304 | uart0_gpio30: uart0_gpio30 { | 304 | uart0_ctsrts_gpio30: uart0_ctsrts_gpio30 { |
305 | brcm,pins = <30 31>; | 305 | brcm,pins = <30 31>; |
306 | brcm,function = <BCM2835_FSEL_ALT3>; | 306 | brcm,function = <BCM2835_FSEL_ALT3>; |
307 | }; | 307 | }; |
308 | uart0_ctsrts_gpio32: uart0_ctsrts_gpio32 { | 308 | uart0_gpio32: uart0_gpio32 { |
309 | brcm,pins = <32 33>; | 309 | brcm,pins = <32 33>; |
310 | brcm,function = <BCM2835_FSEL_ALT3>; | 310 | brcm,function = <BCM2835_FSEL_ALT3>; |
311 | }; | 311 | }; |
312 | uart0_gpio36: uart0_gpio36 { | ||
313 | brcm,pins = <36 37>; | ||
314 | brcm,function = <BCM2835_FSEL_ALT2>; | ||
315 | }; | ||
316 | uart0_ctsrts_gpio38: uart0_ctsrts_gpio38 { | ||
317 | brcm,pins = <38 39>; | ||
318 | brcm,function = <BCM2835_FSEL_ALT2>; | ||
319 | }; | ||
312 | 320 | ||
313 | uart1_gpio14: uart1_gpio14 { | 321 | uart1_gpio14: uart1_gpio14 { |
314 | brcm,pins = <14 15>; | 322 | brcm,pins = <14 15>; |
@@ -326,10 +334,6 @@ | |||
326 | brcm,pins = <30 31>; | 334 | brcm,pins = <30 31>; |
327 | brcm,function = <BCM2835_FSEL_ALT5>; | 335 | brcm,function = <BCM2835_FSEL_ALT5>; |
328 | }; | 336 | }; |
329 | uart1_gpio36: uart1_gpio36 { | ||
330 | brcm,pins = <36 37 38 39>; | ||
331 | brcm,function = <BCM2835_FSEL_ALT2>; | ||
332 | }; | ||
333 | uart1_gpio40: uart1_gpio40 { | 337 | uart1_gpio40: uart1_gpio40 { |
334 | brcm,pins = <40 41>; | 338 | brcm,pins = <40 41>; |
335 | brcm,function = <BCM2835_FSEL_ALT5>; | 339 | brcm,function = <BCM2835_FSEL_ALT5>; |
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts index 4bc4b575c99b..31a9e061ddd0 100644 --- a/arch/arm/boot/dts/dra7-evm.dts +++ b/arch/arm/boot/dts/dra7-evm.dts | |||
@@ -204,6 +204,8 @@ | |||
204 | tps659038: tps659038@58 { | 204 | tps659038: tps659038@58 { |
205 | compatible = "ti,tps659038"; | 205 | compatible = "ti,tps659038"; |
206 | reg = <0x58>; | 206 | reg = <0x58>; |
207 | ti,palmas-override-powerhold; | ||
208 | ti,system-power-controller; | ||
207 | 209 | ||
208 | tps659038_pmic { | 210 | tps659038_pmic { |
209 | compatible = "ti,tps659038-pmic"; | 211 | compatible = "ti,tps659038-pmic"; |
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi index 57892f264cea..e7144662af45 100644 --- a/arch/arm/boot/dts/dra7.dtsi +++ b/arch/arm/boot/dts/dra7.dtsi | |||
@@ -2017,4 +2017,8 @@ | |||
2017 | coefficients = <0 2000>; | 2017 | coefficients = <0 2000>; |
2018 | }; | 2018 | }; |
2019 | 2019 | ||
2020 | &cpu_crit { | ||
2021 | temperature = <120000>; /* milli Celsius */ | ||
2022 | }; | ||
2023 | |||
2020 | /include/ "dra7xx-clocks.dtsi" | 2024 | /include/ "dra7xx-clocks.dtsi" |
diff --git a/arch/arm/boot/dts/imx53-qsrb.dts b/arch/arm/boot/dts/imx53-qsrb.dts index de2215832372..4e103a905dc9 100644 --- a/arch/arm/boot/dts/imx53-qsrb.dts +++ b/arch/arm/boot/dts/imx53-qsrb.dts | |||
@@ -23,7 +23,7 @@ | |||
23 | imx53-qsrb { | 23 | imx53-qsrb { |
24 | pinctrl_pmic: pmicgrp { | 24 | pinctrl_pmic: pmicgrp { |
25 | fsl,pins = < | 25 | fsl,pins = < |
26 | MX53_PAD_CSI0_DAT5__GPIO5_23 0x1e4 /* IRQ */ | 26 | MX53_PAD_CSI0_DAT5__GPIO5_23 0x1c4 /* IRQ */ |
27 | >; | 27 | >; |
28 | }; | 28 | }; |
29 | }; | 29 | }; |
diff --git a/arch/arm/boot/dts/imx6sx-sdb.dts b/arch/arm/boot/dts/imx6sx-sdb.dts index 5bb8fd57e7f5..d71da30c9cff 100644 --- a/arch/arm/boot/dts/imx6sx-sdb.dts +++ b/arch/arm/boot/dts/imx6sx-sdb.dts | |||
@@ -12,23 +12,6 @@ | |||
12 | model = "Freescale i.MX6 SoloX SDB RevB Board"; | 12 | model = "Freescale i.MX6 SoloX SDB RevB Board"; |
13 | }; | 13 | }; |
14 | 14 | ||
15 | &cpu0 { | ||
16 | operating-points = < | ||
17 | /* kHz uV */ | ||
18 | 996000 1250000 | ||
19 | 792000 1175000 | ||
20 | 396000 1175000 | ||
21 | 198000 1175000 | ||
22 | >; | ||
23 | fsl,soc-operating-points = < | ||
24 | /* ARM kHz SOC uV */ | ||
25 | 996000 1250000 | ||
26 | 792000 1175000 | ||
27 | 396000 1175000 | ||
28 | 198000 1175000 | ||
29 | >; | ||
30 | }; | ||
31 | |||
32 | &i2c1 { | 15 | &i2c1 { |
33 | clock-frequency = <100000>; | 16 | clock-frequency = <100000>; |
34 | pinctrl-names = "default"; | 17 | pinctrl-names = "default"; |
diff --git a/arch/arm/boot/dts/include/arm b/arch/arm/boot/dts/include/arm deleted file mode 120000 index a96aa0ea9d8c..000000000000 --- a/arch/arm/boot/dts/include/arm +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | .. \ No newline at end of file | ||
diff --git a/arch/arm/boot/dts/include/arm64 b/arch/arm/boot/dts/include/arm64 deleted file mode 120000 index 074a835fca3e..000000000000 --- a/arch/arm/boot/dts/include/arm64 +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | ../../../../arm64/boot/dts \ No newline at end of file | ||
diff --git a/arch/arm/boot/dts/include/dt-bindings b/arch/arm/boot/dts/include/dt-bindings deleted file mode 120000 index 08c00e4972fa..000000000000 --- a/arch/arm/boot/dts/include/dt-bindings +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | ../../../../../include/dt-bindings \ No newline at end of file | ||
diff --git a/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts b/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts index 08cce17a25a0..43e9364083de 100644 --- a/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts +++ b/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts | |||
@@ -249,9 +249,9 @@ | |||
249 | OMAP3_CORE1_IOPAD(0x2110, PIN_INPUT | MUX_MODE0) /* cam_xclka.cam_xclka */ | 249 | OMAP3_CORE1_IOPAD(0x2110, PIN_INPUT | MUX_MODE0) /* cam_xclka.cam_xclka */ |
250 | OMAP3_CORE1_IOPAD(0x2112, PIN_INPUT | MUX_MODE0) /* cam_pclk.cam_pclk */ | 250 | OMAP3_CORE1_IOPAD(0x2112, PIN_INPUT | MUX_MODE0) /* cam_pclk.cam_pclk */ |
251 | 251 | ||
252 | OMAP3_CORE1_IOPAD(0x2114, PIN_INPUT | MUX_MODE0) /* cam_d0.cam_d0 */ | 252 | OMAP3_CORE1_IOPAD(0x2116, PIN_INPUT | MUX_MODE0) /* cam_d0.cam_d0 */ |
253 | OMAP3_CORE1_IOPAD(0x2116, PIN_INPUT | MUX_MODE0) /* cam_d1.cam_d1 */ | 253 | OMAP3_CORE1_IOPAD(0x2118, PIN_INPUT | MUX_MODE0) /* cam_d1.cam_d1 */ |
254 | OMAP3_CORE1_IOPAD(0x2118, PIN_INPUT | MUX_MODE0) /* cam_d2.cam_d2 */ | 254 | OMAP3_CORE1_IOPAD(0x211a, PIN_INPUT | MUX_MODE0) /* cam_d2.cam_d2 */ |
255 | OMAP3_CORE1_IOPAD(0x211c, PIN_INPUT | MUX_MODE0) /* cam_d3.cam_d3 */ | 255 | OMAP3_CORE1_IOPAD(0x211c, PIN_INPUT | MUX_MODE0) /* cam_d3.cam_d3 */ |
256 | OMAP3_CORE1_IOPAD(0x211e, PIN_INPUT | MUX_MODE0) /* cam_d4.cam_d4 */ | 256 | OMAP3_CORE1_IOPAD(0x211e, PIN_INPUT | MUX_MODE0) /* cam_d4.cam_d4 */ |
257 | OMAP3_CORE1_IOPAD(0x2120, PIN_INPUT | MUX_MODE0) /* cam_d5.cam_d5 */ | 257 | OMAP3_CORE1_IOPAD(0x2120, PIN_INPUT | MUX_MODE0) /* cam_d5.cam_d5 */ |
diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi index 402579ab70d2..3a9e9b6aea68 100644 --- a/arch/arm/boot/dts/mt7623.dtsi +++ b/arch/arm/boot/dts/mt7623.dtsi | |||
@@ -72,6 +72,8 @@ | |||
72 | <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>, | 72 | <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>, |
73 | <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>, | 73 | <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>, |
74 | <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; | 74 | <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; |
75 | clock-frequency = <13000000>; | ||
76 | arm,cpu-registers-not-fw-configured; | ||
75 | }; | 77 | }; |
76 | 78 | ||
77 | watchdog: watchdog@10007000 { | 79 | watchdog: watchdog@10007000 { |
diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi index b3a8b1f24499..9ec737069369 100644 --- a/arch/arm/boot/dts/omap3-gta04.dtsi +++ b/arch/arm/boot/dts/omap3-gta04.dtsi | |||
@@ -55,7 +55,8 @@ | |||
55 | simple-audio-card,bitclock-master = <&telephony_link_master>; | 55 | simple-audio-card,bitclock-master = <&telephony_link_master>; |
56 | simple-audio-card,frame-master = <&telephony_link_master>; | 56 | simple-audio-card,frame-master = <&telephony_link_master>; |
57 | simple-audio-card,format = "i2s"; | 57 | simple-audio-card,format = "i2s"; |
58 | 58 | simple-audio-card,bitclock-inversion; | |
59 | simple-audio-card,frame-inversion; | ||
59 | simple-audio-card,cpu { | 60 | simple-audio-card,cpu { |
60 | sound-dai = <&mcbsp4>; | 61 | sound-dai = <&mcbsp4>; |
61 | }; | 62 | }; |
diff --git a/arch/arm/boot/dts/omap4-panda-a4.dts b/arch/arm/boot/dts/omap4-panda-a4.dts index 78d363177762..f1a6476af371 100644 --- a/arch/arm/boot/dts/omap4-panda-a4.dts +++ b/arch/arm/boot/dts/omap4-panda-a4.dts | |||
@@ -13,7 +13,7 @@ | |||
13 | /* Pandaboard Rev A4+ have external pullups on SCL & SDA */ | 13 | /* Pandaboard Rev A4+ have external pullups on SCL & SDA */ |
14 | &dss_hdmi_pins { | 14 | &dss_hdmi_pins { |
15 | pinctrl-single,pins = < | 15 | pinctrl-single,pins = < |
16 | OMAP4_IOPAD(0x09a, PIN_INPUT_PULLUP | MUX_MODE0) /* hdmi_cec.hdmi_cec */ | 16 | OMAP4_IOPAD(0x09a, PIN_INPUT | MUX_MODE0) /* hdmi_cec.hdmi_cec */ |
17 | OMAP4_IOPAD(0x09c, PIN_INPUT | MUX_MODE0) /* hdmi_scl.hdmi_scl */ | 17 | OMAP4_IOPAD(0x09c, PIN_INPUT | MUX_MODE0) /* hdmi_scl.hdmi_scl */ |
18 | OMAP4_IOPAD(0x09e, PIN_INPUT | MUX_MODE0) /* hdmi_sda.hdmi_sda */ | 18 | OMAP4_IOPAD(0x09e, PIN_INPUT | MUX_MODE0) /* hdmi_sda.hdmi_sda */ |
19 | >; | 19 | >; |
diff --git a/arch/arm/boot/dts/omap4-panda-es.dts b/arch/arm/boot/dts/omap4-panda-es.dts index 119f8e657edc..940fe4f7c5f6 100644 --- a/arch/arm/boot/dts/omap4-panda-es.dts +++ b/arch/arm/boot/dts/omap4-panda-es.dts | |||
@@ -34,7 +34,7 @@ | |||
34 | /* PandaboardES has external pullups on SCL & SDA */ | 34 | /* PandaboardES has external pullups on SCL & SDA */ |
35 | &dss_hdmi_pins { | 35 | &dss_hdmi_pins { |
36 | pinctrl-single,pins = < | 36 | pinctrl-single,pins = < |
37 | OMAP4_IOPAD(0x09a, PIN_INPUT_PULLUP | MUX_MODE0) /* hdmi_cec.hdmi_cec */ | 37 | OMAP4_IOPAD(0x09a, PIN_INPUT | MUX_MODE0) /* hdmi_cec.hdmi_cec */ |
38 | OMAP4_IOPAD(0x09c, PIN_INPUT | MUX_MODE0) /* hdmi_scl.hdmi_scl */ | 38 | OMAP4_IOPAD(0x09c, PIN_INPUT | MUX_MODE0) /* hdmi_scl.hdmi_scl */ |
39 | OMAP4_IOPAD(0x09e, PIN_INPUT | MUX_MODE0) /* hdmi_sda.hdmi_sda */ | 39 | OMAP4_IOPAD(0x09e, PIN_INPUT | MUX_MODE0) /* hdmi_sda.hdmi_sda */ |
40 | >; | 40 | >; |
diff --git a/arch/arm/configs/gemini_defconfig b/arch/arm/configs/gemini_defconfig new file mode 100644 index 000000000000..d2d75fa664a6 --- /dev/null +++ b/arch/arm/configs/gemini_defconfig | |||
@@ -0,0 +1,68 @@ | |||
1 | # CONFIG_LOCALVERSION_AUTO is not set | ||
2 | CONFIG_SYSVIPC=y | ||
3 | CONFIG_NO_HZ_IDLE=y | ||
4 | CONFIG_BSD_PROCESS_ACCT=y | ||
5 | CONFIG_USER_NS=y | ||
6 | CONFIG_RELAY=y | ||
7 | CONFIG_BLK_DEV_INITRD=y | ||
8 | CONFIG_PARTITION_ADVANCED=y | ||
9 | CONFIG_ARCH_MULTI_V4=y | ||
10 | # CONFIG_ARCH_MULTI_V7 is not set | ||
11 | CONFIG_ARCH_GEMINI=y | ||
12 | CONFIG_PCI=y | ||
13 | CONFIG_PREEMPT=y | ||
14 | CONFIG_AEABI=y | ||
15 | CONFIG_CMDLINE="console=ttyS0,115200n8" | ||
16 | CONFIG_KEXEC=y | ||
17 | CONFIG_BINFMT_MISC=y | ||
18 | CONFIG_PM=y | ||
19 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
20 | CONFIG_DEVTMPFS=y | ||
21 | CONFIG_MTD=y | ||
22 | CONFIG_MTD_BLOCK=y | ||
23 | CONFIG_MTD_CFI=y | ||
24 | CONFIG_MTD_CFI_INTELEXT=y | ||
25 | CONFIG_MTD_CFI_AMDSTD=y | ||
26 | CONFIG_MTD_CFI_STAA=y | ||
27 | CONFIG_MTD_PHYSMAP=y | ||
28 | CONFIG_MTD_PHYSMAP_OF=y | ||
29 | CONFIG_BLK_DEV_RAM=y | ||
30 | CONFIG_BLK_DEV_RAM_SIZE=16384 | ||
31 | # CONFIG_SCSI_PROC_FS is not set | ||
32 | CONFIG_BLK_DEV_SD=y | ||
33 | # CONFIG_SCSI_LOWLEVEL is not set | ||
34 | CONFIG_ATA=y | ||
35 | CONFIG_INPUT_EVDEV=y | ||
36 | CONFIG_KEYBOARD_GPIO=y | ||
37 | # CONFIG_INPUT_MOUSE is not set | ||
38 | # CONFIG_LEGACY_PTYS is not set | ||
39 | CONFIG_SERIAL_8250=y | ||
40 | CONFIG_SERIAL_8250_CONSOLE=y | ||
41 | CONFIG_SERIAL_8250_NR_UARTS=1 | ||
42 | CONFIG_SERIAL_8250_RUNTIME_UARTS=1 | ||
43 | CONFIG_SERIAL_OF_PLATFORM=y | ||
44 | # CONFIG_HW_RANDOM is not set | ||
45 | # CONFIG_HWMON is not set | ||
46 | CONFIG_WATCHDOG=y | ||
47 | CONFIG_GEMINI_WATCHDOG=y | ||
48 | CONFIG_USB=y | ||
49 | CONFIG_USB_MON=y | ||
50 | CONFIG_USB_FOTG210_HCD=y | ||
51 | CONFIG_USB_STORAGE=y | ||
52 | CONFIG_NEW_LEDS=y | ||
53 | CONFIG_LEDS_CLASS=y | ||
54 | CONFIG_LEDS_GPIO=y | ||
55 | CONFIG_LEDS_TRIGGERS=y | ||
56 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | ||
57 | CONFIG_RTC_CLASS=y | ||
58 | CONFIG_RTC_DRV_GEMINI=y | ||
59 | CONFIG_DMADEVICES=y | ||
60 | # CONFIG_DNOTIFY is not set | ||
61 | CONFIG_TMPFS=y | ||
62 | CONFIG_TMPFS_POSIX_ACL=y | ||
63 | CONFIG_ROMFS_FS=y | ||
64 | CONFIG_NLS_CODEPAGE_437=y | ||
65 | CONFIG_NLS_ISO8859_1=y | ||
66 | # CONFIG_ENABLE_WARN_DEPRECATED is not set | ||
67 | # CONFIG_ENABLE_MUST_CHECK is not set | ||
68 | CONFIG_DEBUG_FS=y | ||
diff --git a/arch/arm/include/asm/kvm_coproc.h b/arch/arm/include/asm/kvm_coproc.h index 4917c2f7e459..e74ab0fbab79 100644 --- a/arch/arm/include/asm/kvm_coproc.h +++ b/arch/arm/include/asm/kvm_coproc.h | |||
@@ -31,7 +31,8 @@ void kvm_register_target_coproc_table(struct kvm_coproc_target_table *table); | |||
31 | int kvm_handle_cp10_id(struct kvm_vcpu *vcpu, struct kvm_run *run); | 31 | int kvm_handle_cp10_id(struct kvm_vcpu *vcpu, struct kvm_run *run); |
32 | int kvm_handle_cp_0_13_access(struct kvm_vcpu *vcpu, struct kvm_run *run); | 32 | int kvm_handle_cp_0_13_access(struct kvm_vcpu *vcpu, struct kvm_run *run); |
33 | int kvm_handle_cp14_load_store(struct kvm_vcpu *vcpu, struct kvm_run *run); | 33 | int kvm_handle_cp14_load_store(struct kvm_vcpu *vcpu, struct kvm_run *run); |
34 | int kvm_handle_cp14_access(struct kvm_vcpu *vcpu, struct kvm_run *run); | 34 | int kvm_handle_cp14_32(struct kvm_vcpu *vcpu, struct kvm_run *run); |
35 | int kvm_handle_cp14_64(struct kvm_vcpu *vcpu, struct kvm_run *run); | ||
35 | int kvm_handle_cp15_32(struct kvm_vcpu *vcpu, struct kvm_run *run); | 36 | int kvm_handle_cp15_32(struct kvm_vcpu *vcpu, struct kvm_run *run); |
36 | int kvm_handle_cp15_64(struct kvm_vcpu *vcpu, struct kvm_run *run); | 37 | int kvm_handle_cp15_64(struct kvm_vcpu *vcpu, struct kvm_run *run); |
37 | 38 | ||
diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c index 2c14b69511e9..6d1d2e26dfe5 100644 --- a/arch/arm/kvm/coproc.c +++ b/arch/arm/kvm/coproc.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/vfp.h> | 32 | #include <asm/vfp.h> |
33 | #include "../vfp/vfpinstr.h" | 33 | #include "../vfp/vfpinstr.h" |
34 | 34 | ||
35 | #define CREATE_TRACE_POINTS | ||
35 | #include "trace.h" | 36 | #include "trace.h" |
36 | #include "coproc.h" | 37 | #include "coproc.h" |
37 | 38 | ||
@@ -111,12 +112,6 @@ int kvm_handle_cp14_load_store(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
111 | return 1; | 112 | return 1; |
112 | } | 113 | } |
113 | 114 | ||
114 | int kvm_handle_cp14_access(struct kvm_vcpu *vcpu, struct kvm_run *run) | ||
115 | { | ||
116 | kvm_inject_undefined(vcpu); | ||
117 | return 1; | ||
118 | } | ||
119 | |||
120 | static void reset_mpidr(struct kvm_vcpu *vcpu, const struct coproc_reg *r) | 115 | static void reset_mpidr(struct kvm_vcpu *vcpu, const struct coproc_reg *r) |
121 | { | 116 | { |
122 | /* | 117 | /* |
@@ -284,7 +279,7 @@ static bool access_gic_sre(struct kvm_vcpu *vcpu, | |||
284 | * must always support PMCCNTR (the cycle counter): we just RAZ/WI for | 279 | * must always support PMCCNTR (the cycle counter): we just RAZ/WI for |
285 | * all PM registers, which doesn't crash the guest kernel at least. | 280 | * all PM registers, which doesn't crash the guest kernel at least. |
286 | */ | 281 | */ |
287 | static bool pm_fake(struct kvm_vcpu *vcpu, | 282 | static bool trap_raz_wi(struct kvm_vcpu *vcpu, |
288 | const struct coproc_params *p, | 283 | const struct coproc_params *p, |
289 | const struct coproc_reg *r) | 284 | const struct coproc_reg *r) |
290 | { | 285 | { |
@@ -294,19 +289,19 @@ static bool pm_fake(struct kvm_vcpu *vcpu, | |||
294 | return read_zero(vcpu, p); | 289 | return read_zero(vcpu, p); |
295 | } | 290 | } |
296 | 291 | ||
297 | #define access_pmcr pm_fake | 292 | #define access_pmcr trap_raz_wi |
298 | #define access_pmcntenset pm_fake | 293 | #define access_pmcntenset trap_raz_wi |
299 | #define access_pmcntenclr pm_fake | 294 | #define access_pmcntenclr trap_raz_wi |
300 | #define access_pmovsr pm_fake | 295 | #define access_pmovsr trap_raz_wi |
301 | #define access_pmselr pm_fake | 296 | #define access_pmselr trap_raz_wi |
302 | #define access_pmceid0 pm_fake | 297 | #define access_pmceid0 trap_raz_wi |
303 | #define access_pmceid1 pm_fake | 298 | #define access_pmceid1 trap_raz_wi |
304 | #define access_pmccntr pm_fake | 299 | #define access_pmccntr trap_raz_wi |
305 | #define access_pmxevtyper pm_fake | 300 | #define access_pmxevtyper trap_raz_wi |
306 | #define access_pmxevcntr pm_fake | 301 | #define access_pmxevcntr trap_raz_wi |
307 | #define access_pmuserenr pm_fake | 302 | #define access_pmuserenr trap_raz_wi |
308 | #define access_pmintenset pm_fake | 303 | #define access_pmintenset trap_raz_wi |
309 | #define access_pmintenclr pm_fake | 304 | #define access_pmintenclr trap_raz_wi |
310 | 305 | ||
311 | /* Architected CP15 registers. | 306 | /* Architected CP15 registers. |
312 | * CRn denotes the primary register number, but is copied to the CRm in the | 307 | * CRn denotes the primary register number, but is copied to the CRm in the |
@@ -532,12 +527,7 @@ static int emulate_cp15(struct kvm_vcpu *vcpu, | |||
532 | return 1; | 527 | return 1; |
533 | } | 528 | } |
534 | 529 | ||
535 | /** | 530 | static struct coproc_params decode_64bit_hsr(struct kvm_vcpu *vcpu) |
536 | * kvm_handle_cp15_64 -- handles a mrrc/mcrr trap on a guest CP15 access | ||
537 | * @vcpu: The VCPU pointer | ||
538 | * @run: The kvm_run struct | ||
539 | */ | ||
540 | int kvm_handle_cp15_64(struct kvm_vcpu *vcpu, struct kvm_run *run) | ||
541 | { | 531 | { |
542 | struct coproc_params params; | 532 | struct coproc_params params; |
543 | 533 | ||
@@ -551,9 +541,38 @@ int kvm_handle_cp15_64(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
551 | params.Rt2 = (kvm_vcpu_get_hsr(vcpu) >> 10) & 0xf; | 541 | params.Rt2 = (kvm_vcpu_get_hsr(vcpu) >> 10) & 0xf; |
552 | params.CRm = 0; | 542 | params.CRm = 0; |
553 | 543 | ||
544 | return params; | ||
545 | } | ||
546 | |||
547 | /** | ||
548 | * kvm_handle_cp15_64 -- handles a mrrc/mcrr trap on a guest CP15 access | ||
549 | * @vcpu: The VCPU pointer | ||
550 | * @run: The kvm_run struct | ||
551 | */ | ||
552 | int kvm_handle_cp15_64(struct kvm_vcpu *vcpu, struct kvm_run *run) | ||
553 | { | ||
554 | struct coproc_params params = decode_64bit_hsr(vcpu); | ||
555 | |||
554 | return emulate_cp15(vcpu, ¶ms); | 556 | return emulate_cp15(vcpu, ¶ms); |
555 | } | 557 | } |
556 | 558 | ||
559 | /** | ||
560 | * kvm_handle_cp14_64 -- handles a mrrc/mcrr trap on a guest CP14 access | ||
561 | * @vcpu: The VCPU pointer | ||
562 | * @run: The kvm_run struct | ||
563 | */ | ||
564 | int kvm_handle_cp14_64(struct kvm_vcpu *vcpu, struct kvm_run *run) | ||
565 | { | ||
566 | struct coproc_params params = decode_64bit_hsr(vcpu); | ||
567 | |||
568 | /* raz_wi cp14 */ | ||
569 | trap_raz_wi(vcpu, ¶ms, NULL); | ||
570 | |||
571 | /* handled */ | ||
572 | kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); | ||
573 | return 1; | ||
574 | } | ||
575 | |||
557 | static void reset_coproc_regs(struct kvm_vcpu *vcpu, | 576 | static void reset_coproc_regs(struct kvm_vcpu *vcpu, |
558 | const struct coproc_reg *table, size_t num) | 577 | const struct coproc_reg *table, size_t num) |
559 | { | 578 | { |
@@ -564,12 +583,7 @@ static void reset_coproc_regs(struct kvm_vcpu *vcpu, | |||
564 | table[i].reset(vcpu, &table[i]); | 583 | table[i].reset(vcpu, &table[i]); |
565 | } | 584 | } |
566 | 585 | ||
567 | /** | 586 | static struct coproc_params decode_32bit_hsr(struct kvm_vcpu *vcpu) |
568 | * kvm_handle_cp15_32 -- handles a mrc/mcr trap on a guest CP15 access | ||
569 | * @vcpu: The VCPU pointer | ||
570 | * @run: The kvm_run struct | ||
571 | */ | ||
572 | int kvm_handle_cp15_32(struct kvm_vcpu *vcpu, struct kvm_run *run) | ||
573 | { | 587 | { |
574 | struct coproc_params params; | 588 | struct coproc_params params; |
575 | 589 | ||
@@ -583,9 +597,37 @@ int kvm_handle_cp15_32(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
583 | params.Op2 = (kvm_vcpu_get_hsr(vcpu) >> 17) & 0x7; | 597 | params.Op2 = (kvm_vcpu_get_hsr(vcpu) >> 17) & 0x7; |
584 | params.Rt2 = 0; | 598 | params.Rt2 = 0; |
585 | 599 | ||
600 | return params; | ||
601 | } | ||
602 | |||
603 | /** | ||
604 | * kvm_handle_cp15_32 -- handles a mrc/mcr trap on a guest CP15 access | ||
605 | * @vcpu: The VCPU pointer | ||
606 | * @run: The kvm_run struct | ||
607 | */ | ||
608 | int kvm_handle_cp15_32(struct kvm_vcpu *vcpu, struct kvm_run *run) | ||
609 | { | ||
610 | struct coproc_params params = decode_32bit_hsr(vcpu); | ||
586 | return emulate_cp15(vcpu, ¶ms); | 611 | return emulate_cp15(vcpu, ¶ms); |
587 | } | 612 | } |
588 | 613 | ||
614 | /** | ||
615 | * kvm_handle_cp14_32 -- handles a mrc/mcr trap on a guest CP14 access | ||
616 | * @vcpu: The VCPU pointer | ||
617 | * @run: The kvm_run struct | ||
618 | */ | ||
619 | int kvm_handle_cp14_32(struct kvm_vcpu *vcpu, struct kvm_run *run) | ||
620 | { | ||
621 | struct coproc_params params = decode_32bit_hsr(vcpu); | ||
622 | |||
623 | /* raz_wi cp14 */ | ||
624 | trap_raz_wi(vcpu, ¶ms, NULL); | ||
625 | |||
626 | /* handled */ | ||
627 | kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); | ||
628 | return 1; | ||
629 | } | ||
630 | |||
589 | /****************************************************************************** | 631 | /****************************************************************************** |
590 | * Userspace API | 632 | * Userspace API |
591 | *****************************************************************************/ | 633 | *****************************************************************************/ |
diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/kvm/handle_exit.c index 5fd7968cdae9..f86a9aaef462 100644 --- a/arch/arm/kvm/handle_exit.c +++ b/arch/arm/kvm/handle_exit.c | |||
@@ -95,9 +95,9 @@ static exit_handle_fn arm_exit_handlers[] = { | |||
95 | [HSR_EC_WFI] = kvm_handle_wfx, | 95 | [HSR_EC_WFI] = kvm_handle_wfx, |
96 | [HSR_EC_CP15_32] = kvm_handle_cp15_32, | 96 | [HSR_EC_CP15_32] = kvm_handle_cp15_32, |
97 | [HSR_EC_CP15_64] = kvm_handle_cp15_64, | 97 | [HSR_EC_CP15_64] = kvm_handle_cp15_64, |
98 | [HSR_EC_CP14_MR] = kvm_handle_cp14_access, | 98 | [HSR_EC_CP14_MR] = kvm_handle_cp14_32, |
99 | [HSR_EC_CP14_LS] = kvm_handle_cp14_load_store, | 99 | [HSR_EC_CP14_LS] = kvm_handle_cp14_load_store, |
100 | [HSR_EC_CP14_64] = kvm_handle_cp14_access, | 100 | [HSR_EC_CP14_64] = kvm_handle_cp14_64, |
101 | [HSR_EC_CP_0_13] = kvm_handle_cp_0_13_access, | 101 | [HSR_EC_CP_0_13] = kvm_handle_cp_0_13_access, |
102 | [HSR_EC_CP10_ID] = kvm_handle_cp10_id, | 102 | [HSR_EC_CP10_ID] = kvm_handle_cp10_id, |
103 | [HSR_EC_HVC] = handle_hvc, | 103 | [HSR_EC_HVC] = handle_hvc, |
diff --git a/arch/arm/kvm/hyp/Makefile b/arch/arm/kvm/hyp/Makefile index 3023bb530edf..8679405b0b2b 100644 --- a/arch/arm/kvm/hyp/Makefile +++ b/arch/arm/kvm/hyp/Makefile | |||
@@ -2,6 +2,8 @@ | |||
2 | # Makefile for Kernel-based Virtual Machine module, HYP part | 2 | # Makefile for Kernel-based Virtual Machine module, HYP part |
3 | # | 3 | # |
4 | 4 | ||
5 | ccflags-y += -fno-stack-protector | ||
6 | |||
5 | KVM=../../../../virt/kvm | 7 | KVM=../../../../virt/kvm |
6 | 8 | ||
7 | obj-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/hyp/vgic-v2-sr.o | 9 | obj-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/hyp/vgic-v2-sr.o |
diff --git a/arch/arm/kvm/hyp/switch.c b/arch/arm/kvm/hyp/switch.c index 92678b7bd046..624a510d31df 100644 --- a/arch/arm/kvm/hyp/switch.c +++ b/arch/arm/kvm/hyp/switch.c | |||
@@ -48,7 +48,9 @@ static void __hyp_text __activate_traps(struct kvm_vcpu *vcpu, u32 *fpexc_host) | |||
48 | write_sysreg(HSTR_T(15), HSTR); | 48 | write_sysreg(HSTR_T(15), HSTR); |
49 | write_sysreg(HCPTR_TTA | HCPTR_TCP(10) | HCPTR_TCP(11), HCPTR); | 49 | write_sysreg(HCPTR_TTA | HCPTR_TCP(10) | HCPTR_TCP(11), HCPTR); |
50 | val = read_sysreg(HDCR); | 50 | val = read_sysreg(HDCR); |
51 | write_sysreg(val | HDCR_TPM | HDCR_TPMCR, HDCR); | 51 | val |= HDCR_TPM | HDCR_TPMCR; /* trap performance monitors */ |
52 | val |= HDCR_TDRA | HDCR_TDOSA | HDCR_TDA; /* trap debug regs */ | ||
53 | write_sysreg(val, HDCR); | ||
52 | } | 54 | } |
53 | 55 | ||
54 | static void __hyp_text __deactivate_traps(struct kvm_vcpu *vcpu) | 56 | static void __hyp_text __deactivate_traps(struct kvm_vcpu *vcpu) |
diff --git a/arch/arm/kvm/trace.h b/arch/arm/kvm/trace.h index fc0943776db2..b0d10648c486 100644 --- a/arch/arm/kvm/trace.h +++ b/arch/arm/kvm/trace.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ) | 1 | #if !defined(_TRACE_ARM_KVM_H) || defined(TRACE_HEADER_MULTI_READ) |
2 | #define _TRACE_KVM_H | 2 | #define _TRACE_ARM_KVM_H |
3 | 3 | ||
4 | #include <linux/tracepoint.h> | 4 | #include <linux/tracepoint.h> |
5 | 5 | ||
@@ -74,10 +74,10 @@ TRACE_EVENT(kvm_hvc, | |||
74 | __entry->vcpu_pc, __entry->r0, __entry->imm) | 74 | __entry->vcpu_pc, __entry->r0, __entry->imm) |
75 | ); | 75 | ); |
76 | 76 | ||
77 | #endif /* _TRACE_KVM_H */ | 77 | #endif /* _TRACE_ARM_KVM_H */ |
78 | 78 | ||
79 | #undef TRACE_INCLUDE_PATH | 79 | #undef TRACE_INCLUDE_PATH |
80 | #define TRACE_INCLUDE_PATH arch/arm/kvm | 80 | #define TRACE_INCLUDE_PATH . |
81 | #undef TRACE_INCLUDE_FILE | 81 | #undef TRACE_INCLUDE_FILE |
82 | #define TRACE_INCLUDE_FILE trace | 82 | #define TRACE_INCLUDE_FILE trace |
83 | 83 | ||
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 2cd27c830ab6..283e79ab587d 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
@@ -335,7 +335,7 @@ static const struct ramc_info ramc_infos[] __initconst = { | |||
335 | { .idle = sama5d3_ddr_standby, .memctrl = AT91_MEMCTRL_DDRSDR}, | 335 | { .idle = sama5d3_ddr_standby, .memctrl = AT91_MEMCTRL_DDRSDR}, |
336 | }; | 336 | }; |
337 | 337 | ||
338 | static const struct of_device_id const ramc_ids[] __initconst = { | 338 | static const struct of_device_id ramc_ids[] __initconst = { |
339 | { .compatible = "atmel,at91rm9200-sdramc", .data = &ramc_infos[0] }, | 339 | { .compatible = "atmel,at91rm9200-sdramc", .data = &ramc_infos[0] }, |
340 | { .compatible = "atmel,at91sam9260-sdramc", .data = &ramc_infos[1] }, | 340 | { .compatible = "atmel,at91sam9260-sdramc", .data = &ramc_infos[1] }, |
341 | { .compatible = "atmel,at91sam9g45-ddramc", .data = &ramc_infos[2] }, | 341 | { .compatible = "atmel,at91sam9g45-ddramc", .data = &ramc_infos[2] }, |
diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c index cf3f8658f0e5..a55a7ecf146a 100644 --- a/arch/arm/mach-bcm/bcm_kona_smc.c +++ b/arch/arm/mach-bcm/bcm_kona_smc.c | |||
@@ -33,7 +33,7 @@ struct bcm_kona_smc_data { | |||
33 | unsigned result; | 33 | unsigned result; |
34 | }; | 34 | }; |
35 | 35 | ||
36 | static const struct of_device_id const bcm_kona_smc_ids[] __initconst = { | 36 | static const struct of_device_id bcm_kona_smc_ids[] __initconst = { |
37 | {.compatible = "brcm,kona-smc"}, | 37 | {.compatible = "brcm,kona-smc"}, |
38 | {.compatible = "bcm,kona-smc"}, /* deprecated name */ | 38 | {.compatible = "bcm,kona-smc"}, /* deprecated name */ |
39 | {}, | 39 | {}, |
diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c index 03da3813f1ab..7d5a44a06648 100644 --- a/arch/arm/mach-cns3xxx/core.c +++ b/arch/arm/mach-cns3xxx/core.c | |||
@@ -346,7 +346,7 @@ static struct usb_ohci_pdata cns3xxx_usb_ohci_pdata = { | |||
346 | .power_off = csn3xxx_usb_power_off, | 346 | .power_off = csn3xxx_usb_power_off, |
347 | }; | 347 | }; |
348 | 348 | ||
349 | static const struct of_dev_auxdata const cns3xxx_auxdata[] __initconst = { | 349 | static const struct of_dev_auxdata cns3xxx_auxdata[] __initconst = { |
350 | { "intel,usb-ehci", CNS3XXX_USB_BASE, "ehci-platform", &cns3xxx_usb_ehci_pdata }, | 350 | { "intel,usb-ehci", CNS3XXX_USB_BASE, "ehci-platform", &cns3xxx_usb_ehci_pdata }, |
351 | { "intel,usb-ohci", CNS3XXX_USB_OHCI_BASE, "ohci-platform", &cns3xxx_usb_ohci_pdata }, | 351 | { "intel,usb-ohci", CNS3XXX_USB_OHCI_BASE, "ohci-platform", &cns3xxx_usb_ohci_pdata }, |
352 | { "cavium,cns3420-ahci", CNS3XXX_SATA2_BASE, "ahci", NULL }, | 352 | { "cavium,cns3420-ahci", CNS3XXX_SATA2_BASE, "ahci", NULL }, |
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index 3089d3bfa19b..8cc6338fcb12 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h | |||
@@ -266,11 +266,12 @@ extern int omap4_cpu_kill(unsigned int cpu); | |||
266 | extern const struct smp_operations omap4_smp_ops; | 266 | extern const struct smp_operations omap4_smp_ops; |
267 | #endif | 267 | #endif |
268 | 268 | ||
269 | extern u32 omap4_get_cpu1_ns_pa_addr(void); | ||
270 | |||
269 | #if defined(CONFIG_SMP) && defined(CONFIG_PM) | 271 | #if defined(CONFIG_SMP) && defined(CONFIG_PM) |
270 | extern int omap4_mpuss_init(void); | 272 | extern int omap4_mpuss_init(void); |
271 | extern int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state); | 273 | extern int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state); |
272 | extern int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state); | 274 | extern int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state); |
273 | extern u32 omap4_get_cpu1_ns_pa_addr(void); | ||
274 | #else | 275 | #else |
275 | static inline int omap4_enter_lowpower(unsigned int cpu, | 276 | static inline int omap4_enter_lowpower(unsigned int cpu, |
276 | unsigned int power_state) | 277 | unsigned int power_state) |
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c index 03ec6d307c82..4cfc4f9b2c69 100644 --- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c +++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c | |||
@@ -213,11 +213,6 @@ static void __init save_l2x0_context(void) | |||
213 | {} | 213 | {} |
214 | #endif | 214 | #endif |
215 | 215 | ||
216 | u32 omap4_get_cpu1_ns_pa_addr(void) | ||
217 | { | ||
218 | return old_cpu1_ns_pa_addr; | ||
219 | } | ||
220 | |||
221 | /** | 216 | /** |
222 | * omap4_enter_lowpower: OMAP4 MPUSS Low Power Entry Function | 217 | * omap4_enter_lowpower: OMAP4 MPUSS Low Power Entry Function |
223 | * The purpose of this function is to manage low power programming | 218 | * The purpose of this function is to manage low power programming |
@@ -457,6 +452,11 @@ int __init omap4_mpuss_init(void) | |||
457 | 452 | ||
458 | #endif | 453 | #endif |
459 | 454 | ||
455 | u32 omap4_get_cpu1_ns_pa_addr(void) | ||
456 | { | ||
457 | return old_cpu1_ns_pa_addr; | ||
458 | } | ||
459 | |||
460 | /* | 460 | /* |
461 | * For kexec, we must set CPU1_WAKEUP_NS_PA_ADDR to point to | 461 | * For kexec, we must set CPU1_WAKEUP_NS_PA_ADDR to point to |
462 | * current kernel's secondary_startup() early before | 462 | * current kernel's secondary_startup() early before |
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c index 3faf454ba487..33e4953c61a8 100644 --- a/arch/arm/mach-omap2/omap-smp.c +++ b/arch/arm/mach-omap2/omap-smp.c | |||
@@ -306,7 +306,6 @@ static void __init omap4_smp_maybe_reset_cpu1(struct omap_smp_config *c) | |||
306 | 306 | ||
307 | cpu1_startup_pa = readl_relaxed(cfg.wakeupgen_base + | 307 | cpu1_startup_pa = readl_relaxed(cfg.wakeupgen_base + |
308 | OMAP_AUX_CORE_BOOT_1); | 308 | OMAP_AUX_CORE_BOOT_1); |
309 | cpu1_ns_pa_addr = omap4_get_cpu1_ns_pa_addr(); | ||
310 | 309 | ||
311 | /* Did the configured secondary_startup() get overwritten? */ | 310 | /* Did the configured secondary_startup() get overwritten? */ |
312 | if (!omap4_smp_cpu1_startup_valid(cpu1_startup_pa)) | 311 | if (!omap4_smp_cpu1_startup_valid(cpu1_startup_pa)) |
@@ -316,9 +315,13 @@ static void __init omap4_smp_maybe_reset_cpu1(struct omap_smp_config *c) | |||
316 | * If omap4 or 5 has NS_PA_ADDR configured, CPU1 may be in a | 315 | * If omap4 or 5 has NS_PA_ADDR configured, CPU1 may be in a |
317 | * deeper idle state in WFI and will wake to an invalid address. | 316 | * deeper idle state in WFI and will wake to an invalid address. |
318 | */ | 317 | */ |
319 | if ((soc_is_omap44xx() || soc_is_omap54xx()) && | 318 | if ((soc_is_omap44xx() || soc_is_omap54xx())) { |
320 | !omap4_smp_cpu1_startup_valid(cpu1_ns_pa_addr)) | 319 | cpu1_ns_pa_addr = omap4_get_cpu1_ns_pa_addr(); |
321 | needs_reset = true; | 320 | if (!omap4_smp_cpu1_startup_valid(cpu1_ns_pa_addr)) |
321 | needs_reset = true; | ||
322 | } else { | ||
323 | cpu1_ns_pa_addr = 0; | ||
324 | } | ||
322 | 325 | ||
323 | if (!needs_reset || !c->cpu1_rstctrl_va) | 326 | if (!needs_reset || !c->cpu1_rstctrl_va) |
324 | return; | 327 | return; |
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c index 2b138b65129a..dc11841ca334 100644 --- a/arch/arm/mach-omap2/prm_common.c +++ b/arch/arm/mach-omap2/prm_common.c | |||
@@ -711,7 +711,7 @@ static struct omap_prcm_init_data scrm_data __initdata = { | |||
711 | }; | 711 | }; |
712 | #endif | 712 | #endif |
713 | 713 | ||
714 | static const struct of_device_id const omap_prcm_dt_match_table[] __initconst = { | 714 | static const struct of_device_id omap_prcm_dt_match_table[] __initconst = { |
715 | #ifdef CONFIG_SOC_AM33XX | 715 | #ifdef CONFIG_SOC_AM33XX |
716 | { .compatible = "ti,am3-prcm", .data = &am3_prm_data }, | 716 | { .compatible = "ti,am3-prcm", .data = &am3_prm_data }, |
717 | #endif | 717 | #endif |
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c index 2028167fff31..d76b1e5eb8ba 100644 --- a/arch/arm/mach-omap2/vc.c +++ b/arch/arm/mach-omap2/vc.c | |||
@@ -559,7 +559,7 @@ struct i2c_init_data { | |||
559 | u8 hsscll_12; | 559 | u8 hsscll_12; |
560 | }; | 560 | }; |
561 | 561 | ||
562 | static const struct i2c_init_data const omap4_i2c_timing_data[] __initconst = { | 562 | static const struct i2c_init_data omap4_i2c_timing_data[] __initconst = { |
563 | { | 563 | { |
564 | .load = 50, | 564 | .load = 50, |
565 | .loadbits = 0x3, | 565 | .loadbits = 0x3, |
diff --git a/arch/arm/mach-spear/time.c b/arch/arm/mach-spear/time.c index 4878ba90026d..289e036c9c30 100644 --- a/arch/arm/mach-spear/time.c +++ b/arch/arm/mach-spear/time.c | |||
@@ -204,7 +204,7 @@ static void __init spear_clockevent_init(int irq) | |||
204 | setup_irq(irq, &spear_timer_irq); | 204 | setup_irq(irq, &spear_timer_irq); |
205 | } | 205 | } |
206 | 206 | ||
207 | static const struct of_device_id const timer_of_match[] __initconst = { | 207 | static const struct of_device_id timer_of_match[] __initconst = { |
208 | { .compatible = "st,spear-timer", }, | 208 | { .compatible = "st,spear-timer", }, |
209 | { }, | 209 | { }, |
210 | }; | 210 | }; |
diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index 4afcffcb46cb..73272f43ca01 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms | |||
@@ -106,8 +106,13 @@ config ARCH_MVEBU | |||
106 | select ARMADA_AP806_SYSCON | 106 | select ARMADA_AP806_SYSCON |
107 | select ARMADA_CP110_SYSCON | 107 | select ARMADA_CP110_SYSCON |
108 | select ARMADA_37XX_CLK | 108 | select ARMADA_37XX_CLK |
109 | select GPIOLIB | ||
110 | select GPIOLIB_IRQCHIP | ||
109 | select MVEBU_ODMI | 111 | select MVEBU_ODMI |
110 | select MVEBU_PIC | 112 | select MVEBU_PIC |
113 | select OF_GPIO | ||
114 | select PINCTRL | ||
115 | select PINCTRL_ARMADA_37XX | ||
111 | help | 116 | help |
112 | This enables support for Marvell EBU familly, including: | 117 | This enables support for Marvell EBU familly, including: |
113 | - Armada 3700 SoC Family | 118 | - Armada 3700 SoC Family |
diff --git a/arch/arm64/boot/dts/include/arm b/arch/arm64/boot/dts/include/arm deleted file mode 120000 index cf63d80e2b93..000000000000 --- a/arch/arm64/boot/dts/include/arm +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | ../../../../arm/boot/dts \ No newline at end of file | ||
diff --git a/arch/arm64/boot/dts/include/arm64 b/arch/arm64/boot/dts/include/arm64 deleted file mode 120000 index a96aa0ea9d8c..000000000000 --- a/arch/arm64/boot/dts/include/arm64 +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | .. \ No newline at end of file | ||
diff --git a/arch/arm64/boot/dts/include/dt-bindings b/arch/arm64/boot/dts/include/dt-bindings deleted file mode 120000 index 08c00e4972fa..000000000000 --- a/arch/arm64/boot/dts/include/dt-bindings +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | ../../../../../include/dt-bindings \ No newline at end of file | ||
diff --git a/arch/arm64/boot/dts/marvell/armada-3720-db.dts b/arch/arm64/boot/dts/marvell/armada-3720-db.dts index cef5f976bc0f..a89855f57091 100644 --- a/arch/arm64/boot/dts/marvell/armada-3720-db.dts +++ b/arch/arm64/boot/dts/marvell/armada-3720-db.dts | |||
@@ -79,6 +79,8 @@ | |||
79 | }; | 79 | }; |
80 | 80 | ||
81 | &i2c0 { | 81 | &i2c0 { |
82 | pinctrl-names = "default"; | ||
83 | pinctrl-0 = <&i2c1_pins>; | ||
82 | status = "okay"; | 84 | status = "okay"; |
83 | 85 | ||
84 | gpio_exp: pca9555@22 { | 86 | gpio_exp: pca9555@22 { |
@@ -113,6 +115,8 @@ | |||
113 | 115 | ||
114 | &spi0 { | 116 | &spi0 { |
115 | status = "okay"; | 117 | status = "okay"; |
118 | pinctrl-names = "default"; | ||
119 | pinctrl-0 = <&spi_quad_pins>; | ||
116 | 120 | ||
117 | m25p80@0 { | 121 | m25p80@0 { |
118 | compatible = "jedec,spi-nor"; | 122 | compatible = "jedec,spi-nor"; |
@@ -143,6 +147,8 @@ | |||
143 | 147 | ||
144 | /* Exported on the micro USB connector CON32 through an FTDI */ | 148 | /* Exported on the micro USB connector CON32 through an FTDI */ |
145 | &uart0 { | 149 | &uart0 { |
150 | pinctrl-names = "default"; | ||
151 | pinctrl-0 = <&uart1_pins>; | ||
146 | status = "okay"; | 152 | status = "okay"; |
147 | }; | 153 | }; |
148 | 154 | ||
@@ -184,6 +190,8 @@ | |||
184 | }; | 190 | }; |
185 | 191 | ||
186 | ð0 { | 192 | ð0 { |
193 | pinctrl-names = "default"; | ||
194 | pinctrl-0 = <&rgmii_pins>; | ||
187 | phy-mode = "rgmii-id"; | 195 | phy-mode = "rgmii-id"; |
188 | phy = <&phy0>; | 196 | phy = <&phy0>; |
189 | status = "okay"; | 197 | status = "okay"; |
diff --git a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi index 58ae9e095af2..4d495ec39202 100644 --- a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi +++ b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi | |||
@@ -161,16 +161,83 @@ | |||
161 | #clock-cells = <1>; | 161 | #clock-cells = <1>; |
162 | }; | 162 | }; |
163 | 163 | ||
164 | gpio1: gpio@13800 { | 164 | pinctrl_nb: pinctrl@13800 { |
165 | compatible = "marvell,mvebu-gpio-3700", | 165 | compatible = "marvell,armada3710-nb-pinctrl", |
166 | "syscon", "simple-mfd"; | 166 | "syscon", "simple-mfd"; |
167 | reg = <0x13800 0x500>; | 167 | reg = <0x13800 0x100>, <0x13C00 0x20>; |
168 | gpionb: gpio { | ||
169 | #gpio-cells = <2>; | ||
170 | gpio-ranges = <&pinctrl_nb 0 0 36>; | ||
171 | gpio-controller; | ||
172 | interrupts = | ||
173 | <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>, | ||
174 | <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>, | ||
175 | <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>, | ||
176 | <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>, | ||
177 | <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>, | ||
178 | <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>, | ||
179 | <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>, | ||
180 | <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>, | ||
181 | <GIC_SPI 152 IRQ_TYPE_LEVEL_HIGH>, | ||
182 | <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>, | ||
183 | <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>, | ||
184 | <GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>; | ||
185 | |||
186 | }; | ||
168 | 187 | ||
169 | xtalclk: xtal-clk { | 188 | xtalclk: xtal-clk { |
170 | compatible = "marvell,armada-3700-xtal-clock"; | 189 | compatible = "marvell,armada-3700-xtal-clock"; |
171 | clock-output-names = "xtal"; | 190 | clock-output-names = "xtal"; |
172 | #clock-cells = <0>; | 191 | #clock-cells = <0>; |
173 | }; | 192 | }; |
193 | |||
194 | spi_quad_pins: spi-quad-pins { | ||
195 | groups = "spi_quad"; | ||
196 | function = "spi"; | ||
197 | }; | ||
198 | |||
199 | i2c1_pins: i2c1-pins { | ||
200 | groups = "i2c1"; | ||
201 | function = "i2c"; | ||
202 | }; | ||
203 | |||
204 | i2c2_pins: i2c2-pins { | ||
205 | groups = "i2c2"; | ||
206 | function = "i2c"; | ||
207 | }; | ||
208 | |||
209 | uart1_pins: uart1-pins { | ||
210 | groups = "uart1"; | ||
211 | function = "uart"; | ||
212 | }; | ||
213 | |||
214 | uart2_pins: uart2-pins { | ||
215 | groups = "uart2"; | ||
216 | function = "uart"; | ||
217 | }; | ||
218 | }; | ||
219 | |||
220 | pinctrl_sb: pinctrl@18800 { | ||
221 | compatible = "marvell,armada3710-sb-pinctrl", | ||
222 | "syscon", "simple-mfd"; | ||
223 | reg = <0x18800 0x100>, <0x18C00 0x20>; | ||
224 | gpiosb: gpio { | ||
225 | #gpio-cells = <2>; | ||
226 | gpio-ranges = <&pinctrl_sb 0 0 29>; | ||
227 | gpio-controller; | ||
228 | interrupts = | ||
229 | <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>, | ||
230 | <GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH>, | ||
231 | <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH>, | ||
232 | <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>, | ||
233 | <GIC_SPI 156 IRQ_TYPE_LEVEL_HIGH>; | ||
234 | }; | ||
235 | |||
236 | rgmii_pins: mii-pins { | ||
237 | groups = "rgmii"; | ||
238 | function = "mii"; | ||
239 | }; | ||
240 | |||
174 | }; | 241 | }; |
175 | 242 | ||
176 | eth0: ethernet@30000 { | 243 | eth0: ethernet@30000 { |
diff --git a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts index 0ecaad4333a7..1c3634fa94bf 100644 --- a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts +++ b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts | |||
@@ -134,6 +134,9 @@ | |||
134 | bus-width = <8>; | 134 | bus-width = <8>; |
135 | max-frequency = <50000000>; | 135 | max-frequency = <50000000>; |
136 | cap-mmc-highspeed; | 136 | cap-mmc-highspeed; |
137 | mediatek,hs200-cmd-int-delay=<26>; | ||
138 | mediatek,hs400-cmd-int-delay=<14>; | ||
139 | mediatek,hs400-cmd-resp-sel-rising; | ||
137 | vmmc-supply = <&mt6397_vemc_3v3_reg>; | 140 | vmmc-supply = <&mt6397_vemc_3v3_reg>; |
138 | vqmmc-supply = <&mt6397_vio18_reg>; | 141 | vqmmc-supply = <&mt6397_vio18_reg>; |
139 | non-removable; | 142 | non-removable; |
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts b/arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts index 658bb9dc9dfd..7bd31066399b 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts | |||
@@ -44,7 +44,7 @@ | |||
44 | 44 | ||
45 | /dts-v1/; | 45 | /dts-v1/; |
46 | #include "rk3399-gru.dtsi" | 46 | #include "rk3399-gru.dtsi" |
47 | #include <include/dt-bindings/input/linux-event-codes.h> | 47 | #include <dt-bindings/input/linux-event-codes.h> |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * Kevin-specific things | 50 | * Kevin-specific things |
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index ce072859e3b2..65cdd878cfbd 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig | |||
@@ -30,7 +30,6 @@ CONFIG_PROFILING=y | |||
30 | CONFIG_JUMP_LABEL=y | 30 | CONFIG_JUMP_LABEL=y |
31 | CONFIG_MODULES=y | 31 | CONFIG_MODULES=y |
32 | CONFIG_MODULE_UNLOAD=y | 32 | CONFIG_MODULE_UNLOAD=y |
33 | # CONFIG_BLK_DEV_BSG is not set | ||
34 | # CONFIG_IOSCHED_DEADLINE is not set | 33 | # CONFIG_IOSCHED_DEADLINE is not set |
35 | CONFIG_ARCH_SUNXI=y | 34 | CONFIG_ARCH_SUNXI=y |
36 | CONFIG_ARCH_ALPINE=y | 35 | CONFIG_ARCH_ALPINE=y |
@@ -62,16 +61,15 @@ CONFIG_ARCH_XGENE=y | |||
62 | CONFIG_ARCH_ZX=y | 61 | CONFIG_ARCH_ZX=y |
63 | CONFIG_ARCH_ZYNQMP=y | 62 | CONFIG_ARCH_ZYNQMP=y |
64 | CONFIG_PCI=y | 63 | CONFIG_PCI=y |
65 | CONFIG_PCI_MSI=y | ||
66 | CONFIG_PCI_IOV=y | 64 | CONFIG_PCI_IOV=y |
67 | CONFIG_PCI_AARDVARK=y | ||
68 | CONFIG_PCIE_RCAR=y | ||
69 | CONFIG_PCI_HOST_GENERIC=y | ||
70 | CONFIG_PCI_XGENE=y | ||
71 | CONFIG_PCI_LAYERSCAPE=y | 65 | CONFIG_PCI_LAYERSCAPE=y |
72 | CONFIG_PCI_HISI=y | 66 | CONFIG_PCI_HISI=y |
73 | CONFIG_PCIE_QCOM=y | 67 | CONFIG_PCIE_QCOM=y |
74 | CONFIG_PCIE_ARMADA_8K=y | 68 | CONFIG_PCIE_ARMADA_8K=y |
69 | CONFIG_PCI_AARDVARK=y | ||
70 | CONFIG_PCIE_RCAR=y | ||
71 | CONFIG_PCI_HOST_GENERIC=y | ||
72 | CONFIG_PCI_XGENE=y | ||
75 | CONFIG_ARM64_VA_BITS_48=y | 73 | CONFIG_ARM64_VA_BITS_48=y |
76 | CONFIG_SCHED_MC=y | 74 | CONFIG_SCHED_MC=y |
77 | CONFIG_NUMA=y | 75 | CONFIG_NUMA=y |
@@ -80,12 +78,11 @@ CONFIG_KSM=y | |||
80 | CONFIG_TRANSPARENT_HUGEPAGE=y | 78 | CONFIG_TRANSPARENT_HUGEPAGE=y |
81 | CONFIG_CMA=y | 79 | CONFIG_CMA=y |
82 | CONFIG_SECCOMP=y | 80 | CONFIG_SECCOMP=y |
83 | CONFIG_XEN=y | ||
84 | CONFIG_KEXEC=y | 81 | CONFIG_KEXEC=y |
85 | CONFIG_CRASH_DUMP=y | 82 | CONFIG_CRASH_DUMP=y |
83 | CONFIG_XEN=y | ||
86 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 84 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
87 | CONFIG_COMPAT=y | 85 | CONFIG_COMPAT=y |
88 | CONFIG_CPU_IDLE=y | ||
89 | CONFIG_HIBERNATION=y | 86 | CONFIG_HIBERNATION=y |
90 | CONFIG_ARM_CPUIDLE=y | 87 | CONFIG_ARM_CPUIDLE=y |
91 | CONFIG_CPU_FREQ=y | 88 | CONFIG_CPU_FREQ=y |
@@ -155,8 +152,8 @@ CONFIG_MTD_SPI_NOR=y | |||
155 | CONFIG_BLK_DEV_LOOP=y | 152 | CONFIG_BLK_DEV_LOOP=y |
156 | CONFIG_BLK_DEV_NBD=m | 153 | CONFIG_BLK_DEV_NBD=m |
157 | CONFIG_VIRTIO_BLK=y | 154 | CONFIG_VIRTIO_BLK=y |
158 | CONFIG_EEPROM_AT25=m | ||
159 | CONFIG_SRAM=y | 155 | CONFIG_SRAM=y |
156 | CONFIG_EEPROM_AT25=m | ||
160 | # CONFIG_SCSI_PROC_FS is not set | 157 | # CONFIG_SCSI_PROC_FS is not set |
161 | CONFIG_BLK_DEV_SD=y | 158 | CONFIG_BLK_DEV_SD=y |
162 | CONFIG_SCSI_SAS_ATA=y | 159 | CONFIG_SCSI_SAS_ATA=y |
@@ -168,8 +165,8 @@ CONFIG_AHCI_CEVA=y | |||
168 | CONFIG_AHCI_MVEBU=y | 165 | CONFIG_AHCI_MVEBU=y |
169 | CONFIG_AHCI_XGENE=y | 166 | CONFIG_AHCI_XGENE=y |
170 | CONFIG_AHCI_QORIQ=y | 167 | CONFIG_AHCI_QORIQ=y |
171 | CONFIG_SATA_RCAR=y | ||
172 | CONFIG_SATA_SIL24=y | 168 | CONFIG_SATA_SIL24=y |
169 | CONFIG_SATA_RCAR=y | ||
173 | CONFIG_PATA_PLATFORM=y | 170 | CONFIG_PATA_PLATFORM=y |
174 | CONFIG_PATA_OF_PLATFORM=y | 171 | CONFIG_PATA_OF_PLATFORM=y |
175 | CONFIG_NETDEVICES=y | 172 | CONFIG_NETDEVICES=y |
@@ -186,18 +183,17 @@ CONFIG_HNS_ENET=y | |||
186 | CONFIG_E1000E=y | 183 | CONFIG_E1000E=y |
187 | CONFIG_IGB=y | 184 | CONFIG_IGB=y |
188 | CONFIG_IGBVF=y | 185 | CONFIG_IGBVF=y |
189 | CONFIG_MVPP2=y | ||
190 | CONFIG_MVNETA=y | 186 | CONFIG_MVNETA=y |
187 | CONFIG_MVPP2=y | ||
191 | CONFIG_SKY2=y | 188 | CONFIG_SKY2=y |
192 | CONFIG_RAVB=y | 189 | CONFIG_RAVB=y |
193 | CONFIG_SMC91X=y | 190 | CONFIG_SMC91X=y |
194 | CONFIG_SMSC911X=y | 191 | CONFIG_SMSC911X=y |
195 | CONFIG_STMMAC_ETH=m | 192 | CONFIG_STMMAC_ETH=m |
196 | CONFIG_REALTEK_PHY=m | 193 | CONFIG_MDIO_BUS_MUX_MMIOREG=y |
197 | CONFIG_MESON_GXL_PHY=m | 194 | CONFIG_MESON_GXL_PHY=m |
198 | CONFIG_MICREL_PHY=y | 195 | CONFIG_MICREL_PHY=y |
199 | CONFIG_MDIO_BUS_MUX=y | 196 | CONFIG_REALTEK_PHY=m |
200 | CONFIG_MDIO_BUS_MUX_MMIOREG=y | ||
201 | CONFIG_USB_PEGASUS=m | 197 | CONFIG_USB_PEGASUS=m |
202 | CONFIG_USB_RTL8150=m | 198 | CONFIG_USB_RTL8150=m |
203 | CONFIG_USB_RTL8152=m | 199 | CONFIG_USB_RTL8152=m |
@@ -230,14 +226,14 @@ CONFIG_SERIAL_8250_UNIPHIER=y | |||
230 | CONFIG_SERIAL_OF_PLATFORM=y | 226 | CONFIG_SERIAL_OF_PLATFORM=y |
231 | CONFIG_SERIAL_AMBA_PL011=y | 227 | CONFIG_SERIAL_AMBA_PL011=y |
232 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y | 228 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y |
229 | CONFIG_SERIAL_MESON=y | ||
230 | CONFIG_SERIAL_MESON_CONSOLE=y | ||
233 | CONFIG_SERIAL_SAMSUNG=y | 231 | CONFIG_SERIAL_SAMSUNG=y |
234 | CONFIG_SERIAL_SAMSUNG_CONSOLE=y | 232 | CONFIG_SERIAL_SAMSUNG_CONSOLE=y |
235 | CONFIG_SERIAL_TEGRA=y | 233 | CONFIG_SERIAL_TEGRA=y |
236 | CONFIG_SERIAL_SH_SCI=y | 234 | CONFIG_SERIAL_SH_SCI=y |
237 | CONFIG_SERIAL_SH_SCI_NR_UARTS=11 | 235 | CONFIG_SERIAL_SH_SCI_NR_UARTS=11 |
238 | CONFIG_SERIAL_SH_SCI_CONSOLE=y | 236 | CONFIG_SERIAL_SH_SCI_CONSOLE=y |
239 | CONFIG_SERIAL_MESON=y | ||
240 | CONFIG_SERIAL_MESON_CONSOLE=y | ||
241 | CONFIG_SERIAL_MSM=y | 237 | CONFIG_SERIAL_MSM=y |
242 | CONFIG_SERIAL_MSM_CONSOLE=y | 238 | CONFIG_SERIAL_MSM_CONSOLE=y |
243 | CONFIG_SERIAL_XILINX_PS_UART=y | 239 | CONFIG_SERIAL_XILINX_PS_UART=y |
@@ -261,14 +257,14 @@ CONFIG_I2C_UNIPHIER_F=y | |||
261 | CONFIG_I2C_RCAR=y | 257 | CONFIG_I2C_RCAR=y |
262 | CONFIG_I2C_CROS_EC_TUNNEL=y | 258 | CONFIG_I2C_CROS_EC_TUNNEL=y |
263 | CONFIG_SPI=y | 259 | CONFIG_SPI=y |
264 | CONFIG_SPI_MESON_SPIFC=m | ||
265 | CONFIG_SPI_BCM2835=m | 260 | CONFIG_SPI_BCM2835=m |
266 | CONFIG_SPI_BCM2835AUX=m | 261 | CONFIG_SPI_BCM2835AUX=m |
262 | CONFIG_SPI_MESON_SPIFC=m | ||
267 | CONFIG_SPI_ORION=y | 263 | CONFIG_SPI_ORION=y |
268 | CONFIG_SPI_PL022=y | 264 | CONFIG_SPI_PL022=y |
269 | CONFIG_SPI_QUP=y | 265 | CONFIG_SPI_QUP=y |
270 | CONFIG_SPI_SPIDEV=m | ||
271 | CONFIG_SPI_S3C64XX=y | 266 | CONFIG_SPI_S3C64XX=y |
267 | CONFIG_SPI_SPIDEV=m | ||
272 | CONFIG_SPMI=y | 268 | CONFIG_SPMI=y |
273 | CONFIG_PINCTRL_SINGLE=y | 269 | CONFIG_PINCTRL_SINGLE=y |
274 | CONFIG_PINCTRL_MAX77620=y | 270 | CONFIG_PINCTRL_MAX77620=y |
@@ -286,33 +282,30 @@ CONFIG_GPIO_PCA953X=y | |||
286 | CONFIG_GPIO_PCA953X_IRQ=y | 282 | CONFIG_GPIO_PCA953X_IRQ=y |
287 | CONFIG_GPIO_MAX77620=y | 283 | CONFIG_GPIO_MAX77620=y |
288 | CONFIG_POWER_RESET_MSM=y | 284 | CONFIG_POWER_RESET_MSM=y |
289 | CONFIG_BATTERY_BQ27XXX=y | ||
290 | CONFIG_POWER_RESET_XGENE=y | 285 | CONFIG_POWER_RESET_XGENE=y |
291 | CONFIG_POWER_RESET_SYSCON=y | 286 | CONFIG_POWER_RESET_SYSCON=y |
287 | CONFIG_BATTERY_BQ27XXX=y | ||
288 | CONFIG_SENSORS_ARM_SCPI=y | ||
292 | CONFIG_SENSORS_LM90=m | 289 | CONFIG_SENSORS_LM90=m |
293 | CONFIG_SENSORS_INA2XX=m | 290 | CONFIG_SENSORS_INA2XX=m |
294 | CONFIG_SENSORS_ARM_SCPI=y | ||
295 | CONFIG_THERMAL=y | ||
296 | CONFIG_THERMAL_EMULATION=y | ||
297 | CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y | 291 | CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y |
298 | CONFIG_CPU_THERMAL=y | 292 | CONFIG_CPU_THERMAL=y |
299 | CONFIG_BCM2835_THERMAL=y | 293 | CONFIG_THERMAL_EMULATION=y |
300 | CONFIG_EXYNOS_THERMAL=y | 294 | CONFIG_EXYNOS_THERMAL=y |
301 | CONFIG_WATCHDOG=y | 295 | CONFIG_WATCHDOG=y |
302 | CONFIG_BCM2835_WDT=y | ||
303 | CONFIG_RENESAS_WDT=y | ||
304 | CONFIG_S3C2410_WATCHDOG=y | 296 | CONFIG_S3C2410_WATCHDOG=y |
305 | CONFIG_MESON_GXBB_WATCHDOG=m | 297 | CONFIG_MESON_GXBB_WATCHDOG=m |
306 | CONFIG_MESON_WATCHDOG=m | 298 | CONFIG_MESON_WATCHDOG=m |
299 | CONFIG_RENESAS_WDT=y | ||
300 | CONFIG_BCM2835_WDT=y | ||
301 | CONFIG_MFD_CROS_EC=y | ||
302 | CONFIG_MFD_CROS_EC_I2C=y | ||
307 | CONFIG_MFD_EXYNOS_LPASS=m | 303 | CONFIG_MFD_EXYNOS_LPASS=m |
304 | CONFIG_MFD_HI655X_PMIC=y | ||
308 | CONFIG_MFD_MAX77620=y | 305 | CONFIG_MFD_MAX77620=y |
309 | CONFIG_MFD_RK808=y | ||
310 | CONFIG_MFD_SPMI_PMIC=y | 306 | CONFIG_MFD_SPMI_PMIC=y |
307 | CONFIG_MFD_RK808=y | ||
311 | CONFIG_MFD_SEC_CORE=y | 308 | CONFIG_MFD_SEC_CORE=y |
312 | CONFIG_MFD_HI655X_PMIC=y | ||
313 | CONFIG_REGULATOR=y | ||
314 | CONFIG_MFD_CROS_EC=y | ||
315 | CONFIG_MFD_CROS_EC_I2C=y | ||
316 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | 309 | CONFIG_REGULATOR_FIXED_VOLTAGE=y |
317 | CONFIG_REGULATOR_GPIO=y | 310 | CONFIG_REGULATOR_GPIO=y |
318 | CONFIG_REGULATOR_HI655X=y | 311 | CONFIG_REGULATOR_HI655X=y |
@@ -345,13 +338,12 @@ CONFIG_DRM_EXYNOS_DSI=y | |||
345 | CONFIG_DRM_EXYNOS_HDMI=y | 338 | CONFIG_DRM_EXYNOS_HDMI=y |
346 | CONFIG_DRM_EXYNOS_MIC=y | 339 | CONFIG_DRM_EXYNOS_MIC=y |
347 | CONFIG_DRM_RCAR_DU=m | 340 | CONFIG_DRM_RCAR_DU=m |
348 | CONFIG_DRM_RCAR_HDMI=y | ||
349 | CONFIG_DRM_RCAR_LVDS=y | 341 | CONFIG_DRM_RCAR_LVDS=y |
350 | CONFIG_DRM_RCAR_VSP=y | 342 | CONFIG_DRM_RCAR_VSP=y |
351 | CONFIG_DRM_TEGRA=m | 343 | CONFIG_DRM_TEGRA=m |
352 | CONFIG_DRM_VC4=m | ||
353 | CONFIG_DRM_PANEL_SIMPLE=m | 344 | CONFIG_DRM_PANEL_SIMPLE=m |
354 | CONFIG_DRM_I2C_ADV7511=m | 345 | CONFIG_DRM_I2C_ADV7511=m |
346 | CONFIG_DRM_VC4=m | ||
355 | CONFIG_DRM_HISI_KIRIN=m | 347 | CONFIG_DRM_HISI_KIRIN=m |
356 | CONFIG_DRM_MESON=m | 348 | CONFIG_DRM_MESON=m |
357 | CONFIG_FB=y | 349 | CONFIG_FB=y |
@@ -366,39 +358,37 @@ CONFIG_SOUND=y | |||
366 | CONFIG_SND=y | 358 | CONFIG_SND=y |
367 | CONFIG_SND_SOC=y | 359 | CONFIG_SND_SOC=y |
368 | CONFIG_SND_BCM2835_SOC_I2S=m | 360 | CONFIG_SND_BCM2835_SOC_I2S=m |
369 | CONFIG_SND_SOC_RCAR=y | ||
370 | CONFIG_SND_SOC_SAMSUNG=y | 361 | CONFIG_SND_SOC_SAMSUNG=y |
362 | CONFIG_SND_SOC_RCAR=y | ||
371 | CONFIG_SND_SOC_AK4613=y | 363 | CONFIG_SND_SOC_AK4613=y |
372 | CONFIG_USB=y | 364 | CONFIG_USB=y |
373 | CONFIG_USB_OTG=y | 365 | CONFIG_USB_OTG=y |
374 | CONFIG_USB_XHCI_HCD=y | 366 | CONFIG_USB_XHCI_HCD=y |
375 | CONFIG_USB_XHCI_PLATFORM=y | ||
376 | CONFIG_USB_XHCI_RCAR=y | ||
377 | CONFIG_USB_EHCI_EXYNOS=y | ||
378 | CONFIG_USB_XHCI_TEGRA=y | 367 | CONFIG_USB_XHCI_TEGRA=y |
379 | CONFIG_USB_EHCI_HCD=y | 368 | CONFIG_USB_EHCI_HCD=y |
380 | CONFIG_USB_EHCI_MSM=y | 369 | CONFIG_USB_EHCI_MSM=y |
370 | CONFIG_USB_EHCI_EXYNOS=y | ||
381 | CONFIG_USB_EHCI_HCD_PLATFORM=y | 371 | CONFIG_USB_EHCI_HCD_PLATFORM=y |
382 | CONFIG_USB_OHCI_EXYNOS=y | ||
383 | CONFIG_USB_OHCI_HCD=y | 372 | CONFIG_USB_OHCI_HCD=y |
373 | CONFIG_USB_OHCI_EXYNOS=y | ||
384 | CONFIG_USB_OHCI_HCD_PLATFORM=y | 374 | CONFIG_USB_OHCI_HCD_PLATFORM=y |
385 | CONFIG_USB_RENESAS_USBHS=m | 375 | CONFIG_USB_RENESAS_USBHS=m |
386 | CONFIG_USB_STORAGE=y | 376 | CONFIG_USB_STORAGE=y |
387 | CONFIG_USB_DWC2=y | ||
388 | CONFIG_USB_DWC3=y | 377 | CONFIG_USB_DWC3=y |
378 | CONFIG_USB_DWC2=y | ||
389 | CONFIG_USB_CHIPIDEA=y | 379 | CONFIG_USB_CHIPIDEA=y |
390 | CONFIG_USB_CHIPIDEA_UDC=y | 380 | CONFIG_USB_CHIPIDEA_UDC=y |
391 | CONFIG_USB_CHIPIDEA_HOST=y | 381 | CONFIG_USB_CHIPIDEA_HOST=y |
392 | CONFIG_USB_ISP1760=y | 382 | CONFIG_USB_ISP1760=y |
393 | CONFIG_USB_HSIC_USB3503=y | 383 | CONFIG_USB_HSIC_USB3503=y |
394 | CONFIG_USB_MSM_OTG=y | 384 | CONFIG_USB_MSM_OTG=y |
385 | CONFIG_USB_QCOM_8X16_PHY=y | ||
395 | CONFIG_USB_ULPI=y | 386 | CONFIG_USB_ULPI=y |
396 | CONFIG_USB_GADGET=y | 387 | CONFIG_USB_GADGET=y |
397 | CONFIG_USB_RENESAS_USBHS_UDC=m | 388 | CONFIG_USB_RENESAS_USBHS_UDC=m |
398 | CONFIG_MMC=y | 389 | CONFIG_MMC=y |
399 | CONFIG_MMC_BLOCK_MINORS=32 | 390 | CONFIG_MMC_BLOCK_MINORS=32 |
400 | CONFIG_MMC_ARMMMCI=y | 391 | CONFIG_MMC_ARMMMCI=y |
401 | CONFIG_MMC_MESON_GX=y | ||
402 | CONFIG_MMC_SDHCI=y | 392 | CONFIG_MMC_SDHCI=y |
403 | CONFIG_MMC_SDHCI_ACPI=y | 393 | CONFIG_MMC_SDHCI_ACPI=y |
404 | CONFIG_MMC_SDHCI_PLTFM=y | 394 | CONFIG_MMC_SDHCI_PLTFM=y |
@@ -406,6 +396,7 @@ CONFIG_MMC_SDHCI_OF_ARASAN=y | |||
406 | CONFIG_MMC_SDHCI_OF_ESDHC=y | 396 | CONFIG_MMC_SDHCI_OF_ESDHC=y |
407 | CONFIG_MMC_SDHCI_CADENCE=y | 397 | CONFIG_MMC_SDHCI_CADENCE=y |
408 | CONFIG_MMC_SDHCI_TEGRA=y | 398 | CONFIG_MMC_SDHCI_TEGRA=y |
399 | CONFIG_MMC_MESON_GX=y | ||
409 | CONFIG_MMC_SDHCI_MSM=y | 400 | CONFIG_MMC_SDHCI_MSM=y |
410 | CONFIG_MMC_SPI=y | 401 | CONFIG_MMC_SPI=y |
411 | CONFIG_MMC_SDHI=y | 402 | CONFIG_MMC_SDHI=y |
@@ -414,32 +405,31 @@ CONFIG_MMC_DW_EXYNOS=y | |||
414 | CONFIG_MMC_DW_K3=y | 405 | CONFIG_MMC_DW_K3=y |
415 | CONFIG_MMC_DW_ROCKCHIP=y | 406 | CONFIG_MMC_DW_ROCKCHIP=y |
416 | CONFIG_MMC_SUNXI=y | 407 | CONFIG_MMC_SUNXI=y |
417 | CONFIG_MMC_SDHCI_XENON=y | ||
418 | CONFIG_MMC_BCM2835=y | 408 | CONFIG_MMC_BCM2835=y |
409 | CONFIG_MMC_SDHCI_XENON=y | ||
419 | CONFIG_NEW_LEDS=y | 410 | CONFIG_NEW_LEDS=y |
420 | CONFIG_LEDS_CLASS=y | 411 | CONFIG_LEDS_CLASS=y |
421 | CONFIG_LEDS_GPIO=y | 412 | CONFIG_LEDS_GPIO=y |
422 | CONFIG_LEDS_PWM=y | 413 | CONFIG_LEDS_PWM=y |
423 | CONFIG_LEDS_SYSCON=y | 414 | CONFIG_LEDS_SYSCON=y |
424 | CONFIG_LEDS_TRIGGERS=y | ||
425 | CONFIG_LEDS_TRIGGER_DEFAULT_ON=y | ||
426 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | 415 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y |
427 | CONFIG_LEDS_TRIGGER_CPU=y | 416 | CONFIG_LEDS_TRIGGER_CPU=y |
417 | CONFIG_LEDS_TRIGGER_DEFAULT_ON=y | ||
428 | CONFIG_RTC_CLASS=y | 418 | CONFIG_RTC_CLASS=y |
429 | CONFIG_RTC_DRV_MAX77686=y | 419 | CONFIG_RTC_DRV_MAX77686=y |
420 | CONFIG_RTC_DRV_RK808=m | ||
430 | CONFIG_RTC_DRV_S5M=y | 421 | CONFIG_RTC_DRV_S5M=y |
431 | CONFIG_RTC_DRV_DS3232=y | 422 | CONFIG_RTC_DRV_DS3232=y |
432 | CONFIG_RTC_DRV_EFI=y | 423 | CONFIG_RTC_DRV_EFI=y |
424 | CONFIG_RTC_DRV_S3C=y | ||
433 | CONFIG_RTC_DRV_PL031=y | 425 | CONFIG_RTC_DRV_PL031=y |
434 | CONFIG_RTC_DRV_SUN6I=y | 426 | CONFIG_RTC_DRV_SUN6I=y |
435 | CONFIG_RTC_DRV_RK808=m | ||
436 | CONFIG_RTC_DRV_TEGRA=y | 427 | CONFIG_RTC_DRV_TEGRA=y |
437 | CONFIG_RTC_DRV_XGENE=y | 428 | CONFIG_RTC_DRV_XGENE=y |
438 | CONFIG_RTC_DRV_S3C=y | ||
439 | CONFIG_DMADEVICES=y | 429 | CONFIG_DMADEVICES=y |
430 | CONFIG_DMA_BCM2835=m | ||
440 | CONFIG_MV_XOR_V2=y | 431 | CONFIG_MV_XOR_V2=y |
441 | CONFIG_PL330_DMA=y | 432 | CONFIG_PL330_DMA=y |
442 | CONFIG_DMA_BCM2835=m | ||
443 | CONFIG_TEGRA20_APB_DMA=y | 433 | CONFIG_TEGRA20_APB_DMA=y |
444 | CONFIG_QCOM_BAM_DMA=y | 434 | CONFIG_QCOM_BAM_DMA=y |
445 | CONFIG_QCOM_HIDMA_MGMT=y | 435 | CONFIG_QCOM_HIDMA_MGMT=y |
@@ -452,52 +442,53 @@ CONFIG_VIRTIO_BALLOON=y | |||
452 | CONFIG_VIRTIO_MMIO=y | 442 | CONFIG_VIRTIO_MMIO=y |
453 | CONFIG_XEN_GNTDEV=y | 443 | CONFIG_XEN_GNTDEV=y |
454 | CONFIG_XEN_GRANT_DEV_ALLOC=y | 444 | CONFIG_XEN_GRANT_DEV_ALLOC=y |
445 | CONFIG_COMMON_CLK_RK808=y | ||
455 | CONFIG_COMMON_CLK_SCPI=y | 446 | CONFIG_COMMON_CLK_SCPI=y |
456 | CONFIG_COMMON_CLK_CS2000_CP=y | 447 | CONFIG_COMMON_CLK_CS2000_CP=y |
457 | CONFIG_COMMON_CLK_S2MPS11=y | 448 | CONFIG_COMMON_CLK_S2MPS11=y |
458 | CONFIG_COMMON_CLK_PWM=y | ||
459 | CONFIG_COMMON_CLK_RK808=y | ||
460 | CONFIG_CLK_QORIQ=y | 449 | CONFIG_CLK_QORIQ=y |
450 | CONFIG_COMMON_CLK_PWM=y | ||
461 | CONFIG_COMMON_CLK_QCOM=y | 451 | CONFIG_COMMON_CLK_QCOM=y |
452 | CONFIG_QCOM_CLK_SMD_RPM=y | ||
462 | CONFIG_MSM_GCC_8916=y | 453 | CONFIG_MSM_GCC_8916=y |
463 | CONFIG_MSM_GCC_8994=y | 454 | CONFIG_MSM_GCC_8994=y |
464 | CONFIG_MSM_MMCC_8996=y | 455 | CONFIG_MSM_MMCC_8996=y |
465 | CONFIG_HWSPINLOCK_QCOM=y | 456 | CONFIG_HWSPINLOCK_QCOM=y |
466 | CONFIG_MAILBOX=y | ||
467 | CONFIG_ARM_MHU=y | 457 | CONFIG_ARM_MHU=y |
468 | CONFIG_PLATFORM_MHU=y | 458 | CONFIG_PLATFORM_MHU=y |
469 | CONFIG_BCM2835_MBOX=y | 459 | CONFIG_BCM2835_MBOX=y |
470 | CONFIG_HI6220_MBOX=y | 460 | CONFIG_HI6220_MBOX=y |
471 | CONFIG_ARM_SMMU=y | 461 | CONFIG_ARM_SMMU=y |
472 | CONFIG_ARM_SMMU_V3=y | 462 | CONFIG_ARM_SMMU_V3=y |
463 | CONFIG_RPMSG_QCOM_SMD=y | ||
473 | CONFIG_RASPBERRYPI_POWER=y | 464 | CONFIG_RASPBERRYPI_POWER=y |
474 | CONFIG_QCOM_SMEM=y | 465 | CONFIG_QCOM_SMEM=y |
475 | CONFIG_QCOM_SMD=y | ||
476 | CONFIG_QCOM_SMD_RPM=y | 466 | CONFIG_QCOM_SMD_RPM=y |
467 | CONFIG_QCOM_SMP2P=y | ||
468 | CONFIG_QCOM_SMSM=y | ||
477 | CONFIG_ROCKCHIP_PM_DOMAINS=y | 469 | CONFIG_ROCKCHIP_PM_DOMAINS=y |
478 | CONFIG_ARCH_TEGRA_132_SOC=y | 470 | CONFIG_ARCH_TEGRA_132_SOC=y |
479 | CONFIG_ARCH_TEGRA_210_SOC=y | 471 | CONFIG_ARCH_TEGRA_210_SOC=y |
480 | CONFIG_ARCH_TEGRA_186_SOC=y | 472 | CONFIG_ARCH_TEGRA_186_SOC=y |
481 | CONFIG_EXTCON_USB_GPIO=y | 473 | CONFIG_EXTCON_USB_GPIO=y |
474 | CONFIG_IIO=y | ||
475 | CONFIG_EXYNOS_ADC=y | ||
482 | CONFIG_PWM=y | 476 | CONFIG_PWM=y |
483 | CONFIG_PWM_BCM2835=m | 477 | CONFIG_PWM_BCM2835=m |
478 | CONFIG_PWM_MESON=m | ||
484 | CONFIG_PWM_ROCKCHIP=y | 479 | CONFIG_PWM_ROCKCHIP=y |
480 | CONFIG_PWM_SAMSUNG=y | ||
485 | CONFIG_PWM_TEGRA=m | 481 | CONFIG_PWM_TEGRA=m |
486 | CONFIG_PWM_MESON=m | ||
487 | CONFIG_COMMON_RESET_HI6220=y | ||
488 | CONFIG_PHY_RCAR_GEN3_USB2=y | 482 | CONFIG_PHY_RCAR_GEN3_USB2=y |
489 | CONFIG_PHY_HI6220_USB=y | 483 | CONFIG_PHY_HI6220_USB=y |
484 | CONFIG_PHY_SUN4I_USB=y | ||
490 | CONFIG_PHY_ROCKCHIP_INNO_USB2=y | 485 | CONFIG_PHY_ROCKCHIP_INNO_USB2=y |
491 | CONFIG_PHY_ROCKCHIP_EMMC=y | 486 | CONFIG_PHY_ROCKCHIP_EMMC=y |
492 | CONFIG_PHY_SUN4I_USB=y | ||
493 | CONFIG_PHY_XGENE=y | 487 | CONFIG_PHY_XGENE=y |
494 | CONFIG_PHY_TEGRA_XUSB=y | 488 | CONFIG_PHY_TEGRA_XUSB=y |
495 | CONFIG_ARM_SCPI_PROTOCOL=y | 489 | CONFIG_ARM_SCPI_PROTOCOL=y |
496 | CONFIG_ACPI=y | ||
497 | CONFIG_IIO=y | ||
498 | CONFIG_EXYNOS_ADC=y | ||
499 | CONFIG_PWM_SAMSUNG=y | ||
500 | CONFIG_RASPBERRYPI_FIRMWARE=y | 490 | CONFIG_RASPBERRYPI_FIRMWARE=y |
491 | CONFIG_ACPI=y | ||
501 | CONFIG_EXT2_FS=y | 492 | CONFIG_EXT2_FS=y |
502 | CONFIG_EXT3_FS=y | 493 | CONFIG_EXT3_FS=y |
503 | CONFIG_EXT4_FS_POSIX_ACL=y | 494 | CONFIG_EXT4_FS_POSIX_ACL=y |
@@ -511,7 +502,6 @@ CONFIG_FUSE_FS=m | |||
511 | CONFIG_CUSE=m | 502 | CONFIG_CUSE=m |
512 | CONFIG_OVERLAY_FS=m | 503 | CONFIG_OVERLAY_FS=m |
513 | CONFIG_VFAT_FS=y | 504 | CONFIG_VFAT_FS=y |
514 | CONFIG_TMPFS=y | ||
515 | CONFIG_HUGETLBFS=y | 505 | CONFIG_HUGETLBFS=y |
516 | CONFIG_CONFIGFS_FS=y | 506 | CONFIG_CONFIGFS_FS=y |
517 | CONFIG_EFIVAR_FS=y | 507 | CONFIG_EFIVAR_FS=y |
@@ -539,11 +529,9 @@ CONFIG_MEMTEST=y | |||
539 | CONFIG_SECURITY=y | 529 | CONFIG_SECURITY=y |
540 | CONFIG_CRYPTO_ECHAINIV=y | 530 | CONFIG_CRYPTO_ECHAINIV=y |
541 | CONFIG_CRYPTO_ANSI_CPRNG=y | 531 | CONFIG_CRYPTO_ANSI_CPRNG=y |
542 | CONFIG_CRYPTO_DEV_SAFEXCEL=m | ||
543 | CONFIG_ARM64_CRYPTO=y | 532 | CONFIG_ARM64_CRYPTO=y |
544 | CONFIG_CRYPTO_SHA1_ARM64_CE=y | 533 | CONFIG_CRYPTO_SHA1_ARM64_CE=y |
545 | CONFIG_CRYPTO_SHA2_ARM64_CE=y | 534 | CONFIG_CRYPTO_SHA2_ARM64_CE=y |
546 | CONFIG_CRYPTO_GHASH_ARM64_CE=y | 535 | CONFIG_CRYPTO_GHASH_ARM64_CE=y |
547 | CONFIG_CRYPTO_AES_ARM64_CE_CCM=y | 536 | CONFIG_CRYPTO_AES_ARM64_CE_CCM=y |
548 | CONFIG_CRYPTO_AES_ARM64_CE_BLK=y | 537 | CONFIG_CRYPTO_AES_ARM64_CE_BLK=y |
549 | # CONFIG_CRYPTO_AES_ARM64_NEON_BLK is not set | ||
diff --git a/arch/arm64/include/asm/atomic_ll_sc.h b/arch/arm64/include/asm/atomic_ll_sc.h index f819fdcff1ac..f5a2d09afb38 100644 --- a/arch/arm64/include/asm/atomic_ll_sc.h +++ b/arch/arm64/include/asm/atomic_ll_sc.h | |||
@@ -264,7 +264,6 @@ __LL_SC_PREFIX(__cmpxchg_case_##name(volatile void *ptr, \ | |||
264 | " st" #rel "xr" #sz "\t%w[tmp], %" #w "[new], %[v]\n" \ | 264 | " st" #rel "xr" #sz "\t%w[tmp], %" #w "[new], %[v]\n" \ |
265 | " cbnz %w[tmp], 1b\n" \ | 265 | " cbnz %w[tmp], 1b\n" \ |
266 | " " #mb "\n" \ | 266 | " " #mb "\n" \ |
267 | " mov %" #w "[oldval], %" #w "[old]\n" \ | ||
268 | "2:" \ | 267 | "2:" \ |
269 | : [tmp] "=&r" (tmp), [oldval] "=&r" (oldval), \ | 268 | : [tmp] "=&r" (tmp), [oldval] "=&r" (oldval), \ |
270 | [v] "+Q" (*(unsigned long *)ptr) \ | 269 | [v] "+Q" (*(unsigned long *)ptr) \ |
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index e7f84a7b4465..428ee1f2468c 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h | |||
@@ -115,6 +115,7 @@ struct arm64_cpu_capabilities { | |||
115 | 115 | ||
116 | extern DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS); | 116 | extern DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS); |
117 | extern struct static_key_false cpu_hwcap_keys[ARM64_NCAPS]; | 117 | extern struct static_key_false cpu_hwcap_keys[ARM64_NCAPS]; |
118 | extern struct static_key_false arm64_const_caps_ready; | ||
118 | 119 | ||
119 | bool this_cpu_has_cap(unsigned int cap); | 120 | bool this_cpu_has_cap(unsigned int cap); |
120 | 121 | ||
@@ -124,7 +125,7 @@ static inline bool cpu_have_feature(unsigned int num) | |||
124 | } | 125 | } |
125 | 126 | ||
126 | /* System capability check for constant caps */ | 127 | /* System capability check for constant caps */ |
127 | static inline bool cpus_have_const_cap(int num) | 128 | static inline bool __cpus_have_const_cap(int num) |
128 | { | 129 | { |
129 | if (num >= ARM64_NCAPS) | 130 | if (num >= ARM64_NCAPS) |
130 | return false; | 131 | return false; |
@@ -138,6 +139,14 @@ static inline bool cpus_have_cap(unsigned int num) | |||
138 | return test_bit(num, cpu_hwcaps); | 139 | return test_bit(num, cpu_hwcaps); |
139 | } | 140 | } |
140 | 141 | ||
142 | static inline bool cpus_have_const_cap(int num) | ||
143 | { | ||
144 | if (static_branch_likely(&arm64_const_caps_ready)) | ||
145 | return __cpus_have_const_cap(num); | ||
146 | else | ||
147 | return cpus_have_cap(num); | ||
148 | } | ||
149 | |||
141 | static inline void cpus_set_cap(unsigned int num) | 150 | static inline void cpus_set_cap(unsigned int num) |
142 | { | 151 | { |
143 | if (num >= ARM64_NCAPS) { | 152 | if (num >= ARM64_NCAPS) { |
@@ -145,7 +154,6 @@ static inline void cpus_set_cap(unsigned int num) | |||
145 | num, ARM64_NCAPS); | 154 | num, ARM64_NCAPS); |
146 | } else { | 155 | } else { |
147 | __set_bit(num, cpu_hwcaps); | 156 | __set_bit(num, cpu_hwcaps); |
148 | static_branch_enable(&cpu_hwcap_keys[num]); | ||
149 | } | 157 | } |
150 | } | 158 | } |
151 | 159 | ||
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 5e19165c5fa8..1f252a95bc02 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/kvm_types.h> | 26 | #include <linux/kvm_types.h> |
27 | #include <asm/cpufeature.h> | ||
27 | #include <asm/kvm.h> | 28 | #include <asm/kvm.h> |
28 | #include <asm/kvm_asm.h> | 29 | #include <asm/kvm_asm.h> |
29 | #include <asm/kvm_mmio.h> | 30 | #include <asm/kvm_mmio.h> |
@@ -355,9 +356,12 @@ static inline void __cpu_init_hyp_mode(phys_addr_t pgd_ptr, | |||
355 | unsigned long vector_ptr) | 356 | unsigned long vector_ptr) |
356 | { | 357 | { |
357 | /* | 358 | /* |
358 | * Call initialization code, and switch to the full blown | 359 | * Call initialization code, and switch to the full blown HYP code. |
359 | * HYP code. | 360 | * If the cpucaps haven't been finalized yet, something has gone very |
361 | * wrong, and hyp will crash and burn when it uses any | ||
362 | * cpus_have_const_cap() wrapper. | ||
360 | */ | 363 | */ |
364 | BUG_ON(!static_branch_likely(&arm64_const_caps_ready)); | ||
361 | __kvm_call_hyp((void *)pgd_ptr, hyp_stack_ptr, vector_ptr); | 365 | __kvm_call_hyp((void *)pgd_ptr, hyp_stack_ptr, vector_ptr); |
362 | } | 366 | } |
363 | 367 | ||
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 94b8f7fc3310..817ce3365e20 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c | |||
@@ -985,8 +985,16 @@ void update_cpu_capabilities(const struct arm64_cpu_capabilities *caps, | |||
985 | */ | 985 | */ |
986 | void __init enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps) | 986 | void __init enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps) |
987 | { | 987 | { |
988 | for (; caps->matches; caps++) | 988 | for (; caps->matches; caps++) { |
989 | if (caps->enable && cpus_have_cap(caps->capability)) | 989 | unsigned int num = caps->capability; |
990 | |||
991 | if (!cpus_have_cap(num)) | ||
992 | continue; | ||
993 | |||
994 | /* Ensure cpus_have_const_cap(num) works */ | ||
995 | static_branch_enable(&cpu_hwcap_keys[num]); | ||
996 | |||
997 | if (caps->enable) { | ||
990 | /* | 998 | /* |
991 | * Use stop_machine() as it schedules the work allowing | 999 | * Use stop_machine() as it schedules the work allowing |
992 | * us to modify PSTATE, instead of on_each_cpu() which | 1000 | * us to modify PSTATE, instead of on_each_cpu() which |
@@ -994,6 +1002,8 @@ void __init enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps) | |||
994 | * we return. | 1002 | * we return. |
995 | */ | 1003 | */ |
996 | stop_machine(caps->enable, NULL, cpu_online_mask); | 1004 | stop_machine(caps->enable, NULL, cpu_online_mask); |
1005 | } | ||
1006 | } | ||
997 | } | 1007 | } |
998 | 1008 | ||
999 | /* | 1009 | /* |
@@ -1096,6 +1106,14 @@ static void __init setup_feature_capabilities(void) | |||
1096 | enable_cpu_capabilities(arm64_features); | 1106 | enable_cpu_capabilities(arm64_features); |
1097 | } | 1107 | } |
1098 | 1108 | ||
1109 | DEFINE_STATIC_KEY_FALSE(arm64_const_caps_ready); | ||
1110 | EXPORT_SYMBOL(arm64_const_caps_ready); | ||
1111 | |||
1112 | static void __init mark_const_caps_ready(void) | ||
1113 | { | ||
1114 | static_branch_enable(&arm64_const_caps_ready); | ||
1115 | } | ||
1116 | |||
1099 | /* | 1117 | /* |
1100 | * Check if the current CPU has a given feature capability. | 1118 | * Check if the current CPU has a given feature capability. |
1101 | * Should be called from non-preemptible context. | 1119 | * Should be called from non-preemptible context. |
@@ -1131,6 +1149,7 @@ void __init setup_cpu_features(void) | |||
1131 | /* Set the CPU feature capabilies */ | 1149 | /* Set the CPU feature capabilies */ |
1132 | setup_feature_capabilities(); | 1150 | setup_feature_capabilities(); |
1133 | enable_errata_workarounds(); | 1151 | enable_errata_workarounds(); |
1152 | mark_const_caps_ready(); | ||
1134 | setup_elf_hwcaps(arm64_elf_hwcaps); | 1153 | setup_elf_hwcaps(arm64_elf_hwcaps); |
1135 | 1154 | ||
1136 | if (system_supports_32bit_el0()) | 1155 | if (system_supports_32bit_el0()) |
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index bcc79471b38e..83a1b1ad189f 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c | |||
@@ -877,15 +877,24 @@ static int armv8pmu_set_event_filter(struct hw_perf_event *event, | |||
877 | 877 | ||
878 | if (attr->exclude_idle) | 878 | if (attr->exclude_idle) |
879 | return -EPERM; | 879 | return -EPERM; |
880 | if (is_kernel_in_hyp_mode() && | 880 | |
881 | attr->exclude_kernel != attr->exclude_hv) | 881 | /* |
882 | return -EINVAL; | 882 | * If we're running in hyp mode, then we *are* the hypervisor. |
883 | * Therefore we ignore exclude_hv in this configuration, since | ||
884 | * there's no hypervisor to sample anyway. This is consistent | ||
885 | * with other architectures (x86 and Power). | ||
886 | */ | ||
887 | if (is_kernel_in_hyp_mode()) { | ||
888 | if (!attr->exclude_kernel) | ||
889 | config_base |= ARMV8_PMU_INCLUDE_EL2; | ||
890 | } else { | ||
891 | if (attr->exclude_kernel) | ||
892 | config_base |= ARMV8_PMU_EXCLUDE_EL1; | ||
893 | if (!attr->exclude_hv) | ||
894 | config_base |= ARMV8_PMU_INCLUDE_EL2; | ||
895 | } | ||
883 | if (attr->exclude_user) | 896 | if (attr->exclude_user) |
884 | config_base |= ARMV8_PMU_EXCLUDE_EL0; | 897 | config_base |= ARMV8_PMU_EXCLUDE_EL0; |
885 | if (!is_kernel_in_hyp_mode() && attr->exclude_kernel) | ||
886 | config_base |= ARMV8_PMU_EXCLUDE_EL1; | ||
887 | if (!attr->exclude_hv) | ||
888 | config_base |= ARMV8_PMU_INCLUDE_EL2; | ||
889 | 898 | ||
890 | /* | 899 | /* |
891 | * Install the filter into config_base as this is used to | 900 | * Install the filter into config_base as this is used to |
diff --git a/arch/arm64/kvm/hyp/Makefile b/arch/arm64/kvm/hyp/Makefile index aaf42ae8d8c3..14c4e3b14bcb 100644 --- a/arch/arm64/kvm/hyp/Makefile +++ b/arch/arm64/kvm/hyp/Makefile | |||
@@ -2,6 +2,8 @@ | |||
2 | # Makefile for Kernel-based Virtual Machine module, HYP part | 2 | # Makefile for Kernel-based Virtual Machine module, HYP part |
3 | # | 3 | # |
4 | 4 | ||
5 | ccflags-y += -fno-stack-protector | ||
6 | |||
5 | KVM=../../../../virt/kvm | 7 | KVM=../../../../virt/kvm |
6 | 8 | ||
7 | obj-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/hyp/vgic-v2-sr.o | 9 | obj-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/hyp/vgic-v2-sr.o |
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index c6e53580aefe..71f930501ade 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c | |||
@@ -253,8 +253,9 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx) | |||
253 | */ | 253 | */ |
254 | off = offsetof(struct bpf_array, ptrs); | 254 | off = offsetof(struct bpf_array, ptrs); |
255 | emit_a64_mov_i64(tmp, off, ctx); | 255 | emit_a64_mov_i64(tmp, off, ctx); |
256 | emit(A64_LDR64(tmp, r2, tmp), ctx); | 256 | emit(A64_ADD(1, tmp, r2, tmp), ctx); |
257 | emit(A64_LDR64(prg, tmp, r3), ctx); | 257 | emit(A64_LSL(1, prg, r3, 3), ctx); |
258 | emit(A64_LDR64(prg, tmp, prg), ctx); | ||
258 | emit(A64_CBZ(1, prg, jmp_offset), ctx); | 259 | emit(A64_CBZ(1, prg, jmp_offset), ctx); |
259 | 260 | ||
260 | /* goto *(prog->bpf_func + prologue_size); */ | 261 | /* goto *(prog->bpf_func + prologue_size); */ |
diff --git a/arch/cris/boot/dts/include/dt-bindings b/arch/cris/boot/dts/include/dt-bindings deleted file mode 120000 index 08c00e4972fa..000000000000 --- a/arch/cris/boot/dts/include/dt-bindings +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | ../../../../../include/dt-bindings \ No newline at end of file | ||
diff --git a/arch/metag/boot/dts/include/dt-bindings b/arch/metag/boot/dts/include/dt-bindings deleted file mode 120000 index 08c00e4972fa..000000000000 --- a/arch/metag/boot/dts/include/dt-bindings +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | ../../../../../include/dt-bindings \ No newline at end of file | ||
diff --git a/arch/mips/boot/dts/include/dt-bindings b/arch/mips/boot/dts/include/dt-bindings deleted file mode 120000 index 08c00e4972fa..000000000000 --- a/arch/mips/boot/dts/include/dt-bindings +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | ../../../../../include/dt-bindings \ No newline at end of file | ||
diff --git a/arch/powerpc/boot/dts/include/dt-bindings b/arch/powerpc/boot/dts/include/dt-bindings deleted file mode 120000 index 08c00e4972fa..000000000000 --- a/arch/powerpc/boot/dts/include/dt-bindings +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | ../../../../../include/dt-bindings \ No newline at end of file | ||
diff --git a/arch/powerpc/include/asm/module.h b/arch/powerpc/include/asm/module.h index 53885512b8d3..6c0132c7212f 100644 --- a/arch/powerpc/include/asm/module.h +++ b/arch/powerpc/include/asm/module.h | |||
@@ -14,6 +14,10 @@ | |||
14 | #include <asm-generic/module.h> | 14 | #include <asm-generic/module.h> |
15 | 15 | ||
16 | 16 | ||
17 | #ifdef CC_USING_MPROFILE_KERNEL | ||
18 | #define MODULE_ARCH_VERMAGIC "mprofile-kernel" | ||
19 | #endif | ||
20 | |||
17 | #ifndef __powerpc64__ | 21 | #ifndef __powerpc64__ |
18 | /* | 22 | /* |
19 | * Thanks to Paul M for explaining this. | 23 | * Thanks to Paul M for explaining this. |
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index 2a32483c7b6c..8da5d4c1cab2 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h | |||
@@ -132,7 +132,19 @@ extern long long virt_phys_offset; | |||
132 | #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) | 132 | #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) |
133 | #define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr)) | 133 | #define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr)) |
134 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | 134 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) |
135 | |||
136 | #ifdef CONFIG_PPC_BOOK3S_64 | ||
137 | /* | ||
138 | * On hash the vmalloc and other regions alias to the kernel region when passed | ||
139 | * through __pa(), which virt_to_pfn() uses. That means virt_addr_valid() can | ||
140 | * return true for some vmalloc addresses, which is incorrect. So explicitly | ||
141 | * check that the address is in the kernel region. | ||
142 | */ | ||
143 | #define virt_addr_valid(kaddr) (REGION_ID(kaddr) == KERNEL_REGION_ID && \ | ||
144 | pfn_valid(virt_to_pfn(kaddr))) | ||
145 | #else | ||
135 | #define virt_addr_valid(kaddr) pfn_valid(virt_to_pfn(kaddr)) | 146 | #define virt_addr_valid(kaddr) pfn_valid(virt_to_pfn(kaddr)) |
147 | #endif | ||
136 | 148 | ||
137 | /* | 149 | /* |
138 | * On Book-E parts we need __va to parse the device tree and we can't | 150 | * On Book-E parts we need __va to parse the device tree and we can't |
diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S index 07d4e0ad60db..4898d676dcae 100644 --- a/arch/powerpc/kernel/idle_book3s.S +++ b/arch/powerpc/kernel/idle_book3s.S | |||
@@ -416,7 +416,7 @@ power9_dd1_recover_paca: | |||
416 | * which needs to be restored from the stack. | 416 | * which needs to be restored from the stack. |
417 | */ | 417 | */ |
418 | li r3, 1 | 418 | li r3, 1 |
419 | stb r0,PACA_NAPSTATELOST(r13) | 419 | stb r3,PACA_NAPSTATELOST(r13) |
420 | blr | 420 | blr |
421 | 421 | ||
422 | /* | 422 | /* |
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 160ae0fa7d0d..fc4343514bed 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c | |||
@@ -305,16 +305,17 @@ int kprobe_handler(struct pt_regs *regs) | |||
305 | save_previous_kprobe(kcb); | 305 | save_previous_kprobe(kcb); |
306 | set_current_kprobe(p, regs, kcb); | 306 | set_current_kprobe(p, regs, kcb); |
307 | kprobes_inc_nmissed_count(p); | 307 | kprobes_inc_nmissed_count(p); |
308 | prepare_singlestep(p, regs); | ||
309 | kcb->kprobe_status = KPROBE_REENTER; | 308 | kcb->kprobe_status = KPROBE_REENTER; |
310 | if (p->ainsn.boostable >= 0) { | 309 | if (p->ainsn.boostable >= 0) { |
311 | ret = try_to_emulate(p, regs); | 310 | ret = try_to_emulate(p, regs); |
312 | 311 | ||
313 | if (ret > 0) { | 312 | if (ret > 0) { |
314 | restore_previous_kprobe(kcb); | 313 | restore_previous_kprobe(kcb); |
314 | preempt_enable_no_resched(); | ||
315 | return 1; | 315 | return 1; |
316 | } | 316 | } |
317 | } | 317 | } |
318 | prepare_singlestep(p, regs); | ||
318 | return 1; | 319 | return 1; |
319 | } else { | 320 | } else { |
320 | if (*addr != BREAKPOINT_INSTRUCTION) { | 321 | if (*addr != BREAKPOINT_INSTRUCTION) { |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index d645da302bf2..baae104b16c7 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -864,6 +864,25 @@ static void tm_reclaim_thread(struct thread_struct *thr, | |||
864 | if (!MSR_TM_SUSPENDED(mfmsr())) | 864 | if (!MSR_TM_SUSPENDED(mfmsr())) |
865 | return; | 865 | return; |
866 | 866 | ||
867 | /* | ||
868 | * If we are in a transaction and FP is off then we can't have | ||
869 | * used FP inside that transaction. Hence the checkpointed | ||
870 | * state is the same as the live state. We need to copy the | ||
871 | * live state to the checkpointed state so that when the | ||
872 | * transaction is restored, the checkpointed state is correct | ||
873 | * and the aborted transaction sees the correct state. We use | ||
874 | * ckpt_regs.msr here as that's what tm_reclaim will use to | ||
875 | * determine if it's going to write the checkpointed state or | ||
876 | * not. So either this will write the checkpointed registers, | ||
877 | * or reclaim will. Similarly for VMX. | ||
878 | */ | ||
879 | if ((thr->ckpt_regs.msr & MSR_FP) == 0) | ||
880 | memcpy(&thr->ckfp_state, &thr->fp_state, | ||
881 | sizeof(struct thread_fp_state)); | ||
882 | if ((thr->ckpt_regs.msr & MSR_VEC) == 0) | ||
883 | memcpy(&thr->ckvr_state, &thr->vr_state, | ||
884 | sizeof(struct thread_vr_state)); | ||
885 | |||
867 | giveup_all(container_of(thr, struct task_struct, thread)); | 886 | giveup_all(container_of(thr, struct task_struct, thread)); |
868 | 887 | ||
869 | tm_reclaim(thr, thr->ckpt_regs.msr, cause); | 888 | tm_reclaim(thr, thr->ckpt_regs.msr, cause); |
diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig index 24de532c1736..0c52cb5d43f5 100644 --- a/arch/powerpc/kvm/Kconfig +++ b/arch/powerpc/kvm/Kconfig | |||
@@ -67,7 +67,7 @@ config KVM_BOOK3S_64 | |||
67 | select KVM_BOOK3S_64_HANDLER | 67 | select KVM_BOOK3S_64_HANDLER |
68 | select KVM | 68 | select KVM |
69 | select KVM_BOOK3S_PR_POSSIBLE if !KVM_BOOK3S_HV_POSSIBLE | 69 | select KVM_BOOK3S_PR_POSSIBLE if !KVM_BOOK3S_HV_POSSIBLE |
70 | select SPAPR_TCE_IOMMU if IOMMU_SUPPORT | 70 | select SPAPR_TCE_IOMMU if IOMMU_SUPPORT && (PPC_SERIES || PPC_POWERNV) |
71 | ---help--- | 71 | ---help--- |
72 | Support running unmodified book3s_64 and book3s_32 guest kernels | 72 | Support running unmodified book3s_64 and book3s_32 guest kernels |
73 | in virtual machines on book3s_64 host processors. | 73 | in virtual machines on book3s_64 host processors. |
diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile index d91a2604c496..381a6ec0ff3b 100644 --- a/arch/powerpc/kvm/Makefile +++ b/arch/powerpc/kvm/Makefile | |||
@@ -46,7 +46,7 @@ kvm-e500mc-objs := \ | |||
46 | e500_emulate.o | 46 | e500_emulate.o |
47 | kvm-objs-$(CONFIG_KVM_E500MC) := $(kvm-e500mc-objs) | 47 | kvm-objs-$(CONFIG_KVM_E500MC) := $(kvm-e500mc-objs) |
48 | 48 | ||
49 | kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) := \ | 49 | kvm-book3s_64-builtin-objs-$(CONFIG_SPAPR_TCE_IOMMU) := \ |
50 | book3s_64_vio_hv.o | 50 | book3s_64_vio_hv.o |
51 | 51 | ||
52 | kvm-pr-y := \ | 52 | kvm-pr-y := \ |
@@ -90,11 +90,11 @@ kvm-book3s_64-objs-$(CONFIG_KVM_XICS) += \ | |||
90 | book3s_xics.o | 90 | book3s_xics.o |
91 | 91 | ||
92 | kvm-book3s_64-objs-$(CONFIG_KVM_XIVE) += book3s_xive.o | 92 | kvm-book3s_64-objs-$(CONFIG_KVM_XIVE) += book3s_xive.o |
93 | kvm-book3s_64-objs-$(CONFIG_SPAPR_TCE_IOMMU) += book3s_64_vio.o | ||
93 | 94 | ||
94 | kvm-book3s_64-module-objs := \ | 95 | kvm-book3s_64-module-objs := \ |
95 | $(common-objs-y) \ | 96 | $(common-objs-y) \ |
96 | book3s.o \ | 97 | book3s.o \ |
97 | book3s_64_vio.o \ | ||
98 | book3s_rtas.o \ | 98 | book3s_rtas.o \ |
99 | $(kvm-book3s_64-objs-y) | 99 | $(kvm-book3s_64-objs-y) |
100 | 100 | ||
diff --git a/arch/powerpc/kvm/book3s_64_vio_hv.c b/arch/powerpc/kvm/book3s_64_vio_hv.c index eda0a8f6fae8..3adfd2f5301c 100644 --- a/arch/powerpc/kvm/book3s_64_vio_hv.c +++ b/arch/powerpc/kvm/book3s_64_vio_hv.c | |||
@@ -301,6 +301,10 @@ long kvmppc_rm_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn, | |||
301 | /* udbg_printf("H_PUT_TCE(): liobn=0x%lx ioba=0x%lx, tce=0x%lx\n", */ | 301 | /* udbg_printf("H_PUT_TCE(): liobn=0x%lx ioba=0x%lx, tce=0x%lx\n", */ |
302 | /* liobn, ioba, tce); */ | 302 | /* liobn, ioba, tce); */ |
303 | 303 | ||
304 | /* For radix, we might be in virtual mode, so punt */ | ||
305 | if (kvm_is_radix(vcpu->kvm)) | ||
306 | return H_TOO_HARD; | ||
307 | |||
304 | stt = kvmppc_find_table(vcpu->kvm, liobn); | 308 | stt = kvmppc_find_table(vcpu->kvm, liobn); |
305 | if (!stt) | 309 | if (!stt) |
306 | return H_TOO_HARD; | 310 | return H_TOO_HARD; |
@@ -381,6 +385,10 @@ long kvmppc_rm_h_put_tce_indirect(struct kvm_vcpu *vcpu, | |||
381 | bool prereg = false; | 385 | bool prereg = false; |
382 | struct kvmppc_spapr_tce_iommu_table *stit; | 386 | struct kvmppc_spapr_tce_iommu_table *stit; |
383 | 387 | ||
388 | /* For radix, we might be in virtual mode, so punt */ | ||
389 | if (kvm_is_radix(vcpu->kvm)) | ||
390 | return H_TOO_HARD; | ||
391 | |||
384 | stt = kvmppc_find_table(vcpu->kvm, liobn); | 392 | stt = kvmppc_find_table(vcpu->kvm, liobn); |
385 | if (!stt) | 393 | if (!stt) |
386 | return H_TOO_HARD; | 394 | return H_TOO_HARD; |
@@ -491,6 +499,10 @@ long kvmppc_rm_h_stuff_tce(struct kvm_vcpu *vcpu, | |||
491 | long i, ret; | 499 | long i, ret; |
492 | struct kvmppc_spapr_tce_iommu_table *stit; | 500 | struct kvmppc_spapr_tce_iommu_table *stit; |
493 | 501 | ||
502 | /* For radix, we might be in virtual mode, so punt */ | ||
503 | if (kvm_is_radix(vcpu->kvm)) | ||
504 | return H_TOO_HARD; | ||
505 | |||
494 | stt = kvmppc_find_table(vcpu->kvm, liobn); | 506 | stt = kvmppc_find_table(vcpu->kvm, liobn); |
495 | if (!stt) | 507 | if (!stt) |
496 | return H_TOO_HARD; | 508 | return H_TOO_HARD; |
@@ -527,6 +539,7 @@ long kvmppc_rm_h_stuff_tce(struct kvm_vcpu *vcpu, | |||
527 | return H_SUCCESS; | 539 | return H_SUCCESS; |
528 | } | 540 | } |
529 | 541 | ||
542 | /* This can be called in either virtual mode or real mode */ | ||
530 | long kvmppc_h_get_tce(struct kvm_vcpu *vcpu, unsigned long liobn, | 543 | long kvmppc_h_get_tce(struct kvm_vcpu *vcpu, unsigned long liobn, |
531 | unsigned long ioba) | 544 | unsigned long ioba) |
532 | { | 545 | { |
diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c index 88a65923c649..ee4c2558c305 100644 --- a/arch/powerpc/kvm/book3s_hv_builtin.c +++ b/arch/powerpc/kvm/book3s_hv_builtin.c | |||
@@ -207,7 +207,14 @@ EXPORT_SYMBOL_GPL(kvmppc_hwrng_present); | |||
207 | 207 | ||
208 | long kvmppc_h_random(struct kvm_vcpu *vcpu) | 208 | long kvmppc_h_random(struct kvm_vcpu *vcpu) |
209 | { | 209 | { |
210 | if (powernv_get_random_real_mode(&vcpu->arch.gpr[4])) | 210 | int r; |
211 | |||
212 | /* Only need to do the expensive mfmsr() on radix */ | ||
213 | if (kvm_is_radix(vcpu->kvm) && (mfmsr() & MSR_IR)) | ||
214 | r = powernv_get_random_long(&vcpu->arch.gpr[4]); | ||
215 | else | ||
216 | r = powernv_get_random_real_mode(&vcpu->arch.gpr[4]); | ||
217 | if (r) | ||
211 | return H_SUCCESS; | 218 | return H_SUCCESS; |
212 | 219 | ||
213 | return H_HARDWARE; | 220 | return H_HARDWARE; |
diff --git a/arch/powerpc/kvm/book3s_pr_papr.c b/arch/powerpc/kvm/book3s_pr_papr.c index bcbeeb62dd13..8a4205fa774f 100644 --- a/arch/powerpc/kvm/book3s_pr_papr.c +++ b/arch/powerpc/kvm/book3s_pr_papr.c | |||
@@ -50,7 +50,9 @@ static int kvmppc_h_pr_enter(struct kvm_vcpu *vcpu) | |||
50 | pteg_addr = get_pteg_addr(vcpu, pte_index); | 50 | pteg_addr = get_pteg_addr(vcpu, pte_index); |
51 | 51 | ||
52 | mutex_lock(&vcpu->kvm->arch.hpt_mutex); | 52 | mutex_lock(&vcpu->kvm->arch.hpt_mutex); |
53 | copy_from_user(pteg, (void __user *)pteg_addr, sizeof(pteg)); | 53 | ret = H_FUNCTION; |
54 | if (copy_from_user(pteg, (void __user *)pteg_addr, sizeof(pteg))) | ||
55 | goto done; | ||
54 | hpte = pteg; | 56 | hpte = pteg; |
55 | 57 | ||
56 | ret = H_PTEG_FULL; | 58 | ret = H_PTEG_FULL; |
@@ -71,7 +73,9 @@ static int kvmppc_h_pr_enter(struct kvm_vcpu *vcpu) | |||
71 | hpte[0] = cpu_to_be64(kvmppc_get_gpr(vcpu, 6)); | 73 | hpte[0] = cpu_to_be64(kvmppc_get_gpr(vcpu, 6)); |
72 | hpte[1] = cpu_to_be64(kvmppc_get_gpr(vcpu, 7)); | 74 | hpte[1] = cpu_to_be64(kvmppc_get_gpr(vcpu, 7)); |
73 | pteg_addr += i * HPTE_SIZE; | 75 | pteg_addr += i * HPTE_SIZE; |
74 | copy_to_user((void __user *)pteg_addr, hpte, HPTE_SIZE); | 76 | ret = H_FUNCTION; |
77 | if (copy_to_user((void __user *)pteg_addr, hpte, HPTE_SIZE)) | ||
78 | goto done; | ||
75 | kvmppc_set_gpr(vcpu, 4, pte_index | i); | 79 | kvmppc_set_gpr(vcpu, 4, pte_index | i); |
76 | ret = H_SUCCESS; | 80 | ret = H_SUCCESS; |
77 | 81 | ||
@@ -93,7 +97,9 @@ static int kvmppc_h_pr_remove(struct kvm_vcpu *vcpu) | |||
93 | 97 | ||
94 | pteg = get_pteg_addr(vcpu, pte_index); | 98 | pteg = get_pteg_addr(vcpu, pte_index); |
95 | mutex_lock(&vcpu->kvm->arch.hpt_mutex); | 99 | mutex_lock(&vcpu->kvm->arch.hpt_mutex); |
96 | copy_from_user(pte, (void __user *)pteg, sizeof(pte)); | 100 | ret = H_FUNCTION; |
101 | if (copy_from_user(pte, (void __user *)pteg, sizeof(pte))) | ||
102 | goto done; | ||
97 | pte[0] = be64_to_cpu((__force __be64)pte[0]); | 103 | pte[0] = be64_to_cpu((__force __be64)pte[0]); |
98 | pte[1] = be64_to_cpu((__force __be64)pte[1]); | 104 | pte[1] = be64_to_cpu((__force __be64)pte[1]); |
99 | 105 | ||
@@ -103,7 +109,9 @@ static int kvmppc_h_pr_remove(struct kvm_vcpu *vcpu) | |||
103 | ((flags & H_ANDCOND) && (pte[0] & avpn) != 0)) | 109 | ((flags & H_ANDCOND) && (pte[0] & avpn) != 0)) |
104 | goto done; | 110 | goto done; |
105 | 111 | ||
106 | copy_to_user((void __user *)pteg, &v, sizeof(v)); | 112 | ret = H_FUNCTION; |
113 | if (copy_to_user((void __user *)pteg, &v, sizeof(v))) | ||
114 | goto done; | ||
107 | 115 | ||
108 | rb = compute_tlbie_rb(pte[0], pte[1], pte_index); | 116 | rb = compute_tlbie_rb(pte[0], pte[1], pte_index); |
109 | vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false); | 117 | vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false); |
@@ -171,7 +179,10 @@ static int kvmppc_h_pr_bulk_remove(struct kvm_vcpu *vcpu) | |||
171 | } | 179 | } |
172 | 180 | ||
173 | pteg = get_pteg_addr(vcpu, tsh & H_BULK_REMOVE_PTEX); | 181 | pteg = get_pteg_addr(vcpu, tsh & H_BULK_REMOVE_PTEX); |
174 | copy_from_user(pte, (void __user *)pteg, sizeof(pte)); | 182 | if (copy_from_user(pte, (void __user *)pteg, sizeof(pte))) { |
183 | ret = H_FUNCTION; | ||
184 | break; | ||
185 | } | ||
175 | pte[0] = be64_to_cpu((__force __be64)pte[0]); | 186 | pte[0] = be64_to_cpu((__force __be64)pte[0]); |
176 | pte[1] = be64_to_cpu((__force __be64)pte[1]); | 187 | pte[1] = be64_to_cpu((__force __be64)pte[1]); |
177 | 188 | ||
@@ -184,7 +195,10 @@ static int kvmppc_h_pr_bulk_remove(struct kvm_vcpu *vcpu) | |||
184 | tsh |= H_BULK_REMOVE_NOT_FOUND; | 195 | tsh |= H_BULK_REMOVE_NOT_FOUND; |
185 | } else { | 196 | } else { |
186 | /* Splat the pteg in (userland) hpt */ | 197 | /* Splat the pteg in (userland) hpt */ |
187 | copy_to_user((void __user *)pteg, &v, sizeof(v)); | 198 | if (copy_to_user((void __user *)pteg, &v, sizeof(v))) { |
199 | ret = H_FUNCTION; | ||
200 | break; | ||
201 | } | ||
188 | 202 | ||
189 | rb = compute_tlbie_rb(pte[0], pte[1], | 203 | rb = compute_tlbie_rb(pte[0], pte[1], |
190 | tsh & H_BULK_REMOVE_PTEX); | 204 | tsh & H_BULK_REMOVE_PTEX); |
@@ -211,7 +225,9 @@ static int kvmppc_h_pr_protect(struct kvm_vcpu *vcpu) | |||
211 | 225 | ||
212 | pteg = get_pteg_addr(vcpu, pte_index); | 226 | pteg = get_pteg_addr(vcpu, pte_index); |
213 | mutex_lock(&vcpu->kvm->arch.hpt_mutex); | 227 | mutex_lock(&vcpu->kvm->arch.hpt_mutex); |
214 | copy_from_user(pte, (void __user *)pteg, sizeof(pte)); | 228 | ret = H_FUNCTION; |
229 | if (copy_from_user(pte, (void __user *)pteg, sizeof(pte))) | ||
230 | goto done; | ||
215 | pte[0] = be64_to_cpu((__force __be64)pte[0]); | 231 | pte[0] = be64_to_cpu((__force __be64)pte[0]); |
216 | pte[1] = be64_to_cpu((__force __be64)pte[1]); | 232 | pte[1] = be64_to_cpu((__force __be64)pte[1]); |
217 | 233 | ||
@@ -234,7 +250,9 @@ static int kvmppc_h_pr_protect(struct kvm_vcpu *vcpu) | |||
234 | vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false); | 250 | vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false); |
235 | pte[0] = (__force u64)cpu_to_be64(pte[0]); | 251 | pte[0] = (__force u64)cpu_to_be64(pte[0]); |
236 | pte[1] = (__force u64)cpu_to_be64(pte[1]); | 252 | pte[1] = (__force u64)cpu_to_be64(pte[1]); |
237 | copy_to_user((void __user *)pteg, pte, sizeof(pte)); | 253 | ret = H_FUNCTION; |
254 | if (copy_to_user((void __user *)pteg, pte, sizeof(pte))) | ||
255 | goto done; | ||
238 | ret = H_SUCCESS; | 256 | ret = H_SUCCESS; |
239 | 257 | ||
240 | done: | 258 | done: |
@@ -244,36 +262,37 @@ static int kvmppc_h_pr_protect(struct kvm_vcpu *vcpu) | |||
244 | return EMULATE_DONE; | 262 | return EMULATE_DONE; |
245 | } | 263 | } |
246 | 264 | ||
247 | static int kvmppc_h_pr_put_tce(struct kvm_vcpu *vcpu) | 265 | static int kvmppc_h_pr_logical_ci_load(struct kvm_vcpu *vcpu) |
248 | { | 266 | { |
249 | unsigned long liobn = kvmppc_get_gpr(vcpu, 4); | ||
250 | unsigned long ioba = kvmppc_get_gpr(vcpu, 5); | ||
251 | unsigned long tce = kvmppc_get_gpr(vcpu, 6); | ||
252 | long rc; | 267 | long rc; |
253 | 268 | ||
254 | rc = kvmppc_h_put_tce(vcpu, liobn, ioba, tce); | 269 | rc = kvmppc_h_logical_ci_load(vcpu); |
255 | if (rc == H_TOO_HARD) | 270 | if (rc == H_TOO_HARD) |
256 | return EMULATE_FAIL; | 271 | return EMULATE_FAIL; |
257 | kvmppc_set_gpr(vcpu, 3, rc); | 272 | kvmppc_set_gpr(vcpu, 3, rc); |
258 | return EMULATE_DONE; | 273 | return EMULATE_DONE; |
259 | } | 274 | } |
260 | 275 | ||
261 | static int kvmppc_h_pr_logical_ci_load(struct kvm_vcpu *vcpu) | 276 | static int kvmppc_h_pr_logical_ci_store(struct kvm_vcpu *vcpu) |
262 | { | 277 | { |
263 | long rc; | 278 | long rc; |
264 | 279 | ||
265 | rc = kvmppc_h_logical_ci_load(vcpu); | 280 | rc = kvmppc_h_logical_ci_store(vcpu); |
266 | if (rc == H_TOO_HARD) | 281 | if (rc == H_TOO_HARD) |
267 | return EMULATE_FAIL; | 282 | return EMULATE_FAIL; |
268 | kvmppc_set_gpr(vcpu, 3, rc); | 283 | kvmppc_set_gpr(vcpu, 3, rc); |
269 | return EMULATE_DONE; | 284 | return EMULATE_DONE; |
270 | } | 285 | } |
271 | 286 | ||
272 | static int kvmppc_h_pr_logical_ci_store(struct kvm_vcpu *vcpu) | 287 | #ifdef CONFIG_SPAPR_TCE_IOMMU |
288 | static int kvmppc_h_pr_put_tce(struct kvm_vcpu *vcpu) | ||
273 | { | 289 | { |
290 | unsigned long liobn = kvmppc_get_gpr(vcpu, 4); | ||
291 | unsigned long ioba = kvmppc_get_gpr(vcpu, 5); | ||
292 | unsigned long tce = kvmppc_get_gpr(vcpu, 6); | ||
274 | long rc; | 293 | long rc; |
275 | 294 | ||
276 | rc = kvmppc_h_logical_ci_store(vcpu); | 295 | rc = kvmppc_h_put_tce(vcpu, liobn, ioba, tce); |
277 | if (rc == H_TOO_HARD) | 296 | if (rc == H_TOO_HARD) |
278 | return EMULATE_FAIL; | 297 | return EMULATE_FAIL; |
279 | kvmppc_set_gpr(vcpu, 3, rc); | 298 | kvmppc_set_gpr(vcpu, 3, rc); |
@@ -311,6 +330,23 @@ static int kvmppc_h_pr_stuff_tce(struct kvm_vcpu *vcpu) | |||
311 | return EMULATE_DONE; | 330 | return EMULATE_DONE; |
312 | } | 331 | } |
313 | 332 | ||
333 | #else /* CONFIG_SPAPR_TCE_IOMMU */ | ||
334 | static int kvmppc_h_pr_put_tce(struct kvm_vcpu *vcpu) | ||
335 | { | ||
336 | return EMULATE_FAIL; | ||
337 | } | ||
338 | |||
339 | static int kvmppc_h_pr_put_tce_indirect(struct kvm_vcpu *vcpu) | ||
340 | { | ||
341 | return EMULATE_FAIL; | ||
342 | } | ||
343 | |||
344 | static int kvmppc_h_pr_stuff_tce(struct kvm_vcpu *vcpu) | ||
345 | { | ||
346 | return EMULATE_FAIL; | ||
347 | } | ||
348 | #endif /* CONFIG_SPAPR_TCE_IOMMU */ | ||
349 | |||
314 | static int kvmppc_h_pr_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd) | 350 | static int kvmppc_h_pr_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd) |
315 | { | 351 | { |
316 | long rc = kvmppc_xics_hcall(vcpu, cmd); | 352 | long rc = kvmppc_xics_hcall(vcpu, cmd); |
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index f7cf2cd564ef..7f71ab5fcad1 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -1749,7 +1749,7 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
1749 | r = kvm_vm_ioctl_enable_cap(kvm, &cap); | 1749 | r = kvm_vm_ioctl_enable_cap(kvm, &cap); |
1750 | break; | 1750 | break; |
1751 | } | 1751 | } |
1752 | #ifdef CONFIG_PPC_BOOK3S_64 | 1752 | #ifdef CONFIG_SPAPR_TCE_IOMMU |
1753 | case KVM_CREATE_SPAPR_TCE_64: { | 1753 | case KVM_CREATE_SPAPR_TCE_64: { |
1754 | struct kvm_create_spapr_tce_64 create_tce_64; | 1754 | struct kvm_create_spapr_tce_64 create_tce_64; |
1755 | 1755 | ||
@@ -1780,6 +1780,8 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
1780 | r = kvm_vm_ioctl_create_spapr_tce(kvm, &create_tce_64); | 1780 | r = kvm_vm_ioctl_create_spapr_tce(kvm, &create_tce_64); |
1781 | goto out; | 1781 | goto out; |
1782 | } | 1782 | } |
1783 | #endif | ||
1784 | #ifdef CONFIG_PPC_BOOK3S_64 | ||
1783 | case KVM_PPC_GET_SMMU_INFO: { | 1785 | case KVM_PPC_GET_SMMU_INFO: { |
1784 | struct kvm_ppc_smmu_info info; | 1786 | struct kvm_ppc_smmu_info info; |
1785 | struct kvm *kvm = filp->private_data; | 1787 | struct kvm *kvm = filp->private_data; |
diff --git a/arch/powerpc/mm/dump_linuxpagetables.c b/arch/powerpc/mm/dump_linuxpagetables.c index d659345a98d6..44fe4833910f 100644 --- a/arch/powerpc/mm/dump_linuxpagetables.c +++ b/arch/powerpc/mm/dump_linuxpagetables.c | |||
@@ -16,6 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | #include <linux/debugfs.h> | 17 | #include <linux/debugfs.h> |
18 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
19 | #include <linux/hugetlb.h> | ||
19 | #include <linux/io.h> | 20 | #include <linux/io.h> |
20 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
21 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
@@ -391,7 +392,7 @@ static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start) | |||
391 | 392 | ||
392 | for (i = 0; i < PTRS_PER_PMD; i++, pmd++) { | 393 | for (i = 0; i < PTRS_PER_PMD; i++, pmd++) { |
393 | addr = start + i * PMD_SIZE; | 394 | addr = start + i * PMD_SIZE; |
394 | if (!pmd_none(*pmd)) | 395 | if (!pmd_none(*pmd) && !pmd_huge(*pmd)) |
395 | /* pmd exists */ | 396 | /* pmd exists */ |
396 | walk_pte(st, pmd, addr); | 397 | walk_pte(st, pmd, addr); |
397 | else | 398 | else |
@@ -407,7 +408,7 @@ static void walk_pud(struct pg_state *st, pgd_t *pgd, unsigned long start) | |||
407 | 408 | ||
408 | for (i = 0; i < PTRS_PER_PUD; i++, pud++) { | 409 | for (i = 0; i < PTRS_PER_PUD; i++, pud++) { |
409 | addr = start + i * PUD_SIZE; | 410 | addr = start + i * PUD_SIZE; |
410 | if (!pud_none(*pud)) | 411 | if (!pud_none(*pud) && !pud_huge(*pud)) |
411 | /* pud exists */ | 412 | /* pud exists */ |
412 | walk_pmd(st, pud, addr); | 413 | walk_pmd(st, pud, addr); |
413 | else | 414 | else |
@@ -427,7 +428,7 @@ static void walk_pagetables(struct pg_state *st) | |||
427 | */ | 428 | */ |
428 | for (i = 0; i < PTRS_PER_PGD; i++, pgd++) { | 429 | for (i = 0; i < PTRS_PER_PGD; i++, pgd++) { |
429 | addr = KERN_VIRT_START + i * PGDIR_SIZE; | 430 | addr = KERN_VIRT_START + i * PGDIR_SIZE; |
430 | if (!pgd_none(*pgd)) | 431 | if (!pgd_none(*pgd) && !pgd_huge(*pgd)) |
431 | /* pgd exists */ | 432 | /* pgd exists */ |
432 | walk_pud(st, pgd, addr); | 433 | walk_pud(st, pgd, addr); |
433 | else | 434 | else |
diff --git a/arch/s390/include/asm/debug.h b/arch/s390/include/asm/debug.h index 0206c8052328..df7b54ea956d 100644 --- a/arch/s390/include/asm/debug.h +++ b/arch/s390/include/asm/debug.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/time.h> | 12 | #include <linux/time.h> |
13 | #include <linux/refcount.h> | ||
13 | #include <uapi/asm/debug.h> | 14 | #include <uapi/asm/debug.h> |
14 | 15 | ||
15 | #define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */ | 16 | #define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */ |
@@ -31,7 +32,7 @@ struct debug_view; | |||
31 | typedef struct debug_info { | 32 | typedef struct debug_info { |
32 | struct debug_info* next; | 33 | struct debug_info* next; |
33 | struct debug_info* prev; | 34 | struct debug_info* prev; |
34 | atomic_t ref_count; | 35 | refcount_t ref_count; |
35 | spinlock_t lock; | 36 | spinlock_t lock; |
36 | int level; | 37 | int level; |
37 | int nr_areas; | 38 | int nr_areas; |
diff --git a/arch/s390/include/asm/dis.h b/arch/s390/include/asm/dis.h index 60323c21938b..37f617dfbede 100644 --- a/arch/s390/include/asm/dis.h +++ b/arch/s390/include/asm/dis.h | |||
@@ -40,6 +40,8 @@ static inline int insn_length(unsigned char code) | |||
40 | return ((((int) code + 64) >> 7) + 1) << 1; | 40 | return ((((int) code + 64) >> 7) + 1) << 1; |
41 | } | 41 | } |
42 | 42 | ||
43 | struct pt_regs; | ||
44 | |||
43 | void show_code(struct pt_regs *regs); | 45 | void show_code(struct pt_regs *regs); |
44 | void print_fn_code(unsigned char *code, unsigned long len); | 46 | void print_fn_code(unsigned char *code, unsigned long len); |
45 | int insn_to_mnemonic(unsigned char *instruction, char *buf, unsigned int len); | 47 | int insn_to_mnemonic(unsigned char *instruction, char *buf, unsigned int len); |
diff --git a/arch/s390/include/asm/kprobes.h b/arch/s390/include/asm/kprobes.h index 1293c4066cfc..28792ef82c83 100644 --- a/arch/s390/include/asm/kprobes.h +++ b/arch/s390/include/asm/kprobes.h | |||
@@ -27,12 +27,21 @@ | |||
27 | * 2005-Dec Used as a template for s390 by Mike Grundy | 27 | * 2005-Dec Used as a template for s390 by Mike Grundy |
28 | * <grundym@us.ibm.com> | 28 | * <grundym@us.ibm.com> |
29 | */ | 29 | */ |
30 | #include <linux/types.h> | ||
30 | #include <asm-generic/kprobes.h> | 31 | #include <asm-generic/kprobes.h> |
31 | 32 | ||
32 | #define BREAKPOINT_INSTRUCTION 0x0002 | 33 | #define BREAKPOINT_INSTRUCTION 0x0002 |
33 | 34 | ||
35 | #define FIXUP_PSW_NORMAL 0x08 | ||
36 | #define FIXUP_BRANCH_NOT_TAKEN 0x04 | ||
37 | #define FIXUP_RETURN_REGISTER 0x02 | ||
38 | #define FIXUP_NOT_REQUIRED 0x01 | ||
39 | |||
40 | int probe_is_prohibited_opcode(u16 *insn); | ||
41 | int probe_get_fixup_type(u16 *insn); | ||
42 | int probe_is_insn_relative_long(u16 *insn); | ||
43 | |||
34 | #ifdef CONFIG_KPROBES | 44 | #ifdef CONFIG_KPROBES |
35 | #include <linux/types.h> | ||
36 | #include <linux/ptrace.h> | 45 | #include <linux/ptrace.h> |
37 | #include <linux/percpu.h> | 46 | #include <linux/percpu.h> |
38 | #include <linux/sched/task_stack.h> | 47 | #include <linux/sched/task_stack.h> |
@@ -56,11 +65,6 @@ typedef u16 kprobe_opcode_t; | |||
56 | 65 | ||
57 | #define KPROBE_SWAP_INST 0x10 | 66 | #define KPROBE_SWAP_INST 0x10 |
58 | 67 | ||
59 | #define FIXUP_PSW_NORMAL 0x08 | ||
60 | #define FIXUP_BRANCH_NOT_TAKEN 0x04 | ||
61 | #define FIXUP_RETURN_REGISTER 0x02 | ||
62 | #define FIXUP_NOT_REQUIRED 0x01 | ||
63 | |||
64 | /* Architecture specific copy of original instruction */ | 68 | /* Architecture specific copy of original instruction */ |
65 | struct arch_specific_insn { | 69 | struct arch_specific_insn { |
66 | /* copy of original instruction */ | 70 | /* copy of original instruction */ |
@@ -90,10 +94,6 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr); | |||
90 | int kprobe_exceptions_notify(struct notifier_block *self, | 94 | int kprobe_exceptions_notify(struct notifier_block *self, |
91 | unsigned long val, void *data); | 95 | unsigned long val, void *data); |
92 | 96 | ||
93 | int probe_is_prohibited_opcode(u16 *insn); | ||
94 | int probe_get_fixup_type(u16 *insn); | ||
95 | int probe_is_insn_relative_long(u16 *insn); | ||
96 | |||
97 | #define flush_insn_slot(p) do { } while (0) | 97 | #define flush_insn_slot(p) do { } while (0) |
98 | 98 | ||
99 | #endif /* CONFIG_KPROBES */ | 99 | #endif /* CONFIG_KPROBES */ |
diff --git a/arch/s390/include/asm/sysinfo.h b/arch/s390/include/asm/sysinfo.h index 73bff45ced55..e784bed6ed7f 100644 --- a/arch/s390/include/asm/sysinfo.h +++ b/arch/s390/include/asm/sysinfo.h | |||
@@ -146,7 +146,7 @@ extern int topology_max_mnest; | |||
146 | * Returns the maximum nesting level supported by the cpu topology code. | 146 | * Returns the maximum nesting level supported by the cpu topology code. |
147 | * The current maximum level is 4 which is the drawer level. | 147 | * The current maximum level is 4 which is the drawer level. |
148 | */ | 148 | */ |
149 | static inline int topology_mnest_limit(void) | 149 | static inline unsigned char topology_mnest_limit(void) |
150 | { | 150 | { |
151 | return min(topology_max_mnest, 4); | 151 | return min(topology_max_mnest, 4); |
152 | } | 152 | } |
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c index 530226b6cb19..86b3e74f569e 100644 --- a/arch/s390/kernel/debug.c +++ b/arch/s390/kernel/debug.c | |||
@@ -277,7 +277,7 @@ debug_info_alloc(const char *name, int pages_per_area, int nr_areas, | |||
277 | memset(rc->views, 0, DEBUG_MAX_VIEWS * sizeof(struct debug_view *)); | 277 | memset(rc->views, 0, DEBUG_MAX_VIEWS * sizeof(struct debug_view *)); |
278 | memset(rc->debugfs_entries, 0 ,DEBUG_MAX_VIEWS * | 278 | memset(rc->debugfs_entries, 0 ,DEBUG_MAX_VIEWS * |
279 | sizeof(struct dentry*)); | 279 | sizeof(struct dentry*)); |
280 | atomic_set(&(rc->ref_count), 0); | 280 | refcount_set(&(rc->ref_count), 0); |
281 | 281 | ||
282 | return rc; | 282 | return rc; |
283 | 283 | ||
@@ -361,7 +361,7 @@ debug_info_create(const char *name, int pages_per_area, int nr_areas, | |||
361 | debug_area_last = rc; | 361 | debug_area_last = rc; |
362 | rc->next = NULL; | 362 | rc->next = NULL; |
363 | 363 | ||
364 | debug_info_get(rc); | 364 | refcount_set(&rc->ref_count, 1); |
365 | out: | 365 | out: |
366 | return rc; | 366 | return rc; |
367 | } | 367 | } |
@@ -416,7 +416,7 @@ static void | |||
416 | debug_info_get(debug_info_t * db_info) | 416 | debug_info_get(debug_info_t * db_info) |
417 | { | 417 | { |
418 | if (db_info) | 418 | if (db_info) |
419 | atomic_inc(&db_info->ref_count); | 419 | refcount_inc(&db_info->ref_count); |
420 | } | 420 | } |
421 | 421 | ||
422 | /* | 422 | /* |
@@ -431,7 +431,7 @@ debug_info_put(debug_info_t *db_info) | |||
431 | 431 | ||
432 | if (!db_info) | 432 | if (!db_info) |
433 | return; | 433 | return; |
434 | if (atomic_dec_and_test(&db_info->ref_count)) { | 434 | if (refcount_dec_and_test(&db_info->ref_count)) { |
435 | for (i = 0; i < DEBUG_MAX_VIEWS; i++) { | 435 | for (i = 0; i < DEBUG_MAX_VIEWS; i++) { |
436 | if (!db_info->views[i]) | 436 | if (!db_info->views[i]) |
437 | continue; | 437 | continue; |
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index a5f5d3bb3dbc..e408d9cc5b96 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S | |||
@@ -312,6 +312,7 @@ ENTRY(system_call) | |||
312 | lg %r14,__LC_VDSO_PER_CPU | 312 | lg %r14,__LC_VDSO_PER_CPU |
313 | lmg %r0,%r10,__PT_R0(%r11) | 313 | lmg %r0,%r10,__PT_R0(%r11) |
314 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r11) | 314 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r11) |
315 | .Lsysc_exit_timer: | ||
315 | stpt __LC_EXIT_TIMER | 316 | stpt __LC_EXIT_TIMER |
316 | mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER | 317 | mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER |
317 | lmg %r11,%r15,__PT_R11(%r11) | 318 | lmg %r11,%r15,__PT_R11(%r11) |
@@ -623,6 +624,7 @@ ENTRY(io_int_handler) | |||
623 | lg %r14,__LC_VDSO_PER_CPU | 624 | lg %r14,__LC_VDSO_PER_CPU |
624 | lmg %r0,%r10,__PT_R0(%r11) | 625 | lmg %r0,%r10,__PT_R0(%r11) |
625 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r11) | 626 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r11) |
627 | .Lio_exit_timer: | ||
626 | stpt __LC_EXIT_TIMER | 628 | stpt __LC_EXIT_TIMER |
627 | mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER | 629 | mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER |
628 | lmg %r11,%r15,__PT_R11(%r11) | 630 | lmg %r11,%r15,__PT_R11(%r11) |
@@ -1174,15 +1176,23 @@ cleanup_critical: | |||
1174 | br %r14 | 1176 | br %r14 |
1175 | 1177 | ||
1176 | .Lcleanup_sysc_restore: | 1178 | .Lcleanup_sysc_restore: |
1179 | # check if stpt has been executed | ||
1177 | clg %r9,BASED(.Lcleanup_sysc_restore_insn) | 1180 | clg %r9,BASED(.Lcleanup_sysc_restore_insn) |
1181 | jh 0f | ||
1182 | mvc __LC_EXIT_TIMER(8),__LC_ASYNC_ENTER_TIMER | ||
1183 | cghi %r11,__LC_SAVE_AREA_ASYNC | ||
1178 | je 0f | 1184 | je 0f |
1185 | mvc __LC_EXIT_TIMER(8),__LC_MCCK_ENTER_TIMER | ||
1186 | 0: clg %r9,BASED(.Lcleanup_sysc_restore_insn+8) | ||
1187 | je 1f | ||
1179 | lg %r9,24(%r11) # get saved pointer to pt_regs | 1188 | lg %r9,24(%r11) # get saved pointer to pt_regs |
1180 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r9) | 1189 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r9) |
1181 | mvc 0(64,%r11),__PT_R8(%r9) | 1190 | mvc 0(64,%r11),__PT_R8(%r9) |
1182 | lmg %r0,%r7,__PT_R0(%r9) | 1191 | lmg %r0,%r7,__PT_R0(%r9) |
1183 | 0: lmg %r8,%r9,__LC_RETURN_PSW | 1192 | 1: lmg %r8,%r9,__LC_RETURN_PSW |
1184 | br %r14 | 1193 | br %r14 |
1185 | .Lcleanup_sysc_restore_insn: | 1194 | .Lcleanup_sysc_restore_insn: |
1195 | .quad .Lsysc_exit_timer | ||
1186 | .quad .Lsysc_done - 4 | 1196 | .quad .Lsysc_done - 4 |
1187 | 1197 | ||
1188 | .Lcleanup_io_tif: | 1198 | .Lcleanup_io_tif: |
@@ -1190,15 +1200,20 @@ cleanup_critical: | |||
1190 | br %r14 | 1200 | br %r14 |
1191 | 1201 | ||
1192 | .Lcleanup_io_restore: | 1202 | .Lcleanup_io_restore: |
1203 | # check if stpt has been executed | ||
1193 | clg %r9,BASED(.Lcleanup_io_restore_insn) | 1204 | clg %r9,BASED(.Lcleanup_io_restore_insn) |
1194 | je 0f | 1205 | jh 0f |
1206 | mvc __LC_EXIT_TIMER(8),__LC_MCCK_ENTER_TIMER | ||
1207 | 0: clg %r9,BASED(.Lcleanup_io_restore_insn+8) | ||
1208 | je 1f | ||
1195 | lg %r9,24(%r11) # get saved r11 pointer to pt_regs | 1209 | lg %r9,24(%r11) # get saved r11 pointer to pt_regs |
1196 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r9) | 1210 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r9) |
1197 | mvc 0(64,%r11),__PT_R8(%r9) | 1211 | mvc 0(64,%r11),__PT_R8(%r9) |
1198 | lmg %r0,%r7,__PT_R0(%r9) | 1212 | lmg %r0,%r7,__PT_R0(%r9) |
1199 | 0: lmg %r8,%r9,__LC_RETURN_PSW | 1213 | 1: lmg %r8,%r9,__LC_RETURN_PSW |
1200 | br %r14 | 1214 | br %r14 |
1201 | .Lcleanup_io_restore_insn: | 1215 | .Lcleanup_io_restore_insn: |
1216 | .quad .Lio_exit_timer | ||
1202 | .quad .Lio_done - 4 | 1217 | .quad .Lio_done - 4 |
1203 | 1218 | ||
1204 | .Lcleanup_idle: | 1219 | .Lcleanup_idle: |
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c index 27477f34cc0a..d03a6d12c4bd 100644 --- a/arch/s390/kernel/ftrace.c +++ b/arch/s390/kernel/ftrace.c | |||
@@ -173,6 +173,8 @@ int __init ftrace_dyn_arch_init(void) | |||
173 | return 0; | 173 | return 0; |
174 | } | 174 | } |
175 | 175 | ||
176 | #ifdef CONFIG_MODULES | ||
177 | |||
176 | static int __init ftrace_plt_init(void) | 178 | static int __init ftrace_plt_init(void) |
177 | { | 179 | { |
178 | unsigned int *ip; | 180 | unsigned int *ip; |
@@ -191,6 +193,8 @@ static int __init ftrace_plt_init(void) | |||
191 | } | 193 | } |
192 | device_initcall(ftrace_plt_init); | 194 | device_initcall(ftrace_plt_init); |
193 | 195 | ||
196 | #endif /* CONFIG_MODULES */ | ||
197 | |||
194 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 198 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
195 | /* | 199 | /* |
196 | * Hook the return address and push it in the stack of return addresses | 200 | * Hook the return address and push it in the stack of return addresses |
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index 72307f108c40..6e2c42bd1c3b 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S | |||
@@ -31,8 +31,14 @@ SECTIONS | |||
31 | { | 31 | { |
32 | . = 0x00000000; | 32 | . = 0x00000000; |
33 | .text : { | 33 | .text : { |
34 | _text = .; /* Text and read-only data */ | 34 | /* Text and read-only data */ |
35 | HEAD_TEXT | 35 | HEAD_TEXT |
36 | /* | ||
37 | * E.g. perf doesn't like symbols starting at address zero, | ||
38 | * therefore skip the initial PSW and channel program located | ||
39 | * at address zero and let _text start at 0x200. | ||
40 | */ | ||
41 | _text = 0x200; | ||
36 | TEXT_TEXT | 42 | TEXT_TEXT |
37 | SCHED_TEXT | 43 | SCHED_TEXT |
38 | CPUIDLE_TEXT | 44 | CPUIDLE_TEXT |
diff --git a/arch/s390/lib/probes.c b/arch/s390/lib/probes.c index ae90e1ae3607..1963ddbf4ab3 100644 --- a/arch/s390/lib/probes.c +++ b/arch/s390/lib/probes.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright IBM Corp. 2014 | 4 | * Copyright IBM Corp. 2014 |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/errno.h> | ||
7 | #include <asm/kprobes.h> | 8 | #include <asm/kprobes.h> |
8 | #include <asm/dis.h> | 9 | #include <asm/dis.h> |
9 | 10 | ||
diff --git a/arch/s390/lib/uaccess.c b/arch/s390/lib/uaccess.c index 1e5bb2b86c42..b3bd3f23b8e8 100644 --- a/arch/s390/lib/uaccess.c +++ b/arch/s390/lib/uaccess.c | |||
@@ -337,8 +337,8 @@ long __strncpy_from_user(char *dst, const char __user *src, long size) | |||
337 | return 0; | 337 | return 0; |
338 | done = 0; | 338 | done = 0; |
339 | do { | 339 | do { |
340 | offset = (size_t)src & ~PAGE_MASK; | 340 | offset = (size_t)src & (L1_CACHE_BYTES - 1); |
341 | len = min(size - done, PAGE_SIZE - offset); | 341 | len = min(size - done, L1_CACHE_BYTES - offset); |
342 | if (copy_from_user(dst, src, len)) | 342 | if (copy_from_user(dst, src, len)) |
343 | return -EFAULT; | 343 | return -EFAULT; |
344 | len_str = strnlen(dst, len); | 344 | len_str = strnlen(dst, len); |
diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index dcbf985ab243..d1f837dc77a4 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h | |||
@@ -24,9 +24,11 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, | |||
24 | static inline int prepare_hugepage_range(struct file *file, | 24 | static inline int prepare_hugepage_range(struct file *file, |
25 | unsigned long addr, unsigned long len) | 25 | unsigned long addr, unsigned long len) |
26 | { | 26 | { |
27 | if (len & ~HPAGE_MASK) | 27 | struct hstate *h = hstate_file(file); |
28 | |||
29 | if (len & ~huge_page_mask(h)) | ||
28 | return -EINVAL; | 30 | return -EINVAL; |
29 | if (addr & ~HPAGE_MASK) | 31 | if (addr & ~huge_page_mask(h)) |
30 | return -EINVAL; | 32 | return -EINVAL; |
31 | return 0; | 33 | return 0; |
32 | } | 34 | } |
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h index ce6f56980aef..cf190728360b 100644 --- a/arch/sparc/include/asm/pgtable_32.h +++ b/arch/sparc/include/asm/pgtable_32.h | |||
@@ -91,9 +91,9 @@ extern unsigned long pfn_base; | |||
91 | * ZERO_PAGE is a global shared page that is always zero: used | 91 | * ZERO_PAGE is a global shared page that is always zero: used |
92 | * for zero-mapped memory areas etc.. | 92 | * for zero-mapped memory areas etc.. |
93 | */ | 93 | */ |
94 | extern unsigned long empty_zero_page; | 94 | extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
95 | 95 | ||
96 | #define ZERO_PAGE(vaddr) (virt_to_page(&empty_zero_page)) | 96 | #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) |
97 | 97 | ||
98 | /* | 98 | /* |
99 | * In general all page table modifications should use the V8 atomic | 99 | * In general all page table modifications should use the V8 atomic |
diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h index 478bf6bb4598..3fae200dd251 100644 --- a/arch/sparc/include/asm/setup.h +++ b/arch/sparc/include/asm/setup.h | |||
@@ -16,7 +16,7 @@ extern char reboot_command[]; | |||
16 | */ | 16 | */ |
17 | extern unsigned char boot_cpu_id; | 17 | extern unsigned char boot_cpu_id; |
18 | 18 | ||
19 | extern unsigned long empty_zero_page; | 19 | extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
20 | 20 | ||
21 | extern int serial_console; | 21 | extern int serial_console; |
22 | static inline int con_is_present(void) | 22 | static inline int con_is_present(void) |
diff --git a/arch/sparc/kernel/ftrace.c b/arch/sparc/kernel/ftrace.c index 6bcff698069b..cec54dc4ab81 100644 --- a/arch/sparc/kernel/ftrace.c +++ b/arch/sparc/kernel/ftrace.c | |||
@@ -130,17 +130,16 @@ unsigned long prepare_ftrace_return(unsigned long parent, | |||
130 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) | 130 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) |
131 | return parent + 8UL; | 131 | return parent + 8UL; |
132 | 132 | ||
133 | if (ftrace_push_return_trace(parent, self_addr, &trace.depth, | ||
134 | frame_pointer, NULL) == -EBUSY) | ||
135 | return parent + 8UL; | ||
136 | |||
137 | trace.func = self_addr; | 133 | trace.func = self_addr; |
134 | trace.depth = current->curr_ret_stack + 1; | ||
138 | 135 | ||
139 | /* Only trace if the calling function expects to */ | 136 | /* Only trace if the calling function expects to */ |
140 | if (!ftrace_graph_entry(&trace)) { | 137 | if (!ftrace_graph_entry(&trace)) |
141 | current->curr_ret_stack--; | 138 | return parent + 8UL; |
139 | |||
140 | if (ftrace_push_return_trace(parent, self_addr, &trace.depth, | ||
141 | frame_pointer, NULL) == -EBUSY) | ||
142 | return parent + 8UL; | 142 | return parent + 8UL; |
143 | } | ||
144 | 143 | ||
145 | return return_hooker; | 144 | return return_hooker; |
146 | } | 145 | } |
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c index c6afe98de4d9..3bd0d513bddb 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c | |||
@@ -290,7 +290,7 @@ void __init mem_init(void) | |||
290 | 290 | ||
291 | 291 | ||
292 | /* Saves us work later. */ | 292 | /* Saves us work later. */ |
293 | memset((void *)&empty_zero_page, 0, PAGE_SIZE); | 293 | memset((void *)empty_zero_page, 0, PAGE_SIZE); |
294 | 294 | ||
295 | i = last_valid_pfn >> ((20 - PAGE_SHIFT) + 5); | 295 | i = last_valid_pfn >> ((20 - PAGE_SHIFT) + 5); |
296 | i += 1; | 296 | i += 1; |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 9c761fea0c98..695605eb1dfb 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -43,7 +43,7 @@ | |||
43 | #define KVM_PRIVATE_MEM_SLOTS 3 | 43 | #define KVM_PRIVATE_MEM_SLOTS 3 |
44 | #define KVM_MEM_SLOTS_NUM (KVM_USER_MEM_SLOTS + KVM_PRIVATE_MEM_SLOTS) | 44 | #define KVM_MEM_SLOTS_NUM (KVM_USER_MEM_SLOTS + KVM_PRIVATE_MEM_SLOTS) |
45 | 45 | ||
46 | #define KVM_HALT_POLL_NS_DEFAULT 400000 | 46 | #define KVM_HALT_POLL_NS_DEFAULT 200000 |
47 | 47 | ||
48 | #define KVM_IRQCHIP_NUM_PINS KVM_IOAPIC_NUM_PINS | 48 | #define KVM_IRQCHIP_NUM_PINS KVM_IOAPIC_NUM_PINS |
49 | 49 | ||
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 68766b276d9e..a059aac9e937 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h | |||
@@ -319,10 +319,10 @@ do { \ | |||
319 | #define __get_user_asm_u64(x, ptr, retval, errret) \ | 319 | #define __get_user_asm_u64(x, ptr, retval, errret) \ |
320 | ({ \ | 320 | ({ \ |
321 | __typeof__(ptr) __ptr = (ptr); \ | 321 | __typeof__(ptr) __ptr = (ptr); \ |
322 | asm volatile(ASM_STAC "\n" \ | 322 | asm volatile("\n" \ |
323 | "1: movl %2,%%eax\n" \ | 323 | "1: movl %2,%%eax\n" \ |
324 | "2: movl %3,%%edx\n" \ | 324 | "2: movl %3,%%edx\n" \ |
325 | "3: " ASM_CLAC "\n" \ | 325 | "3:\n" \ |
326 | ".section .fixup,\"ax\"\n" \ | 326 | ".section .fixup,\"ax\"\n" \ |
327 | "4: mov %4,%0\n" \ | 327 | "4: mov %4,%0\n" \ |
328 | " xorl %%eax,%%eax\n" \ | 328 | " xorl %%eax,%%eax\n" \ |
@@ -331,7 +331,7 @@ do { \ | |||
331 | ".previous\n" \ | 331 | ".previous\n" \ |
332 | _ASM_EXTABLE(1b, 4b) \ | 332 | _ASM_EXTABLE(1b, 4b) \ |
333 | _ASM_EXTABLE(2b, 4b) \ | 333 | _ASM_EXTABLE(2b, 4b) \ |
334 | : "=r" (retval), "=A"(x) \ | 334 | : "=r" (retval), "=&A"(x) \ |
335 | : "m" (__m(__ptr)), "m" __m(((u32 *)(__ptr)) + 1), \ | 335 | : "m" (__m(__ptr)), "m" __m(((u32 *)(__ptr)) + 1), \ |
336 | "i" (errret), "0" (retval)); \ | 336 | "i" (errret), "0" (retval)); \ |
337 | }) | 337 | }) |
@@ -703,14 +703,15 @@ extern struct movsl_mask { | |||
703 | #define unsafe_put_user(x, ptr, err_label) \ | 703 | #define unsafe_put_user(x, ptr, err_label) \ |
704 | do { \ | 704 | do { \ |
705 | int __pu_err; \ | 705 | int __pu_err; \ |
706 | __put_user_size((x), (ptr), sizeof(*(ptr)), __pu_err, -EFAULT); \ | 706 | __typeof__(*(ptr)) __pu_val = (x); \ |
707 | __put_user_size(__pu_val, (ptr), sizeof(*(ptr)), __pu_err, -EFAULT); \ | ||
707 | if (unlikely(__pu_err)) goto err_label; \ | 708 | if (unlikely(__pu_err)) goto err_label; \ |
708 | } while (0) | 709 | } while (0) |
709 | 710 | ||
710 | #define unsafe_get_user(x, ptr, err_label) \ | 711 | #define unsafe_get_user(x, ptr, err_label) \ |
711 | do { \ | 712 | do { \ |
712 | int __gu_err; \ | 713 | int __gu_err; \ |
713 | unsigned long __gu_val; \ | 714 | __inttype(*(ptr)) __gu_val; \ |
714 | __get_user_size(__gu_val, (ptr), sizeof(*(ptr)), __gu_err, -EFAULT); \ | 715 | __get_user_size(__gu_val, (ptr), sizeof(*(ptr)), __gu_err, -EFAULT); \ |
715 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ | 716 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ |
716 | if (unlikely(__gu_err)) goto err_label; \ | 717 | if (unlikely(__gu_err)) goto err_label; \ |
diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c index c2f8dde3255c..d5d44c452624 100644 --- a/arch/x86/kernel/fpu/init.c +++ b/arch/x86/kernel/fpu/init.c | |||
@@ -90,6 +90,7 @@ static void fpu__init_system_early_generic(struct cpuinfo_x86 *c) | |||
90 | * Boot time FPU feature detection code: | 90 | * Boot time FPU feature detection code: |
91 | */ | 91 | */ |
92 | unsigned int mxcsr_feature_mask __read_mostly = 0xffffffffu; | 92 | unsigned int mxcsr_feature_mask __read_mostly = 0xffffffffu; |
93 | EXPORT_SYMBOL_GPL(mxcsr_feature_mask); | ||
93 | 94 | ||
94 | static void __init fpu__init_system_mxcsr(void) | 95 | static void __init fpu__init_system_mxcsr(void) |
95 | { | 96 | { |
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index c25cfaf584e7..0816ab2e8adc 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -4173,7 +4173,7 @@ static int check_dr_write(struct x86_emulate_ctxt *ctxt) | |||
4173 | 4173 | ||
4174 | static int check_svme(struct x86_emulate_ctxt *ctxt) | 4174 | static int check_svme(struct x86_emulate_ctxt *ctxt) |
4175 | { | 4175 | { |
4176 | u64 efer; | 4176 | u64 efer = 0; |
4177 | 4177 | ||
4178 | ctxt->ops->get_msr(ctxt, MSR_EFER, &efer); | 4178 | ctxt->ops->get_msr(ctxt, MSR_EFER, &efer); |
4179 | 4179 | ||
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 56241746abbd..b0454c7e4cff 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h | |||
@@ -283,11 +283,13 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, | |||
283 | pt_element_t pte; | 283 | pt_element_t pte; |
284 | pt_element_t __user *uninitialized_var(ptep_user); | 284 | pt_element_t __user *uninitialized_var(ptep_user); |
285 | gfn_t table_gfn; | 285 | gfn_t table_gfn; |
286 | unsigned index, pt_access, pte_access, accessed_dirty, pte_pkey; | 286 | u64 pt_access, pte_access; |
287 | unsigned index, accessed_dirty, pte_pkey; | ||
287 | unsigned nested_access; | 288 | unsigned nested_access; |
288 | gpa_t pte_gpa; | 289 | gpa_t pte_gpa; |
289 | bool have_ad; | 290 | bool have_ad; |
290 | int offset; | 291 | int offset; |
292 | u64 walk_nx_mask = 0; | ||
291 | const int write_fault = access & PFERR_WRITE_MASK; | 293 | const int write_fault = access & PFERR_WRITE_MASK; |
292 | const int user_fault = access & PFERR_USER_MASK; | 294 | const int user_fault = access & PFERR_USER_MASK; |
293 | const int fetch_fault = access & PFERR_FETCH_MASK; | 295 | const int fetch_fault = access & PFERR_FETCH_MASK; |
@@ -302,6 +304,7 @@ retry_walk: | |||
302 | have_ad = PT_HAVE_ACCESSED_DIRTY(mmu); | 304 | have_ad = PT_HAVE_ACCESSED_DIRTY(mmu); |
303 | 305 | ||
304 | #if PTTYPE == 64 | 306 | #if PTTYPE == 64 |
307 | walk_nx_mask = 1ULL << PT64_NX_SHIFT; | ||
305 | if (walker->level == PT32E_ROOT_LEVEL) { | 308 | if (walker->level == PT32E_ROOT_LEVEL) { |
306 | pte = mmu->get_pdptr(vcpu, (addr >> 30) & 3); | 309 | pte = mmu->get_pdptr(vcpu, (addr >> 30) & 3); |
307 | trace_kvm_mmu_paging_element(pte, walker->level); | 310 | trace_kvm_mmu_paging_element(pte, walker->level); |
@@ -313,8 +316,6 @@ retry_walk: | |||
313 | walker->max_level = walker->level; | 316 | walker->max_level = walker->level; |
314 | ASSERT(!(is_long_mode(vcpu) && !is_pae(vcpu))); | 317 | ASSERT(!(is_long_mode(vcpu) && !is_pae(vcpu))); |
315 | 318 | ||
316 | accessed_dirty = have_ad ? PT_GUEST_ACCESSED_MASK : 0; | ||
317 | |||
318 | /* | 319 | /* |
319 | * FIXME: on Intel processors, loads of the PDPTE registers for PAE paging | 320 | * FIXME: on Intel processors, loads of the PDPTE registers for PAE paging |
320 | * by the MOV to CR instruction are treated as reads and do not cause the | 321 | * by the MOV to CR instruction are treated as reads and do not cause the |
@@ -322,14 +323,14 @@ retry_walk: | |||
322 | */ | 323 | */ |
323 | nested_access = (have_ad ? PFERR_WRITE_MASK : 0) | PFERR_USER_MASK; | 324 | nested_access = (have_ad ? PFERR_WRITE_MASK : 0) | PFERR_USER_MASK; |
324 | 325 | ||
325 | pt_access = pte_access = ACC_ALL; | 326 | pte_access = ~0; |
326 | ++walker->level; | 327 | ++walker->level; |
327 | 328 | ||
328 | do { | 329 | do { |
329 | gfn_t real_gfn; | 330 | gfn_t real_gfn; |
330 | unsigned long host_addr; | 331 | unsigned long host_addr; |
331 | 332 | ||
332 | pt_access &= pte_access; | 333 | pt_access = pte_access; |
333 | --walker->level; | 334 | --walker->level; |
334 | 335 | ||
335 | index = PT_INDEX(addr, walker->level); | 336 | index = PT_INDEX(addr, walker->level); |
@@ -371,6 +372,12 @@ retry_walk: | |||
371 | 372 | ||
372 | trace_kvm_mmu_paging_element(pte, walker->level); | 373 | trace_kvm_mmu_paging_element(pte, walker->level); |
373 | 374 | ||
375 | /* | ||
376 | * Inverting the NX it lets us AND it like other | ||
377 | * permission bits. | ||
378 | */ | ||
379 | pte_access = pt_access & (pte ^ walk_nx_mask); | ||
380 | |||
374 | if (unlikely(!FNAME(is_present_gpte)(pte))) | 381 | if (unlikely(!FNAME(is_present_gpte)(pte))) |
375 | goto error; | 382 | goto error; |
376 | 383 | ||
@@ -379,14 +386,16 @@ retry_walk: | |||
379 | goto error; | 386 | goto error; |
380 | } | 387 | } |
381 | 388 | ||
382 | accessed_dirty &= pte; | ||
383 | pte_access = pt_access & FNAME(gpte_access)(vcpu, pte); | ||
384 | |||
385 | walker->ptes[walker->level - 1] = pte; | 389 | walker->ptes[walker->level - 1] = pte; |
386 | } while (!is_last_gpte(mmu, walker->level, pte)); | 390 | } while (!is_last_gpte(mmu, walker->level, pte)); |
387 | 391 | ||
388 | pte_pkey = FNAME(gpte_pkeys)(vcpu, pte); | 392 | pte_pkey = FNAME(gpte_pkeys)(vcpu, pte); |
389 | errcode = permission_fault(vcpu, mmu, pte_access, pte_pkey, access); | 393 | accessed_dirty = have_ad ? pte_access & PT_GUEST_ACCESSED_MASK : 0; |
394 | |||
395 | /* Convert to ACC_*_MASK flags for struct guest_walker. */ | ||
396 | walker->pt_access = FNAME(gpte_access)(vcpu, pt_access ^ walk_nx_mask); | ||
397 | walker->pte_access = FNAME(gpte_access)(vcpu, pte_access ^ walk_nx_mask); | ||
398 | errcode = permission_fault(vcpu, mmu, walker->pte_access, pte_pkey, access); | ||
390 | if (unlikely(errcode)) | 399 | if (unlikely(errcode)) |
391 | goto error; | 400 | goto error; |
392 | 401 | ||
@@ -403,7 +412,7 @@ retry_walk: | |||
403 | walker->gfn = real_gpa >> PAGE_SHIFT; | 412 | walker->gfn = real_gpa >> PAGE_SHIFT; |
404 | 413 | ||
405 | if (!write_fault) | 414 | if (!write_fault) |
406 | FNAME(protect_clean_gpte)(mmu, &pte_access, pte); | 415 | FNAME(protect_clean_gpte)(mmu, &walker->pte_access, pte); |
407 | else | 416 | else |
408 | /* | 417 | /* |
409 | * On a write fault, fold the dirty bit into accessed_dirty. | 418 | * On a write fault, fold the dirty bit into accessed_dirty. |
@@ -421,10 +430,8 @@ retry_walk: | |||
421 | goto retry_walk; | 430 | goto retry_walk; |
422 | } | 431 | } |
423 | 432 | ||
424 | walker->pt_access = pt_access; | ||
425 | walker->pte_access = pte_access; | ||
426 | pgprintk("%s: pte %llx pte_access %x pt_access %x\n", | 433 | pgprintk("%s: pte %llx pte_access %x pt_access %x\n", |
427 | __func__, (u64)pte, pte_access, pt_access); | 434 | __func__, (u64)pte, walker->pte_access, walker->pt_access); |
428 | return 1; | 435 | return 1; |
429 | 436 | ||
430 | error: | 437 | error: |
@@ -452,7 +459,7 @@ error: | |||
452 | */ | 459 | */ |
453 | if (!(errcode & PFERR_RSVD_MASK)) { | 460 | if (!(errcode & PFERR_RSVD_MASK)) { |
454 | vcpu->arch.exit_qualification &= 0x187; | 461 | vcpu->arch.exit_qualification &= 0x187; |
455 | vcpu->arch.exit_qualification |= ((pt_access & pte) & 0x7) << 3; | 462 | vcpu->arch.exit_qualification |= (pte_access & 0x7) << 3; |
456 | } | 463 | } |
457 | #endif | 464 | #endif |
458 | walker->fault.address = addr; | 465 | walker->fault.address = addr; |
diff --git a/arch/x86/kvm/pmu_intel.c b/arch/x86/kvm/pmu_intel.c index 9d4a8504a95a..5ab4a364348e 100644 --- a/arch/x86/kvm/pmu_intel.c +++ b/arch/x86/kvm/pmu_intel.c | |||
@@ -294,7 +294,7 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) | |||
294 | ((u64)1 << edx.split.bit_width_fixed) - 1; | 294 | ((u64)1 << edx.split.bit_width_fixed) - 1; |
295 | } | 295 | } |
296 | 296 | ||
297 | pmu->global_ctrl = ((1 << pmu->nr_arch_gp_counters) - 1) | | 297 | pmu->global_ctrl = ((1ull << pmu->nr_arch_gp_counters) - 1) | |
298 | (((1ull << pmu->nr_arch_fixed_counters) - 1) << INTEL_PMC_IDX_FIXED); | 298 | (((1ull << pmu->nr_arch_fixed_counters) - 1) << INTEL_PMC_IDX_FIXED); |
299 | pmu->global_ctrl_mask = ~pmu->global_ctrl; | 299 | pmu->global_ctrl_mask = ~pmu->global_ctrl; |
300 | 300 | ||
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index c27ac6923a18..183ddb235fb4 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -1272,7 +1272,8 @@ static void init_vmcb(struct vcpu_svm *svm) | |||
1272 | 1272 | ||
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | static u64 *avic_get_physical_id_entry(struct kvm_vcpu *vcpu, int index) | 1275 | static u64 *avic_get_physical_id_entry(struct kvm_vcpu *vcpu, |
1276 | unsigned int index) | ||
1276 | { | 1277 | { |
1277 | u64 *avic_physical_id_table; | 1278 | u64 *avic_physical_id_table; |
1278 | struct kvm_arch *vm_data = &vcpu->kvm->arch; | 1279 | struct kvm_arch *vm_data = &vcpu->kvm->arch; |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index c6f4ad44aa95..72f78396bc09 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -6504,7 +6504,7 @@ static __init int hardware_setup(void) | |||
6504 | enable_ept_ad_bits = 0; | 6504 | enable_ept_ad_bits = 0; |
6505 | } | 6505 | } |
6506 | 6506 | ||
6507 | if (!cpu_has_vmx_ept_ad_bits()) | 6507 | if (!cpu_has_vmx_ept_ad_bits() || !enable_ept) |
6508 | enable_ept_ad_bits = 0; | 6508 | enable_ept_ad_bits = 0; |
6509 | 6509 | ||
6510 | if (!cpu_has_vmx_unrestricted_guest()) | 6510 | if (!cpu_has_vmx_unrestricted_guest()) |
@@ -11213,7 +11213,7 @@ static int vmx_write_pml_buffer(struct kvm_vcpu *vcpu) | |||
11213 | if (!nested_cpu_has_pml(vmcs12)) | 11213 | if (!nested_cpu_has_pml(vmcs12)) |
11214 | return 0; | 11214 | return 0; |
11215 | 11215 | ||
11216 | if (vmcs12->guest_pml_index > PML_ENTITY_NUM) { | 11216 | if (vmcs12->guest_pml_index >= PML_ENTITY_NUM) { |
11217 | vmx->nested.pml_full = true; | 11217 | vmx->nested.pml_full = true; |
11218 | return 1; | 11218 | return 1; |
11219 | } | 11219 | } |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 464da936c53d..02363e37d4a6 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1763,6 +1763,7 @@ u64 get_kvmclock_ns(struct kvm *kvm) | |||
1763 | { | 1763 | { |
1764 | struct kvm_arch *ka = &kvm->arch; | 1764 | struct kvm_arch *ka = &kvm->arch; |
1765 | struct pvclock_vcpu_time_info hv_clock; | 1765 | struct pvclock_vcpu_time_info hv_clock; |
1766 | u64 ret; | ||
1766 | 1767 | ||
1767 | spin_lock(&ka->pvclock_gtod_sync_lock); | 1768 | spin_lock(&ka->pvclock_gtod_sync_lock); |
1768 | if (!ka->use_master_clock) { | 1769 | if (!ka->use_master_clock) { |
@@ -1774,10 +1775,17 @@ u64 get_kvmclock_ns(struct kvm *kvm) | |||
1774 | hv_clock.system_time = ka->master_kernel_ns + ka->kvmclock_offset; | 1775 | hv_clock.system_time = ka->master_kernel_ns + ka->kvmclock_offset; |
1775 | spin_unlock(&ka->pvclock_gtod_sync_lock); | 1776 | spin_unlock(&ka->pvclock_gtod_sync_lock); |
1776 | 1777 | ||
1778 | /* both __this_cpu_read() and rdtsc() should be on the same cpu */ | ||
1779 | get_cpu(); | ||
1780 | |||
1777 | kvm_get_time_scale(NSEC_PER_SEC, __this_cpu_read(cpu_tsc_khz) * 1000LL, | 1781 | kvm_get_time_scale(NSEC_PER_SEC, __this_cpu_read(cpu_tsc_khz) * 1000LL, |
1778 | &hv_clock.tsc_shift, | 1782 | &hv_clock.tsc_shift, |
1779 | &hv_clock.tsc_to_system_mul); | 1783 | &hv_clock.tsc_to_system_mul); |
1780 | return __pvclock_read_cycles(&hv_clock, rdtsc()); | 1784 | ret = __pvclock_read_cycles(&hv_clock, rdtsc()); |
1785 | |||
1786 | put_cpu(); | ||
1787 | |||
1788 | return ret; | ||
1781 | } | 1789 | } |
1782 | 1790 | ||
1783 | static void kvm_setup_pvclock_page(struct kvm_vcpu *v) | 1791 | static void kvm_setup_pvclock_page(struct kvm_vcpu *v) |
@@ -3288,11 +3296,14 @@ static void kvm_vcpu_ioctl_x86_get_xsave(struct kvm_vcpu *vcpu, | |||
3288 | } | 3296 | } |
3289 | } | 3297 | } |
3290 | 3298 | ||
3299 | #define XSAVE_MXCSR_OFFSET 24 | ||
3300 | |||
3291 | static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu, | 3301 | static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu, |
3292 | struct kvm_xsave *guest_xsave) | 3302 | struct kvm_xsave *guest_xsave) |
3293 | { | 3303 | { |
3294 | u64 xstate_bv = | 3304 | u64 xstate_bv = |
3295 | *(u64 *)&guest_xsave->region[XSAVE_HDR_OFFSET / sizeof(u32)]; | 3305 | *(u64 *)&guest_xsave->region[XSAVE_HDR_OFFSET / sizeof(u32)]; |
3306 | u32 mxcsr = *(u32 *)&guest_xsave->region[XSAVE_MXCSR_OFFSET / sizeof(u32)]; | ||
3296 | 3307 | ||
3297 | if (boot_cpu_has(X86_FEATURE_XSAVE)) { | 3308 | if (boot_cpu_has(X86_FEATURE_XSAVE)) { |
3298 | /* | 3309 | /* |
@@ -3300,11 +3311,13 @@ static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu, | |||
3300 | * CPUID leaf 0xD, index 0, EDX:EAX. This is for compatibility | 3311 | * CPUID leaf 0xD, index 0, EDX:EAX. This is for compatibility |
3301 | * with old userspace. | 3312 | * with old userspace. |
3302 | */ | 3313 | */ |
3303 | if (xstate_bv & ~kvm_supported_xcr0()) | 3314 | if (xstate_bv & ~kvm_supported_xcr0() || |
3315 | mxcsr & ~mxcsr_feature_mask) | ||
3304 | return -EINVAL; | 3316 | return -EINVAL; |
3305 | load_xsave(vcpu, (u8 *)guest_xsave->region); | 3317 | load_xsave(vcpu, (u8 *)guest_xsave->region); |
3306 | } else { | 3318 | } else { |
3307 | if (xstate_bv & ~XFEATURE_MASK_FPSSE) | 3319 | if (xstate_bv & ~XFEATURE_MASK_FPSSE || |
3320 | mxcsr & ~mxcsr_feature_mask) | ||
3308 | return -EINVAL; | 3321 | return -EINVAL; |
3309 | memcpy(&vcpu->arch.guest_fpu.state.fxsave, | 3322 | memcpy(&vcpu->arch.guest_fpu.state.fxsave, |
3310 | guest_xsave->region, sizeof(struct fxregs_state)); | 3323 | guest_xsave->region, sizeof(struct fxregs_state)); |
@@ -4818,16 +4831,20 @@ emul_write: | |||
4818 | 4831 | ||
4819 | static int kernel_pio(struct kvm_vcpu *vcpu, void *pd) | 4832 | static int kernel_pio(struct kvm_vcpu *vcpu, void *pd) |
4820 | { | 4833 | { |
4821 | /* TODO: String I/O for in kernel device */ | 4834 | int r = 0, i; |
4822 | int r; | ||
4823 | 4835 | ||
4824 | if (vcpu->arch.pio.in) | 4836 | for (i = 0; i < vcpu->arch.pio.count; i++) { |
4825 | r = kvm_io_bus_read(vcpu, KVM_PIO_BUS, vcpu->arch.pio.port, | 4837 | if (vcpu->arch.pio.in) |
4826 | vcpu->arch.pio.size, pd); | 4838 | r = kvm_io_bus_read(vcpu, KVM_PIO_BUS, vcpu->arch.pio.port, |
4827 | else | 4839 | vcpu->arch.pio.size, pd); |
4828 | r = kvm_io_bus_write(vcpu, KVM_PIO_BUS, | 4840 | else |
4829 | vcpu->arch.pio.port, vcpu->arch.pio.size, | 4841 | r = kvm_io_bus_write(vcpu, KVM_PIO_BUS, |
4830 | pd); | 4842 | vcpu->arch.pio.port, vcpu->arch.pio.size, |
4843 | pd); | ||
4844 | if (r) | ||
4845 | break; | ||
4846 | pd += vcpu->arch.pio.size; | ||
4847 | } | ||
4831 | return r; | 4848 | return r; |
4832 | } | 4849 | } |
4833 | 4850 | ||
@@ -4865,6 +4882,8 @@ static int emulator_pio_in_emulated(struct x86_emulate_ctxt *ctxt, | |||
4865 | if (vcpu->arch.pio.count) | 4882 | if (vcpu->arch.pio.count) |
4866 | goto data_avail; | 4883 | goto data_avail; |
4867 | 4884 | ||
4885 | memset(vcpu->arch.pio_data, 0, size * count); | ||
4886 | |||
4868 | ret = emulator_pio_in_out(vcpu, size, port, val, count, true); | 4887 | ret = emulator_pio_in_out(vcpu, size, port, val, count, true); |
4869 | if (ret) { | 4888 | if (ret) { |
4870 | data_avail: | 4889 | data_avail: |
@@ -5048,6 +5067,8 @@ static bool emulator_get_segment(struct x86_emulate_ctxt *ctxt, u16 *selector, | |||
5048 | 5067 | ||
5049 | if (var.unusable) { | 5068 | if (var.unusable) { |
5050 | memset(desc, 0, sizeof(*desc)); | 5069 | memset(desc, 0, sizeof(*desc)); |
5070 | if (base3) | ||
5071 | *base3 = 0; | ||
5051 | return false; | 5072 | return false; |
5052 | } | 5073 | } |
5053 | 5074 | ||
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index 7cd442690f9d..f33eef4ebd12 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c | |||
@@ -142,9 +142,7 @@ static void __init xen_banner(void) | |||
142 | struct xen_extraversion extra; | 142 | struct xen_extraversion extra; |
143 | HYPERVISOR_xen_version(XENVER_extraversion, &extra); | 143 | HYPERVISOR_xen_version(XENVER_extraversion, &extra); |
144 | 144 | ||
145 | pr_info("Booting paravirtualized kernel %son %s\n", | 145 | pr_info("Booting paravirtualized kernel on %s\n", pv_info.name); |
146 | xen_feature(XENFEAT_auto_translated_physmap) ? | ||
147 | "with PVH extensions " : "", pv_info.name); | ||
148 | printk(KERN_INFO "Xen version: %d.%d%s%s\n", | 146 | printk(KERN_INFO "Xen version: %d.%d%s%s\n", |
149 | version >> 16, version & 0xffff, extra.extraversion, | 147 | version >> 16, version & 0xffff, extra.extraversion, |
150 | xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); | 148 | xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); |
@@ -957,15 +955,10 @@ static void xen_write_msr(unsigned int msr, unsigned low, unsigned high) | |||
957 | 955 | ||
958 | void xen_setup_shared_info(void) | 956 | void xen_setup_shared_info(void) |
959 | { | 957 | { |
960 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | 958 | set_fixmap(FIX_PARAVIRT_BOOTMAP, xen_start_info->shared_info); |
961 | set_fixmap(FIX_PARAVIRT_BOOTMAP, | ||
962 | xen_start_info->shared_info); | ||
963 | 959 | ||
964 | HYPERVISOR_shared_info = | 960 | HYPERVISOR_shared_info = |
965 | (struct shared_info *)fix_to_virt(FIX_PARAVIRT_BOOTMAP); | 961 | (struct shared_info *)fix_to_virt(FIX_PARAVIRT_BOOTMAP); |
966 | } else | ||
967 | HYPERVISOR_shared_info = | ||
968 | (struct shared_info *)__va(xen_start_info->shared_info); | ||
969 | 962 | ||
970 | #ifndef CONFIG_SMP | 963 | #ifndef CONFIG_SMP |
971 | /* In UP this is as good a place as any to set up shared info */ | 964 | /* In UP this is as good a place as any to set up shared info */ |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 5e375a5e815f..3be06f3caf3c 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -42,7 +42,7 @@ xmaddr_t arbitrary_virt_to_machine(void *vaddr) | |||
42 | } | 42 | } |
43 | EXPORT_SYMBOL_GPL(arbitrary_virt_to_machine); | 43 | EXPORT_SYMBOL_GPL(arbitrary_virt_to_machine); |
44 | 44 | ||
45 | void xen_flush_tlb_all(void) | 45 | static void xen_flush_tlb_all(void) |
46 | { | 46 | { |
47 | struct mmuext_op *op; | 47 | struct mmuext_op *op; |
48 | struct multicall_space mcs; | 48 | struct multicall_space mcs; |
diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c index 7397d8b8459d..1f386d7fdf70 100644 --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c | |||
@@ -355,10 +355,8 @@ static pteval_t pte_pfn_to_mfn(pteval_t val) | |||
355 | pteval_t flags = val & PTE_FLAGS_MASK; | 355 | pteval_t flags = val & PTE_FLAGS_MASK; |
356 | unsigned long mfn; | 356 | unsigned long mfn; |
357 | 357 | ||
358 | if (!xen_feature(XENFEAT_auto_translated_physmap)) | 358 | mfn = __pfn_to_mfn(pfn); |
359 | mfn = __pfn_to_mfn(pfn); | 359 | |
360 | else | ||
361 | mfn = pfn; | ||
362 | /* | 360 | /* |
363 | * If there's no mfn for the pfn, then just create an | 361 | * If there's no mfn for the pfn, then just create an |
364 | * empty non-present pte. Unfortunately this loses | 362 | * empty non-present pte. Unfortunately this loses |
@@ -647,9 +645,6 @@ static int __xen_pgd_walk(struct mm_struct *mm, pgd_t *pgd, | |||
647 | limit--; | 645 | limit--; |
648 | BUG_ON(limit >= FIXADDR_TOP); | 646 | BUG_ON(limit >= FIXADDR_TOP); |
649 | 647 | ||
650 | if (xen_feature(XENFEAT_auto_translated_physmap)) | ||
651 | return 0; | ||
652 | |||
653 | /* | 648 | /* |
654 | * 64-bit has a great big hole in the middle of the address | 649 | * 64-bit has a great big hole in the middle of the address |
655 | * space, which contains the Xen mappings. On 32-bit these | 650 | * space, which contains the Xen mappings. On 32-bit these |
@@ -1289,9 +1284,6 @@ static void __init xen_pagetable_cleanhighmap(void) | |||
1289 | 1284 | ||
1290 | static void __init xen_pagetable_p2m_setup(void) | 1285 | static void __init xen_pagetable_p2m_setup(void) |
1291 | { | 1286 | { |
1292 | if (xen_feature(XENFEAT_auto_translated_physmap)) | ||
1293 | return; | ||
1294 | |||
1295 | xen_vmalloc_p2m_tree(); | 1287 | xen_vmalloc_p2m_tree(); |
1296 | 1288 | ||
1297 | #ifdef CONFIG_X86_64 | 1289 | #ifdef CONFIG_X86_64 |
@@ -1314,8 +1306,7 @@ static void __init xen_pagetable_init(void) | |||
1314 | xen_build_mfn_list_list(); | 1306 | xen_build_mfn_list_list(); |
1315 | 1307 | ||
1316 | /* Remap memory freed due to conflicts with E820 map */ | 1308 | /* Remap memory freed due to conflicts with E820 map */ |
1317 | if (!xen_feature(XENFEAT_auto_translated_physmap)) | 1309 | xen_remap_memory(); |
1318 | xen_remap_memory(); | ||
1319 | 1310 | ||
1320 | xen_setup_shared_info(); | 1311 | xen_setup_shared_info(); |
1321 | } | 1312 | } |
@@ -1925,21 +1916,20 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) | |||
1925 | /* Zap identity mapping */ | 1916 | /* Zap identity mapping */ |
1926 | init_level4_pgt[0] = __pgd(0); | 1917 | init_level4_pgt[0] = __pgd(0); |
1927 | 1918 | ||
1928 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | 1919 | /* Pre-constructed entries are in pfn, so convert to mfn */ |
1929 | /* Pre-constructed entries are in pfn, so convert to mfn */ | 1920 | /* L4[272] -> level3_ident_pgt */ |
1930 | /* L4[272] -> level3_ident_pgt | 1921 | /* L4[511] -> level3_kernel_pgt */ |
1931 | * L4[511] -> level3_kernel_pgt */ | 1922 | convert_pfn_mfn(init_level4_pgt); |
1932 | convert_pfn_mfn(init_level4_pgt); | ||
1933 | 1923 | ||
1934 | /* L3_i[0] -> level2_ident_pgt */ | 1924 | /* L3_i[0] -> level2_ident_pgt */ |
1935 | convert_pfn_mfn(level3_ident_pgt); | 1925 | convert_pfn_mfn(level3_ident_pgt); |
1936 | /* L3_k[510] -> level2_kernel_pgt | 1926 | /* L3_k[510] -> level2_kernel_pgt */ |
1937 | * L3_k[511] -> level2_fixmap_pgt */ | 1927 | /* L3_k[511] -> level2_fixmap_pgt */ |
1938 | convert_pfn_mfn(level3_kernel_pgt); | 1928 | convert_pfn_mfn(level3_kernel_pgt); |
1929 | |||
1930 | /* L3_k[511][506] -> level1_fixmap_pgt */ | ||
1931 | convert_pfn_mfn(level2_fixmap_pgt); | ||
1939 | 1932 | ||
1940 | /* L3_k[511][506] -> level1_fixmap_pgt */ | ||
1941 | convert_pfn_mfn(level2_fixmap_pgt); | ||
1942 | } | ||
1943 | /* We get [511][511] and have Xen's version of level2_kernel_pgt */ | 1933 | /* We get [511][511] and have Xen's version of level2_kernel_pgt */ |
1944 | l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); | 1934 | l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); |
1945 | l2 = m2v(l3[pud_index(__START_KERNEL_map)].pud); | 1935 | l2 = m2v(l3[pud_index(__START_KERNEL_map)].pud); |
@@ -1962,34 +1952,30 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) | |||
1962 | if (i && i < pgd_index(__START_KERNEL_map)) | 1952 | if (i && i < pgd_index(__START_KERNEL_map)) |
1963 | init_level4_pgt[i] = ((pgd_t *)xen_start_info->pt_base)[i]; | 1953 | init_level4_pgt[i] = ((pgd_t *)xen_start_info->pt_base)[i]; |
1964 | 1954 | ||
1965 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | 1955 | /* Make pagetable pieces RO */ |
1966 | /* Make pagetable pieces RO */ | 1956 | set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); |
1967 | set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); | 1957 | set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO); |
1968 | set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO); | 1958 | set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO); |
1969 | set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO); | 1959 | set_page_prot(level3_user_vsyscall, PAGE_KERNEL_RO); |
1970 | set_page_prot(level3_user_vsyscall, PAGE_KERNEL_RO); | 1960 | set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); |
1971 | set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); | 1961 | set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); |
1972 | set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); | 1962 | set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); |
1973 | set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); | 1963 | set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO); |
1974 | set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO); | 1964 | |
1975 | 1965 | /* Pin down new L4 */ | |
1976 | /* Pin down new L4 */ | 1966 | pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, |
1977 | pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, | 1967 | PFN_DOWN(__pa_symbol(init_level4_pgt))); |
1978 | PFN_DOWN(__pa_symbol(init_level4_pgt))); | 1968 | |
1979 | 1969 | /* Unpin Xen-provided one */ | |
1980 | /* Unpin Xen-provided one */ | 1970 | pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd))); |
1981 | pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd))); | ||
1982 | 1971 | ||
1983 | /* | 1972 | /* |
1984 | * At this stage there can be no user pgd, and no page | 1973 | * At this stage there can be no user pgd, and no page structure to |
1985 | * structure to attach it to, so make sure we just set kernel | 1974 | * attach it to, so make sure we just set kernel pgd. |
1986 | * pgd. | 1975 | */ |
1987 | */ | 1976 | xen_mc_batch(); |
1988 | xen_mc_batch(); | 1977 | __xen_write_cr3(true, __pa(init_level4_pgt)); |
1989 | __xen_write_cr3(true, __pa(init_level4_pgt)); | 1978 | xen_mc_issue(PARAVIRT_LAZY_CPU); |
1990 | xen_mc_issue(PARAVIRT_LAZY_CPU); | ||
1991 | } else | ||
1992 | native_write_cr3(__pa(init_level4_pgt)); | ||
1993 | 1979 | ||
1994 | /* We can't that easily rip out L3 and L2, as the Xen pagetables are | 1980 | /* We can't that easily rip out L3 and L2, as the Xen pagetables are |
1995 | * set out this way: [L4], [L1], [L2], [L3], [L1], [L1] ... for | 1981 | * set out this way: [L4], [L1], [L2], [L3], [L1], [L1] ... for |
@@ -2403,9 +2389,6 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) | |||
2403 | 2389 | ||
2404 | static void __init xen_post_allocator_init(void) | 2390 | static void __init xen_post_allocator_init(void) |
2405 | { | 2391 | { |
2406 | if (xen_feature(XENFEAT_auto_translated_physmap)) | ||
2407 | return; | ||
2408 | |||
2409 | pv_mmu_ops.set_pte = xen_set_pte; | 2392 | pv_mmu_ops.set_pte = xen_set_pte; |
2410 | pv_mmu_ops.set_pmd = xen_set_pmd; | 2393 | pv_mmu_ops.set_pmd = xen_set_pmd; |
2411 | pv_mmu_ops.set_pud = xen_set_pud; | 2394 | pv_mmu_ops.set_pud = xen_set_pud; |
@@ -2511,9 +2494,6 @@ void __init xen_init_mmu_ops(void) | |||
2511 | { | 2494 | { |
2512 | x86_init.paging.pagetable_init = xen_pagetable_init; | 2495 | x86_init.paging.pagetable_init = xen_pagetable_init; |
2513 | 2496 | ||
2514 | if (xen_feature(XENFEAT_auto_translated_physmap)) | ||
2515 | return; | ||
2516 | |||
2517 | pv_mmu_ops = xen_mmu_ops; | 2497 | pv_mmu_ops = xen_mmu_ops; |
2518 | 2498 | ||
2519 | memset(dummy_mapping, 0xff, PAGE_SIZE); | 2499 | memset(dummy_mapping, 0xff, PAGE_SIZE); |
@@ -2650,9 +2630,6 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, | |||
2650 | * this function are redundant and can be ignored. | 2630 | * this function are redundant and can be ignored. |
2651 | */ | 2631 | */ |
2652 | 2632 | ||
2653 | if (xen_feature(XENFEAT_auto_translated_physmap)) | ||
2654 | return 0; | ||
2655 | |||
2656 | if (unlikely(order > MAX_CONTIG_ORDER)) | 2633 | if (unlikely(order > MAX_CONTIG_ORDER)) |
2657 | return -ENOMEM; | 2634 | return -ENOMEM; |
2658 | 2635 | ||
@@ -2689,9 +2666,6 @@ void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order) | |||
2689 | int success; | 2666 | int success; |
2690 | unsigned long vstart; | 2667 | unsigned long vstart; |
2691 | 2668 | ||
2692 | if (xen_feature(XENFEAT_auto_translated_physmap)) | ||
2693 | return; | ||
2694 | |||
2695 | if (unlikely(order > MAX_CONTIG_ORDER)) | 2669 | if (unlikely(order > MAX_CONTIG_ORDER)) |
2696 | return; | 2670 | return; |
2697 | 2671 | ||
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c index b5730e17b455..656624314f0d 100644 --- a/drivers/block/drbd/drbd_req.c +++ b/drivers/block/drbd/drbd_req.c | |||
@@ -315,24 +315,32 @@ void drbd_req_complete(struct drbd_request *req, struct bio_and_error *m) | |||
315 | } | 315 | } |
316 | 316 | ||
317 | /* still holds resource->req_lock */ | 317 | /* still holds resource->req_lock */ |
318 | static int drbd_req_put_completion_ref(struct drbd_request *req, struct bio_and_error *m, int put) | 318 | static void drbd_req_put_completion_ref(struct drbd_request *req, struct bio_and_error *m, int put) |
319 | { | 319 | { |
320 | struct drbd_device *device = req->device; | 320 | struct drbd_device *device = req->device; |
321 | D_ASSERT(device, m || (req->rq_state & RQ_POSTPONED)); | 321 | D_ASSERT(device, m || (req->rq_state & RQ_POSTPONED)); |
322 | 322 | ||
323 | if (!put) | ||
324 | return; | ||
325 | |||
323 | if (!atomic_sub_and_test(put, &req->completion_ref)) | 326 | if (!atomic_sub_and_test(put, &req->completion_ref)) |
324 | return 0; | 327 | return; |
325 | 328 | ||
326 | drbd_req_complete(req, m); | 329 | drbd_req_complete(req, m); |
327 | 330 | ||
331 | /* local completion may still come in later, | ||
332 | * we need to keep the req object around. */ | ||
333 | if (req->rq_state & RQ_LOCAL_ABORTED) | ||
334 | return; | ||
335 | |||
328 | if (req->rq_state & RQ_POSTPONED) { | 336 | if (req->rq_state & RQ_POSTPONED) { |
329 | /* don't destroy the req object just yet, | 337 | /* don't destroy the req object just yet, |
330 | * but queue it for retry */ | 338 | * but queue it for retry */ |
331 | drbd_restart_request(req); | 339 | drbd_restart_request(req); |
332 | return 0; | 340 | return; |
333 | } | 341 | } |
334 | 342 | ||
335 | return 1; | 343 | kref_put(&req->kref, drbd_req_destroy); |
336 | } | 344 | } |
337 | 345 | ||
338 | static void set_if_null_req_next(struct drbd_peer_device *peer_device, struct drbd_request *req) | 346 | static void set_if_null_req_next(struct drbd_peer_device *peer_device, struct drbd_request *req) |
@@ -519,12 +527,8 @@ static void mod_rq_state(struct drbd_request *req, struct bio_and_error *m, | |||
519 | if (req->i.waiting) | 527 | if (req->i.waiting) |
520 | wake_up(&device->misc_wait); | 528 | wake_up(&device->misc_wait); |
521 | 529 | ||
522 | if (c_put) { | 530 | drbd_req_put_completion_ref(req, m, c_put); |
523 | if (drbd_req_put_completion_ref(req, m, c_put)) | 531 | kref_put(&req->kref, drbd_req_destroy); |
524 | kref_put(&req->kref, drbd_req_destroy); | ||
525 | } else { | ||
526 | kref_put(&req->kref, drbd_req_destroy); | ||
527 | } | ||
528 | } | 532 | } |
529 | 533 | ||
530 | static void drbd_report_io_error(struct drbd_device *device, struct drbd_request *req) | 534 | static void drbd_report_io_error(struct drbd_device *device, struct drbd_request *req) |
@@ -1366,8 +1370,7 @@ nodata: | |||
1366 | } | 1370 | } |
1367 | 1371 | ||
1368 | out: | 1372 | out: |
1369 | if (drbd_req_put_completion_ref(req, &m, 1)) | 1373 | drbd_req_put_completion_ref(req, &m, 1); |
1370 | kref_put(&req->kref, drbd_req_destroy); | ||
1371 | spin_unlock_irq(&resource->req_lock); | 1374 | spin_unlock_irq(&resource->req_lock); |
1372 | 1375 | ||
1373 | /* Even though above is a kref_put(), this is safe. | 1376 | /* Even though above is a kref_put(), this is safe. |
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 8fe61b5dc5a6..1f3dfaa54d87 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -504,11 +504,13 @@ static int xen_blkbk_remove(struct xenbus_device *dev) | |||
504 | 504 | ||
505 | dev_set_drvdata(&dev->dev, NULL); | 505 | dev_set_drvdata(&dev->dev, NULL); |
506 | 506 | ||
507 | if (be->blkif) | 507 | if (be->blkif) { |
508 | xen_blkif_disconnect(be->blkif); | 508 | xen_blkif_disconnect(be->blkif); |
509 | 509 | ||
510 | /* Put the reference we set in xen_blkif_alloc(). */ | 510 | /* Put the reference we set in xen_blkif_alloc(). */ |
511 | xen_blkif_put(be->blkif); | 511 | xen_blkif_put(be->blkif); |
512 | } | ||
513 | |||
512 | kfree(be->mode); | 514 | kfree(be->mode); |
513 | kfree(be); | 515 | kfree(be); |
514 | return 0; | 516 | return 0; |
diff --git a/drivers/char/lp.c b/drivers/char/lp.c index 565e4cf04a02..8249762192d5 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c | |||
@@ -859,7 +859,11 @@ static int __init lp_setup (char *str) | |||
859 | } else if (!strcmp(str, "auto")) { | 859 | } else if (!strcmp(str, "auto")) { |
860 | parport_nr[0] = LP_PARPORT_AUTO; | 860 | parport_nr[0] = LP_PARPORT_AUTO; |
861 | } else if (!strcmp(str, "none")) { | 861 | } else if (!strcmp(str, "none")) { |
862 | parport_nr[parport_ptr++] = LP_PARPORT_NONE; | 862 | if (parport_ptr < LP_NO) |
863 | parport_nr[parport_ptr++] = LP_PARPORT_NONE; | ||
864 | else | ||
865 | printk(KERN_INFO "lp: too many ports, %s ignored.\n", | ||
866 | str); | ||
863 | } else if (!strcmp(str, "reset")) { | 867 | } else if (!strcmp(str, "reset")) { |
864 | reset = 1; | 868 | reset = 1; |
865 | } | 869 | } |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 7e4a9d1296bb..6e0cbe092220 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -340,6 +340,11 @@ static const struct vm_operations_struct mmap_mem_ops = { | |||
340 | static int mmap_mem(struct file *file, struct vm_area_struct *vma) | 340 | static int mmap_mem(struct file *file, struct vm_area_struct *vma) |
341 | { | 341 | { |
342 | size_t size = vma->vm_end - vma->vm_start; | 342 | size_t size = vma->vm_end - vma->vm_start; |
343 | phys_addr_t offset = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT; | ||
344 | |||
345 | /* It's illegal to wrap around the end of the physical address space. */ | ||
346 | if (offset + (phys_addr_t)size < offset) | ||
347 | return -EINVAL; | ||
343 | 348 | ||
344 | if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size)) | 349 | if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size)) |
345 | return -EINVAL; | 350 | return -EINVAL; |
diff --git a/drivers/dax/super.c b/drivers/dax/super.c index ebf43f531ada..6ed32aac8bbe 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c | |||
@@ -44,6 +44,7 @@ void dax_read_unlock(int id) | |||
44 | } | 44 | } |
45 | EXPORT_SYMBOL_GPL(dax_read_unlock); | 45 | EXPORT_SYMBOL_GPL(dax_read_unlock); |
46 | 46 | ||
47 | #ifdef CONFIG_BLOCK | ||
47 | int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size, | 48 | int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size, |
48 | pgoff_t *pgoff) | 49 | pgoff_t *pgoff) |
49 | { | 50 | { |
@@ -112,6 +113,7 @@ int __bdev_dax_supported(struct super_block *sb, int blocksize) | |||
112 | return 0; | 113 | return 0; |
113 | } | 114 | } |
114 | EXPORT_SYMBOL_GPL(__bdev_dax_supported); | 115 | EXPORT_SYMBOL_GPL(__bdev_dax_supported); |
116 | #endif | ||
115 | 117 | ||
116 | /** | 118 | /** |
117 | * struct dax_device - anchor object for dax services | 119 | * struct dax_device - anchor object for dax services |
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 82dab1692264..3aea55698165 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -782,24 +782,26 @@ static void debug_dump_dramcfg_low(struct amd64_pvt *pvt, u32 dclr, int chan) | |||
782 | 782 | ||
783 | static void debug_display_dimm_sizes_df(struct amd64_pvt *pvt, u8 ctrl) | 783 | static void debug_display_dimm_sizes_df(struct amd64_pvt *pvt, u8 ctrl) |
784 | { | 784 | { |
785 | u32 *dcsb = ctrl ? pvt->csels[1].csbases : pvt->csels[0].csbases; | 785 | int dimm, size0, size1, cs0, cs1; |
786 | int dimm, size0, size1; | ||
787 | 786 | ||
788 | edac_printk(KERN_DEBUG, EDAC_MC, "UMC%d chip selects:\n", ctrl); | 787 | edac_printk(KERN_DEBUG, EDAC_MC, "UMC%d chip selects:\n", ctrl); |
789 | 788 | ||
790 | for (dimm = 0; dimm < 4; dimm++) { | 789 | for (dimm = 0; dimm < 4; dimm++) { |
791 | size0 = 0; | 790 | size0 = 0; |
791 | cs0 = dimm * 2; | ||
792 | 792 | ||
793 | if (dcsb[dimm*2] & DCSB_CS_ENABLE) | 793 | if (csrow_enabled(cs0, ctrl, pvt)) |
794 | size0 = pvt->ops->dbam_to_cs(pvt, ctrl, 0, dimm); | 794 | size0 = pvt->ops->dbam_to_cs(pvt, ctrl, 0, cs0); |
795 | 795 | ||
796 | size1 = 0; | 796 | size1 = 0; |
797 | if (dcsb[dimm*2 + 1] & DCSB_CS_ENABLE) | 797 | cs1 = dimm * 2 + 1; |
798 | size1 = pvt->ops->dbam_to_cs(pvt, ctrl, 0, dimm); | 798 | |
799 | if (csrow_enabled(cs1, ctrl, pvt)) | ||
800 | size1 = pvt->ops->dbam_to_cs(pvt, ctrl, 0, cs1); | ||
799 | 801 | ||
800 | amd64_info(EDAC_MC ": %d: %5dMB %d: %5dMB\n", | 802 | amd64_info(EDAC_MC ": %d: %5dMB %d: %5dMB\n", |
801 | dimm * 2, size0, | 803 | cs0, size0, |
802 | dimm * 2 + 1, size1); | 804 | cs1, size1); |
803 | } | 805 | } |
804 | } | 806 | } |
805 | 807 | ||
@@ -2756,26 +2758,22 @@ skip: | |||
2756 | * encompasses | 2758 | * encompasses |
2757 | * | 2759 | * |
2758 | */ | 2760 | */ |
2759 | static u32 get_csrow_nr_pages(struct amd64_pvt *pvt, u8 dct, int csrow_nr) | 2761 | static u32 get_csrow_nr_pages(struct amd64_pvt *pvt, u8 dct, int csrow_nr_orig) |
2760 | { | 2762 | { |
2761 | u32 cs_mode, nr_pages; | ||
2762 | u32 dbam = dct ? pvt->dbam1 : pvt->dbam0; | 2763 | u32 dbam = dct ? pvt->dbam1 : pvt->dbam0; |
2764 | int csrow_nr = csrow_nr_orig; | ||
2765 | u32 cs_mode, nr_pages; | ||
2763 | 2766 | ||
2767 | if (!pvt->umc) | ||
2768 | csrow_nr >>= 1; | ||
2764 | 2769 | ||
2765 | /* | 2770 | cs_mode = DBAM_DIMM(csrow_nr, dbam); |
2766 | * The math on this doesn't look right on the surface because x/2*4 can | ||
2767 | * be simplified to x*2 but this expression makes use of the fact that | ||
2768 | * it is integral math where 1/2=0. This intermediate value becomes the | ||
2769 | * number of bits to shift the DBAM register to extract the proper CSROW | ||
2770 | * field. | ||
2771 | */ | ||
2772 | cs_mode = DBAM_DIMM(csrow_nr / 2, dbam); | ||
2773 | 2771 | ||
2774 | nr_pages = pvt->ops->dbam_to_cs(pvt, dct, cs_mode, (csrow_nr / 2)) | 2772 | nr_pages = pvt->ops->dbam_to_cs(pvt, dct, cs_mode, csrow_nr); |
2775 | << (20 - PAGE_SHIFT); | 2773 | nr_pages <<= 20 - PAGE_SHIFT; |
2776 | 2774 | ||
2777 | edac_dbg(0, "csrow: %d, channel: %d, DBAM idx: %d\n", | 2775 | edac_dbg(0, "csrow: %d, channel: %d, DBAM idx: %d\n", |
2778 | csrow_nr, dct, cs_mode); | 2776 | csrow_nr_orig, dct, cs_mode); |
2779 | edac_dbg(0, "nr_pages/channel: %u\n", nr_pages); | 2777 | edac_dbg(0, "nr_pages/channel: %u\n", nr_pages); |
2780 | 2778 | ||
2781 | return nr_pages; | 2779 | return nr_pages; |
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index ed3137c1ceb0..ab3a951a17e6 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c | |||
@@ -155,19 +155,14 @@ static int efi_pstore_scan_sysfs_exit(struct efivar_entry *pos, | |||
155 | * efi_pstore_sysfs_entry_iter | 155 | * efi_pstore_sysfs_entry_iter |
156 | * | 156 | * |
157 | * @record: pstore record to pass to callback | 157 | * @record: pstore record to pass to callback |
158 | * @pos: entry to begin iterating from | ||
159 | * | 158 | * |
160 | * You MUST call efivar_enter_iter_begin() before this function, and | 159 | * You MUST call efivar_enter_iter_begin() before this function, and |
161 | * efivar_entry_iter_end() afterwards. | 160 | * efivar_entry_iter_end() afterwards. |
162 | * | 161 | * |
163 | * It is possible to begin iteration from an arbitrary entry within | ||
164 | * the list by passing @pos. @pos is updated on return to point to | ||
165 | * the next entry of the last one passed to efi_pstore_read_func(). | ||
166 | * To begin iterating from the beginning of the list @pos must be %NULL. | ||
167 | */ | 162 | */ |
168 | static int efi_pstore_sysfs_entry_iter(struct pstore_record *record, | 163 | static int efi_pstore_sysfs_entry_iter(struct pstore_record *record) |
169 | struct efivar_entry **pos) | ||
170 | { | 164 | { |
165 | struct efivar_entry **pos = (struct efivar_entry **)&record->psi->data; | ||
171 | struct efivar_entry *entry, *n; | 166 | struct efivar_entry *entry, *n; |
172 | struct list_head *head = &efivar_sysfs_list; | 167 | struct list_head *head = &efivar_sysfs_list; |
173 | int size = 0; | 168 | int size = 0; |
@@ -218,7 +213,6 @@ static int efi_pstore_sysfs_entry_iter(struct pstore_record *record, | |||
218 | */ | 213 | */ |
219 | static ssize_t efi_pstore_read(struct pstore_record *record) | 214 | static ssize_t efi_pstore_read(struct pstore_record *record) |
220 | { | 215 | { |
221 | struct efivar_entry *entry = (struct efivar_entry *)record->psi->data; | ||
222 | ssize_t size; | 216 | ssize_t size; |
223 | 217 | ||
224 | record->buf = kzalloc(EFIVARS_DATA_SIZE_MAX, GFP_KERNEL); | 218 | record->buf = kzalloc(EFIVARS_DATA_SIZE_MAX, GFP_KERNEL); |
@@ -229,7 +223,7 @@ static ssize_t efi_pstore_read(struct pstore_record *record) | |||
229 | size = -EINTR; | 223 | size = -EINTR; |
230 | goto out; | 224 | goto out; |
231 | } | 225 | } |
232 | size = efi_pstore_sysfs_entry_iter(record, &entry); | 226 | size = efi_pstore_sysfs_entry_iter(record); |
233 | efivar_entry_iter_end(); | 227 | efivar_entry_iter_end(); |
234 | 228 | ||
235 | out: | 229 | out: |
diff --git a/drivers/firmware/google/vpd.c b/drivers/firmware/google/vpd.c index 3ce813110d5e..1e7860f02f4f 100644 --- a/drivers/firmware/google/vpd.c +++ b/drivers/firmware/google/vpd.c | |||
@@ -116,9 +116,13 @@ static int vpd_section_attrib_add(const u8 *key, s32 key_len, | |||
116 | return VPD_OK; | 116 | return VPD_OK; |
117 | 117 | ||
118 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 118 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
119 | info->key = kzalloc(key_len + 1, GFP_KERNEL); | 119 | if (!info) |
120 | if (!info->key) | ||
121 | return -ENOMEM; | 120 | return -ENOMEM; |
121 | info->key = kzalloc(key_len + 1, GFP_KERNEL); | ||
122 | if (!info->key) { | ||
123 | ret = -ENOMEM; | ||
124 | goto free_info; | ||
125 | } | ||
122 | 126 | ||
123 | memcpy(info->key, key, key_len); | 127 | memcpy(info->key, key, key_len); |
124 | 128 | ||
@@ -135,12 +139,17 @@ static int vpd_section_attrib_add(const u8 *key, s32 key_len, | |||
135 | list_add_tail(&info->list, &sec->attribs); | 139 | list_add_tail(&info->list, &sec->attribs); |
136 | 140 | ||
137 | ret = sysfs_create_bin_file(sec->kobj, &info->bin_attr); | 141 | ret = sysfs_create_bin_file(sec->kobj, &info->bin_attr); |
138 | if (ret) { | 142 | if (ret) |
139 | kfree(info->key); | 143 | goto free_info_key; |
140 | return ret; | ||
141 | } | ||
142 | 144 | ||
143 | return 0; | 145 | return 0; |
146 | |||
147 | free_info_key: | ||
148 | kfree(info->key); | ||
149 | free_info: | ||
150 | kfree(info); | ||
151 | |||
152 | return ret; | ||
144 | } | 153 | } |
145 | 154 | ||
146 | static void vpd_section_attrib_destroy(struct vpd_section *sec) | 155 | static void vpd_section_attrib_destroy(struct vpd_section *sec) |
diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index 874ff32db366..00cfed3c3e1a 100644 --- a/drivers/firmware/ti_sci.c +++ b/drivers/firmware/ti_sci.c | |||
@@ -202,7 +202,8 @@ static int ti_sci_debugfs_create(struct platform_device *pdev, | |||
202 | info->debug_buffer[info->debug_region_size] = 0; | 202 | info->debug_buffer[info->debug_region_size] = 0; |
203 | 203 | ||
204 | info->d = debugfs_create_file(strncat(debug_name, dev_name(dev), | 204 | info->d = debugfs_create_file(strncat(debug_name, dev_name(dev), |
205 | sizeof(debug_name)), | 205 | sizeof(debug_name) - |
206 | sizeof("ti_sci_debug@")), | ||
206 | 0444, NULL, info, &ti_sci_debug_fops); | 207 | 0444, NULL, info, &ti_sci_debug_fops); |
207 | if (IS_ERR(info->d)) | 208 | if (IS_ERR(info->d)) |
208 | return PTR_ERR(info->d); | 209 | return PTR_ERR(info->d); |
diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c index 798a3cc480a2..1a3359c0f6cd 100644 --- a/drivers/gpu/drm/arm/hdlcd_crtc.c +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <drm/drmP.h> | 12 | #include <drm/drmP.h> |
13 | #include <drm/drm_atomic.h> | ||
13 | #include <drm/drm_atomic_helper.h> | 14 | #include <drm/drm_atomic_helper.h> |
14 | #include <drm/drm_crtc.h> | 15 | #include <drm/drm_crtc.h> |
15 | #include <drm/drm_crtc_helper.h> | 16 | #include <drm/drm_crtc_helper.h> |
@@ -226,16 +227,33 @@ static const struct drm_crtc_helper_funcs hdlcd_crtc_helper_funcs = { | |||
226 | static int hdlcd_plane_atomic_check(struct drm_plane *plane, | 227 | static int hdlcd_plane_atomic_check(struct drm_plane *plane, |
227 | struct drm_plane_state *state) | 228 | struct drm_plane_state *state) |
228 | { | 229 | { |
229 | u32 src_w, src_h; | 230 | struct drm_rect clip = { 0 }; |
231 | struct drm_crtc_state *crtc_state; | ||
232 | u32 src_h = state->src_h >> 16; | ||
230 | 233 | ||
231 | src_w = state->src_w >> 16; | 234 | /* only the HDLCD_REG_FB_LINE_COUNT register has a limit */ |
232 | src_h = state->src_h >> 16; | 235 | if (src_h >= HDLCD_MAX_YRES) { |
236 | DRM_DEBUG_KMS("Invalid source width: %d\n", src_h); | ||
237 | return -EINVAL; | ||
238 | } | ||
239 | |||
240 | if (!state->fb || !state->crtc) | ||
241 | return 0; | ||
233 | 242 | ||
234 | /* we can't do any scaling of the plane source */ | 243 | crtc_state = drm_atomic_get_existing_crtc_state(state->state, |
235 | if ((src_w != state->crtc_w) || (src_h != state->crtc_h)) | 244 | state->crtc); |
245 | if (!crtc_state) { | ||
246 | DRM_DEBUG_KMS("Invalid crtc state\n"); | ||
236 | return -EINVAL; | 247 | return -EINVAL; |
248 | } | ||
237 | 249 | ||
238 | return 0; | 250 | clip.x2 = crtc_state->adjusted_mode.hdisplay; |
251 | clip.y2 = crtc_state->adjusted_mode.vdisplay; | ||
252 | |||
253 | return drm_plane_helper_check_state(state, &clip, | ||
254 | DRM_PLANE_HELPER_NO_SCALING, | ||
255 | DRM_PLANE_HELPER_NO_SCALING, | ||
256 | false, true); | ||
239 | } | 257 | } |
240 | 258 | ||
241 | static void hdlcd_plane_atomic_update(struct drm_plane *plane, | 259 | static void hdlcd_plane_atomic_update(struct drm_plane *plane, |
@@ -244,21 +262,20 @@ static void hdlcd_plane_atomic_update(struct drm_plane *plane, | |||
244 | struct drm_framebuffer *fb = plane->state->fb; | 262 | struct drm_framebuffer *fb = plane->state->fb; |
245 | struct hdlcd_drm_private *hdlcd; | 263 | struct hdlcd_drm_private *hdlcd; |
246 | struct drm_gem_cma_object *gem; | 264 | struct drm_gem_cma_object *gem; |
247 | u32 src_w, src_h, dest_w, dest_h; | 265 | u32 src_x, src_y, dest_h; |
248 | dma_addr_t scanout_start; | 266 | dma_addr_t scanout_start; |
249 | 267 | ||
250 | if (!fb) | 268 | if (!fb) |
251 | return; | 269 | return; |
252 | 270 | ||
253 | src_w = plane->state->src_w >> 16; | 271 | src_x = plane->state->src.x1 >> 16; |
254 | src_h = plane->state->src_h >> 16; | 272 | src_y = plane->state->src.y1 >> 16; |
255 | dest_w = plane->state->crtc_w; | 273 | dest_h = drm_rect_height(&plane->state->dst); |
256 | dest_h = plane->state->crtc_h; | ||
257 | gem = drm_fb_cma_get_gem_obj(fb, 0); | 274 | gem = drm_fb_cma_get_gem_obj(fb, 0); |
275 | |||
258 | scanout_start = gem->paddr + fb->offsets[0] + | 276 | scanout_start = gem->paddr + fb->offsets[0] + |
259 | plane->state->crtc_y * fb->pitches[0] + | 277 | src_y * fb->pitches[0] + |
260 | plane->state->crtc_x * | 278 | src_x * fb->format->cpp[0]; |
261 | fb->format->cpp[0]; | ||
262 | 279 | ||
263 | hdlcd = plane->dev->dev_private; | 280 | hdlcd = plane->dev->dev_private; |
264 | hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, fb->pitches[0]); | 281 | hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, fb->pitches[0]); |
@@ -305,7 +322,6 @@ static struct drm_plane *hdlcd_plane_init(struct drm_device *drm) | |||
305 | formats, ARRAY_SIZE(formats), | 322 | formats, ARRAY_SIZE(formats), |
306 | DRM_PLANE_TYPE_PRIMARY, NULL); | 323 | DRM_PLANE_TYPE_PRIMARY, NULL); |
307 | if (ret) { | 324 | if (ret) { |
308 | devm_kfree(drm->dev, plane); | ||
309 | return ERR_PTR(ret); | 325 | return ERR_PTR(ret); |
310 | } | 326 | } |
311 | 327 | ||
@@ -329,7 +345,6 @@ int hdlcd_setup_crtc(struct drm_device *drm) | |||
329 | &hdlcd_crtc_funcs, NULL); | 345 | &hdlcd_crtc_funcs, NULL); |
330 | if (ret) { | 346 | if (ret) { |
331 | hdlcd_plane_destroy(primary); | 347 | hdlcd_plane_destroy(primary); |
332 | devm_kfree(drm->dev, primary); | ||
333 | return ret; | 348 | return ret; |
334 | } | 349 | } |
335 | 350 | ||
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c index 65a3bd7a0c00..423dda2785d4 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | |||
@@ -152,8 +152,7 @@ static const struct drm_connector_funcs atmel_hlcdc_panel_connector_funcs = { | |||
152 | .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, | 152 | .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, |
153 | }; | 153 | }; |
154 | 154 | ||
155 | static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, | 155 | static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint) |
156 | const struct device_node *np) | ||
157 | { | 156 | { |
158 | struct atmel_hlcdc_dc *dc = dev->dev_private; | 157 | struct atmel_hlcdc_dc *dc = dev->dev_private; |
159 | struct atmel_hlcdc_rgb_output *output; | 158 | struct atmel_hlcdc_rgb_output *output; |
@@ -161,6 +160,11 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, | |||
161 | struct drm_bridge *bridge; | 160 | struct drm_bridge *bridge; |
162 | int ret; | 161 | int ret; |
163 | 162 | ||
163 | ret = drm_of_find_panel_or_bridge(dev->dev->of_node, 0, endpoint, | ||
164 | &panel, &bridge); | ||
165 | if (ret) | ||
166 | return ret; | ||
167 | |||
164 | output = devm_kzalloc(dev->dev, sizeof(*output), GFP_KERNEL); | 168 | output = devm_kzalloc(dev->dev, sizeof(*output), GFP_KERNEL); |
165 | if (!output) | 169 | if (!output) |
166 | return -EINVAL; | 170 | return -EINVAL; |
@@ -177,10 +181,6 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, | |||
177 | 181 | ||
178 | output->encoder.possible_crtcs = 0x1; | 182 | output->encoder.possible_crtcs = 0x1; |
179 | 183 | ||
180 | ret = drm_of_find_panel_or_bridge(np, 0, 0, &panel, &bridge); | ||
181 | if (ret) | ||
182 | return ret; | ||
183 | |||
184 | if (panel) { | 184 | if (panel) { |
185 | output->connector.dpms = DRM_MODE_DPMS_OFF; | 185 | output->connector.dpms = DRM_MODE_DPMS_OFF; |
186 | output->connector.polled = DRM_CONNECTOR_POLL_CONNECT; | 186 | output->connector.polled = DRM_CONNECTOR_POLL_CONNECT; |
@@ -220,22 +220,14 @@ err_encoder_cleanup: | |||
220 | 220 | ||
221 | int atmel_hlcdc_create_outputs(struct drm_device *dev) | 221 | int atmel_hlcdc_create_outputs(struct drm_device *dev) |
222 | { | 222 | { |
223 | struct device_node *remote; | 223 | int endpoint, ret = 0; |
224 | int ret = -ENODEV; | 224 | |
225 | int endpoint = 0; | 225 | for (endpoint = 0; !ret; endpoint++) |
226 | 226 | ret = atmel_hlcdc_attach_endpoint(dev, endpoint); | |
227 | while (true) { | 227 | |
228 | /* Loop thru possible multiple connections to the output */ | 228 | /* At least one device was successfully attached.*/ |
229 | remote = of_graph_get_remote_node(dev->dev->of_node, 0, | 229 | if (ret == -ENODEV && endpoint) |
230 | endpoint++); | 230 | return 0; |
231 | if (!remote) | ||
232 | break; | ||
233 | |||
234 | ret = atmel_hlcdc_attach_endpoint(dev, remote); | ||
235 | of_node_put(remote); | ||
236 | if (ret) | ||
237 | return ret; | ||
238 | } | ||
239 | 231 | ||
240 | return ret; | 232 | return ret; |
241 | } | 233 | } |
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c index e1909429837e..de80ee1b71df 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | |||
@@ -44,6 +44,7 @@ static struct etnaviv_gem_submit *submit_create(struct drm_device *dev, | |||
44 | 44 | ||
45 | /* initially, until copy_from_user() and bo lookup succeeds: */ | 45 | /* initially, until copy_from_user() and bo lookup succeeds: */ |
46 | submit->nr_bos = 0; | 46 | submit->nr_bos = 0; |
47 | submit->fence = NULL; | ||
47 | 48 | ||
48 | ww_acquire_init(&submit->ticket, &reservation_ww_class); | 49 | ww_acquire_init(&submit->ticket, &reservation_ww_class); |
49 | } | 50 | } |
@@ -294,7 +295,8 @@ static void submit_cleanup(struct etnaviv_gem_submit *submit) | |||
294 | } | 295 | } |
295 | 296 | ||
296 | ww_acquire_fini(&submit->ticket); | 297 | ww_acquire_fini(&submit->ticket); |
297 | dma_fence_put(submit->fence); | 298 | if (submit->fence) |
299 | dma_fence_put(submit->fence); | ||
298 | kfree(submit); | 300 | kfree(submit); |
299 | } | 301 | } |
300 | 302 | ||
diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c index 0ad1a508e2af..c995e540ff96 100644 --- a/drivers/gpu/drm/i915/gvt/handlers.c +++ b/drivers/gpu/drm/i915/gvt/handlers.c | |||
@@ -1244,7 +1244,7 @@ static int dma_ctrl_write(struct intel_vgpu *vgpu, unsigned int offset, | |||
1244 | mode = vgpu_vreg(vgpu, offset); | 1244 | mode = vgpu_vreg(vgpu, offset); |
1245 | 1245 | ||
1246 | if (GFX_MODE_BIT_SET_IN_MASK(mode, START_DMA)) { | 1246 | if (GFX_MODE_BIT_SET_IN_MASK(mode, START_DMA)) { |
1247 | WARN_ONCE(1, "VM(%d): iGVT-g doesn't supporte GuC\n", | 1247 | WARN_ONCE(1, "VM(%d): iGVT-g doesn't support GuC\n", |
1248 | vgpu->id); | 1248 | vgpu->id); |
1249 | return 0; | 1249 | return 0; |
1250 | } | 1250 | } |
diff --git a/drivers/gpu/drm/i915/gvt/render.c b/drivers/gpu/drm/i915/gvt/render.c index c6e7972ac21d..a5e11d89df2f 100644 --- a/drivers/gpu/drm/i915/gvt/render.c +++ b/drivers/gpu/drm/i915/gvt/render.c | |||
@@ -340,6 +340,9 @@ void intel_gvt_restore_render_mmio(struct intel_vgpu *vgpu, int ring_id) | |||
340 | } else | 340 | } else |
341 | v = mmio->value; | 341 | v = mmio->value; |
342 | 342 | ||
343 | if (mmio->in_context) | ||
344 | continue; | ||
345 | |||
343 | I915_WRITE(mmio->reg, v); | 346 | I915_WRITE(mmio->reg, v); |
344 | POSTING_READ(mmio->reg); | 347 | POSTING_READ(mmio->reg); |
345 | 348 | ||
diff --git a/drivers/gpu/drm/i915/gvt/sched_policy.c b/drivers/gpu/drm/i915/gvt/sched_policy.c index 79ba4b3440aa..f25ff133865f 100644 --- a/drivers/gpu/drm/i915/gvt/sched_policy.c +++ b/drivers/gpu/drm/i915/gvt/sched_policy.c | |||
@@ -129,9 +129,13 @@ static void try_to_schedule_next_vgpu(struct intel_gvt *gvt) | |||
129 | struct vgpu_sched_data *vgpu_data; | 129 | struct vgpu_sched_data *vgpu_data; |
130 | ktime_t cur_time; | 130 | ktime_t cur_time; |
131 | 131 | ||
132 | /* no target to schedule */ | 132 | /* no need to schedule if next_vgpu is the same with current_vgpu, |
133 | if (!scheduler->next_vgpu) | 133 | * let scheduler chose next_vgpu again by setting it to NULL. |
134 | */ | ||
135 | if (scheduler->next_vgpu == scheduler->current_vgpu) { | ||
136 | scheduler->next_vgpu = NULL; | ||
134 | return; | 137 | return; |
138 | } | ||
135 | 139 | ||
136 | /* | 140 | /* |
137 | * after the flag is set, workload dispatch thread will | 141 | * after the flag is set, workload dispatch thread will |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 2aa6b97fd22f..a0563e18d753 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -195,9 +195,12 @@ static int ppgtt_bind_vma(struct i915_vma *vma, | |||
195 | u32 pte_flags; | 195 | u32 pte_flags; |
196 | int ret; | 196 | int ret; |
197 | 197 | ||
198 | ret = vma->vm->allocate_va_range(vma->vm, vma->node.start, vma->size); | 198 | if (!(vma->flags & I915_VMA_LOCAL_BIND)) { |
199 | if (ret) | 199 | ret = vma->vm->allocate_va_range(vma->vm, vma->node.start, |
200 | return ret; | 200 | vma->size); |
201 | if (ret) | ||
202 | return ret; | ||
203 | } | ||
201 | 204 | ||
202 | vma->pages = vma->obj->mm.pages; | 205 | vma->pages = vma->obj->mm.pages; |
203 | 206 | ||
@@ -2306,7 +2309,8 @@ static int aliasing_gtt_bind_vma(struct i915_vma *vma, | |||
2306 | if (flags & I915_VMA_LOCAL_BIND) { | 2309 | if (flags & I915_VMA_LOCAL_BIND) { |
2307 | struct i915_hw_ppgtt *appgtt = i915->mm.aliasing_ppgtt; | 2310 | struct i915_hw_ppgtt *appgtt = i915->mm.aliasing_ppgtt; |
2308 | 2311 | ||
2309 | if (appgtt->base.allocate_va_range) { | 2312 | if (!(vma->flags & I915_VMA_LOCAL_BIND) && |
2313 | appgtt->base.allocate_va_range) { | ||
2310 | ret = appgtt->base.allocate_va_range(&appgtt->base, | 2314 | ret = appgtt->base.allocate_va_range(&appgtt->base, |
2311 | vma->node.start, | 2315 | vma->node.start, |
2312 | vma->node.size); | 2316 | vma->node.size); |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 11b12f412492..5a7c63e64381 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -3051,10 +3051,14 @@ enum skl_disp_power_wells { | |||
3051 | #define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */ | 3051 | #define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */ |
3052 | #define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */ | 3052 | #define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */ |
3053 | #define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */ | 3053 | #define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */ |
3054 | #define CLKCFG_FSB_1067_ALT (0 << 0) /* hrawclk 266 */ | ||
3054 | #define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */ | 3055 | #define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */ |
3055 | /* Note, below two are guess */ | 3056 | /* |
3056 | #define CLKCFG_FSB_1600 (4 << 0) /* hrawclk 400 */ | 3057 | * Note that on at least on ELK the below value is reported for both |
3057 | #define CLKCFG_FSB_1600_ALT (0 << 0) /* hrawclk 400 */ | 3058 | * 333 and 400 MHz BIOS FSB setting, but given that the gmch datasheet |
3059 | * lists only 200/266/333 MHz FSB as supported let's decode it as 333 MHz. | ||
3060 | */ | ||
3061 | #define CLKCFG_FSB_1333_ALT (4 << 0) /* hrawclk 333 */ | ||
3058 | #define CLKCFG_FSB_MASK (7 << 0) | 3062 | #define CLKCFG_FSB_MASK (7 << 0) |
3059 | #define CLKCFG_MEM_533 (1 << 4) | 3063 | #define CLKCFG_MEM_533 (1 << 4) |
3060 | #define CLKCFG_MEM_667 (2 << 4) | 3064 | #define CLKCFG_MEM_667 (2 << 4) |
diff --git a/drivers/gpu/drm/i915/intel_cdclk.c b/drivers/gpu/drm/i915/intel_cdclk.c index dd3ad52b7dfe..f29a226e24d8 100644 --- a/drivers/gpu/drm/i915/intel_cdclk.c +++ b/drivers/gpu/drm/i915/intel_cdclk.c | |||
@@ -1798,13 +1798,11 @@ static int g4x_hrawclk(struct drm_i915_private *dev_priv) | |||
1798 | case CLKCFG_FSB_800: | 1798 | case CLKCFG_FSB_800: |
1799 | return 200000; | 1799 | return 200000; |
1800 | case CLKCFG_FSB_1067: | 1800 | case CLKCFG_FSB_1067: |
1801 | case CLKCFG_FSB_1067_ALT: | ||
1801 | return 266667; | 1802 | return 266667; |
1802 | case CLKCFG_FSB_1333: | 1803 | case CLKCFG_FSB_1333: |
1804 | case CLKCFG_FSB_1333_ALT: | ||
1803 | return 333333; | 1805 | return 333333; |
1804 | /* these two are just a guess; one of them might be right */ | ||
1805 | case CLKCFG_FSB_1600: | ||
1806 | case CLKCFG_FSB_1600_ALT: | ||
1807 | return 400000; | ||
1808 | default: | 1806 | default: |
1809 | return 133333; | 1807 | return 133333; |
1810 | } | 1808 | } |
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c index 3ffe8b1f1d48..fc0ef492252a 100644 --- a/drivers/gpu/drm/i915/intel_dsi.c +++ b/drivers/gpu/drm/i915/intel_dsi.c | |||
@@ -410,11 +410,10 @@ static void glk_dsi_device_ready(struct intel_encoder *encoder) | |||
410 | val |= (ULPS_STATE_ENTER | DEVICE_READY); | 410 | val |= (ULPS_STATE_ENTER | DEVICE_READY); |
411 | I915_WRITE(MIPI_DEVICE_READY(port), val); | 411 | I915_WRITE(MIPI_DEVICE_READY(port), val); |
412 | 412 | ||
413 | /* Wait for ULPS Not active */ | 413 | /* Wait for ULPS active */ |
414 | if (intel_wait_for_register(dev_priv, | 414 | if (intel_wait_for_register(dev_priv, |
415 | MIPI_CTRL(port), GLK_ULPS_NOT_ACTIVE, | 415 | MIPI_CTRL(port), GLK_ULPS_NOT_ACTIVE, 0, 20)) |
416 | GLK_ULPS_NOT_ACTIVE, 20)) | 416 | DRM_ERROR("ULPS not active\n"); |
417 | DRM_ERROR("ULPS is still active\n"); | ||
418 | 417 | ||
419 | /* Exit ULPS */ | 418 | /* Exit ULPS */ |
420 | val = I915_READ(MIPI_DEVICE_READY(port)); | 419 | val = I915_READ(MIPI_DEVICE_READY(port)); |
diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c index 25d8e76489e4..668f00480d97 100644 --- a/drivers/gpu/drm/i915/intel_lpe_audio.c +++ b/drivers/gpu/drm/i915/intel_lpe_audio.c | |||
@@ -63,6 +63,7 @@ | |||
63 | #include <linux/acpi.h> | 63 | #include <linux/acpi.h> |
64 | #include <linux/device.h> | 64 | #include <linux/device.h> |
65 | #include <linux/pci.h> | 65 | #include <linux/pci.h> |
66 | #include <linux/pm_runtime.h> | ||
66 | 67 | ||
67 | #include "i915_drv.h" | 68 | #include "i915_drv.h" |
68 | #include <linux/delay.h> | 69 | #include <linux/delay.h> |
@@ -121,6 +122,10 @@ lpe_audio_platdev_create(struct drm_i915_private *dev_priv) | |||
121 | 122 | ||
122 | kfree(rsc); | 123 | kfree(rsc); |
123 | 124 | ||
125 | pm_runtime_forbid(&platdev->dev); | ||
126 | pm_runtime_set_active(&platdev->dev); | ||
127 | pm_runtime_enable(&platdev->dev); | ||
128 | |||
124 | return platdev; | 129 | return platdev; |
125 | 130 | ||
126 | err: | 131 | err: |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 21b10f9840c9..549763f5e17d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -360,6 +360,8 @@ nouveau_display_hpd_work(struct work_struct *work) | |||
360 | pm_runtime_get_sync(drm->dev->dev); | 360 | pm_runtime_get_sync(drm->dev->dev); |
361 | 361 | ||
362 | drm_helper_hpd_irq_event(drm->dev); | 362 | drm_helper_hpd_irq_event(drm->dev); |
363 | /* enable polling for external displays */ | ||
364 | drm_kms_helper_poll_enable(drm->dev); | ||
363 | 365 | ||
364 | pm_runtime_mark_last_busy(drm->dev->dev); | 366 | pm_runtime_mark_last_busy(drm->dev->dev); |
365 | pm_runtime_put_sync(drm->dev->dev); | 367 | pm_runtime_put_sync(drm->dev->dev); |
@@ -413,10 +415,6 @@ nouveau_display_init(struct drm_device *dev) | |||
413 | if (ret) | 415 | if (ret) |
414 | return ret; | 416 | return ret; |
415 | 417 | ||
416 | /* enable polling for external displays */ | ||
417 | if (!dev->mode_config.poll_enabled) | ||
418 | drm_kms_helper_poll_enable(dev); | ||
419 | |||
420 | /* enable hotplug interrupts */ | 418 | /* enable hotplug interrupts */ |
421 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 419 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
422 | struct nouveau_connector *conn = nouveau_connector(connector); | 420 | struct nouveau_connector *conn = nouveau_connector(connector); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 2b6ac24ce690..36268e1802b5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -502,6 +502,9 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) | |||
502 | pm_runtime_allow(dev->dev); | 502 | pm_runtime_allow(dev->dev); |
503 | pm_runtime_mark_last_busy(dev->dev); | 503 | pm_runtime_mark_last_busy(dev->dev); |
504 | pm_runtime_put(dev->dev); | 504 | pm_runtime_put(dev->dev); |
505 | } else { | ||
506 | /* enable polling for external displays */ | ||
507 | drm_kms_helper_poll_enable(dev); | ||
505 | } | 508 | } |
506 | return 0; | 509 | return 0; |
507 | 510 | ||
@@ -774,9 +777,6 @@ nouveau_pmops_runtime_resume(struct device *dev) | |||
774 | 777 | ||
775 | ret = nouveau_do_resume(drm_dev, true); | 778 | ret = nouveau_do_resume(drm_dev, true); |
776 | 779 | ||
777 | if (!drm_dev->mode_config.poll_enabled) | ||
778 | drm_kms_helper_poll_enable(drm_dev); | ||
779 | |||
780 | /* do magic */ | 780 | /* do magic */ |
781 | nvif_mask(&device->object, 0x088488, (1 << 25), (1 << 25)); | 781 | nvif_mask(&device->object, 0x088488, (1 << 25), (1 << 25)); |
782 | vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_ON); | 782 | vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_ON); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c index 3a24788c3185..a7e55c422501 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c | |||
@@ -148,7 +148,7 @@ gk104_fifo_runlist_commit(struct gk104_fifo *fifo, int runl) | |||
148 | case NVKM_MEM_TARGET_NCOH: target = 3; break; | 148 | case NVKM_MEM_TARGET_NCOH: target = 3; break; |
149 | default: | 149 | default: |
150 | WARN_ON(1); | 150 | WARN_ON(1); |
151 | return; | 151 | goto unlock; |
152 | } | 152 | } |
153 | 153 | ||
154 | nvkm_wr32(device, 0x002270, (nvkm_memory_addr(mem) >> 12) | | 154 | nvkm_wr32(device, 0x002270, (nvkm_memory_addr(mem) >> 12) | |
@@ -160,6 +160,7 @@ gk104_fifo_runlist_commit(struct gk104_fifo *fifo, int runl) | |||
160 | & 0x00100000), | 160 | & 0x00100000), |
161 | msecs_to_jiffies(2000)) == 0) | 161 | msecs_to_jiffies(2000)) == 0) |
162 | nvkm_error(subdev, "runlist %d update timeout\n", runl); | 162 | nvkm_error(subdev, "runlist %d update timeout\n", runl); |
163 | unlock: | ||
163 | mutex_unlock(&subdev->mutex); | 164 | mutex_unlock(&subdev->mutex); |
164 | } | 165 | } |
165 | 166 | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_gr.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_gr.c index d1cf02d22db1..1b0c793c0192 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_gr.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_gr.c | |||
@@ -116,6 +116,7 @@ ls_ucode_img_load_gr(const struct nvkm_subdev *subdev, struct ls_ucode_img *img, | |||
116 | ret = nvkm_firmware_get(subdev->device, f, &sig); | 116 | ret = nvkm_firmware_get(subdev->device, f, &sig); |
117 | if (ret) | 117 | if (ret) |
118 | goto free_data; | 118 | goto free_data; |
119 | |||
119 | img->sig = kmemdup(sig->data, sig->size, GFP_KERNEL); | 120 | img->sig = kmemdup(sig->data, sig->size, GFP_KERNEL); |
120 | if (!img->sig) { | 121 | if (!img->sig) { |
121 | ret = -ENOMEM; | 122 | ret = -ENOMEM; |
@@ -126,8 +127,9 @@ ls_ucode_img_load_gr(const struct nvkm_subdev *subdev, struct ls_ucode_img *img, | |||
126 | img->ucode_data = ls_ucode_img_build(bl, code, data, | 127 | img->ucode_data = ls_ucode_img_build(bl, code, data, |
127 | &img->ucode_desc); | 128 | &img->ucode_desc); |
128 | if (IS_ERR(img->ucode_data)) { | 129 | if (IS_ERR(img->ucode_data)) { |
130 | kfree(img->sig); | ||
129 | ret = PTR_ERR(img->ucode_data); | 131 | ret = PTR_ERR(img->ucode_data); |
130 | goto free_data; | 132 | goto free_sig; |
131 | } | 133 | } |
132 | img->ucode_size = img->ucode_desc.image_size; | 134 | img->ucode_size = img->ucode_desc.image_size; |
133 | 135 | ||
diff --git a/drivers/gpu/host1x/Kconfig b/drivers/gpu/host1x/Kconfig index b2fd029d67b3..91916326957f 100644 --- a/drivers/gpu/host1x/Kconfig +++ b/drivers/gpu/host1x/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config TEGRA_HOST1X | 1 | config TEGRA_HOST1X |
2 | tristate "NVIDIA Tegra host1x driver" | 2 | tristate "NVIDIA Tegra host1x driver" |
3 | depends on ARCH_TEGRA || (ARM && COMPILE_TEST) | 3 | depends on ARCH_TEGRA || (ARM && COMPILE_TEST) |
4 | select IOMMU_IOVA if IOMMU_SUPPORT | ||
4 | help | 5 | help |
5 | Driver for the NVIDIA Tegra host1x hardware. | 6 | Driver for the NVIDIA Tegra host1x hardware. |
6 | 7 | ||
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 3ac4c03ba77b..c13a4fd86b3c 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -605,6 +605,13 @@ static int coretemp_cpu_online(unsigned int cpu) | |||
605 | struct platform_data *pdata; | 605 | struct platform_data *pdata; |
606 | 606 | ||
607 | /* | 607 | /* |
608 | * Don't execute this on resume as the offline callback did | ||
609 | * not get executed on suspend. | ||
610 | */ | ||
611 | if (cpuhp_tasks_frozen) | ||
612 | return 0; | ||
613 | |||
614 | /* | ||
608 | * CPUID.06H.EAX[0] indicates whether the CPU has thermal | 615 | * CPUID.06H.EAX[0] indicates whether the CPU has thermal |
609 | * sensors. We check this bit only, all the early CPUs | 616 | * sensors. We check this bit only, all the early CPUs |
610 | * without thermal sensors will be filtered out. | 617 | * without thermal sensors will be filtered out. |
@@ -654,6 +661,13 @@ static int coretemp_cpu_offline(unsigned int cpu) | |||
654 | struct temp_data *tdata; | 661 | struct temp_data *tdata; |
655 | int indx, target; | 662 | int indx, target; |
656 | 663 | ||
664 | /* | ||
665 | * Don't execute this on suspend as the device remove locks | ||
666 | * up the machine. | ||
667 | */ | ||
668 | if (cpuhp_tasks_frozen) | ||
669 | return 0; | ||
670 | |||
657 | /* If the physical CPU device does not exist, just return */ | 671 | /* If the physical CPU device does not exist, just return */ |
658 | if (!pdev) | 672 | if (!pdev) |
659 | return 0; | 673 | return 0; |
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index f2acd4b6bf01..6283b99d2b17 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c | |||
@@ -96,6 +96,7 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev) | |||
96 | struct dw_i2c_dev *dev = platform_get_drvdata(pdev); | 96 | struct dw_i2c_dev *dev = platform_get_drvdata(pdev); |
97 | acpi_handle handle = ACPI_HANDLE(&pdev->dev); | 97 | acpi_handle handle = ACPI_HANDLE(&pdev->dev); |
98 | const struct acpi_device_id *id; | 98 | const struct acpi_device_id *id; |
99 | u32 ss_ht, fp_ht, hs_ht, fs_ht; | ||
99 | struct acpi_device *adev; | 100 | struct acpi_device *adev; |
100 | const char *uid; | 101 | const char *uid; |
101 | 102 | ||
@@ -107,23 +108,24 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev) | |||
107 | * Try to get SDA hold time and *CNT values from an ACPI method for | 108 | * Try to get SDA hold time and *CNT values from an ACPI method for |
108 | * selected speed modes. | 109 | * selected speed modes. |
109 | */ | 110 | */ |
111 | dw_i2c_acpi_params(pdev, "SSCN", &dev->ss_hcnt, &dev->ss_lcnt, &ss_ht); | ||
112 | dw_i2c_acpi_params(pdev, "FPCN", &dev->fp_hcnt, &dev->fp_lcnt, &fp_ht); | ||
113 | dw_i2c_acpi_params(pdev, "HSCN", &dev->hs_hcnt, &dev->hs_lcnt, &hs_ht); | ||
114 | dw_i2c_acpi_params(pdev, "FMCN", &dev->fs_hcnt, &dev->fs_lcnt, &fs_ht); | ||
115 | |||
110 | switch (dev->clk_freq) { | 116 | switch (dev->clk_freq) { |
111 | case 100000: | 117 | case 100000: |
112 | dw_i2c_acpi_params(pdev, "SSCN", &dev->ss_hcnt, &dev->ss_lcnt, | 118 | dev->sda_hold_time = ss_ht; |
113 | &dev->sda_hold_time); | ||
114 | break; | 119 | break; |
115 | case 1000000: | 120 | case 1000000: |
116 | dw_i2c_acpi_params(pdev, "FPCN", &dev->fp_hcnt, &dev->fp_lcnt, | 121 | dev->sda_hold_time = fp_ht; |
117 | &dev->sda_hold_time); | ||
118 | break; | 122 | break; |
119 | case 3400000: | 123 | case 3400000: |
120 | dw_i2c_acpi_params(pdev, "HSCN", &dev->hs_hcnt, &dev->hs_lcnt, | 124 | dev->sda_hold_time = hs_ht; |
121 | &dev->sda_hold_time); | ||
122 | break; | 125 | break; |
123 | case 400000: | 126 | case 400000: |
124 | default: | 127 | default: |
125 | dw_i2c_acpi_params(pdev, "FMCN", &dev->fs_hcnt, &dev->fs_lcnt, | 128 | dev->sda_hold_time = fs_ht; |
126 | &dev->sda_hold_time); | ||
127 | break; | 129 | break; |
128 | } | 130 | } |
129 | 131 | ||
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index cf737ec8563b..5c4db65c5019 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -819,7 +819,6 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, | |||
819 | rc = -EINVAL; | 819 | rc = -EINVAL; |
820 | goto out; | 820 | goto out; |
821 | } | 821 | } |
822 | drv_data->irq = irq_of_parse_and_map(np, 0); | ||
823 | 822 | ||
824 | drv_data->rstc = devm_reset_control_get_optional(dev, NULL); | 823 | drv_data->rstc = devm_reset_control_get_optional(dev, NULL); |
825 | if (IS_ERR(drv_data->rstc)) { | 824 | if (IS_ERR(drv_data->rstc)) { |
@@ -902,10 +901,11 @@ mv64xxx_i2c_probe(struct platform_device *pd) | |||
902 | if (!IS_ERR(drv_data->clk)) | 901 | if (!IS_ERR(drv_data->clk)) |
903 | clk_prepare_enable(drv_data->clk); | 902 | clk_prepare_enable(drv_data->clk); |
904 | 903 | ||
904 | drv_data->irq = platform_get_irq(pd, 0); | ||
905 | |||
905 | if (pdata) { | 906 | if (pdata) { |
906 | drv_data->freq_m = pdata->freq_m; | 907 | drv_data->freq_m = pdata->freq_m; |
907 | drv_data->freq_n = pdata->freq_n; | 908 | drv_data->freq_n = pdata->freq_n; |
908 | drv_data->irq = platform_get_irq(pd, 0); | ||
909 | drv_data->adapter.timeout = msecs_to_jiffies(pdata->timeout); | 909 | drv_data->adapter.timeout = msecs_to_jiffies(pdata->timeout); |
910 | drv_data->offload_enabled = false; | 910 | drv_data->offload_enabled = false; |
911 | memcpy(&drv_data->reg_offsets, &mv64xxx_i2c_regs_mv64xxx, sizeof(drv_data->reg_offsets)); | 911 | memcpy(&drv_data->reg_offsets, &mv64xxx_i2c_regs_mv64xxx, sizeof(drv_data->reg_offsets)); |
@@ -915,7 +915,7 @@ mv64xxx_i2c_probe(struct platform_device *pd) | |||
915 | goto exit_clk; | 915 | goto exit_clk; |
916 | } | 916 | } |
917 | if (drv_data->irq < 0) { | 917 | if (drv_data->irq < 0) { |
918 | rc = -ENXIO; | 918 | rc = drv_data->irq; |
919 | goto exit_reset; | 919 | goto exit_reset; |
920 | } | 920 | } |
921 | 921 | ||
diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c index dbe7e44c9321..6ba6c83ca8f1 100644 --- a/drivers/i2c/busses/i2c-xgene-slimpro.c +++ b/drivers/i2c/busses/i2c-xgene-slimpro.c | |||
@@ -416,6 +416,7 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev) | |||
416 | adapter->class = I2C_CLASS_HWMON; | 416 | adapter->class = I2C_CLASS_HWMON; |
417 | adapter->dev.parent = &pdev->dev; | 417 | adapter->dev.parent = &pdev->dev; |
418 | adapter->dev.of_node = pdev->dev.of_node; | 418 | adapter->dev.of_node = pdev->dev.of_node; |
419 | ACPI_COMPANION_SET(&adapter->dev, ACPI_COMPANION(&pdev->dev)); | ||
419 | i2c_set_adapdata(adapter, ctx); | 420 | i2c_set_adapdata(adapter, ctx); |
420 | rc = i2c_add_adapter(adapter); | 421 | rc = i2c_add_adapter(adapter); |
421 | if (rc) { | 422 | if (rc) { |
diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c index 26f7237558ba..9669ca4937b8 100644 --- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c | |||
@@ -395,18 +395,20 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc, | |||
395 | if (force_nr) { | 395 | if (force_nr) { |
396 | priv->adap.nr = force_nr; | 396 | priv->adap.nr = force_nr; |
397 | ret = i2c_add_numbered_adapter(&priv->adap); | 397 | ret = i2c_add_numbered_adapter(&priv->adap); |
398 | dev_err(&parent->dev, | 398 | if (ret < 0) { |
399 | "failed to add mux-adapter %u as bus %u (error=%d)\n", | 399 | dev_err(&parent->dev, |
400 | chan_id, force_nr, ret); | 400 | "failed to add mux-adapter %u as bus %u (error=%d)\n", |
401 | chan_id, force_nr, ret); | ||
402 | goto err_free_priv; | ||
403 | } | ||
401 | } else { | 404 | } else { |
402 | ret = i2c_add_adapter(&priv->adap); | 405 | ret = i2c_add_adapter(&priv->adap); |
403 | dev_err(&parent->dev, | 406 | if (ret < 0) { |
404 | "failed to add mux-adapter %u (error=%d)\n", | 407 | dev_err(&parent->dev, |
405 | chan_id, ret); | 408 | "failed to add mux-adapter %u (error=%d)\n", |
406 | } | 409 | chan_id, ret); |
407 | if (ret < 0) { | 410 | goto err_free_priv; |
408 | kfree(priv); | 411 | } |
409 | return ret; | ||
410 | } | 412 | } |
411 | 413 | ||
412 | WARN(sysfs_create_link(&priv->adap.dev.kobj, &muxc->dev->kobj, | 414 | WARN(sysfs_create_link(&priv->adap.dev.kobj, &muxc->dev->kobj, |
@@ -422,6 +424,10 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc, | |||
422 | 424 | ||
423 | muxc->adapter[muxc->num_adapters++] = &priv->adap; | 425 | muxc->adapter[muxc->num_adapters++] = &priv->adap; |
424 | return 0; | 426 | return 0; |
427 | |||
428 | err_free_priv: | ||
429 | kfree(priv); | ||
430 | return ret; | ||
425 | } | 431 | } |
426 | EXPORT_SYMBOL_GPL(i2c_mux_add_adapter); | 432 | EXPORT_SYMBOL_GPL(i2c_mux_add_adapter); |
427 | 433 | ||
diff --git a/drivers/i2c/muxes/i2c-mux-reg.c b/drivers/i2c/muxes/i2c-mux-reg.c index 406d5059072c..d97031804de8 100644 --- a/drivers/i2c/muxes/i2c-mux-reg.c +++ b/drivers/i2c/muxes/i2c-mux-reg.c | |||
@@ -196,20 +196,25 @@ static int i2c_mux_reg_probe(struct platform_device *pdev) | |||
196 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 196 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
197 | mux->data.reg_size = resource_size(res); | 197 | mux->data.reg_size = resource_size(res); |
198 | mux->data.reg = devm_ioremap_resource(&pdev->dev, res); | 198 | mux->data.reg = devm_ioremap_resource(&pdev->dev, res); |
199 | if (IS_ERR(mux->data.reg)) | 199 | if (IS_ERR(mux->data.reg)) { |
200 | return PTR_ERR(mux->data.reg); | 200 | ret = PTR_ERR(mux->data.reg); |
201 | goto err_put_parent; | ||
202 | } | ||
201 | } | 203 | } |
202 | 204 | ||
203 | if (mux->data.reg_size != 4 && mux->data.reg_size != 2 && | 205 | if (mux->data.reg_size != 4 && mux->data.reg_size != 2 && |
204 | mux->data.reg_size != 1) { | 206 | mux->data.reg_size != 1) { |
205 | dev_err(&pdev->dev, "Invalid register size\n"); | 207 | dev_err(&pdev->dev, "Invalid register size\n"); |
206 | return -EINVAL; | 208 | ret = -EINVAL; |
209 | goto err_put_parent; | ||
207 | } | 210 | } |
208 | 211 | ||
209 | muxc = i2c_mux_alloc(parent, &pdev->dev, mux->data.n_values, 0, 0, | 212 | muxc = i2c_mux_alloc(parent, &pdev->dev, mux->data.n_values, 0, 0, |
210 | i2c_mux_reg_select, NULL); | 213 | i2c_mux_reg_select, NULL); |
211 | if (!muxc) | 214 | if (!muxc) { |
212 | return -ENOMEM; | 215 | ret = -ENOMEM; |
216 | goto err_put_parent; | ||
217 | } | ||
213 | muxc->priv = mux; | 218 | muxc->priv = mux; |
214 | 219 | ||
215 | platform_set_drvdata(pdev, muxc); | 220 | platform_set_drvdata(pdev, muxc); |
@@ -223,7 +228,7 @@ static int i2c_mux_reg_probe(struct platform_device *pdev) | |||
223 | 228 | ||
224 | ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], class); | 229 | ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], class); |
225 | if (ret) | 230 | if (ret) |
226 | goto add_adapter_failed; | 231 | goto err_del_mux_adapters; |
227 | } | 232 | } |
228 | 233 | ||
229 | dev_dbg(&pdev->dev, "%d port mux on %s adapter\n", | 234 | dev_dbg(&pdev->dev, "%d port mux on %s adapter\n", |
@@ -231,8 +236,10 @@ static int i2c_mux_reg_probe(struct platform_device *pdev) | |||
231 | 236 | ||
232 | return 0; | 237 | return 0; |
233 | 238 | ||
234 | add_adapter_failed: | 239 | err_del_mux_adapters: |
235 | i2c_mux_del_adapters(muxc); | 240 | i2c_mux_del_adapters(muxc); |
241 | err_put_parent: | ||
242 | i2c_put_adapter(parent); | ||
236 | 243 | ||
237 | return ret; | 244 | return ret; |
238 | } | 245 | } |
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 8348f366ddd1..62618e77bedc 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c | |||
@@ -396,13 +396,13 @@ static void iommu_dma_free_iova(struct iommu_dma_cookie *cookie, | |||
396 | dma_addr_t iova, size_t size) | 396 | dma_addr_t iova, size_t size) |
397 | { | 397 | { |
398 | struct iova_domain *iovad = &cookie->iovad; | 398 | struct iova_domain *iovad = &cookie->iovad; |
399 | unsigned long shift = iova_shift(iovad); | ||
400 | 399 | ||
401 | /* The MSI case is only ever cleaning up its most recent allocation */ | 400 | /* The MSI case is only ever cleaning up its most recent allocation */ |
402 | if (cookie->type == IOMMU_DMA_MSI_COOKIE) | 401 | if (cookie->type == IOMMU_DMA_MSI_COOKIE) |
403 | cookie->msi_iova -= size; | 402 | cookie->msi_iova -= size; |
404 | else | 403 | else |
405 | free_iova_fast(iovad, iova >> shift, size >> shift); | 404 | free_iova_fast(iovad, iova_pfn(iovad, iova), |
405 | size >> iova_shift(iovad)); | ||
406 | } | 406 | } |
407 | 407 | ||
408 | static void __iommu_dma_unmap(struct iommu_domain *domain, dma_addr_t dma_addr, | 408 | static void __iommu_dma_unmap(struct iommu_domain *domain, dma_addr_t dma_addr, |
@@ -617,11 +617,14 @@ static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys, | |||
617 | { | 617 | { |
618 | struct iommu_domain *domain = iommu_get_domain_for_dev(dev); | 618 | struct iommu_domain *domain = iommu_get_domain_for_dev(dev); |
619 | struct iommu_dma_cookie *cookie = domain->iova_cookie; | 619 | struct iommu_dma_cookie *cookie = domain->iova_cookie; |
620 | struct iova_domain *iovad = &cookie->iovad; | 620 | size_t iova_off = 0; |
621 | size_t iova_off = iova_offset(iovad, phys); | ||
622 | dma_addr_t iova; | 621 | dma_addr_t iova; |
623 | 622 | ||
624 | size = iova_align(iovad, size + iova_off); | 623 | if (cookie->type == IOMMU_DMA_IOVA_COOKIE) { |
624 | iova_off = iova_offset(&cookie->iovad, phys); | ||
625 | size = iova_align(&cookie->iovad, size + iova_off); | ||
626 | } | ||
627 | |||
625 | iova = iommu_dma_alloc_iova(domain, size, dma_get_mask(dev), dev); | 628 | iova = iommu_dma_alloc_iova(domain, size, dma_get_mask(dev), dev); |
626 | if (!iova) | 629 | if (!iova) |
627 | return DMA_ERROR_CODE; | 630 | return DMA_ERROR_CODE; |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 90ab0115d78e..fc2765ccdb57 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -2055,11 +2055,14 @@ static int domain_context_mapping_one(struct dmar_domain *domain, | |||
2055 | if (context_copied(context)) { | 2055 | if (context_copied(context)) { |
2056 | u16 did_old = context_domain_id(context); | 2056 | u16 did_old = context_domain_id(context); |
2057 | 2057 | ||
2058 | if (did_old >= 0 && did_old < cap_ndoms(iommu->cap)) | 2058 | if (did_old >= 0 && did_old < cap_ndoms(iommu->cap)) { |
2059 | iommu->flush.flush_context(iommu, did_old, | 2059 | iommu->flush.flush_context(iommu, did_old, |
2060 | (((u16)bus) << 8) | devfn, | 2060 | (((u16)bus) << 8) | devfn, |
2061 | DMA_CCMD_MASK_NOBIT, | 2061 | DMA_CCMD_MASK_NOBIT, |
2062 | DMA_CCMD_DEVICE_INVL); | 2062 | DMA_CCMD_DEVICE_INVL); |
2063 | iommu->flush.flush_iotlb(iommu, did_old, 0, 0, | ||
2064 | DMA_TLB_DSI_FLUSH); | ||
2065 | } | ||
2063 | } | 2066 | } |
2064 | 2067 | ||
2065 | pgd = domain->pgd; | 2068 | pgd = domain->pgd; |
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index a27ef570c328..bc1efbfb9ddf 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
19 | #include <linux/component.h> | 19 | #include <linux/component.h> |
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/dma-mapping.h> | ||
21 | #include <linux/dma-iommu.h> | 22 | #include <linux/dma-iommu.h> |
22 | #include <linux/err.h> | 23 | #include <linux/err.h> |
23 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c index d2306c821ebb..31d6b5a582d2 100644 --- a/drivers/irqchip/irq-mbigen.c +++ b/drivers/irqchip/irq-mbigen.c | |||
@@ -106,10 +106,7 @@ static inline void get_mbigen_type_reg(irq_hw_number_t hwirq, | |||
106 | static inline void get_mbigen_clear_reg(irq_hw_number_t hwirq, | 106 | static inline void get_mbigen_clear_reg(irq_hw_number_t hwirq, |
107 | u32 *mask, u32 *addr) | 107 | u32 *mask, u32 *addr) |
108 | { | 108 | { |
109 | unsigned int ofst; | 109 | unsigned int ofst = (hwirq / 32) * 4; |
110 | |||
111 | hwirq -= RESERVED_IRQ_PER_MBIGEN_CHIP; | ||
112 | ofst = hwirq / 32 * 4; | ||
113 | 110 | ||
114 | *mask = 1 << (hwirq % 32); | 111 | *mask = 1 << (hwirq % 32); |
115 | *addr = ofst + REG_MBIGEN_CLEAR_OFFSET; | 112 | *addr = ofst + REG_MBIGEN_CLEAR_OFFSET; |
@@ -337,9 +334,15 @@ static int mbigen_device_probe(struct platform_device *pdev) | |||
337 | mgn_chip->pdev = pdev; | 334 | mgn_chip->pdev = pdev; |
338 | 335 | ||
339 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 336 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
340 | mgn_chip->base = devm_ioremap_resource(&pdev->dev, res); | 337 | if (!res) |
341 | if (IS_ERR(mgn_chip->base)) | 338 | return -EINVAL; |
342 | return PTR_ERR(mgn_chip->base); | 339 | |
340 | mgn_chip->base = devm_ioremap(&pdev->dev, res->start, | ||
341 | resource_size(res)); | ||
342 | if (!mgn_chip->base) { | ||
343 | dev_err(&pdev->dev, "failed to ioremap %pR\n", res); | ||
344 | return -ENOMEM; | ||
345 | } | ||
343 | 346 | ||
344 | if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) | 347 | if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) |
345 | err = mbigen_of_create_domain(pdev, mgn_chip); | 348 | err = mbigen_of_create_domain(pdev, mgn_chip); |
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 5db11a405129..cd8139593ccd 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c | |||
@@ -218,7 +218,7 @@ static DEFINE_SPINLOCK(param_spinlock); | |||
218 | * Buffers are freed after this timeout | 218 | * Buffers are freed after this timeout |
219 | */ | 219 | */ |
220 | static unsigned dm_bufio_max_age = DM_BUFIO_DEFAULT_AGE_SECS; | 220 | static unsigned dm_bufio_max_age = DM_BUFIO_DEFAULT_AGE_SECS; |
221 | static unsigned dm_bufio_retain_bytes = DM_BUFIO_DEFAULT_RETAIN_BYTES; | 221 | static unsigned long dm_bufio_retain_bytes = DM_BUFIO_DEFAULT_RETAIN_BYTES; |
222 | 222 | ||
223 | static unsigned long dm_bufio_peak_allocated; | 223 | static unsigned long dm_bufio_peak_allocated; |
224 | static unsigned long dm_bufio_allocated_kmem_cache; | 224 | static unsigned long dm_bufio_allocated_kmem_cache; |
@@ -1558,10 +1558,10 @@ static bool __try_evict_buffer(struct dm_buffer *b, gfp_t gfp) | |||
1558 | return true; | 1558 | return true; |
1559 | } | 1559 | } |
1560 | 1560 | ||
1561 | static unsigned get_retain_buffers(struct dm_bufio_client *c) | 1561 | static unsigned long get_retain_buffers(struct dm_bufio_client *c) |
1562 | { | 1562 | { |
1563 | unsigned retain_bytes = ACCESS_ONCE(dm_bufio_retain_bytes); | 1563 | unsigned long retain_bytes = ACCESS_ONCE(dm_bufio_retain_bytes); |
1564 | return retain_bytes / c->block_size; | 1564 | return retain_bytes >> (c->sectors_per_block_bits + SECTOR_SHIFT); |
1565 | } | 1565 | } |
1566 | 1566 | ||
1567 | static unsigned long __scan(struct dm_bufio_client *c, unsigned long nr_to_scan, | 1567 | static unsigned long __scan(struct dm_bufio_client *c, unsigned long nr_to_scan, |
@@ -1571,7 +1571,7 @@ static unsigned long __scan(struct dm_bufio_client *c, unsigned long nr_to_scan, | |||
1571 | struct dm_buffer *b, *tmp; | 1571 | struct dm_buffer *b, *tmp; |
1572 | unsigned long freed = 0; | 1572 | unsigned long freed = 0; |
1573 | unsigned long count = nr_to_scan; | 1573 | unsigned long count = nr_to_scan; |
1574 | unsigned retain_target = get_retain_buffers(c); | 1574 | unsigned long retain_target = get_retain_buffers(c); |
1575 | 1575 | ||
1576 | for (l = 0; l < LIST_SIZE; l++) { | 1576 | for (l = 0; l < LIST_SIZE; l++) { |
1577 | list_for_each_entry_safe_reverse(b, tmp, &c->lru[l], lru_list) { | 1577 | list_for_each_entry_safe_reverse(b, tmp, &c->lru[l], lru_list) { |
@@ -1794,8 +1794,8 @@ static bool older_than(struct dm_buffer *b, unsigned long age_hz) | |||
1794 | static void __evict_old_buffers(struct dm_bufio_client *c, unsigned long age_hz) | 1794 | static void __evict_old_buffers(struct dm_bufio_client *c, unsigned long age_hz) |
1795 | { | 1795 | { |
1796 | struct dm_buffer *b, *tmp; | 1796 | struct dm_buffer *b, *tmp; |
1797 | unsigned retain_target = get_retain_buffers(c); | 1797 | unsigned long retain_target = get_retain_buffers(c); |
1798 | unsigned count; | 1798 | unsigned long count; |
1799 | LIST_HEAD(write_list); | 1799 | LIST_HEAD(write_list); |
1800 | 1800 | ||
1801 | dm_bufio_lock(c); | 1801 | dm_bufio_lock(c); |
@@ -1955,7 +1955,7 @@ MODULE_PARM_DESC(max_cache_size_bytes, "Size of metadata cache"); | |||
1955 | module_param_named(max_age_seconds, dm_bufio_max_age, uint, S_IRUGO | S_IWUSR); | 1955 | module_param_named(max_age_seconds, dm_bufio_max_age, uint, S_IRUGO | S_IWUSR); |
1956 | MODULE_PARM_DESC(max_age_seconds, "Max age of a buffer in seconds"); | 1956 | MODULE_PARM_DESC(max_age_seconds, "Max age of a buffer in seconds"); |
1957 | 1957 | ||
1958 | module_param_named(retain_bytes, dm_bufio_retain_bytes, uint, S_IRUGO | S_IWUSR); | 1958 | module_param_named(retain_bytes, dm_bufio_retain_bytes, ulong, S_IRUGO | S_IWUSR); |
1959 | MODULE_PARM_DESC(retain_bytes, "Try to keep at least this many bytes cached in memory"); | 1959 | MODULE_PARM_DESC(retain_bytes, "Try to keep at least this many bytes cached in memory"); |
1960 | 1960 | ||
1961 | module_param_named(peak_allocated_bytes, dm_bufio_peak_allocated, ulong, S_IRUGO | S_IWUSR); | 1961 | module_param_named(peak_allocated_bytes, dm_bufio_peak_allocated, ulong, S_IRUGO | S_IWUSR); |
diff --git a/drivers/md/dm-cache-background-tracker.c b/drivers/md/dm-cache-background-tracker.c index 9b1afdfb13f0..707233891291 100644 --- a/drivers/md/dm-cache-background-tracker.c +++ b/drivers/md/dm-cache-background-tracker.c | |||
@@ -33,6 +33,11 @@ struct background_tracker *btracker_create(unsigned max_work) | |||
33 | { | 33 | { |
34 | struct background_tracker *b = kmalloc(sizeof(*b), GFP_KERNEL); | 34 | struct background_tracker *b = kmalloc(sizeof(*b), GFP_KERNEL); |
35 | 35 | ||
36 | if (!b) { | ||
37 | DMERR("couldn't create background_tracker"); | ||
38 | return NULL; | ||
39 | } | ||
40 | |||
36 | b->max_work = max_work; | 41 | b->max_work = max_work; |
37 | atomic_set(&b->pending_promotes, 0); | 42 | atomic_set(&b->pending_promotes, 0); |
38 | atomic_set(&b->pending_writebacks, 0); | 43 | atomic_set(&b->pending_writebacks, 0); |
diff --git a/drivers/md/dm-cache-policy-smq.c b/drivers/md/dm-cache-policy-smq.c index 72479bd61e11..e5eb9c9b4bc8 100644 --- a/drivers/md/dm-cache-policy-smq.c +++ b/drivers/md/dm-cache-policy-smq.c | |||
@@ -1120,8 +1120,6 @@ static bool clean_target_met(struct smq_policy *mq, bool idle) | |||
1120 | * Cache entries may not be populated. So we cannot rely on the | 1120 | * Cache entries may not be populated. So we cannot rely on the |
1121 | * size of the clean queue. | 1121 | * size of the clean queue. |
1122 | */ | 1122 | */ |
1123 | unsigned nr_clean; | ||
1124 | |||
1125 | if (idle) { | 1123 | if (idle) { |
1126 | /* | 1124 | /* |
1127 | * We'd like to clean everything. | 1125 | * We'd like to clean everything. |
@@ -1129,18 +1127,16 @@ static bool clean_target_met(struct smq_policy *mq, bool idle) | |||
1129 | return q_size(&mq->dirty) == 0u; | 1127 | return q_size(&mq->dirty) == 0u; |
1130 | } | 1128 | } |
1131 | 1129 | ||
1132 | nr_clean = from_cblock(mq->cache_size) - q_size(&mq->dirty); | 1130 | /* |
1133 | return (nr_clean + btracker_nr_writebacks_queued(mq->bg_work)) >= | 1131 | * If we're busy we don't worry about cleaning at all. |
1134 | percent_to_target(mq, CLEAN_TARGET); | 1132 | */ |
1133 | return true; | ||
1135 | } | 1134 | } |
1136 | 1135 | ||
1137 | static bool free_target_met(struct smq_policy *mq, bool idle) | 1136 | static bool free_target_met(struct smq_policy *mq) |
1138 | { | 1137 | { |
1139 | unsigned nr_free; | 1138 | unsigned nr_free; |
1140 | 1139 | ||
1141 | if (!idle) | ||
1142 | return true; | ||
1143 | |||
1144 | nr_free = from_cblock(mq->cache_size) - mq->cache_alloc.nr_allocated; | 1140 | nr_free = from_cblock(mq->cache_size) - mq->cache_alloc.nr_allocated; |
1145 | return (nr_free + btracker_nr_demotions_queued(mq->bg_work)) >= | 1141 | return (nr_free + btracker_nr_demotions_queued(mq->bg_work)) >= |
1146 | percent_to_target(mq, FREE_TARGET); | 1142 | percent_to_target(mq, FREE_TARGET); |
@@ -1190,9 +1186,9 @@ static void queue_demotion(struct smq_policy *mq) | |||
1190 | if (unlikely(WARN_ON_ONCE(!mq->migrations_allowed))) | 1186 | if (unlikely(WARN_ON_ONCE(!mq->migrations_allowed))) |
1191 | return; | 1187 | return; |
1192 | 1188 | ||
1193 | e = q_peek(&mq->clean, mq->clean.nr_levels, true); | 1189 | e = q_peek(&mq->clean, mq->clean.nr_levels / 2, true); |
1194 | if (!e) { | 1190 | if (!e) { |
1195 | if (!clean_target_met(mq, false)) | 1191 | if (!clean_target_met(mq, true)) |
1196 | queue_writeback(mq); | 1192 | queue_writeback(mq); |
1197 | return; | 1193 | return; |
1198 | } | 1194 | } |
@@ -1220,7 +1216,7 @@ static void queue_promotion(struct smq_policy *mq, dm_oblock_t oblock, | |||
1220 | * We always claim to be 'idle' to ensure some demotions happen | 1216 | * We always claim to be 'idle' to ensure some demotions happen |
1221 | * with continuous loads. | 1217 | * with continuous loads. |
1222 | */ | 1218 | */ |
1223 | if (!free_target_met(mq, true)) | 1219 | if (!free_target_met(mq)) |
1224 | queue_demotion(mq); | 1220 | queue_demotion(mq); |
1225 | return; | 1221 | return; |
1226 | } | 1222 | } |
@@ -1421,14 +1417,10 @@ static int smq_get_background_work(struct dm_cache_policy *p, bool idle, | |||
1421 | spin_lock_irqsave(&mq->lock, flags); | 1417 | spin_lock_irqsave(&mq->lock, flags); |
1422 | r = btracker_issue(mq->bg_work, result); | 1418 | r = btracker_issue(mq->bg_work, result); |
1423 | if (r == -ENODATA) { | 1419 | if (r == -ENODATA) { |
1424 | /* find some writeback work to do */ | 1420 | if (!clean_target_met(mq, idle)) { |
1425 | if (mq->migrations_allowed && !free_target_met(mq, idle)) | ||
1426 | queue_demotion(mq); | ||
1427 | |||
1428 | else if (!clean_target_met(mq, idle)) | ||
1429 | queue_writeback(mq); | 1421 | queue_writeback(mq); |
1430 | 1422 | r = btracker_issue(mq->bg_work, result); | |
1431 | r = btracker_issue(mq->bg_work, result); | 1423 | } |
1432 | } | 1424 | } |
1433 | spin_unlock_irqrestore(&mq->lock, flags); | 1425 | spin_unlock_irqrestore(&mq->lock, flags); |
1434 | 1426 | ||
@@ -1452,6 +1444,7 @@ static void __complete_background_work(struct smq_policy *mq, | |||
1452 | clear_pending(mq, e); | 1444 | clear_pending(mq, e); |
1453 | if (success) { | 1445 | if (success) { |
1454 | e->oblock = work->oblock; | 1446 | e->oblock = work->oblock; |
1447 | e->level = NR_CACHE_LEVELS - 1; | ||
1455 | push(mq, e); | 1448 | push(mq, e); |
1456 | // h, q, a | 1449 | // h, q, a |
1457 | } else { | 1450 | } else { |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 1db375f50a13..d682a0511381 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -94,6 +94,9 @@ static void iot_io_begin(struct io_tracker *iot, sector_t len) | |||
94 | 94 | ||
95 | static void __iot_io_end(struct io_tracker *iot, sector_t len) | 95 | static void __iot_io_end(struct io_tracker *iot, sector_t len) |
96 | { | 96 | { |
97 | if (!len) | ||
98 | return; | ||
99 | |||
97 | iot->in_flight -= len; | 100 | iot->in_flight -= len; |
98 | if (!iot->in_flight) | 101 | if (!iot->in_flight) |
99 | iot->idle_time = jiffies; | 102 | iot->idle_time = jiffies; |
@@ -474,7 +477,7 @@ struct cache { | |||
474 | spinlock_t invalidation_lock; | 477 | spinlock_t invalidation_lock; |
475 | struct list_head invalidation_requests; | 478 | struct list_head invalidation_requests; |
476 | 479 | ||
477 | struct io_tracker origin_tracker; | 480 | struct io_tracker tracker; |
478 | 481 | ||
479 | struct work_struct commit_ws; | 482 | struct work_struct commit_ws; |
480 | struct batcher committer; | 483 | struct batcher committer; |
@@ -901,8 +904,7 @@ static dm_oblock_t get_bio_block(struct cache *cache, struct bio *bio) | |||
901 | 904 | ||
902 | static bool accountable_bio(struct cache *cache, struct bio *bio) | 905 | static bool accountable_bio(struct cache *cache, struct bio *bio) |
903 | { | 906 | { |
904 | return ((bio->bi_bdev == cache->origin_dev->bdev) && | 907 | return bio_op(bio) != REQ_OP_DISCARD; |
905 | bio_op(bio) != REQ_OP_DISCARD); | ||
906 | } | 908 | } |
907 | 909 | ||
908 | static void accounted_begin(struct cache *cache, struct bio *bio) | 910 | static void accounted_begin(struct cache *cache, struct bio *bio) |
@@ -912,7 +914,7 @@ static void accounted_begin(struct cache *cache, struct bio *bio) | |||
912 | 914 | ||
913 | if (accountable_bio(cache, bio)) { | 915 | if (accountable_bio(cache, bio)) { |
914 | pb->len = bio_sectors(bio); | 916 | pb->len = bio_sectors(bio); |
915 | iot_io_begin(&cache->origin_tracker, pb->len); | 917 | iot_io_begin(&cache->tracker, pb->len); |
916 | } | 918 | } |
917 | } | 919 | } |
918 | 920 | ||
@@ -921,7 +923,7 @@ static void accounted_complete(struct cache *cache, struct bio *bio) | |||
921 | size_t pb_data_size = get_per_bio_data_size(cache); | 923 | size_t pb_data_size = get_per_bio_data_size(cache); |
922 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | 924 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); |
923 | 925 | ||
924 | iot_io_end(&cache->origin_tracker, pb->len); | 926 | iot_io_end(&cache->tracker, pb->len); |
925 | } | 927 | } |
926 | 928 | ||
927 | static void accounted_request(struct cache *cache, struct bio *bio) | 929 | static void accounted_request(struct cache *cache, struct bio *bio) |
@@ -1716,20 +1718,19 @@ static int invalidate_start(struct cache *cache, dm_cblock_t cblock, | |||
1716 | 1718 | ||
1717 | enum busy { | 1719 | enum busy { |
1718 | IDLE, | 1720 | IDLE, |
1719 | MODERATE, | ||
1720 | BUSY | 1721 | BUSY |
1721 | }; | 1722 | }; |
1722 | 1723 | ||
1723 | static enum busy spare_migration_bandwidth(struct cache *cache) | 1724 | static enum busy spare_migration_bandwidth(struct cache *cache) |
1724 | { | 1725 | { |
1725 | bool idle = iot_idle_for(&cache->origin_tracker, HZ); | 1726 | bool idle = iot_idle_for(&cache->tracker, HZ); |
1726 | sector_t current_volume = (atomic_read(&cache->nr_io_migrations) + 1) * | 1727 | sector_t current_volume = (atomic_read(&cache->nr_io_migrations) + 1) * |
1727 | cache->sectors_per_block; | 1728 | cache->sectors_per_block; |
1728 | 1729 | ||
1729 | if (current_volume <= cache->migration_threshold) | 1730 | if (idle && current_volume <= cache->migration_threshold) |
1730 | return idle ? IDLE : MODERATE; | 1731 | return IDLE; |
1731 | else | 1732 | else |
1732 | return idle ? MODERATE : BUSY; | 1733 | return BUSY; |
1733 | } | 1734 | } |
1734 | 1735 | ||
1735 | static void inc_hit_counter(struct cache *cache, struct bio *bio) | 1736 | static void inc_hit_counter(struct cache *cache, struct bio *bio) |
@@ -2045,8 +2046,6 @@ static void check_migrations(struct work_struct *ws) | |||
2045 | 2046 | ||
2046 | for (;;) { | 2047 | for (;;) { |
2047 | b = spare_migration_bandwidth(cache); | 2048 | b = spare_migration_bandwidth(cache); |
2048 | if (b == BUSY) | ||
2049 | break; | ||
2050 | 2049 | ||
2051 | r = policy_get_background_work(cache->policy, b == IDLE, &op); | 2050 | r = policy_get_background_work(cache->policy, b == IDLE, &op); |
2052 | if (r == -ENODATA) | 2051 | if (r == -ENODATA) |
@@ -2717,7 +2716,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
2717 | 2716 | ||
2718 | batcher_init(&cache->committer, commit_op, cache, | 2717 | batcher_init(&cache->committer, commit_op, cache, |
2719 | issue_op, cache, cache->wq); | 2718 | issue_op, cache, cache->wq); |
2720 | iot_init(&cache->origin_tracker); | 2719 | iot_init(&cache->tracker); |
2721 | 2720 | ||
2722 | init_rwsem(&cache->background_work_lock); | 2721 | init_rwsem(&cache->background_work_lock); |
2723 | prevent_background_work(cache); | 2722 | prevent_background_work(cache); |
@@ -2941,7 +2940,7 @@ static void cache_postsuspend(struct dm_target *ti) | |||
2941 | 2940 | ||
2942 | cancel_delayed_work(&cache->waker); | 2941 | cancel_delayed_work(&cache->waker); |
2943 | flush_workqueue(cache->wq); | 2942 | flush_workqueue(cache->wq); |
2944 | WARN_ON(cache->origin_tracker.in_flight); | 2943 | WARN_ON(cache->tracker.in_flight); |
2945 | 2944 | ||
2946 | /* | 2945 | /* |
2947 | * If it's a flush suspend there won't be any deferred bios, so this | 2946 | * If it's a flush suspend there won't be any deferred bios, so this |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 926a6bcb32c8..3df056b73b66 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -447,7 +447,7 @@ failed: | |||
447 | * it has been invoked. | 447 | * it has been invoked. |
448 | */ | 448 | */ |
449 | #define dm_report_EIO(m) \ | 449 | #define dm_report_EIO(m) \ |
450 | ({ \ | 450 | do { \ |
451 | struct mapped_device *md = dm_table_get_md((m)->ti->table); \ | 451 | struct mapped_device *md = dm_table_get_md((m)->ti->table); \ |
452 | \ | 452 | \ |
453 | pr_debug("%s: returning EIO; QIFNP = %d; SQIFNP = %d; DNFS = %d\n", \ | 453 | pr_debug("%s: returning EIO; QIFNP = %d; SQIFNP = %d; DNFS = %d\n", \ |
@@ -455,8 +455,7 @@ failed: | |||
455 | test_bit(MPATHF_QUEUE_IF_NO_PATH, &(m)->flags), \ | 455 | test_bit(MPATHF_QUEUE_IF_NO_PATH, &(m)->flags), \ |
456 | test_bit(MPATHF_SAVED_QUEUE_IF_NO_PATH, &(m)->flags), \ | 456 | test_bit(MPATHF_SAVED_QUEUE_IF_NO_PATH, &(m)->flags), \ |
457 | dm_noflush_suspending((m)->ti)); \ | 457 | dm_noflush_suspending((m)->ti)); \ |
458 | -EIO; \ | 458 | } while (0) |
459 | }) | ||
460 | 459 | ||
461 | /* | 460 | /* |
462 | * Map cloned requests (request-based multipath) | 461 | * Map cloned requests (request-based multipath) |
@@ -481,7 +480,8 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, | |||
481 | if (!pgpath) { | 480 | if (!pgpath) { |
482 | if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) | 481 | if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) |
483 | return DM_MAPIO_DELAY_REQUEUE; | 482 | return DM_MAPIO_DELAY_REQUEUE; |
484 | return dm_report_EIO(m); /* Failed */ | 483 | dm_report_EIO(m); /* Failed */ |
484 | return DM_MAPIO_KILL; | ||
485 | } else if (test_bit(MPATHF_QUEUE_IO, &m->flags) || | 485 | } else if (test_bit(MPATHF_QUEUE_IO, &m->flags) || |
486 | test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) { | 486 | test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) { |
487 | if (pg_init_all_paths(m)) | 487 | if (pg_init_all_paths(m)) |
@@ -558,7 +558,8 @@ static int __multipath_map_bio(struct multipath *m, struct bio *bio, struct dm_m | |||
558 | if (!pgpath) { | 558 | if (!pgpath) { |
559 | if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) | 559 | if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) |
560 | return DM_MAPIO_REQUEUE; | 560 | return DM_MAPIO_REQUEUE; |
561 | return dm_report_EIO(m); | 561 | dm_report_EIO(m); |
562 | return -EIO; | ||
562 | } | 563 | } |
563 | 564 | ||
564 | mpio->pgpath = pgpath; | 565 | mpio->pgpath = pgpath; |
@@ -1493,7 +1494,7 @@ static int multipath_end_io(struct dm_target *ti, struct request *clone, | |||
1493 | if (atomic_read(&m->nr_valid_paths) == 0 && | 1494 | if (atomic_read(&m->nr_valid_paths) == 0 && |
1494 | !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) { | 1495 | !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) { |
1495 | if (error == -EIO) | 1496 | if (error == -EIO) |
1496 | error = dm_report_EIO(m); | 1497 | dm_report_EIO(m); |
1497 | /* complete with the original error */ | 1498 | /* complete with the original error */ |
1498 | r = DM_ENDIO_DONE; | 1499 | r = DM_ENDIO_DONE; |
1499 | } | 1500 | } |
@@ -1524,8 +1525,10 @@ static int do_end_io_bio(struct multipath *m, struct bio *clone, | |||
1524 | fail_path(mpio->pgpath); | 1525 | fail_path(mpio->pgpath); |
1525 | 1526 | ||
1526 | if (atomic_read(&m->nr_valid_paths) == 0 && | 1527 | if (atomic_read(&m->nr_valid_paths) == 0 && |
1527 | !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) | 1528 | !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) { |
1528 | return dm_report_EIO(m); | 1529 | dm_report_EIO(m); |
1530 | return -EIO; | ||
1531 | } | ||
1529 | 1532 | ||
1530 | /* Queue for the daemon to resubmit */ | 1533 | /* Queue for the daemon to resubmit */ |
1531 | dm_bio_restore(get_bio_details_from_bio(clone), clone); | 1534 | dm_bio_restore(get_bio_details_from_bio(clone), clone); |
diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 2af27026aa2e..b639fa7246ee 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c | |||
@@ -507,6 +507,7 @@ static int map_request(struct dm_rq_target_io *tio) | |||
507 | case DM_MAPIO_KILL: | 507 | case DM_MAPIO_KILL: |
508 | /* The target wants to complete the I/O */ | 508 | /* The target wants to complete the I/O */ |
509 | dm_kill_unmapped_request(rq, -EIO); | 509 | dm_kill_unmapped_request(rq, -EIO); |
510 | break; | ||
510 | default: | 511 | default: |
511 | DMWARN("unimplemented target map return value: %d", r); | 512 | DMWARN("unimplemented target map return value: %d", r); |
512 | BUG(); | 513 | BUG(); |
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index 0f0251d0d337..d31d18d9727c 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c | |||
@@ -484,11 +484,11 @@ static int __write_initial_superblock(struct dm_pool_metadata *pmd) | |||
484 | if (r < 0) | 484 | if (r < 0) |
485 | return r; | 485 | return r; |
486 | 486 | ||
487 | r = save_sm_roots(pmd); | 487 | r = dm_tm_pre_commit(pmd->tm); |
488 | if (r < 0) | 488 | if (r < 0) |
489 | return r; | 489 | return r; |
490 | 490 | ||
491 | r = dm_tm_pre_commit(pmd->tm); | 491 | r = save_sm_roots(pmd); |
492 | if (r < 0) | 492 | if (r < 0) |
493 | return r; | 493 | return r; |
494 | 494 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 82f798be964f..10367ffe92e3 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -8022,18 +8022,15 @@ EXPORT_SYMBOL(md_write_end); | |||
8022 | * may proceed without blocking. It is important to call this before | 8022 | * may proceed without blocking. It is important to call this before |
8023 | * attempting a GFP_KERNEL allocation while holding the mddev lock. | 8023 | * attempting a GFP_KERNEL allocation while holding the mddev lock. |
8024 | * Must be called with mddev_lock held. | 8024 | * Must be called with mddev_lock held. |
8025 | * | ||
8026 | * In the ->external case MD_SB_CHANGE_PENDING can not be cleared until mddev->lock | ||
8027 | * is dropped, so return -EAGAIN after notifying userspace. | ||
8028 | */ | 8025 | */ |
8029 | int md_allow_write(struct mddev *mddev) | 8026 | void md_allow_write(struct mddev *mddev) |
8030 | { | 8027 | { |
8031 | if (!mddev->pers) | 8028 | if (!mddev->pers) |
8032 | return 0; | 8029 | return; |
8033 | if (mddev->ro) | 8030 | if (mddev->ro) |
8034 | return 0; | 8031 | return; |
8035 | if (!mddev->pers->sync_request) | 8032 | if (!mddev->pers->sync_request) |
8036 | return 0; | 8033 | return; |
8037 | 8034 | ||
8038 | spin_lock(&mddev->lock); | 8035 | spin_lock(&mddev->lock); |
8039 | if (mddev->in_sync) { | 8036 | if (mddev->in_sync) { |
@@ -8046,13 +8043,12 @@ int md_allow_write(struct mddev *mddev) | |||
8046 | spin_unlock(&mddev->lock); | 8043 | spin_unlock(&mddev->lock); |
8047 | md_update_sb(mddev, 0); | 8044 | md_update_sb(mddev, 0); |
8048 | sysfs_notify_dirent_safe(mddev->sysfs_state); | 8045 | sysfs_notify_dirent_safe(mddev->sysfs_state); |
8046 | /* wait for the dirty state to be recorded in the metadata */ | ||
8047 | wait_event(mddev->sb_wait, | ||
8048 | !test_bit(MD_SB_CHANGE_CLEAN, &mddev->sb_flags) && | ||
8049 | !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags)); | ||
8049 | } else | 8050 | } else |
8050 | spin_unlock(&mddev->lock); | 8051 | spin_unlock(&mddev->lock); |
8051 | |||
8052 | if (test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags)) | ||
8053 | return -EAGAIN; | ||
8054 | else | ||
8055 | return 0; | ||
8056 | } | 8052 | } |
8057 | EXPORT_SYMBOL_GPL(md_allow_write); | 8053 | EXPORT_SYMBOL_GPL(md_allow_write); |
8058 | 8054 | ||
diff --git a/drivers/md/md.h b/drivers/md/md.h index 4e75d121bfcc..11f15146ce51 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -665,7 +665,7 @@ extern int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, | |||
665 | bool metadata_op); | 665 | bool metadata_op); |
666 | extern void md_do_sync(struct md_thread *thread); | 666 | extern void md_do_sync(struct md_thread *thread); |
667 | extern void md_new_event(struct mddev *mddev); | 667 | extern void md_new_event(struct mddev *mddev); |
668 | extern int md_allow_write(struct mddev *mddev); | 668 | extern void md_allow_write(struct mddev *mddev); |
669 | extern void md_wait_for_blocked_rdev(struct md_rdev *rdev, struct mddev *mddev); | 669 | extern void md_wait_for_blocked_rdev(struct md_rdev *rdev, struct mddev *mddev); |
670 | extern void md_set_array_sectors(struct mddev *mddev, sector_t array_sectors); | 670 | extern void md_set_array_sectors(struct mddev *mddev, sector_t array_sectors); |
671 | extern int md_check_no_bitmap(struct mddev *mddev); | 671 | extern int md_check_no_bitmap(struct mddev *mddev); |
diff --git a/drivers/md/persistent-data/dm-space-map-disk.c b/drivers/md/persistent-data/dm-space-map-disk.c index ebb280a14325..32adf6b4a9c7 100644 --- a/drivers/md/persistent-data/dm-space-map-disk.c +++ b/drivers/md/persistent-data/dm-space-map-disk.c | |||
@@ -142,10 +142,23 @@ static int sm_disk_inc_block(struct dm_space_map *sm, dm_block_t b) | |||
142 | 142 | ||
143 | static int sm_disk_dec_block(struct dm_space_map *sm, dm_block_t b) | 143 | static int sm_disk_dec_block(struct dm_space_map *sm, dm_block_t b) |
144 | { | 144 | { |
145 | int r; | ||
146 | uint32_t old_count; | ||
145 | enum allocation_event ev; | 147 | enum allocation_event ev; |
146 | struct sm_disk *smd = container_of(sm, struct sm_disk, sm); | 148 | struct sm_disk *smd = container_of(sm, struct sm_disk, sm); |
147 | 149 | ||
148 | return sm_ll_dec(&smd->ll, b, &ev); | 150 | r = sm_ll_dec(&smd->ll, b, &ev); |
151 | if (!r && (ev == SM_FREE)) { | ||
152 | /* | ||
153 | * It's only free if it's also free in the last | ||
154 | * transaction. | ||
155 | */ | ||
156 | r = sm_ll_lookup(&smd->old_ll, b, &old_count); | ||
157 | if (!r && !old_count) | ||
158 | smd->nr_allocated_this_transaction--; | ||
159 | } | ||
160 | |||
161 | return r; | ||
149 | } | 162 | } |
150 | 163 | ||
151 | static int sm_disk_new_block(struct dm_space_map *sm, dm_block_t *b) | 164 | static int sm_disk_new_block(struct dm_space_map *sm, dm_block_t *b) |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 84e58596594d..d6c0bc76e837 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -385,7 +385,7 @@ static int raid0_run(struct mddev *mddev) | |||
385 | blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors); | 385 | blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors); |
386 | blk_queue_max_write_same_sectors(mddev->queue, mddev->chunk_sectors); | 386 | blk_queue_max_write_same_sectors(mddev->queue, mddev->chunk_sectors); |
387 | blk_queue_max_write_zeroes_sectors(mddev->queue, mddev->chunk_sectors); | 387 | blk_queue_max_write_zeroes_sectors(mddev->queue, mddev->chunk_sectors); |
388 | blk_queue_max_discard_sectors(mddev->queue, mddev->chunk_sectors); | 388 | blk_queue_max_discard_sectors(mddev->queue, UINT_MAX); |
389 | 389 | ||
390 | blk_queue_io_min(mddev->queue, mddev->chunk_sectors << 9); | 390 | blk_queue_io_min(mddev->queue, mddev->chunk_sectors << 9); |
391 | blk_queue_io_opt(mddev->queue, | 391 | blk_queue_io_opt(mddev->queue, |
@@ -459,6 +459,95 @@ static inline int is_io_in_chunk_boundary(struct mddev *mddev, | |||
459 | } | 459 | } |
460 | } | 460 | } |
461 | 461 | ||
462 | static void raid0_handle_discard(struct mddev *mddev, struct bio *bio) | ||
463 | { | ||
464 | struct r0conf *conf = mddev->private; | ||
465 | struct strip_zone *zone; | ||
466 | sector_t start = bio->bi_iter.bi_sector; | ||
467 | sector_t end; | ||
468 | unsigned int stripe_size; | ||
469 | sector_t first_stripe_index, last_stripe_index; | ||
470 | sector_t start_disk_offset; | ||
471 | unsigned int start_disk_index; | ||
472 | sector_t end_disk_offset; | ||
473 | unsigned int end_disk_index; | ||
474 | unsigned int disk; | ||
475 | |||
476 | zone = find_zone(conf, &start); | ||
477 | |||
478 | if (bio_end_sector(bio) > zone->zone_end) { | ||
479 | struct bio *split = bio_split(bio, | ||
480 | zone->zone_end - bio->bi_iter.bi_sector, GFP_NOIO, | ||
481 | mddev->bio_set); | ||
482 | bio_chain(split, bio); | ||
483 | generic_make_request(bio); | ||
484 | bio = split; | ||
485 | end = zone->zone_end; | ||
486 | } else | ||
487 | end = bio_end_sector(bio); | ||
488 | |||
489 | if (zone != conf->strip_zone) | ||
490 | end = end - zone[-1].zone_end; | ||
491 | |||
492 | /* Now start and end is the offset in zone */ | ||
493 | stripe_size = zone->nb_dev * mddev->chunk_sectors; | ||
494 | |||
495 | first_stripe_index = start; | ||
496 | sector_div(first_stripe_index, stripe_size); | ||
497 | last_stripe_index = end; | ||
498 | sector_div(last_stripe_index, stripe_size); | ||
499 | |||
500 | start_disk_index = (int)(start - first_stripe_index * stripe_size) / | ||
501 | mddev->chunk_sectors; | ||
502 | start_disk_offset = ((int)(start - first_stripe_index * stripe_size) % | ||
503 | mddev->chunk_sectors) + | ||
504 | first_stripe_index * mddev->chunk_sectors; | ||
505 | end_disk_index = (int)(end - last_stripe_index * stripe_size) / | ||
506 | mddev->chunk_sectors; | ||
507 | end_disk_offset = ((int)(end - last_stripe_index * stripe_size) % | ||
508 | mddev->chunk_sectors) + | ||
509 | last_stripe_index * mddev->chunk_sectors; | ||
510 | |||
511 | for (disk = 0; disk < zone->nb_dev; disk++) { | ||
512 | sector_t dev_start, dev_end; | ||
513 | struct bio *discard_bio = NULL; | ||
514 | struct md_rdev *rdev; | ||
515 | |||
516 | if (disk < start_disk_index) | ||
517 | dev_start = (first_stripe_index + 1) * | ||
518 | mddev->chunk_sectors; | ||
519 | else if (disk > start_disk_index) | ||
520 | dev_start = first_stripe_index * mddev->chunk_sectors; | ||
521 | else | ||
522 | dev_start = start_disk_offset; | ||
523 | |||
524 | if (disk < end_disk_index) | ||
525 | dev_end = (last_stripe_index + 1) * mddev->chunk_sectors; | ||
526 | else if (disk > end_disk_index) | ||
527 | dev_end = last_stripe_index * mddev->chunk_sectors; | ||
528 | else | ||
529 | dev_end = end_disk_offset; | ||
530 | |||
531 | if (dev_end <= dev_start) | ||
532 | continue; | ||
533 | |||
534 | rdev = conf->devlist[(zone - conf->strip_zone) * | ||
535 | conf->strip_zone[0].nb_dev + disk]; | ||
536 | if (__blkdev_issue_discard(rdev->bdev, | ||
537 | dev_start + zone->dev_start + rdev->data_offset, | ||
538 | dev_end - dev_start, GFP_NOIO, 0, &discard_bio) || | ||
539 | !discard_bio) | ||
540 | continue; | ||
541 | bio_chain(discard_bio, bio); | ||
542 | if (mddev->gendisk) | ||
543 | trace_block_bio_remap(bdev_get_queue(rdev->bdev), | ||
544 | discard_bio, disk_devt(mddev->gendisk), | ||
545 | bio->bi_iter.bi_sector); | ||
546 | generic_make_request(discard_bio); | ||
547 | } | ||
548 | bio_endio(bio); | ||
549 | } | ||
550 | |||
462 | static void raid0_make_request(struct mddev *mddev, struct bio *bio) | 551 | static void raid0_make_request(struct mddev *mddev, struct bio *bio) |
463 | { | 552 | { |
464 | struct strip_zone *zone; | 553 | struct strip_zone *zone; |
@@ -473,6 +562,11 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio) | |||
473 | return; | 562 | return; |
474 | } | 563 | } |
475 | 564 | ||
565 | if (unlikely((bio_op(bio) == REQ_OP_DISCARD))) { | ||
566 | raid0_handle_discard(mddev, bio); | ||
567 | return; | ||
568 | } | ||
569 | |||
476 | bio_sector = bio->bi_iter.bi_sector; | 570 | bio_sector = bio->bi_iter.bi_sector; |
477 | sector = bio_sector; | 571 | sector = bio_sector; |
478 | chunk_sects = mddev->chunk_sectors; | 572 | chunk_sects = mddev->chunk_sectors; |
@@ -498,19 +592,13 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio) | |||
498 | bio->bi_iter.bi_sector = sector + zone->dev_start + | 592 | bio->bi_iter.bi_sector = sector + zone->dev_start + |
499 | tmp_dev->data_offset; | 593 | tmp_dev->data_offset; |
500 | 594 | ||
501 | if (unlikely((bio_op(bio) == REQ_OP_DISCARD) && | 595 | if (mddev->gendisk) |
502 | !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) { | 596 | trace_block_bio_remap(bdev_get_queue(bio->bi_bdev), |
503 | /* Just ignore it */ | 597 | bio, disk_devt(mddev->gendisk), |
504 | bio_endio(bio); | 598 | bio_sector); |
505 | } else { | 599 | mddev_check_writesame(mddev, bio); |
506 | if (mddev->gendisk) | 600 | mddev_check_write_zeroes(mddev, bio); |
507 | trace_block_bio_remap(bdev_get_queue(bio->bi_bdev), | 601 | generic_make_request(bio); |
508 | bio, disk_devt(mddev->gendisk), | ||
509 | bio_sector); | ||
510 | mddev_check_writesame(mddev, bio); | ||
511 | mddev_check_write_zeroes(mddev, bio); | ||
512 | generic_make_request(bio); | ||
513 | } | ||
514 | } | 602 | } |
515 | 603 | ||
516 | static void raid0_status(struct seq_file *seq, struct mddev *mddev) | 604 | static void raid0_status(struct seq_file *seq, struct mddev *mddev) |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 7ed59351fe97..af5056d56878 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -666,8 +666,11 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect | |||
666 | break; | 666 | break; |
667 | } | 667 | } |
668 | continue; | 668 | continue; |
669 | } else | 669 | } else { |
670 | if ((sectors > best_good_sectors) && (best_disk >= 0)) | ||
671 | best_disk = -1; | ||
670 | best_good_sectors = sectors; | 672 | best_good_sectors = sectors; |
673 | } | ||
671 | 674 | ||
672 | if (best_disk >= 0) | 675 | if (best_disk >= 0) |
673 | /* At least two disks to choose from so failfast is OK */ | 676 | /* At least two disks to choose from so failfast is OK */ |
@@ -1529,17 +1532,16 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, | |||
1529 | plug = container_of(cb, struct raid1_plug_cb, cb); | 1532 | plug = container_of(cb, struct raid1_plug_cb, cb); |
1530 | else | 1533 | else |
1531 | plug = NULL; | 1534 | plug = NULL; |
1532 | spin_lock_irqsave(&conf->device_lock, flags); | ||
1533 | if (plug) { | 1535 | if (plug) { |
1534 | bio_list_add(&plug->pending, mbio); | 1536 | bio_list_add(&plug->pending, mbio); |
1535 | plug->pending_cnt++; | 1537 | plug->pending_cnt++; |
1536 | } else { | 1538 | } else { |
1539 | spin_lock_irqsave(&conf->device_lock, flags); | ||
1537 | bio_list_add(&conf->pending_bio_list, mbio); | 1540 | bio_list_add(&conf->pending_bio_list, mbio); |
1538 | conf->pending_count++; | 1541 | conf->pending_count++; |
1539 | } | 1542 | spin_unlock_irqrestore(&conf->device_lock, flags); |
1540 | spin_unlock_irqrestore(&conf->device_lock, flags); | ||
1541 | if (!plug) | ||
1542 | md_wakeup_thread(mddev->thread); | 1543 | md_wakeup_thread(mddev->thread); |
1544 | } | ||
1543 | } | 1545 | } |
1544 | 1546 | ||
1545 | r1_bio_write_done(r1_bio); | 1547 | r1_bio_write_done(r1_bio); |
@@ -3197,7 +3199,7 @@ static int raid1_reshape(struct mddev *mddev) | |||
3197 | struct r1conf *conf = mddev->private; | 3199 | struct r1conf *conf = mddev->private; |
3198 | int cnt, raid_disks; | 3200 | int cnt, raid_disks; |
3199 | unsigned long flags; | 3201 | unsigned long flags; |
3200 | int d, d2, err; | 3202 | int d, d2; |
3201 | 3203 | ||
3202 | /* Cannot change chunk_size, layout, or level */ | 3204 | /* Cannot change chunk_size, layout, or level */ |
3203 | if (mddev->chunk_sectors != mddev->new_chunk_sectors || | 3205 | if (mddev->chunk_sectors != mddev->new_chunk_sectors || |
@@ -3209,11 +3211,8 @@ static int raid1_reshape(struct mddev *mddev) | |||
3209 | return -EINVAL; | 3211 | return -EINVAL; |
3210 | } | 3212 | } |
3211 | 3213 | ||
3212 | if (!mddev_is_clustered(mddev)) { | 3214 | if (!mddev_is_clustered(mddev)) |
3213 | err = md_allow_write(mddev); | 3215 | md_allow_write(mddev); |
3214 | if (err) | ||
3215 | return err; | ||
3216 | } | ||
3217 | 3216 | ||
3218 | raid_disks = mddev->raid_disks + mddev->delta_disks; | 3217 | raid_disks = mddev->raid_disks + mddev->delta_disks; |
3219 | 3218 | ||
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 6b86a0032cf8..4343d7ff9916 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1282,17 +1282,16 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio, | |||
1282 | plug = container_of(cb, struct raid10_plug_cb, cb); | 1282 | plug = container_of(cb, struct raid10_plug_cb, cb); |
1283 | else | 1283 | else |
1284 | plug = NULL; | 1284 | plug = NULL; |
1285 | spin_lock_irqsave(&conf->device_lock, flags); | ||
1286 | if (plug) { | 1285 | if (plug) { |
1287 | bio_list_add(&plug->pending, mbio); | 1286 | bio_list_add(&plug->pending, mbio); |
1288 | plug->pending_cnt++; | 1287 | plug->pending_cnt++; |
1289 | } else { | 1288 | } else { |
1289 | spin_lock_irqsave(&conf->device_lock, flags); | ||
1290 | bio_list_add(&conf->pending_bio_list, mbio); | 1290 | bio_list_add(&conf->pending_bio_list, mbio); |
1291 | conf->pending_count++; | 1291 | conf->pending_count++; |
1292 | } | 1292 | spin_unlock_irqrestore(&conf->device_lock, flags); |
1293 | spin_unlock_irqrestore(&conf->device_lock, flags); | ||
1294 | if (!plug) | ||
1295 | md_wakeup_thread(mddev->thread); | 1293 | md_wakeup_thread(mddev->thread); |
1294 | } | ||
1296 | } | 1295 | } |
1297 | 1296 | ||
1298 | static void raid10_write_request(struct mddev *mddev, struct bio *bio, | 1297 | static void raid10_write_request(struct mddev *mddev, struct bio *bio, |
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index 26ba09282e7c..4c00bc248287 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "md.h" | 24 | #include "md.h" |
25 | #include "raid5.h" | 25 | #include "raid5.h" |
26 | #include "bitmap.h" | 26 | #include "bitmap.h" |
27 | #include "raid5-log.h" | ||
27 | 28 | ||
28 | /* | 29 | /* |
29 | * metadata/data stored in disk with 4k size unit (a block) regardless | 30 | * metadata/data stored in disk with 4k size unit (a block) regardless |
@@ -622,20 +623,30 @@ static void r5l_do_submit_io(struct r5l_log *log, struct r5l_io_unit *io) | |||
622 | __r5l_set_io_unit_state(io, IO_UNIT_IO_START); | 623 | __r5l_set_io_unit_state(io, IO_UNIT_IO_START); |
623 | spin_unlock_irqrestore(&log->io_list_lock, flags); | 624 | spin_unlock_irqrestore(&log->io_list_lock, flags); |
624 | 625 | ||
626 | /* | ||
627 | * In case of journal device failures, submit_bio will get error | ||
628 | * and calls endio, then active stripes will continue write | ||
629 | * process. Therefore, it is not necessary to check Faulty bit | ||
630 | * of journal device here. | ||
631 | * | ||
632 | * We can't check split_bio after current_bio is submitted. If | ||
633 | * io->split_bio is null, after current_bio is submitted, current_bio | ||
634 | * might already be completed and the io_unit is freed. We submit | ||
635 | * split_bio first to avoid the issue. | ||
636 | */ | ||
637 | if (io->split_bio) { | ||
638 | if (io->has_flush) | ||
639 | io->split_bio->bi_opf |= REQ_PREFLUSH; | ||
640 | if (io->has_fua) | ||
641 | io->split_bio->bi_opf |= REQ_FUA; | ||
642 | submit_bio(io->split_bio); | ||
643 | } | ||
644 | |||
625 | if (io->has_flush) | 645 | if (io->has_flush) |
626 | io->current_bio->bi_opf |= REQ_PREFLUSH; | 646 | io->current_bio->bi_opf |= REQ_PREFLUSH; |
627 | if (io->has_fua) | 647 | if (io->has_fua) |
628 | io->current_bio->bi_opf |= REQ_FUA; | 648 | io->current_bio->bi_opf |= REQ_FUA; |
629 | submit_bio(io->current_bio); | 649 | submit_bio(io->current_bio); |
630 | |||
631 | if (!io->split_bio) | ||
632 | return; | ||
633 | |||
634 | if (io->has_flush) | ||
635 | io->split_bio->bi_opf |= REQ_PREFLUSH; | ||
636 | if (io->has_fua) | ||
637 | io->split_bio->bi_opf |= REQ_FUA; | ||
638 | submit_bio(io->split_bio); | ||
639 | } | 650 | } |
640 | 651 | ||
641 | /* deferred io_unit will be dispatched here */ | 652 | /* deferred io_unit will be dispatched here */ |
@@ -670,6 +681,11 @@ static void r5c_disable_writeback_async(struct work_struct *work) | |||
670 | return; | 681 | return; |
671 | pr_info("md/raid:%s: Disabling writeback cache for degraded array.\n", | 682 | pr_info("md/raid:%s: Disabling writeback cache for degraded array.\n", |
672 | mdname(mddev)); | 683 | mdname(mddev)); |
684 | |||
685 | /* wait superblock change before suspend */ | ||
686 | wait_event(mddev->sb_wait, | ||
687 | !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags)); | ||
688 | |||
673 | mddev_suspend(mddev); | 689 | mddev_suspend(mddev); |
674 | log->r5c_journal_mode = R5C_JOURNAL_MODE_WRITE_THROUGH; | 690 | log->r5c_journal_mode = R5C_JOURNAL_MODE_WRITE_THROUGH; |
675 | mddev_resume(mddev); | 691 | mddev_resume(mddev); |
@@ -2621,8 +2637,11 @@ int r5c_try_caching_write(struct r5conf *conf, | |||
2621 | * When run in degraded mode, array is set to write-through mode. | 2637 | * When run in degraded mode, array is set to write-through mode. |
2622 | * This check helps drain pending write safely in the transition to | 2638 | * This check helps drain pending write safely in the transition to |
2623 | * write-through mode. | 2639 | * write-through mode. |
2640 | * | ||
2641 | * When a stripe is syncing, the write is also handled in write | ||
2642 | * through mode. | ||
2624 | */ | 2643 | */ |
2625 | if (s->failed) { | 2644 | if (s->failed || test_bit(STRIPE_SYNCING, &sh->state)) { |
2626 | r5c_make_stripe_write_out(sh); | 2645 | r5c_make_stripe_write_out(sh); |
2627 | return -EAGAIN; | 2646 | return -EAGAIN; |
2628 | } | 2647 | } |
@@ -2825,6 +2844,9 @@ void r5c_finish_stripe_write_out(struct r5conf *conf, | |||
2825 | } | 2844 | } |
2826 | 2845 | ||
2827 | r5l_append_flush_payload(log, sh->sector); | 2846 | r5l_append_flush_payload(log, sh->sector); |
2847 | /* stripe is flused to raid disks, we can do resync now */ | ||
2848 | if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state)) | ||
2849 | set_bit(STRIPE_HANDLE, &sh->state); | ||
2828 | } | 2850 | } |
2829 | 2851 | ||
2830 | int r5c_cache_data(struct r5l_log *log, struct stripe_head *sh) | 2852 | int r5c_cache_data(struct r5l_log *log, struct stripe_head *sh) |
@@ -2973,7 +2995,7 @@ ioerr: | |||
2973 | return ret; | 2995 | return ret; |
2974 | } | 2996 | } |
2975 | 2997 | ||
2976 | void r5c_update_on_rdev_error(struct mddev *mddev) | 2998 | void r5c_update_on_rdev_error(struct mddev *mddev, struct md_rdev *rdev) |
2977 | { | 2999 | { |
2978 | struct r5conf *conf = mddev->private; | 3000 | struct r5conf *conf = mddev->private; |
2979 | struct r5l_log *log = conf->log; | 3001 | struct r5l_log *log = conf->log; |
@@ -2981,7 +3003,8 @@ void r5c_update_on_rdev_error(struct mddev *mddev) | |||
2981 | if (!log) | 3003 | if (!log) |
2982 | return; | 3004 | return; |
2983 | 3005 | ||
2984 | if (raid5_calc_degraded(conf) > 0 && | 3006 | if ((raid5_calc_degraded(conf) > 0 || |
3007 | test_bit(Journal, &rdev->flags)) && | ||
2985 | conf->log->r5c_journal_mode == R5C_JOURNAL_MODE_WRITE_BACK) | 3008 | conf->log->r5c_journal_mode == R5C_JOURNAL_MODE_WRITE_BACK) |
2986 | schedule_work(&log->disable_writeback_work); | 3009 | schedule_work(&log->disable_writeback_work); |
2987 | } | 3010 | } |
diff --git a/drivers/md/raid5-log.h b/drivers/md/raid5-log.h index 27097101ccca..328d67aedda4 100644 --- a/drivers/md/raid5-log.h +++ b/drivers/md/raid5-log.h | |||
@@ -28,7 +28,8 @@ extern void r5c_flush_cache(struct r5conf *conf, int num); | |||
28 | extern void r5c_check_stripe_cache_usage(struct r5conf *conf); | 28 | extern void r5c_check_stripe_cache_usage(struct r5conf *conf); |
29 | extern void r5c_check_cached_full_stripe(struct r5conf *conf); | 29 | extern void r5c_check_cached_full_stripe(struct r5conf *conf); |
30 | extern struct md_sysfs_entry r5c_journal_mode; | 30 | extern struct md_sysfs_entry r5c_journal_mode; |
31 | extern void r5c_update_on_rdev_error(struct mddev *mddev); | 31 | extern void r5c_update_on_rdev_error(struct mddev *mddev, |
32 | struct md_rdev *rdev); | ||
32 | extern bool r5c_big_stripe_cached(struct r5conf *conf, sector_t sect); | 33 | extern bool r5c_big_stripe_cached(struct r5conf *conf, sector_t sect); |
33 | 34 | ||
34 | extern struct dma_async_tx_descriptor * | 35 | extern struct dma_async_tx_descriptor * |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 2e38cfac5b1d..9c4f7659f8b1 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -103,8 +103,7 @@ static inline void unlock_device_hash_lock(struct r5conf *conf, int hash) | |||
103 | static inline void lock_all_device_hash_locks_irq(struct r5conf *conf) | 103 | static inline void lock_all_device_hash_locks_irq(struct r5conf *conf) |
104 | { | 104 | { |
105 | int i; | 105 | int i; |
106 | local_irq_disable(); | 106 | spin_lock_irq(conf->hash_locks); |
107 | spin_lock(conf->hash_locks); | ||
108 | for (i = 1; i < NR_STRIPE_HASH_LOCKS; i++) | 107 | for (i = 1; i < NR_STRIPE_HASH_LOCKS; i++) |
109 | spin_lock_nest_lock(conf->hash_locks + i, conf->hash_locks); | 108 | spin_lock_nest_lock(conf->hash_locks + i, conf->hash_locks); |
110 | spin_lock(&conf->device_lock); | 109 | spin_lock(&conf->device_lock); |
@@ -114,9 +113,9 @@ static inline void unlock_all_device_hash_locks_irq(struct r5conf *conf) | |||
114 | { | 113 | { |
115 | int i; | 114 | int i; |
116 | spin_unlock(&conf->device_lock); | 115 | spin_unlock(&conf->device_lock); |
117 | for (i = NR_STRIPE_HASH_LOCKS; i; i--) | 116 | for (i = NR_STRIPE_HASH_LOCKS - 1; i; i--) |
118 | spin_unlock(conf->hash_locks + i - 1); | 117 | spin_unlock(conf->hash_locks + i); |
119 | local_irq_enable(); | 118 | spin_unlock_irq(conf->hash_locks); |
120 | } | 119 | } |
121 | 120 | ||
122 | /* Find first data disk in a raid6 stripe */ | 121 | /* Find first data disk in a raid6 stripe */ |
@@ -234,11 +233,15 @@ static void do_release_stripe(struct r5conf *conf, struct stripe_head *sh, | |||
234 | if (test_bit(R5_InJournal, &sh->dev[i].flags)) | 233 | if (test_bit(R5_InJournal, &sh->dev[i].flags)) |
235 | injournal++; | 234 | injournal++; |
236 | /* | 235 | /* |
237 | * When quiesce in r5c write back, set STRIPE_HANDLE for stripes with | 236 | * In the following cases, the stripe cannot be released to cached |
238 | * data in journal, so they are not released to cached lists | 237 | * lists. Therefore, we make the stripe write out and set |
238 | * STRIPE_HANDLE: | ||
239 | * 1. when quiesce in r5c write back; | ||
240 | * 2. when resync is requested fot the stripe. | ||
239 | */ | 241 | */ |
240 | if (conf->quiesce && r5c_is_writeback(conf->log) && | 242 | if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state) || |
241 | !test_bit(STRIPE_HANDLE, &sh->state) && injournal != 0) { | 243 | (conf->quiesce && r5c_is_writeback(conf->log) && |
244 | !test_bit(STRIPE_HANDLE, &sh->state) && injournal != 0)) { | ||
242 | if (test_bit(STRIPE_R5C_CACHING, &sh->state)) | 245 | if (test_bit(STRIPE_R5C_CACHING, &sh->state)) |
243 | r5c_make_stripe_write_out(sh); | 246 | r5c_make_stripe_write_out(sh); |
244 | set_bit(STRIPE_HANDLE, &sh->state); | 247 | set_bit(STRIPE_HANDLE, &sh->state); |
@@ -714,12 +717,11 @@ static bool is_full_stripe_write(struct stripe_head *sh) | |||
714 | 717 | ||
715 | static void lock_two_stripes(struct stripe_head *sh1, struct stripe_head *sh2) | 718 | static void lock_two_stripes(struct stripe_head *sh1, struct stripe_head *sh2) |
716 | { | 719 | { |
717 | local_irq_disable(); | ||
718 | if (sh1 > sh2) { | 720 | if (sh1 > sh2) { |
719 | spin_lock(&sh2->stripe_lock); | 721 | spin_lock_irq(&sh2->stripe_lock); |
720 | spin_lock_nested(&sh1->stripe_lock, 1); | 722 | spin_lock_nested(&sh1->stripe_lock, 1); |
721 | } else { | 723 | } else { |
722 | spin_lock(&sh1->stripe_lock); | 724 | spin_lock_irq(&sh1->stripe_lock); |
723 | spin_lock_nested(&sh2->stripe_lock, 1); | 725 | spin_lock_nested(&sh2->stripe_lock, 1); |
724 | } | 726 | } |
725 | } | 727 | } |
@@ -727,8 +729,7 @@ static void lock_two_stripes(struct stripe_head *sh1, struct stripe_head *sh2) | |||
727 | static void unlock_two_stripes(struct stripe_head *sh1, struct stripe_head *sh2) | 729 | static void unlock_two_stripes(struct stripe_head *sh1, struct stripe_head *sh2) |
728 | { | 730 | { |
729 | spin_unlock(&sh1->stripe_lock); | 731 | spin_unlock(&sh1->stripe_lock); |
730 | spin_unlock(&sh2->stripe_lock); | 732 | spin_unlock_irq(&sh2->stripe_lock); |
731 | local_irq_enable(); | ||
732 | } | 733 | } |
733 | 734 | ||
734 | /* Only freshly new full stripe normal write stripe can be added to a batch list */ | 735 | /* Only freshly new full stripe normal write stripe can be added to a batch list */ |
@@ -2312,14 +2313,12 @@ static int resize_stripes(struct r5conf *conf, int newsize) | |||
2312 | struct stripe_head *osh, *nsh; | 2313 | struct stripe_head *osh, *nsh; |
2313 | LIST_HEAD(newstripes); | 2314 | LIST_HEAD(newstripes); |
2314 | struct disk_info *ndisks; | 2315 | struct disk_info *ndisks; |
2315 | int err; | 2316 | int err = 0; |
2316 | struct kmem_cache *sc; | 2317 | struct kmem_cache *sc; |
2317 | int i; | 2318 | int i; |
2318 | int hash, cnt; | 2319 | int hash, cnt; |
2319 | 2320 | ||
2320 | err = md_allow_write(conf->mddev); | 2321 | md_allow_write(conf->mddev); |
2321 | if (err) | ||
2322 | return err; | ||
2323 | 2322 | ||
2324 | /* Step 1 */ | 2323 | /* Step 1 */ |
2325 | sc = kmem_cache_create(conf->cache_name[1-conf->active_name], | 2324 | sc = kmem_cache_create(conf->cache_name[1-conf->active_name], |
@@ -2694,7 +2693,7 @@ static void raid5_error(struct mddev *mddev, struct md_rdev *rdev) | |||
2694 | bdevname(rdev->bdev, b), | 2693 | bdevname(rdev->bdev, b), |
2695 | mdname(mddev), | 2694 | mdname(mddev), |
2696 | conf->raid_disks - mddev->degraded); | 2695 | conf->raid_disks - mddev->degraded); |
2697 | r5c_update_on_rdev_error(mddev); | 2696 | r5c_update_on_rdev_error(mddev, rdev); |
2698 | } | 2697 | } |
2699 | 2698 | ||
2700 | /* | 2699 | /* |
@@ -3055,6 +3054,11 @@ sector_t raid5_compute_blocknr(struct stripe_head *sh, int i, int previous) | |||
3055 | * When LOG_CRITICAL, stripes with injournal == 0 will be sent to | 3054 | * When LOG_CRITICAL, stripes with injournal == 0 will be sent to |
3056 | * no_space_stripes list. | 3055 | * no_space_stripes list. |
3057 | * | 3056 | * |
3057 | * 3. during journal failure | ||
3058 | * In journal failure, we try to flush all cached data to raid disks | ||
3059 | * based on data in stripe cache. The array is read-only to upper | ||
3060 | * layers, so we would skip all pending writes. | ||
3061 | * | ||
3058 | */ | 3062 | */ |
3059 | static inline bool delay_towrite(struct r5conf *conf, | 3063 | static inline bool delay_towrite(struct r5conf *conf, |
3060 | struct r5dev *dev, | 3064 | struct r5dev *dev, |
@@ -3068,6 +3072,9 @@ static inline bool delay_towrite(struct r5conf *conf, | |||
3068 | if (test_bit(R5C_LOG_CRITICAL, &conf->cache_state) && | 3072 | if (test_bit(R5C_LOG_CRITICAL, &conf->cache_state) && |
3069 | s->injournal > 0) | 3073 | s->injournal > 0) |
3070 | return true; | 3074 | return true; |
3075 | /* case 3 above */ | ||
3076 | if (s->log_failed && s->injournal) | ||
3077 | return true; | ||
3071 | return false; | 3078 | return false; |
3072 | } | 3079 | } |
3073 | 3080 | ||
@@ -4653,8 +4660,13 @@ static void handle_stripe(struct stripe_head *sh) | |||
4653 | 4660 | ||
4654 | if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state) && !sh->batch_head) { | 4661 | if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state) && !sh->batch_head) { |
4655 | spin_lock(&sh->stripe_lock); | 4662 | spin_lock(&sh->stripe_lock); |
4656 | /* Cannot process 'sync' concurrently with 'discard' */ | 4663 | /* |
4657 | if (!test_bit(STRIPE_DISCARD, &sh->state) && | 4664 | * Cannot process 'sync' concurrently with 'discard'. |
4665 | * Flush data in r5cache before 'sync'. | ||
4666 | */ | ||
4667 | if (!test_bit(STRIPE_R5C_PARTIAL_STRIPE, &sh->state) && | ||
4668 | !test_bit(STRIPE_R5C_FULL_STRIPE, &sh->state) && | ||
4669 | !test_bit(STRIPE_DISCARD, &sh->state) && | ||
4658 | test_and_clear_bit(STRIPE_SYNC_REQUESTED, &sh->state)) { | 4670 | test_and_clear_bit(STRIPE_SYNC_REQUESTED, &sh->state)) { |
4659 | set_bit(STRIPE_SYNCING, &sh->state); | 4671 | set_bit(STRIPE_SYNCING, &sh->state); |
4660 | clear_bit(STRIPE_INSYNC, &sh->state); | 4672 | clear_bit(STRIPE_INSYNC, &sh->state); |
@@ -4701,10 +4713,15 @@ static void handle_stripe(struct stripe_head *sh) | |||
4701 | " to_write=%d failed=%d failed_num=%d,%d\n", | 4713 | " to_write=%d failed=%d failed_num=%d,%d\n", |
4702 | s.locked, s.uptodate, s.to_read, s.to_write, s.failed, | 4714 | s.locked, s.uptodate, s.to_read, s.to_write, s.failed, |
4703 | s.failed_num[0], s.failed_num[1]); | 4715 | s.failed_num[0], s.failed_num[1]); |
4704 | /* check if the array has lost more than max_degraded devices and, | 4716 | /* |
4717 | * check if the array has lost more than max_degraded devices and, | ||
4705 | * if so, some requests might need to be failed. | 4718 | * if so, some requests might need to be failed. |
4719 | * | ||
4720 | * When journal device failed (log_failed), we will only process | ||
4721 | * the stripe if there is data need write to raid disks | ||
4706 | */ | 4722 | */ |
4707 | if (s.failed > conf->max_degraded || s.log_failed) { | 4723 | if (s.failed > conf->max_degraded || |
4724 | (s.log_failed && s.injournal == 0)) { | ||
4708 | sh->check_state = 0; | 4725 | sh->check_state = 0; |
4709 | sh->reconstruct_state = 0; | 4726 | sh->reconstruct_state = 0; |
4710 | break_stripe_batch_list(sh, 0); | 4727 | break_stripe_batch_list(sh, 0); |
@@ -5277,8 +5294,10 @@ static struct stripe_head *__get_priority_stripe(struct r5conf *conf, int group) | |||
5277 | struct stripe_head *sh, *tmp; | 5294 | struct stripe_head *sh, *tmp; |
5278 | struct list_head *handle_list = NULL; | 5295 | struct list_head *handle_list = NULL; |
5279 | struct r5worker_group *wg; | 5296 | struct r5worker_group *wg; |
5280 | bool second_try = !r5c_is_writeback(conf->log); | 5297 | bool second_try = !r5c_is_writeback(conf->log) && |
5281 | bool try_loprio = test_bit(R5C_LOG_TIGHT, &conf->cache_state); | 5298 | !r5l_log_disk_error(conf); |
5299 | bool try_loprio = test_bit(R5C_LOG_TIGHT, &conf->cache_state) || | ||
5300 | r5l_log_disk_error(conf); | ||
5282 | 5301 | ||
5283 | again: | 5302 | again: |
5284 | wg = NULL; | 5303 | wg = NULL; |
@@ -6313,7 +6332,6 @@ int | |||
6313 | raid5_set_cache_size(struct mddev *mddev, int size) | 6332 | raid5_set_cache_size(struct mddev *mddev, int size) |
6314 | { | 6333 | { |
6315 | struct r5conf *conf = mddev->private; | 6334 | struct r5conf *conf = mddev->private; |
6316 | int err; | ||
6317 | 6335 | ||
6318 | if (size <= 16 || size > 32768) | 6336 | if (size <= 16 || size > 32768) |
6319 | return -EINVAL; | 6337 | return -EINVAL; |
@@ -6325,10 +6343,7 @@ raid5_set_cache_size(struct mddev *mddev, int size) | |||
6325 | ; | 6343 | ; |
6326 | mutex_unlock(&conf->cache_size_mutex); | 6344 | mutex_unlock(&conf->cache_size_mutex); |
6327 | 6345 | ||
6328 | 6346 | md_allow_write(mddev); | |
6329 | err = md_allow_write(mddev); | ||
6330 | if (err) | ||
6331 | return err; | ||
6332 | 6347 | ||
6333 | mutex_lock(&conf->cache_size_mutex); | 6348 | mutex_lock(&conf->cache_size_mutex); |
6334 | while (size > conf->max_nr_stripes) | 6349 | while (size > conf->max_nr_stripes) |
@@ -7530,7 +7545,9 @@ static int raid5_remove_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
7530 | * neilb: there is no locking about new writes here, | 7545 | * neilb: there is no locking about new writes here, |
7531 | * so this cannot be safe. | 7546 | * so this cannot be safe. |
7532 | */ | 7547 | */ |
7533 | if (atomic_read(&conf->active_stripes)) { | 7548 | if (atomic_read(&conf->active_stripes) || |
7549 | atomic_read(&conf->r5c_cached_full_stripes) || | ||
7550 | atomic_read(&conf->r5c_cached_partial_stripes)) { | ||
7534 | return -EBUSY; | 7551 | return -EBUSY; |
7535 | } | 7552 | } |
7536 | log_exit(conf); | 7553 | log_exit(conf); |
diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index bf0fe0137dfe..6d1b4b707cc2 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c | |||
@@ -512,7 +512,7 @@ static void gpmc_cs_show_timings(int cs, const char *desc) | |||
512 | pr_info("gpmc cs%i access configuration:\n", cs); | 512 | pr_info("gpmc cs%i access configuration:\n", cs); |
513 | GPMC_GET_RAW_BOOL(GPMC_CS_CONFIG1, 4, 4, "time-para-granularity"); | 513 | GPMC_GET_RAW_BOOL(GPMC_CS_CONFIG1, 4, 4, "time-para-granularity"); |
514 | GPMC_GET_RAW(GPMC_CS_CONFIG1, 8, 9, "mux-add-data"); | 514 | GPMC_GET_RAW(GPMC_CS_CONFIG1, 8, 9, "mux-add-data"); |
515 | GPMC_GET_RAW_MAX(GPMC_CS_CONFIG1, 12, 13, | 515 | GPMC_GET_RAW_SHIFT_MAX(GPMC_CS_CONFIG1, 12, 13, 1, |
516 | GPMC_CONFIG1_DEVICESIZE_MAX, "device-width"); | 516 | GPMC_CONFIG1_DEVICESIZE_MAX, "device-width"); |
517 | GPMC_GET_RAW(GPMC_CS_CONFIG1, 16, 17, "wait-pin"); | 517 | GPMC_GET_RAW(GPMC_CS_CONFIG1, 16, 17, "wait-pin"); |
518 | GPMC_GET_RAW_BOOL(GPMC_CS_CONFIG1, 21, 21, "wait-on-write"); | 518 | GPMC_GET_RAW_BOOL(GPMC_CS_CONFIG1, 21, 21, "wait-on-write"); |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 2cba76e6fa3c..07bbd4cc1852 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -492,6 +492,7 @@ config ASPEED_LPC_CTRL | |||
492 | 492 | ||
493 | config PCI_ENDPOINT_TEST | 493 | config PCI_ENDPOINT_TEST |
494 | depends on PCI | 494 | depends on PCI |
495 | select CRC32 | ||
495 | tristate "PCI Endpoint Test driver" | 496 | tristate "PCI Endpoint Test driver" |
496 | ---help--- | 497 | ---help--- |
497 | Enable this configuration option to enable the host side test driver | 498 | Enable this configuration option to enable the host side test driver |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index d474378ed810..b1dd12729f19 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -202,7 +202,7 @@ static int nand_ooblayout_free_lp_hamming(struct mtd_info *mtd, int section, | |||
202 | return 0; | 202 | return 0; |
203 | } | 203 | } |
204 | 204 | ||
205 | const struct mtd_ooblayout_ops nand_ooblayout_lp_hamming_ops = { | 205 | static const struct mtd_ooblayout_ops nand_ooblayout_lp_hamming_ops = { |
206 | .ecc = nand_ooblayout_ecc_lp_hamming, | 206 | .ecc = nand_ooblayout_ecc_lp_hamming, |
207 | .free = nand_ooblayout_free_lp_hamming, | 207 | .free = nand_ooblayout_free_lp_hamming, |
208 | }; | 208 | }; |
@@ -4361,7 +4361,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips, | |||
4361 | /* Initialize the ->data_interface field. */ | 4361 | /* Initialize the ->data_interface field. */ |
4362 | ret = nand_init_data_interface(chip); | 4362 | ret = nand_init_data_interface(chip); |
4363 | if (ret) | 4363 | if (ret) |
4364 | return ret; | 4364 | goto err_nand_init; |
4365 | 4365 | ||
4366 | /* | 4366 | /* |
4367 | * Setup the data interface correctly on the chip and controller side. | 4367 | * Setup the data interface correctly on the chip and controller side. |
@@ -4373,7 +4373,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips, | |||
4373 | */ | 4373 | */ |
4374 | ret = nand_setup_data_interface(chip); | 4374 | ret = nand_setup_data_interface(chip); |
4375 | if (ret) | 4375 | if (ret) |
4376 | return ret; | 4376 | goto err_nand_init; |
4377 | 4377 | ||
4378 | nand_maf_id = chip->id.data[0]; | 4378 | nand_maf_id = chip->id.data[0]; |
4379 | nand_dev_id = chip->id.data[1]; | 4379 | nand_dev_id = chip->id.data[1]; |
@@ -4404,6 +4404,12 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips, | |||
4404 | mtd->size = i * chip->chipsize; | 4404 | mtd->size = i * chip->chipsize; |
4405 | 4405 | ||
4406 | return 0; | 4406 | return 0; |
4407 | |||
4408 | err_nand_init: | ||
4409 | /* Free manufacturer priv data. */ | ||
4410 | nand_manufacturer_cleanup(chip); | ||
4411 | |||
4412 | return ret; | ||
4407 | } | 4413 | } |
4408 | EXPORT_SYMBOL(nand_scan_ident); | 4414 | EXPORT_SYMBOL(nand_scan_ident); |
4409 | 4415 | ||
@@ -4574,18 +4580,23 @@ int nand_scan_tail(struct mtd_info *mtd) | |||
4574 | 4580 | ||
4575 | /* New bad blocks should be marked in OOB, flash-based BBT, or both */ | 4581 | /* New bad blocks should be marked in OOB, flash-based BBT, or both */ |
4576 | if (WARN_ON((chip->bbt_options & NAND_BBT_NO_OOB_BBM) && | 4582 | if (WARN_ON((chip->bbt_options & NAND_BBT_NO_OOB_BBM) && |
4577 | !(chip->bbt_options & NAND_BBT_USE_FLASH))) | 4583 | !(chip->bbt_options & NAND_BBT_USE_FLASH))) { |
4578 | return -EINVAL; | 4584 | ret = -EINVAL; |
4585 | goto err_ident; | ||
4586 | } | ||
4579 | 4587 | ||
4580 | if (invalid_ecc_page_accessors(chip)) { | 4588 | if (invalid_ecc_page_accessors(chip)) { |
4581 | pr_err("Invalid ECC page accessors setup\n"); | 4589 | pr_err("Invalid ECC page accessors setup\n"); |
4582 | return -EINVAL; | 4590 | ret = -EINVAL; |
4591 | goto err_ident; | ||
4583 | } | 4592 | } |
4584 | 4593 | ||
4585 | if (!(chip->options & NAND_OWN_BUFFERS)) { | 4594 | if (!(chip->options & NAND_OWN_BUFFERS)) { |
4586 | nbuf = kzalloc(sizeof(*nbuf), GFP_KERNEL); | 4595 | nbuf = kzalloc(sizeof(*nbuf), GFP_KERNEL); |
4587 | if (!nbuf) | 4596 | if (!nbuf) { |
4588 | return -ENOMEM; | 4597 | ret = -ENOMEM; |
4598 | goto err_ident; | ||
4599 | } | ||
4589 | 4600 | ||
4590 | nbuf->ecccalc = kmalloc(mtd->oobsize, GFP_KERNEL); | 4601 | nbuf->ecccalc = kmalloc(mtd->oobsize, GFP_KERNEL); |
4591 | if (!nbuf->ecccalc) { | 4602 | if (!nbuf->ecccalc) { |
@@ -4608,8 +4619,10 @@ int nand_scan_tail(struct mtd_info *mtd) | |||
4608 | 4619 | ||
4609 | chip->buffers = nbuf; | 4620 | chip->buffers = nbuf; |
4610 | } else { | 4621 | } else { |
4611 | if (!chip->buffers) | 4622 | if (!chip->buffers) { |
4612 | return -ENOMEM; | 4623 | ret = -ENOMEM; |
4624 | goto err_ident; | ||
4625 | } | ||
4613 | } | 4626 | } |
4614 | 4627 | ||
4615 | /* Set the internal oob buffer location, just after the page data */ | 4628 | /* Set the internal oob buffer location, just after the page data */ |
@@ -4842,7 +4855,11 @@ int nand_scan_tail(struct mtd_info *mtd) | |||
4842 | return 0; | 4855 | return 0; |
4843 | 4856 | ||
4844 | /* Build bad block table */ | 4857 | /* Build bad block table */ |
4845 | return chip->scan_bbt(mtd); | 4858 | ret = chip->scan_bbt(mtd); |
4859 | if (ret) | ||
4860 | goto err_free; | ||
4861 | return 0; | ||
4862 | |||
4846 | err_free: | 4863 | err_free: |
4847 | if (nbuf) { | 4864 | if (nbuf) { |
4848 | kfree(nbuf->databuf); | 4865 | kfree(nbuf->databuf); |
@@ -4850,6 +4867,13 @@ err_free: | |||
4850 | kfree(nbuf->ecccalc); | 4867 | kfree(nbuf->ecccalc); |
4851 | kfree(nbuf); | 4868 | kfree(nbuf); |
4852 | } | 4869 | } |
4870 | |||
4871 | err_ident: | ||
4872 | /* Clean up nand_scan_ident(). */ | ||
4873 | |||
4874 | /* Free manufacturer priv data. */ | ||
4875 | nand_manufacturer_cleanup(chip); | ||
4876 | |||
4853 | return ret; | 4877 | return ret; |
4854 | } | 4878 | } |
4855 | EXPORT_SYMBOL(nand_scan_tail); | 4879 | EXPORT_SYMBOL(nand_scan_tail); |
diff --git a/drivers/mtd/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c index 9d5ca0e540b5..92e2cf8e9ff9 100644 --- a/drivers/mtd/nand/nand_ids.c +++ b/drivers/mtd/nand/nand_ids.c | |||
@@ -6,7 +6,6 @@ | |||
6 | * published by the Free Software Foundation. | 6 | * published by the Free Software Foundation. |
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | #include <linux/module.h> | ||
10 | #include <linux/mtd/nand.h> | 9 | #include <linux/mtd/nand.h> |
11 | #include <linux/sizes.h> | 10 | #include <linux/sizes.h> |
12 | 11 | ||
diff --git a/drivers/mtd/nand/nand_samsung.c b/drivers/mtd/nand/nand_samsung.c index 9cfc4035a420..1e0755997762 100644 --- a/drivers/mtd/nand/nand_samsung.c +++ b/drivers/mtd/nand/nand_samsung.c | |||
@@ -84,6 +84,9 @@ static void samsung_nand_decode_id(struct nand_chip *chip) | |||
84 | case 7: | 84 | case 7: |
85 | chip->ecc_strength_ds = 60; | 85 | chip->ecc_strength_ds = 60; |
86 | break; | 86 | break; |
87 | default: | ||
88 | WARN(1, "Could not decode ECC info"); | ||
89 | chip->ecc_step_ds = 0; | ||
87 | } | 90 | } |
88 | } | 91 | } |
89 | } else { | 92 | } else { |
diff --git a/drivers/mtd/nand/tango_nand.c b/drivers/mtd/nand/tango_nand.c index 05b6e1065203..49b286c6c10f 100644 --- a/drivers/mtd/nand/tango_nand.c +++ b/drivers/mtd/nand/tango_nand.c | |||
@@ -55,10 +55,10 @@ | |||
55 | * byte 1 for other packets in the page (PKT_N, for N > 0) | 55 | * byte 1 for other packets in the page (PKT_N, for N > 0) |
56 | * ERR_COUNT_PKT_N is the max error count over all but the first packet. | 56 | * ERR_COUNT_PKT_N is the max error count over all but the first packet. |
57 | */ | 57 | */ |
58 | #define DECODE_OK_PKT_0(v) ((v) & BIT(7)) | ||
59 | #define DECODE_OK_PKT_N(v) ((v) & BIT(15)) | ||
60 | #define ERR_COUNT_PKT_0(v) (((v) >> 0) & 0x3f) | 58 | #define ERR_COUNT_PKT_0(v) (((v) >> 0) & 0x3f) |
61 | #define ERR_COUNT_PKT_N(v) (((v) >> 8) & 0x3f) | 59 | #define ERR_COUNT_PKT_N(v) (((v) >> 8) & 0x3f) |
60 | #define DECODE_FAIL_PKT_0(v) (((v) & BIT(7)) == 0) | ||
61 | #define DECODE_FAIL_PKT_N(v) (((v) & BIT(15)) == 0) | ||
62 | 62 | ||
63 | /* Offsets relative to pbus_base */ | 63 | /* Offsets relative to pbus_base */ |
64 | #define PBUS_CS_CTRL 0x83c | 64 | #define PBUS_CS_CTRL 0x83c |
@@ -193,6 +193,8 @@ static int check_erased_page(struct nand_chip *chip, u8 *buf) | |||
193 | chip->ecc.strength); | 193 | chip->ecc.strength); |
194 | if (res < 0) | 194 | if (res < 0) |
195 | mtd->ecc_stats.failed++; | 195 | mtd->ecc_stats.failed++; |
196 | else | ||
197 | mtd->ecc_stats.corrected += res; | ||
196 | 198 | ||
197 | bitflips = max(res, bitflips); | 199 | bitflips = max(res, bitflips); |
198 | buf += pkt_size; | 200 | buf += pkt_size; |
@@ -202,9 +204,11 @@ static int check_erased_page(struct nand_chip *chip, u8 *buf) | |||
202 | return bitflips; | 204 | return bitflips; |
203 | } | 205 | } |
204 | 206 | ||
205 | static int decode_error_report(struct tango_nfc *nfc) | 207 | static int decode_error_report(struct nand_chip *chip) |
206 | { | 208 | { |
207 | u32 status, res; | 209 | u32 status, res; |
210 | struct mtd_info *mtd = nand_to_mtd(chip); | ||
211 | struct tango_nfc *nfc = to_tango_nfc(chip->controller); | ||
208 | 212 | ||
209 | status = readl_relaxed(nfc->reg_base + NFC_XFER_STATUS); | 213 | status = readl_relaxed(nfc->reg_base + NFC_XFER_STATUS); |
210 | if (status & PAGE_IS_EMPTY) | 214 | if (status & PAGE_IS_EMPTY) |
@@ -212,10 +216,14 @@ static int decode_error_report(struct tango_nfc *nfc) | |||
212 | 216 | ||
213 | res = readl_relaxed(nfc->mem_base + ERROR_REPORT); | 217 | res = readl_relaxed(nfc->mem_base + ERROR_REPORT); |
214 | 218 | ||
215 | if (DECODE_OK_PKT_0(res) && DECODE_OK_PKT_N(res)) | 219 | if (DECODE_FAIL_PKT_0(res) || DECODE_FAIL_PKT_N(res)) |
216 | return max(ERR_COUNT_PKT_0(res), ERR_COUNT_PKT_N(res)); | 220 | return -EBADMSG; |
221 | |||
222 | /* ERR_COUNT_PKT_N is max, not sum, but that's all we have */ | ||
223 | mtd->ecc_stats.corrected += | ||
224 | ERR_COUNT_PKT_0(res) + ERR_COUNT_PKT_N(res); | ||
217 | 225 | ||
218 | return -EBADMSG; | 226 | return max(ERR_COUNT_PKT_0(res), ERR_COUNT_PKT_N(res)); |
219 | } | 227 | } |
220 | 228 | ||
221 | static void tango_dma_callback(void *arg) | 229 | static void tango_dma_callback(void *arg) |
@@ -282,7 +290,7 @@ static int tango_read_page(struct mtd_info *mtd, struct nand_chip *chip, | |||
282 | if (err) | 290 | if (err) |
283 | return err; | 291 | return err; |
284 | 292 | ||
285 | res = decode_error_report(nfc); | 293 | res = decode_error_report(chip); |
286 | if (res < 0) { | 294 | if (res < 0) { |
287 | chip->ecc.read_oob_raw(mtd, chip, page); | 295 | chip->ecc.read_oob_raw(mtd, chip, page); |
288 | res = check_erased_page(chip, buf); | 296 | res = check_erased_page(chip, buf); |
@@ -663,6 +671,7 @@ static const struct of_device_id tango_nand_ids[] = { | |||
663 | { .compatible = "sigma,smp8758-nand" }, | 671 | { .compatible = "sigma,smp8758-nand" }, |
664 | { /* sentinel */ } | 672 | { /* sentinel */ } |
665 | }; | 673 | }; |
674 | MODULE_DEVICE_TABLE(of, tango_nand_ids); | ||
666 | 675 | ||
667 | static struct platform_driver tango_nand_driver = { | 676 | static struct platform_driver tango_nand_driver = { |
668 | .probe = tango_nand_probe, | 677 | .probe = tango_nand_probe, |
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 19581d783d8e..d034d8cd7d22 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c | |||
@@ -849,6 +849,9 @@ static uint64_t _mv88e6xxx_get_ethtool_stat(struct mv88e6xxx_chip *chip, | |||
849 | mv88e6xxx_g1_stats_read(chip, reg, &low); | 849 | mv88e6xxx_g1_stats_read(chip, reg, &low); |
850 | if (s->sizeof_stat == 8) | 850 | if (s->sizeof_stat == 8) |
851 | mv88e6xxx_g1_stats_read(chip, reg + 1, &high); | 851 | mv88e6xxx_g1_stats_read(chip, reg + 1, &high); |
852 | break; | ||
853 | default: | ||
854 | return UINT64_MAX; | ||
852 | } | 855 | } |
853 | value = (((u64)high) << 16) | low; | 856 | value = (((u64)high) << 16) | low; |
854 | return value; | 857 | return value; |
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c index 4ee15ff06a44..faeb4935ef3e 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | |||
@@ -200,29 +200,18 @@ err_exit: | |||
200 | static int hw_atl_a0_hw_offload_set(struct aq_hw_s *self, | 200 | static int hw_atl_a0_hw_offload_set(struct aq_hw_s *self, |
201 | struct aq_nic_cfg_s *aq_nic_cfg) | 201 | struct aq_nic_cfg_s *aq_nic_cfg) |
202 | { | 202 | { |
203 | int err = 0; | ||
204 | |||
205 | /* TX checksums offloads*/ | 203 | /* TX checksums offloads*/ |
206 | tpo_ipv4header_crc_offload_en_set(self, 1); | 204 | tpo_ipv4header_crc_offload_en_set(self, 1); |
207 | tpo_tcp_udp_crc_offload_en_set(self, 1); | 205 | tpo_tcp_udp_crc_offload_en_set(self, 1); |
208 | if (err < 0) | ||
209 | goto err_exit; | ||
210 | 206 | ||
211 | /* RX checksums offloads*/ | 207 | /* RX checksums offloads*/ |
212 | rpo_ipv4header_crc_offload_en_set(self, 1); | 208 | rpo_ipv4header_crc_offload_en_set(self, 1); |
213 | rpo_tcp_udp_crc_offload_en_set(self, 1); | 209 | rpo_tcp_udp_crc_offload_en_set(self, 1); |
214 | if (err < 0) | ||
215 | goto err_exit; | ||
216 | 210 | ||
217 | /* LSO offloads*/ | 211 | /* LSO offloads*/ |
218 | tdm_large_send_offload_en_set(self, 0xFFFFFFFFU); | 212 | tdm_large_send_offload_en_set(self, 0xFFFFFFFFU); |
219 | if (err < 0) | ||
220 | goto err_exit; | ||
221 | |||
222 | err = aq_hw_err_from_flags(self); | ||
223 | 213 | ||
224 | err_exit: | 214 | return aq_hw_err_from_flags(self); |
225 | return err; | ||
226 | } | 215 | } |
227 | 216 | ||
228 | static int hw_atl_a0_hw_init_tx_path(struct aq_hw_s *self) | 217 | static int hw_atl_a0_hw_init_tx_path(struct aq_hw_s *self) |
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c index 42150708191d..1bceb7358e5c 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | |||
@@ -200,25 +200,18 @@ err_exit: | |||
200 | static int hw_atl_b0_hw_offload_set(struct aq_hw_s *self, | 200 | static int hw_atl_b0_hw_offload_set(struct aq_hw_s *self, |
201 | struct aq_nic_cfg_s *aq_nic_cfg) | 201 | struct aq_nic_cfg_s *aq_nic_cfg) |
202 | { | 202 | { |
203 | int err = 0; | ||
204 | unsigned int i; | 203 | unsigned int i; |
205 | 204 | ||
206 | /* TX checksums offloads*/ | 205 | /* TX checksums offloads*/ |
207 | tpo_ipv4header_crc_offload_en_set(self, 1); | 206 | tpo_ipv4header_crc_offload_en_set(self, 1); |
208 | tpo_tcp_udp_crc_offload_en_set(self, 1); | 207 | tpo_tcp_udp_crc_offload_en_set(self, 1); |
209 | if (err < 0) | ||
210 | goto err_exit; | ||
211 | 208 | ||
212 | /* RX checksums offloads*/ | 209 | /* RX checksums offloads*/ |
213 | rpo_ipv4header_crc_offload_en_set(self, 1); | 210 | rpo_ipv4header_crc_offload_en_set(self, 1); |
214 | rpo_tcp_udp_crc_offload_en_set(self, 1); | 211 | rpo_tcp_udp_crc_offload_en_set(self, 1); |
215 | if (err < 0) | ||
216 | goto err_exit; | ||
217 | 212 | ||
218 | /* LSO offloads*/ | 213 | /* LSO offloads*/ |
219 | tdm_large_send_offload_en_set(self, 0xFFFFFFFFU); | 214 | tdm_large_send_offload_en_set(self, 0xFFFFFFFFU); |
220 | if (err < 0) | ||
221 | goto err_exit; | ||
222 | 215 | ||
223 | /* LRO offloads */ | 216 | /* LRO offloads */ |
224 | { | 217 | { |
@@ -245,10 +238,7 @@ static int hw_atl_b0_hw_offload_set(struct aq_hw_s *self, | |||
245 | 238 | ||
246 | rpo_lro_en_set(self, aq_nic_cfg->is_lro ? 0xFFFFFFFFU : 0U); | 239 | rpo_lro_en_set(self, aq_nic_cfg->is_lro ? 0xFFFFFFFFU : 0U); |
247 | } | 240 | } |
248 | err = aq_hw_err_from_flags(self); | 241 | return aq_hw_err_from_flags(self); |
249 | |||
250 | err_exit: | ||
251 | return err; | ||
252 | } | 242 | } |
253 | 243 | ||
254 | static int hw_atl_b0_hw_init_tx_path(struct aq_hw_s *self) | 244 | static int hw_atl_b0_hw_init_tx_path(struct aq_hw_s *self) |
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index b56c54d68d5e..03f55daecb20 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |||
@@ -7630,8 +7630,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7630 | dev->min_mtu = ETH_ZLEN; | 7630 | dev->min_mtu = ETH_ZLEN; |
7631 | dev->max_mtu = BNXT_MAX_MTU; | 7631 | dev->max_mtu = BNXT_MAX_MTU; |
7632 | 7632 | ||
7633 | bnxt_dcb_init(bp); | ||
7634 | |||
7635 | #ifdef CONFIG_BNXT_SRIOV | 7633 | #ifdef CONFIG_BNXT_SRIOV |
7636 | init_waitqueue_head(&bp->sriov_cfg_wait); | 7634 | init_waitqueue_head(&bp->sriov_cfg_wait); |
7637 | #endif | 7635 | #endif |
@@ -7669,6 +7667,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7669 | bnxt_hwrm_func_qcfg(bp); | 7667 | bnxt_hwrm_func_qcfg(bp); |
7670 | bnxt_hwrm_port_led_qcaps(bp); | 7668 | bnxt_hwrm_port_led_qcaps(bp); |
7671 | bnxt_ethtool_init(bp); | 7669 | bnxt_ethtool_init(bp); |
7670 | bnxt_dcb_init(bp); | ||
7672 | 7671 | ||
7673 | bnxt_set_rx_skb_mode(bp, false); | 7672 | bnxt_set_rx_skb_mode(bp, false); |
7674 | bnxt_set_tpa_flags(bp); | 7673 | bnxt_set_tpa_flags(bp); |
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c index 46de2f8ff024..5c6dd0ce209f 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c | |||
@@ -553,8 +553,10 @@ static u8 bnxt_dcbnl_setdcbx(struct net_device *dev, u8 mode) | |||
553 | if ((mode & DCB_CAP_DCBX_VER_CEE) || !(mode & DCB_CAP_DCBX_VER_IEEE)) | 553 | if ((mode & DCB_CAP_DCBX_VER_CEE) || !(mode & DCB_CAP_DCBX_VER_IEEE)) |
554 | return 1; | 554 | return 1; |
555 | 555 | ||
556 | if ((mode & DCB_CAP_DCBX_HOST) && BNXT_VF(bp)) | 556 | if (mode & DCB_CAP_DCBX_HOST) { |
557 | return 1; | 557 | if (BNXT_VF(bp) || (bp->flags & BNXT_FLAG_FW_LLDP_AGENT)) |
558 | return 1; | ||
559 | } | ||
558 | 560 | ||
559 | if (mode == bp->dcbx_cap) | 561 | if (mode == bp->dcbx_cap) |
560 | return 0; | 562 | return 0; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h index fa376444e57c..3549d3876278 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | #define T4FW_VERSION_MAJOR 0x01 | 38 | #define T4FW_VERSION_MAJOR 0x01 |
39 | #define T4FW_VERSION_MINOR 0x10 | 39 | #define T4FW_VERSION_MINOR 0x10 |
40 | #define T4FW_VERSION_MICRO 0x21 | 40 | #define T4FW_VERSION_MICRO 0x2B |
41 | #define T4FW_VERSION_BUILD 0x00 | 41 | #define T4FW_VERSION_BUILD 0x00 |
42 | 42 | ||
43 | #define T4FW_MIN_VERSION_MAJOR 0x01 | 43 | #define T4FW_MIN_VERSION_MAJOR 0x01 |
@@ -46,7 +46,7 @@ | |||
46 | 46 | ||
47 | #define T5FW_VERSION_MAJOR 0x01 | 47 | #define T5FW_VERSION_MAJOR 0x01 |
48 | #define T5FW_VERSION_MINOR 0x10 | 48 | #define T5FW_VERSION_MINOR 0x10 |
49 | #define T5FW_VERSION_MICRO 0x21 | 49 | #define T5FW_VERSION_MICRO 0x2B |
50 | #define T5FW_VERSION_BUILD 0x00 | 50 | #define T5FW_VERSION_BUILD 0x00 |
51 | 51 | ||
52 | #define T5FW_MIN_VERSION_MAJOR 0x00 | 52 | #define T5FW_MIN_VERSION_MAJOR 0x00 |
@@ -55,7 +55,7 @@ | |||
55 | 55 | ||
56 | #define T6FW_VERSION_MAJOR 0x01 | 56 | #define T6FW_VERSION_MAJOR 0x01 |
57 | #define T6FW_VERSION_MINOR 0x10 | 57 | #define T6FW_VERSION_MINOR 0x10 |
58 | #define T6FW_VERSION_MICRO 0x21 | 58 | #define T6FW_VERSION_MICRO 0x2B |
59 | #define T6FW_VERSION_BUILD 0x00 | 59 | #define T6FW_VERSION_BUILD 0x00 |
60 | 60 | ||
61 | #define T6FW_MIN_VERSION_MAJOR 0x00 | 61 | #define T6FW_MIN_VERSION_MAJOR 0x00 |
diff --git a/drivers/net/ethernet/faraday/ftmac100.c b/drivers/net/ethernet/faraday/ftmac100.c index 6ac336b546e6..1536356e2ea8 100644 --- a/drivers/net/ethernet/faraday/ftmac100.c +++ b/drivers/net/ethernet/faraday/ftmac100.c | |||
@@ -1174,11 +1174,17 @@ static int ftmac100_remove(struct platform_device *pdev) | |||
1174 | return 0; | 1174 | return 0; |
1175 | } | 1175 | } |
1176 | 1176 | ||
1177 | static const struct of_device_id ftmac100_of_ids[] = { | ||
1178 | { .compatible = "andestech,atmac100" }, | ||
1179 | { } | ||
1180 | }; | ||
1181 | |||
1177 | static struct platform_driver ftmac100_driver = { | 1182 | static struct platform_driver ftmac100_driver = { |
1178 | .probe = ftmac100_probe, | 1183 | .probe = ftmac100_probe, |
1179 | .remove = ftmac100_remove, | 1184 | .remove = ftmac100_remove, |
1180 | .driver = { | 1185 | .driver = { |
1181 | .name = DRV_NAME, | 1186 | .name = DRV_NAME, |
1187 | .of_match_table = ftmac100_of_ids | ||
1182 | }, | 1188 | }, |
1183 | }; | 1189 | }; |
1184 | 1190 | ||
@@ -1202,3 +1208,4 @@ module_exit(ftmac100_exit); | |||
1202 | MODULE_AUTHOR("Po-Yu Chuang <ratbert@faraday-tech.com>"); | 1208 | MODULE_AUTHOR("Po-Yu Chuang <ratbert@faraday-tech.com>"); |
1203 | MODULE_DESCRIPTION("FTMAC100 driver"); | 1209 | MODULE_DESCRIPTION("FTMAC100 driver"); |
1204 | MODULE_LICENSE("GPL"); | 1210 | MODULE_LICENSE("GPL"); |
1211 | MODULE_DEVICE_TABLE(of, ftmac100_of_ids); | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 703205475524..83aab1e4c8c8 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -2862,12 +2862,10 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev) | |||
2862 | int port = 0; | 2862 | int port = 0; |
2863 | 2863 | ||
2864 | if (msi_x) { | 2864 | if (msi_x) { |
2865 | int nreq = dev->caps.num_ports * num_online_cpus() + 1; | 2865 | int nreq = min3(dev->caps.num_ports * |
2866 | 2866 | (int)num_online_cpus() + 1, | |
2867 | nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs, | 2867 | dev->caps.num_eqs - dev->caps.reserved_eqs, |
2868 | nreq); | 2868 | MAX_MSIX); |
2869 | if (nreq > MAX_MSIX) | ||
2870 | nreq = MAX_MSIX; | ||
2871 | 2869 | ||
2872 | entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); | 2870 | entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); |
2873 | if (!entries) | 2871 | if (!entries) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig index fc52d742b7f7..27251a78075c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig +++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig | |||
@@ -13,7 +13,7 @@ config MLX5_CORE | |||
13 | 13 | ||
14 | config MLX5_CORE_EN | 14 | config MLX5_CORE_EN |
15 | bool "Mellanox Technologies ConnectX-4 Ethernet support" | 15 | bool "Mellanox Technologies ConnectX-4 Ethernet support" |
16 | depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE | 16 | depends on NETDEVICES && ETHERNET && INET && PCI && MLX5_CORE |
17 | depends on IPV6=y || IPV6=n || MLX5_CORE=m | 17 | depends on IPV6=y || IPV6=n || MLX5_CORE=m |
18 | imply PTP_1588_CLOCK | 18 | imply PTP_1588_CLOCK |
19 | default n | 19 | default n |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 0099a3e397bc..2fd044b23875 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h | |||
@@ -1003,7 +1003,7 @@ int mlx5e_create_direct_tirs(struct mlx5e_priv *priv); | |||
1003 | void mlx5e_destroy_direct_tirs(struct mlx5e_priv *priv); | 1003 | void mlx5e_destroy_direct_tirs(struct mlx5e_priv *priv); |
1004 | void mlx5e_destroy_rqt(struct mlx5e_priv *priv, struct mlx5e_rqt *rqt); | 1004 | void mlx5e_destroy_rqt(struct mlx5e_priv *priv, struct mlx5e_rqt *rqt); |
1005 | 1005 | ||
1006 | int mlx5e_create_ttc_table(struct mlx5e_priv *priv, u32 underlay_qpn); | 1006 | int mlx5e_create_ttc_table(struct mlx5e_priv *priv); |
1007 | void mlx5e_destroy_ttc_table(struct mlx5e_priv *priv); | 1007 | void mlx5e_destroy_ttc_table(struct mlx5e_priv *priv); |
1008 | 1008 | ||
1009 | int mlx5e_create_tis(struct mlx5_core_dev *mdev, int tc, | 1009 | int mlx5e_create_tis(struct mlx5_core_dev *mdev, int tc, |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index ce7b09d72ff6..8209affa75c3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | |||
@@ -794,7 +794,6 @@ static void get_supported(u32 eth_proto_cap, | |||
794 | ptys2ethtool_supported_port(link_ksettings, eth_proto_cap); | 794 | ptys2ethtool_supported_port(link_ksettings, eth_proto_cap); |
795 | ptys2ethtool_supported_link(supported, eth_proto_cap); | 795 | ptys2ethtool_supported_link(supported, eth_proto_cap); |
796 | ethtool_link_ksettings_add_link_mode(link_ksettings, supported, Pause); | 796 | ethtool_link_ksettings_add_link_mode(link_ksettings, supported, Pause); |
797 | ethtool_link_ksettings_add_link_mode(link_ksettings, supported, Asym_Pause); | ||
798 | } | 797 | } |
799 | 798 | ||
800 | static void get_advertising(u32 eth_proto_cap, u8 tx_pause, | 799 | static void get_advertising(u32 eth_proto_cap, u8 tx_pause, |
@@ -804,7 +803,7 @@ static void get_advertising(u32 eth_proto_cap, u8 tx_pause, | |||
804 | unsigned long *advertising = link_ksettings->link_modes.advertising; | 803 | unsigned long *advertising = link_ksettings->link_modes.advertising; |
805 | 804 | ||
806 | ptys2ethtool_adver_link(advertising, eth_proto_cap); | 805 | ptys2ethtool_adver_link(advertising, eth_proto_cap); |
807 | if (tx_pause) | 806 | if (rx_pause) |
808 | ethtool_link_ksettings_add_link_mode(link_ksettings, advertising, Pause); | 807 | ethtool_link_ksettings_add_link_mode(link_ksettings, advertising, Pause); |
809 | if (tx_pause ^ rx_pause) | 808 | if (tx_pause ^ rx_pause) |
810 | ethtool_link_ksettings_add_link_mode(link_ksettings, advertising, Asym_Pause); | 809 | ethtool_link_ksettings_add_link_mode(link_ksettings, advertising, Asym_Pause); |
@@ -849,6 +848,8 @@ static int mlx5e_get_link_ksettings(struct net_device *netdev, | |||
849 | struct mlx5e_priv *priv = netdev_priv(netdev); | 848 | struct mlx5e_priv *priv = netdev_priv(netdev); |
850 | struct mlx5_core_dev *mdev = priv->mdev; | 849 | struct mlx5_core_dev *mdev = priv->mdev; |
851 | u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {0}; | 850 | u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {0}; |
851 | u32 rx_pause = 0; | ||
852 | u32 tx_pause = 0; | ||
852 | u32 eth_proto_cap; | 853 | u32 eth_proto_cap; |
853 | u32 eth_proto_admin; | 854 | u32 eth_proto_admin; |
854 | u32 eth_proto_lp; | 855 | u32 eth_proto_lp; |
@@ -871,11 +872,13 @@ static int mlx5e_get_link_ksettings(struct net_device *netdev, | |||
871 | an_disable_admin = MLX5_GET(ptys_reg, out, an_disable_admin); | 872 | an_disable_admin = MLX5_GET(ptys_reg, out, an_disable_admin); |
872 | an_status = MLX5_GET(ptys_reg, out, an_status); | 873 | an_status = MLX5_GET(ptys_reg, out, an_status); |
873 | 874 | ||
875 | mlx5_query_port_pause(mdev, &rx_pause, &tx_pause); | ||
876 | |||
874 | ethtool_link_ksettings_zero_link_mode(link_ksettings, supported); | 877 | ethtool_link_ksettings_zero_link_mode(link_ksettings, supported); |
875 | ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising); | 878 | ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising); |
876 | 879 | ||
877 | get_supported(eth_proto_cap, link_ksettings); | 880 | get_supported(eth_proto_cap, link_ksettings); |
878 | get_advertising(eth_proto_admin, 0, 0, link_ksettings); | 881 | get_advertising(eth_proto_admin, tx_pause, rx_pause, link_ksettings); |
879 | get_speed_duplex(netdev, eth_proto_oper, link_ksettings); | 882 | get_speed_duplex(netdev, eth_proto_oper, link_ksettings); |
880 | 883 | ||
881 | eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap; | 884 | eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c index 576d6787b484..53ed58320a24 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | |||
@@ -800,7 +800,7 @@ void mlx5e_destroy_ttc_table(struct mlx5e_priv *priv) | |||
800 | mlx5e_destroy_flow_table(&ttc->ft); | 800 | mlx5e_destroy_flow_table(&ttc->ft); |
801 | } | 801 | } |
802 | 802 | ||
803 | int mlx5e_create_ttc_table(struct mlx5e_priv *priv, u32 underlay_qpn) | 803 | int mlx5e_create_ttc_table(struct mlx5e_priv *priv) |
804 | { | 804 | { |
805 | struct mlx5e_ttc_table *ttc = &priv->fs.ttc; | 805 | struct mlx5e_ttc_table *ttc = &priv->fs.ttc; |
806 | struct mlx5_flow_table_attr ft_attr = {}; | 806 | struct mlx5_flow_table_attr ft_attr = {}; |
@@ -810,7 +810,6 @@ int mlx5e_create_ttc_table(struct mlx5e_priv *priv, u32 underlay_qpn) | |||
810 | ft_attr.max_fte = MLX5E_TTC_TABLE_SIZE; | 810 | ft_attr.max_fte = MLX5E_TTC_TABLE_SIZE; |
811 | ft_attr.level = MLX5E_TTC_FT_LEVEL; | 811 | ft_attr.level = MLX5E_TTC_FT_LEVEL; |
812 | ft_attr.prio = MLX5E_NIC_PRIO; | 812 | ft_attr.prio = MLX5E_NIC_PRIO; |
813 | ft_attr.underlay_qpn = underlay_qpn; | ||
814 | 813 | ||
815 | ft->t = mlx5_create_flow_table(priv->fs.ns, &ft_attr); | 814 | ft->t = mlx5_create_flow_table(priv->fs.ns, &ft_attr); |
816 | if (IS_ERR(ft->t)) { | 815 | if (IS_ERR(ft->t)) { |
@@ -1147,7 +1146,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv) | |||
1147 | priv->netdev->hw_features &= ~NETIF_F_NTUPLE; | 1146 | priv->netdev->hw_features &= ~NETIF_F_NTUPLE; |
1148 | } | 1147 | } |
1149 | 1148 | ||
1150 | err = mlx5e_create_ttc_table(priv, 0); | 1149 | err = mlx5e_create_ttc_table(priv); |
1151 | if (err) { | 1150 | if (err) { |
1152 | netdev_err(priv->netdev, "Failed to create ttc table, err=%d\n", | 1151 | netdev_err(priv->netdev, "Failed to create ttc table, err=%d\n", |
1153 | err); | 1152 | err); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index a61b71b6fff3..41cd22a223dc 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
@@ -2976,7 +2976,7 @@ static int mlx5e_setup_tc(struct net_device *netdev, u8 tc) | |||
2976 | new_channels.params = priv->channels.params; | 2976 | new_channels.params = priv->channels.params; |
2977 | new_channels.params.num_tc = tc ? tc : 1; | 2977 | new_channels.params.num_tc = tc ? tc : 1; |
2978 | 2978 | ||
2979 | if (test_bit(MLX5E_STATE_OPENED, &priv->state)) { | 2979 | if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) { |
2980 | priv->channels.params = new_channels.params; | 2980 | priv->channels.params = new_channels.params; |
2981 | goto out; | 2981 | goto out; |
2982 | } | 2982 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c index 19e3d2fc2099..fcec7bedd3cd 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | |||
@@ -40,28 +40,25 @@ | |||
40 | #include "eswitch.h" | 40 | #include "eswitch.h" |
41 | 41 | ||
42 | int mlx5_cmd_update_root_ft(struct mlx5_core_dev *dev, | 42 | int mlx5_cmd_update_root_ft(struct mlx5_core_dev *dev, |
43 | struct mlx5_flow_table *ft) | 43 | struct mlx5_flow_table *ft, u32 underlay_qpn) |
44 | { | 44 | { |
45 | u32 in[MLX5_ST_SZ_DW(set_flow_table_root_in)] = {0}; | 45 | u32 in[MLX5_ST_SZ_DW(set_flow_table_root_in)] = {0}; |
46 | u32 out[MLX5_ST_SZ_DW(set_flow_table_root_out)] = {0}; | 46 | u32 out[MLX5_ST_SZ_DW(set_flow_table_root_out)] = {0}; |
47 | 47 | ||
48 | if ((MLX5_CAP_GEN(dev, port_type) == MLX5_CAP_PORT_TYPE_IB) && | 48 | if ((MLX5_CAP_GEN(dev, port_type) == MLX5_CAP_PORT_TYPE_IB) && |
49 | ft->underlay_qpn == 0) | 49 | underlay_qpn == 0) |
50 | return 0; | 50 | return 0; |
51 | 51 | ||
52 | MLX5_SET(set_flow_table_root_in, in, opcode, | 52 | MLX5_SET(set_flow_table_root_in, in, opcode, |
53 | MLX5_CMD_OP_SET_FLOW_TABLE_ROOT); | 53 | MLX5_CMD_OP_SET_FLOW_TABLE_ROOT); |
54 | MLX5_SET(set_flow_table_root_in, in, table_type, ft->type); | 54 | MLX5_SET(set_flow_table_root_in, in, table_type, ft->type); |
55 | MLX5_SET(set_flow_table_root_in, in, table_id, ft->id); | 55 | MLX5_SET(set_flow_table_root_in, in, table_id, ft->id); |
56 | MLX5_SET(set_flow_table_root_in, in, underlay_qpn, underlay_qpn); | ||
56 | if (ft->vport) { | 57 | if (ft->vport) { |
57 | MLX5_SET(set_flow_table_root_in, in, vport_number, ft->vport); | 58 | MLX5_SET(set_flow_table_root_in, in, vport_number, ft->vport); |
58 | MLX5_SET(set_flow_table_root_in, in, other_vport, 1); | 59 | MLX5_SET(set_flow_table_root_in, in, other_vport, 1); |
59 | } | 60 | } |
60 | 61 | ||
61 | if ((MLX5_CAP_GEN(dev, port_type) == MLX5_CAP_PORT_TYPE_IB) && | ||
62 | ft->underlay_qpn != 0) | ||
63 | MLX5_SET(set_flow_table_root_in, in, underlay_qpn, ft->underlay_qpn); | ||
64 | |||
65 | return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); | 62 | return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); |
66 | } | 63 | } |
67 | 64 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h index 8fad80688536..0f98a7cf4877 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h | |||
@@ -71,7 +71,8 @@ int mlx5_cmd_delete_fte(struct mlx5_core_dev *dev, | |||
71 | unsigned int index); | 71 | unsigned int index); |
72 | 72 | ||
73 | int mlx5_cmd_update_root_ft(struct mlx5_core_dev *dev, | 73 | int mlx5_cmd_update_root_ft(struct mlx5_core_dev *dev, |
74 | struct mlx5_flow_table *ft); | 74 | struct mlx5_flow_table *ft, |
75 | u32 underlay_qpn); | ||
75 | 76 | ||
76 | int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u16 *id); | 77 | int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u16 *id); |
77 | int mlx5_cmd_fc_free(struct mlx5_core_dev *dev, u16 id); | 78 | int mlx5_cmd_fc_free(struct mlx5_core_dev *dev, u16 id); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index b8a176503d38..0e487e8ca634 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | |||
@@ -650,7 +650,7 @@ static int update_root_ft_create(struct mlx5_flow_table *ft, struct fs_prio | |||
650 | if (ft->level >= min_level) | 650 | if (ft->level >= min_level) |
651 | return 0; | 651 | return 0; |
652 | 652 | ||
653 | err = mlx5_cmd_update_root_ft(root->dev, ft); | 653 | err = mlx5_cmd_update_root_ft(root->dev, ft, root->underlay_qpn); |
654 | if (err) | 654 | if (err) |
655 | mlx5_core_warn(root->dev, "Update root flow table of id=%u failed\n", | 655 | mlx5_core_warn(root->dev, "Update root flow table of id=%u failed\n", |
656 | ft->id); | 656 | ft->id); |
@@ -818,8 +818,6 @@ static struct mlx5_flow_table *__mlx5_create_flow_table(struct mlx5_flow_namespa | |||
818 | goto unlock_root; | 818 | goto unlock_root; |
819 | } | 819 | } |
820 | 820 | ||
821 | ft->underlay_qpn = ft_attr->underlay_qpn; | ||
822 | |||
823 | tree_init_node(&ft->node, 1, del_flow_table); | 821 | tree_init_node(&ft->node, 1, del_flow_table); |
824 | log_table_sz = ft->max_fte ? ilog2(ft->max_fte) : 0; | 822 | log_table_sz = ft->max_fte ? ilog2(ft->max_fte) : 0; |
825 | next_ft = find_next_chained_ft(fs_prio); | 823 | next_ft = find_next_chained_ft(fs_prio); |
@@ -1489,7 +1487,8 @@ static int update_root_ft_destroy(struct mlx5_flow_table *ft) | |||
1489 | 1487 | ||
1490 | new_root_ft = find_next_ft(ft); | 1488 | new_root_ft = find_next_ft(ft); |
1491 | if (new_root_ft) { | 1489 | if (new_root_ft) { |
1492 | int err = mlx5_cmd_update_root_ft(root->dev, new_root_ft); | 1490 | int err = mlx5_cmd_update_root_ft(root->dev, new_root_ft, |
1491 | root->underlay_qpn); | ||
1493 | 1492 | ||
1494 | if (err) { | 1493 | if (err) { |
1495 | mlx5_core_warn(root->dev, "Update root flow table of id=%u failed\n", | 1494 | mlx5_core_warn(root->dev, "Update root flow table of id=%u failed\n", |
@@ -2062,3 +2061,21 @@ err: | |||
2062 | mlx5_cleanup_fs(dev); | 2061 | mlx5_cleanup_fs(dev); |
2063 | return err; | 2062 | return err; |
2064 | } | 2063 | } |
2064 | |||
2065 | int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn) | ||
2066 | { | ||
2067 | struct mlx5_flow_root_namespace *root = dev->priv.steering->root_ns; | ||
2068 | |||
2069 | root->underlay_qpn = underlay_qpn; | ||
2070 | return 0; | ||
2071 | } | ||
2072 | EXPORT_SYMBOL(mlx5_fs_add_rx_underlay_qpn); | ||
2073 | |||
2074 | int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn) | ||
2075 | { | ||
2076 | struct mlx5_flow_root_namespace *root = dev->priv.steering->root_ns; | ||
2077 | |||
2078 | root->underlay_qpn = 0; | ||
2079 | return 0; | ||
2080 | } | ||
2081 | EXPORT_SYMBOL(mlx5_fs_remove_rx_underlay_qpn); | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h index 81eafc7b9dd9..990acee6fb09 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h | |||
@@ -118,7 +118,6 @@ struct mlx5_flow_table { | |||
118 | /* FWD rules that point on this flow table */ | 118 | /* FWD rules that point on this flow table */ |
119 | struct list_head fwd_rules; | 119 | struct list_head fwd_rules; |
120 | u32 flags; | 120 | u32 flags; |
121 | u32 underlay_qpn; | ||
122 | }; | 121 | }; |
123 | 122 | ||
124 | struct mlx5_fc_cache { | 123 | struct mlx5_fc_cache { |
@@ -195,6 +194,7 @@ struct mlx5_flow_root_namespace { | |||
195 | struct mlx5_flow_table *root_ft; | 194 | struct mlx5_flow_table *root_ft; |
196 | /* Should be held when chaining flow tables */ | 195 | /* Should be held when chaining flow tables */ |
197 | struct mutex chain_lock; | 196 | struct mutex chain_lock; |
197 | u32 underlay_qpn; | ||
198 | }; | 198 | }; |
199 | 199 | ||
200 | int mlx5_init_fc_stats(struct mlx5_core_dev *dev); | 200 | int mlx5_init_fc_stats(struct mlx5_core_dev *dev); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib.c index 019c230da498..cc1858752e70 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib.c | |||
@@ -66,6 +66,10 @@ static void mlx5i_init(struct mlx5_core_dev *mdev, | |||
66 | 66 | ||
67 | mlx5e_build_nic_params(mdev, &priv->channels.params, profile->max_nch(mdev)); | 67 | mlx5e_build_nic_params(mdev, &priv->channels.params, profile->max_nch(mdev)); |
68 | 68 | ||
69 | /* Override RQ params as IPoIB supports only LINKED LIST RQ for now */ | ||
70 | mlx5e_set_rq_type_params(mdev, &priv->channels.params, MLX5_WQ_TYPE_LINKED_LIST); | ||
71 | priv->channels.params.lro_en = false; | ||
72 | |||
69 | mutex_init(&priv->state_lock); | 73 | mutex_init(&priv->state_lock); |
70 | 74 | ||
71 | netdev->hw_features |= NETIF_F_SG; | 75 | netdev->hw_features |= NETIF_F_SG; |
@@ -156,6 +160,8 @@ out: | |||
156 | 160 | ||
157 | static void mlx5i_destroy_underlay_qp(struct mlx5_core_dev *mdev, struct mlx5_core_qp *qp) | 161 | static void mlx5i_destroy_underlay_qp(struct mlx5_core_dev *mdev, struct mlx5_core_qp *qp) |
158 | { | 162 | { |
163 | mlx5_fs_remove_rx_underlay_qpn(mdev, qp->qpn); | ||
164 | |||
159 | mlx5_core_destroy_qp(mdev, qp); | 165 | mlx5_core_destroy_qp(mdev, qp); |
160 | } | 166 | } |
161 | 167 | ||
@@ -170,6 +176,8 @@ static int mlx5i_init_tx(struct mlx5e_priv *priv) | |||
170 | return err; | 176 | return err; |
171 | } | 177 | } |
172 | 178 | ||
179 | mlx5_fs_add_rx_underlay_qpn(priv->mdev, ipriv->qp.qpn); | ||
180 | |||
173 | err = mlx5e_create_tis(priv->mdev, 0 /* tc */, ipriv->qp.qpn, &priv->tisn[0]); | 181 | err = mlx5e_create_tis(priv->mdev, 0 /* tc */, ipriv->qp.qpn, &priv->tisn[0]); |
174 | if (err) { | 182 | if (err) { |
175 | mlx5_core_warn(priv->mdev, "create tis failed, %d\n", err); | 183 | mlx5_core_warn(priv->mdev, "create tis failed, %d\n", err); |
@@ -189,7 +197,6 @@ static void mlx5i_cleanup_tx(struct mlx5e_priv *priv) | |||
189 | 197 | ||
190 | static int mlx5i_create_flow_steering(struct mlx5e_priv *priv) | 198 | static int mlx5i_create_flow_steering(struct mlx5e_priv *priv) |
191 | { | 199 | { |
192 | struct mlx5i_priv *ipriv = priv->ppriv; | ||
193 | int err; | 200 | int err; |
194 | 201 | ||
195 | priv->fs.ns = mlx5_get_flow_namespace(priv->mdev, | 202 | priv->fs.ns = mlx5_get_flow_namespace(priv->mdev, |
@@ -205,7 +212,7 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv) | |||
205 | priv->netdev->hw_features &= ~NETIF_F_NTUPLE; | 212 | priv->netdev->hw_features &= ~NETIF_F_NTUPLE; |
206 | } | 213 | } |
207 | 214 | ||
208 | err = mlx5e_create_ttc_table(priv, ipriv->qp.qpn); | 215 | err = mlx5e_create_ttc_table(priv); |
209 | if (err) { | 216 | if (err) { |
210 | netdev_err(priv->netdev, "Failed to create ttc table, err=%d\n", | 217 | netdev_err(priv->netdev, "Failed to create ttc table, err=%d\n", |
211 | err); | 218 | err); |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c index ea56f6ade6b4..5f0a7bc692a4 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c | |||
@@ -199,10 +199,11 @@ static int mlxsw_sp_erif_entry_get(struct mlxsw_sp *mlxsw_sp, | |||
199 | 199 | ||
200 | entry->counter_valid = false; | 200 | entry->counter_valid = false; |
201 | entry->counter = 0; | 201 | entry->counter = 0; |
202 | entry->index = mlxsw_sp_rif_index(rif); | ||
203 | |||
202 | if (!counters_enabled) | 204 | if (!counters_enabled) |
203 | return 0; | 205 | return 0; |
204 | 206 | ||
205 | entry->index = mlxsw_sp_rif_index(rif); | ||
206 | err = mlxsw_sp_rif_counter_value_get(mlxsw_sp, rif, | 207 | err = mlxsw_sp_rif_counter_value_get(mlxsw_sp, rif, |
207 | MLXSW_SP_RIF_COUNTER_EGRESS, | 208 | MLXSW_SP_RIF_COUNTER_EGRESS, |
208 | &cnt); | 209 | &cnt); |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 33cec1cc1642..9f89c4137d21 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | |||
@@ -206,6 +206,9 @@ void mlxsw_sp_rif_counter_free(struct mlxsw_sp *mlxsw_sp, | |||
206 | { | 206 | { |
207 | unsigned int *p_counter_index; | 207 | unsigned int *p_counter_index; |
208 | 208 | ||
209 | if (!mlxsw_sp_rif_counter_valid_get(rif, dir)) | ||
210 | return; | ||
211 | |||
209 | p_counter_index = mlxsw_sp_rif_p_counter_get(rif, dir); | 212 | p_counter_index = mlxsw_sp_rif_p_counter_get(rif, dir); |
210 | if (WARN_ON(!p_counter_index)) | 213 | if (WARN_ON(!p_counter_index)) |
211 | return; | 214 | return; |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 0d8411f1f954..f4bb0c0b7c1d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | |||
@@ -1497,8 +1497,7 @@ do_fdb_op: | |||
1497 | err = mlxsw_sp_port_fdb_uc_op(mlxsw_sp, local_port, mac, fid, | 1497 | err = mlxsw_sp_port_fdb_uc_op(mlxsw_sp, local_port, mac, fid, |
1498 | adding, true); | 1498 | adding, true); |
1499 | if (err) { | 1499 | if (err) { |
1500 | if (net_ratelimit()) | 1500 | dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Failed to set FDB entry\n"); |
1501 | netdev_err(mlxsw_sp_port->dev, "Failed to set FDB entry\n"); | ||
1502 | return; | 1501 | return; |
1503 | } | 1502 | } |
1504 | 1503 | ||
@@ -1558,8 +1557,7 @@ do_fdb_op: | |||
1558 | err = mlxsw_sp_port_fdb_uc_lag_op(mlxsw_sp, lag_id, mac, fid, lag_vid, | 1557 | err = mlxsw_sp_port_fdb_uc_lag_op(mlxsw_sp, lag_id, mac, fid, lag_vid, |
1559 | adding, true); | 1558 | adding, true); |
1560 | if (err) { | 1559 | if (err) { |
1561 | if (net_ratelimit()) | 1560 | dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Failed to set FDB entry\n"); |
1562 | netdev_err(mlxsw_sp_port->dev, "Failed to set FDB entry\n"); | ||
1563 | return; | 1561 | return; |
1564 | } | 1562 | } |
1565 | 1563 | ||
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c index b8d5270359cd..e30676515529 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c | |||
@@ -247,7 +247,7 @@ nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu) | |||
247 | cmd.req.arg3 = 0; | 247 | cmd.req.arg3 = 0; |
248 | 248 | ||
249 | if (recv_ctx->state == NX_HOST_CTX_STATE_ACTIVE) | 249 | if (recv_ctx->state == NX_HOST_CTX_STATE_ACTIVE) |
250 | netxen_issue_cmd(adapter, &cmd); | 250 | rcode = netxen_issue_cmd(adapter, &cmd); |
251 | 251 | ||
252 | if (rcode != NX_RCODE_SUCCESS) | 252 | if (rcode != NX_RCODE_SUCCESS) |
253 | return -EIO; | 253 | return -EIO; |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_init_fw_funcs.c b/drivers/net/ethernet/qlogic/qed/qed_init_fw_funcs.c index 67200c5498ab..0a8fde629991 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_init_fw_funcs.c +++ b/drivers/net/ethernet/qlogic/qed/qed_init_fw_funcs.c | |||
@@ -983,7 +983,7 @@ void qed_set_rfs_mode_disable(struct qed_hwfn *p_hwfn, | |||
983 | memset(&camline, 0, sizeof(union gft_cam_line_union)); | 983 | memset(&camline, 0, sizeof(union gft_cam_line_union)); |
984 | qed_wr(p_hwfn, p_ptt, PRS_REG_GFT_CAM + CAM_LINE_SIZE * pf_id, | 984 | qed_wr(p_hwfn, p_ptt, PRS_REG_GFT_CAM + CAM_LINE_SIZE * pf_id, |
985 | camline.cam_line_mapped.camline); | 985 | camline.cam_line_mapped.camline); |
986 | memset(&ramline, 0, sizeof(union gft_cam_line_union)); | 986 | memset(&ramline, 0, sizeof(ramline)); |
987 | 987 | ||
988 | for (i = 0; i < RAM_LINE_SIZE / REG_SIZE; i++) { | 988 | for (i = 0; i < RAM_LINE_SIZE / REG_SIZE; i++) { |
989 | u32 hw_addr = PRS_REG_GFT_PROFILE_MASK_RAM; | 989 | u32 hw_addr = PRS_REG_GFT_PROFILE_MASK_RAM; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 49bad00a0f8f..7245b1072518 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
@@ -37,8 +37,8 @@ | |||
37 | 37 | ||
38 | #define _QLCNIC_LINUX_MAJOR 5 | 38 | #define _QLCNIC_LINUX_MAJOR 5 |
39 | #define _QLCNIC_LINUX_MINOR 3 | 39 | #define _QLCNIC_LINUX_MINOR 3 |
40 | #define _QLCNIC_LINUX_SUBVERSION 65 | 40 | #define _QLCNIC_LINUX_SUBVERSION 66 |
41 | #define QLCNIC_LINUX_VERSIONID "5.3.65" | 41 | #define QLCNIC_LINUX_VERSIONID "5.3.66" |
42 | #define QLCNIC_DRV_IDC_VER 0x01 | 42 | #define QLCNIC_DRV_IDC_VER 0x01 |
43 | #define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\ | 43 | #define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\ |
44 | (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION)) | 44 | (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION)) |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index 718bf58a7da6..4fb68797630e 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | |||
@@ -3168,6 +3168,40 @@ int qlcnic_83xx_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr, | |||
3168 | return 0; | 3168 | return 0; |
3169 | } | 3169 | } |
3170 | 3170 | ||
3171 | void qlcnic_83xx_get_port_type(struct qlcnic_adapter *adapter) | ||
3172 | { | ||
3173 | struct qlcnic_hardware_context *ahw = adapter->ahw; | ||
3174 | struct qlcnic_cmd_args cmd; | ||
3175 | u32 config; | ||
3176 | int err; | ||
3177 | |||
3178 | err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_LINK_STATUS); | ||
3179 | if (err) | ||
3180 | return; | ||
3181 | |||
3182 | err = qlcnic_issue_cmd(adapter, &cmd); | ||
3183 | if (err) { | ||
3184 | dev_info(&adapter->pdev->dev, | ||
3185 | "Get Link Status Command failed: 0x%x\n", err); | ||
3186 | goto out; | ||
3187 | } else { | ||
3188 | config = cmd.rsp.arg[3]; | ||
3189 | |||
3190 | switch (QLC_83XX_SFP_MODULE_TYPE(config)) { | ||
3191 | case QLC_83XX_MODULE_FIBRE_1000BASE_SX: | ||
3192 | case QLC_83XX_MODULE_FIBRE_1000BASE_LX: | ||
3193 | case QLC_83XX_MODULE_FIBRE_1000BASE_CX: | ||
3194 | case QLC_83XX_MODULE_TP_1000BASE_T: | ||
3195 | ahw->port_type = QLCNIC_GBE; | ||
3196 | break; | ||
3197 | default: | ||
3198 | ahw->port_type = QLCNIC_XGBE; | ||
3199 | } | ||
3200 | } | ||
3201 | out: | ||
3202 | qlcnic_free_mbx_args(&cmd); | ||
3203 | } | ||
3204 | |||
3171 | int qlcnic_83xx_test_link(struct qlcnic_adapter *adapter) | 3205 | int qlcnic_83xx_test_link(struct qlcnic_adapter *adapter) |
3172 | { | 3206 | { |
3173 | u8 pci_func; | 3207 | u8 pci_func; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h index 3dfe8e27b51c..b75a81246856 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h | |||
@@ -637,6 +637,7 @@ void qlcnic_83xx_get_pauseparam(struct qlcnic_adapter *, | |||
637 | int qlcnic_83xx_set_pauseparam(struct qlcnic_adapter *, | 637 | int qlcnic_83xx_set_pauseparam(struct qlcnic_adapter *, |
638 | struct ethtool_pauseparam *); | 638 | struct ethtool_pauseparam *); |
639 | int qlcnic_83xx_test_link(struct qlcnic_adapter *); | 639 | int qlcnic_83xx_test_link(struct qlcnic_adapter *); |
640 | void qlcnic_83xx_get_port_type(struct qlcnic_adapter *adapter); | ||
640 | int qlcnic_83xx_reg_test(struct qlcnic_adapter *); | 641 | int qlcnic_83xx_reg_test(struct qlcnic_adapter *); |
641 | int qlcnic_83xx_get_regs_len(struct qlcnic_adapter *); | 642 | int qlcnic_83xx_get_regs_len(struct qlcnic_adapter *); |
642 | int qlcnic_83xx_get_registers(struct qlcnic_adapter *, u32 *); | 643 | int qlcnic_83xx_get_registers(struct qlcnic_adapter *, u32 *); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 9a869c15d8bf..7f7deeaf1cf0 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -486,6 +486,9 @@ static int qlcnic_set_link_ksettings(struct net_device *dev, | |||
486 | u32 ret = 0; | 486 | u32 ret = 0; |
487 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 487 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
488 | 488 | ||
489 | if (qlcnic_83xx_check(adapter)) | ||
490 | qlcnic_83xx_get_port_type(adapter); | ||
491 | |||
489 | if (adapter->ahw->port_type != QLCNIC_GBE) | 492 | if (adapter->ahw->port_type != QLCNIC_GBE) |
490 | return -EOPNOTSUPP; | 493 | return -EOPNOTSUPP; |
491 | 494 | ||
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c index 513e6c74e199..24ca7df15d07 100644 --- a/drivers/net/ethernet/qualcomm/qca_spi.c +++ b/drivers/net/ethernet/qualcomm/qca_spi.c | |||
@@ -296,8 +296,9 @@ qcaspi_receive(struct qcaspi *qca) | |||
296 | 296 | ||
297 | /* Allocate rx SKB if we don't have one available. */ | 297 | /* Allocate rx SKB if we don't have one available. */ |
298 | if (!qca->rx_skb) { | 298 | if (!qca->rx_skb) { |
299 | qca->rx_skb = netdev_alloc_skb(net_dev, | 299 | qca->rx_skb = netdev_alloc_skb_ip_align(net_dev, |
300 | net_dev->mtu + VLAN_ETH_HLEN); | 300 | net_dev->mtu + |
301 | VLAN_ETH_HLEN); | ||
301 | if (!qca->rx_skb) { | 302 | if (!qca->rx_skb) { |
302 | netdev_dbg(net_dev, "out of RX resources\n"); | 303 | netdev_dbg(net_dev, "out of RX resources\n"); |
303 | qca->stats.out_of_mem++; | 304 | qca->stats.out_of_mem++; |
@@ -377,7 +378,7 @@ qcaspi_receive(struct qcaspi *qca) | |||
377 | qca->rx_skb, qca->rx_skb->dev); | 378 | qca->rx_skb, qca->rx_skb->dev); |
378 | qca->rx_skb->ip_summed = CHECKSUM_UNNECESSARY; | 379 | qca->rx_skb->ip_summed = CHECKSUM_UNNECESSARY; |
379 | netif_rx_ni(qca->rx_skb); | 380 | netif_rx_ni(qca->rx_skb); |
380 | qca->rx_skb = netdev_alloc_skb(net_dev, | 381 | qca->rx_skb = netdev_alloc_skb_ip_align(net_dev, |
381 | net_dev->mtu + VLAN_ETH_HLEN); | 382 | net_dev->mtu + VLAN_ETH_HLEN); |
382 | if (!qca->rx_skb) { | 383 | if (!qca->rx_skb) { |
383 | netdev_dbg(net_dev, "out of RX resources\n"); | 384 | netdev_dbg(net_dev, "out of RX resources\n"); |
@@ -759,7 +760,8 @@ qcaspi_netdev_init(struct net_device *dev) | |||
759 | if (!qca->rx_buffer) | 760 | if (!qca->rx_buffer) |
760 | return -ENOBUFS; | 761 | return -ENOBUFS; |
761 | 762 | ||
762 | qca->rx_skb = netdev_alloc_skb(dev, qca->net_dev->mtu + VLAN_ETH_HLEN); | 763 | qca->rx_skb = netdev_alloc_skb_ip_align(dev, qca->net_dev->mtu + |
764 | VLAN_ETH_HLEN); | ||
763 | if (!qca->rx_skb) { | 765 | if (!qca->rx_skb) { |
764 | kfree(qca->rx_buffer); | 766 | kfree(qca->rx_buffer); |
765 | netdev_info(qca->net_dev, "Failed to allocate RX sk_buff.\n"); | 767 | netdev_info(qca->net_dev, "Failed to allocate RX sk_buff.\n"); |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index f68c4db656ed..2d686ccf971b 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -3220,7 +3220,8 @@ static int sh_eth_drv_probe(struct platform_device *pdev) | |||
3220 | /* MDIO bus init */ | 3220 | /* MDIO bus init */ |
3221 | ret = sh_mdio_init(mdp, pd); | 3221 | ret = sh_mdio_init(mdp, pd); |
3222 | if (ret) { | 3222 | if (ret) { |
3223 | dev_err(&ndev->dev, "failed to initialise MDIO\n"); | 3223 | if (ret != -EPROBE_DEFER) |
3224 | dev_err(&pdev->dev, "MDIO init failed: %d\n", ret); | ||
3224 | goto out_release; | 3225 | goto out_release; |
3225 | } | 3226 | } |
3226 | 3227 | ||
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h index 7b916aa21bde..4d7fb8af880d 100644 --- a/drivers/net/ethernet/sfc/nic.h +++ b/drivers/net/ethernet/sfc/nic.h | |||
@@ -18,8 +18,12 @@ | |||
18 | #include "mcdi.h" | 18 | #include "mcdi.h" |
19 | 19 | ||
20 | enum { | 20 | enum { |
21 | EFX_REV_SIENA_A0 = 0, | 21 | /* Revisions 0-2 were Falcon A0, A1 and B0 respectively. |
22 | EFX_REV_HUNT_A0 = 1, | 22 | * They are not supported by this driver but these revision numbers |
23 | * form part of the ethtool API for register dumping. | ||
24 | */ | ||
25 | EFX_REV_SIENA_A0 = 3, | ||
26 | EFX_REV_HUNT_A0 = 4, | ||
23 | }; | 27 | }; |
24 | 28 | ||
25 | static inline int efx_nic_rev(struct efx_nic *efx) | 29 | static inline int efx_nic_rev(struct efx_nic *efx) |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index cd8c60132390..a74c481401c4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -3725,7 +3725,7 @@ static void sysfs_display_ring(void *head, int size, int extend_desc, | |||
3725 | ep++; | 3725 | ep++; |
3726 | } else { | 3726 | } else { |
3727 | seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n", | 3727 | seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n", |
3728 | i, (unsigned int)virt_to_phys(ep), | 3728 | i, (unsigned int)virt_to_phys(p), |
3729 | le32_to_cpu(p->des0), le32_to_cpu(p->des1), | 3729 | le32_to_cpu(p->des0), le32_to_cpu(p->des1), |
3730 | le32_to_cpu(p->des2), le32_to_cpu(p->des3)); | 3730 | le32_to_cpu(p->des2), le32_to_cpu(p->des3)); |
3731 | p++; | 3731 | p++; |
diff --git a/drivers/net/ethernet/sun/ldmvsw.c b/drivers/net/ethernet/sun/ldmvsw.c index 5a90fed06260..5b56c24b6ed2 100644 --- a/drivers/net/ethernet/sun/ldmvsw.c +++ b/drivers/net/ethernet/sun/ldmvsw.c | |||
@@ -411,13 +411,14 @@ static int vsw_port_remove(struct vio_dev *vdev) | |||
411 | 411 | ||
412 | if (port) { | 412 | if (port) { |
413 | del_timer_sync(&port->vio.timer); | 413 | del_timer_sync(&port->vio.timer); |
414 | del_timer_sync(&port->clean_timer); | ||
414 | 415 | ||
415 | napi_disable(&port->napi); | 416 | napi_disable(&port->napi); |
417 | unregister_netdev(port->dev); | ||
416 | 418 | ||
417 | list_del_rcu(&port->list); | 419 | list_del_rcu(&port->list); |
418 | 420 | ||
419 | synchronize_rcu(); | 421 | synchronize_rcu(); |
420 | del_timer_sync(&port->clean_timer); | ||
421 | spin_lock_irqsave(&port->vp->lock, flags); | 422 | spin_lock_irqsave(&port->vp->lock, flags); |
422 | sunvnet_port_rm_txq_common(port); | 423 | sunvnet_port_rm_txq_common(port); |
423 | spin_unlock_irqrestore(&port->vp->lock, flags); | 424 | spin_unlock_irqrestore(&port->vp->lock, flags); |
@@ -427,7 +428,6 @@ static int vsw_port_remove(struct vio_dev *vdev) | |||
427 | 428 | ||
428 | dev_set_drvdata(&vdev->dev, NULL); | 429 | dev_set_drvdata(&vdev->dev, NULL); |
429 | 430 | ||
430 | unregister_netdev(port->dev); | ||
431 | free_netdev(port->dev); | 431 | free_netdev(port->dev); |
432 | } | 432 | } |
433 | 433 | ||
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c index 729a7da90b5b..e6222e535019 100644 --- a/drivers/net/ethernet/ti/netcp_core.c +++ b/drivers/net/ethernet/ti/netcp_core.c | |||
@@ -1353,9 +1353,10 @@ int netcp_txpipe_open(struct netcp_tx_pipe *tx_pipe) | |||
1353 | 1353 | ||
1354 | tx_pipe->dma_channel = knav_dma_open_channel(dev, | 1354 | tx_pipe->dma_channel = knav_dma_open_channel(dev, |
1355 | tx_pipe->dma_chan_name, &config); | 1355 | tx_pipe->dma_chan_name, &config); |
1356 | if (IS_ERR_OR_NULL(tx_pipe->dma_channel)) { | 1356 | if (IS_ERR(tx_pipe->dma_channel)) { |
1357 | dev_err(dev, "failed opening tx chan(%s)\n", | 1357 | dev_err(dev, "failed opening tx chan(%s)\n", |
1358 | tx_pipe->dma_chan_name); | 1358 | tx_pipe->dma_chan_name); |
1359 | ret = PTR_ERR(tx_pipe->dma_channel); | ||
1359 | goto err; | 1360 | goto err; |
1360 | } | 1361 | } |
1361 | 1362 | ||
@@ -1673,9 +1674,10 @@ static int netcp_setup_navigator_resources(struct net_device *ndev) | |||
1673 | 1674 | ||
1674 | netcp->rx_channel = knav_dma_open_channel(netcp->netcp_device->device, | 1675 | netcp->rx_channel = knav_dma_open_channel(netcp->netcp_device->device, |
1675 | netcp->dma_chan_name, &config); | 1676 | netcp->dma_chan_name, &config); |
1676 | if (IS_ERR_OR_NULL(netcp->rx_channel)) { | 1677 | if (IS_ERR(netcp->rx_channel)) { |
1677 | dev_err(netcp->ndev_dev, "failed opening rx chan(%s\n", | 1678 | dev_err(netcp->ndev_dev, "failed opening rx chan(%s\n", |
1678 | netcp->dma_chan_name); | 1679 | netcp->dma_chan_name); |
1680 | ret = PTR_ERR(netcp->rx_channel); | ||
1679 | goto fail; | 1681 | goto fail; |
1680 | } | 1682 | } |
1681 | 1683 | ||
diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index 897176fc5043..dd92950a4615 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c | |||
@@ -2651,7 +2651,6 @@ static int gbe_hwtstamp_set(struct gbe_intf *gbe_intf, struct ifreq *ifr) | |||
2651 | case HWTSTAMP_FILTER_NONE: | 2651 | case HWTSTAMP_FILTER_NONE: |
2652 | cpts_rx_enable(cpts, 0); | 2652 | cpts_rx_enable(cpts, 0); |
2653 | break; | 2653 | break; |
2654 | case HWTSTAMP_FILTER_ALL: | ||
2655 | case HWTSTAMP_FILTER_PTP_V1_L4_EVENT: | 2654 | case HWTSTAMP_FILTER_PTP_V1_L4_EVENT: |
2656 | case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: | 2655 | case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: |
2657 | case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: | 2656 | case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: |
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 8716b8c07feb..6f3c805f7211 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -1077,7 +1077,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self) | |||
1077 | * are "42101001.sb" or "42101002.sb" | 1077 | * are "42101001.sb" or "42101002.sb" |
1078 | */ | 1078 | */ |
1079 | sprintf(stir421x_fw_name, "4210%4X.sb", | 1079 | sprintf(stir421x_fw_name, "4210%4X.sb", |
1080 | self->usbdev->descriptor.bcdDevice); | 1080 | le16_to_cpu(self->usbdev->descriptor.bcdDevice)); |
1081 | ret = request_firmware(&fw, stir421x_fw_name, &self->usbdev->dev); | 1081 | ret = request_firmware(&fw, stir421x_fw_name, &self->usbdev->dev); |
1082 | if (ret < 0) | 1082 | if (ret < 0) |
1083 | return ret; | 1083 | return ret; |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index b34eaaae03fd..346ad2ff3998 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -789,10 +789,12 @@ static int macvlan_change_mtu(struct net_device *dev, int new_mtu) | |||
789 | */ | 789 | */ |
790 | static struct lock_class_key macvlan_netdev_addr_lock_key; | 790 | static struct lock_class_key macvlan_netdev_addr_lock_key; |
791 | 791 | ||
792 | #define ALWAYS_ON_FEATURES \ | 792 | #define ALWAYS_ON_OFFLOADS \ |
793 | (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE | NETIF_F_LLTX | \ | 793 | (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE | \ |
794 | NETIF_F_GSO_ROBUST) | 794 | NETIF_F_GSO_ROBUST) |
795 | 795 | ||
796 | #define ALWAYS_ON_FEATURES (ALWAYS_ON_OFFLOADS | NETIF_F_LLTX) | ||
797 | |||
796 | #define MACVLAN_FEATURES \ | 798 | #define MACVLAN_FEATURES \ |
797 | (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ | 799 | (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ |
798 | NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_LRO | \ | 800 | NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_LRO | \ |
@@ -827,6 +829,7 @@ static int macvlan_init(struct net_device *dev) | |||
827 | dev->features |= ALWAYS_ON_FEATURES; | 829 | dev->features |= ALWAYS_ON_FEATURES; |
828 | dev->hw_features |= NETIF_F_LRO; | 830 | dev->hw_features |= NETIF_F_LRO; |
829 | dev->vlan_features = lowerdev->vlan_features & MACVLAN_FEATURES; | 831 | dev->vlan_features = lowerdev->vlan_features & MACVLAN_FEATURES; |
832 | dev->vlan_features |= ALWAYS_ON_OFFLOADS; | ||
830 | dev->gso_max_size = lowerdev->gso_max_size; | 833 | dev->gso_max_size = lowerdev->gso_max_size; |
831 | dev->gso_max_segs = lowerdev->gso_max_segs; | 834 | dev->gso_max_segs = lowerdev->gso_max_segs; |
832 | dev->hard_header_len = lowerdev->hard_header_len; | 835 | dev->hard_header_len = lowerdev->hard_header_len; |
diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c index 963838d4fac1..599ce24c514f 100644 --- a/drivers/net/phy/mdio-mux.c +++ b/drivers/net/phy/mdio-mux.c | |||
@@ -122,10 +122,9 @@ int mdio_mux_init(struct device *dev, | |||
122 | pb = devm_kzalloc(dev, sizeof(*pb), GFP_KERNEL); | 122 | pb = devm_kzalloc(dev, sizeof(*pb), GFP_KERNEL); |
123 | if (pb == NULL) { | 123 | if (pb == NULL) { |
124 | ret_val = -ENOMEM; | 124 | ret_val = -ENOMEM; |
125 | goto err_parent_bus; | 125 | goto err_pb_kz; |
126 | } | 126 | } |
127 | 127 | ||
128 | |||
129 | pb->switch_data = data; | 128 | pb->switch_data = data; |
130 | pb->switch_fn = switch_fn; | 129 | pb->switch_fn = switch_fn; |
131 | pb->current_child = -1; | 130 | pb->current_child = -1; |
@@ -154,6 +153,7 @@ int mdio_mux_init(struct device *dev, | |||
154 | cb->mii_bus = mdiobus_alloc(); | 153 | cb->mii_bus = mdiobus_alloc(); |
155 | if (!cb->mii_bus) { | 154 | if (!cb->mii_bus) { |
156 | ret_val = -ENOMEM; | 155 | ret_val = -ENOMEM; |
156 | devm_kfree(dev, cb); | ||
157 | of_node_put(child_bus_node); | 157 | of_node_put(child_bus_node); |
158 | break; | 158 | break; |
159 | } | 159 | } |
@@ -170,7 +170,6 @@ int mdio_mux_init(struct device *dev, | |||
170 | mdiobus_free(cb->mii_bus); | 170 | mdiobus_free(cb->mii_bus); |
171 | devm_kfree(dev, cb); | 171 | devm_kfree(dev, cb); |
172 | } else { | 172 | } else { |
173 | of_node_get(child_bus_node); | ||
174 | cb->next = pb->children; | 173 | cb->next = pb->children; |
175 | pb->children = cb; | 174 | pb->children = cb; |
176 | } | 175 | } |
@@ -181,9 +180,11 @@ int mdio_mux_init(struct device *dev, | |||
181 | return 0; | 180 | return 0; |
182 | } | 181 | } |
183 | 182 | ||
183 | devm_kfree(dev, pb); | ||
184 | err_pb_kz: | ||
184 | /* balance the reference of_mdio_find_bus() took */ | 185 | /* balance the reference of_mdio_find_bus() took */ |
185 | put_device(&pb->mii_bus->dev); | 186 | if (!mux_bus) |
186 | 187 | put_device(&parent_bus->dev); | |
187 | err_parent_bus: | 188 | err_parent_bus: |
188 | of_node_put(parent_bus_node); | 189 | of_node_put(parent_bus_node); |
189 | return ret_val; | 190 | return ret_val; |
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index a898e5c4ef1b..8e73f5f36e71 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -364,9 +364,6 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) | |||
364 | 364 | ||
365 | mutex_init(&bus->mdio_lock); | 365 | mutex_init(&bus->mdio_lock); |
366 | 366 | ||
367 | if (bus->reset) | ||
368 | bus->reset(bus); | ||
369 | |||
370 | /* de-assert bus level PHY GPIO resets */ | 367 | /* de-assert bus level PHY GPIO resets */ |
371 | if (bus->num_reset_gpios > 0) { | 368 | if (bus->num_reset_gpios > 0) { |
372 | bus->reset_gpiod = devm_kcalloc(&bus->dev, | 369 | bus->reset_gpiod = devm_kcalloc(&bus->dev, |
@@ -396,6 +393,9 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) | |||
396 | } | 393 | } |
397 | } | 394 | } |
398 | 395 | ||
396 | if (bus->reset) | ||
397 | bus->reset(bus); | ||
398 | |||
399 | for (i = 0; i < PHY_MAX_ADDR; i++) { | 399 | for (i = 0; i < PHY_MAX_ADDR; i++) { |
400 | if ((bus->phy_mask & (1 << i)) == 0) { | 400 | if ((bus->phy_mask & (1 << i)) == 0) { |
401 | struct phy_device *phydev; | 401 | struct phy_device *phydev; |
diff --git a/drivers/net/usb/ch9200.c b/drivers/net/usb/ch9200.c index c4f1c363e24b..9df3c1ffff35 100644 --- a/drivers/net/usb/ch9200.c +++ b/drivers/net/usb/ch9200.c | |||
@@ -310,8 +310,8 @@ static int get_mac_address(struct usbnet *dev, unsigned char *data) | |||
310 | int rd_mac_len = 0; | 310 | int rd_mac_len = 0; |
311 | 311 | ||
312 | netdev_dbg(dev->net, "get_mac_address:\n\tusbnet VID:%0x PID:%0x\n", | 312 | netdev_dbg(dev->net, "get_mac_address:\n\tusbnet VID:%0x PID:%0x\n", |
313 | dev->udev->descriptor.idVendor, | 313 | le16_to_cpu(dev->udev->descriptor.idVendor), |
314 | dev->udev->descriptor.idProduct); | 314 | le16_to_cpu(dev->udev->descriptor.idProduct)); |
315 | 315 | ||
316 | memset(mac_addr, 0, sizeof(mac_addr)); | 316 | memset(mac_addr, 0, sizeof(mac_addr)); |
317 | rd_mac_len = control_read(dev, REQUEST_READ, 0, | 317 | rd_mac_len = control_read(dev, REQUEST_READ, 0, |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index d7165767ca9d..8f923a147fa9 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -1196,6 +1196,8 @@ static const struct usb_device_id products[] = { | |||
1196 | {QMI_FIXED_INTF(0x1199, 0x9071, 10)}, /* Sierra Wireless MC74xx */ | 1196 | {QMI_FIXED_INTF(0x1199, 0x9071, 10)}, /* Sierra Wireless MC74xx */ |
1197 | {QMI_FIXED_INTF(0x1199, 0x9079, 8)}, /* Sierra Wireless EM74xx */ | 1197 | {QMI_FIXED_INTF(0x1199, 0x9079, 8)}, /* Sierra Wireless EM74xx */ |
1198 | {QMI_FIXED_INTF(0x1199, 0x9079, 10)}, /* Sierra Wireless EM74xx */ | 1198 | {QMI_FIXED_INTF(0x1199, 0x9079, 10)}, /* Sierra Wireless EM74xx */ |
1199 | {QMI_FIXED_INTF(0x1199, 0x907b, 8)}, /* Sierra Wireless EM74xx */ | ||
1200 | {QMI_FIXED_INTF(0x1199, 0x907b, 10)}, /* Sierra Wireless EM74xx */ | ||
1199 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ | 1201 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ |
1200 | {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */ | 1202 | {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */ |
1201 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ | 1203 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ |
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 25bc764ae7dc..d1c7029ded7c 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -2962,6 +2962,11 @@ vmxnet3_force_close(struct vmxnet3_adapter *adapter) | |||
2962 | /* we need to enable NAPI, otherwise dev_close will deadlock */ | 2962 | /* we need to enable NAPI, otherwise dev_close will deadlock */ |
2963 | for (i = 0; i < adapter->num_rx_queues; i++) | 2963 | for (i = 0; i < adapter->num_rx_queues; i++) |
2964 | napi_enable(&adapter->rx_queue[i].napi); | 2964 | napi_enable(&adapter->rx_queue[i].napi); |
2965 | /* | ||
2966 | * Need to clear the quiesce bit to ensure that vmxnet3_close | ||
2967 | * can quiesce the device properly | ||
2968 | */ | ||
2969 | clear_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state); | ||
2965 | dev_close(adapter->netdev); | 2970 | dev_close(adapter->netdev); |
2966 | } | 2971 | } |
2967 | 2972 | ||
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index ceda5861da78..db882493875c 100644 --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c | |||
@@ -989,6 +989,7 @@ static u32 vrf_fib_table(const struct net_device *dev) | |||
989 | 989 | ||
990 | static int vrf_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb) | 990 | static int vrf_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb) |
991 | { | 991 | { |
992 | kfree_skb(skb); | ||
992 | return 0; | 993 | return 0; |
993 | } | 994 | } |
994 | 995 | ||
@@ -998,7 +999,7 @@ static struct sk_buff *vrf_rcv_nfhook(u8 pf, unsigned int hook, | |||
998 | { | 999 | { |
999 | struct net *net = dev_net(dev); | 1000 | struct net *net = dev_net(dev); |
1000 | 1001 | ||
1001 | if (NF_HOOK(pf, hook, net, NULL, skb, dev, NULL, vrf_rcv_finish) < 0) | 1002 | if (nf_hook(pf, hook, net, NULL, skb, dev, NULL, vrf_rcv_finish) != 1) |
1002 | skb = NULL; /* kfree_skb(skb) handled by nf code */ | 1003 | skb = NULL; /* kfree_skb(skb) handled by nf code */ |
1003 | 1004 | ||
1004 | return skb; | 1005 | return skb; |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 6ffc482550c1..7b61adb6270c 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -1934,8 +1934,7 @@ abort_transaction_no_dev_fatal: | |||
1934 | xennet_disconnect_backend(info); | 1934 | xennet_disconnect_backend(info); |
1935 | xennet_destroy_queues(info); | 1935 | xennet_destroy_queues(info); |
1936 | out: | 1936 | out: |
1937 | unregister_netdev(info->netdev); | 1937 | device_unregister(&dev->dev); |
1938 | xennet_free_netdev(info->netdev); | ||
1939 | return err; | 1938 | return err; |
1940 | } | 1939 | } |
1941 | 1940 | ||
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 70e689bf1cad..dca7165fabcf 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c | |||
@@ -1754,6 +1754,10 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg) | |||
1754 | dev_info(ctrl->ctrl.device, | 1754 | dev_info(ctrl->ctrl.device, |
1755 | "NVME-FC{%d}: resetting controller\n", ctrl->cnum); | 1755 | "NVME-FC{%d}: resetting controller\n", ctrl->cnum); |
1756 | 1756 | ||
1757 | /* stop the queues on error, cleanup is in reset thread */ | ||
1758 | if (ctrl->queue_count > 1) | ||
1759 | nvme_stop_queues(&ctrl->ctrl); | ||
1760 | |||
1757 | if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RECONNECTING)) { | 1761 | if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RECONNECTING)) { |
1758 | dev_err(ctrl->ctrl.device, | 1762 | dev_err(ctrl->ctrl.device, |
1759 | "NVME-FC{%d}: error_recovery: Couldn't change state " | 1763 | "NVME-FC{%d}: error_recovery: Couldn't change state " |
@@ -2720,6 +2724,12 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, | |||
2720 | unsigned long flags; | 2724 | unsigned long flags; |
2721 | int ret, idx; | 2725 | int ret, idx; |
2722 | 2726 | ||
2727 | if (!(rport->remoteport.port_role & | ||
2728 | (FC_PORT_ROLE_NVME_DISCOVERY | FC_PORT_ROLE_NVME_TARGET))) { | ||
2729 | ret = -EBADR; | ||
2730 | goto out_fail; | ||
2731 | } | ||
2732 | |||
2723 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); | 2733 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); |
2724 | if (!ctrl) { | 2734 | if (!ctrl) { |
2725 | ret = -ENOMEM; | 2735 | ret = -ENOMEM; |
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index fed803232edc..4c2ff2bb26bc 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
@@ -1506,6 +1506,11 @@ static inline void nvme_release_cmb(struct nvme_dev *dev) | |||
1506 | if (dev->cmb) { | 1506 | if (dev->cmb) { |
1507 | iounmap(dev->cmb); | 1507 | iounmap(dev->cmb); |
1508 | dev->cmb = NULL; | 1508 | dev->cmb = NULL; |
1509 | if (dev->cmbsz) { | ||
1510 | sysfs_remove_file_from_group(&dev->ctrl.device->kobj, | ||
1511 | &dev_attr_cmb.attr, NULL); | ||
1512 | dev->cmbsz = 0; | ||
1513 | } | ||
1509 | } | 1514 | } |
1510 | } | 1515 | } |
1511 | 1516 | ||
@@ -1779,6 +1784,7 @@ static void nvme_pci_disable(struct nvme_dev *dev) | |||
1779 | { | 1784 | { |
1780 | struct pci_dev *pdev = to_pci_dev(dev->dev); | 1785 | struct pci_dev *pdev = to_pci_dev(dev->dev); |
1781 | 1786 | ||
1787 | nvme_release_cmb(dev); | ||
1782 | pci_free_irq_vectors(pdev); | 1788 | pci_free_irq_vectors(pdev); |
1783 | 1789 | ||
1784 | if (pci_is_enabled(pdev)) { | 1790 | if (pci_is_enabled(pdev)) { |
@@ -2184,7 +2190,6 @@ static void nvme_remove(struct pci_dev *pdev) | |||
2184 | nvme_dev_disable(dev, true); | 2190 | nvme_dev_disable(dev, true); |
2185 | nvme_dev_remove_admin(dev); | 2191 | nvme_dev_remove_admin(dev); |
2186 | nvme_free_queues(dev, 0); | 2192 | nvme_free_queues(dev, 0); |
2187 | nvme_release_cmb(dev); | ||
2188 | nvme_release_prp_pools(dev); | 2193 | nvme_release_prp_pools(dev); |
2189 | nvme_dev_unmap(dev); | 2194 | nvme_dev_unmap(dev); |
2190 | nvme_put_ctrl(&dev->ctrl); | 2195 | nvme_put_ctrl(&dev->ctrl); |
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index cf90713043da..eb9399ac97cf 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c | |||
@@ -529,6 +529,12 @@ fail: | |||
529 | } | 529 | } |
530 | EXPORT_SYMBOL_GPL(nvmet_req_init); | 530 | EXPORT_SYMBOL_GPL(nvmet_req_init); |
531 | 531 | ||
532 | void nvmet_req_uninit(struct nvmet_req *req) | ||
533 | { | ||
534 | percpu_ref_put(&req->sq->ref); | ||
535 | } | ||
536 | EXPORT_SYMBOL_GPL(nvmet_req_uninit); | ||
537 | |||
532 | static inline bool nvmet_cc_en(u32 cc) | 538 | static inline bool nvmet_cc_en(u32 cc) |
533 | { | 539 | { |
534 | return cc & 0x1; | 540 | return cc & 0x1; |
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c index 62eba29c85fb..2006fae61980 100644 --- a/drivers/nvme/target/fc.c +++ b/drivers/nvme/target/fc.c | |||
@@ -517,9 +517,7 @@ nvmet_fc_queue_to_cpu(struct nvmet_fc_tgtport *tgtport, int qid) | |||
517 | { | 517 | { |
518 | int cpu, idx, cnt; | 518 | int cpu, idx, cnt; |
519 | 519 | ||
520 | if (!(tgtport->ops->target_features & | 520 | if (tgtport->ops->max_hw_queues == 1) |
521 | NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED) || | ||
522 | tgtport->ops->max_hw_queues == 1) | ||
523 | return WORK_CPU_UNBOUND; | 521 | return WORK_CPU_UNBOUND; |
524 | 522 | ||
525 | /* Simple cpu selection based on qid modulo active cpu count */ | 523 | /* Simple cpu selection based on qid modulo active cpu count */ |
diff --git a/drivers/nvme/target/fcloop.c b/drivers/nvme/target/fcloop.c index 15551ef79c8c..294a6611fb24 100644 --- a/drivers/nvme/target/fcloop.c +++ b/drivers/nvme/target/fcloop.c | |||
@@ -698,7 +698,6 @@ static struct nvmet_fc_target_template tgttemplate = { | |||
698 | .dma_boundary = FCLOOP_DMABOUND_4G, | 698 | .dma_boundary = FCLOOP_DMABOUND_4G, |
699 | /* optional features */ | 699 | /* optional features */ |
700 | .target_features = NVMET_FCTGTFEAT_CMD_IN_ISR | | 700 | .target_features = NVMET_FCTGTFEAT_CMD_IN_ISR | |
701 | NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED | | ||
702 | NVMET_FCTGTFEAT_OPDONE_IN_ISR, | 701 | NVMET_FCTGTFEAT_OPDONE_IN_ISR, |
703 | /* sizes of additional private data for data structures */ | 702 | /* sizes of additional private data for data structures */ |
704 | .target_priv_sz = sizeof(struct fcloop_tport), | 703 | .target_priv_sz = sizeof(struct fcloop_tport), |
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h index 7cb77ba5993b..cfc5c7fb0ab7 100644 --- a/drivers/nvme/target/nvmet.h +++ b/drivers/nvme/target/nvmet.h | |||
@@ -261,6 +261,7 @@ u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req); | |||
261 | 261 | ||
262 | bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq, | 262 | bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq, |
263 | struct nvmet_sq *sq, struct nvmet_fabrics_ops *ops); | 263 | struct nvmet_sq *sq, struct nvmet_fabrics_ops *ops); |
264 | void nvmet_req_uninit(struct nvmet_req *req); | ||
264 | void nvmet_req_complete(struct nvmet_req *req, u16 status); | 265 | void nvmet_req_complete(struct nvmet_req *req, u16 status); |
265 | 266 | ||
266 | void nvmet_cq_setup(struct nvmet_ctrl *ctrl, struct nvmet_cq *cq, u16 qid, | 267 | void nvmet_cq_setup(struct nvmet_ctrl *ctrl, struct nvmet_cq *cq, u16 qid, |
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c index 99c69018a35f..9e45cde63376 100644 --- a/drivers/nvme/target/rdma.c +++ b/drivers/nvme/target/rdma.c | |||
@@ -567,6 +567,7 @@ static void nvmet_rdma_read_data_done(struct ib_cq *cq, struct ib_wc *wc) | |||
567 | rsp->n_rdma = 0; | 567 | rsp->n_rdma = 0; |
568 | 568 | ||
569 | if (unlikely(wc->status != IB_WC_SUCCESS)) { | 569 | if (unlikely(wc->status != IB_WC_SUCCESS)) { |
570 | nvmet_req_uninit(&rsp->req); | ||
570 | nvmet_rdma_release_rsp(rsp); | 571 | nvmet_rdma_release_rsp(rsp); |
571 | if (wc->status != IB_WC_WR_FLUSH_ERR) { | 572 | if (wc->status != IB_WC_WR_FLUSH_ERR) { |
572 | pr_info("RDMA READ for CQE 0x%p failed with status %s (%d).\n", | 573 | pr_info("RDMA READ for CQE 0x%p failed with status %s (%d).\n", |
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 3080d9dd031d..43bd69dceabf 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -507,6 +507,9 @@ void *__unflatten_device_tree(const void *blob, | |||
507 | 507 | ||
508 | /* Allocate memory for the expanded device tree */ | 508 | /* Allocate memory for the expanded device tree */ |
509 | mem = dt_alloc(size + 4, __alignof__(struct device_node)); | 509 | mem = dt_alloc(size + 4, __alignof__(struct device_node)); |
510 | if (!mem) | ||
511 | return NULL; | ||
512 | |||
510 | memset(mem, 0, size); | 513 | memset(mem, 0, size); |
511 | 514 | ||
512 | *(__be32 *)(mem + size) = cpu_to_be32(0xdeadbeef); | 515 | *(__be32 *)(mem + size) = cpu_to_be32(0xdeadbeef); |
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 4dec07ea510f..d507c3569a88 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c | |||
@@ -197,7 +197,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem) | |||
197 | const struct of_device_id *i; | 197 | const struct of_device_id *i; |
198 | 198 | ||
199 | for (i = __reservedmem_of_table; i < &__rmem_of_table_sentinel; i++) { | 199 | for (i = __reservedmem_of_table; i < &__rmem_of_table_sentinel; i++) { |
200 | int const (*initfn)(struct reserved_mem *rmem) = i->data; | 200 | reservedmem_of_init_fn initfn = i->data; |
201 | const char *compat = i->compatible; | 201 | const char *compat = i->compatible; |
202 | 202 | ||
203 | if (!of_flat_dt_is_compatible(rmem->fdt_node, compat)) | 203 | if (!of_flat_dt_is_compatible(rmem->fdt_node, compat)) |
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index e443b0d0b236..34b9ad6b3143 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c | |||
@@ -35,7 +35,7 @@ static struct bus_type ccwgroup_bus_type; | |||
35 | static void __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev) | 35 | static void __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev) |
36 | { | 36 | { |
37 | int i; | 37 | int i; |
38 | char str[8]; | 38 | char str[16]; |
39 | 39 | ||
40 | for (i = 0; i < gdev->count; i++) { | 40 | for (i = 0; i < gdev->count; i++) { |
41 | sprintf(str, "cdev%d", i); | 41 | sprintf(str, "cdev%d", i); |
@@ -238,7 +238,7 @@ static void ccwgroup_release(struct device *dev) | |||
238 | 238 | ||
239 | static int __ccwgroup_create_symlinks(struct ccwgroup_device *gdev) | 239 | static int __ccwgroup_create_symlinks(struct ccwgroup_device *gdev) |
240 | { | 240 | { |
241 | char str[8]; | 241 | char str[16]; |
242 | int i, rc; | 242 | int i, rc; |
243 | 243 | ||
244 | for (i = 0; i < gdev->count; i++) { | 244 | for (i = 0; i < gdev->count; i++) { |
diff --git a/drivers/s390/cio/qdio_debug.h b/drivers/s390/cio/qdio_debug.h index f33ce8577619..1d595d17bf11 100644 --- a/drivers/s390/cio/qdio_debug.h +++ b/drivers/s390/cio/qdio_debug.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #include "qdio.h" | 11 | #include "qdio.h" |
12 | 12 | ||
13 | /* that gives us 15 characters in the text event views */ | 13 | /* that gives us 15 characters in the text event views */ |
14 | #define QDIO_DBF_LEN 16 | 14 | #define QDIO_DBF_LEN 32 |
15 | 15 | ||
16 | extern debug_info_t *qdio_dbf_setup; | 16 | extern debug_info_t *qdio_dbf_setup; |
17 | extern debug_info_t *qdio_dbf_error; | 17 | extern debug_info_t *qdio_dbf_error; |
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index f6aa21176d89..30bc6105aac3 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
@@ -701,6 +701,7 @@ enum qeth_discipline_id { | |||
701 | }; | 701 | }; |
702 | 702 | ||
703 | struct qeth_discipline { | 703 | struct qeth_discipline { |
704 | const struct device_type *devtype; | ||
704 | void (*start_poll)(struct ccw_device *, int, unsigned long); | 705 | void (*start_poll)(struct ccw_device *, int, unsigned long); |
705 | qdio_handler_t *input_handler; | 706 | qdio_handler_t *input_handler; |
706 | qdio_handler_t *output_handler; | 707 | qdio_handler_t *output_handler; |
@@ -875,6 +876,9 @@ extern struct qeth_discipline qeth_l2_discipline; | |||
875 | extern struct qeth_discipline qeth_l3_discipline; | 876 | extern struct qeth_discipline qeth_l3_discipline; |
876 | extern const struct attribute_group *qeth_generic_attr_groups[]; | 877 | extern const struct attribute_group *qeth_generic_attr_groups[]; |
877 | extern const struct attribute_group *qeth_osn_attr_groups[]; | 878 | extern const struct attribute_group *qeth_osn_attr_groups[]; |
879 | extern const struct attribute_group qeth_device_attr_group; | ||
880 | extern const struct attribute_group qeth_device_blkt_group; | ||
881 | extern const struct device_type qeth_generic_devtype; | ||
878 | extern struct workqueue_struct *qeth_wq; | 882 | extern struct workqueue_struct *qeth_wq; |
879 | 883 | ||
880 | int qeth_card_hw_is_reachable(struct qeth_card *); | 884 | int qeth_card_hw_is_reachable(struct qeth_card *); |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 38114a8d56e0..fc6d85f2b38d 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -5530,10 +5530,12 @@ void qeth_core_free_discipline(struct qeth_card *card) | |||
5530 | card->discipline = NULL; | 5530 | card->discipline = NULL; |
5531 | } | 5531 | } |
5532 | 5532 | ||
5533 | static const struct device_type qeth_generic_devtype = { | 5533 | const struct device_type qeth_generic_devtype = { |
5534 | .name = "qeth_generic", | 5534 | .name = "qeth_generic", |
5535 | .groups = qeth_generic_attr_groups, | 5535 | .groups = qeth_generic_attr_groups, |
5536 | }; | 5536 | }; |
5537 | EXPORT_SYMBOL_GPL(qeth_generic_devtype); | ||
5538 | |||
5537 | static const struct device_type qeth_osn_devtype = { | 5539 | static const struct device_type qeth_osn_devtype = { |
5538 | .name = "qeth_osn", | 5540 | .name = "qeth_osn", |
5539 | .groups = qeth_osn_attr_groups, | 5541 | .groups = qeth_osn_attr_groups, |
@@ -5659,23 +5661,22 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev) | |||
5659 | goto err_card; | 5661 | goto err_card; |
5660 | } | 5662 | } |
5661 | 5663 | ||
5662 | if (card->info.type == QETH_CARD_TYPE_OSN) | ||
5663 | gdev->dev.type = &qeth_osn_devtype; | ||
5664 | else | ||
5665 | gdev->dev.type = &qeth_generic_devtype; | ||
5666 | |||
5667 | switch (card->info.type) { | 5664 | switch (card->info.type) { |
5668 | case QETH_CARD_TYPE_OSN: | 5665 | case QETH_CARD_TYPE_OSN: |
5669 | case QETH_CARD_TYPE_OSM: | 5666 | case QETH_CARD_TYPE_OSM: |
5670 | rc = qeth_core_load_discipline(card, QETH_DISCIPLINE_LAYER2); | 5667 | rc = qeth_core_load_discipline(card, QETH_DISCIPLINE_LAYER2); |
5671 | if (rc) | 5668 | if (rc) |
5672 | goto err_card; | 5669 | goto err_card; |
5670 | |||
5671 | gdev->dev.type = (card->info.type != QETH_CARD_TYPE_OSN) | ||
5672 | ? card->discipline->devtype | ||
5673 | : &qeth_osn_devtype; | ||
5673 | rc = card->discipline->setup(card->gdev); | 5674 | rc = card->discipline->setup(card->gdev); |
5674 | if (rc) | 5675 | if (rc) |
5675 | goto err_disc; | 5676 | goto err_disc; |
5676 | case QETH_CARD_TYPE_OSD: | 5677 | break; |
5677 | case QETH_CARD_TYPE_OSX: | ||
5678 | default: | 5678 | default: |
5679 | gdev->dev.type = &qeth_generic_devtype; | ||
5679 | break; | 5680 | break; |
5680 | } | 5681 | } |
5681 | 5682 | ||
@@ -5731,8 +5732,10 @@ static int qeth_core_set_online(struct ccwgroup_device *gdev) | |||
5731 | if (rc) | 5732 | if (rc) |
5732 | goto err; | 5733 | goto err; |
5733 | rc = card->discipline->setup(card->gdev); | 5734 | rc = card->discipline->setup(card->gdev); |
5734 | if (rc) | 5735 | if (rc) { |
5736 | qeth_core_free_discipline(card); | ||
5735 | goto err; | 5737 | goto err; |
5738 | } | ||
5736 | } | 5739 | } |
5737 | rc = card->discipline->set_online(gdev); | 5740 | rc = card->discipline->set_online(gdev); |
5738 | err: | 5741 | err: |
diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c index 75b29fd2fcf4..db6a285d41e0 100644 --- a/drivers/s390/net/qeth_core_sys.c +++ b/drivers/s390/net/qeth_core_sys.c | |||
@@ -413,12 +413,16 @@ static ssize_t qeth_dev_layer2_store(struct device *dev, | |||
413 | 413 | ||
414 | if (card->options.layer2 == newdis) | 414 | if (card->options.layer2 == newdis) |
415 | goto out; | 415 | goto out; |
416 | else { | 416 | if (card->info.type == QETH_CARD_TYPE_OSM) { |
417 | card->info.mac_bits = 0; | 417 | /* fixed layer, can't switch */ |
418 | if (card->discipline) { | 418 | rc = -EOPNOTSUPP; |
419 | card->discipline->remove(card->gdev); | 419 | goto out; |
420 | qeth_core_free_discipline(card); | 420 | } |
421 | } | 421 | |
422 | card->info.mac_bits = 0; | ||
423 | if (card->discipline) { | ||
424 | card->discipline->remove(card->gdev); | ||
425 | qeth_core_free_discipline(card); | ||
422 | } | 426 | } |
423 | 427 | ||
424 | rc = qeth_core_load_discipline(card, newdis); | 428 | rc = qeth_core_load_discipline(card, newdis); |
@@ -426,6 +430,8 @@ static ssize_t qeth_dev_layer2_store(struct device *dev, | |||
426 | goto out; | 430 | goto out; |
427 | 431 | ||
428 | rc = card->discipline->setup(card->gdev); | 432 | rc = card->discipline->setup(card->gdev); |
433 | if (rc) | ||
434 | qeth_core_free_discipline(card); | ||
429 | out: | 435 | out: |
430 | mutex_unlock(&card->discipline_mutex); | 436 | mutex_unlock(&card->discipline_mutex); |
431 | return rc ? rc : count; | 437 | return rc ? rc : count; |
@@ -703,10 +709,11 @@ static struct attribute *qeth_blkt_device_attrs[] = { | |||
703 | &dev_attr_inter_jumbo.attr, | 709 | &dev_attr_inter_jumbo.attr, |
704 | NULL, | 710 | NULL, |
705 | }; | 711 | }; |
706 | static struct attribute_group qeth_device_blkt_group = { | 712 | const struct attribute_group qeth_device_blkt_group = { |
707 | .name = "blkt", | 713 | .name = "blkt", |
708 | .attrs = qeth_blkt_device_attrs, | 714 | .attrs = qeth_blkt_device_attrs, |
709 | }; | 715 | }; |
716 | EXPORT_SYMBOL_GPL(qeth_device_blkt_group); | ||
710 | 717 | ||
711 | static struct attribute *qeth_device_attrs[] = { | 718 | static struct attribute *qeth_device_attrs[] = { |
712 | &dev_attr_state.attr, | 719 | &dev_attr_state.attr, |
@@ -726,9 +733,10 @@ static struct attribute *qeth_device_attrs[] = { | |||
726 | &dev_attr_switch_attrs.attr, | 733 | &dev_attr_switch_attrs.attr, |
727 | NULL, | 734 | NULL, |
728 | }; | 735 | }; |
729 | static struct attribute_group qeth_device_attr_group = { | 736 | const struct attribute_group qeth_device_attr_group = { |
730 | .attrs = qeth_device_attrs, | 737 | .attrs = qeth_device_attrs, |
731 | }; | 738 | }; |
739 | EXPORT_SYMBOL_GPL(qeth_device_attr_group); | ||
732 | 740 | ||
733 | const struct attribute_group *qeth_generic_attr_groups[] = { | 741 | const struct attribute_group *qeth_generic_attr_groups[] = { |
734 | &qeth_device_attr_group, | 742 | &qeth_device_attr_group, |
diff --git a/drivers/s390/net/qeth_l2.h b/drivers/s390/net/qeth_l2.h index 29d9fb3890ad..0d59f9a45ea9 100644 --- a/drivers/s390/net/qeth_l2.h +++ b/drivers/s390/net/qeth_l2.h | |||
@@ -8,6 +8,8 @@ | |||
8 | 8 | ||
9 | #include "qeth_core.h" | 9 | #include "qeth_core.h" |
10 | 10 | ||
11 | extern const struct attribute_group *qeth_l2_attr_groups[]; | ||
12 | |||
11 | int qeth_l2_create_device_attributes(struct device *); | 13 | int qeth_l2_create_device_attributes(struct device *); |
12 | void qeth_l2_remove_device_attributes(struct device *); | 14 | void qeth_l2_remove_device_attributes(struct device *); |
13 | void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card); | 15 | void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card); |
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 1b07f382d74c..bd2df62a5cdf 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
@@ -880,11 +880,21 @@ static int qeth_l2_stop(struct net_device *dev) | |||
880 | return 0; | 880 | return 0; |
881 | } | 881 | } |
882 | 882 | ||
883 | static const struct device_type qeth_l2_devtype = { | ||
884 | .name = "qeth_layer2", | ||
885 | .groups = qeth_l2_attr_groups, | ||
886 | }; | ||
887 | |||
883 | static int qeth_l2_probe_device(struct ccwgroup_device *gdev) | 888 | static int qeth_l2_probe_device(struct ccwgroup_device *gdev) |
884 | { | 889 | { |
885 | struct qeth_card *card = dev_get_drvdata(&gdev->dev); | 890 | struct qeth_card *card = dev_get_drvdata(&gdev->dev); |
891 | int rc; | ||
886 | 892 | ||
887 | qeth_l2_create_device_attributes(&gdev->dev); | 893 | if (gdev->dev.type == &qeth_generic_devtype) { |
894 | rc = qeth_l2_create_device_attributes(&gdev->dev); | ||
895 | if (rc) | ||
896 | return rc; | ||
897 | } | ||
888 | INIT_LIST_HEAD(&card->vid_list); | 898 | INIT_LIST_HEAD(&card->vid_list); |
889 | hash_init(card->mac_htable); | 899 | hash_init(card->mac_htable); |
890 | card->options.layer2 = 1; | 900 | card->options.layer2 = 1; |
@@ -896,7 +906,8 @@ static void qeth_l2_remove_device(struct ccwgroup_device *cgdev) | |||
896 | { | 906 | { |
897 | struct qeth_card *card = dev_get_drvdata(&cgdev->dev); | 907 | struct qeth_card *card = dev_get_drvdata(&cgdev->dev); |
898 | 908 | ||
899 | qeth_l2_remove_device_attributes(&cgdev->dev); | 909 | if (cgdev->dev.type == &qeth_generic_devtype) |
910 | qeth_l2_remove_device_attributes(&cgdev->dev); | ||
900 | qeth_set_allowed_threads(card, 0, 1); | 911 | qeth_set_allowed_threads(card, 0, 1); |
901 | wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0); | 912 | wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0); |
902 | 913 | ||
@@ -954,7 +965,6 @@ static int qeth_l2_setup_netdev(struct qeth_card *card) | |||
954 | case QETH_CARD_TYPE_OSN: | 965 | case QETH_CARD_TYPE_OSN: |
955 | card->dev = alloc_netdev(0, "osn%d", NET_NAME_UNKNOWN, | 966 | card->dev = alloc_netdev(0, "osn%d", NET_NAME_UNKNOWN, |
956 | ether_setup); | 967 | ether_setup); |
957 | card->dev->flags |= IFF_NOARP; | ||
958 | break; | 968 | break; |
959 | default: | 969 | default: |
960 | card->dev = alloc_etherdev(0); | 970 | card->dev = alloc_etherdev(0); |
@@ -969,9 +979,12 @@ static int qeth_l2_setup_netdev(struct qeth_card *card) | |||
969 | card->dev->min_mtu = 64; | 979 | card->dev->min_mtu = 64; |
970 | card->dev->max_mtu = ETH_MAX_MTU; | 980 | card->dev->max_mtu = ETH_MAX_MTU; |
971 | card->dev->netdev_ops = &qeth_l2_netdev_ops; | 981 | card->dev->netdev_ops = &qeth_l2_netdev_ops; |
972 | card->dev->ethtool_ops = | 982 | if (card->info.type == QETH_CARD_TYPE_OSN) { |
973 | (card->info.type != QETH_CARD_TYPE_OSN) ? | 983 | card->dev->ethtool_ops = &qeth_l2_osn_ops; |
974 | &qeth_l2_ethtool_ops : &qeth_l2_osn_ops; | 984 | card->dev->flags |= IFF_NOARP; |
985 | } else { | ||
986 | card->dev->ethtool_ops = &qeth_l2_ethtool_ops; | ||
987 | } | ||
975 | card->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; | 988 | card->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; |
976 | if (card->info.type == QETH_CARD_TYPE_OSD && !card->info.guestlan) { | 989 | if (card->info.type == QETH_CARD_TYPE_OSD && !card->info.guestlan) { |
977 | card->dev->hw_features = NETIF_F_SG; | 990 | card->dev->hw_features = NETIF_F_SG; |
@@ -1269,6 +1282,7 @@ static int qeth_l2_control_event(struct qeth_card *card, | |||
1269 | } | 1282 | } |
1270 | 1283 | ||
1271 | struct qeth_discipline qeth_l2_discipline = { | 1284 | struct qeth_discipline qeth_l2_discipline = { |
1285 | .devtype = &qeth_l2_devtype, | ||
1272 | .start_poll = qeth_qdio_start_poll, | 1286 | .start_poll = qeth_qdio_start_poll, |
1273 | .input_handler = (qdio_handler_t *) qeth_qdio_input_handler, | 1287 | .input_handler = (qdio_handler_t *) qeth_qdio_input_handler, |
1274 | .output_handler = (qdio_handler_t *) qeth_qdio_output_handler, | 1288 | .output_handler = (qdio_handler_t *) qeth_qdio_output_handler, |
diff --git a/drivers/s390/net/qeth_l2_sys.c b/drivers/s390/net/qeth_l2_sys.c index 687972356d6b..9696baa49e2d 100644 --- a/drivers/s390/net/qeth_l2_sys.c +++ b/drivers/s390/net/qeth_l2_sys.c | |||
@@ -269,3 +269,11 @@ void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card) | |||
269 | } else | 269 | } else |
270 | qeth_bridgeport_an_set(card, 0); | 270 | qeth_bridgeport_an_set(card, 0); |
271 | } | 271 | } |
272 | |||
273 | const struct attribute_group *qeth_l2_attr_groups[] = { | ||
274 | &qeth_device_attr_group, | ||
275 | &qeth_device_blkt_group, | ||
276 | /* l2 specific, see l2_{create,remove}_device_attributes(): */ | ||
277 | &qeth_l2_bridgeport_attr_group, | ||
278 | NULL, | ||
279 | }; | ||
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 6e0354ef4b86..d8df1e635163 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -3039,8 +3039,13 @@ static int qeth_l3_setup_netdev(struct qeth_card *card) | |||
3039 | static int qeth_l3_probe_device(struct ccwgroup_device *gdev) | 3039 | static int qeth_l3_probe_device(struct ccwgroup_device *gdev) |
3040 | { | 3040 | { |
3041 | struct qeth_card *card = dev_get_drvdata(&gdev->dev); | 3041 | struct qeth_card *card = dev_get_drvdata(&gdev->dev); |
3042 | int rc; | ||
3042 | 3043 | ||
3043 | qeth_l3_create_device_attributes(&gdev->dev); | 3044 | rc = qeth_l3_create_device_attributes(&gdev->dev); |
3045 | if (rc) | ||
3046 | return rc; | ||
3047 | hash_init(card->ip_htable); | ||
3048 | hash_init(card->ip_mc_htable); | ||
3044 | card->options.layer2 = 0; | 3049 | card->options.layer2 = 0; |
3045 | card->info.hwtrap = 0; | 3050 | card->info.hwtrap = 0; |
3046 | return 0; | 3051 | return 0; |
@@ -3306,6 +3311,7 @@ static int qeth_l3_control_event(struct qeth_card *card, | |||
3306 | } | 3311 | } |
3307 | 3312 | ||
3308 | struct qeth_discipline qeth_l3_discipline = { | 3313 | struct qeth_discipline qeth_l3_discipline = { |
3314 | .devtype = &qeth_generic_devtype, | ||
3309 | .start_poll = qeth_qdio_start_poll, | 3315 | .start_poll = qeth_qdio_start_poll, |
3310 | .input_handler = (qdio_handler_t *) qeth_qdio_input_handler, | 3316 | .input_handler = (qdio_handler_t *) qeth_qdio_input_handler, |
3311 | .output_handler = (qdio_handler_t *) qeth_qdio_output_handler, | 3317 | .output_handler = (qdio_handler_t *) qeth_qdio_output_handler, |
diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c index 2a76ea78a0bf..b18fe2014cf2 100644 --- a/drivers/s390/virtio/virtio_ccw.c +++ b/drivers/s390/virtio/virtio_ccw.c | |||
@@ -87,7 +87,7 @@ struct vq_info_block { | |||
87 | } __packed; | 87 | } __packed; |
88 | 88 | ||
89 | struct virtio_feature_desc { | 89 | struct virtio_feature_desc { |
90 | __u32 features; | 90 | __le32 features; |
91 | __u8 index; | 91 | __u8 index; |
92 | } __packed; | 92 | } __packed; |
93 | 93 | ||
diff --git a/drivers/scsi/cxlflash/Kconfig b/drivers/scsi/cxlflash/Kconfig index c052104e523e..a011c5dbf214 100644 --- a/drivers/scsi/cxlflash/Kconfig +++ b/drivers/scsi/cxlflash/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | config CXLFLASH | 5 | config CXLFLASH |
6 | tristate "Support for IBM CAPI Flash" | 6 | tristate "Support for IBM CAPI Flash" |
7 | depends on PCI && SCSI && CXL && EEH | 7 | depends on PCI && SCSI && CXL && EEH |
8 | select IRQ_POLL | ||
8 | default m | 9 | default m |
9 | help | 10 | help |
10 | Allows CAPI Accelerated IO to Flash | 11 | Allows CAPI Accelerated IO to Flash |
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index a808e8ef1d08..234352da5c3c 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c | |||
@@ -407,11 +407,12 @@ unlock: | |||
407 | * can_queue. Eventually we will hit the point where we run | 407 | * can_queue. Eventually we will hit the point where we run |
408 | * on all reserved structs. | 408 | * on all reserved structs. |
409 | */ | 409 | */ |
410 | static void fc_fcp_can_queue_ramp_down(struct fc_lport *lport) | 410 | static bool fc_fcp_can_queue_ramp_down(struct fc_lport *lport) |
411 | { | 411 | { |
412 | struct fc_fcp_internal *si = fc_get_scsi_internal(lport); | 412 | struct fc_fcp_internal *si = fc_get_scsi_internal(lport); |
413 | unsigned long flags; | 413 | unsigned long flags; |
414 | int can_queue; | 414 | int can_queue; |
415 | bool changed = false; | ||
415 | 416 | ||
416 | spin_lock_irqsave(lport->host->host_lock, flags); | 417 | spin_lock_irqsave(lport->host->host_lock, flags); |
417 | 418 | ||
@@ -427,9 +428,11 @@ static void fc_fcp_can_queue_ramp_down(struct fc_lport *lport) | |||
427 | if (!can_queue) | 428 | if (!can_queue) |
428 | can_queue = 1; | 429 | can_queue = 1; |
429 | lport->host->can_queue = can_queue; | 430 | lport->host->can_queue = can_queue; |
431 | changed = true; | ||
430 | 432 | ||
431 | unlock: | 433 | unlock: |
432 | spin_unlock_irqrestore(lport->host->host_lock, flags); | 434 | spin_unlock_irqrestore(lport->host->host_lock, flags); |
435 | return changed; | ||
433 | } | 436 | } |
434 | 437 | ||
435 | /* | 438 | /* |
@@ -1896,11 +1899,11 @@ int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd) | |||
1896 | 1899 | ||
1897 | if (!fc_fcp_lport_queue_ready(lport)) { | 1900 | if (!fc_fcp_lport_queue_ready(lport)) { |
1898 | if (lport->qfull) { | 1901 | if (lport->qfull) { |
1899 | fc_fcp_can_queue_ramp_down(lport); | 1902 | if (fc_fcp_can_queue_ramp_down(lport)) |
1900 | shost_printk(KERN_ERR, lport->host, | 1903 | shost_printk(KERN_ERR, lport->host, |
1901 | "libfc: queue full, " | 1904 | "libfc: queue full, " |
1902 | "reducing can_queue to %d.\n", | 1905 | "reducing can_queue to %d.\n", |
1903 | lport->host->can_queue); | 1906 | lport->host->can_queue); |
1904 | } | 1907 | } |
1905 | rc = SCSI_MLQUEUE_HOST_BUSY; | 1908 | rc = SCSI_MLQUEUE_HOST_BUSY; |
1906 | goto out; | 1909 | goto out; |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index 944b32ca4931..1c55408ac718 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -294,6 +294,7 @@ int lpfc_selective_reset(struct lpfc_hba *); | |||
294 | void lpfc_reset_barrier(struct lpfc_hba *); | 294 | void lpfc_reset_barrier(struct lpfc_hba *); |
295 | int lpfc_sli_brdready(struct lpfc_hba *, uint32_t); | 295 | int lpfc_sli_brdready(struct lpfc_hba *, uint32_t); |
296 | int lpfc_sli_brdkill(struct lpfc_hba *); | 296 | int lpfc_sli_brdkill(struct lpfc_hba *); |
297 | int lpfc_sli_chipset_init(struct lpfc_hba *phba); | ||
297 | int lpfc_sli_brdreset(struct lpfc_hba *); | 298 | int lpfc_sli_brdreset(struct lpfc_hba *); |
298 | int lpfc_sli_brdrestart(struct lpfc_hba *); | 299 | int lpfc_sli_brdrestart(struct lpfc_hba *); |
299 | int lpfc_sli_hba_setup(struct lpfc_hba *); | 300 | int lpfc_sli_hba_setup(struct lpfc_hba *); |
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 1487406aea77..c7962dae4dab 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c | |||
@@ -630,7 +630,7 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint8_t fc4_type, | |||
630 | NLP_EVT_DEVICE_RECOVERY); | 630 | NLP_EVT_DEVICE_RECOVERY); |
631 | spin_lock_irq(shost->host_lock); | 631 | spin_lock_irq(shost->host_lock); |
632 | ndlp->nlp_flag &= ~NLP_NVMET_RECOV; | 632 | ndlp->nlp_flag &= ~NLP_NVMET_RECOV; |
633 | spin_lock_irq(shost->host_lock); | 633 | spin_unlock_irq(shost->host_lock); |
634 | } | 634 | } |
635 | } | 635 | } |
636 | 636 | ||
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 90ae354a9c45..4b1eb98c228d 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -3602,6 +3602,13 @@ lpfc_get_wwpn(struct lpfc_hba *phba) | |||
3602 | LPFC_MBOXQ_t *mboxq; | 3602 | LPFC_MBOXQ_t *mboxq; |
3603 | MAILBOX_t *mb; | 3603 | MAILBOX_t *mb; |
3604 | 3604 | ||
3605 | if (phba->sli_rev < LPFC_SLI_REV4) { | ||
3606 | /* Reset the port first */ | ||
3607 | lpfc_sli_brdrestart(phba); | ||
3608 | rc = lpfc_sli_chipset_init(phba); | ||
3609 | if (rc) | ||
3610 | return (uint64_t)-1; | ||
3611 | } | ||
3605 | 3612 | ||
3606 | mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, | 3613 | mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, |
3607 | GFP_KERNEL); | 3614 | GFP_KERNEL); |
@@ -8847,7 +8854,7 @@ lpfc_sli4_queue_unset(struct lpfc_hba *phba) | |||
8847 | lpfc_wq_destroy(phba, phba->sli4_hba.nvmels_wq); | 8854 | lpfc_wq_destroy(phba, phba->sli4_hba.nvmels_wq); |
8848 | 8855 | ||
8849 | /* Unset ELS work queue */ | 8856 | /* Unset ELS work queue */ |
8850 | if (phba->sli4_hba.els_cq) | 8857 | if (phba->sli4_hba.els_wq) |
8851 | lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); | 8858 | lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); |
8852 | 8859 | ||
8853 | /* Unset unsolicited receive queue */ | 8860 | /* Unset unsolicited receive queue */ |
diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c index 94434e621c33..0488580eea12 100644 --- a/drivers/scsi/lpfc/lpfc_nvmet.c +++ b/drivers/scsi/lpfc/lpfc_nvmet.c | |||
@@ -764,7 +764,6 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba) | |||
764 | lpfc_tgttemplate.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1; | 764 | lpfc_tgttemplate.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1; |
765 | lpfc_tgttemplate.max_hw_queues = phba->cfg_nvme_io_channel; | 765 | lpfc_tgttemplate.max_hw_queues = phba->cfg_nvme_io_channel; |
766 | lpfc_tgttemplate.target_features = NVMET_FCTGTFEAT_READDATA_RSP | | 766 | lpfc_tgttemplate.target_features = NVMET_FCTGTFEAT_READDATA_RSP | |
767 | NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED | | ||
768 | NVMET_FCTGTFEAT_CMD_IN_ISR | | 767 | NVMET_FCTGTFEAT_CMD_IN_ISR | |
769 | NVMET_FCTGTFEAT_OPDONE_IN_ISR; | 768 | NVMET_FCTGTFEAT_OPDONE_IN_ISR; |
770 | 769 | ||
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index cf19f4976f5f..2a4fc00dfa9b 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -4204,13 +4204,16 @@ lpfc_sli_brdreset(struct lpfc_hba *phba) | |||
4204 | /* Reset HBA */ | 4204 | /* Reset HBA */ |
4205 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 4205 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
4206 | "0325 Reset HBA Data: x%x x%x\n", | 4206 | "0325 Reset HBA Data: x%x x%x\n", |
4207 | phba->pport->port_state, psli->sli_flag); | 4207 | (phba->pport) ? phba->pport->port_state : 0, |
4208 | psli->sli_flag); | ||
4208 | 4209 | ||
4209 | /* perform board reset */ | 4210 | /* perform board reset */ |
4210 | phba->fc_eventTag = 0; | 4211 | phba->fc_eventTag = 0; |
4211 | phba->link_events = 0; | 4212 | phba->link_events = 0; |
4212 | phba->pport->fc_myDID = 0; | 4213 | if (phba->pport) { |
4213 | phba->pport->fc_prevDID = 0; | 4214 | phba->pport->fc_myDID = 0; |
4215 | phba->pport->fc_prevDID = 0; | ||
4216 | } | ||
4214 | 4217 | ||
4215 | /* Turn off parity checking and serr during the physical reset */ | 4218 | /* Turn off parity checking and serr during the physical reset */ |
4216 | pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value); | 4219 | pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value); |
@@ -4336,7 +4339,8 @@ lpfc_sli_brdrestart_s3(struct lpfc_hba *phba) | |||
4336 | /* Restart HBA */ | 4339 | /* Restart HBA */ |
4337 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 4340 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
4338 | "0337 Restart HBA Data: x%x x%x\n", | 4341 | "0337 Restart HBA Data: x%x x%x\n", |
4339 | phba->pport->port_state, psli->sli_flag); | 4342 | (phba->pport) ? phba->pport->port_state : 0, |
4343 | psli->sli_flag); | ||
4340 | 4344 | ||
4341 | word0 = 0; | 4345 | word0 = 0; |
4342 | mb = (MAILBOX_t *) &word0; | 4346 | mb = (MAILBOX_t *) &word0; |
@@ -4350,7 +4354,7 @@ lpfc_sli_brdrestart_s3(struct lpfc_hba *phba) | |||
4350 | readl(to_slim); /* flush */ | 4354 | readl(to_slim); /* flush */ |
4351 | 4355 | ||
4352 | /* Only skip post after fc_ffinit is completed */ | 4356 | /* Only skip post after fc_ffinit is completed */ |
4353 | if (phba->pport->port_state) | 4357 | if (phba->pport && phba->pport->port_state) |
4354 | word0 = 1; /* This is really setting up word1 */ | 4358 | word0 = 1; /* This is really setting up word1 */ |
4355 | else | 4359 | else |
4356 | word0 = 0; /* This is really setting up word1 */ | 4360 | word0 = 0; /* This is really setting up word1 */ |
@@ -4359,7 +4363,8 @@ lpfc_sli_brdrestart_s3(struct lpfc_hba *phba) | |||
4359 | readl(to_slim); /* flush */ | 4363 | readl(to_slim); /* flush */ |
4360 | 4364 | ||
4361 | lpfc_sli_brdreset(phba); | 4365 | lpfc_sli_brdreset(phba); |
4362 | phba->pport->stopped = 0; | 4366 | if (phba->pport) |
4367 | phba->pport->stopped = 0; | ||
4363 | phba->link_state = LPFC_INIT_START; | 4368 | phba->link_state = LPFC_INIT_START; |
4364 | phba->hba_flag = 0; | 4369 | phba->hba_flag = 0; |
4365 | spin_unlock_irq(&phba->hbalock); | 4370 | spin_unlock_irq(&phba->hbalock); |
@@ -4446,7 +4451,7 @@ lpfc_sli_brdrestart(struct lpfc_hba *phba) | |||
4446 | * iteration, the function will restart the HBA again. The function returns | 4451 | * iteration, the function will restart the HBA again. The function returns |
4447 | * zero if HBA successfully restarted else returns negative error code. | 4452 | * zero if HBA successfully restarted else returns negative error code. |
4448 | **/ | 4453 | **/ |
4449 | static int | 4454 | int |
4450 | lpfc_sli_chipset_init(struct lpfc_hba *phba) | 4455 | lpfc_sli_chipset_init(struct lpfc_hba *phba) |
4451 | { | 4456 | { |
4452 | uint32_t status, i = 0; | 4457 | uint32_t status, i = 0; |
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index a4aadf5f4dc6..1cc814f1505a 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
@@ -3770,9 +3770,6 @@ static long pmcraid_ioctl_passthrough( | |||
3770 | pmcraid_err("couldn't build passthrough ioadls\n"); | 3770 | pmcraid_err("couldn't build passthrough ioadls\n"); |
3771 | goto out_free_cmd; | 3771 | goto out_free_cmd; |
3772 | } | 3772 | } |
3773 | } else if (request_size < 0) { | ||
3774 | rc = -EINVAL; | ||
3775 | goto out_free_cmd; | ||
3776 | } | 3773 | } |
3777 | 3774 | ||
3778 | /* If data is being written into the device, copy the data from user | 3775 | /* If data is being written into the device, copy the data from user |
diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h index 40aeb6bb96a2..07ee88200e91 100644 --- a/drivers/scsi/qedf/qedf.h +++ b/drivers/scsi/qedf/qedf.h | |||
@@ -259,7 +259,7 @@ struct qedf_io_log { | |||
259 | uint16_t task_id; | 259 | uint16_t task_id; |
260 | uint32_t port_id; /* Remote port fabric ID */ | 260 | uint32_t port_id; /* Remote port fabric ID */ |
261 | int lun; | 261 | int lun; |
262 | char op; /* SCSI CDB */ | 262 | unsigned char op; /* SCSI CDB */ |
263 | uint8_t lba[4]; | 263 | uint8_t lba[4]; |
264 | unsigned int bufflen; /* SCSI buffer length */ | 264 | unsigned int bufflen; /* SCSI buffer length */ |
265 | unsigned int sg_count; /* Number of SG elements */ | 265 | unsigned int sg_count; /* Number of SG elements */ |
diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c index c505d41f6dc8..90627033bde6 100644 --- a/drivers/scsi/qedf/qedf_els.c +++ b/drivers/scsi/qedf/qedf_els.c | |||
@@ -109,7 +109,7 @@ retry_els: | |||
109 | did = fcport->rdata->ids.port_id; | 109 | did = fcport->rdata->ids.port_id; |
110 | sid = fcport->sid; | 110 | sid = fcport->sid; |
111 | 111 | ||
112 | __fc_fill_fc_hdr(fc_hdr, FC_RCTL_ELS_REQ, sid, did, | 112 | __fc_fill_fc_hdr(fc_hdr, FC_RCTL_ELS_REQ, did, sid, |
113 | FC_TYPE_ELS, FC_FC_FIRST_SEQ | FC_FC_END_SEQ | | 113 | FC_TYPE_ELS, FC_FC_FIRST_SEQ | FC_FC_END_SEQ | |
114 | FC_FC_SEQ_INIT, 0); | 114 | FC_FC_SEQ_INIT, 0); |
115 | 115 | ||
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index cceddd995a4b..a5c97342fd5d 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c | |||
@@ -2895,7 +2895,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) | |||
2895 | slowpath_params.drv_minor = QEDF_DRIVER_MINOR_VER; | 2895 | slowpath_params.drv_minor = QEDF_DRIVER_MINOR_VER; |
2896 | slowpath_params.drv_rev = QEDF_DRIVER_REV_VER; | 2896 | slowpath_params.drv_rev = QEDF_DRIVER_REV_VER; |
2897 | slowpath_params.drv_eng = QEDF_DRIVER_ENG_VER; | 2897 | slowpath_params.drv_eng = QEDF_DRIVER_ENG_VER; |
2898 | memcpy(slowpath_params.name, "qedf", QED_DRV_VER_STR_SIZE); | 2898 | strncpy(slowpath_params.name, "qedf", QED_DRV_VER_STR_SIZE); |
2899 | rc = qed_ops->common->slowpath_start(qedf->cdev, &slowpath_params); | 2899 | rc = qed_ops->common->slowpath_start(qedf->cdev, &slowpath_params); |
2900 | if (rc) { | 2900 | if (rc) { |
2901 | QEDF_ERR(&(qedf->dbg_ctx), "Cannot start slowpath.\n"); | 2901 | QEDF_ERR(&(qedf->dbg_ctx), "Cannot start slowpath.\n"); |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 7bfbcfa7af40..61cdd99ae41e 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -763,6 +763,8 @@ struct scsi_device *__scsi_device_lookup(struct Scsi_Host *shost, | |||
763 | struct scsi_device *sdev; | 763 | struct scsi_device *sdev; |
764 | 764 | ||
765 | list_for_each_entry(sdev, &shost->__devices, siblings) { | 765 | list_for_each_entry(sdev, &shost->__devices, siblings) { |
766 | if (sdev->sdev_state == SDEV_DEL) | ||
767 | continue; | ||
766 | if (sdev->channel == channel && sdev->id == id && | 768 | if (sdev->channel == channel && sdev->id == id && |
767 | sdev->lun ==lun) | 769 | sdev->lun ==lun) |
768 | return sdev; | 770 | return sdev; |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 814a4bd8405d..e31f1cc90b81 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <scsi/scsi_driver.h> | 30 | #include <scsi/scsi_driver.h> |
31 | #include <scsi/scsi_eh.h> | 31 | #include <scsi/scsi_eh.h> |
32 | #include <scsi/scsi_host.h> | 32 | #include <scsi/scsi_host.h> |
33 | #include <scsi/scsi_transport.h> /* __scsi_init_queue() */ | ||
33 | #include <scsi/scsi_dh.h> | 34 | #include <scsi/scsi_dh.h> |
34 | 35 | ||
35 | #include <trace/events/scsi.h> | 36 | #include <trace/events/scsi.h> |
diff --git a/drivers/soc/bcm/brcmstb/common.c b/drivers/soc/bcm/brcmstb/common.c index b6195fdf0d00..22e98a90468c 100644 --- a/drivers/soc/bcm/brcmstb/common.c +++ b/drivers/soc/bcm/brcmstb/common.c | |||
@@ -49,7 +49,7 @@ static const struct of_device_id sun_top_ctrl_match[] = { | |||
49 | { .compatible = "brcm,bcm7420-sun-top-ctrl", }, | 49 | { .compatible = "brcm,bcm7420-sun-top-ctrl", }, |
50 | { .compatible = "brcm,bcm7425-sun-top-ctrl", }, | 50 | { .compatible = "brcm,bcm7425-sun-top-ctrl", }, |
51 | { .compatible = "brcm,bcm7429-sun-top-ctrl", }, | 51 | { .compatible = "brcm,bcm7429-sun-top-ctrl", }, |
52 | { .compatible = "brcm,bcm7425-sun-top-ctrl", }, | 52 | { .compatible = "brcm,bcm7435-sun-top-ctrl", }, |
53 | { .compatible = "brcm,brcmstb-sun-top-ctrl", }, | 53 | { .compatible = "brcm,brcmstb-sun-top-ctrl", }, |
54 | { } | 54 | { } |
55 | }; | 55 | }; |
diff --git a/drivers/soc/imx/Kconfig b/drivers/soc/imx/Kconfig index 357a5d8f8da0..a5b86a28f343 100644 --- a/drivers/soc/imx/Kconfig +++ b/drivers/soc/imx/Kconfig | |||
@@ -2,8 +2,9 @@ menu "i.MX SoC drivers" | |||
2 | 2 | ||
3 | config IMX7_PM_DOMAINS | 3 | config IMX7_PM_DOMAINS |
4 | bool "i.MX7 PM domains" | 4 | bool "i.MX7 PM domains" |
5 | select PM_GENERIC_DOMAINS | ||
6 | depends on SOC_IMX7D || (COMPILE_TEST && OF) | 5 | depends on SOC_IMX7D || (COMPILE_TEST && OF) |
6 | depends on PM | ||
7 | select PM_GENERIC_DOMAINS | ||
7 | default y if SOC_IMX7D | 8 | default y if SOC_IMX7D |
8 | 9 | ||
9 | endmenu | 10 | endmenu |
diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c index ecebe2eecc3a..026182d3b27c 100644 --- a/drivers/soc/ti/knav_dma.c +++ b/drivers/soc/ti/knav_dma.c | |||
@@ -413,7 +413,7 @@ static int of_channel_match_helper(struct device_node *np, const char *name, | |||
413 | * @name: slave channel name | 413 | * @name: slave channel name |
414 | * @config: dma configuration parameters | 414 | * @config: dma configuration parameters |
415 | * | 415 | * |
416 | * Returns pointer to appropriate DMA channel on success or NULL. | 416 | * Returns pointer to appropriate DMA channel on success or error. |
417 | */ | 417 | */ |
418 | void *knav_dma_open_channel(struct device *dev, const char *name, | 418 | void *knav_dma_open_channel(struct device *dev, const char *name, |
419 | struct knav_dma_cfg *config) | 419 | struct knav_dma_cfg *config) |
diff --git a/drivers/staging/android/ion/devicetree.txt b/drivers/staging/android/ion/devicetree.txt deleted file mode 100644 index 168715271f06..000000000000 --- a/drivers/staging/android/ion/devicetree.txt +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | Ion Memory Manager | ||
2 | |||
3 | Ion is a memory manager that allows for sharing of buffers via dma-buf. | ||
4 | Ion allows for different types of allocation via an abstraction called | ||
5 | a 'heap'. A heap represents a specific type of memory. Each heap has | ||
6 | a different type. There can be multiple instances of the same heap | ||
7 | type. | ||
8 | |||
9 | Specific heap instances are tied to heap IDs. Heap IDs are not to be specified | ||
10 | in the devicetree. | ||
11 | |||
12 | Required properties for Ion | ||
13 | |||
14 | - compatible: "linux,ion" PLUS a compatible property for the device | ||
15 | |||
16 | All child nodes of a linux,ion node are interpreted as heaps | ||
17 | |||
18 | required properties for heaps | ||
19 | |||
20 | - compatible: compatible string for a heap type PLUS a compatible property | ||
21 | for the specific instance of the heap. Current heap types | ||
22 | -- linux,ion-heap-system | ||
23 | -- linux,ion-heap-system-contig | ||
24 | -- linux,ion-heap-carveout | ||
25 | -- linux,ion-heap-chunk | ||
26 | -- linux,ion-heap-dma | ||
27 | -- linux,ion-heap-custom | ||
28 | |||
29 | Optional properties | ||
30 | - memory-region: A phandle to a memory region. Required for DMA heap type | ||
31 | (see reserved-memory.txt for details on the reservation) | ||
32 | |||
33 | Example: | ||
34 | |||
35 | ion { | ||
36 | compatbile = "hisilicon,ion", "linux,ion"; | ||
37 | |||
38 | ion-system-heap { | ||
39 | compatbile = "hisilicon,system-heap", "linux,ion-heap-system" | ||
40 | }; | ||
41 | |||
42 | ion-camera-region { | ||
43 | compatible = "hisilicon,camera-heap", "linux,ion-heap-dma" | ||
44 | memory-region = <&camera_region>; | ||
45 | }; | ||
46 | |||
47 | ion-fb-region { | ||
48 | compatbile = "hisilicon,fb-heap", "linux,ion-heap-dma" | ||
49 | memory-region = <&fb_region>; | ||
50 | }; | ||
51 | } | ||
diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 522bd62c102e..8611adf3bb2e 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c | |||
@@ -376,7 +376,6 @@ int send_request( | |||
376 | rc = ssi_power_mgr_runtime_get(&drvdata->plat_dev->dev); | 376 | rc = ssi_power_mgr_runtime_get(&drvdata->plat_dev->dev); |
377 | if (rc != 0) { | 377 | if (rc != 0) { |
378 | SSI_LOG_ERR("ssi_power_mgr_runtime_get returned %x\n",rc); | 378 | SSI_LOG_ERR("ssi_power_mgr_runtime_get returned %x\n",rc); |
379 | spin_unlock_bh(&req_mgr_h->hw_lock); | ||
380 | return rc; | 379 | return rc; |
381 | } | 380 | } |
382 | #endif | 381 | #endif |
diff --git a/drivers/staging/fsl-dpaa2/Kconfig b/drivers/staging/fsl-dpaa2/Kconfig index 2e325cb747ae..730fd6d4db33 100644 --- a/drivers/staging/fsl-dpaa2/Kconfig +++ b/drivers/staging/fsl-dpaa2/Kconfig | |||
@@ -12,6 +12,7 @@ config FSL_DPAA2 | |||
12 | config FSL_DPAA2_ETH | 12 | config FSL_DPAA2_ETH |
13 | tristate "Freescale DPAA2 Ethernet" | 13 | tristate "Freescale DPAA2 Ethernet" |
14 | depends on FSL_DPAA2 && FSL_MC_DPIO | 14 | depends on FSL_DPAA2 && FSL_MC_DPIO |
15 | depends on NETDEVICES && ETHERNET | ||
15 | ---help--- | 16 | ---help--- |
16 | Ethernet driver for Freescale DPAA2 SoCs, using the | 17 | Ethernet driver for Freescale DPAA2 SoCs, using the |
17 | Freescale MC bus driver | 18 | Freescale MC bus driver |
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 4723a0bd5067..1c6ed5b2a6f9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | |||
@@ -97,8 +97,9 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) | |||
97 | 97 | ||
98 | switch (variable) { | 98 | switch (variable) { |
99 | case HW_VAR_BSSID: | 99 | case HW_VAR_BSSID: |
100 | rtl92e_writel(dev, BSSIDR, ((u32 *)(val))[0]); | 100 | /* BSSIDR 2 byte alignment */ |
101 | rtl92e_writew(dev, BSSIDR+2, ((u16 *)(val+2))[0]); | 101 | rtl92e_writew(dev, BSSIDR, *(u16 *)val); |
102 | rtl92e_writel(dev, BSSIDR + 2, *(u32 *)(val + 2)); | ||
102 | break; | 103 | break; |
103 | 104 | ||
104 | case HW_VAR_MEDIA_STATUS: | 105 | case HW_VAR_MEDIA_STATUS: |
@@ -624,7 +625,7 @@ void rtl92e_get_eeprom_size(struct net_device *dev) | |||
624 | struct r8192_priv *priv = rtllib_priv(dev); | 625 | struct r8192_priv *priv = rtllib_priv(dev); |
625 | 626 | ||
626 | RT_TRACE(COMP_INIT, "===========>%s()\n", __func__); | 627 | RT_TRACE(COMP_INIT, "===========>%s()\n", __func__); |
627 | curCR = rtl92e_readl(dev, EPROM_CMD); | 628 | curCR = rtl92e_readw(dev, EPROM_CMD); |
628 | RT_TRACE(COMP_INIT, "read from Reg Cmd9346CR(%x):%x\n", EPROM_CMD, | 629 | RT_TRACE(COMP_INIT, "read from Reg Cmd9346CR(%x):%x\n", EPROM_CMD, |
629 | curCR); | 630 | curCR); |
630 | priv->epromtype = (curCR & EPROM_CMD_9356SEL) ? EEPROM_93C56 : | 631 | priv->epromtype = (curCR & EPROM_CMD_9356SEL) ? EEPROM_93C56 : |
@@ -961,8 +962,8 @@ static void _rtl92e_net_update(struct net_device *dev) | |||
961 | rtl92e_config_rate(dev, &rate_config); | 962 | rtl92e_config_rate(dev, &rate_config); |
962 | priv->dot11CurrentPreambleMode = PREAMBLE_AUTO; | 963 | priv->dot11CurrentPreambleMode = PREAMBLE_AUTO; |
963 | priv->basic_rate = rate_config &= 0x15f; | 964 | priv->basic_rate = rate_config &= 0x15f; |
964 | rtl92e_writel(dev, BSSIDR, ((u32 *)net->bssid)[0]); | 965 | rtl92e_writew(dev, BSSIDR, *(u16 *)net->bssid); |
965 | rtl92e_writew(dev, BSSIDR+4, ((u16 *)net->bssid)[2]); | 966 | rtl92e_writel(dev, BSSIDR + 2, *(u32 *)(net->bssid + 2)); |
966 | 967 | ||
967 | if (priv->rtllib->iw_mode == IW_MODE_ADHOC) { | 968 | if (priv->rtllib->iw_mode == IW_MODE_ADHOC) { |
968 | rtl92e_writew(dev, ATIMWND, 2); | 969 | rtl92e_writew(dev, ATIMWND, 2); |
@@ -1182,8 +1183,7 @@ void rtl92e_fill_tx_desc(struct net_device *dev, struct tx_desc *pdesc, | |||
1182 | struct cb_desc *cb_desc, struct sk_buff *skb) | 1183 | struct cb_desc *cb_desc, struct sk_buff *skb) |
1183 | { | 1184 | { |
1184 | struct r8192_priv *priv = rtllib_priv(dev); | 1185 | struct r8192_priv *priv = rtllib_priv(dev); |
1185 | dma_addr_t mapping = pci_map_single(priv->pdev, skb->data, skb->len, | 1186 | dma_addr_t mapping; |
1186 | PCI_DMA_TODEVICE); | ||
1187 | struct tx_fwinfo_8190pci *pTxFwInfo; | 1187 | struct tx_fwinfo_8190pci *pTxFwInfo; |
1188 | 1188 | ||
1189 | pTxFwInfo = (struct tx_fwinfo_8190pci *)skb->data; | 1189 | pTxFwInfo = (struct tx_fwinfo_8190pci *)skb->data; |
@@ -1194,8 +1194,6 @@ void rtl92e_fill_tx_desc(struct net_device *dev, struct tx_desc *pdesc, | |||
1194 | pTxFwInfo->Short = _rtl92e_query_is_short(pTxFwInfo->TxHT, | 1194 | pTxFwInfo->Short = _rtl92e_query_is_short(pTxFwInfo->TxHT, |
1195 | pTxFwInfo->TxRate, cb_desc); | 1195 | pTxFwInfo->TxRate, cb_desc); |
1196 | 1196 | ||
1197 | if (pci_dma_mapping_error(priv->pdev, mapping)) | ||
1198 | netdev_err(dev, "%s(): DMA Mapping error\n", __func__); | ||
1199 | if (cb_desc->bAMPDUEnable) { | 1197 | if (cb_desc->bAMPDUEnable) { |
1200 | pTxFwInfo->AllowAggregation = 1; | 1198 | pTxFwInfo->AllowAggregation = 1; |
1201 | pTxFwInfo->RxMF = cb_desc->ampdu_factor; | 1199 | pTxFwInfo->RxMF = cb_desc->ampdu_factor; |
@@ -1230,6 +1228,14 @@ void rtl92e_fill_tx_desc(struct net_device *dev, struct tx_desc *pdesc, | |||
1230 | } | 1228 | } |
1231 | 1229 | ||
1232 | memset((u8 *)pdesc, 0, 12); | 1230 | memset((u8 *)pdesc, 0, 12); |
1231 | |||
1232 | mapping = pci_map_single(priv->pdev, skb->data, skb->len, | ||
1233 | PCI_DMA_TODEVICE); | ||
1234 | if (pci_dma_mapping_error(priv->pdev, mapping)) { | ||
1235 | netdev_err(dev, "%s(): DMA Mapping error\n", __func__); | ||
1236 | return; | ||
1237 | } | ||
1238 | |||
1233 | pdesc->LINIP = 0; | 1239 | pdesc->LINIP = 0; |
1234 | pdesc->CmdInit = 1; | 1240 | pdesc->CmdInit = 1; |
1235 | pdesc->Offset = sizeof(struct tx_fwinfo_8190pci) + 8; | 1241 | pdesc->Offset = sizeof(struct tx_fwinfo_8190pci) + 8; |
diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index 48bbd9e8a52f..dcc4eb691889 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c | |||
@@ -306,11 +306,6 @@ static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *Addr, | |||
306 | pTsCommonInfo->TClasNum = TCLAS_Num; | 306 | pTsCommonInfo->TClasNum = TCLAS_Num; |
307 | } | 307 | } |
308 | 308 | ||
309 | static bool IsACValid(unsigned int tid) | ||
310 | { | ||
311 | return tid < 7; | ||
312 | } | ||
313 | |||
314 | bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, | 309 | bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, |
315 | u8 *Addr, u8 TID, enum tr_select TxRxSelect, bool bAddNewTs) | 310 | u8 *Addr, u8 TID, enum tr_select TxRxSelect, bool bAddNewTs) |
316 | { | 311 | { |
@@ -328,12 +323,6 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, | |||
328 | if (ieee->current_network.qos_data.supported == 0) { | 323 | if (ieee->current_network.qos_data.supported == 0) { |
329 | UP = 0; | 324 | UP = 0; |
330 | } else { | 325 | } else { |
331 | if (!IsACValid(TID)) { | ||
332 | netdev_warn(ieee->dev, "%s(): TID(%d) is not valid\n", | ||
333 | __func__, TID); | ||
334 | return false; | ||
335 | } | ||
336 | |||
337 | switch (TID) { | 326 | switch (TID) { |
338 | case 0: | 327 | case 0: |
339 | case 3: | 328 | case 3: |
@@ -351,6 +340,10 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, | |||
351 | case 7: | 340 | case 7: |
352 | UP = 7; | 341 | UP = 7; |
353 | break; | 342 | break; |
343 | default: | ||
344 | netdev_warn(ieee->dev, "%s(): TID(%d) is not valid\n", | ||
345 | __func__, TID); | ||
346 | return false; | ||
354 | } | 347 | } |
355 | } | 348 | } |
356 | 349 | ||
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index 5e7a61f24f8d..36c3189fc4b7 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | |||
@@ -3531,7 +3531,6 @@ int rtw_wdev_alloc(struct adapter *padapter, struct device *dev) | |||
3531 | pwdev_priv->power_mgmt = true; | 3531 | pwdev_priv->power_mgmt = true; |
3532 | else | 3532 | else |
3533 | pwdev_priv->power_mgmt = false; | 3533 | pwdev_priv->power_mgmt = false; |
3534 | kfree((u8 *)wdev); | ||
3535 | 3534 | ||
3536 | return ret; | 3535 | return ret; |
3537 | 3536 | ||
diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c index 2cee9a952c9b..4a356e509fe4 100644 --- a/drivers/staging/typec/fusb302/fusb302.c +++ b/drivers/staging/typec/fusb302/fusb302.c | |||
@@ -264,22 +264,36 @@ static void fusb302_debugfs_exit(const struct fusb302_chip *chip) { } | |||
264 | 264 | ||
265 | #define FUSB302_RESUME_RETRY 10 | 265 | #define FUSB302_RESUME_RETRY 10 |
266 | #define FUSB302_RESUME_RETRY_SLEEP 50 | 266 | #define FUSB302_RESUME_RETRY_SLEEP 50 |
267 | static int fusb302_i2c_write(struct fusb302_chip *chip, | 267 | |
268 | u8 address, u8 data) | 268 | static bool fusb302_is_suspended(struct fusb302_chip *chip) |
269 | { | 269 | { |
270 | int retry_cnt; | 270 | int retry_cnt; |
271 | int ret = 0; | ||
272 | 271 | ||
273 | atomic_set(&chip->i2c_busy, 1); | ||
274 | for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { | 272 | for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { |
275 | if (atomic_read(&chip->pm_suspend)) { | 273 | if (atomic_read(&chip->pm_suspend)) { |
276 | pr_err("fusb302_i2c: pm suspend, retry %d/%d\n", | 274 | dev_err(chip->dev, "i2c: pm suspend, retry %d/%d\n", |
277 | retry_cnt + 1, FUSB302_RESUME_RETRY); | 275 | retry_cnt + 1, FUSB302_RESUME_RETRY); |
278 | msleep(FUSB302_RESUME_RETRY_SLEEP); | 276 | msleep(FUSB302_RESUME_RETRY_SLEEP); |
279 | } else { | 277 | } else { |
280 | break; | 278 | return false; |
281 | } | 279 | } |
282 | } | 280 | } |
281 | |||
282 | return true; | ||
283 | } | ||
284 | |||
285 | static int fusb302_i2c_write(struct fusb302_chip *chip, | ||
286 | u8 address, u8 data) | ||
287 | { | ||
288 | int ret = 0; | ||
289 | |||
290 | atomic_set(&chip->i2c_busy, 1); | ||
291 | |||
292 | if (fusb302_is_suspended(chip)) { | ||
293 | atomic_set(&chip->i2c_busy, 0); | ||
294 | return -ETIMEDOUT; | ||
295 | } | ||
296 | |||
283 | ret = i2c_smbus_write_byte_data(chip->i2c_client, address, data); | 297 | ret = i2c_smbus_write_byte_data(chip->i2c_client, address, data); |
284 | if (ret < 0) | 298 | if (ret < 0) |
285 | fusb302_log(chip, "cannot write 0x%02x to 0x%02x, ret=%d", | 299 | fusb302_log(chip, "cannot write 0x%02x to 0x%02x, ret=%d", |
@@ -292,21 +306,17 @@ static int fusb302_i2c_write(struct fusb302_chip *chip, | |||
292 | static int fusb302_i2c_block_write(struct fusb302_chip *chip, u8 address, | 306 | static int fusb302_i2c_block_write(struct fusb302_chip *chip, u8 address, |
293 | u8 length, const u8 *data) | 307 | u8 length, const u8 *data) |
294 | { | 308 | { |
295 | int retry_cnt; | ||
296 | int ret = 0; | 309 | int ret = 0; |
297 | 310 | ||
298 | if (length <= 0) | 311 | if (length <= 0) |
299 | return ret; | 312 | return ret; |
300 | atomic_set(&chip->i2c_busy, 1); | 313 | atomic_set(&chip->i2c_busy, 1); |
301 | for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { | 314 | |
302 | if (atomic_read(&chip->pm_suspend)) { | 315 | if (fusb302_is_suspended(chip)) { |
303 | pr_err("fusb302_i2c: pm suspend, retry %d/%d\n", | 316 | atomic_set(&chip->i2c_busy, 0); |
304 | retry_cnt + 1, FUSB302_RESUME_RETRY); | 317 | return -ETIMEDOUT; |
305 | msleep(FUSB302_RESUME_RETRY_SLEEP); | ||
306 | } else { | ||
307 | break; | ||
308 | } | ||
309 | } | 318 | } |
319 | |||
310 | ret = i2c_smbus_write_i2c_block_data(chip->i2c_client, address, | 320 | ret = i2c_smbus_write_i2c_block_data(chip->i2c_client, address, |
311 | length, data); | 321 | length, data); |
312 | if (ret < 0) | 322 | if (ret < 0) |
@@ -320,19 +330,15 @@ static int fusb302_i2c_block_write(struct fusb302_chip *chip, u8 address, | |||
320 | static int fusb302_i2c_read(struct fusb302_chip *chip, | 330 | static int fusb302_i2c_read(struct fusb302_chip *chip, |
321 | u8 address, u8 *data) | 331 | u8 address, u8 *data) |
322 | { | 332 | { |
323 | int retry_cnt; | ||
324 | int ret = 0; | 333 | int ret = 0; |
325 | 334 | ||
326 | atomic_set(&chip->i2c_busy, 1); | 335 | atomic_set(&chip->i2c_busy, 1); |
327 | for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { | 336 | |
328 | if (atomic_read(&chip->pm_suspend)) { | 337 | if (fusb302_is_suspended(chip)) { |
329 | pr_err("fusb302_i2c: pm suspend, retry %d/%d\n", | 338 | atomic_set(&chip->i2c_busy, 0); |
330 | retry_cnt + 1, FUSB302_RESUME_RETRY); | 339 | return -ETIMEDOUT; |
331 | msleep(FUSB302_RESUME_RETRY_SLEEP); | ||
332 | } else { | ||
333 | break; | ||
334 | } | ||
335 | } | 340 | } |
341 | |||
336 | ret = i2c_smbus_read_byte_data(chip->i2c_client, address); | 342 | ret = i2c_smbus_read_byte_data(chip->i2c_client, address); |
337 | *data = (u8)ret; | 343 | *data = (u8)ret; |
338 | if (ret < 0) | 344 | if (ret < 0) |
@@ -345,33 +351,31 @@ static int fusb302_i2c_read(struct fusb302_chip *chip, | |||
345 | static int fusb302_i2c_block_read(struct fusb302_chip *chip, u8 address, | 351 | static int fusb302_i2c_block_read(struct fusb302_chip *chip, u8 address, |
346 | u8 length, u8 *data) | 352 | u8 length, u8 *data) |
347 | { | 353 | { |
348 | int retry_cnt; | ||
349 | int ret = 0; | 354 | int ret = 0; |
350 | 355 | ||
351 | if (length <= 0) | 356 | if (length <= 0) |
352 | return ret; | 357 | return ret; |
353 | atomic_set(&chip->i2c_busy, 1); | 358 | atomic_set(&chip->i2c_busy, 1); |
354 | for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { | 359 | |
355 | if (atomic_read(&chip->pm_suspend)) { | 360 | if (fusb302_is_suspended(chip)) { |
356 | pr_err("fusb302_i2c: pm suspend, retry %d/%d\n", | 361 | atomic_set(&chip->i2c_busy, 0); |
357 | retry_cnt + 1, FUSB302_RESUME_RETRY); | 362 | return -ETIMEDOUT; |
358 | msleep(FUSB302_RESUME_RETRY_SLEEP); | ||
359 | } else { | ||
360 | break; | ||
361 | } | ||
362 | } | 363 | } |
364 | |||
363 | ret = i2c_smbus_read_i2c_block_data(chip->i2c_client, address, | 365 | ret = i2c_smbus_read_i2c_block_data(chip->i2c_client, address, |
364 | length, data); | 366 | length, data); |
365 | if (ret < 0) { | 367 | if (ret < 0) { |
366 | fusb302_log(chip, "cannot block read 0x%02x, len=%d, ret=%d", | 368 | fusb302_log(chip, "cannot block read 0x%02x, len=%d, ret=%d", |
367 | address, length, ret); | 369 | address, length, ret); |
368 | return ret; | 370 | goto done; |
369 | } | 371 | } |
370 | if (ret != length) { | 372 | if (ret != length) { |
371 | fusb302_log(chip, "only read %d/%d bytes from 0x%02x", | 373 | fusb302_log(chip, "only read %d/%d bytes from 0x%02x", |
372 | ret, length, address); | 374 | ret, length, address); |
373 | return -EIO; | 375 | ret = -EIO; |
374 | } | 376 | } |
377 | |||
378 | done: | ||
375 | atomic_set(&chip->i2c_busy, 0); | 379 | atomic_set(&chip->i2c_busy, 0); |
376 | 380 | ||
377 | return ret; | 381 | return ret; |
@@ -489,7 +493,7 @@ static int tcpm_init(struct tcpc_dev *dev) | |||
489 | ret = fusb302_i2c_read(chip, FUSB_REG_STATUS0, &data); | 493 | ret = fusb302_i2c_read(chip, FUSB_REG_STATUS0, &data); |
490 | if (ret < 0) | 494 | if (ret < 0) |
491 | return ret; | 495 | return ret; |
492 | chip->vbus_present = !!(FUSB_REG_STATUS0 & FUSB_REG_STATUS0_VBUSOK); | 496 | chip->vbus_present = !!(data & FUSB_REG_STATUS0_VBUSOK); |
493 | ret = fusb302_i2c_read(chip, FUSB_REG_DEVICE_ID, &data); | 497 | ret = fusb302_i2c_read(chip, FUSB_REG_DEVICE_ID, &data); |
494 | if (ret < 0) | 498 | if (ret < 0) |
495 | return ret; | 499 | return ret; |
@@ -1025,7 +1029,7 @@ static int fusb302_pd_send_message(struct fusb302_chip *chip, | |||
1025 | buf[pos++] = FUSB302_TKN_SYNC1; | 1029 | buf[pos++] = FUSB302_TKN_SYNC1; |
1026 | buf[pos++] = FUSB302_TKN_SYNC2; | 1030 | buf[pos++] = FUSB302_TKN_SYNC2; |
1027 | 1031 | ||
1028 | len = pd_header_cnt(msg->header) * 4; | 1032 | len = pd_header_cnt_le(msg->header) * 4; |
1029 | /* plug 2 for header */ | 1033 | /* plug 2 for header */ |
1030 | len += 2; | 1034 | len += 2; |
1031 | if (len > 0x1F) { | 1035 | if (len > 0x1F) { |
@@ -1481,7 +1485,7 @@ static int fusb302_pd_read_message(struct fusb302_chip *chip, | |||
1481 | (u8 *)&msg->header); | 1485 | (u8 *)&msg->header); |
1482 | if (ret < 0) | 1486 | if (ret < 0) |
1483 | return ret; | 1487 | return ret; |
1484 | len = pd_header_cnt(msg->header) * 4; | 1488 | len = pd_header_cnt_le(msg->header) * 4; |
1485 | /* add 4 to length to include the CRC */ | 1489 | /* add 4 to length to include the CRC */ |
1486 | if (len > PD_MAX_PAYLOAD * 4) { | 1490 | if (len > PD_MAX_PAYLOAD * 4) { |
1487 | fusb302_log(chip, "PD message too long %d", len); | 1491 | fusb302_log(chip, "PD message too long %d", len); |
@@ -1663,14 +1667,12 @@ static int init_gpio(struct fusb302_chip *chip) | |||
1663 | if (ret < 0) { | 1667 | if (ret < 0) { |
1664 | fusb302_log(chip, | 1668 | fusb302_log(chip, |
1665 | "cannot set GPIO Int_N to input, ret=%d", ret); | 1669 | "cannot set GPIO Int_N to input, ret=%d", ret); |
1666 | gpio_free(chip->gpio_int_n); | ||
1667 | return ret; | 1670 | return ret; |
1668 | } | 1671 | } |
1669 | ret = gpio_to_irq(chip->gpio_int_n); | 1672 | ret = gpio_to_irq(chip->gpio_int_n); |
1670 | if (ret < 0) { | 1673 | if (ret < 0) { |
1671 | fusb302_log(chip, | 1674 | fusb302_log(chip, |
1672 | "cannot request IRQ for GPIO Int_N, ret=%d", ret); | 1675 | "cannot request IRQ for GPIO Int_N, ret=%d", ret); |
1673 | gpio_free(chip->gpio_int_n); | ||
1674 | return ret; | 1676 | return ret; |
1675 | } | 1677 | } |
1676 | chip->gpio_int_n_irq = ret; | 1678 | chip->gpio_int_n_irq = ret; |
@@ -1787,11 +1789,13 @@ static const struct of_device_id fusb302_dt_match[] = { | |||
1787 | {.compatible = "fcs,fusb302"}, | 1789 | {.compatible = "fcs,fusb302"}, |
1788 | {}, | 1790 | {}, |
1789 | }; | 1791 | }; |
1792 | MODULE_DEVICE_TABLE(of, fusb302_dt_match); | ||
1790 | 1793 | ||
1791 | static const struct i2c_device_id fusb302_i2c_device_id[] = { | 1794 | static const struct i2c_device_id fusb302_i2c_device_id[] = { |
1792 | {"typec_fusb302", 0}, | 1795 | {"typec_fusb302", 0}, |
1793 | {}, | 1796 | {}, |
1794 | }; | 1797 | }; |
1798 | MODULE_DEVICE_TABLE(i2c, fusb302_i2c_device_id); | ||
1795 | 1799 | ||
1796 | static const struct dev_pm_ops fusb302_pm_ops = { | 1800 | static const struct dev_pm_ops fusb302_pm_ops = { |
1797 | .suspend = fusb302_pm_suspend, | 1801 | .suspend = fusb302_pm_suspend, |
diff --git a/drivers/staging/typec/pd.h b/drivers/staging/typec/pd.h index 8d97bdb95f23..510ef7279900 100644 --- a/drivers/staging/typec/pd.h +++ b/drivers/staging/typec/pd.h | |||
@@ -92,6 +92,16 @@ static inline unsigned int pd_header_type_le(__le16 header) | |||
92 | return pd_header_type(le16_to_cpu(header)); | 92 | return pd_header_type(le16_to_cpu(header)); |
93 | } | 93 | } |
94 | 94 | ||
95 | static inline unsigned int pd_header_msgid(u16 header) | ||
96 | { | ||
97 | return (header >> PD_HEADER_ID_SHIFT) & PD_HEADER_ID_MASK; | ||
98 | } | ||
99 | |||
100 | static inline unsigned int pd_header_msgid_le(__le16 header) | ||
101 | { | ||
102 | return pd_header_msgid(le16_to_cpu(header)); | ||
103 | } | ||
104 | |||
95 | #define PD_MAX_PAYLOAD 7 | 105 | #define PD_MAX_PAYLOAD 7 |
96 | 106 | ||
97 | struct pd_message { | 107 | struct pd_message { |
diff --git a/drivers/staging/typec/pd_vdo.h b/drivers/staging/typec/pd_vdo.h index dba172e0e0d1..d92259f8de0a 100644 --- a/drivers/staging/typec/pd_vdo.h +++ b/drivers/staging/typec/pd_vdo.h | |||
@@ -22,6 +22,9 @@ | |||
22 | * VDM object is minimum of VDM header + 6 additional data objects. | 22 | * VDM object is minimum of VDM header + 6 additional data objects. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #define VDO_MAX_OBJECTS 6 | ||
26 | #define VDO_MAX_SIZE (VDO_MAX_OBJECTS + 1) | ||
27 | |||
25 | /* | 28 | /* |
26 | * VDM header | 29 | * VDM header |
27 | * ---------- | 30 | * ---------- |
@@ -34,7 +37,6 @@ | |||
34 | * <5> :: reserved (SVDM), command type (UVDM) | 37 | * <5> :: reserved (SVDM), command type (UVDM) |
35 | * <4:0> :: command | 38 | * <4:0> :: command |
36 | */ | 39 | */ |
37 | #define VDO_MAX_SIZE 7 | ||
38 | #define VDO(vid, type, custom) \ | 40 | #define VDO(vid, type, custom) \ |
39 | (((vid) << 16) | \ | 41 | (((vid) << 16) | \ |
40 | ((type) << 15) | \ | 42 | ((type) << 15) | \ |
diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c index 5e5be74c7850..df72d8b01e73 100644 --- a/drivers/staging/typec/tcpci.c +++ b/drivers/staging/typec/tcpci.c | |||
@@ -425,7 +425,7 @@ static const struct regmap_config tcpci_regmap_config = { | |||
425 | .max_register = 0x7F, /* 0x80 .. 0xFF are vendor defined */ | 425 | .max_register = 0x7F, /* 0x80 .. 0xFF are vendor defined */ |
426 | }; | 426 | }; |
427 | 427 | ||
428 | const struct tcpc_config tcpci_tcpc_config = { | 428 | static const struct tcpc_config tcpci_tcpc_config = { |
429 | .type = TYPEC_PORT_DFP, | 429 | .type = TYPEC_PORT_DFP, |
430 | .default_role = TYPEC_SINK, | 430 | .default_role = TYPEC_SINK, |
431 | }; | 431 | }; |
diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c index abba655ba00a..20eb4ebcf8c3 100644 --- a/drivers/staging/typec/tcpm.c +++ b/drivers/staging/typec/tcpm.c | |||
@@ -238,6 +238,7 @@ struct tcpm_port { | |||
238 | unsigned int hard_reset_count; | 238 | unsigned int hard_reset_count; |
239 | bool pd_capable; | 239 | bool pd_capable; |
240 | bool explicit_contract; | 240 | bool explicit_contract; |
241 | unsigned int rx_msgid; | ||
241 | 242 | ||
242 | /* Partner capabilities/requests */ | 243 | /* Partner capabilities/requests */ |
243 | u32 sink_request; | 244 | u32 sink_request; |
@@ -251,6 +252,8 @@ struct tcpm_port { | |||
251 | unsigned int nr_src_pdo; | 252 | unsigned int nr_src_pdo; |
252 | u32 snk_pdo[PDO_MAX_OBJECTS]; | 253 | u32 snk_pdo[PDO_MAX_OBJECTS]; |
253 | unsigned int nr_snk_pdo; | 254 | unsigned int nr_snk_pdo; |
255 | u32 snk_vdo[VDO_MAX_OBJECTS]; | ||
256 | unsigned int nr_snk_vdo; | ||
254 | 257 | ||
255 | unsigned int max_snk_mv; | 258 | unsigned int max_snk_mv; |
256 | unsigned int max_snk_ma; | 259 | unsigned int max_snk_ma; |
@@ -997,6 +1000,7 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt, | |||
997 | struct pd_mode_data *modep; | 1000 | struct pd_mode_data *modep; |
998 | int rlen = 0; | 1001 | int rlen = 0; |
999 | u16 svid; | 1002 | u16 svid; |
1003 | int i; | ||
1000 | 1004 | ||
1001 | tcpm_log(port, "Rx VDM cmd 0x%x type %d cmd %d len %d", | 1005 | tcpm_log(port, "Rx VDM cmd 0x%x type %d cmd %d len %d", |
1002 | p0, cmd_type, cmd, cnt); | 1006 | p0, cmd_type, cmd, cnt); |
@@ -1007,6 +1011,14 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt, | |||
1007 | case CMDT_INIT: | 1011 | case CMDT_INIT: |
1008 | switch (cmd) { | 1012 | switch (cmd) { |
1009 | case CMD_DISCOVER_IDENT: | 1013 | case CMD_DISCOVER_IDENT: |
1014 | /* 6.4.4.3.1: Only respond as UFP (device) */ | ||
1015 | if (port->data_role == TYPEC_DEVICE && | ||
1016 | port->nr_snk_vdo) { | ||
1017 | for (i = 0; i < port->nr_snk_vdo; i++) | ||
1018 | response[i + 1] | ||
1019 | = cpu_to_le32(port->snk_vdo[i]); | ||
1020 | rlen = port->nr_snk_vdo + 1; | ||
1021 | } | ||
1010 | break; | 1022 | break; |
1011 | case CMD_DISCOVER_SVID: | 1023 | case CMD_DISCOVER_SVID: |
1012 | break; | 1024 | break; |
@@ -1415,6 +1427,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port, | |||
1415 | break; | 1427 | break; |
1416 | case SOFT_RESET_SEND: | 1428 | case SOFT_RESET_SEND: |
1417 | port->message_id = 0; | 1429 | port->message_id = 0; |
1430 | port->rx_msgid = -1; | ||
1418 | if (port->pwr_role == TYPEC_SOURCE) | 1431 | if (port->pwr_role == TYPEC_SOURCE) |
1419 | next_state = SRC_SEND_CAPABILITIES; | 1432 | next_state = SRC_SEND_CAPABILITIES; |
1420 | else | 1433 | else |
@@ -1503,6 +1516,22 @@ static void tcpm_pd_rx_handler(struct work_struct *work) | |||
1503 | port->attached); | 1516 | port->attached); |
1504 | 1517 | ||
1505 | if (port->attached) { | 1518 | if (port->attached) { |
1519 | enum pd_ctrl_msg_type type = pd_header_type_le(msg->header); | ||
1520 | unsigned int msgid = pd_header_msgid_le(msg->header); | ||
1521 | |||
1522 | /* | ||
1523 | * USB PD standard, 6.6.1.2: | ||
1524 | * "... if MessageID value in a received Message is the | ||
1525 | * same as the stored value, the receiver shall return a | ||
1526 | * GoodCRC Message with that MessageID value and drop | ||
1527 | * the Message (this is a retry of an already received | ||
1528 | * Message). Note: this shall not apply to the Soft_Reset | ||
1529 | * Message which always has a MessageID value of zero." | ||
1530 | */ | ||
1531 | if (msgid == port->rx_msgid && type != PD_CTRL_SOFT_RESET) | ||
1532 | goto done; | ||
1533 | port->rx_msgid = msgid; | ||
1534 | |||
1506 | /* | 1535 | /* |
1507 | * If both ends believe to be DFP/host, we have a data role | 1536 | * If both ends believe to be DFP/host, we have a data role |
1508 | * mismatch. | 1537 | * mismatch. |
@@ -1520,6 +1549,7 @@ static void tcpm_pd_rx_handler(struct work_struct *work) | |||
1520 | } | 1549 | } |
1521 | } | 1550 | } |
1522 | 1551 | ||
1552 | done: | ||
1523 | mutex_unlock(&port->lock); | 1553 | mutex_unlock(&port->lock); |
1524 | kfree(event); | 1554 | kfree(event); |
1525 | } | 1555 | } |
@@ -1719,8 +1749,7 @@ static int tcpm_pd_build_request(struct tcpm_port *port, u32 *rdo) | |||
1719 | } | 1749 | } |
1720 | ma = min(ma, port->max_snk_ma); | 1750 | ma = min(ma, port->max_snk_ma); |
1721 | 1751 | ||
1722 | /* XXX: Any other flags need to be set? */ | 1752 | flags = RDO_USB_COMM | RDO_NO_SUSPEND; |
1723 | flags = 0; | ||
1724 | 1753 | ||
1725 | /* Set mismatch bit if offered power is less than operating power */ | 1754 | /* Set mismatch bit if offered power is less than operating power */ |
1726 | mw = ma * mv / 1000; | 1755 | mw = ma * mv / 1000; |
@@ -1957,6 +1986,12 @@ static void tcpm_reset_port(struct tcpm_port *port) | |||
1957 | port->attached = false; | 1986 | port->attached = false; |
1958 | port->pd_capable = false; | 1987 | port->pd_capable = false; |
1959 | 1988 | ||
1989 | /* | ||
1990 | * First Rx ID should be 0; set this to a sentinel of -1 so that | ||
1991 | * we can check tcpm_pd_rx_handler() if we had seen it before. | ||
1992 | */ | ||
1993 | port->rx_msgid = -1; | ||
1994 | |||
1960 | port->tcpc->set_pd_rx(port->tcpc, false); | 1995 | port->tcpc->set_pd_rx(port->tcpc, false); |
1961 | tcpm_init_vbus(port); /* also disables charging */ | 1996 | tcpm_init_vbus(port); /* also disables charging */ |
1962 | tcpm_init_vconn(port); | 1997 | tcpm_init_vconn(port); |
@@ -2170,6 +2205,7 @@ static void run_state_machine(struct tcpm_port *port) | |||
2170 | port->pwr_opmode = TYPEC_PWR_MODE_USB; | 2205 | port->pwr_opmode = TYPEC_PWR_MODE_USB; |
2171 | port->caps_count = 0; | 2206 | port->caps_count = 0; |
2172 | port->message_id = 0; | 2207 | port->message_id = 0; |
2208 | port->rx_msgid = -1; | ||
2173 | port->explicit_contract = false; | 2209 | port->explicit_contract = false; |
2174 | tcpm_set_state(port, SRC_SEND_CAPABILITIES, 0); | 2210 | tcpm_set_state(port, SRC_SEND_CAPABILITIES, 0); |
2175 | break; | 2211 | break; |
@@ -2329,6 +2365,7 @@ static void run_state_machine(struct tcpm_port *port) | |||
2329 | typec_set_pwr_opmode(port->typec_port, TYPEC_PWR_MODE_USB); | 2365 | typec_set_pwr_opmode(port->typec_port, TYPEC_PWR_MODE_USB); |
2330 | port->pwr_opmode = TYPEC_PWR_MODE_USB; | 2366 | port->pwr_opmode = TYPEC_PWR_MODE_USB; |
2331 | port->message_id = 0; | 2367 | port->message_id = 0; |
2368 | port->rx_msgid = -1; | ||
2332 | port->explicit_contract = false; | 2369 | port->explicit_contract = false; |
2333 | tcpm_set_state(port, SNK_DISCOVERY, 0); | 2370 | tcpm_set_state(port, SNK_DISCOVERY, 0); |
2334 | break; | 2371 | break; |
@@ -2496,6 +2533,7 @@ static void run_state_machine(struct tcpm_port *port) | |||
2496 | /* Soft_Reset states */ | 2533 | /* Soft_Reset states */ |
2497 | case SOFT_RESET: | 2534 | case SOFT_RESET: |
2498 | port->message_id = 0; | 2535 | port->message_id = 0; |
2536 | port->rx_msgid = -1; | ||
2499 | tcpm_pd_send_control(port, PD_CTRL_ACCEPT); | 2537 | tcpm_pd_send_control(port, PD_CTRL_ACCEPT); |
2500 | if (port->pwr_role == TYPEC_SOURCE) | 2538 | if (port->pwr_role == TYPEC_SOURCE) |
2501 | tcpm_set_state(port, SRC_SEND_CAPABILITIES, 0); | 2539 | tcpm_set_state(port, SRC_SEND_CAPABILITIES, 0); |
@@ -2504,6 +2542,7 @@ static void run_state_machine(struct tcpm_port *port) | |||
2504 | break; | 2542 | break; |
2505 | case SOFT_RESET_SEND: | 2543 | case SOFT_RESET_SEND: |
2506 | port->message_id = 0; | 2544 | port->message_id = 0; |
2545 | port->rx_msgid = -1; | ||
2507 | if (tcpm_pd_send_control(port, PD_CTRL_SOFT_RESET)) | 2546 | if (tcpm_pd_send_control(port, PD_CTRL_SOFT_RESET)) |
2508 | tcpm_set_state_cond(port, hard_reset_state(port), 0); | 2547 | tcpm_set_state_cond(port, hard_reset_state(port), 0); |
2509 | else | 2548 | else |
@@ -2568,6 +2607,14 @@ static void run_state_machine(struct tcpm_port *port) | |||
2568 | break; | 2607 | break; |
2569 | case PR_SWAP_SRC_SNK_SOURCE_OFF: | 2608 | case PR_SWAP_SRC_SNK_SOURCE_OFF: |
2570 | tcpm_set_cc(port, TYPEC_CC_RD); | 2609 | tcpm_set_cc(port, TYPEC_CC_RD); |
2610 | /* | ||
2611 | * USB-PD standard, 6.2.1.4, Port Power Role: | ||
2612 | * "During the Power Role Swap Sequence, for the initial Source | ||
2613 | * Port, the Port Power Role field shall be set to Sink in the | ||
2614 | * PS_RDY Message indicating that the initial Source’s power | ||
2615 | * supply is turned off" | ||
2616 | */ | ||
2617 | tcpm_set_pwr_role(port, TYPEC_SINK); | ||
2571 | if (tcpm_pd_send_control(port, PD_CTRL_PS_RDY)) { | 2618 | if (tcpm_pd_send_control(port, PD_CTRL_PS_RDY)) { |
2572 | tcpm_set_state(port, ERROR_RECOVERY, 0); | 2619 | tcpm_set_state(port, ERROR_RECOVERY, 0); |
2573 | break; | 2620 | break; |
@@ -2575,7 +2622,6 @@ static void run_state_machine(struct tcpm_port *port) | |||
2575 | tcpm_set_state_cond(port, SNK_UNATTACHED, PD_T_PS_SOURCE_ON); | 2622 | tcpm_set_state_cond(port, SNK_UNATTACHED, PD_T_PS_SOURCE_ON); |
2576 | break; | 2623 | break; |
2577 | case PR_SWAP_SRC_SNK_SINK_ON: | 2624 | case PR_SWAP_SRC_SNK_SINK_ON: |
2578 | tcpm_set_pwr_role(port, TYPEC_SINK); | ||
2579 | tcpm_swap_complete(port, 0); | 2625 | tcpm_swap_complete(port, 0); |
2580 | tcpm_set_state(port, SNK_STARTUP, 0); | 2626 | tcpm_set_state(port, SNK_STARTUP, 0); |
2581 | break; | 2627 | break; |
@@ -2587,8 +2633,15 @@ static void run_state_machine(struct tcpm_port *port) | |||
2587 | case PR_SWAP_SNK_SRC_SOURCE_ON: | 2633 | case PR_SWAP_SNK_SRC_SOURCE_ON: |
2588 | tcpm_set_cc(port, tcpm_rp_cc(port)); | 2634 | tcpm_set_cc(port, tcpm_rp_cc(port)); |
2589 | tcpm_set_vbus(port, true); | 2635 | tcpm_set_vbus(port, true); |
2590 | tcpm_pd_send_control(port, PD_CTRL_PS_RDY); | 2636 | /* |
2637 | * USB PD standard, 6.2.1.4: | ||
2638 | * "Subsequent Messages initiated by the Policy Engine, | ||
2639 | * such as the PS_RDY Message sent to indicate that Vbus | ||
2640 | * is ready, will have the Port Power Role field set to | ||
2641 | * Source." | ||
2642 | */ | ||
2591 | tcpm_set_pwr_role(port, TYPEC_SOURCE); | 2643 | tcpm_set_pwr_role(port, TYPEC_SOURCE); |
2644 | tcpm_pd_send_control(port, PD_CTRL_PS_RDY); | ||
2592 | tcpm_swap_complete(port, 0); | 2645 | tcpm_swap_complete(port, 0); |
2593 | tcpm_set_state(port, SRC_STARTUP, 0); | 2646 | tcpm_set_state(port, SRC_STARTUP, 0); |
2594 | break; | 2647 | break; |
@@ -3292,6 +3345,20 @@ static int tcpm_copy_pdos(u32 *dest_pdo, const u32 *src_pdo, | |||
3292 | return nr_pdo; | 3345 | return nr_pdo; |
3293 | } | 3346 | } |
3294 | 3347 | ||
3348 | static int tcpm_copy_vdos(u32 *dest_vdo, const u32 *src_vdo, | ||
3349 | unsigned int nr_vdo) | ||
3350 | { | ||
3351 | unsigned int i; | ||
3352 | |||
3353 | if (nr_vdo > VDO_MAX_OBJECTS) | ||
3354 | nr_vdo = VDO_MAX_OBJECTS; | ||
3355 | |||
3356 | for (i = 0; i < nr_vdo; i++) | ||
3357 | dest_vdo[i] = src_vdo[i]; | ||
3358 | |||
3359 | return nr_vdo; | ||
3360 | } | ||
3361 | |||
3295 | void tcpm_update_source_capabilities(struct tcpm_port *port, const u32 *pdo, | 3362 | void tcpm_update_source_capabilities(struct tcpm_port *port, const u32 *pdo, |
3296 | unsigned int nr_pdo) | 3363 | unsigned int nr_pdo) |
3297 | { | 3364 | { |
@@ -3382,6 +3449,8 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc) | |||
3382 | tcpc->config->nr_src_pdo); | 3449 | tcpc->config->nr_src_pdo); |
3383 | port->nr_snk_pdo = tcpm_copy_pdos(port->snk_pdo, tcpc->config->snk_pdo, | 3450 | port->nr_snk_pdo = tcpm_copy_pdos(port->snk_pdo, tcpc->config->snk_pdo, |
3384 | tcpc->config->nr_snk_pdo); | 3451 | tcpc->config->nr_snk_pdo); |
3452 | port->nr_snk_vdo = tcpm_copy_vdos(port->snk_vdo, tcpc->config->snk_vdo, | ||
3453 | tcpc->config->nr_snk_vdo); | ||
3385 | 3454 | ||
3386 | port->max_snk_mv = tcpc->config->max_snk_mv; | 3455 | port->max_snk_mv = tcpc->config->max_snk_mv; |
3387 | port->max_snk_ma = tcpc->config->max_snk_ma; | 3456 | port->max_snk_ma = tcpc->config->max_snk_ma; |
diff --git a/drivers/staging/typec/tcpm.h b/drivers/staging/typec/tcpm.h index 969b365e6549..19c307d31a5a 100644 --- a/drivers/staging/typec/tcpm.h +++ b/drivers/staging/typec/tcpm.h | |||
@@ -60,6 +60,9 @@ struct tcpc_config { | |||
60 | const u32 *snk_pdo; | 60 | const u32 *snk_pdo; |
61 | unsigned int nr_snk_pdo; | 61 | unsigned int nr_snk_pdo; |
62 | 62 | ||
63 | const u32 *snk_vdo; | ||
64 | unsigned int nr_snk_vdo; | ||
65 | |||
63 | unsigned int max_snk_mv; | 66 | unsigned int max_snk_mv; |
64 | unsigned int max_snk_ma; | 67 | unsigned int max_snk_ma; |
65 | unsigned int max_snk_mw; | 68 | unsigned int max_snk_mw; |
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c index 988ee61fb4a7..d04db3f55519 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | |||
@@ -502,8 +502,15 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, | |||
502 | */ | 502 | */ |
503 | sg_init_table(scatterlist, num_pages); | 503 | sg_init_table(scatterlist, num_pages); |
504 | /* Now set the pages for each scatterlist */ | 504 | /* Now set the pages for each scatterlist */ |
505 | for (i = 0; i < num_pages; i++) | 505 | for (i = 0; i < num_pages; i++) { |
506 | sg_set_page(scatterlist + i, pages[i], PAGE_SIZE, 0); | 506 | unsigned int len = PAGE_SIZE - offset; |
507 | |||
508 | if (len > count) | ||
509 | len = count; | ||
510 | sg_set_page(scatterlist + i, pages[i], len, offset); | ||
511 | offset = 0; | ||
512 | count -= len; | ||
513 | } | ||
507 | 514 | ||
508 | dma_buffers = dma_map_sg(g_dev, | 515 | dma_buffers = dma_map_sg(g_dev, |
509 | scatterlist, | 516 | scatterlist, |
@@ -524,20 +531,20 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, | |||
524 | u32 addr = sg_dma_address(sg); | 531 | u32 addr = sg_dma_address(sg); |
525 | 532 | ||
526 | /* Note: addrs is the address + page_count - 1 | 533 | /* Note: addrs is the address + page_count - 1 |
527 | * The firmware expects the block to be page | 534 | * The firmware expects blocks after the first to be page- |
528 | * aligned and a multiple of the page size | 535 | * aligned and a multiple of the page size |
529 | */ | 536 | */ |
530 | WARN_ON(len == 0); | 537 | WARN_ON(len == 0); |
531 | WARN_ON(len & ~PAGE_MASK); | 538 | WARN_ON(i && (i != (dma_buffers - 1)) && (len & ~PAGE_MASK)); |
532 | WARN_ON(addr & ~PAGE_MASK); | 539 | WARN_ON(i && (addr & ~PAGE_MASK)); |
533 | if (k > 0 && | 540 | if (k > 0 && |
534 | ((addrs[k - 1] & PAGE_MASK) | | 541 | ((addrs[k - 1] & PAGE_MASK) + |
535 | ((addrs[k - 1] & ~PAGE_MASK) + 1) << PAGE_SHIFT) | 542 | (((addrs[k - 1] & ~PAGE_MASK) + 1) << PAGE_SHIFT)) |
536 | == addr) { | 543 | == (addr & PAGE_MASK)) |
537 | addrs[k - 1] += (len >> PAGE_SHIFT); | 544 | addrs[k - 1] += ((len + PAGE_SIZE - 1) >> PAGE_SHIFT); |
538 | } else { | 545 | else |
539 | addrs[k++] = addr | ((len >> PAGE_SHIFT) - 1); | 546 | addrs[k++] = (addr & PAGE_MASK) | |
540 | } | 547 | (((len + PAGE_SIZE - 1) >> PAGE_SHIFT) - 1); |
541 | } | 548 | } |
542 | 549 | ||
543 | /* Partial cache lines (fragments) require special measures */ | 550 | /* Partial cache lines (fragments) require special measures */ |
diff --git a/drivers/tee/Kconfig b/drivers/tee/Kconfig index 2330a4eb4e8b..a6df12d88f90 100644 --- a/drivers/tee/Kconfig +++ b/drivers/tee/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | # Generic Trusted Execution Environment Configuration | 1 | # Generic Trusted Execution Environment Configuration |
2 | config TEE | 2 | config TEE |
3 | tristate "Trusted Execution Environment support" | 3 | tristate "Trusted Execution Environment support" |
4 | depends on HAVE_ARM_SMCCC || COMPILE_TEST | ||
4 | select DMA_SHARED_BUFFER | 5 | select DMA_SHARED_BUFFER |
5 | select GENERIC_ALLOCATOR | 6 | select GENERIC_ALLOCATOR |
6 | help | 7 | help |
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 1c196f87e9d9..ff04b7f8549f 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -279,7 +279,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) | |||
279 | map = kzalloc(sizeof(*map), GFP_KERNEL); | 279 | map = kzalloc(sizeof(*map), GFP_KERNEL); |
280 | if (!map) { | 280 | if (!map) { |
281 | ret = -ENOMEM; | 281 | ret = -ENOMEM; |
282 | goto err_map_kobj; | 282 | goto err_map; |
283 | } | 283 | } |
284 | kobject_init(&map->kobj, &map_attr_type); | 284 | kobject_init(&map->kobj, &map_attr_type); |
285 | map->mem = mem; | 285 | map->mem = mem; |
@@ -289,7 +289,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) | |||
289 | goto err_map_kobj; | 289 | goto err_map_kobj; |
290 | ret = kobject_uevent(&map->kobj, KOBJ_ADD); | 290 | ret = kobject_uevent(&map->kobj, KOBJ_ADD); |
291 | if (ret) | 291 | if (ret) |
292 | goto err_map; | 292 | goto err_map_kobj; |
293 | } | 293 | } |
294 | 294 | ||
295 | for (pi = 0; pi < MAX_UIO_PORT_REGIONS; pi++) { | 295 | for (pi = 0; pi < MAX_UIO_PORT_REGIONS; pi++) { |
@@ -308,7 +308,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) | |||
308 | portio = kzalloc(sizeof(*portio), GFP_KERNEL); | 308 | portio = kzalloc(sizeof(*portio), GFP_KERNEL); |
309 | if (!portio) { | 309 | if (!portio) { |
310 | ret = -ENOMEM; | 310 | ret = -ENOMEM; |
311 | goto err_portio_kobj; | 311 | goto err_portio; |
312 | } | 312 | } |
313 | kobject_init(&portio->kobj, &portio_attr_type); | 313 | kobject_init(&portio->kobj, &portio_attr_type); |
314 | portio->port = port; | 314 | portio->port = port; |
@@ -319,7 +319,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) | |||
319 | goto err_portio_kobj; | 319 | goto err_portio_kobj; |
320 | ret = kobject_uevent(&portio->kobj, KOBJ_ADD); | 320 | ret = kobject_uevent(&portio->kobj, KOBJ_ADD); |
321 | if (ret) | 321 | if (ret) |
322 | goto err_portio; | 322 | goto err_portio_kobj; |
323 | } | 323 | } |
324 | 324 | ||
325 | return 0; | 325 | return 0; |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index cfc3cff6e8d5..8e6ef671be9b 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -475,11 +475,11 @@ static void snoop_urb(struct usb_device *udev, | |||
475 | 475 | ||
476 | if (userurb) { /* Async */ | 476 | if (userurb) { /* Async */ |
477 | if (when == SUBMIT) | 477 | if (when == SUBMIT) |
478 | dev_info(&udev->dev, "userurb %p, ep%d %s-%s, " | 478 | dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, " |
479 | "length %u\n", | 479 | "length %u\n", |
480 | userurb, ep, t, d, length); | 480 | userurb, ep, t, d, length); |
481 | else | 481 | else |
482 | dev_info(&udev->dev, "userurb %p, ep%d %s-%s, " | 482 | dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, " |
483 | "actual_length %u status %d\n", | 483 | "actual_length %u status %d\n", |
484 | userurb, ep, t, d, length, | 484 | userurb, ep, t, d, length, |
485 | timeout_or_status); | 485 | timeout_or_status); |
@@ -1895,7 +1895,7 @@ static int proc_reapurb(struct usb_dev_state *ps, void __user *arg) | |||
1895 | if (as) { | 1895 | if (as) { |
1896 | int retval; | 1896 | int retval; |
1897 | 1897 | ||
1898 | snoop(&ps->dev->dev, "reap %p\n", as->userurb); | 1898 | snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
1899 | retval = processcompl(as, (void __user * __user *)arg); | 1899 | retval = processcompl(as, (void __user * __user *)arg); |
1900 | free_async(as); | 1900 | free_async(as); |
1901 | return retval; | 1901 | return retval; |
@@ -1912,7 +1912,7 @@ static int proc_reapurbnonblock(struct usb_dev_state *ps, void __user *arg) | |||
1912 | 1912 | ||
1913 | as = async_getcompleted(ps); | 1913 | as = async_getcompleted(ps); |
1914 | if (as) { | 1914 | if (as) { |
1915 | snoop(&ps->dev->dev, "reap %p\n", as->userurb); | 1915 | snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
1916 | retval = processcompl(as, (void __user * __user *)arg); | 1916 | retval = processcompl(as, (void __user * __user *)arg); |
1917 | free_async(as); | 1917 | free_async(as); |
1918 | } else { | 1918 | } else { |
@@ -2043,7 +2043,7 @@ static int proc_reapurb_compat(struct usb_dev_state *ps, void __user *arg) | |||
2043 | if (as) { | 2043 | if (as) { |
2044 | int retval; | 2044 | int retval; |
2045 | 2045 | ||
2046 | snoop(&ps->dev->dev, "reap %p\n", as->userurb); | 2046 | snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
2047 | retval = processcompl_compat(as, (void __user * __user *)arg); | 2047 | retval = processcompl_compat(as, (void __user * __user *)arg); |
2048 | free_async(as); | 2048 | free_async(as); |
2049 | return retval; | 2049 | return retval; |
@@ -2060,7 +2060,7 @@ static int proc_reapurbnonblock_compat(struct usb_dev_state *ps, void __user *ar | |||
2060 | 2060 | ||
2061 | as = async_getcompleted(ps); | 2061 | as = async_getcompleted(ps); |
2062 | if (as) { | 2062 | if (as) { |
2063 | snoop(&ps->dev->dev, "reap %p\n", as->userurb); | 2063 | snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
2064 | retval = processcompl_compat(as, (void __user * __user *)arg); | 2064 | retval = processcompl_compat(as, (void __user * __user *)arg); |
2065 | free_async(as); | 2065 | free_async(as); |
2066 | } else { | 2066 | } else { |
@@ -2489,7 +2489,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, | |||
2489 | #endif | 2489 | #endif |
2490 | 2490 | ||
2491 | case USBDEVFS_DISCARDURB: | 2491 | case USBDEVFS_DISCARDURB: |
2492 | snoop(&dev->dev, "%s: DISCARDURB %p\n", __func__, p); | 2492 | snoop(&dev->dev, "%s: DISCARDURB %pK\n", __func__, p); |
2493 | ret = proc_unlinkurb(ps, p); | 2493 | ret = proc_unlinkurb(ps, p); |
2494 | break; | 2494 | break; |
2495 | 2495 | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 49550790a3cb..5dea98358c05 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1723,7 +1723,7 @@ int usb_hcd_unlink_urb (struct urb *urb, int status) | |||
1723 | if (retval == 0) | 1723 | if (retval == 0) |
1724 | retval = -EINPROGRESS; | 1724 | retval = -EINPROGRESS; |
1725 | else if (retval != -EIDRM && retval != -EBUSY) | 1725 | else if (retval != -EIDRM && retval != -EBUSY) |
1726 | dev_dbg(&udev->dev, "hcd_unlink_urb %p fail %d\n", | 1726 | dev_dbg(&udev->dev, "hcd_unlink_urb %pK fail %d\n", |
1727 | urb, retval); | 1727 | urb, retval); |
1728 | usb_put_dev(udev); | 1728 | usb_put_dev(udev); |
1729 | } | 1729 | } |
@@ -1890,7 +1890,7 @@ rescan: | |||
1890 | /* kick hcd */ | 1890 | /* kick hcd */ |
1891 | unlink1(hcd, urb, -ESHUTDOWN); | 1891 | unlink1(hcd, urb, -ESHUTDOWN); |
1892 | dev_dbg (hcd->self.controller, | 1892 | dev_dbg (hcd->self.controller, |
1893 | "shutdown urb %p ep%d%s%s\n", | 1893 | "shutdown urb %pK ep%d%s%s\n", |
1894 | urb, usb_endpoint_num(&ep->desc), | 1894 | urb, usb_endpoint_num(&ep->desc), |
1895 | is_in ? "in" : "out", | 1895 | is_in ? "in" : "out", |
1896 | ({ char *s; | 1896 | ({ char *s; |
@@ -2520,6 +2520,7 @@ struct usb_hcd *__usb_create_hcd(const struct hc_driver *driver, | |||
2520 | hcd->bandwidth_mutex = kmalloc(sizeof(*hcd->bandwidth_mutex), | 2520 | hcd->bandwidth_mutex = kmalloc(sizeof(*hcd->bandwidth_mutex), |
2521 | GFP_KERNEL); | 2521 | GFP_KERNEL); |
2522 | if (!hcd->bandwidth_mutex) { | 2522 | if (!hcd->bandwidth_mutex) { |
2523 | kfree(hcd->address0_mutex); | ||
2523 | kfree(hcd); | 2524 | kfree(hcd); |
2524 | dev_dbg(dev, "hcd bandwidth mutex alloc failed\n"); | 2525 | dev_dbg(dev, "hcd bandwidth mutex alloc failed\n"); |
2525 | return NULL; | 2526 | return NULL; |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 9dca59ef18b3..b8bb20d7acdb 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -362,7 +362,8 @@ static void usb_set_lpm_parameters(struct usb_device *udev) | |||
362 | } | 362 | } |
363 | 363 | ||
364 | /* USB 2.0 spec Section 11.24.4.5 */ | 364 | /* USB 2.0 spec Section 11.24.4.5 */ |
365 | static int get_hub_descriptor(struct usb_device *hdev, void *data) | 365 | static int get_hub_descriptor(struct usb_device *hdev, |
366 | struct usb_hub_descriptor *desc) | ||
366 | { | 367 | { |
367 | int i, ret, size; | 368 | int i, ret, size; |
368 | unsigned dtype; | 369 | unsigned dtype; |
@@ -378,10 +379,18 @@ static int get_hub_descriptor(struct usb_device *hdev, void *data) | |||
378 | for (i = 0; i < 3; i++) { | 379 | for (i = 0; i < 3; i++) { |
379 | ret = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), | 380 | ret = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), |
380 | USB_REQ_GET_DESCRIPTOR, USB_DIR_IN | USB_RT_HUB, | 381 | USB_REQ_GET_DESCRIPTOR, USB_DIR_IN | USB_RT_HUB, |
381 | dtype << 8, 0, data, size, | 382 | dtype << 8, 0, desc, size, |
382 | USB_CTRL_GET_TIMEOUT); | 383 | USB_CTRL_GET_TIMEOUT); |
383 | if (ret >= (USB_DT_HUB_NONVAR_SIZE + 2)) | 384 | if (hub_is_superspeed(hdev)) { |
385 | if (ret == size) | ||
386 | return ret; | ||
387 | } else if (ret >= USB_DT_HUB_NONVAR_SIZE + 2) { | ||
388 | /* Make sure we have the DeviceRemovable field. */ | ||
389 | size = USB_DT_HUB_NONVAR_SIZE + desc->bNbrPorts / 8 + 1; | ||
390 | if (ret < size) | ||
391 | return -EMSGSIZE; | ||
384 | return ret; | 392 | return ret; |
393 | } | ||
385 | } | 394 | } |
386 | return -EINVAL; | 395 | return -EINVAL; |
387 | } | 396 | } |
@@ -1313,7 +1322,7 @@ static int hub_configure(struct usb_hub *hub, | |||
1313 | } | 1322 | } |
1314 | mutex_init(&hub->status_mutex); | 1323 | mutex_init(&hub->status_mutex); |
1315 | 1324 | ||
1316 | hub->descriptor = kmalloc(sizeof(*hub->descriptor), GFP_KERNEL); | 1325 | hub->descriptor = kzalloc(sizeof(*hub->descriptor), GFP_KERNEL); |
1317 | if (!hub->descriptor) { | 1326 | if (!hub->descriptor) { |
1318 | ret = -ENOMEM; | 1327 | ret = -ENOMEM; |
1319 | goto fail; | 1328 | goto fail; |
@@ -1321,13 +1330,19 @@ static int hub_configure(struct usb_hub *hub, | |||
1321 | 1330 | ||
1322 | /* Request the entire hub descriptor. | 1331 | /* Request the entire hub descriptor. |
1323 | * hub->descriptor can handle USB_MAXCHILDREN ports, | 1332 | * hub->descriptor can handle USB_MAXCHILDREN ports, |
1324 | * but the hub can/will return fewer bytes here. | 1333 | * but a (non-SS) hub can/will return fewer bytes here. |
1325 | */ | 1334 | */ |
1326 | ret = get_hub_descriptor(hdev, hub->descriptor); | 1335 | ret = get_hub_descriptor(hdev, hub->descriptor); |
1327 | if (ret < 0) { | 1336 | if (ret < 0) { |
1328 | message = "can't read hub descriptor"; | 1337 | message = "can't read hub descriptor"; |
1329 | goto fail; | 1338 | goto fail; |
1330 | } else if (hub->descriptor->bNbrPorts > USB_MAXCHILDREN) { | 1339 | } |
1340 | |||
1341 | maxchild = USB_MAXCHILDREN; | ||
1342 | if (hub_is_superspeed(hdev)) | ||
1343 | maxchild = min_t(unsigned, maxchild, USB_SS_MAXPORTS); | ||
1344 | |||
1345 | if (hub->descriptor->bNbrPorts > maxchild) { | ||
1331 | message = "hub has too many ports!"; | 1346 | message = "hub has too many ports!"; |
1332 | ret = -ENODEV; | 1347 | ret = -ENODEV; |
1333 | goto fail; | 1348 | goto fail; |
diff --git a/drivers/usb/core/of.c b/drivers/usb/core/of.c index d787f195a9a6..d563cbcf76cf 100644 --- a/drivers/usb/core/of.c +++ b/drivers/usb/core/of.c | |||
@@ -53,6 +53,9 @@ EXPORT_SYMBOL_GPL(usb_of_get_child_node); | |||
53 | * | 53 | * |
54 | * Find the companion device from platform bus. | 54 | * Find the companion device from platform bus. |
55 | * | 55 | * |
56 | * Takes a reference to the returned struct device which needs to be dropped | ||
57 | * after use. | ||
58 | * | ||
56 | * Return: On success, a pointer to the companion device, %NULL on failure. | 59 | * Return: On success, a pointer to the companion device, %NULL on failure. |
57 | */ | 60 | */ |
58 | struct device *usb_of_get_companion_dev(struct device *dev) | 61 | struct device *usb_of_get_companion_dev(struct device *dev) |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index d75cb8c0f7df..47903d510955 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -338,7 +338,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
338 | if (!urb || !urb->complete) | 338 | if (!urb || !urb->complete) |
339 | return -EINVAL; | 339 | return -EINVAL; |
340 | if (urb->hcpriv) { | 340 | if (urb->hcpriv) { |
341 | WARN_ONCE(1, "URB %p submitted while active\n", urb); | 341 | WARN_ONCE(1, "URB %pK submitted while active\n", urb); |
342 | return -EBUSY; | 342 | return -EBUSY; |
343 | } | 343 | } |
344 | 344 | ||
diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c index 72664700b8a2..12ee23f53cdd 100644 --- a/drivers/usb/dwc3/dwc3-keystone.c +++ b/drivers/usb/dwc3/dwc3-keystone.c | |||
@@ -107,6 +107,10 @@ static int kdwc3_probe(struct platform_device *pdev) | |||
107 | return PTR_ERR(kdwc->usbss); | 107 | return PTR_ERR(kdwc->usbss); |
108 | 108 | ||
109 | kdwc->clk = devm_clk_get(kdwc->dev, "usb"); | 109 | kdwc->clk = devm_clk_get(kdwc->dev, "usb"); |
110 | if (IS_ERR(kdwc->clk)) { | ||
111 | dev_err(kdwc->dev, "unable to get usb clock\n"); | ||
112 | return PTR_ERR(kdwc->clk); | ||
113 | } | ||
110 | 114 | ||
111 | error = clk_prepare_enable(kdwc->clk); | 115 | error = clk_prepare_enable(kdwc->clk); |
112 | if (error < 0) { | 116 | if (error < 0) { |
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index a15ec71d0423..84a2cebfc712 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c | |||
@@ -39,6 +39,8 @@ | |||
39 | #define PCI_DEVICE_ID_INTEL_APL 0x5aaa | 39 | #define PCI_DEVICE_ID_INTEL_APL 0x5aaa |
40 | #define PCI_DEVICE_ID_INTEL_KBP 0xa2b0 | 40 | #define PCI_DEVICE_ID_INTEL_KBP 0xa2b0 |
41 | #define PCI_DEVICE_ID_INTEL_GLK 0x31aa | 41 | #define PCI_DEVICE_ID_INTEL_GLK 0x31aa |
42 | #define PCI_DEVICE_ID_INTEL_CNPLP 0x9dee | ||
43 | #define PCI_DEVICE_ID_INTEL_CNPH 0xa36e | ||
42 | 44 | ||
43 | #define PCI_INTEL_BXT_DSM_UUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511" | 45 | #define PCI_INTEL_BXT_DSM_UUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511" |
44 | #define PCI_INTEL_BXT_FUNC_PMU_PWR 4 | 46 | #define PCI_INTEL_BXT_FUNC_PMU_PWR 4 |
@@ -270,6 +272,8 @@ static const struct pci_device_id dwc3_pci_id_table[] = { | |||
270 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), }, | 272 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), }, |
271 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), }, | 273 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), }, |
272 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_GLK), }, | 274 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_GLK), }, |
275 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CNPLP), }, | ||
276 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CNPH), }, | ||
273 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, | 277 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, |
274 | { } /* Terminating Entry */ | 278 | { } /* Terminating Entry */ |
275 | }; | 279 | }; |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 6f6f0b3be3ad..aea9a5b948b4 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -1261,14 +1261,24 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) | |||
1261 | __dwc3_gadget_start_isoc(dwc, dep, cur_uf); | 1261 | __dwc3_gadget_start_isoc(dwc, dep, cur_uf); |
1262 | dep->flags &= ~DWC3_EP_PENDING_REQUEST; | 1262 | dep->flags &= ~DWC3_EP_PENDING_REQUEST; |
1263 | } | 1263 | } |
1264 | return 0; | ||
1264 | } | 1265 | } |
1265 | return 0; | 1266 | |
1267 | if ((dep->flags & DWC3_EP_BUSY) && | ||
1268 | !(dep->flags & DWC3_EP_MISSED_ISOC)) { | ||
1269 | WARN_ON_ONCE(!dep->resource_index); | ||
1270 | ret = __dwc3_gadget_kick_transfer(dep, | ||
1271 | dep->resource_index); | ||
1272 | } | ||
1273 | |||
1274 | goto out; | ||
1266 | } | 1275 | } |
1267 | 1276 | ||
1268 | if (!dwc3_calc_trbs_left(dep)) | 1277 | if (!dwc3_calc_trbs_left(dep)) |
1269 | return 0; | 1278 | return 0; |
1270 | 1279 | ||
1271 | ret = __dwc3_gadget_kick_transfer(dep, 0); | 1280 | ret = __dwc3_gadget_kick_transfer(dep, 0); |
1281 | out: | ||
1272 | if (ret == -EBUSY) | 1282 | if (ret == -EBUSY) |
1273 | ret = 0; | 1283 | ret = 0; |
1274 | 1284 | ||
@@ -3026,6 +3036,15 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt) | |||
3026 | return IRQ_HANDLED; | 3036 | return IRQ_HANDLED; |
3027 | } | 3037 | } |
3028 | 3038 | ||
3039 | /* | ||
3040 | * With PCIe legacy interrupt, test shows that top-half irq handler can | ||
3041 | * be called again after HW interrupt deassertion. Check if bottom-half | ||
3042 | * irq event handler completes before caching new event to prevent | ||
3043 | * losing events. | ||
3044 | */ | ||
3045 | if (evt->flags & DWC3_EVENT_PENDING) | ||
3046 | return IRQ_HANDLED; | ||
3047 | |||
3029 | count = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0)); | 3048 | count = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0)); |
3030 | count &= DWC3_GEVNTCOUNT_MASK; | 3049 | count &= DWC3_GEVNTCOUNT_MASK; |
3031 | if (!count) | 3050 | if (!count) |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 71dd27c0d7f2..47dda3450abd 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -1858,12 +1858,12 @@ static int ffs_func_eps_enable(struct ffs_function *func) | |||
1858 | ep->ep->driver_data = ep; | 1858 | ep->ep->driver_data = ep; |
1859 | ep->ep->desc = ds; | 1859 | ep->ep->desc = ds; |
1860 | 1860 | ||
1861 | comp_desc = (struct usb_ss_ep_comp_descriptor *)(ds + | 1861 | if (needs_comp_desc) { |
1862 | USB_DT_ENDPOINT_SIZE); | 1862 | comp_desc = (struct usb_ss_ep_comp_descriptor *)(ds + |
1863 | ep->ep->maxburst = comp_desc->bMaxBurst + 1; | 1863 | USB_DT_ENDPOINT_SIZE); |
1864 | 1864 | ep->ep->maxburst = comp_desc->bMaxBurst + 1; | |
1865 | if (needs_comp_desc) | ||
1866 | ep->ep->comp_desc = comp_desc; | 1865 | ep->ep->comp_desc = comp_desc; |
1866 | } | ||
1867 | 1867 | ||
1868 | ret = usb_ep_enable(ep->ep); | 1868 | ret = usb_ep_enable(ep->ep); |
1869 | if (likely(!ret)) { | 1869 | if (likely(!ret)) { |
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index 000677c991b0..9b0805f55ad7 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c | |||
@@ -1256,7 +1256,7 @@ static void gserial_console_exit(void) | |||
1256 | struct gscons_info *info = &gscons_info; | 1256 | struct gscons_info *info = &gscons_info; |
1257 | 1257 | ||
1258 | unregister_console(&gserial_cons); | 1258 | unregister_console(&gserial_cons); |
1259 | if (info->console_thread != NULL) | 1259 | if (!IS_ERR_OR_NULL(info->console_thread)) |
1260 | kthread_stop(info->console_thread); | 1260 | kthread_stop(info->console_thread); |
1261 | gs_buf_free(&info->con_buf); | 1261 | gs_buf_free(&info->con_buf); |
1262 | } | 1262 | } |
diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c index c79081952ea0..ccabb51cb98d 100644 --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c | |||
@@ -2008,7 +2008,7 @@ ss_hub_descriptor(struct usb_hub_descriptor *desc) | |||
2008 | HUB_CHAR_COMMON_OCPM); | 2008 | HUB_CHAR_COMMON_OCPM); |
2009 | desc->bNbrPorts = 1; | 2009 | desc->bNbrPorts = 1; |
2010 | desc->u.ss.bHubHdrDecLat = 0x04; /* Worst case: 0.4 micro sec*/ | 2010 | desc->u.ss.bHubHdrDecLat = 0x04; /* Worst case: 0.4 micro sec*/ |
2011 | desc->u.ss.DeviceRemovable = 0xffff; | 2011 | desc->u.ss.DeviceRemovable = 0; |
2012 | } | 2012 | } |
2013 | 2013 | ||
2014 | static inline void hub_descriptor(struct usb_hub_descriptor *desc) | 2014 | static inline void hub_descriptor(struct usb_hub_descriptor *desc) |
@@ -2020,8 +2020,8 @@ static inline void hub_descriptor(struct usb_hub_descriptor *desc) | |||
2020 | HUB_CHAR_INDV_PORT_LPSM | | 2020 | HUB_CHAR_INDV_PORT_LPSM | |
2021 | HUB_CHAR_COMMON_OCPM); | 2021 | HUB_CHAR_COMMON_OCPM); |
2022 | desc->bNbrPorts = 1; | 2022 | desc->bNbrPorts = 1; |
2023 | desc->u.hs.DeviceRemovable[0] = 0xff; | 2023 | desc->u.hs.DeviceRemovable[0] = 0; |
2024 | desc->u.hs.DeviceRemovable[1] = 0xff; | 2024 | desc->u.hs.DeviceRemovable[1] = 0xff; /* PortPwrCtrlMask */ |
2025 | } | 2025 | } |
2026 | 2026 | ||
2027 | static int dummy_hub_control( | 2027 | static int dummy_hub_control( |
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index bc7b9be12f54..f1908ea9fbd8 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c | |||
@@ -384,8 +384,10 @@ static int ehci_platform_resume(struct device *dev) | |||
384 | } | 384 | } |
385 | 385 | ||
386 | companion_dev = usb_of_get_companion_dev(hcd->self.controller); | 386 | companion_dev = usb_of_get_companion_dev(hcd->self.controller); |
387 | if (companion_dev) | 387 | if (companion_dev) { |
388 | device_pm_wait_for_dev(hcd->self.controller, companion_dev); | 388 | device_pm_wait_for_dev(hcd->self.controller, companion_dev); |
389 | put_device(companion_dev); | ||
390 | } | ||
389 | 391 | ||
390 | ehci_resume(hcd, priv->reset_on_resume); | 392 | ehci_resume(hcd, priv->reset_on_resume); |
391 | return 0; | 393 | return 0; |
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index bfa7fa3d2eea..7bf78be1fd32 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -1269,7 +1269,7 @@ static void set_td_timer(struct r8a66597 *r8a66597, struct r8a66597_td *td) | |||
1269 | time = 30; | 1269 | time = 30; |
1270 | break; | 1270 | break; |
1271 | default: | 1271 | default: |
1272 | time = 300; | 1272 | time = 50; |
1273 | break; | 1273 | break; |
1274 | } | 1274 | } |
1275 | 1275 | ||
@@ -1785,6 +1785,7 @@ static void r8a66597_td_timer(unsigned long _r8a66597) | |||
1785 | pipe = td->pipe; | 1785 | pipe = td->pipe; |
1786 | pipe_stop(r8a66597, pipe); | 1786 | pipe_stop(r8a66597, pipe); |
1787 | 1787 | ||
1788 | /* Select a different address or endpoint */ | ||
1788 | new_td = td; | 1789 | new_td = td; |
1789 | do { | 1790 | do { |
1790 | list_move_tail(&new_td->queue, | 1791 | list_move_tail(&new_td->queue, |
@@ -1794,7 +1795,8 @@ static void r8a66597_td_timer(unsigned long _r8a66597) | |||
1794 | new_td = td; | 1795 | new_td = td; |
1795 | break; | 1796 | break; |
1796 | } | 1797 | } |
1797 | } while (td != new_td && td->address == new_td->address); | 1798 | } while (td != new_td && td->address == new_td->address && |
1799 | td->pipe->info.epnum == new_td->pipe->info.epnum); | ||
1798 | 1800 | ||
1799 | start_transfer(r8a66597, new_td); | 1801 | start_transfer(r8a66597, new_td); |
1800 | 1802 | ||
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 5e3e9d4c6956..0dde49c35dd2 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -419,7 +419,7 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) | |||
419 | wait_for_completion(cmd->completion); | 419 | wait_for_completion(cmd->completion); |
420 | 420 | ||
421 | if (cmd->status == COMP_COMMAND_ABORTED || | 421 | if (cmd->status == COMP_COMMAND_ABORTED || |
422 | cmd->status == COMP_STOPPED) { | 422 | cmd->status == COMP_COMMAND_RING_STOPPED) { |
423 | xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n"); | 423 | xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n"); |
424 | ret = -ETIME; | 424 | ret = -ETIME; |
425 | } | 425 | } |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index bbe22bcc550a..1f1687e888d6 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -56,7 +56,7 @@ static struct xhci_segment *xhci_segment_alloc(struct xhci_hcd *xhci, | |||
56 | } | 56 | } |
57 | 57 | ||
58 | if (max_packet) { | 58 | if (max_packet) { |
59 | seg->bounce_buf = kzalloc(max_packet, flags | GFP_DMA); | 59 | seg->bounce_buf = kzalloc(max_packet, flags); |
60 | if (!seg->bounce_buf) { | 60 | if (!seg->bounce_buf) { |
61 | dma_pool_free(xhci->segment_pool, seg->trbs, dma); | 61 | dma_pool_free(xhci->segment_pool, seg->trbs, dma); |
62 | kfree(seg); | 62 | kfree(seg); |
@@ -1724,7 +1724,7 @@ static int scratchpad_alloc(struct xhci_hcd *xhci, gfp_t flags) | |||
1724 | xhci->dcbaa->dev_context_ptrs[0] = cpu_to_le64(xhci->scratchpad->sp_dma); | 1724 | xhci->dcbaa->dev_context_ptrs[0] = cpu_to_le64(xhci->scratchpad->sp_dma); |
1725 | for (i = 0; i < num_sp; i++) { | 1725 | for (i = 0; i < num_sp; i++) { |
1726 | dma_addr_t dma; | 1726 | dma_addr_t dma; |
1727 | void *buf = dma_alloc_coherent(dev, xhci->page_size, &dma, | 1727 | void *buf = dma_zalloc_coherent(dev, xhci->page_size, &dma, |
1728 | flags); | 1728 | flags); |
1729 | if (!buf) | 1729 | if (!buf) |
1730 | goto fail_sp4; | 1730 | goto fail_sp4; |
@@ -2307,10 +2307,11 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) | |||
2307 | /* Place limits on the number of roothub ports so that the hub | 2307 | /* Place limits on the number of roothub ports so that the hub |
2308 | * descriptors aren't longer than the USB core will allocate. | 2308 | * descriptors aren't longer than the USB core will allocate. |
2309 | */ | 2309 | */ |
2310 | if (xhci->num_usb3_ports > 15) { | 2310 | if (xhci->num_usb3_ports > USB_SS_MAXPORTS) { |
2311 | xhci_dbg_trace(xhci, trace_xhci_dbg_init, | 2311 | xhci_dbg_trace(xhci, trace_xhci_dbg_init, |
2312 | "Limiting USB 3.0 roothub ports to 15."); | 2312 | "Limiting USB 3.0 roothub ports to %u.", |
2313 | xhci->num_usb3_ports = 15; | 2313 | USB_SS_MAXPORTS); |
2314 | xhci->num_usb3_ports = USB_SS_MAXPORTS; | ||
2314 | } | 2315 | } |
2315 | if (xhci->num_usb2_ports > USB_MAXCHILDREN) { | 2316 | if (xhci->num_usb2_ports > USB_MAXCHILDREN) { |
2316 | xhci_dbg_trace(xhci, trace_xhci_dbg_init, | 2317 | xhci_dbg_trace(xhci, trace_xhci_dbg_init, |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 7b86508ac8cf..fcf1f3f63e7a 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI 0x0aa8 | 52 | #define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI 0x0aa8 |
53 | #define PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI 0x1aa8 | 53 | #define PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI 0x1aa8 |
54 | #define PCI_DEVICE_ID_INTEL_APL_XHCI 0x5aa8 | 54 | #define PCI_DEVICE_ID_INTEL_APL_XHCI 0x5aa8 |
55 | #define PCI_DEVICE_ID_INTEL_DNV_XHCI 0x19d0 | ||
55 | 56 | ||
56 | static const char hcd_name[] = "xhci_hcd"; | 57 | static const char hcd_name[] = "xhci_hcd"; |
57 | 58 | ||
@@ -166,7 +167,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
166 | pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || | 167 | pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || |
167 | pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI || | 168 | pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI || |
168 | pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI || | 169 | pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI || |
169 | pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) { | 170 | pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI || |
171 | pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI)) { | ||
170 | xhci->quirks |= XHCI_PME_STUCK_QUIRK; | 172 | xhci->quirks |= XHCI_PME_STUCK_QUIRK; |
171 | } | 173 | } |
172 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | 174 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && |
@@ -175,7 +177,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
175 | } | 177 | } |
176 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | 178 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && |
177 | (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || | 179 | (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || |
178 | pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) | 180 | pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI || |
181 | pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI)) | ||
179 | xhci->quirks |= XHCI_MISSING_CAS; | 182 | xhci->quirks |= XHCI_MISSING_CAS; |
180 | 183 | ||
181 | if (pdev->vendor == PCI_VENDOR_ID_ETRON && | 184 | if (pdev->vendor == PCI_VENDOR_ID_ETRON && |
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 7c2a9e7c8e0f..c04144b25a67 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c | |||
@@ -177,7 +177,7 @@ static int xhci_plat_probe(struct platform_device *pdev) | |||
177 | 177 | ||
178 | irq = platform_get_irq(pdev, 0); | 178 | irq = platform_get_irq(pdev, 0); |
179 | if (irq < 0) | 179 | if (irq < 0) |
180 | return -ENODEV; | 180 | return irq; |
181 | 181 | ||
182 | /* | 182 | /* |
183 | * sysdev must point to a device that is known to the system firmware | 183 | * sysdev must point to a device that is known to the system firmware |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 74bf5c60a260..03f63f50afb6 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -323,7 +323,7 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci, | |||
323 | if (i_cmd->status != COMP_COMMAND_ABORTED) | 323 | if (i_cmd->status != COMP_COMMAND_ABORTED) |
324 | continue; | 324 | continue; |
325 | 325 | ||
326 | i_cmd->status = COMP_STOPPED; | 326 | i_cmd->status = COMP_COMMAND_RING_STOPPED; |
327 | 327 | ||
328 | xhci_dbg(xhci, "Turn aborted command %p to no-op\n", | 328 | xhci_dbg(xhci, "Turn aborted command %p to no-op\n", |
329 | i_cmd->command_trb); | 329 | i_cmd->command_trb); |
@@ -641,8 +641,8 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci, | |||
641 | xhci_urb_free_priv(urb_priv); | 641 | xhci_urb_free_priv(urb_priv); |
642 | usb_hcd_unlink_urb_from_ep(hcd, urb); | 642 | usb_hcd_unlink_urb_from_ep(hcd, urb); |
643 | spin_unlock(&xhci->lock); | 643 | spin_unlock(&xhci->lock); |
644 | usb_hcd_giveback_urb(hcd, urb, status); | ||
645 | trace_xhci_urb_giveback(urb); | 644 | trace_xhci_urb_giveback(urb); |
645 | usb_hcd_giveback_urb(hcd, urb, status); | ||
646 | spin_lock(&xhci->lock); | 646 | spin_lock(&xhci->lock); |
647 | } | 647 | } |
648 | 648 | ||
@@ -1380,7 +1380,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | |||
1380 | cmd_comp_code = GET_COMP_CODE(le32_to_cpu(event->status)); | 1380 | cmd_comp_code = GET_COMP_CODE(le32_to_cpu(event->status)); |
1381 | 1381 | ||
1382 | /* If CMD ring stopped we own the trbs between enqueue and dequeue */ | 1382 | /* If CMD ring stopped we own the trbs between enqueue and dequeue */ |
1383 | if (cmd_comp_code == COMP_STOPPED) { | 1383 | if (cmd_comp_code == COMP_COMMAND_RING_STOPPED) { |
1384 | complete_all(&xhci->cmd_ring_stop_completion); | 1384 | complete_all(&xhci->cmd_ring_stop_completion); |
1385 | return; | 1385 | return; |
1386 | } | 1386 | } |
@@ -1436,8 +1436,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | |||
1436 | break; | 1436 | break; |
1437 | case TRB_CMD_NOOP: | 1437 | case TRB_CMD_NOOP: |
1438 | /* Is this an aborted command turned to NO-OP? */ | 1438 | /* Is this an aborted command turned to NO-OP? */ |
1439 | if (cmd->status == COMP_STOPPED) | 1439 | if (cmd->status == COMP_COMMAND_RING_STOPPED) |
1440 | cmd_comp_code = COMP_STOPPED; | 1440 | cmd_comp_code = COMP_COMMAND_RING_STOPPED; |
1441 | break; | 1441 | break; |
1442 | case TRB_RESET_EP: | 1442 | case TRB_RESET_EP: |
1443 | WARN_ON(slot_id != TRB_TO_SLOT_ID( | 1443 | WARN_ON(slot_id != TRB_TO_SLOT_ID( |
@@ -2677,11 +2677,12 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) | |||
2677 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 2677 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
2678 | union xhci_trb *event_ring_deq; | 2678 | union xhci_trb *event_ring_deq; |
2679 | irqreturn_t ret = IRQ_NONE; | 2679 | irqreturn_t ret = IRQ_NONE; |
2680 | unsigned long flags; | ||
2680 | dma_addr_t deq; | 2681 | dma_addr_t deq; |
2681 | u64 temp_64; | 2682 | u64 temp_64; |
2682 | u32 status; | 2683 | u32 status; |
2683 | 2684 | ||
2684 | spin_lock(&xhci->lock); | 2685 | spin_lock_irqsave(&xhci->lock, flags); |
2685 | /* Check if the xHC generated the interrupt, or the irq is shared */ | 2686 | /* Check if the xHC generated the interrupt, or the irq is shared */ |
2686 | status = readl(&xhci->op_regs->status); | 2687 | status = readl(&xhci->op_regs->status); |
2687 | if (status == ~(u32)0) { | 2688 | if (status == ~(u32)0) { |
@@ -2707,12 +2708,9 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) | |||
2707 | */ | 2708 | */ |
2708 | status |= STS_EINT; | 2709 | status |= STS_EINT; |
2709 | writel(status, &xhci->op_regs->status); | 2710 | writel(status, &xhci->op_regs->status); |
2710 | /* FIXME when MSI-X is supported and there are multiple vectors */ | ||
2711 | /* Clear the MSI-X event interrupt status */ | ||
2712 | 2711 | ||
2713 | if (hcd->irq) { | 2712 | if (!hcd->msi_enabled) { |
2714 | u32 irq_pending; | 2713 | u32 irq_pending; |
2715 | /* Acknowledge the PCI interrupt */ | ||
2716 | irq_pending = readl(&xhci->ir_set->irq_pending); | 2714 | irq_pending = readl(&xhci->ir_set->irq_pending); |
2717 | irq_pending |= IMAN_IP; | 2715 | irq_pending |= IMAN_IP; |
2718 | writel(irq_pending, &xhci->ir_set->irq_pending); | 2716 | writel(irq_pending, &xhci->ir_set->irq_pending); |
@@ -2757,7 +2755,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) | |||
2757 | ret = IRQ_HANDLED; | 2755 | ret = IRQ_HANDLED; |
2758 | 2756 | ||
2759 | out: | 2757 | out: |
2760 | spin_unlock(&xhci->lock); | 2758 | spin_unlock_irqrestore(&xhci->lock, flags); |
2761 | 2759 | ||
2762 | return ret; | 2760 | return ret; |
2763 | } | 2761 | } |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 2d1310220832..30f47d92a610 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -359,9 +359,10 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) | |||
359 | /* fall back to msi*/ | 359 | /* fall back to msi*/ |
360 | ret = xhci_setup_msi(xhci); | 360 | ret = xhci_setup_msi(xhci); |
361 | 361 | ||
362 | if (!ret) | 362 | if (!ret) { |
363 | /* hcd->irq is 0, we have MSI */ | 363 | hcd->msi_enabled = 1; |
364 | return 0; | 364 | return 0; |
365 | } | ||
365 | 366 | ||
366 | if (!pdev->irq) { | 367 | if (!pdev->irq) { |
367 | xhci_err(xhci, "No msi-x/msi found and no IRQ in BIOS\n"); | 368 | xhci_err(xhci, "No msi-x/msi found and no IRQ in BIOS\n"); |
@@ -1763,7 +1764,7 @@ static int xhci_configure_endpoint_result(struct xhci_hcd *xhci, | |||
1763 | 1764 | ||
1764 | switch (*cmd_status) { | 1765 | switch (*cmd_status) { |
1765 | case COMP_COMMAND_ABORTED: | 1766 | case COMP_COMMAND_ABORTED: |
1766 | case COMP_STOPPED: | 1767 | case COMP_COMMAND_RING_STOPPED: |
1767 | xhci_warn(xhci, "Timeout while waiting for configure endpoint command\n"); | 1768 | xhci_warn(xhci, "Timeout while waiting for configure endpoint command\n"); |
1768 | ret = -ETIME; | 1769 | ret = -ETIME; |
1769 | break; | 1770 | break; |
@@ -1813,7 +1814,7 @@ static int xhci_evaluate_context_result(struct xhci_hcd *xhci, | |||
1813 | 1814 | ||
1814 | switch (*cmd_status) { | 1815 | switch (*cmd_status) { |
1815 | case COMP_COMMAND_ABORTED: | 1816 | case COMP_COMMAND_ABORTED: |
1816 | case COMP_STOPPED: | 1817 | case COMP_COMMAND_RING_STOPPED: |
1817 | xhci_warn(xhci, "Timeout while waiting for evaluate context command\n"); | 1818 | xhci_warn(xhci, "Timeout while waiting for evaluate context command\n"); |
1818 | ret = -ETIME; | 1819 | ret = -ETIME; |
1819 | break; | 1820 | break; |
@@ -3432,7 +3433,7 @@ static int xhci_discover_or_reset_device(struct usb_hcd *hcd, | |||
3432 | ret = reset_device_cmd->status; | 3433 | ret = reset_device_cmd->status; |
3433 | switch (ret) { | 3434 | switch (ret) { |
3434 | case COMP_COMMAND_ABORTED: | 3435 | case COMP_COMMAND_ABORTED: |
3435 | case COMP_STOPPED: | 3436 | case COMP_COMMAND_RING_STOPPED: |
3436 | xhci_warn(xhci, "Timeout waiting for reset device command\n"); | 3437 | xhci_warn(xhci, "Timeout waiting for reset device command\n"); |
3437 | ret = -ETIME; | 3438 | ret = -ETIME; |
3438 | goto command_cleanup; | 3439 | goto command_cleanup; |
@@ -3817,7 +3818,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
3817 | */ | 3818 | */ |
3818 | switch (command->status) { | 3819 | switch (command->status) { |
3819 | case COMP_COMMAND_ABORTED: | 3820 | case COMP_COMMAND_ABORTED: |
3820 | case COMP_STOPPED: | 3821 | case COMP_COMMAND_RING_STOPPED: |
3821 | xhci_warn(xhci, "Timeout while waiting for setup device command\n"); | 3822 | xhci_warn(xhci, "Timeout while waiting for setup device command\n"); |
3822 | ret = -ETIME; | 3823 | ret = -ETIME; |
3823 | break; | 3824 | break; |
diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c index e9cae4d82af2..15d4e64d3b65 100644 --- a/drivers/usb/misc/chaoskey.c +++ b/drivers/usb/misc/chaoskey.c | |||
@@ -192,7 +192,7 @@ static int chaoskey_probe(struct usb_interface *interface, | |||
192 | 192 | ||
193 | dev->in_ep = in_ep; | 193 | dev->in_ep = in_ep; |
194 | 194 | ||
195 | if (udev->descriptor.idVendor != ALEA_VENDOR_ID) | 195 | if (le16_to_cpu(udev->descriptor.idVendor) != ALEA_VENDOR_ID) |
196 | dev->reads_started = 1; | 196 | dev->reads_started = 1; |
197 | 197 | ||
198 | dev->size = size; | 198 | dev->size = size; |
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 77569531b78a..83b05a287b0c 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c | |||
@@ -554,7 +554,7 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd, | |||
554 | info.revision = le16_to_cpu(dev->udev->descriptor.bcdDevice); | 554 | info.revision = le16_to_cpu(dev->udev->descriptor.bcdDevice); |
555 | 555 | ||
556 | /* 0==UNKNOWN, 1==LOW(usb1.1) ,2=FULL(usb1.1), 3=HIGH(usb2.0) */ | 556 | /* 0==UNKNOWN, 1==LOW(usb1.1) ,2=FULL(usb1.1), 3=HIGH(usb2.0) */ |
557 | info.speed = le16_to_cpu(dev->udev->speed); | 557 | info.speed = dev->udev->speed; |
558 | info.if_num = dev->interface->cur_altsetting->desc.bInterfaceNumber; | 558 | info.if_num = dev->interface->cur_altsetting->desc.bInterfaceNumber; |
559 | info.report_size = dev->report_size; | 559 | info.report_size = dev->report_size; |
560 | 560 | ||
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index aa3c280fdf8d..0782ac6f5edf 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c | |||
@@ -926,6 +926,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device | |||
926 | USB_MAJOR, dev->minor); | 926 | USB_MAJOR, dev->minor); |
927 | 927 | ||
928 | exit: | 928 | exit: |
929 | kfree(get_version_reply); | ||
929 | return retval; | 930 | return retval; |
930 | 931 | ||
931 | error: | 932 | error: |
diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c b/drivers/usb/misc/sisusbvga/sisusb_con.c index 3c6948af726a..f019d80ca9e4 100644 --- a/drivers/usb/misc/sisusbvga/sisusb_con.c +++ b/drivers/usb/misc/sisusbvga/sisusb_con.c | |||
@@ -973,7 +973,7 @@ sisusbcon_set_origin(struct vc_data *c) | |||
973 | 973 | ||
974 | mutex_unlock(&sisusb->lock); | 974 | mutex_unlock(&sisusb->lock); |
975 | 975 | ||
976 | return 1; | 976 | return true; |
977 | } | 977 | } |
978 | 978 | ||
979 | /* Interface routine */ | 979 | /* Interface routine */ |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index ac3a4952abb4..dbe617a735d8 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -2780,10 +2780,11 @@ int musb_host_setup(struct musb *musb, int power_budget) | |||
2780 | int ret; | 2780 | int ret; |
2781 | struct usb_hcd *hcd = musb->hcd; | 2781 | struct usb_hcd *hcd = musb->hcd; |
2782 | 2782 | ||
2783 | MUSB_HST_MODE(musb); | 2783 | if (musb->port_mode == MUSB_PORT_MODE_HOST) { |
2784 | musb->xceiv->otg->default_a = 1; | 2784 | MUSB_HST_MODE(musb); |
2785 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; | 2785 | musb->xceiv->otg->default_a = 1; |
2786 | 2786 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; | |
2787 | } | ||
2787 | otg_set_host(musb->xceiv->otg, &hcd->self); | 2788 | otg_set_host(musb->xceiv->otg, &hcd->self); |
2788 | hcd->self.otg_port = 1; | 2789 | hcd->self.otg_port = 1; |
2789 | musb->xceiv->otg->host = &hcd->self; | 2790 | musb->xceiv->otg->host = &hcd->self; |
diff --git a/drivers/usb/musb/tusb6010_omap.c b/drivers/usb/musb/tusb6010_omap.c index 8b43c4b99f04..7870b37e0ea5 100644 --- a/drivers/usb/musb/tusb6010_omap.c +++ b/drivers/usb/musb/tusb6010_omap.c | |||
@@ -219,6 +219,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz, | |||
219 | u32 dma_remaining; | 219 | u32 dma_remaining; |
220 | int src_burst, dst_burst; | 220 | int src_burst, dst_burst; |
221 | u16 csr; | 221 | u16 csr; |
222 | u32 psize; | ||
222 | int ch; | 223 | int ch; |
223 | s8 dmareq; | 224 | s8 dmareq; |
224 | s8 sync_dev; | 225 | s8 sync_dev; |
@@ -390,15 +391,19 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz, | |||
390 | 391 | ||
391 | if (chdat->tx) { | 392 | if (chdat->tx) { |
392 | /* Send transfer_packet_sz packets at a time */ | 393 | /* Send transfer_packet_sz packets at a time */ |
393 | musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET, | 394 | psize = musb_readl(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET); |
394 | chdat->transfer_packet_sz); | 395 | psize &= ~0x7ff; |
396 | psize |= chdat->transfer_packet_sz; | ||
397 | musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET, psize); | ||
395 | 398 | ||
396 | musb_writel(ep_conf, TUSB_EP_TX_OFFSET, | 399 | musb_writel(ep_conf, TUSB_EP_TX_OFFSET, |
397 | TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len)); | 400 | TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len)); |
398 | } else { | 401 | } else { |
399 | /* Receive transfer_packet_sz packets at a time */ | 402 | /* Receive transfer_packet_sz packets at a time */ |
400 | musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET, | 403 | psize = musb_readl(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET); |
401 | chdat->transfer_packet_sz << 16); | 404 | psize &= ~(0x7ff << 16); |
405 | psize |= (chdat->transfer_packet_sz << 16); | ||
406 | musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET, psize); | ||
402 | 407 | ||
403 | musb_writel(ep_conf, TUSB_EP_RX_OFFSET, | 408 | musb_writel(ep_conf, TUSB_EP_RX_OFFSET, |
404 | TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len)); | 409 | TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len)); |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index d38780fa8788..aba74f817dc6 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -809,10 +809,10 @@ static const struct usb_device_id id_table_combined[] = { | |||
809 | { USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) }, | 809 | { USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) }, |
810 | { USB_DEVICE(FTDI_VID, CYBER_CORTEX_AV_PID), | 810 | { USB_DEVICE(FTDI_VID, CYBER_CORTEX_AV_PID), |
811 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 811 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
812 | { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), | 812 | { USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID, 1) }, |
813 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 813 | { USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID, 1) }, |
814 | { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID), | 814 | { USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_TINY_PID, 1) }, |
815 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 815 | { USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_TINY_H_PID, 1) }, |
816 | { USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID), | 816 | { USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID), |
817 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 817 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
818 | { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID), | 818 | { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID), |
@@ -1527,9 +1527,9 @@ static int set_serial_info(struct tty_struct *tty, | |||
1527 | (new_serial.flags & ASYNC_FLAGS)); | 1527 | (new_serial.flags & ASYNC_FLAGS)); |
1528 | priv->custom_divisor = new_serial.custom_divisor; | 1528 | priv->custom_divisor = new_serial.custom_divisor; |
1529 | 1529 | ||
1530 | check_and_exit: | ||
1530 | write_latency_timer(port); | 1531 | write_latency_timer(port); |
1531 | 1532 | ||
1532 | check_and_exit: | ||
1533 | if ((old_priv.flags & ASYNC_SPD_MASK) != | 1533 | if ((old_priv.flags & ASYNC_SPD_MASK) != |
1534 | (priv->flags & ASYNC_SPD_MASK)) { | 1534 | (priv->flags & ASYNC_SPD_MASK)) { |
1535 | if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | 1535 | if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 71fb9e59db71..4fcf1cecb6d7 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -882,6 +882,8 @@ | |||
882 | /* Olimex */ | 882 | /* Olimex */ |
883 | #define OLIMEX_VID 0x15BA | 883 | #define OLIMEX_VID 0x15BA |
884 | #define OLIMEX_ARM_USB_OCD_PID 0x0003 | 884 | #define OLIMEX_ARM_USB_OCD_PID 0x0003 |
885 | #define OLIMEX_ARM_USB_TINY_PID 0x0004 | ||
886 | #define OLIMEX_ARM_USB_TINY_H_PID 0x002a | ||
885 | #define OLIMEX_ARM_USB_OCD_H_PID 0x002b | 887 | #define OLIMEX_ARM_USB_OCD_H_PID 0x002b |
886 | 888 | ||
887 | /* | 889 | /* |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 87798e625d6c..6cefb9cb133d 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -2336,8 +2336,11 @@ static void change_port_settings(struct tty_struct *tty, | |||
2336 | if (!baud) { | 2336 | if (!baud) { |
2337 | /* pick a default, any default... */ | 2337 | /* pick a default, any default... */ |
2338 | baud = 9600; | 2338 | baud = 9600; |
2339 | } else | 2339 | } else { |
2340 | /* Avoid a zero divisor. */ | ||
2341 | baud = min(baud, 461550); | ||
2340 | tty_encode_baud_rate(tty, baud, baud); | 2342 | tty_encode_baud_rate(tty, baud, baud); |
2343 | } | ||
2341 | 2344 | ||
2342 | edge_port->baud_rate = baud; | 2345 | edge_port->baud_rate = baud; |
2343 | config->wBaudRate = (__u16)((461550L + baud/2) / baud); | 2346 | config->wBaudRate = (__u16)((461550L + baud/2) / baud); |
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index 73956d48a0c5..f9734a96d516 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c | |||
@@ -197,6 +197,7 @@ static u8 ir_xbof_change(u8 xbof) | |||
197 | static int ir_startup(struct usb_serial *serial) | 197 | static int ir_startup(struct usb_serial *serial) |
198 | { | 198 | { |
199 | struct usb_irda_cs_descriptor *irda_desc; | 199 | struct usb_irda_cs_descriptor *irda_desc; |
200 | int rates; | ||
200 | 201 | ||
201 | irda_desc = irda_usb_find_class_desc(serial, 0); | 202 | irda_desc = irda_usb_find_class_desc(serial, 0); |
202 | if (!irda_desc) { | 203 | if (!irda_desc) { |
@@ -205,18 +206,20 @@ static int ir_startup(struct usb_serial *serial) | |||
205 | return -ENODEV; | 206 | return -ENODEV; |
206 | } | 207 | } |
207 | 208 | ||
209 | rates = le16_to_cpu(irda_desc->wBaudRate); | ||
210 | |||
208 | dev_dbg(&serial->dev->dev, | 211 | dev_dbg(&serial->dev->dev, |
209 | "%s - Baud rates supported:%s%s%s%s%s%s%s%s%s\n", | 212 | "%s - Baud rates supported:%s%s%s%s%s%s%s%s%s\n", |
210 | __func__, | 213 | __func__, |
211 | (irda_desc->wBaudRate & USB_IRDA_BR_2400) ? " 2400" : "", | 214 | (rates & USB_IRDA_BR_2400) ? " 2400" : "", |
212 | (irda_desc->wBaudRate & USB_IRDA_BR_9600) ? " 9600" : "", | 215 | (rates & USB_IRDA_BR_9600) ? " 9600" : "", |
213 | (irda_desc->wBaudRate & USB_IRDA_BR_19200) ? " 19200" : "", | 216 | (rates & USB_IRDA_BR_19200) ? " 19200" : "", |
214 | (irda_desc->wBaudRate & USB_IRDA_BR_38400) ? " 38400" : "", | 217 | (rates & USB_IRDA_BR_38400) ? " 38400" : "", |
215 | (irda_desc->wBaudRate & USB_IRDA_BR_57600) ? " 57600" : "", | 218 | (rates & USB_IRDA_BR_57600) ? " 57600" : "", |
216 | (irda_desc->wBaudRate & USB_IRDA_BR_115200) ? " 115200" : "", | 219 | (rates & USB_IRDA_BR_115200) ? " 115200" : "", |
217 | (irda_desc->wBaudRate & USB_IRDA_BR_576000) ? " 576000" : "", | 220 | (rates & USB_IRDA_BR_576000) ? " 576000" : "", |
218 | (irda_desc->wBaudRate & USB_IRDA_BR_1152000) ? " 1152000" : "", | 221 | (rates & USB_IRDA_BR_1152000) ? " 1152000" : "", |
219 | (irda_desc->wBaudRate & USB_IRDA_BR_4000000) ? " 4000000" : ""); | 222 | (rates & USB_IRDA_BR_4000000) ? " 4000000" : ""); |
220 | 223 | ||
221 | switch (irda_desc->bmAdditionalBOFs) { | 224 | switch (irda_desc->bmAdditionalBOFs) { |
222 | case USB_IRDA_AB_48: | 225 | case USB_IRDA_AB_48: |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index edbc81f205c2..70f346f1aa86 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -189,7 +189,7 @@ static int mct_u232_set_baud_rate(struct tty_struct *tty, | |||
189 | return -ENOMEM; | 189 | return -ENOMEM; |
190 | 190 | ||
191 | divisor = mct_u232_calculate_baud_rate(serial, value, &speed); | 191 | divisor = mct_u232_calculate_baud_rate(serial, value, &speed); |
192 | put_unaligned_le32(cpu_to_le32(divisor), buf); | 192 | put_unaligned_le32(divisor, buf); |
193 | rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | 193 | rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
194 | MCT_U232_SET_BAUD_RATE_REQUEST, | 194 | MCT_U232_SET_BAUD_RATE_REQUEST, |
195 | MCT_U232_SET_REQUEST_TYPE, | 195 | MCT_U232_SET_REQUEST_TYPE, |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index af67a0de6b5d..3bf61acfc26b 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -281,6 +281,7 @@ static void option_instat_callback(struct urb *urb); | |||
281 | #define TELIT_PRODUCT_LE922_USBCFG0 0x1042 | 281 | #define TELIT_PRODUCT_LE922_USBCFG0 0x1042 |
282 | #define TELIT_PRODUCT_LE922_USBCFG3 0x1043 | 282 | #define TELIT_PRODUCT_LE922_USBCFG3 0x1043 |
283 | #define TELIT_PRODUCT_LE922_USBCFG5 0x1045 | 283 | #define TELIT_PRODUCT_LE922_USBCFG5 0x1045 |
284 | #define TELIT_PRODUCT_ME910 0x1100 | ||
284 | #define TELIT_PRODUCT_LE920 0x1200 | 285 | #define TELIT_PRODUCT_LE920 0x1200 |
285 | #define TELIT_PRODUCT_LE910 0x1201 | 286 | #define TELIT_PRODUCT_LE910 0x1201 |
286 | #define TELIT_PRODUCT_LE910_USBCFG4 0x1206 | 287 | #define TELIT_PRODUCT_LE910_USBCFG4 0x1206 |
@@ -640,6 +641,11 @@ static const struct option_blacklist_info simcom_sim7100e_blacklist = { | |||
640 | .reserved = BIT(5) | BIT(6), | 641 | .reserved = BIT(5) | BIT(6), |
641 | }; | 642 | }; |
642 | 643 | ||
644 | static const struct option_blacklist_info telit_me910_blacklist = { | ||
645 | .sendsetup = BIT(0), | ||
646 | .reserved = BIT(1) | BIT(3), | ||
647 | }; | ||
648 | |||
643 | static const struct option_blacklist_info telit_le910_blacklist = { | 649 | static const struct option_blacklist_info telit_le910_blacklist = { |
644 | .sendsetup = BIT(0), | 650 | .sendsetup = BIT(0), |
645 | .reserved = BIT(1) | BIT(2), | 651 | .reserved = BIT(1) | BIT(2), |
@@ -1235,6 +1241,8 @@ static const struct usb_device_id option_ids[] = { | |||
1235 | .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, | 1241 | .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, |
1236 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG5, 0xff), | 1242 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG5, 0xff), |
1237 | .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 }, | 1243 | .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 }, |
1244 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), | ||
1245 | .driver_info = (kernel_ulong_t)&telit_me910_blacklist }, | ||
1238 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), | 1246 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), |
1239 | .driver_info = (kernel_ulong_t)&telit_le910_blacklist }, | 1247 | .driver_info = (kernel_ulong_t)&telit_le910_blacklist }, |
1240 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), | 1248 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 38b3f0d8cd58..fd509ed6cf70 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -162,6 +162,8 @@ static const struct usb_device_id id_table[] = { | |||
162 | {DEVICE_SWI(0x1199, 0x9071)}, /* Sierra Wireless MC74xx */ | 162 | {DEVICE_SWI(0x1199, 0x9071)}, /* Sierra Wireless MC74xx */ |
163 | {DEVICE_SWI(0x1199, 0x9078)}, /* Sierra Wireless EM74xx */ | 163 | {DEVICE_SWI(0x1199, 0x9078)}, /* Sierra Wireless EM74xx */ |
164 | {DEVICE_SWI(0x1199, 0x9079)}, /* Sierra Wireless EM74xx */ | 164 | {DEVICE_SWI(0x1199, 0x9079)}, /* Sierra Wireless EM74xx */ |
165 | {DEVICE_SWI(0x1199, 0x907a)}, /* Sierra Wireless EM74xx QDL */ | ||
166 | {DEVICE_SWI(0x1199, 0x907b)}, /* Sierra Wireless EM74xx */ | ||
165 | {DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ | 167 | {DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ |
166 | {DEVICE_SWI(0x413c, 0x81a3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ | 168 | {DEVICE_SWI(0x413c, 0x81a3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ |
167 | {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ | 169 | {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ |
diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c index 369f3c24815a..44af719194b2 100644 --- a/drivers/usb/storage/ene_ub6250.c +++ b/drivers/usb/storage/ene_ub6250.c | |||
@@ -446,6 +446,10 @@ struct ms_lib_ctrl { | |||
446 | #define SD_BLOCK_LEN 9 | 446 | #define SD_BLOCK_LEN 9 |
447 | 447 | ||
448 | struct ene_ub6250_info { | 448 | struct ene_ub6250_info { |
449 | |||
450 | /* I/O bounce buffer */ | ||
451 | u8 *bbuf; | ||
452 | |||
449 | /* for 6250 code */ | 453 | /* for 6250 code */ |
450 | struct SD_STATUS SD_Status; | 454 | struct SD_STATUS SD_Status; |
451 | struct MS_STATUS MS_Status; | 455 | struct MS_STATUS MS_Status; |
@@ -493,8 +497,11 @@ static int ene_load_bincode(struct us_data *us, unsigned char flag); | |||
493 | 497 | ||
494 | static void ene_ub6250_info_destructor(void *extra) | 498 | static void ene_ub6250_info_destructor(void *extra) |
495 | { | 499 | { |
500 | struct ene_ub6250_info *info = (struct ene_ub6250_info *) extra; | ||
501 | |||
496 | if (!extra) | 502 | if (!extra) |
497 | return; | 503 | return; |
504 | kfree(info->bbuf); | ||
498 | } | 505 | } |
499 | 506 | ||
500 | static int ene_send_scsi_cmd(struct us_data *us, u8 fDir, void *buf, int use_sg) | 507 | static int ene_send_scsi_cmd(struct us_data *us, u8 fDir, void *buf, int use_sg) |
@@ -860,8 +867,9 @@ static int ms_read_readpage(struct us_data *us, u32 PhyBlockAddr, | |||
860 | u8 PageNum, u32 *PageBuf, struct ms_lib_type_extdat *ExtraDat) | 867 | u8 PageNum, u32 *PageBuf, struct ms_lib_type_extdat *ExtraDat) |
861 | { | 868 | { |
862 | struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; | 869 | struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; |
870 | struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; | ||
871 | u8 *bbuf = info->bbuf; | ||
863 | int result; | 872 | int result; |
864 | u8 ExtBuf[4]; | ||
865 | u32 bn = PhyBlockAddr * 0x20 + PageNum; | 873 | u32 bn = PhyBlockAddr * 0x20 + PageNum; |
866 | 874 | ||
867 | result = ene_load_bincode(us, MS_RW_PATTERN); | 875 | result = ene_load_bincode(us, MS_RW_PATTERN); |
@@ -901,7 +909,7 @@ static int ms_read_readpage(struct us_data *us, u32 PhyBlockAddr, | |||
901 | bcb->CDB[2] = (unsigned char)(PhyBlockAddr>>16); | 909 | bcb->CDB[2] = (unsigned char)(PhyBlockAddr>>16); |
902 | bcb->CDB[6] = 0x01; | 910 | bcb->CDB[6] = 0x01; |
903 | 911 | ||
904 | result = ene_send_scsi_cmd(us, FDIR_READ, &ExtBuf, 0); | 912 | result = ene_send_scsi_cmd(us, FDIR_READ, bbuf, 0); |
905 | if (result != USB_STOR_XFER_GOOD) | 913 | if (result != USB_STOR_XFER_GOOD) |
906 | return USB_STOR_TRANSPORT_ERROR; | 914 | return USB_STOR_TRANSPORT_ERROR; |
907 | 915 | ||
@@ -910,9 +918,9 @@ static int ms_read_readpage(struct us_data *us, u32 PhyBlockAddr, | |||
910 | ExtraDat->status0 = 0x10; /* Not yet,fireware support */ | 918 | ExtraDat->status0 = 0x10; /* Not yet,fireware support */ |
911 | 919 | ||
912 | ExtraDat->status1 = 0x00; /* Not yet,fireware support */ | 920 | ExtraDat->status1 = 0x00; /* Not yet,fireware support */ |
913 | ExtraDat->ovrflg = ExtBuf[0]; | 921 | ExtraDat->ovrflg = bbuf[0]; |
914 | ExtraDat->mngflg = ExtBuf[1]; | 922 | ExtraDat->mngflg = bbuf[1]; |
915 | ExtraDat->logadr = memstick_logaddr(ExtBuf[2], ExtBuf[3]); | 923 | ExtraDat->logadr = memstick_logaddr(bbuf[2], bbuf[3]); |
916 | 924 | ||
917 | return USB_STOR_TRANSPORT_GOOD; | 925 | return USB_STOR_TRANSPORT_GOOD; |
918 | } | 926 | } |
@@ -1332,8 +1340,9 @@ static int ms_lib_read_extra(struct us_data *us, u32 PhyBlock, | |||
1332 | u8 PageNum, struct ms_lib_type_extdat *ExtraDat) | 1340 | u8 PageNum, struct ms_lib_type_extdat *ExtraDat) |
1333 | { | 1341 | { |
1334 | struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; | 1342 | struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; |
1343 | struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; | ||
1344 | u8 *bbuf = info->bbuf; | ||
1335 | int result; | 1345 | int result; |
1336 | u8 ExtBuf[4]; | ||
1337 | 1346 | ||
1338 | memset(bcb, 0, sizeof(struct bulk_cb_wrap)); | 1347 | memset(bcb, 0, sizeof(struct bulk_cb_wrap)); |
1339 | bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); | 1348 | bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); |
@@ -1347,7 +1356,7 @@ static int ms_lib_read_extra(struct us_data *us, u32 PhyBlock, | |||
1347 | bcb->CDB[2] = (unsigned char)(PhyBlock>>16); | 1356 | bcb->CDB[2] = (unsigned char)(PhyBlock>>16); |
1348 | bcb->CDB[6] = 0x01; | 1357 | bcb->CDB[6] = 0x01; |
1349 | 1358 | ||
1350 | result = ene_send_scsi_cmd(us, FDIR_READ, &ExtBuf, 0); | 1359 | result = ene_send_scsi_cmd(us, FDIR_READ, bbuf, 0); |
1351 | if (result != USB_STOR_XFER_GOOD) | 1360 | if (result != USB_STOR_XFER_GOOD) |
1352 | return USB_STOR_TRANSPORT_ERROR; | 1361 | return USB_STOR_TRANSPORT_ERROR; |
1353 | 1362 | ||
@@ -1355,9 +1364,9 @@ static int ms_lib_read_extra(struct us_data *us, u32 PhyBlock, | |||
1355 | ExtraDat->intr = 0x80; /* Not yet, waiting for fireware support */ | 1364 | ExtraDat->intr = 0x80; /* Not yet, waiting for fireware support */ |
1356 | ExtraDat->status0 = 0x10; /* Not yet, waiting for fireware support */ | 1365 | ExtraDat->status0 = 0x10; /* Not yet, waiting for fireware support */ |
1357 | ExtraDat->status1 = 0x00; /* Not yet, waiting for fireware support */ | 1366 | ExtraDat->status1 = 0x00; /* Not yet, waiting for fireware support */ |
1358 | ExtraDat->ovrflg = ExtBuf[0]; | 1367 | ExtraDat->ovrflg = bbuf[0]; |
1359 | ExtraDat->mngflg = ExtBuf[1]; | 1368 | ExtraDat->mngflg = bbuf[1]; |
1360 | ExtraDat->logadr = memstick_logaddr(ExtBuf[2], ExtBuf[3]); | 1369 | ExtraDat->logadr = memstick_logaddr(bbuf[2], bbuf[3]); |
1361 | 1370 | ||
1362 | return USB_STOR_TRANSPORT_GOOD; | 1371 | return USB_STOR_TRANSPORT_GOOD; |
1363 | } | 1372 | } |
@@ -1556,9 +1565,9 @@ static int ms_lib_scan_logicalblocknumber(struct us_data *us, u16 btBlk1st) | |||
1556 | u16 PhyBlock, newblk, i; | 1565 | u16 PhyBlock, newblk, i; |
1557 | u16 LogStart, LogEnde; | 1566 | u16 LogStart, LogEnde; |
1558 | struct ms_lib_type_extdat extdat; | 1567 | struct ms_lib_type_extdat extdat; |
1559 | u8 buf[0x200]; | ||
1560 | u32 count = 0, index = 0; | 1568 | u32 count = 0, index = 0; |
1561 | struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; | 1569 | struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; |
1570 | u8 *bbuf = info->bbuf; | ||
1562 | 1571 | ||
1563 | for (PhyBlock = 0; PhyBlock < info->MS_Lib.NumberOfPhyBlock;) { | 1572 | for (PhyBlock = 0; PhyBlock < info->MS_Lib.NumberOfPhyBlock;) { |
1564 | ms_lib_phy_to_log_range(PhyBlock, &LogStart, &LogEnde); | 1573 | ms_lib_phy_to_log_range(PhyBlock, &LogStart, &LogEnde); |
@@ -1572,14 +1581,16 @@ static int ms_lib_scan_logicalblocknumber(struct us_data *us, u16 btBlk1st) | |||
1572 | } | 1581 | } |
1573 | 1582 | ||
1574 | if (count == PhyBlock) { | 1583 | if (count == PhyBlock) { |
1575 | ms_lib_read_extrablock(us, PhyBlock, 0, 0x80, &buf); | 1584 | ms_lib_read_extrablock(us, PhyBlock, 0, 0x80, |
1585 | bbuf); | ||
1576 | count += 0x80; | 1586 | count += 0x80; |
1577 | } | 1587 | } |
1578 | index = (PhyBlock % 0x80) * 4; | 1588 | index = (PhyBlock % 0x80) * 4; |
1579 | 1589 | ||
1580 | extdat.ovrflg = buf[index]; | 1590 | extdat.ovrflg = bbuf[index]; |
1581 | extdat.mngflg = buf[index+1]; | 1591 | extdat.mngflg = bbuf[index+1]; |
1582 | extdat.logadr = memstick_logaddr(buf[index+2], buf[index+3]); | 1592 | extdat.logadr = memstick_logaddr(bbuf[index+2], |
1593 | bbuf[index+3]); | ||
1583 | 1594 | ||
1584 | if ((extdat.ovrflg & MS_REG_OVR_BKST) != MS_REG_OVR_BKST_OK) { | 1595 | if ((extdat.ovrflg & MS_REG_OVR_BKST) != MS_REG_OVR_BKST_OK) { |
1585 | ms_lib_setacquired_errorblock(us, PhyBlock); | 1596 | ms_lib_setacquired_errorblock(us, PhyBlock); |
@@ -2062,9 +2073,9 @@ static int ene_ms_init(struct us_data *us) | |||
2062 | { | 2073 | { |
2063 | struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; | 2074 | struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; |
2064 | int result; | 2075 | int result; |
2065 | u8 buf[0x200]; | ||
2066 | u16 MSP_BlockSize, MSP_UserAreaBlocks; | 2076 | u16 MSP_BlockSize, MSP_UserAreaBlocks; |
2067 | struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; | 2077 | struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; |
2078 | u8 *bbuf = info->bbuf; | ||
2068 | 2079 | ||
2069 | printk(KERN_INFO "transport --- ENE_MSInit\n"); | 2080 | printk(KERN_INFO "transport --- ENE_MSInit\n"); |
2070 | 2081 | ||
@@ -2083,13 +2094,13 @@ static int ene_ms_init(struct us_data *us) | |||
2083 | bcb->CDB[0] = 0xF1; | 2094 | bcb->CDB[0] = 0xF1; |
2084 | bcb->CDB[1] = 0x01; | 2095 | bcb->CDB[1] = 0x01; |
2085 | 2096 | ||
2086 | result = ene_send_scsi_cmd(us, FDIR_READ, &buf, 0); | 2097 | result = ene_send_scsi_cmd(us, FDIR_READ, bbuf, 0); |
2087 | if (result != USB_STOR_XFER_GOOD) { | 2098 | if (result != USB_STOR_XFER_GOOD) { |
2088 | printk(KERN_ERR "Execution MS Init Code Fail !!\n"); | 2099 | printk(KERN_ERR "Execution MS Init Code Fail !!\n"); |
2089 | return USB_STOR_TRANSPORT_ERROR; | 2100 | return USB_STOR_TRANSPORT_ERROR; |
2090 | } | 2101 | } |
2091 | /* the same part to test ENE */ | 2102 | /* the same part to test ENE */ |
2092 | info->MS_Status = *(struct MS_STATUS *)&buf[0]; | 2103 | info->MS_Status = *(struct MS_STATUS *) bbuf; |
2093 | 2104 | ||
2094 | if (info->MS_Status.Insert && info->MS_Status.Ready) { | 2105 | if (info->MS_Status.Insert && info->MS_Status.Ready) { |
2095 | printk(KERN_INFO "Insert = %x\n", info->MS_Status.Insert); | 2106 | printk(KERN_INFO "Insert = %x\n", info->MS_Status.Insert); |
@@ -2098,15 +2109,15 @@ static int ene_ms_init(struct us_data *us) | |||
2098 | printk(KERN_INFO "IsMSPHG = %x\n", info->MS_Status.IsMSPHG); | 2109 | printk(KERN_INFO "IsMSPHG = %x\n", info->MS_Status.IsMSPHG); |
2099 | printk(KERN_INFO "WtP= %x\n", info->MS_Status.WtP); | 2110 | printk(KERN_INFO "WtP= %x\n", info->MS_Status.WtP); |
2100 | if (info->MS_Status.IsMSPro) { | 2111 | if (info->MS_Status.IsMSPro) { |
2101 | MSP_BlockSize = (buf[6] << 8) | buf[7]; | 2112 | MSP_BlockSize = (bbuf[6] << 8) | bbuf[7]; |
2102 | MSP_UserAreaBlocks = (buf[10] << 8) | buf[11]; | 2113 | MSP_UserAreaBlocks = (bbuf[10] << 8) | bbuf[11]; |
2103 | info->MSP_TotalBlock = MSP_BlockSize * MSP_UserAreaBlocks; | 2114 | info->MSP_TotalBlock = MSP_BlockSize * MSP_UserAreaBlocks; |
2104 | } else { | 2115 | } else { |
2105 | ms_card_init(us); /* Card is MS (to ms.c)*/ | 2116 | ms_card_init(us); /* Card is MS (to ms.c)*/ |
2106 | } | 2117 | } |
2107 | usb_stor_dbg(us, "MS Init Code OK !!\n"); | 2118 | usb_stor_dbg(us, "MS Init Code OK !!\n"); |
2108 | } else { | 2119 | } else { |
2109 | usb_stor_dbg(us, "MS Card Not Ready --- %x\n", buf[0]); | 2120 | usb_stor_dbg(us, "MS Card Not Ready --- %x\n", bbuf[0]); |
2110 | return USB_STOR_TRANSPORT_ERROR; | 2121 | return USB_STOR_TRANSPORT_ERROR; |
2111 | } | 2122 | } |
2112 | 2123 | ||
@@ -2116,9 +2127,9 @@ static int ene_ms_init(struct us_data *us) | |||
2116 | static int ene_sd_init(struct us_data *us) | 2127 | static int ene_sd_init(struct us_data *us) |
2117 | { | 2128 | { |
2118 | int result; | 2129 | int result; |
2119 | u8 buf[0x200]; | ||
2120 | struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; | 2130 | struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; |
2121 | struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; | 2131 | struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; |
2132 | u8 *bbuf = info->bbuf; | ||
2122 | 2133 | ||
2123 | usb_stor_dbg(us, "transport --- ENE_SDInit\n"); | 2134 | usb_stor_dbg(us, "transport --- ENE_SDInit\n"); |
2124 | /* SD Init Part-1 */ | 2135 | /* SD Init Part-1 */ |
@@ -2152,17 +2163,17 @@ static int ene_sd_init(struct us_data *us) | |||
2152 | bcb->Flags = US_BULK_FLAG_IN; | 2163 | bcb->Flags = US_BULK_FLAG_IN; |
2153 | bcb->CDB[0] = 0xF1; | 2164 | bcb->CDB[0] = 0xF1; |
2154 | 2165 | ||
2155 | result = ene_send_scsi_cmd(us, FDIR_READ, &buf, 0); | 2166 | result = ene_send_scsi_cmd(us, FDIR_READ, bbuf, 0); |
2156 | if (result != USB_STOR_XFER_GOOD) { | 2167 | if (result != USB_STOR_XFER_GOOD) { |
2157 | usb_stor_dbg(us, "Execution SD Init Code Fail !!\n"); | 2168 | usb_stor_dbg(us, "Execution SD Init Code Fail !!\n"); |
2158 | return USB_STOR_TRANSPORT_ERROR; | 2169 | return USB_STOR_TRANSPORT_ERROR; |
2159 | } | 2170 | } |
2160 | 2171 | ||
2161 | info->SD_Status = *(struct SD_STATUS *)&buf[0]; | 2172 | info->SD_Status = *(struct SD_STATUS *) bbuf; |
2162 | if (info->SD_Status.Insert && info->SD_Status.Ready) { | 2173 | if (info->SD_Status.Insert && info->SD_Status.Ready) { |
2163 | struct SD_STATUS *s = &info->SD_Status; | 2174 | struct SD_STATUS *s = &info->SD_Status; |
2164 | 2175 | ||
2165 | ene_get_card_status(us, (unsigned char *)&buf); | 2176 | ene_get_card_status(us, bbuf); |
2166 | usb_stor_dbg(us, "Insert = %x\n", s->Insert); | 2177 | usb_stor_dbg(us, "Insert = %x\n", s->Insert); |
2167 | usb_stor_dbg(us, "Ready = %x\n", s->Ready); | 2178 | usb_stor_dbg(us, "Ready = %x\n", s->Ready); |
2168 | usb_stor_dbg(us, "IsMMC = %x\n", s->IsMMC); | 2179 | usb_stor_dbg(us, "IsMMC = %x\n", s->IsMMC); |
@@ -2170,7 +2181,7 @@ static int ene_sd_init(struct us_data *us) | |||
2170 | usb_stor_dbg(us, "HiSpeed = %x\n", s->HiSpeed); | 2181 | usb_stor_dbg(us, "HiSpeed = %x\n", s->HiSpeed); |
2171 | usb_stor_dbg(us, "WtP = %x\n", s->WtP); | 2182 | usb_stor_dbg(us, "WtP = %x\n", s->WtP); |
2172 | } else { | 2183 | } else { |
2173 | usb_stor_dbg(us, "SD Card Not Ready --- %x\n", buf[0]); | 2184 | usb_stor_dbg(us, "SD Card Not Ready --- %x\n", bbuf[0]); |
2174 | return USB_STOR_TRANSPORT_ERROR; | 2185 | return USB_STOR_TRANSPORT_ERROR; |
2175 | } | 2186 | } |
2176 | return USB_STOR_TRANSPORT_GOOD; | 2187 | return USB_STOR_TRANSPORT_GOOD; |
@@ -2180,13 +2191,15 @@ static int ene_sd_init(struct us_data *us) | |||
2180 | static int ene_init(struct us_data *us) | 2191 | static int ene_init(struct us_data *us) |
2181 | { | 2192 | { |
2182 | int result; | 2193 | int result; |
2183 | u8 misc_reg03 = 0; | 2194 | u8 misc_reg03; |
2184 | struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); | 2195 | struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); |
2196 | u8 *bbuf = info->bbuf; | ||
2185 | 2197 | ||
2186 | result = ene_get_card_type(us, REG_CARD_STATUS, &misc_reg03); | 2198 | result = ene_get_card_type(us, REG_CARD_STATUS, bbuf); |
2187 | if (result != USB_STOR_XFER_GOOD) | 2199 | if (result != USB_STOR_XFER_GOOD) |
2188 | return USB_STOR_TRANSPORT_ERROR; | 2200 | return USB_STOR_TRANSPORT_ERROR; |
2189 | 2201 | ||
2202 | misc_reg03 = bbuf[0]; | ||
2190 | if (misc_reg03 & 0x01) { | 2203 | if (misc_reg03 & 0x01) { |
2191 | if (!info->SD_Status.Ready) { | 2204 | if (!info->SD_Status.Ready) { |
2192 | result = ene_sd_init(us); | 2205 | result = ene_sd_init(us); |
@@ -2303,8 +2316,9 @@ static int ene_ub6250_probe(struct usb_interface *intf, | |||
2303 | const struct usb_device_id *id) | 2316 | const struct usb_device_id *id) |
2304 | { | 2317 | { |
2305 | int result; | 2318 | int result; |
2306 | u8 misc_reg03 = 0; | 2319 | u8 misc_reg03; |
2307 | struct us_data *us; | 2320 | struct us_data *us; |
2321 | struct ene_ub6250_info *info; | ||
2308 | 2322 | ||
2309 | result = usb_stor_probe1(&us, intf, id, | 2323 | result = usb_stor_probe1(&us, intf, id, |
2310 | (id - ene_ub6250_usb_ids) + ene_ub6250_unusual_dev_list, | 2324 | (id - ene_ub6250_usb_ids) + ene_ub6250_unusual_dev_list, |
@@ -2313,11 +2327,16 @@ static int ene_ub6250_probe(struct usb_interface *intf, | |||
2313 | return result; | 2327 | return result; |
2314 | 2328 | ||
2315 | /* FIXME: where should the code alloc extra buf ? */ | 2329 | /* FIXME: where should the code alloc extra buf ? */ |
2316 | if (!us->extra) { | 2330 | us->extra = kzalloc(sizeof(struct ene_ub6250_info), GFP_KERNEL); |
2317 | us->extra = kzalloc(sizeof(struct ene_ub6250_info), GFP_KERNEL); | 2331 | if (!us->extra) |
2318 | if (!us->extra) | 2332 | return -ENOMEM; |
2319 | return -ENOMEM; | 2333 | us->extra_destructor = ene_ub6250_info_destructor; |
2320 | us->extra_destructor = ene_ub6250_info_destructor; | 2334 | |
2335 | info = (struct ene_ub6250_info *)(us->extra); | ||
2336 | info->bbuf = kmalloc(512, GFP_KERNEL); | ||
2337 | if (!info->bbuf) { | ||
2338 | kfree(us->extra); | ||
2339 | return -ENOMEM; | ||
2321 | } | 2340 | } |
2322 | 2341 | ||
2323 | us->transport_name = "ene_ub6250"; | 2342 | us->transport_name = "ene_ub6250"; |
@@ -2329,12 +2348,13 @@ static int ene_ub6250_probe(struct usb_interface *intf, | |||
2329 | return result; | 2348 | return result; |
2330 | 2349 | ||
2331 | /* probe card type */ | 2350 | /* probe card type */ |
2332 | result = ene_get_card_type(us, REG_CARD_STATUS, &misc_reg03); | 2351 | result = ene_get_card_type(us, REG_CARD_STATUS, info->bbuf); |
2333 | if (result != USB_STOR_XFER_GOOD) { | 2352 | if (result != USB_STOR_XFER_GOOD) { |
2334 | usb_stor_disconnect(intf); | 2353 | usb_stor_disconnect(intf); |
2335 | return USB_STOR_TRANSPORT_ERROR; | 2354 | return USB_STOR_TRANSPORT_ERROR; |
2336 | } | 2355 | } |
2337 | 2356 | ||
2357 | misc_reg03 = info->bbuf[0]; | ||
2338 | if (!(misc_reg03 & 0x01)) { | 2358 | if (!(misc_reg03 & 0x01)) { |
2339 | pr_info("ums_eneub6250: This driver only supports SD/MS cards. " | 2359 | pr_info("ums_eneub6250: This driver only supports SD/MS cards. " |
2340 | "It does not support SM cards.\n"); | 2360 | "It does not support SM cards.\n"); |
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c index 5d8b2c261940..0585078638db 100644 --- a/drivers/usb/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c | |||
@@ -235,14 +235,19 @@ done: | |||
235 | 235 | ||
236 | static inline void hub_descriptor(struct usb_hub_descriptor *desc) | 236 | static inline void hub_descriptor(struct usb_hub_descriptor *desc) |
237 | { | 237 | { |
238 | int width; | ||
239 | |||
238 | memset(desc, 0, sizeof(*desc)); | 240 | memset(desc, 0, sizeof(*desc)); |
239 | desc->bDescriptorType = USB_DT_HUB; | 241 | desc->bDescriptorType = USB_DT_HUB; |
240 | desc->bDescLength = 9; | ||
241 | desc->wHubCharacteristics = cpu_to_le16( | 242 | desc->wHubCharacteristics = cpu_to_le16( |
242 | HUB_CHAR_INDV_PORT_LPSM | HUB_CHAR_COMMON_OCPM); | 243 | HUB_CHAR_INDV_PORT_LPSM | HUB_CHAR_COMMON_OCPM); |
244 | |||
243 | desc->bNbrPorts = VHCI_HC_PORTS; | 245 | desc->bNbrPorts = VHCI_HC_PORTS; |
244 | desc->u.hs.DeviceRemovable[0] = 0xff; | 246 | BUILD_BUG_ON(VHCI_HC_PORTS > USB_MAXCHILDREN); |
245 | desc->u.hs.DeviceRemovable[1] = 0xff; | 247 | width = desc->bNbrPorts / 8 + 1; |
248 | desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * width; | ||
249 | memset(&desc->u.hs.DeviceRemovable[0], 0, width); | ||
250 | memset(&desc->u.hs.DeviceRemovable[width], 0xff, width); | ||
246 | } | 251 | } |
247 | 252 | ||
248 | static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | 253 | static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, |
diff --git a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c index 6345e85822a4..a50cf45e530f 100644 --- a/drivers/uwb/i1480/dfu/usb.c +++ b/drivers/uwb/i1480/dfu/usb.c | |||
@@ -341,6 +341,7 @@ error_submit_ep1: | |||
341 | static | 341 | static |
342 | int i1480_usb_probe(struct usb_interface *iface, const struct usb_device_id *id) | 342 | int i1480_usb_probe(struct usb_interface *iface, const struct usb_device_id *id) |
343 | { | 343 | { |
344 | struct usb_device *udev = interface_to_usbdev(iface); | ||
344 | struct i1480_usb *i1480_usb; | 345 | struct i1480_usb *i1480_usb; |
345 | struct i1480 *i1480; | 346 | struct i1480 *i1480; |
346 | struct device *dev = &iface->dev; | 347 | struct device *dev = &iface->dev; |
@@ -352,8 +353,8 @@ int i1480_usb_probe(struct usb_interface *iface, const struct usb_device_id *id) | |||
352 | iface->cur_altsetting->desc.bInterfaceNumber); | 353 | iface->cur_altsetting->desc.bInterfaceNumber); |
353 | goto error; | 354 | goto error; |
354 | } | 355 | } |
355 | if (iface->num_altsetting > 1 | 356 | if (iface->num_altsetting > 1 && |
356 | && interface_to_usbdev(iface)->descriptor.idProduct == 0xbabe) { | 357 | le16_to_cpu(udev->descriptor.idProduct) == 0xbabe) { |
357 | /* Need altsetting #1 [HW QUIRK] or EP1 won't work */ | 358 | /* Need altsetting #1 [HW QUIRK] or EP1 won't work */ |
358 | result = usb_set_interface(interface_to_usbdev(iface), 0, 1); | 359 | result = usb_set_interface(interface_to_usbdev(iface), 0, 1); |
359 | if (result < 0) | 360 | if (result < 0) |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 52a70ee6014f..8b9049dac094 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -452,7 +452,7 @@ config DAVINCI_WATCHDOG | |||
452 | 452 | ||
453 | config ORION_WATCHDOG | 453 | config ORION_WATCHDOG |
454 | tristate "Orion watchdog" | 454 | tristate "Orion watchdog" |
455 | depends on ARCH_ORION5X || ARCH_DOVE || MACH_DOVE || ARCH_MVEBU || COMPILE_TEST | 455 | depends on ARCH_ORION5X || ARCH_DOVE || MACH_DOVE || ARCH_MVEBU || (COMPILE_TEST && !ARCH_EBSA110) |
456 | depends on ARM | 456 | depends on ARM |
457 | select WATCHDOG_CORE | 457 | select WATCHDOG_CORE |
458 | help | 458 | help |
diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c index 6fce17d5b9f1..a5775dfd8d5f 100644 --- a/drivers/watchdog/bcm_kona_wdt.c +++ b/drivers/watchdog/bcm_kona_wdt.c | |||
@@ -304,6 +304,8 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev) | |||
304 | if (!wdt) | 304 | if (!wdt) |
305 | return -ENOMEM; | 305 | return -ENOMEM; |
306 | 306 | ||
307 | spin_lock_init(&wdt->lock); | ||
308 | |||
307 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 309 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
308 | wdt->base = devm_ioremap_resource(dev, res); | 310 | wdt->base = devm_ioremap_resource(dev, res); |
309 | if (IS_ERR(wdt->base)) | 311 | if (IS_ERR(wdt->base)) |
@@ -316,7 +318,6 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev) | |||
316 | return ret; | 318 | return ret; |
317 | } | 319 | } |
318 | 320 | ||
319 | spin_lock_init(&wdt->lock); | ||
320 | platform_set_drvdata(pdev, wdt); | 321 | platform_set_drvdata(pdev, wdt); |
321 | watchdog_set_drvdata(&bcm_kona_wdt_wdd, wdt); | 322 | watchdog_set_drvdata(&bcm_kona_wdt_wdd, wdt); |
322 | bcm_kona_wdt_wdd.parent = &pdev->dev; | 323 | bcm_kona_wdt_wdd.parent = &pdev->dev; |
diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c index 8d61e8bfe60b..86e0b5d2e761 100644 --- a/drivers/watchdog/cadence_wdt.c +++ b/drivers/watchdog/cadence_wdt.c | |||
@@ -49,7 +49,7 @@ | |||
49 | /* Counter maximum value */ | 49 | /* Counter maximum value */ |
50 | #define CDNS_WDT_COUNTER_MAX 0xFFF | 50 | #define CDNS_WDT_COUNTER_MAX 0xFFF |
51 | 51 | ||
52 | static int wdt_timeout = CDNS_WDT_DEFAULT_TIMEOUT; | 52 | static int wdt_timeout; |
53 | static int nowayout = WATCHDOG_NOWAYOUT; | 53 | static int nowayout = WATCHDOG_NOWAYOUT; |
54 | 54 | ||
55 | module_param(wdt_timeout, int, 0); | 55 | module_param(wdt_timeout, int, 0); |
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index 347f0389b089..c4f65873bfa4 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c | |||
@@ -306,16 +306,15 @@ static int iTCO_wdt_ping(struct watchdog_device *wd_dev) | |||
306 | 306 | ||
307 | iTCO_vendor_pre_keepalive(p->smi_res, wd_dev->timeout); | 307 | iTCO_vendor_pre_keepalive(p->smi_res, wd_dev->timeout); |
308 | 308 | ||
309 | /* Reset the timeout status bit so that the timer | ||
310 | * needs to count down twice again before rebooting */ | ||
311 | outw(0x0008, TCO1_STS(p)); /* write 1 to clear bit */ | ||
312 | |||
309 | /* Reload the timer by writing to the TCO Timer Counter register */ | 313 | /* Reload the timer by writing to the TCO Timer Counter register */ |
310 | if (p->iTCO_version >= 2) { | 314 | if (p->iTCO_version >= 2) |
311 | outw(0x01, TCO_RLD(p)); | 315 | outw(0x01, TCO_RLD(p)); |
312 | } else if (p->iTCO_version == 1) { | 316 | else if (p->iTCO_version == 1) |
313 | /* Reset the timeout status bit so that the timer | ||
314 | * needs to count down twice again before rebooting */ | ||
315 | outw(0x0008, TCO1_STS(p)); /* write 1 to clear bit */ | ||
316 | |||
317 | outb(0x01, TCO_RLD(p)); | 317 | outb(0x01, TCO_RLD(p)); |
318 | } | ||
319 | 318 | ||
320 | spin_unlock(&p->io_lock); | 319 | spin_unlock(&p->io_lock); |
321 | return 0; | 320 | return 0; |
@@ -328,11 +327,8 @@ static int iTCO_wdt_set_timeout(struct watchdog_device *wd_dev, unsigned int t) | |||
328 | unsigned char val8; | 327 | unsigned char val8; |
329 | unsigned int tmrval; | 328 | unsigned int tmrval; |
330 | 329 | ||
331 | tmrval = seconds_to_ticks(p, t); | 330 | /* The timer counts down twice before rebooting */ |
332 | 331 | tmrval = seconds_to_ticks(p, t) / 2; | |
333 | /* For TCO v1 the timer counts down twice before rebooting */ | ||
334 | if (p->iTCO_version == 1) | ||
335 | tmrval /= 2; | ||
336 | 332 | ||
337 | /* from the specs: */ | 333 | /* from the specs: */ |
338 | /* "Values of 0h-3h are ignored and should not be attempted" */ | 334 | /* "Values of 0h-3h are ignored and should not be attempted" */ |
@@ -385,6 +381,8 @@ static unsigned int iTCO_wdt_get_timeleft(struct watchdog_device *wd_dev) | |||
385 | spin_lock(&p->io_lock); | 381 | spin_lock(&p->io_lock); |
386 | val16 = inw(TCO_RLD(p)); | 382 | val16 = inw(TCO_RLD(p)); |
387 | val16 &= 0x3ff; | 383 | val16 &= 0x3ff; |
384 | if (!(inw(TCO1_STS(p)) & 0x0008)) | ||
385 | val16 += (inw(TCOv2_TMR(p)) & 0x3ff); | ||
388 | spin_unlock(&p->io_lock); | 386 | spin_unlock(&p->io_lock); |
389 | 387 | ||
390 | time_left = ticks_to_seconds(p, val16); | 388 | time_left = ticks_to_seconds(p, val16); |
diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c index 99ebf6ea3de6..5615f4013924 100644 --- a/drivers/watchdog/pcwd_usb.c +++ b/drivers/watchdog/pcwd_usb.c | |||
@@ -630,6 +630,9 @@ static int usb_pcwd_probe(struct usb_interface *interface, | |||
630 | return -ENODEV; | 630 | return -ENODEV; |
631 | } | 631 | } |
632 | 632 | ||
633 | if (iface_desc->desc.bNumEndpoints < 1) | ||
634 | return -ENODEV; | ||
635 | |||
633 | /* check out the endpoint: it has to be Interrupt & IN */ | 636 | /* check out the endpoint: it has to be Interrupt & IN */ |
634 | endpoint = &iface_desc->endpoint[0].desc; | 637 | endpoint = &iface_desc->endpoint[0].desc; |
635 | 638 | ||
diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c index f709962018ac..362fd229786d 100644 --- a/drivers/watchdog/sama5d4_wdt.c +++ b/drivers/watchdog/sama5d4_wdt.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * Licensed under GPLv2. | 6 | * Licensed under GPLv2. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/delay.h> | ||
9 | #include <linux/interrupt.h> | 10 | #include <linux/interrupt.h> |
10 | #include <linux/io.h> | 11 | #include <linux/io.h> |
11 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
@@ -29,6 +30,7 @@ struct sama5d4_wdt { | |||
29 | struct watchdog_device wdd; | 30 | struct watchdog_device wdd; |
30 | void __iomem *reg_base; | 31 | void __iomem *reg_base; |
31 | u32 mr; | 32 | u32 mr; |
33 | unsigned long last_ping; | ||
32 | }; | 34 | }; |
33 | 35 | ||
34 | static int wdt_timeout = WDT_DEFAULT_TIMEOUT; | 36 | static int wdt_timeout = WDT_DEFAULT_TIMEOUT; |
@@ -44,11 +46,34 @@ MODULE_PARM_DESC(nowayout, | |||
44 | "Watchdog cannot be stopped once started (default=" | 46 | "Watchdog cannot be stopped once started (default=" |
45 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 47 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
46 | 48 | ||
49 | #define wdt_enabled (!(wdt->mr & AT91_WDT_WDDIS)) | ||
50 | |||
47 | #define wdt_read(wdt, field) \ | 51 | #define wdt_read(wdt, field) \ |
48 | readl_relaxed((wdt)->reg_base + (field)) | 52 | readl_relaxed((wdt)->reg_base + (field)) |
49 | 53 | ||
50 | #define wdt_write(wtd, field, val) \ | 54 | /* 4 slow clock periods is 4/32768 = 122.07µs*/ |
51 | writel_relaxed((val), (wdt)->reg_base + (field)) | 55 | #define WDT_DELAY usecs_to_jiffies(123) |
56 | |||
57 | static void wdt_write(struct sama5d4_wdt *wdt, u32 field, u32 val) | ||
58 | { | ||
59 | /* | ||
60 | * WDT_CR and WDT_MR must not be modified within three slow clock | ||
61 | * periods following a restart of the watchdog performed by a write | ||
62 | * access in WDT_CR. | ||
63 | */ | ||
64 | while (time_before(jiffies, wdt->last_ping + WDT_DELAY)) | ||
65 | usleep_range(30, 125); | ||
66 | writel_relaxed(val, wdt->reg_base + field); | ||
67 | wdt->last_ping = jiffies; | ||
68 | } | ||
69 | |||
70 | static void wdt_write_nosleep(struct sama5d4_wdt *wdt, u32 field, u32 val) | ||
71 | { | ||
72 | if (time_before(jiffies, wdt->last_ping + WDT_DELAY)) | ||
73 | udelay(123); | ||
74 | writel_relaxed(val, wdt->reg_base + field); | ||
75 | wdt->last_ping = jiffies; | ||
76 | } | ||
52 | 77 | ||
53 | static int sama5d4_wdt_start(struct watchdog_device *wdd) | 78 | static int sama5d4_wdt_start(struct watchdog_device *wdd) |
54 | { | 79 | { |
@@ -89,7 +114,16 @@ static int sama5d4_wdt_set_timeout(struct watchdog_device *wdd, | |||
89 | wdt->mr &= ~AT91_WDT_WDD; | 114 | wdt->mr &= ~AT91_WDT_WDD; |
90 | wdt->mr |= AT91_WDT_SET_WDV(value); | 115 | wdt->mr |= AT91_WDT_SET_WDV(value); |
91 | wdt->mr |= AT91_WDT_SET_WDD(value); | 116 | wdt->mr |= AT91_WDT_SET_WDD(value); |
92 | wdt_write(wdt, AT91_WDT_MR, wdt->mr); | 117 | |
118 | /* | ||
119 | * WDDIS has to be 0 when updating WDD/WDV. The datasheet states: When | ||
120 | * setting the WDDIS bit, and while it is set, the fields WDV and WDD | ||
121 | * must not be modified. | ||
122 | * If the watchdog is enabled, then the timeout can be updated. Else, | ||
123 | * wait that the user enables it. | ||
124 | */ | ||
125 | if (wdt_enabled) | ||
126 | wdt_write(wdt, AT91_WDT_MR, wdt->mr & ~AT91_WDT_WDDIS); | ||
93 | 127 | ||
94 | wdd->timeout = timeout; | 128 | wdd->timeout = timeout; |
95 | 129 | ||
@@ -145,23 +179,21 @@ static int of_sama5d4_wdt_init(struct device_node *np, struct sama5d4_wdt *wdt) | |||
145 | 179 | ||
146 | static int sama5d4_wdt_init(struct sama5d4_wdt *wdt) | 180 | static int sama5d4_wdt_init(struct sama5d4_wdt *wdt) |
147 | { | 181 | { |
148 | struct watchdog_device *wdd = &wdt->wdd; | ||
149 | u32 value = WDT_SEC2TICKS(wdd->timeout); | ||
150 | u32 reg; | 182 | u32 reg; |
151 | |||
152 | /* | 183 | /* |
153 | * Because the fields WDV and WDD must not be modified when the WDDIS | 184 | * When booting and resuming, the bootloader may have changed the |
154 | * bit is set, so clear the WDDIS bit before writing the WDT_MR. | 185 | * watchdog configuration. |
186 | * If the watchdog is already running, we can safely update it. | ||
187 | * Else, we have to disable it properly. | ||
155 | */ | 188 | */ |
156 | reg = wdt_read(wdt, AT91_WDT_MR); | 189 | if (wdt_enabled) { |
157 | reg &= ~AT91_WDT_WDDIS; | 190 | wdt_write_nosleep(wdt, AT91_WDT_MR, wdt->mr); |
158 | wdt_write(wdt, AT91_WDT_MR, reg); | 191 | } else { |
159 | 192 | reg = wdt_read(wdt, AT91_WDT_MR); | |
160 | wdt->mr |= AT91_WDT_SET_WDD(value); | 193 | if (!(reg & AT91_WDT_WDDIS)) |
161 | wdt->mr |= AT91_WDT_SET_WDV(value); | 194 | wdt_write_nosleep(wdt, AT91_WDT_MR, |
162 | 195 | reg | AT91_WDT_WDDIS); | |
163 | wdt_write(wdt, AT91_WDT_MR, wdt->mr); | 196 | } |
164 | |||
165 | return 0; | 197 | return 0; |
166 | } | 198 | } |
167 | 199 | ||
@@ -172,6 +204,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev) | |||
172 | struct resource *res; | 204 | struct resource *res; |
173 | void __iomem *regs; | 205 | void __iomem *regs; |
174 | u32 irq = 0; | 206 | u32 irq = 0; |
207 | u32 timeout; | ||
175 | int ret; | 208 | int ret; |
176 | 209 | ||
177 | wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); | 210 | wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); |
@@ -184,6 +217,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev) | |||
184 | wdd->ops = &sama5d4_wdt_ops; | 217 | wdd->ops = &sama5d4_wdt_ops; |
185 | wdd->min_timeout = MIN_WDT_TIMEOUT; | 218 | wdd->min_timeout = MIN_WDT_TIMEOUT; |
186 | wdd->max_timeout = MAX_WDT_TIMEOUT; | 219 | wdd->max_timeout = MAX_WDT_TIMEOUT; |
220 | wdt->last_ping = jiffies; | ||
187 | 221 | ||
188 | watchdog_set_drvdata(wdd, wdt); | 222 | watchdog_set_drvdata(wdd, wdt); |
189 | 223 | ||
@@ -221,6 +255,11 @@ static int sama5d4_wdt_probe(struct platform_device *pdev) | |||
221 | return ret; | 255 | return ret; |
222 | } | 256 | } |
223 | 257 | ||
258 | timeout = WDT_SEC2TICKS(wdd->timeout); | ||
259 | |||
260 | wdt->mr |= AT91_WDT_SET_WDD(timeout); | ||
261 | wdt->mr |= AT91_WDT_SET_WDV(timeout); | ||
262 | |||
224 | ret = sama5d4_wdt_init(wdt); | 263 | ret = sama5d4_wdt_init(wdt); |
225 | if (ret) | 264 | if (ret) |
226 | return ret; | 265 | return ret; |
@@ -263,9 +302,7 @@ static int sama5d4_wdt_resume(struct device *dev) | |||
263 | { | 302 | { |
264 | struct sama5d4_wdt *wdt = dev_get_drvdata(dev); | 303 | struct sama5d4_wdt *wdt = dev_get_drvdata(dev); |
265 | 304 | ||
266 | wdt_write(wdt, AT91_WDT_MR, wdt->mr & ~AT91_WDT_WDDIS); | 305 | sama5d4_wdt_init(wdt); |
267 | if (wdt->mr & AT91_WDT_WDDIS) | ||
268 | wdt_write(wdt, AT91_WDT_MR, wdt->mr); | ||
269 | 306 | ||
270 | return 0; | 307 | return 0; |
271 | } | 308 | } |
diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c index 48b2c058b009..bc7addc2dc06 100644 --- a/drivers/watchdog/wdt_pci.c +++ b/drivers/watchdog/wdt_pci.c | |||
@@ -332,7 +332,7 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id) | |||
332 | pr_crit("Would Reboot\n"); | 332 | pr_crit("Would Reboot\n"); |
333 | #else | 333 | #else |
334 | pr_crit("Initiating system reboot\n"); | 334 | pr_crit("Initiating system reboot\n"); |
335 | emergency_restart(NULL); | 335 | emergency_restart(); |
336 | #endif | 336 | #endif |
337 | #else | 337 | #else |
338 | pr_crit("Reset in 5ms\n"); | 338 | pr_crit("Reset in 5ms\n"); |
diff --git a/drivers/watchdog/zx2967_wdt.c b/drivers/watchdog/zx2967_wdt.c index e290d5a13a6d..c98252733c30 100644 --- a/drivers/watchdog/zx2967_wdt.c +++ b/drivers/watchdog/zx2967_wdt.c | |||
@@ -211,10 +211,8 @@ static int zx2967_wdt_probe(struct platform_device *pdev) | |||
211 | 211 | ||
212 | base = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 212 | base = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
213 | wdt->reg_base = devm_ioremap_resource(dev, base); | 213 | wdt->reg_base = devm_ioremap_resource(dev, base); |
214 | if (IS_ERR(wdt->reg_base)) { | 214 | if (IS_ERR(wdt->reg_base)) |
215 | dev_err(dev, "ioremap failed\n"); | ||
216 | return PTR_ERR(wdt->reg_base); | 215 | return PTR_ERR(wdt->reg_base); |
217 | } | ||
218 | 216 | ||
219 | zx2967_wdt_reset_sysctrl(dev); | 217 | zx2967_wdt_reset_sysctrl(dev); |
220 | 218 | ||
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index 15bac390dff9..b98436f5c7c7 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c | |||
@@ -1135,20 +1135,19 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr, | |||
1135 | u32 acllen = 0; | 1135 | u32 acllen = 0; |
1136 | int rc = 0; | 1136 | int rc = 0; |
1137 | struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); | 1137 | struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); |
1138 | struct cifs_tcon *tcon; | 1138 | struct smb_version_operations *ops; |
1139 | 1139 | ||
1140 | cifs_dbg(NOISY, "converting ACL to mode for %s\n", path); | 1140 | cifs_dbg(NOISY, "converting ACL to mode for %s\n", path); |
1141 | 1141 | ||
1142 | if (IS_ERR(tlink)) | 1142 | if (IS_ERR(tlink)) |
1143 | return PTR_ERR(tlink); | 1143 | return PTR_ERR(tlink); |
1144 | tcon = tlink_tcon(tlink); | ||
1145 | 1144 | ||
1146 | if (pfid && (tcon->ses->server->ops->get_acl_by_fid)) | 1145 | ops = tlink_tcon(tlink)->ses->server->ops; |
1147 | pntsd = tcon->ses->server->ops->get_acl_by_fid(cifs_sb, pfid, | 1146 | |
1148 | &acllen); | 1147 | if (pfid && (ops->get_acl_by_fid)) |
1149 | else if (tcon->ses->server->ops->get_acl) | 1148 | pntsd = ops->get_acl_by_fid(cifs_sb, pfid, &acllen); |
1150 | pntsd = tcon->ses->server->ops->get_acl(cifs_sb, inode, path, | 1149 | else if (ops->get_acl) |
1151 | &acllen); | 1150 | pntsd = ops->get_acl(cifs_sb, inode, path, &acllen); |
1152 | else { | 1151 | else { |
1153 | cifs_put_tlink(tlink); | 1152 | cifs_put_tlink(tlink); |
1154 | return -EOPNOTSUPP; | 1153 | return -EOPNOTSUPP; |
@@ -1181,23 +1180,23 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode, | |||
1181 | struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */ | 1180 | struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */ |
1182 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 1181 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
1183 | struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); | 1182 | struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); |
1184 | struct cifs_tcon *tcon; | 1183 | struct smb_version_operations *ops; |
1185 | 1184 | ||
1186 | if (IS_ERR(tlink)) | 1185 | if (IS_ERR(tlink)) |
1187 | return PTR_ERR(tlink); | 1186 | return PTR_ERR(tlink); |
1188 | tcon = tlink_tcon(tlink); | 1187 | |
1188 | ops = tlink_tcon(tlink)->ses->server->ops; | ||
1189 | 1189 | ||
1190 | cifs_dbg(NOISY, "set ACL from mode for %s\n", path); | 1190 | cifs_dbg(NOISY, "set ACL from mode for %s\n", path); |
1191 | 1191 | ||
1192 | /* Get the security descriptor */ | 1192 | /* Get the security descriptor */ |
1193 | 1193 | ||
1194 | if (tcon->ses->server->ops->get_acl == NULL) { | 1194 | if (ops->get_acl == NULL) { |
1195 | cifs_put_tlink(tlink); | 1195 | cifs_put_tlink(tlink); |
1196 | return -EOPNOTSUPP; | 1196 | return -EOPNOTSUPP; |
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | pntsd = tcon->ses->server->ops->get_acl(cifs_sb, inode, path, | 1199 | pntsd = ops->get_acl(cifs_sb, inode, path, &secdesclen); |
1200 | &secdesclen); | ||
1201 | if (IS_ERR(pntsd)) { | 1200 | if (IS_ERR(pntsd)) { |
1202 | rc = PTR_ERR(pntsd); | 1201 | rc = PTR_ERR(pntsd); |
1203 | cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc); | 1202 | cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc); |
@@ -1224,13 +1223,12 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode, | |||
1224 | 1223 | ||
1225 | cifs_dbg(NOISY, "build_sec_desc rc: %d\n", rc); | 1224 | cifs_dbg(NOISY, "build_sec_desc rc: %d\n", rc); |
1226 | 1225 | ||
1227 | if (tcon->ses->server->ops->set_acl == NULL) | 1226 | if (ops->set_acl == NULL) |
1228 | rc = -EOPNOTSUPP; | 1227 | rc = -EOPNOTSUPP; |
1229 | 1228 | ||
1230 | if (!rc) { | 1229 | if (!rc) { |
1231 | /* Set the security descriptor */ | 1230 | /* Set the security descriptor */ |
1232 | rc = tcon->ses->server->ops->set_acl(pnntsd, secdesclen, inode, | 1231 | rc = ops->set_acl(pnntsd, secdesclen, inode, path, aclflag); |
1233 | path, aclflag); | ||
1234 | cifs_dbg(NOISY, "set_cifs_acl rc: %d\n", rc); | 1232 | cifs_dbg(NOISY, "set_cifs_acl rc: %d\n", rc); |
1235 | } | 1233 | } |
1236 | cifs_put_tlink(tlink); | 1234 | cifs_put_tlink(tlink); |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 8be55be70faf..bcc7d9acad64 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -418,7 +418,7 @@ struct smb_version_operations { | |||
418 | int (*validate_negotiate)(const unsigned int, struct cifs_tcon *); | 418 | int (*validate_negotiate)(const unsigned int, struct cifs_tcon *); |
419 | ssize_t (*query_all_EAs)(const unsigned int, struct cifs_tcon *, | 419 | ssize_t (*query_all_EAs)(const unsigned int, struct cifs_tcon *, |
420 | const unsigned char *, const unsigned char *, char *, | 420 | const unsigned char *, const unsigned char *, char *, |
421 | size_t, const struct nls_table *, int); | 421 | size_t, struct cifs_sb_info *); |
422 | int (*set_EA)(const unsigned int, struct cifs_tcon *, const char *, | 422 | int (*set_EA)(const unsigned int, struct cifs_tcon *, const char *, |
423 | const char *, const void *, const __u16, | 423 | const char *, const void *, const __u16, |
424 | const struct nls_table *, int); | 424 | const struct nls_table *, int); |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index e49958c3f8bb..6eb3147132e3 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -480,8 +480,7 @@ extern int CIFSSMBCopy(unsigned int xid, | |||
480 | extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon, | 480 | extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon, |
481 | const unsigned char *searchName, | 481 | const unsigned char *searchName, |
482 | const unsigned char *ea_name, char *EAData, | 482 | const unsigned char *ea_name, char *EAData, |
483 | size_t bufsize, const struct nls_table *nls_codepage, | 483 | size_t bufsize, struct cifs_sb_info *cifs_sb); |
484 | int remap_special_chars); | ||
485 | extern int CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon, | 484 | extern int CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon, |
486 | const char *fileName, const char *ea_name, | 485 | const char *fileName, const char *ea_name, |
487 | const void *ea_value, const __u16 ea_value_len, | 486 | const void *ea_value, const __u16 ea_value_len, |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 4c01b3f9abf0..fbb0d4cbda41 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -697,9 +697,7 @@ cifs_echo_callback(struct mid_q_entry *mid) | |||
697 | { | 697 | { |
698 | struct TCP_Server_Info *server = mid->callback_data; | 698 | struct TCP_Server_Info *server = mid->callback_data; |
699 | 699 | ||
700 | mutex_lock(&server->srv_mutex); | ||
701 | DeleteMidQEntry(mid); | 700 | DeleteMidQEntry(mid); |
702 | mutex_unlock(&server->srv_mutex); | ||
703 | add_credits(server, 1, CIFS_ECHO_OP); | 701 | add_credits(server, 1, CIFS_ECHO_OP); |
704 | } | 702 | } |
705 | 703 | ||
@@ -1599,9 +1597,7 @@ cifs_readv_callback(struct mid_q_entry *mid) | |||
1599 | } | 1597 | } |
1600 | 1598 | ||
1601 | queue_work(cifsiod_wq, &rdata->work); | 1599 | queue_work(cifsiod_wq, &rdata->work); |
1602 | mutex_lock(&server->srv_mutex); | ||
1603 | DeleteMidQEntry(mid); | 1600 | DeleteMidQEntry(mid); |
1604 | mutex_unlock(&server->srv_mutex); | ||
1605 | add_credits(server, 1, 0); | 1601 | add_credits(server, 1, 0); |
1606 | } | 1602 | } |
1607 | 1603 | ||
@@ -2058,7 +2054,6 @@ cifs_writev_callback(struct mid_q_entry *mid) | |||
2058 | { | 2054 | { |
2059 | struct cifs_writedata *wdata = mid->callback_data; | 2055 | struct cifs_writedata *wdata = mid->callback_data; |
2060 | struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink); | 2056 | struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink); |
2061 | struct TCP_Server_Info *server = tcon->ses->server; | ||
2062 | unsigned int written; | 2057 | unsigned int written; |
2063 | WRITE_RSP *smb = (WRITE_RSP *)mid->resp_buf; | 2058 | WRITE_RSP *smb = (WRITE_RSP *)mid->resp_buf; |
2064 | 2059 | ||
@@ -2095,9 +2090,7 @@ cifs_writev_callback(struct mid_q_entry *mid) | |||
2095 | } | 2090 | } |
2096 | 2091 | ||
2097 | queue_work(cifsiod_wq, &wdata->work); | 2092 | queue_work(cifsiod_wq, &wdata->work); |
2098 | mutex_lock(&server->srv_mutex); | ||
2099 | DeleteMidQEntry(mid); | 2093 | DeleteMidQEntry(mid); |
2100 | mutex_unlock(&server->srv_mutex); | ||
2101 | add_credits(tcon->ses->server, 1, 0); | 2094 | add_credits(tcon->ses->server, 1, 0); |
2102 | } | 2095 | } |
2103 | 2096 | ||
@@ -6076,11 +6069,13 @@ ssize_t | |||
6076 | CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon, | 6069 | CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon, |
6077 | const unsigned char *searchName, const unsigned char *ea_name, | 6070 | const unsigned char *searchName, const unsigned char *ea_name, |
6078 | char *EAData, size_t buf_size, | 6071 | char *EAData, size_t buf_size, |
6079 | const struct nls_table *nls_codepage, int remap) | 6072 | struct cifs_sb_info *cifs_sb) |
6080 | { | 6073 | { |
6081 | /* BB assumes one setup word */ | 6074 | /* BB assumes one setup word */ |
6082 | TRANSACTION2_QPI_REQ *pSMB = NULL; | 6075 | TRANSACTION2_QPI_REQ *pSMB = NULL; |
6083 | TRANSACTION2_QPI_RSP *pSMBr = NULL; | 6076 | TRANSACTION2_QPI_RSP *pSMBr = NULL; |
6077 | int remap = cifs_remap(cifs_sb); | ||
6078 | struct nls_table *nls_codepage = cifs_sb->local_nls; | ||
6084 | int rc = 0; | 6079 | int rc = 0; |
6085 | int bytes_returned; | 6080 | int bytes_returned; |
6086 | int list_len; | 6081 | int list_len; |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 6ef78ad838e6..0fd081bd2a2f 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -582,7 +582,7 @@ cifs_relock_file(struct cifsFileInfo *cfile) | |||
582 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 582 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
583 | int rc = 0; | 583 | int rc = 0; |
584 | 584 | ||
585 | down_read(&cinode->lock_sem); | 585 | down_read_nested(&cinode->lock_sem, SINGLE_DEPTH_NESTING); |
586 | if (cinode->can_cache_brlcks) { | 586 | if (cinode->can_cache_brlcks) { |
587 | /* can cache locks - no need to relock */ | 587 | /* can cache locks - no need to relock */ |
588 | up_read(&cinode->lock_sem); | 588 | up_read(&cinode->lock_sem); |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index c3b2fa0b2ec8..4d1fcd76d022 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -563,8 +563,7 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path, | |||
563 | 563 | ||
564 | rc = tcon->ses->server->ops->query_all_EAs(xid, tcon, path, | 564 | rc = tcon->ses->server->ops->query_all_EAs(xid, tcon, path, |
565 | "SETFILEBITS", ea_value, 4 /* size of buf */, | 565 | "SETFILEBITS", ea_value, 4 /* size of buf */, |
566 | cifs_sb->local_nls, | 566 | cifs_sb); |
567 | cifs_remap(cifs_sb)); | ||
568 | cifs_put_tlink(tlink); | 567 | cifs_put_tlink(tlink); |
569 | if (rc < 0) | 568 | if (rc < 0) |
570 | return (int)rc; | 569 | return (int)rc; |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 48ff7703b919..e4afdaae743f 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -1240,15 +1240,19 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree, | |||
1240 | goto tcon_exit; | 1240 | goto tcon_exit; |
1241 | } | 1241 | } |
1242 | 1242 | ||
1243 | if (rsp->ShareType & SMB2_SHARE_TYPE_DISK) | 1243 | switch (rsp->ShareType) { |
1244 | case SMB2_SHARE_TYPE_DISK: | ||
1244 | cifs_dbg(FYI, "connection to disk share\n"); | 1245 | cifs_dbg(FYI, "connection to disk share\n"); |
1245 | else if (rsp->ShareType & SMB2_SHARE_TYPE_PIPE) { | 1246 | break; |
1247 | case SMB2_SHARE_TYPE_PIPE: | ||
1246 | tcon->ipc = true; | 1248 | tcon->ipc = true; |
1247 | cifs_dbg(FYI, "connection to pipe share\n"); | 1249 | cifs_dbg(FYI, "connection to pipe share\n"); |
1248 | } else if (rsp->ShareType & SMB2_SHARE_TYPE_PRINT) { | 1250 | break; |
1249 | tcon->print = true; | 1251 | case SMB2_SHARE_TYPE_PRINT: |
1252 | tcon->ipc = true; | ||
1250 | cifs_dbg(FYI, "connection to printer\n"); | 1253 | cifs_dbg(FYI, "connection to printer\n"); |
1251 | } else { | 1254 | break; |
1255 | default: | ||
1252 | cifs_dbg(VFS, "unknown share type %d\n", rsp->ShareType); | 1256 | cifs_dbg(VFS, "unknown share type %d\n", rsp->ShareType); |
1253 | rc = -EOPNOTSUPP; | 1257 | rc = -EOPNOTSUPP; |
1254 | goto tcon_error_exit; | 1258 | goto tcon_error_exit; |
@@ -2173,9 +2177,7 @@ smb2_echo_callback(struct mid_q_entry *mid) | |||
2173 | if (mid->mid_state == MID_RESPONSE_RECEIVED) | 2177 | if (mid->mid_state == MID_RESPONSE_RECEIVED) |
2174 | credits_received = le16_to_cpu(rsp->hdr.sync_hdr.CreditRequest); | 2178 | credits_received = le16_to_cpu(rsp->hdr.sync_hdr.CreditRequest); |
2175 | 2179 | ||
2176 | mutex_lock(&server->srv_mutex); | ||
2177 | DeleteMidQEntry(mid); | 2180 | DeleteMidQEntry(mid); |
2178 | mutex_unlock(&server->srv_mutex); | ||
2179 | add_credits(server, credits_received, CIFS_ECHO_OP); | 2181 | add_credits(server, credits_received, CIFS_ECHO_OP); |
2180 | } | 2182 | } |
2181 | 2183 | ||
@@ -2433,9 +2435,7 @@ smb2_readv_callback(struct mid_q_entry *mid) | |||
2433 | cifs_stats_fail_inc(tcon, SMB2_READ_HE); | 2435 | cifs_stats_fail_inc(tcon, SMB2_READ_HE); |
2434 | 2436 | ||
2435 | queue_work(cifsiod_wq, &rdata->work); | 2437 | queue_work(cifsiod_wq, &rdata->work); |
2436 | mutex_lock(&server->srv_mutex); | ||
2437 | DeleteMidQEntry(mid); | 2438 | DeleteMidQEntry(mid); |
2438 | mutex_unlock(&server->srv_mutex); | ||
2439 | add_credits(server, credits_received, 0); | 2439 | add_credits(server, credits_received, 0); |
2440 | } | 2440 | } |
2441 | 2441 | ||
@@ -2594,7 +2594,6 @@ smb2_writev_callback(struct mid_q_entry *mid) | |||
2594 | { | 2594 | { |
2595 | struct cifs_writedata *wdata = mid->callback_data; | 2595 | struct cifs_writedata *wdata = mid->callback_data; |
2596 | struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink); | 2596 | struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink); |
2597 | struct TCP_Server_Info *server = tcon->ses->server; | ||
2598 | unsigned int written; | 2597 | unsigned int written; |
2599 | struct smb2_write_rsp *rsp = (struct smb2_write_rsp *)mid->resp_buf; | 2598 | struct smb2_write_rsp *rsp = (struct smb2_write_rsp *)mid->resp_buf; |
2600 | unsigned int credits_received = 1; | 2599 | unsigned int credits_received = 1; |
@@ -2634,9 +2633,7 @@ smb2_writev_callback(struct mid_q_entry *mid) | |||
2634 | cifs_stats_fail_inc(tcon, SMB2_WRITE_HE); | 2633 | cifs_stats_fail_inc(tcon, SMB2_WRITE_HE); |
2635 | 2634 | ||
2636 | queue_work(cifsiod_wq, &wdata->work); | 2635 | queue_work(cifsiod_wq, &wdata->work); |
2637 | mutex_lock(&server->srv_mutex); | ||
2638 | DeleteMidQEntry(mid); | 2636 | DeleteMidQEntry(mid); |
2639 | mutex_unlock(&server->srv_mutex); | ||
2640 | add_credits(tcon->ses->server, credits_received, 0); | 2637 | add_credits(tcon->ses->server, credits_received, 0); |
2641 | } | 2638 | } |
2642 | 2639 | ||
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 4d64b5b8fc9c..47a125ece11e 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -94,7 +94,7 @@ DeleteMidQEntry(struct mid_q_entry *midEntry) | |||
94 | now = jiffies; | 94 | now = jiffies; |
95 | /* commands taking longer than one second are indications that | 95 | /* commands taking longer than one second are indications that |
96 | something is wrong, unless it is quite a slow link or server */ | 96 | something is wrong, unless it is quite a slow link or server */ |
97 | if ((now - midEntry->when_alloc) > HZ) { | 97 | if (time_after(now, midEntry->when_alloc + HZ)) { |
98 | if ((cifsFYI & CIFS_TIMER) && (midEntry->command != command)) { | 98 | if ((cifsFYI & CIFS_TIMER) && (midEntry->command != command)) { |
99 | pr_debug(" CIFS slow rsp: cmd %d mid %llu", | 99 | pr_debug(" CIFS slow rsp: cmd %d mid %llu", |
100 | midEntry->command, midEntry->mid); | 100 | midEntry->command, midEntry->mid); |
@@ -613,9 +613,7 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server) | |||
613 | } | 613 | } |
614 | spin_unlock(&GlobalMid_Lock); | 614 | spin_unlock(&GlobalMid_Lock); |
615 | 615 | ||
616 | mutex_lock(&server->srv_mutex); | ||
617 | DeleteMidQEntry(mid); | 616 | DeleteMidQEntry(mid); |
618 | mutex_unlock(&server->srv_mutex); | ||
619 | return rc; | 617 | return rc; |
620 | } | 618 | } |
621 | 619 | ||
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 20af5187ba63..3cb5c9e2d4e7 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c | |||
@@ -235,8 +235,7 @@ static int cifs_xattr_get(const struct xattr_handler *handler, | |||
235 | 235 | ||
236 | if (pTcon->ses->server->ops->query_all_EAs) | 236 | if (pTcon->ses->server->ops->query_all_EAs) |
237 | rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, | 237 | rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, |
238 | full_path, name, value, size, | 238 | full_path, name, value, size, cifs_sb); |
239 | cifs_sb->local_nls, cifs_remap(cifs_sb)); | ||
240 | break; | 239 | break; |
241 | 240 | ||
242 | case XATTR_CIFS_ACL: { | 241 | case XATTR_CIFS_ACL: { |
@@ -336,8 +335,7 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size) | |||
336 | 335 | ||
337 | if (pTcon->ses->server->ops->query_all_EAs) | 336 | if (pTcon->ses->server->ops->query_all_EAs) |
338 | rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, | 337 | rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, |
339 | full_path, NULL, data, buf_size, | 338 | full_path, NULL, data, buf_size, cifs_sb); |
340 | cifs_sb->local_nls, cifs_remap(cifs_sb)); | ||
341 | list_ea_exit: | 339 | list_ea_exit: |
342 | kfree(full_path); | 340 | kfree(full_path); |
343 | free_xid(xid); | 341 | free_xid(xid); |
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 26d77f9f8c12..2dcbd5698884 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -817,7 +817,7 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length, | |||
817 | iomap->bdev = bdev; | 817 | iomap->bdev = bdev; |
818 | iomap->offset = (u64)first_block << blkbits; | 818 | iomap->offset = (u64)first_block << blkbits; |
819 | if (blk_queue_dax(bdev->bd_queue)) | 819 | if (blk_queue_dax(bdev->bd_queue)) |
820 | iomap->dax_dev = dax_get_by_host(bdev->bd_disk->disk_name); | 820 | iomap->dax_dev = fs_dax_get_by_host(bdev->bd_disk->disk_name); |
821 | else | 821 | else |
822 | iomap->dax_dev = NULL; | 822 | iomap->dax_dev = NULL; |
823 | 823 | ||
@@ -841,7 +841,7 @@ static int | |||
841 | ext2_iomap_end(struct inode *inode, loff_t offset, loff_t length, | 841 | ext2_iomap_end(struct inode *inode, loff_t offset, loff_t length, |
842 | ssize_t written, unsigned flags, struct iomap *iomap) | 842 | ssize_t written, unsigned flags, struct iomap *iomap) |
843 | { | 843 | { |
844 | put_dax(iomap->dax_dev); | 844 | fs_put_dax(iomap->dax_dev); |
845 | if (iomap->type == IOMAP_MAPPED && | 845 | if (iomap->type == IOMAP_MAPPED && |
846 | written < length && | 846 | written < length && |
847 | (flags & IOMAP_WRITE)) | 847 | (flags & IOMAP_WRITE)) |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 5834c4d76be8..1bd0bfa547f6 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -3412,7 +3412,7 @@ retry: | |||
3412 | bdev = inode->i_sb->s_bdev; | 3412 | bdev = inode->i_sb->s_bdev; |
3413 | iomap->bdev = bdev; | 3413 | iomap->bdev = bdev; |
3414 | if (blk_queue_dax(bdev->bd_queue)) | 3414 | if (blk_queue_dax(bdev->bd_queue)) |
3415 | iomap->dax_dev = dax_get_by_host(bdev->bd_disk->disk_name); | 3415 | iomap->dax_dev = fs_dax_get_by_host(bdev->bd_disk->disk_name); |
3416 | else | 3416 | else |
3417 | iomap->dax_dev = NULL; | 3417 | iomap->dax_dev = NULL; |
3418 | iomap->offset = first_block << blkbits; | 3418 | iomap->offset = first_block << blkbits; |
@@ -3447,7 +3447,7 @@ static int ext4_iomap_end(struct inode *inode, loff_t offset, loff_t length, | |||
3447 | int blkbits = inode->i_blkbits; | 3447 | int blkbits = inode->i_blkbits; |
3448 | bool truncate = false; | 3448 | bool truncate = false; |
3449 | 3449 | ||
3450 | put_dax(iomap->dax_dev); | 3450 | fs_put_dax(iomap->dax_dev); |
3451 | if (!(flags & IOMAP_WRITE) || (flags & IOMAP_FAULT)) | 3451 | if (!(flags & IOMAP_WRITE) || (flags & IOMAP_FAULT)) |
3452 | return 0; | 3452 | return 0; |
3453 | 3453 | ||
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 5a1b58f8fef4..65c88379a3a1 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -975,8 +975,15 @@ static int fuse_bdi_init(struct fuse_conn *fc, struct super_block *sb) | |||
975 | int err; | 975 | int err; |
976 | char *suffix = ""; | 976 | char *suffix = ""; |
977 | 977 | ||
978 | if (sb->s_bdev) | 978 | if (sb->s_bdev) { |
979 | suffix = "-fuseblk"; | 979 | suffix = "-fuseblk"; |
980 | /* | ||
981 | * sb->s_bdi points to blkdev's bdi however we want to redirect | ||
982 | * it to our private bdi... | ||
983 | */ | ||
984 | bdi_put(sb->s_bdi); | ||
985 | sb->s_bdi = &noop_backing_dev_info; | ||
986 | } | ||
980 | err = super_setup_bdi_name(sb, "%u:%u%s", MAJOR(fc->dev), | 987 | err = super_setup_bdi_name(sb, "%u:%u%s", MAJOR(fc->dev), |
981 | MINOR(fc->dev), suffix); | 988 | MINOR(fc->dev), suffix); |
982 | if (err) | 989 | if (err) |
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index a63f61c256bd..94e5bdf7304c 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
@@ -1068,7 +1068,7 @@ xfs_file_iomap_begin( | |||
1068 | /* optionally associate a dax device with the iomap bdev */ | 1068 | /* optionally associate a dax device with the iomap bdev */ |
1069 | bdev = iomap->bdev; | 1069 | bdev = iomap->bdev; |
1070 | if (blk_queue_dax(bdev->bd_queue)) | 1070 | if (blk_queue_dax(bdev->bd_queue)) |
1071 | iomap->dax_dev = dax_get_by_host(bdev->bd_disk->disk_name); | 1071 | iomap->dax_dev = fs_dax_get_by_host(bdev->bd_disk->disk_name); |
1072 | else | 1072 | else |
1073 | iomap->dax_dev = NULL; | 1073 | iomap->dax_dev = NULL; |
1074 | 1074 | ||
@@ -1149,7 +1149,7 @@ xfs_file_iomap_end( | |||
1149 | unsigned flags, | 1149 | unsigned flags, |
1150 | struct iomap *iomap) | 1150 | struct iomap *iomap) |
1151 | { | 1151 | { |
1152 | put_dax(iomap->dax_dev); | 1152 | fs_put_dax(iomap->dax_dev); |
1153 | if ((flags & IOMAP_WRITE) && iomap->type == IOMAP_DELALLOC) | 1153 | if ((flags & IOMAP_WRITE) && iomap->type == IOMAP_DELALLOC) |
1154 | return xfs_file_iomap_end_delalloc(XFS_I(inode), offset, | 1154 | return xfs_file_iomap_end_delalloc(XFS_I(inode), offset, |
1155 | length, written, iomap); | 1155 | length, written, iomap); |
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index 97b8d3728b31..ef718586321c 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h | |||
@@ -195,7 +195,10 @@ struct vgic_dist { | |||
195 | /* either a GICv2 CPU interface */ | 195 | /* either a GICv2 CPU interface */ |
196 | gpa_t vgic_cpu_base; | 196 | gpa_t vgic_cpu_base; |
197 | /* or a number of GICv3 redistributor regions */ | 197 | /* or a number of GICv3 redistributor regions */ |
198 | gpa_t vgic_redist_base; | 198 | struct { |
199 | gpa_t vgic_redist_base; | ||
200 | gpa_t vgic_redist_free_offset; | ||
201 | }; | ||
199 | }; | 202 | }; |
200 | 203 | ||
201 | /* distributor enabled */ | 204 | /* distributor enabled */ |
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index 5efb4db44e1e..d5093b52b485 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h | |||
@@ -40,6 +40,9 @@ struct bpf_reg_state { | |||
40 | */ | 40 | */ |
41 | s64 min_value; | 41 | s64 min_value; |
42 | u64 max_value; | 42 | u64 max_value; |
43 | u32 min_align; | ||
44 | u32 aux_off; | ||
45 | u32 aux_off_align; | ||
43 | }; | 46 | }; |
44 | 47 | ||
45 | enum bpf_stack_slot_type { | 48 | enum bpf_stack_slot_type { |
@@ -87,6 +90,7 @@ struct bpf_verifier_env { | |||
87 | struct bpf_prog *prog; /* eBPF program being verified */ | 90 | struct bpf_prog *prog; /* eBPF program being verified */ |
88 | struct bpf_verifier_stack_elem *head; /* stack of verifier states to be processed */ | 91 | struct bpf_verifier_stack_elem *head; /* stack of verifier states to be processed */ |
89 | int stack_size; /* number of states to be processed */ | 92 | int stack_size; /* number of states to be processed */ |
93 | bool strict_alignment; /* perform strict pointer alignment checks */ | ||
90 | struct bpf_verifier_state cur_state; /* current verifier state */ | 94 | struct bpf_verifier_state cur_state; /* current verifier state */ |
91 | struct bpf_verifier_state_list **explored_states; /* search pruning optimization */ | 95 | struct bpf_verifier_state_list **explored_states; /* search pruning optimization */ |
92 | const struct bpf_ext_analyzer_ops *analyzer_ops; /* external analyzer ops */ | 96 | const struct bpf_ext_analyzer_ops *analyzer_ops; /* external analyzer ops */ |
diff --git a/include/linux/dax.h b/include/linux/dax.h index 00ebac854bb7..5ec1f6c47716 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h | |||
@@ -18,6 +18,20 @@ struct dax_operations { | |||
18 | void **, pfn_t *); | 18 | void **, pfn_t *); |
19 | }; | 19 | }; |
20 | 20 | ||
21 | #if IS_ENABLED(CONFIG_DAX) | ||
22 | struct dax_device *dax_get_by_host(const char *host); | ||
23 | void put_dax(struct dax_device *dax_dev); | ||
24 | #else | ||
25 | static inline struct dax_device *dax_get_by_host(const char *host) | ||
26 | { | ||
27 | return NULL; | ||
28 | } | ||
29 | |||
30 | static inline void put_dax(struct dax_device *dax_dev) | ||
31 | { | ||
32 | } | ||
33 | #endif | ||
34 | |||
21 | int bdev_dax_pgoff(struct block_device *, sector_t, size_t, pgoff_t *pgoff); | 35 | int bdev_dax_pgoff(struct block_device *, sector_t, size_t, pgoff_t *pgoff); |
22 | #if IS_ENABLED(CONFIG_FS_DAX) | 36 | #if IS_ENABLED(CONFIG_FS_DAX) |
23 | int __bdev_dax_supported(struct super_block *sb, int blocksize); | 37 | int __bdev_dax_supported(struct super_block *sb, int blocksize); |
@@ -25,23 +39,29 @@ static inline int bdev_dax_supported(struct super_block *sb, int blocksize) | |||
25 | { | 39 | { |
26 | return __bdev_dax_supported(sb, blocksize); | 40 | return __bdev_dax_supported(sb, blocksize); |
27 | } | 41 | } |
42 | |||
43 | static inline struct dax_device *fs_dax_get_by_host(const char *host) | ||
44 | { | ||
45 | return dax_get_by_host(host); | ||
46 | } | ||
47 | |||
48 | static inline void fs_put_dax(struct dax_device *dax_dev) | ||
49 | { | ||
50 | put_dax(dax_dev); | ||
51 | } | ||
52 | |||
28 | #else | 53 | #else |
29 | static inline int bdev_dax_supported(struct super_block *sb, int blocksize) | 54 | static inline int bdev_dax_supported(struct super_block *sb, int blocksize) |
30 | { | 55 | { |
31 | return -EOPNOTSUPP; | 56 | return -EOPNOTSUPP; |
32 | } | 57 | } |
33 | #endif | ||
34 | 58 | ||
35 | #if IS_ENABLED(CONFIG_DAX) | 59 | static inline struct dax_device *fs_dax_get_by_host(const char *host) |
36 | struct dax_device *dax_get_by_host(const char *host); | ||
37 | void put_dax(struct dax_device *dax_dev); | ||
38 | #else | ||
39 | static inline struct dax_device *dax_get_by_host(const char *host) | ||
40 | { | 60 | { |
41 | return NULL; | 61 | return NULL; |
42 | } | 62 | } |
43 | 63 | ||
44 | static inline void put_dax(struct dax_device *dax_dev) | 64 | static inline void fs_put_dax(struct dax_device *dax_dev) |
45 | { | 65 | { |
46 | } | 66 | } |
47 | #endif | 67 | #endif |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 30f90c1a0aaf..541df0b5b815 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -349,6 +349,9 @@ extern int proc_kprobes_optimization_handler(struct ctl_table *table, | |||
349 | int write, void __user *buffer, | 349 | int write, void __user *buffer, |
350 | size_t *length, loff_t *ppos); | 350 | size_t *length, loff_t *ppos); |
351 | #endif | 351 | #endif |
352 | extern void wait_for_kprobe_optimizer(void); | ||
353 | #else | ||
354 | static inline void wait_for_kprobe_optimizer(void) { } | ||
352 | #endif /* CONFIG_OPTPROBES */ | 355 | #endif /* CONFIG_OPTPROBES */ |
353 | #ifdef CONFIG_KPROBES_ON_FTRACE | 356 | #ifdef CONFIG_KPROBES_ON_FTRACE |
354 | extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, | 357 | extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, |
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h index 1b166d2e19c5..b25e7baa273e 100644 --- a/include/linux/mlx5/fs.h +++ b/include/linux/mlx5/fs.h | |||
@@ -109,7 +109,6 @@ struct mlx5_flow_table_attr { | |||
109 | int max_fte; | 109 | int max_fte; |
110 | u32 level; | 110 | u32 level; |
111 | u32 flags; | 111 | u32 flags; |
112 | u32 underlay_qpn; | ||
113 | }; | 112 | }; |
114 | 113 | ||
115 | struct mlx5_flow_table * | 114 | struct mlx5_flow_table * |
@@ -167,4 +166,7 @@ struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging); | |||
167 | void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter); | 166 | void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter); |
168 | void mlx5_fc_query_cached(struct mlx5_fc *counter, | 167 | void mlx5_fc_query_cached(struct mlx5_fc *counter, |
169 | u64 *bytes, u64 *packets, u64 *lastuse); | 168 | u64 *bytes, u64 *packets, u64 *lastuse); |
169 | int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn); | ||
170 | int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn); | ||
171 | |||
170 | #endif | 172 | #endif |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 9c23bd2efb56..3f39d27decf4 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -3296,11 +3296,15 @@ int dev_get_phys_port_id(struct net_device *dev, | |||
3296 | int dev_get_phys_port_name(struct net_device *dev, | 3296 | int dev_get_phys_port_name(struct net_device *dev, |
3297 | char *name, size_t len); | 3297 | char *name, size_t len); |
3298 | int dev_change_proto_down(struct net_device *dev, bool proto_down); | 3298 | int dev_change_proto_down(struct net_device *dev, bool proto_down); |
3299 | int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, | ||
3300 | int fd, u32 flags); | ||
3301 | struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev); | 3299 | struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev); |
3302 | struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, | 3300 | struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, |
3303 | struct netdev_queue *txq, int *ret); | 3301 | struct netdev_queue *txq, int *ret); |
3302 | |||
3303 | typedef int (*xdp_op_t)(struct net_device *dev, struct netdev_xdp *xdp); | ||
3304 | int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, | ||
3305 | int fd, u32 flags); | ||
3306 | bool __dev_xdp_attached(struct net_device *dev, xdp_op_t xdp_op); | ||
3307 | |||
3304 | int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb); | 3308 | int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb); |
3305 | int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); | 3309 | int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); |
3306 | bool is_skb_forwardable(const struct net_device *dev, | 3310 | bool is_skb_forwardable(const struct net_device *dev, |
diff --git a/include/linux/nvme-fc-driver.h b/include/linux/nvme-fc-driver.h index 0db37158a61d..6c8c5d8041b7 100644 --- a/include/linux/nvme-fc-driver.h +++ b/include/linux/nvme-fc-driver.h | |||
@@ -27,8 +27,8 @@ | |||
27 | 27 | ||
28 | /* FC Port role bitmask - can merge with FC Port Roles in fc transport */ | 28 | /* FC Port role bitmask - can merge with FC Port Roles in fc transport */ |
29 | #define FC_PORT_ROLE_NVME_INITIATOR 0x10 | 29 | #define FC_PORT_ROLE_NVME_INITIATOR 0x10 |
30 | #define FC_PORT_ROLE_NVME_TARGET 0x11 | 30 | #define FC_PORT_ROLE_NVME_TARGET 0x20 |
31 | #define FC_PORT_ROLE_NVME_DISCOVERY 0x12 | 31 | #define FC_PORT_ROLE_NVME_DISCOVERY 0x40 |
32 | 32 | ||
33 | 33 | ||
34 | /** | 34 | /** |
@@ -642,15 +642,7 @@ enum { | |||
642 | * sequence in one LLDD operation. Errors during Data | 642 | * sequence in one LLDD operation. Errors during Data |
643 | * sequence transmit must not allow RSP sequence to be sent. | 643 | * sequence transmit must not allow RSP sequence to be sent. |
644 | */ | 644 | */ |
645 | NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED = (1 << 1), | 645 | NVMET_FCTGTFEAT_CMD_IN_ISR = (1 << 1), |
646 | /* Bit 1: When 0, the LLDD will deliver FCP CMD | ||
647 | * on the CPU it should be affinitized to. Thus work will | ||
648 | * be scheduled on the cpu received on. When 1, the LLDD | ||
649 | * may not deliver the CMD on the CPU it should be worked | ||
650 | * on. The transport should pick a cpu to schedule the work | ||
651 | * on. | ||
652 | */ | ||
653 | NVMET_FCTGTFEAT_CMD_IN_ISR = (1 << 2), | ||
654 | /* Bit 2: When 0, the LLDD is calling the cmd rcv handler | 646 | /* Bit 2: When 0, the LLDD is calling the cmd rcv handler |
655 | * in a non-isr context, allowing the transport to finish | 647 | * in a non-isr context, allowing the transport to finish |
656 | * op completion in the calling context. When 1, the LLDD | 648 | * op completion in the calling context. When 1, the LLDD |
@@ -658,7 +650,7 @@ enum { | |||
658 | * requiring the transport to transition to a workqueue | 650 | * requiring the transport to transition to a workqueue |
659 | * for op completion. | 651 | * for op completion. |
660 | */ | 652 | */ |
661 | NVMET_FCTGTFEAT_OPDONE_IN_ISR = (1 << 3), | 653 | NVMET_FCTGTFEAT_OPDONE_IN_ISR = (1 << 2), |
662 | /* Bit 3: When 0, the LLDD is calling the op done handler | 654 | /* Bit 3: When 0, the LLDD is calling the op done handler |
663 | * in a non-isr context, allowing the transport to finish | 655 | * in a non-isr context, allowing the transport to finish |
664 | * op completion in the calling context. When 1, the LLDD | 656 | * op completion in the calling context. When 1, the LLDD |
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index ec6b11deb773..1e0deb8e8494 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h | |||
@@ -8,7 +8,7 @@ | |||
8 | #include <linux/ioport.h> | 8 | #include <linux/ioport.h> |
9 | #include <linux/of.h> | 9 | #include <linux/of.h> |
10 | 10 | ||
11 | typedef int const (*of_irq_init_cb_t)(struct device_node *, struct device_node *); | 11 | typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *); |
12 | 12 | ||
13 | /* | 13 | /* |
14 | * Workarounds only applied to 32bit powermac machines | 14 | * Workarounds only applied to 32bit powermac machines |
diff --git a/include/linux/soc/renesas/rcar-rst.h b/include/linux/soc/renesas/rcar-rst.h index a18e0783946b..787e7ad53d45 100644 --- a/include/linux/soc/renesas/rcar-rst.h +++ b/include/linux/soc/renesas/rcar-rst.h | |||
@@ -1,6 +1,11 @@ | |||
1 | #ifndef __LINUX_SOC_RENESAS_RCAR_RST_H__ | 1 | #ifndef __LINUX_SOC_RENESAS_RCAR_RST_H__ |
2 | #define __LINUX_SOC_RENESAS_RCAR_RST_H__ | 2 | #define __LINUX_SOC_RENESAS_RCAR_RST_H__ |
3 | 3 | ||
4 | #if defined(CONFIG_ARCH_RCAR_GEN1) || defined(CONFIG_ARCH_RCAR_GEN2) || \ | ||
5 | defined(CONFIG_ARCH_R8A7795) || defined(CONFIG_ARCH_R8A7796) | ||
4 | int rcar_rst_read_mode_pins(u32 *mode); | 6 | int rcar_rst_read_mode_pins(u32 *mode); |
7 | #else | ||
8 | static inline int rcar_rst_read_mode_pins(u32 *mode) { return -ENODEV; } | ||
9 | #endif | ||
5 | 10 | ||
6 | #endif /* __LINUX_SOC_RENESAS_RCAR_RST_H__ */ | 11 | #endif /* __LINUX_SOC_RENESAS_RCAR_RST_H__ */ |
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index a469999a106d..50398b69ca44 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
@@ -148,6 +148,7 @@ struct usb_hcd { | |||
148 | unsigned rh_registered:1;/* is root hub registered? */ | 148 | unsigned rh_registered:1;/* is root hub registered? */ |
149 | unsigned rh_pollable:1; /* may we poll the root hub? */ | 149 | unsigned rh_pollable:1; /* may we poll the root hub? */ |
150 | unsigned msix_enabled:1; /* driver has MSI-X enabled? */ | 150 | unsigned msix_enabled:1; /* driver has MSI-X enabled? */ |
151 | unsigned msi_enabled:1; /* driver has MSI enabled? */ | ||
151 | unsigned remove_phy:1; /* auto-remove USB phy */ | 152 | unsigned remove_phy:1; /* auto-remove USB phy */ |
152 | 153 | ||
153 | /* The next flag is a stopgap, to be removed when all the HCDs | 154 | /* The next flag is a stopgap, to be removed when all the HCDs |
diff --git a/include/net/x25.h b/include/net/x25.h index c383aa4edbf0..6d30a01d281d 100644 --- a/include/net/x25.h +++ b/include/net/x25.h | |||
@@ -298,10 +298,10 @@ void x25_check_rbuf(struct sock *); | |||
298 | 298 | ||
299 | /* sysctl_net_x25.c */ | 299 | /* sysctl_net_x25.c */ |
300 | #ifdef CONFIG_SYSCTL | 300 | #ifdef CONFIG_SYSCTL |
301 | void x25_register_sysctl(void); | 301 | int x25_register_sysctl(void); |
302 | void x25_unregister_sysctl(void); | 302 | void x25_unregister_sysctl(void); |
303 | #else | 303 | #else |
304 | static inline void x25_register_sysctl(void) {}; | 304 | static inline int x25_register_sysctl(void) { return 0; }; |
305 | static inline void x25_unregister_sysctl(void) {}; | 305 | static inline void x25_unregister_sysctl(void) {}; |
306 | #endif /* CONFIG_SYSCTL */ | 306 | #endif /* CONFIG_SYSCTL */ |
307 | 307 | ||
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 945a1f5f63c5..94dfa9def355 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h | |||
@@ -132,6 +132,13 @@ enum bpf_attach_type { | |||
132 | */ | 132 | */ |
133 | #define BPF_F_ALLOW_OVERRIDE (1U << 0) | 133 | #define BPF_F_ALLOW_OVERRIDE (1U << 0) |
134 | 134 | ||
135 | /* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the | ||
136 | * verifier will perform strict alignment checking as if the kernel | ||
137 | * has been built with CONFIG_EFFICIENT_UNALIGNED_ACCESS not set, | ||
138 | * and NET_IP_ALIGN defined to 2. | ||
139 | */ | ||
140 | #define BPF_F_STRICT_ALIGNMENT (1U << 0) | ||
141 | |||
135 | #define BPF_PSEUDO_MAP_FD 1 | 142 | #define BPF_PSEUDO_MAP_FD 1 |
136 | 143 | ||
137 | /* flags for BPF_MAP_UPDATE_ELEM command */ | 144 | /* flags for BPF_MAP_UPDATE_ELEM command */ |
@@ -177,6 +184,7 @@ union bpf_attr { | |||
177 | __u32 log_size; /* size of user buffer */ | 184 | __u32 log_size; /* size of user buffer */ |
178 | __aligned_u64 log_buf; /* user supplied buffer */ | 185 | __aligned_u64 log_buf; /* user supplied buffer */ |
179 | __u32 kern_version; /* checked when prog_type=kprobe */ | 186 | __u32 kern_version; /* checked when prog_type=kprobe */ |
187 | __u32 prog_flags; | ||
180 | }; | 188 | }; |
181 | 189 | ||
182 | struct { /* anonymous struct used by BPF_OBJ_* commands */ | 190 | struct { /* anonymous struct used by BPF_OBJ_* commands */ |
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 8e56ac70e0d1..15ac20382aba 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h | |||
@@ -888,9 +888,18 @@ enum { | |||
888 | /* XDP section */ | 888 | /* XDP section */ |
889 | 889 | ||
890 | #define XDP_FLAGS_UPDATE_IF_NOEXIST (1U << 0) | 890 | #define XDP_FLAGS_UPDATE_IF_NOEXIST (1U << 0) |
891 | #define XDP_FLAGS_SKB_MODE (2U << 0) | 891 | #define XDP_FLAGS_SKB_MODE (1U << 1) |
892 | #define XDP_FLAGS_DRV_MODE (1U << 2) | ||
892 | #define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | \ | 893 | #define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | \ |
893 | XDP_FLAGS_SKB_MODE) | 894 | XDP_FLAGS_SKB_MODE | \ |
895 | XDP_FLAGS_DRV_MODE) | ||
896 | |||
897 | /* These are stored into IFLA_XDP_ATTACHED on dump. */ | ||
898 | enum { | ||
899 | XDP_ATTACHED_NONE = 0, | ||
900 | XDP_ATTACHED_DRV, | ||
901 | XDP_ATTACHED_SKB, | ||
902 | }; | ||
894 | 903 | ||
895 | enum { | 904 | enum { |
896 | IFLA_XDP_UNSPEC, | 905 | IFLA_XDP_UNSPEC, |
diff --git a/include/uapi/linux/usb/ch11.h b/include/uapi/linux/usb/ch11.h index 361297e96f58..576c704e3fb8 100644 --- a/include/uapi/linux/usb/ch11.h +++ b/include/uapi/linux/usb/ch11.h | |||
@@ -22,6 +22,9 @@ | |||
22 | */ | 22 | */ |
23 | #define USB_MAXCHILDREN 31 | 23 | #define USB_MAXCHILDREN 31 |
24 | 24 | ||
25 | /* See USB 3.1 spec Table 10-5 */ | ||
26 | #define USB_SS_MAXPORTS 15 | ||
27 | |||
25 | /* | 28 | /* |
26 | * Hub request types | 29 | * Hub request types |
27 | */ | 30 | */ |
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index fd2411fd6914..265a0d854e33 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c | |||
@@ -783,7 +783,7 @@ struct bpf_prog *bpf_prog_get_type(u32 ufd, enum bpf_prog_type type) | |||
783 | EXPORT_SYMBOL_GPL(bpf_prog_get_type); | 783 | EXPORT_SYMBOL_GPL(bpf_prog_get_type); |
784 | 784 | ||
785 | /* last field in 'union bpf_attr' used by this command */ | 785 | /* last field in 'union bpf_attr' used by this command */ |
786 | #define BPF_PROG_LOAD_LAST_FIELD kern_version | 786 | #define BPF_PROG_LOAD_LAST_FIELD prog_flags |
787 | 787 | ||
788 | static int bpf_prog_load(union bpf_attr *attr) | 788 | static int bpf_prog_load(union bpf_attr *attr) |
789 | { | 789 | { |
@@ -796,6 +796,9 @@ static int bpf_prog_load(union bpf_attr *attr) | |||
796 | if (CHECK_ATTR(BPF_PROG_LOAD)) | 796 | if (CHECK_ATTR(BPF_PROG_LOAD)) |
797 | return -EINVAL; | 797 | return -EINVAL; |
798 | 798 | ||
799 | if (attr->prog_flags & ~BPF_F_STRICT_ALIGNMENT) | ||
800 | return -EINVAL; | ||
801 | |||
799 | /* copy eBPF program license from user space */ | 802 | /* copy eBPF program license from user space */ |
800 | if (strncpy_from_user(license, u64_to_user_ptr(attr->license), | 803 | if (strncpy_from_user(license, u64_to_user_ptr(attr->license), |
801 | sizeof(license) - 1) < 0) | 804 | sizeof(license) - 1) < 0) |
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index c5b56c92f8e2..1eddb713b815 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c | |||
@@ -140,7 +140,7 @@ struct bpf_verifier_stack_elem { | |||
140 | struct bpf_verifier_stack_elem *next; | 140 | struct bpf_verifier_stack_elem *next; |
141 | }; | 141 | }; |
142 | 142 | ||
143 | #define BPF_COMPLEXITY_LIMIT_INSNS 65536 | 143 | #define BPF_COMPLEXITY_LIMIT_INSNS 98304 |
144 | #define BPF_COMPLEXITY_LIMIT_STACK 1024 | 144 | #define BPF_COMPLEXITY_LIMIT_STACK 1024 |
145 | 145 | ||
146 | #define BPF_MAP_PTR_POISON ((void *)0xeB9F + POISON_POINTER_DELTA) | 146 | #define BPF_MAP_PTR_POISON ((void *)0xeB9F + POISON_POINTER_DELTA) |
@@ -241,6 +241,12 @@ static void print_verifier_state(struct bpf_verifier_state *state) | |||
241 | if (reg->max_value != BPF_REGISTER_MAX_RANGE) | 241 | if (reg->max_value != BPF_REGISTER_MAX_RANGE) |
242 | verbose(",max_value=%llu", | 242 | verbose(",max_value=%llu", |
243 | (unsigned long long)reg->max_value); | 243 | (unsigned long long)reg->max_value); |
244 | if (reg->min_align) | ||
245 | verbose(",min_align=%u", reg->min_align); | ||
246 | if (reg->aux_off) | ||
247 | verbose(",aux_off=%u", reg->aux_off); | ||
248 | if (reg->aux_off_align) | ||
249 | verbose(",aux_off_align=%u", reg->aux_off_align); | ||
244 | } | 250 | } |
245 | for (i = 0; i < MAX_BPF_STACK; i += BPF_REG_SIZE) { | 251 | for (i = 0; i < MAX_BPF_STACK; i += BPF_REG_SIZE) { |
246 | if (state->stack_slot_type[i] == STACK_SPILL) | 252 | if (state->stack_slot_type[i] == STACK_SPILL) |
@@ -466,6 +472,9 @@ static void init_reg_state(struct bpf_reg_state *regs) | |||
466 | regs[i].imm = 0; | 472 | regs[i].imm = 0; |
467 | regs[i].min_value = BPF_REGISTER_MIN_RANGE; | 473 | regs[i].min_value = BPF_REGISTER_MIN_RANGE; |
468 | regs[i].max_value = BPF_REGISTER_MAX_RANGE; | 474 | regs[i].max_value = BPF_REGISTER_MAX_RANGE; |
475 | regs[i].min_align = 0; | ||
476 | regs[i].aux_off = 0; | ||
477 | regs[i].aux_off_align = 0; | ||
469 | } | 478 | } |
470 | 479 | ||
471 | /* frame pointer */ | 480 | /* frame pointer */ |
@@ -492,6 +501,7 @@ static void reset_reg_range_values(struct bpf_reg_state *regs, u32 regno) | |||
492 | { | 501 | { |
493 | regs[regno].min_value = BPF_REGISTER_MIN_RANGE; | 502 | regs[regno].min_value = BPF_REGISTER_MIN_RANGE; |
494 | regs[regno].max_value = BPF_REGISTER_MAX_RANGE; | 503 | regs[regno].max_value = BPF_REGISTER_MAX_RANGE; |
504 | regs[regno].min_align = 0; | ||
495 | } | 505 | } |
496 | 506 | ||
497 | static void mark_reg_unknown_value_and_range(struct bpf_reg_state *regs, | 507 | static void mark_reg_unknown_value_and_range(struct bpf_reg_state *regs, |
@@ -779,17 +789,33 @@ static bool is_pointer_value(struct bpf_verifier_env *env, int regno) | |||
779 | } | 789 | } |
780 | 790 | ||
781 | static int check_pkt_ptr_alignment(const struct bpf_reg_state *reg, | 791 | static int check_pkt_ptr_alignment(const struct bpf_reg_state *reg, |
782 | int off, int size) | 792 | int off, int size, bool strict) |
783 | { | 793 | { |
784 | if (reg->id && size != 1) { | 794 | int ip_align; |
785 | verbose("Unknown alignment. Only byte-sized access allowed in packet access.\n"); | 795 | int reg_off; |
786 | return -EACCES; | 796 | |
797 | /* Byte size accesses are always allowed. */ | ||
798 | if (!strict || size == 1) | ||
799 | return 0; | ||
800 | |||
801 | reg_off = reg->off; | ||
802 | if (reg->id) { | ||
803 | if (reg->aux_off_align % size) { | ||
804 | verbose("Packet access is only %u byte aligned, %d byte access not allowed\n", | ||
805 | reg->aux_off_align, size); | ||
806 | return -EACCES; | ||
807 | } | ||
808 | reg_off += reg->aux_off; | ||
787 | } | 809 | } |
788 | 810 | ||
789 | /* skb->data is NET_IP_ALIGN-ed */ | 811 | /* skb->data is NET_IP_ALIGN-ed, but for strict alignment checking |
790 | if ((NET_IP_ALIGN + reg->off + off) % size != 0) { | 812 | * we force this to 2 which is universally what architectures use |
813 | * when they don't set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS. | ||
814 | */ | ||
815 | ip_align = strict ? 2 : NET_IP_ALIGN; | ||
816 | if ((ip_align + reg_off + off) % size != 0) { | ||
791 | verbose("misaligned packet access off %d+%d+%d size %d\n", | 817 | verbose("misaligned packet access off %d+%d+%d size %d\n", |
792 | NET_IP_ALIGN, reg->off, off, size); | 818 | ip_align, reg_off, off, size); |
793 | return -EACCES; | 819 | return -EACCES; |
794 | } | 820 | } |
795 | 821 | ||
@@ -797,9 +823,9 @@ static int check_pkt_ptr_alignment(const struct bpf_reg_state *reg, | |||
797 | } | 823 | } |
798 | 824 | ||
799 | static int check_val_ptr_alignment(const struct bpf_reg_state *reg, | 825 | static int check_val_ptr_alignment(const struct bpf_reg_state *reg, |
800 | int size) | 826 | int size, bool strict) |
801 | { | 827 | { |
802 | if (size != 1) { | 828 | if (strict && size != 1) { |
803 | verbose("Unknown alignment. Only byte-sized access allowed in value access.\n"); | 829 | verbose("Unknown alignment. Only byte-sized access allowed in value access.\n"); |
804 | return -EACCES; | 830 | return -EACCES; |
805 | } | 831 | } |
@@ -807,16 +833,20 @@ static int check_val_ptr_alignment(const struct bpf_reg_state *reg, | |||
807 | return 0; | 833 | return 0; |
808 | } | 834 | } |
809 | 835 | ||
810 | static int check_ptr_alignment(const struct bpf_reg_state *reg, | 836 | static int check_ptr_alignment(struct bpf_verifier_env *env, |
837 | const struct bpf_reg_state *reg, | ||
811 | int off, int size) | 838 | int off, int size) |
812 | { | 839 | { |
840 | bool strict = env->strict_alignment; | ||
841 | |||
842 | if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)) | ||
843 | strict = true; | ||
844 | |||
813 | switch (reg->type) { | 845 | switch (reg->type) { |
814 | case PTR_TO_PACKET: | 846 | case PTR_TO_PACKET: |
815 | return IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) ? 0 : | 847 | return check_pkt_ptr_alignment(reg, off, size, strict); |
816 | check_pkt_ptr_alignment(reg, off, size); | ||
817 | case PTR_TO_MAP_VALUE_ADJ: | 848 | case PTR_TO_MAP_VALUE_ADJ: |
818 | return IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) ? 0 : | 849 | return check_val_ptr_alignment(reg, size, strict); |
819 | check_val_ptr_alignment(reg, size); | ||
820 | default: | 850 | default: |
821 | if (off % size != 0) { | 851 | if (off % size != 0) { |
822 | verbose("misaligned access off %d size %d\n", | 852 | verbose("misaligned access off %d size %d\n", |
@@ -849,7 +879,7 @@ static int check_mem_access(struct bpf_verifier_env *env, u32 regno, int off, | |||
849 | if (size < 0) | 879 | if (size < 0) |
850 | return size; | 880 | return size; |
851 | 881 | ||
852 | err = check_ptr_alignment(reg, off, size); | 882 | err = check_ptr_alignment(env, reg, off, size); |
853 | if (err) | 883 | if (err) |
854 | return err; | 884 | return err; |
855 | 885 | ||
@@ -883,6 +913,8 @@ static int check_mem_access(struct bpf_verifier_env *env, u32 regno, int off, | |||
883 | value_regno); | 913 | value_regno); |
884 | /* note that reg.[id|off|range] == 0 */ | 914 | /* note that reg.[id|off|range] == 0 */ |
885 | state->regs[value_regno].type = reg_type; | 915 | state->regs[value_regno].type = reg_type; |
916 | state->regs[value_regno].aux_off = 0; | ||
917 | state->regs[value_regno].aux_off_align = 0; | ||
886 | } | 918 | } |
887 | 919 | ||
888 | } else if (reg->type == FRAME_PTR || reg->type == PTR_TO_STACK) { | 920 | } else if (reg->type == FRAME_PTR || reg->type == PTR_TO_STACK) { |
@@ -1455,6 +1487,8 @@ add_imm: | |||
1455 | */ | 1487 | */ |
1456 | dst_reg->off += imm; | 1488 | dst_reg->off += imm; |
1457 | } else { | 1489 | } else { |
1490 | bool had_id; | ||
1491 | |||
1458 | if (src_reg->type == PTR_TO_PACKET) { | 1492 | if (src_reg->type == PTR_TO_PACKET) { |
1459 | /* R6=pkt(id=0,off=0,r=62) R7=imm22; r7 += r6 */ | 1493 | /* R6=pkt(id=0,off=0,r=62) R7=imm22; r7 += r6 */ |
1460 | tmp_reg = *dst_reg; /* save r7 state */ | 1494 | tmp_reg = *dst_reg; /* save r7 state */ |
@@ -1488,14 +1522,23 @@ add_imm: | |||
1488 | src_reg->imm); | 1522 | src_reg->imm); |
1489 | return -EACCES; | 1523 | return -EACCES; |
1490 | } | 1524 | } |
1525 | |||
1526 | had_id = (dst_reg->id != 0); | ||
1527 | |||
1491 | /* dst_reg stays as pkt_ptr type and since some positive | 1528 | /* dst_reg stays as pkt_ptr type and since some positive |
1492 | * integer value was added to the pointer, increment its 'id' | 1529 | * integer value was added to the pointer, increment its 'id' |
1493 | */ | 1530 | */ |
1494 | dst_reg->id = ++env->id_gen; | 1531 | dst_reg->id = ++env->id_gen; |
1495 | 1532 | ||
1496 | /* something was added to pkt_ptr, set range and off to zero */ | 1533 | /* something was added to pkt_ptr, set range to zero */ |
1534 | dst_reg->aux_off += dst_reg->off; | ||
1497 | dst_reg->off = 0; | 1535 | dst_reg->off = 0; |
1498 | dst_reg->range = 0; | 1536 | dst_reg->range = 0; |
1537 | if (had_id) | ||
1538 | dst_reg->aux_off_align = min(dst_reg->aux_off_align, | ||
1539 | src_reg->min_align); | ||
1540 | else | ||
1541 | dst_reg->aux_off_align = src_reg->min_align; | ||
1499 | } | 1542 | } |
1500 | return 0; | 1543 | return 0; |
1501 | } | 1544 | } |
@@ -1669,6 +1712,13 @@ static void check_reg_overflow(struct bpf_reg_state *reg) | |||
1669 | reg->min_value = BPF_REGISTER_MIN_RANGE; | 1712 | reg->min_value = BPF_REGISTER_MIN_RANGE; |
1670 | } | 1713 | } |
1671 | 1714 | ||
1715 | static u32 calc_align(u32 imm) | ||
1716 | { | ||
1717 | if (!imm) | ||
1718 | return 1U << 31; | ||
1719 | return imm - ((imm - 1) & imm); | ||
1720 | } | ||
1721 | |||
1672 | static void adjust_reg_min_max_vals(struct bpf_verifier_env *env, | 1722 | static void adjust_reg_min_max_vals(struct bpf_verifier_env *env, |
1673 | struct bpf_insn *insn) | 1723 | struct bpf_insn *insn) |
1674 | { | 1724 | { |
@@ -1676,8 +1726,10 @@ static void adjust_reg_min_max_vals(struct bpf_verifier_env *env, | |||
1676 | s64 min_val = BPF_REGISTER_MIN_RANGE; | 1726 | s64 min_val = BPF_REGISTER_MIN_RANGE; |
1677 | u64 max_val = BPF_REGISTER_MAX_RANGE; | 1727 | u64 max_val = BPF_REGISTER_MAX_RANGE; |
1678 | u8 opcode = BPF_OP(insn->code); | 1728 | u8 opcode = BPF_OP(insn->code); |
1729 | u32 dst_align, src_align; | ||
1679 | 1730 | ||
1680 | dst_reg = ®s[insn->dst_reg]; | 1731 | dst_reg = ®s[insn->dst_reg]; |
1732 | src_align = 0; | ||
1681 | if (BPF_SRC(insn->code) == BPF_X) { | 1733 | if (BPF_SRC(insn->code) == BPF_X) { |
1682 | check_reg_overflow(®s[insn->src_reg]); | 1734 | check_reg_overflow(®s[insn->src_reg]); |
1683 | min_val = regs[insn->src_reg].min_value; | 1735 | min_val = regs[insn->src_reg].min_value; |
@@ -1693,12 +1745,18 @@ static void adjust_reg_min_max_vals(struct bpf_verifier_env *env, | |||
1693 | regs[insn->src_reg].type != UNKNOWN_VALUE) { | 1745 | regs[insn->src_reg].type != UNKNOWN_VALUE) { |
1694 | min_val = BPF_REGISTER_MIN_RANGE; | 1746 | min_val = BPF_REGISTER_MIN_RANGE; |
1695 | max_val = BPF_REGISTER_MAX_RANGE; | 1747 | max_val = BPF_REGISTER_MAX_RANGE; |
1748 | src_align = 0; | ||
1749 | } else { | ||
1750 | src_align = regs[insn->src_reg].min_align; | ||
1696 | } | 1751 | } |
1697 | } else if (insn->imm < BPF_REGISTER_MAX_RANGE && | 1752 | } else if (insn->imm < BPF_REGISTER_MAX_RANGE && |
1698 | (s64)insn->imm > BPF_REGISTER_MIN_RANGE) { | 1753 | (s64)insn->imm > BPF_REGISTER_MIN_RANGE) { |
1699 | min_val = max_val = insn->imm; | 1754 | min_val = max_val = insn->imm; |
1755 | src_align = calc_align(insn->imm); | ||
1700 | } | 1756 | } |
1701 | 1757 | ||
1758 | dst_align = dst_reg->min_align; | ||
1759 | |||
1702 | /* We don't know anything about what was done to this register, mark it | 1760 | /* We don't know anything about what was done to this register, mark it |
1703 | * as unknown. | 1761 | * as unknown. |
1704 | */ | 1762 | */ |
@@ -1723,18 +1781,21 @@ static void adjust_reg_min_max_vals(struct bpf_verifier_env *env, | |||
1723 | dst_reg->min_value += min_val; | 1781 | dst_reg->min_value += min_val; |
1724 | if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE) | 1782 | if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE) |
1725 | dst_reg->max_value += max_val; | 1783 | dst_reg->max_value += max_val; |
1784 | dst_reg->min_align = min(src_align, dst_align); | ||
1726 | break; | 1785 | break; |
1727 | case BPF_SUB: | 1786 | case BPF_SUB: |
1728 | if (dst_reg->min_value != BPF_REGISTER_MIN_RANGE) | 1787 | if (dst_reg->min_value != BPF_REGISTER_MIN_RANGE) |
1729 | dst_reg->min_value -= min_val; | 1788 | dst_reg->min_value -= min_val; |
1730 | if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE) | 1789 | if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE) |
1731 | dst_reg->max_value -= max_val; | 1790 | dst_reg->max_value -= max_val; |
1791 | dst_reg->min_align = min(src_align, dst_align); | ||
1732 | break; | 1792 | break; |
1733 | case BPF_MUL: | 1793 | case BPF_MUL: |
1734 | if (dst_reg->min_value != BPF_REGISTER_MIN_RANGE) | 1794 | if (dst_reg->min_value != BPF_REGISTER_MIN_RANGE) |
1735 | dst_reg->min_value *= min_val; | 1795 | dst_reg->min_value *= min_val; |
1736 | if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE) | 1796 | if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE) |
1737 | dst_reg->max_value *= max_val; | 1797 | dst_reg->max_value *= max_val; |
1798 | dst_reg->min_align = max(src_align, dst_align); | ||
1738 | break; | 1799 | break; |
1739 | case BPF_AND: | 1800 | case BPF_AND: |
1740 | /* Disallow AND'ing of negative numbers, ain't nobody got time | 1801 | /* Disallow AND'ing of negative numbers, ain't nobody got time |
@@ -1746,17 +1807,23 @@ static void adjust_reg_min_max_vals(struct bpf_verifier_env *env, | |||
1746 | else | 1807 | else |
1747 | dst_reg->min_value = 0; | 1808 | dst_reg->min_value = 0; |
1748 | dst_reg->max_value = max_val; | 1809 | dst_reg->max_value = max_val; |
1810 | dst_reg->min_align = max(src_align, dst_align); | ||
1749 | break; | 1811 | break; |
1750 | case BPF_LSH: | 1812 | case BPF_LSH: |
1751 | /* Gotta have special overflow logic here, if we're shifting | 1813 | /* Gotta have special overflow logic here, if we're shifting |
1752 | * more than MAX_RANGE then just assume we have an invalid | 1814 | * more than MAX_RANGE then just assume we have an invalid |
1753 | * range. | 1815 | * range. |
1754 | */ | 1816 | */ |
1755 | if (min_val > ilog2(BPF_REGISTER_MAX_RANGE)) | 1817 | if (min_val > ilog2(BPF_REGISTER_MAX_RANGE)) { |
1756 | dst_reg->min_value = BPF_REGISTER_MIN_RANGE; | 1818 | dst_reg->min_value = BPF_REGISTER_MIN_RANGE; |
1757 | else if (dst_reg->min_value != BPF_REGISTER_MIN_RANGE) | 1819 | dst_reg->min_align = 1; |
1758 | dst_reg->min_value <<= min_val; | 1820 | } else { |
1759 | 1821 | if (dst_reg->min_value != BPF_REGISTER_MIN_RANGE) | |
1822 | dst_reg->min_value <<= min_val; | ||
1823 | if (!dst_reg->min_align) | ||
1824 | dst_reg->min_align = 1; | ||
1825 | dst_reg->min_align <<= min_val; | ||
1826 | } | ||
1760 | if (max_val > ilog2(BPF_REGISTER_MAX_RANGE)) | 1827 | if (max_val > ilog2(BPF_REGISTER_MAX_RANGE)) |
1761 | dst_reg->max_value = BPF_REGISTER_MAX_RANGE; | 1828 | dst_reg->max_value = BPF_REGISTER_MAX_RANGE; |
1762 | else if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE) | 1829 | else if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE) |
@@ -1766,11 +1833,19 @@ static void adjust_reg_min_max_vals(struct bpf_verifier_env *env, | |||
1766 | /* RSH by a negative number is undefined, and the BPF_RSH is an | 1833 | /* RSH by a negative number is undefined, and the BPF_RSH is an |
1767 | * unsigned shift, so make the appropriate casts. | 1834 | * unsigned shift, so make the appropriate casts. |
1768 | */ | 1835 | */ |
1769 | if (min_val < 0 || dst_reg->min_value < 0) | 1836 | if (min_val < 0 || dst_reg->min_value < 0) { |
1770 | dst_reg->min_value = BPF_REGISTER_MIN_RANGE; | 1837 | dst_reg->min_value = BPF_REGISTER_MIN_RANGE; |
1771 | else | 1838 | } else { |
1772 | dst_reg->min_value = | 1839 | dst_reg->min_value = |
1773 | (u64)(dst_reg->min_value) >> min_val; | 1840 | (u64)(dst_reg->min_value) >> min_val; |
1841 | } | ||
1842 | if (min_val < 0) { | ||
1843 | dst_reg->min_align = 1; | ||
1844 | } else { | ||
1845 | dst_reg->min_align >>= (u64) min_val; | ||
1846 | if (!dst_reg->min_align) | ||
1847 | dst_reg->min_align = 1; | ||
1848 | } | ||
1774 | if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE) | 1849 | if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE) |
1775 | dst_reg->max_value >>= max_val; | 1850 | dst_reg->max_value >>= max_val; |
1776 | break; | 1851 | break; |
@@ -1872,6 +1947,7 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn) | |||
1872 | regs[insn->dst_reg].imm = insn->imm; | 1947 | regs[insn->dst_reg].imm = insn->imm; |
1873 | regs[insn->dst_reg].max_value = insn->imm; | 1948 | regs[insn->dst_reg].max_value = insn->imm; |
1874 | regs[insn->dst_reg].min_value = insn->imm; | 1949 | regs[insn->dst_reg].min_value = insn->imm; |
1950 | regs[insn->dst_reg].min_align = calc_align(insn->imm); | ||
1875 | } | 1951 | } |
1876 | 1952 | ||
1877 | } else if (opcode > BPF_END) { | 1953 | } else if (opcode > BPF_END) { |
@@ -2564,6 +2640,7 @@ peek_stack: | |||
2564 | env->explored_states[t + 1] = STATE_LIST_MARK; | 2640 | env->explored_states[t + 1] = STATE_LIST_MARK; |
2565 | } else { | 2641 | } else { |
2566 | /* conditional jump with two edges */ | 2642 | /* conditional jump with two edges */ |
2643 | env->explored_states[t] = STATE_LIST_MARK; | ||
2567 | ret = push_insn(t, t + 1, FALLTHROUGH, env); | 2644 | ret = push_insn(t, t + 1, FALLTHROUGH, env); |
2568 | if (ret == 1) | 2645 | if (ret == 1) |
2569 | goto peek_stack; | 2646 | goto peek_stack; |
@@ -2722,6 +2799,12 @@ static bool states_equal(struct bpf_verifier_env *env, | |||
2722 | rcur->type != NOT_INIT)) | 2799 | rcur->type != NOT_INIT)) |
2723 | continue; | 2800 | continue; |
2724 | 2801 | ||
2802 | /* Don't care about the reg->id in this case. */ | ||
2803 | if (rold->type == PTR_TO_MAP_VALUE_OR_NULL && | ||
2804 | rcur->type == PTR_TO_MAP_VALUE_OR_NULL && | ||
2805 | rold->map_ptr == rcur->map_ptr) | ||
2806 | continue; | ||
2807 | |||
2725 | if (rold->type == PTR_TO_PACKET && rcur->type == PTR_TO_PACKET && | 2808 | if (rold->type == PTR_TO_PACKET && rcur->type == PTR_TO_PACKET && |
2726 | compare_ptrs_to_packet(rold, rcur)) | 2809 | compare_ptrs_to_packet(rold, rcur)) |
2727 | continue; | 2810 | continue; |
@@ -2856,8 +2939,15 @@ static int do_check(struct bpf_verifier_env *env) | |||
2856 | goto process_bpf_exit; | 2939 | goto process_bpf_exit; |
2857 | } | 2940 | } |
2858 | 2941 | ||
2859 | if (log_level && do_print_state) { | 2942 | if (need_resched()) |
2860 | verbose("\nfrom %d to %d:", prev_insn_idx, insn_idx); | 2943 | cond_resched(); |
2944 | |||
2945 | if (log_level > 1 || (log_level && do_print_state)) { | ||
2946 | if (log_level > 1) | ||
2947 | verbose("%d:", insn_idx); | ||
2948 | else | ||
2949 | verbose("\nfrom %d to %d:", | ||
2950 | prev_insn_idx, insn_idx); | ||
2861 | print_verifier_state(&env->cur_state); | 2951 | print_verifier_state(&env->cur_state); |
2862 | do_print_state = false; | 2952 | do_print_state = false; |
2863 | } | 2953 | } |
@@ -3494,6 +3584,10 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr) | |||
3494 | } else { | 3584 | } else { |
3495 | log_level = 0; | 3585 | log_level = 0; |
3496 | } | 3586 | } |
3587 | if (attr->prog_flags & BPF_F_STRICT_ALIGNMENT) | ||
3588 | env->strict_alignment = true; | ||
3589 | else | ||
3590 | env->strict_alignment = false; | ||
3497 | 3591 | ||
3498 | ret = replace_map_fd_with_map_ptr(env); | 3592 | ret = replace_map_fd_with_map_ptr(env); |
3499 | if (ret < 0) | 3593 | if (ret < 0) |
@@ -3599,6 +3693,7 @@ int bpf_analyzer(struct bpf_prog *prog, const struct bpf_ext_analyzer_ops *ops, | |||
3599 | mutex_lock(&bpf_verifier_lock); | 3693 | mutex_lock(&bpf_verifier_lock); |
3600 | 3694 | ||
3601 | log_level = 0; | 3695 | log_level = 0; |
3696 | env->strict_alignment = false; | ||
3602 | 3697 | ||
3603 | env->explored_states = kcalloc(env->prog->len, | 3698 | env->explored_states = kcalloc(env->prog->len, |
3604 | sizeof(struct bpf_verifier_state_list *), | 3699 | sizeof(struct bpf_verifier_state_list *), |
diff --git a/kernel/fork.c b/kernel/fork.c index 06d759ab4c62..aa1076c5e4a9 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1845,11 +1845,13 @@ static __latent_entropy struct task_struct *copy_process( | |||
1845 | */ | 1845 | */ |
1846 | recalc_sigpending(); | 1846 | recalc_sigpending(); |
1847 | if (signal_pending(current)) { | 1847 | if (signal_pending(current)) { |
1848 | spin_unlock(¤t->sighand->siglock); | ||
1849 | write_unlock_irq(&tasklist_lock); | ||
1850 | retval = -ERESTARTNOINTR; | 1848 | retval = -ERESTARTNOINTR; |
1851 | goto bad_fork_cancel_cgroup; | 1849 | goto bad_fork_cancel_cgroup; |
1852 | } | 1850 | } |
1851 | if (unlikely(!(ns_of_pid(pid)->nr_hashed & PIDNS_HASH_ADDING))) { | ||
1852 | retval = -ENOMEM; | ||
1853 | goto bad_fork_cancel_cgroup; | ||
1854 | } | ||
1853 | 1855 | ||
1854 | if (likely(p->pid)) { | 1856 | if (likely(p->pid)) { |
1855 | ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace); | 1857 | ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace); |
@@ -1907,6 +1909,8 @@ static __latent_entropy struct task_struct *copy_process( | |||
1907 | return p; | 1909 | return p; |
1908 | 1910 | ||
1909 | bad_fork_cancel_cgroup: | 1911 | bad_fork_cancel_cgroup: |
1912 | spin_unlock(¤t->sighand->siglock); | ||
1913 | write_unlock_irq(&tasklist_lock); | ||
1910 | cgroup_cancel_fork(p); | 1914 | cgroup_cancel_fork(p); |
1911 | bad_fork_free_pid: | 1915 | bad_fork_free_pid: |
1912 | cgroup_threadgroup_change_end(current); | 1916 | cgroup_threadgroup_change_end(current); |
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 686be4b73018..c94da688ee9b 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
@@ -880,8 +880,8 @@ irq_set_chained_handler_and_data(unsigned int irq, irq_flow_handler_t handle, | |||
880 | if (!desc) | 880 | if (!desc) |
881 | return; | 881 | return; |
882 | 882 | ||
883 | __irq_do_set_handler(desc, handle, 1, NULL); | ||
884 | desc->irq_common_data.handler_data = data; | 883 | desc->irq_common_data.handler_data = data; |
884 | __irq_do_set_handler(desc, handle, 1, NULL); | ||
885 | 885 | ||
886 | irq_put_desc_busunlock(desc, flags); | 886 | irq_put_desc_busunlock(desc, flags); |
887 | } | 887 | } |
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 7367e0ec6f81..2d2d3a568e4e 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -595,7 +595,7 @@ static void kprobe_optimizer(struct work_struct *work) | |||
595 | } | 595 | } |
596 | 596 | ||
597 | /* Wait for completing optimization and unoptimization */ | 597 | /* Wait for completing optimization and unoptimization */ |
598 | static void wait_for_kprobe_optimizer(void) | 598 | void wait_for_kprobe_optimizer(void) |
599 | { | 599 | { |
600 | mutex_lock(&kprobe_mutex); | 600 | mutex_lock(&kprobe_mutex); |
601 | 601 | ||
@@ -2183,6 +2183,12 @@ static int kprobes_module_callback(struct notifier_block *nb, | |||
2183 | * The vaddr this probe is installed will soon | 2183 | * The vaddr this probe is installed will soon |
2184 | * be vfreed buy not synced to disk. Hence, | 2184 | * be vfreed buy not synced to disk. Hence, |
2185 | * disarming the breakpoint isn't needed. | 2185 | * disarming the breakpoint isn't needed. |
2186 | * | ||
2187 | * Note, this will also move any optimized probes | ||
2188 | * that are pending to be removed from their | ||
2189 | * corresponding lists to the freeing_list and | ||
2190 | * will not be touched by the delayed | ||
2191 | * kprobe_optimizer work handler. | ||
2186 | */ | 2192 | */ |
2187 | kill_kprobe(p); | 2193 | kill_kprobe(p); |
2188 | } | 2194 | } |
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index d1f3e9f558b8..74a5a7255b4d 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c | |||
@@ -277,7 +277,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) | |||
277 | * if reparented. | 277 | * if reparented. |
278 | */ | 278 | */ |
279 | for (;;) { | 279 | for (;;) { |
280 | set_current_state(TASK_UNINTERRUPTIBLE); | 280 | set_current_state(TASK_INTERRUPTIBLE); |
281 | if (pid_ns->nr_hashed == init_pids) | 281 | if (pid_ns->nr_hashed == init_pids) |
282 | break; | 282 | break; |
283 | schedule(); | 283 | schedule(); |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 759f4bd52cd6..803c3bc274c4 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -3502,6 +3502,31 @@ asmlinkage __visible void __sched schedule(void) | |||
3502 | } | 3502 | } |
3503 | EXPORT_SYMBOL(schedule); | 3503 | EXPORT_SYMBOL(schedule); |
3504 | 3504 | ||
3505 | /* | ||
3506 | * synchronize_rcu_tasks() makes sure that no task is stuck in preempted | ||
3507 | * state (have scheduled out non-voluntarily) by making sure that all | ||
3508 | * tasks have either left the run queue or have gone into user space. | ||
3509 | * As idle tasks do not do either, they must not ever be preempted | ||
3510 | * (schedule out non-voluntarily). | ||
3511 | * | ||
3512 | * schedule_idle() is similar to schedule_preempt_disable() except that it | ||
3513 | * never enables preemption because it does not call sched_submit_work(). | ||
3514 | */ | ||
3515 | void __sched schedule_idle(void) | ||
3516 | { | ||
3517 | /* | ||
3518 | * As this skips calling sched_submit_work(), which the idle task does | ||
3519 | * regardless because that function is a nop when the task is in a | ||
3520 | * TASK_RUNNING state, make sure this isn't used someplace that the | ||
3521 | * current task can be in any other state. Note, idle is always in the | ||
3522 | * TASK_RUNNING state. | ||
3523 | */ | ||
3524 | WARN_ON_ONCE(current->state); | ||
3525 | do { | ||
3526 | __schedule(false); | ||
3527 | } while (need_resched()); | ||
3528 | } | ||
3529 | |||
3505 | #ifdef CONFIG_CONTEXT_TRACKING | 3530 | #ifdef CONFIG_CONTEXT_TRACKING |
3506 | asmlinkage __visible void __sched schedule_user(void) | 3531 | asmlinkage __visible void __sched schedule_user(void) |
3507 | { | 3532 | { |
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 2a25a9ec2c6e..ef63adce0c9c 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c | |||
@@ -265,7 +265,7 @@ static void do_idle(void) | |||
265 | smp_mb__after_atomic(); | 265 | smp_mb__after_atomic(); |
266 | 266 | ||
267 | sched_ttwu_pending(); | 267 | sched_ttwu_pending(); |
268 | schedule_preempt_disabled(); | 268 | schedule_idle(); |
269 | 269 | ||
270 | if (unlikely(klp_patch_pending(current))) | 270 | if (unlikely(klp_patch_pending(current))) |
271 | klp_update_patch_state(current); | 271 | klp_update_patch_state(current); |
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 7808ab050599..6dda2aab731e 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h | |||
@@ -1467,6 +1467,8 @@ static inline struct cpuidle_state *idle_get_state(struct rq *rq) | |||
1467 | } | 1467 | } |
1468 | #endif | 1468 | #endif |
1469 | 1469 | ||
1470 | extern void schedule_idle(void); | ||
1471 | |||
1470 | extern void sysrq_sched_debug_show(void); | 1472 | extern void sysrq_sched_debug_show(void); |
1471 | extern void sched_init_granularity(void); | 1473 | extern void sched_init_granularity(void); |
1472 | extern void update_max_interval(void); | 1474 | extern void update_max_interval(void); |
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index bd8ae8d5ae9c..193c5f5e3f79 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -1662,14 +1662,14 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev, | |||
1662 | goto out; | 1662 | goto out; |
1663 | 1663 | ||
1664 | if (attr == &dev_attr_act_mask) { | 1664 | if (attr == &dev_attr_act_mask) { |
1665 | if (sscanf(buf, "%llx", &value) != 1) { | 1665 | if (kstrtoull(buf, 0, &value)) { |
1666 | /* Assume it is a list of trace category names */ | 1666 | /* Assume it is a list of trace category names */ |
1667 | ret = blk_trace_str2mask(buf); | 1667 | ret = blk_trace_str2mask(buf); |
1668 | if (ret < 0) | 1668 | if (ret < 0) |
1669 | goto out; | 1669 | goto out; |
1670 | value = ret; | 1670 | value = ret; |
1671 | } | 1671 | } |
1672 | } else if (sscanf(buf, "%llu", &value) != 1) | 1672 | } else if (kstrtoull(buf, 0, &value)) |
1673 | goto out; | 1673 | goto out; |
1674 | 1674 | ||
1675 | ret = -ENXIO; | 1675 | ret = -ENXIO; |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 39dca4e86a94..74fdfe9ed3db 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -4144,9 +4144,9 @@ unregister_ftrace_function_probe_func(char *glob, struct trace_array *tr, | |||
4144 | int i, ret = -ENODEV; | 4144 | int i, ret = -ENODEV; |
4145 | int size; | 4145 | int size; |
4146 | 4146 | ||
4147 | if (glob && (strcmp(glob, "*") == 0 || !strlen(glob))) | 4147 | if (!glob || !strlen(glob) || !strcmp(glob, "*")) |
4148 | func_g.search = NULL; | 4148 | func_g.search = NULL; |
4149 | else if (glob) { | 4149 | else { |
4150 | int not; | 4150 | int not; |
4151 | 4151 | ||
4152 | func_g.type = filter_parse_regex(glob, strlen(glob), | 4152 | func_g.type = filter_parse_regex(glob, strlen(glob), |
@@ -4256,6 +4256,14 @@ unregister_ftrace_function_probe_func(char *glob, struct trace_array *tr, | |||
4256 | return ret; | 4256 | return ret; |
4257 | } | 4257 | } |
4258 | 4258 | ||
4259 | void clear_ftrace_function_probes(struct trace_array *tr) | ||
4260 | { | ||
4261 | struct ftrace_func_probe *probe, *n; | ||
4262 | |||
4263 | list_for_each_entry_safe(probe, n, &tr->func_probes, list) | ||
4264 | unregister_ftrace_function_probe_func(NULL, tr, probe->probe_ops); | ||
4265 | } | ||
4266 | |||
4259 | static LIST_HEAD(ftrace_commands); | 4267 | static LIST_HEAD(ftrace_commands); |
4260 | static DEFINE_MUTEX(ftrace_cmd_mutex); | 4268 | static DEFINE_MUTEX(ftrace_cmd_mutex); |
4261 | 4269 | ||
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index c4536c449021..1122f151466f 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1558,7 +1558,7 @@ static __init int init_trace_selftests(void) | |||
1558 | 1558 | ||
1559 | return 0; | 1559 | return 0; |
1560 | } | 1560 | } |
1561 | early_initcall(init_trace_selftests); | 1561 | core_initcall(init_trace_selftests); |
1562 | #else | 1562 | #else |
1563 | static inline int run_tracer_selftest(struct tracer *type) | 1563 | static inline int run_tracer_selftest(struct tracer *type) |
1564 | { | 1564 | { |
@@ -2568,7 +2568,36 @@ static inline void ftrace_trace_stack(struct trace_array *tr, | |||
2568 | void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, | 2568 | void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, |
2569 | int pc) | 2569 | int pc) |
2570 | { | 2570 | { |
2571 | __ftrace_trace_stack(tr->trace_buffer.buffer, flags, skip, pc, NULL); | 2571 | struct ring_buffer *buffer = tr->trace_buffer.buffer; |
2572 | |||
2573 | if (rcu_is_watching()) { | ||
2574 | __ftrace_trace_stack(buffer, flags, skip, pc, NULL); | ||
2575 | return; | ||
2576 | } | ||
2577 | |||
2578 | /* | ||
2579 | * When an NMI triggers, RCU is enabled via rcu_nmi_enter(), | ||
2580 | * but if the above rcu_is_watching() failed, then the NMI | ||
2581 | * triggered someplace critical, and rcu_irq_enter() should | ||
2582 | * not be called from NMI. | ||
2583 | */ | ||
2584 | if (unlikely(in_nmi())) | ||
2585 | return; | ||
2586 | |||
2587 | /* | ||
2588 | * It is possible that a function is being traced in a | ||
2589 | * location that RCU is not watching. A call to | ||
2590 | * rcu_irq_enter() will make sure that it is, but there's | ||
2591 | * a few internal rcu functions that could be traced | ||
2592 | * where that wont work either. In those cases, we just | ||
2593 | * do nothing. | ||
2594 | */ | ||
2595 | if (unlikely(rcu_irq_enter_disabled())) | ||
2596 | return; | ||
2597 | |||
2598 | rcu_irq_enter_irqson(); | ||
2599 | __ftrace_trace_stack(buffer, flags, skip, pc, NULL); | ||
2600 | rcu_irq_exit_irqson(); | ||
2572 | } | 2601 | } |
2573 | 2602 | ||
2574 | /** | 2603 | /** |
@@ -7550,6 +7579,7 @@ static int instance_rmdir(const char *name) | |||
7550 | } | 7579 | } |
7551 | 7580 | ||
7552 | tracing_set_nop(tr); | 7581 | tracing_set_nop(tr); |
7582 | clear_ftrace_function_probes(tr); | ||
7553 | event_trace_del_tracer(tr); | 7583 | event_trace_del_tracer(tr); |
7554 | ftrace_clear_pids(tr); | 7584 | ftrace_clear_pids(tr); |
7555 | ftrace_destroy_function_files(tr); | 7585 | ftrace_destroy_function_files(tr); |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 291a1bca5748..39fd77330aab 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -980,6 +980,7 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr, | |||
980 | extern int | 980 | extern int |
981 | unregister_ftrace_function_probe_func(char *glob, struct trace_array *tr, | 981 | unregister_ftrace_function_probe_func(char *glob, struct trace_array *tr, |
982 | struct ftrace_probe_ops *ops); | 982 | struct ftrace_probe_ops *ops); |
983 | extern void clear_ftrace_function_probes(struct trace_array *tr); | ||
983 | 984 | ||
984 | int register_ftrace_command(struct ftrace_func_command *cmd); | 985 | int register_ftrace_command(struct ftrace_func_command *cmd); |
985 | int unregister_ftrace_command(struct ftrace_func_command *cmd); | 986 | int unregister_ftrace_command(struct ftrace_func_command *cmd); |
@@ -998,6 +999,10 @@ static inline __init int unregister_ftrace_command(char *cmd_name) | |||
998 | { | 999 | { |
999 | return -EINVAL; | 1000 | return -EINVAL; |
1000 | } | 1001 | } |
1002 | static inline void clear_ftrace_function_probes(struct trace_array *tr) | ||
1003 | { | ||
1004 | } | ||
1005 | |||
1001 | /* | 1006 | /* |
1002 | * The ops parameter passed in is usually undefined. | 1007 | * The ops parameter passed in is usually undefined. |
1003 | * This must be a macro. | 1008 | * This must be a macro. |
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 8485f6738a87..c129fca6ec99 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c | |||
@@ -1535,6 +1535,11 @@ static __init int kprobe_trace_self_tests_init(void) | |||
1535 | 1535 | ||
1536 | end: | 1536 | end: |
1537 | release_all_trace_kprobes(); | 1537 | release_all_trace_kprobes(); |
1538 | /* | ||
1539 | * Wait for the optimizer work to finish. Otherwise it might fiddle | ||
1540 | * with probes in already freed __init text. | ||
1541 | */ | ||
1542 | wait_for_kprobe_optimizer(); | ||
1538 | if (warn) | 1543 | if (warn) |
1539 | pr_cont("NG: Some tests are failed. Please check them.\n"); | 1544 | pr_cont("NG: Some tests are failed. Please check them.\n"); |
1540 | else | 1545 | else |
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c index 71e85643b3f9..6ad3e043c617 100644 --- a/net/9p/trans_xen.c +++ b/net/9p/trans_xen.c | |||
@@ -454,8 +454,8 @@ static int xen_9pfs_front_probe(struct xenbus_device *dev, | |||
454 | goto error_xenbus; | 454 | goto error_xenbus; |
455 | } | 455 | } |
456 | priv->tag = xenbus_read(xbt, dev->nodename, "tag", NULL); | 456 | priv->tag = xenbus_read(xbt, dev->nodename, "tag", NULL); |
457 | if (!priv->tag) { | 457 | if (IS_ERR(priv->tag)) { |
458 | ret = -EINVAL; | 458 | ret = PTR_ERR(priv->tag); |
459 | goto error_xenbus; | 459 | goto error_xenbus; |
460 | } | 460 | } |
461 | ret = xenbus_transaction_end(xbt, 0); | 461 | ret = xenbus_transaction_end(xbt, 0); |
@@ -525,7 +525,7 @@ static struct xenbus_driver xen_9pfs_front_driver = { | |||
525 | .otherend_changed = xen_9pfs_front_changed, | 525 | .otherend_changed = xen_9pfs_front_changed, |
526 | }; | 526 | }; |
527 | 527 | ||
528 | int p9_trans_xen_init(void) | 528 | static int p9_trans_xen_init(void) |
529 | { | 529 | { |
530 | if (!xen_domain()) | 530 | if (!xen_domain()) |
531 | return -ENODEV; | 531 | return -ENODEV; |
@@ -537,7 +537,7 @@ int p9_trans_xen_init(void) | |||
537 | } | 537 | } |
538 | module_init(p9_trans_xen_init); | 538 | module_init(p9_trans_xen_init); |
539 | 539 | ||
540 | void p9_trans_xen_exit(void) | 540 | static void p9_trans_xen_exit(void) |
541 | { | 541 | { |
542 | v9fs_unregister_trans(&p9_xen_trans); | 542 | v9fs_unregister_trans(&p9_xen_trans); |
543 | return xenbus_unregister_driver(&xen_9pfs_front_driver); | 543 | return xenbus_unregister_driver(&xen_9pfs_front_driver); |
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index c5ce7745b230..574f78824d8a 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -835,6 +835,13 @@ static int br_validate(struct nlattr *tb[], struct nlattr *data[]) | |||
835 | return -EPROTONOSUPPORT; | 835 | return -EPROTONOSUPPORT; |
836 | } | 836 | } |
837 | } | 837 | } |
838 | |||
839 | if (data[IFLA_BR_VLAN_DEFAULT_PVID]) { | ||
840 | __u16 defpvid = nla_get_u16(data[IFLA_BR_VLAN_DEFAULT_PVID]); | ||
841 | |||
842 | if (defpvid >= VLAN_VID_MASK) | ||
843 | return -EINVAL; | ||
844 | } | ||
838 | #endif | 845 | #endif |
839 | 846 | ||
840 | return 0; | 847 | return 0; |
diff --git a/net/core/dev.c b/net/core/dev.c index 96cf83da0d66..fca407b4a6ea 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -6852,6 +6852,32 @@ int dev_change_proto_down(struct net_device *dev, bool proto_down) | |||
6852 | } | 6852 | } |
6853 | EXPORT_SYMBOL(dev_change_proto_down); | 6853 | EXPORT_SYMBOL(dev_change_proto_down); |
6854 | 6854 | ||
6855 | bool __dev_xdp_attached(struct net_device *dev, xdp_op_t xdp_op) | ||
6856 | { | ||
6857 | struct netdev_xdp xdp; | ||
6858 | |||
6859 | memset(&xdp, 0, sizeof(xdp)); | ||
6860 | xdp.command = XDP_QUERY_PROG; | ||
6861 | |||
6862 | /* Query must always succeed. */ | ||
6863 | WARN_ON(xdp_op(dev, &xdp) < 0); | ||
6864 | return xdp.prog_attached; | ||
6865 | } | ||
6866 | |||
6867 | static int dev_xdp_install(struct net_device *dev, xdp_op_t xdp_op, | ||
6868 | struct netlink_ext_ack *extack, | ||
6869 | struct bpf_prog *prog) | ||
6870 | { | ||
6871 | struct netdev_xdp xdp; | ||
6872 | |||
6873 | memset(&xdp, 0, sizeof(xdp)); | ||
6874 | xdp.command = XDP_SETUP_PROG; | ||
6875 | xdp.extack = extack; | ||
6876 | xdp.prog = prog; | ||
6877 | |||
6878 | return xdp_op(dev, &xdp); | ||
6879 | } | ||
6880 | |||
6855 | /** | 6881 | /** |
6856 | * dev_change_xdp_fd - set or clear a bpf program for a device rx path | 6882 | * dev_change_xdp_fd - set or clear a bpf program for a device rx path |
6857 | * @dev: device | 6883 | * @dev: device |
@@ -6864,41 +6890,34 @@ EXPORT_SYMBOL(dev_change_proto_down); | |||
6864 | int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, | 6890 | int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, |
6865 | int fd, u32 flags) | 6891 | int fd, u32 flags) |
6866 | { | 6892 | { |
6867 | int (*xdp_op)(struct net_device *dev, struct netdev_xdp *xdp); | ||
6868 | const struct net_device_ops *ops = dev->netdev_ops; | 6893 | const struct net_device_ops *ops = dev->netdev_ops; |
6869 | struct bpf_prog *prog = NULL; | 6894 | struct bpf_prog *prog = NULL; |
6870 | struct netdev_xdp xdp; | 6895 | xdp_op_t xdp_op, xdp_chk; |
6871 | int err; | 6896 | int err; |
6872 | 6897 | ||
6873 | ASSERT_RTNL(); | 6898 | ASSERT_RTNL(); |
6874 | 6899 | ||
6875 | xdp_op = ops->ndo_xdp; | 6900 | xdp_op = xdp_chk = ops->ndo_xdp; |
6901 | if (!xdp_op && (flags & XDP_FLAGS_DRV_MODE)) | ||
6902 | return -EOPNOTSUPP; | ||
6876 | if (!xdp_op || (flags & XDP_FLAGS_SKB_MODE)) | 6903 | if (!xdp_op || (flags & XDP_FLAGS_SKB_MODE)) |
6877 | xdp_op = generic_xdp_install; | 6904 | xdp_op = generic_xdp_install; |
6905 | if (xdp_op == xdp_chk) | ||
6906 | xdp_chk = generic_xdp_install; | ||
6878 | 6907 | ||
6879 | if (fd >= 0) { | 6908 | if (fd >= 0) { |
6880 | if (flags & XDP_FLAGS_UPDATE_IF_NOEXIST) { | 6909 | if (xdp_chk && __dev_xdp_attached(dev, xdp_chk)) |
6881 | memset(&xdp, 0, sizeof(xdp)); | 6910 | return -EEXIST; |
6882 | xdp.command = XDP_QUERY_PROG; | 6911 | if ((flags & XDP_FLAGS_UPDATE_IF_NOEXIST) && |
6883 | 6912 | __dev_xdp_attached(dev, xdp_op)) | |
6884 | err = xdp_op(dev, &xdp); | 6913 | return -EBUSY; |
6885 | if (err < 0) | ||
6886 | return err; | ||
6887 | if (xdp.prog_attached) | ||
6888 | return -EBUSY; | ||
6889 | } | ||
6890 | 6914 | ||
6891 | prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_XDP); | 6915 | prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_XDP); |
6892 | if (IS_ERR(prog)) | 6916 | if (IS_ERR(prog)) |
6893 | return PTR_ERR(prog); | 6917 | return PTR_ERR(prog); |
6894 | } | 6918 | } |
6895 | 6919 | ||
6896 | memset(&xdp, 0, sizeof(xdp)); | 6920 | err = dev_xdp_install(dev, xdp_op, extack, prog); |
6897 | xdp.command = XDP_SETUP_PROG; | ||
6898 | xdp.extack = extack; | ||
6899 | xdp.prog = prog; | ||
6900 | |||
6901 | err = xdp_op(dev, &xdp); | ||
6902 | if (err < 0 && prog) | 6921 | if (err < 0 && prog) |
6903 | bpf_prog_put(prog); | 6922 | bpf_prog_put(prog); |
6904 | 6923 | ||
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 58b0bcc125b5..d274f81fcc2c 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1132,10 +1132,6 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, | |||
1132 | lladdr = neigh->ha; | 1132 | lladdr = neigh->ha; |
1133 | } | 1133 | } |
1134 | 1134 | ||
1135 | if (new & NUD_CONNECTED) | ||
1136 | neigh->confirmed = jiffies; | ||
1137 | neigh->updated = jiffies; | ||
1138 | |||
1139 | /* If entry was valid and address is not changed, | 1135 | /* If entry was valid and address is not changed, |
1140 | do not change entry state, if new one is STALE. | 1136 | do not change entry state, if new one is STALE. |
1141 | */ | 1137 | */ |
@@ -1157,6 +1153,16 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, | |||
1157 | } | 1153 | } |
1158 | } | 1154 | } |
1159 | 1155 | ||
1156 | /* Update timestamps only once we know we will make a change to the | ||
1157 | * neighbour entry. Otherwise we risk to move the locktime window with | ||
1158 | * noop updates and ignore relevant ARP updates. | ||
1159 | */ | ||
1160 | if (new != old || lladdr != neigh->ha) { | ||
1161 | if (new & NUD_CONNECTED) | ||
1162 | neigh->confirmed = jiffies; | ||
1163 | neigh->updated = jiffies; | ||
1164 | } | ||
1165 | |||
1160 | if (new != old) { | 1166 | if (new != old) { |
1161 | neigh_del_timer(neigh); | 1167 | neigh_del_timer(neigh); |
1162 | if (new & NUD_PROBE) | 1168 | if (new & NUD_PROBE) |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index bcb0f610ee42..49a279a7cc15 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -899,8 +899,7 @@ static size_t rtnl_port_size(const struct net_device *dev, | |||
899 | static size_t rtnl_xdp_size(void) | 899 | static size_t rtnl_xdp_size(void) |
900 | { | 900 | { |
901 | size_t xdp_size = nla_total_size(0) + /* nest IFLA_XDP */ | 901 | size_t xdp_size = nla_total_size(0) + /* nest IFLA_XDP */ |
902 | nla_total_size(1) + /* XDP_ATTACHED */ | 902 | nla_total_size(1); /* XDP_ATTACHED */ |
903 | nla_total_size(4); /* XDP_FLAGS */ | ||
904 | 903 | ||
905 | return xdp_size; | 904 | return xdp_size; |
906 | } | 905 | } |
@@ -1247,37 +1246,34 @@ static int rtnl_fill_link_ifmap(struct sk_buff *skb, struct net_device *dev) | |||
1247 | return 0; | 1246 | return 0; |
1248 | } | 1247 | } |
1249 | 1248 | ||
1249 | static u8 rtnl_xdp_attached_mode(struct net_device *dev) | ||
1250 | { | ||
1251 | const struct net_device_ops *ops = dev->netdev_ops; | ||
1252 | |||
1253 | ASSERT_RTNL(); | ||
1254 | |||
1255 | if (rcu_access_pointer(dev->xdp_prog)) | ||
1256 | return XDP_ATTACHED_SKB; | ||
1257 | if (ops->ndo_xdp && __dev_xdp_attached(dev, ops->ndo_xdp)) | ||
1258 | return XDP_ATTACHED_DRV; | ||
1259 | |||
1260 | return XDP_ATTACHED_NONE; | ||
1261 | } | ||
1262 | |||
1250 | static int rtnl_xdp_fill(struct sk_buff *skb, struct net_device *dev) | 1263 | static int rtnl_xdp_fill(struct sk_buff *skb, struct net_device *dev) |
1251 | { | 1264 | { |
1252 | struct nlattr *xdp; | 1265 | struct nlattr *xdp; |
1253 | u32 xdp_flags = 0; | ||
1254 | u8 val = 0; | ||
1255 | int err; | 1266 | int err; |
1256 | 1267 | ||
1257 | xdp = nla_nest_start(skb, IFLA_XDP); | 1268 | xdp = nla_nest_start(skb, IFLA_XDP); |
1258 | if (!xdp) | 1269 | if (!xdp) |
1259 | return -EMSGSIZE; | 1270 | return -EMSGSIZE; |
1260 | if (rcu_access_pointer(dev->xdp_prog)) { | 1271 | |
1261 | xdp_flags = XDP_FLAGS_SKB_MODE; | 1272 | err = nla_put_u8(skb, IFLA_XDP_ATTACHED, |
1262 | val = 1; | 1273 | rtnl_xdp_attached_mode(dev)); |
1263 | } else if (dev->netdev_ops->ndo_xdp) { | ||
1264 | struct netdev_xdp xdp_op = {}; | ||
1265 | |||
1266 | xdp_op.command = XDP_QUERY_PROG; | ||
1267 | err = dev->netdev_ops->ndo_xdp(dev, &xdp_op); | ||
1268 | if (err) | ||
1269 | goto err_cancel; | ||
1270 | val = xdp_op.prog_attached; | ||
1271 | } | ||
1272 | err = nla_put_u8(skb, IFLA_XDP_ATTACHED, val); | ||
1273 | if (err) | 1274 | if (err) |
1274 | goto err_cancel; | 1275 | goto err_cancel; |
1275 | 1276 | ||
1276 | if (xdp_flags) { | ||
1277 | err = nla_put_u32(skb, IFLA_XDP_FLAGS, xdp_flags); | ||
1278 | if (err) | ||
1279 | goto err_cancel; | ||
1280 | } | ||
1281 | nla_nest_end(skb, xdp); | 1277 | nla_nest_end(skb, xdp); |
1282 | return 0; | 1278 | return 0; |
1283 | 1279 | ||
@@ -1631,13 +1627,13 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | |||
1631 | cb->nlh->nlmsg_seq, 0, | 1627 | cb->nlh->nlmsg_seq, 0, |
1632 | flags, | 1628 | flags, |
1633 | ext_filter_mask); | 1629 | ext_filter_mask); |
1634 | /* If we ran out of room on the first message, | ||
1635 | * we're in trouble | ||
1636 | */ | ||
1637 | WARN_ON((err == -EMSGSIZE) && (skb->len == 0)); | ||
1638 | 1630 | ||
1639 | if (err < 0) | 1631 | if (err < 0) { |
1640 | goto out; | 1632 | if (likely(skb->len)) |
1633 | goto out; | ||
1634 | |||
1635 | goto out_err; | ||
1636 | } | ||
1641 | 1637 | ||
1642 | nl_dump_check_consistent(cb, nlmsg_hdr(skb)); | 1638 | nl_dump_check_consistent(cb, nlmsg_hdr(skb)); |
1643 | cont: | 1639 | cont: |
@@ -1645,10 +1641,12 @@ cont: | |||
1645 | } | 1641 | } |
1646 | } | 1642 | } |
1647 | out: | 1643 | out: |
1644 | err = skb->len; | ||
1645 | out_err: | ||
1648 | cb->args[1] = idx; | 1646 | cb->args[1] = idx; |
1649 | cb->args[0] = h; | 1647 | cb->args[0] = h; |
1650 | 1648 | ||
1651 | return skb->len; | 1649 | return err; |
1652 | } | 1650 | } |
1653 | 1651 | ||
1654 | int rtnl_nla_parse_ifla(struct nlattr **tb, const struct nlattr *head, int len, | 1652 | int rtnl_nla_parse_ifla(struct nlattr **tb, const struct nlattr *head, int len, |
@@ -2199,6 +2197,11 @@ static int do_setlink(const struct sk_buff *skb, | |||
2199 | err = -EINVAL; | 2197 | err = -EINVAL; |
2200 | goto errout; | 2198 | goto errout; |
2201 | } | 2199 | } |
2200 | if ((xdp_flags & XDP_FLAGS_SKB_MODE) && | ||
2201 | (xdp_flags & XDP_FLAGS_DRV_MODE)) { | ||
2202 | err = -EINVAL; | ||
2203 | goto errout; | ||
2204 | } | ||
2202 | } | 2205 | } |
2203 | 2206 | ||
2204 | if (xdp[IFLA_XDP_FD]) { | 2207 | if (xdp[IFLA_XDP_FD]) { |
@@ -3452,8 +3455,12 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) | |||
3452 | err = br_dev->netdev_ops->ndo_bridge_getlink( | 3455 | err = br_dev->netdev_ops->ndo_bridge_getlink( |
3453 | skb, portid, seq, dev, | 3456 | skb, portid, seq, dev, |
3454 | filter_mask, NLM_F_MULTI); | 3457 | filter_mask, NLM_F_MULTI); |
3455 | if (err < 0 && err != -EOPNOTSUPP) | 3458 | if (err < 0 && err != -EOPNOTSUPP) { |
3456 | break; | 3459 | if (likely(skb->len)) |
3460 | break; | ||
3461 | |||
3462 | goto out_err; | ||
3463 | } | ||
3457 | } | 3464 | } |
3458 | idx++; | 3465 | idx++; |
3459 | } | 3466 | } |
@@ -3464,16 +3471,22 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) | |||
3464 | seq, dev, | 3471 | seq, dev, |
3465 | filter_mask, | 3472 | filter_mask, |
3466 | NLM_F_MULTI); | 3473 | NLM_F_MULTI); |
3467 | if (err < 0 && err != -EOPNOTSUPP) | 3474 | if (err < 0 && err != -EOPNOTSUPP) { |
3468 | break; | 3475 | if (likely(skb->len)) |
3476 | break; | ||
3477 | |||
3478 | goto out_err; | ||
3479 | } | ||
3469 | } | 3480 | } |
3470 | idx++; | 3481 | idx++; |
3471 | } | 3482 | } |
3472 | } | 3483 | } |
3484 | err = skb->len; | ||
3485 | out_err: | ||
3473 | rcu_read_unlock(); | 3486 | rcu_read_unlock(); |
3474 | cb->args[0] = idx; | 3487 | cb->args[0] = idx; |
3475 | 3488 | ||
3476 | return skb->len; | 3489 | return err; |
3477 | } | 3490 | } |
3478 | 3491 | ||
3479 | static inline size_t bridge_nlmsg_size(void) | 3492 | static inline size_t bridge_nlmsg_size(void) |
diff --git a/net/core/sock.c b/net/core/sock.c index 79c6aee6af9b..727f924b7f91 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -139,10 +139,7 @@ | |||
139 | 139 | ||
140 | #include <trace/events/sock.h> | 140 | #include <trace/events/sock.h> |
141 | 141 | ||
142 | #ifdef CONFIG_INET | ||
143 | #include <net/tcp.h> | 142 | #include <net/tcp.h> |
144 | #endif | ||
145 | |||
146 | #include <net/busy_poll.h> | 143 | #include <net/busy_poll.h> |
147 | 144 | ||
148 | static DEFINE_MUTEX(proto_list_mutex); | 145 | static DEFINE_MUTEX(proto_list_mutex); |
@@ -1803,28 +1800,24 @@ EXPORT_SYMBOL(skb_set_owner_w); | |||
1803 | * delay queue. We want to allow the owner socket to send more | 1800 | * delay queue. We want to allow the owner socket to send more |
1804 | * packets, as if they were already TX completed by a typical driver. | 1801 | * packets, as if they were already TX completed by a typical driver. |
1805 | * But we also want to keep skb->sk set because some packet schedulers | 1802 | * But we also want to keep skb->sk set because some packet schedulers |
1806 | * rely on it (sch_fq for example). So we set skb->truesize to a small | 1803 | * rely on it (sch_fq for example). |
1807 | * amount (1) and decrease sk_wmem_alloc accordingly. | ||
1808 | */ | 1804 | */ |
1809 | void skb_orphan_partial(struct sk_buff *skb) | 1805 | void skb_orphan_partial(struct sk_buff *skb) |
1810 | { | 1806 | { |
1811 | /* If this skb is a TCP pure ACK or already went here, | 1807 | if (skb_is_tcp_pure_ack(skb)) |
1812 | * we have nothing to do. 2 is already a very small truesize. | ||
1813 | */ | ||
1814 | if (skb->truesize <= 2) | ||
1815 | return; | 1808 | return; |
1816 | 1809 | ||
1817 | /* TCP stack sets skb->ooo_okay based on sk_wmem_alloc, | ||
1818 | * so we do not completely orphan skb, but transfert all | ||
1819 | * accounted bytes but one, to avoid unexpected reorders. | ||
1820 | */ | ||
1821 | if (skb->destructor == sock_wfree | 1810 | if (skb->destructor == sock_wfree |
1822 | #ifdef CONFIG_INET | 1811 | #ifdef CONFIG_INET |
1823 | || skb->destructor == tcp_wfree | 1812 | || skb->destructor == tcp_wfree |
1824 | #endif | 1813 | #endif |
1825 | ) { | 1814 | ) { |
1826 | atomic_sub(skb->truesize - 1, &skb->sk->sk_wmem_alloc); | 1815 | struct sock *sk = skb->sk; |
1827 | skb->truesize = 1; | 1816 | |
1817 | if (atomic_inc_not_zero(&sk->sk_refcnt)) { | ||
1818 | atomic_sub(skb->truesize, &sk->sk_wmem_alloc); | ||
1819 | skb->destructor = sock_efree; | ||
1820 | } | ||
1828 | } else { | 1821 | } else { |
1829 | skb_orphan(skb); | 1822 | skb_orphan(skb); |
1830 | } | 1823 | } |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 840f14aaa016..992621172220 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -426,6 +426,9 @@ static struct sock *dccp_v6_request_recv_sock(const struct sock *sk, | |||
426 | newsk->sk_backlog_rcv = dccp_v4_do_rcv; | 426 | newsk->sk_backlog_rcv = dccp_v4_do_rcv; |
427 | newnp->pktoptions = NULL; | 427 | newnp->pktoptions = NULL; |
428 | newnp->opt = NULL; | 428 | newnp->opt = NULL; |
429 | newnp->ipv6_mc_list = NULL; | ||
430 | newnp->ipv6_ac_list = NULL; | ||
431 | newnp->ipv6_fl_list = NULL; | ||
429 | newnp->mcast_oif = inet6_iif(skb); | 432 | newnp->mcast_oif = inet6_iif(skb); |
430 | newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; | 433 | newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; |
431 | 434 | ||
@@ -490,6 +493,9 @@ static struct sock *dccp_v6_request_recv_sock(const struct sock *sk, | |||
490 | /* Clone RX bits */ | 493 | /* Clone RX bits */ |
491 | newnp->rxopt.all = np->rxopt.all; | 494 | newnp->rxopt.all = np->rxopt.all; |
492 | 495 | ||
496 | newnp->ipv6_mc_list = NULL; | ||
497 | newnp->ipv6_ac_list = NULL; | ||
498 | newnp->ipv6_fl_list = NULL; | ||
493 | newnp->pktoptions = NULL; | 499 | newnp->pktoptions = NULL; |
494 | newnp->opt = NULL; | 500 | newnp->opt = NULL; |
495 | newnp->mcast_oif = inet6_iif(skb); | 501 | newnp->mcast_oif = inet6_iif(skb); |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 0937b34c27ca..d54345a06f72 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -653,6 +653,7 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb) | |||
653 | unsigned char *arp_ptr; | 653 | unsigned char *arp_ptr; |
654 | struct rtable *rt; | 654 | struct rtable *rt; |
655 | unsigned char *sha; | 655 | unsigned char *sha; |
656 | unsigned char *tha = NULL; | ||
656 | __be32 sip, tip; | 657 | __be32 sip, tip; |
657 | u16 dev_type = dev->type; | 658 | u16 dev_type = dev->type; |
658 | int addr_type; | 659 | int addr_type; |
@@ -724,6 +725,7 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb) | |||
724 | break; | 725 | break; |
725 | #endif | 726 | #endif |
726 | default: | 727 | default: |
728 | tha = arp_ptr; | ||
727 | arp_ptr += dev->addr_len; | 729 | arp_ptr += dev->addr_len; |
728 | } | 730 | } |
729 | memcpy(&tip, arp_ptr, 4); | 731 | memcpy(&tip, arp_ptr, 4); |
@@ -842,8 +844,18 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb) | |||
842 | It is possible, that this option should be enabled for some | 844 | It is possible, that this option should be enabled for some |
843 | devices (strip is candidate) | 845 | devices (strip is candidate) |
844 | */ | 846 | */ |
845 | is_garp = arp->ar_op == htons(ARPOP_REQUEST) && tip == sip && | 847 | is_garp = tip == sip && addr_type == RTN_UNICAST; |
846 | addr_type == RTN_UNICAST; | 848 | |
849 | /* Unsolicited ARP _replies_ also require target hwaddr to be | ||
850 | * the same as source. | ||
851 | */ | ||
852 | if (is_garp && arp->ar_op == htons(ARPOP_REPLY)) | ||
853 | is_garp = | ||
854 | /* IPv4 over IEEE 1394 doesn't provide target | ||
855 | * hardware address field in its ARP payload. | ||
856 | */ | ||
857 | tha && | ||
858 | !memcmp(tha, sha, dev->addr_len); | ||
847 | 859 | ||
848 | if (!n && | 860 | if (!n && |
849 | ((arp->ar_op == htons(ARPOP_REPLY) && | 861 | ((arp->ar_op == htons(ARPOP_REPLY) && |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 39bd1edee676..83e3ed258467 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -763,7 +763,7 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) | |||
763 | unsigned int e = 0, s_e; | 763 | unsigned int e = 0, s_e; |
764 | struct fib_table *tb; | 764 | struct fib_table *tb; |
765 | struct hlist_head *head; | 765 | struct hlist_head *head; |
766 | int dumped = 0; | 766 | int dumped = 0, err; |
767 | 767 | ||
768 | if (nlmsg_len(cb->nlh) >= sizeof(struct rtmsg) && | 768 | if (nlmsg_len(cb->nlh) >= sizeof(struct rtmsg) && |
769 | ((struct rtmsg *) nlmsg_data(cb->nlh))->rtm_flags & RTM_F_CLONED) | 769 | ((struct rtmsg *) nlmsg_data(cb->nlh))->rtm_flags & RTM_F_CLONED) |
@@ -783,20 +783,27 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) | |||
783 | if (dumped) | 783 | if (dumped) |
784 | memset(&cb->args[2], 0, sizeof(cb->args) - | 784 | memset(&cb->args[2], 0, sizeof(cb->args) - |
785 | 2 * sizeof(cb->args[0])); | 785 | 2 * sizeof(cb->args[0])); |
786 | if (fib_table_dump(tb, skb, cb) < 0) | 786 | err = fib_table_dump(tb, skb, cb); |
787 | goto out; | 787 | if (err < 0) { |
788 | if (likely(skb->len)) | ||
789 | goto out; | ||
790 | |||
791 | goto out_err; | ||
792 | } | ||
788 | dumped = 1; | 793 | dumped = 1; |
789 | next: | 794 | next: |
790 | e++; | 795 | e++; |
791 | } | 796 | } |
792 | } | 797 | } |
793 | out: | 798 | out: |
799 | err = skb->len; | ||
800 | out_err: | ||
794 | rcu_read_unlock(); | 801 | rcu_read_unlock(); |
795 | 802 | ||
796 | cb->args[1] = e; | 803 | cb->args[1] = e; |
797 | cb->args[0] = h; | 804 | cb->args[0] = h; |
798 | 805 | ||
799 | return skb->len; | 806 | return err; |
800 | } | 807 | } |
801 | 808 | ||
802 | /* Prepare and feed intra-kernel routing request. | 809 | /* Prepare and feed intra-kernel routing request. |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 1201409ba1dc..51182ff2b441 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1983,6 +1983,8 @@ static int fn_trie_dump_leaf(struct key_vector *l, struct fib_table *tb, | |||
1983 | 1983 | ||
1984 | /* rcu_read_lock is hold by caller */ | 1984 | /* rcu_read_lock is hold by caller */ |
1985 | hlist_for_each_entry_rcu(fa, &l->leaf, fa_list) { | 1985 | hlist_for_each_entry_rcu(fa, &l->leaf, fa_list) { |
1986 | int err; | ||
1987 | |||
1986 | if (i < s_i) { | 1988 | if (i < s_i) { |
1987 | i++; | 1989 | i++; |
1988 | continue; | 1990 | continue; |
@@ -1993,17 +1995,14 @@ static int fn_trie_dump_leaf(struct key_vector *l, struct fib_table *tb, | |||
1993 | continue; | 1995 | continue; |
1994 | } | 1996 | } |
1995 | 1997 | ||
1996 | if (fib_dump_info(skb, NETLINK_CB(cb->skb).portid, | 1998 | err = fib_dump_info(skb, NETLINK_CB(cb->skb).portid, |
1997 | cb->nlh->nlmsg_seq, | 1999 | cb->nlh->nlmsg_seq, RTM_NEWROUTE, |
1998 | RTM_NEWROUTE, | 2000 | tb->tb_id, fa->fa_type, |
1999 | tb->tb_id, | 2001 | xkey, KEYLENGTH - fa->fa_slen, |
2000 | fa->fa_type, | 2002 | fa->fa_tos, fa->fa_info, NLM_F_MULTI); |
2001 | xkey, | 2003 | if (err < 0) { |
2002 | KEYLENGTH - fa->fa_slen, | ||
2003 | fa->fa_tos, | ||
2004 | fa->fa_info, NLM_F_MULTI) < 0) { | ||
2005 | cb->args[4] = i; | 2004 | cb->args[4] = i; |
2006 | return -1; | 2005 | return err; |
2007 | } | 2006 | } |
2008 | i++; | 2007 | i++; |
2009 | } | 2008 | } |
@@ -2025,10 +2024,13 @@ int fib_table_dump(struct fib_table *tb, struct sk_buff *skb, | |||
2025 | t_key key = cb->args[3]; | 2024 | t_key key = cb->args[3]; |
2026 | 2025 | ||
2027 | while ((l = leaf_walk_rcu(&tp, key)) != NULL) { | 2026 | while ((l = leaf_walk_rcu(&tp, key)) != NULL) { |
2028 | if (fn_trie_dump_leaf(l, tb, skb, cb) < 0) { | 2027 | int err; |
2028 | |||
2029 | err = fn_trie_dump_leaf(l, tb, skb, cb); | ||
2030 | if (err < 0) { | ||
2029 | cb->args[3] = key; | 2031 | cb->args[3] = key; |
2030 | cb->args[2] = count; | 2032 | cb->args[2] = count; |
2031 | return -1; | 2033 | return err; |
2032 | } | 2034 | } |
2033 | 2035 | ||
2034 | ++count; | 2036 | ++count; |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 3a02d52ed50e..551de4d023a8 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1980,6 +1980,20 @@ int ip_mr_input(struct sk_buff *skb) | |||
1980 | struct net *net = dev_net(skb->dev); | 1980 | struct net *net = dev_net(skb->dev); |
1981 | int local = skb_rtable(skb)->rt_flags & RTCF_LOCAL; | 1981 | int local = skb_rtable(skb)->rt_flags & RTCF_LOCAL; |
1982 | struct mr_table *mrt; | 1982 | struct mr_table *mrt; |
1983 | struct net_device *dev; | ||
1984 | |||
1985 | /* skb->dev passed in is the loX master dev for vrfs. | ||
1986 | * As there are no vifs associated with loopback devices, | ||
1987 | * get the proper interface that does have a vif associated with it. | ||
1988 | */ | ||
1989 | dev = skb->dev; | ||
1990 | if (netif_is_l3_master(skb->dev)) { | ||
1991 | dev = dev_get_by_index_rcu(net, IPCB(skb)->iif); | ||
1992 | if (!dev) { | ||
1993 | kfree_skb(skb); | ||
1994 | return -ENODEV; | ||
1995 | } | ||
1996 | } | ||
1983 | 1997 | ||
1984 | /* Packet is looped back after forward, it should not be | 1998 | /* Packet is looped back after forward, it should not be |
1985 | * forwarded second time, but still can be delivered locally. | 1999 | * forwarded second time, but still can be delivered locally. |
@@ -2017,7 +2031,7 @@ int ip_mr_input(struct sk_buff *skb) | |||
2017 | /* already under rcu_read_lock() */ | 2031 | /* already under rcu_read_lock() */ |
2018 | cache = ipmr_cache_find(mrt, ip_hdr(skb)->saddr, ip_hdr(skb)->daddr); | 2032 | cache = ipmr_cache_find(mrt, ip_hdr(skb)->saddr, ip_hdr(skb)->daddr); |
2019 | if (!cache) { | 2033 | if (!cache) { |
2020 | int vif = ipmr_find_vif(mrt, skb->dev); | 2034 | int vif = ipmr_find_vif(mrt, dev); |
2021 | 2035 | ||
2022 | if (vif >= 0) | 2036 | if (vif >= 0) |
2023 | cache = ipmr_cache_find_any(mrt, ip_hdr(skb)->daddr, | 2037 | cache = ipmr_cache_find_any(mrt, ip_hdr(skb)->daddr, |
@@ -2037,7 +2051,7 @@ int ip_mr_input(struct sk_buff *skb) | |||
2037 | } | 2051 | } |
2038 | 2052 | ||
2039 | read_lock(&mrt_lock); | 2053 | read_lock(&mrt_lock); |
2040 | vif = ipmr_find_vif(mrt, skb->dev); | 2054 | vif = ipmr_find_vif(mrt, dev); |
2041 | if (vif >= 0) { | 2055 | if (vif >= 0) { |
2042 | int err2 = ipmr_cache_unresolved(mrt, vif, skb); | 2056 | int err2 = ipmr_cache_unresolved(mrt, vif, skb); |
2043 | read_unlock(&mrt_lock); | 2057 | read_unlock(&mrt_lock); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 5a3ad09e2786..174d4376baa5 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1179,13 +1179,14 @@ static int tcp_match_skb_to_sack(struct sock *sk, struct sk_buff *skb, | |||
1179 | */ | 1179 | */ |
1180 | if (pkt_len > mss) { | 1180 | if (pkt_len > mss) { |
1181 | unsigned int new_len = (pkt_len / mss) * mss; | 1181 | unsigned int new_len = (pkt_len / mss) * mss; |
1182 | if (!in_sack && new_len < pkt_len) { | 1182 | if (!in_sack && new_len < pkt_len) |
1183 | new_len += mss; | 1183 | new_len += mss; |
1184 | if (new_len >= skb->len) | ||
1185 | return 0; | ||
1186 | } | ||
1187 | pkt_len = new_len; | 1184 | pkt_len = new_len; |
1188 | } | 1185 | } |
1186 | |||
1187 | if (pkt_len >= skb->len && !in_sack) | ||
1188 | return 0; | ||
1189 | |||
1189 | err = tcp_fragment(sk, skb, pkt_len, mss, GFP_ATOMIC); | 1190 | err = tcp_fragment(sk, skb, pkt_len, mss, GFP_ATOMIC); |
1190 | if (err < 0) | 1191 | if (err < 0) |
1191 | return err; | 1192 | return err; |
@@ -3189,7 +3190,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, | |||
3189 | int delta; | 3190 | int delta; |
3190 | 3191 | ||
3191 | /* Non-retransmitted hole got filled? That's reordering */ | 3192 | /* Non-retransmitted hole got filled? That's reordering */ |
3192 | if (reord < prior_fackets) | 3193 | if (reord < prior_fackets && reord <= tp->fackets_out) |
3193 | tcp_update_reordering(sk, tp->fackets_out - reord, 0); | 3194 | tcp_update_reordering(sk, tp->fackets_out - reord, 0); |
3194 | 3195 | ||
3195 | delta = tcp_is_fack(tp) ? pkts_acked : | 3196 | delta = tcp_is_fack(tp) ? pkts_acked : |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index ea6e4cff9faf..1d6219bf2d6b 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1612,7 +1612,7 @@ static void udp_v4_rehash(struct sock *sk) | |||
1612 | udp_lib_rehash(sk, new_hash); | 1612 | udp_lib_rehash(sk, new_hash); |
1613 | } | 1613 | } |
1614 | 1614 | ||
1615 | int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | 1615 | static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) |
1616 | { | 1616 | { |
1617 | int rc; | 1617 | int rc; |
1618 | 1618 | ||
@@ -1657,7 +1657,7 @@ EXPORT_SYMBOL(udp_encap_enable); | |||
1657 | * Note that in the success and error cases, the skb is assumed to | 1657 | * Note that in the success and error cases, the skb is assumed to |
1658 | * have either been requeued or freed. | 1658 | * have either been requeued or freed. |
1659 | */ | 1659 | */ |
1660 | int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | 1660 | static int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) |
1661 | { | 1661 | { |
1662 | struct udp_sock *up = udp_sk(sk); | 1662 | struct udp_sock *up = udp_sk(sk); |
1663 | int is_udplite = IS_UDPLITE(sk); | 1663 | int is_udplite = IS_UDPLITE(sk); |
diff --git a/net/ipv4/udp_impl.h b/net/ipv4/udp_impl.h index feb50a16398d..a8cf8c6fb60c 100644 --- a/net/ipv4/udp_impl.h +++ b/net/ipv4/udp_impl.h | |||
@@ -25,7 +25,6 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock, | |||
25 | int flags, int *addr_len); | 25 | int flags, int *addr_len); |
26 | int udp_sendpage(struct sock *sk, struct page *page, int offset, size_t size, | 26 | int udp_sendpage(struct sock *sk, struct page *page, int offset, size_t size, |
27 | int flags); | 27 | int flags); |
28 | int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); | ||
29 | void udp_destroy_sock(struct sock *sk); | 28 | void udp_destroy_sock(struct sock *sk); |
30 | 29 | ||
31 | #ifdef CONFIG_PROC_FS | 30 | #ifdef CONFIG_PROC_FS |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 8d297a79b568..6a4fb1e629fb 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1022,7 +1022,10 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, | |||
1022 | INIT_HLIST_NODE(&ifa->addr_lst); | 1022 | INIT_HLIST_NODE(&ifa->addr_lst); |
1023 | ifa->scope = scope; | 1023 | ifa->scope = scope; |
1024 | ifa->prefix_len = pfxlen; | 1024 | ifa->prefix_len = pfxlen; |
1025 | ifa->flags = flags | IFA_F_TENTATIVE; | 1025 | ifa->flags = flags; |
1026 | /* No need to add the TENTATIVE flag for addresses with NODAD */ | ||
1027 | if (!(flags & IFA_F_NODAD)) | ||
1028 | ifa->flags |= IFA_F_TENTATIVE; | ||
1026 | ifa->valid_lft = valid_lft; | 1029 | ifa->valid_lft = valid_lft; |
1027 | ifa->prefered_lft = prefered_lft; | 1030 | ifa->prefered_lft = prefered_lft; |
1028 | ifa->cstamp = ifa->tstamp = jiffies; | 1031 | ifa->cstamp = ifa->tstamp = jiffies; |
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index 93e58a5e1837..280268f1dd7b 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c | |||
@@ -63,7 +63,6 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, | |||
63 | const struct net_offload *ops; | 63 | const struct net_offload *ops; |
64 | int proto; | 64 | int proto; |
65 | struct frag_hdr *fptr; | 65 | struct frag_hdr *fptr; |
66 | unsigned int unfrag_ip6hlen; | ||
67 | unsigned int payload_len; | 66 | unsigned int payload_len; |
68 | u8 *prevhdr; | 67 | u8 *prevhdr; |
69 | int offset = 0; | 68 | int offset = 0; |
@@ -116,8 +115,10 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, | |||
116 | skb->network_header = (u8 *)ipv6h - skb->head; | 115 | skb->network_header = (u8 *)ipv6h - skb->head; |
117 | 116 | ||
118 | if (udpfrag) { | 117 | if (udpfrag) { |
119 | unfrag_ip6hlen = ip6_find_1stfragopt(skb, &prevhdr); | 118 | int err = ip6_find_1stfragopt(skb, &prevhdr); |
120 | fptr = (struct frag_hdr *)((u8 *)ipv6h + unfrag_ip6hlen); | 119 | if (err < 0) |
120 | return ERR_PTR(err); | ||
121 | fptr = (struct frag_hdr *)((u8 *)ipv6h + err); | ||
121 | fptr->frag_off = htons(offset); | 122 | fptr->frag_off = htons(offset); |
122 | if (skb->next) | 123 | if (skb->next) |
123 | fptr->frag_off |= htons(IP6_MF); | 124 | fptr->frag_off |= htons(IP6_MF); |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 58f6288e9ba5..d4a31becbd25 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -597,7 +597,10 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, | |||
597 | int ptr, offset = 0, err = 0; | 597 | int ptr, offset = 0, err = 0; |
598 | u8 *prevhdr, nexthdr = 0; | 598 | u8 *prevhdr, nexthdr = 0; |
599 | 599 | ||
600 | hlen = ip6_find_1stfragopt(skb, &prevhdr); | 600 | err = ip6_find_1stfragopt(skb, &prevhdr); |
601 | if (err < 0) | ||
602 | goto fail; | ||
603 | hlen = err; | ||
601 | nexthdr = *prevhdr; | 604 | nexthdr = *prevhdr; |
602 | 605 | ||
603 | mtu = ip6_skb_dst_mtu(skb); | 606 | mtu = ip6_skb_dst_mtu(skb); |
diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c index cd4252346a32..e9065b8d3af8 100644 --- a/net/ipv6/output_core.c +++ b/net/ipv6/output_core.c | |||
@@ -79,14 +79,13 @@ EXPORT_SYMBOL(ipv6_select_ident); | |||
79 | int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) | 79 | int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) |
80 | { | 80 | { |
81 | u16 offset = sizeof(struct ipv6hdr); | 81 | u16 offset = sizeof(struct ipv6hdr); |
82 | struct ipv6_opt_hdr *exthdr = | ||
83 | (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1); | ||
84 | unsigned int packet_len = skb_tail_pointer(skb) - | 82 | unsigned int packet_len = skb_tail_pointer(skb) - |
85 | skb_network_header(skb); | 83 | skb_network_header(skb); |
86 | int found_rhdr = 0; | 84 | int found_rhdr = 0; |
87 | *nexthdr = &ipv6_hdr(skb)->nexthdr; | 85 | *nexthdr = &ipv6_hdr(skb)->nexthdr; |
88 | 86 | ||
89 | while (offset + 1 <= packet_len) { | 87 | while (offset <= packet_len) { |
88 | struct ipv6_opt_hdr *exthdr; | ||
90 | 89 | ||
91 | switch (**nexthdr) { | 90 | switch (**nexthdr) { |
92 | 91 | ||
@@ -107,13 +106,16 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) | |||
107 | return offset; | 106 | return offset; |
108 | } | 107 | } |
109 | 108 | ||
110 | offset += ipv6_optlen(exthdr); | 109 | if (offset + sizeof(struct ipv6_opt_hdr) > packet_len) |
111 | *nexthdr = &exthdr->nexthdr; | 110 | return -EINVAL; |
111 | |||
112 | exthdr = (struct ipv6_opt_hdr *)(skb_network_header(skb) + | 112 | exthdr = (struct ipv6_opt_hdr *)(skb_network_header(skb) + |
113 | offset); | 113 | offset); |
114 | offset += ipv6_optlen(exthdr); | ||
115 | *nexthdr = &exthdr->nexthdr; | ||
114 | } | 116 | } |
115 | 117 | ||
116 | return offset; | 118 | return -EINVAL; |
117 | } | 119 | } |
118 | EXPORT_SYMBOL(ip6_find_1stfragopt); | 120 | EXPORT_SYMBOL(ip6_find_1stfragopt); |
119 | 121 | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 7a8237acd210..4f4310a36a04 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1062,6 +1062,7 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff * | |||
1062 | newtp->af_specific = &tcp_sock_ipv6_mapped_specific; | 1062 | newtp->af_specific = &tcp_sock_ipv6_mapped_specific; |
1063 | #endif | 1063 | #endif |
1064 | 1064 | ||
1065 | newnp->ipv6_mc_list = NULL; | ||
1065 | newnp->ipv6_ac_list = NULL; | 1066 | newnp->ipv6_ac_list = NULL; |
1066 | newnp->ipv6_fl_list = NULL; | 1067 | newnp->ipv6_fl_list = NULL; |
1067 | newnp->pktoptions = NULL; | 1068 | newnp->pktoptions = NULL; |
@@ -1131,6 +1132,7 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff * | |||
1131 | First: no IPv4 options. | 1132 | First: no IPv4 options. |
1132 | */ | 1133 | */ |
1133 | newinet->inet_opt = NULL; | 1134 | newinet->inet_opt = NULL; |
1135 | newnp->ipv6_mc_list = NULL; | ||
1134 | newnp->ipv6_ac_list = NULL; | 1136 | newnp->ipv6_ac_list = NULL; |
1135 | newnp->ipv6_fl_list = NULL; | 1137 | newnp->ipv6_fl_list = NULL; |
1136 | 1138 | ||
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 04862abfe4ec..06ec39b79609 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -526,7 +526,7 @@ out: | |||
526 | return; | 526 | return; |
527 | } | 527 | } |
528 | 528 | ||
529 | int __udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | 529 | static int __udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) |
530 | { | 530 | { |
531 | int rc; | 531 | int rc; |
532 | 532 | ||
@@ -569,7 +569,7 @@ void udpv6_encap_enable(void) | |||
569 | } | 569 | } |
570 | EXPORT_SYMBOL(udpv6_encap_enable); | 570 | EXPORT_SYMBOL(udpv6_encap_enable); |
571 | 571 | ||
572 | int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | 572 | static int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) |
573 | { | 573 | { |
574 | struct udp_sock *up = udp_sk(sk); | 574 | struct udp_sock *up = udp_sk(sk); |
575 | int is_udplite = IS_UDPLITE(sk); | 575 | int is_udplite = IS_UDPLITE(sk); |
diff --git a/net/ipv6/udp_impl.h b/net/ipv6/udp_impl.h index e78bdc76dcc3..f180b3d85e31 100644 --- a/net/ipv6/udp_impl.h +++ b/net/ipv6/udp_impl.h | |||
@@ -26,7 +26,6 @@ int compat_udpv6_getsockopt(struct sock *sk, int level, int optname, | |||
26 | int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len); | 26 | int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len); |
27 | int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock, | 27 | int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock, |
28 | int flags, int *addr_len); | 28 | int flags, int *addr_len); |
29 | int __udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); | ||
30 | void udpv6_destroy_sock(struct sock *sk); | 29 | void udpv6_destroy_sock(struct sock *sk); |
31 | 30 | ||
32 | #ifdef CONFIG_PROC_FS | 31 | #ifdef CONFIG_PROC_FS |
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c index ac858c480f2f..a2267f80febb 100644 --- a/net/ipv6/udp_offload.c +++ b/net/ipv6/udp_offload.c | |||
@@ -29,6 +29,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, | |||
29 | u8 frag_hdr_sz = sizeof(struct frag_hdr); | 29 | u8 frag_hdr_sz = sizeof(struct frag_hdr); |
30 | __wsum csum; | 30 | __wsum csum; |
31 | int tnl_hlen; | 31 | int tnl_hlen; |
32 | int err; | ||
32 | 33 | ||
33 | mss = skb_shinfo(skb)->gso_size; | 34 | mss = skb_shinfo(skb)->gso_size; |
34 | if (unlikely(skb->len <= mss)) | 35 | if (unlikely(skb->len <= mss)) |
@@ -90,7 +91,10 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, | |||
90 | /* Find the unfragmentable header and shift it left by frag_hdr_sz | 91 | /* Find the unfragmentable header and shift it left by frag_hdr_sz |
91 | * bytes to insert fragment header. | 92 | * bytes to insert fragment header. |
92 | */ | 93 | */ |
93 | unfrag_ip6hlen = ip6_find_1stfragopt(skb, &prevhdr); | 94 | err = ip6_find_1stfragopt(skb, &prevhdr); |
95 | if (err < 0) | ||
96 | return ERR_PTR(err); | ||
97 | unfrag_ip6hlen = err; | ||
94 | nexthdr = *prevhdr; | 98 | nexthdr = *prevhdr; |
95 | *prevhdr = NEXTHDR_FRAGMENT; | 99 | *prevhdr = NEXTHDR_FRAGMENT; |
96 | unfrag_len = (skb_network_header(skb) - skb_mac_header(skb)) + | 100 | unfrag_len = (skb_network_header(skb) - skb_mac_header(skb)) + |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index f4001763134d..e3eeed19cc7a 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -2658,13 +2658,6 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) | |||
2658 | dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex); | 2658 | dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex); |
2659 | } | 2659 | } |
2660 | 2660 | ||
2661 | sockc.tsflags = po->sk.sk_tsflags; | ||
2662 | if (msg->msg_controllen) { | ||
2663 | err = sock_cmsg_send(&po->sk, msg, &sockc); | ||
2664 | if (unlikely(err)) | ||
2665 | goto out; | ||
2666 | } | ||
2667 | |||
2668 | err = -ENXIO; | 2661 | err = -ENXIO; |
2669 | if (unlikely(dev == NULL)) | 2662 | if (unlikely(dev == NULL)) |
2670 | goto out; | 2663 | goto out; |
@@ -2672,6 +2665,13 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) | |||
2672 | if (unlikely(!(dev->flags & IFF_UP))) | 2665 | if (unlikely(!(dev->flags & IFF_UP))) |
2673 | goto out_put; | 2666 | goto out_put; |
2674 | 2667 | ||
2668 | sockc.tsflags = po->sk.sk_tsflags; | ||
2669 | if (msg->msg_controllen) { | ||
2670 | err = sock_cmsg_send(&po->sk, msg, &sockc); | ||
2671 | if (unlikely(err)) | ||
2672 | goto out_put; | ||
2673 | } | ||
2674 | |||
2675 | if (po->sk.sk_socket->type == SOCK_RAW) | 2675 | if (po->sk.sk_socket->type == SOCK_RAW) |
2676 | reserve = dev->hard_header_len; | 2676 | reserve = dev->hard_header_len; |
2677 | size_max = po->tx_ring.frame_size | 2677 | size_max = po->tx_ring.frame_size |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index bbe57d57b67f..e88342fde1bc 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -1831,6 +1831,12 @@ static int tc_dump_tclass_root(struct Qdisc *root, struct sk_buff *skb, | |||
1831 | if (!qdisc_dev(root)) | 1831 | if (!qdisc_dev(root)) |
1832 | return 0; | 1832 | return 0; |
1833 | 1833 | ||
1834 | if (tcm->tcm_parent) { | ||
1835 | q = qdisc_match_from_root(root, TC_H_MAJ(tcm->tcm_parent)); | ||
1836 | if (q && tc_dump_tclass_qdisc(q, skb, tcm, cb, t_p, s_t) < 0) | ||
1837 | return -1; | ||
1838 | return 0; | ||
1839 | } | ||
1834 | hash_for_each(qdisc_dev(root)->qdisc_hash, b, q, hash) { | 1840 | hash_for_each(qdisc_dev(root)->qdisc_hash, b, q, hash) { |
1835 | if (tc_dump_tclass_qdisc(q, skb, tcm, cb, t_p, s_t) < 0) | 1841 | if (tc_dump_tclass_qdisc(q, skb, tcm, cb, t_p, s_t) < 0) |
1836 | return -1; | 1842 | return -1; |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 961ee59f696a..f5b45b8b8b16 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -240,12 +240,10 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr, | |||
240 | struct sctp_bind_addr *bp; | 240 | struct sctp_bind_addr *bp; |
241 | struct ipv6_pinfo *np = inet6_sk(sk); | 241 | struct ipv6_pinfo *np = inet6_sk(sk); |
242 | struct sctp_sockaddr_entry *laddr; | 242 | struct sctp_sockaddr_entry *laddr; |
243 | union sctp_addr *baddr = NULL; | ||
244 | union sctp_addr *daddr = &t->ipaddr; | 243 | union sctp_addr *daddr = &t->ipaddr; |
245 | union sctp_addr dst_saddr; | 244 | union sctp_addr dst_saddr; |
246 | struct in6_addr *final_p, final; | 245 | struct in6_addr *final_p, final; |
247 | __u8 matchlen = 0; | 246 | __u8 matchlen = 0; |
248 | __u8 bmatchlen; | ||
249 | sctp_scope_t scope; | 247 | sctp_scope_t scope; |
250 | 248 | ||
251 | memset(fl6, 0, sizeof(struct flowi6)); | 249 | memset(fl6, 0, sizeof(struct flowi6)); |
@@ -312,23 +310,37 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr, | |||
312 | */ | 310 | */ |
313 | rcu_read_lock(); | 311 | rcu_read_lock(); |
314 | list_for_each_entry_rcu(laddr, &bp->address_list, list) { | 312 | list_for_each_entry_rcu(laddr, &bp->address_list, list) { |
315 | if (!laddr->valid) | 313 | struct dst_entry *bdst; |
314 | __u8 bmatchlen; | ||
315 | |||
316 | if (!laddr->valid || | ||
317 | laddr->state != SCTP_ADDR_SRC || | ||
318 | laddr->a.sa.sa_family != AF_INET6 || | ||
319 | scope > sctp_scope(&laddr->a)) | ||
316 | continue; | 320 | continue; |
317 | if ((laddr->state == SCTP_ADDR_SRC) && | 321 | |
318 | (laddr->a.sa.sa_family == AF_INET6) && | 322 | fl6->saddr = laddr->a.v6.sin6_addr; |
319 | (scope <= sctp_scope(&laddr->a))) { | 323 | fl6->fl6_sport = laddr->a.v6.sin6_port; |
320 | bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a); | ||
321 | if (!baddr || (matchlen < bmatchlen)) { | ||
322 | baddr = &laddr->a; | ||
323 | matchlen = bmatchlen; | ||
324 | } | ||
325 | } | ||
326 | } | ||
327 | if (baddr) { | ||
328 | fl6->saddr = baddr->v6.sin6_addr; | ||
329 | fl6->fl6_sport = baddr->v6.sin6_port; | ||
330 | final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final); | 324 | final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final); |
331 | dst = ip6_dst_lookup_flow(sk, fl6, final_p); | 325 | bdst = ip6_dst_lookup_flow(sk, fl6, final_p); |
326 | |||
327 | if (!IS_ERR(bdst) && | ||
328 | ipv6_chk_addr(dev_net(bdst->dev), | ||
329 | &laddr->a.v6.sin6_addr, bdst->dev, 1)) { | ||
330 | if (!IS_ERR_OR_NULL(dst)) | ||
331 | dst_release(dst); | ||
332 | dst = bdst; | ||
333 | break; | ||
334 | } | ||
335 | |||
336 | bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a); | ||
337 | if (matchlen > bmatchlen) | ||
338 | continue; | ||
339 | |||
340 | if (!IS_ERR_OR_NULL(dst)) | ||
341 | dst_release(dst); | ||
342 | dst = bdst; | ||
343 | matchlen = bmatchlen; | ||
332 | } | 344 | } |
333 | rcu_read_unlock(); | 345 | rcu_read_unlock(); |
334 | 346 | ||
@@ -665,6 +677,9 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, | |||
665 | newnp = inet6_sk(newsk); | 677 | newnp = inet6_sk(newsk); |
666 | 678 | ||
667 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); | 679 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); |
680 | newnp->ipv6_mc_list = NULL; | ||
681 | newnp->ipv6_ac_list = NULL; | ||
682 | newnp->ipv6_fl_list = NULL; | ||
668 | 683 | ||
669 | rcu_read_lock(); | 684 | rcu_read_lock(); |
670 | opt = rcu_dereference(np->opt); | 685 | opt = rcu_dereference(np->opt); |
diff --git a/net/smc/Kconfig b/net/smc/Kconfig index c717ef0896aa..33954852f3f8 100644 --- a/net/smc/Kconfig +++ b/net/smc/Kconfig | |||
@@ -8,6 +8,10 @@ config SMC | |||
8 | The Linux implementation of the SMC-R solution is designed as | 8 | The Linux implementation of the SMC-R solution is designed as |
9 | a separate socket family SMC. | 9 | a separate socket family SMC. |
10 | 10 | ||
11 | Warning: SMC will expose all memory for remote reads and writes | ||
12 | once a connection is established. Don't enable this option except | ||
13 | for tightly controlled lab environment. | ||
14 | |||
11 | Select this option if you want to run SMC socket applications | 15 | Select this option if you want to run SMC socket applications |
12 | 16 | ||
13 | config SMC_DIAG | 17 | config SMC_DIAG |
diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c index e41f594a1e1d..03ec058d18df 100644 --- a/net/smc/smc_clc.c +++ b/net/smc/smc_clc.c | |||
@@ -204,7 +204,7 @@ int smc_clc_send_confirm(struct smc_sock *smc) | |||
204 | memcpy(&cclc.lcl.mac, &link->smcibdev->mac[link->ibport - 1], ETH_ALEN); | 204 | memcpy(&cclc.lcl.mac, &link->smcibdev->mac[link->ibport - 1], ETH_ALEN); |
205 | hton24(cclc.qpn, link->roce_qp->qp_num); | 205 | hton24(cclc.qpn, link->roce_qp->qp_num); |
206 | cclc.rmb_rkey = | 206 | cclc.rmb_rkey = |
207 | htonl(conn->rmb_desc->mr_rx[SMC_SINGLE_LINK]->rkey); | 207 | htonl(conn->rmb_desc->rkey[SMC_SINGLE_LINK]); |
208 | cclc.conn_idx = 1; /* for now: 1 RMB = 1 RMBE */ | 208 | cclc.conn_idx = 1; /* for now: 1 RMB = 1 RMBE */ |
209 | cclc.rmbe_alert_token = htonl(conn->alert_token_local); | 209 | cclc.rmbe_alert_token = htonl(conn->alert_token_local); |
210 | cclc.qp_mtu = min(link->path_mtu, link->peer_mtu); | 210 | cclc.qp_mtu = min(link->path_mtu, link->peer_mtu); |
@@ -256,7 +256,7 @@ int smc_clc_send_accept(struct smc_sock *new_smc, int srv_first_contact) | |||
256 | memcpy(&aclc.lcl.mac, link->smcibdev->mac[link->ibport - 1], ETH_ALEN); | 256 | memcpy(&aclc.lcl.mac, link->smcibdev->mac[link->ibport - 1], ETH_ALEN); |
257 | hton24(aclc.qpn, link->roce_qp->qp_num); | 257 | hton24(aclc.qpn, link->roce_qp->qp_num); |
258 | aclc.rmb_rkey = | 258 | aclc.rmb_rkey = |
259 | htonl(conn->rmb_desc->mr_rx[SMC_SINGLE_LINK]->rkey); | 259 | htonl(conn->rmb_desc->rkey[SMC_SINGLE_LINK]); |
260 | aclc.conn_idx = 1; /* as long as 1 RMB = 1 RMBE */ | 260 | aclc.conn_idx = 1; /* as long as 1 RMB = 1 RMBE */ |
261 | aclc.rmbe_alert_token = htonl(conn->alert_token_local); | 261 | aclc.rmbe_alert_token = htonl(conn->alert_token_local); |
262 | aclc.qp_mtu = link->path_mtu; | 262 | aclc.qp_mtu = link->path_mtu; |
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index 65020e93ff21..3ac09a629ea1 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c | |||
@@ -613,19 +613,8 @@ int smc_rmb_create(struct smc_sock *smc) | |||
613 | rmb_desc = NULL; | 613 | rmb_desc = NULL; |
614 | continue; /* if mapping failed, try smaller one */ | 614 | continue; /* if mapping failed, try smaller one */ |
615 | } | 615 | } |
616 | rc = smc_ib_get_memory_region(lgr->lnk[SMC_SINGLE_LINK].roce_pd, | 616 | rmb_desc->rkey[SMC_SINGLE_LINK] = |
617 | IB_ACCESS_REMOTE_WRITE | | 617 | lgr->lnk[SMC_SINGLE_LINK].roce_pd->unsafe_global_rkey; |
618 | IB_ACCESS_LOCAL_WRITE, | ||
619 | &rmb_desc->mr_rx[SMC_SINGLE_LINK]); | ||
620 | if (rc) { | ||
621 | smc_ib_buf_unmap(lgr->lnk[SMC_SINGLE_LINK].smcibdev, | ||
622 | tmp_bufsize, rmb_desc, | ||
623 | DMA_FROM_DEVICE); | ||
624 | kfree(rmb_desc->cpu_addr); | ||
625 | kfree(rmb_desc); | ||
626 | rmb_desc = NULL; | ||
627 | continue; | ||
628 | } | ||
629 | rmb_desc->used = 1; | 618 | rmb_desc->used = 1; |
630 | write_lock_bh(&lgr->rmbs_lock); | 619 | write_lock_bh(&lgr->rmbs_lock); |
631 | list_add(&rmb_desc->list, | 620 | list_add(&rmb_desc->list, |
@@ -668,6 +657,7 @@ int smc_rmb_rtoken_handling(struct smc_connection *conn, | |||
668 | 657 | ||
669 | for (i = 0; i < SMC_RMBS_PER_LGR_MAX; i++) { | 658 | for (i = 0; i < SMC_RMBS_PER_LGR_MAX; i++) { |
670 | if ((lgr->rtokens[i][SMC_SINGLE_LINK].rkey == rkey) && | 659 | if ((lgr->rtokens[i][SMC_SINGLE_LINK].rkey == rkey) && |
660 | (lgr->rtokens[i][SMC_SINGLE_LINK].dma_addr == dma_addr) && | ||
671 | test_bit(i, lgr->rtokens_used_mask)) { | 661 | test_bit(i, lgr->rtokens_used_mask)) { |
672 | conn->rtoken_idx = i; | 662 | conn->rtoken_idx = i; |
673 | return 0; | 663 | return 0; |
diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h index 27eb38056a27..b013cb43a327 100644 --- a/net/smc/smc_core.h +++ b/net/smc/smc_core.h | |||
@@ -93,7 +93,7 @@ struct smc_buf_desc { | |||
93 | u64 dma_addr[SMC_LINKS_PER_LGR_MAX]; | 93 | u64 dma_addr[SMC_LINKS_PER_LGR_MAX]; |
94 | /* mapped address of buffer */ | 94 | /* mapped address of buffer */ |
95 | void *cpu_addr; /* virtual address of buffer */ | 95 | void *cpu_addr; /* virtual address of buffer */ |
96 | struct ib_mr *mr_rx[SMC_LINKS_PER_LGR_MAX]; | 96 | u32 rkey[SMC_LINKS_PER_LGR_MAX]; |
97 | /* for rmb only: | 97 | /* for rmb only: |
98 | * rkey provided to peer | 98 | * rkey provided to peer |
99 | */ | 99 | */ |
diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c index cb69ab977cd7..b31715505a35 100644 --- a/net/smc/smc_ib.c +++ b/net/smc/smc_ib.c | |||
@@ -37,24 +37,6 @@ u8 local_systemid[SMC_SYSTEMID_LEN] = SMC_LOCAL_SYSTEMID_RESET; /* unique system | |||
37 | * identifier | 37 | * identifier |
38 | */ | 38 | */ |
39 | 39 | ||
40 | int smc_ib_get_memory_region(struct ib_pd *pd, int access_flags, | ||
41 | struct ib_mr **mr) | ||
42 | { | ||
43 | int rc; | ||
44 | |||
45 | if (*mr) | ||
46 | return 0; /* already done */ | ||
47 | |||
48 | /* obtain unique key - | ||
49 | * next invocation of get_dma_mr returns a different key! | ||
50 | */ | ||
51 | *mr = pd->device->get_dma_mr(pd, access_flags); | ||
52 | rc = PTR_ERR_OR_ZERO(*mr); | ||
53 | if (IS_ERR(*mr)) | ||
54 | *mr = NULL; | ||
55 | return rc; | ||
56 | } | ||
57 | |||
58 | static int smc_ib_modify_qp_init(struct smc_link *lnk) | 40 | static int smc_ib_modify_qp_init(struct smc_link *lnk) |
59 | { | 41 | { |
60 | struct ib_qp_attr qp_attr; | 42 | struct ib_qp_attr qp_attr; |
@@ -210,7 +192,8 @@ int smc_ib_create_protection_domain(struct smc_link *lnk) | |||
210 | { | 192 | { |
211 | int rc; | 193 | int rc; |
212 | 194 | ||
213 | lnk->roce_pd = ib_alloc_pd(lnk->smcibdev->ibdev, 0); | 195 | lnk->roce_pd = ib_alloc_pd(lnk->smcibdev->ibdev, |
196 | IB_PD_UNSAFE_GLOBAL_RKEY); | ||
214 | rc = PTR_ERR_OR_ZERO(lnk->roce_pd); | 197 | rc = PTR_ERR_OR_ZERO(lnk->roce_pd); |
215 | if (IS_ERR(lnk->roce_pd)) | 198 | if (IS_ERR(lnk->roce_pd)) |
216 | lnk->roce_pd = NULL; | 199 | lnk->roce_pd = NULL; |
diff --git a/net/smc/smc_ib.h b/net/smc/smc_ib.h index 7e1f0e24d177..b567152a526d 100644 --- a/net/smc/smc_ib.h +++ b/net/smc/smc_ib.h | |||
@@ -61,8 +61,6 @@ void smc_ib_dealloc_protection_domain(struct smc_link *lnk); | |||
61 | int smc_ib_create_protection_domain(struct smc_link *lnk); | 61 | int smc_ib_create_protection_domain(struct smc_link *lnk); |
62 | void smc_ib_destroy_queue_pair(struct smc_link *lnk); | 62 | void smc_ib_destroy_queue_pair(struct smc_link *lnk); |
63 | int smc_ib_create_queue_pair(struct smc_link *lnk); | 63 | int smc_ib_create_queue_pair(struct smc_link *lnk); |
64 | int smc_ib_get_memory_region(struct ib_pd *pd, int access_flags, | ||
65 | struct ib_mr **mr); | ||
66 | int smc_ib_ready_link(struct smc_link *lnk); | 64 | int smc_ib_ready_link(struct smc_link *lnk); |
67 | int smc_ib_modify_qp_rts(struct smc_link *lnk); | 65 | int smc_ib_modify_qp_rts(struct smc_link *lnk); |
68 | int smc_ib_modify_qp_reset(struct smc_link *lnk); | 66 | int smc_ib_modify_qp_reset(struct smc_link *lnk); |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 0d4f2f455a7c..1b92b72e812f 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -362,25 +362,25 @@ static int tipc_sk_sock_err(struct socket *sock, long *timeout) | |||
362 | return 0; | 362 | return 0; |
363 | } | 363 | } |
364 | 364 | ||
365 | #define tipc_wait_for_cond(sock_, timeout_, condition_) \ | 365 | #define tipc_wait_for_cond(sock_, timeo_, condition_) \ |
366 | ({ \ | 366 | ({ \ |
367 | int rc_ = 0; \ | 367 | struct sock *sk_; \ |
368 | int done_ = 0; \ | 368 | int rc_; \ |
369 | \ | 369 | \ |
370 | while (!(condition_) && !done_) { \ | 370 | while ((rc_ = !(condition_))) { \ |
371 | struct sock *sk_ = sock->sk; \ | 371 | DEFINE_WAIT_FUNC(wait_, woken_wake_function); \ |
372 | DEFINE_WAIT_FUNC(wait_, woken_wake_function); \ | 372 | sk_ = (sock_)->sk; \ |
373 | \ | 373 | rc_ = tipc_sk_sock_err((sock_), timeo_); \ |
374 | rc_ = tipc_sk_sock_err(sock_, timeout_); \ | 374 | if (rc_) \ |
375 | if (rc_) \ | 375 | break; \ |
376 | break; \ | 376 | prepare_to_wait(sk_sleep(sk_), &wait_, TASK_INTERRUPTIBLE); \ |
377 | prepare_to_wait(sk_sleep(sk_), &wait_, \ | 377 | release_sock(sk_); \ |
378 | TASK_INTERRUPTIBLE); \ | 378 | *(timeo_) = wait_woken(&wait_, TASK_INTERRUPTIBLE, *(timeo_)); \ |
379 | done_ = sk_wait_event(sk_, timeout_, \ | 379 | sched_annotate_sleep(); \ |
380 | (condition_), &wait_); \ | 380 | lock_sock(sk_); \ |
381 | remove_wait_queue(sk_sleep(sk_), &wait_); \ | 381 | remove_wait_queue(sk_sleep(sk_), &wait_); \ |
382 | } \ | 382 | } \ |
383 | rc_; \ | 383 | rc_; \ |
384 | }) | 384 | }) |
385 | 385 | ||
386 | /** | 386 | /** |
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 8b911c29860e..5a1a98df3499 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -1791,32 +1791,40 @@ void x25_kill_by_neigh(struct x25_neigh *nb) | |||
1791 | 1791 | ||
1792 | static int __init x25_init(void) | 1792 | static int __init x25_init(void) |
1793 | { | 1793 | { |
1794 | int rc = proto_register(&x25_proto, 0); | 1794 | int rc; |
1795 | 1795 | ||
1796 | if (rc != 0) | 1796 | rc = proto_register(&x25_proto, 0); |
1797 | if (rc) | ||
1797 | goto out; | 1798 | goto out; |
1798 | 1799 | ||
1799 | rc = sock_register(&x25_family_ops); | 1800 | rc = sock_register(&x25_family_ops); |
1800 | if (rc != 0) | 1801 | if (rc) |
1801 | goto out_proto; | 1802 | goto out_proto; |
1802 | 1803 | ||
1803 | dev_add_pack(&x25_packet_type); | 1804 | dev_add_pack(&x25_packet_type); |
1804 | 1805 | ||
1805 | rc = register_netdevice_notifier(&x25_dev_notifier); | 1806 | rc = register_netdevice_notifier(&x25_dev_notifier); |
1806 | if (rc != 0) | 1807 | if (rc) |
1807 | goto out_sock; | 1808 | goto out_sock; |
1808 | 1809 | ||
1809 | pr_info("Linux Version 0.2\n"); | 1810 | rc = x25_register_sysctl(); |
1811 | if (rc) | ||
1812 | goto out_dev; | ||
1810 | 1813 | ||
1811 | x25_register_sysctl(); | ||
1812 | rc = x25_proc_init(); | 1814 | rc = x25_proc_init(); |
1813 | if (rc != 0) | 1815 | if (rc) |
1814 | goto out_dev; | 1816 | goto out_sysctl; |
1817 | |||
1818 | pr_info("Linux Version 0.2\n"); | ||
1819 | |||
1815 | out: | 1820 | out: |
1816 | return rc; | 1821 | return rc; |
1822 | out_sysctl: | ||
1823 | x25_unregister_sysctl(); | ||
1817 | out_dev: | 1824 | out_dev: |
1818 | unregister_netdevice_notifier(&x25_dev_notifier); | 1825 | unregister_netdevice_notifier(&x25_dev_notifier); |
1819 | out_sock: | 1826 | out_sock: |
1827 | dev_remove_pack(&x25_packet_type); | ||
1820 | sock_unregister(AF_X25); | 1828 | sock_unregister(AF_X25); |
1821 | out_proto: | 1829 | out_proto: |
1822 | proto_unregister(&x25_proto); | 1830 | proto_unregister(&x25_proto); |
diff --git a/net/x25/sysctl_net_x25.c b/net/x25/sysctl_net_x25.c index a06dfe143c67..ba078c85f0a1 100644 --- a/net/x25/sysctl_net_x25.c +++ b/net/x25/sysctl_net_x25.c | |||
@@ -73,9 +73,12 @@ static struct ctl_table x25_table[] = { | |||
73 | { }, | 73 | { }, |
74 | }; | 74 | }; |
75 | 75 | ||
76 | void __init x25_register_sysctl(void) | 76 | int __init x25_register_sysctl(void) |
77 | { | 77 | { |
78 | x25_table_header = register_net_sysctl(&init_net, "net/x25", x25_table); | 78 | x25_table_header = register_net_sysctl(&init_net, "net/x25", x25_table); |
79 | if (!x25_table_header) | ||
80 | return -ENOMEM; | ||
81 | return 0; | ||
79 | } | 82 | } |
80 | 83 | ||
81 | void x25_unregister_sysctl(void) | 84 | void x25_unregister_sysctl(void) |
diff --git a/samples/bpf/cookie_uid_helper_example.c b/samples/bpf/cookie_uid_helper_example.c index b08ab4e88929..9d751e209f31 100644 --- a/samples/bpf/cookie_uid_helper_example.c +++ b/samples/bpf/cookie_uid_helper_example.c | |||
@@ -306,7 +306,9 @@ int main(int argc, char *argv[]) | |||
306 | prog_attach_iptables(argv[2]); | 306 | prog_attach_iptables(argv[2]); |
307 | if (cfg_test_traffic) { | 307 | if (cfg_test_traffic) { |
308 | if (signal(SIGINT, finish) == SIG_ERR) | 308 | if (signal(SIGINT, finish) == SIG_ERR) |
309 | error(1, errno, "register handler failed"); | 309 | error(1, errno, "register SIGINT handler failed"); |
310 | if (signal(SIGTERM, finish) == SIG_ERR) | ||
311 | error(1, errno, "register SIGTERM handler failed"); | ||
310 | while (!test_finish) { | 312 | while (!test_finish) { |
311 | print_table(); | 313 | print_table(); |
312 | printf("\n"); | 314 | printf("\n"); |
diff --git a/samples/bpf/offwaketime_user.c b/samples/bpf/offwaketime_user.c index 9cce2a66bd66..512f87a5fd20 100644 --- a/samples/bpf/offwaketime_user.c +++ b/samples/bpf/offwaketime_user.c | |||
@@ -100,6 +100,7 @@ int main(int argc, char **argv) | |||
100 | setrlimit(RLIMIT_MEMLOCK, &r); | 100 | setrlimit(RLIMIT_MEMLOCK, &r); |
101 | 101 | ||
102 | signal(SIGINT, int_exit); | 102 | signal(SIGINT, int_exit); |
103 | signal(SIGTERM, int_exit); | ||
103 | 104 | ||
104 | if (load_kallsyms()) { | 105 | if (load_kallsyms()) { |
105 | printf("failed to process /proc/kallsyms\n"); | 106 | printf("failed to process /proc/kallsyms\n"); |
diff --git a/samples/bpf/sampleip_user.c b/samples/bpf/sampleip_user.c index be59d7dcbdde..4ed690b907ff 100644 --- a/samples/bpf/sampleip_user.c +++ b/samples/bpf/sampleip_user.c | |||
@@ -180,6 +180,7 @@ int main(int argc, char **argv) | |||
180 | return 1; | 180 | return 1; |
181 | } | 181 | } |
182 | signal(SIGINT, int_exit); | 182 | signal(SIGINT, int_exit); |
183 | signal(SIGTERM, int_exit); | ||
183 | 184 | ||
184 | /* do sampling */ | 185 | /* do sampling */ |
185 | printf("Sampling at %d Hertz for %d seconds. Ctrl-C also ends.\n", | 186 | printf("Sampling at %d Hertz for %d seconds. Ctrl-C also ends.\n", |
diff --git a/samples/bpf/trace_event_user.c b/samples/bpf/trace_event_user.c index 0c5561d193a4..fa4336423da5 100644 --- a/samples/bpf/trace_event_user.c +++ b/samples/bpf/trace_event_user.c | |||
@@ -192,6 +192,7 @@ int main(int argc, char **argv) | |||
192 | setrlimit(RLIMIT_MEMLOCK, &r); | 192 | setrlimit(RLIMIT_MEMLOCK, &r); |
193 | 193 | ||
194 | signal(SIGINT, int_exit); | 194 | signal(SIGINT, int_exit); |
195 | signal(SIGTERM, int_exit); | ||
195 | 196 | ||
196 | if (load_kallsyms()) { | 197 | if (load_kallsyms()) { |
197 | printf("failed to process /proc/kallsyms\n"); | 198 | printf("failed to process /proc/kallsyms\n"); |
diff --git a/samples/bpf/tracex2_user.c b/samples/bpf/tracex2_user.c index 7fee0f1ba9a3..7321a3f253c9 100644 --- a/samples/bpf/tracex2_user.c +++ b/samples/bpf/tracex2_user.c | |||
@@ -127,6 +127,7 @@ int main(int ac, char **argv) | |||
127 | } | 127 | } |
128 | 128 | ||
129 | signal(SIGINT, int_exit); | 129 | signal(SIGINT, int_exit); |
130 | signal(SIGTERM, int_exit); | ||
130 | 131 | ||
131 | /* start 'ping' in the background to have some kfree_skb events */ | 132 | /* start 'ping' in the background to have some kfree_skb events */ |
132 | f = popen("ping -c5 localhost", "r"); | 133 | f = popen("ping -c5 localhost", "r"); |
diff --git a/samples/bpf/xdp1_user.c b/samples/bpf/xdp1_user.c index 378850c70eb8..2431c0321b71 100644 --- a/samples/bpf/xdp1_user.c +++ b/samples/bpf/xdp1_user.c | |||
@@ -62,13 +62,14 @@ static void usage(const char *prog) | |||
62 | fprintf(stderr, | 62 | fprintf(stderr, |
63 | "usage: %s [OPTS] IFINDEX\n\n" | 63 | "usage: %s [OPTS] IFINDEX\n\n" |
64 | "OPTS:\n" | 64 | "OPTS:\n" |
65 | " -S use skb-mode\n", | 65 | " -S use skb-mode\n" |
66 | " -N enforce native mode\n", | ||
66 | prog); | 67 | prog); |
67 | } | 68 | } |
68 | 69 | ||
69 | int main(int argc, char **argv) | 70 | int main(int argc, char **argv) |
70 | { | 71 | { |
71 | const char *optstr = "S"; | 72 | const char *optstr = "SN"; |
72 | char filename[256]; | 73 | char filename[256]; |
73 | int opt; | 74 | int opt; |
74 | 75 | ||
@@ -77,6 +78,9 @@ int main(int argc, char **argv) | |||
77 | case 'S': | 78 | case 'S': |
78 | xdp_flags |= XDP_FLAGS_SKB_MODE; | 79 | xdp_flags |= XDP_FLAGS_SKB_MODE; |
79 | break; | 80 | break; |
81 | case 'N': | ||
82 | xdp_flags |= XDP_FLAGS_DRV_MODE; | ||
83 | break; | ||
80 | default: | 84 | default: |
81 | usage(basename(argv[0])); | 85 | usage(basename(argv[0])); |
82 | return 1; | 86 | return 1; |
@@ -102,6 +106,7 @@ int main(int argc, char **argv) | |||
102 | } | 106 | } |
103 | 107 | ||
104 | signal(SIGINT, int_exit); | 108 | signal(SIGINT, int_exit); |
109 | signal(SIGTERM, int_exit); | ||
105 | 110 | ||
106 | if (set_link_xdp_fd(ifindex, prog_fd[0], xdp_flags) < 0) { | 111 | if (set_link_xdp_fd(ifindex, prog_fd[0], xdp_flags) < 0) { |
107 | printf("link set xdp fd failed\n"); | 112 | printf("link set xdp fd failed\n"); |
diff --git a/samples/bpf/xdp_tx_iptunnel_user.c b/samples/bpf/xdp_tx_iptunnel_user.c index 92b8bde9337c..715cd12eaca5 100644 --- a/samples/bpf/xdp_tx_iptunnel_user.c +++ b/samples/bpf/xdp_tx_iptunnel_user.c | |||
@@ -79,6 +79,8 @@ static void usage(const char *cmd) | |||
79 | printf(" -m <dest-MAC> Used in sending the IP Tunneled pkt\n"); | 79 | printf(" -m <dest-MAC> Used in sending the IP Tunneled pkt\n"); |
80 | printf(" -T <stop-after-X-seconds> Default: 0 (forever)\n"); | 80 | printf(" -T <stop-after-X-seconds> Default: 0 (forever)\n"); |
81 | printf(" -P <IP-Protocol> Default is TCP\n"); | 81 | printf(" -P <IP-Protocol> Default is TCP\n"); |
82 | printf(" -S use skb-mode\n"); | ||
83 | printf(" -N enforce native mode\n"); | ||
82 | printf(" -h Display this help\n"); | 84 | printf(" -h Display this help\n"); |
83 | } | 85 | } |
84 | 86 | ||
@@ -138,7 +140,7 @@ int main(int argc, char **argv) | |||
138 | { | 140 | { |
139 | unsigned char opt_flags[256] = {}; | 141 | unsigned char opt_flags[256] = {}; |
140 | unsigned int kill_after_s = 0; | 142 | unsigned int kill_after_s = 0; |
141 | const char *optstr = "i:a:p:s:d:m:T:P:Sh"; | 143 | const char *optstr = "i:a:p:s:d:m:T:P:SNh"; |
142 | int min_port = 0, max_port = 0; | 144 | int min_port = 0, max_port = 0; |
143 | struct iptnl_info tnl = {}; | 145 | struct iptnl_info tnl = {}; |
144 | struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; | 146 | struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; |
@@ -206,6 +208,9 @@ int main(int argc, char **argv) | |||
206 | case 'S': | 208 | case 'S': |
207 | xdp_flags |= XDP_FLAGS_SKB_MODE; | 209 | xdp_flags |= XDP_FLAGS_SKB_MODE; |
208 | break; | 210 | break; |
211 | case 'N': | ||
212 | xdp_flags |= XDP_FLAGS_DRV_MODE; | ||
213 | break; | ||
209 | default: | 214 | default: |
210 | usage(argv[0]); | 215 | usage(argv[0]); |
211 | return 1; | 216 | return 1; |
@@ -239,6 +244,7 @@ int main(int argc, char **argv) | |||
239 | } | 244 | } |
240 | 245 | ||
241 | signal(SIGINT, int_exit); | 246 | signal(SIGINT, int_exit); |
247 | signal(SIGTERM, int_exit); | ||
242 | 248 | ||
243 | while (min_port <= max_port) { | 249 | while (min_port <= max_port) { |
244 | vip.dport = htons(min_port++); | 250 | vip.dport = htons(min_port++); |
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 6ba97a1f9c5a..ce753a408c56 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst | |||
@@ -8,6 +8,29 @@ | |||
8 | # | 8 | # |
9 | # ========================================================================== | 9 | # ========================================================================== |
10 | 10 | ||
11 | PHONY := __headers | ||
12 | __headers: | ||
13 | |||
14 | include scripts/Kbuild.include | ||
15 | |||
16 | srcdir := $(srctree)/$(obj) | ||
17 | subdirs := $(patsubst $(srcdir)/%/.,%,$(wildcard $(srcdir)/*/.)) | ||
18 | # caller may set destination dir (when installing to asm/) | ||
19 | _dst := $(if $(dst),$(dst),$(obj)) | ||
20 | |||
21 | # Recursion | ||
22 | __headers: $(subdirs) | ||
23 | |||
24 | .PHONY: $(subdirs) | ||
25 | $(subdirs): | ||
26 | $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@ | ||
27 | |||
28 | # Skip header install/check for include/uapi and arch/$(hdr-arch)/include/uapi. | ||
29 | # We have only sub-directories there. | ||
30 | skip-inst := $(if $(filter %/uapi,$(obj)),1) | ||
31 | |||
32 | ifeq ($(skip-inst),) | ||
33 | |||
11 | # generated header directory | 34 | # generated header directory |
12 | gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) | 35 | gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) |
13 | 36 | ||
@@ -15,21 +38,14 @@ gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) | |||
15 | kbuild-file := $(srctree)/$(obj)/Kbuild | 38 | kbuild-file := $(srctree)/$(obj)/Kbuild |
16 | -include $(kbuild-file) | 39 | -include $(kbuild-file) |
17 | 40 | ||
18 | # called may set destination dir (when installing to asm/) | ||
19 | _dst := $(if $(dst),$(dst),$(obj)) | ||
20 | |||
21 | old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild | 41 | old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild |
22 | ifneq ($(wildcard $(old-kbuild-file)),) | 42 | ifneq ($(wildcard $(old-kbuild-file)),) |
23 | include $(old-kbuild-file) | 43 | include $(old-kbuild-file) |
24 | endif | 44 | endif |
25 | 45 | ||
26 | include scripts/Kbuild.include | ||
27 | |||
28 | installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst)) | 46 | installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst)) |
29 | 47 | ||
30 | srcdir := $(srctree)/$(obj) | ||
31 | gendir := $(objtree)/$(gen) | 48 | gendir := $(objtree)/$(gen) |
32 | subdirs := $(patsubst $(srcdir)/%/.,%,$(wildcard $(srcdir)/*/.)) | ||
33 | header-files := $(notdir $(wildcard $(srcdir)/*.h)) | 49 | header-files := $(notdir $(wildcard $(srcdir)/*.h)) |
34 | header-files += $(notdir $(wildcard $(srcdir)/*.agh)) | 50 | header-files += $(notdir $(wildcard $(srcdir)/*.agh)) |
35 | header-files := $(filter-out $(no-export-headers), $(header-files)) | 51 | header-files := $(filter-out $(no-export-headers), $(header-files)) |
@@ -88,11 +104,9 @@ quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files) | |||
88 | $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \ | 104 | $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \ |
89 | touch $@ | 105 | touch $@ |
90 | 106 | ||
91 | PHONY += __headersinst __headerscheck | ||
92 | |||
93 | ifndef HDRCHECK | 107 | ifndef HDRCHECK |
94 | # Rules for installing headers | 108 | # Rules for installing headers |
95 | __headersinst: $(subdirs) $(install-file) | 109 | __headers: $(install-file) |
96 | @: | 110 | @: |
97 | 111 | ||
98 | targets += $(install-file) | 112 | targets += $(install-file) |
@@ -104,7 +118,7 @@ $(install-file): scripts/headers_install.sh \ | |||
104 | $(call if_changed,install) | 118 | $(call if_changed,install) |
105 | 119 | ||
106 | else | 120 | else |
107 | __headerscheck: $(subdirs) $(check-file) | 121 | __headers: $(check-file) |
108 | @: | 122 | @: |
109 | 123 | ||
110 | targets += $(check-file) | 124 | targets += $(check-file) |
@@ -113,11 +127,6 @@ $(check-file): scripts/headers_check.pl $(output-files) FORCE | |||
113 | 127 | ||
114 | endif | 128 | endif |
115 | 129 | ||
116 | # Recursion | ||
117 | .PHONY: $(subdirs) | ||
118 | $(subdirs): | ||
119 | $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@ | ||
120 | |||
121 | targets := $(wildcard $(sort $(targets))) | 130 | targets := $(wildcard $(sort $(targets))) |
122 | cmd_files := $(wildcard \ | 131 | cmd_files := $(wildcard \ |
123 | $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) | 132 | $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) |
@@ -126,6 +135,8 @@ ifneq ($(cmd_files),) | |||
126 | include $(cmd_files) | 135 | include $(cmd_files) |
127 | endif | 136 | endif |
128 | 137 | ||
138 | endif # skip-inst | ||
139 | |||
129 | .PHONY: $(PHONY) | 140 | .PHONY: $(PHONY) |
130 | PHONY += FORCE | 141 | PHONY += FORCE |
131 | FORCE: ; | 142 | FORCE: ; |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 6dc1eda13b8e..58c05e5d9870 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -175,7 +175,7 @@ ld_flags = $(LDFLAGS) $(ldflags-y) | |||
175 | 175 | ||
176 | dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ | 176 | dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ |
177 | -I$(srctree)/arch/$(SRCARCH)/boot/dts \ | 177 | -I$(srctree)/arch/$(SRCARCH)/boot/dts \ |
178 | -I$(srctree)/arch/$(SRCARCH)/boot/dts/include \ | 178 | -I$(srctree)/scripts/dtc/include-prefixes \ |
179 | -I$(srctree)/drivers/of/testcase-data \ | 179 | -I$(srctree)/drivers/of/testcase-data \ |
180 | -undef -D__DTS__ | 180 | -undef -D__DTS__ |
181 | 181 | ||
diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c index 5adfc8f52b4f..4b72b530c84f 100644 --- a/scripts/dtc/checks.c +++ b/scripts/dtc/checks.c | |||
@@ -873,7 +873,7 @@ static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct no | |||
873 | while (size--) | 873 | while (size--) |
874 | reg = (reg << 32) | fdt32_to_cpu(*(cells++)); | 874 | reg = (reg << 32) | fdt32_to_cpu(*(cells++)); |
875 | 875 | ||
876 | snprintf(unit_addr, sizeof(unit_addr), "%lx", reg); | 876 | snprintf(unit_addr, sizeof(unit_addr), "%zx", reg); |
877 | if (!streq(unitname, unit_addr)) | 877 | if (!streq(unitname, unit_addr)) |
878 | FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"", | 878 | FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"", |
879 | node->fullpath, unit_addr); | 879 | node->fullpath, unit_addr); |
diff --git a/scripts/dtc/include-prefixes/arc b/scripts/dtc/include-prefixes/arc new file mode 120000 index 000000000000..5d21b5a69a11 --- /dev/null +++ b/scripts/dtc/include-prefixes/arc | |||
@@ -0,0 +1 @@ | |||
../../../arch/arc/boot/dts \ No newline at end of file | |||
diff --git a/scripts/dtc/include-prefixes/arm b/scripts/dtc/include-prefixes/arm new file mode 120000 index 000000000000..eb14d4515a57 --- /dev/null +++ b/scripts/dtc/include-prefixes/arm | |||
@@ -0,0 +1 @@ | |||
../../../arch/arm/boot/dts \ No newline at end of file | |||
diff --git a/scripts/dtc/include-prefixes/arm64 b/scripts/dtc/include-prefixes/arm64 new file mode 120000 index 000000000000..275c42c21d71 --- /dev/null +++ b/scripts/dtc/include-prefixes/arm64 | |||
@@ -0,0 +1 @@ | |||
../../../arch/arm64/boot/dts \ No newline at end of file | |||
diff --git a/scripts/dtc/include-prefixes/c6x b/scripts/dtc/include-prefixes/c6x new file mode 120000 index 000000000000..49ded4cae2be --- /dev/null +++ b/scripts/dtc/include-prefixes/c6x | |||
@@ -0,0 +1 @@ | |||
../../../arch/c6x/boot/dts \ No newline at end of file | |||
diff --git a/scripts/dtc/include-prefixes/cris b/scripts/dtc/include-prefixes/cris new file mode 120000 index 000000000000..736d998ba506 --- /dev/null +++ b/scripts/dtc/include-prefixes/cris | |||
@@ -0,0 +1 @@ | |||
../../../arch/cris/boot/dts \ No newline at end of file | |||
diff --git a/scripts/dtc/include-prefixes/dt-bindings b/scripts/dtc/include-prefixes/dt-bindings new file mode 120000 index 000000000000..04fdbb3af016 --- /dev/null +++ b/scripts/dtc/include-prefixes/dt-bindings | |||
@@ -0,0 +1 @@ | |||
../../../include/dt-bindings \ No newline at end of file | |||
diff --git a/scripts/dtc/include-prefixes/h8300 b/scripts/dtc/include-prefixes/h8300 new file mode 120000 index 000000000000..3bdaa332c54c --- /dev/null +++ b/scripts/dtc/include-prefixes/h8300 | |||
@@ -0,0 +1 @@ | |||
../../../arch/h8300/boot/dts \ No newline at end of file | |||
diff --git a/scripts/dtc/include-prefixes/metag b/scripts/dtc/include-prefixes/metag new file mode 120000 index 000000000000..87a3c847db8f --- /dev/null +++ b/scripts/dtc/include-prefixes/metag | |||
@@ -0,0 +1 @@ | |||
../../../arch/metag/boot/dts \ No newline at end of file | |||
diff --git a/scripts/dtc/include-prefixes/microblaze b/scripts/dtc/include-prefixes/microblaze new file mode 120000 index 000000000000..d9830330a21d --- /dev/null +++ b/scripts/dtc/include-prefixes/microblaze | |||
@@ -0,0 +1 @@ | |||
../../../arch/microblaze/boot/dts \ No newline at end of file | |||
diff --git a/scripts/dtc/include-prefixes/mips b/scripts/dtc/include-prefixes/mips new file mode 120000 index 000000000000..ae8d4948dc8d --- /dev/null +++ b/scripts/dtc/include-prefixes/mips | |||
@@ -0,0 +1 @@ | |||
../../../arch/mips/boot/dts \ No newline at end of file | |||
diff --git a/scripts/dtc/include-prefixes/nios2 b/scripts/dtc/include-prefixes/nios2 new file mode 120000 index 000000000000..51772336d13f --- /dev/null +++ b/scripts/dtc/include-prefixes/nios2 | |||
@@ -0,0 +1 @@ | |||
../../../arch/nios2/boot/dts \ No newline at end of file | |||
diff --git a/scripts/dtc/include-prefixes/openrisc b/scripts/dtc/include-prefixes/openrisc new file mode 120000 index 000000000000..71c3bc75c560 --- /dev/null +++ b/scripts/dtc/include-prefixes/openrisc | |||
@@ -0,0 +1 @@ | |||
../../../arch/openrisc/boot/dts \ No newline at end of file | |||
diff --git a/scripts/dtc/include-prefixes/powerpc b/scripts/dtc/include-prefixes/powerpc new file mode 120000 index 000000000000..7cd6ec16e899 --- /dev/null +++ b/scripts/dtc/include-prefixes/powerpc | |||
@@ -0,0 +1 @@ | |||
../../../arch/powerpc/boot/dts \ No newline at end of file | |||
diff --git a/scripts/dtc/include-prefixes/sh b/scripts/dtc/include-prefixes/sh new file mode 120000 index 000000000000..67d37808c599 --- /dev/null +++ b/scripts/dtc/include-prefixes/sh | |||
@@ -0,0 +1 @@ | |||
../../../arch/sh/boot/dts \ No newline at end of file | |||
diff --git a/scripts/dtc/include-prefixes/xtensa b/scripts/dtc/include-prefixes/xtensa new file mode 120000 index 000000000000..d1eaf6ec7a2b --- /dev/null +++ b/scripts/dtc/include-prefixes/xtensa | |||
@@ -0,0 +1 @@ | |||
../../../arch/xtensa/boot/dts \ No newline at end of file | |||
diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c index 664b7fe206d6..b11d3920b9a5 100644 --- a/sound/x86/intel_hdmi_audio.c +++ b/sound/x86/intel_hdmi_audio.c | |||
@@ -1809,10 +1809,6 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev) | |||
1809 | pdata->notify_pending = false; | 1809 | pdata->notify_pending = false; |
1810 | spin_unlock_irq(&pdata->lpe_audio_slock); | 1810 | spin_unlock_irq(&pdata->lpe_audio_slock); |
1811 | 1811 | ||
1812 | /* runtime PM isn't enabled as default, since it won't save much on | ||
1813 | * BYT/CHT devices; user who want the runtime PM should adjust the | ||
1814 | * power/ontrol and power/autosuspend_delay_ms sysfs entries instead | ||
1815 | */ | ||
1816 | pm_runtime_use_autosuspend(&pdev->dev); | 1812 | pm_runtime_use_autosuspend(&pdev->dev); |
1817 | pm_runtime_mark_last_busy(&pdev->dev); | 1813 | pm_runtime_mark_last_busy(&pdev->dev); |
1818 | pm_runtime_set_active(&pdev->dev); | 1814 | pm_runtime_set_active(&pdev->dev); |
diff --git a/tools/build/feature/test-bpf.c b/tools/build/feature/test-bpf.c index ebc6dceddb58..7598361ef1f1 100644 --- a/tools/build/feature/test-bpf.c +++ b/tools/build/feature/test-bpf.c | |||
@@ -29,6 +29,7 @@ int main(void) | |||
29 | attr.log_size = 0; | 29 | attr.log_size = 0; |
30 | attr.log_level = 0; | 30 | attr.log_level = 0; |
31 | attr.kern_version = 0; | 31 | attr.kern_version = 0; |
32 | attr.prog_flags = 0; | ||
32 | 33 | ||
33 | /* | 34 | /* |
34 | * Test existence of __NR_bpf and BPF_PROG_LOAD. | 35 | * Test existence of __NR_bpf and BPF_PROG_LOAD. |
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index e553529929f6..94dfa9def355 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h | |||
@@ -132,6 +132,13 @@ enum bpf_attach_type { | |||
132 | */ | 132 | */ |
133 | #define BPF_F_ALLOW_OVERRIDE (1U << 0) | 133 | #define BPF_F_ALLOW_OVERRIDE (1U << 0) |
134 | 134 | ||
135 | /* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the | ||
136 | * verifier will perform strict alignment checking as if the kernel | ||
137 | * has been built with CONFIG_EFFICIENT_UNALIGNED_ACCESS not set, | ||
138 | * and NET_IP_ALIGN defined to 2. | ||
139 | */ | ||
140 | #define BPF_F_STRICT_ALIGNMENT (1U << 0) | ||
141 | |||
135 | #define BPF_PSEUDO_MAP_FD 1 | 142 | #define BPF_PSEUDO_MAP_FD 1 |
136 | 143 | ||
137 | /* flags for BPF_MAP_UPDATE_ELEM command */ | 144 | /* flags for BPF_MAP_UPDATE_ELEM command */ |
@@ -177,6 +184,7 @@ union bpf_attr { | |||
177 | __u32 log_size; /* size of user buffer */ | 184 | __u32 log_size; /* size of user buffer */ |
178 | __aligned_u64 log_buf; /* user supplied buffer */ | 185 | __aligned_u64 log_buf; /* user supplied buffer */ |
179 | __u32 kern_version; /* checked when prog_type=kprobe */ | 186 | __u32 kern_version; /* checked when prog_type=kprobe */ |
187 | __u32 prog_flags; | ||
180 | }; | 188 | }; |
181 | 189 | ||
182 | struct { /* anonymous struct used by BPF_OBJ_* commands */ | 190 | struct { /* anonymous struct used by BPF_OBJ_* commands */ |
@@ -481,8 +489,7 @@ union bpf_attr { | |||
481 | * u32 bpf_get_socket_uid(skb) | 489 | * u32 bpf_get_socket_uid(skb) |
482 | * Get the owner uid of the socket stored inside sk_buff. | 490 | * Get the owner uid of the socket stored inside sk_buff. |
483 | * @skb: pointer to skb | 491 | * @skb: pointer to skb |
484 | * Return: uid of the socket owner on success or 0 if the socket pointer | 492 | * Return: uid of the socket owner on success or overflowuid if failed. |
485 | * inside sk_buff is NULL | ||
486 | */ | 493 | */ |
487 | #define __BPF_FUNC_MAPPER(FN) \ | 494 | #define __BPF_FUNC_MAPPER(FN) \ |
488 | FN(unspec), \ | 495 | FN(unspec), \ |
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c index 4fe444b8092e..6e178987af8e 100644 --- a/tools/lib/bpf/bpf.c +++ b/tools/lib/bpf/bpf.c | |||
@@ -117,6 +117,28 @@ int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns, | |||
117 | return sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); | 117 | return sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); |
118 | } | 118 | } |
119 | 119 | ||
120 | int bpf_verify_program(enum bpf_prog_type type, const struct bpf_insn *insns, | ||
121 | size_t insns_cnt, int strict_alignment, | ||
122 | const char *license, __u32 kern_version, | ||
123 | char *log_buf, size_t log_buf_sz) | ||
124 | { | ||
125 | union bpf_attr attr; | ||
126 | |||
127 | bzero(&attr, sizeof(attr)); | ||
128 | attr.prog_type = type; | ||
129 | attr.insn_cnt = (__u32)insns_cnt; | ||
130 | attr.insns = ptr_to_u64(insns); | ||
131 | attr.license = ptr_to_u64(license); | ||
132 | attr.log_buf = ptr_to_u64(log_buf); | ||
133 | attr.log_size = log_buf_sz; | ||
134 | attr.log_level = 2; | ||
135 | log_buf[0] = 0; | ||
136 | attr.kern_version = kern_version; | ||
137 | attr.prog_flags = strict_alignment ? BPF_F_STRICT_ALIGNMENT : 0; | ||
138 | |||
139 | return sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); | ||
140 | } | ||
141 | |||
120 | int bpf_map_update_elem(int fd, const void *key, const void *value, | 142 | int bpf_map_update_elem(int fd, const void *key, const void *value, |
121 | __u64 flags) | 143 | __u64 flags) |
122 | { | 144 | { |
diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h index edb4daeff7a5..972bd8333eb7 100644 --- a/tools/lib/bpf/bpf.h +++ b/tools/lib/bpf/bpf.h | |||
@@ -35,6 +35,10 @@ int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns, | |||
35 | size_t insns_cnt, const char *license, | 35 | size_t insns_cnt, const char *license, |
36 | __u32 kern_version, char *log_buf, | 36 | __u32 kern_version, char *log_buf, |
37 | size_t log_buf_sz); | 37 | size_t log_buf_sz); |
38 | int bpf_verify_program(enum bpf_prog_type type, const struct bpf_insn *insns, | ||
39 | size_t insns_cnt, int strict_alignment, | ||
40 | const char *license, __u32 kern_version, | ||
41 | char *log_buf, size_t log_buf_sz); | ||
38 | 42 | ||
39 | int bpf_map_update_elem(int fd, const void *key, const void *value, | 43 | int bpf_map_update_elem(int fd, const void *key, const void *value, |
40 | __u64 flags); | 44 | __u64 flags); |
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 91edd0566237..f389b02d43a0 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile | |||
@@ -11,7 +11,8 @@ endif | |||
11 | CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include | 11 | CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include |
12 | LDLIBS += -lcap -lelf | 12 | LDLIBS += -lcap -lelf |
13 | 13 | ||
14 | TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs | 14 | TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \ |
15 | test_align | ||
15 | 16 | ||
16 | TEST_GEN_FILES = test_pkt_access.o test_xdp.o test_l4lb.o test_tcp_estats.o | 17 | TEST_GEN_FILES = test_pkt_access.o test_xdp.o test_l4lb.o test_tcp_estats.o |
17 | 18 | ||
@@ -34,6 +35,7 @@ $(BPFOBJ): force | |||
34 | CLANG ?= clang | 35 | CLANG ?= clang |
35 | 36 | ||
36 | %.o: %.c | 37 | %.o: %.c |
37 | $(CLANG) -I. -I../../../include/uapi -I../../../../samples/bpf/ \ | 38 | $(CLANG) -I. -I./include/uapi -I../../../include/uapi \ |
39 | -I../../../../samples/bpf/ \ | ||
38 | -Wno-compare-distinct-pointer-types \ | 40 | -Wno-compare-distinct-pointer-types \ |
39 | -O2 -target bpf -c $< -o $@ | 41 | -O2 -target bpf -c $< -o $@ |
diff --git a/tools/testing/selftests/bpf/include/uapi/linux/types.h b/tools/testing/selftests/bpf/include/uapi/linux/types.h new file mode 100644 index 000000000000..51841848fbfe --- /dev/null +++ b/tools/testing/selftests/bpf/include/uapi/linux/types.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _UAPI_LINUX_TYPES_H | ||
2 | #define _UAPI_LINUX_TYPES_H | ||
3 | |||
4 | #include <asm-generic/int-ll64.h> | ||
5 | |||
6 | /* copied from linux:include/uapi/linux/types.h */ | ||
7 | #define __bitwise | ||
8 | typedef __u16 __bitwise __le16; | ||
9 | typedef __u16 __bitwise __be16; | ||
10 | typedef __u32 __bitwise __le32; | ||
11 | typedef __u32 __bitwise __be32; | ||
12 | typedef __u64 __bitwise __le64; | ||
13 | typedef __u64 __bitwise __be64; | ||
14 | |||
15 | typedef __u16 __bitwise __sum16; | ||
16 | typedef __u32 __bitwise __wsum; | ||
17 | |||
18 | #define __aligned_u64 __u64 __attribute__((aligned(8))) | ||
19 | #define __aligned_be64 __be64 __attribute__((aligned(8))) | ||
20 | #define __aligned_le64 __le64 __attribute__((aligned(8))) | ||
21 | |||
22 | #endif /* _UAPI_LINUX_TYPES_H */ | ||
diff --git a/tools/testing/selftests/bpf/test_align.c b/tools/testing/selftests/bpf/test_align.c new file mode 100644 index 000000000000..9644d4e069de --- /dev/null +++ b/tools/testing/selftests/bpf/test_align.c | |||
@@ -0,0 +1,453 @@ | |||
1 | #include <asm/types.h> | ||
2 | #include <linux/types.h> | ||
3 | #include <stdint.h> | ||
4 | #include <stdio.h> | ||
5 | #include <stdlib.h> | ||
6 | #include <unistd.h> | ||
7 | #include <errno.h> | ||
8 | #include <string.h> | ||
9 | #include <stddef.h> | ||
10 | #include <stdbool.h> | ||
11 | |||
12 | #include <linux/unistd.h> | ||
13 | #include <linux/filter.h> | ||
14 | #include <linux/bpf_perf_event.h> | ||
15 | #include <linux/bpf.h> | ||
16 | |||
17 | #include <bpf/bpf.h> | ||
18 | |||
19 | #include "../../../include/linux/filter.h" | ||
20 | |||
21 | #ifndef ARRAY_SIZE | ||
22 | # define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | ||
23 | #endif | ||
24 | |||
25 | #define MAX_INSNS 512 | ||
26 | #define MAX_MATCHES 16 | ||
27 | |||
28 | struct bpf_align_test { | ||
29 | const char *descr; | ||
30 | struct bpf_insn insns[MAX_INSNS]; | ||
31 | enum { | ||
32 | UNDEF, | ||
33 | ACCEPT, | ||
34 | REJECT | ||
35 | } result; | ||
36 | enum bpf_prog_type prog_type; | ||
37 | const char *matches[MAX_MATCHES]; | ||
38 | }; | ||
39 | |||
40 | static struct bpf_align_test tests[] = { | ||
41 | { | ||
42 | .descr = "mov", | ||
43 | .insns = { | ||
44 | BPF_MOV64_IMM(BPF_REG_3, 2), | ||
45 | BPF_MOV64_IMM(BPF_REG_3, 4), | ||
46 | BPF_MOV64_IMM(BPF_REG_3, 8), | ||
47 | BPF_MOV64_IMM(BPF_REG_3, 16), | ||
48 | BPF_MOV64_IMM(BPF_REG_3, 32), | ||
49 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
50 | BPF_EXIT_INSN(), | ||
51 | }, | ||
52 | .prog_type = BPF_PROG_TYPE_SCHED_CLS, | ||
53 | .matches = { | ||
54 | "1: R1=ctx R3=imm2,min_value=2,max_value=2,min_align=2 R10=fp", | ||
55 | "2: R1=ctx R3=imm4,min_value=4,max_value=4,min_align=4 R10=fp", | ||
56 | "3: R1=ctx R3=imm8,min_value=8,max_value=8,min_align=8 R10=fp", | ||
57 | "4: R1=ctx R3=imm16,min_value=16,max_value=16,min_align=16 R10=fp", | ||
58 | "5: R1=ctx R3=imm32,min_value=32,max_value=32,min_align=32 R10=fp", | ||
59 | }, | ||
60 | }, | ||
61 | { | ||
62 | .descr = "shift", | ||
63 | .insns = { | ||
64 | BPF_MOV64_IMM(BPF_REG_3, 1), | ||
65 | BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1), | ||
66 | BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1), | ||
67 | BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1), | ||
68 | BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1), | ||
69 | BPF_ALU64_IMM(BPF_RSH, BPF_REG_3, 4), | ||
70 | BPF_MOV64_IMM(BPF_REG_4, 32), | ||
71 | BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1), | ||
72 | BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1), | ||
73 | BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1), | ||
74 | BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1), | ||
75 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
76 | BPF_EXIT_INSN(), | ||
77 | }, | ||
78 | .prog_type = BPF_PROG_TYPE_SCHED_CLS, | ||
79 | .matches = { | ||
80 | "1: R1=ctx R3=imm1,min_value=1,max_value=1,min_align=1 R10=fp", | ||
81 | "2: R1=ctx R3=imm2,min_value=2,max_value=2,min_align=2 R10=fp", | ||
82 | "3: R1=ctx R3=imm4,min_value=4,max_value=4,min_align=4 R10=fp", | ||
83 | "4: R1=ctx R3=imm8,min_value=8,max_value=8,min_align=8 R10=fp", | ||
84 | "5: R1=ctx R3=imm16,min_value=16,max_value=16,min_align=16 R10=fp", | ||
85 | "6: R1=ctx R3=imm1,min_value=1,max_value=1,min_align=1 R10=fp", | ||
86 | "7: R1=ctx R3=imm1,min_value=1,max_value=1,min_align=1 R4=imm32,min_value=32,max_value=32,min_align=32 R10=fp", | ||
87 | "8: R1=ctx R3=imm1,min_value=1,max_value=1,min_align=1 R4=imm16,min_value=16,max_value=16,min_align=16 R10=fp", | ||
88 | "9: R1=ctx R3=imm1,min_value=1,max_value=1,min_align=1 R4=imm8,min_value=8,max_value=8,min_align=8 R10=fp", | ||
89 | "10: R1=ctx R3=imm1,min_value=1,max_value=1,min_align=1 R4=imm4,min_value=4,max_value=4,min_align=4 R10=fp", | ||
90 | "11: R1=ctx R3=imm1,min_value=1,max_value=1,min_align=1 R4=imm2,min_value=2,max_value=2,min_align=2 R10=fp", | ||
91 | }, | ||
92 | }, | ||
93 | { | ||
94 | .descr = "addsub", | ||
95 | .insns = { | ||
96 | BPF_MOV64_IMM(BPF_REG_3, 4), | ||
97 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_3, 4), | ||
98 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_3, 2), | ||
99 | BPF_MOV64_IMM(BPF_REG_4, 8), | ||
100 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 4), | ||
101 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 2), | ||
102 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
103 | BPF_EXIT_INSN(), | ||
104 | }, | ||
105 | .prog_type = BPF_PROG_TYPE_SCHED_CLS, | ||
106 | .matches = { | ||
107 | "1: R1=ctx R3=imm4,min_value=4,max_value=4,min_align=4 R10=fp", | ||
108 | "2: R1=ctx R3=imm8,min_value=8,max_value=8,min_align=4 R10=fp", | ||
109 | "3: R1=ctx R3=imm10,min_value=10,max_value=10,min_align=2 R10=fp", | ||
110 | "4: R1=ctx R3=imm10,min_value=10,max_value=10,min_align=2 R4=imm8,min_value=8,max_value=8,min_align=8 R10=fp", | ||
111 | "5: R1=ctx R3=imm10,min_value=10,max_value=10,min_align=2 R4=imm12,min_value=12,max_value=12,min_align=4 R10=fp", | ||
112 | "6: R1=ctx R3=imm10,min_value=10,max_value=10,min_align=2 R4=imm14,min_value=14,max_value=14,min_align=2 R10=fp", | ||
113 | }, | ||
114 | }, | ||
115 | { | ||
116 | .descr = "mul", | ||
117 | .insns = { | ||
118 | BPF_MOV64_IMM(BPF_REG_3, 7), | ||
119 | BPF_ALU64_IMM(BPF_MUL, BPF_REG_3, 1), | ||
120 | BPF_ALU64_IMM(BPF_MUL, BPF_REG_3, 2), | ||
121 | BPF_ALU64_IMM(BPF_MUL, BPF_REG_3, 4), | ||
122 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
123 | BPF_EXIT_INSN(), | ||
124 | }, | ||
125 | .prog_type = BPF_PROG_TYPE_SCHED_CLS, | ||
126 | .matches = { | ||
127 | "1: R1=ctx R3=imm7,min_value=7,max_value=7,min_align=1 R10=fp", | ||
128 | "2: R1=ctx R3=imm7,min_value=7,max_value=7,min_align=1 R10=fp", | ||
129 | "3: R1=ctx R3=imm14,min_value=14,max_value=14,min_align=2 R10=fp", | ||
130 | "4: R1=ctx R3=imm56,min_value=56,max_value=56,min_align=4 R10=fp", | ||
131 | }, | ||
132 | }, | ||
133 | |||
134 | #define PREP_PKT_POINTERS \ | ||
135 | BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, \ | ||
136 | offsetof(struct __sk_buff, data)), \ | ||
137 | BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, \ | ||
138 | offsetof(struct __sk_buff, data_end)) | ||
139 | |||
140 | #define LOAD_UNKNOWN(DST_REG) \ | ||
141 | PREP_PKT_POINTERS, \ | ||
142 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_2), \ | ||
143 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8), \ | ||
144 | BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_0, 1), \ | ||
145 | BPF_EXIT_INSN(), \ | ||
146 | BPF_LDX_MEM(BPF_B, DST_REG, BPF_REG_2, 0) | ||
147 | |||
148 | { | ||
149 | .descr = "unknown shift", | ||
150 | .insns = { | ||
151 | LOAD_UNKNOWN(BPF_REG_3), | ||
152 | BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1), | ||
153 | BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1), | ||
154 | BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1), | ||
155 | BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1), | ||
156 | LOAD_UNKNOWN(BPF_REG_4), | ||
157 | BPF_ALU64_IMM(BPF_LSH, BPF_REG_4, 5), | ||
158 | BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1), | ||
159 | BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1), | ||
160 | BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1), | ||
161 | BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1), | ||
162 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
163 | BPF_EXIT_INSN(), | ||
164 | }, | ||
165 | .prog_type = BPF_PROG_TYPE_SCHED_CLS, | ||
166 | .matches = { | ||
167 | "7: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R10=fp", | ||
168 | "8: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv55,min_align=2 R10=fp", | ||
169 | "9: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv54,min_align=4 R10=fp", | ||
170 | "10: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv53,min_align=8 R10=fp", | ||
171 | "11: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv52,min_align=16 R10=fp", | ||
172 | "18: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv56 R10=fp", | ||
173 | "19: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv51,min_align=32 R10=fp", | ||
174 | "20: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv52,min_align=16 R10=fp", | ||
175 | "21: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv53,min_align=8 R10=fp", | ||
176 | "22: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv54,min_align=4 R10=fp", | ||
177 | "23: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv55,min_align=2 R10=fp", | ||
178 | }, | ||
179 | }, | ||
180 | { | ||
181 | .descr = "unknown mul", | ||
182 | .insns = { | ||
183 | LOAD_UNKNOWN(BPF_REG_3), | ||
184 | BPF_MOV64_REG(BPF_REG_4, BPF_REG_3), | ||
185 | BPF_ALU64_IMM(BPF_MUL, BPF_REG_4, 1), | ||
186 | BPF_MOV64_REG(BPF_REG_4, BPF_REG_3), | ||
187 | BPF_ALU64_IMM(BPF_MUL, BPF_REG_4, 2), | ||
188 | BPF_MOV64_REG(BPF_REG_4, BPF_REG_3), | ||
189 | BPF_ALU64_IMM(BPF_MUL, BPF_REG_4, 4), | ||
190 | BPF_MOV64_REG(BPF_REG_4, BPF_REG_3), | ||
191 | BPF_ALU64_IMM(BPF_MUL, BPF_REG_4, 8), | ||
192 | BPF_ALU64_IMM(BPF_MUL, BPF_REG_4, 2), | ||
193 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
194 | BPF_EXIT_INSN(), | ||
195 | }, | ||
196 | .prog_type = BPF_PROG_TYPE_SCHED_CLS, | ||
197 | .matches = { | ||
198 | "7: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R10=fp", | ||
199 | "8: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv56 R10=fp", | ||
200 | "9: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv55,min_align=1 R10=fp", | ||
201 | "10: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv56 R10=fp", | ||
202 | "11: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv54,min_align=2 R10=fp", | ||
203 | "12: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv56 R10=fp", | ||
204 | "13: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv53,min_align=4 R10=fp", | ||
205 | "14: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv56 R10=fp", | ||
206 | "15: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv52,min_align=8 R10=fp", | ||
207 | "16: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv50,min_align=8 R10=fp" | ||
208 | }, | ||
209 | }, | ||
210 | { | ||
211 | .descr = "packet const offset", | ||
212 | .insns = { | ||
213 | PREP_PKT_POINTERS, | ||
214 | BPF_MOV64_REG(BPF_REG_5, BPF_REG_2), | ||
215 | |||
216 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
217 | |||
218 | /* Skip over ethernet header. */ | ||
219 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_5, 14), | ||
220 | BPF_MOV64_REG(BPF_REG_4, BPF_REG_5), | ||
221 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 4), | ||
222 | BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_4, 1), | ||
223 | BPF_EXIT_INSN(), | ||
224 | |||
225 | BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_5, 0), | ||
226 | BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_5, 1), | ||
227 | BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_5, 2), | ||
228 | BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_5, 3), | ||
229 | BPF_LDX_MEM(BPF_H, BPF_REG_4, BPF_REG_5, 0), | ||
230 | BPF_LDX_MEM(BPF_H, BPF_REG_4, BPF_REG_5, 2), | ||
231 | BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_5, 0), | ||
232 | |||
233 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
234 | BPF_EXIT_INSN(), | ||
235 | }, | ||
236 | .prog_type = BPF_PROG_TYPE_SCHED_CLS, | ||
237 | .matches = { | ||
238 | "4: R0=imm0,min_value=0,max_value=0,min_align=2147483648 R1=ctx R2=pkt(id=0,off=0,r=0) R3=pkt_end R5=pkt(id=0,off=0,r=0) R10=fp", | ||
239 | "5: R0=imm0,min_value=0,max_value=0,min_align=2147483648 R1=ctx R2=pkt(id=0,off=0,r=0) R3=pkt_end R5=pkt(id=0,off=14,r=0) R10=fp", | ||
240 | "6: R0=imm0,min_value=0,max_value=0,min_align=2147483648 R1=ctx R2=pkt(id=0,off=0,r=0) R3=pkt_end R4=pkt(id=0,off=14,r=0) R5=pkt(id=0,off=14,r=0) R10=fp", | ||
241 | "10: R0=imm0,min_value=0,max_value=0,min_align=2147483648 R1=ctx R2=pkt(id=0,off=0,r=18) R3=pkt_end R4=inv56 R5=pkt(id=0,off=14,r=18) R10=fp", | ||
242 | "14: R0=imm0,min_value=0,max_value=0,min_align=2147483648 R1=ctx R2=pkt(id=0,off=0,r=18) R3=pkt_end R4=inv48 R5=pkt(id=0,off=14,r=18) R10=fp", | ||
243 | "15: R0=imm0,min_value=0,max_value=0,min_align=2147483648 R1=ctx R2=pkt(id=0,off=0,r=18) R3=pkt_end R4=inv48 R5=pkt(id=0,off=14,r=18) R10=fp", | ||
244 | }, | ||
245 | }, | ||
246 | { | ||
247 | .descr = "packet variable offset", | ||
248 | .insns = { | ||
249 | LOAD_UNKNOWN(BPF_REG_6), | ||
250 | BPF_ALU64_IMM(BPF_LSH, BPF_REG_6, 2), | ||
251 | |||
252 | /* First, add a constant to the R5 packet pointer, | ||
253 | * then a variable with a known alignment. | ||
254 | */ | ||
255 | BPF_MOV64_REG(BPF_REG_5, BPF_REG_2), | ||
256 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_5, 14), | ||
257 | BPF_ALU64_REG(BPF_ADD, BPF_REG_5, BPF_REG_6), | ||
258 | BPF_MOV64_REG(BPF_REG_4, BPF_REG_5), | ||
259 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 4), | ||
260 | BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_4, 1), | ||
261 | BPF_EXIT_INSN(), | ||
262 | BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_5, 0), | ||
263 | |||
264 | /* Now, test in the other direction. Adding first | ||
265 | * the variable offset to R5, then the constant. | ||
266 | */ | ||
267 | BPF_MOV64_REG(BPF_REG_5, BPF_REG_2), | ||
268 | BPF_ALU64_REG(BPF_ADD, BPF_REG_5, BPF_REG_6), | ||
269 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_5, 14), | ||
270 | BPF_MOV64_REG(BPF_REG_4, BPF_REG_5), | ||
271 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 4), | ||
272 | BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_4, 1), | ||
273 | BPF_EXIT_INSN(), | ||
274 | BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_5, 0), | ||
275 | |||
276 | /* Test multiple accumulations of unknown values | ||
277 | * into a packet pointer. | ||
278 | */ | ||
279 | BPF_MOV64_REG(BPF_REG_5, BPF_REG_2), | ||
280 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_5, 14), | ||
281 | BPF_ALU64_REG(BPF_ADD, BPF_REG_5, BPF_REG_6), | ||
282 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_5, 4), | ||
283 | BPF_ALU64_REG(BPF_ADD, BPF_REG_5, BPF_REG_6), | ||
284 | BPF_MOV64_REG(BPF_REG_4, BPF_REG_5), | ||
285 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 4), | ||
286 | BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_4, 1), | ||
287 | BPF_EXIT_INSN(), | ||
288 | BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_5, 0), | ||
289 | |||
290 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
291 | BPF_EXIT_INSN(), | ||
292 | }, | ||
293 | .prog_type = BPF_PROG_TYPE_SCHED_CLS, | ||
294 | .matches = { | ||
295 | /* Calculated offset in R6 has unknown value, but known | ||
296 | * alignment of 4. | ||
297 | */ | ||
298 | "8: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R6=inv54,min_align=4 R10=fp", | ||
299 | |||
300 | /* Offset is added to packet pointer R5, resulting in known | ||
301 | * auxiliary alignment and offset. | ||
302 | */ | ||
303 | "11: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R5=pkt(id=1,off=0,r=0),aux_off=14,aux_off_align=4 R6=inv54,min_align=4 R10=fp", | ||
304 | |||
305 | /* At the time the word size load is performed from R5, | ||
306 | * it's total offset is NET_IP_ALIGN + reg->off (0) + | ||
307 | * reg->aux_off (14) which is 16. Then the variable | ||
308 | * offset is considered using reg->aux_off_align which | ||
309 | * is 4 and meets the load's requirements. | ||
310 | */ | ||
311 | "15: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=pkt(id=1,off=4,r=4),aux_off=14,aux_off_align=4 R5=pkt(id=1,off=0,r=4),aux_off=14,aux_off_align=4 R6=inv54,min_align=4 R10=fp", | ||
312 | |||
313 | |||
314 | /* Variable offset is added to R5 packet pointer, | ||
315 | * resulting in auxiliary alignment of 4. | ||
316 | */ | ||
317 | "18: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv,aux_off=14,aux_off_align=4 R5=pkt(id=2,off=0,r=0),aux_off_align=4 R6=inv54,min_align=4 R10=fp", | ||
318 | |||
319 | /* Constant offset is added to R5, resulting in | ||
320 | * reg->off of 14. | ||
321 | */ | ||
322 | "19: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv,aux_off=14,aux_off_align=4 R5=pkt(id=2,off=14,r=0),aux_off_align=4 R6=inv54,min_align=4 R10=fp", | ||
323 | |||
324 | /* At the time the word size load is performed from R5, | ||
325 | * it's total offset is NET_IP_ALIGN + reg->off (14) which | ||
326 | * is 16. Then the variable offset is considered using | ||
327 | * reg->aux_off_align which is 4 and meets the load's | ||
328 | * requirements. | ||
329 | */ | ||
330 | "23: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=pkt(id=2,off=18,r=18),aux_off_align=4 R5=pkt(id=2,off=14,r=18),aux_off_align=4 R6=inv54,min_align=4 R10=fp", | ||
331 | |||
332 | /* Constant offset is added to R5 packet pointer, | ||
333 | * resulting in reg->off value of 14. | ||
334 | */ | ||
335 | "26: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv,aux_off_align=4 R5=pkt(id=0,off=14,r=8) R6=inv54,min_align=4 R10=fp", | ||
336 | /* Variable offset is added to R5, resulting in an | ||
337 | * auxiliary offset of 14, and an auxiliary alignment of 4. | ||
338 | */ | ||
339 | "27: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv,aux_off_align=4 R5=pkt(id=3,off=0,r=0),aux_off=14,aux_off_align=4 R6=inv54,min_align=4 R10=fp", | ||
340 | /* Constant is added to R5 again, setting reg->off to 4. */ | ||
341 | "28: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv,aux_off_align=4 R5=pkt(id=3,off=4,r=0),aux_off=14,aux_off_align=4 R6=inv54,min_align=4 R10=fp", | ||
342 | /* And once more we add a variable, which causes an accumulation | ||
343 | * of reg->off into reg->aux_off_align, with resulting value of | ||
344 | * 18. The auxiliary alignment stays at 4. | ||
345 | */ | ||
346 | "29: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv,aux_off_align=4 R5=pkt(id=4,off=0,r=0),aux_off=18,aux_off_align=4 R6=inv54,min_align=4 R10=fp", | ||
347 | /* At the time the word size load is performed from R5, | ||
348 | * it's total offset is NET_IP_ALIGN + reg->off (0) + | ||
349 | * reg->aux_off (18) which is 20. Then the variable offset | ||
350 | * is considered using reg->aux_off_align which is 4 and meets | ||
351 | * the load's requirements. | ||
352 | */ | ||
353 | "33: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=pkt(id=4,off=4,r=4),aux_off=18,aux_off_align=4 R5=pkt(id=4,off=0,r=4),aux_off=18,aux_off_align=4 R6=inv54,min_align=4 R10=fp", | ||
354 | }, | ||
355 | }, | ||
356 | }; | ||
357 | |||
358 | static int probe_filter_length(const struct bpf_insn *fp) | ||
359 | { | ||
360 | int len; | ||
361 | |||
362 | for (len = MAX_INSNS - 1; len > 0; --len) | ||
363 | if (fp[len].code != 0 || fp[len].imm != 0) | ||
364 | break; | ||
365 | return len + 1; | ||
366 | } | ||
367 | |||
368 | static char bpf_vlog[32768]; | ||
369 | |||
370 | static int do_test_single(struct bpf_align_test *test) | ||
371 | { | ||
372 | struct bpf_insn *prog = test->insns; | ||
373 | int prog_type = test->prog_type; | ||
374 | int prog_len, i; | ||
375 | int fd_prog; | ||
376 | int ret; | ||
377 | |||
378 | prog_len = probe_filter_length(prog); | ||
379 | fd_prog = bpf_verify_program(prog_type ? : BPF_PROG_TYPE_SOCKET_FILTER, | ||
380 | prog, prog_len, 1, "GPL", 0, | ||
381 | bpf_vlog, sizeof(bpf_vlog)); | ||
382 | if (fd_prog < 0) { | ||
383 | printf("Failed to load program.\n"); | ||
384 | printf("%s", bpf_vlog); | ||
385 | ret = 1; | ||
386 | } else { | ||
387 | ret = 0; | ||
388 | for (i = 0; i < MAX_MATCHES; i++) { | ||
389 | const char *t, *m = test->matches[i]; | ||
390 | |||
391 | if (!m) | ||
392 | break; | ||
393 | t = strstr(bpf_vlog, m); | ||
394 | if (!t) { | ||
395 | printf("Failed to find match: %s\n", m); | ||
396 | ret = 1; | ||
397 | printf("%s", bpf_vlog); | ||
398 | break; | ||
399 | } | ||
400 | } | ||
401 | close(fd_prog); | ||
402 | } | ||
403 | return ret; | ||
404 | } | ||
405 | |||
406 | static int do_test(unsigned int from, unsigned int to) | ||
407 | { | ||
408 | int all_pass = 0; | ||
409 | int all_fail = 0; | ||
410 | unsigned int i; | ||
411 | |||
412 | for (i = from; i < to; i++) { | ||
413 | struct bpf_align_test *test = &tests[i]; | ||
414 | int fail; | ||
415 | |||
416 | printf("Test %3d: %s ... ", | ||
417 | i, test->descr); | ||
418 | fail = do_test_single(test); | ||
419 | if (fail) { | ||
420 | all_fail++; | ||
421 | printf("FAIL\n"); | ||
422 | } else { | ||
423 | all_pass++; | ||
424 | printf("PASS\n"); | ||
425 | } | ||
426 | } | ||
427 | printf("Results: %d pass %d fail\n", | ||
428 | all_pass, all_fail); | ||
429 | return 0; | ||
430 | } | ||
431 | |||
432 | int main(int argc, char **argv) | ||
433 | { | ||
434 | unsigned int from = 0, to = ARRAY_SIZE(tests); | ||
435 | |||
436 | if (argc == 3) { | ||
437 | unsigned int l = atoi(argv[argc - 2]); | ||
438 | unsigned int u = atoi(argv[argc - 1]); | ||
439 | |||
440 | if (l < to && u < to) { | ||
441 | from = l; | ||
442 | to = u + 1; | ||
443 | } | ||
444 | } else if (argc == 2) { | ||
445 | unsigned int t = atoi(argv[argc - 1]); | ||
446 | |||
447 | if (t < to) { | ||
448 | from = t; | ||
449 | to = t + 1; | ||
450 | } | ||
451 | } | ||
452 | return do_test(from, to); | ||
453 | } | ||
diff --git a/tools/testing/selftests/bpf/test_pkt_access.c b/tools/testing/selftests/bpf/test_pkt_access.c index 39387bb7e08c..6e11ba11709e 100644 --- a/tools/testing/selftests/bpf/test_pkt_access.c +++ b/tools/testing/selftests/bpf/test_pkt_access.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * License as published by the Free Software Foundation. | 5 | * License as published by the Free Software Foundation. |
6 | */ | 6 | */ |
7 | #include <stddef.h> | 7 | #include <stddef.h> |
8 | #include <string.h> | ||
8 | #include <linux/bpf.h> | 9 | #include <linux/bpf.h> |
9 | #include <linux/if_ether.h> | 10 | #include <linux/if_ether.h> |
10 | #include <linux/if_packet.h> | 11 | #include <linux/if_packet.h> |
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest index 32e6211e1c6e..717581145cfc 100755 --- a/tools/testing/selftests/ftrace/ftracetest +++ b/tools/testing/selftests/ftrace/ftracetest | |||
@@ -58,7 +58,7 @@ parse_opts() { # opts | |||
58 | ;; | 58 | ;; |
59 | --verbose|-v|-vv) | 59 | --verbose|-v|-vv) |
60 | VERBOSE=$((VERBOSE + 1)) | 60 | VERBOSE=$((VERBOSE + 1)) |
61 | [ $1 == '-vv' ] && VERBOSE=$((VERBOSE + 1)) | 61 | [ $1 = '-vv' ] && VERBOSE=$((VERBOSE + 1)) |
62 | shift 1 | 62 | shift 1 |
63 | ;; | 63 | ;; |
64 | --debug|-d) | 64 | --debug|-d) |
diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc index 07bb3e5930b4..aa31368851c9 100644 --- a/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc | |||
@@ -48,7 +48,7 @@ test_event_enabled() { | |||
48 | e=`cat $EVENT_ENABLE` | 48 | e=`cat $EVENT_ENABLE` |
49 | if [ "$e" != $val ]; then | 49 | if [ "$e" != $val ]; then |
50 | echo "Expected $val but found $e" | 50 | echo "Expected $val but found $e" |
51 | exit -1 | 51 | exit 1 |
52 | fi | 52 | fi |
53 | } | 53 | } |
54 | 54 | ||
diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions index 9aec6fcb7729..f2019b37370d 100644 --- a/tools/testing/selftests/ftrace/test.d/functions +++ b/tools/testing/selftests/ftrace/test.d/functions | |||
@@ -34,10 +34,10 @@ reset_ftrace_filter() { # reset all triggers in set_ftrace_filter | |||
34 | echo > set_ftrace_filter | 34 | echo > set_ftrace_filter |
35 | grep -v '^#' set_ftrace_filter | while read t; do | 35 | grep -v '^#' set_ftrace_filter | while read t; do |
36 | tr=`echo $t | cut -d: -f2` | 36 | tr=`echo $t | cut -d: -f2` |
37 | if [ "$tr" == "" ]; then | 37 | if [ "$tr" = "" ]; then |
38 | continue | 38 | continue |
39 | fi | 39 | fi |
40 | if [ $tr == "enable_event" -o $tr == "disable_event" ]; then | 40 | if [ $tr = "enable_event" -o $tr = "disable_event" ]; then |
41 | tr=`echo $t | cut -d: -f1-4` | 41 | tr=`echo $t | cut -d: -f1-4` |
42 | limit=`echo $t | cut -d: -f5` | 42 | limit=`echo $t | cut -d: -f5` |
43 | else | 43 | else |
diff --git a/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc b/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc index 4c5a061a5b4e..c73db7863adb 100644 --- a/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc +++ b/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc | |||
@@ -75,9 +75,13 @@ rmdir foo | |||
75 | if [ -d foo ]; then | 75 | if [ -d foo ]; then |
76 | fail "foo still exists" | 76 | fail "foo still exists" |
77 | fi | 77 | fi |
78 | exit 0 | ||
79 | |||
80 | 78 | ||
79 | mkdir foo | ||
80 | echo "schedule:enable_event:sched:sched_switch" > foo/set_ftrace_filter | ||
81 | rmdir foo | ||
82 | if [ -d foo ]; then | ||
83 | fail "foo still exists" | ||
84 | fi | ||
81 | 85 | ||
82 | 86 | ||
83 | instance_slam() { | 87 | instance_slam() { |
diff --git a/tools/testing/selftests/powerpc/tm/.gitignore b/tools/testing/selftests/powerpc/tm/.gitignore index 427621792229..2f1f7b013293 100644 --- a/tools/testing/selftests/powerpc/tm/.gitignore +++ b/tools/testing/selftests/powerpc/tm/.gitignore | |||
@@ -11,3 +11,4 @@ tm-signal-context-chk-fpu | |||
11 | tm-signal-context-chk-gpr | 11 | tm-signal-context-chk-gpr |
12 | tm-signal-context-chk-vmx | 12 | tm-signal-context-chk-vmx |
13 | tm-signal-context-chk-vsx | 13 | tm-signal-context-chk-vsx |
14 | tm-vmx-unavail | ||
diff --git a/tools/testing/selftests/powerpc/tm/Makefile b/tools/testing/selftests/powerpc/tm/Makefile index 5576ee6a51f2..958c11c14acd 100644 --- a/tools/testing/selftests/powerpc/tm/Makefile +++ b/tools/testing/selftests/powerpc/tm/Makefile | |||
@@ -2,7 +2,8 @@ SIGNAL_CONTEXT_CHK_TESTS := tm-signal-context-chk-gpr tm-signal-context-chk-fpu | |||
2 | tm-signal-context-chk-vmx tm-signal-context-chk-vsx | 2 | tm-signal-context-chk-vmx tm-signal-context-chk-vsx |
3 | 3 | ||
4 | TEST_GEN_PROGS := tm-resched-dscr tm-syscall tm-signal-msr-resv tm-signal-stack \ | 4 | TEST_GEN_PROGS := tm-resched-dscr tm-syscall tm-signal-msr-resv tm-signal-stack \ |
5 | tm-vmxcopy tm-fork tm-tar tm-tmspr $(SIGNAL_CONTEXT_CHK_TESTS) | 5 | tm-vmxcopy tm-fork tm-tar tm-tmspr tm-vmx-unavail \ |
6 | $(SIGNAL_CONTEXT_CHK_TESTS) | ||
6 | 7 | ||
7 | include ../../lib.mk | 8 | include ../../lib.mk |
8 | 9 | ||
@@ -13,6 +14,7 @@ CFLAGS += -mhtm | |||
13 | $(OUTPUT)/tm-syscall: tm-syscall-asm.S | 14 | $(OUTPUT)/tm-syscall: tm-syscall-asm.S |
14 | $(OUTPUT)/tm-syscall: CFLAGS += -I../../../../../usr/include | 15 | $(OUTPUT)/tm-syscall: CFLAGS += -I../../../../../usr/include |
15 | $(OUTPUT)/tm-tmspr: CFLAGS += -pthread | 16 | $(OUTPUT)/tm-tmspr: CFLAGS += -pthread |
17 | $(OUTPUT)/tm-vmx-unavail: CFLAGS += -pthread -m64 | ||
16 | 18 | ||
17 | SIGNAL_CONTEXT_CHK_TESTS := $(patsubst %,$(OUTPUT)/%,$(SIGNAL_CONTEXT_CHK_TESTS)) | 19 | SIGNAL_CONTEXT_CHK_TESTS := $(patsubst %,$(OUTPUT)/%,$(SIGNAL_CONTEXT_CHK_TESTS)) |
18 | $(SIGNAL_CONTEXT_CHK_TESTS): tm-signal.S | 20 | $(SIGNAL_CONTEXT_CHK_TESTS): tm-signal.S |
diff --git a/tools/testing/selftests/powerpc/tm/tm-vmx-unavail.c b/tools/testing/selftests/powerpc/tm/tm-vmx-unavail.c new file mode 100644 index 000000000000..137185ba4937 --- /dev/null +++ b/tools/testing/selftests/powerpc/tm/tm-vmx-unavail.c | |||
@@ -0,0 +1,118 @@ | |||
1 | /* | ||
2 | * Copyright 2017, Michael Neuling, IBM Corp. | ||
3 | * Licensed under GPLv2. | ||
4 | * Original: Breno Leitao <brenohl@br.ibm.com> & | ||
5 | * Gustavo Bueno Romero <gromero@br.ibm.com> | ||
6 | * Edited: Michael Neuling | ||
7 | * | ||
8 | * Force VMX unavailable during a transaction and see if it corrupts | ||
9 | * the checkpointed VMX register state after the abort. | ||
10 | */ | ||
11 | |||
12 | #include <inttypes.h> | ||
13 | #include <htmintrin.h> | ||
14 | #include <string.h> | ||
15 | #include <stdlib.h> | ||
16 | #include <stdio.h> | ||
17 | #include <pthread.h> | ||
18 | #include <sys/mman.h> | ||
19 | #include <unistd.h> | ||
20 | #include <pthread.h> | ||
21 | |||
22 | #include "tm.h" | ||
23 | #include "utils.h" | ||
24 | |||
25 | int passed; | ||
26 | |||
27 | void *worker(void *unused) | ||
28 | { | ||
29 | __int128 vmx0; | ||
30 | uint64_t texasr; | ||
31 | |||
32 | asm goto ( | ||
33 | "li 3, 1;" /* Stick non-zero value in VMX0 */ | ||
34 | "std 3, 0(%[vmx0_ptr]);" | ||
35 | "lvx 0, 0, %[vmx0_ptr];" | ||
36 | |||
37 | /* Wait here a bit so we get scheduled out 255 times */ | ||
38 | "lis 3, 0x3fff;" | ||
39 | "1: ;" | ||
40 | "addi 3, 3, -1;" | ||
41 | "cmpdi 3, 0;" | ||
42 | "bne 1b;" | ||
43 | |||
44 | /* Kernel will hopefully turn VMX off now */ | ||
45 | |||
46 | "tbegin. ;" | ||
47 | "beq failure;" | ||
48 | |||
49 | /* Cause VMX unavail. Any VMX instruction */ | ||
50 | "vaddcuw 0,0,0;" | ||
51 | |||
52 | "tend. ;" | ||
53 | "b %l[success];" | ||
54 | |||
55 | /* Check VMX0 sanity after abort */ | ||
56 | "failure: ;" | ||
57 | "lvx 1, 0, %[vmx0_ptr];" | ||
58 | "vcmpequb. 2, 0, 1;" | ||
59 | "bc 4, 24, %l[value_mismatch];" | ||
60 | "b %l[value_match];" | ||
61 | : | ||
62 | : [vmx0_ptr] "r"(&vmx0) | ||
63 | : "r3" | ||
64 | : success, value_match, value_mismatch | ||
65 | ); | ||
66 | |||
67 | /* HTM aborted and VMX0 is corrupted */ | ||
68 | value_mismatch: | ||
69 | texasr = __builtin_get_texasr(); | ||
70 | |||
71 | printf("\n\n==============\n\n"); | ||
72 | printf("Failure with error: %lx\n", _TEXASR_FAILURE_CODE(texasr)); | ||
73 | printf("Summary error : %lx\n", _TEXASR_FAILURE_SUMMARY(texasr)); | ||
74 | printf("TFIAR exact : %lx\n\n", _TEXASR_TFIAR_EXACT(texasr)); | ||
75 | |||
76 | passed = 0; | ||
77 | return NULL; | ||
78 | |||
79 | /* HTM aborted but VMX0 is correct */ | ||
80 | value_match: | ||
81 | // printf("!"); | ||
82 | return NULL; | ||
83 | |||
84 | success: | ||
85 | // printf("."); | ||
86 | return NULL; | ||
87 | } | ||
88 | |||
89 | int tm_vmx_unavail_test() | ||
90 | { | ||
91 | int threads; | ||
92 | pthread_t *thread; | ||
93 | |||
94 | SKIP_IF(!have_htm()); | ||
95 | |||
96 | passed = 1; | ||
97 | |||
98 | threads = sysconf(_SC_NPROCESSORS_ONLN) * 4; | ||
99 | thread = malloc(sizeof(pthread_t)*threads); | ||
100 | if (!thread) | ||
101 | return EXIT_FAILURE; | ||
102 | |||
103 | for (uint64_t i = 0; i < threads; i++) | ||
104 | pthread_create(&thread[i], NULL, &worker, NULL); | ||
105 | |||
106 | for (uint64_t i = 0; i < threads; i++) | ||
107 | pthread_join(thread[i], NULL); | ||
108 | |||
109 | free(thread); | ||
110 | |||
111 | return passed ? EXIT_SUCCESS : EXIT_FAILURE; | ||
112 | } | ||
113 | |||
114 | |||
115 | int main(int argc, char **argv) | ||
116 | { | ||
117 | return test_harness(tm_vmx_unavail_test, "tm_vmx_unavail_test"); | ||
118 | } | ||
diff --git a/virt/kvm/arm/hyp/vgic-v3-sr.c b/virt/kvm/arm/hyp/vgic-v3-sr.c index bce6037cf01d..32c3295929b0 100644 --- a/virt/kvm/arm/hyp/vgic-v3-sr.c +++ b/virt/kvm/arm/hyp/vgic-v3-sr.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <asm/kvm_hyp.h> | 22 | #include <asm/kvm_hyp.h> |
23 | 23 | ||
24 | #define vtr_to_max_lr_idx(v) ((v) & 0xf) | 24 | #define vtr_to_max_lr_idx(v) ((v) & 0xf) |
25 | #define vtr_to_nr_pri_bits(v) (((u32)(v) >> 29) + 1) | 25 | #define vtr_to_nr_pre_bits(v) (((u32)(v) >> 26) + 1) |
26 | 26 | ||
27 | static u64 __hyp_text __gic_v3_get_lr(unsigned int lr) | 27 | static u64 __hyp_text __gic_v3_get_lr(unsigned int lr) |
28 | { | 28 | { |
@@ -135,13 +135,13 @@ void __hyp_text __vgic_v3_save_state(struct kvm_vcpu *vcpu) | |||
135 | 135 | ||
136 | if (used_lrs) { | 136 | if (used_lrs) { |
137 | int i; | 137 | int i; |
138 | u32 nr_pri_bits; | 138 | u32 nr_pre_bits; |
139 | 139 | ||
140 | cpu_if->vgic_elrsr = read_gicreg(ICH_ELSR_EL2); | 140 | cpu_if->vgic_elrsr = read_gicreg(ICH_ELSR_EL2); |
141 | 141 | ||
142 | write_gicreg(0, ICH_HCR_EL2); | 142 | write_gicreg(0, ICH_HCR_EL2); |
143 | val = read_gicreg(ICH_VTR_EL2); | 143 | val = read_gicreg(ICH_VTR_EL2); |
144 | nr_pri_bits = vtr_to_nr_pri_bits(val); | 144 | nr_pre_bits = vtr_to_nr_pre_bits(val); |
145 | 145 | ||
146 | for (i = 0; i < used_lrs; i++) { | 146 | for (i = 0; i < used_lrs; i++) { |
147 | if (cpu_if->vgic_elrsr & (1 << i)) | 147 | if (cpu_if->vgic_elrsr & (1 << i)) |
@@ -152,7 +152,7 @@ void __hyp_text __vgic_v3_save_state(struct kvm_vcpu *vcpu) | |||
152 | __gic_v3_set_lr(0, i); | 152 | __gic_v3_set_lr(0, i); |
153 | } | 153 | } |
154 | 154 | ||
155 | switch (nr_pri_bits) { | 155 | switch (nr_pre_bits) { |
156 | case 7: | 156 | case 7: |
157 | cpu_if->vgic_ap0r[3] = read_gicreg(ICH_AP0R3_EL2); | 157 | cpu_if->vgic_ap0r[3] = read_gicreg(ICH_AP0R3_EL2); |
158 | cpu_if->vgic_ap0r[2] = read_gicreg(ICH_AP0R2_EL2); | 158 | cpu_if->vgic_ap0r[2] = read_gicreg(ICH_AP0R2_EL2); |
@@ -162,7 +162,7 @@ void __hyp_text __vgic_v3_save_state(struct kvm_vcpu *vcpu) | |||
162 | cpu_if->vgic_ap0r[0] = read_gicreg(ICH_AP0R0_EL2); | 162 | cpu_if->vgic_ap0r[0] = read_gicreg(ICH_AP0R0_EL2); |
163 | } | 163 | } |
164 | 164 | ||
165 | switch (nr_pri_bits) { | 165 | switch (nr_pre_bits) { |
166 | case 7: | 166 | case 7: |
167 | cpu_if->vgic_ap1r[3] = read_gicreg(ICH_AP1R3_EL2); | 167 | cpu_if->vgic_ap1r[3] = read_gicreg(ICH_AP1R3_EL2); |
168 | cpu_if->vgic_ap1r[2] = read_gicreg(ICH_AP1R2_EL2); | 168 | cpu_if->vgic_ap1r[2] = read_gicreg(ICH_AP1R2_EL2); |
@@ -198,7 +198,7 @@ void __hyp_text __vgic_v3_restore_state(struct kvm_vcpu *vcpu) | |||
198 | struct vgic_v3_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v3; | 198 | struct vgic_v3_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v3; |
199 | u64 used_lrs = vcpu->arch.vgic_cpu.used_lrs; | 199 | u64 used_lrs = vcpu->arch.vgic_cpu.used_lrs; |
200 | u64 val; | 200 | u64 val; |
201 | u32 nr_pri_bits; | 201 | u32 nr_pre_bits; |
202 | int i; | 202 | int i; |
203 | 203 | ||
204 | /* | 204 | /* |
@@ -217,12 +217,12 @@ void __hyp_text __vgic_v3_restore_state(struct kvm_vcpu *vcpu) | |||
217 | } | 217 | } |
218 | 218 | ||
219 | val = read_gicreg(ICH_VTR_EL2); | 219 | val = read_gicreg(ICH_VTR_EL2); |
220 | nr_pri_bits = vtr_to_nr_pri_bits(val); | 220 | nr_pre_bits = vtr_to_nr_pre_bits(val); |
221 | 221 | ||
222 | if (used_lrs) { | 222 | if (used_lrs) { |
223 | write_gicreg(cpu_if->vgic_hcr, ICH_HCR_EL2); | 223 | write_gicreg(cpu_if->vgic_hcr, ICH_HCR_EL2); |
224 | 224 | ||
225 | switch (nr_pri_bits) { | 225 | switch (nr_pre_bits) { |
226 | case 7: | 226 | case 7: |
227 | write_gicreg(cpu_if->vgic_ap0r[3], ICH_AP0R3_EL2); | 227 | write_gicreg(cpu_if->vgic_ap0r[3], ICH_AP0R3_EL2); |
228 | write_gicreg(cpu_if->vgic_ap0r[2], ICH_AP0R2_EL2); | 228 | write_gicreg(cpu_if->vgic_ap0r[2], ICH_AP0R2_EL2); |
@@ -232,7 +232,7 @@ void __hyp_text __vgic_v3_restore_state(struct kvm_vcpu *vcpu) | |||
232 | write_gicreg(cpu_if->vgic_ap0r[0], ICH_AP0R0_EL2); | 232 | write_gicreg(cpu_if->vgic_ap0r[0], ICH_AP0R0_EL2); |
233 | } | 233 | } |
234 | 234 | ||
235 | switch (nr_pri_bits) { | 235 | switch (nr_pre_bits) { |
236 | case 7: | 236 | case 7: |
237 | write_gicreg(cpu_if->vgic_ap1r[3], ICH_AP1R3_EL2); | 237 | write_gicreg(cpu_if->vgic_ap1r[3], ICH_AP1R3_EL2); |
238 | write_gicreg(cpu_if->vgic_ap1r[2], ICH_AP1R2_EL2); | 238 | write_gicreg(cpu_if->vgic_ap1r[2], ICH_AP1R2_EL2); |
diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c index 313ee646480f..a2d63247d1bb 100644 --- a/virt/kvm/arm/mmu.c +++ b/virt/kvm/arm/mmu.c | |||
@@ -295,6 +295,13 @@ static void unmap_stage2_range(struct kvm *kvm, phys_addr_t start, u64 size) | |||
295 | assert_spin_locked(&kvm->mmu_lock); | 295 | assert_spin_locked(&kvm->mmu_lock); |
296 | pgd = kvm->arch.pgd + stage2_pgd_index(addr); | 296 | pgd = kvm->arch.pgd + stage2_pgd_index(addr); |
297 | do { | 297 | do { |
298 | /* | ||
299 | * Make sure the page table is still active, as another thread | ||
300 | * could have possibly freed the page table, while we released | ||
301 | * the lock. | ||
302 | */ | ||
303 | if (!READ_ONCE(kvm->arch.pgd)) | ||
304 | break; | ||
298 | next = stage2_pgd_addr_end(addr, end); | 305 | next = stage2_pgd_addr_end(addr, end); |
299 | if (!stage2_pgd_none(*pgd)) | 306 | if (!stage2_pgd_none(*pgd)) |
300 | unmap_stage2_puds(kvm, pgd, addr, next); | 307 | unmap_stage2_puds(kvm, pgd, addr, next); |
@@ -829,22 +836,22 @@ void stage2_unmap_vm(struct kvm *kvm) | |||
829 | * Walks the level-1 page table pointed to by kvm->arch.pgd and frees all | 836 | * Walks the level-1 page table pointed to by kvm->arch.pgd and frees all |
830 | * underlying level-2 and level-3 tables before freeing the actual level-1 table | 837 | * underlying level-2 and level-3 tables before freeing the actual level-1 table |
831 | * and setting the struct pointer to NULL. | 838 | * and setting the struct pointer to NULL. |
832 | * | ||
833 | * Note we don't need locking here as this is only called when the VM is | ||
834 | * destroyed, which can only be done once. | ||
835 | */ | 839 | */ |
836 | void kvm_free_stage2_pgd(struct kvm *kvm) | 840 | void kvm_free_stage2_pgd(struct kvm *kvm) |
837 | { | 841 | { |
838 | if (kvm->arch.pgd == NULL) | 842 | void *pgd = NULL; |
839 | return; | ||
840 | 843 | ||
841 | spin_lock(&kvm->mmu_lock); | 844 | spin_lock(&kvm->mmu_lock); |
842 | unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE); | 845 | if (kvm->arch.pgd) { |
846 | unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE); | ||
847 | pgd = READ_ONCE(kvm->arch.pgd); | ||
848 | kvm->arch.pgd = NULL; | ||
849 | } | ||
843 | spin_unlock(&kvm->mmu_lock); | 850 | spin_unlock(&kvm->mmu_lock); |
844 | 851 | ||
845 | /* Free the HW pgd, one page at a time */ | 852 | /* Free the HW pgd, one page at a time */ |
846 | free_pages_exact(kvm->arch.pgd, S2_PGD_SIZE); | 853 | if (pgd) |
847 | kvm->arch.pgd = NULL; | 854 | free_pages_exact(pgd, S2_PGD_SIZE); |
848 | } | 855 | } |
849 | 856 | ||
850 | static pud_t *stage2_get_pud(struct kvm *kvm, struct kvm_mmu_memory_cache *cache, | 857 | static pud_t *stage2_get_pud(struct kvm *kvm, struct kvm_mmu_memory_cache *cache, |
@@ -1170,11 +1177,13 @@ static void stage2_wp_range(struct kvm *kvm, phys_addr_t addr, phys_addr_t end) | |||
1170 | * large. Otherwise, we may see kernel panics with | 1177 | * large. Otherwise, we may see kernel panics with |
1171 | * CONFIG_DETECT_HUNG_TASK, CONFIG_LOCKUP_DETECTOR, | 1178 | * CONFIG_DETECT_HUNG_TASK, CONFIG_LOCKUP_DETECTOR, |
1172 | * CONFIG_LOCKDEP. Additionally, holding the lock too long | 1179 | * CONFIG_LOCKDEP. Additionally, holding the lock too long |
1173 | * will also starve other vCPUs. | 1180 | * will also starve other vCPUs. We have to also make sure |
1181 | * that the page tables are not freed while we released | ||
1182 | * the lock. | ||
1174 | */ | 1183 | */ |
1175 | if (need_resched() || spin_needbreak(&kvm->mmu_lock)) | 1184 | cond_resched_lock(&kvm->mmu_lock); |
1176 | cond_resched_lock(&kvm->mmu_lock); | 1185 | if (!READ_ONCE(kvm->arch.pgd)) |
1177 | 1186 | break; | |
1178 | next = stage2_pgd_addr_end(addr, end); | 1187 | next = stage2_pgd_addr_end(addr, end); |
1179 | if (stage2_pgd_present(*pgd)) | 1188 | if (stage2_pgd_present(*pgd)) |
1180 | stage2_wp_puds(pgd, addr, next); | 1189 | stage2_wp_puds(pgd, addr, next); |
diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c index dc68e2e424ab..3a0b8999f011 100644 --- a/virt/kvm/arm/vgic/vgic-init.c +++ b/virt/kvm/arm/vgic/vgic-init.c | |||
@@ -242,8 +242,11 @@ int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu) | |||
242 | * If we are creating a VCPU with a GICv3 we must also register the | 242 | * If we are creating a VCPU with a GICv3 we must also register the |
243 | * KVM io device for the redistributor that belongs to this VCPU. | 243 | * KVM io device for the redistributor that belongs to this VCPU. |
244 | */ | 244 | */ |
245 | if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) | 245 | if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) { |
246 | mutex_lock(&vcpu->kvm->lock); | ||
246 | ret = vgic_register_redist_iodev(vcpu); | 247 | ret = vgic_register_redist_iodev(vcpu); |
248 | mutex_unlock(&vcpu->kvm->lock); | ||
249 | } | ||
247 | return ret; | 250 | return ret; |
248 | } | 251 | } |
249 | 252 | ||
diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c index 99da1a207c19..201d5e2e973d 100644 --- a/virt/kvm/arm/vgic/vgic-mmio-v3.c +++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c | |||
@@ -586,7 +586,7 @@ int vgic_register_redist_iodev(struct kvm_vcpu *vcpu) | |||
586 | if (!vgic_v3_check_base(kvm)) | 586 | if (!vgic_v3_check_base(kvm)) |
587 | return -EINVAL; | 587 | return -EINVAL; |
588 | 588 | ||
589 | rd_base = vgic->vgic_redist_base + kvm_vcpu_get_idx(vcpu) * SZ_64K * 2; | 589 | rd_base = vgic->vgic_redist_base + vgic->vgic_redist_free_offset; |
590 | sgi_base = rd_base + SZ_64K; | 590 | sgi_base = rd_base + SZ_64K; |
591 | 591 | ||
592 | kvm_iodevice_init(&rd_dev->dev, &kvm_io_gic_ops); | 592 | kvm_iodevice_init(&rd_dev->dev, &kvm_io_gic_ops); |
@@ -614,11 +614,15 @@ int vgic_register_redist_iodev(struct kvm_vcpu *vcpu) | |||
614 | mutex_lock(&kvm->slots_lock); | 614 | mutex_lock(&kvm->slots_lock); |
615 | ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, sgi_base, | 615 | ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, sgi_base, |
616 | SZ_64K, &sgi_dev->dev); | 616 | SZ_64K, &sgi_dev->dev); |
617 | mutex_unlock(&kvm->slots_lock); | 617 | if (ret) { |
618 | if (ret) | ||
619 | kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS, | 618 | kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS, |
620 | &rd_dev->dev); | 619 | &rd_dev->dev); |
620 | goto out; | ||
621 | } | ||
621 | 622 | ||
623 | vgic->vgic_redist_free_offset += 2 * SZ_64K; | ||
624 | out: | ||
625 | mutex_unlock(&kvm->slots_lock); | ||
622 | return ret; | 626 | return ret; |
623 | } | 627 | } |
624 | 628 | ||
@@ -644,10 +648,12 @@ static int vgic_register_all_redist_iodevs(struct kvm *kvm) | |||
644 | 648 | ||
645 | if (ret) { | 649 | if (ret) { |
646 | /* The current c failed, so we start with the previous one. */ | 650 | /* The current c failed, so we start with the previous one. */ |
651 | mutex_lock(&kvm->slots_lock); | ||
647 | for (c--; c >= 0; c--) { | 652 | for (c--; c >= 0; c--) { |
648 | vcpu = kvm_get_vcpu(kvm, c); | 653 | vcpu = kvm_get_vcpu(kvm, c); |
649 | vgic_unregister_redist_iodev(vcpu); | 654 | vgic_unregister_redist_iodev(vcpu); |
650 | } | 655 | } |
656 | mutex_unlock(&kvm->slots_lock); | ||
651 | } | 657 | } |
652 | 658 | ||
653 | return ret; | 659 | return ret; |
diff --git a/virt/kvm/arm/vgic/vgic-v2.c b/virt/kvm/arm/vgic/vgic-v2.c index a65757aab6d3..504b4bd0d651 100644 --- a/virt/kvm/arm/vgic/vgic-v2.c +++ b/virt/kvm/arm/vgic/vgic-v2.c | |||
@@ -149,6 +149,13 @@ void vgic_v2_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr) | |||
149 | if (irq->hw) { | 149 | if (irq->hw) { |
150 | val |= GICH_LR_HW; | 150 | val |= GICH_LR_HW; |
151 | val |= irq->hwintid << GICH_LR_PHYSID_CPUID_SHIFT; | 151 | val |= irq->hwintid << GICH_LR_PHYSID_CPUID_SHIFT; |
152 | /* | ||
153 | * Never set pending+active on a HW interrupt, as the | ||
154 | * pending state is kept at the physical distributor | ||
155 | * level. | ||
156 | */ | ||
157 | if (irq->active && irq_is_pending(irq)) | ||
158 | val &= ~GICH_LR_PENDING_BIT; | ||
152 | } else { | 159 | } else { |
153 | if (irq->config == VGIC_CONFIG_LEVEL) | 160 | if (irq->config == VGIC_CONFIG_LEVEL) |
154 | val |= GICH_LR_EOI; | 161 | val |= GICH_LR_EOI; |
diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c index 8fa737edde6f..6fe3f003636a 100644 --- a/virt/kvm/arm/vgic/vgic-v3.c +++ b/virt/kvm/arm/vgic/vgic-v3.c | |||
@@ -127,6 +127,13 @@ void vgic_v3_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr) | |||
127 | if (irq->hw) { | 127 | if (irq->hw) { |
128 | val |= ICH_LR_HW; | 128 | val |= ICH_LR_HW; |
129 | val |= ((u64)irq->hwintid) << ICH_LR_PHYS_ID_SHIFT; | 129 | val |= ((u64)irq->hwintid) << ICH_LR_PHYS_ID_SHIFT; |
130 | /* | ||
131 | * Never set pending+active on a HW interrupt, as the | ||
132 | * pending state is kept at the physical distributor | ||
133 | * level. | ||
134 | */ | ||
135 | if (irq->active && irq_is_pending(irq)) | ||
136 | val &= ~ICH_LR_PENDING_BIT; | ||
130 | } else { | 137 | } else { |
131 | if (irq->config == VGIC_CONFIG_LEVEL) | 138 | if (irq->config == VGIC_CONFIG_LEVEL) |
132 | val |= ICH_LR_EOI; | 139 | val |= ICH_LR_EOI; |