diff options
553 files changed, 5639 insertions, 3301 deletions
diff --git a/.gitignore b/.gitignore index 3b8b9b33be38..7e9932e55475 100644 --- a/.gitignore +++ b/.gitignore | |||
@@ -29,6 +29,7 @@ modules.builtin | |||
29 | *.bz2 | 29 | *.bz2 |
30 | *.lzma | 30 | *.lzma |
31 | *.xz | 31 | *.xz |
32 | *.lz4 | ||
32 | *.lzo | 33 | *.lzo |
33 | *.patch | 34 | *.patch |
34 | *.gcno | 35 | *.gcno |
diff --git a/Documentation/DocBook/device-drivers.tmpl b/Documentation/DocBook/device-drivers.tmpl index cbfdf5486639..fe397f90a34f 100644 --- a/Documentation/DocBook/device-drivers.tmpl +++ b/Documentation/DocBook/device-drivers.tmpl | |||
@@ -84,7 +84,7 @@ X!Iinclude/linux/kobject.h | |||
84 | 84 | ||
85 | <sect1><title>Kernel utility functions</title> | 85 | <sect1><title>Kernel utility functions</title> |
86 | !Iinclude/linux/kernel.h | 86 | !Iinclude/linux/kernel.h |
87 | !Ekernel/printk.c | 87 | !Ekernel/printk/printk.c |
88 | !Ekernel/panic.c | 88 | !Ekernel/panic.c |
89 | !Ekernel/sys.c | 89 | !Ekernel/sys.c |
90 | !Ekernel/rcupdate.c | 90 | !Ekernel/rcupdate.c |
diff --git a/Documentation/DocBook/media_api.tmpl b/Documentation/DocBook/media_api.tmpl index 6a8b7158697f..9c92bb879b6d 100644 --- a/Documentation/DocBook/media_api.tmpl +++ b/Documentation/DocBook/media_api.tmpl | |||
@@ -1,6 +1,6 @@ | |||
1 | <?xml version="1.0"?> | 1 | <?xml version="1.0"?> |
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" | 2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
3 | "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ |
4 | <!ENTITY % media-entities SYSTEM "./media-entities.tmpl"> %media-entities; | 4 | <!ENTITY % media-entities SYSTEM "./media-entities.tmpl"> %media-entities; |
5 | <!ENTITY media-indices SYSTEM "./media-indices.tmpl"> | 5 | <!ENTITY media-indices SYSTEM "./media-indices.tmpl"> |
6 | 6 | ||
diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt index a1ee681942cc..6113f9275f42 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt | |||
@@ -4,7 +4,7 @@ | |||
4 | Required properties : | 4 | Required properties : |
5 | 5 | ||
6 | - reg : Offset and length of the register set for the device | 6 | - reg : Offset and length of the register set for the device |
7 | - compatible : Should be "marvell,mv64xxx-i2c" | 7 | - compatible : Should be "marvell,mv64xxx-i2c" or "allwinner,sun4i-i2c" |
8 | - interrupts : The interrupt number | 8 | - interrupts : The interrupt number |
9 | 9 | ||
10 | Optional properties : | 10 | Optional properties : |
diff --git a/Documentation/devicetree/bindings/regulator/palmas-pmic.txt b/Documentation/devicetree/bindings/regulator/palmas-pmic.txt index d5a308629c57..30b0581bb1ce 100644 --- a/Documentation/devicetree/bindings/regulator/palmas-pmic.txt +++ b/Documentation/devicetree/bindings/regulator/palmas-pmic.txt | |||
@@ -31,9 +31,8 @@ Optional nodes: | |||
31 | Optional sub-node properties: | 31 | Optional sub-node properties: |
32 | ti,warm-reset - maintain voltage during warm reset(boolean) | 32 | ti,warm-reset - maintain voltage during warm reset(boolean) |
33 | ti,roof-floor - control voltage selection by pin(boolean) | 33 | ti,roof-floor - control voltage selection by pin(boolean) |
34 | ti,sleep-mode - mode to adopt in pmic sleep 0 - off, 1 - auto, | 34 | ti,mode-sleep - mode to adopt in pmic sleep 0 - off, 1 - auto, |
35 | 2 - eco, 3 - forced pwm | 35 | 2 - eco, 3 - forced pwm |
36 | ti,tstep - slope control 0 - Jump, 1 10mV/us, 2 5mV/us, 3 2.5mV/us | ||
37 | ti,smps-range - OTP has the wrong range set for the hardware so override | 36 | ti,smps-range - OTP has the wrong range set for the hardware so override |
38 | 0 - low range, 1 - high range. | 37 | 0 - low range, 1 - high range. |
39 | 38 | ||
@@ -59,7 +58,6 @@ pmic { | |||
59 | ti,warm-reset; | 58 | ti,warm-reset; |
60 | ti,roof-floor; | 59 | ti,roof-floor; |
61 | ti,mode-sleep = <0>; | 60 | ti,mode-sleep = <0>; |
62 | ti,tstep = <0>; | ||
63 | ti,smps-range = <1>; | 61 | ti,smps-range = <1>; |
64 | }; | 62 | }; |
65 | 63 | ||
diff --git a/Documentation/sysctl/net.txt b/Documentation/sysctl/net.txt index 1c15043aaee4..d569f2a424d5 100644 --- a/Documentation/sysctl/net.txt +++ b/Documentation/sysctl/net.txt | |||
@@ -52,7 +52,7 @@ Default: 64 | |||
52 | 52 | ||
53 | busy_read | 53 | busy_read |
54 | ---------------- | 54 | ---------------- |
55 | Low latency busy poll timeout for socket reads. (needs CONFIG_NET_LL_RX_POLL) | 55 | Low latency busy poll timeout for socket reads. (needs CONFIG_NET_RX_BUSY_POLL) |
56 | Approximate time in us to busy loop waiting for packets on the device queue. | 56 | Approximate time in us to busy loop waiting for packets on the device queue. |
57 | This sets the default value of the SO_BUSY_POLL socket option. | 57 | This sets the default value of the SO_BUSY_POLL socket option. |
58 | Can be set or overridden per socket by setting socket option SO_BUSY_POLL, | 58 | Can be set or overridden per socket by setting socket option SO_BUSY_POLL, |
@@ -63,7 +63,7 @@ Default: 0 (off) | |||
63 | 63 | ||
64 | busy_poll | 64 | busy_poll |
65 | ---------------- | 65 | ---------------- |
66 | Low latency busy poll timeout for poll and select. (needs CONFIG_NET_LL_RX_POLL) | 66 | Low latency busy poll timeout for poll and select. (needs CONFIG_NET_RX_BUSY_POLL) |
67 | Approximate time in us to busy loop waiting for events. | 67 | Approximate time in us to busy loop waiting for events. |
68 | Recommended value depends on the number of sockets you poll on. | 68 | Recommended value depends on the number of sockets you poll on. |
69 | For several sockets 50, for several hundreds 100. | 69 | For several sockets 50, for several hundreds 100. |
diff --git a/MAINTAINERS b/MAINTAINERS index a26b10e52aea..7cacc88dc79c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -965,6 +965,12 @@ M: Lennert Buytenhek <kernel@wantstofly.org> | |||
965 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 965 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
966 | S: Maintained | 966 | S: Maintained |
967 | 967 | ||
968 | ARM/TEXAS INSTRUMENT KEYSTONE ARCHITECTURE | ||
969 | M: Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
970 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
971 | S: Maintained | ||
972 | F: arch/arm/mach-keystone/ | ||
973 | |||
968 | ARM/LOGICPD PXA270 MACHINE SUPPORT | 974 | ARM/LOGICPD PXA270 MACHINE SUPPORT |
969 | M: Lennert Buytenhek <kernel@wantstofly.org> | 975 | M: Lennert Buytenhek <kernel@wantstofly.org> |
970 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 976 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
@@ -1259,7 +1265,6 @@ F: drivers/rtc/rtc-coh901331.c | |||
1259 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git | 1265 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git |
1260 | 1266 | ||
1261 | ARM/Ux500 ARM ARCHITECTURE | 1267 | ARM/Ux500 ARM ARCHITECTURE |
1262 | M: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> | ||
1263 | M: Linus Walleij <linus.walleij@linaro.org> | 1268 | M: Linus Walleij <linus.walleij@linaro.org> |
1264 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1269 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1265 | S: Maintained | 1270 | S: Maintained |
@@ -1406,7 +1411,7 @@ ATHEROS ATH6KL WIRELESS DRIVER | |||
1406 | M: Kalle Valo <kvalo@qca.qualcomm.com> | 1411 | M: Kalle Valo <kvalo@qca.qualcomm.com> |
1407 | L: linux-wireless@vger.kernel.org | 1412 | L: linux-wireless@vger.kernel.org |
1408 | W: http://wireless.kernel.org/en/users/Drivers/ath6kl | 1413 | W: http://wireless.kernel.org/en/users/Drivers/ath6kl |
1409 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath6kl.git | 1414 | T: git git://github.com/kvalo/ath.git |
1410 | S: Supported | 1415 | S: Supported |
1411 | F: drivers/net/wireless/ath/ath6kl/ | 1416 | F: drivers/net/wireless/ath/ath6kl/ |
1412 | 1417 | ||
@@ -2871,7 +2876,7 @@ F: drivers/media/usb/dvb-usb-v2/dvb_usb* | |||
2871 | F: drivers/media/usb/dvb-usb-v2/usb_urb.c | 2876 | F: drivers/media/usb/dvb-usb-v2/usb_urb.c |
2872 | 2877 | ||
2873 | DYNAMIC DEBUG | 2878 | DYNAMIC DEBUG |
2874 | M: Jason Baron <jbaron@redhat.com> | 2879 | M: Jason Baron <jbaron@akamai.com> |
2875 | S: Maintained | 2880 | S: Maintained |
2876 | F: lib/dynamic_debug.c | 2881 | F: lib/dynamic_debug.c |
2877 | F: include/linux/dynamic_debug.h | 2882 | F: include/linux/dynamic_debug.h |
@@ -6726,6 +6731,14 @@ T: git git://linuxtv.org/anttip/media_tree.git | |||
6726 | S: Maintained | 6731 | S: Maintained |
6727 | F: drivers/media/tuners/qt1010* | 6732 | F: drivers/media/tuners/qt1010* |
6728 | 6733 | ||
6734 | QUALCOMM ATHEROS ATH10K WIRELESS DRIVER | ||
6735 | M: Kalle Valo <kvalo@qca.qualcomm.com> | ||
6736 | L: ath10k@lists.infradead.org | ||
6737 | W: http://wireless.kernel.org/en/users/Drivers/ath10k | ||
6738 | T: git git://github.com/kvalo/ath.git | ||
6739 | S: Supported | ||
6740 | F: drivers/net/wireless/ath/ath10k/ | ||
6741 | |||
6729 | QUALCOMM HEXAGON ARCHITECTURE | 6742 | QUALCOMM HEXAGON ARCHITECTURE |
6730 | M: Richard Kuo <rkuo@codeaurora.org> | 6743 | M: Richard Kuo <rkuo@codeaurora.org> |
6731 | L: linux-hexagon@vger.kernel.org | 6744 | L: linux-hexagon@vger.kernel.org |
@@ -8270,7 +8283,7 @@ S: Maintained | |||
8270 | F: sound/soc/codecs/twl4030* | 8283 | F: sound/soc/codecs/twl4030* |
8271 | 8284 | ||
8272 | TI WILINK WIRELESS DRIVERS | 8285 | TI WILINK WIRELESS DRIVERS |
8273 | M: Luciano Coelho <coelho@ti.com> | 8286 | M: Luciano Coelho <luca@coelho.fi> |
8274 | L: linux-wireless@vger.kernel.org | 8287 | L: linux-wireless@vger.kernel.org |
8275 | W: http://wireless.kernel.org/en/users/Drivers/wl12xx | 8288 | W: http://wireless.kernel.org/en/users/Drivers/wl12xx |
8276 | W: http://wireless.kernel.org/en/users/Drivers/wl1251 | 8289 | W: http://wireless.kernel.org/en/users/Drivers/wl1251 |
@@ -8656,6 +8669,11 @@ T: git git://git.alsa-project.org/alsa-kernel.git | |||
8656 | S: Maintained | 8669 | S: Maintained |
8657 | F: sound/usb/midi.* | 8670 | F: sound/usb/midi.* |
8658 | 8671 | ||
8672 | USB NETWORKING DRIVERS | ||
8673 | L: linux-usb@vger.kernel.org | ||
8674 | S: Odd Fixes | ||
8675 | F: drivers/net/usb/ | ||
8676 | |||
8659 | USB OHCI DRIVER | 8677 | USB OHCI DRIVER |
8660 | M: Alan Stern <stern@rowland.harvard.edu> | 8678 | M: Alan Stern <stern@rowland.harvard.edu> |
8661 | L: linux-usb@vger.kernel.org | 8679 | L: linux-usb@vger.kernel.org |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 11 | 2 | PATCHLEVEL = 11 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc3 | 4 | EXTRAVERSION = -rc4 |
5 | NAME = Linux for Workgroups | 5 | NAME = Linux for Workgroups |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 37c0f4e978d4..43594d5116ef 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -20,7 +20,6 @@ config ARM | |||
20 | select GENERIC_STRNCPY_FROM_USER | 20 | select GENERIC_STRNCPY_FROM_USER |
21 | select GENERIC_STRNLEN_USER | 21 | select GENERIC_STRNLEN_USER |
22 | select HARDIRQS_SW_RESEND | 22 | select HARDIRQS_SW_RESEND |
23 | select HAVE_AOUT | ||
24 | select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL | 23 | select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL |
25 | select HAVE_ARCH_KGDB | 24 | select HAVE_ARCH_KGDB |
26 | select HAVE_ARCH_SECCOMP_FILTER | 25 | select HAVE_ARCH_SECCOMP_FILTER |
@@ -218,7 +217,8 @@ config VECTORS_BASE | |||
218 | default DRAM_BASE if REMAP_VECTORS_TO_RAM | 217 | default DRAM_BASE if REMAP_VECTORS_TO_RAM |
219 | default 0x00000000 | 218 | default 0x00000000 |
220 | help | 219 | help |
221 | The base address of exception vectors. | 220 | The base address of exception vectors. This must be two pages |
221 | in size. | ||
222 | 222 | ||
223 | config ARM_PATCH_PHYS_VIRT | 223 | config ARM_PATCH_PHYS_VIRT |
224 | bool "Patch physical to virtual translations at runtime" if EMBEDDED | 224 | bool "Patch physical to virtual translations at runtime" if EMBEDDED |
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index e401a766c0bd..583f4a00ec32 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug | |||
@@ -804,9 +804,19 @@ config DEBUG_LL_INCLUDE | |||
804 | 804 | ||
805 | config DEBUG_UNCOMPRESS | 805 | config DEBUG_UNCOMPRESS |
806 | bool | 806 | bool |
807 | default y if ARCH_MULTIPLATFORM && DEBUG_LL && \ | 807 | depends on ARCH_MULTIPLATFORM |
808 | !DEBUG_OMAP2PLUS_UART && \ | 808 | default y if DEBUG_LL && !DEBUG_OMAP2PLUS_UART && \ |
809 | !DEBUG_TEGRA_UART | 809 | !DEBUG_TEGRA_UART |
810 | help | ||
811 | This option influences the normal decompressor output for | ||
812 | multiplatform kernels. Normally, multiplatform kernels disable | ||
813 | decompressor output because it is not possible to know where to | ||
814 | send the decompressor output. | ||
815 | |||
816 | When this option is set, the selected DEBUG_LL output method | ||
817 | will be re-used for normal decompressor output on multiplatform | ||
818 | kernels. | ||
819 | |||
810 | 820 | ||
811 | config UNCOMPRESS_INCLUDE | 821 | config UNCOMPRESS_INCLUDE |
812 | string | 822 | string |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index c0ac0f5e5e5c..6fd2ceae305a 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -153,6 +153,7 @@ machine-$(CONFIG_ARCH_DAVINCI) += davinci | |||
153 | machine-$(CONFIG_ARCH_DOVE) += dove | 153 | machine-$(CONFIG_ARCH_DOVE) += dove |
154 | machine-$(CONFIG_ARCH_EBSA110) += ebsa110 | 154 | machine-$(CONFIG_ARCH_EBSA110) += ebsa110 |
155 | machine-$(CONFIG_ARCH_EP93XX) += ep93xx | 155 | machine-$(CONFIG_ARCH_EP93XX) += ep93xx |
156 | machine-$(CONFIG_ARCH_EXYNOS) += exynos | ||
156 | machine-$(CONFIG_ARCH_GEMINI) += gemini | 157 | machine-$(CONFIG_ARCH_GEMINI) += gemini |
157 | machine-$(CONFIG_ARCH_HIGHBANK) += highbank | 158 | machine-$(CONFIG_ARCH_HIGHBANK) += highbank |
158 | machine-$(CONFIG_ARCH_INTEGRATOR) += integrator | 159 | machine-$(CONFIG_ARCH_INTEGRATOR) += integrator |
@@ -160,15 +161,16 @@ machine-$(CONFIG_ARCH_IOP13XX) += iop13xx | |||
160 | machine-$(CONFIG_ARCH_IOP32X) += iop32x | 161 | machine-$(CONFIG_ARCH_IOP32X) += iop32x |
161 | machine-$(CONFIG_ARCH_IOP33X) += iop33x | 162 | machine-$(CONFIG_ARCH_IOP33X) += iop33x |
162 | machine-$(CONFIG_ARCH_IXP4XX) += ixp4xx | 163 | machine-$(CONFIG_ARCH_IXP4XX) += ixp4xx |
164 | machine-$(CONFIG_ARCH_KEYSTONE) += keystone | ||
163 | machine-$(CONFIG_ARCH_KIRKWOOD) += kirkwood | 165 | machine-$(CONFIG_ARCH_KIRKWOOD) += kirkwood |
164 | machine-$(CONFIG_ARCH_KS8695) += ks8695 | 166 | machine-$(CONFIG_ARCH_KS8695) += ks8695 |
165 | machine-$(CONFIG_ARCH_LPC32XX) += lpc32xx | 167 | machine-$(CONFIG_ARCH_LPC32XX) += lpc32xx |
166 | machine-$(CONFIG_ARCH_MMP) += mmp | 168 | machine-$(CONFIG_ARCH_MMP) += mmp |
167 | machine-$(CONFIG_ARCH_MSM) += msm | 169 | machine-$(CONFIG_ARCH_MSM) += msm |
168 | machine-$(CONFIG_ARCH_MV78XX0) += mv78xx0 | 170 | machine-$(CONFIG_ARCH_MV78XX0) += mv78xx0 |
171 | machine-$(CONFIG_ARCH_MVEBU) += mvebu | ||
169 | machine-$(CONFIG_ARCH_MXC) += imx | 172 | machine-$(CONFIG_ARCH_MXC) += imx |
170 | machine-$(CONFIG_ARCH_MXS) += mxs | 173 | machine-$(CONFIG_ARCH_MXS) += mxs |
171 | machine-$(CONFIG_ARCH_MVEBU) += mvebu | ||
172 | machine-$(CONFIG_ARCH_NETX) += netx | 174 | machine-$(CONFIG_ARCH_NETX) += netx |
173 | machine-$(CONFIG_ARCH_NOMADIK) += nomadik | 175 | machine-$(CONFIG_ARCH_NOMADIK) += nomadik |
174 | machine-$(CONFIG_ARCH_NSPIRE) += nspire | 176 | machine-$(CONFIG_ARCH_NSPIRE) += nspire |
@@ -176,7 +178,6 @@ machine-$(CONFIG_ARCH_OMAP1) += omap1 | |||
176 | machine-$(CONFIG_ARCH_OMAP2PLUS) += omap2 | 178 | machine-$(CONFIG_ARCH_OMAP2PLUS) += omap2 |
177 | machine-$(CONFIG_ARCH_ORION5X) += orion5x | 179 | machine-$(CONFIG_ARCH_ORION5X) += orion5x |
178 | machine-$(CONFIG_ARCH_PICOXCELL) += picoxcell | 180 | machine-$(CONFIG_ARCH_PICOXCELL) += picoxcell |
179 | machine-$(CONFIG_ARCH_SIRF) += prima2 | ||
180 | machine-$(CONFIG_ARCH_PXA) += pxa | 181 | machine-$(CONFIG_ARCH_PXA) += pxa |
181 | machine-$(CONFIG_ARCH_REALVIEW) += realview | 182 | machine-$(CONFIG_ARCH_REALVIEW) += realview |
182 | machine-$(CONFIG_ARCH_ROCKCHIP) += rockchip | 183 | machine-$(CONFIG_ARCH_ROCKCHIP) += rockchip |
@@ -186,25 +187,24 @@ machine-$(CONFIG_ARCH_S3C64XX) += s3c64xx | |||
186 | machine-$(CONFIG_ARCH_S5P64X0) += s5p64x0 | 187 | machine-$(CONFIG_ARCH_S5P64X0) += s5p64x0 |
187 | machine-$(CONFIG_ARCH_S5PC100) += s5pc100 | 188 | machine-$(CONFIG_ARCH_S5PC100) += s5pc100 |
188 | machine-$(CONFIG_ARCH_S5PV210) += s5pv210 | 189 | machine-$(CONFIG_ARCH_S5PV210) += s5pv210 |
189 | machine-$(CONFIG_ARCH_EXYNOS) += exynos | ||
190 | machine-$(CONFIG_ARCH_SA1100) += sa1100 | 190 | machine-$(CONFIG_ARCH_SA1100) += sa1100 |
191 | machine-$(CONFIG_ARCH_SHARK) += shark | 191 | machine-$(CONFIG_ARCH_SHARK) += shark |
192 | machine-$(CONFIG_ARCH_SHMOBILE) += shmobile | 192 | machine-$(CONFIG_ARCH_SHMOBILE) += shmobile |
193 | machine-$(CONFIG_ARCH_SIRF) += prima2 | ||
194 | machine-$(CONFIG_ARCH_SOCFPGA) += socfpga | ||
195 | machine-$(CONFIG_ARCH_STI) += sti | ||
196 | machine-$(CONFIG_ARCH_SUNXI) += sunxi | ||
193 | machine-$(CONFIG_ARCH_TEGRA) += tegra | 197 | machine-$(CONFIG_ARCH_TEGRA) += tegra |
194 | machine-$(CONFIG_ARCH_U300) += u300 | 198 | machine-$(CONFIG_ARCH_U300) += u300 |
195 | machine-$(CONFIG_ARCH_U8500) += ux500 | 199 | machine-$(CONFIG_ARCH_U8500) += ux500 |
196 | machine-$(CONFIG_ARCH_VERSATILE) += versatile | 200 | machine-$(CONFIG_ARCH_VERSATILE) += versatile |
197 | machine-$(CONFIG_ARCH_VEXPRESS) += vexpress | 201 | machine-$(CONFIG_ARCH_VEXPRESS) += vexpress |
202 | machine-$(CONFIG_ARCH_VIRT) += virt | ||
198 | machine-$(CONFIG_ARCH_VT8500) += vt8500 | 203 | machine-$(CONFIG_ARCH_VT8500) += vt8500 |
199 | machine-$(CONFIG_ARCH_W90X900) += w90x900 | 204 | machine-$(CONFIG_ARCH_W90X900) += w90x900 |
205 | machine-$(CONFIG_ARCH_ZYNQ) += zynq | ||
200 | machine-$(CONFIG_FOOTBRIDGE) += footbridge | 206 | machine-$(CONFIG_FOOTBRIDGE) += footbridge |
201 | machine-$(CONFIG_ARCH_SOCFPGA) += socfpga | ||
202 | machine-$(CONFIG_PLAT_SPEAR) += spear | 207 | machine-$(CONFIG_PLAT_SPEAR) += spear |
203 | machine-$(CONFIG_ARCH_STI) += sti | ||
204 | machine-$(CONFIG_ARCH_VIRT) += virt | ||
205 | machine-$(CONFIG_ARCH_ZYNQ) += zynq | ||
206 | machine-$(CONFIG_ARCH_SUNXI) += sunxi | ||
207 | machine-$(CONFIG_ARCH_KEYSTONE) += keystone | ||
208 | 208 | ||
209 | # Platform directory name. This list is sorted alphanumerically | 209 | # Platform directory name. This list is sorted alphanumerically |
210 | # by CONFIG_* macro name. | 210 | # by CONFIG_* macro name. |
diff --git a/arch/arm/boot/dts/msm8960-cdp.dts b/arch/arm/boot/dts/msm8960-cdp.dts index db2060c46540..9c1167b0459b 100644 --- a/arch/arm/boot/dts/msm8960-cdp.dts +++ b/arch/arm/boot/dts/msm8960-cdp.dts | |||
@@ -26,7 +26,7 @@ | |||
26 | cpu-offset = <0x80000>; | 26 | cpu-offset = <0x80000>; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | msmgpio: gpio@fd510000 { | 29 | msmgpio: gpio@800000 { |
30 | compatible = "qcom,msm-gpio"; | 30 | compatible = "qcom,msm-gpio"; |
31 | gpio-controller; | 31 | gpio-controller; |
32 | #gpio-cells = <2>; | 32 | #gpio-cells = <2>; |
@@ -34,7 +34,7 @@ | |||
34 | interrupts = <0 32 0x4>; | 34 | interrupts = <0 32 0x4>; |
35 | interrupt-controller; | 35 | interrupt-controller; |
36 | #interrupt-cells = <2>; | 36 | #interrupt-cells = <2>; |
37 | reg = <0xfd510000 0x4000>; | 37 | reg = <0x800000 0x4000>; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | serial@16440000 { | 40 | serial@16440000 { |
diff --git a/arch/arm/boot/dts/omap5-uevm.dts b/arch/arm/boot/dts/omap5-uevm.dts index 08b72678abff..65d7b601651c 100644 --- a/arch/arm/boot/dts/omap5-uevm.dts +++ b/arch/arm/boot/dts/omap5-uevm.dts | |||
@@ -235,7 +235,7 @@ | |||
235 | }; | 235 | }; |
236 | 236 | ||
237 | &mmc1 { | 237 | &mmc1 { |
238 | vmmc-supply = <&vmmcsd_fixed>; | 238 | vmmc-supply = <&ldo9_reg>; |
239 | bus-width = <4>; | 239 | bus-width = <4>; |
240 | }; | 240 | }; |
241 | 241 | ||
@@ -282,6 +282,7 @@ | |||
282 | 282 | ||
283 | regulators { | 283 | regulators { |
284 | smps123_reg: smps123 { | 284 | smps123_reg: smps123 { |
285 | /* VDD_OPP_MPU */ | ||
285 | regulator-name = "smps123"; | 286 | regulator-name = "smps123"; |
286 | regulator-min-microvolt = < 600000>; | 287 | regulator-min-microvolt = < 600000>; |
287 | regulator-max-microvolt = <1500000>; | 288 | regulator-max-microvolt = <1500000>; |
@@ -290,6 +291,7 @@ | |||
290 | }; | 291 | }; |
291 | 292 | ||
292 | smps45_reg: smps45 { | 293 | smps45_reg: smps45 { |
294 | /* VDD_OPP_MM */ | ||
293 | regulator-name = "smps45"; | 295 | regulator-name = "smps45"; |
294 | regulator-min-microvolt = < 600000>; | 296 | regulator-min-microvolt = < 600000>; |
295 | regulator-max-microvolt = <1310000>; | 297 | regulator-max-microvolt = <1310000>; |
@@ -298,6 +300,7 @@ | |||
298 | }; | 300 | }; |
299 | 301 | ||
300 | smps6_reg: smps6 { | 302 | smps6_reg: smps6 { |
303 | /* VDD_DDR3 - over VDD_SMPS6 */ | ||
301 | regulator-name = "smps6"; | 304 | regulator-name = "smps6"; |
302 | regulator-min-microvolt = <1200000>; | 305 | regulator-min-microvolt = <1200000>; |
303 | regulator-max-microvolt = <1200000>; | 306 | regulator-max-microvolt = <1200000>; |
@@ -306,6 +309,7 @@ | |||
306 | }; | 309 | }; |
307 | 310 | ||
308 | smps7_reg: smps7 { | 311 | smps7_reg: smps7 { |
312 | /* VDDS_1v8_OMAP over VDDS_1v8_MAIN */ | ||
309 | regulator-name = "smps7"; | 313 | regulator-name = "smps7"; |
310 | regulator-min-microvolt = <1800000>; | 314 | regulator-min-microvolt = <1800000>; |
311 | regulator-max-microvolt = <1800000>; | 315 | regulator-max-microvolt = <1800000>; |
@@ -314,6 +318,7 @@ | |||
314 | }; | 318 | }; |
315 | 319 | ||
316 | smps8_reg: smps8 { | 320 | smps8_reg: smps8 { |
321 | /* VDD_OPP_CORE */ | ||
317 | regulator-name = "smps8"; | 322 | regulator-name = "smps8"; |
318 | regulator-min-microvolt = < 600000>; | 323 | regulator-min-microvolt = < 600000>; |
319 | regulator-max-microvolt = <1310000>; | 324 | regulator-max-microvolt = <1310000>; |
@@ -322,15 +327,15 @@ | |||
322 | }; | 327 | }; |
323 | 328 | ||
324 | smps9_reg: smps9 { | 329 | smps9_reg: smps9 { |
330 | /* VDDA_2v1_AUD over VDD_2v1 */ | ||
325 | regulator-name = "smps9"; | 331 | regulator-name = "smps9"; |
326 | regulator-min-microvolt = <2100000>; | 332 | regulator-min-microvolt = <2100000>; |
327 | regulator-max-microvolt = <2100000>; | 333 | regulator-max-microvolt = <2100000>; |
328 | regulator-always-on; | ||
329 | regulator-boot-on; | ||
330 | ti,smps-range = <0x80>; | 334 | ti,smps-range = <0x80>; |
331 | }; | 335 | }; |
332 | 336 | ||
333 | smps10_reg: smps10 { | 337 | smps10_reg: smps10 { |
338 | /* VBUS_5V_OTG */ | ||
334 | regulator-name = "smps10"; | 339 | regulator-name = "smps10"; |
335 | regulator-min-microvolt = <5000000>; | 340 | regulator-min-microvolt = <5000000>; |
336 | regulator-max-microvolt = <5000000>; | 341 | regulator-max-microvolt = <5000000>; |
@@ -339,38 +344,40 @@ | |||
339 | }; | 344 | }; |
340 | 345 | ||
341 | ldo1_reg: ldo1 { | 346 | ldo1_reg: ldo1 { |
347 | /* VDDAPHY_CAM: vdda_csiport */ | ||
342 | regulator-name = "ldo1"; | 348 | regulator-name = "ldo1"; |
343 | regulator-min-microvolt = <2800000>; | 349 | regulator-min-microvolt = <1500000>; |
344 | regulator-max-microvolt = <2800000>; | 350 | regulator-max-microvolt = <1800000>; |
345 | regulator-always-on; | ||
346 | regulator-boot-on; | ||
347 | }; | 351 | }; |
348 | 352 | ||
349 | ldo2_reg: ldo2 { | 353 | ldo2_reg: ldo2 { |
354 | /* VCC_2V8_DISP: Does not go anywhere */ | ||
350 | regulator-name = "ldo2"; | 355 | regulator-name = "ldo2"; |
351 | regulator-min-microvolt = <2900000>; | 356 | regulator-min-microvolt = <2800000>; |
352 | regulator-max-microvolt = <2900000>; | 357 | regulator-max-microvolt = <2800000>; |
353 | regulator-always-on; | 358 | /* Unused */ |
354 | regulator-boot-on; | 359 | status = "disabled"; |
355 | }; | 360 | }; |
356 | 361 | ||
357 | ldo3_reg: ldo3 { | 362 | ldo3_reg: ldo3 { |
363 | /* VDDAPHY_MDM: vdda_lli */ | ||
358 | regulator-name = "ldo3"; | 364 | regulator-name = "ldo3"; |
359 | regulator-min-microvolt = <3000000>; | 365 | regulator-min-microvolt = <1500000>; |
360 | regulator-max-microvolt = <3000000>; | 366 | regulator-max-microvolt = <1500000>; |
361 | regulator-always-on; | ||
362 | regulator-boot-on; | 367 | regulator-boot-on; |
368 | /* Only if Modem is used */ | ||
369 | status = "disabled"; | ||
363 | }; | 370 | }; |
364 | 371 | ||
365 | ldo4_reg: ldo4 { | 372 | ldo4_reg: ldo4 { |
373 | /* VDDAPHY_DISP: vdda_dsiport/hdmi */ | ||
366 | regulator-name = "ldo4"; | 374 | regulator-name = "ldo4"; |
367 | regulator-min-microvolt = <2200000>; | 375 | regulator-min-microvolt = <1500000>; |
368 | regulator-max-microvolt = <2200000>; | 376 | regulator-max-microvolt = <1800000>; |
369 | regulator-always-on; | ||
370 | regulator-boot-on; | ||
371 | }; | 377 | }; |
372 | 378 | ||
373 | ldo5_reg: ldo5 { | 379 | ldo5_reg: ldo5 { |
380 | /* VDDA_1V8_PHY: usb/sata/hdmi.. */ | ||
374 | regulator-name = "ldo5"; | 381 | regulator-name = "ldo5"; |
375 | regulator-min-microvolt = <1800000>; | 382 | regulator-min-microvolt = <1800000>; |
376 | regulator-max-microvolt = <1800000>; | 383 | regulator-max-microvolt = <1800000>; |
@@ -379,38 +386,43 @@ | |||
379 | }; | 386 | }; |
380 | 387 | ||
381 | ldo6_reg: ldo6 { | 388 | ldo6_reg: ldo6 { |
389 | /* VDDS_1V2_WKUP: hsic/ldo_emu_wkup */ | ||
382 | regulator-name = "ldo6"; | 390 | regulator-name = "ldo6"; |
383 | regulator-min-microvolt = <1500000>; | 391 | regulator-min-microvolt = <1200000>; |
384 | regulator-max-microvolt = <1500000>; | 392 | regulator-max-microvolt = <1200000>; |
385 | regulator-always-on; | 393 | regulator-always-on; |
386 | regulator-boot-on; | 394 | regulator-boot-on; |
387 | }; | 395 | }; |
388 | 396 | ||
389 | ldo7_reg: ldo7 { | 397 | ldo7_reg: ldo7 { |
398 | /* VDD_VPP: vpp1 */ | ||
390 | regulator-name = "ldo7"; | 399 | regulator-name = "ldo7"; |
391 | regulator-min-microvolt = <1500000>; | 400 | regulator-min-microvolt = <2000000>; |
392 | regulator-max-microvolt = <1500000>; | 401 | regulator-max-microvolt = <2000000>; |
393 | regulator-always-on; | 402 | /* Only for efuse reprograming! */ |
394 | regulator-boot-on; | 403 | status = "disabled"; |
395 | }; | 404 | }; |
396 | 405 | ||
397 | ldo8_reg: ldo8 { | 406 | ldo8_reg: ldo8 { |
407 | /* VDD_3v0: Does not go anywhere */ | ||
398 | regulator-name = "ldo8"; | 408 | regulator-name = "ldo8"; |
399 | regulator-min-microvolt = <1500000>; | 409 | regulator-min-microvolt = <3000000>; |
400 | regulator-max-microvolt = <1500000>; | 410 | regulator-max-microvolt = <3000000>; |
401 | regulator-always-on; | ||
402 | regulator-boot-on; | 411 | regulator-boot-on; |
412 | /* Unused */ | ||
413 | status = "disabled"; | ||
403 | }; | 414 | }; |
404 | 415 | ||
405 | ldo9_reg: ldo9 { | 416 | ldo9_reg: ldo9 { |
417 | /* VCC_DV_SDIO: vdds_sdcard */ | ||
406 | regulator-name = "ldo9"; | 418 | regulator-name = "ldo9"; |
407 | regulator-min-microvolt = <1800000>; | 419 | regulator-min-microvolt = <1800000>; |
408 | regulator-max-microvolt = <3300000>; | 420 | regulator-max-microvolt = <3000000>; |
409 | regulator-always-on; | ||
410 | regulator-boot-on; | 421 | regulator-boot-on; |
411 | }; | 422 | }; |
412 | 423 | ||
413 | ldoln_reg: ldoln { | 424 | ldoln_reg: ldoln { |
425 | /* VDDA_1v8_REF: vdds_osc/mm_l4per.. */ | ||
414 | regulator-name = "ldoln"; | 426 | regulator-name = "ldoln"; |
415 | regulator-min-microvolt = <1800000>; | 427 | regulator-min-microvolt = <1800000>; |
416 | regulator-max-microvolt = <1800000>; | 428 | regulator-max-microvolt = <1800000>; |
@@ -419,12 +431,20 @@ | |||
419 | }; | 431 | }; |
420 | 432 | ||
421 | ldousb_reg: ldousb { | 433 | ldousb_reg: ldousb { |
434 | /* VDDA_3V_USB: VDDA_USBHS33 */ | ||
422 | regulator-name = "ldousb"; | 435 | regulator-name = "ldousb"; |
423 | regulator-min-microvolt = <3250000>; | 436 | regulator-min-microvolt = <3250000>; |
424 | regulator-max-microvolt = <3250000>; | 437 | regulator-max-microvolt = <3250000>; |
425 | regulator-always-on; | 438 | regulator-always-on; |
426 | regulator-boot-on; | 439 | regulator-boot-on; |
427 | }; | 440 | }; |
441 | |||
442 | regen3_reg: regen3 { | ||
443 | /* REGEN3 controls LDO9 supply to card */ | ||
444 | regulator-name = "regen3"; | ||
445 | regulator-always-on; | ||
446 | regulator-boot-on; | ||
447 | }; | ||
428 | }; | 448 | }; |
429 | }; | 449 | }; |
430 | }; | 450 | }; |
diff --git a/arch/arm/boot/dts/stih41x.dtsi b/arch/arm/boot/dts/stih41x.dtsi index 7321403cab8a..f5b9898d9c6e 100644 --- a/arch/arm/boot/dts/stih41x.dtsi +++ b/arch/arm/boot/dts/stih41x.dtsi | |||
@@ -6,10 +6,12 @@ | |||
6 | #address-cells = <1>; | 6 | #address-cells = <1>; |
7 | #size-cells = <0>; | 7 | #size-cells = <0>; |
8 | cpu@0 { | 8 | cpu@0 { |
9 | device_type = "cpu"; | ||
9 | compatible = "arm,cortex-a9"; | 10 | compatible = "arm,cortex-a9"; |
10 | reg = <0>; | 11 | reg = <0>; |
11 | }; | 12 | }; |
12 | cpu@1 { | 13 | cpu@1 { |
14 | device_type = "cpu"; | ||
13 | compatible = "arm,cortex-a9"; | 15 | compatible = "arm,cortex-a9"; |
14 | reg = <1>; | 16 | reg = <1>; |
15 | }; | 17 | }; |
diff --git a/arch/arm/boot/dts/tegra20-colibri-512.dtsi b/arch/arm/boot/dts/tegra20-colibri-512.dtsi index 2fcb3f2ca160..5592be6f2f7a 100644 --- a/arch/arm/boot/dts/tegra20-colibri-512.dtsi +++ b/arch/arm/boot/dts/tegra20-colibri-512.dtsi | |||
@@ -457,6 +457,7 @@ | |||
457 | }; | 457 | }; |
458 | 458 | ||
459 | usb-phy@c5004000 { | 459 | usb-phy@c5004000 { |
460 | status = "okay"; | ||
460 | nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1) | 461 | nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1) |
461 | GPIO_ACTIVE_LOW>; | 462 | GPIO_ACTIVE_LOW>; |
462 | }; | 463 | }; |
diff --git a/arch/arm/include/asm/a.out-core.h b/arch/arm/include/asm/a.out-core.h deleted file mode 100644 index 92f10cb5c70c..000000000000 --- a/arch/arm/include/asm/a.out-core.h +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | /* a.out coredump register dumper | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_A_OUT_CORE_H | ||
13 | #define _ASM_A_OUT_CORE_H | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | #include <linux/user.h> | ||
18 | #include <linux/elfcore.h> | ||
19 | |||
20 | /* | ||
21 | * fill in the user structure for an a.out core dump | ||
22 | */ | ||
23 | static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump) | ||
24 | { | ||
25 | struct task_struct *tsk = current; | ||
26 | |||
27 | dump->magic = CMAGIC; | ||
28 | dump->start_code = tsk->mm->start_code; | ||
29 | dump->start_stack = regs->ARM_sp & ~(PAGE_SIZE - 1); | ||
30 | |||
31 | dump->u_tsize = (tsk->mm->end_code - tsk->mm->start_code) >> PAGE_SHIFT; | ||
32 | dump->u_dsize = (tsk->mm->brk - tsk->mm->start_data + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
33 | dump->u_ssize = 0; | ||
34 | |||
35 | memset(dump->u_debugreg, 0, sizeof(dump->u_debugreg)); | ||
36 | |||
37 | if (dump->start_stack < 0x04000000) | ||
38 | dump->u_ssize = (0x04000000 - dump->start_stack) >> PAGE_SHIFT; | ||
39 | |||
40 | dump->regs = *regs; | ||
41 | dump->u_fpvalid = dump_fpu (regs, &dump->u_fp); | ||
42 | } | ||
43 | |||
44 | #endif /* __KERNEL__ */ | ||
45 | #endif /* _ASM_A_OUT_CORE_H */ | ||
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h index 8c25dc4e9851..9672e978d50d 100644 --- a/arch/arm/include/asm/cputype.h +++ b/arch/arm/include/asm/cputype.h | |||
@@ -89,13 +89,18 @@ extern unsigned int processor_id; | |||
89 | __val; \ | 89 | __val; \ |
90 | }) | 90 | }) |
91 | 91 | ||
92 | /* | ||
93 | * The memory clobber prevents gcc 4.5 from reordering the mrc before | ||
94 | * any is_smp() tests, which can cause undefined instruction aborts on | ||
95 | * ARM1136 r0 due to the missing extended CP15 registers. | ||
96 | */ | ||
92 | #define read_cpuid_ext(ext_reg) \ | 97 | #define read_cpuid_ext(ext_reg) \ |
93 | ({ \ | 98 | ({ \ |
94 | unsigned int __val; \ | 99 | unsigned int __val; \ |
95 | asm("mrc p15, 0, %0, c0, " ext_reg \ | 100 | asm("mrc p15, 0, %0, c0, " ext_reg \ |
96 | : "=r" (__val) \ | 101 | : "=r" (__val) \ |
97 | : \ | 102 | : \ |
98 | : "cc"); \ | 103 | : "memory"); \ |
99 | __val; \ | 104 | __val; \ |
100 | }) | 105 | }) |
101 | 106 | ||
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index 38050b1c4800..56211f2084ef 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h | |||
@@ -130,4 +130,10 @@ struct mm_struct; | |||
130 | extern unsigned long arch_randomize_brk(struct mm_struct *mm); | 130 | extern unsigned long arch_randomize_brk(struct mm_struct *mm); |
131 | #define arch_randomize_brk arch_randomize_brk | 131 | #define arch_randomize_brk arch_randomize_brk |
132 | 132 | ||
133 | #ifdef CONFIG_MMU | ||
134 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 | ||
135 | struct linux_binprm; | ||
136 | int arch_setup_additional_pages(struct linux_binprm *, int); | ||
137 | #endif | ||
138 | |||
133 | #endif | 139 | #endif |
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h index e3d55547e755..6f18da09668b 100644 --- a/arch/arm/include/asm/mmu.h +++ b/arch/arm/include/asm/mmu.h | |||
@@ -6,8 +6,11 @@ | |||
6 | typedef struct { | 6 | typedef struct { |
7 | #ifdef CONFIG_CPU_HAS_ASID | 7 | #ifdef CONFIG_CPU_HAS_ASID |
8 | atomic64_t id; | 8 | atomic64_t id; |
9 | #else | ||
10 | int switch_pending; | ||
9 | #endif | 11 | #endif |
10 | unsigned int vmalloc_seq; | 12 | unsigned int vmalloc_seq; |
13 | unsigned long sigpage; | ||
11 | } mm_context_t; | 14 | } mm_context_t; |
12 | 15 | ||
13 | #ifdef CONFIG_CPU_HAS_ASID | 16 | #ifdef CONFIG_CPU_HAS_ASID |
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h index b5792b7fd8d3..9b32f76bb0dd 100644 --- a/arch/arm/include/asm/mmu_context.h +++ b/arch/arm/include/asm/mmu_context.h | |||
@@ -56,7 +56,7 @@ static inline void check_and_switch_context(struct mm_struct *mm, | |||
56 | * on non-ASID CPUs, the old mm will remain valid until the | 56 | * on non-ASID CPUs, the old mm will remain valid until the |
57 | * finish_arch_post_lock_switch() call. | 57 | * finish_arch_post_lock_switch() call. |
58 | */ | 58 | */ |
59 | set_ti_thread_flag(task_thread_info(tsk), TIF_SWITCH_MM); | 59 | mm->context.switch_pending = 1; |
60 | else | 60 | else |
61 | cpu_switch_mm(mm->pgd, mm); | 61 | cpu_switch_mm(mm->pgd, mm); |
62 | } | 62 | } |
@@ -65,9 +65,21 @@ static inline void check_and_switch_context(struct mm_struct *mm, | |||
65 | finish_arch_post_lock_switch | 65 | finish_arch_post_lock_switch |
66 | static inline void finish_arch_post_lock_switch(void) | 66 | static inline void finish_arch_post_lock_switch(void) |
67 | { | 67 | { |
68 | if (test_and_clear_thread_flag(TIF_SWITCH_MM)) { | 68 | struct mm_struct *mm = current->mm; |
69 | struct mm_struct *mm = current->mm; | 69 | |
70 | cpu_switch_mm(mm->pgd, mm); | 70 | if (mm && mm->context.switch_pending) { |
71 | /* | ||
72 | * Preemption must be disabled during cpu_switch_mm() as we | ||
73 | * have some stateful cache flush implementations. Check | ||
74 | * switch_pending again in case we were preempted and the | ||
75 | * switch to this mm was already done. | ||
76 | */ | ||
77 | preempt_disable(); | ||
78 | if (mm->context.switch_pending) { | ||
79 | mm->context.switch_pending = 0; | ||
80 | cpu_switch_mm(mm->pgd, mm); | ||
81 | } | ||
82 | preempt_enable_no_resched(); | ||
71 | } | 83 | } |
72 | } | 84 | } |
73 | 85 | ||
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h index 6363f3d1d505..4355f0ec44d6 100644 --- a/arch/arm/include/asm/page.h +++ b/arch/arm/include/asm/page.h | |||
@@ -142,7 +142,9 @@ extern void __cpu_copy_user_highpage(struct page *to, struct page *from, | |||
142 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) | 142 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) |
143 | extern void copy_page(void *to, const void *from); | 143 | extern void copy_page(void *to, const void *from); |
144 | 144 | ||
145 | #ifdef CONFIG_KUSER_HELPERS | ||
145 | #define __HAVE_ARCH_GATE_AREA 1 | 146 | #define __HAVE_ARCH_GATE_AREA 1 |
147 | #endif | ||
146 | 148 | ||
147 | #ifdef CONFIG_ARM_LPAE | 149 | #ifdef CONFIG_ARM_LPAE |
148 | #include <asm/pgtable-3level-types.h> | 150 | #include <asm/pgtable-3level-types.h> |
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h index 06e7d509eaac..413f3876341c 100644 --- a/arch/arm/include/asm/processor.h +++ b/arch/arm/include/asm/processor.h | |||
@@ -54,7 +54,6 @@ struct thread_struct { | |||
54 | 54 | ||
55 | #define start_thread(regs,pc,sp) \ | 55 | #define start_thread(regs,pc,sp) \ |
56 | ({ \ | 56 | ({ \ |
57 | unsigned long *stack = (unsigned long *)sp; \ | ||
58 | memset(regs->uregs, 0, sizeof(regs->uregs)); \ | 57 | memset(regs->uregs, 0, sizeof(regs->uregs)); \ |
59 | if (current->personality & ADDR_LIMIT_32BIT) \ | 58 | if (current->personality & ADDR_LIMIT_32BIT) \ |
60 | regs->ARM_cpsr = USR_MODE; \ | 59 | regs->ARM_cpsr = USR_MODE; \ |
@@ -65,9 +64,6 @@ struct thread_struct { | |||
65 | regs->ARM_cpsr |= PSR_ENDSTATE; \ | 64 | regs->ARM_cpsr |= PSR_ENDSTATE; \ |
66 | regs->ARM_pc = pc & ~1; /* pc */ \ | 65 | regs->ARM_pc = pc & ~1; /* pc */ \ |
67 | regs->ARM_sp = sp; /* sp */ \ | 66 | regs->ARM_sp = sp; /* sp */ \ |
68 | regs->ARM_r2 = stack[2]; /* r2 (envp) */ \ | ||
69 | regs->ARM_r1 = stack[1]; /* r1 (argv) */ \ | ||
70 | regs->ARM_r0 = stack[0]; /* r0 (argc) */ \ | ||
71 | nommu_start_thread(regs); \ | 67 | nommu_start_thread(regs); \ |
72 | }) | 68 | }) |
73 | 69 | ||
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index 214d4158089a..2b8114fcba09 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h | |||
@@ -156,7 +156,6 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *, | |||
156 | #define TIF_USING_IWMMXT 17 | 156 | #define TIF_USING_IWMMXT 17 |
157 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ | 157 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ |
158 | #define TIF_RESTORE_SIGMASK 20 | 158 | #define TIF_RESTORE_SIGMASK 20 |
159 | #define TIF_SWITCH_MM 22 /* deferred switch_mm */ | ||
160 | 159 | ||
161 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | 160 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
162 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | 161 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) |
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h index fdbb9e369745..f467e9b3f8d5 100644 --- a/arch/arm/include/asm/tlbflush.h +++ b/arch/arm/include/asm/tlbflush.h | |||
@@ -443,7 +443,18 @@ static inline void local_flush_bp_all(void) | |||
443 | isb(); | 443 | isb(); |
444 | } | 444 | } |
445 | 445 | ||
446 | #include <asm/cputype.h> | ||
446 | #ifdef CONFIG_ARM_ERRATA_798181 | 447 | #ifdef CONFIG_ARM_ERRATA_798181 |
448 | static inline int erratum_a15_798181(void) | ||
449 | { | ||
450 | unsigned int midr = read_cpuid_id(); | ||
451 | |||
452 | /* Cortex-A15 r0p0..r3p2 affected */ | ||
453 | if ((midr & 0xff0ffff0) != 0x410fc0f0 || midr > 0x413fc0f2) | ||
454 | return 0; | ||
455 | return 1; | ||
456 | } | ||
457 | |||
447 | static inline void dummy_flush_tlb_a15_erratum(void) | 458 | static inline void dummy_flush_tlb_a15_erratum(void) |
448 | { | 459 | { |
449 | /* | 460 | /* |
@@ -453,6 +464,11 @@ static inline void dummy_flush_tlb_a15_erratum(void) | |||
453 | dsb(); | 464 | dsb(); |
454 | } | 465 | } |
455 | #else | 466 | #else |
467 | static inline int erratum_a15_798181(void) | ||
468 | { | ||
469 | return 0; | ||
470 | } | ||
471 | |||
456 | static inline void dummy_flush_tlb_a15_erratum(void) | 472 | static inline void dummy_flush_tlb_a15_erratum(void) |
457 | { | 473 | { |
458 | } | 474 | } |
diff --git a/arch/arm/include/asm/virt.h b/arch/arm/include/asm/virt.h index 50af92bac737..4371f45c5784 100644 --- a/arch/arm/include/asm/virt.h +++ b/arch/arm/include/asm/virt.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #define BOOT_CPU_MODE_MISMATCH PSR_N_BIT | 29 | #define BOOT_CPU_MODE_MISMATCH PSR_N_BIT |
30 | 30 | ||
31 | #ifndef __ASSEMBLY__ | 31 | #ifndef __ASSEMBLY__ |
32 | #include <asm/cacheflush.h> | ||
32 | 33 | ||
33 | #ifdef CONFIG_ARM_VIRT_EXT | 34 | #ifdef CONFIG_ARM_VIRT_EXT |
34 | /* | 35 | /* |
@@ -41,10 +42,21 @@ | |||
41 | */ | 42 | */ |
42 | extern int __boot_cpu_mode; | 43 | extern int __boot_cpu_mode; |
43 | 44 | ||
45 | static inline void sync_boot_mode(void) | ||
46 | { | ||
47 | /* | ||
48 | * As secondaries write to __boot_cpu_mode with caches disabled, we | ||
49 | * must flush the corresponding cache entries to ensure the visibility | ||
50 | * of their writes. | ||
51 | */ | ||
52 | sync_cache_r(&__boot_cpu_mode); | ||
53 | } | ||
54 | |||
44 | void __hyp_set_vectors(unsigned long phys_vector_base); | 55 | void __hyp_set_vectors(unsigned long phys_vector_base); |
45 | unsigned long __hyp_get_vectors(void); | 56 | unsigned long __hyp_get_vectors(void); |
46 | #else | 57 | #else |
47 | #define __boot_cpu_mode (SVC_MODE) | 58 | #define __boot_cpu_mode (SVC_MODE) |
59 | #define sync_boot_mode() | ||
48 | #endif | 60 | #endif |
49 | 61 | ||
50 | #ifndef ZIMAGE | 62 | #ifndef ZIMAGE |
diff --git a/arch/arm/include/uapi/asm/Kbuild b/arch/arm/include/uapi/asm/Kbuild index 47bcb2d254af..18d76fd5a2af 100644 --- a/arch/arm/include/uapi/asm/Kbuild +++ b/arch/arm/include/uapi/asm/Kbuild | |||
@@ -1,7 +1,6 @@ | |||
1 | # UAPI Header export list | 1 | # UAPI Header export list |
2 | include include/uapi/asm-generic/Kbuild.asm | 2 | include include/uapi/asm-generic/Kbuild.asm |
3 | 3 | ||
4 | header-y += a.out.h | ||
5 | header-y += byteorder.h | 4 | header-y += byteorder.h |
6 | header-y += fcntl.h | 5 | header-y += fcntl.h |
7 | header-y += hwcap.h | 6 | header-y += hwcap.h |
diff --git a/arch/arm/include/uapi/asm/a.out.h b/arch/arm/include/uapi/asm/a.out.h deleted file mode 100644 index 083894b2e3bc..000000000000 --- a/arch/arm/include/uapi/asm/a.out.h +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | #ifndef __ARM_A_OUT_H__ | ||
2 | #define __ARM_A_OUT_H__ | ||
3 | |||
4 | #include <linux/personality.h> | ||
5 | #include <linux/types.h> | ||
6 | |||
7 | struct exec | ||
8 | { | ||
9 | __u32 a_info; /* Use macros N_MAGIC, etc for access */ | ||
10 | __u32 a_text; /* length of text, in bytes */ | ||
11 | __u32 a_data; /* length of data, in bytes */ | ||
12 | __u32 a_bss; /* length of uninitialized data area for file, in bytes */ | ||
13 | __u32 a_syms; /* length of symbol table data in file, in bytes */ | ||
14 | __u32 a_entry; /* start address */ | ||
15 | __u32 a_trsize; /* length of relocation info for text, in bytes */ | ||
16 | __u32 a_drsize; /* length of relocation info for data, in bytes */ | ||
17 | }; | ||
18 | |||
19 | /* | ||
20 | * This is always the same | ||
21 | */ | ||
22 | #define N_TXTADDR(a) (0x00008000) | ||
23 | |||
24 | #define N_TRSIZE(a) ((a).a_trsize) | ||
25 | #define N_DRSIZE(a) ((a).a_drsize) | ||
26 | #define N_SYMSIZE(a) ((a).a_syms) | ||
27 | |||
28 | #define M_ARM 103 | ||
29 | |||
30 | #ifndef LIBRARY_START_TEXT | ||
31 | #define LIBRARY_START_TEXT (0x00c00000) | ||
32 | #endif | ||
33 | |||
34 | #endif /* __A_OUT_GNU_H__ */ | ||
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index a39cfc2a1f90..d40d0ef389db 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S | |||
@@ -742,6 +742,18 @@ ENDPROC(__switch_to) | |||
742 | #endif | 742 | #endif |
743 | .endm | 743 | .endm |
744 | 744 | ||
745 | .macro kuser_pad, sym, size | ||
746 | .if (. - \sym) & 3 | ||
747 | .rept 4 - (. - \sym) & 3 | ||
748 | .byte 0 | ||
749 | .endr | ||
750 | .endif | ||
751 | .rept (\size - (. - \sym)) / 4 | ||
752 | .word 0xe7fddef1 | ||
753 | .endr | ||
754 | .endm | ||
755 | |||
756 | #ifdef CONFIG_KUSER_HELPERS | ||
745 | .align 5 | 757 | .align 5 |
746 | .globl __kuser_helper_start | 758 | .globl __kuser_helper_start |
747 | __kuser_helper_start: | 759 | __kuser_helper_start: |
@@ -832,18 +844,13 @@ kuser_cmpxchg64_fixup: | |||
832 | #error "incoherent kernel configuration" | 844 | #error "incoherent kernel configuration" |
833 | #endif | 845 | #endif |
834 | 846 | ||
835 | /* pad to next slot */ | 847 | kuser_pad __kuser_cmpxchg64, 64 |
836 | .rept (16 - (. - __kuser_cmpxchg64)/4) | ||
837 | .word 0 | ||
838 | .endr | ||
839 | |||
840 | .align 5 | ||
841 | 848 | ||
842 | __kuser_memory_barrier: @ 0xffff0fa0 | 849 | __kuser_memory_barrier: @ 0xffff0fa0 |
843 | smp_dmb arm | 850 | smp_dmb arm |
844 | usr_ret lr | 851 | usr_ret lr |
845 | 852 | ||
846 | .align 5 | 853 | kuser_pad __kuser_memory_barrier, 32 |
847 | 854 | ||
848 | __kuser_cmpxchg: @ 0xffff0fc0 | 855 | __kuser_cmpxchg: @ 0xffff0fc0 |
849 | 856 | ||
@@ -916,13 +923,14 @@ kuser_cmpxchg32_fixup: | |||
916 | 923 | ||
917 | #endif | 924 | #endif |
918 | 925 | ||
919 | .align 5 | 926 | kuser_pad __kuser_cmpxchg, 32 |
920 | 927 | ||
921 | __kuser_get_tls: @ 0xffff0fe0 | 928 | __kuser_get_tls: @ 0xffff0fe0 |
922 | ldr r0, [pc, #(16 - 8)] @ read TLS, set in kuser_get_tls_init | 929 | ldr r0, [pc, #(16 - 8)] @ read TLS, set in kuser_get_tls_init |
923 | usr_ret lr | 930 | usr_ret lr |
924 | mrc p15, 0, r0, c13, c0, 3 @ 0xffff0fe8 hardware TLS code | 931 | mrc p15, 0, r0, c13, c0, 3 @ 0xffff0fe8 hardware TLS code |
925 | .rep 4 | 932 | kuser_pad __kuser_get_tls, 16 |
933 | .rep 3 | ||
926 | .word 0 @ 0xffff0ff0 software TLS value, then | 934 | .word 0 @ 0xffff0ff0 software TLS value, then |
927 | .endr @ pad up to __kuser_helper_version | 935 | .endr @ pad up to __kuser_helper_version |
928 | 936 | ||
@@ -932,14 +940,16 @@ __kuser_helper_version: @ 0xffff0ffc | |||
932 | .globl __kuser_helper_end | 940 | .globl __kuser_helper_end |
933 | __kuser_helper_end: | 941 | __kuser_helper_end: |
934 | 942 | ||
943 | #endif | ||
944 | |||
935 | THUMB( .thumb ) | 945 | THUMB( .thumb ) |
936 | 946 | ||
937 | /* | 947 | /* |
938 | * Vector stubs. | 948 | * Vector stubs. |
939 | * | 949 | * |
940 | * This code is copied to 0xffff0200 so we can use branches in the | 950 | * This code is copied to 0xffff1000 so we can use branches in the |
941 | * vectors, rather than ldr's. Note that this code must not | 951 | * vectors, rather than ldr's. Note that this code must not exceed |
942 | * exceed 0x300 bytes. | 952 | * a page size. |
943 | * | 953 | * |
944 | * Common stub entry macro: | 954 | * Common stub entry macro: |
945 | * Enter in IRQ mode, spsr = SVC/USR CPSR, lr = SVC/USR PC | 955 | * Enter in IRQ mode, spsr = SVC/USR CPSR, lr = SVC/USR PC |
@@ -986,8 +996,17 @@ ENDPROC(vector_\name) | |||
986 | 1: | 996 | 1: |
987 | .endm | 997 | .endm |
988 | 998 | ||
989 | .globl __stubs_start | 999 | .section .stubs, "ax", %progbits |
990 | __stubs_start: | 1000 | __stubs_start: |
1001 | @ This must be the first word | ||
1002 | .word vector_swi | ||
1003 | |||
1004 | vector_rst: | ||
1005 | ARM( swi SYS_ERROR0 ) | ||
1006 | THUMB( svc #0 ) | ||
1007 | THUMB( nop ) | ||
1008 | b vector_und | ||
1009 | |||
991 | /* | 1010 | /* |
992 | * Interrupt dispatcher | 1011 | * Interrupt dispatcher |
993 | */ | 1012 | */ |
@@ -1082,6 +1101,16 @@ __stubs_start: | |||
1082 | .align 5 | 1101 | .align 5 |
1083 | 1102 | ||
1084 | /*============================================================================= | 1103 | /*============================================================================= |
1104 | * Address exception handler | ||
1105 | *----------------------------------------------------------------------------- | ||
1106 | * These aren't too critical. | ||
1107 | * (they're not supposed to happen, and won't happen in 32-bit data mode). | ||
1108 | */ | ||
1109 | |||
1110 | vector_addrexcptn: | ||
1111 | b vector_addrexcptn | ||
1112 | |||
1113 | /*============================================================================= | ||
1085 | * Undefined FIQs | 1114 | * Undefined FIQs |
1086 | *----------------------------------------------------------------------------- | 1115 | *----------------------------------------------------------------------------- |
1087 | * Enter in FIQ mode, spsr = ANY CPSR, lr = ANY PC | 1116 | * Enter in FIQ mode, spsr = ANY CPSR, lr = ANY PC |
@@ -1094,45 +1123,19 @@ __stubs_start: | |||
1094 | vector_fiq: | 1123 | vector_fiq: |
1095 | subs pc, lr, #4 | 1124 | subs pc, lr, #4 |
1096 | 1125 | ||
1097 | /*============================================================================= | 1126 | .globl vector_fiq_offset |
1098 | * Address exception handler | 1127 | .equ vector_fiq_offset, vector_fiq |
1099 | *----------------------------------------------------------------------------- | ||
1100 | * These aren't too critical. | ||
1101 | * (they're not supposed to happen, and won't happen in 32-bit data mode). | ||
1102 | */ | ||
1103 | |||
1104 | vector_addrexcptn: | ||
1105 | b vector_addrexcptn | ||
1106 | |||
1107 | /* | ||
1108 | * We group all the following data together to optimise | ||
1109 | * for CPUs with separate I & D caches. | ||
1110 | */ | ||
1111 | .align 5 | ||
1112 | |||
1113 | .LCvswi: | ||
1114 | .word vector_swi | ||
1115 | |||
1116 | .globl __stubs_end | ||
1117 | __stubs_end: | ||
1118 | |||
1119 | .equ stubs_offset, __vectors_start + 0x200 - __stubs_start | ||
1120 | 1128 | ||
1121 | .globl __vectors_start | 1129 | .section .vectors, "ax", %progbits |
1122 | __vectors_start: | 1130 | __vectors_start: |
1123 | ARM( swi SYS_ERROR0 ) | 1131 | W(b) vector_rst |
1124 | THUMB( svc #0 ) | 1132 | W(b) vector_und |
1125 | THUMB( nop ) | 1133 | W(ldr) pc, __vectors_start + 0x1000 |
1126 | W(b) vector_und + stubs_offset | 1134 | W(b) vector_pabt |
1127 | W(ldr) pc, .LCvswi + stubs_offset | 1135 | W(b) vector_dabt |
1128 | W(b) vector_pabt + stubs_offset | 1136 | W(b) vector_addrexcptn |
1129 | W(b) vector_dabt + stubs_offset | 1137 | W(b) vector_irq |
1130 | W(b) vector_addrexcptn + stubs_offset | 1138 | W(b) vector_fiq |
1131 | W(b) vector_irq + stubs_offset | ||
1132 | W(b) vector_fiq + stubs_offset | ||
1133 | |||
1134 | .globl __vectors_end | ||
1135 | __vectors_end: | ||
1136 | 1139 | ||
1137 | .data | 1140 | .data |
1138 | 1141 | ||
diff --git a/arch/arm/kernel/entry-v7m.S b/arch/arm/kernel/entry-v7m.S index e00621f1403f..52b26432c9a9 100644 --- a/arch/arm/kernel/entry-v7m.S +++ b/arch/arm/kernel/entry-v7m.S | |||
@@ -49,7 +49,7 @@ __irq_entry: | |||
49 | mov r1, sp | 49 | mov r1, sp |
50 | stmdb sp!, {lr} | 50 | stmdb sp!, {lr} |
51 | @ routine called with r0 = irq number, r1 = struct pt_regs * | 51 | @ routine called with r0 = irq number, r1 = struct pt_regs * |
52 | bl nvic_do_IRQ | 52 | bl nvic_handle_irq |
53 | 53 | ||
54 | pop {lr} | 54 | pop {lr} |
55 | @ | 55 | @ |
diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c index 2adda11f712f..25442f451148 100644 --- a/arch/arm/kernel/fiq.c +++ b/arch/arm/kernel/fiq.c | |||
@@ -47,6 +47,11 @@ | |||
47 | #include <asm/irq.h> | 47 | #include <asm/irq.h> |
48 | #include <asm/traps.h> | 48 | #include <asm/traps.h> |
49 | 49 | ||
50 | #define FIQ_OFFSET ({ \ | ||
51 | extern void *vector_fiq_offset; \ | ||
52 | (unsigned)&vector_fiq_offset; \ | ||
53 | }) | ||
54 | |||
50 | static unsigned long no_fiq_insn; | 55 | static unsigned long no_fiq_insn; |
51 | 56 | ||
52 | /* Default reacquire function | 57 | /* Default reacquire function |
@@ -80,13 +85,16 @@ int show_fiq_list(struct seq_file *p, int prec) | |||
80 | void set_fiq_handler(void *start, unsigned int length) | 85 | void set_fiq_handler(void *start, unsigned int length) |
81 | { | 86 | { |
82 | #if defined(CONFIG_CPU_USE_DOMAINS) | 87 | #if defined(CONFIG_CPU_USE_DOMAINS) |
83 | memcpy((void *)0xffff001c, start, length); | 88 | void *base = (void *)0xffff0000; |
84 | #else | 89 | #else |
85 | memcpy(vectors_page + 0x1c, start, length); | 90 | void *base = vectors_page; |
86 | #endif | 91 | #endif |
87 | flush_icache_range(0xffff001c, 0xffff001c + length); | 92 | unsigned offset = FIQ_OFFSET; |
93 | |||
94 | memcpy(base + offset, start, length); | ||
95 | flush_icache_range(0xffff0000 + offset, 0xffff0000 + offset + length); | ||
88 | if (!vectors_high()) | 96 | if (!vectors_high()) |
89 | flush_icache_range(0x1c, 0x1c + length); | 97 | flush_icache_range(offset, offset + length); |
90 | } | 98 | } |
91 | 99 | ||
92 | int claim_fiq(struct fiq_handler *f) | 100 | int claim_fiq(struct fiq_handler *f) |
@@ -144,6 +152,7 @@ EXPORT_SYMBOL(disable_fiq); | |||
144 | 152 | ||
145 | void __init init_FIQ(int start) | 153 | void __init init_FIQ(int start) |
146 | { | 154 | { |
147 | no_fiq_insn = *(unsigned long *)0xffff001c; | 155 | unsigned offset = FIQ_OFFSET; |
156 | no_fiq_insn = *(unsigned long *)(0xffff0000 + offset); | ||
148 | fiq_start = start; | 157 | fiq_start = start; |
149 | } | 158 | } |
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S index b361de143756..14235ba64a90 100644 --- a/arch/arm/kernel/head-nommu.S +++ b/arch/arm/kernel/head-nommu.S | |||
@@ -87,6 +87,7 @@ ENTRY(stext) | |||
87 | ENDPROC(stext) | 87 | ENDPROC(stext) |
88 | 88 | ||
89 | #ifdef CONFIG_SMP | 89 | #ifdef CONFIG_SMP |
90 | .text | ||
90 | ENTRY(secondary_startup) | 91 | ENTRY(secondary_startup) |
91 | /* | 92 | /* |
92 | * Common entry point for secondary CPUs. | 93 | * Common entry point for secondary CPUs. |
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 9cf6063020ae..2c7cc1e03473 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -343,6 +343,7 @@ __turn_mmu_on_loc: | |||
343 | .long __turn_mmu_on_end | 343 | .long __turn_mmu_on_end |
344 | 344 | ||
345 | #if defined(CONFIG_SMP) | 345 | #if defined(CONFIG_SMP) |
346 | .text | ||
346 | ENTRY(secondary_startup) | 347 | ENTRY(secondary_startup) |
347 | /* | 348 | /* |
348 | * Common entry point for secondary CPUs. | 349 | * Common entry point for secondary CPUs. |
diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S index 4910232c4833..797b1a6a4906 100644 --- a/arch/arm/kernel/hyp-stub.S +++ b/arch/arm/kernel/hyp-stub.S | |||
@@ -56,8 +56,8 @@ ENTRY(__boot_cpu_mode) | |||
56 | ldr \reg3, [\reg2] | 56 | ldr \reg3, [\reg2] |
57 | ldr \reg1, [\reg2, \reg3] | 57 | ldr \reg1, [\reg2, \reg3] |
58 | cmp \mode, \reg1 @ matches primary CPU boot mode? | 58 | cmp \mode, \reg1 @ matches primary CPU boot mode? |
59 | orrne r7, r7, #BOOT_CPU_MODE_MISMATCH | 59 | orrne \reg1, \reg1, #BOOT_CPU_MODE_MISMATCH |
60 | strne r7, [r5, r6] @ record what happened and give up | 60 | strne \reg1, [\reg2, \reg3] @ record what happened and give up |
61 | .endm | 61 | .endm |
62 | 62 | ||
63 | #else /* ZIMAGE */ | 63 | #else /* ZIMAGE */ |
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index d3ca4f6915af..536c85fe72a8 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -197,6 +197,7 @@ void machine_shutdown(void) | |||
197 | */ | 197 | */ |
198 | void machine_halt(void) | 198 | void machine_halt(void) |
199 | { | 199 | { |
200 | local_irq_disable(); | ||
200 | smp_send_stop(); | 201 | smp_send_stop(); |
201 | 202 | ||
202 | local_irq_disable(); | 203 | local_irq_disable(); |
@@ -211,6 +212,7 @@ void machine_halt(void) | |||
211 | */ | 212 | */ |
212 | void machine_power_off(void) | 213 | void machine_power_off(void) |
213 | { | 214 | { |
215 | local_irq_disable(); | ||
214 | smp_send_stop(); | 216 | smp_send_stop(); |
215 | 217 | ||
216 | if (pm_power_off) | 218 | if (pm_power_off) |
@@ -230,6 +232,7 @@ void machine_power_off(void) | |||
230 | */ | 232 | */ |
231 | void machine_restart(char *cmd) | 233 | void machine_restart(char *cmd) |
232 | { | 234 | { |
235 | local_irq_disable(); | ||
233 | smp_send_stop(); | 236 | smp_send_stop(); |
234 | 237 | ||
235 | arm_pm_restart(reboot_mode, cmd); | 238 | arm_pm_restart(reboot_mode, cmd); |
@@ -426,10 +429,11 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) | |||
426 | } | 429 | } |
427 | 430 | ||
428 | #ifdef CONFIG_MMU | 431 | #ifdef CONFIG_MMU |
432 | #ifdef CONFIG_KUSER_HELPERS | ||
429 | /* | 433 | /* |
430 | * The vectors page is always readable from user space for the | 434 | * The vectors page is always readable from user space for the |
431 | * atomic helpers and the signal restart code. Insert it into the | 435 | * atomic helpers. Insert it into the gate_vma so that it is visible |
432 | * gate_vma so that it is visible through ptrace and /proc/<pid>/mem. | 436 | * through ptrace and /proc/<pid>/mem. |
433 | */ | 437 | */ |
434 | static struct vm_area_struct gate_vma = { | 438 | static struct vm_area_struct gate_vma = { |
435 | .vm_start = 0xffff0000, | 439 | .vm_start = 0xffff0000, |
@@ -458,9 +462,48 @@ int in_gate_area_no_mm(unsigned long addr) | |||
458 | { | 462 | { |
459 | return in_gate_area(NULL, addr); | 463 | return in_gate_area(NULL, addr); |
460 | } | 464 | } |
465 | #define is_gate_vma(vma) ((vma) = &gate_vma) | ||
466 | #else | ||
467 | #define is_gate_vma(vma) 0 | ||
468 | #endif | ||
461 | 469 | ||
462 | const char *arch_vma_name(struct vm_area_struct *vma) | 470 | const char *arch_vma_name(struct vm_area_struct *vma) |
463 | { | 471 | { |
464 | return (vma == &gate_vma) ? "[vectors]" : NULL; | 472 | return is_gate_vma(vma) ? "[vectors]" : |
473 | (vma->vm_mm && vma->vm_start == vma->vm_mm->context.sigpage) ? | ||
474 | "[sigpage]" : NULL; | ||
475 | } | ||
476 | |||
477 | static struct page *signal_page; | ||
478 | extern struct page *get_signal_page(void); | ||
479 | |||
480 | int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | ||
481 | { | ||
482 | struct mm_struct *mm = current->mm; | ||
483 | unsigned long addr; | ||
484 | int ret; | ||
485 | |||
486 | if (!signal_page) | ||
487 | signal_page = get_signal_page(); | ||
488 | if (!signal_page) | ||
489 | return -ENOMEM; | ||
490 | |||
491 | down_write(&mm->mmap_sem); | ||
492 | addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0); | ||
493 | if (IS_ERR_VALUE(addr)) { | ||
494 | ret = addr; | ||
495 | goto up_fail; | ||
496 | } | ||
497 | |||
498 | ret = install_special_mapping(mm, addr, PAGE_SIZE, | ||
499 | VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC, | ||
500 | &signal_page); | ||
501 | |||
502 | if (ret == 0) | ||
503 | mm->context.sigpage = addr; | ||
504 | |||
505 | up_fail: | ||
506 | up_write(&mm->mmap_sem); | ||
507 | return ret; | ||
465 | } | 508 | } |
466 | #endif | 509 | #endif |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 63af9a7ae512..afc2489ee13b 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -836,6 +836,8 @@ static int __init meminfo_cmp(const void *_a, const void *_b) | |||
836 | void __init hyp_mode_check(void) | 836 | void __init hyp_mode_check(void) |
837 | { | 837 | { |
838 | #ifdef CONFIG_ARM_VIRT_EXT | 838 | #ifdef CONFIG_ARM_VIRT_EXT |
839 | sync_boot_mode(); | ||
840 | |||
839 | if (is_hyp_mode_available()) { | 841 | if (is_hyp_mode_available()) { |
840 | pr_info("CPU: All CPU(s) started in HYP mode.\n"); | 842 | pr_info("CPU: All CPU(s) started in HYP mode.\n"); |
841 | pr_info("CPU: Virtualization extensions available.\n"); | 843 | pr_info("CPU: Virtualization extensions available.\n"); |
@@ -971,6 +973,7 @@ static const char *hwcap_str[] = { | |||
971 | "vfpv4", | 973 | "vfpv4", |
972 | "idiva", | 974 | "idiva", |
973 | "idivt", | 975 | "idivt", |
976 | "vfpd32", | ||
974 | "lpae", | 977 | "lpae", |
975 | NULL | 978 | NULL |
976 | }; | 979 | }; |
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 1c16c35c271a..ab3304225272 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/random.h> | ||
11 | #include <linux/signal.h> | 12 | #include <linux/signal.h> |
12 | #include <linux/personality.h> | 13 | #include <linux/personality.h> |
13 | #include <linux/uaccess.h> | 14 | #include <linux/uaccess.h> |
@@ -15,12 +16,11 @@ | |||
15 | 16 | ||
16 | #include <asm/elf.h> | 17 | #include <asm/elf.h> |
17 | #include <asm/cacheflush.h> | 18 | #include <asm/cacheflush.h> |
19 | #include <asm/traps.h> | ||
18 | #include <asm/ucontext.h> | 20 | #include <asm/ucontext.h> |
19 | #include <asm/unistd.h> | 21 | #include <asm/unistd.h> |
20 | #include <asm/vfp.h> | 22 | #include <asm/vfp.h> |
21 | 23 | ||
22 | #include "signal.h" | ||
23 | |||
24 | /* | 24 | /* |
25 | * For ARM syscalls, we encode the syscall number into the instruction. | 25 | * For ARM syscalls, we encode the syscall number into the instruction. |
26 | */ | 26 | */ |
@@ -40,11 +40,13 @@ | |||
40 | #define SWI_THUMB_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_sigreturn - __NR_SYSCALL_BASE)) | 40 | #define SWI_THUMB_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_sigreturn - __NR_SYSCALL_BASE)) |
41 | #define SWI_THUMB_RT_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_rt_sigreturn - __NR_SYSCALL_BASE)) | 41 | #define SWI_THUMB_RT_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_rt_sigreturn - __NR_SYSCALL_BASE)) |
42 | 42 | ||
43 | const unsigned long sigreturn_codes[7] = { | 43 | static const unsigned long sigreturn_codes[7] = { |
44 | MOV_R7_NR_SIGRETURN, SWI_SYS_SIGRETURN, SWI_THUMB_SIGRETURN, | 44 | MOV_R7_NR_SIGRETURN, SWI_SYS_SIGRETURN, SWI_THUMB_SIGRETURN, |
45 | MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN, | 45 | MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN, |
46 | }; | 46 | }; |
47 | 47 | ||
48 | static unsigned long signal_return_offset; | ||
49 | |||
48 | #ifdef CONFIG_CRUNCH | 50 | #ifdef CONFIG_CRUNCH |
49 | static int preserve_crunch_context(struct crunch_sigframe __user *frame) | 51 | static int preserve_crunch_context(struct crunch_sigframe __user *frame) |
50 | { | 52 | { |
@@ -400,14 +402,20 @@ setup_return(struct pt_regs *regs, struct ksignal *ksig, | |||
400 | __put_user(sigreturn_codes[idx+1], rc+1)) | 402 | __put_user(sigreturn_codes[idx+1], rc+1)) |
401 | return 1; | 403 | return 1; |
402 | 404 | ||
403 | if ((cpsr & MODE32_BIT) && !IS_ENABLED(CONFIG_ARM_MPU)) { | 405 | #ifdef CONFIG_MMU |
406 | if (cpsr & MODE32_BIT) { | ||
407 | struct mm_struct *mm = current->mm; | ||
408 | |||
404 | /* | 409 | /* |
405 | * 32-bit code can use the new high-page | 410 | * 32-bit code can use the signal return page |
406 | * signal return code support except when the MPU has | 411 | * except when the MPU has protected the vectors |
407 | * protected the vectors page from PL0 | 412 | * page from PL0 |
408 | */ | 413 | */ |
409 | retcode = KERN_SIGRETURN_CODE + (idx << 2) + thumb; | 414 | retcode = mm->context.sigpage + signal_return_offset + |
410 | } else { | 415 | (idx << 2) + thumb; |
416 | } else | ||
417 | #endif | ||
418 | { | ||
411 | /* | 419 | /* |
412 | * Ensure that the instruction cache sees | 420 | * Ensure that the instruction cache sees |
413 | * the return code written onto the stack. | 421 | * the return code written onto the stack. |
@@ -608,3 +616,33 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) | |||
608 | } while (thread_flags & _TIF_WORK_MASK); | 616 | } while (thread_flags & _TIF_WORK_MASK); |
609 | return 0; | 617 | return 0; |
610 | } | 618 | } |
619 | |||
620 | struct page *get_signal_page(void) | ||
621 | { | ||
622 | unsigned long ptr; | ||
623 | unsigned offset; | ||
624 | struct page *page; | ||
625 | void *addr; | ||
626 | |||
627 | page = alloc_pages(GFP_KERNEL, 0); | ||
628 | |||
629 | if (!page) | ||
630 | return NULL; | ||
631 | |||
632 | addr = page_address(page); | ||
633 | |||
634 | /* Give the signal return code some randomness */ | ||
635 | offset = 0x200 + (get_random_int() & 0x7fc); | ||
636 | signal_return_offset = offset; | ||
637 | |||
638 | /* | ||
639 | * Copy signal return handlers into the vector page, and | ||
640 | * set sigreturn to be a pointer to these. | ||
641 | */ | ||
642 | memcpy(addr + offset, sigreturn_codes, sizeof(sigreturn_codes)); | ||
643 | |||
644 | ptr = (unsigned long)addr + offset; | ||
645 | flush_icache_range(ptr, ptr + sizeof(sigreturn_codes)); | ||
646 | |||
647 | return page; | ||
648 | } | ||
diff --git a/arch/arm/kernel/signal.h b/arch/arm/kernel/signal.h deleted file mode 100644 index 5ff067b7c752..000000000000 --- a/arch/arm/kernel/signal.h +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/kernel/signal.h | ||
3 | * | ||
4 | * Copyright (C) 2005-2009 Russell King. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #define KERN_SIGRETURN_CODE (CONFIG_VECTORS_BASE + 0x00000500) | ||
11 | |||
12 | extern const unsigned long sigreturn_codes[7]; | ||
diff --git a/arch/arm/kernel/smp_tlb.c b/arch/arm/kernel/smp_tlb.c index a98b62dca2fa..c2edfff573c2 100644 --- a/arch/arm/kernel/smp_tlb.c +++ b/arch/arm/kernel/smp_tlb.c | |||
@@ -70,23 +70,6 @@ static inline void ipi_flush_bp_all(void *ignored) | |||
70 | local_flush_bp_all(); | 70 | local_flush_bp_all(); |
71 | } | 71 | } |
72 | 72 | ||
73 | #ifdef CONFIG_ARM_ERRATA_798181 | ||
74 | static int erratum_a15_798181(void) | ||
75 | { | ||
76 | unsigned int midr = read_cpuid_id(); | ||
77 | |||
78 | /* Cortex-A15 r0p0..r3p2 affected */ | ||
79 | if ((midr & 0xff0ffff0) != 0x410fc0f0 || midr > 0x413fc0f2) | ||
80 | return 0; | ||
81 | return 1; | ||
82 | } | ||
83 | #else | ||
84 | static int erratum_a15_798181(void) | ||
85 | { | ||
86 | return 0; | ||
87 | } | ||
88 | #endif | ||
89 | |||
90 | static void ipi_flush_tlb_a15_erratum(void *arg) | 73 | static void ipi_flush_tlb_a15_erratum(void *arg) |
91 | { | 74 | { |
92 | dmb(); | 75 | dmb(); |
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index cab094c234ee..ab517fcce21b 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -35,8 +35,6 @@ | |||
35 | #include <asm/tls.h> | 35 | #include <asm/tls.h> |
36 | #include <asm/system_misc.h> | 36 | #include <asm/system_misc.h> |
37 | 37 | ||
38 | #include "signal.h" | ||
39 | |||
40 | static const char *handler[]= { "prefetch abort", "data abort", "address exception", "interrupt" }; | 38 | static const char *handler[]= { "prefetch abort", "data abort", "address exception", "interrupt" }; |
41 | 39 | ||
42 | void *vectors_page; | 40 | void *vectors_page; |
@@ -800,15 +798,26 @@ void __init trap_init(void) | |||
800 | return; | 798 | return; |
801 | } | 799 | } |
802 | 800 | ||
803 | static void __init kuser_get_tls_init(unsigned long vectors) | 801 | #ifdef CONFIG_KUSER_HELPERS |
802 | static void __init kuser_init(void *vectors) | ||
804 | { | 803 | { |
804 | extern char __kuser_helper_start[], __kuser_helper_end[]; | ||
805 | int kuser_sz = __kuser_helper_end - __kuser_helper_start; | ||
806 | |||
807 | memcpy(vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz); | ||
808 | |||
805 | /* | 809 | /* |
806 | * vectors + 0xfe0 = __kuser_get_tls | 810 | * vectors + 0xfe0 = __kuser_get_tls |
807 | * vectors + 0xfe8 = hardware TLS instruction at 0xffff0fe8 | 811 | * vectors + 0xfe8 = hardware TLS instruction at 0xffff0fe8 |
808 | */ | 812 | */ |
809 | if (tls_emu || has_tls_reg) | 813 | if (tls_emu || has_tls_reg) |
810 | memcpy((void *)vectors + 0xfe0, (void *)vectors + 0xfe8, 4); | 814 | memcpy(vectors + 0xfe0, vectors + 0xfe8, 4); |
811 | } | 815 | } |
816 | #else | ||
817 | static void __init kuser_init(void *vectors) | ||
818 | { | ||
819 | } | ||
820 | #endif | ||
812 | 821 | ||
813 | void __init early_trap_init(void *vectors_base) | 822 | void __init early_trap_init(void *vectors_base) |
814 | { | 823 | { |
@@ -816,33 +825,30 @@ void __init early_trap_init(void *vectors_base) | |||
816 | unsigned long vectors = (unsigned long)vectors_base; | 825 | unsigned long vectors = (unsigned long)vectors_base; |
817 | extern char __stubs_start[], __stubs_end[]; | 826 | extern char __stubs_start[], __stubs_end[]; |
818 | extern char __vectors_start[], __vectors_end[]; | 827 | extern char __vectors_start[], __vectors_end[]; |
819 | extern char __kuser_helper_start[], __kuser_helper_end[]; | 828 | unsigned i; |
820 | int kuser_sz = __kuser_helper_end - __kuser_helper_start; | ||
821 | 829 | ||
822 | vectors_page = vectors_base; | 830 | vectors_page = vectors_base; |
823 | 831 | ||
824 | /* | 832 | /* |
833 | * Poison the vectors page with an undefined instruction. This | ||
834 | * instruction is chosen to be undefined for both ARM and Thumb | ||
835 | * ISAs. The Thumb version is an undefined instruction with a | ||
836 | * branch back to the undefined instruction. | ||
837 | */ | ||
838 | for (i = 0; i < PAGE_SIZE / sizeof(u32); i++) | ||
839 | ((u32 *)vectors_base)[i] = 0xe7fddef1; | ||
840 | |||
841 | /* | ||
825 | * Copy the vectors, stubs and kuser helpers (in entry-armv.S) | 842 | * Copy the vectors, stubs and kuser helpers (in entry-armv.S) |
826 | * into the vector page, mapped at 0xffff0000, and ensure these | 843 | * into the vector page, mapped at 0xffff0000, and ensure these |
827 | * are visible to the instruction stream. | 844 | * are visible to the instruction stream. |
828 | */ | 845 | */ |
829 | memcpy((void *)vectors, __vectors_start, __vectors_end - __vectors_start); | 846 | memcpy((void *)vectors, __vectors_start, __vectors_end - __vectors_start); |
830 | memcpy((void *)vectors + 0x200, __stubs_start, __stubs_end - __stubs_start); | 847 | memcpy((void *)vectors + 0x1000, __stubs_start, __stubs_end - __stubs_start); |
831 | memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz); | ||
832 | 848 | ||
833 | /* | 849 | kuser_init(vectors_base); |
834 | * Do processor specific fixups for the kuser helpers | ||
835 | */ | ||
836 | kuser_get_tls_init(vectors); | ||
837 | |||
838 | /* | ||
839 | * Copy signal return handlers into the vector page, and | ||
840 | * set sigreturn to be a pointer to these. | ||
841 | */ | ||
842 | memcpy((void *)(vectors + KERN_SIGRETURN_CODE - CONFIG_VECTORS_BASE), | ||
843 | sigreturn_codes, sizeof(sigreturn_codes)); | ||
844 | 850 | ||
845 | flush_icache_range(vectors, vectors + PAGE_SIZE); | 851 | flush_icache_range(vectors, vectors + PAGE_SIZE * 2); |
846 | modify_domain(DOMAIN_USER, DOMAIN_CLIENT); | 852 | modify_domain(DOMAIN_USER, DOMAIN_CLIENT); |
847 | #else /* ifndef CONFIG_CPU_V7M */ | 853 | #else /* ifndef CONFIG_CPU_V7M */ |
848 | /* | 854 | /* |
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index fa25e4e425f6..7bcee5c9b604 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S | |||
@@ -148,6 +148,23 @@ SECTIONS | |||
148 | . = ALIGN(PAGE_SIZE); | 148 | . = ALIGN(PAGE_SIZE); |
149 | __init_begin = .; | 149 | __init_begin = .; |
150 | #endif | 150 | #endif |
151 | /* | ||
152 | * The vectors and stubs are relocatable code, and the | ||
153 | * only thing that matters is their relative offsets | ||
154 | */ | ||
155 | __vectors_start = .; | ||
156 | .vectors 0 : AT(__vectors_start) { | ||
157 | *(.vectors) | ||
158 | } | ||
159 | . = __vectors_start + SIZEOF(.vectors); | ||
160 | __vectors_end = .; | ||
161 | |||
162 | __stubs_start = .; | ||
163 | .stubs 0x1000 : AT(__stubs_start) { | ||
164 | *(.stubs) | ||
165 | } | ||
166 | . = __stubs_start + SIZEOF(.stubs); | ||
167 | __stubs_end = .; | ||
151 | 168 | ||
152 | INIT_TEXT_SECTION(8) | 169 | INIT_TEXT_SECTION(8) |
153 | .exit.text : { | 170 | .exit.text : { |
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig index 614e41e7881b..905efc8cac79 100644 --- a/arch/arm/mach-msm/Kconfig +++ b/arch/arm/mach-msm/Kconfig | |||
@@ -121,8 +121,7 @@ config MSM_SMD | |||
121 | bool | 121 | bool |
122 | 122 | ||
123 | config MSM_GPIOMUX | 123 | config MSM_GPIOMUX |
124 | depends on !(ARCH_MSM8X60 || ARCH_MSM8960) | 124 | bool |
125 | bool "MSM V1 TLMM GPIOMUX architecture" | ||
126 | help | 125 | help |
127 | Support for MSM V1 TLMM GPIOMUX architecture. | 126 | Support for MSM V1 TLMM GPIOMUX architecture. |
128 | 127 | ||
diff --git a/arch/arm/mach-msm/gpiomux-v1.c b/arch/arm/mach-msm/gpiomux-v1.c deleted file mode 100644 index 27de2abd7144..000000000000 --- a/arch/arm/mach-msm/gpiomux-v1.c +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* Copyright (c) 2010, Code Aurora Forum. All rights reserved. | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License version 2 and | ||
5 | * only version 2 as published by the Free Software Foundation. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, | ||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | * GNU General Public License for more details. | ||
11 | * | ||
12 | * You should have received a copy of the GNU General Public License | ||
13 | * along with this program; if not, write to the Free Software | ||
14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
15 | * 02110-1301, USA. | ||
16 | */ | ||
17 | #include <linux/kernel.h> | ||
18 | #include "gpiomux.h" | ||
19 | #include "proc_comm.h" | ||
20 | |||
21 | void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val) | ||
22 | { | ||
23 | unsigned tlmm_config = (val & ~GPIOMUX_CTL_MASK) | | ||
24 | ((gpio & 0x3ff) << 4); | ||
25 | unsigned tlmm_disable = 0; | ||
26 | int rc; | ||
27 | |||
28 | rc = msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, | ||
29 | &tlmm_config, &tlmm_disable); | ||
30 | if (rc) | ||
31 | pr_err("%s: unexpected proc_comm failure %d: %08x %08x\n", | ||
32 | __func__, rc, tlmm_config, tlmm_disable); | ||
33 | } | ||
diff --git a/arch/arm/mach-msm/gpiomux.h b/arch/arm/mach-msm/gpiomux.h index 8e82f41a8923..4410d7766f93 100644 --- a/arch/arm/mach-msm/gpiomux.h +++ b/arch/arm/mach-msm/gpiomux.h | |||
@@ -73,16 +73,6 @@ extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS]; | |||
73 | int msm_gpiomux_write(unsigned gpio, | 73 | int msm_gpiomux_write(unsigned gpio, |
74 | gpiomux_config_t active, | 74 | gpiomux_config_t active, |
75 | gpiomux_config_t suspended); | 75 | gpiomux_config_t suspended); |
76 | |||
77 | /* Architecture-internal function for use by the framework only. | ||
78 | * This function can assume the following: | ||
79 | * - the gpio value has passed a bounds-check | ||
80 | * - the gpiomux spinlock has been obtained | ||
81 | * | ||
82 | * This function is not for public consumption. External users | ||
83 | * should use msm_gpiomux_write. | ||
84 | */ | ||
85 | void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val); | ||
86 | #else | 76 | #else |
87 | static inline int msm_gpiomux_write(unsigned gpio, | 77 | static inline int msm_gpiomux_write(unsigned gpio, |
88 | gpiomux_config_t active, | 78 | gpiomux_config_t active, |
diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c index 393aeefaebb0..043e5705f2a6 100644 --- a/arch/arm/mach-omap2/dss-common.c +++ b/arch/arm/mach-omap2/dss-common.c | |||
@@ -42,7 +42,7 @@ | |||
42 | 42 | ||
43 | /* Using generic display panel */ | 43 | /* Using generic display panel */ |
44 | static struct tfp410_platform_data omap4_dvi_panel = { | 44 | static struct tfp410_platform_data omap4_dvi_panel = { |
45 | .i2c_bus_num = 3, | 45 | .i2c_bus_num = 2, |
46 | .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, | 46 | .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, |
47 | }; | 47 | }; |
48 | 48 | ||
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index 5cc92874be7e..f99f68e1e85b 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c | |||
@@ -129,6 +129,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev) | |||
129 | struct device_node *node = pdev->dev.of_node; | 129 | struct device_node *node = pdev->dev.of_node; |
130 | const char *oh_name; | 130 | const char *oh_name; |
131 | int oh_cnt, i, ret = 0; | 131 | int oh_cnt, i, ret = 0; |
132 | bool device_active = false; | ||
132 | 133 | ||
133 | oh_cnt = of_property_count_strings(node, "ti,hwmods"); | 134 | oh_cnt = of_property_count_strings(node, "ti,hwmods"); |
134 | if (oh_cnt <= 0) { | 135 | if (oh_cnt <= 0) { |
@@ -152,6 +153,8 @@ static int omap_device_build_from_dt(struct platform_device *pdev) | |||
152 | goto odbfd_exit1; | 153 | goto odbfd_exit1; |
153 | } | 154 | } |
154 | hwmods[i] = oh; | 155 | hwmods[i] = oh; |
156 | if (oh->flags & HWMOD_INIT_NO_IDLE) | ||
157 | device_active = true; | ||
155 | } | 158 | } |
156 | 159 | ||
157 | od = omap_device_alloc(pdev, hwmods, oh_cnt); | 160 | od = omap_device_alloc(pdev, hwmods, oh_cnt); |
@@ -172,6 +175,11 @@ static int omap_device_build_from_dt(struct platform_device *pdev) | |||
172 | 175 | ||
173 | pdev->dev.pm_domain = &omap_device_pm_domain; | 176 | pdev->dev.pm_domain = &omap_device_pm_domain; |
174 | 177 | ||
178 | if (device_active) { | ||
179 | omap_device_enable(pdev); | ||
180 | pm_runtime_set_active(&pdev->dev); | ||
181 | } | ||
182 | |||
175 | odbfd_exit1: | 183 | odbfd_exit1: |
176 | kfree(hwmods); | 184 | kfree(hwmods); |
177 | odbfd_exit: | 185 | odbfd_exit: |
@@ -842,6 +850,7 @@ static int __init omap_device_late_idle(struct device *dev, void *data) | |||
842 | { | 850 | { |
843 | struct platform_device *pdev = to_platform_device(dev); | 851 | struct platform_device *pdev = to_platform_device(dev); |
844 | struct omap_device *od = to_omap_device(pdev); | 852 | struct omap_device *od = to_omap_device(pdev); |
853 | int i; | ||
845 | 854 | ||
846 | if (!od) | 855 | if (!od) |
847 | return 0; | 856 | return 0; |
@@ -850,6 +859,15 @@ static int __init omap_device_late_idle(struct device *dev, void *data) | |||
850 | * If omap_device state is enabled, but has no driver bound, | 859 | * If omap_device state is enabled, but has no driver bound, |
851 | * idle it. | 860 | * idle it. |
852 | */ | 861 | */ |
862 | |||
863 | /* | ||
864 | * Some devices (like memory controllers) are always kept | ||
865 | * enabled, and should not be idled even with no drivers. | ||
866 | */ | ||
867 | for (i = 0; i < od->hwmods_cnt; i++) | ||
868 | if (od->hwmods[i]->flags & HWMOD_INIT_NO_IDLE) | ||
869 | return 0; | ||
870 | |||
853 | if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) { | 871 | if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) { |
854 | if (od->_state == OMAP_DEVICE_STATE_ENABLED) { | 872 | if (od->_state == OMAP_DEVICE_STATE_ENABLED) { |
855 | dev_warn(dev, "%s: enabled but no driver. Idling\n", | 873 | dev_warn(dev, "%s: enabled but no driver. Idling\n", |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 7341eff63f56..7f4db12b1459 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -2386,7 +2386,7 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) | |||
2386 | 2386 | ||
2387 | np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh); | 2387 | np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh); |
2388 | if (np) | 2388 | if (np) |
2389 | va_start = of_iomap(np, 0); | 2389 | va_start = of_iomap(np, oh->mpu_rt_idx); |
2390 | } else { | 2390 | } else { |
2391 | va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); | 2391 | va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); |
2392 | } | 2392 | } |
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h index aab33fd814c0..e1482a9b3bc2 100644 --- a/arch/arm/mach-omap2/omap_hwmod.h +++ b/arch/arm/mach-omap2/omap_hwmod.h | |||
@@ -95,6 +95,54 @@ extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type3; | |||
95 | #define MODULEMODE_HWCTRL 1 | 95 | #define MODULEMODE_HWCTRL 1 |
96 | #define MODULEMODE_SWCTRL 2 | 96 | #define MODULEMODE_SWCTRL 2 |
97 | 97 | ||
98 | #define DEBUG_OMAP2UART1_FLAGS 0 | ||
99 | #define DEBUG_OMAP2UART2_FLAGS 0 | ||
100 | #define DEBUG_OMAP2UART3_FLAGS 0 | ||
101 | #define DEBUG_OMAP3UART3_FLAGS 0 | ||
102 | #define DEBUG_OMAP3UART4_FLAGS 0 | ||
103 | #define DEBUG_OMAP4UART3_FLAGS 0 | ||
104 | #define DEBUG_OMAP4UART4_FLAGS 0 | ||
105 | #define DEBUG_TI81XXUART1_FLAGS 0 | ||
106 | #define DEBUG_TI81XXUART2_FLAGS 0 | ||
107 | #define DEBUG_TI81XXUART3_FLAGS 0 | ||
108 | #define DEBUG_AM33XXUART1_FLAGS 0 | ||
109 | |||
110 | #define DEBUG_OMAPUART_FLAGS (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET) | ||
111 | |||
112 | #if defined(CONFIG_DEBUG_OMAP2UART1) | ||
113 | #undef DEBUG_OMAP2UART1_FLAGS | ||
114 | #define DEBUG_OMAP2UART1_FLAGS DEBUG_OMAPUART_FLAGS | ||
115 | #elif defined(CONFIG_DEBUG_OMAP2UART2) | ||
116 | #undef DEBUG_OMAP2UART2_FLAGS | ||
117 | #define DEBUG_OMAP2UART2_FLAGS DEBUG_OMAPUART_FLAGS | ||
118 | #elif defined(CONFIG_DEBUG_OMAP2UART3) | ||
119 | #undef DEBUG_OMAP2UART3_FLAGS | ||
120 | #define DEBUG_OMAP2UART3_FLAGS DEBUG_OMAPUART_FLAGS | ||
121 | #elif defined(CONFIG_DEBUG_OMAP3UART3) | ||
122 | #undef DEBUG_OMAP3UART3_FLAGS | ||
123 | #define DEBUG_OMAP3UART3_FLAGS DEBUG_OMAPUART_FLAGS | ||
124 | #elif defined(CONFIG_DEBUG_OMAP3UART4) | ||
125 | #undef DEBUG_OMAP3UART4_FLAGS | ||
126 | #define DEBUG_OMAP3UART4_FLAGS DEBUG_OMAPUART_FLAGS | ||
127 | #elif defined(CONFIG_DEBUG_OMAP4UART3) | ||
128 | #undef DEBUG_OMAP4UART3_FLAGS | ||
129 | #define DEBUG_OMAP4UART3_FLAGS DEBUG_OMAPUART_FLAGS | ||
130 | #elif defined(CONFIG_DEBUG_OMAP4UART4) | ||
131 | #undef DEBUG_OMAP4UART4_FLAGS | ||
132 | #define DEBUG_OMAP4UART4_FLAGS DEBUG_OMAPUART_FLAGS | ||
133 | #elif defined(CONFIG_DEBUG_TI81XXUART1) | ||
134 | #undef DEBUG_TI81XXUART1_FLAGS | ||
135 | #define DEBUG_TI81XXUART1_FLAGS DEBUG_OMAPUART_FLAGS | ||
136 | #elif defined(CONFIG_DEBUG_TI81XXUART2) | ||
137 | #undef DEBUG_TI81XXUART2_FLAGS | ||
138 | #define DEBUG_TI81XXUART2_FLAGS DEBUG_OMAPUART_FLAGS | ||
139 | #elif defined(CONFIG_DEBUG_TI81XXUART3) | ||
140 | #undef DEBUG_TI81XXUART3_FLAGS | ||
141 | #define DEBUG_TI81XXUART3_FLAGS DEBUG_OMAPUART_FLAGS | ||
142 | #elif defined(CONFIG_DEBUG_AM33XXUART1) | ||
143 | #undef DEBUG_AM33XXUART1_FLAGS | ||
144 | #define DEBUG_AM33XXUART1_FLAGS DEBUG_OMAPUART_FLAGS | ||
145 | #endif | ||
98 | 146 | ||
99 | /** | 147 | /** |
100 | * struct omap_hwmod_mux_info - hwmod specific mux configuration | 148 | * struct omap_hwmod_mux_info - hwmod specific mux configuration |
@@ -568,6 +616,7 @@ struct omap_hwmod_link { | |||
568 | * @voltdm: pointer to voltage domain (filled in at runtime) | 616 | * @voltdm: pointer to voltage domain (filled in at runtime) |
569 | * @dev_attr: arbitrary device attributes that can be passed to the driver | 617 | * @dev_attr: arbitrary device attributes that can be passed to the driver |
570 | * @_sysc_cache: internal-use hwmod flags | 618 | * @_sysc_cache: internal-use hwmod flags |
619 | * @mpu_rt_idx: index of device address space for register target (for DT boot) | ||
571 | * @_mpu_rt_va: cached register target start address (internal use) | 620 | * @_mpu_rt_va: cached register target start address (internal use) |
572 | * @_mpu_port: cached MPU register target slave (internal use) | 621 | * @_mpu_port: cached MPU register target slave (internal use) |
573 | * @opt_clks_cnt: number of @opt_clks | 622 | * @opt_clks_cnt: number of @opt_clks |
@@ -617,6 +666,7 @@ struct omap_hwmod { | |||
617 | struct list_head node; | 666 | struct list_head node; |
618 | struct omap_hwmod_ocp_if *_mpu_port; | 667 | struct omap_hwmod_ocp_if *_mpu_port; |
619 | u16 flags; | 668 | u16 flags; |
669 | u8 mpu_rt_idx; | ||
620 | u8 response_lat; | 670 | u8 response_lat; |
621 | u8 rst_lines_cnt; | 671 | u8 rst_lines_cnt; |
622 | u8 opt_clks_cnt; | 672 | u8 opt_clks_cnt; |
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c index d05fc7b54567..56cebb05509e 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c | |||
@@ -512,7 +512,7 @@ struct omap_hwmod omap2xxx_uart1_hwmod = { | |||
512 | .mpu_irqs = omap2_uart1_mpu_irqs, | 512 | .mpu_irqs = omap2_uart1_mpu_irqs, |
513 | .sdma_reqs = omap2_uart1_sdma_reqs, | 513 | .sdma_reqs = omap2_uart1_sdma_reqs, |
514 | .main_clk = "uart1_fck", | 514 | .main_clk = "uart1_fck", |
515 | .flags = HWMOD_SWSUP_SIDLE_ACT, | 515 | .flags = DEBUG_OMAP2UART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT, |
516 | .prcm = { | 516 | .prcm = { |
517 | .omap2 = { | 517 | .omap2 = { |
518 | .module_offs = CORE_MOD, | 518 | .module_offs = CORE_MOD, |
@@ -532,7 +532,7 @@ struct omap_hwmod omap2xxx_uart2_hwmod = { | |||
532 | .mpu_irqs = omap2_uart2_mpu_irqs, | 532 | .mpu_irqs = omap2_uart2_mpu_irqs, |
533 | .sdma_reqs = omap2_uart2_sdma_reqs, | 533 | .sdma_reqs = omap2_uart2_sdma_reqs, |
534 | .main_clk = "uart2_fck", | 534 | .main_clk = "uart2_fck", |
535 | .flags = HWMOD_SWSUP_SIDLE_ACT, | 535 | .flags = DEBUG_OMAP2UART2_FLAGS | HWMOD_SWSUP_SIDLE_ACT, |
536 | .prcm = { | 536 | .prcm = { |
537 | .omap2 = { | 537 | .omap2 = { |
538 | .module_offs = CORE_MOD, | 538 | .module_offs = CORE_MOD, |
@@ -552,7 +552,7 @@ struct omap_hwmod omap2xxx_uart3_hwmod = { | |||
552 | .mpu_irqs = omap2_uart3_mpu_irqs, | 552 | .mpu_irqs = omap2_uart3_mpu_irqs, |
553 | .sdma_reqs = omap2_uart3_sdma_reqs, | 553 | .sdma_reqs = omap2_uart3_sdma_reqs, |
554 | .main_clk = "uart3_fck", | 554 | .main_clk = "uart3_fck", |
555 | .flags = HWMOD_SWSUP_SIDLE_ACT, | 555 | .flags = DEBUG_OMAP2UART3_FLAGS | HWMOD_SWSUP_SIDLE_ACT, |
556 | .prcm = { | 556 | .prcm = { |
557 | .omap2 = { | 557 | .omap2 = { |
558 | .module_offs = CORE_MOD, | 558 | .module_offs = CORE_MOD, |
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c index 28bbd56346a9..eb2f3b93b51c 100644 --- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c | |||
@@ -562,6 +562,7 @@ static struct omap_hwmod am33xx_cpgmac0_hwmod = { | |||
562 | .clkdm_name = "cpsw_125mhz_clkdm", | 562 | .clkdm_name = "cpsw_125mhz_clkdm", |
563 | .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY), | 563 | .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY), |
564 | .main_clk = "cpsw_125mhz_gclk", | 564 | .main_clk = "cpsw_125mhz_gclk", |
565 | .mpu_rt_idx = 1, | ||
565 | .prcm = { | 566 | .prcm = { |
566 | .omap4 = { | 567 | .omap4 = { |
567 | .clkctrl_offs = AM33XX_CM_PER_CPGMAC0_CLKCTRL_OFFSET, | 568 | .clkctrl_offs = AM33XX_CM_PER_CPGMAC0_CLKCTRL_OFFSET, |
@@ -1512,7 +1513,7 @@ static struct omap_hwmod am33xx_uart1_hwmod = { | |||
1512 | .name = "uart1", | 1513 | .name = "uart1", |
1513 | .class = &uart_class, | 1514 | .class = &uart_class, |
1514 | .clkdm_name = "l4_wkup_clkdm", | 1515 | .clkdm_name = "l4_wkup_clkdm", |
1515 | .flags = HWMOD_SWSUP_SIDLE_ACT, | 1516 | .flags = DEBUG_AM33XXUART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT, |
1516 | .main_clk = "dpll_per_m2_div4_wkupdm_ck", | 1517 | .main_clk = "dpll_per_m2_div4_wkupdm_ck", |
1517 | .prcm = { | 1518 | .prcm = { |
1518 | .omap4 = { | 1519 | .omap4 = { |
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index f7a3df2fb579..0c3a427da544 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
@@ -490,7 +490,7 @@ static struct omap_hwmod omap3xxx_uart1_hwmod = { | |||
490 | .mpu_irqs = omap2_uart1_mpu_irqs, | 490 | .mpu_irqs = omap2_uart1_mpu_irqs, |
491 | .sdma_reqs = omap2_uart1_sdma_reqs, | 491 | .sdma_reqs = omap2_uart1_sdma_reqs, |
492 | .main_clk = "uart1_fck", | 492 | .main_clk = "uart1_fck", |
493 | .flags = HWMOD_SWSUP_SIDLE_ACT, | 493 | .flags = DEBUG_TI81XXUART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT, |
494 | .prcm = { | 494 | .prcm = { |
495 | .omap2 = { | 495 | .omap2 = { |
496 | .module_offs = CORE_MOD, | 496 | .module_offs = CORE_MOD, |
@@ -509,7 +509,7 @@ static struct omap_hwmod omap3xxx_uart2_hwmod = { | |||
509 | .mpu_irqs = omap2_uart2_mpu_irqs, | 509 | .mpu_irqs = omap2_uart2_mpu_irqs, |
510 | .sdma_reqs = omap2_uart2_sdma_reqs, | 510 | .sdma_reqs = omap2_uart2_sdma_reqs, |
511 | .main_clk = "uart2_fck", | 511 | .main_clk = "uart2_fck", |
512 | .flags = HWMOD_SWSUP_SIDLE_ACT, | 512 | .flags = DEBUG_TI81XXUART2_FLAGS | HWMOD_SWSUP_SIDLE_ACT, |
513 | .prcm = { | 513 | .prcm = { |
514 | .omap2 = { | 514 | .omap2 = { |
515 | .module_offs = CORE_MOD, | 515 | .module_offs = CORE_MOD, |
@@ -528,7 +528,8 @@ static struct omap_hwmod omap3xxx_uart3_hwmod = { | |||
528 | .mpu_irqs = omap2_uart3_mpu_irqs, | 528 | .mpu_irqs = omap2_uart3_mpu_irqs, |
529 | .sdma_reqs = omap2_uart3_sdma_reqs, | 529 | .sdma_reqs = omap2_uart3_sdma_reqs, |
530 | .main_clk = "uart3_fck", | 530 | .main_clk = "uart3_fck", |
531 | .flags = HWMOD_SWSUP_SIDLE_ACT, | 531 | .flags = DEBUG_OMAP3UART3_FLAGS | DEBUG_TI81XXUART3_FLAGS | |
532 | HWMOD_SWSUP_SIDLE_ACT, | ||
532 | .prcm = { | 533 | .prcm = { |
533 | .omap2 = { | 534 | .omap2 = { |
534 | .module_offs = OMAP3430_PER_MOD, | 535 | .module_offs = OMAP3430_PER_MOD, |
@@ -558,7 +559,7 @@ static struct omap_hwmod omap36xx_uart4_hwmod = { | |||
558 | .mpu_irqs = uart4_mpu_irqs, | 559 | .mpu_irqs = uart4_mpu_irqs, |
559 | .sdma_reqs = uart4_sdma_reqs, | 560 | .sdma_reqs = uart4_sdma_reqs, |
560 | .main_clk = "uart4_fck", | 561 | .main_clk = "uart4_fck", |
561 | .flags = HWMOD_SWSUP_SIDLE_ACT, | 562 | .flags = DEBUG_OMAP3UART4_FLAGS | HWMOD_SWSUP_SIDLE_ACT, |
562 | .prcm = { | 563 | .prcm = { |
563 | .omap2 = { | 564 | .omap2 = { |
564 | .module_offs = OMAP3430_PER_MOD, | 565 | .module_offs = OMAP3430_PER_MOD, |
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index d04b5e60fdbe..9c3b504477d7 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |||
@@ -2858,8 +2858,7 @@ static struct omap_hwmod omap44xx_uart3_hwmod = { | |||
2858 | .name = "uart3", | 2858 | .name = "uart3", |
2859 | .class = &omap44xx_uart_hwmod_class, | 2859 | .class = &omap44xx_uart_hwmod_class, |
2860 | .clkdm_name = "l4_per_clkdm", | 2860 | .clkdm_name = "l4_per_clkdm", |
2861 | .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET | | 2861 | .flags = DEBUG_OMAP4UART3_FLAGS | HWMOD_SWSUP_SIDLE_ACT, |
2862 | HWMOD_SWSUP_SIDLE_ACT, | ||
2863 | .main_clk = "func_48m_fclk", | 2862 | .main_clk = "func_48m_fclk", |
2864 | .prcm = { | 2863 | .prcm = { |
2865 | .omap4 = { | 2864 | .omap4 = { |
@@ -2875,7 +2874,7 @@ static struct omap_hwmod omap44xx_uart4_hwmod = { | |||
2875 | .name = "uart4", | 2874 | .name = "uart4", |
2876 | .class = &omap44xx_uart_hwmod_class, | 2875 | .class = &omap44xx_uart_hwmod_class, |
2877 | .clkdm_name = "l4_per_clkdm", | 2876 | .clkdm_name = "l4_per_clkdm", |
2878 | .flags = HWMOD_SWSUP_SIDLE_ACT, | 2877 | .flags = DEBUG_OMAP4UART4_FLAGS | HWMOD_SWSUP_SIDLE_ACT, |
2879 | .main_clk = "func_48m_fclk", | 2878 | .main_clk = "func_48m_fclk", |
2880 | .prcm = { | 2879 | .prcm = { |
2881 | .omap4 = { | 2880 | .omap4 = { |
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c index f37ae96b70a1..3c70f5c1860f 100644 --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c | |||
@@ -1375,7 +1375,7 @@ static struct omap_hwmod omap54xx_uart3_hwmod = { | |||
1375 | .name = "uart3", | 1375 | .name = "uart3", |
1376 | .class = &omap54xx_uart_hwmod_class, | 1376 | .class = &omap54xx_uart_hwmod_class, |
1377 | .clkdm_name = "l4per_clkdm", | 1377 | .clkdm_name = "l4per_clkdm", |
1378 | .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, | 1378 | .flags = DEBUG_OMAP4UART3_FLAGS, |
1379 | .main_clk = "func_48m_fclk", | 1379 | .main_clk = "func_48m_fclk", |
1380 | .prcm = { | 1380 | .prcm = { |
1381 | .omap4 = { | 1381 | .omap4 = { |
@@ -1391,6 +1391,7 @@ static struct omap_hwmod omap54xx_uart4_hwmod = { | |||
1391 | .name = "uart4", | 1391 | .name = "uart4", |
1392 | .class = &omap54xx_uart_hwmod_class, | 1392 | .class = &omap54xx_uart_hwmod_class, |
1393 | .clkdm_name = "l4per_clkdm", | 1393 | .clkdm_name = "l4per_clkdm", |
1394 | .flags = DEBUG_OMAP4UART4_FLAGS, | ||
1394 | .main_clk = "func_48m_fclk", | 1395 | .main_clk = "func_48m_fclk", |
1395 | .prcm = { | 1396 | .prcm = { |
1396 | .omap4 = { | 1397 | .omap4 = { |
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 3a674de6cb63..a388f8c1bcb3 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -208,17 +208,6 @@ static int __init omap_serial_early_init(void) | |||
208 | pr_info("%s used as console in debug mode: uart%d clocks will not be gated", | 208 | pr_info("%s used as console in debug mode: uart%d clocks will not be gated", |
209 | uart_name, uart->num); | 209 | uart_name, uart->num); |
210 | } | 210 | } |
211 | |||
212 | /* | ||
213 | * omap-uart can be used for earlyprintk logs | ||
214 | * So if omap-uart is used as console then prevent | ||
215 | * uart reset and idle to get logs from omap-uart | ||
216 | * until uart console driver is available to take | ||
217 | * care for console messages. | ||
218 | * Idling or resetting omap-uart while printing logs | ||
219 | * early boot logs can stall the boot-up. | ||
220 | */ | ||
221 | oh->flags |= HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET; | ||
222 | } | 211 | } |
223 | } while (1); | 212 | } while (1); |
224 | 213 | ||
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c index e115f6742107..c5be60d85e4b 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c | |||
@@ -1162,9 +1162,6 @@ static void __init eva_init(void) | |||
1162 | gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */ | 1162 | gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */ |
1163 | gpio_request_one(202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */ | 1163 | gpio_request_one(202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */ |
1164 | 1164 | ||
1165 | /* Touchscreen */ | ||
1166 | gpio_request_one(166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */ | ||
1167 | |||
1168 | /* GETHER */ | 1165 | /* GETHER */ |
1169 | gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */ | 1166 | gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */ |
1170 | 1167 | ||
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c index d5554646916c..3354a85c90f7 100644 --- a/arch/arm/mach-shmobile/board-bockw.c +++ b/arch/arm/mach-shmobile/board-bockw.c | |||
@@ -167,7 +167,13 @@ static const struct pinctrl_map bockw_pinctrl_map[] = { | |||
167 | "usb1", "usb1"), | 167 | "usb1", "usb1"), |
168 | /* SDHI0 */ | 168 | /* SDHI0 */ |
169 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", | 169 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", |
170 | "sdhi0", "sdhi0"), | 170 | "sdhi0_data4", "sdhi0"), |
171 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", | ||
172 | "sdhi0_ctrl", "sdhi0"), | ||
173 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", | ||
174 | "sdhi0_cd", "sdhi0"), | ||
175 | PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", | ||
176 | "sdhi0_wp", "sdhi0"), | ||
171 | }; | 177 | }; |
172 | 178 | ||
173 | #define FPGA 0x18200000 | 179 | #define FPGA 0x18200000 |
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c index d73e21d3ea8a..8d6bd5c5efb9 100644 --- a/arch/arm/mach-shmobile/board-lager.c +++ b/arch/arm/mach-shmobile/board-lager.c | |||
@@ -59,7 +59,7 @@ static __initdata struct gpio_led_platform_data lager_leds_pdata = { | |||
59 | #define GPIO_KEY(c, g, d, ...) \ | 59 | #define GPIO_KEY(c, g, d, ...) \ |
60 | { .code = c, .gpio = g, .desc = d, .active_low = 1 } | 60 | { .code = c, .gpio = g, .desc = d, .active_low = 1 } |
61 | 61 | ||
62 | static __initdata struct gpio_keys_button gpio_buttons[] = { | 62 | static struct gpio_keys_button gpio_buttons[] = { |
63 | GPIO_KEY(KEY_4, RCAR_GP_PIN(1, 28), "SW2-pin4"), | 63 | GPIO_KEY(KEY_4, RCAR_GP_PIN(1, 28), "SW2-pin4"), |
64 | GPIO_KEY(KEY_3, RCAR_GP_PIN(1, 26), "SW2-pin3"), | 64 | GPIO_KEY(KEY_3, RCAR_GP_PIN(1, 26), "SW2-pin3"), |
65 | GPIO_KEY(KEY_2, RCAR_GP_PIN(1, 24), "SW2-pin2"), | 65 | GPIO_KEY(KEY_2, RCAR_GP_PIN(1, 24), "SW2-pin2"), |
diff --git a/arch/arm/mach-sti/headsmp.S b/arch/arm/mach-sti/headsmp.S index 78ebc7559f53..4c09bae86edf 100644 --- a/arch/arm/mach-sti/headsmp.S +++ b/arch/arm/mach-sti/headsmp.S | |||
@@ -16,8 +16,6 @@ | |||
16 | #include <linux/linkage.h> | 16 | #include <linux/linkage.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | 18 | ||
19 | __INIT | ||
20 | |||
21 | /* | 19 | /* |
22 | * ST specific entry point for secondary CPUs. This provides | 20 | * ST specific entry point for secondary CPUs. This provides |
23 | * a "holding pen" into which all secondary cores are held until we're | 21 | * a "holding pen" into which all secondary cores are held until we're |
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index 6cacdc8dd654..db5c2cab8fda 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig | |||
@@ -421,24 +421,28 @@ config CPU_32v3 | |||
421 | select CPU_USE_DOMAINS if MMU | 421 | select CPU_USE_DOMAINS if MMU |
422 | select NEEDS_SYSCALL_FOR_CMPXCHG if SMP | 422 | select NEEDS_SYSCALL_FOR_CMPXCHG if SMP |
423 | select TLS_REG_EMUL if SMP || !MMU | 423 | select TLS_REG_EMUL if SMP || !MMU |
424 | select NEED_KUSER_HELPERS | ||
424 | 425 | ||
425 | config CPU_32v4 | 426 | config CPU_32v4 |
426 | bool | 427 | bool |
427 | select CPU_USE_DOMAINS if MMU | 428 | select CPU_USE_DOMAINS if MMU |
428 | select NEEDS_SYSCALL_FOR_CMPXCHG if SMP | 429 | select NEEDS_SYSCALL_FOR_CMPXCHG if SMP |
429 | select TLS_REG_EMUL if SMP || !MMU | 430 | select TLS_REG_EMUL if SMP || !MMU |
431 | select NEED_KUSER_HELPERS | ||
430 | 432 | ||
431 | config CPU_32v4T | 433 | config CPU_32v4T |
432 | bool | 434 | bool |
433 | select CPU_USE_DOMAINS if MMU | 435 | select CPU_USE_DOMAINS if MMU |
434 | select NEEDS_SYSCALL_FOR_CMPXCHG if SMP | 436 | select NEEDS_SYSCALL_FOR_CMPXCHG if SMP |
435 | select TLS_REG_EMUL if SMP || !MMU | 437 | select TLS_REG_EMUL if SMP || !MMU |
438 | select NEED_KUSER_HELPERS | ||
436 | 439 | ||
437 | config CPU_32v5 | 440 | config CPU_32v5 |
438 | bool | 441 | bool |
439 | select CPU_USE_DOMAINS if MMU | 442 | select CPU_USE_DOMAINS if MMU |
440 | select NEEDS_SYSCALL_FOR_CMPXCHG if SMP | 443 | select NEEDS_SYSCALL_FOR_CMPXCHG if SMP |
441 | select TLS_REG_EMUL if SMP || !MMU | 444 | select TLS_REG_EMUL if SMP || !MMU |
445 | select NEED_KUSER_HELPERS | ||
442 | 446 | ||
443 | config CPU_32v6 | 447 | config CPU_32v6 |
444 | bool | 448 | bool |
@@ -776,6 +780,7 @@ config CPU_BPREDICT_DISABLE | |||
776 | 780 | ||
777 | config TLS_REG_EMUL | 781 | config TLS_REG_EMUL |
778 | bool | 782 | bool |
783 | select NEED_KUSER_HELPERS | ||
779 | help | 784 | help |
780 | An SMP system using a pre-ARMv6 processor (there are apparently | 785 | An SMP system using a pre-ARMv6 processor (there are apparently |
781 | a few prototypes like that in existence) and therefore access to | 786 | a few prototypes like that in existence) and therefore access to |
@@ -783,11 +788,40 @@ config TLS_REG_EMUL | |||
783 | 788 | ||
784 | config NEEDS_SYSCALL_FOR_CMPXCHG | 789 | config NEEDS_SYSCALL_FOR_CMPXCHG |
785 | bool | 790 | bool |
791 | select NEED_KUSER_HELPERS | ||
786 | help | 792 | help |
787 | SMP on a pre-ARMv6 processor? Well OK then. | 793 | SMP on a pre-ARMv6 processor? Well OK then. |
788 | Forget about fast user space cmpxchg support. | 794 | Forget about fast user space cmpxchg support. |
789 | It is just not possible. | 795 | It is just not possible. |
790 | 796 | ||
797 | config NEED_KUSER_HELPERS | ||
798 | bool | ||
799 | |||
800 | config KUSER_HELPERS | ||
801 | bool "Enable kuser helpers in vector page" if !NEED_KUSER_HELPERS | ||
802 | default y | ||
803 | help | ||
804 | Warning: disabling this option may break user programs. | ||
805 | |||
806 | Provide kuser helpers in the vector page. The kernel provides | ||
807 | helper code to userspace in read only form at a fixed location | ||
808 | in the high vector page to allow userspace to be independent of | ||
809 | the CPU type fitted to the system. This permits binaries to be | ||
810 | run on ARMv4 through to ARMv7 without modification. | ||
811 | |||
812 | However, the fixed address nature of these helpers can be used | ||
813 | by ROP (return orientated programming) authors when creating | ||
814 | exploits. | ||
815 | |||
816 | If all of the binaries and libraries which run on your platform | ||
817 | are built specifically for your platform, and make no use of | ||
818 | these helpers, then you can turn this option off. However, | ||
819 | when such an binary or library is run, it will receive a SIGILL | ||
820 | signal, which will terminate the program. | ||
821 | |||
822 | Say N here only if you are absolutely certain that you do not | ||
823 | need these helpers; otherwise, the safe option is to say Y. | ||
824 | |||
791 | config DMA_CACHE_RWFO | 825 | config DMA_CACHE_RWFO |
792 | bool "Enable read/write for ownership DMA cache maintenance" | 826 | bool "Enable read/write for ownership DMA cache maintenance" |
793 | depends on CPU_V6K && SMP | 827 | depends on CPU_V6K && SMP |
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c index b55b1015724b..4a0544492f10 100644 --- a/arch/arm/mm/context.c +++ b/arch/arm/mm/context.c | |||
@@ -245,7 +245,8 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) | |||
245 | if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) { | 245 | if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) { |
246 | local_flush_bp_all(); | 246 | local_flush_bp_all(); |
247 | local_flush_tlb_all(); | 247 | local_flush_tlb_all(); |
248 | dummy_flush_tlb_a15_erratum(); | 248 | if (erratum_a15_798181()) |
249 | dummy_flush_tlb_a15_erratum(); | ||
249 | } | 250 | } |
250 | 251 | ||
251 | atomic64_set(&per_cpu(active_asids, cpu), asid); | 252 | atomic64_set(&per_cpu(active_asids, cpu), asid); |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 4f56617a2392..53cdbd39ec8e 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -989,6 +989,7 @@ phys_addr_t arm_lowmem_limit __initdata = 0; | |||
989 | 989 | ||
990 | void __init sanity_check_meminfo(void) | 990 | void __init sanity_check_meminfo(void) |
991 | { | 991 | { |
992 | phys_addr_t memblock_limit = 0; | ||
992 | int i, j, highmem = 0; | 993 | int i, j, highmem = 0; |
993 | phys_addr_t vmalloc_limit = __pa(vmalloc_min - 1) + 1; | 994 | phys_addr_t vmalloc_limit = __pa(vmalloc_min - 1) + 1; |
994 | 995 | ||
@@ -1052,9 +1053,32 @@ void __init sanity_check_meminfo(void) | |||
1052 | bank->size = size_limit; | 1053 | bank->size = size_limit; |
1053 | } | 1054 | } |
1054 | #endif | 1055 | #endif |
1055 | if (!bank->highmem && bank->start + bank->size > arm_lowmem_limit) | 1056 | if (!bank->highmem) { |
1056 | arm_lowmem_limit = bank->start + bank->size; | 1057 | phys_addr_t bank_end = bank->start + bank->size; |
1057 | 1058 | ||
1059 | if (bank_end > arm_lowmem_limit) | ||
1060 | arm_lowmem_limit = bank_end; | ||
1061 | |||
1062 | /* | ||
1063 | * Find the first non-section-aligned page, and point | ||
1064 | * memblock_limit at it. This relies on rounding the | ||
1065 | * limit down to be section-aligned, which happens at | ||
1066 | * the end of this function. | ||
1067 | * | ||
1068 | * With this algorithm, the start or end of almost any | ||
1069 | * bank can be non-section-aligned. The only exception | ||
1070 | * is that the start of the bank 0 must be section- | ||
1071 | * aligned, since otherwise memory would need to be | ||
1072 | * allocated when mapping the start of bank 0, which | ||
1073 | * occurs before any free memory is mapped. | ||
1074 | */ | ||
1075 | if (!memblock_limit) { | ||
1076 | if (!IS_ALIGNED(bank->start, SECTION_SIZE)) | ||
1077 | memblock_limit = bank->start; | ||
1078 | else if (!IS_ALIGNED(bank_end, SECTION_SIZE)) | ||
1079 | memblock_limit = bank_end; | ||
1080 | } | ||
1081 | } | ||
1058 | j++; | 1082 | j++; |
1059 | } | 1083 | } |
1060 | #ifdef CONFIG_HIGHMEM | 1084 | #ifdef CONFIG_HIGHMEM |
@@ -1079,7 +1103,18 @@ void __init sanity_check_meminfo(void) | |||
1079 | #endif | 1103 | #endif |
1080 | meminfo.nr_banks = j; | 1104 | meminfo.nr_banks = j; |
1081 | high_memory = __va(arm_lowmem_limit - 1) + 1; | 1105 | high_memory = __va(arm_lowmem_limit - 1) + 1; |
1082 | memblock_set_current_limit(arm_lowmem_limit); | 1106 | |
1107 | /* | ||
1108 | * Round the memblock limit down to a section size. This | ||
1109 | * helps to ensure that we will allocate memory from the | ||
1110 | * last full section, which should be mapped. | ||
1111 | */ | ||
1112 | if (memblock_limit) | ||
1113 | memblock_limit = round_down(memblock_limit, SECTION_SIZE); | ||
1114 | if (!memblock_limit) | ||
1115 | memblock_limit = arm_lowmem_limit; | ||
1116 | |||
1117 | memblock_set_current_limit(memblock_limit); | ||
1083 | } | 1118 | } |
1084 | 1119 | ||
1085 | static inline void prepare_page_table(void) | 1120 | static inline void prepare_page_table(void) |
@@ -1160,7 +1195,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc) | |||
1160 | /* | 1195 | /* |
1161 | * Allocate the vector page early. | 1196 | * Allocate the vector page early. |
1162 | */ | 1197 | */ |
1163 | vectors = early_alloc(PAGE_SIZE); | 1198 | vectors = early_alloc(PAGE_SIZE * 2); |
1164 | 1199 | ||
1165 | early_trap_init(vectors); | 1200 | early_trap_init(vectors); |
1166 | 1201 | ||
@@ -1205,15 +1240,27 @@ static void __init devicemaps_init(struct machine_desc *mdesc) | |||
1205 | map.pfn = __phys_to_pfn(virt_to_phys(vectors)); | 1240 | map.pfn = __phys_to_pfn(virt_to_phys(vectors)); |
1206 | map.virtual = 0xffff0000; | 1241 | map.virtual = 0xffff0000; |
1207 | map.length = PAGE_SIZE; | 1242 | map.length = PAGE_SIZE; |
1243 | #ifdef CONFIG_KUSER_HELPERS | ||
1208 | map.type = MT_HIGH_VECTORS; | 1244 | map.type = MT_HIGH_VECTORS; |
1245 | #else | ||
1246 | map.type = MT_LOW_VECTORS; | ||
1247 | #endif | ||
1209 | create_mapping(&map); | 1248 | create_mapping(&map); |
1210 | 1249 | ||
1211 | if (!vectors_high()) { | 1250 | if (!vectors_high()) { |
1212 | map.virtual = 0; | 1251 | map.virtual = 0; |
1252 | map.length = PAGE_SIZE * 2; | ||
1213 | map.type = MT_LOW_VECTORS; | 1253 | map.type = MT_LOW_VECTORS; |
1214 | create_mapping(&map); | 1254 | create_mapping(&map); |
1215 | } | 1255 | } |
1216 | 1256 | ||
1257 | /* Now create a kernel read-only mapping */ | ||
1258 | map.pfn += 1; | ||
1259 | map.virtual = 0xffff0000 + PAGE_SIZE; | ||
1260 | map.length = PAGE_SIZE; | ||
1261 | map.type = MT_LOW_VECTORS; | ||
1262 | create_mapping(&map); | ||
1263 | |||
1217 | /* | 1264 | /* |
1218 | * Ask the machine support to map in the statically mapped devices. | 1265 | * Ask the machine support to map in the statically mapped devices. |
1219 | */ | 1266 | */ |
@@ -1276,8 +1323,6 @@ void __init paging_init(struct machine_desc *mdesc) | |||
1276 | { | 1323 | { |
1277 | void *zero_page; | 1324 | void *zero_page; |
1278 | 1325 | ||
1279 | memblock_set_current_limit(arm_lowmem_limit); | ||
1280 | |||
1281 | build_mem_type_table(); | 1326 | build_mem_type_table(); |
1282 | prepare_page_table(); | 1327 | prepare_page_table(); |
1283 | map_lowmem(); | 1328 | map_lowmem(); |
diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S index f64afb9f1bd5..bdd3be4be77a 100644 --- a/arch/arm/mm/proc-v7-2level.S +++ b/arch/arm/mm/proc-v7-2level.S | |||
@@ -110,7 +110,7 @@ ENTRY(cpu_v7_set_pte_ext) | |||
110 | ARM( str r3, [r0, #2048]! ) | 110 | ARM( str r3, [r0, #2048]! ) |
111 | THUMB( add r0, r0, #2048 ) | 111 | THUMB( add r0, r0, #2048 ) |
112 | THUMB( str r3, [r0] ) | 112 | THUMB( str r3, [r0] ) |
113 | ALT_SMP(mov pc,lr) | 113 | ALT_SMP(W(nop)) |
114 | ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte | 114 | ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte |
115 | #endif | 115 | #endif |
116 | mov pc, lr | 116 | mov pc, lr |
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S index c36ac69488c8..01a719e18bb0 100644 --- a/arch/arm/mm/proc-v7-3level.S +++ b/arch/arm/mm/proc-v7-3level.S | |||
@@ -81,7 +81,7 @@ ENTRY(cpu_v7_set_pte_ext) | |||
81 | tst r3, #1 << (55 - 32) @ L_PTE_DIRTY | 81 | tst r3, #1 << (55 - 32) @ L_PTE_DIRTY |
82 | orreq r2, #L_PTE_RDONLY | 82 | orreq r2, #L_PTE_RDONLY |
83 | 1: strd r2, r3, [r0] | 83 | 1: strd r2, r3, [r0] |
84 | ALT_SMP(mov pc, lr) | 84 | ALT_SMP(W(nop)) |
85 | ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte | 85 | ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte |
86 | #endif | 86 | #endif |
87 | mov pc, lr | 87 | mov pc, lr |
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index 5c6d5a3050ea..73398bcf9bd8 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
@@ -75,13 +75,14 @@ ENTRY(cpu_v7_do_idle) | |||
75 | ENDPROC(cpu_v7_do_idle) | 75 | ENDPROC(cpu_v7_do_idle) |
76 | 76 | ||
77 | ENTRY(cpu_v7_dcache_clean_area) | 77 | ENTRY(cpu_v7_dcache_clean_area) |
78 | ALT_SMP(mov pc, lr) @ MP extensions imply L1 PTW | 78 | ALT_SMP(W(nop)) @ MP extensions imply L1 PTW |
79 | ALT_UP(W(nop)) | 79 | ALT_UP_B(1f) |
80 | dcache_line_size r2, r3 | 80 | mov pc, lr |
81 | 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry | 81 | 1: dcache_line_size r2, r3 |
82 | 2: mcr p15, 0, r0, c7, c10, 1 @ clean D entry | ||
82 | add r0, r0, r2 | 83 | add r0, r0, r2 |
83 | subs r1, r1, r2 | 84 | subs r1, r1, r2 |
84 | bhi 1b | 85 | bhi 2b |
85 | dsb | 86 | dsb |
86 | mov pc, lr | 87 | mov pc, lr |
87 | ENDPROC(cpu_v7_dcache_clean_area) | 88 | ENDPROC(cpu_v7_dcache_clean_area) |
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index f71c37edca26..c9770ba5c7df 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c | |||
@@ -172,7 +172,7 @@ static void __init xen_percpu_init(void *unused) | |||
172 | enable_percpu_irq(xen_events_irq, 0); | 172 | enable_percpu_irq(xen_events_irq, 0); |
173 | } | 173 | } |
174 | 174 | ||
175 | static void xen_restart(char str, const char *cmd) | 175 | static void xen_restart(enum reboot_mode reboot_mode, const char *cmd) |
176 | { | 176 | { |
177 | struct sched_shutdown r = { .reason = SHUTDOWN_reboot }; | 177 | struct sched_shutdown r = { .reason = SHUTDOWN_reboot }; |
178 | int rc; | 178 | int rc; |
diff --git a/arch/avr32/boards/atngw100/mrmt.c b/arch/avr32/boards/atngw100/mrmt.c index f91431963452..7de083d19b7e 100644 --- a/arch/avr32/boards/atngw100/mrmt.c +++ b/arch/avr32/boards/atngw100/mrmt.c | |||
@@ -150,7 +150,6 @@ static struct ac97c_platform_data __initdata ac97c0_data = { | |||
150 | static struct platform_device rmt_ts_device = { | 150 | static struct platform_device rmt_ts_device = { |
151 | .name = "ucb1400_ts", | 151 | .name = "ucb1400_ts", |
152 | .id = -1, | 152 | .id = -1, |
153 | } | ||
154 | }; | 153 | }; |
155 | #endif | 154 | #endif |
156 | 155 | ||
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig index 7913695b2fcb..efbd2929aeb7 100644 --- a/arch/ia64/configs/generic_defconfig +++ b/arch/ia64/configs/generic_defconfig | |||
@@ -31,7 +31,7 @@ CONFIG_ACPI_FAN=m | |||
31 | CONFIG_ACPI_DOCK=y | 31 | CONFIG_ACPI_DOCK=y |
32 | CONFIG_ACPI_PROCESSOR=m | 32 | CONFIG_ACPI_PROCESSOR=m |
33 | CONFIG_ACPI_CONTAINER=m | 33 | CONFIG_ACPI_CONTAINER=m |
34 | CONFIG_HOTPLUG_PCI=m | 34 | CONFIG_HOTPLUG_PCI=y |
35 | CONFIG_HOTPLUG_PCI_ACPI=m | 35 | CONFIG_HOTPLUG_PCI_ACPI=m |
36 | CONFIG_PACKET=y | 36 | CONFIG_PACKET=y |
37 | CONFIG_UNIX=y | 37 | CONFIG_UNIX=y |
diff --git a/arch/ia64/configs/gensparse_defconfig b/arch/ia64/configs/gensparse_defconfig index f8e913365423..f64980dd20c3 100644 --- a/arch/ia64/configs/gensparse_defconfig +++ b/arch/ia64/configs/gensparse_defconfig | |||
@@ -25,7 +25,7 @@ CONFIG_ACPI_BUTTON=m | |||
25 | CONFIG_ACPI_FAN=m | 25 | CONFIG_ACPI_FAN=m |
26 | CONFIG_ACPI_PROCESSOR=m | 26 | CONFIG_ACPI_PROCESSOR=m |
27 | CONFIG_ACPI_CONTAINER=m | 27 | CONFIG_ACPI_CONTAINER=m |
28 | CONFIG_HOTPLUG_PCI=m | 28 | CONFIG_HOTPLUG_PCI=y |
29 | CONFIG_HOTPLUG_PCI_ACPI=m | 29 | CONFIG_HOTPLUG_PCI_ACPI=m |
30 | CONFIG_PACKET=y | 30 | CONFIG_PACKET=y |
31 | CONFIG_UNIX=y | 31 | CONFIG_UNIX=y |
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig index a5a9e02e60a0..0f4e9e41f130 100644 --- a/arch/ia64/configs/tiger_defconfig +++ b/arch/ia64/configs/tiger_defconfig | |||
@@ -31,7 +31,7 @@ CONFIG_ACPI_BUTTON=m | |||
31 | CONFIG_ACPI_FAN=m | 31 | CONFIG_ACPI_FAN=m |
32 | CONFIG_ACPI_PROCESSOR=m | 32 | CONFIG_ACPI_PROCESSOR=m |
33 | CONFIG_ACPI_CONTAINER=m | 33 | CONFIG_ACPI_CONTAINER=m |
34 | CONFIG_HOTPLUG_PCI=m | 34 | CONFIG_HOTPLUG_PCI=y |
35 | CONFIG_HOTPLUG_PCI_ACPI=m | 35 | CONFIG_HOTPLUG_PCI_ACPI=m |
36 | CONFIG_PACKET=y | 36 | CONFIG_PACKET=y |
37 | CONFIG_UNIX=y | 37 | CONFIG_UNIX=y |
diff --git a/arch/ia64/configs/xen_domu_defconfig b/arch/ia64/configs/xen_domu_defconfig index 37b9b422caad..b025acfde5c1 100644 --- a/arch/ia64/configs/xen_domu_defconfig +++ b/arch/ia64/configs/xen_domu_defconfig | |||
@@ -32,7 +32,7 @@ CONFIG_ACPI_BUTTON=m | |||
32 | CONFIG_ACPI_FAN=m | 32 | CONFIG_ACPI_FAN=m |
33 | CONFIG_ACPI_PROCESSOR=m | 33 | CONFIG_ACPI_PROCESSOR=m |
34 | CONFIG_ACPI_CONTAINER=m | 34 | CONFIG_ACPI_CONTAINER=m |
35 | CONFIG_HOTPLUG_PCI=m | 35 | CONFIG_HOTPLUG_PCI=y |
36 | CONFIG_HOTPLUG_PCI_ACPI=m | 36 | CONFIG_HOTPLUG_PCI_ACPI=m |
37 | CONFIG_PACKET=y | 37 | CONFIG_PACKET=y |
38 | CONFIG_UNIX=y | 38 | CONFIG_UNIX=y |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index c3abed332301..e12764c2a9d0 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -114,6 +114,7 @@ config BCM47XX | |||
114 | select FW_CFE | 114 | select FW_CFE |
115 | select HW_HAS_PCI | 115 | select HW_HAS_PCI |
116 | select IRQ_CPU | 116 | select IRQ_CPU |
117 | select SYS_HAS_CPU_MIPS32_R1 | ||
117 | select NO_EXCEPT_FILL | 118 | select NO_EXCEPT_FILL |
118 | select SYS_SUPPORTS_32BIT_KERNEL | 119 | select SYS_SUPPORTS_32BIT_KERNEL |
119 | select SYS_SUPPORTS_LITTLE_ENDIAN | 120 | select SYS_SUPPORTS_LITTLE_ENDIAN |
diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig index ba611927749b..2b8b118398c4 100644 --- a/arch/mips/bcm47xx/Kconfig +++ b/arch/mips/bcm47xx/Kconfig | |||
@@ -2,7 +2,6 @@ if BCM47XX | |||
2 | 2 | ||
3 | config BCM47XX_SSB | 3 | config BCM47XX_SSB |
4 | bool "SSB Support for Broadcom BCM47XX" | 4 | bool "SSB Support for Broadcom BCM47XX" |
5 | select SYS_HAS_CPU_MIPS32_R1 | ||
6 | select SSB | 5 | select SSB |
7 | select SSB_DRIVER_MIPS | 6 | select SSB_DRIVER_MIPS |
8 | select SSB_DRIVER_EXTIF | 7 | select SSB_DRIVER_EXTIF |
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h index 1dc086087a72..fa44f3ec5302 100644 --- a/arch/mips/include/asm/cpu-features.h +++ b/arch/mips/include/asm/cpu-features.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #define current_cpu_type() current_cpu_data.cputype | 17 | #define current_cpu_type() current_cpu_data.cputype |
18 | #endif | 18 | #endif |
19 | 19 | ||
20 | #define boot_cpu_type() cpu_data[0].cputype | ||
21 | |||
20 | /* | 22 | /* |
21 | * SMP assumption: Options of CPU 0 are a superset of all processors. | 23 | * SMP assumption: Options of CPU 0 are a superset of all processors. |
22 | * This is true for all known MIPS systems. | 24 | * This is true for all known MIPS systems. |
diff --git a/arch/mips/include/asm/mach-generic/spaces.h b/arch/mips/include/asm/mach-generic/spaces.h index 5b2f2e68e57f..9488fa5f8866 100644 --- a/arch/mips/include/asm/mach-generic/spaces.h +++ b/arch/mips/include/asm/mach-generic/spaces.h | |||
@@ -25,8 +25,12 @@ | |||
25 | #else | 25 | #else |
26 | #define CAC_BASE _AC(0x80000000, UL) | 26 | #define CAC_BASE _AC(0x80000000, UL) |
27 | #endif | 27 | #endif |
28 | #ifndef IO_BASE | ||
28 | #define IO_BASE _AC(0xa0000000, UL) | 29 | #define IO_BASE _AC(0xa0000000, UL) |
30 | #endif | ||
31 | #ifndef UNCAC_BASE | ||
29 | #define UNCAC_BASE _AC(0xa0000000, UL) | 32 | #define UNCAC_BASE _AC(0xa0000000, UL) |
33 | #endif | ||
30 | 34 | ||
31 | #ifndef MAP_BASE | 35 | #ifndef MAP_BASE |
32 | #ifdef CONFIG_KVM_GUEST | 36 | #ifdef CONFIG_KVM_GUEST |
diff --git a/arch/mips/include/uapi/asm/siginfo.h b/arch/mips/include/uapi/asm/siginfo.h index b7a23064841f..88e292b7719e 100644 --- a/arch/mips/include/uapi/asm/siginfo.h +++ b/arch/mips/include/uapi/asm/siginfo.h | |||
@@ -25,11 +25,12 @@ struct siginfo; | |||
25 | /* | 25 | /* |
26 | * Careful to keep union _sifields from shifting ... | 26 | * Careful to keep union _sifields from shifting ... |
27 | */ | 27 | */ |
28 | #if __SIZEOF_LONG__ == 4 | 28 | #if _MIPS_SZLONG == 32 |
29 | #define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int)) | 29 | #define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int)) |
30 | #endif | 30 | #elif _MIPS_SZLONG == 64 |
31 | #if __SIZEOF_LONG__ == 8 | ||
32 | #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) | 31 | #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) |
32 | #else | ||
33 | #error _MIPS_SZLONG neither 32 nor 64 | ||
33 | #endif | 34 | #endif |
34 | 35 | ||
35 | #include <asm-generic/siginfo.h> | 36 | #include <asm-generic/siginfo.h> |
diff --git a/arch/mips/kernel/bmips_vec.S b/arch/mips/kernel/bmips_vec.S index f739aedcb509..bd79c4f9bff4 100644 --- a/arch/mips/kernel/bmips_vec.S +++ b/arch/mips/kernel/bmips_vec.S | |||
@@ -54,7 +54,11 @@ LEAF(bmips_smp_movevec) | |||
54 | /* set up CPU1 CBR; move BASE to 0xa000_0000 */ | 54 | /* set up CPU1 CBR; move BASE to 0xa000_0000 */ |
55 | li k0, 0xff400000 | 55 | li k0, 0xff400000 |
56 | mtc0 k0, $22, 6 | 56 | mtc0 k0, $22, 6 |
57 | li k1, CKSEG1 | BMIPS_RELO_VECTOR_CONTROL_1 | 57 | /* set up relocation vector address based on thread ID */ |
58 | mfc0 k1, $22, 3 | ||
59 | srl k1, 16 | ||
60 | andi k1, 0x8000 | ||
61 | or k1, CKSEG1 | BMIPS_RELO_VECTOR_CONTROL_0 | ||
58 | or k0, k1 | 62 | or k0, k1 |
59 | li k1, 0xa0080000 | 63 | li k1, 0xa0080000 |
60 | sw k1, 0(k0) | 64 | sw k1, 0(k0) |
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c index c0bb4d59076a..126da74d4c55 100644 --- a/arch/mips/kernel/smp-bmips.c +++ b/arch/mips/kernel/smp-bmips.c | |||
@@ -66,6 +66,8 @@ static void __init bmips_smp_setup(void) | |||
66 | int i, cpu = 1, boot_cpu = 0; | 66 | int i, cpu = 1, boot_cpu = 0; |
67 | 67 | ||
68 | #if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) | 68 | #if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) |
69 | int cpu_hw_intr; | ||
70 | |||
69 | /* arbitration priority */ | 71 | /* arbitration priority */ |
70 | clear_c0_brcm_cmt_ctrl(0x30); | 72 | clear_c0_brcm_cmt_ctrl(0x30); |
71 | 73 | ||
@@ -79,15 +81,13 @@ static void __init bmips_smp_setup(void) | |||
79 | * MIPS interrupts 0,1 (SW INT 0,1) cross over to the other thread | 81 | * MIPS interrupts 0,1 (SW INT 0,1) cross over to the other thread |
80 | * MIPS interrupt 2 (HW INT 0) is the CPU0 L1 controller output | 82 | * MIPS interrupt 2 (HW INT 0) is the CPU0 L1 controller output |
81 | * MIPS interrupt 3 (HW INT 1) is the CPU1 L1 controller output | 83 | * MIPS interrupt 3 (HW INT 1) is the CPU1 L1 controller output |
82 | * | ||
83 | * If booting from TP1, leave the existing CMT interrupt routing | ||
84 | * such that TP0 responds to SW1 and TP1 responds to SW0. | ||
85 | */ | 84 | */ |
86 | if (boot_cpu == 0) | 85 | if (boot_cpu == 0) |
87 | change_c0_brcm_cmt_intr(0xf8018000, | 86 | cpu_hw_intr = 0x02; |
88 | (0x02 << 27) | (0x03 << 15)); | ||
89 | else | 87 | else |
90 | change_c0_brcm_cmt_intr(0xf8018000, (0x1d << 27)); | 88 | cpu_hw_intr = 0x1d; |
89 | |||
90 | change_c0_brcm_cmt_intr(0xf8018000, (cpu_hw_intr << 27) | (0x03 << 15)); | ||
91 | 91 | ||
92 | /* single core, 2 threads (2 pipelines) */ | 92 | /* single core, 2 threads (2 pipelines) */ |
93 | max_cpus = 2; | 93 | max_cpus = 2; |
@@ -202,9 +202,15 @@ static void bmips_init_secondary(void) | |||
202 | #if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) | 202 | #if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) |
203 | void __iomem *cbr = BMIPS_GET_CBR(); | 203 | void __iomem *cbr = BMIPS_GET_CBR(); |
204 | unsigned long old_vec; | 204 | unsigned long old_vec; |
205 | unsigned long relo_vector; | ||
206 | int boot_cpu; | ||
207 | |||
208 | boot_cpu = !!(read_c0_brcm_cmt_local() & (1 << 31)); | ||
209 | relo_vector = boot_cpu ? BMIPS_RELO_VECTOR_CONTROL_0 : | ||
210 | BMIPS_RELO_VECTOR_CONTROL_1; | ||
205 | 211 | ||
206 | old_vec = __raw_readl(cbr + BMIPS_RELO_VECTOR_CONTROL_1); | 212 | old_vec = __raw_readl(cbr + relo_vector); |
207 | __raw_writel(old_vec & ~0x20000000, cbr + BMIPS_RELO_VECTOR_CONTROL_1); | 213 | __raw_writel(old_vec & ~0x20000000, cbr + relo_vector); |
208 | 214 | ||
209 | clear_c0_cause(smp_processor_id() ? C_SW1 : C_SW0); | 215 | clear_c0_cause(smp_processor_id() ? C_SW1 : C_SW0); |
210 | #elif defined(CONFIG_CPU_BMIPS5000) | 216 | #elif defined(CONFIG_CPU_BMIPS5000) |
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c index e4b1140cdae0..3a2b6e9f25cf 100644 --- a/arch/mips/oprofile/op_model_mipsxx.c +++ b/arch/mips/oprofile/op_model_mipsxx.c | |||
@@ -166,7 +166,7 @@ static void mipsxx_reg_setup(struct op_counter_config *ctr) | |||
166 | reg.control[i] |= M_PERFCTL_USER; | 166 | reg.control[i] |= M_PERFCTL_USER; |
167 | if (ctr[i].exl) | 167 | if (ctr[i].exl) |
168 | reg.control[i] |= M_PERFCTL_EXL; | 168 | reg.control[i] |= M_PERFCTL_EXL; |
169 | if (current_cpu_type() == CPU_XLR) | 169 | if (boot_cpu_type() == CPU_XLR) |
170 | reg.control[i] |= M_PERFCTL_COUNT_ALL_THREADS; | 170 | reg.control[i] |= M_PERFCTL_COUNT_ALL_THREADS; |
171 | reg.counter[i] = 0x80000000 - ctr[i].count; | 171 | reg.counter[i] = 0x80000000 - ctr[i].count; |
172 | } | 172 | } |
diff --git a/arch/mips/pnx833x/common/platform.c b/arch/mips/pnx833x/common/platform.c index d22dc0d6f289..2b7e837dc2e2 100644 --- a/arch/mips/pnx833x/common/platform.c +++ b/arch/mips/pnx833x/common/platform.c | |||
@@ -206,11 +206,13 @@ static struct resource pnx833x_ethernet_resources[] = { | |||
206 | .end = PNX8335_IP3902_PORTS_END, | 206 | .end = PNX8335_IP3902_PORTS_END, |
207 | .flags = IORESOURCE_MEM, | 207 | .flags = IORESOURCE_MEM, |
208 | }, | 208 | }, |
209 | #ifdef CONFIG_SOC_PNX8335 | ||
209 | [1] = { | 210 | [1] = { |
210 | .start = PNX8335_PIC_ETHERNET_INT, | 211 | .start = PNX8335_PIC_ETHERNET_INT, |
211 | .end = PNX8335_PIC_ETHERNET_INT, | 212 | .end = PNX8335_PIC_ETHERNET_INT, |
212 | .flags = IORESOURCE_IRQ, | 213 | .flags = IORESOURCE_IRQ, |
213 | }, | 214 | }, |
215 | #endif | ||
214 | }; | 216 | }; |
215 | 217 | ||
216 | static struct platform_device pnx833x_ethernet_device = { | 218 | static struct platform_device pnx833x_ethernet_device = { |
diff --git a/arch/mips/powertv/asic/asic_devices.c b/arch/mips/powertv/asic/asic_devices.c index 9f64c2387808..0238af1ba503 100644 --- a/arch/mips/powertv/asic/asic_devices.c +++ b/arch/mips/powertv/asic/asic_devices.c | |||
@@ -529,8 +529,7 @@ EXPORT_SYMBOL(asic_resource_get); | |||
529 | */ | 529 | */ |
530 | void platform_release_memory(void *ptr, int size) | 530 | void platform_release_memory(void *ptr, int size) |
531 | { | 531 | { |
532 | free_reserved_area((unsigned long)ptr, (unsigned long)(ptr + size), | 532 | free_reserved_area(ptr, ptr + size, -1, NULL); |
533 | -1, NULL); | ||
534 | } | 533 | } |
535 | EXPORT_SYMBOL(platform_release_memory); | 534 | EXPORT_SYMBOL(platform_release_memory); |
536 | 535 | ||
diff --git a/arch/parisc/configs/c8000_defconfig b/arch/parisc/configs/c8000_defconfig new file mode 100644 index 000000000000..f11006361297 --- /dev/null +++ b/arch/parisc/configs/c8000_defconfig | |||
@@ -0,0 +1,279 @@ | |||
1 | # CONFIG_LOCALVERSION_AUTO is not set | ||
2 | CONFIG_SYSVIPC=y | ||
3 | CONFIG_POSIX_MQUEUE=y | ||
4 | CONFIG_FHANDLE=y | ||
5 | CONFIG_BSD_PROCESS_ACCT=y | ||
6 | CONFIG_BSD_PROCESS_ACCT_V3=y | ||
7 | CONFIG_IKCONFIG=y | ||
8 | CONFIG_IKCONFIG_PROC=y | ||
9 | CONFIG_RELAY=y | ||
10 | CONFIG_BLK_DEV_INITRD=y | ||
11 | CONFIG_RD_BZIP2=y | ||
12 | CONFIG_RD_LZMA=y | ||
13 | CONFIG_RD_LZO=y | ||
14 | CONFIG_EXPERT=y | ||
15 | CONFIG_SYSCTL_SYSCALL=y | ||
16 | CONFIG_SLAB=y | ||
17 | CONFIG_MODULES=y | ||
18 | CONFIG_MODULE_UNLOAD=y | ||
19 | CONFIG_MODULE_FORCE_UNLOAD=y | ||
20 | CONFIG_MODVERSIONS=y | ||
21 | CONFIG_BLK_DEV_INTEGRITY=y | ||
22 | CONFIG_PA8X00=y | ||
23 | CONFIG_MLONGCALLS=y | ||
24 | CONFIG_64BIT=y | ||
25 | CONFIG_SMP=y | ||
26 | CONFIG_PREEMPT=y | ||
27 | # CONFIG_CROSS_MEMORY_ATTACH is not set | ||
28 | CONFIG_IOMMU_CCIO=y | ||
29 | CONFIG_PCI=y | ||
30 | CONFIG_PCI_LBA=y | ||
31 | # CONFIG_SUPERIO is not set | ||
32 | # CONFIG_CHASSIS_LCD_LED is not set | ||
33 | # CONFIG_PDC_CHASSIS is not set | ||
34 | # CONFIG_PDC_CHASSIS_WARN is not set | ||
35 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | ||
36 | CONFIG_BINFMT_MISC=m | ||
37 | CONFIG_PACKET=y | ||
38 | CONFIG_UNIX=y | ||
39 | CONFIG_XFRM_USER=m | ||
40 | CONFIG_XFRM_SUB_POLICY=y | ||
41 | CONFIG_NET_KEY=m | ||
42 | CONFIG_INET=y | ||
43 | CONFIG_IP_MULTICAST=y | ||
44 | CONFIG_IP_PNP=y | ||
45 | CONFIG_IP_PNP_DHCP=y | ||
46 | CONFIG_IP_PNP_BOOTP=y | ||
47 | CONFIG_IP_PNP_RARP=y | ||
48 | CONFIG_NET_IPIP=m | ||
49 | CONFIG_IP_MROUTE=y | ||
50 | CONFIG_IP_PIMSM_V1=y | ||
51 | CONFIG_IP_PIMSM_V2=y | ||
52 | CONFIG_SYN_COOKIES=y | ||
53 | CONFIG_INET_AH=m | ||
54 | CONFIG_INET_ESP=m | ||
55 | CONFIG_INET_IPCOMP=m | ||
56 | CONFIG_INET_XFRM_MODE_BEET=m | ||
57 | CONFIG_INET_DIAG=m | ||
58 | # CONFIG_IPV6 is not set | ||
59 | CONFIG_IP_DCCP=m | ||
60 | # CONFIG_IP_DCCP_CCID3 is not set | ||
61 | CONFIG_TIPC=m | ||
62 | CONFIG_LLC2=m | ||
63 | CONFIG_DNS_RESOLVER=y | ||
64 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
65 | # CONFIG_STANDALONE is not set | ||
66 | CONFIG_PARPORT=y | ||
67 | CONFIG_PARPORT_PC=y | ||
68 | CONFIG_PARPORT_PC_FIFO=y | ||
69 | CONFIG_BLK_DEV_UMEM=m | ||
70 | CONFIG_BLK_DEV_LOOP=m | ||
71 | CONFIG_BLK_DEV_CRYPTOLOOP=m | ||
72 | CONFIG_BLK_DEV_SX8=m | ||
73 | CONFIG_BLK_DEV_RAM=y | ||
74 | CONFIG_BLK_DEV_RAM_SIZE=6144 | ||
75 | CONFIG_CDROM_PKTCDVD=m | ||
76 | CONFIG_CDROM_PKTCDVD_WCACHE=y | ||
77 | CONFIG_ATA_OVER_ETH=m | ||
78 | CONFIG_IDE=y | ||
79 | CONFIG_BLK_DEV_IDECD=y | ||
80 | CONFIG_BLK_DEV_PLATFORM=y | ||
81 | CONFIG_BLK_DEV_GENERIC=y | ||
82 | CONFIG_BLK_DEV_SIIMAGE=y | ||
83 | CONFIG_SCSI=y | ||
84 | CONFIG_BLK_DEV_SD=y | ||
85 | CONFIG_CHR_DEV_ST=m | ||
86 | CONFIG_BLK_DEV_SR=m | ||
87 | CONFIG_CHR_DEV_SG=y | ||
88 | CONFIG_CHR_DEV_SCH=m | ||
89 | CONFIG_SCSI_CONSTANTS=y | ||
90 | CONFIG_SCSI_LOGGING=y | ||
91 | CONFIG_SCSI_FC_ATTRS=y | ||
92 | CONFIG_SCSI_SAS_LIBSAS=m | ||
93 | CONFIG_ISCSI_TCP=m | ||
94 | CONFIG_ISCSI_BOOT_SYSFS=m | ||
95 | CONFIG_FUSION=y | ||
96 | CONFIG_FUSION_SPI=y | ||
97 | CONFIG_FUSION_SAS=y | ||
98 | CONFIG_NETDEVICES=y | ||
99 | CONFIG_DUMMY=m | ||
100 | CONFIG_NETCONSOLE=m | ||
101 | CONFIG_TUN=y | ||
102 | CONFIG_E1000=y | ||
103 | CONFIG_PPP=m | ||
104 | CONFIG_PPP_BSDCOMP=m | ||
105 | CONFIG_PPP_DEFLATE=m | ||
106 | CONFIG_PPP_MPPE=m | ||
107 | CONFIG_PPPOE=m | ||
108 | CONFIG_PPP_ASYNC=m | ||
109 | CONFIG_PPP_SYNC_TTY=m | ||
110 | # CONFIG_WLAN is not set | ||
111 | CONFIG_INPUT_FF_MEMLESS=m | ||
112 | # CONFIG_KEYBOARD_ATKBD is not set | ||
113 | # CONFIG_KEYBOARD_HIL_OLD is not set | ||
114 | # CONFIG_KEYBOARD_HIL is not set | ||
115 | CONFIG_MOUSE_PS2=m | ||
116 | CONFIG_INPUT_MISC=y | ||
117 | CONFIG_INPUT_CM109=m | ||
118 | CONFIG_SERIO_SERPORT=m | ||
119 | CONFIG_SERIO_PARKBD=m | ||
120 | CONFIG_SERIO_GSCPS2=m | ||
121 | # CONFIG_HP_SDC is not set | ||
122 | CONFIG_SERIO_PCIPS2=m | ||
123 | CONFIG_SERIO_LIBPS2=y | ||
124 | CONFIG_SERIO_RAW=m | ||
125 | CONFIG_SERIAL_8250=y | ||
126 | # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set | ||
127 | CONFIG_SERIAL_8250_CONSOLE=y | ||
128 | CONFIG_SERIAL_8250_NR_UARTS=8 | ||
129 | CONFIG_SERIAL_8250_RUNTIME_UARTS=8 | ||
130 | CONFIG_SERIAL_8250_EXTENDED=y | ||
131 | # CONFIG_SERIAL_MUX is not set | ||
132 | CONFIG_SERIAL_JSM=m | ||
133 | CONFIG_PRINTER=y | ||
134 | CONFIG_HW_RANDOM=y | ||
135 | CONFIG_RAW_DRIVER=m | ||
136 | CONFIG_PTP_1588_CLOCK=y | ||
137 | CONFIG_SSB=m | ||
138 | CONFIG_SSB_DRIVER_PCICORE=y | ||
139 | CONFIG_AGP=y | ||
140 | CONFIG_AGP_PARISC=y | ||
141 | CONFIG_DRM=y | ||
142 | CONFIG_DRM_RADEON=y | ||
143 | CONFIG_FIRMWARE_EDID=y | ||
144 | CONFIG_FB_FOREIGN_ENDIAN=y | ||
145 | CONFIG_FB_MODE_HELPERS=y | ||
146 | CONFIG_FB_TILEBLITTING=y | ||
147 | # CONFIG_FB_STI is not set | ||
148 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | ||
149 | # CONFIG_LCD_CLASS_DEVICE is not set | ||
150 | # CONFIG_BACKLIGHT_GENERIC is not set | ||
151 | CONFIG_FRAMEBUFFER_CONSOLE=y | ||
152 | # CONFIG_STI_CONSOLE is not set | ||
153 | CONFIG_LOGO=y | ||
154 | # CONFIG_LOGO_LINUX_MONO is not set | ||
155 | # CONFIG_LOGO_LINUX_VGA16 is not set | ||
156 | # CONFIG_LOGO_LINUX_CLUT224 is not set | ||
157 | CONFIG_SOUND=m | ||
158 | CONFIG_SND=m | ||
159 | CONFIG_SND_SEQUENCER=m | ||
160 | CONFIG_SND_SEQ_DUMMY=m | ||
161 | CONFIG_SND_MIXER_OSS=m | ||
162 | CONFIG_SND_PCM_OSS=m | ||
163 | CONFIG_SND_SEQUENCER_OSS=y | ||
164 | CONFIG_SND_VERBOSE_PRINTK=y | ||
165 | CONFIG_SND_AD1889=m | ||
166 | # CONFIG_SND_USB is not set | ||
167 | # CONFIG_SND_GSC is not set | ||
168 | CONFIG_HID_A4TECH=m | ||
169 | CONFIG_HID_APPLE=m | ||
170 | CONFIG_HID_BELKIN=m | ||
171 | CONFIG_HID_CHERRY=m | ||
172 | CONFIG_HID_CHICONY=m | ||
173 | CONFIG_HID_CYPRESS=m | ||
174 | CONFIG_HID_DRAGONRISE=m | ||
175 | CONFIG_HID_EZKEY=m | ||
176 | CONFIG_HID_KYE=m | ||
177 | CONFIG_HID_GYRATION=m | ||
178 | CONFIG_HID_TWINHAN=m | ||
179 | CONFIG_HID_KENSINGTON=m | ||
180 | CONFIG_HID_LOGITECH=m | ||
181 | CONFIG_HID_LOGITECH_DJ=m | ||
182 | CONFIG_HID_MICROSOFT=m | ||
183 | CONFIG_HID_MONTEREY=m | ||
184 | CONFIG_HID_NTRIG=m | ||
185 | CONFIG_HID_ORTEK=m | ||
186 | CONFIG_HID_PANTHERLORD=m | ||
187 | CONFIG_HID_PETALYNX=m | ||
188 | CONFIG_HID_SAMSUNG=m | ||
189 | CONFIG_HID_SUNPLUS=m | ||
190 | CONFIG_HID_GREENASIA=m | ||
191 | CONFIG_HID_SMARTJOYPLUS=m | ||
192 | CONFIG_HID_TOPSEED=m | ||
193 | CONFIG_HID_THRUSTMASTER=m | ||
194 | CONFIG_HID_ZEROPLUS=m | ||
195 | CONFIG_USB_HID=m | ||
196 | CONFIG_USB=y | ||
197 | CONFIG_USB_OHCI_HCD=y | ||
198 | CONFIG_USB_STORAGE=y | ||
199 | CONFIG_EXT2_FS=y | ||
200 | CONFIG_EXT2_FS_XATTR=y | ||
201 | CONFIG_EXT2_FS_POSIX_ACL=y | ||
202 | CONFIG_EXT2_FS_SECURITY=y | ||
203 | CONFIG_EXT3_FS=y | ||
204 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | ||
205 | CONFIG_EXT4_FS=m | ||
206 | CONFIG_REISERFS_FS=m | ||
207 | CONFIG_REISERFS_PROC_INFO=y | ||
208 | CONFIG_XFS_FS=m | ||
209 | CONFIG_XFS_POSIX_ACL=y | ||
210 | CONFIG_QUOTA=y | ||
211 | CONFIG_QFMT_V1=m | ||
212 | CONFIG_QFMT_V2=m | ||
213 | CONFIG_AUTOFS4_FS=m | ||
214 | CONFIG_FUSE_FS=m | ||
215 | CONFIG_ISO9660_FS=y | ||
216 | CONFIG_JOLIET=y | ||
217 | CONFIG_MSDOS_FS=m | ||
218 | CONFIG_VFAT_FS=m | ||
219 | CONFIG_PROC_KCORE=y | ||
220 | CONFIG_TMPFS=y | ||
221 | CONFIG_TMPFS_XATTR=y | ||
222 | CONFIG_NFS_FS=m | ||
223 | CONFIG_NLS_CODEPAGE_437=m | ||
224 | CONFIG_NLS_CODEPAGE_737=m | ||
225 | CONFIG_NLS_CODEPAGE_775=m | ||
226 | CONFIG_NLS_CODEPAGE_850=m | ||
227 | CONFIG_NLS_CODEPAGE_852=m | ||
228 | CONFIG_NLS_CODEPAGE_855=m | ||
229 | CONFIG_NLS_CODEPAGE_857=m | ||
230 | CONFIG_NLS_CODEPAGE_860=m | ||
231 | CONFIG_NLS_CODEPAGE_861=m | ||
232 | CONFIG_NLS_CODEPAGE_862=m | ||
233 | CONFIG_NLS_CODEPAGE_863=m | ||
234 | CONFIG_NLS_CODEPAGE_864=m | ||
235 | CONFIG_NLS_CODEPAGE_865=m | ||
236 | CONFIG_NLS_CODEPAGE_866=m | ||
237 | CONFIG_NLS_CODEPAGE_869=m | ||
238 | CONFIG_NLS_CODEPAGE_936=m | ||
239 | CONFIG_NLS_CODEPAGE_950=m | ||
240 | CONFIG_NLS_CODEPAGE_932=m | ||
241 | CONFIG_NLS_CODEPAGE_949=m | ||
242 | CONFIG_NLS_CODEPAGE_874=m | ||
243 | CONFIG_NLS_ISO8859_8=m | ||
244 | CONFIG_NLS_CODEPAGE_1250=m | ||
245 | CONFIG_NLS_CODEPAGE_1251=m | ||
246 | CONFIG_NLS_ASCII=m | ||
247 | CONFIG_NLS_ISO8859_1=m | ||
248 | CONFIG_NLS_ISO8859_2=m | ||
249 | CONFIG_NLS_ISO8859_3=m | ||
250 | CONFIG_NLS_ISO8859_4=m | ||
251 | CONFIG_NLS_ISO8859_5=m | ||
252 | CONFIG_NLS_ISO8859_6=m | ||
253 | CONFIG_NLS_ISO8859_7=m | ||
254 | CONFIG_NLS_ISO8859_9=m | ||
255 | CONFIG_NLS_ISO8859_13=m | ||
256 | CONFIG_NLS_ISO8859_14=m | ||
257 | CONFIG_NLS_ISO8859_15=m | ||
258 | CONFIG_NLS_KOI8_R=m | ||
259 | CONFIG_NLS_KOI8_U=m | ||
260 | CONFIG_NLS_UTF8=m | ||
261 | CONFIG_UNUSED_SYMBOLS=y | ||
262 | CONFIG_DEBUG_FS=y | ||
263 | CONFIG_MAGIC_SYSRQ=y | ||
264 | CONFIG_DEBUG_SLAB=y | ||
265 | CONFIG_DEBUG_SLAB_LEAK=y | ||
266 | CONFIG_DEBUG_MEMORY_INIT=y | ||
267 | CONFIG_DEBUG_STACKOVERFLOW=y | ||
268 | CONFIG_LOCKUP_DETECTOR=y | ||
269 | CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y | ||
270 | CONFIG_PANIC_ON_OOPS=y | ||
271 | CONFIG_DEBUG_RT_MUTEXES=y | ||
272 | CONFIG_RT_MUTEX_TESTER=y | ||
273 | CONFIG_PROVE_RCU_DELAY=y | ||
274 | CONFIG_DEBUG_BLOCK_EXT_DEVT=y | ||
275 | CONFIG_LATENCYTOP=y | ||
276 | CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y | ||
277 | CONFIG_KEYS=y | ||
278 | # CONFIG_CRYPTO_HW is not set | ||
279 | CONFIG_FONTS=y | ||
diff --git a/arch/parisc/include/asm/parisc-device.h b/arch/parisc/include/asm/parisc-device.h index 9afdad6c2ffb..eaf4dc1c7294 100644 --- a/arch/parisc/include/asm/parisc-device.h +++ b/arch/parisc/include/asm/parisc-device.h | |||
@@ -23,6 +23,7 @@ struct parisc_device { | |||
23 | /* generic info returned from pdc_pat_cell_module() */ | 23 | /* generic info returned from pdc_pat_cell_module() */ |
24 | unsigned long mod_info; /* PAT specific - Misc Module info */ | 24 | unsigned long mod_info; /* PAT specific - Misc Module info */ |
25 | unsigned long pmod_loc; /* physical Module location */ | 25 | unsigned long pmod_loc; /* physical Module location */ |
26 | unsigned long mod0; | ||
26 | #endif | 27 | #endif |
27 | u64 dma_mask; /* DMA mask for I/O */ | 28 | u64 dma_mask; /* DMA mask for I/O */ |
28 | struct device dev; | 29 | struct device dev; |
@@ -61,4 +62,6 @@ parisc_get_drvdata(struct parisc_device *d) | |||
61 | 62 | ||
62 | extern struct bus_type parisc_bus_type; | 63 | extern struct bus_type parisc_bus_type; |
63 | 64 | ||
65 | int iosapic_serial_irq(struct parisc_device *dev); | ||
66 | |||
64 | #endif /*_ASM_PARISC_PARISC_DEVICE_H_*/ | 67 | #endif /*_ASM_PARISC_PARISC_DEVICE_H_*/ |
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index 2e65aa54bd10..c035673209f7 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c | |||
@@ -71,18 +71,27 @@ flush_cache_all_local(void) | |||
71 | } | 71 | } |
72 | EXPORT_SYMBOL(flush_cache_all_local); | 72 | EXPORT_SYMBOL(flush_cache_all_local); |
73 | 73 | ||
74 | /* Virtual address of pfn. */ | ||
75 | #define pfn_va(pfn) __va(PFN_PHYS(pfn)) | ||
76 | |||
74 | void | 77 | void |
75 | update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep) | 78 | update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep) |
76 | { | 79 | { |
77 | struct page *page = pte_page(*ptep); | 80 | unsigned long pfn = pte_pfn(*ptep); |
81 | struct page *page; | ||
78 | 82 | ||
79 | if (pfn_valid(page_to_pfn(page)) && page_mapping(page) && | 83 | /* We don't have pte special. As a result, we can be called with |
80 | test_bit(PG_dcache_dirty, &page->flags)) { | 84 | an invalid pfn and we don't need to flush the kernel dcache page. |
85 | This occurs with FireGL card in C8000. */ | ||
86 | if (!pfn_valid(pfn)) | ||
87 | return; | ||
81 | 88 | ||
82 | flush_kernel_dcache_page(page); | 89 | page = pfn_to_page(pfn); |
90 | if (page_mapping(page) && test_bit(PG_dcache_dirty, &page->flags)) { | ||
91 | flush_kernel_dcache_page_addr(pfn_va(pfn)); | ||
83 | clear_bit(PG_dcache_dirty, &page->flags); | 92 | clear_bit(PG_dcache_dirty, &page->flags); |
84 | } else if (parisc_requires_coherency()) | 93 | } else if (parisc_requires_coherency()) |
85 | flush_kernel_dcache_page(page); | 94 | flush_kernel_dcache_page_addr(pfn_va(pfn)); |
86 | } | 95 | } |
87 | 96 | ||
88 | void | 97 | void |
@@ -495,44 +504,42 @@ static inline pte_t *get_ptep(pgd_t *pgd, unsigned long addr) | |||
495 | 504 | ||
496 | void flush_cache_mm(struct mm_struct *mm) | 505 | void flush_cache_mm(struct mm_struct *mm) |
497 | { | 506 | { |
507 | struct vm_area_struct *vma; | ||
508 | pgd_t *pgd; | ||
509 | |||
498 | /* Flushing the whole cache on each cpu takes forever on | 510 | /* Flushing the whole cache on each cpu takes forever on |
499 | rp3440, etc. So, avoid it if the mm isn't too big. */ | 511 | rp3440, etc. So, avoid it if the mm isn't too big. */ |
500 | if (mm_total_size(mm) < parisc_cache_flush_threshold) { | 512 | if (mm_total_size(mm) >= parisc_cache_flush_threshold) { |
501 | struct vm_area_struct *vma; | 513 | flush_cache_all(); |
502 | 514 | return; | |
503 | if (mm->context == mfsp(3)) { | 515 | } |
504 | for (vma = mm->mmap; vma; vma = vma->vm_next) { | 516 | |
505 | flush_user_dcache_range_asm(vma->vm_start, | 517 | if (mm->context == mfsp(3)) { |
506 | vma->vm_end); | 518 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
507 | if (vma->vm_flags & VM_EXEC) | 519 | flush_user_dcache_range_asm(vma->vm_start, vma->vm_end); |
508 | flush_user_icache_range_asm( | 520 | if ((vma->vm_flags & VM_EXEC) == 0) |
509 | vma->vm_start, vma->vm_end); | 521 | continue; |
510 | } | 522 | flush_user_icache_range_asm(vma->vm_start, vma->vm_end); |
511 | } else { | ||
512 | pgd_t *pgd = mm->pgd; | ||
513 | |||
514 | for (vma = mm->mmap; vma; vma = vma->vm_next) { | ||
515 | unsigned long addr; | ||
516 | |||
517 | for (addr = vma->vm_start; addr < vma->vm_end; | ||
518 | addr += PAGE_SIZE) { | ||
519 | pte_t *ptep = get_ptep(pgd, addr); | ||
520 | if (ptep != NULL) { | ||
521 | pte_t pte = *ptep; | ||
522 | __flush_cache_page(vma, addr, | ||
523 | page_to_phys(pte_page(pte))); | ||
524 | } | ||
525 | } | ||
526 | } | ||
527 | } | 523 | } |
528 | return; | 524 | return; |
529 | } | 525 | } |
530 | 526 | ||
531 | #ifdef CONFIG_SMP | 527 | pgd = mm->pgd; |
532 | flush_cache_all(); | 528 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
533 | #else | 529 | unsigned long addr; |
534 | flush_cache_all_local(); | 530 | |
535 | #endif | 531 | for (addr = vma->vm_start; addr < vma->vm_end; |
532 | addr += PAGE_SIZE) { | ||
533 | unsigned long pfn; | ||
534 | pte_t *ptep = get_ptep(pgd, addr); | ||
535 | if (!ptep) | ||
536 | continue; | ||
537 | pfn = pte_pfn(*ptep); | ||
538 | if (!pfn_valid(pfn)) | ||
539 | continue; | ||
540 | __flush_cache_page(vma, addr, PFN_PHYS(pfn)); | ||
541 | } | ||
542 | } | ||
536 | } | 543 | } |
537 | 544 | ||
538 | void | 545 | void |
@@ -556,33 +563,32 @@ flush_user_icache_range(unsigned long start, unsigned long end) | |||
556 | void flush_cache_range(struct vm_area_struct *vma, | 563 | void flush_cache_range(struct vm_area_struct *vma, |
557 | unsigned long start, unsigned long end) | 564 | unsigned long start, unsigned long end) |
558 | { | 565 | { |
566 | unsigned long addr; | ||
567 | pgd_t *pgd; | ||
568 | |||
559 | BUG_ON(!vma->vm_mm->context); | 569 | BUG_ON(!vma->vm_mm->context); |
560 | 570 | ||
561 | if ((end - start) < parisc_cache_flush_threshold) { | 571 | if ((end - start) >= parisc_cache_flush_threshold) { |
562 | if (vma->vm_mm->context == mfsp(3)) { | ||
563 | flush_user_dcache_range_asm(start, end); | ||
564 | if (vma->vm_flags & VM_EXEC) | ||
565 | flush_user_icache_range_asm(start, end); | ||
566 | } else { | ||
567 | unsigned long addr; | ||
568 | pgd_t *pgd = vma->vm_mm->pgd; | ||
569 | |||
570 | for (addr = start & PAGE_MASK; addr < end; | ||
571 | addr += PAGE_SIZE) { | ||
572 | pte_t *ptep = get_ptep(pgd, addr); | ||
573 | if (ptep != NULL) { | ||
574 | pte_t pte = *ptep; | ||
575 | flush_cache_page(vma, | ||
576 | addr, pte_pfn(pte)); | ||
577 | } | ||
578 | } | ||
579 | } | ||
580 | } else { | ||
581 | #ifdef CONFIG_SMP | ||
582 | flush_cache_all(); | 572 | flush_cache_all(); |
583 | #else | 573 | return; |
584 | flush_cache_all_local(); | 574 | } |
585 | #endif | 575 | |
576 | if (vma->vm_mm->context == mfsp(3)) { | ||
577 | flush_user_dcache_range_asm(start, end); | ||
578 | if (vma->vm_flags & VM_EXEC) | ||
579 | flush_user_icache_range_asm(start, end); | ||
580 | return; | ||
581 | } | ||
582 | |||
583 | pgd = vma->vm_mm->pgd; | ||
584 | for (addr = start & PAGE_MASK; addr < end; addr += PAGE_SIZE) { | ||
585 | unsigned long pfn; | ||
586 | pte_t *ptep = get_ptep(pgd, addr); | ||
587 | if (!ptep) | ||
588 | continue; | ||
589 | pfn = pte_pfn(*ptep); | ||
590 | if (pfn_valid(pfn)) | ||
591 | __flush_cache_page(vma, addr, PFN_PHYS(pfn)); | ||
586 | } | 592 | } |
587 | } | 593 | } |
588 | 594 | ||
@@ -591,9 +597,10 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long | |||
591 | { | 597 | { |
592 | BUG_ON(!vma->vm_mm->context); | 598 | BUG_ON(!vma->vm_mm->context); |
593 | 599 | ||
594 | flush_tlb_page(vma, vmaddr); | 600 | if (pfn_valid(pfn)) { |
595 | __flush_cache_page(vma, vmaddr, page_to_phys(pfn_to_page(pfn))); | 601 | flush_tlb_page(vma, vmaddr); |
596 | 602 | __flush_cache_page(vma, vmaddr, PFN_PHYS(pfn)); | |
603 | } | ||
597 | } | 604 | } |
598 | 605 | ||
599 | #ifdef CONFIG_PARISC_TMPALIAS | 606 | #ifdef CONFIG_PARISC_TMPALIAS |
diff --git a/arch/parisc/kernel/inventory.c b/arch/parisc/kernel/inventory.c index 3295ef4a185d..f0b6722fc706 100644 --- a/arch/parisc/kernel/inventory.c +++ b/arch/parisc/kernel/inventory.c | |||
@@ -211,6 +211,7 @@ pat_query_module(ulong pcell_loc, ulong mod_index) | |||
211 | /* REVISIT: who is the consumer of this? not sure yet... */ | 211 | /* REVISIT: who is the consumer of this? not sure yet... */ |
212 | dev->mod_info = pa_pdc_cell->mod_info; /* pass to PAT_GET_ENTITY() */ | 212 | dev->mod_info = pa_pdc_cell->mod_info; /* pass to PAT_GET_ENTITY() */ |
213 | dev->pmod_loc = pa_pdc_cell->mod_location; | 213 | dev->pmod_loc = pa_pdc_cell->mod_location; |
214 | dev->mod0 = pa_pdc_cell->mod[0]; | ||
214 | 215 | ||
215 | register_parisc_device(dev); /* advertise device */ | 216 | register_parisc_device(dev); /* advertise device */ |
216 | 217 | ||
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c index 940188d1942c..07349b002687 100644 --- a/arch/parisc/kernel/signal.c +++ b/arch/parisc/kernel/signal.c | |||
@@ -56,13 +56,6 @@ | |||
56 | #define A(__x) ((unsigned long)(__x)) | 56 | #define A(__x) ((unsigned long)(__x)) |
57 | 57 | ||
58 | /* | 58 | /* |
59 | * Atomically swap in the new signal mask, and wait for a signal. | ||
60 | */ | ||
61 | #ifdef CONFIG_64BIT | ||
62 | #include "sys32.h" | ||
63 | #endif | ||
64 | |||
65 | /* | ||
66 | * Do a signal return - restore sigcontext. | 59 | * Do a signal return - restore sigcontext. |
67 | */ | 60 | */ |
68 | 61 | ||
diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c index 33eca1b04926..6c6a271a6140 100644 --- a/arch/parisc/kernel/signal32.c +++ b/arch/parisc/kernel/signal32.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
35 | 35 | ||
36 | #include "signal32.h" | 36 | #include "signal32.h" |
37 | #include "sys32.h" | ||
38 | 37 | ||
39 | #define DEBUG_COMPAT_SIG 0 | 38 | #define DEBUG_COMPAT_SIG 0 |
40 | #define DEBUG_COMPAT_SIG_LEVEL 2 | 39 | #define DEBUG_COMPAT_SIG_LEVEL 2 |
diff --git a/arch/parisc/kernel/sys32.h b/arch/parisc/kernel/sys32.h deleted file mode 100644 index 60dd470f39f8..000000000000 --- a/arch/parisc/kernel/sys32.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Richard Hirst <rhirst at parisc-linux.org> | ||
3 | * Copyright (C) 2003 James Bottomley <jejb at parisc-linux.org> | ||
4 | * Copyright (C) 2003 Randolph Chung <tausq with parisc-linux.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | #ifndef _PARISC64_KERNEL_SYS32_H | ||
21 | #define _PARISC64_KERNEL_SYS32_H | ||
22 | |||
23 | #include <linux/compat.h> | ||
24 | |||
25 | /* Call a kernel syscall which will use kernel space instead of user | ||
26 | * space for its copy_to/from_user. | ||
27 | */ | ||
28 | #define KERNEL_SYSCALL(ret, syscall, args...) \ | ||
29 | { \ | ||
30 | mm_segment_t old_fs = get_fs(); \ | ||
31 | set_fs(KERNEL_DS); \ | ||
32 | ret = syscall(args); \ | ||
33 | set_fs (old_fs); \ | ||
34 | } | ||
35 | |||
36 | #endif | ||
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c index a134ff4da12e..bb9f3b64de55 100644 --- a/arch/parisc/kernel/sys_parisc32.c +++ b/arch/parisc/kernel/sys_parisc32.c | |||
@@ -42,8 +42,6 @@ | |||
42 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
43 | #include <asm/mmu_context.h> | 43 | #include <asm/mmu_context.h> |
44 | 44 | ||
45 | #include "sys32.h" | ||
46 | |||
47 | #undef DEBUG | 45 | #undef DEBUG |
48 | 46 | ||
49 | #ifdef DEBUG | 47 | #ifdef DEBUG |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 3bf72cd2c8fc..dbd9d3c991e8 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -566,7 +566,7 @@ config SCHED_SMT | |||
566 | config PPC_DENORMALISATION | 566 | config PPC_DENORMALISATION |
567 | bool "PowerPC denormalisation exception handling" | 567 | bool "PowerPC denormalisation exception handling" |
568 | depends on PPC_BOOK3S_64 | 568 | depends on PPC_BOOK3S_64 |
569 | default "n" | 569 | default "y" if PPC_POWERNV |
570 | ---help--- | 570 | ---help--- |
571 | Add support for handling denormalisation of single precision | 571 | Add support for handling denormalisation of single precision |
572 | values. Useful for bare metal only. If unsure say Y here. | 572 | values. Useful for bare metal only. If unsure say Y here. |
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig index c86fcb92358e..0e8cfd09da2f 100644 --- a/arch/powerpc/configs/ppc64_defconfig +++ b/arch/powerpc/configs/ppc64_defconfig | |||
@@ -58,7 +58,7 @@ CONFIG_SCHED_SMT=y | |||
58 | CONFIG_PPC_DENORMALISATION=y | 58 | CONFIG_PPC_DENORMALISATION=y |
59 | CONFIG_PCCARD=y | 59 | CONFIG_PCCARD=y |
60 | CONFIG_ELECTRA_CF=y | 60 | CONFIG_ELECTRA_CF=y |
61 | CONFIG_HOTPLUG_PCI=m | 61 | CONFIG_HOTPLUG_PCI=y |
62 | CONFIG_HOTPLUG_PCI_RPA=m | 62 | CONFIG_HOTPLUG_PCI_RPA=m |
63 | CONFIG_HOTPLUG_PCI_RPA_DLPAR=m | 63 | CONFIG_HOTPLUG_PCI_RPA_DLPAR=m |
64 | CONFIG_PACKET=y | 64 | CONFIG_PACKET=y |
diff --git a/arch/powerpc/configs/ppc64e_defconfig b/arch/powerpc/configs/ppc64e_defconfig index 4b20f76172e2..0085dc4642c5 100644 --- a/arch/powerpc/configs/ppc64e_defconfig +++ b/arch/powerpc/configs/ppc64e_defconfig | |||
@@ -32,7 +32,7 @@ CONFIG_IRQ_ALL_CPUS=y | |||
32 | CONFIG_SPARSEMEM_MANUAL=y | 32 | CONFIG_SPARSEMEM_MANUAL=y |
33 | CONFIG_PCI_MSI=y | 33 | CONFIG_PCI_MSI=y |
34 | CONFIG_PCCARD=y | 34 | CONFIG_PCCARD=y |
35 | CONFIG_HOTPLUG_PCI=m | 35 | CONFIG_HOTPLUG_PCI=y |
36 | CONFIG_PACKET=y | 36 | CONFIG_PACKET=y |
37 | CONFIG_UNIX=y | 37 | CONFIG_UNIX=y |
38 | CONFIG_XFRM_USER=m | 38 | CONFIG_XFRM_USER=m |
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig index bea8587c3af5..1d4b9763895d 100644 --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_defconfig | |||
@@ -53,7 +53,7 @@ CONFIG_PPC_64K_PAGES=y | |||
53 | CONFIG_PPC_SUBPAGE_PROT=y | 53 | CONFIG_PPC_SUBPAGE_PROT=y |
54 | CONFIG_SCHED_SMT=y | 54 | CONFIG_SCHED_SMT=y |
55 | CONFIG_PPC_DENORMALISATION=y | 55 | CONFIG_PPC_DENORMALISATION=y |
56 | CONFIG_HOTPLUG_PCI=m | 56 | CONFIG_HOTPLUG_PCI=y |
57 | CONFIG_HOTPLUG_PCI_RPA=m | 57 | CONFIG_HOTPLUG_PCI_RPA=m |
58 | CONFIG_HOTPLUG_PCI_RPA_DLPAR=m | 58 | CONFIG_HOTPLUG_PCI_RPA_DLPAR=m |
59 | CONFIG_PACKET=y | 59 | CONFIG_PACKET=y |
diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h index 2dd7bfc459be..8b2492644754 100644 --- a/arch/powerpc/include/asm/perf_event_server.h +++ b/arch/powerpc/include/asm/perf_event_server.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <asm/hw_irq.h> | 13 | #include <asm/hw_irq.h> |
14 | #include <linux/device.h> | 14 | #include <linux/device.h> |
15 | #include <uapi/asm/perf_event.h> | ||
15 | 16 | ||
16 | #define MAX_HWEVENTS 8 | 17 | #define MAX_HWEVENTS 8 |
17 | #define MAX_EVENT_ALTERNATIVES 8 | 18 | #define MAX_EVENT_ALTERNATIVES 8 |
@@ -69,11 +70,6 @@ struct power_pmu { | |||
69 | #define PPMU_LIMITED_PMC_REQD 2 /* have to put this on a limited PMC */ | 70 | #define PPMU_LIMITED_PMC_REQD 2 /* have to put this on a limited PMC */ |
70 | #define PPMU_ONLY_COUNT_RUN 4 /* only counting in run state */ | 71 | #define PPMU_ONLY_COUNT_RUN 4 /* only counting in run state */ |
71 | 72 | ||
72 | /* | ||
73 | * We use the event config bit 63 as a flag to request EBB. | ||
74 | */ | ||
75 | #define EVENT_CONFIG_EBB_SHIFT 63 | ||
76 | |||
77 | extern int register_power_pmu(struct power_pmu *); | 73 | extern int register_power_pmu(struct power_pmu *); |
78 | 74 | ||
79 | struct pt_regs; | 75 | struct pt_regs; |
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 47a35b08b963..e378cccfca55 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h | |||
@@ -247,6 +247,10 @@ struct thread_struct { | |||
247 | unsigned long tm_orig_msr; /* Thread's MSR on ctx switch */ | 247 | unsigned long tm_orig_msr; /* Thread's MSR on ctx switch */ |
248 | struct pt_regs ckpt_regs; /* Checkpointed registers */ | 248 | struct pt_regs ckpt_regs; /* Checkpointed registers */ |
249 | 249 | ||
250 | unsigned long tm_tar; | ||
251 | unsigned long tm_ppr; | ||
252 | unsigned long tm_dscr; | ||
253 | |||
250 | /* | 254 | /* |
251 | * Transactional FP and VSX 0-31 register set. | 255 | * Transactional FP and VSX 0-31 register set. |
252 | * NOTE: the sense of these is the opposite of the integer ckpt_regs! | 256 | * NOTE: the sense of these is the opposite of the integer ckpt_regs! |
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index a6840e4e24f7..99222e27f173 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h | |||
@@ -254,19 +254,28 @@ | |||
254 | #define SPRN_HRMOR 0x139 /* Real mode offset register */ | 254 | #define SPRN_HRMOR 0x139 /* Real mode offset register */ |
255 | #define SPRN_HSRR0 0x13A /* Hypervisor Save/Restore 0 */ | 255 | #define SPRN_HSRR0 0x13A /* Hypervisor Save/Restore 0 */ |
256 | #define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */ | 256 | #define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */ |
257 | /* HFSCR and FSCR bit numbers are the same */ | ||
258 | #define FSCR_TAR_LG 8 /* Enable Target Address Register */ | ||
259 | #define FSCR_EBB_LG 7 /* Enable Event Based Branching */ | ||
260 | #define FSCR_TM_LG 5 /* Enable Transactional Memory */ | ||
261 | #define FSCR_PM_LG 4 /* Enable prob/priv access to PMU SPRs */ | ||
262 | #define FSCR_BHRB_LG 3 /* Enable Branch History Rolling Buffer*/ | ||
263 | #define FSCR_DSCR_LG 2 /* Enable Data Stream Control Register */ | ||
264 | #define FSCR_VECVSX_LG 1 /* Enable VMX/VSX */ | ||
265 | #define FSCR_FP_LG 0 /* Enable Floating Point */ | ||
257 | #define SPRN_FSCR 0x099 /* Facility Status & Control Register */ | 266 | #define SPRN_FSCR 0x099 /* Facility Status & Control Register */ |
258 | #define FSCR_TAR (1 << (63-55)) /* Enable Target Address Register */ | 267 | #define FSCR_TAR __MASK(FSCR_TAR_LG) |
259 | #define FSCR_EBB (1 << (63-56)) /* Enable Event Based Branching */ | 268 | #define FSCR_EBB __MASK(FSCR_EBB_LG) |
260 | #define FSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */ | 269 | #define FSCR_DSCR __MASK(FSCR_DSCR_LG) |
261 | #define SPRN_HFSCR 0xbe /* HV=1 Facility Status & Control Register */ | 270 | #define SPRN_HFSCR 0xbe /* HV=1 Facility Status & Control Register */ |
262 | #define HFSCR_TAR (1 << (63-55)) /* Enable Target Address Register */ | 271 | #define HFSCR_TAR __MASK(FSCR_TAR_LG) |
263 | #define HFSCR_EBB (1 << (63-56)) /* Enable Event Based Branching */ | 272 | #define HFSCR_EBB __MASK(FSCR_EBB_LG) |
264 | #define HFSCR_TM (1 << (63-58)) /* Enable Transactional Memory */ | 273 | #define HFSCR_TM __MASK(FSCR_TM_LG) |
265 | #define HFSCR_PM (1 << (63-60)) /* Enable prob/priv access to PMU SPRs */ | 274 | #define HFSCR_PM __MASK(FSCR_PM_LG) |
266 | #define HFSCR_BHRB (1 << (63-59)) /* Enable Branch History Rolling Buffer*/ | 275 | #define HFSCR_BHRB __MASK(FSCR_BHRB_LG) |
267 | #define HFSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */ | 276 | #define HFSCR_DSCR __MASK(FSCR_DSCR_LG) |
268 | #define HFSCR_VECVSX (1 << (63-62)) /* Enable VMX/VSX */ | 277 | #define HFSCR_VECVSX __MASK(FSCR_VECVSX_LG) |
269 | #define HFSCR_FP (1 << (63-63)) /* Enable Floating Point */ | 278 | #define HFSCR_FP __MASK(FSCR_FP_LG) |
270 | #define SPRN_TAR 0x32f /* Target Address Register */ | 279 | #define SPRN_TAR 0x32f /* Target Address Register */ |
271 | #define SPRN_LPCR 0x13E /* LPAR Control Register */ | 280 | #define SPRN_LPCR 0x13E /* LPAR Control Register */ |
272 | #define LPCR_VPM0 (1ul << (63-0)) | 281 | #define LPCR_VPM0 (1ul << (63-0)) |
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h index ffbaabebcdca..48cfc858abd6 100644 --- a/arch/powerpc/include/asm/smp.h +++ b/arch/powerpc/include/asm/smp.h | |||
@@ -145,6 +145,10 @@ extern void __cpu_die(unsigned int cpu); | |||
145 | #define smp_setup_cpu_maps() | 145 | #define smp_setup_cpu_maps() |
146 | static inline void inhibit_secondary_onlining(void) {} | 146 | static inline void inhibit_secondary_onlining(void) {} |
147 | static inline void uninhibit_secondary_onlining(void) {} | 147 | static inline void uninhibit_secondary_onlining(void) {} |
148 | static inline const struct cpumask *cpu_sibling_mask(int cpu) | ||
149 | { | ||
150 | return cpumask_of(cpu); | ||
151 | } | ||
148 | 152 | ||
149 | #endif /* CONFIG_SMP */ | 153 | #endif /* CONFIG_SMP */ |
150 | 154 | ||
diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h index 49a13e0ef234..294c2cedcf7a 100644 --- a/arch/powerpc/include/asm/switch_to.h +++ b/arch/powerpc/include/asm/switch_to.h | |||
@@ -15,6 +15,15 @@ extern struct task_struct *__switch_to(struct task_struct *, | |||
15 | struct thread_struct; | 15 | struct thread_struct; |
16 | extern struct task_struct *_switch(struct thread_struct *prev, | 16 | extern struct task_struct *_switch(struct thread_struct *prev, |
17 | struct thread_struct *next); | 17 | struct thread_struct *next); |
18 | #ifdef CONFIG_PPC_BOOK3S_64 | ||
19 | static inline void save_tar(struct thread_struct *prev) | ||
20 | { | ||
21 | if (cpu_has_feature(CPU_FTR_ARCH_207S)) | ||
22 | prev->tar = mfspr(SPRN_TAR); | ||
23 | } | ||
24 | #else | ||
25 | static inline void save_tar(struct thread_struct *prev) {} | ||
26 | #endif | ||
18 | 27 | ||
19 | extern void giveup_fpu(struct task_struct *); | 28 | extern void giveup_fpu(struct task_struct *); |
20 | extern void load_up_fpu(void); | 29 | extern void load_up_fpu(void); |
diff --git a/arch/powerpc/include/uapi/asm/Kbuild b/arch/powerpc/include/uapi/asm/Kbuild index 5182c8622b54..48be855ef37b 100644 --- a/arch/powerpc/include/uapi/asm/Kbuild +++ b/arch/powerpc/include/uapi/asm/Kbuild | |||
@@ -20,6 +20,7 @@ header-y += mman.h | |||
20 | header-y += msgbuf.h | 20 | header-y += msgbuf.h |
21 | header-y += nvram.h | 21 | header-y += nvram.h |
22 | header-y += param.h | 22 | header-y += param.h |
23 | header-y += perf_event.h | ||
23 | header-y += poll.h | 24 | header-y += poll.h |
24 | header-y += posix_types.h | 25 | header-y += posix_types.h |
25 | header-y += ps3fb.h | 26 | header-y += ps3fb.h |
diff --git a/arch/powerpc/include/uapi/asm/perf_event.h b/arch/powerpc/include/uapi/asm/perf_event.h new file mode 100644 index 000000000000..80a4d40cf5bc --- /dev/null +++ b/arch/powerpc/include/uapi/asm/perf_event.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * Copyright 2013 Michael Ellerman, IBM Corp. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; version 2 of the | ||
7 | * License. | ||
8 | */ | ||
9 | |||
10 | #ifndef _UAPI_ASM_POWERPC_PERF_EVENT_H | ||
11 | #define _UAPI_ASM_POWERPC_PERF_EVENT_H | ||
12 | |||
13 | /* | ||
14 | * We use bit 63 of perf_event_attr.config as a flag to request EBB. | ||
15 | */ | ||
16 | #define PERF_EVENT_CONFIG_EBB_SHIFT 63 | ||
17 | |||
18 | #endif /* _UAPI_ASM_POWERPC_PERF_EVENT_H */ | ||
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index c7e8afc2ead0..8207459efe56 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -138,6 +138,9 @@ int main(void) | |||
138 | DEFINE(THREAD_TM_TFHAR, offsetof(struct thread_struct, tm_tfhar)); | 138 | DEFINE(THREAD_TM_TFHAR, offsetof(struct thread_struct, tm_tfhar)); |
139 | DEFINE(THREAD_TM_TEXASR, offsetof(struct thread_struct, tm_texasr)); | 139 | DEFINE(THREAD_TM_TEXASR, offsetof(struct thread_struct, tm_texasr)); |
140 | DEFINE(THREAD_TM_TFIAR, offsetof(struct thread_struct, tm_tfiar)); | 140 | DEFINE(THREAD_TM_TFIAR, offsetof(struct thread_struct, tm_tfiar)); |
141 | DEFINE(THREAD_TM_TAR, offsetof(struct thread_struct, tm_tar)); | ||
142 | DEFINE(THREAD_TM_PPR, offsetof(struct thread_struct, tm_ppr)); | ||
143 | DEFINE(THREAD_TM_DSCR, offsetof(struct thread_struct, tm_dscr)); | ||
141 | DEFINE(PT_CKPT_REGS, offsetof(struct thread_struct, ckpt_regs)); | 144 | DEFINE(PT_CKPT_REGS, offsetof(struct thread_struct, ckpt_regs)); |
142 | DEFINE(THREAD_TRANSACT_VR0, offsetof(struct thread_struct, | 145 | DEFINE(THREAD_TRANSACT_VR0, offsetof(struct thread_struct, |
143 | transact_vr[0])); | 146 | transact_vr[0])); |
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index ea9414c8088d..55593ee2d5aa 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c | |||
@@ -1061,7 +1061,7 @@ static const struct file_operations proc_eeh_operations = { | |||
1061 | 1061 | ||
1062 | static int __init eeh_init_proc(void) | 1062 | static int __init eeh_init_proc(void) |
1063 | { | 1063 | { |
1064 | if (machine_is(pseries)) | 1064 | if (machine_is(pseries) || machine_is(powernv)) |
1065 | proc_create("powerpc/eeh", 0, NULL, &proc_eeh_operations); | 1065 | proc_create("powerpc/eeh", 0, NULL, &proc_eeh_operations); |
1066 | return 0; | 1066 | return 0; |
1067 | } | 1067 | } |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index ab15b8d057ad..2bd0b885b0fe 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -449,15 +449,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_DSCR) | |||
449 | 449 | ||
450 | #ifdef CONFIG_PPC_BOOK3S_64 | 450 | #ifdef CONFIG_PPC_BOOK3S_64 |
451 | BEGIN_FTR_SECTION | 451 | BEGIN_FTR_SECTION |
452 | /* | ||
453 | * Back up the TAR across context switches. Note that the TAR is not | ||
454 | * available for use in the kernel. (To provide this, the TAR should | ||
455 | * be backed up/restored on exception entry/exit instead, and be in | ||
456 | * pt_regs. FIXME, this should be in pt_regs anyway (for debug).) | ||
457 | */ | ||
458 | mfspr r0,SPRN_TAR | ||
459 | std r0,THREAD_TAR(r3) | ||
460 | |||
461 | /* Event based branch registers */ | 452 | /* Event based branch registers */ |
462 | mfspr r0, SPRN_BESCR | 453 | mfspr r0, SPRN_BESCR |
463 | std r0, THREAD_BESCR(r3) | 454 | std r0, THREAD_BESCR(r3) |
@@ -584,9 +575,34 @@ BEGIN_FTR_SECTION | |||
584 | ld r7,DSCR_DEFAULT@toc(2) | 575 | ld r7,DSCR_DEFAULT@toc(2) |
585 | ld r0,THREAD_DSCR(r4) | 576 | ld r0,THREAD_DSCR(r4) |
586 | cmpwi r6,0 | 577 | cmpwi r6,0 |
578 | li r8, FSCR_DSCR | ||
587 | bne 1f | 579 | bne 1f |
588 | ld r0,0(r7) | 580 | ld r0,0(r7) |
589 | 1: cmpd r0,r25 | 581 | b 3f |
582 | 1: | ||
583 | BEGIN_FTR_SECTION_NESTED(70) | ||
584 | mfspr r6, SPRN_FSCR | ||
585 | or r6, r6, r8 | ||
586 | mtspr SPRN_FSCR, r6 | ||
587 | BEGIN_FTR_SECTION_NESTED(69) | ||
588 | mfspr r6, SPRN_HFSCR | ||
589 | or r6, r6, r8 | ||
590 | mtspr SPRN_HFSCR, r6 | ||
591 | END_FTR_SECTION_NESTED(CPU_FTR_HVMODE, CPU_FTR_HVMODE, 69) | ||
592 | b 4f | ||
593 | END_FTR_SECTION_NESTED(CPU_FTR_ARCH_207S, CPU_FTR_ARCH_207S, 70) | ||
594 | 3: | ||
595 | BEGIN_FTR_SECTION_NESTED(70) | ||
596 | mfspr r6, SPRN_FSCR | ||
597 | andc r6, r6, r8 | ||
598 | mtspr SPRN_FSCR, r6 | ||
599 | BEGIN_FTR_SECTION_NESTED(69) | ||
600 | mfspr r6, SPRN_HFSCR | ||
601 | andc r6, r6, r8 | ||
602 | mtspr SPRN_HFSCR, r6 | ||
603 | END_FTR_SECTION_NESTED(CPU_FTR_HVMODE, CPU_FTR_HVMODE, 69) | ||
604 | END_FTR_SECTION_NESTED(CPU_FTR_ARCH_207S, CPU_FTR_ARCH_207S, 70) | ||
605 | 4: cmpd r0,r25 | ||
590 | beq 2f | 606 | beq 2f |
591 | mtspr SPRN_DSCR,r0 | 607 | mtspr SPRN_DSCR,r0 |
592 | 2: | 608 | 2: |
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 4e00d223b2e3..902ca3c6b4b6 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S | |||
@@ -848,7 +848,7 @@ hv_facility_unavailable_relon_trampoline: | |||
848 | . = 0x4f80 | 848 | . = 0x4f80 |
849 | SET_SCRATCH0(r13) | 849 | SET_SCRATCH0(r13) |
850 | EXCEPTION_PROLOG_0(PACA_EXGEN) | 850 | EXCEPTION_PROLOG_0(PACA_EXGEN) |
851 | b facility_unavailable_relon_hv | 851 | b hv_facility_unavailable_relon_hv |
852 | 852 | ||
853 | STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint) | 853 | STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint) |
854 | #ifdef CONFIG_PPC_DENORMALISATION | 854 | #ifdef CONFIG_PPC_DENORMALISATION |
@@ -1175,6 +1175,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX) | |||
1175 | b .ret_from_except | 1175 | b .ret_from_except |
1176 | 1176 | ||
1177 | STD_EXCEPTION_COMMON(0xf60, facility_unavailable, .facility_unavailable_exception) | 1177 | STD_EXCEPTION_COMMON(0xf60, facility_unavailable, .facility_unavailable_exception) |
1178 | STD_EXCEPTION_COMMON(0xf80, hv_facility_unavailable, .facility_unavailable_exception) | ||
1178 | 1179 | ||
1179 | .align 7 | 1180 | .align 7 |
1180 | .globl __end_handlers | 1181 | .globl __end_handlers |
@@ -1188,7 +1189,7 @@ __end_handlers: | |||
1188 | STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable) | 1189 | STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable) |
1189 | STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable) | 1190 | STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable) |
1190 | STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable) | 1191 | STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable) |
1191 | STD_RELON_EXCEPTION_HV_OOL(0xf80, facility_unavailable) | 1192 | STD_RELON_EXCEPTION_HV_OOL(0xf80, hv_facility_unavailable) |
1192 | 1193 | ||
1193 | #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) | 1194 | #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) |
1194 | /* | 1195 | /* |
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 2e51cde616d2..c69440cef7af 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -362,7 +362,7 @@ int arch_show_interrupts(struct seq_file *p, int prec) | |||
362 | seq_printf(p, "%10u ", per_cpu(irq_stat, j).spurious_irqs); | 362 | seq_printf(p, "%10u ", per_cpu(irq_stat, j).spurious_irqs); |
363 | seq_printf(p, " Spurious interrupts\n"); | 363 | seq_printf(p, " Spurious interrupts\n"); |
364 | 364 | ||
365 | seq_printf(p, "%*s: ", prec, "CNT"); | 365 | seq_printf(p, "%*s: ", prec, "PMI"); |
366 | for_each_online_cpu(j) | 366 | for_each_online_cpu(j) |
367 | seq_printf(p, "%10u ", per_cpu(irq_stat, j).pmu_irqs); | 367 | seq_printf(p, "%10u ", per_cpu(irq_stat, j).pmu_irqs); |
368 | seq_printf(p, " Performance monitoring interrupts\n"); | 368 | seq_printf(p, " Performance monitoring interrupts\n"); |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index c517dbe705fd..8083be20fe5e 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -600,6 +600,16 @@ struct task_struct *__switch_to(struct task_struct *prev, | |||
600 | struct ppc64_tlb_batch *batch; | 600 | struct ppc64_tlb_batch *batch; |
601 | #endif | 601 | #endif |
602 | 602 | ||
603 | /* Back up the TAR across context switches. | ||
604 | * Note that the TAR is not available for use in the kernel. (To | ||
605 | * provide this, the TAR should be backed up/restored on exception | ||
606 | * entry/exit instead, and be in pt_regs. FIXME, this should be in | ||
607 | * pt_regs anyway (for debug).) | ||
608 | * Save the TAR here before we do treclaim/trecheckpoint as these | ||
609 | * will change the TAR. | ||
610 | */ | ||
611 | save_tar(&prev->thread); | ||
612 | |||
603 | __switch_to_tm(prev); | 613 | __switch_to_tm(prev); |
604 | 614 | ||
605 | #ifdef CONFIG_SMP | 615 | #ifdef CONFIG_SMP |
diff --git a/arch/powerpc/kernel/tm.S b/arch/powerpc/kernel/tm.S index 51be8fb24803..0554d1f6d70d 100644 --- a/arch/powerpc/kernel/tm.S +++ b/arch/powerpc/kernel/tm.S | |||
@@ -233,6 +233,16 @@ dont_backup_fp: | |||
233 | std r5, _CCR(r7) | 233 | std r5, _CCR(r7) |
234 | std r6, _XER(r7) | 234 | std r6, _XER(r7) |
235 | 235 | ||
236 | |||
237 | /* ******************** TAR, PPR, DSCR ********** */ | ||
238 | mfspr r3, SPRN_TAR | ||
239 | mfspr r4, SPRN_PPR | ||
240 | mfspr r5, SPRN_DSCR | ||
241 | |||
242 | std r3, THREAD_TM_TAR(r12) | ||
243 | std r4, THREAD_TM_PPR(r12) | ||
244 | std r5, THREAD_TM_DSCR(r12) | ||
245 | |||
236 | /* MSR and flags: We don't change CRs, and we don't need to alter | 246 | /* MSR and flags: We don't change CRs, and we don't need to alter |
237 | * MSR. | 247 | * MSR. |
238 | */ | 248 | */ |
@@ -347,6 +357,16 @@ dont_restore_fp: | |||
347 | mtmsr r6 /* FP/Vec off again! */ | 357 | mtmsr r6 /* FP/Vec off again! */ |
348 | 358 | ||
349 | restore_gprs: | 359 | restore_gprs: |
360 | |||
361 | /* ******************** TAR, PPR, DSCR ********** */ | ||
362 | ld r4, THREAD_TM_TAR(r3) | ||
363 | ld r5, THREAD_TM_PPR(r3) | ||
364 | ld r6, THREAD_TM_DSCR(r3) | ||
365 | |||
366 | mtspr SPRN_TAR, r4 | ||
367 | mtspr SPRN_PPR, r5 | ||
368 | mtspr SPRN_DSCR, r6 | ||
369 | |||
350 | /* ******************** CR,LR,CCR,MSR ********** */ | 370 | /* ******************** CR,LR,CCR,MSR ********** */ |
351 | ld r3, _CTR(r7) | 371 | ld r3, _CTR(r7) |
352 | ld r4, _LINK(r7) | 372 | ld r4, _LINK(r7) |
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index bf33c22e38a4..e435bc089ea3 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c | |||
@@ -44,9 +44,7 @@ | |||
44 | #include <asm/machdep.h> | 44 | #include <asm/machdep.h> |
45 | #include <asm/rtas.h> | 45 | #include <asm/rtas.h> |
46 | #include <asm/pmc.h> | 46 | #include <asm/pmc.h> |
47 | #ifdef CONFIG_PPC32 | ||
48 | #include <asm/reg.h> | 47 | #include <asm/reg.h> |
49 | #endif | ||
50 | #ifdef CONFIG_PMAC_BACKLIGHT | 48 | #ifdef CONFIG_PMAC_BACKLIGHT |
51 | #include <asm/backlight.h> | 49 | #include <asm/backlight.h> |
52 | #endif | 50 | #endif |
@@ -1296,43 +1294,54 @@ void vsx_unavailable_exception(struct pt_regs *regs) | |||
1296 | die("Unrecoverable VSX Unavailable Exception", regs, SIGABRT); | 1294 | die("Unrecoverable VSX Unavailable Exception", regs, SIGABRT); |
1297 | } | 1295 | } |
1298 | 1296 | ||
1297 | #ifdef CONFIG_PPC64 | ||
1299 | void facility_unavailable_exception(struct pt_regs *regs) | 1298 | void facility_unavailable_exception(struct pt_regs *regs) |
1300 | { | 1299 | { |
1301 | static char *facility_strings[] = { | 1300 | static char *facility_strings[] = { |
1302 | "FPU", | 1301 | [FSCR_FP_LG] = "FPU", |
1303 | "VMX/VSX", | 1302 | [FSCR_VECVSX_LG] = "VMX/VSX", |
1304 | "DSCR", | 1303 | [FSCR_DSCR_LG] = "DSCR", |
1305 | "PMU SPRs", | 1304 | [FSCR_PM_LG] = "PMU SPRs", |
1306 | "BHRB", | 1305 | [FSCR_BHRB_LG] = "BHRB", |
1307 | "TM", | 1306 | [FSCR_TM_LG] = "TM", |
1308 | "AT", | 1307 | [FSCR_EBB_LG] = "EBB", |
1309 | "EBB", | 1308 | [FSCR_TAR_LG] = "TAR", |
1310 | "TAR", | ||
1311 | }; | 1309 | }; |
1312 | char *facility, *prefix; | 1310 | char *facility = "unknown"; |
1313 | u64 value; | 1311 | u64 value; |
1312 | u8 status; | ||
1313 | bool hv; | ||
1314 | 1314 | ||
1315 | if (regs->trap == 0xf60) { | 1315 | hv = (regs->trap == 0xf80); |
1316 | value = mfspr(SPRN_FSCR); | 1316 | if (hv) |
1317 | prefix = ""; | ||
1318 | } else { | ||
1319 | value = mfspr(SPRN_HFSCR); | 1317 | value = mfspr(SPRN_HFSCR); |
1320 | prefix = "Hypervisor "; | 1318 | else |
1319 | value = mfspr(SPRN_FSCR); | ||
1320 | |||
1321 | status = value >> 56; | ||
1322 | if (status == FSCR_DSCR_LG) { | ||
1323 | /* User is acessing the DSCR. Set the inherit bit and allow | ||
1324 | * the user to set it directly in future by setting via the | ||
1325 | * H/FSCR DSCR bit. | ||
1326 | */ | ||
1327 | current->thread.dscr_inherit = 1; | ||
1328 | if (hv) | ||
1329 | mtspr(SPRN_HFSCR, value | HFSCR_DSCR); | ||
1330 | else | ||
1331 | mtspr(SPRN_FSCR, value | FSCR_DSCR); | ||
1332 | return; | ||
1321 | } | 1333 | } |
1322 | 1334 | ||
1323 | value = value >> 56; | 1335 | if ((status < ARRAY_SIZE(facility_strings)) && |
1336 | facility_strings[status]) | ||
1337 | facility = facility_strings[status]; | ||
1324 | 1338 | ||
1325 | /* We restore the interrupt state now */ | 1339 | /* We restore the interrupt state now */ |
1326 | if (!arch_irq_disabled_regs(regs)) | 1340 | if (!arch_irq_disabled_regs(regs)) |
1327 | local_irq_enable(); | 1341 | local_irq_enable(); |
1328 | 1342 | ||
1329 | if (value < ARRAY_SIZE(facility_strings)) | ||
1330 | facility = facility_strings[value]; | ||
1331 | else | ||
1332 | facility = "unknown"; | ||
1333 | |||
1334 | pr_err("%sFacility '%s' unavailable, exception at 0x%lx, MSR=%lx\n", | 1343 | pr_err("%sFacility '%s' unavailable, exception at 0x%lx, MSR=%lx\n", |
1335 | prefix, facility, regs->nip, regs->msr); | 1344 | hv ? "Hypervisor " : "", facility, regs->nip, regs->msr); |
1336 | 1345 | ||
1337 | if (user_mode(regs)) { | 1346 | if (user_mode(regs)) { |
1338 | _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); | 1347 | _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); |
@@ -1341,6 +1350,7 @@ void facility_unavailable_exception(struct pt_regs *regs) | |||
1341 | 1350 | ||
1342 | die("Unexpected facility unavailable exception", regs, SIGABRT); | 1351 | die("Unexpected facility unavailable exception", regs, SIGABRT); |
1343 | } | 1352 | } |
1353 | #endif | ||
1344 | 1354 | ||
1345 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | 1355 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
1346 | 1356 | ||
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 2efa9dde741a..7629cd3eb91a 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c | |||
@@ -1809,7 +1809,7 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu) | |||
1809 | rma_size <<= PAGE_SHIFT; | 1809 | rma_size <<= PAGE_SHIFT; |
1810 | rmls = lpcr_rmls(rma_size); | 1810 | rmls = lpcr_rmls(rma_size); |
1811 | err = -EINVAL; | 1811 | err = -EINVAL; |
1812 | if (rmls < 0) { | 1812 | if ((long)rmls < 0) { |
1813 | pr_err("KVM: Can't use RMA of 0x%lx bytes\n", rma_size); | 1813 | pr_err("KVM: Can't use RMA of 0x%lx bytes\n", rma_size); |
1814 | goto out_srcu; | 1814 | goto out_srcu; |
1815 | } | 1815 | } |
@@ -1874,7 +1874,7 @@ int kvmppc_core_init_vm(struct kvm *kvm) | |||
1874 | /* Allocate the guest's logical partition ID */ | 1874 | /* Allocate the guest's logical partition ID */ |
1875 | 1875 | ||
1876 | lpid = kvmppc_alloc_lpid(); | 1876 | lpid = kvmppc_alloc_lpid(); |
1877 | if (lpid < 0) | 1877 | if ((long)lpid < 0) |
1878 | return -ENOMEM; | 1878 | return -ENOMEM; |
1879 | kvm->arch.lpid = lpid; | 1879 | kvm->arch.lpid = lpid; |
1880 | 1880 | ||
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index 19498a567a81..c6e13d9a9e15 100644 --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm/book3s_pr.c | |||
@@ -1047,11 +1047,12 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) | |||
1047 | if (err) | 1047 | if (err) |
1048 | goto free_shadow_vcpu; | 1048 | goto free_shadow_vcpu; |
1049 | 1049 | ||
1050 | err = -ENOMEM; | ||
1050 | p = __get_free_page(GFP_KERNEL|__GFP_ZERO); | 1051 | p = __get_free_page(GFP_KERNEL|__GFP_ZERO); |
1051 | /* the real shared page fills the last 4k of our page */ | ||
1052 | vcpu->arch.shared = (void*)(p + PAGE_SIZE - 4096); | ||
1053 | if (!p) | 1052 | if (!p) |
1054 | goto uninit_vcpu; | 1053 | goto uninit_vcpu; |
1054 | /* the real shared page fills the last 4k of our page */ | ||
1055 | vcpu->arch.shared = (void *)(p + PAGE_SIZE - 4096); | ||
1055 | 1056 | ||
1056 | #ifdef CONFIG_PPC_BOOK3S_64 | 1057 | #ifdef CONFIG_PPC_BOOK3S_64 |
1057 | /* default to book3s_64 (970fx) */ | 1058 | /* default to book3s_64 (970fx) */ |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 08397217e8ac..5850798826cd 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/seq_file.h> | 27 | #include <linux/seq_file.h> |
28 | #include <linux/uaccess.h> | 28 | #include <linux/uaccess.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <asm/cputhreads.h> | ||
30 | #include <asm/sparsemem.h> | 31 | #include <asm/sparsemem.h> |
31 | #include <asm/prom.h> | 32 | #include <asm/prom.h> |
32 | #include <asm/smp.h> | 33 | #include <asm/smp.h> |
@@ -1318,7 +1319,8 @@ static int update_cpu_associativity_changes_mask(void) | |||
1318 | } | 1319 | } |
1319 | } | 1320 | } |
1320 | if (changed) { | 1321 | if (changed) { |
1321 | cpumask_set_cpu(cpu, changes); | 1322 | cpumask_or(changes, changes, cpu_sibling_mask(cpu)); |
1323 | cpu = cpu_last_thread_sibling(cpu); | ||
1322 | } | 1324 | } |
1323 | } | 1325 | } |
1324 | 1326 | ||
@@ -1426,7 +1428,7 @@ static int update_cpu_topology(void *data) | |||
1426 | if (!data) | 1428 | if (!data) |
1427 | return -EINVAL; | 1429 | return -EINVAL; |
1428 | 1430 | ||
1429 | cpu = get_cpu(); | 1431 | cpu = smp_processor_id(); |
1430 | 1432 | ||
1431 | for (update = data; update; update = update->next) { | 1433 | for (update = data; update; update = update->next) { |
1432 | if (cpu != update->cpu) | 1434 | if (cpu != update->cpu) |
@@ -1446,12 +1448,12 @@ static int update_cpu_topology(void *data) | |||
1446 | */ | 1448 | */ |
1447 | int arch_update_cpu_topology(void) | 1449 | int arch_update_cpu_topology(void) |
1448 | { | 1450 | { |
1449 | unsigned int cpu, changed = 0; | 1451 | unsigned int cpu, sibling, changed = 0; |
1450 | struct topology_update_data *updates, *ud; | 1452 | struct topology_update_data *updates, *ud; |
1451 | unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0}; | 1453 | unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0}; |
1452 | cpumask_t updated_cpus; | 1454 | cpumask_t updated_cpus; |
1453 | struct device *dev; | 1455 | struct device *dev; |
1454 | int weight, i = 0; | 1456 | int weight, new_nid, i = 0; |
1455 | 1457 | ||
1456 | weight = cpumask_weight(&cpu_associativity_changes_mask); | 1458 | weight = cpumask_weight(&cpu_associativity_changes_mask); |
1457 | if (!weight) | 1459 | if (!weight) |
@@ -1464,19 +1466,46 @@ int arch_update_cpu_topology(void) | |||
1464 | cpumask_clear(&updated_cpus); | 1466 | cpumask_clear(&updated_cpus); |
1465 | 1467 | ||
1466 | for_each_cpu(cpu, &cpu_associativity_changes_mask) { | 1468 | for_each_cpu(cpu, &cpu_associativity_changes_mask) { |
1467 | ud = &updates[i++]; | 1469 | /* |
1468 | ud->cpu = cpu; | 1470 | * If siblings aren't flagged for changes, updates list |
1469 | vphn_get_associativity(cpu, associativity); | 1471 | * will be too short. Skip on this update and set for next |
1470 | ud->new_nid = associativity_to_nid(associativity); | 1472 | * update. |
1471 | 1473 | */ | |
1472 | if (ud->new_nid < 0 || !node_online(ud->new_nid)) | 1474 | if (!cpumask_subset(cpu_sibling_mask(cpu), |
1473 | ud->new_nid = first_online_node; | 1475 | &cpu_associativity_changes_mask)) { |
1476 | pr_info("Sibling bits not set for associativity " | ||
1477 | "change, cpu%d\n", cpu); | ||
1478 | cpumask_or(&cpu_associativity_changes_mask, | ||
1479 | &cpu_associativity_changes_mask, | ||
1480 | cpu_sibling_mask(cpu)); | ||
1481 | cpu = cpu_last_thread_sibling(cpu); | ||
1482 | continue; | ||
1483 | } | ||
1474 | 1484 | ||
1475 | ud->old_nid = numa_cpu_lookup_table[cpu]; | 1485 | /* Use associativity from first thread for all siblings */ |
1476 | cpumask_set_cpu(cpu, &updated_cpus); | 1486 | vphn_get_associativity(cpu, associativity); |
1487 | new_nid = associativity_to_nid(associativity); | ||
1488 | if (new_nid < 0 || !node_online(new_nid)) | ||
1489 | new_nid = first_online_node; | ||
1490 | |||
1491 | if (new_nid == numa_cpu_lookup_table[cpu]) { | ||
1492 | cpumask_andnot(&cpu_associativity_changes_mask, | ||
1493 | &cpu_associativity_changes_mask, | ||
1494 | cpu_sibling_mask(cpu)); | ||
1495 | cpu = cpu_last_thread_sibling(cpu); | ||
1496 | continue; | ||
1497 | } | ||
1477 | 1498 | ||
1478 | if (i < weight) | 1499 | for_each_cpu(sibling, cpu_sibling_mask(cpu)) { |
1479 | ud->next = &updates[i]; | 1500 | ud = &updates[i++]; |
1501 | ud->cpu = sibling; | ||
1502 | ud->new_nid = new_nid; | ||
1503 | ud->old_nid = numa_cpu_lookup_table[sibling]; | ||
1504 | cpumask_set_cpu(sibling, &updated_cpus); | ||
1505 | if (i < weight) | ||
1506 | ud->next = &updates[i]; | ||
1507 | } | ||
1508 | cpu = cpu_last_thread_sibling(cpu); | ||
1480 | } | 1509 | } |
1481 | 1510 | ||
1482 | stop_machine(update_cpu_topology, &updates[0], &updated_cpus); | 1511 | stop_machine(update_cpu_topology, &updates[0], &updated_cpus); |
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index 24a45f91c65f..eeae308cf982 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c | |||
@@ -484,7 +484,7 @@ static bool is_ebb_event(struct perf_event *event) | |||
484 | * use bit 63 of the event code for something else if they wish. | 484 | * use bit 63 of the event code for something else if they wish. |
485 | */ | 485 | */ |
486 | return (ppmu->flags & PPMU_EBB) && | 486 | return (ppmu->flags & PPMU_EBB) && |
487 | ((event->attr.config >> EVENT_CONFIG_EBB_SHIFT) & 1); | 487 | ((event->attr.config >> PERF_EVENT_CONFIG_EBB_SHIFT) & 1); |
488 | } | 488 | } |
489 | 489 | ||
490 | static int ebb_event_check(struct perf_event *event) | 490 | static int ebb_event_check(struct perf_event *event) |
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c index 7466374d2787..2ee4a707f0df 100644 --- a/arch/powerpc/perf/power8-pmu.c +++ b/arch/powerpc/perf/power8-pmu.c | |||
@@ -118,7 +118,7 @@ | |||
118 | (EVENT_UNIT_MASK << EVENT_UNIT_SHIFT) | \ | 118 | (EVENT_UNIT_MASK << EVENT_UNIT_SHIFT) | \ |
119 | (EVENT_COMBINE_MASK << EVENT_COMBINE_SHIFT) | \ | 119 | (EVENT_COMBINE_MASK << EVENT_COMBINE_SHIFT) | \ |
120 | (EVENT_MARKED_MASK << EVENT_MARKED_SHIFT) | \ | 120 | (EVENT_MARKED_MASK << EVENT_MARKED_SHIFT) | \ |
121 | (EVENT_EBB_MASK << EVENT_CONFIG_EBB_SHIFT) | \ | 121 | (EVENT_EBB_MASK << PERF_EVENT_CONFIG_EBB_SHIFT) | \ |
122 | EVENT_PSEL_MASK) | 122 | EVENT_PSEL_MASK) |
123 | 123 | ||
124 | /* MMCRA IFM bits - POWER8 */ | 124 | /* MMCRA IFM bits - POWER8 */ |
@@ -233,10 +233,10 @@ static int power8_get_constraint(u64 event, unsigned long *maskp, unsigned long | |||
233 | pmc = (event >> EVENT_PMC_SHIFT) & EVENT_PMC_MASK; | 233 | pmc = (event >> EVENT_PMC_SHIFT) & EVENT_PMC_MASK; |
234 | unit = (event >> EVENT_UNIT_SHIFT) & EVENT_UNIT_MASK; | 234 | unit = (event >> EVENT_UNIT_SHIFT) & EVENT_UNIT_MASK; |
235 | cache = (event >> EVENT_CACHE_SEL_SHIFT) & EVENT_CACHE_SEL_MASK; | 235 | cache = (event >> EVENT_CACHE_SEL_SHIFT) & EVENT_CACHE_SEL_MASK; |
236 | ebb = (event >> EVENT_CONFIG_EBB_SHIFT) & EVENT_EBB_MASK; | 236 | ebb = (event >> PERF_EVENT_CONFIG_EBB_SHIFT) & EVENT_EBB_MASK; |
237 | 237 | ||
238 | /* Clear the EBB bit in the event, so event checks work below */ | 238 | /* Clear the EBB bit in the event, so event checks work below */ |
239 | event &= ~(EVENT_EBB_MASK << EVENT_CONFIG_EBB_SHIFT); | 239 | event &= ~(EVENT_EBB_MASK << PERF_EVENT_CONFIG_EBB_SHIFT); |
240 | 240 | ||
241 | if (pmc) { | 241 | if (pmc) { |
242 | if (pmc > 6) | 242 | if (pmc > 6) |
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c index 9f8671a44551..6a5f2b1f32ca 100644 --- a/arch/powerpc/platforms/pseries/nvram.c +++ b/arch/powerpc/platforms/pseries/nvram.c | |||
@@ -569,35 +569,6 @@ error: | |||
569 | return ret; | 569 | return ret; |
570 | } | 570 | } |
571 | 571 | ||
572 | static int unzip_oops(char *oops_buf, char *big_buf) | ||
573 | { | ||
574 | struct oops_log_info *oops_hdr = (struct oops_log_info *)oops_buf; | ||
575 | u64 timestamp = oops_hdr->timestamp; | ||
576 | char *big_oops_data = NULL; | ||
577 | char *oops_data_buf = NULL; | ||
578 | size_t big_oops_data_sz; | ||
579 | int unzipped_len; | ||
580 | |||
581 | big_oops_data = big_buf + sizeof(struct oops_log_info); | ||
582 | big_oops_data_sz = big_oops_buf_sz - sizeof(struct oops_log_info); | ||
583 | oops_data_buf = oops_buf + sizeof(struct oops_log_info); | ||
584 | |||
585 | unzipped_len = nvram_decompress(oops_data_buf, big_oops_data, | ||
586 | oops_hdr->report_length, | ||
587 | big_oops_data_sz); | ||
588 | |||
589 | if (unzipped_len < 0) { | ||
590 | pr_err("nvram: decompression failed; returned %d\n", | ||
591 | unzipped_len); | ||
592 | return -1; | ||
593 | } | ||
594 | oops_hdr = (struct oops_log_info *)big_buf; | ||
595 | oops_hdr->version = OOPS_HDR_VERSION; | ||
596 | oops_hdr->report_length = (u16) unzipped_len; | ||
597 | oops_hdr->timestamp = timestamp; | ||
598 | return 0; | ||
599 | } | ||
600 | |||
601 | static int nvram_pstore_open(struct pstore_info *psi) | 572 | static int nvram_pstore_open(struct pstore_info *psi) |
602 | { | 573 | { |
603 | /* Reset the iterator to start reading partitions again */ | 574 | /* Reset the iterator to start reading partitions again */ |
@@ -685,10 +656,9 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type, | |||
685 | unsigned int err_type, id_no, size = 0; | 656 | unsigned int err_type, id_no, size = 0; |
686 | struct nvram_os_partition *part = NULL; | 657 | struct nvram_os_partition *part = NULL; |
687 | char *buff = NULL, *big_buff = NULL; | 658 | char *buff = NULL, *big_buff = NULL; |
688 | int rc, sig = 0; | 659 | int sig = 0; |
689 | loff_t p; | 660 | loff_t p; |
690 | 661 | ||
691 | read_partition: | ||
692 | read_type++; | 662 | read_type++; |
693 | 663 | ||
694 | switch (nvram_type_ids[read_type]) { | 664 | switch (nvram_type_ids[read_type]) { |
@@ -749,30 +719,46 @@ read_partition: | |||
749 | *id = id_no; | 719 | *id = id_no; |
750 | 720 | ||
751 | if (nvram_type_ids[read_type] == PSTORE_TYPE_DMESG) { | 721 | if (nvram_type_ids[read_type] == PSTORE_TYPE_DMESG) { |
722 | int length, unzipped_len; | ||
723 | size_t hdr_size; | ||
724 | |||
752 | oops_hdr = (struct oops_log_info *)buff; | 725 | oops_hdr = (struct oops_log_info *)buff; |
753 | *buf = buff + sizeof(*oops_hdr); | 726 | if (oops_hdr->version < OOPS_HDR_VERSION) { |
727 | /* Old format oops header had 2-byte record size */ | ||
728 | hdr_size = sizeof(u16); | ||
729 | length = oops_hdr->version; | ||
730 | time->tv_sec = 0; | ||
731 | time->tv_nsec = 0; | ||
732 | } else { | ||
733 | hdr_size = sizeof(*oops_hdr); | ||
734 | length = oops_hdr->report_length; | ||
735 | time->tv_sec = oops_hdr->timestamp; | ||
736 | time->tv_nsec = 0; | ||
737 | } | ||
738 | *buf = kmalloc(length, GFP_KERNEL); | ||
739 | if (*buf == NULL) | ||
740 | return -ENOMEM; | ||
741 | memcpy(*buf, buff + hdr_size, length); | ||
742 | kfree(buff); | ||
754 | 743 | ||
755 | if (err_type == ERR_TYPE_KERNEL_PANIC_GZ) { | 744 | if (err_type == ERR_TYPE_KERNEL_PANIC_GZ) { |
756 | big_buff = kmalloc(big_oops_buf_sz, GFP_KERNEL); | 745 | big_buff = kmalloc(big_oops_buf_sz, GFP_KERNEL); |
757 | if (!big_buff) | 746 | if (!big_buff) |
758 | return -ENOMEM; | 747 | return -ENOMEM; |
759 | 748 | ||
760 | rc = unzip_oops(buff, big_buff); | 749 | unzipped_len = nvram_decompress(*buf, big_buff, |
750 | length, big_oops_buf_sz); | ||
761 | 751 | ||
762 | if (rc != 0) { | 752 | if (unzipped_len < 0) { |
763 | kfree(buff); | 753 | pr_err("nvram: decompression failed, returned " |
754 | "rc %d\n", unzipped_len); | ||
764 | kfree(big_buff); | 755 | kfree(big_buff); |
765 | goto read_partition; | 756 | } else { |
757 | *buf = big_buff; | ||
758 | length = unzipped_len; | ||
766 | } | 759 | } |
767 | |||
768 | oops_hdr = (struct oops_log_info *)big_buff; | ||
769 | *buf = big_buff + sizeof(*oops_hdr); | ||
770 | kfree(buff); | ||
771 | } | 760 | } |
772 | 761 | return length; | |
773 | time->tv_sec = oops_hdr->timestamp; | ||
774 | time->tv_nsec = 0; | ||
775 | return oops_hdr->report_length; | ||
776 | } | 762 | } |
777 | 763 | ||
778 | *buf = buff; | 764 | *buf = buff; |
@@ -816,6 +802,7 @@ static int nvram_pstore_init(void) | |||
816 | static void __init nvram_init_oops_partition(int rtas_partition_exists) | 802 | static void __init nvram_init_oops_partition(int rtas_partition_exists) |
817 | { | 803 | { |
818 | int rc; | 804 | int rc; |
805 | size_t size; | ||
819 | 806 | ||
820 | rc = pseries_nvram_init_os_partition(&oops_log_partition); | 807 | rc = pseries_nvram_init_os_partition(&oops_log_partition); |
821 | if (rc != 0) { | 808 | if (rc != 0) { |
@@ -844,8 +831,9 @@ static void __init nvram_init_oops_partition(int rtas_partition_exists) | |||
844 | big_oops_buf_sz = (oops_data_sz * 100) / 45; | 831 | big_oops_buf_sz = (oops_data_sz * 100) / 45; |
845 | big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); | 832 | big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); |
846 | if (big_oops_buf) { | 833 | if (big_oops_buf) { |
847 | stream.workspace = kmalloc(zlib_deflate_workspacesize( | 834 | size = max(zlib_deflate_workspacesize(WINDOW_BITS, MEM_LEVEL), |
848 | WINDOW_BITS, MEM_LEVEL), GFP_KERNEL); | 835 | zlib_inflate_workspacesize()); |
836 | stream.workspace = kmalloc(size, GFP_KERNEL); | ||
849 | if (!stream.workspace) { | 837 | if (!stream.workspace) { |
850 | pr_err("nvram: No memory for compression workspace; " | 838 | pr_err("nvram: No memory for compression workspace; " |
851 | "skipping compression of %s partition data\n", | 839 | "skipping compression of %s partition data\n", |
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 22f75b504f7f..8a4cae78f03c 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -118,6 +118,7 @@ config S390 | |||
118 | select HAVE_FUNCTION_TRACE_MCOUNT_TEST | 118 | select HAVE_FUNCTION_TRACE_MCOUNT_TEST |
119 | select HAVE_KERNEL_BZIP2 | 119 | select HAVE_KERNEL_BZIP2 |
120 | select HAVE_KERNEL_GZIP | 120 | select HAVE_KERNEL_GZIP |
121 | select HAVE_KERNEL_LZ4 | ||
121 | select HAVE_KERNEL_LZMA | 122 | select HAVE_KERNEL_LZMA |
122 | select HAVE_KERNEL_LZO | 123 | select HAVE_KERNEL_LZO |
123 | select HAVE_KERNEL_XZ | 124 | select HAVE_KERNEL_XZ |
@@ -227,11 +228,12 @@ config MARCH_Z196 | |||
227 | not work on older machines. | 228 | not work on older machines. |
228 | 229 | ||
229 | config MARCH_ZEC12 | 230 | config MARCH_ZEC12 |
230 | bool "IBM zEC12" | 231 | bool "IBM zBC12 and zEC12" |
231 | select HAVE_MARCH_ZEC12_FEATURES if 64BIT | 232 | select HAVE_MARCH_ZEC12_FEATURES if 64BIT |
232 | help | 233 | help |
233 | Select this to enable optimizations for IBM zEC12 (2827 series). The | 234 | Select this to enable optimizations for IBM zBC12 and zEC12 (2828 and |
234 | kernel will be slightly faster but will not work on older machines. | 235 | 2827 series). The kernel will be slightly faster but will not work on |
236 | older machines. | ||
235 | 237 | ||
236 | endchoice | 238 | endchoice |
237 | 239 | ||
@@ -709,6 +711,7 @@ config S390_GUEST | |||
709 | def_bool y | 711 | def_bool y |
710 | prompt "s390 support for virtio devices" | 712 | prompt "s390 support for virtio devices" |
711 | depends on 64BIT | 713 | depends on 64BIT |
714 | select TTY | ||
712 | select VIRTUALIZATION | 715 | select VIRTUALIZATION |
713 | select VIRTIO | 716 | select VIRTIO |
714 | select VIRTIO_CONSOLE | 717 | select VIRTIO_CONSOLE |
diff --git a/arch/s390/boot/compressed/Makefile b/arch/s390/boot/compressed/Makefile index 3ad8f61c9985..866ecbe670e4 100644 --- a/arch/s390/boot/compressed/Makefile +++ b/arch/s390/boot/compressed/Makefile | |||
@@ -6,9 +6,9 @@ | |||
6 | 6 | ||
7 | BITS := $(if $(CONFIG_64BIT),64,31) | 7 | BITS := $(if $(CONFIG_64BIT),64,31) |
8 | 8 | ||
9 | targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \ | 9 | targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 |
10 | vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo misc.o piggy.o \ | 10 | targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4 |
11 | sizes.h head$(BITS).o | 11 | targets += misc.o piggy.o sizes.h head$(BITS).o |
12 | 12 | ||
13 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 | 13 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 |
14 | KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING | 14 | KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING |
@@ -48,6 +48,7 @@ vmlinux.bin.all-y := $(obj)/vmlinux.bin | |||
48 | 48 | ||
49 | suffix-$(CONFIG_KERNEL_GZIP) := gz | 49 | suffix-$(CONFIG_KERNEL_GZIP) := gz |
50 | suffix-$(CONFIG_KERNEL_BZIP2) := bz2 | 50 | suffix-$(CONFIG_KERNEL_BZIP2) := bz2 |
51 | suffix-$(CONFIG_KERNEL_LZ4) := lz4 | ||
51 | suffix-$(CONFIG_KERNEL_LZMA) := lzma | 52 | suffix-$(CONFIG_KERNEL_LZMA) := lzma |
52 | suffix-$(CONFIG_KERNEL_LZO) := lzo | 53 | suffix-$(CONFIG_KERNEL_LZO) := lzo |
53 | suffix-$(CONFIG_KERNEL_XZ) := xz | 54 | suffix-$(CONFIG_KERNEL_XZ) := xz |
@@ -56,6 +57,8 @@ $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) | |||
56 | $(call if_changed,gzip) | 57 | $(call if_changed,gzip) |
57 | $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) | 58 | $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) |
58 | $(call if_changed,bzip2) | 59 | $(call if_changed,bzip2) |
60 | $(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) | ||
61 | $(call if_changed,lz4) | ||
59 | $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) | 62 | $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) |
60 | $(call if_changed,lzma) | 63 | $(call if_changed,lzma) |
61 | $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) | 64 | $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) |
diff --git a/arch/s390/boot/compressed/misc.c b/arch/s390/boot/compressed/misc.c index c4c6a1cf221b..57cbaff1f397 100644 --- a/arch/s390/boot/compressed/misc.c +++ b/arch/s390/boot/compressed/misc.c | |||
@@ -47,6 +47,10 @@ static unsigned long free_mem_end_ptr; | |||
47 | #include "../../../../lib/decompress_bunzip2.c" | 47 | #include "../../../../lib/decompress_bunzip2.c" |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #ifdef CONFIG_KERNEL_LZ4 | ||
51 | #include "../../../../lib/decompress_unlz4.c" | ||
52 | #endif | ||
53 | |||
50 | #ifdef CONFIG_KERNEL_LZMA | 54 | #ifdef CONFIG_KERNEL_LZMA |
51 | #include "../../../../lib/decompress_unlzma.c" | 55 | #include "../../../../lib/decompress_unlzma.c" |
52 | #endif | 56 | #endif |
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h index 4d8604e311f3..7d4676758733 100644 --- a/arch/s390/include/asm/bitops.h +++ b/arch/s390/include/asm/bitops.h | |||
@@ -693,7 +693,7 @@ static inline int find_next_bit_left(const unsigned long *addr, | |||
693 | size -= offset; | 693 | size -= offset; |
694 | p = addr + offset / BITS_PER_LONG; | 694 | p = addr + offset / BITS_PER_LONG; |
695 | if (bit) { | 695 | if (bit) { |
696 | set = __flo_word(0, *p & (~0UL << bit)); | 696 | set = __flo_word(0, *p & (~0UL >> bit)); |
697 | if (set >= size) | 697 | if (set >= size) |
698 | return size + offset; | 698 | return size + offset; |
699 | if (set < BITS_PER_LONG) | 699 | if (set < BITS_PER_LONG) |
diff --git a/arch/s390/kernel/perf_event.c b/arch/s390/kernel/perf_event.c index a6fc037671b1..500aa1029bcb 100644 --- a/arch/s390/kernel/perf_event.c +++ b/arch/s390/kernel/perf_event.c | |||
@@ -52,12 +52,13 @@ static struct kvm_s390_sie_block *sie_block(struct pt_regs *regs) | |||
52 | 52 | ||
53 | static bool is_in_guest(struct pt_regs *regs) | 53 | static bool is_in_guest(struct pt_regs *regs) |
54 | { | 54 | { |
55 | unsigned long ip = instruction_pointer(regs); | ||
56 | |||
57 | if (user_mode(regs)) | 55 | if (user_mode(regs)) |
58 | return false; | 56 | return false; |
59 | 57 | #if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) | |
60 | return ip == (unsigned long) &sie_exit; | 58 | return instruction_pointer(regs) == (unsigned long) &sie_exit; |
59 | #else | ||
60 | return false; | ||
61 | #endif | ||
61 | } | 62 | } |
62 | 63 | ||
63 | static unsigned long guest_is_user_mode(struct pt_regs *regs) | 64 | static unsigned long guest_is_user_mode(struct pt_regs *regs) |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 497451ec5e26..aeed8a61fa0d 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -994,6 +994,7 @@ static void __init setup_hwcaps(void) | |||
994 | strcpy(elf_platform, "z196"); | 994 | strcpy(elf_platform, "z196"); |
995 | break; | 995 | break; |
996 | case 0x2827: | 996 | case 0x2827: |
997 | case 0x2828: | ||
997 | strcpy(elf_platform, "zEC12"); | 998 | strcpy(elf_platform, "zEC12"); |
998 | break; | 999 | break; |
999 | } | 1000 | } |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index ba694d2ba51e..34c1c9a90be2 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -702,14 +702,25 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) | |||
702 | return rc; | 702 | return rc; |
703 | 703 | ||
704 | vcpu->arch.sie_block->icptcode = 0; | 704 | vcpu->arch.sie_block->icptcode = 0; |
705 | preempt_disable(); | ||
706 | kvm_guest_enter(); | ||
707 | preempt_enable(); | ||
708 | VCPU_EVENT(vcpu, 6, "entering sie flags %x", | 705 | VCPU_EVENT(vcpu, 6, "entering sie flags %x", |
709 | atomic_read(&vcpu->arch.sie_block->cpuflags)); | 706 | atomic_read(&vcpu->arch.sie_block->cpuflags)); |
710 | trace_kvm_s390_sie_enter(vcpu, | 707 | trace_kvm_s390_sie_enter(vcpu, |
711 | atomic_read(&vcpu->arch.sie_block->cpuflags)); | 708 | atomic_read(&vcpu->arch.sie_block->cpuflags)); |
709 | |||
710 | /* | ||
711 | * As PF_VCPU will be used in fault handler, between guest_enter | ||
712 | * and guest_exit should be no uaccess. | ||
713 | */ | ||
714 | preempt_disable(); | ||
715 | kvm_guest_enter(); | ||
716 | preempt_enable(); | ||
712 | rc = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs); | 717 | rc = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs); |
718 | kvm_guest_exit(); | ||
719 | |||
720 | VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", | ||
721 | vcpu->arch.sie_block->icptcode); | ||
722 | trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode); | ||
723 | |||
713 | if (rc > 0) | 724 | if (rc > 0) |
714 | rc = 0; | 725 | rc = 0; |
715 | if (rc < 0) { | 726 | if (rc < 0) { |
@@ -721,10 +732,6 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) | |||
721 | rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | 732 | rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
722 | } | 733 | } |
723 | } | 734 | } |
724 | VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", | ||
725 | vcpu->arch.sie_block->icptcode); | ||
726 | trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode); | ||
727 | kvm_guest_exit(); | ||
728 | 735 | ||
729 | memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16); | 736 | memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16); |
730 | return rc; | 737 | return rc; |
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c index 0da3e6eb6be6..4cdc54e63ebc 100644 --- a/arch/s390/kvm/priv.c +++ b/arch/s390/kvm/priv.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
17 | #include <linux/compat.h> | 17 | #include <linux/compat.h> |
18 | #include <asm/asm-offsets.h> | 18 | #include <asm/asm-offsets.h> |
19 | #include <asm/facility.h> | ||
19 | #include <asm/current.h> | 20 | #include <asm/current.h> |
20 | #include <asm/debug.h> | 21 | #include <asm/debug.h> |
21 | #include <asm/ebcdic.h> | 22 | #include <asm/ebcdic.h> |
@@ -532,8 +533,7 @@ static int handle_pfmf(struct kvm_vcpu *vcpu) | |||
532 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); | 533 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
533 | 534 | ||
534 | /* Only provide non-quiescing support if the host supports it */ | 535 | /* Only provide non-quiescing support if the host supports it */ |
535 | if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ && | 536 | if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ && !test_facility(14)) |
536 | S390_lowcore.stfl_fac_list & 0x00020000) | ||
537 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); | 537 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
538 | 538 | ||
539 | /* No support for conditional-SSKE */ | 539 | /* No support for conditional-SSKE */ |
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index ce36ea80e4f9..ad446b0c55b6 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c | |||
@@ -69,6 +69,7 @@ static void __init setup_zero_pages(void) | |||
69 | order = 2; | 69 | order = 2; |
70 | break; | 70 | break; |
71 | case 0x2827: /* zEC12 */ | 71 | case 0x2827: /* zEC12 */ |
72 | case 0x2828: /* zEC12 */ | ||
72 | default: | 73 | default: |
73 | order = 5; | 74 | order = 5; |
74 | break; | 75 | break; |
diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c index ffeb17ce7f31..930783d2c99b 100644 --- a/arch/s390/oprofile/init.c +++ b/arch/s390/oprofile/init.c | |||
@@ -440,7 +440,7 @@ static int oprofile_hwsampler_init(struct oprofile_operations *ops) | |||
440 | switch (id.machine) { | 440 | switch (id.machine) { |
441 | case 0x2097: case 0x2098: ops->cpu_type = "s390/z10"; break; | 441 | case 0x2097: case 0x2098: ops->cpu_type = "s390/z10"; break; |
442 | case 0x2817: case 0x2818: ops->cpu_type = "s390/z196"; break; | 442 | case 0x2817: case 0x2818: ops->cpu_type = "s390/z196"; break; |
443 | case 0x2827: ops->cpu_type = "s390/zEC12"; break; | 443 | case 0x2827: case 0x2828: ops->cpu_type = "s390/zEC12"; break; |
444 | default: return -ENODEV; | 444 | default: return -ENODEV; |
445 | } | 445 | } |
446 | } | 446 | } |
diff --git a/arch/sh/configs/sh03_defconfig b/arch/sh/configs/sh03_defconfig index 2051821724c6..0cf4097b71e8 100644 --- a/arch/sh/configs/sh03_defconfig +++ b/arch/sh/configs/sh03_defconfig | |||
@@ -22,7 +22,7 @@ CONFIG_PREEMPT=y | |||
22 | CONFIG_CMDLINE_OVERWRITE=y | 22 | CONFIG_CMDLINE_OVERWRITE=y |
23 | CONFIG_CMDLINE="console=ttySC1,115200 mem=64M root=/dev/nfs" | 23 | CONFIG_CMDLINE="console=ttySC1,115200 mem=64M root=/dev/nfs" |
24 | CONFIG_PCI=y | 24 | CONFIG_PCI=y |
25 | CONFIG_HOTPLUG_PCI=m | 25 | CONFIG_HOTPLUG_PCI=y |
26 | CONFIG_BINFMT_MISC=y | 26 | CONFIG_BINFMT_MISC=y |
27 | CONFIG_NET=y | 27 | CONFIG_NET=y |
28 | CONFIG_PACKET=y | 28 | CONFIG_PACKET=y |
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index d606463aa6d6..b7388a425f09 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c | |||
@@ -225,7 +225,7 @@ static void low_free(unsigned long size, unsigned long addr) | |||
225 | unsigned long nr_pages; | 225 | unsigned long nr_pages; |
226 | 226 | ||
227 | nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE; | 227 | nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE; |
228 | efi_call_phys2(sys_table->boottime->free_pages, addr, size); | 228 | efi_call_phys2(sys_table->boottime->free_pages, addr, nr_pages); |
229 | } | 229 | } |
230 | 230 | ||
231 | static void find_bits(unsigned long mask, u8 *pos, u8 *size) | 231 | static void find_bits(unsigned long mask, u8 *pos, u8 *size) |
diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c index e2703520d120..c370e1c4468b 100644 --- a/arch/x86/kernel/cpu/mcheck/mce-severity.c +++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c | |||
@@ -111,8 +111,8 @@ static struct severity { | |||
111 | #ifdef CONFIG_MEMORY_FAILURE | 111 | #ifdef CONFIG_MEMORY_FAILURE |
112 | MCESEV( | 112 | MCESEV( |
113 | KEEP, "Action required but unaffected thread is continuable", | 113 | KEEP, "Action required but unaffected thread is continuable", |
114 | SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR), | 114 | SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR, MCI_UC_SAR|MCI_ADDR), |
115 | MCGMASK(MCG_STATUS_RIPV, MCG_STATUS_RIPV) | 115 | MCGMASK(MCG_STATUS_RIPV|MCG_STATUS_EIPV, MCG_STATUS_RIPV) |
116 | ), | 116 | ), |
117 | MCESEV( | 117 | MCESEV( |
118 | AR, "Action required: data load error in a user process", | 118 | AR, "Action required: data load error in a user process", |
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 94ab6b90dd3f..63bdb29b2549 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c | |||
@@ -196,15 +196,23 @@ static void __init ati_bugs_contd(int num, int slot, int func) | |||
196 | static void __init intel_remapping_check(int num, int slot, int func) | 196 | static void __init intel_remapping_check(int num, int slot, int func) |
197 | { | 197 | { |
198 | u8 revision; | 198 | u8 revision; |
199 | u16 device; | ||
199 | 200 | ||
201 | device = read_pci_config_16(num, slot, func, PCI_DEVICE_ID); | ||
200 | revision = read_pci_config_byte(num, slot, func, PCI_REVISION_ID); | 202 | revision = read_pci_config_byte(num, slot, func, PCI_REVISION_ID); |
201 | 203 | ||
202 | /* | 204 | /* |
203 | * Revision 0x13 of this chipset supports irq remapping | 205 | * Revision 13 of all triggering devices id in this quirk have |
204 | * but has an erratum that breaks its behavior, flag it as such | 206 | * a problem draining interrupts when irq remapping is enabled, |
207 | * and should be flagged as broken. Additionally revisions 0x12 | ||
208 | * and 0x22 of device id 0x3405 has this problem. | ||
205 | */ | 209 | */ |
206 | if (revision == 0x13) | 210 | if (revision == 0x13) |
207 | set_irq_remapping_broken(); | 211 | set_irq_remapping_broken(); |
212 | else if ((device == 0x3405) && | ||
213 | ((revision == 0x12) || | ||
214 | (revision == 0x22))) | ||
215 | set_irq_remapping_broken(); | ||
208 | 216 | ||
209 | } | 217 | } |
210 | 218 | ||
@@ -239,6 +247,8 @@ static struct chipset early_qrk[] __initdata = { | |||
239 | PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd }, | 247 | PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd }, |
240 | { PCI_VENDOR_ID_INTEL, 0x3403, PCI_CLASS_BRIDGE_HOST, | 248 | { PCI_VENDOR_ID_INTEL, 0x3403, PCI_CLASS_BRIDGE_HOST, |
241 | PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, | 249 | PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, |
250 | { PCI_VENDOR_ID_INTEL, 0x3405, PCI_CLASS_BRIDGE_HOST, | ||
251 | PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, | ||
242 | { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, | 252 | { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, |
243 | PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, | 253 | PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, |
244 | {} | 254 | {} |
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index 202d24f0f7e7..5d576ab34403 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c | |||
@@ -116,7 +116,7 @@ static void mxcsr_feature_mask_init(void) | |||
116 | 116 | ||
117 | if (cpu_has_fxsr) { | 117 | if (cpu_has_fxsr) { |
118 | memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct)); | 118 | memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct)); |
119 | asm volatile("fxsave %0" : : "m" (fx_scratch)); | 119 | asm volatile("fxsave %0" : "+m" (fx_scratch)); |
120 | mask = fx_scratch.mxcsr_mask; | 120 | mask = fx_scratch.mxcsr_mask; |
121 | if (mask == 0) | 121 | if (mask == 0) |
122 | mask = 0x0000ffbf; | 122 | mask = 0x0000ffbf; |
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index 47ebb1dbfbcb..7a0adb7ee433 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c | |||
@@ -220,12 +220,13 @@ int apply_microcode_amd(int cpu) | |||
220 | return 0; | 220 | return 0; |
221 | } | 221 | } |
222 | 222 | ||
223 | if (__apply_microcode_amd(mc_amd)) | 223 | if (__apply_microcode_amd(mc_amd)) { |
224 | pr_err("CPU%d: update failed for patch_level=0x%08x\n", | 224 | pr_err("CPU%d: update failed for patch_level=0x%08x\n", |
225 | cpu, mc_amd->hdr.patch_id); | 225 | cpu, mc_amd->hdr.patch_id); |
226 | else | 226 | return -1; |
227 | pr_info("CPU%d: new patch_level=0x%08x\n", cpu, | 227 | } |
228 | mc_amd->hdr.patch_id); | 228 | pr_info("CPU%d: new patch_level=0x%08x\n", cpu, |
229 | mc_amd->hdr.patch_id); | ||
229 | 230 | ||
230 | uci->cpu_sig.rev = mc_amd->hdr.patch_id; | 231 | uci->cpu_sig.rev = mc_amd->hdr.patch_id; |
231 | c->microcode = mc_amd->hdr.patch_id; | 232 | c->microcode = mc_amd->hdr.patch_id; |
diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c index 643b8b5eee86..8244f5ec2f4c 100644 --- a/arch/x86/platform/ce4100/ce4100.c +++ b/arch/x86/platform/ce4100/ce4100.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/reboot.h> | ||
15 | #include <linux/serial_reg.h> | 16 | #include <linux/serial_reg.h> |
16 | #include <linux/serial_8250.h> | 17 | #include <linux/serial_8250.h> |
17 | #include <linux/reboot.h> | 18 | #include <linux/reboot.h> |
diff --git a/drivers/accessibility/braille/braille_console.c b/drivers/accessibility/braille/braille_console.c index d21167bfc865..dc34a5b8bcee 100644 --- a/drivers/accessibility/braille/braille_console.c +++ b/drivers/accessibility/braille/braille_console.c | |||
@@ -359,6 +359,9 @@ int braille_register_console(struct console *console, int index, | |||
359 | char *console_options, char *braille_options) | 359 | char *console_options, char *braille_options) |
360 | { | 360 | { |
361 | int ret; | 361 | int ret; |
362 | |||
363 | if (!(console->flags & CON_BRL)) | ||
364 | return 0; | ||
362 | if (!console_options) | 365 | if (!console_options) |
363 | /* Only support VisioBraille for now */ | 366 | /* Only support VisioBraille for now */ |
364 | console_options = "57600o8"; | 367 | console_options = "57600o8"; |
@@ -374,15 +377,17 @@ int braille_register_console(struct console *console, int index, | |||
374 | braille_co = console; | 377 | braille_co = console; |
375 | register_keyboard_notifier(&keyboard_notifier_block); | 378 | register_keyboard_notifier(&keyboard_notifier_block); |
376 | register_vt_notifier(&vt_notifier_block); | 379 | register_vt_notifier(&vt_notifier_block); |
377 | return 0; | 380 | return 1; |
378 | } | 381 | } |
379 | 382 | ||
380 | int braille_unregister_console(struct console *console) | 383 | int braille_unregister_console(struct console *console) |
381 | { | 384 | { |
382 | if (braille_co != console) | 385 | if (braille_co != console) |
383 | return -EINVAL; | 386 | return -EINVAL; |
387 | if (!(console->flags & CON_BRL)) | ||
388 | return 0; | ||
384 | unregister_keyboard_notifier(&keyboard_notifier_block); | 389 | unregister_keyboard_notifier(&keyboard_notifier_block); |
385 | unregister_vt_notifier(&vt_notifier_block); | 390 | unregister_vt_notifier(&vt_notifier_block); |
386 | braille_co = NULL; | 391 | braille_co = NULL; |
387 | return 0; | 392 | return 1; |
388 | } | 393 | } |
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index fd6c51cc3acb..5a74a9c1e42c 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c | |||
@@ -451,7 +451,6 @@ static void acpi_processor_remove(struct acpi_device *device) | |||
451 | /* Clean up. */ | 451 | /* Clean up. */ |
452 | per_cpu(processor_device_array, pr->id) = NULL; | 452 | per_cpu(processor_device_array, pr->id) = NULL; |
453 | per_cpu(processors, pr->id) = NULL; | 453 | per_cpu(processors, pr->id) = NULL; |
454 | try_offline_node(cpu_to_node(pr->id)); | ||
455 | 454 | ||
456 | /* Remove the CPU. */ | 455 | /* Remove the CPU. */ |
457 | get_online_cpus(); | 456 | get_online_cpus(); |
@@ -459,6 +458,8 @@ static void acpi_processor_remove(struct acpi_device *device) | |||
459 | acpi_unmap_lsapic(pr->id); | 458 | acpi_unmap_lsapic(pr->id); |
460 | put_online_cpus(); | 459 | put_online_cpus(); |
461 | 460 | ||
461 | try_offline_node(cpu_to_node(pr->id)); | ||
462 | |||
462 | out: | 463 | out: |
463 | free_cpumask_var(pr->throttling.shared_cpu_map); | 464 | free_cpumask_var(pr->throttling.shared_cpu_map); |
464 | kfree(pr); | 465 | kfree(pr); |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 082b4dd252a8..d405fbad406a 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -117,6 +117,7 @@ struct acpi_battery { | |||
117 | struct acpi_device *device; | 117 | struct acpi_device *device; |
118 | struct notifier_block pm_nb; | 118 | struct notifier_block pm_nb; |
119 | unsigned long update_time; | 119 | unsigned long update_time; |
120 | int revision; | ||
120 | int rate_now; | 121 | int rate_now; |
121 | int capacity_now; | 122 | int capacity_now; |
122 | int voltage_now; | 123 | int voltage_now; |
@@ -359,6 +360,7 @@ static struct acpi_offsets info_offsets[] = { | |||
359 | }; | 360 | }; |
360 | 361 | ||
361 | static struct acpi_offsets extended_info_offsets[] = { | 362 | static struct acpi_offsets extended_info_offsets[] = { |
363 | {offsetof(struct acpi_battery, revision), 0}, | ||
362 | {offsetof(struct acpi_battery, power_unit), 0}, | 364 | {offsetof(struct acpi_battery, power_unit), 0}, |
363 | {offsetof(struct acpi_battery, design_capacity), 0}, | 365 | {offsetof(struct acpi_battery, design_capacity), 0}, |
364 | {offsetof(struct acpi_battery, full_charge_capacity), 0}, | 366 | {offsetof(struct acpi_battery, full_charge_capacity), 0}, |
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index f68095756fb7..408f6b2a5fa8 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -31,6 +31,7 @@ static LIST_HEAD(bus_type_list); | |||
31 | static DECLARE_RWSEM(bus_type_sem); | 31 | static DECLARE_RWSEM(bus_type_sem); |
32 | 32 | ||
33 | #define PHYSICAL_NODE_STRING "physical_node" | 33 | #define PHYSICAL_NODE_STRING "physical_node" |
34 | #define PHYSICAL_NODE_NAME_SIZE (sizeof(PHYSICAL_NODE_STRING) + 10) | ||
34 | 35 | ||
35 | int register_acpi_bus_type(struct acpi_bus_type *type) | 36 | int register_acpi_bus_type(struct acpi_bus_type *type) |
36 | { | 37 | { |
@@ -78,41 +79,108 @@ static struct acpi_bus_type *acpi_get_bus_type(struct device *dev) | |||
78 | return ret; | 79 | return ret; |
79 | } | 80 | } |
80 | 81 | ||
81 | static acpi_status do_acpi_find_child(acpi_handle handle, u32 lvl_not_used, | 82 | static acpi_status acpi_dev_present(acpi_handle handle, u32 lvl_not_used, |
82 | void *addr_p, void **ret_p) | 83 | void *not_used, void **ret_p) |
83 | { | 84 | { |
84 | unsigned long long addr, sta; | 85 | struct acpi_device *adev = NULL; |
85 | acpi_status status; | ||
86 | 86 | ||
87 | status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr); | 87 | acpi_bus_get_device(handle, &adev); |
88 | if (ACPI_SUCCESS(status) && addr == *((u64 *)addr_p)) { | 88 | if (adev) { |
89 | *ret_p = handle; | 89 | *ret_p = handle; |
90 | status = acpi_bus_get_status_handle(handle, &sta); | 90 | return AE_CTRL_TERMINATE; |
91 | if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_ENABLED)) | ||
92 | return AE_CTRL_TERMINATE; | ||
93 | } | 91 | } |
94 | return AE_OK; | 92 | return AE_OK; |
95 | } | 93 | } |
96 | 94 | ||
97 | acpi_handle acpi_get_child(acpi_handle parent, u64 address) | 95 | static bool acpi_extra_checks_passed(acpi_handle handle, bool is_bridge) |
98 | { | 96 | { |
99 | void *ret = NULL; | 97 | unsigned long long sta; |
98 | acpi_status status; | ||
99 | |||
100 | status = acpi_bus_get_status_handle(handle, &sta); | ||
101 | if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED)) | ||
102 | return false; | ||
103 | |||
104 | if (is_bridge) { | ||
105 | void *test = NULL; | ||
106 | |||
107 | /* Check if this object has at least one child device. */ | ||
108 | acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, | ||
109 | acpi_dev_present, NULL, NULL, &test); | ||
110 | return !!test; | ||
111 | } | ||
112 | return true; | ||
113 | } | ||
114 | |||
115 | struct find_child_context { | ||
116 | u64 addr; | ||
117 | bool is_bridge; | ||
118 | acpi_handle ret; | ||
119 | bool ret_checked; | ||
120 | }; | ||
121 | |||
122 | static acpi_status do_find_child(acpi_handle handle, u32 lvl_not_used, | ||
123 | void *data, void **not_used) | ||
124 | { | ||
125 | struct find_child_context *context = data; | ||
126 | unsigned long long addr; | ||
127 | acpi_status status; | ||
100 | 128 | ||
101 | if (!parent) | 129 | status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr); |
102 | return NULL; | 130 | if (ACPI_FAILURE(status) || addr != context->addr) |
131 | return AE_OK; | ||
103 | 132 | ||
104 | acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, NULL, | 133 | if (!context->ret) { |
105 | do_acpi_find_child, &address, &ret); | 134 | /* This is the first matching object. Save its handle. */ |
106 | return (acpi_handle)ret; | 135 | context->ret = handle; |
136 | return AE_OK; | ||
137 | } | ||
138 | /* | ||
139 | * There is more than one matching object with the same _ADR value. | ||
140 | * That really is unexpected, so we are kind of beyond the scope of the | ||
141 | * spec here. We have to choose which one to return, though. | ||
142 | * | ||
143 | * First, check if the previously found object is good enough and return | ||
144 | * its handle if so. Second, check the same for the object that we've | ||
145 | * just found. | ||
146 | */ | ||
147 | if (!context->ret_checked) { | ||
148 | if (acpi_extra_checks_passed(context->ret, context->is_bridge)) | ||
149 | return AE_CTRL_TERMINATE; | ||
150 | else | ||
151 | context->ret_checked = true; | ||
152 | } | ||
153 | if (acpi_extra_checks_passed(handle, context->is_bridge)) { | ||
154 | context->ret = handle; | ||
155 | return AE_CTRL_TERMINATE; | ||
156 | } | ||
157 | return AE_OK; | ||
107 | } | 158 | } |
108 | EXPORT_SYMBOL(acpi_get_child); | 159 | |
160 | acpi_handle acpi_find_child(acpi_handle parent, u64 addr, bool is_bridge) | ||
161 | { | ||
162 | if (parent) { | ||
163 | struct find_child_context context = { | ||
164 | .addr = addr, | ||
165 | .is_bridge = is_bridge, | ||
166 | }; | ||
167 | |||
168 | acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, do_find_child, | ||
169 | NULL, &context, NULL); | ||
170 | return context.ret; | ||
171 | } | ||
172 | return NULL; | ||
173 | } | ||
174 | EXPORT_SYMBOL_GPL(acpi_find_child); | ||
109 | 175 | ||
110 | int acpi_bind_one(struct device *dev, acpi_handle handle) | 176 | int acpi_bind_one(struct device *dev, acpi_handle handle) |
111 | { | 177 | { |
112 | struct acpi_device *acpi_dev; | 178 | struct acpi_device *acpi_dev; |
113 | acpi_status status; | 179 | acpi_status status; |
114 | struct acpi_device_physical_node *physical_node, *pn; | 180 | struct acpi_device_physical_node *physical_node, *pn; |
115 | char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; | 181 | char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; |
182 | struct list_head *physnode_list; | ||
183 | unsigned int node_id; | ||
116 | int retval = -EINVAL; | 184 | int retval = -EINVAL; |
117 | 185 | ||
118 | if (ACPI_HANDLE(dev)) { | 186 | if (ACPI_HANDLE(dev)) { |
@@ -139,25 +207,27 @@ int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
139 | 207 | ||
140 | mutex_lock(&acpi_dev->physical_node_lock); | 208 | mutex_lock(&acpi_dev->physical_node_lock); |
141 | 209 | ||
142 | /* Sanity check. */ | 210 | /* |
143 | list_for_each_entry(pn, &acpi_dev->physical_node_list, node) | 211 | * Keep the list sorted by node_id so that the IDs of removed nodes can |
212 | * be recycled easily. | ||
213 | */ | ||
214 | physnode_list = &acpi_dev->physical_node_list; | ||
215 | node_id = 0; | ||
216 | list_for_each_entry(pn, &acpi_dev->physical_node_list, node) { | ||
217 | /* Sanity check. */ | ||
144 | if (pn->dev == dev) { | 218 | if (pn->dev == dev) { |
145 | dev_warn(dev, "Already associated with ACPI node\n"); | 219 | dev_warn(dev, "Already associated with ACPI node\n"); |
146 | goto err_free; | 220 | goto err_free; |
147 | } | 221 | } |
148 | 222 | if (pn->node_id == node_id) { | |
149 | /* allocate physical node id according to physical_node_id_bitmap */ | 223 | physnode_list = &pn->node; |
150 | physical_node->node_id = | 224 | node_id++; |
151 | find_first_zero_bit(acpi_dev->physical_node_id_bitmap, | 225 | } |
152 | ACPI_MAX_PHYSICAL_NODE); | ||
153 | if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) { | ||
154 | retval = -ENOSPC; | ||
155 | goto err_free; | ||
156 | } | 226 | } |
157 | 227 | ||
158 | set_bit(physical_node->node_id, acpi_dev->physical_node_id_bitmap); | 228 | physical_node->node_id = node_id; |
159 | physical_node->dev = dev; | 229 | physical_node->dev = dev; |
160 | list_add_tail(&physical_node->node, &acpi_dev->physical_node_list); | 230 | list_add(&physical_node->node, physnode_list); |
161 | acpi_dev->physical_node_count++; | 231 | acpi_dev->physical_node_count++; |
162 | 232 | ||
163 | mutex_unlock(&acpi_dev->physical_node_lock); | 233 | mutex_unlock(&acpi_dev->physical_node_lock); |
@@ -208,7 +278,7 @@ int acpi_unbind_one(struct device *dev) | |||
208 | 278 | ||
209 | mutex_lock(&acpi_dev->physical_node_lock); | 279 | mutex_lock(&acpi_dev->physical_node_lock); |
210 | list_for_each_safe(node, next, &acpi_dev->physical_node_list) { | 280 | list_for_each_safe(node, next, &acpi_dev->physical_node_list) { |
211 | char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; | 281 | char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; |
212 | 282 | ||
213 | entry = list_entry(node, struct acpi_device_physical_node, | 283 | entry = list_entry(node, struct acpi_device_physical_node, |
214 | node); | 284 | node); |
@@ -216,7 +286,6 @@ int acpi_unbind_one(struct device *dev) | |||
216 | continue; | 286 | continue; |
217 | 287 | ||
218 | list_del(node); | 288 | list_del(node); |
219 | clear_bit(entry->node_id, acpi_dev->physical_node_id_bitmap); | ||
220 | 289 | ||
221 | acpi_dev->physical_node_count--; | 290 | acpi_dev->physical_node_count--; |
222 | 291 | ||
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index aa1227a7e3f2..04a13784dd20 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c | |||
@@ -311,6 +311,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
311 | dev->pnp.bus_id, | 311 | dev->pnp.bus_id, |
312 | (u32) dev->wakeup.sleep_state); | 312 | (u32) dev->wakeup.sleep_state); |
313 | 313 | ||
314 | mutex_lock(&dev->physical_node_lock); | ||
315 | |||
314 | if (!dev->physical_node_count) { | 316 | if (!dev->physical_node_count) { |
315 | seq_printf(seq, "%c%-8s\n", | 317 | seq_printf(seq, "%c%-8s\n", |
316 | dev->wakeup.flags.run_wake ? '*' : ' ', | 318 | dev->wakeup.flags.run_wake ? '*' : ' ', |
@@ -338,6 +340,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
338 | put_device(ldev); | 340 | put_device(ldev); |
339 | } | 341 | } |
340 | } | 342 | } |
343 | |||
344 | mutex_unlock(&dev->physical_node_lock); | ||
341 | } | 345 | } |
342 | mutex_unlock(&acpi_device_lock); | 346 | mutex_unlock(&acpi_device_lock); |
343 | return 0; | 347 | return 0; |
@@ -347,12 +351,16 @@ static void physical_device_enable_wakeup(struct acpi_device *adev) | |||
347 | { | 351 | { |
348 | struct acpi_device_physical_node *entry; | 352 | struct acpi_device_physical_node *entry; |
349 | 353 | ||
354 | mutex_lock(&adev->physical_node_lock); | ||
355 | |||
350 | list_for_each_entry(entry, | 356 | list_for_each_entry(entry, |
351 | &adev->physical_node_list, node) | 357 | &adev->physical_node_list, node) |
352 | if (entry->dev && device_can_wakeup(entry->dev)) { | 358 | if (entry->dev && device_can_wakeup(entry->dev)) { |
353 | bool enable = !device_may_wakeup(entry->dev); | 359 | bool enable = !device_may_wakeup(entry->dev); |
354 | device_set_wakeup_enable(entry->dev, enable); | 360 | device_set_wakeup_enable(entry->dev, enable); |
355 | } | 361 | } |
362 | |||
363 | mutex_unlock(&adev->physical_node_lock); | ||
356 | } | 364 | } |
357 | 365 | ||
358 | static ssize_t | 366 | static ssize_t |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 0ec434d2586d..e1284b8dc6ee 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -689,7 +689,7 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device, | |||
689 | * Some systems always report current brightness level as maximum | 689 | * Some systems always report current brightness level as maximum |
690 | * through _BQC, we need to test another value for them. | 690 | * through _BQC, we need to test another value for them. |
691 | */ | 691 | */ |
692 | test_level = current_level == max_level ? br->levels[2] : max_level; | 692 | test_level = current_level == max_level ? br->levels[3] : max_level; |
693 | 693 | ||
694 | result = acpi_video_device_lcd_set_level(device, test_level); | 694 | result = acpi_video_device_lcd_set_level(device, test_level); |
695 | if (result) | 695 | if (result) |
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c index 4ec7c04b3f82..26386f0b89a8 100644 --- a/drivers/ata/pata_imx.c +++ b/drivers/ata/pata_imx.c | |||
@@ -237,6 +237,7 @@ static const struct of_device_id imx_pata_dt_ids[] = { | |||
237 | /* sentinel */ | 237 | /* sentinel */ |
238 | } | 238 | } |
239 | }; | 239 | }; |
240 | MODULE_DEVICE_TABLE(of, imx_pata_dt_ids); | ||
240 | 241 | ||
241 | static struct platform_driver pata_imx_driver = { | 242 | static struct platform_driver pata_imx_driver = { |
242 | .probe = pata_imx_probe, | 243 | .probe = pata_imx_probe, |
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index e69102696533..3455f833e473 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
@@ -719,7 +719,8 @@ static int regcache_sync_block_raw(struct regmap *map, void *block, | |||
719 | } | 719 | } |
720 | } | 720 | } |
721 | 721 | ||
722 | return regcache_sync_block_raw_flush(map, &data, base, regtmp); | 722 | return regcache_sync_block_raw_flush(map, &data, base, regtmp + |
723 | map->reg_stride); | ||
723 | } | 724 | } |
724 | 725 | ||
725 | int regcache_sync_block(struct regmap *map, void *block, | 726 | int regcache_sync_block(struct regmap *map, void *block, |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 11f467c00d0a..a12b923bbaca 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -91,6 +91,10 @@ static struct usb_device_id ath3k_table[] = { | |||
91 | { USB_DEVICE(0x0489, 0xe04e) }, | 91 | { USB_DEVICE(0x0489, 0xe04e) }, |
92 | { USB_DEVICE(0x0489, 0xe056) }, | 92 | { USB_DEVICE(0x0489, 0xe056) }, |
93 | { USB_DEVICE(0x0489, 0xe04d) }, | 93 | { USB_DEVICE(0x0489, 0xe04d) }, |
94 | { USB_DEVICE(0x04c5, 0x1330) }, | ||
95 | { USB_DEVICE(0x13d3, 0x3402) }, | ||
96 | { USB_DEVICE(0x0cf3, 0x3121) }, | ||
97 | { USB_DEVICE(0x0cf3, 0xe003) }, | ||
94 | 98 | ||
95 | /* Atheros AR5BBU12 with sflash firmware */ | 99 | /* Atheros AR5BBU12 with sflash firmware */ |
96 | { USB_DEVICE(0x0489, 0xE02C) }, | 100 | { USB_DEVICE(0x0489, 0xE02C) }, |
@@ -128,6 +132,10 @@ static struct usb_device_id ath3k_blist_tbl[] = { | |||
128 | { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, | 132 | { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, |
129 | { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, | 133 | { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, |
130 | { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, | 134 | { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, |
135 | { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, | ||
136 | { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, | ||
137 | { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, | ||
138 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, | ||
131 | 139 | ||
132 | /* Atheros AR5BBU22 with sflash firmware */ | 140 | /* Atheros AR5BBU22 with sflash firmware */ |
133 | { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, | 141 | { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, |
@@ -193,24 +201,44 @@ error: | |||
193 | 201 | ||
194 | static int ath3k_get_state(struct usb_device *udev, unsigned char *state) | 202 | static int ath3k_get_state(struct usb_device *udev, unsigned char *state) |
195 | { | 203 | { |
196 | int pipe = 0; | 204 | int ret, pipe = 0; |
205 | char *buf; | ||
206 | |||
207 | buf = kmalloc(sizeof(*buf), GFP_KERNEL); | ||
208 | if (!buf) | ||
209 | return -ENOMEM; | ||
197 | 210 | ||
198 | pipe = usb_rcvctrlpipe(udev, 0); | 211 | pipe = usb_rcvctrlpipe(udev, 0); |
199 | return usb_control_msg(udev, pipe, ATH3K_GETSTATE, | 212 | ret = usb_control_msg(udev, pipe, ATH3K_GETSTATE, |
200 | USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, | 213 | USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, |
201 | state, 0x01, USB_CTRL_SET_TIMEOUT); | 214 | buf, sizeof(*buf), USB_CTRL_SET_TIMEOUT); |
215 | |||
216 | *state = *buf; | ||
217 | kfree(buf); | ||
218 | |||
219 | return ret; | ||
202 | } | 220 | } |
203 | 221 | ||
204 | static int ath3k_get_version(struct usb_device *udev, | 222 | static int ath3k_get_version(struct usb_device *udev, |
205 | struct ath3k_version *version) | 223 | struct ath3k_version *version) |
206 | { | 224 | { |
207 | int pipe = 0; | 225 | int ret, pipe = 0; |
226 | struct ath3k_version *buf; | ||
227 | const int size = sizeof(*buf); | ||
228 | |||
229 | buf = kmalloc(size, GFP_KERNEL); | ||
230 | if (!buf) | ||
231 | return -ENOMEM; | ||
208 | 232 | ||
209 | pipe = usb_rcvctrlpipe(udev, 0); | 233 | pipe = usb_rcvctrlpipe(udev, 0); |
210 | return usb_control_msg(udev, pipe, ATH3K_GETVERSION, | 234 | ret = usb_control_msg(udev, pipe, ATH3K_GETVERSION, |
211 | USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, version, | 235 | USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, |
212 | sizeof(struct ath3k_version), | 236 | buf, size, USB_CTRL_SET_TIMEOUT); |
213 | USB_CTRL_SET_TIMEOUT); | 237 | |
238 | memcpy(version, buf, size); | ||
239 | kfree(buf); | ||
240 | |||
241 | return ret; | ||
214 | } | 242 | } |
215 | 243 | ||
216 | static int ath3k_load_fwfile(struct usb_device *udev, | 244 | static int ath3k_load_fwfile(struct usb_device *udev, |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index de4cf4daa2f4..8e16f0af6358 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -154,6 +154,10 @@ static struct usb_device_id blacklist_table[] = { | |||
154 | { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, | 154 | { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, |
155 | { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, | 155 | { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, |
156 | { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, | 156 | { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, |
157 | { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, | ||
158 | { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, | ||
159 | { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, | ||
160 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, | ||
157 | 161 | ||
158 | /* Atheros AR5BBU12 with sflash firmware */ | 162 | /* Atheros AR5BBU12 with sflash firmware */ |
159 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | 163 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, |
@@ -1095,7 +1099,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev, | |||
1095 | if (IS_ERR(skb)) { | 1099 | if (IS_ERR(skb)) { |
1096 | BT_ERR("%s sending Intel patch command (0x%4.4x) failed (%ld)", | 1100 | BT_ERR("%s sending Intel patch command (0x%4.4x) failed (%ld)", |
1097 | hdev->name, cmd->opcode, PTR_ERR(skb)); | 1101 | hdev->name, cmd->opcode, PTR_ERR(skb)); |
1098 | return -PTR_ERR(skb); | 1102 | return PTR_ERR(skb); |
1099 | } | 1103 | } |
1100 | 1104 | ||
1101 | /* It ensures that the returned event matches the event data read from | 1105 | /* It ensures that the returned event matches the event data read from |
@@ -1147,7 +1151,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) | |||
1147 | if (IS_ERR(skb)) { | 1151 | if (IS_ERR(skb)) { |
1148 | BT_ERR("%s sending initial HCI reset command failed (%ld)", | 1152 | BT_ERR("%s sending initial HCI reset command failed (%ld)", |
1149 | hdev->name, PTR_ERR(skb)); | 1153 | hdev->name, PTR_ERR(skb)); |
1150 | return -PTR_ERR(skb); | 1154 | return PTR_ERR(skb); |
1151 | } | 1155 | } |
1152 | kfree_skb(skb); | 1156 | kfree_skb(skb); |
1153 | 1157 | ||
@@ -1161,7 +1165,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) | |||
1161 | if (IS_ERR(skb)) { | 1165 | if (IS_ERR(skb)) { |
1162 | BT_ERR("%s reading Intel fw version command failed (%ld)", | 1166 | BT_ERR("%s reading Intel fw version command failed (%ld)", |
1163 | hdev->name, PTR_ERR(skb)); | 1167 | hdev->name, PTR_ERR(skb)); |
1164 | return -PTR_ERR(skb); | 1168 | return PTR_ERR(skb); |
1165 | } | 1169 | } |
1166 | 1170 | ||
1167 | if (skb->len != sizeof(*ver)) { | 1171 | if (skb->len != sizeof(*ver)) { |
@@ -1219,7 +1223,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) | |||
1219 | BT_ERR("%s entering Intel manufacturer mode failed (%ld)", | 1223 | BT_ERR("%s entering Intel manufacturer mode failed (%ld)", |
1220 | hdev->name, PTR_ERR(skb)); | 1224 | hdev->name, PTR_ERR(skb)); |
1221 | release_firmware(fw); | 1225 | release_firmware(fw); |
1222 | return -PTR_ERR(skb); | 1226 | return PTR_ERR(skb); |
1223 | } | 1227 | } |
1224 | 1228 | ||
1225 | if (skb->data[0]) { | 1229 | if (skb->data[0]) { |
@@ -1276,7 +1280,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) | |||
1276 | if (IS_ERR(skb)) { | 1280 | if (IS_ERR(skb)) { |
1277 | BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", | 1281 | BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", |
1278 | hdev->name, PTR_ERR(skb)); | 1282 | hdev->name, PTR_ERR(skb)); |
1279 | return -PTR_ERR(skb); | 1283 | return PTR_ERR(skb); |
1280 | } | 1284 | } |
1281 | kfree_skb(skb); | 1285 | kfree_skb(skb); |
1282 | 1286 | ||
@@ -1292,7 +1296,7 @@ exit_mfg_disable: | |||
1292 | if (IS_ERR(skb)) { | 1296 | if (IS_ERR(skb)) { |
1293 | BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", | 1297 | BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", |
1294 | hdev->name, PTR_ERR(skb)); | 1298 | hdev->name, PTR_ERR(skb)); |
1295 | return -PTR_ERR(skb); | 1299 | return PTR_ERR(skb); |
1296 | } | 1300 | } |
1297 | kfree_skb(skb); | 1301 | kfree_skb(skb); |
1298 | 1302 | ||
@@ -1310,7 +1314,7 @@ exit_mfg_deactivate: | |||
1310 | if (IS_ERR(skb)) { | 1314 | if (IS_ERR(skb)) { |
1311 | BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", | 1315 | BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", |
1312 | hdev->name, PTR_ERR(skb)); | 1316 | hdev->name, PTR_ERR(skb)); |
1313 | return -PTR_ERR(skb); | 1317 | return PTR_ERR(skb); |
1314 | } | 1318 | } |
1315 | kfree_skb(skb); | 1319 | kfree_skb(skb); |
1316 | 1320 | ||
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index bf5d2477cb77..15f2e7025b78 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c | |||
@@ -129,7 +129,8 @@ parisc_agp_insert_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
129 | off_t j, io_pg_start; | 129 | off_t j, io_pg_start; |
130 | int io_pg_count; | 130 | int io_pg_count; |
131 | 131 | ||
132 | if (type != 0 || mem->type != 0) { | 132 | if (type != mem->type || |
133 | agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type)) { | ||
133 | return -EINVAL; | 134 | return -EINVAL; |
134 | } | 135 | } |
135 | 136 | ||
@@ -175,7 +176,8 @@ parisc_agp_remove_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
175 | struct _parisc_agp_info *info = &parisc_agp_info; | 176 | struct _parisc_agp_info *info = &parisc_agp_info; |
176 | int i, io_pg_start, io_pg_count; | 177 | int i, io_pg_start, io_pg_count; |
177 | 178 | ||
178 | if (type != 0 || mem->type != 0) { | 179 | if (type != mem->type || |
180 | agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type)) { | ||
179 | return -EINVAL; | 181 | return -EINVAL; |
180 | } | 182 | } |
181 | 183 | ||
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 1b456fe9b87a..fc45567ad3ac 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -272,9 +272,12 @@ static struct port *find_port_by_devt_in_portdev(struct ports_device *portdev, | |||
272 | unsigned long flags; | 272 | unsigned long flags; |
273 | 273 | ||
274 | spin_lock_irqsave(&portdev->ports_lock, flags); | 274 | spin_lock_irqsave(&portdev->ports_lock, flags); |
275 | list_for_each_entry(port, &portdev->ports, list) | 275 | list_for_each_entry(port, &portdev->ports, list) { |
276 | if (port->cdev->dev == dev) | 276 | if (port->cdev->dev == dev) { |
277 | kref_get(&port->kref); | ||
277 | goto out; | 278 | goto out; |
279 | } | ||
280 | } | ||
278 | port = NULL; | 281 | port = NULL; |
279 | out: | 282 | out: |
280 | spin_unlock_irqrestore(&portdev->ports_lock, flags); | 283 | spin_unlock_irqrestore(&portdev->ports_lock, flags); |
@@ -746,6 +749,10 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf, | |||
746 | 749 | ||
747 | port = filp->private_data; | 750 | port = filp->private_data; |
748 | 751 | ||
752 | /* Port is hot-unplugged. */ | ||
753 | if (!port->guest_connected) | ||
754 | return -ENODEV; | ||
755 | |||
749 | if (!port_has_data(port)) { | 756 | if (!port_has_data(port)) { |
750 | /* | 757 | /* |
751 | * If nothing's connected on the host just return 0 in | 758 | * If nothing's connected on the host just return 0 in |
@@ -762,7 +769,7 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf, | |||
762 | if (ret < 0) | 769 | if (ret < 0) |
763 | return ret; | 770 | return ret; |
764 | } | 771 | } |
765 | /* Port got hot-unplugged. */ | 772 | /* Port got hot-unplugged while we were waiting above. */ |
766 | if (!port->guest_connected) | 773 | if (!port->guest_connected) |
767 | return -ENODEV; | 774 | return -ENODEV; |
768 | /* | 775 | /* |
@@ -932,13 +939,25 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, | |||
932 | if (is_rproc_serial(port->out_vq->vdev)) | 939 | if (is_rproc_serial(port->out_vq->vdev)) |
933 | return -EINVAL; | 940 | return -EINVAL; |
934 | 941 | ||
942 | /* | ||
943 | * pipe->nrbufs == 0 means there are no data to transfer, | ||
944 | * so this returns just 0 for no data. | ||
945 | */ | ||
946 | pipe_lock(pipe); | ||
947 | if (!pipe->nrbufs) { | ||
948 | ret = 0; | ||
949 | goto error_out; | ||
950 | } | ||
951 | |||
935 | ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK); | 952 | ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK); |
936 | if (ret < 0) | 953 | if (ret < 0) |
937 | return ret; | 954 | goto error_out; |
938 | 955 | ||
939 | buf = alloc_buf(port->out_vq, 0, pipe->nrbufs); | 956 | buf = alloc_buf(port->out_vq, 0, pipe->nrbufs); |
940 | if (!buf) | 957 | if (!buf) { |
941 | return -ENOMEM; | 958 | ret = -ENOMEM; |
959 | goto error_out; | ||
960 | } | ||
942 | 961 | ||
943 | sgl.n = 0; | 962 | sgl.n = 0; |
944 | sgl.len = 0; | 963 | sgl.len = 0; |
@@ -946,12 +965,17 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, | |||
946 | sgl.sg = buf->sg; | 965 | sgl.sg = buf->sg; |
947 | sg_init_table(sgl.sg, sgl.size); | 966 | sg_init_table(sgl.sg, sgl.size); |
948 | ret = __splice_from_pipe(pipe, &sd, pipe_to_sg); | 967 | ret = __splice_from_pipe(pipe, &sd, pipe_to_sg); |
968 | pipe_unlock(pipe); | ||
949 | if (likely(ret > 0)) | 969 | if (likely(ret > 0)) |
950 | ret = __send_to_port(port, buf->sg, sgl.n, sgl.len, buf, true); | 970 | ret = __send_to_port(port, buf->sg, sgl.n, sgl.len, buf, true); |
951 | 971 | ||
952 | if (unlikely(ret <= 0)) | 972 | if (unlikely(ret <= 0)) |
953 | free_buf(buf, true); | 973 | free_buf(buf, true); |
954 | return ret; | 974 | return ret; |
975 | |||
976 | error_out: | ||
977 | pipe_unlock(pipe); | ||
978 | return ret; | ||
955 | } | 979 | } |
956 | 980 | ||
957 | static unsigned int port_fops_poll(struct file *filp, poll_table *wait) | 981 | static unsigned int port_fops_poll(struct file *filp, poll_table *wait) |
@@ -1019,14 +1043,14 @@ static int port_fops_open(struct inode *inode, struct file *filp) | |||
1019 | struct port *port; | 1043 | struct port *port; |
1020 | int ret; | 1044 | int ret; |
1021 | 1045 | ||
1046 | /* We get the port with a kref here */ | ||
1022 | port = find_port_by_devt(cdev->dev); | 1047 | port = find_port_by_devt(cdev->dev); |
1048 | if (!port) { | ||
1049 | /* Port was unplugged before we could proceed */ | ||
1050 | return -ENXIO; | ||
1051 | } | ||
1023 | filp->private_data = port; | 1052 | filp->private_data = port; |
1024 | 1053 | ||
1025 | /* Prevent against a port getting hot-unplugged at the same time */ | ||
1026 | spin_lock_irq(&port->portdev->ports_lock); | ||
1027 | kref_get(&port->kref); | ||
1028 | spin_unlock_irq(&port->portdev->ports_lock); | ||
1029 | |||
1030 | /* | 1054 | /* |
1031 | * Don't allow opening of console port devices -- that's done | 1055 | * Don't allow opening of console port devices -- that's done |
1032 | * via /dev/hvc | 1056 | * via /dev/hvc |
@@ -1498,14 +1522,6 @@ static void remove_port(struct kref *kref) | |||
1498 | 1522 | ||
1499 | port = container_of(kref, struct port, kref); | 1523 | port = container_of(kref, struct port, kref); |
1500 | 1524 | ||
1501 | sysfs_remove_group(&port->dev->kobj, &port_attribute_group); | ||
1502 | device_destroy(pdrvdata.class, port->dev->devt); | ||
1503 | cdev_del(port->cdev); | ||
1504 | |||
1505 | kfree(port->name); | ||
1506 | |||
1507 | debugfs_remove(port->debugfs_file); | ||
1508 | |||
1509 | kfree(port); | 1525 | kfree(port); |
1510 | } | 1526 | } |
1511 | 1527 | ||
@@ -1539,12 +1555,14 @@ static void unplug_port(struct port *port) | |||
1539 | spin_unlock_irq(&port->portdev->ports_lock); | 1555 | spin_unlock_irq(&port->portdev->ports_lock); |
1540 | 1556 | ||
1541 | if (port->guest_connected) { | 1557 | if (port->guest_connected) { |
1558 | /* Let the app know the port is going down. */ | ||
1559 | send_sigio_to_port(port); | ||
1560 | |||
1561 | /* Do this after sigio is actually sent */ | ||
1542 | port->guest_connected = false; | 1562 | port->guest_connected = false; |
1543 | port->host_connected = false; | 1563 | port->host_connected = false; |
1544 | wake_up_interruptible(&port->waitqueue); | ||
1545 | 1564 | ||
1546 | /* Let the app know the port is going down. */ | 1565 | wake_up_interruptible(&port->waitqueue); |
1547 | send_sigio_to_port(port); | ||
1548 | } | 1566 | } |
1549 | 1567 | ||
1550 | if (is_console_port(port)) { | 1568 | if (is_console_port(port)) { |
@@ -1563,6 +1581,14 @@ static void unplug_port(struct port *port) | |||
1563 | */ | 1581 | */ |
1564 | port->portdev = NULL; | 1582 | port->portdev = NULL; |
1565 | 1583 | ||
1584 | sysfs_remove_group(&port->dev->kobj, &port_attribute_group); | ||
1585 | device_destroy(pdrvdata.class, port->dev->devt); | ||
1586 | cdev_del(port->cdev); | ||
1587 | |||
1588 | kfree(port->name); | ||
1589 | |||
1590 | debugfs_remove(port->debugfs_file); | ||
1591 | |||
1566 | /* | 1592 | /* |
1567 | * Locks around here are not necessary - a port can't be | 1593 | * Locks around here are not necessary - a port can't be |
1568 | * opened after we removed the port struct from ports_list | 1594 | * opened after we removed the port struct from ports_list |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index a4ad7339588d..f0a5e2b0eb8a 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1177,14 +1177,11 @@ static int __cpufreq_remove_dev(struct device *dev, | |||
1177 | __func__, cpu_dev->id, cpu); | 1177 | __func__, cpu_dev->id, cpu); |
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | if ((cpus == 1) && (cpufreq_driver->target)) | ||
1181 | __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); | ||
1182 | |||
1183 | pr_debug("%s: removing link, cpu: %d\n", __func__, cpu); | ||
1184 | cpufreq_cpu_put(data); | ||
1185 | |||
1186 | /* If cpu is last user of policy, free policy */ | 1180 | /* If cpu is last user of policy, free policy */ |
1187 | if (cpus == 1) { | 1181 | if (cpus == 1) { |
1182 | if (cpufreq_driver->target) | ||
1183 | __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); | ||
1184 | |||
1188 | lock_policy_rwsem_read(cpu); | 1185 | lock_policy_rwsem_read(cpu); |
1189 | kobj = &data->kobj; | 1186 | kobj = &data->kobj; |
1190 | cmp = &data->kobj_unregister; | 1187 | cmp = &data->kobj_unregister; |
@@ -1205,9 +1202,13 @@ static int __cpufreq_remove_dev(struct device *dev, | |||
1205 | free_cpumask_var(data->related_cpus); | 1202 | free_cpumask_var(data->related_cpus); |
1206 | free_cpumask_var(data->cpus); | 1203 | free_cpumask_var(data->cpus); |
1207 | kfree(data); | 1204 | kfree(data); |
1208 | } else if (cpufreq_driver->target) { | 1205 | } else { |
1209 | __cpufreq_governor(data, CPUFREQ_GOV_START); | 1206 | pr_debug("%s: removing link, cpu: %d\n", __func__, cpu); |
1210 | __cpufreq_governor(data, CPUFREQ_GOV_LIMITS); | 1207 | cpufreq_cpu_put(data); |
1208 | if (cpufreq_driver->target) { | ||
1209 | __cpufreq_governor(data, CPUFREQ_GOV_START); | ||
1210 | __cpufreq_governor(data, CPUFREQ_GOV_LIMITS); | ||
1211 | } | ||
1211 | } | 1212 | } |
1212 | 1213 | ||
1213 | per_cpu(cpufreq_policy_cpu, cpu) = -1; | 1214 | per_cpu(cpufreq_policy_cpu, cpu) = -1; |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 0ceb2eff5a7e..f97cb3d8c5a2 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -221,8 +221,8 @@ static ssize_t store_down_threshold(struct dbs_data *dbs_data, const char *buf, | |||
221 | return count; | 221 | return count; |
222 | } | 222 | } |
223 | 223 | ||
224 | static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | 224 | static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data, |
225 | size_t count) | 225 | const char *buf, size_t count) |
226 | { | 226 | { |
227 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; | 227 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; |
228 | unsigned int input, j; | 228 | unsigned int input, j; |
@@ -235,10 +235,10 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | |||
235 | if (input > 1) | 235 | if (input > 1) |
236 | input = 1; | 236 | input = 1; |
237 | 237 | ||
238 | if (input == cs_tuners->ignore_nice) /* nothing to do */ | 238 | if (input == cs_tuners->ignore_nice_load) /* nothing to do */ |
239 | return count; | 239 | return count; |
240 | 240 | ||
241 | cs_tuners->ignore_nice = input; | 241 | cs_tuners->ignore_nice_load = input; |
242 | 242 | ||
243 | /* we need to re-evaluate prev_cpu_idle */ | 243 | /* we need to re-evaluate prev_cpu_idle */ |
244 | for_each_online_cpu(j) { | 244 | for_each_online_cpu(j) { |
@@ -246,7 +246,7 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | |||
246 | dbs_info = &per_cpu(cs_cpu_dbs_info, j); | 246 | dbs_info = &per_cpu(cs_cpu_dbs_info, j); |
247 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, | 247 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, |
248 | &dbs_info->cdbs.prev_cpu_wall, 0); | 248 | &dbs_info->cdbs.prev_cpu_wall, 0); |
249 | if (cs_tuners->ignore_nice) | 249 | if (cs_tuners->ignore_nice_load) |
250 | dbs_info->cdbs.prev_cpu_nice = | 250 | dbs_info->cdbs.prev_cpu_nice = |
251 | kcpustat_cpu(j).cpustat[CPUTIME_NICE]; | 251 | kcpustat_cpu(j).cpustat[CPUTIME_NICE]; |
252 | } | 252 | } |
@@ -279,7 +279,7 @@ show_store_one(cs, sampling_rate); | |||
279 | show_store_one(cs, sampling_down_factor); | 279 | show_store_one(cs, sampling_down_factor); |
280 | show_store_one(cs, up_threshold); | 280 | show_store_one(cs, up_threshold); |
281 | show_store_one(cs, down_threshold); | 281 | show_store_one(cs, down_threshold); |
282 | show_store_one(cs, ignore_nice); | 282 | show_store_one(cs, ignore_nice_load); |
283 | show_store_one(cs, freq_step); | 283 | show_store_one(cs, freq_step); |
284 | declare_show_sampling_rate_min(cs); | 284 | declare_show_sampling_rate_min(cs); |
285 | 285 | ||
@@ -287,7 +287,7 @@ gov_sys_pol_attr_rw(sampling_rate); | |||
287 | gov_sys_pol_attr_rw(sampling_down_factor); | 287 | gov_sys_pol_attr_rw(sampling_down_factor); |
288 | gov_sys_pol_attr_rw(up_threshold); | 288 | gov_sys_pol_attr_rw(up_threshold); |
289 | gov_sys_pol_attr_rw(down_threshold); | 289 | gov_sys_pol_attr_rw(down_threshold); |
290 | gov_sys_pol_attr_rw(ignore_nice); | 290 | gov_sys_pol_attr_rw(ignore_nice_load); |
291 | gov_sys_pol_attr_rw(freq_step); | 291 | gov_sys_pol_attr_rw(freq_step); |
292 | gov_sys_pol_attr_ro(sampling_rate_min); | 292 | gov_sys_pol_attr_ro(sampling_rate_min); |
293 | 293 | ||
@@ -297,7 +297,7 @@ static struct attribute *dbs_attributes_gov_sys[] = { | |||
297 | &sampling_down_factor_gov_sys.attr, | 297 | &sampling_down_factor_gov_sys.attr, |
298 | &up_threshold_gov_sys.attr, | 298 | &up_threshold_gov_sys.attr, |
299 | &down_threshold_gov_sys.attr, | 299 | &down_threshold_gov_sys.attr, |
300 | &ignore_nice_gov_sys.attr, | 300 | &ignore_nice_load_gov_sys.attr, |
301 | &freq_step_gov_sys.attr, | 301 | &freq_step_gov_sys.attr, |
302 | NULL | 302 | NULL |
303 | }; | 303 | }; |
@@ -313,7 +313,7 @@ static struct attribute *dbs_attributes_gov_pol[] = { | |||
313 | &sampling_down_factor_gov_pol.attr, | 313 | &sampling_down_factor_gov_pol.attr, |
314 | &up_threshold_gov_pol.attr, | 314 | &up_threshold_gov_pol.attr, |
315 | &down_threshold_gov_pol.attr, | 315 | &down_threshold_gov_pol.attr, |
316 | &ignore_nice_gov_pol.attr, | 316 | &ignore_nice_load_gov_pol.attr, |
317 | &freq_step_gov_pol.attr, | 317 | &freq_step_gov_pol.attr, |
318 | NULL | 318 | NULL |
319 | }; | 319 | }; |
@@ -338,7 +338,7 @@ static int cs_init(struct dbs_data *dbs_data) | |||
338 | tuners->up_threshold = DEF_FREQUENCY_UP_THRESHOLD; | 338 | tuners->up_threshold = DEF_FREQUENCY_UP_THRESHOLD; |
339 | tuners->down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD; | 339 | tuners->down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD; |
340 | tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; | 340 | tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; |
341 | tuners->ignore_nice = 0; | 341 | tuners->ignore_nice_load = 0; |
342 | tuners->freq_step = DEF_FREQUENCY_STEP; | 342 | tuners->freq_step = DEF_FREQUENCY_STEP; |
343 | 343 | ||
344 | dbs_data->tuners = tuners; | 344 | dbs_data->tuners = tuners; |
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 7b839a8db2a7..e59afaa9da23 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c | |||
@@ -47,9 +47,9 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) | |||
47 | unsigned int j; | 47 | unsigned int j; |
48 | 48 | ||
49 | if (dbs_data->cdata->governor == GOV_ONDEMAND) | 49 | if (dbs_data->cdata->governor == GOV_ONDEMAND) |
50 | ignore_nice = od_tuners->ignore_nice; | 50 | ignore_nice = od_tuners->ignore_nice_load; |
51 | else | 51 | else |
52 | ignore_nice = cs_tuners->ignore_nice; | 52 | ignore_nice = cs_tuners->ignore_nice_load; |
53 | 53 | ||
54 | policy = cdbs->cur_policy; | 54 | policy = cdbs->cur_policy; |
55 | 55 | ||
@@ -298,12 +298,12 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
298 | cs_tuners = dbs_data->tuners; | 298 | cs_tuners = dbs_data->tuners; |
299 | cs_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); | 299 | cs_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); |
300 | sampling_rate = cs_tuners->sampling_rate; | 300 | sampling_rate = cs_tuners->sampling_rate; |
301 | ignore_nice = cs_tuners->ignore_nice; | 301 | ignore_nice = cs_tuners->ignore_nice_load; |
302 | } else { | 302 | } else { |
303 | od_tuners = dbs_data->tuners; | 303 | od_tuners = dbs_data->tuners; |
304 | od_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); | 304 | od_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); |
305 | sampling_rate = od_tuners->sampling_rate; | 305 | sampling_rate = od_tuners->sampling_rate; |
306 | ignore_nice = od_tuners->ignore_nice; | 306 | ignore_nice = od_tuners->ignore_nice_load; |
307 | od_ops = dbs_data->cdata->gov_ops; | 307 | od_ops = dbs_data->cdata->gov_ops; |
308 | io_busy = od_tuners->io_is_busy; | 308 | io_busy = od_tuners->io_is_busy; |
309 | } | 309 | } |
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 6663ec3b3056..d5f12b4b11b8 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h | |||
@@ -165,7 +165,7 @@ struct cs_cpu_dbs_info_s { | |||
165 | 165 | ||
166 | /* Per policy Governers sysfs tunables */ | 166 | /* Per policy Governers sysfs tunables */ |
167 | struct od_dbs_tuners { | 167 | struct od_dbs_tuners { |
168 | unsigned int ignore_nice; | 168 | unsigned int ignore_nice_load; |
169 | unsigned int sampling_rate; | 169 | unsigned int sampling_rate; |
170 | unsigned int sampling_down_factor; | 170 | unsigned int sampling_down_factor; |
171 | unsigned int up_threshold; | 171 | unsigned int up_threshold; |
@@ -175,7 +175,7 @@ struct od_dbs_tuners { | |||
175 | }; | 175 | }; |
176 | 176 | ||
177 | struct cs_dbs_tuners { | 177 | struct cs_dbs_tuners { |
178 | unsigned int ignore_nice; | 178 | unsigned int ignore_nice_load; |
179 | unsigned int sampling_rate; | 179 | unsigned int sampling_rate; |
180 | unsigned int sampling_down_factor; | 180 | unsigned int sampling_down_factor; |
181 | unsigned int up_threshold; | 181 | unsigned int up_threshold; |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 93eb5cbcc1f6..c087347d6688 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -403,8 +403,8 @@ static ssize_t store_sampling_down_factor(struct dbs_data *dbs_data, | |||
403 | return count; | 403 | return count; |
404 | } | 404 | } |
405 | 405 | ||
406 | static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | 406 | static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data, |
407 | size_t count) | 407 | const char *buf, size_t count) |
408 | { | 408 | { |
409 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; | 409 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; |
410 | unsigned int input; | 410 | unsigned int input; |
@@ -419,10 +419,10 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | |||
419 | if (input > 1) | 419 | if (input > 1) |
420 | input = 1; | 420 | input = 1; |
421 | 421 | ||
422 | if (input == od_tuners->ignore_nice) { /* nothing to do */ | 422 | if (input == od_tuners->ignore_nice_load) { /* nothing to do */ |
423 | return count; | 423 | return count; |
424 | } | 424 | } |
425 | od_tuners->ignore_nice = input; | 425 | od_tuners->ignore_nice_load = input; |
426 | 426 | ||
427 | /* we need to re-evaluate prev_cpu_idle */ | 427 | /* we need to re-evaluate prev_cpu_idle */ |
428 | for_each_online_cpu(j) { | 428 | for_each_online_cpu(j) { |
@@ -430,7 +430,7 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | |||
430 | dbs_info = &per_cpu(od_cpu_dbs_info, j); | 430 | dbs_info = &per_cpu(od_cpu_dbs_info, j); |
431 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, | 431 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, |
432 | &dbs_info->cdbs.prev_cpu_wall, od_tuners->io_is_busy); | 432 | &dbs_info->cdbs.prev_cpu_wall, od_tuners->io_is_busy); |
433 | if (od_tuners->ignore_nice) | 433 | if (od_tuners->ignore_nice_load) |
434 | dbs_info->cdbs.prev_cpu_nice = | 434 | dbs_info->cdbs.prev_cpu_nice = |
435 | kcpustat_cpu(j).cpustat[CPUTIME_NICE]; | 435 | kcpustat_cpu(j).cpustat[CPUTIME_NICE]; |
436 | 436 | ||
@@ -461,7 +461,7 @@ show_store_one(od, sampling_rate); | |||
461 | show_store_one(od, io_is_busy); | 461 | show_store_one(od, io_is_busy); |
462 | show_store_one(od, up_threshold); | 462 | show_store_one(od, up_threshold); |
463 | show_store_one(od, sampling_down_factor); | 463 | show_store_one(od, sampling_down_factor); |
464 | show_store_one(od, ignore_nice); | 464 | show_store_one(od, ignore_nice_load); |
465 | show_store_one(od, powersave_bias); | 465 | show_store_one(od, powersave_bias); |
466 | declare_show_sampling_rate_min(od); | 466 | declare_show_sampling_rate_min(od); |
467 | 467 | ||
@@ -469,7 +469,7 @@ gov_sys_pol_attr_rw(sampling_rate); | |||
469 | gov_sys_pol_attr_rw(io_is_busy); | 469 | gov_sys_pol_attr_rw(io_is_busy); |
470 | gov_sys_pol_attr_rw(up_threshold); | 470 | gov_sys_pol_attr_rw(up_threshold); |
471 | gov_sys_pol_attr_rw(sampling_down_factor); | 471 | gov_sys_pol_attr_rw(sampling_down_factor); |
472 | gov_sys_pol_attr_rw(ignore_nice); | 472 | gov_sys_pol_attr_rw(ignore_nice_load); |
473 | gov_sys_pol_attr_rw(powersave_bias); | 473 | gov_sys_pol_attr_rw(powersave_bias); |
474 | gov_sys_pol_attr_ro(sampling_rate_min); | 474 | gov_sys_pol_attr_ro(sampling_rate_min); |
475 | 475 | ||
@@ -478,7 +478,7 @@ static struct attribute *dbs_attributes_gov_sys[] = { | |||
478 | &sampling_rate_gov_sys.attr, | 478 | &sampling_rate_gov_sys.attr, |
479 | &up_threshold_gov_sys.attr, | 479 | &up_threshold_gov_sys.attr, |
480 | &sampling_down_factor_gov_sys.attr, | 480 | &sampling_down_factor_gov_sys.attr, |
481 | &ignore_nice_gov_sys.attr, | 481 | &ignore_nice_load_gov_sys.attr, |
482 | &powersave_bias_gov_sys.attr, | 482 | &powersave_bias_gov_sys.attr, |
483 | &io_is_busy_gov_sys.attr, | 483 | &io_is_busy_gov_sys.attr, |
484 | NULL | 484 | NULL |
@@ -494,7 +494,7 @@ static struct attribute *dbs_attributes_gov_pol[] = { | |||
494 | &sampling_rate_gov_pol.attr, | 494 | &sampling_rate_gov_pol.attr, |
495 | &up_threshold_gov_pol.attr, | 495 | &up_threshold_gov_pol.attr, |
496 | &sampling_down_factor_gov_pol.attr, | 496 | &sampling_down_factor_gov_pol.attr, |
497 | &ignore_nice_gov_pol.attr, | 497 | &ignore_nice_load_gov_pol.attr, |
498 | &powersave_bias_gov_pol.attr, | 498 | &powersave_bias_gov_pol.attr, |
499 | &io_is_busy_gov_pol.attr, | 499 | &io_is_busy_gov_pol.attr, |
500 | NULL | 500 | NULL |
@@ -544,7 +544,7 @@ static int od_init(struct dbs_data *dbs_data) | |||
544 | } | 544 | } |
545 | 545 | ||
546 | tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; | 546 | tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; |
547 | tuners->ignore_nice = 0; | 547 | tuners->ignore_nice_load = 0; |
548 | tuners->powersave_bias = default_powersave_bias; | 548 | tuners->powersave_bias = default_powersave_bias; |
549 | tuners->io_is_busy = should_io_be_busy(); | 549 | tuners->io_is_busy = should_io_be_busy(); |
550 | 550 | ||
diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c index bb838b985077..9536852c504a 100644 --- a/drivers/cpufreq/loongson2_cpufreq.c +++ b/drivers/cpufreq/loongson2_cpufreq.c | |||
@@ -118,11 +118,6 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
118 | clk_put(cpuclk); | 118 | clk_put(cpuclk); |
119 | return -EINVAL; | 119 | return -EINVAL; |
120 | } | 120 | } |
121 | ret = clk_set_rate(cpuclk, rate); | ||
122 | if (ret) { | ||
123 | clk_put(cpuclk); | ||
124 | return ret; | ||
125 | } | ||
126 | 121 | ||
127 | /* clock table init */ | 122 | /* clock table init */ |
128 | for (i = 2; | 123 | for (i = 2; |
@@ -130,6 +125,12 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
130 | i++) | 125 | i++) |
131 | loongson2_clockmod_table[i].frequency = (rate * i) / 8; | 126 | loongson2_clockmod_table[i].frequency = (rate * i) / 8; |
132 | 127 | ||
128 | ret = clk_set_rate(cpuclk, rate); | ||
129 | if (ret) { | ||
130 | clk_put(cpuclk); | ||
131 | return ret; | ||
132 | } | ||
133 | |||
133 | policy->cur = loongson2_cpufreq_get(policy->cpu); | 134 | policy->cur = loongson2_cpufreq_get(policy->cpu); |
134 | 135 | ||
135 | cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0], | 136 | cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0], |
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index fe343a06b7da..bc580b67a652 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -28,13 +28,6 @@ | |||
28 | #define MAX_INTERESTING 50000 | 28 | #define MAX_INTERESTING 50000 |
29 | #define STDDEV_THRESH 400 | 29 | #define STDDEV_THRESH 400 |
30 | 30 | ||
31 | /* 60 * 60 > STDDEV_THRESH * INTERVALS = 400 * 8 */ | ||
32 | #define MAX_DEVIATION 60 | ||
33 | |||
34 | static DEFINE_PER_CPU(struct hrtimer, menu_hrtimer); | ||
35 | static DEFINE_PER_CPU(int, hrtimer_status); | ||
36 | /* menu hrtimer mode */ | ||
37 | enum {MENU_HRTIMER_STOP, MENU_HRTIMER_REPEAT, MENU_HRTIMER_GENERAL}; | ||
38 | 31 | ||
39 | /* | 32 | /* |
40 | * Concepts and ideas behind the menu governor | 33 | * Concepts and ideas behind the menu governor |
@@ -116,13 +109,6 @@ enum {MENU_HRTIMER_STOP, MENU_HRTIMER_REPEAT, MENU_HRTIMER_GENERAL}; | |||
116 | * | 109 | * |
117 | */ | 110 | */ |
118 | 111 | ||
119 | /* | ||
120 | * The C-state residency is so long that is is worthwhile to exit | ||
121 | * from the shallow C-state and re-enter into a deeper C-state. | ||
122 | */ | ||
123 | static unsigned int perfect_cstate_ms __read_mostly = 30; | ||
124 | module_param(perfect_cstate_ms, uint, 0000); | ||
125 | |||
126 | struct menu_device { | 112 | struct menu_device { |
127 | int last_state_idx; | 113 | int last_state_idx; |
128 | int needs_update; | 114 | int needs_update; |
@@ -205,52 +191,17 @@ static u64 div_round64(u64 dividend, u32 divisor) | |||
205 | return div_u64(dividend + (divisor / 2), divisor); | 191 | return div_u64(dividend + (divisor / 2), divisor); |
206 | } | 192 | } |
207 | 193 | ||
208 | /* Cancel the hrtimer if it is not triggered yet */ | ||
209 | void menu_hrtimer_cancel(void) | ||
210 | { | ||
211 | int cpu = smp_processor_id(); | ||
212 | struct hrtimer *hrtmr = &per_cpu(menu_hrtimer, cpu); | ||
213 | |||
214 | /* The timer is still not time out*/ | ||
215 | if (per_cpu(hrtimer_status, cpu)) { | ||
216 | hrtimer_cancel(hrtmr); | ||
217 | per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_STOP; | ||
218 | } | ||
219 | } | ||
220 | EXPORT_SYMBOL_GPL(menu_hrtimer_cancel); | ||
221 | |||
222 | /* Call back for hrtimer is triggered */ | ||
223 | static enum hrtimer_restart menu_hrtimer_notify(struct hrtimer *hrtimer) | ||
224 | { | ||
225 | int cpu = smp_processor_id(); | ||
226 | struct menu_device *data = &per_cpu(menu_devices, cpu); | ||
227 | |||
228 | /* In general case, the expected residency is much larger than | ||
229 | * deepest C-state target residency, but prediction logic still | ||
230 | * predicts a small predicted residency, so the prediction | ||
231 | * history is totally broken if the timer is triggered. | ||
232 | * So reset the correction factor. | ||
233 | */ | ||
234 | if (per_cpu(hrtimer_status, cpu) == MENU_HRTIMER_GENERAL) | ||
235 | data->correction_factor[data->bucket] = RESOLUTION * DECAY; | ||
236 | |||
237 | per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_STOP; | ||
238 | |||
239 | return HRTIMER_NORESTART; | ||
240 | } | ||
241 | |||
242 | /* | 194 | /* |
243 | * Try detecting repeating patterns by keeping track of the last 8 | 195 | * Try detecting repeating patterns by keeping track of the last 8 |
244 | * intervals, and checking if the standard deviation of that set | 196 | * intervals, and checking if the standard deviation of that set |
245 | * of points is below a threshold. If it is... then use the | 197 | * of points is below a threshold. If it is... then use the |
246 | * average of these 8 points as the estimated value. | 198 | * average of these 8 points as the estimated value. |
247 | */ | 199 | */ |
248 | static u32 get_typical_interval(struct menu_device *data) | 200 | static void get_typical_interval(struct menu_device *data) |
249 | { | 201 | { |
250 | int i = 0, divisor = 0; | 202 | int i = 0, divisor = 0; |
251 | uint64_t max = 0, avg = 0, stddev = 0; | 203 | uint64_t max = 0, avg = 0, stddev = 0; |
252 | int64_t thresh = LLONG_MAX; /* Discard outliers above this value. */ | 204 | int64_t thresh = LLONG_MAX; /* Discard outliers above this value. */ |
253 | unsigned int ret = 0; | ||
254 | 205 | ||
255 | again: | 206 | again: |
256 | 207 | ||
@@ -291,16 +242,13 @@ again: | |||
291 | if (((avg > stddev * 6) && (divisor * 4 >= INTERVALS * 3)) | 242 | if (((avg > stddev * 6) && (divisor * 4 >= INTERVALS * 3)) |
292 | || stddev <= 20) { | 243 | || stddev <= 20) { |
293 | data->predicted_us = avg; | 244 | data->predicted_us = avg; |
294 | ret = 1; | 245 | return; |
295 | return ret; | ||
296 | 246 | ||
297 | } else if ((divisor * 4) > INTERVALS * 3) { | 247 | } else if ((divisor * 4) > INTERVALS * 3) { |
298 | /* Exclude the max interval */ | 248 | /* Exclude the max interval */ |
299 | thresh = max - 1; | 249 | thresh = max - 1; |
300 | goto again; | 250 | goto again; |
301 | } | 251 | } |
302 | |||
303 | return ret; | ||
304 | } | 252 | } |
305 | 253 | ||
306 | /** | 254 | /** |
@@ -315,9 +263,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
315 | int i; | 263 | int i; |
316 | int multiplier; | 264 | int multiplier; |
317 | struct timespec t; | 265 | struct timespec t; |
318 | int repeat = 0, low_predicted = 0; | ||
319 | int cpu = smp_processor_id(); | ||
320 | struct hrtimer *hrtmr = &per_cpu(menu_hrtimer, cpu); | ||
321 | 266 | ||
322 | if (data->needs_update) { | 267 | if (data->needs_update) { |
323 | menu_update(drv, dev); | 268 | menu_update(drv, dev); |
@@ -352,7 +297,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
352 | data->predicted_us = div_round64(data->expected_us * data->correction_factor[data->bucket], | 297 | data->predicted_us = div_round64(data->expected_us * data->correction_factor[data->bucket], |
353 | RESOLUTION * DECAY); | 298 | RESOLUTION * DECAY); |
354 | 299 | ||
355 | repeat = get_typical_interval(data); | 300 | get_typical_interval(data); |
356 | 301 | ||
357 | /* | 302 | /* |
358 | * We want to default to C1 (hlt), not to busy polling | 303 | * We want to default to C1 (hlt), not to busy polling |
@@ -373,10 +318,8 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
373 | 318 | ||
374 | if (s->disabled || su->disable) | 319 | if (s->disabled || su->disable) |
375 | continue; | 320 | continue; |
376 | if (s->target_residency > data->predicted_us) { | 321 | if (s->target_residency > data->predicted_us) |
377 | low_predicted = 1; | ||
378 | continue; | 322 | continue; |
379 | } | ||
380 | if (s->exit_latency > latency_req) | 323 | if (s->exit_latency > latency_req) |
381 | continue; | 324 | continue; |
382 | if (s->exit_latency * multiplier > data->predicted_us) | 325 | if (s->exit_latency * multiplier > data->predicted_us) |
@@ -386,44 +329,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
386 | data->exit_us = s->exit_latency; | 329 | data->exit_us = s->exit_latency; |
387 | } | 330 | } |
388 | 331 | ||
389 | /* not deepest C-state chosen for low predicted residency */ | ||
390 | if (low_predicted) { | ||
391 | unsigned int timer_us = 0; | ||
392 | unsigned int perfect_us = 0; | ||
393 | |||
394 | /* | ||
395 | * Set a timer to detect whether this sleep is much | ||
396 | * longer than repeat mode predicted. If the timer | ||
397 | * triggers, the code will evaluate whether to put | ||
398 | * the CPU into a deeper C-state. | ||
399 | * The timer is cancelled on CPU wakeup. | ||
400 | */ | ||
401 | timer_us = 2 * (data->predicted_us + MAX_DEVIATION); | ||
402 | |||
403 | perfect_us = perfect_cstate_ms * 1000; | ||
404 | |||
405 | if (repeat && (4 * timer_us < data->expected_us)) { | ||
406 | RCU_NONIDLE(hrtimer_start(hrtmr, | ||
407 | ns_to_ktime(1000 * timer_us), | ||
408 | HRTIMER_MODE_REL_PINNED)); | ||
409 | /* In repeat case, menu hrtimer is started */ | ||
410 | per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_REPEAT; | ||
411 | } else if (perfect_us < data->expected_us) { | ||
412 | /* | ||
413 | * The next timer is long. This could be because | ||
414 | * we did not make a useful prediction. | ||
415 | * In that case, it makes sense to re-enter | ||
416 | * into a deeper C-state after some time. | ||
417 | */ | ||
418 | RCU_NONIDLE(hrtimer_start(hrtmr, | ||
419 | ns_to_ktime(1000 * timer_us), | ||
420 | HRTIMER_MODE_REL_PINNED)); | ||
421 | /* In general case, menu hrtimer is started */ | ||
422 | per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_GENERAL; | ||
423 | } | ||
424 | |||
425 | } | ||
426 | |||
427 | return data->last_state_idx; | 332 | return data->last_state_idx; |
428 | } | 333 | } |
429 | 334 | ||
@@ -514,9 +419,6 @@ static int menu_enable_device(struct cpuidle_driver *drv, | |||
514 | struct cpuidle_device *dev) | 419 | struct cpuidle_device *dev) |
515 | { | 420 | { |
516 | struct menu_device *data = &per_cpu(menu_devices, dev->cpu); | 421 | struct menu_device *data = &per_cpu(menu_devices, dev->cpu); |
517 | struct hrtimer *t = &per_cpu(menu_hrtimer, dev->cpu); | ||
518 | hrtimer_init(t, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
519 | t->function = menu_hrtimer_notify; | ||
520 | 422 | ||
521 | memset(data, 0, sizeof(struct menu_device)); | 423 | memset(data, 0, sizeof(struct menu_device)); |
522 | 424 | ||
diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c index ce3dc3e9688c..0bbdea5059f3 100644 --- a/drivers/dma/pch_dma.c +++ b/drivers/dma/pch_dma.c | |||
@@ -867,6 +867,7 @@ static int pch_dma_probe(struct pci_dev *pdev, | |||
867 | 867 | ||
868 | if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { | 868 | if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { |
869 | dev_err(&pdev->dev, "Cannot find proper base address\n"); | 869 | dev_err(&pdev->dev, "Cannot find proper base address\n"); |
870 | err = -ENODEV; | ||
870 | goto err_disable_pdev; | 871 | goto err_disable_pdev; |
871 | } | 872 | } |
872 | 873 | ||
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 593827b3fdd4..fa645d825009 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
@@ -2505,6 +2505,10 @@ static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx) | |||
2505 | /* Assign cookies to all nodes */ | 2505 | /* Assign cookies to all nodes */ |
2506 | while (!list_empty(&last->node)) { | 2506 | while (!list_empty(&last->node)) { |
2507 | desc = list_entry(last->node.next, struct dma_pl330_desc, node); | 2507 | desc = list_entry(last->node.next, struct dma_pl330_desc, node); |
2508 | if (pch->cyclic) { | ||
2509 | desc->txd.callback = last->txd.callback; | ||
2510 | desc->txd.callback_param = last->txd.callback_param; | ||
2511 | } | ||
2508 | 2512 | ||
2509 | dma_cookie_assign(&desc->txd); | 2513 | dma_cookie_assign(&desc->txd); |
2510 | 2514 | ||
@@ -2688,45 +2692,82 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( | |||
2688 | size_t period_len, enum dma_transfer_direction direction, | 2692 | size_t period_len, enum dma_transfer_direction direction, |
2689 | unsigned long flags, void *context) | 2693 | unsigned long flags, void *context) |
2690 | { | 2694 | { |
2691 | struct dma_pl330_desc *desc; | 2695 | struct dma_pl330_desc *desc = NULL, *first = NULL; |
2692 | struct dma_pl330_chan *pch = to_pchan(chan); | 2696 | struct dma_pl330_chan *pch = to_pchan(chan); |
2697 | struct dma_pl330_dmac *pdmac = pch->dmac; | ||
2698 | unsigned int i; | ||
2693 | dma_addr_t dst; | 2699 | dma_addr_t dst; |
2694 | dma_addr_t src; | 2700 | dma_addr_t src; |
2695 | 2701 | ||
2696 | desc = pl330_get_desc(pch); | 2702 | if (len % period_len != 0) |
2697 | if (!desc) { | ||
2698 | dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n", | ||
2699 | __func__, __LINE__); | ||
2700 | return NULL; | 2703 | return NULL; |
2701 | } | ||
2702 | 2704 | ||
2703 | switch (direction) { | 2705 | if (!is_slave_direction(direction)) { |
2704 | case DMA_MEM_TO_DEV: | ||
2705 | desc->rqcfg.src_inc = 1; | ||
2706 | desc->rqcfg.dst_inc = 0; | ||
2707 | desc->req.rqtype = MEMTODEV; | ||
2708 | src = dma_addr; | ||
2709 | dst = pch->fifo_addr; | ||
2710 | break; | ||
2711 | case DMA_DEV_TO_MEM: | ||
2712 | desc->rqcfg.src_inc = 0; | ||
2713 | desc->rqcfg.dst_inc = 1; | ||
2714 | desc->req.rqtype = DEVTOMEM; | ||
2715 | src = pch->fifo_addr; | ||
2716 | dst = dma_addr; | ||
2717 | break; | ||
2718 | default: | ||
2719 | dev_err(pch->dmac->pif.dev, "%s:%d Invalid dma direction\n", | 2706 | dev_err(pch->dmac->pif.dev, "%s:%d Invalid dma direction\n", |
2720 | __func__, __LINE__); | 2707 | __func__, __LINE__); |
2721 | return NULL; | 2708 | return NULL; |
2722 | } | 2709 | } |
2723 | 2710 | ||
2724 | desc->rqcfg.brst_size = pch->burst_sz; | 2711 | for (i = 0; i < len / period_len; i++) { |
2725 | desc->rqcfg.brst_len = 1; | 2712 | desc = pl330_get_desc(pch); |
2713 | if (!desc) { | ||
2714 | dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n", | ||
2715 | __func__, __LINE__); | ||
2726 | 2716 | ||
2727 | pch->cyclic = true; | 2717 | if (!first) |
2718 | return NULL; | ||
2719 | |||
2720 | spin_lock_irqsave(&pdmac->pool_lock, flags); | ||
2721 | |||
2722 | while (!list_empty(&first->node)) { | ||
2723 | desc = list_entry(first->node.next, | ||
2724 | struct dma_pl330_desc, node); | ||
2725 | list_move_tail(&desc->node, &pdmac->desc_pool); | ||
2726 | } | ||
2727 | |||
2728 | list_move_tail(&first->node, &pdmac->desc_pool); | ||
2728 | 2729 | ||
2729 | fill_px(&desc->px, dst, src, period_len); | 2730 | spin_unlock_irqrestore(&pdmac->pool_lock, flags); |
2731 | |||
2732 | return NULL; | ||
2733 | } | ||
2734 | |||
2735 | switch (direction) { | ||
2736 | case DMA_MEM_TO_DEV: | ||
2737 | desc->rqcfg.src_inc = 1; | ||
2738 | desc->rqcfg.dst_inc = 0; | ||
2739 | desc->req.rqtype = MEMTODEV; | ||
2740 | src = dma_addr; | ||
2741 | dst = pch->fifo_addr; | ||
2742 | break; | ||
2743 | case DMA_DEV_TO_MEM: | ||
2744 | desc->rqcfg.src_inc = 0; | ||
2745 | desc->rqcfg.dst_inc = 1; | ||
2746 | desc->req.rqtype = DEVTOMEM; | ||
2747 | src = pch->fifo_addr; | ||
2748 | dst = dma_addr; | ||
2749 | break; | ||
2750 | default: | ||
2751 | break; | ||
2752 | } | ||
2753 | |||
2754 | desc->rqcfg.brst_size = pch->burst_sz; | ||
2755 | desc->rqcfg.brst_len = 1; | ||
2756 | fill_px(&desc->px, dst, src, period_len); | ||
2757 | |||
2758 | if (!first) | ||
2759 | first = desc; | ||
2760 | else | ||
2761 | list_add_tail(&desc->node, &first->node); | ||
2762 | |||
2763 | dma_addr += period_len; | ||
2764 | } | ||
2765 | |||
2766 | if (!desc) | ||
2767 | return NULL; | ||
2768 | |||
2769 | pch->cyclic = true; | ||
2770 | desc->txd.flags = flags; | ||
2730 | 2771 | ||
2731 | return &desc->txd; | 2772 | return &desc->txd; |
2732 | } | 2773 | } |
diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c index b67f45f5c271..5039fbc88254 100644 --- a/drivers/dma/sh/shdma.c +++ b/drivers/dma/sh/shdma.c | |||
@@ -400,8 +400,8 @@ static size_t sh_dmae_get_partial(struct shdma_chan *schan, | |||
400 | shdma_chan); | 400 | shdma_chan); |
401 | struct sh_dmae_desc *sh_desc = container_of(sdesc, | 401 | struct sh_dmae_desc *sh_desc = container_of(sdesc, |
402 | struct sh_dmae_desc, shdma_desc); | 402 | struct sh_dmae_desc, shdma_desc); |
403 | return (sh_desc->hw.tcr - sh_dmae_readl(sh_chan, TCR)) << | 403 | return sh_desc->hw.tcr - |
404 | sh_chan->xmit_shift; | 404 | (sh_dmae_readl(sh_chan, TCR) << sh_chan->xmit_shift); |
405 | } | 405 | } |
406 | 406 | ||
407 | /* Called from error IRQ or NMI */ | 407 | /* Called from error IRQ or NMI */ |
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index eb760a218da4..232fa8fce26a 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -419,6 +419,13 @@ static void __init dmi_format_ids(char *buf, size_t len) | |||
419 | dmi_get_system_info(DMI_BIOS_DATE)); | 419 | dmi_get_system_info(DMI_BIOS_DATE)); |
420 | } | 420 | } |
421 | 421 | ||
422 | /* | ||
423 | * Check for DMI/SMBIOS headers in the system firmware image. Any | ||
424 | * SMBIOS header must start 16 bytes before the DMI header, so take a | ||
425 | * 32 byte buffer and check for DMI at offset 16 and SMBIOS at offset | ||
426 | * 0. If the DMI header is present, set dmi_ver accordingly (SMBIOS | ||
427 | * takes precedence) and return 0. Otherwise return 1. | ||
428 | */ | ||
422 | static int __init dmi_present(const u8 *buf) | 429 | static int __init dmi_present(const u8 *buf) |
423 | { | 430 | { |
424 | int smbios_ver; | 431 | int smbios_ver; |
@@ -506,6 +513,13 @@ void __init dmi_scan_machine(void) | |||
506 | if (p == NULL) | 513 | if (p == NULL) |
507 | goto error; | 514 | goto error; |
508 | 515 | ||
516 | /* | ||
517 | * Iterate over all possible DMI header addresses q. | ||
518 | * Maintain the 32 bytes around q in buf. On the | ||
519 | * first iteration, substitute zero for the | ||
520 | * out-of-range bytes so there is no chance of falsely | ||
521 | * detecting an SMBIOS header. | ||
522 | */ | ||
509 | memset(buf, 0, 16); | 523 | memset(buf, 0, 16); |
510 | for (q = p; q < p + 0x10000; q += 16) { | 524 | for (q = p; q < p + 0x10000; q += 16) { |
511 | memcpy_fromio(buf + 16, q, 16); | 525 | memcpy_fromio(buf + 16, q, 16); |
diff --git a/drivers/gpio/gpio-msm-v1.c b/drivers/gpio/gpio-msm-v1.c index e3ceaacde45c..73b73969d361 100644 --- a/drivers/gpio/gpio-msm-v1.c +++ b/drivers/gpio/gpio-msm-v1.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/device.h> | 22 | #include <linux/device.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/err.h> | ||
24 | 25 | ||
25 | #include <mach/msm_gpiomux.h> | 26 | #include <mach/msm_gpiomux.h> |
26 | 27 | ||
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index c57244ef428b..dfeb3a3a8f20 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -1037,18 +1037,6 @@ omap_mpuio_alloc_gc(struct gpio_bank *bank, unsigned int irq_start, | |||
1037 | IRQ_NOREQUEST | IRQ_NOPROBE, 0); | 1037 | IRQ_NOREQUEST | IRQ_NOPROBE, 0); |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | #if defined(CONFIG_OF_GPIO) | ||
1041 | static inline bool omap_gpio_chip_boot_dt(struct gpio_chip *chip) | ||
1042 | { | ||
1043 | return chip->of_node != NULL; | ||
1044 | } | ||
1045 | #else | ||
1046 | static inline bool omap_gpio_chip_boot_dt(struct gpio_chip *chip) | ||
1047 | { | ||
1048 | return false; | ||
1049 | } | ||
1050 | #endif | ||
1051 | |||
1052 | static void omap_gpio_chip_init(struct gpio_bank *bank) | 1040 | static void omap_gpio_chip_init(struct gpio_bank *bank) |
1053 | { | 1041 | { |
1054 | int j; | 1042 | int j; |
@@ -1080,68 +1068,24 @@ static void omap_gpio_chip_init(struct gpio_bank *bank) | |||
1080 | 1068 | ||
1081 | gpiochip_add(&bank->chip); | 1069 | gpiochip_add(&bank->chip); |
1082 | 1070 | ||
1083 | /* | 1071 | for (j = 0; j < bank->width; j++) { |
1084 | * REVISIT these explicit calls to irq_create_mapping() | 1072 | int irq = irq_create_mapping(bank->domain, j); |
1085 | * to do the GPIO to IRQ domain mapping for each GPIO in | 1073 | irq_set_lockdep_class(irq, &gpio_lock_class); |
1086 | * the bank can be removed once all OMAP platforms have | 1074 | irq_set_chip_data(irq, bank); |
1087 | * been migrated to Device Tree boot only. | 1075 | if (bank->is_mpuio) { |
1088 | * Since in DT boot irq_create_mapping() is called from | 1076 | omap_mpuio_alloc_gc(bank, irq, bank->width); |
1089 | * irq_create_of_mapping() only for the GPIO lines that | 1077 | } else { |
1090 | * are used as interrupts. | 1078 | irq_set_chip_and_handler(irq, &gpio_irq_chip, |
1091 | */ | 1079 | handle_simple_irq); |
1092 | if (!omap_gpio_chip_boot_dt(&bank->chip)) | 1080 | set_irq_flags(irq, IRQF_VALID); |
1093 | for (j = 0; j < bank->width; j++) | 1081 | } |
1094 | irq_create_mapping(bank->domain, j); | 1082 | } |
1095 | irq_set_chained_handler(bank->irq, gpio_irq_handler); | 1083 | irq_set_chained_handler(bank->irq, gpio_irq_handler); |
1096 | irq_set_handler_data(bank->irq, bank); | 1084 | irq_set_handler_data(bank->irq, bank); |
1097 | } | 1085 | } |
1098 | 1086 | ||
1099 | static const struct of_device_id omap_gpio_match[]; | 1087 | static const struct of_device_id omap_gpio_match[]; |
1100 | 1088 | ||
1101 | static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq, | ||
1102 | irq_hw_number_t hwirq) | ||
1103 | { | ||
1104 | struct gpio_bank *bank = d->host_data; | ||
1105 | int gpio; | ||
1106 | int ret; | ||
1107 | |||
1108 | if (!bank) | ||
1109 | return -EINVAL; | ||
1110 | |||
1111 | irq_set_lockdep_class(virq, &gpio_lock_class); | ||
1112 | irq_set_chip_data(virq, bank); | ||
1113 | if (bank->is_mpuio) { | ||
1114 | omap_mpuio_alloc_gc(bank, virq, bank->width); | ||
1115 | } else { | ||
1116 | irq_set_chip_and_handler(virq, &gpio_irq_chip, | ||
1117 | handle_simple_irq); | ||
1118 | set_irq_flags(virq, IRQF_VALID); | ||
1119 | } | ||
1120 | |||
1121 | /* | ||
1122 | * REVISIT most GPIO IRQ chip drivers need to call | ||
1123 | * gpio_request() before a GPIO line can be used as an | ||
1124 | * IRQ. Ideally this should be handled by the IRQ core | ||
1125 | * but until then this has to be done on a per driver | ||
1126 | * basis. Remove this once this is managed by the core. | ||
1127 | */ | ||
1128 | if (omap_gpio_chip_boot_dt(&bank->chip)) { | ||
1129 | gpio = irq_to_gpio(bank, hwirq); | ||
1130 | ret = gpio_request_one(gpio, GPIOF_IN, NULL); | ||
1131 | if (ret) { | ||
1132 | dev_err(bank->dev, "Could not request GPIO%d\n", gpio); | ||
1133 | return ret; | ||
1134 | } | ||
1135 | } | ||
1136 | |||
1137 | return 0; | ||
1138 | } | ||
1139 | |||
1140 | static struct irq_domain_ops omap_gpio_irq_ops = { | ||
1141 | .xlate = irq_domain_xlate_onetwocell, | ||
1142 | .map = omap_gpio_irq_map, | ||
1143 | }; | ||
1144 | |||
1145 | static int omap_gpio_probe(struct platform_device *pdev) | 1089 | static int omap_gpio_probe(struct platform_device *pdev) |
1146 | { | 1090 | { |
1147 | struct device *dev = &pdev->dev; | 1091 | struct device *dev = &pdev->dev; |
@@ -1207,10 +1151,10 @@ static int omap_gpio_probe(struct platform_device *pdev) | |||
1207 | } | 1151 | } |
1208 | 1152 | ||
1209 | bank->domain = irq_domain_add_legacy(node, bank->width, irq_base, | 1153 | bank->domain = irq_domain_add_legacy(node, bank->width, irq_base, |
1210 | 0, &omap_gpio_irq_ops, bank); | 1154 | 0, &irq_domain_simple_ops, NULL); |
1211 | #else | 1155 | #else |
1212 | bank->domain = irq_domain_add_linear(node, bank->width, | 1156 | bank->domain = irq_domain_add_linear(node, bank->width, |
1213 | &omap_gpio_irq_ops, bank); | 1157 | &irq_domain_simple_ops, NULL); |
1214 | #endif | 1158 | #endif |
1215 | if (!bank->domain) { | 1159 | if (!bank->domain) { |
1216 | dev_err(dev, "Couldn't register an IRQ domain\n"); | 1160 | dev_err(dev, "Couldn't register an IRQ domain\n"); |
diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c index 98d670825a1a..6e8887fe6c1b 100644 --- a/drivers/gpu/drm/ast/ast_ttm.c +++ b/drivers/gpu/drm/ast/ast_ttm.c | |||
@@ -323,6 +323,7 @@ int ast_bo_create(struct drm_device *dev, int size, int align, | |||
323 | 323 | ||
324 | astbo->gem.driver_private = NULL; | 324 | astbo->gem.driver_private = NULL; |
325 | astbo->bo.bdev = &ast->ttm.bdev; | 325 | astbo->bo.bdev = &ast->ttm.bdev; |
326 | astbo->bo.bdev->dev_mapping = dev->dev_mapping; | ||
326 | 327 | ||
327 | ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); | 328 | ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); |
328 | 329 | ||
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c index 0047012045c2..69fd8f1ac8df 100644 --- a/drivers/gpu/drm/cirrus/cirrus_ttm.c +++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c | |||
@@ -328,6 +328,7 @@ int cirrus_bo_create(struct drm_device *dev, int size, int align, | |||
328 | 328 | ||
329 | cirrusbo->gem.driver_private = NULL; | 329 | cirrusbo->gem.driver_private = NULL; |
330 | cirrusbo->bo.bdev = &cirrus->ttm.bdev; | 330 | cirrusbo->bo.bdev = &cirrus->ttm.bdev; |
331 | cirrusbo->bo.bdev->dev_mapping = dev->dev_mapping; | ||
331 | 332 | ||
332 | cirrus_ttm_placement(cirrusbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); | 333 | cirrus_ttm_placement(cirrusbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); |
333 | 334 | ||
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 8bcce7866d36..f92da0a32f0d 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -708,7 +708,10 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc, | |||
708 | /* Subtract time delta from raw timestamp to get final | 708 | /* Subtract time delta from raw timestamp to get final |
709 | * vblank_time timestamp for end of vblank. | 709 | * vblank_time timestamp for end of vblank. |
710 | */ | 710 | */ |
711 | etime = ktime_sub_ns(etime, delta_ns); | 711 | if (delta_ns < 0) |
712 | etime = ktime_add_ns(etime, -delta_ns); | ||
713 | else | ||
714 | etime = ktime_sub_ns(etime, delta_ns); | ||
712 | *vblank_time = ktime_to_timeval(etime); | 715 | *vblank_time = ktime_to_timeval(etime); |
713 | 716 | ||
714 | DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n", | 717 | DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n", |
diff --git a/drivers/gpu/drm/exynos/exynos_ddc.c b/drivers/gpu/drm/exynos/exynos_ddc.c index 95c75edef01a..30ef41bcd7b8 100644 --- a/drivers/gpu/drm/exynos/exynos_ddc.c +++ b/drivers/gpu/drm/exynos/exynos_ddc.c | |||
@@ -15,7 +15,6 @@ | |||
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
18 | #include <linux/module.h> | ||
19 | 18 | ||
20 | 19 | ||
21 | #include "exynos_drm_drv.h" | 20 | #include "exynos_drm_drv.h" |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index 61b094f689a7..6e047bd53e2f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/module.h> | ||
16 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
17 | #include <linux/mfd/syscon.h> | 16 | #include <linux/mfd/syscon.h> |
18 | #include <linux/regmap.h> | 17 | #include <linux/regmap.h> |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 3e106beca5b6..1c263dac3c1c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <drm/drmP.h> | 14 | #include <drm/drmP.h> |
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/module.h> | ||
18 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
19 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
20 | #include <linux/of_device.h> | 19 | #include <linux/of_device.h> |
@@ -130,7 +129,6 @@ static const struct of_device_id fimd_driver_dt_match[] = { | |||
130 | .data = &exynos5_fimd_driver_data }, | 129 | .data = &exynos5_fimd_driver_data }, |
131 | {}, | 130 | {}, |
132 | }; | 131 | }; |
133 | MODULE_DEVICE_TABLE(of, fimd_driver_dt_match); | ||
134 | #endif | 132 | #endif |
135 | 133 | ||
136 | static inline struct fimd_driver_data *drm_fimd_get_driver_data( | 134 | static inline struct fimd_driver_data *drm_fimd_get_driver_data( |
@@ -1082,7 +1080,6 @@ static struct platform_device_id fimd_driver_ids[] = { | |||
1082 | }, | 1080 | }, |
1083 | {}, | 1081 | {}, |
1084 | }; | 1082 | }; |
1085 | MODULE_DEVICE_TABLE(platform, fimd_driver_ids); | ||
1086 | 1083 | ||
1087 | static const struct dev_pm_ops fimd_pm_ops = { | 1084 | static const struct dev_pm_ops fimd_pm_ops = { |
1088 | SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume) | 1085 | SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume) |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 42a5a5466075..eddea4941483 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c | |||
@@ -8,7 +8,6 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/module.h> | ||
12 | #include <linux/clk.h> | 11 | #include <linux/clk.h> |
13 | #include <linux/err.h> | 12 | #include <linux/err.h> |
14 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
@@ -806,9 +805,20 @@ static void g2d_dma_start(struct g2d_data *g2d, | |||
806 | struct g2d_cmdlist_node *node = | 805 | struct g2d_cmdlist_node *node = |
807 | list_first_entry(&runqueue_node->run_cmdlist, | 806 | list_first_entry(&runqueue_node->run_cmdlist, |
808 | struct g2d_cmdlist_node, list); | 807 | struct g2d_cmdlist_node, list); |
808 | int ret; | ||
809 | |||
810 | ret = pm_runtime_get_sync(g2d->dev); | ||
811 | if (ret < 0) { | ||
812 | dev_warn(g2d->dev, "failed pm power on.\n"); | ||
813 | return; | ||
814 | } | ||
809 | 815 | ||
810 | pm_runtime_get_sync(g2d->dev); | 816 | ret = clk_prepare_enable(g2d->gate_clk); |
811 | clk_enable(g2d->gate_clk); | 817 | if (ret < 0) { |
818 | dev_warn(g2d->dev, "failed to enable clock.\n"); | ||
819 | pm_runtime_put_sync(g2d->dev); | ||
820 | return; | ||
821 | } | ||
812 | 822 | ||
813 | writel_relaxed(node->dma_addr, g2d->regs + G2D_DMA_SFR_BASE_ADDR); | 823 | writel_relaxed(node->dma_addr, g2d->regs + G2D_DMA_SFR_BASE_ADDR); |
814 | writel_relaxed(G2D_DMA_START, g2d->regs + G2D_DMA_COMMAND); | 824 | writel_relaxed(G2D_DMA_START, g2d->regs + G2D_DMA_COMMAND); |
@@ -861,7 +871,7 @@ static void g2d_runqueue_worker(struct work_struct *work) | |||
861 | runqueue_work); | 871 | runqueue_work); |
862 | 872 | ||
863 | mutex_lock(&g2d->runqueue_mutex); | 873 | mutex_lock(&g2d->runqueue_mutex); |
864 | clk_disable(g2d->gate_clk); | 874 | clk_disable_unprepare(g2d->gate_clk); |
865 | pm_runtime_put_sync(g2d->dev); | 875 | pm_runtime_put_sync(g2d->dev); |
866 | 876 | ||
867 | complete(&g2d->runqueue_node->complete); | 877 | complete(&g2d->runqueue_node->complete); |
@@ -1521,7 +1531,6 @@ static const struct of_device_id exynos_g2d_match[] = { | |||
1521 | { .compatible = "samsung,exynos5250-g2d" }, | 1531 | { .compatible = "samsung,exynos5250-g2d" }, |
1522 | {}, | 1532 | {}, |
1523 | }; | 1533 | }; |
1524 | MODULE_DEVICE_TABLE(of, exynos_g2d_match); | ||
1525 | #endif | 1534 | #endif |
1526 | 1535 | ||
1527 | struct platform_driver g2d_driver = { | 1536 | struct platform_driver g2d_driver = { |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 472e3b25e7f2..90b8a1a5344c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/module.h> | ||
16 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
17 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
18 | #include <linux/pm_runtime.h> | 17 | #include <linux/pm_runtime.h> |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index aaa550d622f0..8d3bc01d6834 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c | |||
@@ -15,7 +15,6 @@ | |||
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/wait.h> | 17 | #include <linux/wait.h> |
18 | #include <linux/module.h> | ||
19 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
20 | #include <linux/pm_runtime.h> | 19 | #include <linux/pm_runtime.h> |
21 | 20 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index b1ef8e7ff9c9..d2b6ab4def93 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/module.h> | ||
16 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
17 | #include <linux/types.h> | 16 | #include <linux/types.h> |
18 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
@@ -342,10 +341,10 @@ int exynos_drm_ipp_get_property(struct drm_device *drm_dev, void *data, | |||
342 | */ | 341 | */ |
343 | ippdrv = ipp_find_obj(&ctx->ipp_idr, &ctx->ipp_lock, | 342 | ippdrv = ipp_find_obj(&ctx->ipp_idr, &ctx->ipp_lock, |
344 | prop_list->ipp_id); | 343 | prop_list->ipp_id); |
345 | if (!ippdrv) { | 344 | if (IS_ERR(ippdrv)) { |
346 | DRM_ERROR("not found ipp%d driver.\n", | 345 | DRM_ERROR("not found ipp%d driver.\n", |
347 | prop_list->ipp_id); | 346 | prop_list->ipp_id); |
348 | return -EINVAL; | 347 | return PTR_ERR(ippdrv); |
349 | } | 348 | } |
350 | 349 | ||
351 | prop_list = ippdrv->prop_list; | 350 | prop_list = ippdrv->prop_list; |
@@ -970,9 +969,9 @@ int exynos_drm_ipp_queue_buf(struct drm_device *drm_dev, void *data, | |||
970 | /* find command node */ | 969 | /* find command node */ |
971 | c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock, | 970 | c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock, |
972 | qbuf->prop_id); | 971 | qbuf->prop_id); |
973 | if (!c_node) { | 972 | if (IS_ERR(c_node)) { |
974 | DRM_ERROR("failed to get command node.\n"); | 973 | DRM_ERROR("failed to get command node.\n"); |
975 | return -EFAULT; | 974 | return PTR_ERR(c_node); |
976 | } | 975 | } |
977 | 976 | ||
978 | /* buffer control */ | 977 | /* buffer control */ |
@@ -1106,9 +1105,9 @@ int exynos_drm_ipp_cmd_ctrl(struct drm_device *drm_dev, void *data, | |||
1106 | 1105 | ||
1107 | c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock, | 1106 | c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock, |
1108 | cmd_ctrl->prop_id); | 1107 | cmd_ctrl->prop_id); |
1109 | if (!c_node) { | 1108 | if (IS_ERR(c_node)) { |
1110 | DRM_ERROR("invalid command node list.\n"); | 1109 | DRM_ERROR("invalid command node list.\n"); |
1111 | return -EINVAL; | 1110 | return PTR_ERR(c_node); |
1112 | } | 1111 | } |
1113 | 1112 | ||
1114 | if (!exynos_drm_ipp_check_valid(ippdrv->dev, cmd_ctrl->ctrl, | 1113 | if (!exynos_drm_ipp_check_valid(ippdrv->dev, cmd_ctrl->ctrl, |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c index 427640aa5148..49669aa24c45 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c +++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> | ||
14 | #include <linux/err.h> | 13 | #include <linux/err.h> |
15 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
16 | #include <linux/io.h> | 15 | #include <linux/io.h> |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 41cc74d83e4e..c57c56519add 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <drm/drmP.h> | 13 | #include <drm/drmP.h> |
14 | 14 | ||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/module.h> | ||
17 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
18 | 17 | ||
19 | #include <drm/exynos_drm.h> | 18 | #include <drm/exynos_drm.h> |
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 62ef5971ac3c..2f5c6942c968 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
25 | #include <linux/wait.h> | 25 | #include <linux/wait.h> |
26 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
27 | #include <linux/module.h> | ||
28 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
29 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
30 | #include <linux/irq.h> | 29 | #include <linux/irq.h> |
diff --git a/drivers/gpu/drm/exynos/exynos_hdmiphy.c b/drivers/gpu/drm/exynos/exynos_hdmiphy.c index ef04255076c7..6e320ae9afed 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmiphy.c +++ b/drivers/gpu/drm/exynos/exynos_hdmiphy.c | |||
@@ -15,7 +15,6 @@ | |||
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
18 | #include <linux/module.h> | ||
19 | 18 | ||
20 | #include "exynos_drm_drv.h" | 19 | #include "exynos_drm_drv.h" |
21 | #include "exynos_hdmi.h" | 20 | #include "exynos_hdmi.h" |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 42ffb71c63bc..c9a137caea41 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/wait.h> | 24 | #include <linux/wait.h> |
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include <linux/module.h> | ||
27 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
28 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
29 | #include <linux/irq.h> | 28 | #include <linux/irq.h> |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 66c63808fa35..f4669802a0fb 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1594,6 +1594,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1594 | intel_detect_pch(dev); | 1594 | intel_detect_pch(dev); |
1595 | 1595 | ||
1596 | intel_irq_init(dev); | 1596 | intel_irq_init(dev); |
1597 | intel_pm_init(dev); | ||
1597 | intel_gt_sanitize(dev); | 1598 | intel_gt_sanitize(dev); |
1598 | intel_gt_init(dev); | 1599 | intel_gt_init(dev); |
1599 | 1600 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index d2ee3343c943..1929bffc1c77 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1582,6 +1582,7 @@ void i915_hangcheck_elapsed(unsigned long data); | |||
1582 | void i915_handle_error(struct drm_device *dev, bool wedged); | 1582 | void i915_handle_error(struct drm_device *dev, bool wedged); |
1583 | 1583 | ||
1584 | extern void intel_irq_init(struct drm_device *dev); | 1584 | extern void intel_irq_init(struct drm_device *dev); |
1585 | extern void intel_pm_init(struct drm_device *dev); | ||
1585 | extern void intel_hpd_init(struct drm_device *dev); | 1586 | extern void intel_hpd_init(struct drm_device *dev); |
1586 | extern void intel_gt_init(struct drm_device *dev); | 1587 | extern void intel_gt_init(struct drm_device *dev); |
1587 | extern void intel_gt_sanitize(struct drm_device *dev); | 1588 | extern void intel_gt_sanitize(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index f2326fc60ac9..6f514297c483 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -1856,10 +1856,16 @@ | |||
1856 | #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) | 1856 | #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) |
1857 | 1857 | ||
1858 | #define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114) | 1858 | #define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114) |
1859 | /* HDMI/DP bits are gen4+ */ | 1859 | /* |
1860 | #define PORTB_HOTPLUG_LIVE_STATUS (1 << 29) | 1860 | * HDMI/DP bits are gen4+ |
1861 | * | ||
1862 | * WARNING: Bspec for hpd status bits on gen4 seems to be completely confused. | ||
1863 | * Please check the detailed lore in the commit message for for experimental | ||
1864 | * evidence. | ||
1865 | */ | ||
1866 | #define PORTD_HOTPLUG_LIVE_STATUS (1 << 29) | ||
1861 | #define PORTC_HOTPLUG_LIVE_STATUS (1 << 28) | 1867 | #define PORTC_HOTPLUG_LIVE_STATUS (1 << 28) |
1862 | #define PORTD_HOTPLUG_LIVE_STATUS (1 << 27) | 1868 | #define PORTB_HOTPLUG_LIVE_STATUS (1 << 27) |
1863 | #define PORTD_HOTPLUG_INT_STATUS (3 << 21) | 1869 | #define PORTD_HOTPLUG_INT_STATUS (3 << 21) |
1864 | #define PORTC_HOTPLUG_INT_STATUS (3 << 19) | 1870 | #define PORTC_HOTPLUG_INT_STATUS (3 << 19) |
1865 | #define PORTB_HOTPLUG_INT_STATUS (3 << 17) | 1871 | #define PORTB_HOTPLUG_INT_STATUS (3 << 17) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 5fb305840db8..e38b45786653 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -8269,9 +8269,11 @@ check_crtc_state(struct drm_device *dev) | |||
8269 | 8269 | ||
8270 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, | 8270 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, |
8271 | base.head) { | 8271 | base.head) { |
8272 | enum pipe pipe; | ||
8272 | if (encoder->base.crtc != &crtc->base) | 8273 | if (encoder->base.crtc != &crtc->base) |
8273 | continue; | 8274 | continue; |
8274 | if (encoder->get_config) | 8275 | if (encoder->get_config && |
8276 | encoder->get_hw_state(encoder, &pipe)) | ||
8275 | encoder->get_config(encoder, &pipe_config); | 8277 | encoder->get_config(encoder, &pipe_config); |
8276 | } | 8278 | } |
8277 | 8279 | ||
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 67e2c1f1c9a8..5950888ae1d0 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -497,8 +497,11 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level, u32 max) | |||
497 | goto out; | 497 | goto out; |
498 | } | 498 | } |
499 | 499 | ||
500 | /* scale to hardware */ | 500 | /* scale to hardware, but be careful to not overflow */ |
501 | level = level * freq / max; | 501 | if (freq < max) |
502 | level = level * freq / max; | ||
503 | else | ||
504 | level = freq / max * level; | ||
502 | 505 | ||
503 | dev_priv->backlight.level = level; | 506 | dev_priv->backlight.level = level; |
504 | if (dev_priv->backlight.device) | 507 | if (dev_priv->backlight.device) |
@@ -515,6 +518,17 @@ void intel_panel_disable_backlight(struct drm_device *dev) | |||
515 | struct drm_i915_private *dev_priv = dev->dev_private; | 518 | struct drm_i915_private *dev_priv = dev->dev_private; |
516 | unsigned long flags; | 519 | unsigned long flags; |
517 | 520 | ||
521 | /* | ||
522 | * Do not disable backlight on the vgaswitcheroo path. When switching | ||
523 | * away from i915, the other client may depend on i915 to handle the | ||
524 | * backlight. This will leave the backlight on unnecessarily when | ||
525 | * another client is not activated. | ||
526 | */ | ||
527 | if (dev->switch_power_state == DRM_SWITCH_POWER_CHANGING) { | ||
528 | DRM_DEBUG_DRIVER("Skipping backlight disable on vga switch\n"); | ||
529 | return; | ||
530 | } | ||
531 | |||
518 | spin_lock_irqsave(&dev_priv->backlight.lock, flags); | 532 | spin_lock_irqsave(&dev_priv->backlight.lock, flags); |
519 | 533 | ||
520 | dev_priv->backlight.enabled = false; | 534 | dev_priv->backlight.enabled = false; |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 51a2a60f5bfc..b0e4a0bd1313 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -5063,8 +5063,26 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable) | |||
5063 | } | 5063 | } |
5064 | } else { | 5064 | } else { |
5065 | if (enable_requested) { | 5065 | if (enable_requested) { |
5066 | unsigned long irqflags; | ||
5067 | enum pipe p; | ||
5068 | |||
5066 | I915_WRITE(HSW_PWR_WELL_DRIVER, 0); | 5069 | I915_WRITE(HSW_PWR_WELL_DRIVER, 0); |
5070 | POSTING_READ(HSW_PWR_WELL_DRIVER); | ||
5067 | DRM_DEBUG_KMS("Requesting to disable the power well\n"); | 5071 | DRM_DEBUG_KMS("Requesting to disable the power well\n"); |
5072 | |||
5073 | /* | ||
5074 | * After this, the registers on the pipes that are part | ||
5075 | * of the power well will become zero, so we have to | ||
5076 | * adjust our counters according to that. | ||
5077 | * | ||
5078 | * FIXME: Should we do this in general in | ||
5079 | * drm_vblank_post_modeset? | ||
5080 | */ | ||
5081 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | ||
5082 | for_each_pipe(p) | ||
5083 | if (p != PIPE_A) | ||
5084 | dev->last_vblank[p] = 0; | ||
5085 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | ||
5068 | } | 5086 | } |
5069 | } | 5087 | } |
5070 | } | 5088 | } |
@@ -5536,6 +5554,12 @@ void intel_gt_init(struct drm_device *dev) | |||
5536 | dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get; | 5554 | dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get; |
5537 | dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put; | 5555 | dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put; |
5538 | } | 5556 | } |
5557 | } | ||
5558 | |||
5559 | void intel_pm_init(struct drm_device *dev) | ||
5560 | { | ||
5561 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
5562 | |||
5539 | INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work, | 5563 | INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work, |
5540 | intel_gen6_powersave_work); | 5564 | intel_gen6_powersave_work); |
5541 | } | 5565 | } |
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 251784aa2225..503a414cbdad 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c | |||
@@ -29,6 +29,7 @@ static void mga_crtc_load_lut(struct drm_crtc *crtc) | |||
29 | struct mga_crtc *mga_crtc = to_mga_crtc(crtc); | 29 | struct mga_crtc *mga_crtc = to_mga_crtc(crtc); |
30 | struct drm_device *dev = crtc->dev; | 30 | struct drm_device *dev = crtc->dev; |
31 | struct mga_device *mdev = dev->dev_private; | 31 | struct mga_device *mdev = dev->dev_private; |
32 | struct drm_framebuffer *fb = crtc->fb; | ||
32 | int i; | 33 | int i; |
33 | 34 | ||
34 | if (!crtc->enabled) | 35 | if (!crtc->enabled) |
@@ -36,6 +37,28 @@ static void mga_crtc_load_lut(struct drm_crtc *crtc) | |||
36 | 37 | ||
37 | WREG8(DAC_INDEX + MGA1064_INDEX, 0); | 38 | WREG8(DAC_INDEX + MGA1064_INDEX, 0); |
38 | 39 | ||
40 | if (fb && fb->bits_per_pixel == 16) { | ||
41 | int inc = (fb->depth == 15) ? 8 : 4; | ||
42 | u8 r, b; | ||
43 | for (i = 0; i < MGAG200_LUT_SIZE; i += inc) { | ||
44 | if (fb->depth == 16) { | ||
45 | if (i > (MGAG200_LUT_SIZE >> 1)) { | ||
46 | r = b = 0; | ||
47 | } else { | ||
48 | r = mga_crtc->lut_r[i << 1]; | ||
49 | b = mga_crtc->lut_b[i << 1]; | ||
50 | } | ||
51 | } else { | ||
52 | r = mga_crtc->lut_r[i]; | ||
53 | b = mga_crtc->lut_b[i]; | ||
54 | } | ||
55 | /* VGA registers */ | ||
56 | WREG8(DAC_INDEX + MGA1064_COL_PAL, r); | ||
57 | WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_g[i]); | ||
58 | WREG8(DAC_INDEX + MGA1064_COL_PAL, b); | ||
59 | } | ||
60 | return; | ||
61 | } | ||
39 | for (i = 0; i < MGAG200_LUT_SIZE; i++) { | 62 | for (i = 0; i < MGAG200_LUT_SIZE; i++) { |
40 | /* VGA registers */ | 63 | /* VGA registers */ |
41 | WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_r[i]); | 64 | WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_r[i]); |
@@ -877,7 +900,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, | |||
877 | 900 | ||
878 | pitch = crtc->fb->pitches[0] / (crtc->fb->bits_per_pixel / 8); | 901 | pitch = crtc->fb->pitches[0] / (crtc->fb->bits_per_pixel / 8); |
879 | if (crtc->fb->bits_per_pixel == 24) | 902 | if (crtc->fb->bits_per_pixel == 24) |
880 | pitch = pitch >> (4 - bppshift); | 903 | pitch = (pitch * 3) >> (4 - bppshift); |
881 | else | 904 | else |
882 | pitch = pitch >> (4 - bppshift); | 905 | pitch = pitch >> (4 - bppshift); |
883 | 906 | ||
@@ -1251,6 +1274,24 @@ static void mga_crtc_destroy(struct drm_crtc *crtc) | |||
1251 | kfree(mga_crtc); | 1274 | kfree(mga_crtc); |
1252 | } | 1275 | } |
1253 | 1276 | ||
1277 | static void mga_crtc_disable(struct drm_crtc *crtc) | ||
1278 | { | ||
1279 | int ret; | ||
1280 | DRM_DEBUG_KMS("\n"); | ||
1281 | mga_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); | ||
1282 | if (crtc->fb) { | ||
1283 | struct mga_framebuffer *mga_fb = to_mga_framebuffer(crtc->fb); | ||
1284 | struct drm_gem_object *obj = mga_fb->obj; | ||
1285 | struct mgag200_bo *bo = gem_to_mga_bo(obj); | ||
1286 | ret = mgag200_bo_reserve(bo, false); | ||
1287 | if (ret) | ||
1288 | return; | ||
1289 | mgag200_bo_push_sysram(bo); | ||
1290 | mgag200_bo_unreserve(bo); | ||
1291 | } | ||
1292 | crtc->fb = NULL; | ||
1293 | } | ||
1294 | |||
1254 | /* These provide the minimum set of functions required to handle a CRTC */ | 1295 | /* These provide the minimum set of functions required to handle a CRTC */ |
1255 | static const struct drm_crtc_funcs mga_crtc_funcs = { | 1296 | static const struct drm_crtc_funcs mga_crtc_funcs = { |
1256 | .cursor_set = mga_crtc_cursor_set, | 1297 | .cursor_set = mga_crtc_cursor_set, |
@@ -1261,6 +1302,7 @@ static const struct drm_crtc_funcs mga_crtc_funcs = { | |||
1261 | }; | 1302 | }; |
1262 | 1303 | ||
1263 | static const struct drm_crtc_helper_funcs mga_helper_funcs = { | 1304 | static const struct drm_crtc_helper_funcs mga_helper_funcs = { |
1305 | .disable = mga_crtc_disable, | ||
1264 | .dpms = mga_crtc_dpms, | 1306 | .dpms = mga_crtc_dpms, |
1265 | .mode_fixup = mga_crtc_mode_fixup, | 1307 | .mode_fixup = mga_crtc_mode_fixup, |
1266 | .mode_set = mga_crtc_mode_set, | 1308 | .mode_set = mga_crtc_mode_set, |
@@ -1581,6 +1623,8 @@ static struct drm_connector *mga_vga_init(struct drm_device *dev) | |||
1581 | 1623 | ||
1582 | drm_connector_helper_add(connector, &mga_vga_connector_helper_funcs); | 1624 | drm_connector_helper_add(connector, &mga_vga_connector_helper_funcs); |
1583 | 1625 | ||
1626 | drm_sysfs_connector_add(connector); | ||
1627 | |||
1584 | mga_connector->i2c = mgag200_i2c_create(dev); | 1628 | mga_connector->i2c = mgag200_i2c_create(dev); |
1585 | if (!mga_connector->i2c) | 1629 | if (!mga_connector->i2c) |
1586 | DRM_ERROR("failed to add ddc bus\n"); | 1630 | DRM_ERROR("failed to add ddc bus\n"); |
diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c index 3acb2b044c7b..d70e4a92773b 100644 --- a/drivers/gpu/drm/mgag200/mgag200_ttm.c +++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c | |||
@@ -323,6 +323,7 @@ int mgag200_bo_create(struct drm_device *dev, int size, int align, | |||
323 | 323 | ||
324 | mgabo->gem.driver_private = NULL; | 324 | mgabo->gem.driver_private = NULL; |
325 | mgabo->bo.bdev = &mdev->ttm.bdev; | 325 | mgabo->bo.bdev = &mdev->ttm.bdev; |
326 | mgabo->bo.bdev->dev_mapping = dev->dev_mapping; | ||
326 | 327 | ||
327 | mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); | 328 | mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); |
328 | 329 | ||
@@ -353,6 +354,7 @@ int mgag200_bo_pin(struct mgag200_bo *bo, u32 pl_flag, u64 *gpu_addr) | |||
353 | bo->pin_count++; | 354 | bo->pin_count++; |
354 | if (gpu_addr) | 355 | if (gpu_addr) |
355 | *gpu_addr = mgag200_bo_gpu_offset(bo); | 356 | *gpu_addr = mgag200_bo_gpu_offset(bo); |
357 | return 0; | ||
356 | } | 358 | } |
357 | 359 | ||
358 | mgag200_ttm_placement(bo, pl_flag); | 360 | mgag200_ttm_placement(bo, pl_flag); |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c index 373dbcc523b2..a19e7d79b847 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c | |||
@@ -36,6 +36,8 @@ nva3_hda_eld(struct nv50_disp_priv *priv, int or, u8 *data, u32 size) | |||
36 | if (data && data[0]) { | 36 | if (data && data[0]) { |
37 | for (i = 0; i < size; i++) | 37 | for (i = 0; i < size; i++) |
38 | nv_wr32(priv, 0x61c440 + soff, (i << 8) | data[i]); | 38 | nv_wr32(priv, 0x61c440 + soff, (i << 8) | data[i]); |
39 | for (; i < 0x60; i++) | ||
40 | nv_wr32(priv, 0x61c440 + soff, (i << 8)); | ||
39 | nv_mask(priv, 0x61c448 + soff, 0x80000003, 0x80000003); | 41 | nv_mask(priv, 0x61c448 + soff, 0x80000003, 0x80000003); |
40 | } else | 42 | } else |
41 | if (data) { | 43 | if (data) { |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c index dc57e24fc1df..717639386ced 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c | |||
@@ -41,6 +41,8 @@ nvd0_hda_eld(struct nv50_disp_priv *priv, int or, u8 *data, u32 size) | |||
41 | if (data && data[0]) { | 41 | if (data && data[0]) { |
42 | for (i = 0; i < size; i++) | 42 | for (i = 0; i < size; i++) |
43 | nv_wr32(priv, 0x10ec00 + soff, (i << 8) | data[i]); | 43 | nv_wr32(priv, 0x10ec00 + soff, (i << 8) | data[i]); |
44 | for (; i < 0x60; i++) | ||
45 | nv_wr32(priv, 0x10ec00 + soff, (i << 8)); | ||
44 | nv_mask(priv, 0x10ec10 + soff, 0x80000003, 0x80000003); | 46 | nv_mask(priv, 0x10ec10 + soff, 0x80000003, 0x80000003); |
45 | } else | 47 | } else |
46 | if (data) { | 48 | if (data) { |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c index ab1e918469a8..526b75242899 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c | |||
@@ -47,14 +47,8 @@ int | |||
47 | nv50_sor_mthd(struct nouveau_object *object, u32 mthd, void *args, u32 size) | 47 | nv50_sor_mthd(struct nouveau_object *object, u32 mthd, void *args, u32 size) |
48 | { | 48 | { |
49 | struct nv50_disp_priv *priv = (void *)object->engine; | 49 | struct nv50_disp_priv *priv = (void *)object->engine; |
50 | struct nouveau_bios *bios = nouveau_bios(priv); | ||
51 | const u16 type = (mthd & NV50_DISP_SOR_MTHD_TYPE) >> 12; | ||
52 | const u8 head = (mthd & NV50_DISP_SOR_MTHD_HEAD) >> 3; | 50 | const u8 head = (mthd & NV50_DISP_SOR_MTHD_HEAD) >> 3; |
53 | const u8 link = (mthd & NV50_DISP_SOR_MTHD_LINK) >> 2; | ||
54 | const u8 or = (mthd & NV50_DISP_SOR_MTHD_OR); | 51 | const u8 or = (mthd & NV50_DISP_SOR_MTHD_OR); |
55 | const u16 mask = (0x0100 << head) | (0x0040 << link) | (0x0001 << or); | ||
56 | struct dcb_output outp; | ||
57 | u8 ver, hdr; | ||
58 | u32 data; | 52 | u32 data; |
59 | int ret = -EINVAL; | 53 | int ret = -EINVAL; |
60 | 54 | ||
@@ -62,8 +56,6 @@ nv50_sor_mthd(struct nouveau_object *object, u32 mthd, void *args, u32 size) | |||
62 | return -EINVAL; | 56 | return -EINVAL; |
63 | data = *(u32 *)args; | 57 | data = *(u32 *)args; |
64 | 58 | ||
65 | if (type && !dcb_outp_match(bios, type, mask, &ver, &hdr, &outp)) | ||
66 | return -ENODEV; | ||
67 | 59 | ||
68 | switch (mthd & ~0x3f) { | 60 | switch (mthd & ~0x3f) { |
69 | case NV50_DISP_SOR_PWR: | 61 | case NV50_DISP_SOR_PWR: |
diff --git a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c index 49ecbb859b25..c19004301309 100644 --- a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c +++ b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c | |||
@@ -265,8 +265,8 @@ nv31_mpeg_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
265 | int | 265 | int |
266 | nv31_mpeg_init(struct nouveau_object *object) | 266 | nv31_mpeg_init(struct nouveau_object *object) |
267 | { | 267 | { |
268 | struct nouveau_engine *engine = nv_engine(object->engine); | 268 | struct nouveau_engine *engine = nv_engine(object); |
269 | struct nv31_mpeg_priv *priv = (void *)engine; | 269 | struct nv31_mpeg_priv *priv = (void *)object; |
270 | struct nouveau_fb *pfb = nouveau_fb(object); | 270 | struct nouveau_fb *pfb = nouveau_fb(object); |
271 | int ret, i; | 271 | int ret, i; |
272 | 272 | ||
@@ -284,7 +284,10 @@ nv31_mpeg_init(struct nouveau_object *object) | |||
284 | /* PMPEG init */ | 284 | /* PMPEG init */ |
285 | nv_wr32(priv, 0x00b32c, 0x00000000); | 285 | nv_wr32(priv, 0x00b32c, 0x00000000); |
286 | nv_wr32(priv, 0x00b314, 0x00000100); | 286 | nv_wr32(priv, 0x00b314, 0x00000100); |
287 | nv_wr32(priv, 0x00b220, nv44_graph_class(priv) ? 0x00000044 : 0x00000031); | 287 | if (nv_device(priv)->chipset >= 0x40 && nv44_graph_class(priv)) |
288 | nv_wr32(priv, 0x00b220, 0x00000044); | ||
289 | else | ||
290 | nv_wr32(priv, 0x00b220, 0x00000031); | ||
288 | nv_wr32(priv, 0x00b300, 0x02001ec1); | 291 | nv_wr32(priv, 0x00b300, 0x02001ec1); |
289 | nv_mask(priv, 0x00b32c, 0x00000001, 0x00000001); | 292 | nv_mask(priv, 0x00b32c, 0x00000001, 0x00000001); |
290 | 293 | ||
diff --git a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c index f7c581ad1991..dd6196072e9c 100644 --- a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c +++ b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c | |||
@@ -61,6 +61,7 @@ nv40_mpeg_context_ctor(struct nouveau_object *parent, | |||
61 | if (ret) | 61 | if (ret) |
62 | return ret; | 62 | return ret; |
63 | 63 | ||
64 | nv_wo32(&chan->base.base, 0x78, 0x02001ec1); | ||
64 | return 0; | 65 | return 0; |
65 | } | 66 | } |
66 | 67 | ||
diff --git a/drivers/gpu/drm/nouveau/core/engine/xtensa.c b/drivers/gpu/drm/nouveau/core/engine/xtensa.c index 0639bc59d0a5..5f6ede7c4892 100644 --- a/drivers/gpu/drm/nouveau/core/engine/xtensa.c +++ b/drivers/gpu/drm/nouveau/core/engine/xtensa.c | |||
@@ -118,7 +118,13 @@ _nouveau_xtensa_init(struct nouveau_object *object) | |||
118 | return ret; | 118 | return ret; |
119 | } | 119 | } |
120 | 120 | ||
121 | ret = nouveau_gpuobj_new(object, NULL, fw->size, 0x1000, 0, | 121 | if (fw->size > 0x40000) { |
122 | nv_warn(xtensa, "firmware %s too large\n", name); | ||
123 | release_firmware(fw); | ||
124 | return -EINVAL; | ||
125 | } | ||
126 | |||
127 | ret = nouveau_gpuobj_new(object, NULL, 0x40000, 0x1000, 0, | ||
122 | &xtensa->gpu_fw); | 128 | &xtensa->gpu_fw); |
123 | if (ret) { | 129 | if (ret) { |
124 | release_firmware(fw); | 130 | release_firmware(fw); |
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/vm.h b/drivers/gpu/drm/nouveau/core/include/subdev/vm.h index f2e87b105666..fcf57fa309bf 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/vm.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/vm.h | |||
@@ -55,7 +55,7 @@ struct nouveau_vma { | |||
55 | struct nouveau_vm { | 55 | struct nouveau_vm { |
56 | struct nouveau_vmmgr *vmm; | 56 | struct nouveau_vmmgr *vmm; |
57 | struct nouveau_mm mm; | 57 | struct nouveau_mm mm; |
58 | int refcount; | 58 | struct kref refcount; |
59 | 59 | ||
60 | struct list_head pgd_list; | 60 | struct list_head pgd_list; |
61 | atomic_t engref[NVDEV_SUBDEV_NR]; | 61 | atomic_t engref[NVDEV_SUBDEV_NR]; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h b/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h index 6c974dd83e8b..db9d6ddde52c 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h | |||
@@ -81,7 +81,7 @@ void nv44_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *); | |||
81 | void nv46_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size, | 81 | void nv46_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size, |
82 | u32 pitch, u32 flags, struct nouveau_fb_tile *); | 82 | u32 pitch, u32 flags, struct nouveau_fb_tile *); |
83 | 83 | ||
84 | void nv50_ram_put(struct nouveau_fb *, struct nouveau_mem **); | 84 | void __nv50_ram_put(struct nouveau_fb *, struct nouveau_mem *); |
85 | extern int nv50_fb_memtype[0x80]; | 85 | extern int nv50_fb_memtype[0x80]; |
86 | 86 | ||
87 | #endif | 87 | #endif |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c index af5aa7ee8ad9..903baff77fdd 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c | |||
@@ -27,17 +27,10 @@ | |||
27 | #include "priv.h" | 27 | #include "priv.h" |
28 | 28 | ||
29 | void | 29 | void |
30 | nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem) | 30 | __nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem *mem) |
31 | { | 31 | { |
32 | struct nouveau_mm_node *this; | 32 | struct nouveau_mm_node *this; |
33 | struct nouveau_mem *mem; | ||
34 | 33 | ||
35 | mem = *pmem; | ||
36 | *pmem = NULL; | ||
37 | if (unlikely(mem == NULL)) | ||
38 | return; | ||
39 | |||
40 | mutex_lock(&pfb->base.mutex); | ||
41 | while (!list_empty(&mem->regions)) { | 34 | while (!list_empty(&mem->regions)) { |
42 | this = list_first_entry(&mem->regions, typeof(*this), rl_entry); | 35 | this = list_first_entry(&mem->regions, typeof(*this), rl_entry); |
43 | 36 | ||
@@ -46,6 +39,19 @@ nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem) | |||
46 | } | 39 | } |
47 | 40 | ||
48 | nouveau_mm_free(&pfb->tags, &mem->tag); | 41 | nouveau_mm_free(&pfb->tags, &mem->tag); |
42 | } | ||
43 | |||
44 | void | ||
45 | nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem) | ||
46 | { | ||
47 | struct nouveau_mem *mem = *pmem; | ||
48 | |||
49 | *pmem = NULL; | ||
50 | if (unlikely(mem == NULL)) | ||
51 | return; | ||
52 | |||
53 | mutex_lock(&pfb->base.mutex); | ||
54 | __nv50_ram_put(pfb, mem); | ||
49 | mutex_unlock(&pfb->base.mutex); | 55 | mutex_unlock(&pfb->base.mutex); |
50 | 56 | ||
51 | kfree(mem); | 57 | kfree(mem); |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c index 9c3634acbb9d..cf97c4de4a6b 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c | |||
@@ -33,11 +33,19 @@ void | |||
33 | nvc0_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem) | 33 | nvc0_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem) |
34 | { | 34 | { |
35 | struct nouveau_ltcg *ltcg = nouveau_ltcg(pfb); | 35 | struct nouveau_ltcg *ltcg = nouveau_ltcg(pfb); |
36 | struct nouveau_mem *mem = *pmem; | ||
36 | 37 | ||
37 | if ((*pmem)->tag) | 38 | *pmem = NULL; |
38 | ltcg->tags_free(ltcg, &(*pmem)->tag); | 39 | if (unlikely(mem == NULL)) |
40 | return; | ||
39 | 41 | ||
40 | nv50_ram_put(pfb, pmem); | 42 | mutex_lock(&pfb->base.mutex); |
43 | if (mem->tag) | ||
44 | ltcg->tags_free(ltcg, &mem->tag); | ||
45 | __nv50_ram_put(pfb, mem); | ||
46 | mutex_unlock(&pfb->base.mutex); | ||
47 | |||
48 | kfree(mem); | ||
41 | } | 49 | } |
42 | 50 | ||
43 | int | 51 | int |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c index bf489dcf46e2..c4c1d415e7fe 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c | |||
@@ -103,7 +103,7 @@ nv50_gpio_intr(struct nouveau_subdev *subdev) | |||
103 | int i; | 103 | int i; |
104 | 104 | ||
105 | intr0 = nv_rd32(priv, 0xe054) & nv_rd32(priv, 0xe050); | 105 | intr0 = nv_rd32(priv, 0xe054) & nv_rd32(priv, 0xe050); |
106 | if (nv_device(priv)->chipset >= 0x90) | 106 | if (nv_device(priv)->chipset > 0x92) |
107 | intr1 = nv_rd32(priv, 0xe074) & nv_rd32(priv, 0xe070); | 107 | intr1 = nv_rd32(priv, 0xe074) & nv_rd32(priv, 0xe070); |
108 | 108 | ||
109 | hi = (intr0 & 0x0000ffff) | (intr1 << 16); | 109 | hi = (intr0 & 0x0000ffff) | (intr1 << 16); |
@@ -115,7 +115,7 @@ nv50_gpio_intr(struct nouveau_subdev *subdev) | |||
115 | } | 115 | } |
116 | 116 | ||
117 | nv_wr32(priv, 0xe054, intr0); | 117 | nv_wr32(priv, 0xe054, intr0); |
118 | if (nv_device(priv)->chipset >= 0x90) | 118 | if (nv_device(priv)->chipset > 0x92) |
119 | nv_wr32(priv, 0xe074, intr1); | 119 | nv_wr32(priv, 0xe074, intr1); |
120 | } | 120 | } |
121 | 121 | ||
@@ -146,7 +146,7 @@ nv50_gpio_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
146 | int ret; | 146 | int ret; |
147 | 147 | ||
148 | ret = nouveau_gpio_create(parent, engine, oclass, | 148 | ret = nouveau_gpio_create(parent, engine, oclass, |
149 | nv_device(parent)->chipset >= 0x90 ? 32 : 16, | 149 | nv_device(parent)->chipset > 0x92 ? 32 : 16, |
150 | &priv); | 150 | &priv); |
151 | *pobject = nv_object(priv); | 151 | *pobject = nv_object(priv); |
152 | if (ret) | 152 | if (ret) |
@@ -182,7 +182,7 @@ nv50_gpio_init(struct nouveau_object *object) | |||
182 | /* disable, and ack any pending gpio interrupts */ | 182 | /* disable, and ack any pending gpio interrupts */ |
183 | nv_wr32(priv, 0xe050, 0x00000000); | 183 | nv_wr32(priv, 0xe050, 0x00000000); |
184 | nv_wr32(priv, 0xe054, 0xffffffff); | 184 | nv_wr32(priv, 0xe054, 0xffffffff); |
185 | if (nv_device(priv)->chipset >= 0x90) { | 185 | if (nv_device(priv)->chipset > 0x92) { |
186 | nv_wr32(priv, 0xe070, 0x00000000); | 186 | nv_wr32(priv, 0xe070, 0x00000000); |
187 | nv_wr32(priv, 0xe074, 0xffffffff); | 187 | nv_wr32(priv, 0xe074, 0xffffffff); |
188 | } | 188 | } |
@@ -195,7 +195,7 @@ nv50_gpio_fini(struct nouveau_object *object, bool suspend) | |||
195 | { | 195 | { |
196 | struct nv50_gpio_priv *priv = (void *)object; | 196 | struct nv50_gpio_priv *priv = (void *)object; |
197 | nv_wr32(priv, 0xe050, 0x00000000); | 197 | nv_wr32(priv, 0xe050, 0x00000000); |
198 | if (nv_device(priv)->chipset >= 0x90) | 198 | if (nv_device(priv)->chipset > 0x92) |
199 | nv_wr32(priv, 0xe070, 0x00000000); | 199 | nv_wr32(priv, 0xe070, 0x00000000); |
200 | return nouveau_gpio_fini(&priv->base, suspend); | 200 | return nouveau_gpio_fini(&priv->base, suspend); |
201 | } | 201 | } |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c index 0cb322a5e72c..f25fc5fc7dd1 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c | |||
@@ -41,7 +41,7 @@ nv50_mc_intr[] = { | |||
41 | { 0x04000000, NVDEV_ENGINE_DISP }, | 41 | { 0x04000000, NVDEV_ENGINE_DISP }, |
42 | { 0x10000000, NVDEV_SUBDEV_BUS }, | 42 | { 0x10000000, NVDEV_SUBDEV_BUS }, |
43 | { 0x80000000, NVDEV_ENGINE_SW }, | 43 | { 0x80000000, NVDEV_ENGINE_SW }, |
44 | { 0x0000d101, NVDEV_SUBDEV_FB }, | 44 | { 0x0002d101, NVDEV_SUBDEV_FB }, |
45 | {}, | 45 | {}, |
46 | }; | 46 | }; |
47 | 47 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c index 67fcb6c852ac..ef3133e7575c 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c | |||
@@ -361,7 +361,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length, | |||
361 | 361 | ||
362 | INIT_LIST_HEAD(&vm->pgd_list); | 362 | INIT_LIST_HEAD(&vm->pgd_list); |
363 | vm->vmm = vmm; | 363 | vm->vmm = vmm; |
364 | vm->refcount = 1; | 364 | kref_init(&vm->refcount); |
365 | vm->fpde = offset >> (vmm->pgt_bits + 12); | 365 | vm->fpde = offset >> (vmm->pgt_bits + 12); |
366 | vm->lpde = (offset + length - 1) >> (vmm->pgt_bits + 12); | 366 | vm->lpde = (offset + length - 1) >> (vmm->pgt_bits + 12); |
367 | 367 | ||
@@ -441,8 +441,9 @@ nouveau_vm_unlink(struct nouveau_vm *vm, struct nouveau_gpuobj *mpgd) | |||
441 | } | 441 | } |
442 | 442 | ||
443 | static void | 443 | static void |
444 | nouveau_vm_del(struct nouveau_vm *vm) | 444 | nouveau_vm_del(struct kref *kref) |
445 | { | 445 | { |
446 | struct nouveau_vm *vm = container_of(kref, typeof(*vm), refcount); | ||
446 | struct nouveau_vm_pgd *vpgd, *tmp; | 447 | struct nouveau_vm_pgd *vpgd, *tmp; |
447 | 448 | ||
448 | list_for_each_entry_safe(vpgd, tmp, &vm->pgd_list, head) { | 449 | list_for_each_entry_safe(vpgd, tmp, &vm->pgd_list, head) { |
@@ -458,27 +459,19 @@ int | |||
458 | nouveau_vm_ref(struct nouveau_vm *ref, struct nouveau_vm **ptr, | 459 | nouveau_vm_ref(struct nouveau_vm *ref, struct nouveau_vm **ptr, |
459 | struct nouveau_gpuobj *pgd) | 460 | struct nouveau_gpuobj *pgd) |
460 | { | 461 | { |
461 | struct nouveau_vm *vm; | 462 | if (ref) { |
462 | int ret; | 463 | int ret = nouveau_vm_link(ref, pgd); |
463 | |||
464 | vm = ref; | ||
465 | if (vm) { | ||
466 | ret = nouveau_vm_link(vm, pgd); | ||
467 | if (ret) | 464 | if (ret) |
468 | return ret; | 465 | return ret; |
469 | 466 | ||
470 | vm->refcount++; | 467 | kref_get(&ref->refcount); |
471 | } | 468 | } |
472 | 469 | ||
473 | vm = *ptr; | 470 | if (*ptr) { |
474 | *ptr = ref; | 471 | nouveau_vm_unlink(*ptr, pgd); |
475 | 472 | kref_put(&(*ptr)->refcount, nouveau_vm_del); | |
476 | if (vm) { | ||
477 | nouveau_vm_unlink(vm, pgd); | ||
478 | |||
479 | if (--vm->refcount == 0) | ||
480 | nouveau_vm_del(vm); | ||
481 | } | 473 | } |
482 | 474 | ||
475 | *ptr = ref; | ||
483 | return 0; | 476 | return 0; |
484 | } | 477 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 4e7ee5f4155c..af20fba3a1a4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -198,7 +198,12 @@ nouveau_bo_new(struct drm_device *dev, int size, int align, | |||
198 | size_t acc_size; | 198 | size_t acc_size; |
199 | int ret; | 199 | int ret; |
200 | int type = ttm_bo_type_device; | 200 | int type = ttm_bo_type_device; |
201 | int max_size = INT_MAX & ~((1 << drm->client.base.vm->vmm->lpg_shift) - 1); | 201 | int lpg_shift = 12; |
202 | int max_size; | ||
203 | |||
204 | if (drm->client.base.vm) | ||
205 | lpg_shift = drm->client.base.vm->vmm->lpg_shift; | ||
206 | max_size = INT_MAX & ~((1 << lpg_shift) - 1); | ||
202 | 207 | ||
203 | if (size <= 0 || size > max_size) { | 208 | if (size <= 0 || size > max_size) { |
204 | nv_warn(drm, "skipped size %x\n", (u32)size); | 209 | nv_warn(drm, "skipped size %x\n", (u32)size); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 4c1bc061fae2..8f6d63d7edd3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -398,7 +398,8 @@ void | |||
398 | nouveau_fbcon_output_poll_changed(struct drm_device *dev) | 398 | nouveau_fbcon_output_poll_changed(struct drm_device *dev) |
399 | { | 399 | { |
400 | struct nouveau_drm *drm = nouveau_drm(dev); | 400 | struct nouveau_drm *drm = nouveau_drm(dev); |
401 | drm_fb_helper_hotplug_event(&drm->fbcon->helper); | 401 | if (drm->fbcon) |
402 | drm_fb_helper_hotplug_event(&drm->fbcon->helper); | ||
402 | } | 403 | } |
403 | 404 | ||
404 | static int | 405 | static int |
diff --git a/drivers/gpu/drm/nouveau/nv17_fence.c b/drivers/gpu/drm/nouveau/nv17_fence.c index 8e47a9bae8c3..22aa9963ea6f 100644 --- a/drivers/gpu/drm/nouveau/nv17_fence.c +++ b/drivers/gpu/drm/nouveau/nv17_fence.c | |||
@@ -76,7 +76,7 @@ nv17_fence_context_new(struct nouveau_channel *chan) | |||
76 | struct ttm_mem_reg *mem = &priv->bo->bo.mem; | 76 | struct ttm_mem_reg *mem = &priv->bo->bo.mem; |
77 | struct nouveau_object *object; | 77 | struct nouveau_object *object; |
78 | u32 start = mem->start * PAGE_SIZE; | 78 | u32 start = mem->start * PAGE_SIZE; |
79 | u32 limit = mem->start + mem->size - 1; | 79 | u32 limit = start + mem->size - 1; |
80 | int ret = 0; | 80 | int ret = 0; |
81 | 81 | ||
82 | fctx = chan->fence = kzalloc(sizeof(*fctx), GFP_KERNEL); | 82 | fctx = chan->fence = kzalloc(sizeof(*fctx), GFP_KERNEL); |
diff --git a/drivers/gpu/drm/nouveau/nv50_fence.c b/drivers/gpu/drm/nouveau/nv50_fence.c index f9701e567db8..0ee363840035 100644 --- a/drivers/gpu/drm/nouveau/nv50_fence.c +++ b/drivers/gpu/drm/nouveau/nv50_fence.c | |||
@@ -39,6 +39,8 @@ nv50_fence_context_new(struct nouveau_channel *chan) | |||
39 | struct nv10_fence_chan *fctx; | 39 | struct nv10_fence_chan *fctx; |
40 | struct ttm_mem_reg *mem = &priv->bo->bo.mem; | 40 | struct ttm_mem_reg *mem = &priv->bo->bo.mem; |
41 | struct nouveau_object *object; | 41 | struct nouveau_object *object; |
42 | u32 start = mem->start * PAGE_SIZE; | ||
43 | u32 limit = start + mem->size - 1; | ||
42 | int ret, i; | 44 | int ret, i; |
43 | 45 | ||
44 | fctx = chan->fence = kzalloc(sizeof(*fctx), GFP_KERNEL); | 46 | fctx = chan->fence = kzalloc(sizeof(*fctx), GFP_KERNEL); |
@@ -51,26 +53,28 @@ nv50_fence_context_new(struct nouveau_channel *chan) | |||
51 | fctx->base.sync = nv17_fence_sync; | 53 | fctx->base.sync = nv17_fence_sync; |
52 | 54 | ||
53 | ret = nouveau_object_new(nv_object(chan->cli), chan->handle, | 55 | ret = nouveau_object_new(nv_object(chan->cli), chan->handle, |
54 | NvSema, 0x0002, | 56 | NvSema, 0x003d, |
55 | &(struct nv_dma_class) { | 57 | &(struct nv_dma_class) { |
56 | .flags = NV_DMA_TARGET_VRAM | | 58 | .flags = NV_DMA_TARGET_VRAM | |
57 | NV_DMA_ACCESS_RDWR, | 59 | NV_DMA_ACCESS_RDWR, |
58 | .start = mem->start * PAGE_SIZE, | 60 | .start = start, |
59 | .limit = mem->size - 1, | 61 | .limit = limit, |
60 | }, sizeof(struct nv_dma_class), | 62 | }, sizeof(struct nv_dma_class), |
61 | &object); | 63 | &object); |
62 | 64 | ||
63 | /* dma objects for display sync channel semaphore blocks */ | 65 | /* dma objects for display sync channel semaphore blocks */ |
64 | for (i = 0; !ret && i < dev->mode_config.num_crtc; i++) { | 66 | for (i = 0; !ret && i < dev->mode_config.num_crtc; i++) { |
65 | struct nouveau_bo *bo = nv50_display_crtc_sema(dev, i); | 67 | struct nouveau_bo *bo = nv50_display_crtc_sema(dev, i); |
68 | u32 start = bo->bo.mem.start * PAGE_SIZE; | ||
69 | u32 limit = start + bo->bo.mem.size - 1; | ||
66 | 70 | ||
67 | ret = nouveau_object_new(nv_object(chan->cli), chan->handle, | 71 | ret = nouveau_object_new(nv_object(chan->cli), chan->handle, |
68 | NvEvoSema0 + i, 0x003d, | 72 | NvEvoSema0 + i, 0x003d, |
69 | &(struct nv_dma_class) { | 73 | &(struct nv_dma_class) { |
70 | .flags = NV_DMA_TARGET_VRAM | | 74 | .flags = NV_DMA_TARGET_VRAM | |
71 | NV_DMA_ACCESS_RDWR, | 75 | NV_DMA_ACCESS_RDWR, |
72 | .start = bo->bo.offset, | 76 | .start = start, |
73 | .limit = bo->bo.offset + 0xfff, | 77 | .limit = limit, |
74 | }, sizeof(struct nv_dma_class), | 78 | }, sizeof(struct nv_dma_class), |
75 | &object); | 79 | &object); |
76 | } | 80 | } |
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index fb441a790f3d..15da7ef344a4 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
@@ -1222,12 +1222,17 @@ int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) | |||
1222 | int r; | 1222 | int r; |
1223 | 1223 | ||
1224 | mutex_lock(&ctx->mutex); | 1224 | mutex_lock(&ctx->mutex); |
1225 | /* reset data block */ | ||
1226 | ctx->data_block = 0; | ||
1225 | /* reset reg block */ | 1227 | /* reset reg block */ |
1226 | ctx->reg_block = 0; | 1228 | ctx->reg_block = 0; |
1227 | /* reset fb window */ | 1229 | /* reset fb window */ |
1228 | ctx->fb_base = 0; | 1230 | ctx->fb_base = 0; |
1229 | /* reset io mode */ | 1231 | /* reset io mode */ |
1230 | ctx->io_mode = ATOM_IO_MM; | 1232 | ctx->io_mode = ATOM_IO_MM; |
1233 | /* reset divmul */ | ||
1234 | ctx->divmul[0] = 0; | ||
1235 | ctx->divmul[1] = 0; | ||
1231 | r = atom_execute_table_locked(ctx, index, params); | 1236 | r = atom_execute_table_locked(ctx, index, params); |
1232 | mutex_unlock(&ctx->mutex); | 1237 | mutex_unlock(&ctx->mutex); |
1233 | return r; | 1238 | return r; |
diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c index 0bfd55e08820..9953e1fbc46d 100644 --- a/drivers/gpu/drm/radeon/btc_dpm.c +++ b/drivers/gpu/drm/radeon/btc_dpm.c | |||
@@ -2548,9 +2548,6 @@ int btc_dpm_init(struct radeon_device *rdev) | |||
2548 | { | 2548 | { |
2549 | struct rv7xx_power_info *pi; | 2549 | struct rv7xx_power_info *pi; |
2550 | struct evergreen_power_info *eg_pi; | 2550 | struct evergreen_power_info *eg_pi; |
2551 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
2552 | u16 data_offset, size; | ||
2553 | u8 frev, crev; | ||
2554 | struct atom_clock_dividers dividers; | 2551 | struct atom_clock_dividers dividers; |
2555 | int ret; | 2552 | int ret; |
2556 | 2553 | ||
@@ -2633,16 +2630,7 @@ int btc_dpm_init(struct radeon_device *rdev) | |||
2633 | eg_pi->vddci_control = | 2630 | eg_pi->vddci_control = |
2634 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); | 2631 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); |
2635 | 2632 | ||
2636 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 2633 | rv770_get_engine_memory_ss(rdev); |
2637 | &frev, &crev, &data_offset)) { | ||
2638 | pi->sclk_ss = true; | ||
2639 | pi->mclk_ss = true; | ||
2640 | pi->dynamic_ss = true; | ||
2641 | } else { | ||
2642 | pi->sclk_ss = false; | ||
2643 | pi->mclk_ss = false; | ||
2644 | pi->dynamic_ss = true; | ||
2645 | } | ||
2646 | 2634 | ||
2647 | pi->asi = RV770_ASI_DFLT; | 2635 | pi->asi = RV770_ASI_DFLT; |
2648 | pi->pasi = CYPRESS_HASI_DFLT; | 2636 | pi->pasi = CYPRESS_HASI_DFLT; |
@@ -2659,8 +2647,7 @@ int btc_dpm_init(struct radeon_device *rdev) | |||
2659 | 2647 | ||
2660 | pi->dynamic_pcie_gen2 = true; | 2648 | pi->dynamic_pcie_gen2 = true; |
2661 | 2649 | ||
2662 | if (pi->gfx_clock_gating && | 2650 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
2663 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
2664 | pi->thermal_protection = true; | 2651 | pi->thermal_protection = true; |
2665 | else | 2652 | else |
2666 | pi->thermal_protection = false; | 2653 | pi->thermal_protection = false; |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 6dacec4e2090..8928bd109c16 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -2587,9 +2587,11 @@ u32 cik_compute_ring_get_rptr(struct radeon_device *rdev, | |||
2587 | if (rdev->wb.enabled) { | 2587 | if (rdev->wb.enabled) { |
2588 | rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); | 2588 | rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); |
2589 | } else { | 2589 | } else { |
2590 | mutex_lock(&rdev->srbm_mutex); | ||
2590 | cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); | 2591 | cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); |
2591 | rptr = RREG32(CP_HQD_PQ_RPTR); | 2592 | rptr = RREG32(CP_HQD_PQ_RPTR); |
2592 | cik_srbm_select(rdev, 0, 0, 0, 0); | 2593 | cik_srbm_select(rdev, 0, 0, 0, 0); |
2594 | mutex_unlock(&rdev->srbm_mutex); | ||
2593 | } | 2595 | } |
2594 | rptr = (rptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; | 2596 | rptr = (rptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; |
2595 | 2597 | ||
@@ -2604,9 +2606,11 @@ u32 cik_compute_ring_get_wptr(struct radeon_device *rdev, | |||
2604 | if (rdev->wb.enabled) { | 2606 | if (rdev->wb.enabled) { |
2605 | wptr = le32_to_cpu(rdev->wb.wb[ring->wptr_offs/4]); | 2607 | wptr = le32_to_cpu(rdev->wb.wb[ring->wptr_offs/4]); |
2606 | } else { | 2608 | } else { |
2609 | mutex_lock(&rdev->srbm_mutex); | ||
2607 | cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); | 2610 | cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); |
2608 | wptr = RREG32(CP_HQD_PQ_WPTR); | 2611 | wptr = RREG32(CP_HQD_PQ_WPTR); |
2609 | cik_srbm_select(rdev, 0, 0, 0, 0); | 2612 | cik_srbm_select(rdev, 0, 0, 0, 0); |
2613 | mutex_unlock(&rdev->srbm_mutex); | ||
2610 | } | 2614 | } |
2611 | wptr = (wptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; | 2615 | wptr = (wptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; |
2612 | 2616 | ||
@@ -2897,6 +2901,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
2897 | WREG32(CP_CPF_DEBUG, tmp); | 2901 | WREG32(CP_CPF_DEBUG, tmp); |
2898 | 2902 | ||
2899 | /* init the pipes */ | 2903 | /* init the pipes */ |
2904 | mutex_lock(&rdev->srbm_mutex); | ||
2900 | for (i = 0; i < (rdev->mec.num_pipe * rdev->mec.num_mec); i++) { | 2905 | for (i = 0; i < (rdev->mec.num_pipe * rdev->mec.num_mec); i++) { |
2901 | int me = (i < 4) ? 1 : 2; | 2906 | int me = (i < 4) ? 1 : 2; |
2902 | int pipe = (i < 4) ? i : (i - 4); | 2907 | int pipe = (i < 4) ? i : (i - 4); |
@@ -2919,6 +2924,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
2919 | WREG32(CP_HPD_EOP_CONTROL, tmp); | 2924 | WREG32(CP_HPD_EOP_CONTROL, tmp); |
2920 | } | 2925 | } |
2921 | cik_srbm_select(rdev, 0, 0, 0, 0); | 2926 | cik_srbm_select(rdev, 0, 0, 0, 0); |
2927 | mutex_unlock(&rdev->srbm_mutex); | ||
2922 | 2928 | ||
2923 | /* init the queues. Just two for now. */ | 2929 | /* init the queues. Just two for now. */ |
2924 | for (i = 0; i < 2; i++) { | 2930 | for (i = 0; i < 2; i++) { |
@@ -2972,6 +2978,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
2972 | mqd->static_thread_mgmt23[0] = 0xffffffff; | 2978 | mqd->static_thread_mgmt23[0] = 0xffffffff; |
2973 | mqd->static_thread_mgmt23[1] = 0xffffffff; | 2979 | mqd->static_thread_mgmt23[1] = 0xffffffff; |
2974 | 2980 | ||
2981 | mutex_lock(&rdev->srbm_mutex); | ||
2975 | cik_srbm_select(rdev, rdev->ring[idx].me, | 2982 | cik_srbm_select(rdev, rdev->ring[idx].me, |
2976 | rdev->ring[idx].pipe, | 2983 | rdev->ring[idx].pipe, |
2977 | rdev->ring[idx].queue, 0); | 2984 | rdev->ring[idx].queue, 0); |
@@ -3099,6 +3106,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
3099 | WREG32(CP_HQD_ACTIVE, mqd->queue_state.cp_hqd_active); | 3106 | WREG32(CP_HQD_ACTIVE, mqd->queue_state.cp_hqd_active); |
3100 | 3107 | ||
3101 | cik_srbm_select(rdev, 0, 0, 0, 0); | 3108 | cik_srbm_select(rdev, 0, 0, 0, 0); |
3109 | mutex_unlock(&rdev->srbm_mutex); | ||
3102 | 3110 | ||
3103 | radeon_bo_kunmap(rdev->ring[idx].mqd_obj); | 3111 | radeon_bo_kunmap(rdev->ring[idx].mqd_obj); |
3104 | radeon_bo_unreserve(rdev->ring[idx].mqd_obj); | 3112 | radeon_bo_unreserve(rdev->ring[idx].mqd_obj); |
@@ -4320,6 +4328,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) | |||
4320 | 4328 | ||
4321 | /* XXX SH_MEM regs */ | 4329 | /* XXX SH_MEM regs */ |
4322 | /* where to put LDS, scratch, GPUVM in FSA64 space */ | 4330 | /* where to put LDS, scratch, GPUVM in FSA64 space */ |
4331 | mutex_lock(&rdev->srbm_mutex); | ||
4323 | for (i = 0; i < 16; i++) { | 4332 | for (i = 0; i < 16; i++) { |
4324 | cik_srbm_select(rdev, 0, 0, 0, i); | 4333 | cik_srbm_select(rdev, 0, 0, 0, i); |
4325 | /* CP and shaders */ | 4334 | /* CP and shaders */ |
@@ -4335,6 +4344,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) | |||
4335 | /* XXX SDMA RLC - todo */ | 4344 | /* XXX SDMA RLC - todo */ |
4336 | } | 4345 | } |
4337 | cik_srbm_select(rdev, 0, 0, 0, 0); | 4346 | cik_srbm_select(rdev, 0, 0, 0, 0); |
4347 | mutex_unlock(&rdev->srbm_mutex); | ||
4338 | 4348 | ||
4339 | cik_pcie_gart_tlb_flush(rdev); | 4349 | cik_pcie_gart_tlb_flush(rdev); |
4340 | DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", | 4350 | DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", |
@@ -5954,6 +5964,8 @@ static int cik_startup(struct radeon_device *rdev) | |||
5954 | struct radeon_ring *ring; | 5964 | struct radeon_ring *ring; |
5955 | int r; | 5965 | int r; |
5956 | 5966 | ||
5967 | cik_mc_program(rdev); | ||
5968 | |||
5957 | if (rdev->flags & RADEON_IS_IGP) { | 5969 | if (rdev->flags & RADEON_IS_IGP) { |
5958 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || | 5970 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || |
5959 | !rdev->mec_fw || !rdev->sdma_fw || !rdev->rlc_fw) { | 5971 | !rdev->mec_fw || !rdev->sdma_fw || !rdev->rlc_fw) { |
@@ -5985,7 +5997,6 @@ static int cik_startup(struct radeon_device *rdev) | |||
5985 | if (r) | 5997 | if (r) |
5986 | return r; | 5998 | return r; |
5987 | 5999 | ||
5988 | cik_mc_program(rdev); | ||
5989 | r = cik_pcie_gart_enable(rdev); | 6000 | r = cik_pcie_gart_enable(rdev); |
5990 | if (r) | 6001 | if (r) |
5991 | return r; | 6002 | return r; |
@@ -6194,7 +6205,7 @@ int cik_suspend(struct radeon_device *rdev) | |||
6194 | radeon_vm_manager_fini(rdev); | 6205 | radeon_vm_manager_fini(rdev); |
6195 | cik_cp_enable(rdev, false); | 6206 | cik_cp_enable(rdev, false); |
6196 | cik_sdma_enable(rdev, false); | 6207 | cik_sdma_enable(rdev, false); |
6197 | r600_uvd_rbc_stop(rdev); | 6208 | r600_uvd_stop(rdev); |
6198 | radeon_uvd_suspend(rdev); | 6209 | radeon_uvd_suspend(rdev); |
6199 | cik_irq_suspend(rdev); | 6210 | cik_irq_suspend(rdev); |
6200 | radeon_wb_disable(rdev); | 6211 | radeon_wb_disable(rdev); |
@@ -6358,6 +6369,7 @@ void cik_fini(struct radeon_device *rdev) | |||
6358 | radeon_vm_manager_fini(rdev); | 6369 | radeon_vm_manager_fini(rdev); |
6359 | radeon_ib_pool_fini(rdev); | 6370 | radeon_ib_pool_fini(rdev); |
6360 | radeon_irq_kms_fini(rdev); | 6371 | radeon_irq_kms_fini(rdev); |
6372 | r600_uvd_stop(rdev); | ||
6361 | radeon_uvd_fini(rdev); | 6373 | radeon_uvd_fini(rdev); |
6362 | cik_pcie_gart_fini(rdev); | 6374 | cik_pcie_gart_fini(rdev); |
6363 | r600_vram_scratch_fini(rdev); | 6375 | r600_vram_scratch_fini(rdev); |
@@ -6978,7 +6990,7 @@ int cik_uvd_resume(struct radeon_device *rdev) | |||
6978 | 6990 | ||
6979 | /* programm the VCPU memory controller bits 0-27 */ | 6991 | /* programm the VCPU memory controller bits 0-27 */ |
6980 | addr = rdev->uvd.gpu_addr >> 3; | 6992 | addr = rdev->uvd.gpu_addr >> 3; |
6981 | size = RADEON_GPU_PAGE_ALIGN(rdev->uvd.fw_size + 4) >> 3; | 6993 | size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) >> 3; |
6982 | WREG32(UVD_VCPU_CACHE_OFFSET0, addr); | 6994 | WREG32(UVD_VCPU_CACHE_OFFSET0, addr); |
6983 | WREG32(UVD_VCPU_CACHE_SIZE0, size); | 6995 | WREG32(UVD_VCPU_CACHE_SIZE0, size); |
6984 | 6996 | ||
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c index 9bcdd174780f..7e5d0b570a30 100644 --- a/drivers/gpu/drm/radeon/cypress_dpm.c +++ b/drivers/gpu/drm/radeon/cypress_dpm.c | |||
@@ -2038,9 +2038,6 @@ int cypress_dpm_init(struct radeon_device *rdev) | |||
2038 | { | 2038 | { |
2039 | struct rv7xx_power_info *pi; | 2039 | struct rv7xx_power_info *pi; |
2040 | struct evergreen_power_info *eg_pi; | 2040 | struct evergreen_power_info *eg_pi; |
2041 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
2042 | uint16_t data_offset, size; | ||
2043 | uint8_t frev, crev; | ||
2044 | struct atom_clock_dividers dividers; | 2041 | struct atom_clock_dividers dividers; |
2045 | int ret; | 2042 | int ret; |
2046 | 2043 | ||
@@ -2092,16 +2089,7 @@ int cypress_dpm_init(struct radeon_device *rdev) | |||
2092 | eg_pi->vddci_control = | 2089 | eg_pi->vddci_control = |
2093 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); | 2090 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); |
2094 | 2091 | ||
2095 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 2092 | rv770_get_engine_memory_ss(rdev); |
2096 | &frev, &crev, &data_offset)) { | ||
2097 | pi->sclk_ss = true; | ||
2098 | pi->mclk_ss = true; | ||
2099 | pi->dynamic_ss = true; | ||
2100 | } else { | ||
2101 | pi->sclk_ss = false; | ||
2102 | pi->mclk_ss = false; | ||
2103 | pi->dynamic_ss = true; | ||
2104 | } | ||
2105 | 2093 | ||
2106 | pi->asi = RV770_ASI_DFLT; | 2094 | pi->asi = RV770_ASI_DFLT; |
2107 | pi->pasi = CYPRESS_HASI_DFLT; | 2095 | pi->pasi = CYPRESS_HASI_DFLT; |
@@ -2122,8 +2110,7 @@ int cypress_dpm_init(struct radeon_device *rdev) | |||
2122 | 2110 | ||
2123 | pi->dynamic_pcie_gen2 = true; | 2111 | pi->dynamic_pcie_gen2 = true; |
2124 | 2112 | ||
2125 | if (pi->gfx_clock_gating && | 2113 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
2126 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
2127 | pi->thermal_protection = true; | 2114 | pi->thermal_protection = true; |
2128 | else | 2115 | else |
2129 | pi->thermal_protection = false; | 2116 | pi->thermal_protection = false; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 038dcac7670c..d5b49e33315e 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -5106,6 +5106,8 @@ static int evergreen_startup(struct radeon_device *rdev) | |||
5106 | /* enable aspm */ | 5106 | /* enable aspm */ |
5107 | evergreen_program_aspm(rdev); | 5107 | evergreen_program_aspm(rdev); |
5108 | 5108 | ||
5109 | evergreen_mc_program(rdev); | ||
5110 | |||
5109 | if (ASIC_IS_DCE5(rdev)) { | 5111 | if (ASIC_IS_DCE5(rdev)) { |
5110 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) { | 5112 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) { |
5111 | r = ni_init_microcode(rdev); | 5113 | r = ni_init_microcode(rdev); |
@@ -5133,7 +5135,6 @@ static int evergreen_startup(struct radeon_device *rdev) | |||
5133 | if (r) | 5135 | if (r) |
5134 | return r; | 5136 | return r; |
5135 | 5137 | ||
5136 | evergreen_mc_program(rdev); | ||
5137 | if (rdev->flags & RADEON_IS_AGP) { | 5138 | if (rdev->flags & RADEON_IS_AGP) { |
5138 | evergreen_agp_enable(rdev); | 5139 | evergreen_agp_enable(rdev); |
5139 | } else { | 5140 | } else { |
@@ -5291,10 +5292,10 @@ int evergreen_resume(struct radeon_device *rdev) | |||
5291 | int evergreen_suspend(struct radeon_device *rdev) | 5292 | int evergreen_suspend(struct radeon_device *rdev) |
5292 | { | 5293 | { |
5293 | r600_audio_fini(rdev); | 5294 | r600_audio_fini(rdev); |
5295 | r600_uvd_stop(rdev); | ||
5294 | radeon_uvd_suspend(rdev); | 5296 | radeon_uvd_suspend(rdev); |
5295 | r700_cp_stop(rdev); | 5297 | r700_cp_stop(rdev); |
5296 | r600_dma_stop(rdev); | 5298 | r600_dma_stop(rdev); |
5297 | r600_uvd_rbc_stop(rdev); | ||
5298 | evergreen_irq_suspend(rdev); | 5299 | evergreen_irq_suspend(rdev); |
5299 | radeon_wb_disable(rdev); | 5300 | radeon_wb_disable(rdev); |
5300 | evergreen_pcie_gart_disable(rdev); | 5301 | evergreen_pcie_gart_disable(rdev); |
@@ -5429,6 +5430,7 @@ void evergreen_fini(struct radeon_device *rdev) | |||
5429 | radeon_ib_pool_fini(rdev); | 5430 | radeon_ib_pool_fini(rdev); |
5430 | radeon_irq_kms_fini(rdev); | 5431 | radeon_irq_kms_fini(rdev); |
5431 | evergreen_pcie_gart_fini(rdev); | 5432 | evergreen_pcie_gart_fini(rdev); |
5433 | r600_uvd_stop(rdev); | ||
5432 | radeon_uvd_fini(rdev); | 5434 | radeon_uvd_fini(rdev); |
5433 | r600_vram_scratch_fini(rdev); | 5435 | r600_vram_scratch_fini(rdev); |
5434 | radeon_gem_fini(rdev); | 5436 | radeon_gem_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index b0d3fb341417..b0e280058b9b 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | |||
@@ -148,18 +148,40 @@ static void evergreen_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
148 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 148 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
149 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); | 149 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); |
150 | u32 base_rate = 24000; | 150 | u32 base_rate = 24000; |
151 | u32 max_ratio = clock / base_rate; | ||
152 | u32 dto_phase; | ||
153 | u32 dto_modulo = clock; | ||
154 | u32 wallclock_ratio; | ||
155 | u32 dto_cntl; | ||
151 | 156 | ||
152 | if (!dig || !dig->afmt) | 157 | if (!dig || !dig->afmt) |
153 | return; | 158 | return; |
154 | 159 | ||
160 | if (max_ratio >= 8) { | ||
161 | dto_phase = 192 * 1000; | ||
162 | wallclock_ratio = 3; | ||
163 | } else if (max_ratio >= 4) { | ||
164 | dto_phase = 96 * 1000; | ||
165 | wallclock_ratio = 2; | ||
166 | } else if (max_ratio >= 2) { | ||
167 | dto_phase = 48 * 1000; | ||
168 | wallclock_ratio = 1; | ||
169 | } else { | ||
170 | dto_phase = 24 * 1000; | ||
171 | wallclock_ratio = 0; | ||
172 | } | ||
173 | dto_cntl = RREG32(DCCG_AUDIO_DTO0_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; | ||
174 | dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); | ||
175 | WREG32(DCCG_AUDIO_DTO0_CNTL, dto_cntl); | ||
176 | |||
155 | /* XXX two dtos; generally use dto0 for hdmi */ | 177 | /* XXX two dtos; generally use dto0 for hdmi */ |
156 | /* Express [24MHz / target pixel clock] as an exact rational | 178 | /* Express [24MHz / target pixel clock] as an exact rational |
157 | * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE | 179 | * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE |
158 | * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator | 180 | * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator |
159 | */ | 181 | */ |
160 | WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); | ||
161 | WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); | ||
162 | WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id)); | 182 | WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id)); |
183 | WREG32(DCCG_AUDIO_DTO0_PHASE, dto_phase); | ||
184 | WREG32(DCCG_AUDIO_DTO0_MODULE, dto_modulo); | ||
163 | } | 185 | } |
164 | 186 | ||
165 | 187 | ||
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index a7baf67aef6c..0d582ac1dc31 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
@@ -497,6 +497,9 @@ | |||
497 | #define DCCG_AUDIO_DTO0_MODULE 0x05b4 | 497 | #define DCCG_AUDIO_DTO0_MODULE 0x05b4 |
498 | #define DCCG_AUDIO_DTO0_LOAD 0x05b8 | 498 | #define DCCG_AUDIO_DTO0_LOAD 0x05b8 |
499 | #define DCCG_AUDIO_DTO0_CNTL 0x05bc | 499 | #define DCCG_AUDIO_DTO0_CNTL 0x05bc |
500 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO(x) (((x) & 7) << 0) | ||
501 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK 7 | ||
502 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_SHIFT 0 | ||
500 | 503 | ||
501 | #define DCCG_AUDIO_DTO1_PHASE 0x05c0 | 504 | #define DCCG_AUDIO_DTO1_PHASE 0x05c0 |
502 | #define DCCG_AUDIO_DTO1_MODULE 0x05c4 | 505 | #define DCCG_AUDIO_DTO1_MODULE 0x05c4 |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 56bd4f3be4fe..ccb4f8b54852 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -794,9 +794,13 @@ int ni_init_microcode(struct radeon_device *rdev) | |||
794 | if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) { | 794 | if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) { |
795 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); | 795 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); |
796 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); | 796 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); |
797 | if (err) | 797 | if (err) { |
798 | goto out; | 798 | printk(KERN_ERR |
799 | if (rdev->smc_fw->size != smc_req_size) { | 799 | "smc: error loading firmware \"%s\"\n", |
800 | fw_name); | ||
801 | release_firmware(rdev->smc_fw); | ||
802 | rdev->smc_fw = NULL; | ||
803 | } else if (rdev->smc_fw->size != smc_req_size) { | ||
800 | printk(KERN_ERR | 804 | printk(KERN_ERR |
801 | "ni_mc: Bogus length %zu in firmware \"%s\"\n", | 805 | "ni_mc: Bogus length %zu in firmware \"%s\"\n", |
802 | rdev->mc_fw->size, fw_name); | 806 | rdev->mc_fw->size, fw_name); |
@@ -2079,6 +2083,8 @@ static int cayman_startup(struct radeon_device *rdev) | |||
2079 | /* enable aspm */ | 2083 | /* enable aspm */ |
2080 | evergreen_program_aspm(rdev); | 2084 | evergreen_program_aspm(rdev); |
2081 | 2085 | ||
2086 | evergreen_mc_program(rdev); | ||
2087 | |||
2082 | if (rdev->flags & RADEON_IS_IGP) { | 2088 | if (rdev->flags & RADEON_IS_IGP) { |
2083 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { | 2089 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { |
2084 | r = ni_init_microcode(rdev); | 2090 | r = ni_init_microcode(rdev); |
@@ -2107,7 +2113,6 @@ static int cayman_startup(struct radeon_device *rdev) | |||
2107 | if (r) | 2113 | if (r) |
2108 | return r; | 2114 | return r; |
2109 | 2115 | ||
2110 | evergreen_mc_program(rdev); | ||
2111 | r = cayman_pcie_gart_enable(rdev); | 2116 | r = cayman_pcie_gart_enable(rdev); |
2112 | if (r) | 2117 | if (r) |
2113 | return r; | 2118 | return r; |
@@ -2286,7 +2291,7 @@ int cayman_suspend(struct radeon_device *rdev) | |||
2286 | radeon_vm_manager_fini(rdev); | 2291 | radeon_vm_manager_fini(rdev); |
2287 | cayman_cp_enable(rdev, false); | 2292 | cayman_cp_enable(rdev, false); |
2288 | cayman_dma_stop(rdev); | 2293 | cayman_dma_stop(rdev); |
2289 | r600_uvd_rbc_stop(rdev); | 2294 | r600_uvd_stop(rdev); |
2290 | radeon_uvd_suspend(rdev); | 2295 | radeon_uvd_suspend(rdev); |
2291 | evergreen_irq_suspend(rdev); | 2296 | evergreen_irq_suspend(rdev); |
2292 | radeon_wb_disable(rdev); | 2297 | radeon_wb_disable(rdev); |
@@ -2418,6 +2423,7 @@ void cayman_fini(struct radeon_device *rdev) | |||
2418 | radeon_vm_manager_fini(rdev); | 2423 | radeon_vm_manager_fini(rdev); |
2419 | radeon_ib_pool_fini(rdev); | 2424 | radeon_ib_pool_fini(rdev); |
2420 | radeon_irq_kms_fini(rdev); | 2425 | radeon_irq_kms_fini(rdev); |
2426 | r600_uvd_stop(rdev); | ||
2421 | radeon_uvd_fini(rdev); | 2427 | radeon_uvd_fini(rdev); |
2422 | cayman_pcie_gart_fini(rdev); | 2428 | cayman_pcie_gart_fini(rdev); |
2423 | r600_vram_scratch_fini(rdev); | 2429 | r600_vram_scratch_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index 559cf24d51af..f0f5f748938a 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c | |||
@@ -1054,10 +1054,6 @@ static int ni_restrict_performance_levels_before_switch(struct radeon_device *rd | |||
1054 | int ni_dpm_force_performance_level(struct radeon_device *rdev, | 1054 | int ni_dpm_force_performance_level(struct radeon_device *rdev, |
1055 | enum radeon_dpm_forced_level level) | 1055 | enum radeon_dpm_forced_level level) |
1056 | { | 1056 | { |
1057 | struct radeon_ps *rps = rdev->pm.dpm.current_ps; | ||
1058 | struct ni_ps *ps = ni_get_ps(rps); | ||
1059 | u32 levels; | ||
1060 | |||
1061 | if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { | 1057 | if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { |
1062 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK) | 1058 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK) |
1063 | return -EINVAL; | 1059 | return -EINVAL; |
@@ -1068,8 +1064,7 @@ int ni_dpm_force_performance_level(struct radeon_device *rdev, | |||
1068 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) | 1064 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) |
1069 | return -EINVAL; | 1065 | return -EINVAL; |
1070 | 1066 | ||
1071 | levels = ps->performance_level_count - 1; | 1067 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 1) != PPSMC_Result_OK) |
1072 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) | ||
1073 | return -EINVAL; | 1068 | return -EINVAL; |
1074 | } else if (level == RADEON_DPM_FORCED_LEVEL_AUTO) { | 1069 | } else if (level == RADEON_DPM_FORCED_LEVEL_AUTO) { |
1075 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) | 1070 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) |
@@ -4072,9 +4067,6 @@ int ni_dpm_init(struct radeon_device *rdev) | |||
4072 | struct rv7xx_power_info *pi; | 4067 | struct rv7xx_power_info *pi; |
4073 | struct evergreen_power_info *eg_pi; | 4068 | struct evergreen_power_info *eg_pi; |
4074 | struct ni_power_info *ni_pi; | 4069 | struct ni_power_info *ni_pi; |
4075 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
4076 | u16 data_offset, size; | ||
4077 | u8 frev, crev; | ||
4078 | struct atom_clock_dividers dividers; | 4070 | struct atom_clock_dividers dividers; |
4079 | int ret; | 4071 | int ret; |
4080 | 4072 | ||
@@ -4167,16 +4159,7 @@ int ni_dpm_init(struct radeon_device *rdev) | |||
4167 | eg_pi->vddci_control = | 4159 | eg_pi->vddci_control = |
4168 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); | 4160 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); |
4169 | 4161 | ||
4170 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 4162 | rv770_get_engine_memory_ss(rdev); |
4171 | &frev, &crev, &data_offset)) { | ||
4172 | pi->sclk_ss = true; | ||
4173 | pi->mclk_ss = true; | ||
4174 | pi->dynamic_ss = true; | ||
4175 | } else { | ||
4176 | pi->sclk_ss = false; | ||
4177 | pi->mclk_ss = false; | ||
4178 | pi->dynamic_ss = true; | ||
4179 | } | ||
4180 | 4163 | ||
4181 | pi->asi = RV770_ASI_DFLT; | 4164 | pi->asi = RV770_ASI_DFLT; |
4182 | pi->pasi = CYPRESS_HASI_DFLT; | 4165 | pi->pasi = CYPRESS_HASI_DFLT; |
@@ -4193,8 +4176,7 @@ int ni_dpm_init(struct radeon_device *rdev) | |||
4193 | 4176 | ||
4194 | pi->dynamic_pcie_gen2 = true; | 4177 | pi->dynamic_pcie_gen2 = true; |
4195 | 4178 | ||
4196 | if (pi->gfx_clock_gating && | 4179 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
4197 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
4198 | pi->thermal_protection = true; | 4180 | pi->thermal_protection = true; |
4199 | else | 4181 | else |
4200 | pi->thermal_protection = false; | 4182 | pi->thermal_protection = false; |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 10f712e37003..e66e72077350 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -2299,9 +2299,13 @@ int r600_init_microcode(struct radeon_device *rdev) | |||
2299 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) { | 2299 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) { |
2300 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", smc_chip_name); | 2300 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", smc_chip_name); |
2301 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); | 2301 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); |
2302 | if (err) | 2302 | if (err) { |
2303 | goto out; | 2303 | printk(KERN_ERR |
2304 | if (rdev->smc_fw->size != smc_req_size) { | 2304 | "smc: error loading firmware \"%s\"\n", |
2305 | fw_name); | ||
2306 | release_firmware(rdev->smc_fw); | ||
2307 | rdev->smc_fw = NULL; | ||
2308 | } else if (rdev->smc_fw->size != smc_req_size) { | ||
2305 | printk(KERN_ERR | 2309 | printk(KERN_ERR |
2306 | "smc: Bogus length %zu in firmware \"%s\"\n", | 2310 | "smc: Bogus length %zu in firmware \"%s\"\n", |
2307 | rdev->smc_fw->size, fw_name); | 2311 | rdev->smc_fw->size, fw_name); |
@@ -2697,12 +2701,29 @@ int r600_uvd_rbc_start(struct radeon_device *rdev) | |||
2697 | return 0; | 2701 | return 0; |
2698 | } | 2702 | } |
2699 | 2703 | ||
2700 | void r600_uvd_rbc_stop(struct radeon_device *rdev) | 2704 | void r600_uvd_stop(struct radeon_device *rdev) |
2701 | { | 2705 | { |
2702 | struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; | 2706 | struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; |
2703 | 2707 | ||
2704 | /* force RBC into idle state */ | 2708 | /* force RBC into idle state */ |
2705 | WREG32(UVD_RBC_RB_CNTL, 0x11010101); | 2709 | WREG32(UVD_RBC_RB_CNTL, 0x11010101); |
2710 | |||
2711 | /* Stall UMC and register bus before resetting VCPU */ | ||
2712 | WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); | ||
2713 | WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); | ||
2714 | mdelay(1); | ||
2715 | |||
2716 | /* put VCPU into reset */ | ||
2717 | WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET); | ||
2718 | mdelay(5); | ||
2719 | |||
2720 | /* disable VCPU clock */ | ||
2721 | WREG32(UVD_VCPU_CNTL, 0x0); | ||
2722 | |||
2723 | /* Unstall UMC and register bus */ | ||
2724 | WREG32_P(UVD_LMI_CTRL2, 0, ~(1 << 8)); | ||
2725 | WREG32_P(UVD_RB_ARB_CTRL, 0, ~(1 << 3)); | ||
2726 | |||
2706 | ring->ready = false; | 2727 | ring->ready = false; |
2707 | } | 2728 | } |
2708 | 2729 | ||
@@ -2722,6 +2743,11 @@ int r600_uvd_init(struct radeon_device *rdev) | |||
2722 | /* disable interupt */ | 2743 | /* disable interupt */ |
2723 | WREG32_P(UVD_MASTINT_EN, 0, ~(1 << 1)); | 2744 | WREG32_P(UVD_MASTINT_EN, 0, ~(1 << 1)); |
2724 | 2745 | ||
2746 | /* Stall UMC and register bus before resetting VCPU */ | ||
2747 | WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); | ||
2748 | WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); | ||
2749 | mdelay(1); | ||
2750 | |||
2725 | /* put LMI, VCPU, RBC etc... into reset */ | 2751 | /* put LMI, VCPU, RBC etc... into reset */ |
2726 | WREG32(UVD_SOFT_RESET, LMI_SOFT_RESET | VCPU_SOFT_RESET | | 2752 | WREG32(UVD_SOFT_RESET, LMI_SOFT_RESET | VCPU_SOFT_RESET | |
2727 | LBSI_SOFT_RESET | RBC_SOFT_RESET | CSM_SOFT_RESET | | 2753 | LBSI_SOFT_RESET | RBC_SOFT_RESET | CSM_SOFT_RESET | |
@@ -2751,10 +2777,6 @@ int r600_uvd_init(struct radeon_device *rdev) | |||
2751 | WREG32(UVD_MPC_SET_ALU, 0); | 2777 | WREG32(UVD_MPC_SET_ALU, 0); |
2752 | WREG32(UVD_MPC_SET_MUX, 0x88); | 2778 | WREG32(UVD_MPC_SET_MUX, 0x88); |
2753 | 2779 | ||
2754 | /* Stall UMC */ | ||
2755 | WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); | ||
2756 | WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); | ||
2757 | |||
2758 | /* take all subblocks out of reset, except VCPU */ | 2780 | /* take all subblocks out of reset, except VCPU */ |
2759 | WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET); | 2781 | WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET); |
2760 | mdelay(5); | 2782 | mdelay(5); |
@@ -3312,6 +3334,8 @@ static int r600_startup(struct radeon_device *rdev) | |||
3312 | /* enable pcie gen2 link */ | 3334 | /* enable pcie gen2 link */ |
3313 | r600_pcie_gen2_enable(rdev); | 3335 | r600_pcie_gen2_enable(rdev); |
3314 | 3336 | ||
3337 | r600_mc_program(rdev); | ||
3338 | |||
3315 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { | 3339 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { |
3316 | r = r600_init_microcode(rdev); | 3340 | r = r600_init_microcode(rdev); |
3317 | if (r) { | 3341 | if (r) { |
@@ -3324,7 +3348,6 @@ static int r600_startup(struct radeon_device *rdev) | |||
3324 | if (r) | 3348 | if (r) |
3325 | return r; | 3349 | return r; |
3326 | 3350 | ||
3327 | r600_mc_program(rdev); | ||
3328 | if (rdev->flags & RADEON_IS_AGP) { | 3351 | if (rdev->flags & RADEON_IS_AGP) { |
3329 | r600_agp_enable(rdev); | 3352 | r600_agp_enable(rdev); |
3330 | } else { | 3353 | } else { |
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index f48240bb8c56..f264df5470f7 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c | |||
@@ -226,10 +226,29 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
226 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 226 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
227 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 227 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
228 | u32 base_rate = 24000; | 228 | u32 base_rate = 24000; |
229 | u32 max_ratio = clock / base_rate; | ||
230 | u32 dto_phase; | ||
231 | u32 dto_modulo = clock; | ||
232 | u32 wallclock_ratio; | ||
233 | u32 dto_cntl; | ||
229 | 234 | ||
230 | if (!dig || !dig->afmt) | 235 | if (!dig || !dig->afmt) |
231 | return; | 236 | return; |
232 | 237 | ||
238 | if (max_ratio >= 8) { | ||
239 | dto_phase = 192 * 1000; | ||
240 | wallclock_ratio = 3; | ||
241 | } else if (max_ratio >= 4) { | ||
242 | dto_phase = 96 * 1000; | ||
243 | wallclock_ratio = 2; | ||
244 | } else if (max_ratio >= 2) { | ||
245 | dto_phase = 48 * 1000; | ||
246 | wallclock_ratio = 1; | ||
247 | } else { | ||
248 | dto_phase = 24 * 1000; | ||
249 | wallclock_ratio = 0; | ||
250 | } | ||
251 | |||
233 | /* there are two DTOs selected by DCCG_AUDIO_DTO_SELECT. | 252 | /* there are two DTOs selected by DCCG_AUDIO_DTO_SELECT. |
234 | * doesn't matter which one you use. Just use the first one. | 253 | * doesn't matter which one you use. Just use the first one. |
235 | */ | 254 | */ |
@@ -242,9 +261,21 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
242 | /* according to the reg specs, this should DCE3.2 only, but in | 261 | /* according to the reg specs, this should DCE3.2 only, but in |
243 | * practice it seems to cover DCE3.0 as well. | 262 | * practice it seems to cover DCE3.0 as well. |
244 | */ | 263 | */ |
245 | WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); | 264 | if (dig->dig_encoder == 0) { |
246 | WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); | 265 | dto_cntl = RREG32(DCCG_AUDIO_DTO0_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; |
247 | WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ | 266 | dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); |
267 | WREG32(DCCG_AUDIO_DTO0_CNTL, dto_cntl); | ||
268 | WREG32(DCCG_AUDIO_DTO0_PHASE, dto_phase); | ||
269 | WREG32(DCCG_AUDIO_DTO0_MODULE, dto_modulo); | ||
270 | WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ | ||
271 | } else { | ||
272 | dto_cntl = RREG32(DCCG_AUDIO_DTO1_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; | ||
273 | dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); | ||
274 | WREG32(DCCG_AUDIO_DTO1_CNTL, dto_cntl); | ||
275 | WREG32(DCCG_AUDIO_DTO1_PHASE, dto_phase); | ||
276 | WREG32(DCCG_AUDIO_DTO1_MODULE, dto_modulo); | ||
277 | WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */ | ||
278 | } | ||
248 | } else { | 279 | } else { |
249 | /* according to the reg specs, this should be DCE2.0 and DCE3.0 */ | 280 | /* according to the reg specs, this should be DCE2.0 and DCE3.0 */ |
250 | WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) | | 281 | WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) | |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index 8e3fe815edab..7c780839a7f4 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -933,6 +933,9 @@ | |||
933 | #define DCCG_AUDIO_DTO0_LOAD 0x051c | 933 | #define DCCG_AUDIO_DTO0_LOAD 0x051c |
934 | # define DTO_LOAD (1 << 31) | 934 | # define DTO_LOAD (1 << 31) |
935 | #define DCCG_AUDIO_DTO0_CNTL 0x0520 | 935 | #define DCCG_AUDIO_DTO0_CNTL 0x0520 |
936 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO(x) (((x) & 7) << 0) | ||
937 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK 7 | ||
938 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_SHIFT 0 | ||
936 | 939 | ||
937 | #define DCCG_AUDIO_DTO1_PHASE 0x0524 | 940 | #define DCCG_AUDIO_DTO1_PHASE 0x0524 |
938 | #define DCCG_AUDIO_DTO1_MODULE 0x0528 | 941 | #define DCCG_AUDIO_DTO1_MODULE 0x0528 |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 2f08219c39b6..274b8e1b889f 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1468,7 +1468,6 @@ struct radeon_uvd { | |||
1468 | void *cpu_addr; | 1468 | void *cpu_addr; |
1469 | uint64_t gpu_addr; | 1469 | uint64_t gpu_addr; |
1470 | void *saved_bo; | 1470 | void *saved_bo; |
1471 | unsigned fw_size; | ||
1472 | atomic_t handles[RADEON_MAX_UVD_HANDLES]; | 1471 | atomic_t handles[RADEON_MAX_UVD_HANDLES]; |
1473 | struct drm_file *filp[RADEON_MAX_UVD_HANDLES]; | 1472 | struct drm_file *filp[RADEON_MAX_UVD_HANDLES]; |
1474 | struct delayed_work idle_work; | 1473 | struct delayed_work idle_work; |
@@ -2066,6 +2065,7 @@ struct radeon_device { | |||
2066 | const struct firmware *mec_fw; /* CIK MEC firmware */ | 2065 | const struct firmware *mec_fw; /* CIK MEC firmware */ |
2067 | const struct firmware *sdma_fw; /* CIK SDMA firmware */ | 2066 | const struct firmware *sdma_fw; /* CIK SDMA firmware */ |
2068 | const struct firmware *smc_fw; /* SMC firmware */ | 2067 | const struct firmware *smc_fw; /* SMC firmware */ |
2068 | const struct firmware *uvd_fw; /* UVD firmware */ | ||
2069 | struct r600_blit r600_blit; | 2069 | struct r600_blit r600_blit; |
2070 | struct r600_vram_scratch vram_scratch; | 2070 | struct r600_vram_scratch vram_scratch; |
2071 | int msi_enabled; /* msi enabled */ | 2071 | int msi_enabled; /* msi enabled */ |
@@ -2095,6 +2095,8 @@ struct radeon_device { | |||
2095 | /* ACPI interface */ | 2095 | /* ACPI interface */ |
2096 | struct radeon_atif atif; | 2096 | struct radeon_atif atif; |
2097 | struct radeon_atcs atcs; | 2097 | struct radeon_atcs atcs; |
2098 | /* srbm instance registers */ | ||
2099 | struct mutex srbm_mutex; | ||
2098 | }; | 2100 | }; |
2099 | 2101 | ||
2100 | int radeon_device_init(struct radeon_device *rdev, | 2102 | int radeon_device_init(struct radeon_device *rdev, |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index 902479fa737f..3d61d5aac18f 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -441,7 +441,7 @@ void rs780_dpm_debugfs_print_current_performance_level(struct radeon_device *rde | |||
441 | /* uvd */ | 441 | /* uvd */ |
442 | int r600_uvd_init(struct radeon_device *rdev); | 442 | int r600_uvd_init(struct radeon_device *rdev); |
443 | int r600_uvd_rbc_start(struct radeon_device *rdev); | 443 | int r600_uvd_rbc_start(struct radeon_device *rdev); |
444 | void r600_uvd_rbc_stop(struct radeon_device *rdev); | 444 | void r600_uvd_stop(struct radeon_device *rdev); |
445 | int r600_uvd_ib_test(struct radeon_device *rdev, struct radeon_ring *ring); | 445 | int r600_uvd_ib_test(struct radeon_device *rdev, struct radeon_ring *ring); |
446 | void r600_uvd_fence_emit(struct radeon_device *rdev, | 446 | void r600_uvd_fence_emit(struct radeon_device *rdev, |
447 | struct radeon_fence *fence); | 447 | struct radeon_fence *fence); |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index e3f3e8841789..4ccd61f60eb6 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -2782,7 +2782,7 @@ int radeon_atom_get_clock_dividers(struct radeon_device *rdev, | |||
2782 | ATOM_PLL_CNTL_FLAG_PLL_POST_DIV_EN) ? true : false; | 2782 | ATOM_PLL_CNTL_FLAG_PLL_POST_DIV_EN) ? true : false; |
2783 | dividers->enable_dithen = (args.v3.ucCntlFlag & | 2783 | dividers->enable_dithen = (args.v3.ucCntlFlag & |
2784 | ATOM_PLL_CNTL_FLAG_FRACTION_DISABLE) ? false : true; | 2784 | ATOM_PLL_CNTL_FLAG_FRACTION_DISABLE) ? false : true; |
2785 | dividers->fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDiv); | 2785 | dividers->whole_fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDiv); |
2786 | dividers->frac_fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDivFrac); | 2786 | dividers->frac_fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDivFrac); |
2787 | dividers->ref_div = args.v3.ucRefDiv; | 2787 | dividers->ref_div = args.v3.ucRefDiv; |
2788 | dividers->vco_mode = (args.v3.ucCntlFlag & | 2788 | dividers->vco_mode = (args.v3.ucCntlFlag & |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 82335e38ec4f..63398ae1dbf5 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -1163,6 +1163,7 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1163 | mutex_init(&rdev->gem.mutex); | 1163 | mutex_init(&rdev->gem.mutex); |
1164 | mutex_init(&rdev->pm.mutex); | 1164 | mutex_init(&rdev->pm.mutex); |
1165 | mutex_init(&rdev->gpu_clock_mutex); | 1165 | mutex_init(&rdev->gpu_clock_mutex); |
1166 | mutex_init(&rdev->srbm_mutex); | ||
1166 | init_rwsem(&rdev->pm.mclk_lock); | 1167 | init_rwsem(&rdev->pm.mclk_lock); |
1167 | init_rwsem(&rdev->exclusive_lock); | 1168 | init_rwsem(&rdev->exclusive_lock); |
1168 | init_waitqueue_head(&rdev->irq.vblank_queue); | 1169 | init_waitqueue_head(&rdev->irq.vblank_queue); |
@@ -1519,6 +1520,7 @@ int radeon_gpu_reset(struct radeon_device *rdev) | |||
1519 | radeon_save_bios_scratch_regs(rdev); | 1520 | radeon_save_bios_scratch_regs(rdev); |
1520 | /* block TTM */ | 1521 | /* block TTM */ |
1521 | resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); | 1522 | resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); |
1523 | radeon_pm_suspend(rdev); | ||
1522 | radeon_suspend(rdev); | 1524 | radeon_suspend(rdev); |
1523 | 1525 | ||
1524 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { | 1526 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { |
@@ -1564,6 +1566,7 @@ retry: | |||
1564 | } | 1566 | } |
1565 | } | 1567 | } |
1566 | 1568 | ||
1569 | radeon_pm_resume(rdev); | ||
1567 | drm_helper_resume_force_mode(rdev->ddev); | 1570 | drm_helper_resume_force_mode(rdev->ddev); |
1568 | 1571 | ||
1569 | ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); | 1572 | ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); |
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 7ddb0efe2408..ddb8f8e04eb5 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c | |||
@@ -782,7 +782,7 @@ int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring) | |||
782 | 782 | ||
783 | } else { | 783 | } else { |
784 | /* put fence directly behind firmware */ | 784 | /* put fence directly behind firmware */ |
785 | index = ALIGN(rdev->uvd.fw_size, 8); | 785 | index = ALIGN(rdev->uvd_fw->size, 8); |
786 | rdev->fence_drv[ring].cpu_addr = rdev->uvd.cpu_addr + index; | 786 | rdev->fence_drv[ring].cpu_addr = rdev->uvd.cpu_addr + index; |
787 | rdev->fence_drv[ring].gpu_addr = rdev->uvd.gpu_addr + index; | 787 | rdev->fence_drv[ring].gpu_addr = rdev->uvd.gpu_addr + index; |
788 | } | 788 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 6a51d943ccf4..b990b1a2bd50 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -207,7 +207,6 @@ void radeon_gart_table_vram_free(struct radeon_device *rdev) | |||
207 | if (rdev->gart.robj == NULL) { | 207 | if (rdev->gart.robj == NULL) { |
208 | return; | 208 | return; |
209 | } | 209 | } |
210 | radeon_gart_table_vram_unpin(rdev); | ||
211 | radeon_bo_unref(&rdev->gart.robj); | 210 | radeon_bo_unref(&rdev->gart.robj); |
212 | } | 211 | } |
213 | 212 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index f374c467aaca..c557850cd345 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -1176,7 +1176,14 @@ int radeon_pm_init(struct radeon_device *rdev) | |||
1176 | case CHIP_VERDE: | 1176 | case CHIP_VERDE: |
1177 | case CHIP_OLAND: | 1177 | case CHIP_OLAND: |
1178 | case CHIP_HAINAN: | 1178 | case CHIP_HAINAN: |
1179 | if (radeon_dpm == 1) | 1179 | /* DPM requires the RLC, RV770+ dGPU requires SMC */ |
1180 | if (!rdev->rlc_fw) | ||
1181 | rdev->pm.pm_method = PM_METHOD_PROFILE; | ||
1182 | else if ((rdev->family >= CHIP_RV770) && | ||
1183 | (!(rdev->flags & RADEON_IS_IGP)) && | ||
1184 | (!rdev->smc_fw)) | ||
1185 | rdev->pm.pm_method = PM_METHOD_PROFILE; | ||
1186 | else if (radeon_dpm == 1) | ||
1180 | rdev->pm.pm_method = PM_METHOD_DPM; | 1187 | rdev->pm.pm_method = PM_METHOD_DPM; |
1181 | else | 1188 | else |
1182 | rdev->pm.pm_method = PM_METHOD_PROFILE; | 1189 | rdev->pm.pm_method = PM_METHOD_PROFILE; |
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 414fd145d20e..f1c15754e73c 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c | |||
@@ -56,7 +56,6 @@ static void radeon_uvd_idle_work_handler(struct work_struct *work); | |||
56 | 56 | ||
57 | int radeon_uvd_init(struct radeon_device *rdev) | 57 | int radeon_uvd_init(struct radeon_device *rdev) |
58 | { | 58 | { |
59 | const struct firmware *fw; | ||
60 | unsigned long bo_size; | 59 | unsigned long bo_size; |
61 | const char *fw_name; | 60 | const char *fw_name; |
62 | int i, r; | 61 | int i, r; |
@@ -105,14 +104,14 @@ int radeon_uvd_init(struct radeon_device *rdev) | |||
105 | return -EINVAL; | 104 | return -EINVAL; |
106 | } | 105 | } |
107 | 106 | ||
108 | r = request_firmware(&fw, fw_name, rdev->dev); | 107 | r = request_firmware(&rdev->uvd_fw, fw_name, rdev->dev); |
109 | if (r) { | 108 | if (r) { |
110 | dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n", | 109 | dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n", |
111 | fw_name); | 110 | fw_name); |
112 | return r; | 111 | return r; |
113 | } | 112 | } |
114 | 113 | ||
115 | bo_size = RADEON_GPU_PAGE_ALIGN(fw->size + 8) + | 114 | bo_size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 8) + |
116 | RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE; | 115 | RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE; |
117 | r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true, | 116 | r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true, |
118 | RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->uvd.vcpu_bo); | 117 | RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->uvd.vcpu_bo); |
@@ -145,12 +144,6 @@ int radeon_uvd_init(struct radeon_device *rdev) | |||
145 | 144 | ||
146 | radeon_bo_unreserve(rdev->uvd.vcpu_bo); | 145 | radeon_bo_unreserve(rdev->uvd.vcpu_bo); |
147 | 146 | ||
148 | rdev->uvd.fw_size = fw->size; | ||
149 | memset(rdev->uvd.cpu_addr, 0, bo_size); | ||
150 | memcpy(rdev->uvd.cpu_addr, fw->data, fw->size); | ||
151 | |||
152 | release_firmware(fw); | ||
153 | |||
154 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { | 147 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { |
155 | atomic_set(&rdev->uvd.handles[i], 0); | 148 | atomic_set(&rdev->uvd.handles[i], 0); |
156 | rdev->uvd.filp[i] = NULL; | 149 | rdev->uvd.filp[i] = NULL; |
@@ -174,33 +167,60 @@ void radeon_uvd_fini(struct radeon_device *rdev) | |||
174 | } | 167 | } |
175 | 168 | ||
176 | radeon_bo_unref(&rdev->uvd.vcpu_bo); | 169 | radeon_bo_unref(&rdev->uvd.vcpu_bo); |
170 | |||
171 | release_firmware(rdev->uvd_fw); | ||
177 | } | 172 | } |
178 | 173 | ||
179 | int radeon_uvd_suspend(struct radeon_device *rdev) | 174 | int radeon_uvd_suspend(struct radeon_device *rdev) |
180 | { | 175 | { |
181 | unsigned size; | 176 | unsigned size; |
177 | void *ptr; | ||
178 | int i; | ||
182 | 179 | ||
183 | if (rdev->uvd.vcpu_bo == NULL) | 180 | if (rdev->uvd.vcpu_bo == NULL) |
184 | return 0; | 181 | return 0; |
185 | 182 | ||
183 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) | ||
184 | if (atomic_read(&rdev->uvd.handles[i])) | ||
185 | break; | ||
186 | |||
187 | if (i == RADEON_MAX_UVD_HANDLES) | ||
188 | return 0; | ||
189 | |||
186 | size = radeon_bo_size(rdev->uvd.vcpu_bo); | 190 | size = radeon_bo_size(rdev->uvd.vcpu_bo); |
191 | size -= rdev->uvd_fw->size; | ||
192 | |||
193 | ptr = rdev->uvd.cpu_addr; | ||
194 | ptr += rdev->uvd_fw->size; | ||
195 | |||
187 | rdev->uvd.saved_bo = kmalloc(size, GFP_KERNEL); | 196 | rdev->uvd.saved_bo = kmalloc(size, GFP_KERNEL); |
188 | memcpy(rdev->uvd.saved_bo, rdev->uvd.cpu_addr, size); | 197 | memcpy(rdev->uvd.saved_bo, ptr, size); |
189 | 198 | ||
190 | return 0; | 199 | return 0; |
191 | } | 200 | } |
192 | 201 | ||
193 | int radeon_uvd_resume(struct radeon_device *rdev) | 202 | int radeon_uvd_resume(struct radeon_device *rdev) |
194 | { | 203 | { |
204 | unsigned size; | ||
205 | void *ptr; | ||
206 | |||
195 | if (rdev->uvd.vcpu_bo == NULL) | 207 | if (rdev->uvd.vcpu_bo == NULL) |
196 | return -EINVAL; | 208 | return -EINVAL; |
197 | 209 | ||
210 | memcpy(rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size); | ||
211 | |||
212 | size = radeon_bo_size(rdev->uvd.vcpu_bo); | ||
213 | size -= rdev->uvd_fw->size; | ||
214 | |||
215 | ptr = rdev->uvd.cpu_addr; | ||
216 | ptr += rdev->uvd_fw->size; | ||
217 | |||
198 | if (rdev->uvd.saved_bo != NULL) { | 218 | if (rdev->uvd.saved_bo != NULL) { |
199 | unsigned size = radeon_bo_size(rdev->uvd.vcpu_bo); | 219 | memcpy(ptr, rdev->uvd.saved_bo, size); |
200 | memcpy(rdev->uvd.cpu_addr, rdev->uvd.saved_bo, size); | ||
201 | kfree(rdev->uvd.saved_bo); | 220 | kfree(rdev->uvd.saved_bo); |
202 | rdev->uvd.saved_bo = NULL; | 221 | rdev->uvd.saved_bo = NULL; |
203 | } | 222 | } else |
223 | memset(ptr, 0, size); | ||
204 | 224 | ||
205 | return 0; | 225 | return 0; |
206 | } | 226 | } |
@@ -215,8 +235,8 @@ void radeon_uvd_free_handles(struct radeon_device *rdev, struct drm_file *filp) | |||
215 | { | 235 | { |
216 | int i, r; | 236 | int i, r; |
217 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { | 237 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { |
218 | if (rdev->uvd.filp[i] == filp) { | 238 | uint32_t handle = atomic_read(&rdev->uvd.handles[i]); |
219 | uint32_t handle = atomic_read(&rdev->uvd.handles[i]); | 239 | if (handle != 0 && rdev->uvd.filp[i] == filp) { |
220 | struct radeon_fence *fence; | 240 | struct radeon_fence *fence; |
221 | 241 | ||
222 | r = radeon_uvd_get_destroy_msg(rdev, | 242 | r = radeon_uvd_get_destroy_msg(rdev, |
@@ -337,8 +357,10 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, | |||
337 | } | 357 | } |
338 | 358 | ||
339 | r = radeon_bo_kmap(bo, &ptr); | 359 | r = radeon_bo_kmap(bo, &ptr); |
340 | if (r) | 360 | if (r) { |
361 | DRM_ERROR("Failed mapping the UVD message (%d)!\n", r); | ||
341 | return r; | 362 | return r; |
363 | } | ||
342 | 364 | ||
343 | msg = ptr + offset; | 365 | msg = ptr + offset; |
344 | 366 | ||
@@ -364,8 +386,14 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, | |||
364 | radeon_bo_kunmap(bo); | 386 | radeon_bo_kunmap(bo); |
365 | return 0; | 387 | return 0; |
366 | } else { | 388 | } else { |
367 | /* it's a create msg, no special handling needed */ | ||
368 | radeon_bo_kunmap(bo); | 389 | radeon_bo_kunmap(bo); |
390 | |||
391 | if (msg_type != 0) { | ||
392 | DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type); | ||
393 | return -EINVAL; | ||
394 | } | ||
395 | |||
396 | /* it's a create msg, no special handling needed */ | ||
369 | } | 397 | } |
370 | 398 | ||
371 | /* create or decode, validate the handle */ | 399 | /* create or decode, validate the handle */ |
@@ -388,7 +416,7 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, | |||
388 | 416 | ||
389 | static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, | 417 | static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, |
390 | int data0, int data1, | 418 | int data0, int data1, |
391 | unsigned buf_sizes[]) | 419 | unsigned buf_sizes[], bool *has_msg_cmd) |
392 | { | 420 | { |
393 | struct radeon_cs_chunk *relocs_chunk; | 421 | struct radeon_cs_chunk *relocs_chunk; |
394 | struct radeon_cs_reloc *reloc; | 422 | struct radeon_cs_reloc *reloc; |
@@ -417,7 +445,7 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, | |||
417 | 445 | ||
418 | if (cmd < 0x4) { | 446 | if (cmd < 0x4) { |
419 | if ((end - start) < buf_sizes[cmd]) { | 447 | if ((end - start) < buf_sizes[cmd]) { |
420 | DRM_ERROR("buffer to small (%d / %d)!\n", | 448 | DRM_ERROR("buffer (%d) to small (%d / %d)!\n", cmd, |
421 | (unsigned)(end - start), buf_sizes[cmd]); | 449 | (unsigned)(end - start), buf_sizes[cmd]); |
422 | return -EINVAL; | 450 | return -EINVAL; |
423 | } | 451 | } |
@@ -442,9 +470,17 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, | |||
442 | } | 470 | } |
443 | 471 | ||
444 | if (cmd == 0) { | 472 | if (cmd == 0) { |
473 | if (*has_msg_cmd) { | ||
474 | DRM_ERROR("More than one message in a UVD-IB!\n"); | ||
475 | return -EINVAL; | ||
476 | } | ||
477 | *has_msg_cmd = true; | ||
445 | r = radeon_uvd_cs_msg(p, reloc->robj, offset, buf_sizes); | 478 | r = radeon_uvd_cs_msg(p, reloc->robj, offset, buf_sizes); |
446 | if (r) | 479 | if (r) |
447 | return r; | 480 | return r; |
481 | } else if (!*has_msg_cmd) { | ||
482 | DRM_ERROR("Message needed before other commands are send!\n"); | ||
483 | return -EINVAL; | ||
448 | } | 484 | } |
449 | 485 | ||
450 | return 0; | 486 | return 0; |
@@ -453,7 +489,8 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, | |||
453 | static int radeon_uvd_cs_reg(struct radeon_cs_parser *p, | 489 | static int radeon_uvd_cs_reg(struct radeon_cs_parser *p, |
454 | struct radeon_cs_packet *pkt, | 490 | struct radeon_cs_packet *pkt, |
455 | int *data0, int *data1, | 491 | int *data0, int *data1, |
456 | unsigned buf_sizes[]) | 492 | unsigned buf_sizes[], |
493 | bool *has_msg_cmd) | ||
457 | { | 494 | { |
458 | int i, r; | 495 | int i, r; |
459 | 496 | ||
@@ -467,7 +504,8 @@ static int radeon_uvd_cs_reg(struct radeon_cs_parser *p, | |||
467 | *data1 = p->idx; | 504 | *data1 = p->idx; |
468 | break; | 505 | break; |
469 | case UVD_GPCOM_VCPU_CMD: | 506 | case UVD_GPCOM_VCPU_CMD: |
470 | r = radeon_uvd_cs_reloc(p, *data0, *data1, buf_sizes); | 507 | r = radeon_uvd_cs_reloc(p, *data0, *data1, |
508 | buf_sizes, has_msg_cmd); | ||
471 | if (r) | 509 | if (r) |
472 | return r; | 510 | return r; |
473 | break; | 511 | break; |
@@ -488,6 +526,9 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) | |||
488 | struct radeon_cs_packet pkt; | 526 | struct radeon_cs_packet pkt; |
489 | int r, data0 = 0, data1 = 0; | 527 | int r, data0 = 0, data1 = 0; |
490 | 528 | ||
529 | /* does the IB has a msg command */ | ||
530 | bool has_msg_cmd = false; | ||
531 | |||
491 | /* minimum buffer sizes */ | 532 | /* minimum buffer sizes */ |
492 | unsigned buf_sizes[] = { | 533 | unsigned buf_sizes[] = { |
493 | [0x00000000] = 2048, | 534 | [0x00000000] = 2048, |
@@ -514,8 +555,8 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) | |||
514 | return r; | 555 | return r; |
515 | switch (pkt.type) { | 556 | switch (pkt.type) { |
516 | case RADEON_PACKET_TYPE0: | 557 | case RADEON_PACKET_TYPE0: |
517 | r = radeon_uvd_cs_reg(p, &pkt, &data0, | 558 | r = radeon_uvd_cs_reg(p, &pkt, &data0, &data1, |
518 | &data1, buf_sizes); | 559 | buf_sizes, &has_msg_cmd); |
519 | if (r) | 560 | if (r) |
520 | return r; | 561 | return r; |
521 | break; | 562 | break; |
@@ -527,6 +568,12 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) | |||
527 | return -EINVAL; | 568 | return -EINVAL; |
528 | } | 569 | } |
529 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); | 570 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); |
571 | |||
572 | if (!has_msg_cmd) { | ||
573 | DRM_ERROR("UVD-IBs need a msg command!\n"); | ||
574 | return -EINVAL; | ||
575 | } | ||
576 | |||
530 | return 0; | 577 | return 0; |
531 | } | 578 | } |
532 | 579 | ||
diff --git a/drivers/gpu/drm/radeon/rv6xx_dpm.c b/drivers/gpu/drm/radeon/rv6xx_dpm.c index 363018c60412..bdd888b4db2b 100644 --- a/drivers/gpu/drm/radeon/rv6xx_dpm.c +++ b/drivers/gpu/drm/radeon/rv6xx_dpm.c | |||
@@ -1944,9 +1944,7 @@ static int rv6xx_parse_power_table(struct radeon_device *rdev) | |||
1944 | 1944 | ||
1945 | int rv6xx_dpm_init(struct radeon_device *rdev) | 1945 | int rv6xx_dpm_init(struct radeon_device *rdev) |
1946 | { | 1946 | { |
1947 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | 1947 | struct radeon_atom_ss ss; |
1948 | uint16_t data_offset, size; | ||
1949 | uint8_t frev, crev; | ||
1950 | struct atom_clock_dividers dividers; | 1948 | struct atom_clock_dividers dividers; |
1951 | struct rv6xx_power_info *pi; | 1949 | struct rv6xx_power_info *pi; |
1952 | int ret; | 1950 | int ret; |
@@ -1989,16 +1987,18 @@ int rv6xx_dpm_init(struct radeon_device *rdev) | |||
1989 | 1987 | ||
1990 | pi->gfx_clock_gating = true; | 1988 | pi->gfx_clock_gating = true; |
1991 | 1989 | ||
1992 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 1990 | pi->sclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, |
1993 | &frev, &crev, &data_offset)) { | 1991 | ASIC_INTERNAL_ENGINE_SS, 0); |
1994 | pi->sclk_ss = true; | 1992 | pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, |
1995 | pi->mclk_ss = true; | 1993 | ASIC_INTERNAL_MEMORY_SS, 0); |
1994 | |||
1995 | /* Disable sclk ss, causes hangs on a lot of systems */ | ||
1996 | pi->sclk_ss = false; | ||
1997 | |||
1998 | if (pi->sclk_ss || pi->mclk_ss) | ||
1996 | pi->dynamic_ss = true; | 1999 | pi->dynamic_ss = true; |
1997 | } else { | 2000 | else |
1998 | pi->sclk_ss = false; | ||
1999 | pi->mclk_ss = false; | ||
2000 | pi->dynamic_ss = false; | 2001 | pi->dynamic_ss = false; |
2001 | } | ||
2002 | 2002 | ||
2003 | pi->dynamic_pcie_gen2 = true; | 2003 | pi->dynamic_pcie_gen2 = true; |
2004 | 2004 | ||
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 30ea14e8854c..bcc68ec204ad 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -813,7 +813,7 @@ int rv770_uvd_resume(struct radeon_device *rdev) | |||
813 | 813 | ||
814 | /* programm the VCPU memory controller bits 0-27 */ | 814 | /* programm the VCPU memory controller bits 0-27 */ |
815 | addr = rdev->uvd.gpu_addr >> 3; | 815 | addr = rdev->uvd.gpu_addr >> 3; |
816 | size = RADEON_GPU_PAGE_ALIGN(rdev->uvd.fw_size + 4) >> 3; | 816 | size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) >> 3; |
817 | WREG32(UVD_VCPU_CACHE_OFFSET0, addr); | 817 | WREG32(UVD_VCPU_CACHE_OFFSET0, addr); |
818 | WREG32(UVD_VCPU_CACHE_SIZE0, size); | 818 | WREG32(UVD_VCPU_CACHE_SIZE0, size); |
819 | 819 | ||
@@ -1829,6 +1829,8 @@ static int rv770_startup(struct radeon_device *rdev) | |||
1829 | /* enable pcie gen2 link */ | 1829 | /* enable pcie gen2 link */ |
1830 | rv770_pcie_gen2_enable(rdev); | 1830 | rv770_pcie_gen2_enable(rdev); |
1831 | 1831 | ||
1832 | rv770_mc_program(rdev); | ||
1833 | |||
1832 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { | 1834 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { |
1833 | r = r600_init_microcode(rdev); | 1835 | r = r600_init_microcode(rdev); |
1834 | if (r) { | 1836 | if (r) { |
@@ -1841,7 +1843,6 @@ static int rv770_startup(struct radeon_device *rdev) | |||
1841 | if (r) | 1843 | if (r) |
1842 | return r; | 1844 | return r; |
1843 | 1845 | ||
1844 | rv770_mc_program(rdev); | ||
1845 | if (rdev->flags & RADEON_IS_AGP) { | 1846 | if (rdev->flags & RADEON_IS_AGP) { |
1846 | rv770_agp_enable(rdev); | 1847 | rv770_agp_enable(rdev); |
1847 | } else { | 1848 | } else { |
@@ -1983,6 +1984,7 @@ int rv770_resume(struct radeon_device *rdev) | |||
1983 | int rv770_suspend(struct radeon_device *rdev) | 1984 | int rv770_suspend(struct radeon_device *rdev) |
1984 | { | 1985 | { |
1985 | r600_audio_fini(rdev); | 1986 | r600_audio_fini(rdev); |
1987 | r600_uvd_stop(rdev); | ||
1986 | radeon_uvd_suspend(rdev); | 1988 | radeon_uvd_suspend(rdev); |
1987 | r700_cp_stop(rdev); | 1989 | r700_cp_stop(rdev); |
1988 | r600_dma_stop(rdev); | 1990 | r600_dma_stop(rdev); |
@@ -2098,6 +2100,7 @@ void rv770_fini(struct radeon_device *rdev) | |||
2098 | radeon_ib_pool_fini(rdev); | 2100 | radeon_ib_pool_fini(rdev); |
2099 | radeon_irq_kms_fini(rdev); | 2101 | radeon_irq_kms_fini(rdev); |
2100 | rv770_pcie_gart_fini(rdev); | 2102 | rv770_pcie_gart_fini(rdev); |
2103 | r600_uvd_stop(rdev); | ||
2101 | radeon_uvd_fini(rdev); | 2104 | radeon_uvd_fini(rdev); |
2102 | r600_vram_scratch_fini(rdev); | 2105 | r600_vram_scratch_fini(rdev); |
2103 | radeon_gem_fini(rdev); | 2106 | radeon_gem_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c index 2d347925f77d..094c67a29d0d 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.c +++ b/drivers/gpu/drm/radeon/rv770_dpm.c | |||
@@ -2319,12 +2319,25 @@ int rv7xx_parse_power_table(struct radeon_device *rdev) | |||
2319 | return 0; | 2319 | return 0; |
2320 | } | 2320 | } |
2321 | 2321 | ||
2322 | void rv770_get_engine_memory_ss(struct radeon_device *rdev) | ||
2323 | { | ||
2324 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | ||
2325 | struct radeon_atom_ss ss; | ||
2326 | |||
2327 | pi->sclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, | ||
2328 | ASIC_INTERNAL_ENGINE_SS, 0); | ||
2329 | pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, | ||
2330 | ASIC_INTERNAL_MEMORY_SS, 0); | ||
2331 | |||
2332 | if (pi->sclk_ss || pi->mclk_ss) | ||
2333 | pi->dynamic_ss = true; | ||
2334 | else | ||
2335 | pi->dynamic_ss = false; | ||
2336 | } | ||
2337 | |||
2322 | int rv770_dpm_init(struct radeon_device *rdev) | 2338 | int rv770_dpm_init(struct radeon_device *rdev) |
2323 | { | 2339 | { |
2324 | struct rv7xx_power_info *pi; | 2340 | struct rv7xx_power_info *pi; |
2325 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
2326 | uint16_t data_offset, size; | ||
2327 | uint8_t frev, crev; | ||
2328 | struct atom_clock_dividers dividers; | 2341 | struct atom_clock_dividers dividers; |
2329 | int ret; | 2342 | int ret; |
2330 | 2343 | ||
@@ -2369,16 +2382,7 @@ int rv770_dpm_init(struct radeon_device *rdev) | |||
2369 | pi->mvdd_control = | 2382 | pi->mvdd_control = |
2370 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0); | 2383 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0); |
2371 | 2384 | ||
2372 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 2385 | rv770_get_engine_memory_ss(rdev); |
2373 | &frev, &crev, &data_offset)) { | ||
2374 | pi->sclk_ss = true; | ||
2375 | pi->mclk_ss = true; | ||
2376 | pi->dynamic_ss = true; | ||
2377 | } else { | ||
2378 | pi->sclk_ss = false; | ||
2379 | pi->mclk_ss = false; | ||
2380 | pi->dynamic_ss = false; | ||
2381 | } | ||
2382 | 2386 | ||
2383 | pi->asi = RV770_ASI_DFLT; | 2387 | pi->asi = RV770_ASI_DFLT; |
2384 | pi->pasi = RV770_HASI_DFLT; | 2388 | pi->pasi = RV770_HASI_DFLT; |
@@ -2393,8 +2397,7 @@ int rv770_dpm_init(struct radeon_device *rdev) | |||
2393 | 2397 | ||
2394 | pi->dynamic_pcie_gen2 = true; | 2398 | pi->dynamic_pcie_gen2 = true; |
2395 | 2399 | ||
2396 | if (pi->gfx_clock_gating && | 2400 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
2397 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
2398 | pi->thermal_protection = true; | 2401 | pi->thermal_protection = true; |
2399 | else | 2402 | else |
2400 | pi->thermal_protection = false; | 2403 | pi->thermal_protection = false; |
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.h b/drivers/gpu/drm/radeon/rv770_dpm.h index 96b1b2a62a8a..9244effc6b59 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.h +++ b/drivers/gpu/drm/radeon/rv770_dpm.h | |||
@@ -275,6 +275,7 @@ void rv770_set_uvd_clock_before_set_eng_clock(struct radeon_device *rdev, | |||
275 | void rv770_set_uvd_clock_after_set_eng_clock(struct radeon_device *rdev, | 275 | void rv770_set_uvd_clock_after_set_eng_clock(struct radeon_device *rdev, |
276 | struct radeon_ps *new_ps, | 276 | struct radeon_ps *new_ps, |
277 | struct radeon_ps *old_ps); | 277 | struct radeon_ps *old_ps); |
278 | void rv770_get_engine_memory_ss(struct radeon_device *rdev); | ||
278 | 279 | ||
279 | /* smc */ | 280 | /* smc */ |
280 | int rv770_read_smc_soft_register(struct radeon_device *rdev, | 281 | int rv770_read_smc_soft_register(struct radeon_device *rdev, |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index d325280e2f9f..daa8d2df8ec5 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -1663,9 +1663,13 @@ static int si_init_microcode(struct radeon_device *rdev) | |||
1663 | 1663 | ||
1664 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); | 1664 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); |
1665 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); | 1665 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); |
1666 | if (err) | 1666 | if (err) { |
1667 | goto out; | 1667 | printk(KERN_ERR |
1668 | if (rdev->smc_fw->size != smc_req_size) { | 1668 | "smc: error loading firmware \"%s\"\n", |
1669 | fw_name); | ||
1670 | release_firmware(rdev->smc_fw); | ||
1671 | rdev->smc_fw = NULL; | ||
1672 | } else if (rdev->smc_fw->size != smc_req_size) { | ||
1669 | printk(KERN_ERR | 1673 | printk(KERN_ERR |
1670 | "si_smc: Bogus length %zu in firmware \"%s\"\n", | 1674 | "si_smc: Bogus length %zu in firmware \"%s\"\n", |
1671 | rdev->smc_fw->size, fw_name); | 1675 | rdev->smc_fw->size, fw_name); |
@@ -5215,14 +5219,12 @@ static void si_enable_mc_ls(struct radeon_device *rdev, | |||
5215 | 5219 | ||
5216 | static void si_init_cg(struct radeon_device *rdev) | 5220 | static void si_init_cg(struct radeon_device *rdev) |
5217 | { | 5221 | { |
5218 | bool has_uvd = true; | ||
5219 | |||
5220 | si_enable_mgcg(rdev, true); | 5222 | si_enable_mgcg(rdev, true); |
5221 | si_enable_cgcg(rdev, true); | 5223 | si_enable_cgcg(rdev, false); |
5222 | /* disable MC LS on Tahiti */ | 5224 | /* disable MC LS on Tahiti */ |
5223 | if (rdev->family == CHIP_TAHITI) | 5225 | if (rdev->family == CHIP_TAHITI) |
5224 | si_enable_mc_ls(rdev, false); | 5226 | si_enable_mc_ls(rdev, false); |
5225 | if (has_uvd) { | 5227 | if (rdev->has_uvd) { |
5226 | si_enable_uvd_mgcg(rdev, true); | 5228 | si_enable_uvd_mgcg(rdev, true); |
5227 | si_init_uvd_internal_cg(rdev); | 5229 | si_init_uvd_internal_cg(rdev); |
5228 | } | 5230 | } |
@@ -5230,9 +5232,7 @@ static void si_init_cg(struct radeon_device *rdev) | |||
5230 | 5232 | ||
5231 | static void si_fini_cg(struct radeon_device *rdev) | 5233 | static void si_fini_cg(struct radeon_device *rdev) |
5232 | { | 5234 | { |
5233 | bool has_uvd = true; | 5235 | if (rdev->has_uvd) |
5234 | |||
5235 | if (has_uvd) | ||
5236 | si_enable_uvd_mgcg(rdev, false); | 5236 | si_enable_uvd_mgcg(rdev, false); |
5237 | si_enable_cgcg(rdev, false); | 5237 | si_enable_cgcg(rdev, false); |
5238 | si_enable_mgcg(rdev, false); | 5238 | si_enable_mgcg(rdev, false); |
@@ -5241,11 +5241,11 @@ static void si_fini_cg(struct radeon_device *rdev) | |||
5241 | static void si_init_pg(struct radeon_device *rdev) | 5241 | static void si_init_pg(struct radeon_device *rdev) |
5242 | { | 5242 | { |
5243 | bool has_pg = false; | 5243 | bool has_pg = false; |
5244 | 5244 | #if 0 | |
5245 | /* only cape verde supports PG */ | 5245 | /* only cape verde supports PG */ |
5246 | if (rdev->family == CHIP_VERDE) | 5246 | if (rdev->family == CHIP_VERDE) |
5247 | has_pg = true; | 5247 | has_pg = true; |
5248 | 5248 | #endif | |
5249 | if (has_pg) { | 5249 | if (has_pg) { |
5250 | si_init_ao_cu_mask(rdev); | 5250 | si_init_ao_cu_mask(rdev); |
5251 | si_init_dma_pg(rdev); | 5251 | si_init_dma_pg(rdev); |
@@ -6422,6 +6422,8 @@ static int si_startup(struct radeon_device *rdev) | |||
6422 | /* enable aspm */ | 6422 | /* enable aspm */ |
6423 | si_program_aspm(rdev); | 6423 | si_program_aspm(rdev); |
6424 | 6424 | ||
6425 | si_mc_program(rdev); | ||
6426 | |||
6425 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || | 6427 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || |
6426 | !rdev->rlc_fw || !rdev->mc_fw) { | 6428 | !rdev->rlc_fw || !rdev->mc_fw) { |
6427 | r = si_init_microcode(rdev); | 6429 | r = si_init_microcode(rdev); |
@@ -6441,7 +6443,6 @@ static int si_startup(struct radeon_device *rdev) | |||
6441 | if (r) | 6443 | if (r) |
6442 | return r; | 6444 | return r; |
6443 | 6445 | ||
6444 | si_mc_program(rdev); | ||
6445 | r = si_pcie_gart_enable(rdev); | 6446 | r = si_pcie_gart_enable(rdev); |
6446 | if (r) | 6447 | if (r) |
6447 | return r; | 6448 | return r; |
@@ -6625,7 +6626,7 @@ int si_suspend(struct radeon_device *rdev) | |||
6625 | si_cp_enable(rdev, false); | 6626 | si_cp_enable(rdev, false); |
6626 | cayman_dma_stop(rdev); | 6627 | cayman_dma_stop(rdev); |
6627 | if (rdev->has_uvd) { | 6628 | if (rdev->has_uvd) { |
6628 | r600_uvd_rbc_stop(rdev); | 6629 | r600_uvd_stop(rdev); |
6629 | radeon_uvd_suspend(rdev); | 6630 | radeon_uvd_suspend(rdev); |
6630 | } | 6631 | } |
6631 | si_irq_suspend(rdev); | 6632 | si_irq_suspend(rdev); |
@@ -6767,8 +6768,10 @@ void si_fini(struct radeon_device *rdev) | |||
6767 | radeon_vm_manager_fini(rdev); | 6768 | radeon_vm_manager_fini(rdev); |
6768 | radeon_ib_pool_fini(rdev); | 6769 | radeon_ib_pool_fini(rdev); |
6769 | radeon_irq_kms_fini(rdev); | 6770 | radeon_irq_kms_fini(rdev); |
6770 | if (rdev->has_uvd) | 6771 | if (rdev->has_uvd) { |
6772 | r600_uvd_stop(rdev); | ||
6771 | radeon_uvd_fini(rdev); | 6773 | radeon_uvd_fini(rdev); |
6774 | } | ||
6772 | si_pcie_gart_fini(rdev); | 6775 | si_pcie_gart_fini(rdev); |
6773 | r600_vram_scratch_fini(rdev); | 6776 | r600_vram_scratch_fini(rdev); |
6774 | radeon_gem_fini(rdev); | 6777 | radeon_gem_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 73aaa2e4c312..88699e3cd868 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c | |||
@@ -37,8 +37,6 @@ | |||
37 | 37 | ||
38 | #define SMC_RAM_END 0x20000 | 38 | #define SMC_RAM_END 0x20000 |
39 | 39 | ||
40 | #define DDR3_DRAM_ROWS 0x2000 | ||
41 | |||
42 | #define SCLK_MIN_DEEPSLEEP_FREQ 1350 | 40 | #define SCLK_MIN_DEEPSLEEP_FREQ 1350 |
43 | 41 | ||
44 | static const struct si_cac_config_reg cac_weights_tahiti[] = | 42 | static const struct si_cac_config_reg cac_weights_tahiti[] = |
@@ -1767,8 +1765,9 @@ static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coe | |||
1767 | { | 1765 | { |
1768 | s64 kt, kv, leakage_w, i_leakage, vddc; | 1766 | s64 kt, kv, leakage_w, i_leakage, vddc; |
1769 | s64 temperature, t_slope, t_intercept, av, bv, t_ref; | 1767 | s64 temperature, t_slope, t_intercept, av, bv, t_ref; |
1768 | s64 tmp; | ||
1770 | 1769 | ||
1771 | i_leakage = drm_int2fixp(ileakage / 100); | 1770 | i_leakage = div64_s64(drm_int2fixp(ileakage), 100); |
1772 | vddc = div64_s64(drm_int2fixp(v), 1000); | 1771 | vddc = div64_s64(drm_int2fixp(v), 1000); |
1773 | temperature = div64_s64(drm_int2fixp(t), 1000); | 1772 | temperature = div64_s64(drm_int2fixp(t), 1000); |
1774 | 1773 | ||
@@ -1778,8 +1777,9 @@ static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coe | |||
1778 | bv = div64_s64(drm_int2fixp(coeff->bv), 100000000); | 1777 | bv = div64_s64(drm_int2fixp(coeff->bv), 100000000); |
1779 | t_ref = drm_int2fixp(coeff->t_ref); | 1778 | t_ref = drm_int2fixp(coeff->t_ref); |
1780 | 1779 | ||
1781 | kt = drm_fixp_div(drm_fixp_exp(drm_fixp_mul(drm_fixp_mul(t_slope, vddc) + t_intercept, temperature)), | 1780 | tmp = drm_fixp_mul(t_slope, vddc) + t_intercept; |
1782 | drm_fixp_exp(drm_fixp_mul(drm_fixp_mul(t_slope, vddc) + t_intercept, t_ref))); | 1781 | kt = drm_fixp_exp(drm_fixp_mul(tmp, temperature)); |
1782 | kt = drm_fixp_div(kt, drm_fixp_exp(drm_fixp_mul(tmp, t_ref))); | ||
1783 | kv = drm_fixp_mul(av, drm_fixp_exp(drm_fixp_mul(bv, vddc))); | 1783 | kv = drm_fixp_mul(av, drm_fixp_exp(drm_fixp_mul(bv, vddc))); |
1784 | 1784 | ||
1785 | leakage_w = drm_fixp_mul(drm_fixp_mul(drm_fixp_mul(i_leakage, kt), kv), vddc); | 1785 | leakage_w = drm_fixp_mul(drm_fixp_mul(drm_fixp_mul(i_leakage, kt), kv), vddc); |
@@ -1931,6 +1931,7 @@ static void si_initialize_powertune_defaults(struct radeon_device *rdev) | |||
1931 | si_pi->cac_override = cac_override_pitcairn; | 1931 | si_pi->cac_override = cac_override_pitcairn; |
1932 | si_pi->powertune_data = &powertune_data_pitcairn; | 1932 | si_pi->powertune_data = &powertune_data_pitcairn; |
1933 | si_pi->dte_data = dte_data_pitcairn; | 1933 | si_pi->dte_data = dte_data_pitcairn; |
1934 | break; | ||
1934 | } | 1935 | } |
1935 | } else if (rdev->family == CHIP_VERDE) { | 1936 | } else if (rdev->family == CHIP_VERDE) { |
1936 | si_pi->lcac_config = lcac_cape_verde; | 1937 | si_pi->lcac_config = lcac_cape_verde; |
@@ -1941,6 +1942,7 @@ static void si_initialize_powertune_defaults(struct radeon_device *rdev) | |||
1941 | case 0x683B: | 1942 | case 0x683B: |
1942 | case 0x683F: | 1943 | case 0x683F: |
1943 | case 0x6829: | 1944 | case 0x6829: |
1945 | case 0x6835: | ||
1944 | si_pi->cac_weights = cac_weights_cape_verde_pro; | 1946 | si_pi->cac_weights = cac_weights_cape_verde_pro; |
1945 | si_pi->dte_data = dte_data_cape_verde; | 1947 | si_pi->dte_data = dte_data_cape_verde; |
1946 | break; | 1948 | break; |
@@ -2901,7 +2903,8 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, | |||
2901 | { | 2903 | { |
2902 | struct ni_ps *ps = ni_get_ps(rps); | 2904 | struct ni_ps *ps = ni_get_ps(rps); |
2903 | struct radeon_clock_and_voltage_limits *max_limits; | 2905 | struct radeon_clock_and_voltage_limits *max_limits; |
2904 | bool disable_mclk_switching; | 2906 | bool disable_mclk_switching = false; |
2907 | bool disable_sclk_switching = false; | ||
2905 | u32 mclk, sclk; | 2908 | u32 mclk, sclk; |
2906 | u16 vddc, vddci; | 2909 | u16 vddc, vddci; |
2907 | int i; | 2910 | int i; |
@@ -2909,8 +2912,11 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, | |||
2909 | if ((rdev->pm.dpm.new_active_crtc_count > 1) || | 2912 | if ((rdev->pm.dpm.new_active_crtc_count > 1) || |
2910 | ni_dpm_vblank_too_short(rdev)) | 2913 | ni_dpm_vblank_too_short(rdev)) |
2911 | disable_mclk_switching = true; | 2914 | disable_mclk_switching = true; |
2912 | else | 2915 | |
2913 | disable_mclk_switching = false; | 2916 | if (rps->vclk || rps->dclk) { |
2917 | disable_mclk_switching = true; | ||
2918 | disable_sclk_switching = true; | ||
2919 | } | ||
2914 | 2920 | ||
2915 | if (rdev->pm.dpm.ac_power) | 2921 | if (rdev->pm.dpm.ac_power) |
2916 | max_limits = &rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac; | 2922 | max_limits = &rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac; |
@@ -2938,27 +2944,43 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, | |||
2938 | 2944 | ||
2939 | if (disable_mclk_switching) { | 2945 | if (disable_mclk_switching) { |
2940 | mclk = ps->performance_levels[ps->performance_level_count - 1].mclk; | 2946 | mclk = ps->performance_levels[ps->performance_level_count - 1].mclk; |
2941 | sclk = ps->performance_levels[0].sclk; | ||
2942 | vddc = ps->performance_levels[0].vddc; | ||
2943 | vddci = ps->performance_levels[ps->performance_level_count - 1].vddci; | 2947 | vddci = ps->performance_levels[ps->performance_level_count - 1].vddci; |
2944 | } else { | 2948 | } else { |
2945 | sclk = ps->performance_levels[0].sclk; | ||
2946 | mclk = ps->performance_levels[0].mclk; | 2949 | mclk = ps->performance_levels[0].mclk; |
2947 | vddc = ps->performance_levels[0].vddc; | ||
2948 | vddci = ps->performance_levels[0].vddci; | 2950 | vddci = ps->performance_levels[0].vddci; |
2949 | } | 2951 | } |
2950 | 2952 | ||
2953 | if (disable_sclk_switching) { | ||
2954 | sclk = ps->performance_levels[ps->performance_level_count - 1].sclk; | ||
2955 | vddc = ps->performance_levels[ps->performance_level_count - 1].vddc; | ||
2956 | } else { | ||
2957 | sclk = ps->performance_levels[0].sclk; | ||
2958 | vddc = ps->performance_levels[0].vddc; | ||
2959 | } | ||
2960 | |||
2951 | /* adjusted low state */ | 2961 | /* adjusted low state */ |
2952 | ps->performance_levels[0].sclk = sclk; | 2962 | ps->performance_levels[0].sclk = sclk; |
2953 | ps->performance_levels[0].mclk = mclk; | 2963 | ps->performance_levels[0].mclk = mclk; |
2954 | ps->performance_levels[0].vddc = vddc; | 2964 | ps->performance_levels[0].vddc = vddc; |
2955 | ps->performance_levels[0].vddci = vddci; | 2965 | ps->performance_levels[0].vddci = vddci; |
2956 | 2966 | ||
2957 | for (i = 1; i < ps->performance_level_count; i++) { | 2967 | if (disable_sclk_switching) { |
2958 | if (ps->performance_levels[i].sclk < ps->performance_levels[i - 1].sclk) | 2968 | sclk = ps->performance_levels[0].sclk; |
2959 | ps->performance_levels[i].sclk = ps->performance_levels[i - 1].sclk; | 2969 | for (i = 1; i < ps->performance_level_count; i++) { |
2960 | if (ps->performance_levels[i].vddc < ps->performance_levels[i - 1].vddc) | 2970 | if (sclk < ps->performance_levels[i].sclk) |
2961 | ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc; | 2971 | sclk = ps->performance_levels[i].sclk; |
2972 | } | ||
2973 | for (i = 0; i < ps->performance_level_count; i++) { | ||
2974 | ps->performance_levels[i].sclk = sclk; | ||
2975 | ps->performance_levels[i].vddc = vddc; | ||
2976 | } | ||
2977 | } else { | ||
2978 | for (i = 1; i < ps->performance_level_count; i++) { | ||
2979 | if (ps->performance_levels[i].sclk < ps->performance_levels[i - 1].sclk) | ||
2980 | ps->performance_levels[i].sclk = ps->performance_levels[i - 1].sclk; | ||
2981 | if (ps->performance_levels[i].vddc < ps->performance_levels[i - 1].vddc) | ||
2982 | ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc; | ||
2983 | } | ||
2962 | } | 2984 | } |
2963 | 2985 | ||
2964 | if (disable_mclk_switching) { | 2986 | if (disable_mclk_switching) { |
@@ -3237,10 +3259,10 @@ int si_dpm_force_performance_level(struct radeon_device *rdev, | |||
3237 | { | 3259 | { |
3238 | struct radeon_ps *rps = rdev->pm.dpm.current_ps; | 3260 | struct radeon_ps *rps = rdev->pm.dpm.current_ps; |
3239 | struct ni_ps *ps = ni_get_ps(rps); | 3261 | struct ni_ps *ps = ni_get_ps(rps); |
3240 | u32 levels; | 3262 | u32 levels = ps->performance_level_count; |
3241 | 3263 | ||
3242 | if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { | 3264 | if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { |
3243 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK) | 3265 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) |
3244 | return -EINVAL; | 3266 | return -EINVAL; |
3245 | 3267 | ||
3246 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 1) != PPSMC_Result_OK) | 3268 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 1) != PPSMC_Result_OK) |
@@ -3249,14 +3271,13 @@ int si_dpm_force_performance_level(struct radeon_device *rdev, | |||
3249 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) | 3271 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) |
3250 | return -EINVAL; | 3272 | return -EINVAL; |
3251 | 3273 | ||
3252 | levels = ps->performance_level_count - 1; | 3274 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 1) != PPSMC_Result_OK) |
3253 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) | ||
3254 | return -EINVAL; | 3275 | return -EINVAL; |
3255 | } else if (level == RADEON_DPM_FORCED_LEVEL_AUTO) { | 3276 | } else if (level == RADEON_DPM_FORCED_LEVEL_AUTO) { |
3256 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) | 3277 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) |
3257 | return -EINVAL; | 3278 | return -EINVAL; |
3258 | 3279 | ||
3259 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK) | 3280 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) |
3260 | return -EINVAL; | 3281 | return -EINVAL; |
3261 | } | 3282 | } |
3262 | 3283 | ||
@@ -3620,8 +3641,12 @@ static void si_enable_display_gap(struct radeon_device *rdev) | |||
3620 | { | 3641 | { |
3621 | u32 tmp = RREG32(CG_DISPLAY_GAP_CNTL); | 3642 | u32 tmp = RREG32(CG_DISPLAY_GAP_CNTL); |
3622 | 3643 | ||
3644 | tmp &= ~(DISP1_GAP_MASK | DISP2_GAP_MASK); | ||
3645 | tmp |= (DISP1_GAP(R600_PM_DISPLAY_GAP_IGNORE) | | ||
3646 | DISP2_GAP(R600_PM_DISPLAY_GAP_IGNORE)); | ||
3647 | |||
3623 | tmp &= ~(DISP1_GAP_MCHG_MASK | DISP2_GAP_MCHG_MASK); | 3648 | tmp &= ~(DISP1_GAP_MCHG_MASK | DISP2_GAP_MCHG_MASK); |
3624 | tmp |= (DISP1_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE) | | 3649 | tmp |= (DISP1_GAP_MCHG(R600_PM_DISPLAY_GAP_VBLANK) | |
3625 | DISP2_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE)); | 3650 | DISP2_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE)); |
3626 | WREG32(CG_DISPLAY_GAP_CNTL, tmp); | 3651 | WREG32(CG_DISPLAY_GAP_CNTL, tmp); |
3627 | } | 3652 | } |
@@ -4036,16 +4061,15 @@ static int si_force_switch_to_arb_f0(struct radeon_device *rdev) | |||
4036 | static u32 si_calculate_memory_refresh_rate(struct radeon_device *rdev, | 4061 | static u32 si_calculate_memory_refresh_rate(struct radeon_device *rdev, |
4037 | u32 engine_clock) | 4062 | u32 engine_clock) |
4038 | { | 4063 | { |
4039 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | ||
4040 | u32 dram_rows; | 4064 | u32 dram_rows; |
4041 | u32 dram_refresh_rate; | 4065 | u32 dram_refresh_rate; |
4042 | u32 mc_arb_rfsh_rate; | 4066 | u32 mc_arb_rfsh_rate; |
4043 | u32 tmp = (RREG32(MC_ARB_RAMCFG) & NOOFROWS_MASK) >> NOOFROWS_SHIFT; | 4067 | u32 tmp = (RREG32(MC_ARB_RAMCFG) & NOOFROWS_MASK) >> NOOFROWS_SHIFT; |
4044 | 4068 | ||
4045 | if (pi->mem_gddr5) | 4069 | if (tmp >= 4) |
4046 | dram_rows = 1 << (tmp + 10); | 4070 | dram_rows = 16384; |
4047 | else | 4071 | else |
4048 | dram_rows = DDR3_DRAM_ROWS; | 4072 | dram_rows = 1 << (tmp + 10); |
4049 | 4073 | ||
4050 | dram_refresh_rate = 1 << ((RREG32(MC_SEQ_MISC0) & 0x3) + 3); | 4074 | dram_refresh_rate = 1 << ((RREG32(MC_SEQ_MISC0) & 0x3) + 3); |
4051 | mc_arb_rfsh_rate = ((engine_clock * 10) * dram_refresh_rate / dram_rows - 32) / 64; | 4075 | mc_arb_rfsh_rate = ((engine_clock * 10) * dram_refresh_rate / dram_rows - 32) / 64; |
@@ -6013,16 +6037,11 @@ int si_dpm_set_power_state(struct radeon_device *rdev) | |||
6013 | return ret; | 6037 | return ret; |
6014 | } | 6038 | } |
6015 | 6039 | ||
6016 | #if 0 | ||
6017 | /* XXX */ | ||
6018 | ret = si_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO); | 6040 | ret = si_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO); |
6019 | if (ret) { | 6041 | if (ret) { |
6020 | DRM_ERROR("si_dpm_force_performance_level failed\n"); | 6042 | DRM_ERROR("si_dpm_force_performance_level failed\n"); |
6021 | return ret; | 6043 | return ret; |
6022 | } | 6044 | } |
6023 | #else | ||
6024 | rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO; | ||
6025 | #endif | ||
6026 | 6045 | ||
6027 | return 0; | 6046 | return 0; |
6028 | } | 6047 | } |
@@ -6254,9 +6273,6 @@ int si_dpm_init(struct radeon_device *rdev) | |||
6254 | struct evergreen_power_info *eg_pi; | 6273 | struct evergreen_power_info *eg_pi; |
6255 | struct ni_power_info *ni_pi; | 6274 | struct ni_power_info *ni_pi; |
6256 | struct si_power_info *si_pi; | 6275 | struct si_power_info *si_pi; |
6257 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
6258 | u16 data_offset, size; | ||
6259 | u8 frev, crev; | ||
6260 | struct atom_clock_dividers dividers; | 6276 | struct atom_clock_dividers dividers; |
6261 | int ret; | 6277 | int ret; |
6262 | u32 mask; | 6278 | u32 mask; |
@@ -6347,16 +6363,7 @@ int si_dpm_init(struct radeon_device *rdev) | |||
6347 | si_pi->vddc_phase_shed_control = | 6363 | si_pi->vddc_phase_shed_control = |
6348 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, VOLTAGE_OBJ_PHASE_LUT); | 6364 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, VOLTAGE_OBJ_PHASE_LUT); |
6349 | 6365 | ||
6350 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 6366 | rv770_get_engine_memory_ss(rdev); |
6351 | &frev, &crev, &data_offset)) { | ||
6352 | pi->sclk_ss = true; | ||
6353 | pi->mclk_ss = true; | ||
6354 | pi->dynamic_ss = true; | ||
6355 | } else { | ||
6356 | pi->sclk_ss = false; | ||
6357 | pi->mclk_ss = false; | ||
6358 | pi->dynamic_ss = true; | ||
6359 | } | ||
6360 | 6367 | ||
6361 | pi->asi = RV770_ASI_DFLT; | 6368 | pi->asi = RV770_ASI_DFLT; |
6362 | pi->pasi = CYPRESS_HASI_DFLT; | 6369 | pi->pasi = CYPRESS_HASI_DFLT; |
@@ -6367,8 +6374,7 @@ int si_dpm_init(struct radeon_device *rdev) | |||
6367 | eg_pi->sclk_deep_sleep = true; | 6374 | eg_pi->sclk_deep_sleep = true; |
6368 | si_pi->sclk_deep_sleep_above_low = false; | 6375 | si_pi->sclk_deep_sleep_above_low = false; |
6369 | 6376 | ||
6370 | if (pi->gfx_clock_gating && | 6377 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
6371 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
6372 | pi->thermal_protection = true; | 6378 | pi->thermal_protection = true; |
6373 | else | 6379 | else |
6374 | pi->thermal_protection = false; | 6380 | pi->thermal_protection = false; |
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 5207591a598c..cd33084c7860 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c | |||
@@ -192,6 +192,7 @@ static struct hid_ll_driver logi_dj_ll_driver; | |||
192 | static int logi_dj_output_hidraw_report(struct hid_device *hid, u8 * buf, | 192 | static int logi_dj_output_hidraw_report(struct hid_device *hid, u8 * buf, |
193 | size_t count, | 193 | size_t count, |
194 | unsigned char report_type); | 194 | unsigned char report_type); |
195 | static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev); | ||
195 | 196 | ||
196 | static void logi_dj_recv_destroy_djhid_device(struct dj_receiver_dev *djrcv_dev, | 197 | static void logi_dj_recv_destroy_djhid_device(struct dj_receiver_dev *djrcv_dev, |
197 | struct dj_report *dj_report) | 198 | struct dj_report *dj_report) |
@@ -232,6 +233,7 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, | |||
232 | if (dj_report->report_params[DEVICE_PAIRED_PARAM_SPFUNCTION] & | 233 | if (dj_report->report_params[DEVICE_PAIRED_PARAM_SPFUNCTION] & |
233 | SPFUNCTION_DEVICE_LIST_EMPTY) { | 234 | SPFUNCTION_DEVICE_LIST_EMPTY) { |
234 | dbg_hid("%s: device list is empty\n", __func__); | 235 | dbg_hid("%s: device list is empty\n", __func__); |
236 | djrcv_dev->querying_devices = false; | ||
235 | return; | 237 | return; |
236 | } | 238 | } |
237 | 239 | ||
@@ -242,6 +244,12 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, | |||
242 | return; | 244 | return; |
243 | } | 245 | } |
244 | 246 | ||
247 | if (djrcv_dev->paired_dj_devices[dj_report->device_index]) { | ||
248 | /* The device is already known. No need to reallocate it. */ | ||
249 | dbg_hid("%s: device is already known\n", __func__); | ||
250 | return; | ||
251 | } | ||
252 | |||
245 | dj_hiddev = hid_allocate_device(); | 253 | dj_hiddev = hid_allocate_device(); |
246 | if (IS_ERR(dj_hiddev)) { | 254 | if (IS_ERR(dj_hiddev)) { |
247 | dev_err(&djrcv_hdev->dev, "%s: hid_allocate_device failed\n", | 255 | dev_err(&djrcv_hdev->dev, "%s: hid_allocate_device failed\n", |
@@ -305,6 +313,7 @@ static void delayedwork_callback(struct work_struct *work) | |||
305 | struct dj_report dj_report; | 313 | struct dj_report dj_report; |
306 | unsigned long flags; | 314 | unsigned long flags; |
307 | int count; | 315 | int count; |
316 | int retval; | ||
308 | 317 | ||
309 | dbg_hid("%s\n", __func__); | 318 | dbg_hid("%s\n", __func__); |
310 | 319 | ||
@@ -337,6 +346,25 @@ static void delayedwork_callback(struct work_struct *work) | |||
337 | logi_dj_recv_destroy_djhid_device(djrcv_dev, &dj_report); | 346 | logi_dj_recv_destroy_djhid_device(djrcv_dev, &dj_report); |
338 | break; | 347 | break; |
339 | default: | 348 | default: |
349 | /* A normal report (i. e. not belonging to a pair/unpair notification) | ||
350 | * arriving here, means that the report arrived but we did not have a | ||
351 | * paired dj_device associated to the report's device_index, this | ||
352 | * means that the original "device paired" notification corresponding | ||
353 | * to this dj_device never arrived to this driver. The reason is that | ||
354 | * hid-core discards all packets coming from a device while probe() is | ||
355 | * executing. */ | ||
356 | if (!djrcv_dev->paired_dj_devices[dj_report.device_index]) { | ||
357 | /* ok, we don't know the device, just re-ask the | ||
358 | * receiver for the list of connected devices. */ | ||
359 | retval = logi_dj_recv_query_paired_devices(djrcv_dev); | ||
360 | if (!retval) { | ||
361 | /* everything went fine, so just leave */ | ||
362 | break; | ||
363 | } | ||
364 | dev_err(&djrcv_dev->hdev->dev, | ||
365 | "%s:logi_dj_recv_query_paired_devices " | ||
366 | "error:%d\n", __func__, retval); | ||
367 | } | ||
340 | dbg_hid("%s: unexpected report type\n", __func__); | 368 | dbg_hid("%s: unexpected report type\n", __func__); |
341 | } | 369 | } |
342 | } | 370 | } |
@@ -367,6 +395,12 @@ static void logi_dj_recv_forward_null_report(struct dj_receiver_dev *djrcv_dev, | |||
367 | if (!djdev) { | 395 | if (!djdev) { |
368 | dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]" | 396 | dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]" |
369 | " is NULL, index %d\n", dj_report->device_index); | 397 | " is NULL, index %d\n", dj_report->device_index); |
398 | kfifo_in(&djrcv_dev->notif_fifo, dj_report, sizeof(struct dj_report)); | ||
399 | |||
400 | if (schedule_work(&djrcv_dev->work) == 0) { | ||
401 | dbg_hid("%s: did not schedule the work item, was already " | ||
402 | "queued\n", __func__); | ||
403 | } | ||
370 | return; | 404 | return; |
371 | } | 405 | } |
372 | 406 | ||
@@ -397,6 +431,12 @@ static void logi_dj_recv_forward_report(struct dj_receiver_dev *djrcv_dev, | |||
397 | if (dj_device == NULL) { | 431 | if (dj_device == NULL) { |
398 | dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]" | 432 | dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]" |
399 | " is NULL, index %d\n", dj_report->device_index); | 433 | " is NULL, index %d\n", dj_report->device_index); |
434 | kfifo_in(&djrcv_dev->notif_fifo, dj_report, sizeof(struct dj_report)); | ||
435 | |||
436 | if (schedule_work(&djrcv_dev->work) == 0) { | ||
437 | dbg_hid("%s: did not schedule the work item, was already " | ||
438 | "queued\n", __func__); | ||
439 | } | ||
400 | return; | 440 | return; |
401 | } | 441 | } |
402 | 442 | ||
@@ -444,6 +484,10 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) | |||
444 | struct dj_report *dj_report; | 484 | struct dj_report *dj_report; |
445 | int retval; | 485 | int retval; |
446 | 486 | ||
487 | /* no need to protect djrcv_dev->querying_devices */ | ||
488 | if (djrcv_dev->querying_devices) | ||
489 | return 0; | ||
490 | |||
447 | dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); | 491 | dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); |
448 | if (!dj_report) | 492 | if (!dj_report) |
449 | return -ENOMEM; | 493 | return -ENOMEM; |
@@ -455,6 +499,7 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) | |||
455 | return retval; | 499 | return retval; |
456 | } | 500 | } |
457 | 501 | ||
502 | |||
458 | static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, | 503 | static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, |
459 | unsigned timeout) | 504 | unsigned timeout) |
460 | { | 505 | { |
diff --git a/drivers/hid/hid-logitech-dj.h b/drivers/hid/hid-logitech-dj.h index fd28a5e0ca3b..4a4000340ce1 100644 --- a/drivers/hid/hid-logitech-dj.h +++ b/drivers/hid/hid-logitech-dj.h | |||
@@ -101,6 +101,7 @@ struct dj_receiver_dev { | |||
101 | struct work_struct work; | 101 | struct work_struct work; |
102 | struct kfifo notif_fifo; | 102 | struct kfifo notif_fifo; |
103 | spinlock_t lock; | 103 | spinlock_t lock; |
104 | bool querying_devices; | ||
104 | }; | 105 | }; |
105 | 106 | ||
106 | struct dj_device { | 107 | struct dj_device { |
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index ecbc74923d06..87fbe2924cfa 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c | |||
@@ -369,7 +369,8 @@ static int sony_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
369 | if (sc->quirks & PS3REMOTE) | 369 | if (sc->quirks & PS3REMOTE) |
370 | return ps3remote_mapping(hdev, hi, field, usage, bit, max); | 370 | return ps3remote_mapping(hdev, hi, field, usage, bit, max); |
371 | 371 | ||
372 | return -1; | 372 | /* Let hid-core decide for the others */ |
373 | return 0; | ||
373 | } | 374 | } |
374 | 375 | ||
375 | /* | 376 | /* |
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index a7451632ceb4..6f1feb2c2e97 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -518,7 +518,6 @@ int hidraw_connect(struct hid_device *hid) | |||
518 | goto out; | 518 | goto out; |
519 | } | 519 | } |
520 | 520 | ||
521 | mutex_unlock(&minors_lock); | ||
522 | init_waitqueue_head(&dev->wait); | 521 | init_waitqueue_head(&dev->wait); |
523 | INIT_LIST_HEAD(&dev->list); | 522 | INIT_LIST_HEAD(&dev->list); |
524 | 523 | ||
@@ -528,6 +527,7 @@ int hidraw_connect(struct hid_device *hid) | |||
528 | dev->exist = 1; | 527 | dev->exist = 1; |
529 | hid->hidraw = dev; | 528 | hid->hidraw = dev; |
530 | 529 | ||
530 | mutex_unlock(&minors_lock); | ||
531 | out: | 531 | out: |
532 | return result; | 532 | return result; |
533 | 533 | ||
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c index 0f34bca9f5e5..6099f50b28aa 100644 --- a/drivers/hwmon/adt7470.c +++ b/drivers/hwmon/adt7470.c | |||
@@ -215,7 +215,7 @@ static inline int adt7470_write_word_data(struct i2c_client *client, u8 reg, | |||
215 | u16 value) | 215 | u16 value) |
216 | { | 216 | { |
217 | return i2c_smbus_write_byte_data(client, reg, value & 0xFF) | 217 | return i2c_smbus_write_byte_data(client, reg, value & 0xFF) |
218 | && i2c_smbus_write_byte_data(client, reg + 1, value >> 8); | 218 | || i2c_smbus_write_byte_data(client, reg + 1, value >> 8); |
219 | } | 219 | } |
220 | 220 | ||
221 | static void adt7470_init_client(struct i2c_client *client) | 221 | static void adt7470_init_client(struct i2c_client *client) |
diff --git a/drivers/hwmon/max6697.c b/drivers/hwmon/max6697.c index 328fb0353c17..a41b5f3fc506 100644 --- a/drivers/hwmon/max6697.c +++ b/drivers/hwmon/max6697.c | |||
@@ -605,12 +605,12 @@ static int max6697_init_chip(struct i2c_client *client) | |||
605 | if (ret < 0) | 605 | if (ret < 0) |
606 | return ret; | 606 | return ret; |
607 | ret = i2c_smbus_write_byte_data(client, MAX6581_REG_IDEALITY, | 607 | ret = i2c_smbus_write_byte_data(client, MAX6581_REG_IDEALITY, |
608 | pdata->ideality_mask >> 1); | 608 | pdata->ideality_value); |
609 | if (ret < 0) | 609 | if (ret < 0) |
610 | return ret; | 610 | return ret; |
611 | ret = i2c_smbus_write_byte_data(client, | 611 | ret = i2c_smbus_write_byte_data(client, |
612 | MAX6581_REG_IDEALITY_SELECT, | 612 | MAX6581_REG_IDEALITY_SELECT, |
613 | pdata->ideality_value); | 613 | pdata->ideality_mask >> 1); |
614 | if (ret < 0) | 614 | if (ret < 0) |
615 | return ret; | 615 | return ret; |
616 | } | 616 | } |
diff --git a/drivers/i2c/busses/i2c-kempld.c b/drivers/i2c/busses/i2c-kempld.c index ccec916bc3eb..af8f65fb1c05 100644 --- a/drivers/i2c/busses/i2c-kempld.c +++ b/drivers/i2c/busses/i2c-kempld.c | |||
@@ -246,9 +246,9 @@ static void kempld_i2c_device_init(struct kempld_i2c_data *i2c) | |||
246 | bus_frequency = KEMPLD_I2C_FREQ_MAX; | 246 | bus_frequency = KEMPLD_I2C_FREQ_MAX; |
247 | 247 | ||
248 | if (pld->info.spec_major == 1) | 248 | if (pld->info.spec_major == 1) |
249 | prescale = pld->pld_clock / bus_frequency * 5 - 1000; | 249 | prescale = pld->pld_clock / (bus_frequency * 5) - 1000; |
250 | else | 250 | else |
251 | prescale = pld->pld_clock / bus_frequency * 4 - 3000; | 251 | prescale = pld->pld_clock / (bus_frequency * 4) - 3000; |
252 | 252 | ||
253 | if (prescale < 0) | 253 | if (prescale < 0) |
254 | prescale = 0; | 254 | prescale = 0; |
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index df8ff5aea5b5..e2e9a0dade96 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
@@ -493,7 +493,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
493 | * based on this empirical measurement and a lot of previous frobbing. | 493 | * based on this empirical measurement and a lot of previous frobbing. |
494 | */ | 494 | */ |
495 | i2c->cmd_err = 0; | 495 | i2c->cmd_err = 0; |
496 | if (msg->len < 8) { | 496 | if (0) { /* disable PIO mode until a proper fix is made */ |
497 | ret = mxs_i2c_pio_setup_xfer(adap, msg, flags); | 497 | ret = mxs_i2c_pio_setup_xfer(adap, msg, flags); |
498 | if (ret) | 498 | if (ret) |
499 | mxs_i2c_reset(i2c); | 499 | mxs_i2c_reset(i2c); |
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index 0ad208a69c29..3ceac3e91dde 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c | |||
@@ -60,7 +60,6 @@ static void tiadc_step_config(struct tiadc_device *adc_dev) | |||
60 | { | 60 | { |
61 | unsigned int stepconfig; | 61 | unsigned int stepconfig; |
62 | int i, steps; | 62 | int i, steps; |
63 | u32 step_en; | ||
64 | 63 | ||
65 | /* | 64 | /* |
66 | * There are 16 configurable steps and 8 analog input | 65 | * There are 16 configurable steps and 8 analog input |
@@ -86,8 +85,7 @@ static void tiadc_step_config(struct tiadc_device *adc_dev) | |||
86 | adc_dev->channel_step[i] = steps; | 85 | adc_dev->channel_step[i] = steps; |
87 | steps++; | 86 | steps++; |
88 | } | 87 | } |
89 | step_en = get_adc_step_mask(adc_dev); | 88 | |
90 | am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en); | ||
91 | } | 89 | } |
92 | 90 | ||
93 | static const char * const chan_name_ain[] = { | 91 | static const char * const chan_name_ain[] = { |
@@ -142,10 +140,22 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, | |||
142 | int *val, int *val2, long mask) | 140 | int *val, int *val2, long mask) |
143 | { | 141 | { |
144 | struct tiadc_device *adc_dev = iio_priv(indio_dev); | 142 | struct tiadc_device *adc_dev = iio_priv(indio_dev); |
145 | int i; | 143 | int i, map_val; |
146 | unsigned int fifo1count, read; | 144 | unsigned int fifo1count, read, stepid; |
147 | u32 step = UINT_MAX; | 145 | u32 step = UINT_MAX; |
148 | bool found = false; | 146 | bool found = false; |
147 | u32 step_en; | ||
148 | unsigned long timeout = jiffies + usecs_to_jiffies | ||
149 | (IDLE_TIMEOUT * adc_dev->channels); | ||
150 | step_en = get_adc_step_mask(adc_dev); | ||
151 | am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en); | ||
152 | |||
153 | /* Wait for ADC sequencer to complete sampling */ | ||
154 | while (tiadc_readl(adc_dev, REG_ADCFSM) & SEQ_STATUS) { | ||
155 | if (time_after(jiffies, timeout)) | ||
156 | return -EAGAIN; | ||
157 | } | ||
158 | map_val = chan->channel + TOTAL_CHANNELS; | ||
149 | 159 | ||
150 | /* | 160 | /* |
151 | * When the sub-system is first enabled, | 161 | * When the sub-system is first enabled, |
@@ -170,12 +180,16 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, | |||
170 | fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); | 180 | fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); |
171 | for (i = 0; i < fifo1count; i++) { | 181 | for (i = 0; i < fifo1count; i++) { |
172 | read = tiadc_readl(adc_dev, REG_FIFO1); | 182 | read = tiadc_readl(adc_dev, REG_FIFO1); |
173 | if (read >> 16 == step) { | 183 | stepid = read & FIFOREAD_CHNLID_MASK; |
174 | *val = read & 0xfff; | 184 | stepid = stepid >> 0x10; |
185 | |||
186 | if (stepid == map_val) { | ||
187 | read = read & FIFOREAD_DATA_MASK; | ||
175 | found = true; | 188 | found = true; |
189 | *val = read; | ||
176 | } | 190 | } |
177 | } | 191 | } |
178 | am335x_tsc_se_update(adc_dev->mfd_tscadc); | 192 | |
179 | if (found == false) | 193 | if (found == false) |
180 | return -EBUSY; | 194 | return -EBUSY; |
181 | return IIO_VAL_INT; | 195 | return IIO_VAL_INT; |
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index ea8a4146620d..0dd9bb873130 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c | |||
@@ -127,12 +127,17 @@ static struct iio_trigger *iio_trigger_find_by_name(const char *name, | |||
127 | void iio_trigger_poll(struct iio_trigger *trig, s64 time) | 127 | void iio_trigger_poll(struct iio_trigger *trig, s64 time) |
128 | { | 128 | { |
129 | int i; | 129 | int i; |
130 | if (!trig->use_count) | 130 | |
131 | for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) | 131 | if (!atomic_read(&trig->use_count)) { |
132 | if (trig->subirqs[i].enabled) { | 132 | atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER); |
133 | trig->use_count++; | 133 | |
134 | for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { | ||
135 | if (trig->subirqs[i].enabled) | ||
134 | generic_handle_irq(trig->subirq_base + i); | 136 | generic_handle_irq(trig->subirq_base + i); |
135 | } | 137 | else |
138 | iio_trigger_notify_done(trig); | ||
139 | } | ||
140 | } | ||
136 | } | 141 | } |
137 | EXPORT_SYMBOL(iio_trigger_poll); | 142 | EXPORT_SYMBOL(iio_trigger_poll); |
138 | 143 | ||
@@ -146,19 +151,24 @@ EXPORT_SYMBOL(iio_trigger_generic_data_rdy_poll); | |||
146 | void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time) | 151 | void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time) |
147 | { | 152 | { |
148 | int i; | 153 | int i; |
149 | if (!trig->use_count) | 154 | |
150 | for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) | 155 | if (!atomic_read(&trig->use_count)) { |
151 | if (trig->subirqs[i].enabled) { | 156 | atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER); |
152 | trig->use_count++; | 157 | |
158 | for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { | ||
159 | if (trig->subirqs[i].enabled) | ||
153 | handle_nested_irq(trig->subirq_base + i); | 160 | handle_nested_irq(trig->subirq_base + i); |
154 | } | 161 | else |
162 | iio_trigger_notify_done(trig); | ||
163 | } | ||
164 | } | ||
155 | } | 165 | } |
156 | EXPORT_SYMBOL(iio_trigger_poll_chained); | 166 | EXPORT_SYMBOL(iio_trigger_poll_chained); |
157 | 167 | ||
158 | void iio_trigger_notify_done(struct iio_trigger *trig) | 168 | void iio_trigger_notify_done(struct iio_trigger *trig) |
159 | { | 169 | { |
160 | trig->use_count--; | 170 | if (atomic_dec_and_test(&trig->use_count) && trig->ops && |
161 | if (trig->use_count == 0 && trig->ops && trig->ops->try_reenable) | 171 | trig->ops->try_reenable) |
162 | if (trig->ops->try_reenable(trig)) | 172 | if (trig->ops->try_reenable(trig)) |
163 | /* Missed an interrupt so launch new poll now */ | 173 | /* Missed an interrupt so launch new poll now */ |
164 | iio_trigger_poll(trig, 0); | 174 | iio_trigger_poll(trig, 0); |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index f1c279fabe64..7c0f9535fb7d 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -423,7 +423,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) | |||
423 | struct sockaddr_ib *addr; | 423 | struct sockaddr_ib *addr; |
424 | union ib_gid gid, sgid, *dgid; | 424 | union ib_gid gid, sgid, *dgid; |
425 | u16 pkey, index; | 425 | u16 pkey, index; |
426 | u8 port, p; | 426 | u8 p; |
427 | int i; | 427 | int i; |
428 | 428 | ||
429 | cma_dev = NULL; | 429 | cma_dev = NULL; |
@@ -443,7 +443,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) | |||
443 | if (!memcmp(&gid, dgid, sizeof(gid))) { | 443 | if (!memcmp(&gid, dgid, sizeof(gid))) { |
444 | cma_dev = cur_dev; | 444 | cma_dev = cur_dev; |
445 | sgid = gid; | 445 | sgid = gid; |
446 | port = p; | 446 | id_priv->id.port_num = p; |
447 | goto found; | 447 | goto found; |
448 | } | 448 | } |
449 | 449 | ||
@@ -451,7 +451,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) | |||
451 | dgid->global.subnet_prefix)) { | 451 | dgid->global.subnet_prefix)) { |
452 | cma_dev = cur_dev; | 452 | cma_dev = cur_dev; |
453 | sgid = gid; | 453 | sgid = gid; |
454 | port = p; | 454 | id_priv->id.port_num = p; |
455 | } | 455 | } |
456 | } | 456 | } |
457 | } | 457 | } |
@@ -462,7 +462,6 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) | |||
462 | 462 | ||
463 | found: | 463 | found: |
464 | cma_attach_to_dev(id_priv, cma_dev); | 464 | cma_attach_to_dev(id_priv, cma_dev); |
465 | id_priv->id.port_num = port; | ||
466 | addr = (struct sockaddr_ib *) cma_src_addr(id_priv); | 465 | addr = (struct sockaddr_ib *) cma_src_addr(id_priv); |
467 | memcpy(&addr->sib_addr, &sgid, sizeof sgid); | 466 | memcpy(&addr->sib_addr, &sgid, sizeof sgid); |
468 | cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr); | 467 | cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr); |
@@ -880,7 +879,8 @@ static int cma_save_net_info(struct rdma_cm_id *id, struct rdma_cm_id *listen_id | |||
880 | { | 879 | { |
881 | struct cma_hdr *hdr; | 880 | struct cma_hdr *hdr; |
882 | 881 | ||
883 | if (listen_id->route.addr.src_addr.ss_family == AF_IB) { | 882 | if ((listen_id->route.addr.src_addr.ss_family == AF_IB) && |
883 | (ib_event->event == IB_CM_REQ_RECEIVED)) { | ||
884 | cma_save_ib_info(id, listen_id, ib_event->param.req_rcvd.primary_path); | 884 | cma_save_ib_info(id, listen_id, ib_event->param.req_rcvd.primary_path); |
885 | return 0; | 885 | return 0; |
886 | } | 886 | } |
@@ -2677,29 +2677,32 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv, | |||
2677 | { | 2677 | { |
2678 | struct ib_cm_sidr_req_param req; | 2678 | struct ib_cm_sidr_req_param req; |
2679 | struct ib_cm_id *id; | 2679 | struct ib_cm_id *id; |
2680 | void *private_data; | ||
2680 | int offset, ret; | 2681 | int offset, ret; |
2681 | 2682 | ||
2683 | memset(&req, 0, sizeof req); | ||
2682 | offset = cma_user_data_offset(id_priv); | 2684 | offset = cma_user_data_offset(id_priv); |
2683 | req.private_data_len = offset + conn_param->private_data_len; | 2685 | req.private_data_len = offset + conn_param->private_data_len; |
2684 | if (req.private_data_len < conn_param->private_data_len) | 2686 | if (req.private_data_len < conn_param->private_data_len) |
2685 | return -EINVAL; | 2687 | return -EINVAL; |
2686 | 2688 | ||
2687 | if (req.private_data_len) { | 2689 | if (req.private_data_len) { |
2688 | req.private_data = kzalloc(req.private_data_len, GFP_ATOMIC); | 2690 | private_data = kzalloc(req.private_data_len, GFP_ATOMIC); |
2689 | if (!req.private_data) | 2691 | if (!private_data) |
2690 | return -ENOMEM; | 2692 | return -ENOMEM; |
2691 | } else { | 2693 | } else { |
2692 | req.private_data = NULL; | 2694 | private_data = NULL; |
2693 | } | 2695 | } |
2694 | 2696 | ||
2695 | if (conn_param->private_data && conn_param->private_data_len) | 2697 | if (conn_param->private_data && conn_param->private_data_len) |
2696 | memcpy((void *) req.private_data + offset, | 2698 | memcpy(private_data + offset, conn_param->private_data, |
2697 | conn_param->private_data, conn_param->private_data_len); | 2699 | conn_param->private_data_len); |
2698 | 2700 | ||
2699 | if (req.private_data) { | 2701 | if (private_data) { |
2700 | ret = cma_format_hdr((void *) req.private_data, id_priv); | 2702 | ret = cma_format_hdr(private_data, id_priv); |
2701 | if (ret) | 2703 | if (ret) |
2702 | goto out; | 2704 | goto out; |
2705 | req.private_data = private_data; | ||
2703 | } | 2706 | } |
2704 | 2707 | ||
2705 | id = ib_create_cm_id(id_priv->id.device, cma_sidr_rep_handler, | 2708 | id = ib_create_cm_id(id_priv->id.device, cma_sidr_rep_handler, |
@@ -2721,7 +2724,7 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv, | |||
2721 | id_priv->cm_id.ib = NULL; | 2724 | id_priv->cm_id.ib = NULL; |
2722 | } | 2725 | } |
2723 | out: | 2726 | out: |
2724 | kfree(req.private_data); | 2727 | kfree(private_data); |
2725 | return ret; | 2728 | return ret; |
2726 | } | 2729 | } |
2727 | 2730 | ||
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index dc3fd1e8af07..4c837e66516b 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -2663,6 +2663,7 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv) | |||
2663 | int ret, i; | 2663 | int ret, i; |
2664 | struct ib_qp_attr *attr; | 2664 | struct ib_qp_attr *attr; |
2665 | struct ib_qp *qp; | 2665 | struct ib_qp *qp; |
2666 | u16 pkey_index; | ||
2666 | 2667 | ||
2667 | attr = kmalloc(sizeof *attr, GFP_KERNEL); | 2668 | attr = kmalloc(sizeof *attr, GFP_KERNEL); |
2668 | if (!attr) { | 2669 | if (!attr) { |
@@ -2670,6 +2671,11 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv) | |||
2670 | return -ENOMEM; | 2671 | return -ENOMEM; |
2671 | } | 2672 | } |
2672 | 2673 | ||
2674 | ret = ib_find_pkey(port_priv->device, port_priv->port_num, | ||
2675 | IB_DEFAULT_PKEY_FULL, &pkey_index); | ||
2676 | if (ret) | ||
2677 | pkey_index = 0; | ||
2678 | |||
2673 | for (i = 0; i < IB_MAD_QPS_CORE; i++) { | 2679 | for (i = 0; i < IB_MAD_QPS_CORE; i++) { |
2674 | qp = port_priv->qp_info[i].qp; | 2680 | qp = port_priv->qp_info[i].qp; |
2675 | if (!qp) | 2681 | if (!qp) |
@@ -2680,7 +2686,7 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv) | |||
2680 | * one is needed for the Reset to Init transition | 2686 | * one is needed for the Reset to Init transition |
2681 | */ | 2687 | */ |
2682 | attr->qp_state = IB_QPS_INIT; | 2688 | attr->qp_state = IB_QPS_INIT; |
2683 | attr->pkey_index = 0; | 2689 | attr->pkey_index = pkey_index; |
2684 | attr->qkey = (qp->qp_num == 0) ? 0 : IB_QP1_QKEY; | 2690 | attr->qkey = (qp->qp_num == 0) ? 0 : IB_QP1_QKEY; |
2685 | ret = ib_modify_qp(qp, attr, IB_QP_STATE | | 2691 | ret = ib_modify_qp(qp, attr, IB_QP_STATE | |
2686 | IB_QP_PKEY_INDEX | IB_QP_QKEY); | 2692 | IB_QP_PKEY_INDEX | IB_QP_QKEY); |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index e87f2201b220..d2283837d451 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c | |||
@@ -226,6 +226,7 @@ static struct ib_cq *iwch_create_cq(struct ib_device *ibdev, int entries, int ve | |||
226 | mm->len = PAGE_ALIGN(((1UL << uresp.size_log2) + 1) * | 226 | mm->len = PAGE_ALIGN(((1UL << uresp.size_log2) + 1) * |
227 | sizeof(struct t3_cqe)); | 227 | sizeof(struct t3_cqe)); |
228 | uresp.memsize = mm->len; | 228 | uresp.memsize = mm->len; |
229 | uresp.reserved = 0; | ||
229 | resplen = sizeof uresp; | 230 | resplen = sizeof uresp; |
230 | } | 231 | } |
231 | if (ib_copy_to_udata(udata, &uresp, resplen)) { | 232 | if (ib_copy_to_udata(udata, &uresp, resplen)) { |
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index 232040447e8a..a4975e1654a6 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
@@ -1657,6 +1657,8 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, | |||
1657 | if (mm5) { | 1657 | if (mm5) { |
1658 | uresp.ma_sync_key = ucontext->key; | 1658 | uresp.ma_sync_key = ucontext->key; |
1659 | ucontext->key += PAGE_SIZE; | 1659 | ucontext->key += PAGE_SIZE; |
1660 | } else { | ||
1661 | uresp.ma_sync_key = 0; | ||
1660 | } | 1662 | } |
1661 | uresp.sq_key = ucontext->key; | 1663 | uresp.sq_key = ucontext->key; |
1662 | ucontext->key += PAGE_SIZE; | 1664 | ucontext->key += PAGE_SIZE; |
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 4d599cedbb0b..f2a3f48107e7 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
@@ -1511,8 +1511,14 @@ static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx, | |||
1511 | 1511 | ||
1512 | memset(&attr, 0, sizeof attr); | 1512 | memset(&attr, 0, sizeof attr); |
1513 | attr.qp_state = IB_QPS_INIT; | 1513 | attr.qp_state = IB_QPS_INIT; |
1514 | attr.pkey_index = | 1514 | ret = 0; |
1515 | to_mdev(ctx->ib_dev)->pkeys.virt2phys_pkey[ctx->slave][ctx->port - 1][0]; | 1515 | if (create_tun) |
1516 | ret = find_slave_port_pkey_ix(to_mdev(ctx->ib_dev), ctx->slave, | ||
1517 | ctx->port, IB_DEFAULT_PKEY_FULL, | ||
1518 | &attr.pkey_index); | ||
1519 | if (ret || !create_tun) | ||
1520 | attr.pkey_index = | ||
1521 | to_mdev(ctx->ib_dev)->pkeys.virt2phys_pkey[ctx->slave][ctx->port - 1][0]; | ||
1516 | attr.qkey = IB_QP1_QKEY; | 1522 | attr.qkey = IB_QP1_QKEY; |
1517 | attr.port_num = ctx->port; | 1523 | attr.port_num = ctx->port; |
1518 | ret = ib_modify_qp(tun_qp->qp, &attr, qp_attr_mask_INIT); | 1524 | ret = ib_modify_qp(tun_qp->qp, &attr, qp_attr_mask_INIT); |
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 8000fff4d444..3f831de9a4d8 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
@@ -619,7 +619,8 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, | |||
619 | 619 | ||
620 | resp.tot_uuars = req.total_num_uuars; | 620 | resp.tot_uuars = req.total_num_uuars; |
621 | resp.num_ports = dev->mdev.caps.num_ports; | 621 | resp.num_ports = dev->mdev.caps.num_ports; |
622 | err = ib_copy_to_udata(udata, &resp, sizeof(resp)); | 622 | err = ib_copy_to_udata(udata, &resp, |
623 | sizeof(resp) - sizeof(resp.reserved)); | ||
623 | if (err) | 624 | if (err) |
624 | goto out_uars; | 625 | goto out_uars; |
625 | 626 | ||
@@ -1426,7 +1427,8 @@ static int init_one(struct pci_dev *pdev, | |||
1426 | if (err) | 1427 | if (err) |
1427 | goto err_eqs; | 1428 | goto err_eqs; |
1428 | 1429 | ||
1429 | if (ib_register_device(&dev->ib_dev, NULL)) | 1430 | err = ib_register_device(&dev->ib_dev, NULL); |
1431 | if (err) | ||
1430 | goto err_rsrc; | 1432 | goto err_rsrc; |
1431 | 1433 | ||
1432 | err = create_umr_res(dev); | 1434 | err = create_umr_res(dev); |
@@ -1434,8 +1436,9 @@ static int init_one(struct pci_dev *pdev, | |||
1434 | goto err_dev; | 1436 | goto err_dev; |
1435 | 1437 | ||
1436 | for (i = 0; i < ARRAY_SIZE(mlx5_class_attributes); i++) { | 1438 | for (i = 0; i < ARRAY_SIZE(mlx5_class_attributes); i++) { |
1437 | if (device_create_file(&dev->ib_dev.dev, | 1439 | err = device_create_file(&dev->ib_dev.dev, |
1438 | mlx5_class_attributes[i])) | 1440 | mlx5_class_attributes[i]); |
1441 | if (err) | ||
1439 | goto err_umrc; | 1442 | goto err_umrc; |
1440 | } | 1443 | } |
1441 | 1444 | ||
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 16ac54c9819f..045f8cdbd303 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
@@ -199,7 +199,7 @@ static int set_rq_size(struct mlx5_ib_dev *dev, struct ib_qp_cap *cap, | |||
199 | 199 | ||
200 | static int sq_overhead(enum ib_qp_type qp_type) | 200 | static int sq_overhead(enum ib_qp_type qp_type) |
201 | { | 201 | { |
202 | int size; | 202 | int size = 0; |
203 | 203 | ||
204 | switch (qp_type) { | 204 | switch (qp_type) { |
205 | case IB_QPT_XRC_INI: | 205 | case IB_QPT_XRC_INI: |
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index 418004c93feb..90200245c5eb 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c | |||
@@ -3570,10 +3570,10 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, | |||
3570 | tcp_state = (aeq_info & NES_AEQE_TCP_STATE_MASK) >> NES_AEQE_TCP_STATE_SHIFT; | 3570 | tcp_state = (aeq_info & NES_AEQE_TCP_STATE_MASK) >> NES_AEQE_TCP_STATE_SHIFT; |
3571 | iwarp_state = (aeq_info & NES_AEQE_IWARP_STATE_MASK) >> NES_AEQE_IWARP_STATE_SHIFT; | 3571 | iwarp_state = (aeq_info & NES_AEQE_IWARP_STATE_MASK) >> NES_AEQE_IWARP_STATE_SHIFT; |
3572 | nes_debug(NES_DBG_AEQ, "aeid = 0x%04X, qp-cq id = %d, aeqe = %p," | 3572 | nes_debug(NES_DBG_AEQ, "aeid = 0x%04X, qp-cq id = %d, aeqe = %p," |
3573 | " Tcp state = %d, iWARP state = %d\n", | 3573 | " Tcp state = %s, iWARP state = %s\n", |
3574 | async_event_id, | 3574 | async_event_id, |
3575 | le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]), aeqe, | 3575 | le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]), aeqe, |
3576 | tcp_state, iwarp_state); | 3576 | nes_tcp_state_str[tcp_state], nes_iwarp_state_str[iwarp_state]); |
3577 | 3577 | ||
3578 | aeqe_cq_id = le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]); | 3578 | aeqe_cq_id = le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]); |
3579 | if (aeq_info & NES_AEQE_QP) { | 3579 | if (aeq_info & NES_AEQE_QP) { |
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index 8f67fe2e91e6..5b53ca5a2284 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c | |||
@@ -1384,6 +1384,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd, | |||
1384 | 1384 | ||
1385 | if (ibpd->uobject) { | 1385 | if (ibpd->uobject) { |
1386 | uresp.mmap_sq_db_index = nesqp->mmap_sq_db_index; | 1386 | uresp.mmap_sq_db_index = nesqp->mmap_sq_db_index; |
1387 | uresp.mmap_rq_db_index = 0; | ||
1387 | uresp.actual_sq_size = sq_size; | 1388 | uresp.actual_sq_size = sq_size; |
1388 | uresp.actual_rq_size = rq_size; | 1389 | uresp.actual_rq_size = rq_size; |
1389 | uresp.qp_id = nesqp->hwqp.qp_id; | 1390 | uresp.qp_id = nesqp->hwqp.qp_id; |
@@ -1767,7 +1768,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, | |||
1767 | resp.cq_id = nescq->hw_cq.cq_number; | 1768 | resp.cq_id = nescq->hw_cq.cq_number; |
1768 | resp.cq_size = nescq->hw_cq.cq_size; | 1769 | resp.cq_size = nescq->hw_cq.cq_size; |
1769 | resp.mmap_db_index = 0; | 1770 | resp.mmap_db_index = 0; |
1770 | if (ib_copy_to_udata(udata, &resp, sizeof resp)) { | 1771 | if (ib_copy_to_udata(udata, &resp, sizeof resp - sizeof resp.reserved)) { |
1771 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); | 1772 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); |
1772 | kfree(nescq); | 1773 | kfree(nescq); |
1773 | return ERR_PTR(-EFAULT); | 1774 | return ERR_PTR(-EFAULT); |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c index a877a8ed7907..f4c587c68f64 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <net/netevent.h> | 29 | #include <net/netevent.h> |
30 | 30 | ||
31 | #include <rdma/ib_addr.h> | 31 | #include <rdma/ib_addr.h> |
32 | #include <rdma/ib_cache.h> | ||
33 | 32 | ||
34 | #include "ocrdma.h" | 33 | #include "ocrdma.h" |
35 | #include "ocrdma_verbs.h" | 34 | #include "ocrdma_verbs.h" |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index dcfbab177faa..f36630e4b6be 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | |||
@@ -242,6 +242,7 @@ struct ib_ucontext *ocrdma_alloc_ucontext(struct ib_device *ibdev, | |||
242 | memset(ctx->ah_tbl.va, 0, map_len); | 242 | memset(ctx->ah_tbl.va, 0, map_len); |
243 | ctx->ah_tbl.len = map_len; | 243 | ctx->ah_tbl.len = map_len; |
244 | 244 | ||
245 | memset(&resp, 0, sizeof(resp)); | ||
245 | resp.ah_tbl_len = ctx->ah_tbl.len; | 246 | resp.ah_tbl_len = ctx->ah_tbl.len; |
246 | resp.ah_tbl_page = ctx->ah_tbl.pa; | 247 | resp.ah_tbl_page = ctx->ah_tbl.pa; |
247 | 248 | ||
@@ -253,7 +254,6 @@ struct ib_ucontext *ocrdma_alloc_ucontext(struct ib_device *ibdev, | |||
253 | resp.wqe_size = dev->attr.wqe_size; | 254 | resp.wqe_size = dev->attr.wqe_size; |
254 | resp.rqe_size = dev->attr.rqe_size; | 255 | resp.rqe_size = dev->attr.rqe_size; |
255 | resp.dpp_wqe_size = dev->attr.wqe_size; | 256 | resp.dpp_wqe_size = dev->attr.wqe_size; |
256 | resp.rsvd = 0; | ||
257 | 257 | ||
258 | memcpy(resp.fw_ver, dev->attr.fw_ver, sizeof(resp.fw_ver)); | 258 | memcpy(resp.fw_ver, dev->attr.fw_ver, sizeof(resp.fw_ver)); |
259 | status = ib_copy_to_udata(udata, &resp, sizeof(resp)); | 259 | status = ib_copy_to_udata(udata, &resp, sizeof(resp)); |
@@ -338,6 +338,7 @@ static int ocrdma_copy_pd_uresp(struct ocrdma_pd *pd, | |||
338 | struct ocrdma_alloc_pd_uresp rsp; | 338 | struct ocrdma_alloc_pd_uresp rsp; |
339 | struct ocrdma_ucontext *uctx = get_ocrdma_ucontext(ib_ctx); | 339 | struct ocrdma_ucontext *uctx = get_ocrdma_ucontext(ib_ctx); |
340 | 340 | ||
341 | memset(&rsp, 0, sizeof(rsp)); | ||
341 | rsp.id = pd->id; | 342 | rsp.id = pd->id; |
342 | rsp.dpp_enabled = pd->dpp_enabled; | 343 | rsp.dpp_enabled = pd->dpp_enabled; |
343 | db_page_addr = pd->dev->nic_info.unmapped_db + | 344 | db_page_addr = pd->dev->nic_info.unmapped_db + |
@@ -692,6 +693,7 @@ static int ocrdma_copy_cq_uresp(struct ocrdma_cq *cq, struct ib_udata *udata, | |||
692 | struct ocrdma_ucontext *uctx; | 693 | struct ocrdma_ucontext *uctx; |
693 | struct ocrdma_create_cq_uresp uresp; | 694 | struct ocrdma_create_cq_uresp uresp; |
694 | 695 | ||
696 | memset(&uresp, 0, sizeof(uresp)); | ||
695 | uresp.cq_id = cq->id; | 697 | uresp.cq_id = cq->id; |
696 | uresp.page_size = cq->len; | 698 | uresp.page_size = cq->len; |
697 | uresp.num_pages = 1; | 699 | uresp.num_pages = 1; |
@@ -1460,6 +1462,7 @@ static int ocrdma_copy_srq_uresp(struct ocrdma_srq *srq, struct ib_udata *udata) | |||
1460 | int status; | 1462 | int status; |
1461 | struct ocrdma_create_srq_uresp uresp; | 1463 | struct ocrdma_create_srq_uresp uresp; |
1462 | 1464 | ||
1465 | memset(&uresp, 0, sizeof(uresp)); | ||
1463 | uresp.rq_dbid = srq->rq.dbid; | 1466 | uresp.rq_dbid = srq->rq.dbid; |
1464 | uresp.num_rq_pages = 1; | 1467 | uresp.num_rq_pages = 1; |
1465 | uresp.rq_page_addr[0] = srq->rq.pa; | 1468 | uresp.rq_page_addr[0] = srq->rq.pa; |
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c index 21e8b09d4bf8..016e7429adf6 100644 --- a/drivers/infiniband/hw/qib/qib_iba7322.c +++ b/drivers/infiniband/hw/qib/qib_iba7322.c | |||
@@ -1596,6 +1596,8 @@ static void sdma_7322_p_errors(struct qib_pportdata *ppd, u64 errs) | |||
1596 | struct qib_devdata *dd = ppd->dd; | 1596 | struct qib_devdata *dd = ppd->dd; |
1597 | 1597 | ||
1598 | errs &= QIB_E_P_SDMAERRS; | 1598 | errs &= QIB_E_P_SDMAERRS; |
1599 | err_decode(ppd->cpspec->sdmamsgbuf, sizeof(ppd->cpspec->sdmamsgbuf), | ||
1600 | errs, qib_7322p_error_msgs); | ||
1599 | 1601 | ||
1600 | if (errs & QIB_E_P_SDMAUNEXPDATA) | 1602 | if (errs & QIB_E_P_SDMAUNEXPDATA) |
1601 | qib_dev_err(dd, "IB%u:%u SDmaUnexpData\n", dd->unit, | 1603 | qib_dev_err(dd, "IB%u:%u SDmaUnexpData\n", dd->unit, |
diff --git a/drivers/infiniband/hw/qib/qib_sdma.c b/drivers/infiniband/hw/qib/qib_sdma.c index 32162d355370..9b5322d8cd5a 100644 --- a/drivers/infiniband/hw/qib/qib_sdma.c +++ b/drivers/infiniband/hw/qib/qib_sdma.c | |||
@@ -717,7 +717,7 @@ void dump_sdma_state(struct qib_pportdata *ppd) | |||
717 | struct qib_sdma_txreq *txp, *txpnext; | 717 | struct qib_sdma_txreq *txp, *txpnext; |
718 | __le64 *descqp; | 718 | __le64 *descqp; |
719 | u64 desc[2]; | 719 | u64 desc[2]; |
720 | dma_addr_t addr; | 720 | u64 addr; |
721 | u16 gen, dwlen, dwoffset; | 721 | u16 gen, dwlen, dwoffset; |
722 | u16 head, tail, cnt; | 722 | u16 head, tail, cnt; |
723 | 723 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 2cfa76f5d99e..196b1d13cbcb 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -932,12 +932,47 @@ int ipoib_ib_dev_init(struct net_device *dev, struct ib_device *ca, int port) | |||
932 | return 0; | 932 | return 0; |
933 | } | 933 | } |
934 | 934 | ||
935 | /* | ||
936 | * Takes whatever value which is in pkey index 0 and updates priv->pkey | ||
937 | * returns 0 if the pkey value was changed. | ||
938 | */ | ||
939 | static inline int update_parent_pkey(struct ipoib_dev_priv *priv) | ||
940 | { | ||
941 | int result; | ||
942 | u16 prev_pkey; | ||
943 | |||
944 | prev_pkey = priv->pkey; | ||
945 | result = ib_query_pkey(priv->ca, priv->port, 0, &priv->pkey); | ||
946 | if (result) { | ||
947 | ipoib_warn(priv, "ib_query_pkey port %d failed (ret = %d)\n", | ||
948 | priv->port, result); | ||
949 | return result; | ||
950 | } | ||
951 | |||
952 | priv->pkey |= 0x8000; | ||
953 | |||
954 | if (prev_pkey != priv->pkey) { | ||
955 | ipoib_dbg(priv, "pkey changed from 0x%x to 0x%x\n", | ||
956 | prev_pkey, priv->pkey); | ||
957 | /* | ||
958 | * Update the pkey in the broadcast address, while making sure to set | ||
959 | * the full membership bit, so that we join the right broadcast group. | ||
960 | */ | ||
961 | priv->dev->broadcast[8] = priv->pkey >> 8; | ||
962 | priv->dev->broadcast[9] = priv->pkey & 0xff; | ||
963 | return 0; | ||
964 | } | ||
965 | |||
966 | return 1; | ||
967 | } | ||
968 | |||
935 | static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, | 969 | static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, |
936 | enum ipoib_flush_level level) | 970 | enum ipoib_flush_level level) |
937 | { | 971 | { |
938 | struct ipoib_dev_priv *cpriv; | 972 | struct ipoib_dev_priv *cpriv; |
939 | struct net_device *dev = priv->dev; | 973 | struct net_device *dev = priv->dev; |
940 | u16 new_index; | 974 | u16 new_index; |
975 | int result; | ||
941 | 976 | ||
942 | mutex_lock(&priv->vlan_mutex); | 977 | mutex_lock(&priv->vlan_mutex); |
943 | 978 | ||
@@ -951,6 +986,10 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, | |||
951 | mutex_unlock(&priv->vlan_mutex); | 986 | mutex_unlock(&priv->vlan_mutex); |
952 | 987 | ||
953 | if (!test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) { | 988 | if (!test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) { |
989 | /* for non-child devices must check/update the pkey value here */ | ||
990 | if (level == IPOIB_FLUSH_HEAVY && | ||
991 | !test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) | ||
992 | update_parent_pkey(priv); | ||
954 | ipoib_dbg(priv, "Not flushing - IPOIB_FLAG_INITIALIZED not set.\n"); | 993 | ipoib_dbg(priv, "Not flushing - IPOIB_FLAG_INITIALIZED not set.\n"); |
955 | return; | 994 | return; |
956 | } | 995 | } |
@@ -961,21 +1000,32 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, | |||
961 | } | 1000 | } |
962 | 1001 | ||
963 | if (level == IPOIB_FLUSH_HEAVY) { | 1002 | if (level == IPOIB_FLUSH_HEAVY) { |
964 | if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &new_index)) { | 1003 | /* child devices chase their origin pkey value, while non-child |
965 | clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); | 1004 | * (parent) devices should always takes what present in pkey index 0 |
966 | ipoib_ib_dev_down(dev, 0); | 1005 | */ |
967 | ipoib_ib_dev_stop(dev, 0); | 1006 | if (test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { |
968 | if (ipoib_pkey_dev_delay_open(dev)) | 1007 | if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &new_index)) { |
1008 | clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); | ||
1009 | ipoib_ib_dev_down(dev, 0); | ||
1010 | ipoib_ib_dev_stop(dev, 0); | ||
1011 | if (ipoib_pkey_dev_delay_open(dev)) | ||
1012 | return; | ||
1013 | } | ||
1014 | /* restart QP only if P_Key index is changed */ | ||
1015 | if (test_and_set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags) && | ||
1016 | new_index == priv->pkey_index) { | ||
1017 | ipoib_dbg(priv, "Not flushing - P_Key index not changed.\n"); | ||
969 | return; | 1018 | return; |
1019 | } | ||
1020 | priv->pkey_index = new_index; | ||
1021 | } else { | ||
1022 | result = update_parent_pkey(priv); | ||
1023 | /* restart QP only if P_Key value changed */ | ||
1024 | if (result) { | ||
1025 | ipoib_dbg(priv, "Not flushing - P_Key value not changed.\n"); | ||
1026 | return; | ||
1027 | } | ||
970 | } | 1028 | } |
971 | |||
972 | /* restart QP only if P_Key index is changed */ | ||
973 | if (test_and_set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags) && | ||
974 | new_index == priv->pkey_index) { | ||
975 | ipoib_dbg(priv, "Not flushing - P_Key index not changed.\n"); | ||
976 | return; | ||
977 | } | ||
978 | priv->pkey_index = new_index; | ||
979 | } | 1029 | } |
980 | 1030 | ||
981 | if (level == IPOIB_FLUSH_LIGHT) { | 1031 | if (level == IPOIB_FLUSH_LIGHT) { |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index b6e049a3c7a8..c6f71a88c55c 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -1461,7 +1461,7 @@ static ssize_t create_child(struct device *dev, | |||
1461 | if (sscanf(buf, "%i", &pkey) != 1) | 1461 | if (sscanf(buf, "%i", &pkey) != 1) |
1462 | return -EINVAL; | 1462 | return -EINVAL; |
1463 | 1463 | ||
1464 | if (pkey < 0 || pkey > 0xffff) | 1464 | if (pkey <= 0 || pkey > 0xffff || pkey == 0x8000) |
1465 | return -EINVAL; | 1465 | return -EINVAL; |
1466 | 1466 | ||
1467 | /* | 1467 | /* |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_netlink.c b/drivers/infiniband/ulp/ipoib/ipoib_netlink.c index 74685936c948..f81abe16cf09 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_netlink.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_netlink.c | |||
@@ -119,6 +119,15 @@ static int ipoib_new_child_link(struct net *src_net, struct net_device *dev, | |||
119 | } else | 119 | } else |
120 | child_pkey = nla_get_u16(data[IFLA_IPOIB_PKEY]); | 120 | child_pkey = nla_get_u16(data[IFLA_IPOIB_PKEY]); |
121 | 121 | ||
122 | if (child_pkey == 0 || child_pkey == 0x8000) | ||
123 | return -EINVAL; | ||
124 | |||
125 | /* | ||
126 | * Set the full membership bit, so that we join the right | ||
127 | * broadcast group, etc. | ||
128 | */ | ||
129 | child_pkey |= 0x8000; | ||
130 | |||
122 | err = __ipoib_vlan_add(ppriv, netdev_priv(dev), child_pkey, IPOIB_RTNL_CHILD); | 131 | err = __ipoib_vlan_add(ppriv, netdev_priv(dev), child_pkey, IPOIB_RTNL_CHILD); |
123 | 132 | ||
124 | if (!err && data) | 133 | if (!err && data) |
diff --git a/drivers/macintosh/windfarm_rm31.c b/drivers/macintosh/windfarm_rm31.c index 0b9a79b2f48a..82fc86a90c1a 100644 --- a/drivers/macintosh/windfarm_rm31.c +++ b/drivers/macintosh/windfarm_rm31.c | |||
@@ -439,15 +439,15 @@ static void backside_setup_pid(void) | |||
439 | 439 | ||
440 | /* Slots fan */ | 440 | /* Slots fan */ |
441 | static const struct wf_pid_param slots_param = { | 441 | static const struct wf_pid_param slots_param = { |
442 | .interval = 5, | 442 | .interval = 1, |
443 | .history_len = 2, | 443 | .history_len = 20, |
444 | .gd = 30 << 20, | 444 | .gd = 0, |
445 | .gp = 5 << 20, | 445 | .gp = 0, |
446 | .gr = 0, | 446 | .gr = 0x00100000, |
447 | .itarget = 40 << 16, | 447 | .itarget = 3200000, |
448 | .additive = 1, | 448 | .additive = 0, |
449 | .min = 300, | 449 | .min = 20, |
450 | .max = 4000, | 450 | .max = 100, |
451 | }; | 451 | }; |
452 | 452 | ||
453 | static void slots_fan_tick(void) | 453 | static void slots_fan_tick(void) |
diff --git a/drivers/media/i2c/ml86v7667.c b/drivers/media/i2c/ml86v7667.c index efdc873e58d1..a9857022f71d 100644 --- a/drivers/media/i2c/ml86v7667.c +++ b/drivers/media/i2c/ml86v7667.c | |||
@@ -117,7 +117,7 @@ static int ml86v7667_s_ctrl(struct v4l2_ctrl *ctrl) | |||
117 | { | 117 | { |
118 | struct v4l2_subdev *sd = to_sd(ctrl); | 118 | struct v4l2_subdev *sd = to_sd(ctrl); |
119 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 119 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
120 | int ret; | 120 | int ret = -EINVAL; |
121 | 121 | ||
122 | switch (ctrl->id) { | 122 | switch (ctrl->id) { |
123 | case V4L2_CID_BRIGHTNESS: | 123 | case V4L2_CID_BRIGHTNESS: |
@@ -157,7 +157,7 @@ static int ml86v7667_s_ctrl(struct v4l2_ctrl *ctrl) | |||
157 | break; | 157 | break; |
158 | } | 158 | } |
159 | 159 | ||
160 | return 0; | 160 | return ret; |
161 | } | 161 | } |
162 | 162 | ||
163 | static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) | 163 | static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) |
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index df4ada880e42..bd9405df1bd6 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c | |||
@@ -1987,7 +1987,7 @@ MODULE_DEVICE_TABLE(platform, coda_platform_ids); | |||
1987 | 1987 | ||
1988 | #ifdef CONFIG_OF | 1988 | #ifdef CONFIG_OF |
1989 | static const struct of_device_id coda_dt_ids[] = { | 1989 | static const struct of_device_id coda_dt_ids[] = { |
1990 | { .compatible = "fsl,imx27-vpu", .data = &coda_platform_ids[CODA_IMX27] }, | 1990 | { .compatible = "fsl,imx27-vpu", .data = &coda_devdata[CODA_IMX27] }, |
1991 | { .compatible = "fsl,imx53-vpu", .data = &coda_devdata[CODA_IMX53] }, | 1991 | { .compatible = "fsl,imx53-vpu", .data = &coda_devdata[CODA_IMX53] }, |
1992 | { /* sentinel */ } | 1992 | { /* sentinel */ } |
1993 | }; | 1993 | }; |
diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c index 553d87e5ceab..fd6289d60cde 100644 --- a/drivers/media/platform/s5p-g2d/g2d.c +++ b/drivers/media/platform/s5p-g2d/g2d.c | |||
@@ -784,6 +784,7 @@ static int g2d_probe(struct platform_device *pdev) | |||
784 | } | 784 | } |
785 | *vfd = g2d_videodev; | 785 | *vfd = g2d_videodev; |
786 | vfd->lock = &dev->mutex; | 786 | vfd->lock = &dev->mutex; |
787 | vfd->v4l2_dev = &dev->v4l2_dev; | ||
787 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0); | 788 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0); |
788 | if (ret) { | 789 | if (ret) { |
789 | v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); | 790 | v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 5296385153d5..4f6dd42c9adb 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | |||
@@ -344,7 +344,7 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
344 | pix_mp->num_planes = 2; | 344 | pix_mp->num_planes = 2; |
345 | /* Set pixelformat to the format in which MFC | 345 | /* Set pixelformat to the format in which MFC |
346 | outputs the decoded frame */ | 346 | outputs the decoded frame */ |
347 | pix_mp->pixelformat = V4L2_PIX_FMT_NV12MT; | 347 | pix_mp->pixelformat = ctx->dst_fmt->fourcc; |
348 | pix_mp->plane_fmt[0].bytesperline = ctx->buf_width; | 348 | pix_mp->plane_fmt[0].bytesperline = ctx->buf_width; |
349 | pix_mp->plane_fmt[0].sizeimage = ctx->luma_size; | 349 | pix_mp->plane_fmt[0].sizeimage = ctx->luma_size; |
350 | pix_mp->plane_fmt[1].bytesperline = ctx->buf_width; | 350 | pix_mp->plane_fmt[1].bytesperline = ctx->buf_width; |
@@ -382,10 +382,16 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
382 | mfc_err("Unsupported format for source.\n"); | 382 | mfc_err("Unsupported format for source.\n"); |
383 | return -EINVAL; | 383 | return -EINVAL; |
384 | } | 384 | } |
385 | if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { | 385 | if (fmt->codec_mode == S5P_FIMV_CODEC_NONE) { |
386 | mfc_err("Not supported format.\n"); | 386 | mfc_err("Unknown codec\n"); |
387 | return -EINVAL; | 387 | return -EINVAL; |
388 | } | 388 | } |
389 | if (!IS_MFCV6(dev)) { | ||
390 | if (fmt->fourcc == V4L2_PIX_FMT_VP8) { | ||
391 | mfc_err("Not supported format.\n"); | ||
392 | return -EINVAL; | ||
393 | } | ||
394 | } | ||
389 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { | 395 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
390 | fmt = find_format(f, MFC_FMT_RAW); | 396 | fmt = find_format(f, MFC_FMT_RAW); |
391 | if (!fmt) { | 397 | if (!fmt) { |
@@ -411,7 +417,6 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
411 | struct s5p_mfc_dev *dev = video_drvdata(file); | 417 | struct s5p_mfc_dev *dev = video_drvdata(file); |
412 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); | 418 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); |
413 | int ret = 0; | 419 | int ret = 0; |
414 | struct s5p_mfc_fmt *fmt; | ||
415 | struct v4l2_pix_format_mplane *pix_mp; | 420 | struct v4l2_pix_format_mplane *pix_mp; |
416 | 421 | ||
417 | mfc_debug_enter(); | 422 | mfc_debug_enter(); |
@@ -425,54 +430,32 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
425 | goto out; | 430 | goto out; |
426 | } | 431 | } |
427 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { | 432 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
428 | fmt = find_format(f, MFC_FMT_RAW); | 433 | /* dst_fmt is validated by call to vidioc_try_fmt */ |
429 | if (!fmt) { | 434 | ctx->dst_fmt = find_format(f, MFC_FMT_RAW); |
430 | mfc_err("Unsupported format for source.\n"); | 435 | ret = 0; |
431 | return -EINVAL; | ||
432 | } | ||
433 | if (!IS_MFCV6(dev) && (fmt->fourcc != V4L2_PIX_FMT_NV12MT)) { | ||
434 | mfc_err("Not supported format.\n"); | ||
435 | return -EINVAL; | ||
436 | } else if (IS_MFCV6(dev) && | ||
437 | (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { | ||
438 | mfc_err("Not supported format.\n"); | ||
439 | return -EINVAL; | ||
440 | } | ||
441 | ctx->dst_fmt = fmt; | ||
442 | mfc_debug_leave(); | ||
443 | return ret; | ||
444 | } else if (f->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { | ||
445 | mfc_err("Wrong type error for S_FMT : %d", f->type); | ||
446 | return -EINVAL; | ||
447 | } | ||
448 | fmt = find_format(f, MFC_FMT_DEC); | ||
449 | if (!fmt || fmt->codec_mode == S5P_MFC_CODEC_NONE) { | ||
450 | mfc_err("Unknown codec\n"); | ||
451 | ret = -EINVAL; | ||
452 | goto out; | 436 | goto out; |
453 | } | 437 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { |
454 | if (fmt->type != MFC_FMT_DEC) { | 438 | /* src_fmt is validated by call to vidioc_try_fmt */ |
455 | mfc_err("Wrong format selected, you should choose " | 439 | ctx->src_fmt = find_format(f, MFC_FMT_DEC); |
456 | "format for decoding\n"); | 440 | ctx->codec_mode = ctx->src_fmt->codec_mode; |
441 | mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); | ||
442 | pix_mp->height = 0; | ||
443 | pix_mp->width = 0; | ||
444 | if (pix_mp->plane_fmt[0].sizeimage) | ||
445 | ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; | ||
446 | else | ||
447 | pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size = | ||
448 | DEF_CPB_SIZE; | ||
449 | pix_mp->plane_fmt[0].bytesperline = 0; | ||
450 | ctx->state = MFCINST_INIT; | ||
451 | ret = 0; | ||
452 | goto out; | ||
453 | } else { | ||
454 | mfc_err("Wrong type error for S_FMT : %d", f->type); | ||
457 | ret = -EINVAL; | 455 | ret = -EINVAL; |
458 | goto out; | 456 | goto out; |
459 | } | 457 | } |
460 | if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { | 458 | |
461 | mfc_err("Not supported format.\n"); | ||
462 | return -EINVAL; | ||
463 | } | ||
464 | ctx->src_fmt = fmt; | ||
465 | ctx->codec_mode = fmt->codec_mode; | ||
466 | mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); | ||
467 | pix_mp->height = 0; | ||
468 | pix_mp->width = 0; | ||
469 | if (pix_mp->plane_fmt[0].sizeimage) | ||
470 | ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; | ||
471 | else | ||
472 | pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size = | ||
473 | DEF_CPB_SIZE; | ||
474 | pix_mp->plane_fmt[0].bytesperline = 0; | ||
475 | ctx->state = MFCINST_INIT; | ||
476 | out: | 459 | out: |
477 | mfc_debug_leave(); | 460 | mfc_debug_leave(); |
478 | return ret; | 461 | return ret; |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 2549967b2f85..59e56f4c8ce3 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | |||
@@ -906,6 +906,7 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
906 | 906 | ||
907 | static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) | 907 | static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) |
908 | { | 908 | { |
909 | struct s5p_mfc_dev *dev = video_drvdata(file); | ||
909 | struct s5p_mfc_fmt *fmt; | 910 | struct s5p_mfc_fmt *fmt; |
910 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; | 911 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; |
911 | 912 | ||
@@ -930,6 +931,18 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
930 | return -EINVAL; | 931 | return -EINVAL; |
931 | } | 932 | } |
932 | 933 | ||
934 | if (!IS_MFCV6(dev)) { | ||
935 | if (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16) { | ||
936 | mfc_err("Not supported format.\n"); | ||
937 | return -EINVAL; | ||
938 | } | ||
939 | } else if (IS_MFCV6(dev)) { | ||
940 | if (fmt->fourcc == V4L2_PIX_FMT_NV12MT) { | ||
941 | mfc_err("Not supported format.\n"); | ||
942 | return -EINVAL; | ||
943 | } | ||
944 | } | ||
945 | |||
933 | if (fmt->num_planes != pix_fmt_mp->num_planes) { | 946 | if (fmt->num_planes != pix_fmt_mp->num_planes) { |
934 | mfc_err("failed to try output format\n"); | 947 | mfc_err("failed to try output format\n"); |
935 | return -EINVAL; | 948 | return -EINVAL; |
@@ -947,7 +960,6 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
947 | { | 960 | { |
948 | struct s5p_mfc_dev *dev = video_drvdata(file); | 961 | struct s5p_mfc_dev *dev = video_drvdata(file); |
949 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); | 962 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); |
950 | struct s5p_mfc_fmt *fmt; | ||
951 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; | 963 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; |
952 | int ret = 0; | 964 | int ret = 0; |
953 | 965 | ||
@@ -960,13 +972,9 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
960 | goto out; | 972 | goto out; |
961 | } | 973 | } |
962 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { | 974 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
963 | fmt = find_format(f, MFC_FMT_ENC); | 975 | /* dst_fmt is validated by call to vidioc_try_fmt */ |
964 | if (!fmt) { | 976 | ctx->dst_fmt = find_format(f, MFC_FMT_ENC); |
965 | mfc_err("failed to set capture format\n"); | ||
966 | return -EINVAL; | ||
967 | } | ||
968 | ctx->state = MFCINST_INIT; | 977 | ctx->state = MFCINST_INIT; |
969 | ctx->dst_fmt = fmt; | ||
970 | ctx->codec_mode = ctx->dst_fmt->codec_mode; | 978 | ctx->codec_mode = ctx->dst_fmt->codec_mode; |
971 | ctx->enc_dst_buf_size = pix_fmt_mp->plane_fmt[0].sizeimage; | 979 | ctx->enc_dst_buf_size = pix_fmt_mp->plane_fmt[0].sizeimage; |
972 | pix_fmt_mp->plane_fmt[0].bytesperline = 0; | 980 | pix_fmt_mp->plane_fmt[0].bytesperline = 0; |
@@ -987,28 +995,8 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
987 | } | 995 | } |
988 | mfc_debug(2, "Got instance number: %d\n", ctx->inst_no); | 996 | mfc_debug(2, "Got instance number: %d\n", ctx->inst_no); |
989 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { | 997 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { |
990 | fmt = find_format(f, MFC_FMT_RAW); | 998 | /* src_fmt is validated by call to vidioc_try_fmt */ |
991 | if (!fmt) { | 999 | ctx->src_fmt = find_format(f, MFC_FMT_RAW); |
992 | mfc_err("failed to set output format\n"); | ||
993 | return -EINVAL; | ||
994 | } | ||
995 | |||
996 | if (!IS_MFCV6(dev) && | ||
997 | (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16)) { | ||
998 | mfc_err("Not supported format.\n"); | ||
999 | return -EINVAL; | ||
1000 | } else if (IS_MFCV6(dev) && | ||
1001 | (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { | ||
1002 | mfc_err("Not supported format.\n"); | ||
1003 | return -EINVAL; | ||
1004 | } | ||
1005 | |||
1006 | if (fmt->num_planes != pix_fmt_mp->num_planes) { | ||
1007 | mfc_err("failed to set output format\n"); | ||
1008 | ret = -EINVAL; | ||
1009 | goto out; | ||
1010 | } | ||
1011 | ctx->src_fmt = fmt; | ||
1012 | ctx->img_width = pix_fmt_mp->width; | 1000 | ctx->img_width = pix_fmt_mp->width; |
1013 | ctx->img_height = pix_fmt_mp->height; | 1001 | ctx->img_height = pix_fmt_mp->height; |
1014 | mfc_debug(2, "codec number: %d\n", ctx->src_fmt->codec_mode); | 1002 | mfc_debug(2, "codec number: %d\n", ctx->src_fmt->codec_mode); |
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c index 4851cc2e4a4d..c4ff9739a7ae 100644 --- a/drivers/media/usb/em28xx/em28xx-i2c.c +++ b/drivers/media/usb/em28xx/em28xx-i2c.c | |||
@@ -726,7 +726,7 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus, | |||
726 | 726 | ||
727 | *eedata = data; | 727 | *eedata = data; |
728 | *eedata_len = len; | 728 | *eedata_len = len; |
729 | dev_config = (void *)eedata; | 729 | dev_config = (void *)*eedata; |
730 | 730 | ||
731 | switch (le16_to_cpu(dev_config->chip_conf) >> 4 & 0x3) { | 731 | switch (le16_to_cpu(dev_config->chip_conf) >> 4 & 0x3) { |
732 | case 0: | 732 | case 0: |
diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c index cb694055ba7d..6e5070774dc2 100644 --- a/drivers/media/usb/hdpvr/hdpvr-core.c +++ b/drivers/media/usb/hdpvr/hdpvr-core.c | |||
@@ -303,6 +303,11 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
303 | 303 | ||
304 | dev->workqueue = 0; | 304 | dev->workqueue = 0; |
305 | 305 | ||
306 | /* init video transfer queues first of all */ | ||
307 | /* to prevent oops in hdpvr_delete() on error paths */ | ||
308 | INIT_LIST_HEAD(&dev->free_buff_list); | ||
309 | INIT_LIST_HEAD(&dev->rec_buff_list); | ||
310 | |||
306 | /* register v4l2_device early so it can be used for printks */ | 311 | /* register v4l2_device early so it can be used for printks */ |
307 | if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) { | 312 | if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) { |
308 | dev_err(&interface->dev, "v4l2_device_register failed\n"); | 313 | dev_err(&interface->dev, "v4l2_device_register failed\n"); |
@@ -325,10 +330,6 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
325 | if (!dev->workqueue) | 330 | if (!dev->workqueue) |
326 | goto error; | 331 | goto error; |
327 | 332 | ||
328 | /* init video transfer queues */ | ||
329 | INIT_LIST_HEAD(&dev->free_buff_list); | ||
330 | INIT_LIST_HEAD(&dev->rec_buff_list); | ||
331 | |||
332 | dev->options = hdpvr_default_options; | 333 | dev->options = hdpvr_default_options; |
333 | 334 | ||
334 | if (default_video_input < HDPVR_VIDEO_INPUTS) | 335 | if (default_video_input < HDPVR_VIDEO_INPUTS) |
@@ -405,7 +406,7 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
405 | video_nr[atomic_inc_return(&dev_nr)]); | 406 | video_nr[atomic_inc_return(&dev_nr)]); |
406 | if (retval < 0) { | 407 | if (retval < 0) { |
407 | v4l2_err(&dev->v4l2_dev, "registering videodev failed\n"); | 408 | v4l2_err(&dev->v4l2_dev, "registering videodev failed\n"); |
408 | goto error; | 409 | goto reg_fail; |
409 | } | 410 | } |
410 | 411 | ||
411 | /* let the user know what node this device is now attached to */ | 412 | /* let the user know what node this device is now attached to */ |
diff --git a/drivers/media/usb/usbtv/Kconfig b/drivers/media/usb/usbtv/Kconfig index 8864436464bf..7c5b86006ee6 100644 --- a/drivers/media/usb/usbtv/Kconfig +++ b/drivers/media/usb/usbtv/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_USBTV | 1 | config VIDEO_USBTV |
2 | tristate "USBTV007 video capture support" | 2 | tristate "USBTV007 video capture support" |
3 | depends on VIDEO_DEV | 3 | depends on VIDEO_V4L2 |
4 | select VIDEOBUF2_VMALLOC | 4 | select VIDEOBUF2_VMALLOC |
5 | 5 | ||
6 | ---help--- | 6 | ---help--- |
diff --git a/drivers/media/usb/usbtv/usbtv.c b/drivers/media/usb/usbtv/usbtv.c index bf43f874685e..91650173941a 100644 --- a/drivers/media/usb/usbtv/usbtv.c +++ b/drivers/media/usb/usbtv/usbtv.c | |||
@@ -57,7 +57,7 @@ | |||
57 | #define USBTV_CHUNK_SIZE 256 | 57 | #define USBTV_CHUNK_SIZE 256 |
58 | #define USBTV_CHUNK 240 | 58 | #define USBTV_CHUNK 240 |
59 | #define USBTV_CHUNKS (USBTV_WIDTH * USBTV_HEIGHT \ | 59 | #define USBTV_CHUNKS (USBTV_WIDTH * USBTV_HEIGHT \ |
60 | / 2 / USBTV_CHUNK) | 60 | / 4 / USBTV_CHUNK) |
61 | 61 | ||
62 | /* Chunk header. */ | 62 | /* Chunk header. */ |
63 | #define USBTV_MAGIC_OK(chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ | 63 | #define USBTV_MAGIC_OK(chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ |
@@ -89,6 +89,7 @@ struct usbtv { | |||
89 | /* Number of currently processed frame, useful find | 89 | /* Number of currently processed frame, useful find |
90 | * out when a new one begins. */ | 90 | * out when a new one begins. */ |
91 | u32 frame_id; | 91 | u32 frame_id; |
92 | int chunks_done; | ||
92 | 93 | ||
93 | int iso_size; | 94 | int iso_size; |
94 | unsigned int sequence; | 95 | unsigned int sequence; |
@@ -202,6 +203,26 @@ static int usbtv_setup_capture(struct usbtv *usbtv) | |||
202 | return 0; | 203 | return 0; |
203 | } | 204 | } |
204 | 205 | ||
206 | /* Copy data from chunk into a frame buffer, deinterlacing the data | ||
207 | * into every second line. Unfortunately, they don't align nicely into | ||
208 | * 720 pixel lines, as the chunk is 240 words long, which is 480 pixels. | ||
209 | * Therefore, we break down the chunk into two halves before copyting, | ||
210 | * so that we can interleave a line if needed. */ | ||
211 | static void usbtv_chunk_to_vbuf(u32 *frame, u32 *src, int chunk_no, int odd) | ||
212 | { | ||
213 | int half; | ||
214 | |||
215 | for (half = 0; half < 2; half++) { | ||
216 | int part_no = chunk_no * 2 + half; | ||
217 | int line = part_no / 3; | ||
218 | int part_index = (line * 2 + !odd) * 3 + (part_no % 3); | ||
219 | |||
220 | u32 *dst = &frame[part_index * USBTV_CHUNK/2]; | ||
221 | memcpy(dst, src, USBTV_CHUNK/2 * sizeof(*src)); | ||
222 | src += USBTV_CHUNK/2; | ||
223 | } | ||
224 | } | ||
225 | |||
205 | /* Called for each 256-byte image chunk. | 226 | /* Called for each 256-byte image chunk. |
206 | * First word identifies the chunk, followed by 240 words of image | 227 | * First word identifies the chunk, followed by 240 words of image |
207 | * data and padding. */ | 228 | * data and padding. */ |
@@ -218,17 +239,17 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk) | |||
218 | frame_id = USBTV_FRAME_ID(chunk); | 239 | frame_id = USBTV_FRAME_ID(chunk); |
219 | odd = USBTV_ODD(chunk); | 240 | odd = USBTV_ODD(chunk); |
220 | chunk_no = USBTV_CHUNK_NO(chunk); | 241 | chunk_no = USBTV_CHUNK_NO(chunk); |
221 | |||
222 | /* Deinterlace. TODO: Use interlaced frame format. */ | ||
223 | chunk_no = (chunk_no - chunk_no % 3) * 2 + chunk_no % 3; | ||
224 | chunk_no += !odd * 3; | ||
225 | |||
226 | if (chunk_no >= USBTV_CHUNKS) | 242 | if (chunk_no >= USBTV_CHUNKS) |
227 | return; | 243 | return; |
228 | 244 | ||
229 | /* Beginning of a frame. */ | 245 | /* Beginning of a frame. */ |
230 | if (chunk_no == 0) | 246 | if (chunk_no == 0) { |
231 | usbtv->frame_id = frame_id; | 247 | usbtv->frame_id = frame_id; |
248 | usbtv->chunks_done = 0; | ||
249 | } | ||
250 | |||
251 | if (usbtv->frame_id != frame_id) | ||
252 | return; | ||
232 | 253 | ||
233 | spin_lock_irqsave(&usbtv->buflock, flags); | 254 | spin_lock_irqsave(&usbtv->buflock, flags); |
234 | if (list_empty(&usbtv->bufs)) { | 255 | if (list_empty(&usbtv->bufs)) { |
@@ -241,19 +262,23 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk) | |||
241 | buf = list_first_entry(&usbtv->bufs, struct usbtv_buf, list); | 262 | buf = list_first_entry(&usbtv->bufs, struct usbtv_buf, list); |
242 | frame = vb2_plane_vaddr(&buf->vb, 0); | 263 | frame = vb2_plane_vaddr(&buf->vb, 0); |
243 | 264 | ||
244 | /* Copy the chunk. */ | 265 | /* Copy the chunk data. */ |
245 | memcpy(&frame[chunk_no * USBTV_CHUNK], &chunk[1], | 266 | usbtv_chunk_to_vbuf(frame, &chunk[1], chunk_no, odd); |
246 | USBTV_CHUNK * sizeof(chunk[1])); | 267 | usbtv->chunks_done++; |
247 | 268 | ||
248 | /* Last chunk in a frame, signalling an end */ | 269 | /* Last chunk in a frame, signalling an end */ |
249 | if (usbtv->frame_id && chunk_no == USBTV_CHUNKS-1) { | 270 | if (odd && chunk_no == USBTV_CHUNKS-1) { |
250 | int size = vb2_plane_size(&buf->vb, 0); | 271 | int size = vb2_plane_size(&buf->vb, 0); |
272 | enum vb2_buffer_state state = usbtv->chunks_done == | ||
273 | USBTV_CHUNKS ? | ||
274 | VB2_BUF_STATE_DONE : | ||
275 | VB2_BUF_STATE_ERROR; | ||
251 | 276 | ||
252 | buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; | 277 | buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; |
253 | buf->vb.v4l2_buf.sequence = usbtv->sequence++; | 278 | buf->vb.v4l2_buf.sequence = usbtv->sequence++; |
254 | v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp); | 279 | v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp); |
255 | vb2_set_plane_payload(&buf->vb, 0, size); | 280 | vb2_set_plane_payload(&buf->vb, 0, size); |
256 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE); | 281 | vb2_buffer_done(&buf->vb, state); |
257 | list_del(&buf->list); | 282 | list_del(&buf->list); |
258 | } | 283 | } |
259 | 284 | ||
@@ -518,7 +543,7 @@ static int usbtv_queue_setup(struct vb2_queue *vq, | |||
518 | if (*nbuffers < 2) | 543 | if (*nbuffers < 2) |
519 | *nbuffers = 2; | 544 | *nbuffers = 2; |
520 | *nplanes = 1; | 545 | *nplanes = 1; |
521 | sizes[0] = USBTV_CHUNK * USBTV_CHUNKS * sizeof(u32); | 546 | sizes[0] = USBTV_WIDTH * USBTV_HEIGHT / 2 * sizeof(u32); |
522 | 547 | ||
523 | return 0; | 548 | return 0; |
524 | } | 549 | } |
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index a746ba272f04..a956053608f9 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c | |||
@@ -1007,7 +1007,7 @@ static void arcnet_rx(struct net_device *dev, int bufnum) | |||
1007 | 1007 | ||
1008 | soft = &pkt.soft.rfc1201; | 1008 | soft = &pkt.soft.rfc1201; |
1009 | 1009 | ||
1010 | lp->hw.copy_from_card(dev, bufnum, 0, &pkt, sizeof(ARC_HDR_SIZE)); | 1010 | lp->hw.copy_from_card(dev, bufnum, 0, &pkt, ARC_HDR_SIZE); |
1011 | if (pkt.hard.offset[0]) { | 1011 | if (pkt.hard.offset[0]) { |
1012 | ofs = pkt.hard.offset[0]; | 1012 | ofs = pkt.hard.offset[0]; |
1013 | length = 256 - ofs; | 1013 | length = 256 - ofs; |
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index 6aa7b3266c80..ac6177d3befc 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c | |||
@@ -412,10 +412,20 @@ static void esd_usb2_read_bulk_callback(struct urb *urb) | |||
412 | 412 | ||
413 | switch (msg->msg.hdr.cmd) { | 413 | switch (msg->msg.hdr.cmd) { |
414 | case CMD_CAN_RX: | 414 | case CMD_CAN_RX: |
415 | if (msg->msg.rx.net >= dev->net_count) { | ||
416 | dev_err(dev->udev->dev.parent, "format error\n"); | ||
417 | break; | ||
418 | } | ||
419 | |||
415 | esd_usb2_rx_can_msg(dev->nets[msg->msg.rx.net], msg); | 420 | esd_usb2_rx_can_msg(dev->nets[msg->msg.rx.net], msg); |
416 | break; | 421 | break; |
417 | 422 | ||
418 | case CMD_CAN_TX: | 423 | case CMD_CAN_TX: |
424 | if (msg->msg.txdone.net >= dev->net_count) { | ||
425 | dev_err(dev->udev->dev.parent, "format error\n"); | ||
426 | break; | ||
427 | } | ||
428 | |||
419 | esd_usb2_tx_done_msg(dev->nets[msg->msg.txdone.net], | 429 | esd_usb2_tx_done_msg(dev->nets[msg->msg.txdone.net], |
420 | msg); | 430 | msg); |
421 | break; | 431 | break; |
diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c index cbd388eea682..8becd3d838b5 100644 --- a/drivers/net/can/usb/usb_8dev.c +++ b/drivers/net/can/usb/usb_8dev.c | |||
@@ -779,6 +779,7 @@ static int usb_8dev_start(struct usb_8dev_priv *priv) | |||
779 | usb_unanchor_urb(urb); | 779 | usb_unanchor_urb(urb); |
780 | usb_free_coherent(priv->udev, RX_BUFFER_SIZE, buf, | 780 | usb_free_coherent(priv->udev, RX_BUFFER_SIZE, buf, |
781 | urb->transfer_dma); | 781 | urb->transfer_dma); |
782 | usb_free_urb(urb); | ||
782 | break; | 783 | break; |
783 | } | 784 | } |
784 | 785 | ||
diff --git a/drivers/net/ethernet/allwinner/Kconfig b/drivers/net/ethernet/allwinner/Kconfig index 53ad213e865b..d8d95d4cd45a 100644 --- a/drivers/net/ethernet/allwinner/Kconfig +++ b/drivers/net/ethernet/allwinner/Kconfig | |||
@@ -3,19 +3,20 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | config NET_VENDOR_ALLWINNER | 5 | config NET_VENDOR_ALLWINNER |
6 | bool "Allwinner devices" | 6 | bool "Allwinner devices" |
7 | default y | 7 | default y |
8 | depends on ARCH_SUNXI | ||
9 | ---help--- | ||
10 | If you have a network (Ethernet) card belonging to this | ||
11 | class, say Y and read the Ethernet-HOWTO, available from | ||
12 | <http://www.tldp.org/docs.html#howto>. | ||
13 | 8 | ||
14 | Note that the answer to this question doesn't directly | 9 | depends on ARCH_SUNXI |
15 | affect the kernel: saying N will just cause the configurator | 10 | ---help--- |
16 | to skip all the questions about Allwinner cards. If you say Y, | 11 | If you have a network (Ethernet) card belonging to this |
17 | you will be asked for your specific card in the following | 12 | class, say Y and read the Ethernet-HOWTO, available from |
18 | questions. | 13 | <http://www.tldp.org/docs.html#howto>. |
14 | |||
15 | Note that the answer to this question doesn't directly | ||
16 | affect the kernel: saying N will just cause the configurator | ||
17 | to skip all the questions about Allwinner cards. If you say Y, | ||
18 | you will be asked for your specific card in the following | ||
19 | questions. | ||
19 | 20 | ||
20 | if NET_VENDOR_ALLWINNER | 21 | if NET_VENDOR_ALLWINNER |
21 | 22 | ||
@@ -26,6 +27,7 @@ config SUN4I_EMAC | |||
26 | select CRC32 | 27 | select CRC32 |
27 | select MII | 28 | select MII |
28 | select PHYLIB | 29 | select PHYLIB |
30 | select MDIO_SUN4I | ||
29 | ---help--- | 31 | ---help--- |
30 | Support for Allwinner A10 EMAC ethernet driver. | 32 | Support for Allwinner A10 EMAC ethernet driver. |
31 | 33 | ||
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c.h b/drivers/net/ethernet/atheros/atl1c/atl1c.h index b2bf324631dc..0f0556526ba9 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c.h +++ b/drivers/net/ethernet/atheros/atl1c/atl1c.h | |||
@@ -520,6 +520,9 @@ struct atl1c_adapter { | |||
520 | struct net_device *netdev; | 520 | struct net_device *netdev; |
521 | struct pci_dev *pdev; | 521 | struct pci_dev *pdev; |
522 | struct napi_struct napi; | 522 | struct napi_struct napi; |
523 | struct page *rx_page; | ||
524 | unsigned int rx_page_offset; | ||
525 | unsigned int rx_frag_size; | ||
523 | struct atl1c_hw hw; | 526 | struct atl1c_hw hw; |
524 | struct atl1c_hw_stats hw_stats; | 527 | struct atl1c_hw_stats hw_stats; |
525 | struct mii_if_info mii; /* MII interface info */ | 528 | struct mii_if_info mii; /* MII interface info */ |
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 786a87483298..a36a760ada28 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c | |||
@@ -481,10 +481,15 @@ static int atl1c_set_mac_addr(struct net_device *netdev, void *p) | |||
481 | static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter, | 481 | static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter, |
482 | struct net_device *dev) | 482 | struct net_device *dev) |
483 | { | 483 | { |
484 | unsigned int head_size; | ||
484 | int mtu = dev->mtu; | 485 | int mtu = dev->mtu; |
485 | 486 | ||
486 | adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ? | 487 | adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ? |
487 | roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE; | 488 | roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE; |
489 | |||
490 | head_size = SKB_DATA_ALIGN(adapter->rx_buffer_len + NET_SKB_PAD) + | ||
491 | SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); | ||
492 | adapter->rx_frag_size = roundup_pow_of_two(head_size); | ||
488 | } | 493 | } |
489 | 494 | ||
490 | static netdev_features_t atl1c_fix_features(struct net_device *netdev, | 495 | static netdev_features_t atl1c_fix_features(struct net_device *netdev, |
@@ -952,6 +957,10 @@ static void atl1c_free_ring_resources(struct atl1c_adapter *adapter) | |||
952 | kfree(adapter->tpd_ring[0].buffer_info); | 957 | kfree(adapter->tpd_ring[0].buffer_info); |
953 | adapter->tpd_ring[0].buffer_info = NULL; | 958 | adapter->tpd_ring[0].buffer_info = NULL; |
954 | } | 959 | } |
960 | if (adapter->rx_page) { | ||
961 | put_page(adapter->rx_page); | ||
962 | adapter->rx_page = NULL; | ||
963 | } | ||
955 | } | 964 | } |
956 | 965 | ||
957 | /** | 966 | /** |
@@ -1639,6 +1648,35 @@ static inline void atl1c_rx_checksum(struct atl1c_adapter *adapter, | |||
1639 | skb_checksum_none_assert(skb); | 1648 | skb_checksum_none_assert(skb); |
1640 | } | 1649 | } |
1641 | 1650 | ||
1651 | static struct sk_buff *atl1c_alloc_skb(struct atl1c_adapter *adapter) | ||
1652 | { | ||
1653 | struct sk_buff *skb; | ||
1654 | struct page *page; | ||
1655 | |||
1656 | if (adapter->rx_frag_size > PAGE_SIZE) | ||
1657 | return netdev_alloc_skb(adapter->netdev, | ||
1658 | adapter->rx_buffer_len); | ||
1659 | |||
1660 | page = adapter->rx_page; | ||
1661 | if (!page) { | ||
1662 | adapter->rx_page = page = alloc_page(GFP_ATOMIC); | ||
1663 | if (unlikely(!page)) | ||
1664 | return NULL; | ||
1665 | adapter->rx_page_offset = 0; | ||
1666 | } | ||
1667 | |||
1668 | skb = build_skb(page_address(page) + adapter->rx_page_offset, | ||
1669 | adapter->rx_frag_size); | ||
1670 | if (likely(skb)) { | ||
1671 | adapter->rx_page_offset += adapter->rx_frag_size; | ||
1672 | if (adapter->rx_page_offset >= PAGE_SIZE) | ||
1673 | adapter->rx_page = NULL; | ||
1674 | else | ||
1675 | get_page(page); | ||
1676 | } | ||
1677 | return skb; | ||
1678 | } | ||
1679 | |||
1642 | static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter) | 1680 | static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter) |
1643 | { | 1681 | { |
1644 | struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring; | 1682 | struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring; |
@@ -1660,7 +1698,7 @@ static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter) | |||
1660 | while (next_info->flags & ATL1C_BUFFER_FREE) { | 1698 | while (next_info->flags & ATL1C_BUFFER_FREE) { |
1661 | rfd_desc = ATL1C_RFD_DESC(rfd_ring, rfd_next_to_use); | 1699 | rfd_desc = ATL1C_RFD_DESC(rfd_ring, rfd_next_to_use); |
1662 | 1700 | ||
1663 | skb = netdev_alloc_skb(adapter->netdev, adapter->rx_buffer_len); | 1701 | skb = atl1c_alloc_skb(adapter); |
1664 | if (unlikely(!skb)) { | 1702 | if (unlikely(!skb)) { |
1665 | if (netif_msg_rx_err(adapter)) | 1703 | if (netif_msg_rx_err(adapter)) |
1666 | dev_warn(&pdev->dev, "alloc rx buffer failed\n"); | 1704 | dev_warn(&pdev->dev, "alloc rx buffer failed\n"); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index dedbd76c033e..d80e34b8285f 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
@@ -486,7 +486,7 @@ struct bnx2x_fastpath { | |||
486 | 486 | ||
487 | struct napi_struct napi; | 487 | struct napi_struct napi; |
488 | 488 | ||
489 | #ifdef CONFIG_NET_LL_RX_POLL | 489 | #ifdef CONFIG_NET_RX_BUSY_POLL |
490 | unsigned int state; | 490 | unsigned int state; |
491 | #define BNX2X_FP_STATE_IDLE 0 | 491 | #define BNX2X_FP_STATE_IDLE 0 |
492 | #define BNX2X_FP_STATE_NAPI (1 << 0) /* NAPI owns this FP */ | 492 | #define BNX2X_FP_STATE_NAPI (1 << 0) /* NAPI owns this FP */ |
@@ -498,7 +498,7 @@ struct bnx2x_fastpath { | |||
498 | #define BNX2X_FP_USER_PEND (BNX2X_FP_STATE_POLL | BNX2X_FP_STATE_POLL_YIELD) | 498 | #define BNX2X_FP_USER_PEND (BNX2X_FP_STATE_POLL | BNX2X_FP_STATE_POLL_YIELD) |
499 | /* protect state */ | 499 | /* protect state */ |
500 | spinlock_t lock; | 500 | spinlock_t lock; |
501 | #endif /* CONFIG_NET_LL_RX_POLL */ | 501 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
502 | 502 | ||
503 | union host_hc_status_block status_blk; | 503 | union host_hc_status_block status_blk; |
504 | /* chip independent shortcuts into sb structure */ | 504 | /* chip independent shortcuts into sb structure */ |
@@ -572,7 +572,7 @@ struct bnx2x_fastpath { | |||
572 | #define bnx2x_fp_stats(bp, fp) (&((bp)->fp_stats[(fp)->index])) | 572 | #define bnx2x_fp_stats(bp, fp) (&((bp)->fp_stats[(fp)->index])) |
573 | #define bnx2x_fp_qstats(bp, fp) (&((bp)->fp_stats[(fp)->index].eth_q_stats)) | 573 | #define bnx2x_fp_qstats(bp, fp) (&((bp)->fp_stats[(fp)->index].eth_q_stats)) |
574 | 574 | ||
575 | #ifdef CONFIG_NET_LL_RX_POLL | 575 | #ifdef CONFIG_NET_RX_BUSY_POLL |
576 | static inline void bnx2x_fp_init_lock(struct bnx2x_fastpath *fp) | 576 | static inline void bnx2x_fp_init_lock(struct bnx2x_fastpath *fp) |
577 | { | 577 | { |
578 | spin_lock_init(&fp->lock); | 578 | spin_lock_init(&fp->lock); |
@@ -680,7 +680,7 @@ static inline bool bnx2x_fp_ll_polling(struct bnx2x_fastpath *fp) | |||
680 | { | 680 | { |
681 | return false; | 681 | return false; |
682 | } | 682 | } |
683 | #endif /* CONFIG_NET_LL_RX_POLL */ | 683 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
684 | 684 | ||
685 | /* Use 2500 as a mini-jumbo MTU for FCoE */ | 685 | /* Use 2500 as a mini-jumbo MTU for FCoE */ |
686 | #define BNX2X_FCOE_MINI_JUMBO_MTU 2500 | 686 | #define BNX2X_FCOE_MINI_JUMBO_MTU 2500 |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index ee350bde1818..f2d1ff10054b 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -3117,7 +3117,7 @@ int bnx2x_poll(struct napi_struct *napi, int budget) | |||
3117 | return work_done; | 3117 | return work_done; |
3118 | } | 3118 | } |
3119 | 3119 | ||
3120 | #ifdef CONFIG_NET_LL_RX_POLL | 3120 | #ifdef CONFIG_NET_RX_BUSY_POLL |
3121 | /* must be called with local_bh_disable()d */ | 3121 | /* must be called with local_bh_disable()d */ |
3122 | int bnx2x_low_latency_recv(struct napi_struct *napi) | 3122 | int bnx2x_low_latency_recv(struct napi_struct *napi) |
3123 | { | 3123 | { |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index e5da07858a2f..e06186c305d8 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -12026,7 +12026,7 @@ static const struct net_device_ops bnx2x_netdev_ops = { | |||
12026 | .ndo_fcoe_get_wwn = bnx2x_fcoe_get_wwn, | 12026 | .ndo_fcoe_get_wwn = bnx2x_fcoe_get_wwn, |
12027 | #endif | 12027 | #endif |
12028 | 12028 | ||
12029 | #ifdef CONFIG_NET_LL_RX_POLL | 12029 | #ifdef CONFIG_NET_RX_BUSY_POLL |
12030 | .ndo_busy_poll = bnx2x_low_latency_recv, | 12030 | .ndo_busy_poll = bnx2x_low_latency_recv, |
12031 | #endif | 12031 | #endif |
12032 | }; | 12032 | }; |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index d964f302ac94..ddebc7a5dda0 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -17625,7 +17625,8 @@ err_out_free_res: | |||
17625 | pci_release_regions(pdev); | 17625 | pci_release_regions(pdev); |
17626 | 17626 | ||
17627 | err_out_disable_pdev: | 17627 | err_out_disable_pdev: |
17628 | pci_disable_device(pdev); | 17628 | if (pci_is_enabled(pdev)) |
17629 | pci_disable_device(pdev); | ||
17629 | pci_set_drvdata(pdev, NULL); | 17630 | pci_set_drvdata(pdev, NULL); |
17630 | return err; | 17631 | return err; |
17631 | } | 17632 | } |
@@ -17773,7 +17774,8 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, | |||
17773 | 17774 | ||
17774 | rtnl_lock(); | 17775 | rtnl_lock(); |
17775 | 17776 | ||
17776 | if (!netif_running(netdev)) | 17777 | /* We probably don't have netdev yet */ |
17778 | if (!netdev || !netif_running(netdev)) | ||
17777 | goto done; | 17779 | goto done; |
17778 | 17780 | ||
17779 | tg3_phy_stop(tp); | 17781 | tg3_phy_stop(tp); |
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index 2b0a0ea4f8e7..ae236009f1a8 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h | |||
@@ -259,6 +259,7 @@ struct bufdesc_ex { | |||
259 | struct fec_enet_delayed_work { | 259 | struct fec_enet_delayed_work { |
260 | struct delayed_work delay_work; | 260 | struct delayed_work delay_work; |
261 | bool timeout; | 261 | bool timeout; |
262 | bool trig_tx; | ||
262 | }; | 263 | }; |
263 | 264 | ||
264 | /* The FEC buffer descriptors track the ring buffers. The rx_bd_base and | 265 | /* The FEC buffer descriptors track the ring buffers. The rx_bd_base and |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index d3ad5ea711d3..77ea0db0bbfc 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -93,6 +93,20 @@ static void set_multicast_list(struct net_device *ndev); | |||
93 | #define FEC_QUIRK_HAS_CSUM (1 << 5) | 93 | #define FEC_QUIRK_HAS_CSUM (1 << 5) |
94 | /* Controller has hardware vlan support */ | 94 | /* Controller has hardware vlan support */ |
95 | #define FEC_QUIRK_HAS_VLAN (1 << 6) | 95 | #define FEC_QUIRK_HAS_VLAN (1 << 6) |
96 | /* ENET IP errata ERR006358 | ||
97 | * | ||
98 | * If the ready bit in the transmit buffer descriptor (TxBD[R]) is previously | ||
99 | * detected as not set during a prior frame transmission, then the | ||
100 | * ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs | ||
101 | * were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in | ||
102 | * If the ready bit in the transmit buffer descriptor (TxBD[R]) is previously | ||
103 | * detected as not set during a prior frame transmission, then the | ||
104 | * ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs | ||
105 | * were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in | ||
106 | * frames not being transmitted until there is a 0-to-1 transition on | ||
107 | * ENET_TDAR[TDAR]. | ||
108 | */ | ||
109 | #define FEC_QUIRK_ERR006358 (1 << 7) | ||
96 | 110 | ||
97 | static struct platform_device_id fec_devtype[] = { | 111 | static struct platform_device_id fec_devtype[] = { |
98 | { | 112 | { |
@@ -112,7 +126,7 @@ static struct platform_device_id fec_devtype[] = { | |||
112 | .name = "imx6q-fec", | 126 | .name = "imx6q-fec", |
113 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | | 127 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | |
114 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | | 128 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | |
115 | FEC_QUIRK_HAS_VLAN, | 129 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358, |
116 | }, { | 130 | }, { |
117 | .name = "mvf600-fec", | 131 | .name = "mvf600-fec", |
118 | .driver_data = FEC_QUIRK_ENET_MAC, | 132 | .driver_data = FEC_QUIRK_ENET_MAC, |
@@ -275,16 +289,11 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
275 | struct fec_enet_private *fep = netdev_priv(ndev); | 289 | struct fec_enet_private *fep = netdev_priv(ndev); |
276 | const struct platform_device_id *id_entry = | 290 | const struct platform_device_id *id_entry = |
277 | platform_get_device_id(fep->pdev); | 291 | platform_get_device_id(fep->pdev); |
278 | struct bufdesc *bdp; | 292 | struct bufdesc *bdp, *bdp_pre; |
279 | void *bufaddr; | 293 | void *bufaddr; |
280 | unsigned short status; | 294 | unsigned short status; |
281 | unsigned int index; | 295 | unsigned int index; |
282 | 296 | ||
283 | if (!fep->link) { | ||
284 | /* Link is down or auto-negotiation is in progress. */ | ||
285 | return NETDEV_TX_BUSY; | ||
286 | } | ||
287 | |||
288 | /* Fill in a Tx ring entry */ | 297 | /* Fill in a Tx ring entry */ |
289 | bdp = fep->cur_tx; | 298 | bdp = fep->cur_tx; |
290 | 299 | ||
@@ -370,6 +379,15 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
370 | ebdp->cbd_esc |= BD_ENET_TX_PINS; | 379 | ebdp->cbd_esc |= BD_ENET_TX_PINS; |
371 | } | 380 | } |
372 | } | 381 | } |
382 | |||
383 | bdp_pre = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); | ||
384 | if ((id_entry->driver_data & FEC_QUIRK_ERR006358) && | ||
385 | !(bdp_pre->cbd_sc & BD_ENET_TX_READY)) { | ||
386 | fep->delay_work.trig_tx = true; | ||
387 | schedule_delayed_work(&(fep->delay_work.delay_work), | ||
388 | msecs_to_jiffies(1)); | ||
389 | } | ||
390 | |||
373 | /* If this was the last BD in the ring, start at the beginning again. */ | 391 | /* If this was the last BD in the ring, start at the beginning again. */ |
374 | if (status & BD_ENET_TX_WRAP) | 392 | if (status & BD_ENET_TX_WRAP) |
375 | bdp = fep->tx_bd_base; | 393 | bdp = fep->tx_bd_base; |
@@ -689,6 +707,11 @@ static void fec_enet_work(struct work_struct *work) | |||
689 | fec_restart(fep->netdev, fep->full_duplex); | 707 | fec_restart(fep->netdev, fep->full_duplex); |
690 | netif_wake_queue(fep->netdev); | 708 | netif_wake_queue(fep->netdev); |
691 | } | 709 | } |
710 | |||
711 | if (fep->delay_work.trig_tx) { | ||
712 | fep->delay_work.trig_tx = false; | ||
713 | writel(0, fep->hwp + FEC_X_DES_ACTIVE); | ||
714 | } | ||
692 | } | 715 | } |
693 | 716 | ||
694 | static void | 717 | static void |
@@ -2279,4 +2302,5 @@ static struct platform_driver fec_driver = { | |||
2279 | 2302 | ||
2280 | module_platform_driver(fec_driver); | 2303 | module_platform_driver(fec_driver); |
2281 | 2304 | ||
2305 | MODULE_ALIAS("platform:"DRIVER_NAME); | ||
2282 | MODULE_LICENSE("GPL"); | 2306 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 6a0c1b66ce54..c1d72c03cb59 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -3739,9 +3739,8 @@ static void igb_set_rx_mode(struct net_device *netdev) | |||
3739 | rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE | E1000_RCTL_VFE); | 3739 | rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE | E1000_RCTL_VFE); |
3740 | 3740 | ||
3741 | if (netdev->flags & IFF_PROMISC) { | 3741 | if (netdev->flags & IFF_PROMISC) { |
3742 | u32 mrqc = rd32(E1000_MRQC); | ||
3743 | /* retain VLAN HW filtering if in VT mode */ | 3742 | /* retain VLAN HW filtering if in VT mode */ |
3744 | if (mrqc & E1000_MRQC_ENABLE_VMDQ) | 3743 | if (adapter->vfs_allocated_count) |
3745 | rctl |= E1000_RCTL_VFE; | 3744 | rctl |= E1000_RCTL_VFE; |
3746 | rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); | 3745 | rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); |
3747 | vmolr |= (E1000_VMOLR_ROPE | E1000_VMOLR_MPME); | 3746 | vmolr |= (E1000_VMOLR_ROPE | E1000_VMOLR_MPME); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 7be725cdfea8..a6494e5daffe 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
@@ -54,7 +54,7 @@ | |||
54 | 54 | ||
55 | #include <net/busy_poll.h> | 55 | #include <net/busy_poll.h> |
56 | 56 | ||
57 | #ifdef CONFIG_NET_LL_RX_POLL | 57 | #ifdef CONFIG_NET_RX_BUSY_POLL |
58 | #define LL_EXTENDED_STATS | 58 | #define LL_EXTENDED_STATS |
59 | #endif | 59 | #endif |
60 | /* common prefix used by pr_<> macros */ | 60 | /* common prefix used by pr_<> macros */ |
@@ -366,7 +366,7 @@ struct ixgbe_q_vector { | |||
366 | struct rcu_head rcu; /* to avoid race with update stats on free */ | 366 | struct rcu_head rcu; /* to avoid race with update stats on free */ |
367 | char name[IFNAMSIZ + 9]; | 367 | char name[IFNAMSIZ + 9]; |
368 | 368 | ||
369 | #ifdef CONFIG_NET_LL_RX_POLL | 369 | #ifdef CONFIG_NET_RX_BUSY_POLL |
370 | unsigned int state; | 370 | unsigned int state; |
371 | #define IXGBE_QV_STATE_IDLE 0 | 371 | #define IXGBE_QV_STATE_IDLE 0 |
372 | #define IXGBE_QV_STATE_NAPI 1 /* NAPI owns this QV */ | 372 | #define IXGBE_QV_STATE_NAPI 1 /* NAPI owns this QV */ |
@@ -377,12 +377,12 @@ struct ixgbe_q_vector { | |||
377 | #define IXGBE_QV_YIELD (IXGBE_QV_STATE_NAPI_YIELD | IXGBE_QV_STATE_POLL_YIELD) | 377 | #define IXGBE_QV_YIELD (IXGBE_QV_STATE_NAPI_YIELD | IXGBE_QV_STATE_POLL_YIELD) |
378 | #define IXGBE_QV_USER_PEND (IXGBE_QV_STATE_POLL | IXGBE_QV_STATE_POLL_YIELD) | 378 | #define IXGBE_QV_USER_PEND (IXGBE_QV_STATE_POLL | IXGBE_QV_STATE_POLL_YIELD) |
379 | spinlock_t lock; | 379 | spinlock_t lock; |
380 | #endif /* CONFIG_NET_LL_RX_POLL */ | 380 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
381 | 381 | ||
382 | /* for dynamic allocation of rings associated with this q_vector */ | 382 | /* for dynamic allocation of rings associated with this q_vector */ |
383 | struct ixgbe_ring ring[0] ____cacheline_internodealigned_in_smp; | 383 | struct ixgbe_ring ring[0] ____cacheline_internodealigned_in_smp; |
384 | }; | 384 | }; |
385 | #ifdef CONFIG_NET_LL_RX_POLL | 385 | #ifdef CONFIG_NET_RX_BUSY_POLL |
386 | static inline void ixgbe_qv_init_lock(struct ixgbe_q_vector *q_vector) | 386 | static inline void ixgbe_qv_init_lock(struct ixgbe_q_vector *q_vector) |
387 | { | 387 | { |
388 | 388 | ||
@@ -462,7 +462,7 @@ static inline bool ixgbe_qv_ll_polling(struct ixgbe_q_vector *q_vector) | |||
462 | WARN_ON(!(q_vector->state & IXGBE_QV_LOCKED)); | 462 | WARN_ON(!(q_vector->state & IXGBE_QV_LOCKED)); |
463 | return q_vector->state & IXGBE_QV_USER_PEND; | 463 | return q_vector->state & IXGBE_QV_USER_PEND; |
464 | } | 464 | } |
465 | #else /* CONFIG_NET_LL_RX_POLL */ | 465 | #else /* CONFIG_NET_RX_BUSY_POLL */ |
466 | static inline void ixgbe_qv_init_lock(struct ixgbe_q_vector *q_vector) | 466 | static inline void ixgbe_qv_init_lock(struct ixgbe_q_vector *q_vector) |
467 | { | 467 | { |
468 | } | 468 | } |
@@ -491,7 +491,7 @@ static inline bool ixgbe_qv_ll_polling(struct ixgbe_q_vector *q_vector) | |||
491 | { | 491 | { |
492 | return false; | 492 | return false; |
493 | } | 493 | } |
494 | #endif /* CONFIG_NET_LL_RX_POLL */ | 494 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
495 | 495 | ||
496 | #ifdef CONFIG_IXGBE_HWMON | 496 | #ifdef CONFIG_IXGBE_HWMON |
497 | 497 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c index ac780770863d..7a77f37a7cbc 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c | |||
@@ -108,9 +108,8 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_82598(struct ixgbe_hw *hw, | |||
108 | 108 | ||
109 | /* Enable arbiter */ | 109 | /* Enable arbiter */ |
110 | reg &= ~IXGBE_DPMCS_ARBDIS; | 110 | reg &= ~IXGBE_DPMCS_ARBDIS; |
111 | /* Enable DFP and Recycle mode */ | ||
112 | reg |= (IXGBE_DPMCS_TDPAC | IXGBE_DPMCS_TRM); | ||
113 | reg |= IXGBE_DPMCS_TSOEF; | 111 | reg |= IXGBE_DPMCS_TSOEF; |
112 | |||
114 | /* Configure Max TSO packet size 34KB including payload and headers */ | 113 | /* Configure Max TSO packet size 34KB including payload and headers */ |
115 | reg |= (0x4 << IXGBE_DPMCS_MTSOS_SHIFT); | 114 | reg |= (0x4 << IXGBE_DPMCS_MTSOS_SHIFT); |
116 | 115 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index bad8f14b1941..be4b1fb3d0d2 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -1998,7 +1998,7 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | |||
1998 | return total_rx_packets; | 1998 | return total_rx_packets; |
1999 | } | 1999 | } |
2000 | 2000 | ||
2001 | #ifdef CONFIG_NET_LL_RX_POLL | 2001 | #ifdef CONFIG_NET_RX_BUSY_POLL |
2002 | /* must be called with local_bh_disable()d */ | 2002 | /* must be called with local_bh_disable()d */ |
2003 | static int ixgbe_low_latency_recv(struct napi_struct *napi) | 2003 | static int ixgbe_low_latency_recv(struct napi_struct *napi) |
2004 | { | 2004 | { |
@@ -2030,7 +2030,7 @@ static int ixgbe_low_latency_recv(struct napi_struct *napi) | |||
2030 | 2030 | ||
2031 | return found; | 2031 | return found; |
2032 | } | 2032 | } |
2033 | #endif /* CONFIG_NET_LL_RX_POLL */ | 2033 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
2034 | 2034 | ||
2035 | /** | 2035 | /** |
2036 | * ixgbe_configure_msix - Configure MSI-X hardware | 2036 | * ixgbe_configure_msix - Configure MSI-X hardware |
@@ -7227,7 +7227,7 @@ static const struct net_device_ops ixgbe_netdev_ops = { | |||
7227 | #ifdef CONFIG_NET_POLL_CONTROLLER | 7227 | #ifdef CONFIG_NET_POLL_CONTROLLER |
7228 | .ndo_poll_controller = ixgbe_netpoll, | 7228 | .ndo_poll_controller = ixgbe_netpoll, |
7229 | #endif | 7229 | #endif |
7230 | #ifdef CONFIG_NET_LL_RX_POLL | 7230 | #ifdef CONFIG_NET_RX_BUSY_POLL |
7231 | .ndo_busy_poll = ixgbe_low_latency_recv, | 7231 | .ndo_busy_poll = ixgbe_low_latency_recv, |
7232 | #endif | 7232 | #endif |
7233 | #ifdef IXGBE_FCOE | 7233 | #ifdef IXGBE_FCOE |
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 712779fb12b7..b017818bccae 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
@@ -88,6 +88,8 @@ | |||
88 | #define MVNETA_TX_IN_PRGRS BIT(1) | 88 | #define MVNETA_TX_IN_PRGRS BIT(1) |
89 | #define MVNETA_TX_FIFO_EMPTY BIT(8) | 89 | #define MVNETA_TX_FIFO_EMPTY BIT(8) |
90 | #define MVNETA_RX_MIN_FRAME_SIZE 0x247c | 90 | #define MVNETA_RX_MIN_FRAME_SIZE 0x247c |
91 | #define MVNETA_SGMII_SERDES_CFG 0x24A0 | ||
92 | #define MVNETA_SGMII_SERDES_PROTO 0x0cc7 | ||
91 | #define MVNETA_TYPE_PRIO 0x24bc | 93 | #define MVNETA_TYPE_PRIO 0x24bc |
92 | #define MVNETA_FORCE_UNI BIT(21) | 94 | #define MVNETA_FORCE_UNI BIT(21) |
93 | #define MVNETA_TXQ_CMD_1 0x24e4 | 95 | #define MVNETA_TXQ_CMD_1 0x24e4 |
@@ -655,6 +657,8 @@ static void mvneta_port_sgmii_config(struct mvneta_port *pp) | |||
655 | val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); | 657 | val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); |
656 | val |= MVNETA_GMAC2_PSC_ENABLE; | 658 | val |= MVNETA_GMAC2_PSC_ENABLE; |
657 | mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); | 659 | mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); |
660 | |||
661 | mvreg_write(pp, MVNETA_SGMII_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO); | ||
658 | } | 662 | } |
659 | 663 | ||
660 | /* Start the Ethernet port RX and TX activity */ | 664 | /* Start the Ethernet port RX and TX activity */ |
@@ -2728,28 +2732,24 @@ static int mvneta_probe(struct platform_device *pdev) | |||
2728 | 2732 | ||
2729 | pp = netdev_priv(dev); | 2733 | pp = netdev_priv(dev); |
2730 | 2734 | ||
2731 | pp->tx_done_timer.function = mvneta_tx_done_timer_callback; | ||
2732 | init_timer(&pp->tx_done_timer); | ||
2733 | clear_bit(MVNETA_F_TX_DONE_TIMER_BIT, &pp->flags); | ||
2734 | |||
2735 | pp->weight = MVNETA_RX_POLL_WEIGHT; | 2735 | pp->weight = MVNETA_RX_POLL_WEIGHT; |
2736 | pp->phy_node = phy_node; | 2736 | pp->phy_node = phy_node; |
2737 | pp->phy_interface = phy_mode; | 2737 | pp->phy_interface = phy_mode; |
2738 | 2738 | ||
2739 | pp->base = of_iomap(dn, 0); | ||
2740 | if (pp->base == NULL) { | ||
2741 | err = -ENOMEM; | ||
2742 | goto err_free_irq; | ||
2743 | } | ||
2744 | |||
2745 | pp->clk = devm_clk_get(&pdev->dev, NULL); | 2739 | pp->clk = devm_clk_get(&pdev->dev, NULL); |
2746 | if (IS_ERR(pp->clk)) { | 2740 | if (IS_ERR(pp->clk)) { |
2747 | err = PTR_ERR(pp->clk); | 2741 | err = PTR_ERR(pp->clk); |
2748 | goto err_unmap; | 2742 | goto err_free_irq; |
2749 | } | 2743 | } |
2750 | 2744 | ||
2751 | clk_prepare_enable(pp->clk); | 2745 | clk_prepare_enable(pp->clk); |
2752 | 2746 | ||
2747 | pp->base = of_iomap(dn, 0); | ||
2748 | if (pp->base == NULL) { | ||
2749 | err = -ENOMEM; | ||
2750 | goto err_clk; | ||
2751 | } | ||
2752 | |||
2753 | dt_mac_addr = of_get_mac_address(dn); | 2753 | dt_mac_addr = of_get_mac_address(dn); |
2754 | if (dt_mac_addr && is_valid_ether_addr(dt_mac_addr)) { | 2754 | if (dt_mac_addr && is_valid_ether_addr(dt_mac_addr)) { |
2755 | mac_from = "device tree"; | 2755 | mac_from = "device tree"; |
@@ -2766,6 +2766,9 @@ static int mvneta_probe(struct platform_device *pdev) | |||
2766 | } | 2766 | } |
2767 | 2767 | ||
2768 | pp->tx_done_timer.data = (unsigned long)dev; | 2768 | pp->tx_done_timer.data = (unsigned long)dev; |
2769 | pp->tx_done_timer.function = mvneta_tx_done_timer_callback; | ||
2770 | init_timer(&pp->tx_done_timer); | ||
2771 | clear_bit(MVNETA_F_TX_DONE_TIMER_BIT, &pp->flags); | ||
2769 | 2772 | ||
2770 | pp->tx_ring_size = MVNETA_MAX_TXD; | 2773 | pp->tx_ring_size = MVNETA_MAX_TXD; |
2771 | pp->rx_ring_size = MVNETA_MAX_RXD; | 2774 | pp->rx_ring_size = MVNETA_MAX_RXD; |
@@ -2776,7 +2779,7 @@ static int mvneta_probe(struct platform_device *pdev) | |||
2776 | err = mvneta_init(pp, phy_addr); | 2779 | err = mvneta_init(pp, phy_addr); |
2777 | if (err < 0) { | 2780 | if (err < 0) { |
2778 | dev_err(&pdev->dev, "can't init eth hal\n"); | 2781 | dev_err(&pdev->dev, "can't init eth hal\n"); |
2779 | goto err_clk; | 2782 | goto err_unmap; |
2780 | } | 2783 | } |
2781 | mvneta_port_power_up(pp, phy_mode); | 2784 | mvneta_port_power_up(pp, phy_mode); |
2782 | 2785 | ||
@@ -2806,10 +2809,10 @@ static int mvneta_probe(struct platform_device *pdev) | |||
2806 | 2809 | ||
2807 | err_deinit: | 2810 | err_deinit: |
2808 | mvneta_deinit(pp); | 2811 | mvneta_deinit(pp); |
2809 | err_clk: | ||
2810 | clk_disable_unprepare(pp->clk); | ||
2811 | err_unmap: | 2812 | err_unmap: |
2812 | iounmap(pp->base); | 2813 | iounmap(pp->base); |
2814 | err_clk: | ||
2815 | clk_disable_unprepare(pp->clk); | ||
2813 | err_free_irq: | 2816 | err_free_irq: |
2814 | irq_dispose_mapping(dev->irq); | 2817 | irq_dispose_mapping(dev->irq); |
2815 | err_free_netdev: | 2818 | err_free_netdev: |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index 727874f575ce..a28cd801a236 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | |||
@@ -223,7 +223,7 @@ static int mlx4_en_get_sset_count(struct net_device *dev, int sset) | |||
223 | case ETH_SS_STATS: | 223 | case ETH_SS_STATS: |
224 | return (priv->stats_bitmap ? bit_count : NUM_ALL_STATS) + | 224 | return (priv->stats_bitmap ? bit_count : NUM_ALL_STATS) + |
225 | (priv->tx_ring_num * 2) + | 225 | (priv->tx_ring_num * 2) + |
226 | #ifdef CONFIG_NET_LL_RX_POLL | 226 | #ifdef CONFIG_NET_RX_BUSY_POLL |
227 | (priv->rx_ring_num * 5); | 227 | (priv->rx_ring_num * 5); |
228 | #else | 228 | #else |
229 | (priv->rx_ring_num * 2); | 229 | (priv->rx_ring_num * 2); |
@@ -276,7 +276,7 @@ static void mlx4_en_get_ethtool_stats(struct net_device *dev, | |||
276 | for (i = 0; i < priv->rx_ring_num; i++) { | 276 | for (i = 0; i < priv->rx_ring_num; i++) { |
277 | data[index++] = priv->rx_ring[i].packets; | 277 | data[index++] = priv->rx_ring[i].packets; |
278 | data[index++] = priv->rx_ring[i].bytes; | 278 | data[index++] = priv->rx_ring[i].bytes; |
279 | #ifdef CONFIG_NET_LL_RX_POLL | 279 | #ifdef CONFIG_NET_RX_BUSY_POLL |
280 | data[index++] = priv->rx_ring[i].yields; | 280 | data[index++] = priv->rx_ring[i].yields; |
281 | data[index++] = priv->rx_ring[i].misses; | 281 | data[index++] = priv->rx_ring[i].misses; |
282 | data[index++] = priv->rx_ring[i].cleaned; | 282 | data[index++] = priv->rx_ring[i].cleaned; |
@@ -344,7 +344,7 @@ static void mlx4_en_get_strings(struct net_device *dev, | |||
344 | "rx%d_packets", i); | 344 | "rx%d_packets", i); |
345 | sprintf(data + (index++) * ETH_GSTRING_LEN, | 345 | sprintf(data + (index++) * ETH_GSTRING_LEN, |
346 | "rx%d_bytes", i); | 346 | "rx%d_bytes", i); |
347 | #ifdef CONFIG_NET_LL_RX_POLL | 347 | #ifdef CONFIG_NET_RX_BUSY_POLL |
348 | sprintf(data + (index++) * ETH_GSTRING_LEN, | 348 | sprintf(data + (index++) * ETH_GSTRING_LEN, |
349 | "rx%d_napi_yield", i); | 349 | "rx%d_napi_yield", i); |
350 | sprintf(data + (index++) * ETH_GSTRING_LEN, | 350 | sprintf(data + (index++) * ETH_GSTRING_LEN, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 5eac871399d8..fa37b7a61213 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -68,7 +68,7 @@ int mlx4_en_setup_tc(struct net_device *dev, u8 up) | |||
68 | return 0; | 68 | return 0; |
69 | } | 69 | } |
70 | 70 | ||
71 | #ifdef CONFIG_NET_LL_RX_POLL | 71 | #ifdef CONFIG_NET_RX_BUSY_POLL |
72 | /* must be called with local_bh_disable()d */ | 72 | /* must be called with local_bh_disable()d */ |
73 | static int mlx4_en_low_latency_recv(struct napi_struct *napi) | 73 | static int mlx4_en_low_latency_recv(struct napi_struct *napi) |
74 | { | 74 | { |
@@ -94,7 +94,7 @@ static int mlx4_en_low_latency_recv(struct napi_struct *napi) | |||
94 | 94 | ||
95 | return done; | 95 | return done; |
96 | } | 96 | } |
97 | #endif /* CONFIG_NET_LL_RX_POLL */ | 97 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
98 | 98 | ||
99 | #ifdef CONFIG_RFS_ACCEL | 99 | #ifdef CONFIG_RFS_ACCEL |
100 | 100 | ||
@@ -2140,7 +2140,7 @@ static const struct net_device_ops mlx4_netdev_ops = { | |||
2140 | #ifdef CONFIG_RFS_ACCEL | 2140 | #ifdef CONFIG_RFS_ACCEL |
2141 | .ndo_rx_flow_steer = mlx4_en_filter_rfs, | 2141 | .ndo_rx_flow_steer = mlx4_en_filter_rfs, |
2142 | #endif | 2142 | #endif |
2143 | #ifdef CONFIG_NET_LL_RX_POLL | 2143 | #ifdef CONFIG_NET_RX_BUSY_POLL |
2144 | .ndo_busy_poll = mlx4_en_low_latency_recv, | 2144 | .ndo_busy_poll = mlx4_en_low_latency_recv, |
2145 | #endif | 2145 | #endif |
2146 | }; | 2146 | }; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index 8873d6802c80..6fc6dabc78d5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c | |||
@@ -845,16 +845,7 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave, | |||
845 | MLX4_CMD_NATIVE); | 845 | MLX4_CMD_NATIVE); |
846 | 846 | ||
847 | if (!err && dev->caps.function != slave) { | 847 | if (!err && dev->caps.function != slave) { |
848 | /* if config MAC in DB use it */ | 848 | def_mac = priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac; |
849 | if (priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac) | ||
850 | def_mac = priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac; | ||
851 | else { | ||
852 | /* set slave default_mac address */ | ||
853 | MLX4_GET(def_mac, outbox->buf, QUERY_PORT_MAC_OFFSET); | ||
854 | def_mac += slave << 8; | ||
855 | priv->mfunc.master.vf_admin[slave].vport[vhcr->in_modifier].mac = def_mac; | ||
856 | } | ||
857 | |||
858 | MLX4_PUT(outbox->buf, def_mac, QUERY_PORT_MAC_OFFSET); | 849 | MLX4_PUT(outbox->buf, def_mac, QUERY_PORT_MAC_OFFSET); |
859 | 850 | ||
860 | /* get port type - currently only eth is enabled */ | 851 | /* get port type - currently only eth is enabled */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index e85af922dcdc..36be3208786a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -371,7 +371,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
371 | 371 | ||
372 | dev->caps.sqp_demux = (mlx4_is_master(dev)) ? MLX4_MAX_NUM_SLAVES : 0; | 372 | dev->caps.sqp_demux = (mlx4_is_master(dev)) ? MLX4_MAX_NUM_SLAVES : 0; |
373 | 373 | ||
374 | if (!enable_64b_cqe_eqe) { | 374 | if (!enable_64b_cqe_eqe && !mlx4_is_slave(dev)) { |
375 | if (dev_cap->flags & | 375 | if (dev_cap->flags & |
376 | (MLX4_DEV_CAP_FLAG_64B_CQE | MLX4_DEV_CAP_FLAG_64B_EQE)) { | 376 | (MLX4_DEV_CAP_FLAG_64B_CQE | MLX4_DEV_CAP_FLAG_64B_EQE)) { |
377 | mlx4_warn(dev, "64B EQEs/CQEs supported by the device but not enabled\n"); | 377 | mlx4_warn(dev, "64B EQEs/CQEs supported by the device but not enabled\n"); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 35fb60e2320c..5e0aa569306a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -292,7 +292,7 @@ struct mlx4_en_rx_ring { | |||
292 | void *rx_info; | 292 | void *rx_info; |
293 | unsigned long bytes; | 293 | unsigned long bytes; |
294 | unsigned long packets; | 294 | unsigned long packets; |
295 | #ifdef CONFIG_NET_LL_RX_POLL | 295 | #ifdef CONFIG_NET_RX_BUSY_POLL |
296 | unsigned long yields; | 296 | unsigned long yields; |
297 | unsigned long misses; | 297 | unsigned long misses; |
298 | unsigned long cleaned; | 298 | unsigned long cleaned; |
@@ -318,7 +318,7 @@ struct mlx4_en_cq { | |||
318 | struct mlx4_cqe *buf; | 318 | struct mlx4_cqe *buf; |
319 | #define MLX4_EN_OPCODE_ERROR 0x1e | 319 | #define MLX4_EN_OPCODE_ERROR 0x1e |
320 | 320 | ||
321 | #ifdef CONFIG_NET_LL_RX_POLL | 321 | #ifdef CONFIG_NET_RX_BUSY_POLL |
322 | unsigned int state; | 322 | unsigned int state; |
323 | #define MLX4_EN_CQ_STATE_IDLE 0 | 323 | #define MLX4_EN_CQ_STATE_IDLE 0 |
324 | #define MLX4_EN_CQ_STATE_NAPI 1 /* NAPI owns this CQ */ | 324 | #define MLX4_EN_CQ_STATE_NAPI 1 /* NAPI owns this CQ */ |
@@ -329,7 +329,7 @@ struct mlx4_en_cq { | |||
329 | #define CQ_YIELD (MLX4_EN_CQ_STATE_NAPI_YIELD | MLX4_EN_CQ_STATE_POLL_YIELD) | 329 | #define CQ_YIELD (MLX4_EN_CQ_STATE_NAPI_YIELD | MLX4_EN_CQ_STATE_POLL_YIELD) |
330 | #define CQ_USER_PEND (MLX4_EN_CQ_STATE_POLL | MLX4_EN_CQ_STATE_POLL_YIELD) | 330 | #define CQ_USER_PEND (MLX4_EN_CQ_STATE_POLL | MLX4_EN_CQ_STATE_POLL_YIELD) |
331 | spinlock_t poll_lock; /* protects from LLS/napi conflicts */ | 331 | spinlock_t poll_lock; /* protects from LLS/napi conflicts */ |
332 | #endif /* CONFIG_NET_LL_RX_POLL */ | 332 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
333 | }; | 333 | }; |
334 | 334 | ||
335 | struct mlx4_en_port_profile { | 335 | struct mlx4_en_port_profile { |
@@ -580,7 +580,7 @@ struct mlx4_mac_entry { | |||
580 | struct rcu_head rcu; | 580 | struct rcu_head rcu; |
581 | }; | 581 | }; |
582 | 582 | ||
583 | #ifdef CONFIG_NET_LL_RX_POLL | 583 | #ifdef CONFIG_NET_RX_BUSY_POLL |
584 | static inline void mlx4_en_cq_init_lock(struct mlx4_en_cq *cq) | 584 | static inline void mlx4_en_cq_init_lock(struct mlx4_en_cq *cq) |
585 | { | 585 | { |
586 | spin_lock_init(&cq->poll_lock); | 586 | spin_lock_init(&cq->poll_lock); |
@@ -687,7 +687,7 @@ static inline bool mlx4_en_cq_ll_polling(struct mlx4_en_cq *cq) | |||
687 | { | 687 | { |
688 | return false; | 688 | return false; |
689 | } | 689 | } |
690 | #endif /* CONFIG_NET_LL_RX_POLL */ | 690 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
691 | 691 | ||
692 | #define MLX4_EN_WOL_DO_MODIFY (1ULL << 63) | 692 | #define MLX4_EN_WOL_DO_MODIFY (1ULL << 63) |
693 | 693 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index 205753a04cfc..c571de85d0f9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include "mlx5_core.h" | 46 | #include "mlx5_core.h" |
47 | 47 | ||
48 | enum { | 48 | enum { |
49 | CMD_IF_REV = 3, | 49 | CMD_IF_REV = 4, |
50 | }; | 50 | }; |
51 | 51 | ||
52 | enum { | 52 | enum { |
@@ -282,6 +282,12 @@ const char *mlx5_command_str(int command) | |||
282 | case MLX5_CMD_OP_TEARDOWN_HCA: | 282 | case MLX5_CMD_OP_TEARDOWN_HCA: |
283 | return "TEARDOWN_HCA"; | 283 | return "TEARDOWN_HCA"; |
284 | 284 | ||
285 | case MLX5_CMD_OP_ENABLE_HCA: | ||
286 | return "MLX5_CMD_OP_ENABLE_HCA"; | ||
287 | |||
288 | case MLX5_CMD_OP_DISABLE_HCA: | ||
289 | return "MLX5_CMD_OP_DISABLE_HCA"; | ||
290 | |||
285 | case MLX5_CMD_OP_QUERY_PAGES: | 291 | case MLX5_CMD_OP_QUERY_PAGES: |
286 | return "QUERY_PAGES"; | 292 | return "QUERY_PAGES"; |
287 | 293 | ||
@@ -1113,7 +1119,13 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector) | |||
1113 | 1119 | ||
1114 | for (i = 0; i < (1 << cmd->log_sz); i++) { | 1120 | for (i = 0; i < (1 << cmd->log_sz); i++) { |
1115 | if (test_bit(i, &vector)) { | 1121 | if (test_bit(i, &vector)) { |
1122 | struct semaphore *sem; | ||
1123 | |||
1116 | ent = cmd->ent_arr[i]; | 1124 | ent = cmd->ent_arr[i]; |
1125 | if (ent->page_queue) | ||
1126 | sem = &cmd->pages_sem; | ||
1127 | else | ||
1128 | sem = &cmd->sem; | ||
1117 | ktime_get_ts(&ent->ts2); | 1129 | ktime_get_ts(&ent->ts2); |
1118 | memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); | 1130 | memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); |
1119 | dump_command(dev, ent, 0); | 1131 | dump_command(dev, ent, 0); |
@@ -1136,10 +1148,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector) | |||
1136 | } else { | 1148 | } else { |
1137 | complete(&ent->done); | 1149 | complete(&ent->done); |
1138 | } | 1150 | } |
1139 | if (ent->page_queue) | 1151 | up(sem); |
1140 | up(&cmd->pages_sem); | ||
1141 | else | ||
1142 | up(&cmd->sem); | ||
1143 | } | 1152 | } |
1144 | } | 1153 | } |
1145 | } | 1154 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 12242de2b0e3..b47739b0b5f6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
@@ -249,6 +249,44 @@ static int set_hca_ctrl(struct mlx5_core_dev *dev) | |||
249 | return err; | 249 | return err; |
250 | } | 250 | } |
251 | 251 | ||
252 | static int mlx5_core_enable_hca(struct mlx5_core_dev *dev) | ||
253 | { | ||
254 | int err; | ||
255 | struct mlx5_enable_hca_mbox_in in; | ||
256 | struct mlx5_enable_hca_mbox_out out; | ||
257 | |||
258 | memset(&in, 0, sizeof(in)); | ||
259 | memset(&out, 0, sizeof(out)); | ||
260 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_ENABLE_HCA); | ||
261 | err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); | ||
262 | if (err) | ||
263 | return err; | ||
264 | |||
265 | if (out.hdr.status) | ||
266 | return mlx5_cmd_status_to_err(&out.hdr); | ||
267 | |||
268 | return 0; | ||
269 | } | ||
270 | |||
271 | static int mlx5_core_disable_hca(struct mlx5_core_dev *dev) | ||
272 | { | ||
273 | int err; | ||
274 | struct mlx5_disable_hca_mbox_in in; | ||
275 | struct mlx5_disable_hca_mbox_out out; | ||
276 | |||
277 | memset(&in, 0, sizeof(in)); | ||
278 | memset(&out, 0, sizeof(out)); | ||
279 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_DISABLE_HCA); | ||
280 | err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); | ||
281 | if (err) | ||
282 | return err; | ||
283 | |||
284 | if (out.hdr.status) | ||
285 | return mlx5_cmd_status_to_err(&out.hdr); | ||
286 | |||
287 | return 0; | ||
288 | } | ||
289 | |||
252 | int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev) | 290 | int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev) |
253 | { | 291 | { |
254 | struct mlx5_priv *priv = &dev->priv; | 292 | struct mlx5_priv *priv = &dev->priv; |
@@ -304,28 +342,41 @@ int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev) | |||
304 | } | 342 | } |
305 | 343 | ||
306 | mlx5_pagealloc_init(dev); | 344 | mlx5_pagealloc_init(dev); |
345 | |||
346 | err = mlx5_core_enable_hca(dev); | ||
347 | if (err) { | ||
348 | dev_err(&pdev->dev, "enable hca failed\n"); | ||
349 | goto err_pagealloc_cleanup; | ||
350 | } | ||
351 | |||
352 | err = mlx5_satisfy_startup_pages(dev, 1); | ||
353 | if (err) { | ||
354 | dev_err(&pdev->dev, "failed to allocate boot pages\n"); | ||
355 | goto err_disable_hca; | ||
356 | } | ||
357 | |||
307 | err = set_hca_ctrl(dev); | 358 | err = set_hca_ctrl(dev); |
308 | if (err) { | 359 | if (err) { |
309 | dev_err(&pdev->dev, "set_hca_ctrl failed\n"); | 360 | dev_err(&pdev->dev, "set_hca_ctrl failed\n"); |
310 | goto err_pagealloc_cleanup; | 361 | goto reclaim_boot_pages; |
311 | } | 362 | } |
312 | 363 | ||
313 | err = handle_hca_cap(dev); | 364 | err = handle_hca_cap(dev); |
314 | if (err) { | 365 | if (err) { |
315 | dev_err(&pdev->dev, "handle_hca_cap failed\n"); | 366 | dev_err(&pdev->dev, "handle_hca_cap failed\n"); |
316 | goto err_pagealloc_cleanup; | 367 | goto reclaim_boot_pages; |
317 | } | 368 | } |
318 | 369 | ||
319 | err = mlx5_satisfy_startup_pages(dev); | 370 | err = mlx5_satisfy_startup_pages(dev, 0); |
320 | if (err) { | 371 | if (err) { |
321 | dev_err(&pdev->dev, "failed to allocate startup pages\n"); | 372 | dev_err(&pdev->dev, "failed to allocate init pages\n"); |
322 | goto err_pagealloc_cleanup; | 373 | goto reclaim_boot_pages; |
323 | } | 374 | } |
324 | 375 | ||
325 | err = mlx5_pagealloc_start(dev); | 376 | err = mlx5_pagealloc_start(dev); |
326 | if (err) { | 377 | if (err) { |
327 | dev_err(&pdev->dev, "mlx5_pagealloc_start failed\n"); | 378 | dev_err(&pdev->dev, "mlx5_pagealloc_start failed\n"); |
328 | goto err_reclaim_pages; | 379 | goto reclaim_boot_pages; |
329 | } | 380 | } |
330 | 381 | ||
331 | err = mlx5_cmd_init_hca(dev); | 382 | err = mlx5_cmd_init_hca(dev); |
@@ -396,9 +447,12 @@ err_stop_poll: | |||
396 | err_pagealloc_stop: | 447 | err_pagealloc_stop: |
397 | mlx5_pagealloc_stop(dev); | 448 | mlx5_pagealloc_stop(dev); |
398 | 449 | ||
399 | err_reclaim_pages: | 450 | reclaim_boot_pages: |
400 | mlx5_reclaim_startup_pages(dev); | 451 | mlx5_reclaim_startup_pages(dev); |
401 | 452 | ||
453 | err_disable_hca: | ||
454 | mlx5_core_disable_hca(dev); | ||
455 | |||
402 | err_pagealloc_cleanup: | 456 | err_pagealloc_cleanup: |
403 | mlx5_pagealloc_cleanup(dev); | 457 | mlx5_pagealloc_cleanup(dev); |
404 | mlx5_cmd_cleanup(dev); | 458 | mlx5_cmd_cleanup(dev); |
@@ -434,6 +488,7 @@ void mlx5_dev_cleanup(struct mlx5_core_dev *dev) | |||
434 | mlx5_cmd_teardown_hca(dev); | 488 | mlx5_cmd_teardown_hca(dev); |
435 | mlx5_pagealloc_stop(dev); | 489 | mlx5_pagealloc_stop(dev); |
436 | mlx5_reclaim_startup_pages(dev); | 490 | mlx5_reclaim_startup_pages(dev); |
491 | mlx5_core_disable_hca(dev); | ||
437 | mlx5_pagealloc_cleanup(dev); | 492 | mlx5_pagealloc_cleanup(dev); |
438 | mlx5_cmd_cleanup(dev); | 493 | mlx5_cmd_cleanup(dev); |
439 | iounmap(dev->iseg); | 494 | iounmap(dev->iseg); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c index f0bf46339b28..4a3e137931a3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | |||
@@ -64,7 +64,7 @@ struct mlx5_query_pages_inbox { | |||
64 | 64 | ||
65 | struct mlx5_query_pages_outbox { | 65 | struct mlx5_query_pages_outbox { |
66 | struct mlx5_outbox_hdr hdr; | 66 | struct mlx5_outbox_hdr hdr; |
67 | u8 reserved[2]; | 67 | __be16 num_boot_pages; |
68 | __be16 func_id; | 68 | __be16 func_id; |
69 | __be16 init_pages; | 69 | __be16 init_pages; |
70 | __be16 num_pages; | 70 | __be16 num_pages; |
@@ -146,7 +146,7 @@ static struct page *remove_page(struct mlx5_core_dev *dev, u64 addr) | |||
146 | } | 146 | } |
147 | 147 | ||
148 | static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, | 148 | static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, |
149 | s16 *pages, s16 *init_pages) | 149 | s16 *pages, s16 *init_pages, u16 *boot_pages) |
150 | { | 150 | { |
151 | struct mlx5_query_pages_inbox in; | 151 | struct mlx5_query_pages_inbox in; |
152 | struct mlx5_query_pages_outbox out; | 152 | struct mlx5_query_pages_outbox out; |
@@ -164,8 +164,13 @@ static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, | |||
164 | 164 | ||
165 | if (pages) | 165 | if (pages) |
166 | *pages = be16_to_cpu(out.num_pages); | 166 | *pages = be16_to_cpu(out.num_pages); |
167 | |||
167 | if (init_pages) | 168 | if (init_pages) |
168 | *init_pages = be16_to_cpu(out.init_pages); | 169 | *init_pages = be16_to_cpu(out.init_pages); |
170 | |||
171 | if (boot_pages) | ||
172 | *boot_pages = be16_to_cpu(out.num_boot_pages); | ||
173 | |||
169 | *func_id = be16_to_cpu(out.func_id); | 174 | *func_id = be16_to_cpu(out.func_id); |
170 | 175 | ||
171 | return err; | 176 | return err; |
@@ -357,19 +362,22 @@ void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, | |||
357 | queue_work(dev->priv.pg_wq, &req->work); | 362 | queue_work(dev->priv.pg_wq, &req->work); |
358 | } | 363 | } |
359 | 364 | ||
360 | int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev) | 365 | int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot) |
361 | { | 366 | { |
367 | u16 uninitialized_var(boot_pages); | ||
362 | s16 uninitialized_var(init_pages); | 368 | s16 uninitialized_var(init_pages); |
363 | u16 uninitialized_var(func_id); | 369 | u16 uninitialized_var(func_id); |
364 | int err; | 370 | int err; |
365 | 371 | ||
366 | err = mlx5_cmd_query_pages(dev, &func_id, NULL, &init_pages); | 372 | err = mlx5_cmd_query_pages(dev, &func_id, NULL, &init_pages, |
373 | &boot_pages); | ||
367 | if (err) | 374 | if (err) |
368 | return err; | 375 | return err; |
369 | 376 | ||
370 | mlx5_core_dbg(dev, "requested %d init pages for func_id 0x%x\n", init_pages, func_id); | ||
371 | 377 | ||
372 | return give_pages(dev, func_id, init_pages, 0); | 378 | mlx5_core_dbg(dev, "requested %d init pages and %d boot pages for func_id 0x%x\n", |
379 | init_pages, boot_pages, func_id); | ||
380 | return give_pages(dev, func_id, boot ? boot_pages : init_pages, 0); | ||
373 | } | 381 | } |
374 | 382 | ||
375 | static int optimal_reclaimed_pages(void) | 383 | static int optimal_reclaimed_pages(void) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/uar.c b/drivers/net/ethernet/mellanox/mlx5/core/uar.c index 71d4a3937200..68f5d9c77c7b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/uar.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/uar.c | |||
@@ -164,6 +164,7 @@ int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari) | |||
164 | uuari->uars[i].map = ioremap(addr, PAGE_SIZE); | 164 | uuari->uars[i].map = ioremap(addr, PAGE_SIZE); |
165 | if (!uuari->uars[i].map) { | 165 | if (!uuari->uars[i].map) { |
166 | mlx5_cmd_free_uar(dev, uuari->uars[i].index); | 166 | mlx5_cmd_free_uar(dev, uuari->uars[i].index); |
167 | err = -ENOMEM; | ||
167 | goto out_count; | 168 | goto out_count; |
168 | } | 169 | } |
169 | mlx5_core_dbg(dev, "allocated uar index 0x%x, mmaped at %p\n", | 170 | mlx5_core_dbg(dev, "allocated uar index 0x%x, mmaped at %p\n", |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig index cb22341a14a8..a588ffde9700 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig +++ b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | config PCH_GBE | 5 | config PCH_GBE |
6 | tristate "OKI SEMICONDUCTOR IOH(ML7223/ML7831) GbE" | 6 | tristate "OKI SEMICONDUCTOR IOH(ML7223/ML7831) GbE" |
7 | depends on PCI | 7 | depends on PCI && (X86 || COMPILE_TEST) |
8 | select MII | 8 | select MII |
9 | select PTP_1588_CLOCK_PCH | 9 | select PTP_1588_CLOCK_PCH |
10 | ---help--- | 10 | ---help--- |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index b00cf5665eab..221645e9f182 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
@@ -1400,8 +1400,8 @@ void qlcnic_pci_camqm_write_2M(struct qlcnic_adapter *, u64, u64); | |||
1400 | #define ADDR_IN_RANGE(addr, low, high) \ | 1400 | #define ADDR_IN_RANGE(addr, low, high) \ |
1401 | (((addr) < (high)) && ((addr) >= (low))) | 1401 | (((addr) < (high)) && ((addr) >= (low))) |
1402 | 1402 | ||
1403 | #define QLCRD32(adapter, off) \ | 1403 | #define QLCRD32(adapter, off, err) \ |
1404 | (adapter->ahw->hw_ops->read_reg)(adapter, off) | 1404 | (adapter->ahw->hw_ops->read_reg)(adapter, off, err) |
1405 | 1405 | ||
1406 | #define QLCWR32(adapter, off, val) \ | 1406 | #define QLCWR32(adapter, off, val) \ |
1407 | adapter->ahw->hw_ops->write_reg(adapter, off, val) | 1407 | adapter->ahw->hw_ops->write_reg(adapter, off, val) |
@@ -1604,7 +1604,7 @@ struct qlcnic_nic_template { | |||
1604 | struct qlcnic_hardware_ops { | 1604 | struct qlcnic_hardware_ops { |
1605 | void (*read_crb) (struct qlcnic_adapter *, char *, loff_t, size_t); | 1605 | void (*read_crb) (struct qlcnic_adapter *, char *, loff_t, size_t); |
1606 | void (*write_crb) (struct qlcnic_adapter *, char *, loff_t, size_t); | 1606 | void (*write_crb) (struct qlcnic_adapter *, char *, loff_t, size_t); |
1607 | int (*read_reg) (struct qlcnic_adapter *, ulong); | 1607 | int (*read_reg) (struct qlcnic_adapter *, ulong, int *); |
1608 | int (*write_reg) (struct qlcnic_adapter *, ulong, u32); | 1608 | int (*write_reg) (struct qlcnic_adapter *, ulong, u32); |
1609 | void (*get_ocm_win) (struct qlcnic_hardware_context *); | 1609 | void (*get_ocm_win) (struct qlcnic_hardware_context *); |
1610 | int (*get_mac_address) (struct qlcnic_adapter *, u8 *); | 1610 | int (*get_mac_address) (struct qlcnic_adapter *, u8 *); |
@@ -1662,12 +1662,6 @@ static inline void qlcnic_write_crb(struct qlcnic_adapter *adapter, char *buf, | |||
1662 | adapter->ahw->hw_ops->write_crb(adapter, buf, offset, size); | 1662 | adapter->ahw->hw_ops->write_crb(adapter, buf, offset, size); |
1663 | } | 1663 | } |
1664 | 1664 | ||
1665 | static inline int qlcnic_hw_read_wx_2M(struct qlcnic_adapter *adapter, | ||
1666 | ulong off) | ||
1667 | { | ||
1668 | return adapter->ahw->hw_ops->read_reg(adapter, off); | ||
1669 | } | ||
1670 | |||
1671 | static inline int qlcnic_hw_write_wx_2M(struct qlcnic_adapter *adapter, | 1665 | static inline int qlcnic_hw_write_wx_2M(struct qlcnic_adapter *adapter, |
1672 | ulong off, u32 data) | 1666 | ulong off, u32 data) |
1673 | { | 1667 | { |
@@ -1869,7 +1863,8 @@ static inline void qlcnic_free_mac_list(struct qlcnic_adapter *adapter) | |||
1869 | 1863 | ||
1870 | static inline void qlcnic_set_mac_filter_count(struct qlcnic_adapter *adapter) | 1864 | static inline void qlcnic_set_mac_filter_count(struct qlcnic_adapter *adapter) |
1871 | { | 1865 | { |
1872 | adapter->ahw->hw_ops->set_mac_filter_count(adapter); | 1866 | if (adapter->ahw->hw_ops->set_mac_filter_count) |
1867 | adapter->ahw->hw_ops->set_mac_filter_count(adapter); | ||
1873 | } | 1868 | } |
1874 | 1869 | ||
1875 | static inline void qlcnic_dev_request_reset(struct qlcnic_adapter *adapter, | 1870 | static inline void qlcnic_dev_request_reset(struct qlcnic_adapter *adapter, |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index 0913c623a67e..92da9980a0a0 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | |||
@@ -228,17 +228,17 @@ static int __qlcnic_set_win_base(struct qlcnic_adapter *adapter, u32 addr) | |||
228 | return 0; | 228 | return 0; |
229 | } | 229 | } |
230 | 230 | ||
231 | int qlcnic_83xx_rd_reg_indirect(struct qlcnic_adapter *adapter, ulong addr) | 231 | int qlcnic_83xx_rd_reg_indirect(struct qlcnic_adapter *adapter, ulong addr, |
232 | int *err) | ||
232 | { | 233 | { |
233 | int ret; | ||
234 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 234 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
235 | 235 | ||
236 | ret = __qlcnic_set_win_base(adapter, (u32) addr); | 236 | *err = __qlcnic_set_win_base(adapter, (u32) addr); |
237 | if (!ret) { | 237 | if (!*err) { |
238 | return QLCRDX(ahw, QLCNIC_WILDCARD); | 238 | return QLCRDX(ahw, QLCNIC_WILDCARD); |
239 | } else { | 239 | } else { |
240 | dev_err(&adapter->pdev->dev, | 240 | dev_err(&adapter->pdev->dev, |
241 | "%s failed, addr = 0x%x\n", __func__, (int)addr); | 241 | "%s failed, addr = 0x%lx\n", __func__, addr); |
242 | return -EIO; | 242 | return -EIO; |
243 | } | 243 | } |
244 | } | 244 | } |
@@ -561,7 +561,7 @@ void qlcnic_83xx_cam_unlock(struct qlcnic_adapter *adapter) | |||
561 | void qlcnic_83xx_read_crb(struct qlcnic_adapter *adapter, char *buf, | 561 | void qlcnic_83xx_read_crb(struct qlcnic_adapter *adapter, char *buf, |
562 | loff_t offset, size_t size) | 562 | loff_t offset, size_t size) |
563 | { | 563 | { |
564 | int ret; | 564 | int ret = 0; |
565 | u32 data; | 565 | u32 data; |
566 | 566 | ||
567 | if (qlcnic_api_lock(adapter)) { | 567 | if (qlcnic_api_lock(adapter)) { |
@@ -571,7 +571,7 @@ void qlcnic_83xx_read_crb(struct qlcnic_adapter *adapter, char *buf, | |||
571 | return; | 571 | return; |
572 | } | 572 | } |
573 | 573 | ||
574 | ret = qlcnic_83xx_rd_reg_indirect(adapter, (u32) offset); | 574 | data = QLCRD32(adapter, (u32) offset, &ret); |
575 | qlcnic_api_unlock(adapter); | 575 | qlcnic_api_unlock(adapter); |
576 | 576 | ||
577 | if (ret == -EIO) { | 577 | if (ret == -EIO) { |
@@ -580,7 +580,6 @@ void qlcnic_83xx_read_crb(struct qlcnic_adapter *adapter, char *buf, | |||
580 | __func__, (u32)offset); | 580 | __func__, (u32)offset); |
581 | return; | 581 | return; |
582 | } | 582 | } |
583 | data = ret; | ||
584 | memcpy(buf, &data, size); | 583 | memcpy(buf, &data, size); |
585 | } | 584 | } |
586 | 585 | ||
@@ -2075,18 +2074,25 @@ void qlcnic_83xx_config_intr_coal(struct qlcnic_adapter *adapter) | |||
2075 | static void qlcnic_83xx_handle_link_aen(struct qlcnic_adapter *adapter, | 2074 | static void qlcnic_83xx_handle_link_aen(struct qlcnic_adapter *adapter, |
2076 | u32 data[]) | 2075 | u32 data[]) |
2077 | { | 2076 | { |
2077 | struct qlcnic_hardware_context *ahw = adapter->ahw; | ||
2078 | u8 link_status, duplex; | 2078 | u8 link_status, duplex; |
2079 | /* link speed */ | 2079 | /* link speed */ |
2080 | link_status = LSB(data[3]) & 1; | 2080 | link_status = LSB(data[3]) & 1; |
2081 | adapter->ahw->link_speed = MSW(data[2]); | 2081 | if (link_status) { |
2082 | adapter->ahw->link_autoneg = MSB(MSW(data[3])); | 2082 | ahw->link_speed = MSW(data[2]); |
2083 | adapter->ahw->module_type = MSB(LSW(data[3])); | 2083 | duplex = LSB(MSW(data[3])); |
2084 | duplex = LSB(MSW(data[3])); | 2084 | if (duplex) |
2085 | if (duplex) | 2085 | ahw->link_duplex = DUPLEX_FULL; |
2086 | adapter->ahw->link_duplex = DUPLEX_FULL; | 2086 | else |
2087 | else | 2087 | ahw->link_duplex = DUPLEX_HALF; |
2088 | adapter->ahw->link_duplex = DUPLEX_HALF; | 2088 | } else { |
2089 | adapter->ahw->has_link_events = 1; | 2089 | ahw->link_speed = SPEED_UNKNOWN; |
2090 | ahw->link_duplex = DUPLEX_UNKNOWN; | ||
2091 | } | ||
2092 | |||
2093 | ahw->link_autoneg = MSB(MSW(data[3])); | ||
2094 | ahw->module_type = MSB(LSW(data[3])); | ||
2095 | ahw->has_link_events = 1; | ||
2090 | qlcnic_advert_link_change(adapter, link_status); | 2096 | qlcnic_advert_link_change(adapter, link_status); |
2091 | } | 2097 | } |
2092 | 2098 | ||
@@ -2384,9 +2390,9 @@ int qlcnic_83xx_lockless_flash_read32(struct qlcnic_adapter *adapter, | |||
2384 | u32 flash_addr, u8 *p_data, | 2390 | u32 flash_addr, u8 *p_data, |
2385 | int count) | 2391 | int count) |
2386 | { | 2392 | { |
2387 | int i, ret; | 2393 | u32 word, range, flash_offset, addr = flash_addr, ret; |
2388 | u32 word, range, flash_offset, addr = flash_addr; | ||
2389 | ulong indirect_add, direct_window; | 2394 | ulong indirect_add, direct_window; |
2395 | int i, err = 0; | ||
2390 | 2396 | ||
2391 | flash_offset = addr & (QLCNIC_FLASH_SECTOR_SIZE - 1); | 2397 | flash_offset = addr & (QLCNIC_FLASH_SECTOR_SIZE - 1); |
2392 | if (addr & 0x3) { | 2398 | if (addr & 0x3) { |
@@ -2404,10 +2410,9 @@ int qlcnic_83xx_lockless_flash_read32(struct qlcnic_adapter *adapter, | |||
2404 | /* Multi sector read */ | 2410 | /* Multi sector read */ |
2405 | for (i = 0; i < count; i++) { | 2411 | for (i = 0; i < count; i++) { |
2406 | indirect_add = QLC_83XX_FLASH_DIRECT_DATA(addr); | 2412 | indirect_add = QLC_83XX_FLASH_DIRECT_DATA(addr); |
2407 | ret = qlcnic_83xx_rd_reg_indirect(adapter, | 2413 | ret = QLCRD32(adapter, indirect_add, &err); |
2408 | indirect_add); | 2414 | if (err == -EIO) |
2409 | if (ret == -EIO) | 2415 | return err; |
2410 | return -EIO; | ||
2411 | 2416 | ||
2412 | word = ret; | 2417 | word = ret; |
2413 | *(u32 *)p_data = word; | 2418 | *(u32 *)p_data = word; |
@@ -2428,10 +2433,9 @@ int qlcnic_83xx_lockless_flash_read32(struct qlcnic_adapter *adapter, | |||
2428 | /* Single sector read */ | 2433 | /* Single sector read */ |
2429 | for (i = 0; i < count; i++) { | 2434 | for (i = 0; i < count; i++) { |
2430 | indirect_add = QLC_83XX_FLASH_DIRECT_DATA(addr); | 2435 | indirect_add = QLC_83XX_FLASH_DIRECT_DATA(addr); |
2431 | ret = qlcnic_83xx_rd_reg_indirect(adapter, | 2436 | ret = QLCRD32(adapter, indirect_add, &err); |
2432 | indirect_add); | 2437 | if (err == -EIO) |
2433 | if (ret == -EIO) | 2438 | return err; |
2434 | return -EIO; | ||
2435 | 2439 | ||
2436 | word = ret; | 2440 | word = ret; |
2437 | *(u32 *)p_data = word; | 2441 | *(u32 *)p_data = word; |
@@ -2447,10 +2451,13 @@ static int qlcnic_83xx_poll_flash_status_reg(struct qlcnic_adapter *adapter) | |||
2447 | { | 2451 | { |
2448 | u32 status; | 2452 | u32 status; |
2449 | int retries = QLC_83XX_FLASH_READ_RETRY_COUNT; | 2453 | int retries = QLC_83XX_FLASH_READ_RETRY_COUNT; |
2454 | int err = 0; | ||
2450 | 2455 | ||
2451 | do { | 2456 | do { |
2452 | status = qlcnic_83xx_rd_reg_indirect(adapter, | 2457 | status = QLCRD32(adapter, QLC_83XX_FLASH_STATUS, &err); |
2453 | QLC_83XX_FLASH_STATUS); | 2458 | if (err == -EIO) |
2459 | return err; | ||
2460 | |||
2454 | if ((status & QLC_83XX_FLASH_STATUS_READY) == | 2461 | if ((status & QLC_83XX_FLASH_STATUS_READY) == |
2455 | QLC_83XX_FLASH_STATUS_READY) | 2462 | QLC_83XX_FLASH_STATUS_READY) |
2456 | break; | 2463 | break; |
@@ -2502,7 +2509,8 @@ int qlcnic_83xx_disable_flash_write(struct qlcnic_adapter *adapter) | |||
2502 | 2509 | ||
2503 | int qlcnic_83xx_read_flash_mfg_id(struct qlcnic_adapter *adapter) | 2510 | int qlcnic_83xx_read_flash_mfg_id(struct qlcnic_adapter *adapter) |
2504 | { | 2511 | { |
2505 | int ret, mfg_id; | 2512 | int ret, err = 0; |
2513 | u32 mfg_id; | ||
2506 | 2514 | ||
2507 | if (qlcnic_83xx_lock_flash(adapter)) | 2515 | if (qlcnic_83xx_lock_flash(adapter)) |
2508 | return -EIO; | 2516 | return -EIO; |
@@ -2517,9 +2525,11 @@ int qlcnic_83xx_read_flash_mfg_id(struct qlcnic_adapter *adapter) | |||
2517 | return -EIO; | 2525 | return -EIO; |
2518 | } | 2526 | } |
2519 | 2527 | ||
2520 | mfg_id = qlcnic_83xx_rd_reg_indirect(adapter, QLC_83XX_FLASH_RDDATA); | 2528 | mfg_id = QLCRD32(adapter, QLC_83XX_FLASH_RDDATA, &err); |
2521 | if (mfg_id == -EIO) | 2529 | if (err == -EIO) { |
2522 | return -EIO; | 2530 | qlcnic_83xx_unlock_flash(adapter); |
2531 | return err; | ||
2532 | } | ||
2523 | 2533 | ||
2524 | adapter->flash_mfg_id = (mfg_id & 0xFF); | 2534 | adapter->flash_mfg_id = (mfg_id & 0xFF); |
2525 | qlcnic_83xx_unlock_flash(adapter); | 2535 | qlcnic_83xx_unlock_flash(adapter); |
@@ -2636,7 +2646,7 @@ int qlcnic_83xx_flash_bulk_write(struct qlcnic_adapter *adapter, u32 addr, | |||
2636 | u32 *p_data, int count) | 2646 | u32 *p_data, int count) |
2637 | { | 2647 | { |
2638 | u32 temp; | 2648 | u32 temp; |
2639 | int ret = -EIO; | 2649 | int ret = -EIO, err = 0; |
2640 | 2650 | ||
2641 | if ((count < QLC_83XX_FLASH_WRITE_MIN) || | 2651 | if ((count < QLC_83XX_FLASH_WRITE_MIN) || |
2642 | (count > QLC_83XX_FLASH_WRITE_MAX)) { | 2652 | (count > QLC_83XX_FLASH_WRITE_MAX)) { |
@@ -2645,8 +2655,10 @@ int qlcnic_83xx_flash_bulk_write(struct qlcnic_adapter *adapter, u32 addr, | |||
2645 | return -EIO; | 2655 | return -EIO; |
2646 | } | 2656 | } |
2647 | 2657 | ||
2648 | temp = qlcnic_83xx_rd_reg_indirect(adapter, | 2658 | temp = QLCRD32(adapter, QLC_83XX_FLASH_SPI_CONTROL, &err); |
2649 | QLC_83XX_FLASH_SPI_CONTROL); | 2659 | if (err == -EIO) |
2660 | return err; | ||
2661 | |||
2650 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_SPI_CONTROL, | 2662 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_SPI_CONTROL, |
2651 | (temp | QLC_83XX_FLASH_SPI_CTRL)); | 2663 | (temp | QLC_83XX_FLASH_SPI_CTRL)); |
2652 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, | 2664 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, |
@@ -2695,13 +2707,18 @@ int qlcnic_83xx_flash_bulk_write(struct qlcnic_adapter *adapter, u32 addr, | |||
2695 | return -EIO; | 2707 | return -EIO; |
2696 | } | 2708 | } |
2697 | 2709 | ||
2698 | ret = qlcnic_83xx_rd_reg_indirect(adapter, QLC_83XX_FLASH_SPI_STATUS); | 2710 | ret = QLCRD32(adapter, QLC_83XX_FLASH_SPI_STATUS, &err); |
2711 | if (err == -EIO) | ||
2712 | return err; | ||
2713 | |||
2699 | if ((ret & QLC_83XX_FLASH_SPI_CTRL) == QLC_83XX_FLASH_SPI_CTRL) { | 2714 | if ((ret & QLC_83XX_FLASH_SPI_CTRL) == QLC_83XX_FLASH_SPI_CTRL) { |
2700 | dev_err(&adapter->pdev->dev, "%s: failed at %d\n", | 2715 | dev_err(&adapter->pdev->dev, "%s: failed at %d\n", |
2701 | __func__, __LINE__); | 2716 | __func__, __LINE__); |
2702 | /* Operation failed, clear error bit */ | 2717 | /* Operation failed, clear error bit */ |
2703 | temp = qlcnic_83xx_rd_reg_indirect(adapter, | 2718 | temp = QLCRD32(adapter, QLC_83XX_FLASH_SPI_CONTROL, &err); |
2704 | QLC_83XX_FLASH_SPI_CONTROL); | 2719 | if (err == -EIO) |
2720 | return err; | ||
2721 | |||
2705 | qlcnic_83xx_wrt_reg_indirect(adapter, | 2722 | qlcnic_83xx_wrt_reg_indirect(adapter, |
2706 | QLC_83XX_FLASH_SPI_CONTROL, | 2723 | QLC_83XX_FLASH_SPI_CONTROL, |
2707 | (temp | QLC_83XX_FLASH_SPI_CTRL)); | 2724 | (temp | QLC_83XX_FLASH_SPI_CTRL)); |
@@ -2823,6 +2840,7 @@ int qlcnic_83xx_ms_mem_write128(struct qlcnic_adapter *adapter, u64 addr, | |||
2823 | { | 2840 | { |
2824 | int i, j, ret = 0; | 2841 | int i, j, ret = 0; |
2825 | u32 temp; | 2842 | u32 temp; |
2843 | int err = 0; | ||
2826 | 2844 | ||
2827 | /* Check alignment */ | 2845 | /* Check alignment */ |
2828 | if (addr & 0xF) | 2846 | if (addr & 0xF) |
@@ -2855,8 +2873,12 @@ int qlcnic_83xx_ms_mem_write128(struct qlcnic_adapter *adapter, u64 addr, | |||
2855 | QLCNIC_TA_WRITE_START); | 2873 | QLCNIC_TA_WRITE_START); |
2856 | 2874 | ||
2857 | for (j = 0; j < MAX_CTL_CHECK; j++) { | 2875 | for (j = 0; j < MAX_CTL_CHECK; j++) { |
2858 | temp = qlcnic_83xx_rd_reg_indirect(adapter, | 2876 | temp = QLCRD32(adapter, QLCNIC_MS_CTRL, &err); |
2859 | QLCNIC_MS_CTRL); | 2877 | if (err == -EIO) { |
2878 | mutex_unlock(&adapter->ahw->mem_lock); | ||
2879 | return err; | ||
2880 | } | ||
2881 | |||
2860 | if ((temp & TA_CTL_BUSY) == 0) | 2882 | if ((temp & TA_CTL_BUSY) == 0) |
2861 | break; | 2883 | break; |
2862 | } | 2884 | } |
@@ -2878,9 +2900,9 @@ int qlcnic_83xx_ms_mem_write128(struct qlcnic_adapter *adapter, u64 addr, | |||
2878 | int qlcnic_83xx_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr, | 2900 | int qlcnic_83xx_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr, |
2879 | u8 *p_data, int count) | 2901 | u8 *p_data, int count) |
2880 | { | 2902 | { |
2881 | int i, ret; | 2903 | u32 word, addr = flash_addr, ret; |
2882 | u32 word, addr = flash_addr; | ||
2883 | ulong indirect_addr; | 2904 | ulong indirect_addr; |
2905 | int i, err = 0; | ||
2884 | 2906 | ||
2885 | if (qlcnic_83xx_lock_flash(adapter) != 0) | 2907 | if (qlcnic_83xx_lock_flash(adapter) != 0) |
2886 | return -EIO; | 2908 | return -EIO; |
@@ -2900,10 +2922,10 @@ int qlcnic_83xx_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr, | |||
2900 | } | 2922 | } |
2901 | 2923 | ||
2902 | indirect_addr = QLC_83XX_FLASH_DIRECT_DATA(addr); | 2924 | indirect_addr = QLC_83XX_FLASH_DIRECT_DATA(addr); |
2903 | ret = qlcnic_83xx_rd_reg_indirect(adapter, | 2925 | ret = QLCRD32(adapter, indirect_addr, &err); |
2904 | indirect_addr); | 2926 | if (err == -EIO) |
2905 | if (ret == -EIO) | 2927 | return err; |
2906 | return -EIO; | 2928 | |
2907 | word = ret; | 2929 | word = ret; |
2908 | *(u32 *)p_data = word; | 2930 | *(u32 *)p_data = word; |
2909 | p_data = p_data + 4; | 2931 | p_data = p_data + 4; |
@@ -3014,8 +3036,8 @@ int qlcnic_83xx_get_settings(struct qlcnic_adapter *adapter, | |||
3014 | } | 3036 | } |
3015 | 3037 | ||
3016 | if (ahw->port_type == QLCNIC_XGBE) { | 3038 | if (ahw->port_type == QLCNIC_XGBE) { |
3017 | ecmd->supported = SUPPORTED_1000baseT_Full; | 3039 | ecmd->supported = SUPPORTED_10000baseT_Full; |
3018 | ecmd->advertising = ADVERTISED_1000baseT_Full; | 3040 | ecmd->advertising = ADVERTISED_10000baseT_Full; |
3019 | } else { | 3041 | } else { |
3020 | ecmd->supported = (SUPPORTED_10baseT_Half | | 3042 | ecmd->supported = (SUPPORTED_10baseT_Half | |
3021 | SUPPORTED_10baseT_Full | | 3043 | SUPPORTED_10baseT_Full | |
@@ -3369,7 +3391,8 @@ int qlcnic_83xx_set_pauseparam(struct qlcnic_adapter *adapter, | |||
3369 | 3391 | ||
3370 | static int qlcnic_83xx_read_flash_status_reg(struct qlcnic_adapter *adapter) | 3392 | static int qlcnic_83xx_read_flash_status_reg(struct qlcnic_adapter *adapter) |
3371 | { | 3393 | { |
3372 | int ret; | 3394 | int ret, err = 0; |
3395 | u32 temp; | ||
3373 | 3396 | ||
3374 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, | 3397 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, |
3375 | QLC_83XX_FLASH_OEM_READ_SIG); | 3398 | QLC_83XX_FLASH_OEM_READ_SIG); |
@@ -3379,8 +3402,11 @@ static int qlcnic_83xx_read_flash_status_reg(struct qlcnic_adapter *adapter) | |||
3379 | if (ret) | 3402 | if (ret) |
3380 | return -EIO; | 3403 | return -EIO; |
3381 | 3404 | ||
3382 | ret = qlcnic_83xx_rd_reg_indirect(adapter, QLC_83XX_FLASH_RDDATA); | 3405 | temp = QLCRD32(adapter, QLC_83XX_FLASH_RDDATA, &err); |
3383 | return ret & 0xFF; | 3406 | if (err == -EIO) |
3407 | return err; | ||
3408 | |||
3409 | return temp & 0xFF; | ||
3384 | } | 3410 | } |
3385 | 3411 | ||
3386 | int qlcnic_83xx_flash_test(struct qlcnic_adapter *adapter) | 3412 | int qlcnic_83xx_flash_test(struct qlcnic_adapter *adapter) |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h index 2548d1403d75..272f56a2e14b 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h | |||
@@ -508,7 +508,7 @@ void qlcnic_83xx_add_sysfs(struct qlcnic_adapter *); | |||
508 | void qlcnic_83xx_remove_sysfs(struct qlcnic_adapter *); | 508 | void qlcnic_83xx_remove_sysfs(struct qlcnic_adapter *); |
509 | void qlcnic_83xx_write_crb(struct qlcnic_adapter *, char *, loff_t, size_t); | 509 | void qlcnic_83xx_write_crb(struct qlcnic_adapter *, char *, loff_t, size_t); |
510 | void qlcnic_83xx_read_crb(struct qlcnic_adapter *, char *, loff_t, size_t); | 510 | void qlcnic_83xx_read_crb(struct qlcnic_adapter *, char *, loff_t, size_t); |
511 | int qlcnic_83xx_rd_reg_indirect(struct qlcnic_adapter *, ulong); | 511 | int qlcnic_83xx_rd_reg_indirect(struct qlcnic_adapter *, ulong, int *); |
512 | int qlcnic_83xx_wrt_reg_indirect(struct qlcnic_adapter *, ulong, u32); | 512 | int qlcnic_83xx_wrt_reg_indirect(struct qlcnic_adapter *, ulong, u32); |
513 | void qlcnic_83xx_process_rcv_diag(struct qlcnic_adapter *, int, u64 []); | 513 | void qlcnic_83xx_process_rcv_diag(struct qlcnic_adapter *, int, u64 []); |
514 | int qlcnic_83xx_nic_set_promisc(struct qlcnic_adapter *, u32); | 514 | int qlcnic_83xx_nic_set_promisc(struct qlcnic_adapter *, u32); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index f41dfab1e9a3..9f4b8d5f0865 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | |||
@@ -1303,8 +1303,11 @@ static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) | |||
1303 | { | 1303 | { |
1304 | int i, j; | 1304 | int i, j; |
1305 | u32 val = 0, val1 = 0, reg = 0; | 1305 | u32 val = 0, val1 = 0, reg = 0; |
1306 | int err = 0; | ||
1306 | 1307 | ||
1307 | val = QLCRD32(adapter, QLC_83XX_SRE_SHIM_REG); | 1308 | val = QLCRD32(adapter, QLC_83XX_SRE_SHIM_REG, &err); |
1309 | if (err == -EIO) | ||
1310 | return; | ||
1308 | dev_info(&adapter->pdev->dev, "SRE-Shim Ctrl:0x%x\n", val); | 1311 | dev_info(&adapter->pdev->dev, "SRE-Shim Ctrl:0x%x\n", val); |
1309 | 1312 | ||
1310 | for (j = 0; j < 2; j++) { | 1313 | for (j = 0; j < 2; j++) { |
@@ -1318,7 +1321,9 @@ static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) | |||
1318 | reg = QLC_83XX_PORT1_THRESHOLD; | 1321 | reg = QLC_83XX_PORT1_THRESHOLD; |
1319 | } | 1322 | } |
1320 | for (i = 0; i < 8; i++) { | 1323 | for (i = 0; i < 8; i++) { |
1321 | val = QLCRD32(adapter, reg + (i * 0x4)); | 1324 | val = QLCRD32(adapter, reg + (i * 0x4), &err); |
1325 | if (err == -EIO) | ||
1326 | return; | ||
1322 | dev_info(&adapter->pdev->dev, "0x%x ", val); | 1327 | dev_info(&adapter->pdev->dev, "0x%x ", val); |
1323 | } | 1328 | } |
1324 | dev_info(&adapter->pdev->dev, "\n"); | 1329 | dev_info(&adapter->pdev->dev, "\n"); |
@@ -1335,8 +1340,10 @@ static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) | |||
1335 | reg = QLC_83XX_PORT1_TC_MC_REG; | 1340 | reg = QLC_83XX_PORT1_TC_MC_REG; |
1336 | } | 1341 | } |
1337 | for (i = 0; i < 4; i++) { | 1342 | for (i = 0; i < 4; i++) { |
1338 | val = QLCRD32(adapter, reg + (i * 0x4)); | 1343 | val = QLCRD32(adapter, reg + (i * 0x4), &err); |
1339 | dev_info(&adapter->pdev->dev, "0x%x ", val); | 1344 | if (err == -EIO) |
1345 | return; | ||
1346 | dev_info(&adapter->pdev->dev, "0x%x ", val); | ||
1340 | } | 1347 | } |
1341 | dev_info(&adapter->pdev->dev, "\n"); | 1348 | dev_info(&adapter->pdev->dev, "\n"); |
1342 | } | 1349 | } |
@@ -1352,17 +1359,25 @@ static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) | |||
1352 | reg = QLC_83XX_PORT1_TC_STATS; | 1359 | reg = QLC_83XX_PORT1_TC_STATS; |
1353 | } | 1360 | } |
1354 | for (i = 7; i >= 0; i--) { | 1361 | for (i = 7; i >= 0; i--) { |
1355 | val = QLCRD32(adapter, reg); | 1362 | val = QLCRD32(adapter, reg, &err); |
1363 | if (err == -EIO) | ||
1364 | return; | ||
1356 | val &= ~(0x7 << 29); /* Reset bits 29 to 31 */ | 1365 | val &= ~(0x7 << 29); /* Reset bits 29 to 31 */ |
1357 | QLCWR32(adapter, reg, (val | (i << 29))); | 1366 | QLCWR32(adapter, reg, (val | (i << 29))); |
1358 | val = QLCRD32(adapter, reg); | 1367 | val = QLCRD32(adapter, reg, &err); |
1368 | if (err == -EIO) | ||
1369 | return; | ||
1359 | dev_info(&adapter->pdev->dev, "0x%x ", val); | 1370 | dev_info(&adapter->pdev->dev, "0x%x ", val); |
1360 | } | 1371 | } |
1361 | dev_info(&adapter->pdev->dev, "\n"); | 1372 | dev_info(&adapter->pdev->dev, "\n"); |
1362 | } | 1373 | } |
1363 | 1374 | ||
1364 | val = QLCRD32(adapter, QLC_83XX_PORT2_IFB_THRESHOLD); | 1375 | val = QLCRD32(adapter, QLC_83XX_PORT2_IFB_THRESHOLD, &err); |
1365 | val1 = QLCRD32(adapter, QLC_83XX_PORT3_IFB_THRESHOLD); | 1376 | if (err == -EIO) |
1377 | return; | ||
1378 | val1 = QLCRD32(adapter, QLC_83XX_PORT3_IFB_THRESHOLD, &err); | ||
1379 | if (err == -EIO) | ||
1380 | return; | ||
1366 | dev_info(&adapter->pdev->dev, | 1381 | dev_info(&adapter->pdev->dev, |
1367 | "IFB-Pause Thresholds: Port 2:0x%x, Port 3:0x%x\n", | 1382 | "IFB-Pause Thresholds: Port 2:0x%x, Port 3:0x%x\n", |
1368 | val, val1); | 1383 | val, val1); |
@@ -1425,7 +1440,7 @@ static void qlcnic_83xx_take_eport_out_of_reset(struct qlcnic_adapter *adapter) | |||
1425 | static int qlcnic_83xx_check_heartbeat(struct qlcnic_adapter *p_dev) | 1440 | static int qlcnic_83xx_check_heartbeat(struct qlcnic_adapter *p_dev) |
1426 | { | 1441 | { |
1427 | u32 heartbeat, peg_status; | 1442 | u32 heartbeat, peg_status; |
1428 | int retries, ret = -EIO; | 1443 | int retries, ret = -EIO, err = 0; |
1429 | 1444 | ||
1430 | retries = QLCNIC_HEARTBEAT_CHECK_RETRY_COUNT; | 1445 | retries = QLCNIC_HEARTBEAT_CHECK_RETRY_COUNT; |
1431 | p_dev->heartbeat = QLC_SHARED_REG_RD32(p_dev, | 1446 | p_dev->heartbeat = QLC_SHARED_REG_RD32(p_dev, |
@@ -1453,11 +1468,11 @@ static int qlcnic_83xx_check_heartbeat(struct qlcnic_adapter *p_dev) | |||
1453 | "PEG_NET_2_PC: 0x%x, PEG_NET_3_PC: 0x%x,\n" | 1468 | "PEG_NET_2_PC: 0x%x, PEG_NET_3_PC: 0x%x,\n" |
1454 | "PEG_NET_4_PC: 0x%x\n", peg_status, | 1469 | "PEG_NET_4_PC: 0x%x\n", peg_status, |
1455 | QLC_SHARED_REG_RD32(p_dev, QLCNIC_PEG_HALT_STATUS2), | 1470 | QLC_SHARED_REG_RD32(p_dev, QLCNIC_PEG_HALT_STATUS2), |
1456 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_0), | 1471 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_0, &err), |
1457 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_1), | 1472 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_1, &err), |
1458 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_2), | 1473 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_2, &err), |
1459 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_3), | 1474 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_3, &err), |
1460 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_4)); | 1475 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_4, &err)); |
1461 | 1476 | ||
1462 | if (QLCNIC_FWERROR_CODE(peg_status) == 0x67) | 1477 | if (QLCNIC_FWERROR_CODE(peg_status) == 0x67) |
1463 | dev_err(&p_dev->pdev->dev, | 1478 | dev_err(&p_dev->pdev->dev, |
@@ -1501,18 +1516,22 @@ int qlcnic_83xx_check_hw_status(struct qlcnic_adapter *p_dev) | |||
1501 | static int qlcnic_83xx_poll_reg(struct qlcnic_adapter *p_dev, u32 addr, | 1516 | static int qlcnic_83xx_poll_reg(struct qlcnic_adapter *p_dev, u32 addr, |
1502 | int duration, u32 mask, u32 status) | 1517 | int duration, u32 mask, u32 status) |
1503 | { | 1518 | { |
1519 | int timeout_error, err = 0; | ||
1504 | u32 value; | 1520 | u32 value; |
1505 | int timeout_error; | ||
1506 | u8 retries; | 1521 | u8 retries; |
1507 | 1522 | ||
1508 | value = qlcnic_83xx_rd_reg_indirect(p_dev, addr); | 1523 | value = QLCRD32(p_dev, addr, &err); |
1524 | if (err == -EIO) | ||
1525 | return err; | ||
1509 | retries = duration / 10; | 1526 | retries = duration / 10; |
1510 | 1527 | ||
1511 | do { | 1528 | do { |
1512 | if ((value & mask) != status) { | 1529 | if ((value & mask) != status) { |
1513 | timeout_error = 1; | 1530 | timeout_error = 1; |
1514 | msleep(duration / 10); | 1531 | msleep(duration / 10); |
1515 | value = qlcnic_83xx_rd_reg_indirect(p_dev, addr); | 1532 | value = QLCRD32(p_dev, addr, &err); |
1533 | if (err == -EIO) | ||
1534 | return err; | ||
1516 | } else { | 1535 | } else { |
1517 | timeout_error = 0; | 1536 | timeout_error = 0; |
1518 | break; | 1537 | break; |
@@ -1606,9 +1625,12 @@ int qlcnic_83xx_get_reset_instruction_template(struct qlcnic_adapter *p_dev) | |||
1606 | static void qlcnic_83xx_read_write_crb_reg(struct qlcnic_adapter *p_dev, | 1625 | static void qlcnic_83xx_read_write_crb_reg(struct qlcnic_adapter *p_dev, |
1607 | u32 raddr, u32 waddr) | 1626 | u32 raddr, u32 waddr) |
1608 | { | 1627 | { |
1609 | int value; | 1628 | int err = 0; |
1629 | u32 value; | ||
1610 | 1630 | ||
1611 | value = qlcnic_83xx_rd_reg_indirect(p_dev, raddr); | 1631 | value = QLCRD32(p_dev, raddr, &err); |
1632 | if (err == -EIO) | ||
1633 | return; | ||
1612 | qlcnic_83xx_wrt_reg_indirect(p_dev, waddr, value); | 1634 | qlcnic_83xx_wrt_reg_indirect(p_dev, waddr, value); |
1613 | } | 1635 | } |
1614 | 1636 | ||
@@ -1617,12 +1639,16 @@ static void qlcnic_83xx_rmw_crb_reg(struct qlcnic_adapter *p_dev, | |||
1617 | u32 raddr, u32 waddr, | 1639 | u32 raddr, u32 waddr, |
1618 | struct qlc_83xx_rmw *p_rmw_hdr) | 1640 | struct qlc_83xx_rmw *p_rmw_hdr) |
1619 | { | 1641 | { |
1620 | int value; | 1642 | int err = 0; |
1643 | u32 value; | ||
1621 | 1644 | ||
1622 | if (p_rmw_hdr->index_a) | 1645 | if (p_rmw_hdr->index_a) { |
1623 | value = p_dev->ahw->reset.array[p_rmw_hdr->index_a]; | 1646 | value = p_dev->ahw->reset.array[p_rmw_hdr->index_a]; |
1624 | else | 1647 | } else { |
1625 | value = qlcnic_83xx_rd_reg_indirect(p_dev, raddr); | 1648 | value = QLCRD32(p_dev, raddr, &err); |
1649 | if (err == -EIO) | ||
1650 | return; | ||
1651 | } | ||
1626 | 1652 | ||
1627 | value &= p_rmw_hdr->mask; | 1653 | value &= p_rmw_hdr->mask; |
1628 | value <<= p_rmw_hdr->shl; | 1654 | value <<= p_rmw_hdr->shl; |
@@ -1675,7 +1701,7 @@ static void qlcnic_83xx_poll_list(struct qlcnic_adapter *p_dev, | |||
1675 | long delay; | 1701 | long delay; |
1676 | struct qlc_83xx_entry *entry; | 1702 | struct qlc_83xx_entry *entry; |
1677 | struct qlc_83xx_poll *poll; | 1703 | struct qlc_83xx_poll *poll; |
1678 | int i; | 1704 | int i, err = 0; |
1679 | unsigned long arg1, arg2; | 1705 | unsigned long arg1, arg2; |
1680 | 1706 | ||
1681 | poll = (struct qlc_83xx_poll *)((char *)p_hdr + | 1707 | poll = (struct qlc_83xx_poll *)((char *)p_hdr + |
@@ -1699,10 +1725,12 @@ static void qlcnic_83xx_poll_list(struct qlcnic_adapter *p_dev, | |||
1699 | arg1, delay, | 1725 | arg1, delay, |
1700 | poll->mask, | 1726 | poll->mask, |
1701 | poll->status)){ | 1727 | poll->status)){ |
1702 | qlcnic_83xx_rd_reg_indirect(p_dev, | 1728 | QLCRD32(p_dev, arg1, &err); |
1703 | arg1); | 1729 | if (err == -EIO) |
1704 | qlcnic_83xx_rd_reg_indirect(p_dev, | 1730 | return; |
1705 | arg2); | 1731 | QLCRD32(p_dev, arg2, &err); |
1732 | if (err == -EIO) | ||
1733 | return; | ||
1706 | } | 1734 | } |
1707 | } | 1735 | } |
1708 | } | 1736 | } |
@@ -1768,7 +1796,7 @@ static void qlcnic_83xx_poll_read_list(struct qlcnic_adapter *p_dev, | |||
1768 | struct qlc_83xx_entry_hdr *p_hdr) | 1796 | struct qlc_83xx_entry_hdr *p_hdr) |
1769 | { | 1797 | { |
1770 | long delay; | 1798 | long delay; |
1771 | int index, i, j; | 1799 | int index, i, j, err; |
1772 | struct qlc_83xx_quad_entry *entry; | 1800 | struct qlc_83xx_quad_entry *entry; |
1773 | struct qlc_83xx_poll *poll; | 1801 | struct qlc_83xx_poll *poll; |
1774 | unsigned long addr; | 1802 | unsigned long addr; |
@@ -1788,7 +1816,10 @@ static void qlcnic_83xx_poll_read_list(struct qlcnic_adapter *p_dev, | |||
1788 | poll->mask, poll->status)){ | 1816 | poll->mask, poll->status)){ |
1789 | index = p_dev->ahw->reset.array_index; | 1817 | index = p_dev->ahw->reset.array_index; |
1790 | addr = entry->dr_addr; | 1818 | addr = entry->dr_addr; |
1791 | j = qlcnic_83xx_rd_reg_indirect(p_dev, addr); | 1819 | j = QLCRD32(p_dev, addr, &err); |
1820 | if (err == -EIO) | ||
1821 | return; | ||
1822 | |||
1792 | p_dev->ahw->reset.array[index++] = j; | 1823 | p_dev->ahw->reset.array[index++] = j; |
1793 | 1824 | ||
1794 | if (index == QLC_83XX_MAX_RESET_SEQ_ENTRIES) | 1825 | if (index == QLC_83XX_MAX_RESET_SEQ_ENTRIES) |
@@ -2123,6 +2154,8 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac) | |||
2123 | set_bit(QLC_83XX_MBX_READY, &adapter->ahw->idc.status); | 2154 | set_bit(QLC_83XX_MBX_READY, &adapter->ahw->idc.status); |
2124 | qlcnic_83xx_clear_function_resources(adapter); | 2155 | qlcnic_83xx_clear_function_resources(adapter); |
2125 | 2156 | ||
2157 | INIT_DELAYED_WORK(&adapter->idc_aen_work, qlcnic_83xx_idc_aen_work); | ||
2158 | |||
2126 | /* register for NIC IDC AEN Events */ | 2159 | /* register for NIC IDC AEN Events */ |
2127 | qlcnic_83xx_register_nic_idc_func(adapter, 1); | 2160 | qlcnic_83xx_register_nic_idc_func(adapter, 1); |
2128 | 2161 | ||
@@ -2140,8 +2173,6 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac) | |||
2140 | if (adapter->nic_ops->init_driver(adapter)) | 2173 | if (adapter->nic_ops->init_driver(adapter)) |
2141 | return -EIO; | 2174 | return -EIO; |
2142 | 2175 | ||
2143 | INIT_DELAYED_WORK(&adapter->idc_aen_work, qlcnic_83xx_idc_aen_work); | ||
2144 | |||
2145 | /* Periodically monitor device status */ | 2176 | /* Periodically monitor device status */ |
2146 | qlcnic_83xx_idc_poll_dev_state(&adapter->fw_work.work); | 2177 | qlcnic_83xx_idc_poll_dev_state(&adapter->fw_work.work); |
2147 | 2178 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index 0581a484ceb5..d09389b33474 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | |||
@@ -104,7 +104,7 @@ static u32 | |||
104 | qlcnic_poll_rsp(struct qlcnic_adapter *adapter) | 104 | qlcnic_poll_rsp(struct qlcnic_adapter *adapter) |
105 | { | 105 | { |
106 | u32 rsp; | 106 | u32 rsp; |
107 | int timeout = 0; | 107 | int timeout = 0, err = 0; |
108 | 108 | ||
109 | do { | 109 | do { |
110 | /* give atleast 1ms for firmware to respond */ | 110 | /* give atleast 1ms for firmware to respond */ |
@@ -113,7 +113,7 @@ qlcnic_poll_rsp(struct qlcnic_adapter *adapter) | |||
113 | if (++timeout > QLCNIC_OS_CRB_RETRY_COUNT) | 113 | if (++timeout > QLCNIC_OS_CRB_RETRY_COUNT) |
114 | return QLCNIC_CDRP_RSP_TIMEOUT; | 114 | return QLCNIC_CDRP_RSP_TIMEOUT; |
115 | 115 | ||
116 | rsp = QLCRD32(adapter, QLCNIC_CDRP_CRB_OFFSET); | 116 | rsp = QLCRD32(adapter, QLCNIC_CDRP_CRB_OFFSET, &err); |
117 | } while (!QLCNIC_CDRP_IS_RSP(rsp)); | 117 | } while (!QLCNIC_CDRP_IS_RSP(rsp)); |
118 | 118 | ||
119 | return rsp; | 119 | return rsp; |
@@ -122,7 +122,7 @@ qlcnic_poll_rsp(struct qlcnic_adapter *adapter) | |||
122 | int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, | 122 | int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, |
123 | struct qlcnic_cmd_args *cmd) | 123 | struct qlcnic_cmd_args *cmd) |
124 | { | 124 | { |
125 | int i; | 125 | int i, err = 0; |
126 | u32 rsp; | 126 | u32 rsp; |
127 | u32 signature; | 127 | u32 signature; |
128 | struct pci_dev *pdev = adapter->pdev; | 128 | struct pci_dev *pdev = adapter->pdev; |
@@ -148,7 +148,7 @@ int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, | |||
148 | dev_err(&pdev->dev, "card response timeout.\n"); | 148 | dev_err(&pdev->dev, "card response timeout.\n"); |
149 | cmd->rsp.arg[0] = QLCNIC_RCODE_TIMEOUT; | 149 | cmd->rsp.arg[0] = QLCNIC_RCODE_TIMEOUT; |
150 | } else if (rsp == QLCNIC_CDRP_RSP_FAIL) { | 150 | } else if (rsp == QLCNIC_CDRP_RSP_FAIL) { |
151 | cmd->rsp.arg[0] = QLCRD32(adapter, QLCNIC_CDRP_ARG(1)); | 151 | cmd->rsp.arg[0] = QLCRD32(adapter, QLCNIC_CDRP_ARG(1), &err); |
152 | switch (cmd->rsp.arg[0]) { | 152 | switch (cmd->rsp.arg[0]) { |
153 | case QLCNIC_RCODE_INVALID_ARGS: | 153 | case QLCNIC_RCODE_INVALID_ARGS: |
154 | fmt = "CDRP invalid args: [%d]\n"; | 154 | fmt = "CDRP invalid args: [%d]\n"; |
@@ -175,7 +175,7 @@ int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, | |||
175 | cmd->rsp.arg[0] = QLCNIC_RCODE_SUCCESS; | 175 | cmd->rsp.arg[0] = QLCNIC_RCODE_SUCCESS; |
176 | 176 | ||
177 | for (i = 1; i < cmd->rsp.num; i++) | 177 | for (i = 1; i < cmd->rsp.num; i++) |
178 | cmd->rsp.arg[i] = QLCRD32(adapter, QLCNIC_CDRP_ARG(i)); | 178 | cmd->rsp.arg[i] = QLCRD32(adapter, QLCNIC_CDRP_ARG(i), &err); |
179 | 179 | ||
180 | /* Release semaphore */ | 180 | /* Release semaphore */ |
181 | qlcnic_api_unlock(adapter); | 181 | qlcnic_api_unlock(adapter); |
@@ -210,10 +210,10 @@ int qlcnic_fw_cmd_set_drv_version(struct qlcnic_adapter *adapter, u32 fw_cmd) | |||
210 | if (err) { | 210 | if (err) { |
211 | dev_info(&adapter->pdev->dev, | 211 | dev_info(&adapter->pdev->dev, |
212 | "Failed to set driver version in firmware\n"); | 212 | "Failed to set driver version in firmware\n"); |
213 | return -EIO; | 213 | err = -EIO; |
214 | } | 214 | } |
215 | 215 | qlcnic_free_mbx_args(&cmd); | |
216 | return 0; | 216 | return err; |
217 | } | 217 | } |
218 | 218 | ||
219 | int | 219 | int |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 700a46324d09..7aac23ab31d1 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -150,6 +150,7 @@ static const char qlcnic_gstrings_test[][ETH_GSTRING_LEN] = { | |||
150 | "Link_Test_on_offline", | 150 | "Link_Test_on_offline", |
151 | "Interrupt_Test_offline", | 151 | "Interrupt_Test_offline", |
152 | "Internal_Loopback_offline", | 152 | "Internal_Loopback_offline", |
153 | "External_Loopback_offline", | ||
153 | "EEPROM_Test_offline" | 154 | "EEPROM_Test_offline" |
154 | }; | 155 | }; |
155 | 156 | ||
@@ -266,7 +267,7 @@ int qlcnic_82xx_get_settings(struct qlcnic_adapter *adapter, | |||
266 | { | 267 | { |
267 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 268 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
268 | u32 speed, reg; | 269 | u32 speed, reg; |
269 | int check_sfp_module = 0; | 270 | int check_sfp_module = 0, err = 0; |
270 | u16 pcifn = ahw->pci_func; | 271 | u16 pcifn = ahw->pci_func; |
271 | 272 | ||
272 | /* read which mode */ | 273 | /* read which mode */ |
@@ -289,7 +290,7 @@ int qlcnic_82xx_get_settings(struct qlcnic_adapter *adapter, | |||
289 | 290 | ||
290 | } else if (adapter->ahw->port_type == QLCNIC_XGBE) { | 291 | } else if (adapter->ahw->port_type == QLCNIC_XGBE) { |
291 | u32 val = 0; | 292 | u32 val = 0; |
292 | val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR); | 293 | val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR, &err); |
293 | 294 | ||
294 | if (val == QLCNIC_PORT_MODE_802_3_AP) { | 295 | if (val == QLCNIC_PORT_MODE_802_3_AP) { |
295 | ecmd->supported = SUPPORTED_1000baseT_Full; | 296 | ecmd->supported = SUPPORTED_1000baseT_Full; |
@@ -300,9 +301,13 @@ int qlcnic_82xx_get_settings(struct qlcnic_adapter *adapter, | |||
300 | } | 301 | } |
301 | 302 | ||
302 | if (netif_running(adapter->netdev) && ahw->has_link_events) { | 303 | if (netif_running(adapter->netdev) && ahw->has_link_events) { |
303 | reg = QLCRD32(adapter, P3P_LINK_SPEED_REG(pcifn)); | 304 | if (ahw->linkup) { |
304 | speed = P3P_LINK_SPEED_VAL(pcifn, reg); | 305 | reg = QLCRD32(adapter, |
305 | ahw->link_speed = speed * P3P_LINK_SPEED_MHZ; | 306 | P3P_LINK_SPEED_REG(pcifn), &err); |
307 | speed = P3P_LINK_SPEED_VAL(pcifn, reg); | ||
308 | ahw->link_speed = speed * P3P_LINK_SPEED_MHZ; | ||
309 | } | ||
310 | |||
306 | ethtool_cmd_speed_set(ecmd, ahw->link_speed); | 311 | ethtool_cmd_speed_set(ecmd, ahw->link_speed); |
307 | ecmd->autoneg = ahw->link_autoneg; | 312 | ecmd->autoneg = ahw->link_autoneg; |
308 | ecmd->duplex = ahw->link_duplex; | 313 | ecmd->duplex = ahw->link_duplex; |
@@ -463,13 +468,14 @@ static int qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
463 | static int qlcnic_82xx_get_registers(struct qlcnic_adapter *adapter, | 468 | static int qlcnic_82xx_get_registers(struct qlcnic_adapter *adapter, |
464 | u32 *regs_buff) | 469 | u32 *regs_buff) |
465 | { | 470 | { |
466 | int i, j = 0; | 471 | int i, j = 0, err = 0; |
467 | 472 | ||
468 | for (i = QLCNIC_DEV_INFO_SIZE + 1; diag_registers[j] != -1; j++, i++) | 473 | for (i = QLCNIC_DEV_INFO_SIZE + 1; diag_registers[j] != -1; j++, i++) |
469 | regs_buff[i] = QLC_SHARED_REG_RD32(adapter, diag_registers[j]); | 474 | regs_buff[i] = QLC_SHARED_REG_RD32(adapter, diag_registers[j]); |
470 | j = 0; | 475 | j = 0; |
471 | while (ext_diag_registers[j] != -1) | 476 | while (ext_diag_registers[j] != -1) |
472 | regs_buff[i++] = QLCRD32(adapter, ext_diag_registers[j++]); | 477 | regs_buff[i++] = QLCRD32(adapter, ext_diag_registers[j++], |
478 | &err); | ||
473 | return i; | 479 | return i; |
474 | } | 480 | } |
475 | 481 | ||
@@ -519,13 +525,16 @@ qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) | |||
519 | static u32 qlcnic_test_link(struct net_device *dev) | 525 | static u32 qlcnic_test_link(struct net_device *dev) |
520 | { | 526 | { |
521 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 527 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
528 | int err = 0; | ||
522 | u32 val; | 529 | u32 val; |
523 | 530 | ||
524 | if (qlcnic_83xx_check(adapter)) { | 531 | if (qlcnic_83xx_check(adapter)) { |
525 | val = qlcnic_83xx_test_link(adapter); | 532 | val = qlcnic_83xx_test_link(adapter); |
526 | return (val & 1) ? 0 : 1; | 533 | return (val & 1) ? 0 : 1; |
527 | } | 534 | } |
528 | val = QLCRD32(adapter, CRB_XG_STATE_P3P); | 535 | val = QLCRD32(adapter, CRB_XG_STATE_P3P, &err); |
536 | if (err == -EIO) | ||
537 | return err; | ||
529 | val = XG_LINK_STATE_P3P(adapter->ahw->pci_func, val); | 538 | val = XG_LINK_STATE_P3P(adapter->ahw->pci_func, val); |
530 | return (val == XG_LINK_UP_P3P) ? 0 : 1; | 539 | return (val == XG_LINK_UP_P3P) ? 0 : 1; |
531 | } | 540 | } |
@@ -658,6 +667,7 @@ qlcnic_get_pauseparam(struct net_device *netdev, | |||
658 | { | 667 | { |
659 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 668 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
660 | int port = adapter->ahw->physical_port; | 669 | int port = adapter->ahw->physical_port; |
670 | int err = 0; | ||
661 | __u32 val; | 671 | __u32 val; |
662 | 672 | ||
663 | if (qlcnic_83xx_check(adapter)) { | 673 | if (qlcnic_83xx_check(adapter)) { |
@@ -668,9 +678,13 @@ qlcnic_get_pauseparam(struct net_device *netdev, | |||
668 | if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) | 678 | if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) |
669 | return; | 679 | return; |
670 | /* get flow control settings */ | 680 | /* get flow control settings */ |
671 | val = QLCRD32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port)); | 681 | val = QLCRD32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port), &err); |
682 | if (err == -EIO) | ||
683 | return; | ||
672 | pause->rx_pause = qlcnic_gb_get_rx_flowctl(val); | 684 | pause->rx_pause = qlcnic_gb_get_rx_flowctl(val); |
673 | val = QLCRD32(adapter, QLCNIC_NIU_GB_PAUSE_CTL); | 685 | val = QLCRD32(adapter, QLCNIC_NIU_GB_PAUSE_CTL, &err); |
686 | if (err == -EIO) | ||
687 | return; | ||
674 | switch (port) { | 688 | switch (port) { |
675 | case 0: | 689 | case 0: |
676 | pause->tx_pause = !(qlcnic_gb_get_gb0_mask(val)); | 690 | pause->tx_pause = !(qlcnic_gb_get_gb0_mask(val)); |
@@ -690,7 +704,9 @@ qlcnic_get_pauseparam(struct net_device *netdev, | |||
690 | if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) | 704 | if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) |
691 | return; | 705 | return; |
692 | pause->rx_pause = 1; | 706 | pause->rx_pause = 1; |
693 | val = QLCRD32(adapter, QLCNIC_NIU_XG_PAUSE_CTL); | 707 | val = QLCRD32(adapter, QLCNIC_NIU_XG_PAUSE_CTL, &err); |
708 | if (err == -EIO) | ||
709 | return; | ||
694 | if (port == 0) | 710 | if (port == 0) |
695 | pause->tx_pause = !(qlcnic_xg_get_xg0_mask(val)); | 711 | pause->tx_pause = !(qlcnic_xg_get_xg0_mask(val)); |
696 | else | 712 | else |
@@ -707,6 +723,7 @@ qlcnic_set_pauseparam(struct net_device *netdev, | |||
707 | { | 723 | { |
708 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 724 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
709 | int port = adapter->ahw->physical_port; | 725 | int port = adapter->ahw->physical_port; |
726 | int err = 0; | ||
710 | __u32 val; | 727 | __u32 val; |
711 | 728 | ||
712 | if (qlcnic_83xx_check(adapter)) | 729 | if (qlcnic_83xx_check(adapter)) |
@@ -717,7 +734,9 @@ qlcnic_set_pauseparam(struct net_device *netdev, | |||
717 | if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) | 734 | if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) |
718 | return -EIO; | 735 | return -EIO; |
719 | /* set flow control */ | 736 | /* set flow control */ |
720 | val = QLCRD32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port)); | 737 | val = QLCRD32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port), &err); |
738 | if (err == -EIO) | ||
739 | return err; | ||
721 | 740 | ||
722 | if (pause->rx_pause) | 741 | if (pause->rx_pause) |
723 | qlcnic_gb_rx_flowctl(val); | 742 | qlcnic_gb_rx_flowctl(val); |
@@ -728,7 +747,9 @@ qlcnic_set_pauseparam(struct net_device *netdev, | |||
728 | val); | 747 | val); |
729 | QLCWR32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port), val); | 748 | QLCWR32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port), val); |
730 | /* set autoneg */ | 749 | /* set autoneg */ |
731 | val = QLCRD32(adapter, QLCNIC_NIU_GB_PAUSE_CTL); | 750 | val = QLCRD32(adapter, QLCNIC_NIU_GB_PAUSE_CTL, &err); |
751 | if (err == -EIO) | ||
752 | return err; | ||
732 | switch (port) { | 753 | switch (port) { |
733 | case 0: | 754 | case 0: |
734 | if (pause->tx_pause) | 755 | if (pause->tx_pause) |
@@ -764,7 +785,9 @@ qlcnic_set_pauseparam(struct net_device *netdev, | |||
764 | if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) | 785 | if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) |
765 | return -EIO; | 786 | return -EIO; |
766 | 787 | ||
767 | val = QLCRD32(adapter, QLCNIC_NIU_XG_PAUSE_CTL); | 788 | val = QLCRD32(adapter, QLCNIC_NIU_XG_PAUSE_CTL, &err); |
789 | if (err == -EIO) | ||
790 | return err; | ||
768 | if (port == 0) { | 791 | if (port == 0) { |
769 | if (pause->tx_pause) | 792 | if (pause->tx_pause) |
770 | qlcnic_xg_unset_xg0_mask(val); | 793 | qlcnic_xg_unset_xg0_mask(val); |
@@ -788,11 +811,14 @@ static int qlcnic_reg_test(struct net_device *dev) | |||
788 | { | 811 | { |
789 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 812 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
790 | u32 data_read; | 813 | u32 data_read; |
814 | int err = 0; | ||
791 | 815 | ||
792 | if (qlcnic_83xx_check(adapter)) | 816 | if (qlcnic_83xx_check(adapter)) |
793 | return qlcnic_83xx_reg_test(adapter); | 817 | return qlcnic_83xx_reg_test(adapter); |
794 | 818 | ||
795 | data_read = QLCRD32(adapter, QLCNIC_PCIX_PH_REG(0)); | 819 | data_read = QLCRD32(adapter, QLCNIC_PCIX_PH_REG(0), &err); |
820 | if (err == -EIO) | ||
821 | return err; | ||
796 | if ((data_read & 0xffff) != adapter->pdev->vendor) | 822 | if ((data_read & 0xffff) != adapter->pdev->vendor) |
797 | return 1; | 823 | return 1; |
798 | 824 | ||
@@ -1026,8 +1052,15 @@ qlcnic_diag_test(struct net_device *dev, struct ethtool_test *eth_test, | |||
1026 | if (data[3]) | 1052 | if (data[3]) |
1027 | eth_test->flags |= ETH_TEST_FL_FAILED; | 1053 | eth_test->flags |= ETH_TEST_FL_FAILED; |
1028 | 1054 | ||
1029 | data[4] = qlcnic_eeprom_test(dev); | 1055 | if (eth_test->flags & ETH_TEST_FL_EXTERNAL_LB) { |
1030 | if (data[4]) | 1056 | data[4] = qlcnic_loopback_test(dev, QLCNIC_ELB_MODE); |
1057 | if (data[4]) | ||
1058 | eth_test->flags |= ETH_TEST_FL_FAILED; | ||
1059 | eth_test->flags |= ETH_TEST_FL_EXTERNAL_LB_DONE; | ||
1060 | } | ||
1061 | |||
1062 | data[5] = qlcnic_eeprom_test(dev); | ||
1063 | if (data[5]) | ||
1031 | eth_test->flags |= ETH_TEST_FL_FAILED; | 1064 | eth_test->flags |= ETH_TEST_FL_FAILED; |
1032 | } | 1065 | } |
1033 | } | 1066 | } |
@@ -1257,17 +1290,20 @@ qlcnic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
1257 | { | 1290 | { |
1258 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 1291 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
1259 | u32 wol_cfg; | 1292 | u32 wol_cfg; |
1293 | int err = 0; | ||
1260 | 1294 | ||
1261 | if (qlcnic_83xx_check(adapter)) | 1295 | if (qlcnic_83xx_check(adapter)) |
1262 | return; | 1296 | return; |
1263 | wol->supported = 0; | 1297 | wol->supported = 0; |
1264 | wol->wolopts = 0; | 1298 | wol->wolopts = 0; |
1265 | 1299 | ||
1266 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV); | 1300 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV, &err); |
1301 | if (err == -EIO) | ||
1302 | return; | ||
1267 | if (wol_cfg & (1UL << adapter->portnum)) | 1303 | if (wol_cfg & (1UL << adapter->portnum)) |
1268 | wol->supported |= WAKE_MAGIC; | 1304 | wol->supported |= WAKE_MAGIC; |
1269 | 1305 | ||
1270 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG); | 1306 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG, &err); |
1271 | if (wol_cfg & (1UL << adapter->portnum)) | 1307 | if (wol_cfg & (1UL << adapter->portnum)) |
1272 | wol->wolopts |= WAKE_MAGIC; | 1308 | wol->wolopts |= WAKE_MAGIC; |
1273 | } | 1309 | } |
@@ -1277,17 +1313,22 @@ qlcnic_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
1277 | { | 1313 | { |
1278 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 1314 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
1279 | u32 wol_cfg; | 1315 | u32 wol_cfg; |
1316 | int err = 0; | ||
1280 | 1317 | ||
1281 | if (qlcnic_83xx_check(adapter)) | 1318 | if (qlcnic_83xx_check(adapter)) |
1282 | return -EOPNOTSUPP; | 1319 | return -EOPNOTSUPP; |
1283 | if (wol->wolopts & ~WAKE_MAGIC) | 1320 | if (wol->wolopts & ~WAKE_MAGIC) |
1284 | return -EINVAL; | 1321 | return -EINVAL; |
1285 | 1322 | ||
1286 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV); | 1323 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV, &err); |
1324 | if (err == -EIO) | ||
1325 | return err; | ||
1287 | if (!(wol_cfg & (1 << adapter->portnum))) | 1326 | if (!(wol_cfg & (1 << adapter->portnum))) |
1288 | return -EOPNOTSUPP; | 1327 | return -EOPNOTSUPP; |
1289 | 1328 | ||
1290 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG); | 1329 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG, &err); |
1330 | if (err == -EIO) | ||
1331 | return err; | ||
1291 | if (wol->wolopts & WAKE_MAGIC) | 1332 | if (wol->wolopts & WAKE_MAGIC) |
1292 | wol_cfg |= 1UL << adapter->portnum; | 1333 | wol_cfg |= 1UL << adapter->portnum; |
1293 | else | 1334 | else |
@@ -1540,7 +1581,7 @@ qlcnic_set_dump(struct net_device *netdev, struct ethtool_dump *val) | |||
1540 | return 0; | 1581 | return 0; |
1541 | case QLCNIC_SET_QUIESCENT: | 1582 | case QLCNIC_SET_QUIESCENT: |
1542 | case QLCNIC_RESET_QUIESCENT: | 1583 | case QLCNIC_RESET_QUIESCENT: |
1543 | state = QLCRD32(adapter, QLCNIC_CRB_DEV_STATE); | 1584 | state = QLC_SHARED_REG_RD32(adapter, QLCNIC_CRB_DEV_STATE); |
1544 | if (state == QLCNIC_DEV_FAILED || (state == QLCNIC_DEV_BADBAD)) | 1585 | if (state == QLCNIC_DEV_FAILED || (state == QLCNIC_DEV_BADBAD)) |
1545 | netdev_info(netdev, "Device in FAILED state\n"); | 1586 | netdev_info(netdev, "Device in FAILED state\n"); |
1546 | return 0; | 1587 | return 0; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index 5b5d2edf125d..4d5f59b2d153 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | |||
@@ -317,16 +317,20 @@ static void qlcnic_write_window_reg(u32 addr, void __iomem *bar0, u32 data) | |||
317 | int | 317 | int |
318 | qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg) | 318 | qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg) |
319 | { | 319 | { |
320 | int done = 0, timeout = 0; | 320 | int timeout = 0; |
321 | int err = 0; | ||
322 | u32 done = 0; | ||
321 | 323 | ||
322 | while (!done) { | 324 | while (!done) { |
323 | done = QLCRD32(adapter, QLCNIC_PCIE_REG(PCIE_SEM_LOCK(sem))); | 325 | done = QLCRD32(adapter, QLCNIC_PCIE_REG(PCIE_SEM_LOCK(sem)), |
326 | &err); | ||
324 | if (done == 1) | 327 | if (done == 1) |
325 | break; | 328 | break; |
326 | if (++timeout >= QLCNIC_PCIE_SEM_TIMEOUT) { | 329 | if (++timeout >= QLCNIC_PCIE_SEM_TIMEOUT) { |
327 | dev_err(&adapter->pdev->dev, | 330 | dev_err(&adapter->pdev->dev, |
328 | "Failed to acquire sem=%d lock; holdby=%d\n", | 331 | "Failed to acquire sem=%d lock; holdby=%d\n", |
329 | sem, id_reg ? QLCRD32(adapter, id_reg) : -1); | 332 | sem, |
333 | id_reg ? QLCRD32(adapter, id_reg, &err) : -1); | ||
330 | return -EIO; | 334 | return -EIO; |
331 | } | 335 | } |
332 | msleep(1); | 336 | msleep(1); |
@@ -341,19 +345,22 @@ qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg) | |||
341 | void | 345 | void |
342 | qlcnic_pcie_sem_unlock(struct qlcnic_adapter *adapter, int sem) | 346 | qlcnic_pcie_sem_unlock(struct qlcnic_adapter *adapter, int sem) |
343 | { | 347 | { |
344 | QLCRD32(adapter, QLCNIC_PCIE_REG(PCIE_SEM_UNLOCK(sem))); | 348 | int err = 0; |
349 | |||
350 | QLCRD32(adapter, QLCNIC_PCIE_REG(PCIE_SEM_UNLOCK(sem)), &err); | ||
345 | } | 351 | } |
346 | 352 | ||
347 | int qlcnic_ind_rd(struct qlcnic_adapter *adapter, u32 addr) | 353 | int qlcnic_ind_rd(struct qlcnic_adapter *adapter, u32 addr) |
348 | { | 354 | { |
355 | int err = 0; | ||
349 | u32 data; | 356 | u32 data; |
350 | 357 | ||
351 | if (qlcnic_82xx_check(adapter)) | 358 | if (qlcnic_82xx_check(adapter)) |
352 | qlcnic_read_window_reg(addr, adapter->ahw->pci_base0, &data); | 359 | qlcnic_read_window_reg(addr, adapter->ahw->pci_base0, &data); |
353 | else { | 360 | else { |
354 | data = qlcnic_83xx_rd_reg_indirect(adapter, addr); | 361 | data = QLCRD32(adapter, addr, &err); |
355 | if (data == -EIO) | 362 | if (err == -EIO) |
356 | return -EIO; | 363 | return err; |
357 | } | 364 | } |
358 | return data; | 365 | return data; |
359 | } | 366 | } |
@@ -516,20 +523,18 @@ void __qlcnic_set_multi(struct net_device *netdev, u16 vlan) | |||
516 | if (netdev->flags & IFF_PROMISC) { | 523 | if (netdev->flags & IFF_PROMISC) { |
517 | if (!(adapter->flags & QLCNIC_PROMISC_DISABLED)) | 524 | if (!(adapter->flags & QLCNIC_PROMISC_DISABLED)) |
518 | mode = VPORT_MISS_MODE_ACCEPT_ALL; | 525 | mode = VPORT_MISS_MODE_ACCEPT_ALL; |
519 | } else if (netdev->flags & IFF_ALLMULTI) { | 526 | } else if ((netdev->flags & IFF_ALLMULTI) || |
520 | if (netdev_mc_count(netdev) > ahw->max_mc_count) { | 527 | (netdev_mc_count(netdev) > ahw->max_mc_count)) { |
521 | mode = VPORT_MISS_MODE_ACCEPT_MULTI; | 528 | mode = VPORT_MISS_MODE_ACCEPT_MULTI; |
522 | } else if (!netdev_mc_empty(netdev) && | 529 | } else if (!netdev_mc_empty(netdev) && |
523 | !qlcnic_sriov_vf_check(adapter)) { | 530 | !qlcnic_sriov_vf_check(adapter)) { |
524 | netdev_for_each_mc_addr(ha, netdev) | 531 | netdev_for_each_mc_addr(ha, netdev) |
525 | qlcnic_nic_add_mac(adapter, ha->addr, | 532 | qlcnic_nic_add_mac(adapter, ha->addr, vlan); |
526 | vlan); | ||
527 | } | ||
528 | if (mode != VPORT_MISS_MODE_ACCEPT_MULTI && | ||
529 | qlcnic_sriov_vf_check(adapter)) | ||
530 | qlcnic_vf_add_mc_list(netdev, vlan); | ||
531 | } | 533 | } |
532 | 534 | ||
535 | if (qlcnic_sriov_vf_check(adapter)) | ||
536 | qlcnic_vf_add_mc_list(netdev, vlan); | ||
537 | |||
533 | /* configure unicast MAC address, if there is not sufficient space | 538 | /* configure unicast MAC address, if there is not sufficient space |
534 | * to store all the unicast addresses then enable promiscuous mode | 539 | * to store all the unicast addresses then enable promiscuous mode |
535 | */ | 540 | */ |
@@ -1161,7 +1166,8 @@ int qlcnic_82xx_hw_write_wx_2M(struct qlcnic_adapter *adapter, ulong off, | |||
1161 | return -EIO; | 1166 | return -EIO; |
1162 | } | 1167 | } |
1163 | 1168 | ||
1164 | int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong off) | 1169 | int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong off, |
1170 | int *err) | ||
1165 | { | 1171 | { |
1166 | unsigned long flags; | 1172 | unsigned long flags; |
1167 | int rv; | 1173 | int rv; |
@@ -1417,7 +1423,7 @@ int qlcnic_pci_mem_read_2M(struct qlcnic_adapter *adapter, u64 off, u64 *data) | |||
1417 | 1423 | ||
1418 | int qlcnic_82xx_get_board_info(struct qlcnic_adapter *adapter) | 1424 | int qlcnic_82xx_get_board_info(struct qlcnic_adapter *adapter) |
1419 | { | 1425 | { |
1420 | int offset, board_type, magic; | 1426 | int offset, board_type, magic, err = 0; |
1421 | struct pci_dev *pdev = adapter->pdev; | 1427 | struct pci_dev *pdev = adapter->pdev; |
1422 | 1428 | ||
1423 | offset = QLCNIC_FW_MAGIC_OFFSET; | 1429 | offset = QLCNIC_FW_MAGIC_OFFSET; |
@@ -1437,7 +1443,9 @@ int qlcnic_82xx_get_board_info(struct qlcnic_adapter *adapter) | |||
1437 | adapter->ahw->board_type = board_type; | 1443 | adapter->ahw->board_type = board_type; |
1438 | 1444 | ||
1439 | if (board_type == QLCNIC_BRDTYPE_P3P_4_GB_MM) { | 1445 | if (board_type == QLCNIC_BRDTYPE_P3P_4_GB_MM) { |
1440 | u32 gpio = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_PAD_GPIO_I); | 1446 | u32 gpio = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_PAD_GPIO_I, &err); |
1447 | if (err == -EIO) | ||
1448 | return err; | ||
1441 | if ((gpio & 0x8000) == 0) | 1449 | if ((gpio & 0x8000) == 0) |
1442 | board_type = QLCNIC_BRDTYPE_P3P_10G_TP; | 1450 | board_type = QLCNIC_BRDTYPE_P3P_10G_TP; |
1443 | } | 1451 | } |
@@ -1477,10 +1485,13 @@ int | |||
1477 | qlcnic_wol_supported(struct qlcnic_adapter *adapter) | 1485 | qlcnic_wol_supported(struct qlcnic_adapter *adapter) |
1478 | { | 1486 | { |
1479 | u32 wol_cfg; | 1487 | u32 wol_cfg; |
1488 | int err = 0; | ||
1480 | 1489 | ||
1481 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV); | 1490 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV, &err); |
1482 | if (wol_cfg & (1UL << adapter->portnum)) { | 1491 | if (wol_cfg & (1UL << adapter->portnum)) { |
1483 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG); | 1492 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG, &err); |
1493 | if (err == -EIO) | ||
1494 | return err; | ||
1484 | if (wol_cfg & (1 << adapter->portnum)) | 1495 | if (wol_cfg & (1 << adapter->portnum)) |
1485 | return 1; | 1496 | return 1; |
1486 | } | 1497 | } |
@@ -1541,6 +1552,7 @@ void qlcnic_82xx_get_func_no(struct qlcnic_adapter *adapter) | |||
1541 | void qlcnic_82xx_read_crb(struct qlcnic_adapter *adapter, char *buf, | 1552 | void qlcnic_82xx_read_crb(struct qlcnic_adapter *adapter, char *buf, |
1542 | loff_t offset, size_t size) | 1553 | loff_t offset, size_t size) |
1543 | { | 1554 | { |
1555 | int err = 0; | ||
1544 | u32 data; | 1556 | u32 data; |
1545 | u64 qmdata; | 1557 | u64 qmdata; |
1546 | 1558 | ||
@@ -1548,7 +1560,7 @@ void qlcnic_82xx_read_crb(struct qlcnic_adapter *adapter, char *buf, | |||
1548 | qlcnic_pci_camqm_read_2M(adapter, offset, &qmdata); | 1560 | qlcnic_pci_camqm_read_2M(adapter, offset, &qmdata); |
1549 | memcpy(buf, &qmdata, size); | 1561 | memcpy(buf, &qmdata, size); |
1550 | } else { | 1562 | } else { |
1551 | data = QLCRD32(adapter, offset); | 1563 | data = QLCRD32(adapter, offset, &err); |
1552 | memcpy(buf, &data, size); | 1564 | memcpy(buf, &data, size); |
1553 | } | 1565 | } |
1554 | } | 1566 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h index 2c22504f57aa..4a71b28effcb 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h | |||
@@ -154,7 +154,7 @@ struct qlcnic_hardware_context; | |||
154 | struct qlcnic_adapter; | 154 | struct qlcnic_adapter; |
155 | 155 | ||
156 | int qlcnic_82xx_start_firmware(struct qlcnic_adapter *); | 156 | int qlcnic_82xx_start_firmware(struct qlcnic_adapter *); |
157 | int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong); | 157 | int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong, int *); |
158 | int qlcnic_82xx_hw_write_wx_2M(struct qlcnic_adapter *, ulong, u32); | 158 | int qlcnic_82xx_hw_write_wx_2M(struct qlcnic_adapter *, ulong, u32); |
159 | int qlcnic_82xx_config_hw_lro(struct qlcnic_adapter *adapter, int); | 159 | int qlcnic_82xx_config_hw_lro(struct qlcnic_adapter *adapter, int); |
160 | int qlcnic_82xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32); | 160 | int qlcnic_82xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c index d28336fc65ab..974d62607e13 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c | |||
@@ -142,7 +142,7 @@ void qlcnic_release_tx_buffers(struct qlcnic_adapter *adapter) | |||
142 | buffrag->length, PCI_DMA_TODEVICE); | 142 | buffrag->length, PCI_DMA_TODEVICE); |
143 | buffrag->dma = 0ULL; | 143 | buffrag->dma = 0ULL; |
144 | } | 144 | } |
145 | for (j = 0; j < cmd_buf->frag_count; j++) { | 145 | for (j = 1; j < cmd_buf->frag_count; j++) { |
146 | buffrag++; | 146 | buffrag++; |
147 | if (buffrag->dma) { | 147 | if (buffrag->dma) { |
148 | pci_unmap_page(adapter->pdev, buffrag->dma, | 148 | pci_unmap_page(adapter->pdev, buffrag->dma, |
@@ -286,10 +286,11 @@ static int qlcnic_wait_rom_done(struct qlcnic_adapter *adapter) | |||
286 | { | 286 | { |
287 | long timeout = 0; | 287 | long timeout = 0; |
288 | long done = 0; | 288 | long done = 0; |
289 | int err = 0; | ||
289 | 290 | ||
290 | cond_resched(); | 291 | cond_resched(); |
291 | while (done == 0) { | 292 | while (done == 0) { |
292 | done = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_STATUS); | 293 | done = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_STATUS, &err); |
293 | done &= 2; | 294 | done &= 2; |
294 | if (++timeout >= QLCNIC_MAX_ROM_WAIT_USEC) { | 295 | if (++timeout >= QLCNIC_MAX_ROM_WAIT_USEC) { |
295 | dev_err(&adapter->pdev->dev, | 296 | dev_err(&adapter->pdev->dev, |
@@ -304,6 +305,8 @@ static int qlcnic_wait_rom_done(struct qlcnic_adapter *adapter) | |||
304 | static int do_rom_fast_read(struct qlcnic_adapter *adapter, | 305 | static int do_rom_fast_read(struct qlcnic_adapter *adapter, |
305 | u32 addr, u32 *valp) | 306 | u32 addr, u32 *valp) |
306 | { | 307 | { |
308 | int err = 0; | ||
309 | |||
307 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_ADDRESS, addr); | 310 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_ADDRESS, addr); |
308 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 311 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
309 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_ABYTE_CNT, 3); | 312 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_ABYTE_CNT, 3); |
@@ -317,7 +320,9 @@ static int do_rom_fast_read(struct qlcnic_adapter *adapter, | |||
317 | udelay(10); | 320 | udelay(10); |
318 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 321 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
319 | 322 | ||
320 | *valp = QLCRD32(adapter, QLCNIC_ROMUSB_ROM_RDATA); | 323 | *valp = QLCRD32(adapter, QLCNIC_ROMUSB_ROM_RDATA, &err); |
324 | if (err == -EIO) | ||
325 | return err; | ||
321 | return 0; | 326 | return 0; |
322 | } | 327 | } |
323 | 328 | ||
@@ -369,11 +374,11 @@ int qlcnic_rom_fast_read(struct qlcnic_adapter *adapter, u32 addr, u32 *valp) | |||
369 | 374 | ||
370 | int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter) | 375 | int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter) |
371 | { | 376 | { |
372 | int addr, val; | 377 | int addr, err = 0; |
373 | int i, n, init_delay; | 378 | int i, n, init_delay; |
374 | struct crb_addr_pair *buf; | 379 | struct crb_addr_pair *buf; |
375 | unsigned offset; | 380 | unsigned offset; |
376 | u32 off; | 381 | u32 off, val; |
377 | struct pci_dev *pdev = adapter->pdev; | 382 | struct pci_dev *pdev = adapter->pdev; |
378 | 383 | ||
379 | QLC_SHARED_REG_WR32(adapter, QLCNIC_CMDPEG_STATE, 0); | 384 | QLC_SHARED_REG_WR32(adapter, QLCNIC_CMDPEG_STATE, 0); |
@@ -402,7 +407,9 @@ int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter) | |||
402 | QLCWR32(adapter, QLCNIC_CRB_NIU + 0xb0000, 0x00); | 407 | QLCWR32(adapter, QLCNIC_CRB_NIU + 0xb0000, 0x00); |
403 | 408 | ||
404 | /* halt sre */ | 409 | /* halt sre */ |
405 | val = QLCRD32(adapter, QLCNIC_CRB_SRE + 0x1000); | 410 | val = QLCRD32(adapter, QLCNIC_CRB_SRE + 0x1000, &err); |
411 | if (err == -EIO) | ||
412 | return err; | ||
406 | QLCWR32(adapter, QLCNIC_CRB_SRE + 0x1000, val & (~(0x1))); | 413 | QLCWR32(adapter, QLCNIC_CRB_SRE + 0x1000, val & (~(0x1))); |
407 | 414 | ||
408 | /* halt epg */ | 415 | /* halt epg */ |
@@ -719,10 +726,12 @@ qlcnic_check_flash_fw_ver(struct qlcnic_adapter *adapter) | |||
719 | static int | 726 | static int |
720 | qlcnic_has_mn(struct qlcnic_adapter *adapter) | 727 | qlcnic_has_mn(struct qlcnic_adapter *adapter) |
721 | { | 728 | { |
722 | u32 capability; | 729 | u32 capability = 0; |
723 | capability = 0; | 730 | int err = 0; |
724 | 731 | ||
725 | capability = QLCRD32(adapter, QLCNIC_PEG_TUNE_CAPABILITY); | 732 | capability = QLCRD32(adapter, QLCNIC_PEG_TUNE_CAPABILITY, &err); |
733 | if (err == -EIO) | ||
734 | return err; | ||
726 | if (capability & QLCNIC_PEG_TUNE_MN_PRESENT) | 735 | if (capability & QLCNIC_PEG_TUNE_MN_PRESENT) |
727 | return 1; | 736 | return 1; |
728 | 737 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c index d3f8797efcc3..6946d354f44f 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | |||
@@ -161,36 +161,68 @@ static inline int qlcnic_82xx_is_lb_pkt(u64 sts_data) | |||
161 | return (qlcnic_get_sts_status(sts_data) == STATUS_CKSUM_LOOP) ? 1 : 0; | 161 | return (qlcnic_get_sts_status(sts_data) == STATUS_CKSUM_LOOP) ? 1 : 0; |
162 | } | 162 | } |
163 | 163 | ||
164 | static void qlcnic_delete_rx_list_mac(struct qlcnic_adapter *adapter, | ||
165 | struct qlcnic_filter *fil, | ||
166 | void *addr, u16 vlan_id) | ||
167 | { | ||
168 | int ret; | ||
169 | u8 op; | ||
170 | |||
171 | op = vlan_id ? QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_ADD; | ||
172 | ret = qlcnic_sre_macaddr_change(adapter, addr, vlan_id, op); | ||
173 | if (ret) | ||
174 | return; | ||
175 | |||
176 | op = vlan_id ? QLCNIC_MAC_VLAN_DEL : QLCNIC_MAC_DEL; | ||
177 | ret = qlcnic_sre_macaddr_change(adapter, addr, vlan_id, op); | ||
178 | if (!ret) { | ||
179 | hlist_del(&fil->fnode); | ||
180 | adapter->rx_fhash.fnum--; | ||
181 | } | ||
182 | } | ||
183 | |||
184 | static struct qlcnic_filter *qlcnic_find_mac_filter(struct hlist_head *head, | ||
185 | void *addr, u16 vlan_id) | ||
186 | { | ||
187 | struct qlcnic_filter *tmp_fil = NULL; | ||
188 | struct hlist_node *n; | ||
189 | |||
190 | hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { | ||
191 | if (!memcmp(tmp_fil->faddr, addr, ETH_ALEN) && | ||
192 | tmp_fil->vlan_id == vlan_id) | ||
193 | return tmp_fil; | ||
194 | } | ||
195 | |||
196 | return NULL; | ||
197 | } | ||
198 | |||
164 | void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb, | 199 | void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb, |
165 | int loopback_pkt, u16 vlan_id) | 200 | int loopback_pkt, u16 vlan_id) |
166 | { | 201 | { |
167 | struct ethhdr *phdr = (struct ethhdr *)(skb->data); | 202 | struct ethhdr *phdr = (struct ethhdr *)(skb->data); |
168 | struct qlcnic_filter *fil, *tmp_fil; | 203 | struct qlcnic_filter *fil, *tmp_fil; |
169 | struct hlist_node *n; | ||
170 | struct hlist_head *head; | 204 | struct hlist_head *head; |
171 | unsigned long time; | 205 | unsigned long time; |
172 | u64 src_addr = 0; | 206 | u64 src_addr = 0; |
173 | u8 hindex, found = 0, op; | 207 | u8 hindex, op; |
174 | int ret; | 208 | int ret; |
175 | 209 | ||
176 | memcpy(&src_addr, phdr->h_source, ETH_ALEN); | 210 | memcpy(&src_addr, phdr->h_source, ETH_ALEN); |
211 | hindex = qlcnic_mac_hash(src_addr) & | ||
212 | (adapter->fhash.fbucket_size - 1); | ||
177 | 213 | ||
178 | if (loopback_pkt) { | 214 | if (loopback_pkt) { |
179 | if (adapter->rx_fhash.fnum >= adapter->rx_fhash.fmax) | 215 | if (adapter->rx_fhash.fnum >= adapter->rx_fhash.fmax) |
180 | return; | 216 | return; |
181 | 217 | ||
182 | hindex = qlcnic_mac_hash(src_addr) & | ||
183 | (adapter->fhash.fbucket_size - 1); | ||
184 | head = &(adapter->rx_fhash.fhead[hindex]); | 218 | head = &(adapter->rx_fhash.fhead[hindex]); |
185 | 219 | ||
186 | hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { | 220 | tmp_fil = qlcnic_find_mac_filter(head, &src_addr, vlan_id); |
187 | if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && | 221 | if (tmp_fil) { |
188 | tmp_fil->vlan_id == vlan_id) { | 222 | time = tmp_fil->ftime; |
189 | time = tmp_fil->ftime; | 223 | if (time_after(jiffies, QLCNIC_READD_AGE * HZ + time)) |
190 | if (jiffies > (QLCNIC_READD_AGE * HZ + time)) | 224 | tmp_fil->ftime = jiffies; |
191 | tmp_fil->ftime = jiffies; | 225 | return; |
192 | return; | ||
193 | } | ||
194 | } | 226 | } |
195 | 227 | ||
196 | fil = kzalloc(sizeof(struct qlcnic_filter), GFP_ATOMIC); | 228 | fil = kzalloc(sizeof(struct qlcnic_filter), GFP_ATOMIC); |
@@ -205,36 +237,37 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb, | |||
205 | adapter->rx_fhash.fnum++; | 237 | adapter->rx_fhash.fnum++; |
206 | spin_unlock(&adapter->rx_mac_learn_lock); | 238 | spin_unlock(&adapter->rx_mac_learn_lock); |
207 | } else { | 239 | } else { |
208 | hindex = qlcnic_mac_hash(src_addr) & | 240 | head = &adapter->fhash.fhead[hindex]; |
209 | (adapter->fhash.fbucket_size - 1); | ||
210 | head = &(adapter->rx_fhash.fhead[hindex]); | ||
211 | spin_lock(&adapter->rx_mac_learn_lock); | ||
212 | hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { | ||
213 | if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && | ||
214 | tmp_fil->vlan_id == vlan_id) { | ||
215 | found = 1; | ||
216 | break; | ||
217 | } | ||
218 | } | ||
219 | 241 | ||
220 | if (!found) { | 242 | spin_lock(&adapter->mac_learn_lock); |
221 | spin_unlock(&adapter->rx_mac_learn_lock); | ||
222 | return; | ||
223 | } | ||
224 | 243 | ||
225 | op = vlan_id ? QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_ADD; | 244 | tmp_fil = qlcnic_find_mac_filter(head, &src_addr, vlan_id); |
226 | ret = qlcnic_sre_macaddr_change(adapter, (u8 *)&src_addr, | 245 | if (tmp_fil) { |
227 | vlan_id, op); | ||
228 | if (!ret) { | ||
229 | op = vlan_id ? QLCNIC_MAC_VLAN_DEL : QLCNIC_MAC_DEL; | 246 | op = vlan_id ? QLCNIC_MAC_VLAN_DEL : QLCNIC_MAC_DEL; |
230 | ret = qlcnic_sre_macaddr_change(adapter, | 247 | ret = qlcnic_sre_macaddr_change(adapter, |
231 | (u8 *)&src_addr, | 248 | (u8 *)&src_addr, |
232 | vlan_id, op); | 249 | vlan_id, op); |
233 | if (!ret) { | 250 | if (!ret) { |
234 | hlist_del(&(tmp_fil->fnode)); | 251 | hlist_del(&tmp_fil->fnode); |
235 | adapter->rx_fhash.fnum--; | 252 | adapter->fhash.fnum--; |
236 | } | 253 | } |
254 | |||
255 | spin_unlock(&adapter->mac_learn_lock); | ||
256 | |||
257 | return; | ||
237 | } | 258 | } |
259 | |||
260 | spin_unlock(&adapter->mac_learn_lock); | ||
261 | |||
262 | head = &adapter->rx_fhash.fhead[hindex]; | ||
263 | |||
264 | spin_lock(&adapter->rx_mac_learn_lock); | ||
265 | |||
266 | tmp_fil = qlcnic_find_mac_filter(head, &src_addr, vlan_id); | ||
267 | if (tmp_fil) | ||
268 | qlcnic_delete_rx_list_mac(adapter, tmp_fil, &src_addr, | ||
269 | vlan_id); | ||
270 | |||
238 | spin_unlock(&adapter->rx_mac_learn_lock); | 271 | spin_unlock(&adapter->rx_mac_learn_lock); |
239 | } | 272 | } |
240 | } | 273 | } |
@@ -262,7 +295,7 @@ void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr, | |||
262 | 295 | ||
263 | mac_req = (struct qlcnic_mac_req *)&(req->words[0]); | 296 | mac_req = (struct qlcnic_mac_req *)&(req->words[0]); |
264 | mac_req->op = vlan_id ? QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_ADD; | 297 | mac_req->op = vlan_id ? QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_ADD; |
265 | memcpy(mac_req->mac_addr, &uaddr, ETH_ALEN); | 298 | memcpy(mac_req->mac_addr, uaddr, ETH_ALEN); |
266 | 299 | ||
267 | vlan_req = (struct qlcnic_vlan_req *)&req->words[1]; | 300 | vlan_req = (struct qlcnic_vlan_req *)&req->words[1]; |
268 | vlan_req->vlan_id = cpu_to_le16(vlan_id); | 301 | vlan_req->vlan_id = cpu_to_le16(vlan_id); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 4528f8ec333b..ee013fcc3322 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -977,8 +977,8 @@ qlcnic_check_options(struct qlcnic_adapter *adapter) | |||
977 | static int | 977 | static int |
978 | qlcnic_initialize_nic(struct qlcnic_adapter *adapter) | 978 | qlcnic_initialize_nic(struct qlcnic_adapter *adapter) |
979 | { | 979 | { |
980 | int err; | ||
981 | struct qlcnic_info nic_info; | 980 | struct qlcnic_info nic_info; |
981 | int err = 0; | ||
982 | 982 | ||
983 | memset(&nic_info, 0, sizeof(struct qlcnic_info)); | 983 | memset(&nic_info, 0, sizeof(struct qlcnic_info)); |
984 | err = qlcnic_get_nic_info(adapter, &nic_info, adapter->ahw->pci_func); | 984 | err = qlcnic_get_nic_info(adapter, &nic_info, adapter->ahw->pci_func); |
@@ -993,7 +993,9 @@ qlcnic_initialize_nic(struct qlcnic_adapter *adapter) | |||
993 | 993 | ||
994 | if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_MORE_CAPS) { | 994 | if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_MORE_CAPS) { |
995 | u32 temp; | 995 | u32 temp; |
996 | temp = QLCRD32(adapter, CRB_FW_CAPABILITIES_2); | 996 | temp = QLCRD32(adapter, CRB_FW_CAPABILITIES_2, &err); |
997 | if (err == -EIO) | ||
998 | return err; | ||
997 | adapter->ahw->extra_capability[0] = temp; | 999 | adapter->ahw->extra_capability[0] = temp; |
998 | } | 1000 | } |
999 | adapter->ahw->max_mac_filters = nic_info.max_mac_filters; | 1001 | adapter->ahw->max_mac_filters = nic_info.max_mac_filters; |
@@ -1383,6 +1385,8 @@ qlcnic_request_irq(struct qlcnic_adapter *adapter) | |||
1383 | if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { | 1385 | if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { |
1384 | if (qlcnic_82xx_check(adapter)) | 1386 | if (qlcnic_82xx_check(adapter)) |
1385 | handler = qlcnic_tmp_intr; | 1387 | handler = qlcnic_tmp_intr; |
1388 | else | ||
1389 | handler = qlcnic_83xx_tmp_intr; | ||
1386 | if (!QLCNIC_IS_MSI_FAMILY(adapter)) | 1390 | if (!QLCNIC_IS_MSI_FAMILY(adapter)) |
1387 | flags |= IRQF_SHARED; | 1391 | flags |= IRQF_SHARED; |
1388 | 1392 | ||
@@ -1531,12 +1535,12 @@ int __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev) | |||
1531 | if (netdev->features & NETIF_F_LRO) | 1535 | if (netdev->features & NETIF_F_LRO) |
1532 | qlcnic_config_hw_lro(adapter, QLCNIC_LRO_ENABLED); | 1536 | qlcnic_config_hw_lro(adapter, QLCNIC_LRO_ENABLED); |
1533 | 1537 | ||
1538 | set_bit(__QLCNIC_DEV_UP, &adapter->state); | ||
1534 | qlcnic_napi_enable(adapter); | 1539 | qlcnic_napi_enable(adapter); |
1535 | 1540 | ||
1536 | qlcnic_linkevent_request(adapter, 1); | 1541 | qlcnic_linkevent_request(adapter, 1); |
1537 | 1542 | ||
1538 | adapter->ahw->reset_context = 0; | 1543 | adapter->ahw->reset_context = 0; |
1539 | set_bit(__QLCNIC_DEV_UP, &adapter->state); | ||
1540 | return 0; | 1544 | return 0; |
1541 | } | 1545 | } |
1542 | 1546 | ||
@@ -2139,7 +2143,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2139 | if (qlcnic_83xx_check(adapter) && !qlcnic_use_msi_x && | 2143 | if (qlcnic_83xx_check(adapter) && !qlcnic_use_msi_x && |
2140 | !!qlcnic_use_msi) | 2144 | !!qlcnic_use_msi) |
2141 | dev_warn(&pdev->dev, | 2145 | dev_warn(&pdev->dev, |
2142 | "83xx adapter do not support MSI interrupts\n"); | 2146 | "Device does not support MSI interrupts\n"); |
2143 | 2147 | ||
2144 | err = qlcnic_setup_intr(adapter, 0); | 2148 | err = qlcnic_setup_intr(adapter, 0); |
2145 | if (err) { | 2149 | if (err) { |
@@ -3093,6 +3097,7 @@ qlcnic_check_health(struct qlcnic_adapter *adapter) | |||
3093 | { | 3097 | { |
3094 | u32 state = 0, heartbeat; | 3098 | u32 state = 0, heartbeat; |
3095 | u32 peg_status; | 3099 | u32 peg_status; |
3100 | int err = 0; | ||
3096 | 3101 | ||
3097 | if (qlcnic_check_temp(adapter)) | 3102 | if (qlcnic_check_temp(adapter)) |
3098 | goto detach; | 3103 | goto detach; |
@@ -3139,11 +3144,11 @@ qlcnic_check_health(struct qlcnic_adapter *adapter) | |||
3139 | "PEG_NET_4_PC: 0x%x\n", | 3144 | "PEG_NET_4_PC: 0x%x\n", |
3140 | peg_status, | 3145 | peg_status, |
3141 | QLC_SHARED_REG_RD32(adapter, QLCNIC_PEG_HALT_STATUS2), | 3146 | QLC_SHARED_REG_RD32(adapter, QLCNIC_PEG_HALT_STATUS2), |
3142 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_0 + 0x3c), | 3147 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_0 + 0x3c, &err), |
3143 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_1 + 0x3c), | 3148 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_1 + 0x3c, &err), |
3144 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_2 + 0x3c), | 3149 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_2 + 0x3c, &err), |
3145 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_3 + 0x3c), | 3150 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_3 + 0x3c, &err), |
3146 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_4 + 0x3c)); | 3151 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_4 + 0x3c, &err)); |
3147 | if (QLCNIC_FWERROR_CODE(peg_status) == 0x67) | 3152 | if (QLCNIC_FWERROR_CODE(peg_status) == 0x67) |
3148 | dev_err(&adapter->pdev->dev, | 3153 | dev_err(&adapter->pdev->dev, |
3149 | "Firmware aborted with error code 0x00006700. " | 3154 | "Firmware aborted with error code 0x00006700. " |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c index ab8a6744d402..79e54efe07b9 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c | |||
@@ -1084,7 +1084,7 @@ flash_temp: | |||
1084 | tmpl_hdr = ahw->fw_dump.tmpl_hdr; | 1084 | tmpl_hdr = ahw->fw_dump.tmpl_hdr; |
1085 | tmpl_hdr->drv_cap_mask = QLCNIC_DUMP_MASK_DEF; | 1085 | tmpl_hdr->drv_cap_mask = QLCNIC_DUMP_MASK_DEF; |
1086 | 1086 | ||
1087 | if ((tmpl_hdr->version & 0xffffff) >= 0x20001) | 1087 | if ((tmpl_hdr->version & 0xfffff) >= 0x20001) |
1088 | ahw->fw_dump.use_pex_dma = true; | 1088 | ahw->fw_dump.use_pex_dma = true; |
1089 | else | 1089 | else |
1090 | ahw->fw_dump.use_pex_dma = false; | 1090 | ahw->fw_dump.use_pex_dma = false; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index 62380ce89905..5d40045b3cea 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | |||
@@ -562,7 +562,7 @@ static int qlcnic_sriov_setup_vf(struct qlcnic_adapter *adapter, | |||
562 | INIT_LIST_HEAD(&adapter->vf_mc_list); | 562 | INIT_LIST_HEAD(&adapter->vf_mc_list); |
563 | if (!qlcnic_use_msi_x && !!qlcnic_use_msi) | 563 | if (!qlcnic_use_msi_x && !!qlcnic_use_msi) |
564 | dev_warn(&adapter->pdev->dev, | 564 | dev_warn(&adapter->pdev->dev, |
565 | "83xx adapter do not support MSI interrupts\n"); | 565 | "Device does not support MSI interrupts\n"); |
566 | 566 | ||
567 | err = qlcnic_setup_intr(adapter, 1); | 567 | err = qlcnic_setup_intr(adapter, 1); |
568 | if (err) { | 568 | if (err) { |
@@ -762,6 +762,7 @@ static int qlcnic_sriov_alloc_bc_mbx_args(struct qlcnic_cmd_args *mbx, u32 type) | |||
762 | memset(mbx->rsp.arg, 0, sizeof(u32) * mbx->rsp.num); | 762 | memset(mbx->rsp.arg, 0, sizeof(u32) * mbx->rsp.num); |
763 | mbx->req.arg[0] = (type | (mbx->req.num << 16) | | 763 | mbx->req.arg[0] = (type | (mbx->req.num << 16) | |
764 | (3 << 29)); | 764 | (3 << 29)); |
765 | mbx->rsp.arg[0] = (type & 0xffff) | mbx->rsp.num << 16; | ||
765 | return 0; | 766 | return 0; |
766 | } | 767 | } |
767 | } | 768 | } |
@@ -813,6 +814,7 @@ static int qlcnic_sriov_prepare_bc_hdr(struct qlcnic_bc_trans *trans, | |||
813 | cmd->req.num = trans->req_pay_size / 4; | 814 | cmd->req.num = trans->req_pay_size / 4; |
814 | cmd->rsp.num = trans->rsp_pay_size / 4; | 815 | cmd->rsp.num = trans->rsp_pay_size / 4; |
815 | hdr = trans->rsp_hdr; | 816 | hdr = trans->rsp_hdr; |
817 | cmd->op_type = trans->req_hdr->op_type; | ||
816 | } | 818 | } |
817 | 819 | ||
818 | trans->trans_id = seq; | 820 | trans->trans_id = seq; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c index ee0c1d307966..eb49cd65378c 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | |||
@@ -635,12 +635,12 @@ static int qlcnic_sriov_pf_channel_cfg_cmd(struct qlcnic_bc_trans *trans, | |||
635 | struct qlcnic_cmd_args *cmd) | 635 | struct qlcnic_cmd_args *cmd) |
636 | { | 636 | { |
637 | struct qlcnic_vf_info *vf = trans->vf; | 637 | struct qlcnic_vf_info *vf = trans->vf; |
638 | struct qlcnic_adapter *adapter = vf->adapter; | 638 | struct qlcnic_vport *vp = vf->vp; |
639 | int err; | 639 | struct qlcnic_adapter *adapter; |
640 | u16 func = vf->pci_func; | 640 | u16 func = vf->pci_func; |
641 | int err; | ||
641 | 642 | ||
642 | cmd->rsp.arg[0] = trans->req_hdr->cmd_op; | 643 | adapter = vf->adapter; |
643 | cmd->rsp.arg[0] |= (1 << 16); | ||
644 | 644 | ||
645 | if (trans->req_hdr->cmd_op == QLCNIC_BC_CMD_CHANNEL_INIT) { | 645 | if (trans->req_hdr->cmd_op == QLCNIC_BC_CMD_CHANNEL_INIT) { |
646 | err = qlcnic_sriov_pf_config_vport(adapter, 1, func); | 646 | err = qlcnic_sriov_pf_config_vport(adapter, 1, func); |
@@ -650,6 +650,8 @@ static int qlcnic_sriov_pf_channel_cfg_cmd(struct qlcnic_bc_trans *trans, | |||
650 | qlcnic_sriov_pf_config_vport(adapter, 0, func); | 650 | qlcnic_sriov_pf_config_vport(adapter, 0, func); |
651 | } | 651 | } |
652 | } else { | 652 | } else { |
653 | if (vp->vlan_mode == QLC_GUEST_VLAN_MODE) | ||
654 | vp->vlan = 0; | ||
653 | err = qlcnic_sriov_pf_config_vport(adapter, 0, func); | 655 | err = qlcnic_sriov_pf_config_vport(adapter, 0, func); |
654 | } | 656 | } |
655 | 657 | ||
@@ -1183,7 +1185,7 @@ static int qlcnic_sriov_pf_get_acl_cmd(struct qlcnic_bc_trans *trans, | |||
1183 | u8 cmd_op, mode = vp->vlan_mode; | 1185 | u8 cmd_op, mode = vp->vlan_mode; |
1184 | 1186 | ||
1185 | cmd_op = trans->req_hdr->cmd_op; | 1187 | cmd_op = trans->req_hdr->cmd_op; |
1186 | cmd->rsp.arg[0] = (cmd_op & 0xffff) | 14 << 16 | 1 << 25; | 1188 | cmd->rsp.arg[0] |= 1 << 25; |
1187 | 1189 | ||
1188 | switch (mode) { | 1190 | switch (mode) { |
1189 | case QLC_GUEST_VLAN_MODE: | 1191 | case QLC_GUEST_VLAN_MODE: |
@@ -1561,6 +1563,7 @@ void qlcnic_sriov_pf_handle_flr(struct qlcnic_sriov *sriov, | |||
1561 | struct qlcnic_vf_info *vf) | 1563 | struct qlcnic_vf_info *vf) |
1562 | { | 1564 | { |
1563 | struct net_device *dev = vf->adapter->netdev; | 1565 | struct net_device *dev = vf->adapter->netdev; |
1566 | struct qlcnic_vport *vp = vf->vp; | ||
1564 | 1567 | ||
1565 | if (!test_and_clear_bit(QLC_BC_VF_STATE, &vf->state)) { | 1568 | if (!test_and_clear_bit(QLC_BC_VF_STATE, &vf->state)) { |
1566 | clear_bit(QLC_BC_VF_FLR, &vf->state); | 1569 | clear_bit(QLC_BC_VF_FLR, &vf->state); |
@@ -1573,6 +1576,9 @@ void qlcnic_sriov_pf_handle_flr(struct qlcnic_sriov *sriov, | |||
1573 | return; | 1576 | return; |
1574 | } | 1577 | } |
1575 | 1578 | ||
1579 | if (vp->vlan_mode == QLC_GUEST_VLAN_MODE) | ||
1580 | vp->vlan = 0; | ||
1581 | |||
1576 | qlcnic_sriov_schedule_flr(sriov, vf, qlcnic_sriov_pf_process_flr); | 1582 | qlcnic_sriov_schedule_flr(sriov, vf, qlcnic_sriov_pf_process_flr); |
1577 | netdev_info(dev, "FLR received for PCI func %d\n", vf->pci_func); | 1583 | netdev_info(dev, "FLR received for PCI func %d\n", vf->pci_func); |
1578 | } | 1584 | } |
@@ -1621,13 +1627,15 @@ int qlcnic_sriov_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) | |||
1621 | { | 1627 | { |
1622 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1628 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
1623 | struct qlcnic_sriov *sriov = adapter->ahw->sriov; | 1629 | struct qlcnic_sriov *sriov = adapter->ahw->sriov; |
1624 | int i, num_vfs = sriov->num_vfs; | 1630 | int i, num_vfs; |
1625 | struct qlcnic_vf_info *vf_info; | 1631 | struct qlcnic_vf_info *vf_info; |
1626 | u8 *curr_mac; | 1632 | u8 *curr_mac; |
1627 | 1633 | ||
1628 | if (!qlcnic_sriov_pf_check(adapter)) | 1634 | if (!qlcnic_sriov_pf_check(adapter)) |
1629 | return -EOPNOTSUPP; | 1635 | return -EOPNOTSUPP; |
1630 | 1636 | ||
1637 | num_vfs = sriov->num_vfs; | ||
1638 | |||
1631 | if (!is_valid_ether_addr(mac) || vf >= num_vfs) | 1639 | if (!is_valid_ether_addr(mac) || vf >= num_vfs) |
1632 | return -EINVAL; | 1640 | return -EINVAL; |
1633 | 1641 | ||
@@ -1741,6 +1749,7 @@ int qlcnic_sriov_set_vf_vlan(struct net_device *netdev, int vf, | |||
1741 | 1749 | ||
1742 | switch (vlan) { | 1750 | switch (vlan) { |
1743 | case 4095: | 1751 | case 4095: |
1752 | vp->vlan = 0; | ||
1744 | vp->vlan_mode = QLC_GUEST_VLAN_MODE; | 1753 | vp->vlan_mode = QLC_GUEST_VLAN_MODE; |
1745 | break; | 1754 | break; |
1746 | case 0: | 1755 | case 0: |
@@ -1759,6 +1768,29 @@ int qlcnic_sriov_set_vf_vlan(struct net_device *netdev, int vf, | |||
1759 | return 0; | 1768 | return 0; |
1760 | } | 1769 | } |
1761 | 1770 | ||
1771 | static inline __u32 qlcnic_sriov_get_vf_vlan(struct qlcnic_adapter *adapter, | ||
1772 | struct qlcnic_vport *vp, int vf) | ||
1773 | { | ||
1774 | __u32 vlan = 0; | ||
1775 | |||
1776 | switch (vp->vlan_mode) { | ||
1777 | case QLC_PVID_MODE: | ||
1778 | vlan = vp->vlan; | ||
1779 | break; | ||
1780 | case QLC_GUEST_VLAN_MODE: | ||
1781 | vlan = MAX_VLAN_ID; | ||
1782 | break; | ||
1783 | case QLC_NO_VLAN_MODE: | ||
1784 | vlan = 0; | ||
1785 | break; | ||
1786 | default: | ||
1787 | netdev_info(adapter->netdev, "Invalid VLAN mode = %d for VF %d\n", | ||
1788 | vp->vlan_mode, vf); | ||
1789 | } | ||
1790 | |||
1791 | return vlan; | ||
1792 | } | ||
1793 | |||
1762 | int qlcnic_sriov_get_vf_config(struct net_device *netdev, | 1794 | int qlcnic_sriov_get_vf_config(struct net_device *netdev, |
1763 | int vf, struct ifla_vf_info *ivi) | 1795 | int vf, struct ifla_vf_info *ivi) |
1764 | { | 1796 | { |
@@ -1774,7 +1806,7 @@ int qlcnic_sriov_get_vf_config(struct net_device *netdev, | |||
1774 | 1806 | ||
1775 | vp = sriov->vf_info[vf].vp; | 1807 | vp = sriov->vf_info[vf].vp; |
1776 | memcpy(&ivi->mac, vp->mac, ETH_ALEN); | 1808 | memcpy(&ivi->mac, vp->mac, ETH_ALEN); |
1777 | ivi->vlan = vp->vlan; | 1809 | ivi->vlan = qlcnic_sriov_get_vf_vlan(adapter, vp, vf); |
1778 | ivi->qos = vp->qos; | 1810 | ivi->qos = vp->qos; |
1779 | ivi->spoofchk = vp->spoofchk; | 1811 | ivi->spoofchk = vp->spoofchk; |
1780 | if (vp->max_tx_bw == MAX_BW) | 1812 | if (vp->max_tx_bw == MAX_BW) |
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index e6acb9fa5767..6f35f8404d68 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
@@ -478,7 +478,7 @@ rx_status_loop: | |||
478 | 478 | ||
479 | while (1) { | 479 | while (1) { |
480 | u32 status, len; | 480 | u32 status, len; |
481 | dma_addr_t mapping; | 481 | dma_addr_t mapping, new_mapping; |
482 | struct sk_buff *skb, *new_skb; | 482 | struct sk_buff *skb, *new_skb; |
483 | struct cp_desc *desc; | 483 | struct cp_desc *desc; |
484 | const unsigned buflen = cp->rx_buf_sz; | 484 | const unsigned buflen = cp->rx_buf_sz; |
@@ -520,6 +520,13 @@ rx_status_loop: | |||
520 | goto rx_next; | 520 | goto rx_next; |
521 | } | 521 | } |
522 | 522 | ||
523 | new_mapping = dma_map_single(&cp->pdev->dev, new_skb->data, buflen, | ||
524 | PCI_DMA_FROMDEVICE); | ||
525 | if (dma_mapping_error(&cp->pdev->dev, new_mapping)) { | ||
526 | dev->stats.rx_dropped++; | ||
527 | goto rx_next; | ||
528 | } | ||
529 | |||
523 | dma_unmap_single(&cp->pdev->dev, mapping, | 530 | dma_unmap_single(&cp->pdev->dev, mapping, |
524 | buflen, PCI_DMA_FROMDEVICE); | 531 | buflen, PCI_DMA_FROMDEVICE); |
525 | 532 | ||
@@ -531,12 +538,11 @@ rx_status_loop: | |||
531 | 538 | ||
532 | skb_put(skb, len); | 539 | skb_put(skb, len); |
533 | 540 | ||
534 | mapping = dma_map_single(&cp->pdev->dev, new_skb->data, buflen, | ||
535 | PCI_DMA_FROMDEVICE); | ||
536 | cp->rx_skb[rx_tail] = new_skb; | 541 | cp->rx_skb[rx_tail] = new_skb; |
537 | 542 | ||
538 | cp_rx_skb(cp, skb, desc); | 543 | cp_rx_skb(cp, skb, desc); |
539 | rx++; | 544 | rx++; |
545 | mapping = new_mapping; | ||
540 | 546 | ||
541 | rx_next: | 547 | rx_next: |
542 | cp->rx_ring[rx_tail].opts2 = 0; | 548 | cp->rx_ring[rx_tail].opts2 = 0; |
@@ -716,6 +722,22 @@ static inline u32 cp_tx_vlan_tag(struct sk_buff *skb) | |||
716 | TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00; | 722 | TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00; |
717 | } | 723 | } |
718 | 724 | ||
725 | static void unwind_tx_frag_mapping(struct cp_private *cp, struct sk_buff *skb, | ||
726 | int first, int entry_last) | ||
727 | { | ||
728 | int frag, index; | ||
729 | struct cp_desc *txd; | ||
730 | skb_frag_t *this_frag; | ||
731 | for (frag = 0; frag+first < entry_last; frag++) { | ||
732 | index = first+frag; | ||
733 | cp->tx_skb[index] = NULL; | ||
734 | txd = &cp->tx_ring[index]; | ||
735 | this_frag = &skb_shinfo(skb)->frags[frag]; | ||
736 | dma_unmap_single(&cp->pdev->dev, le64_to_cpu(txd->addr), | ||
737 | skb_frag_size(this_frag), PCI_DMA_TODEVICE); | ||
738 | } | ||
739 | } | ||
740 | |||
719 | static netdev_tx_t cp_start_xmit (struct sk_buff *skb, | 741 | static netdev_tx_t cp_start_xmit (struct sk_buff *skb, |
720 | struct net_device *dev) | 742 | struct net_device *dev) |
721 | { | 743 | { |
@@ -749,6 +771,9 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, | |||
749 | 771 | ||
750 | len = skb->len; | 772 | len = skb->len; |
751 | mapping = dma_map_single(&cp->pdev->dev, skb->data, len, PCI_DMA_TODEVICE); | 773 | mapping = dma_map_single(&cp->pdev->dev, skb->data, len, PCI_DMA_TODEVICE); |
774 | if (dma_mapping_error(&cp->pdev->dev, mapping)) | ||
775 | goto out_dma_error; | ||
776 | |||
752 | txd->opts2 = opts2; | 777 | txd->opts2 = opts2; |
753 | txd->addr = cpu_to_le64(mapping); | 778 | txd->addr = cpu_to_le64(mapping); |
754 | wmb(); | 779 | wmb(); |
@@ -786,6 +811,9 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, | |||
786 | first_len = skb_headlen(skb); | 811 | first_len = skb_headlen(skb); |
787 | first_mapping = dma_map_single(&cp->pdev->dev, skb->data, | 812 | first_mapping = dma_map_single(&cp->pdev->dev, skb->data, |
788 | first_len, PCI_DMA_TODEVICE); | 813 | first_len, PCI_DMA_TODEVICE); |
814 | if (dma_mapping_error(&cp->pdev->dev, first_mapping)) | ||
815 | goto out_dma_error; | ||
816 | |||
789 | cp->tx_skb[entry] = skb; | 817 | cp->tx_skb[entry] = skb; |
790 | entry = NEXT_TX(entry); | 818 | entry = NEXT_TX(entry); |
791 | 819 | ||
@@ -799,6 +827,11 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, | |||
799 | mapping = dma_map_single(&cp->pdev->dev, | 827 | mapping = dma_map_single(&cp->pdev->dev, |
800 | skb_frag_address(this_frag), | 828 | skb_frag_address(this_frag), |
801 | len, PCI_DMA_TODEVICE); | 829 | len, PCI_DMA_TODEVICE); |
830 | if (dma_mapping_error(&cp->pdev->dev, mapping)) { | ||
831 | unwind_tx_frag_mapping(cp, skb, first_entry, entry); | ||
832 | goto out_dma_error; | ||
833 | } | ||
834 | |||
802 | eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; | 835 | eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; |
803 | 836 | ||
804 | ctrl = eor | len | DescOwn; | 837 | ctrl = eor | len | DescOwn; |
@@ -859,11 +892,16 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, | |||
859 | if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1)) | 892 | if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1)) |
860 | netif_stop_queue(dev); | 893 | netif_stop_queue(dev); |
861 | 894 | ||
895 | out_unlock: | ||
862 | spin_unlock_irqrestore(&cp->lock, intr_flags); | 896 | spin_unlock_irqrestore(&cp->lock, intr_flags); |
863 | 897 | ||
864 | cpw8(TxPoll, NormalTxPoll); | 898 | cpw8(TxPoll, NormalTxPoll); |
865 | 899 | ||
866 | return NETDEV_TX_OK; | 900 | return NETDEV_TX_OK; |
901 | out_dma_error: | ||
902 | kfree_skb(skb); | ||
903 | cp->dev->stats.tx_dropped++; | ||
904 | goto out_unlock; | ||
867 | } | 905 | } |
868 | 906 | ||
869 | /* Set or clear the multicast filter for this adaptor. | 907 | /* Set or clear the multicast filter for this adaptor. |
@@ -1054,6 +1092,10 @@ static int cp_refill_rx(struct cp_private *cp) | |||
1054 | 1092 | ||
1055 | mapping = dma_map_single(&cp->pdev->dev, skb->data, | 1093 | mapping = dma_map_single(&cp->pdev->dev, skb->data, |
1056 | cp->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1094 | cp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1095 | if (dma_mapping_error(&cp->pdev->dev, mapping)) { | ||
1096 | kfree_skb(skb); | ||
1097 | goto err_out; | ||
1098 | } | ||
1057 | cp->rx_skb[i] = skb; | 1099 | cp->rx_skb[i] = skb; |
1058 | 1100 | ||
1059 | cp->rx_ring[i].opts2 = 0; | 1101 | cp->rx_ring[i].opts2 = 0; |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 4106a743ca74..b5eb4195fc99 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -3689,7 +3689,7 @@ static void rtl_phy_work(struct rtl8169_private *tp) | |||
3689 | if (tp->link_ok(ioaddr)) | 3689 | if (tp->link_ok(ioaddr)) |
3690 | return; | 3690 | return; |
3691 | 3691 | ||
3692 | netif_warn(tp, link, tp->dev, "PHY reset until link up\n"); | 3692 | netif_dbg(tp, link, tp->dev, "PHY reset until link up\n"); |
3693 | 3693 | ||
3694 | tp->phy_reset_enable(tp); | 3694 | tp->phy_reset_enable(tp); |
3695 | 3695 | ||
@@ -6468,6 +6468,8 @@ static int rtl8169_close(struct net_device *dev) | |||
6468 | rtl8169_down(dev); | 6468 | rtl8169_down(dev); |
6469 | rtl_unlock_work(tp); | 6469 | rtl_unlock_work(tp); |
6470 | 6470 | ||
6471 | cancel_work_sync(&tp->wk.work); | ||
6472 | |||
6471 | free_irq(pdev->irq, dev); | 6473 | free_irq(pdev->irq, dev); |
6472 | 6474 | ||
6473 | dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, | 6475 | dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, |
@@ -6793,8 +6795,6 @@ static void rtl_remove_one(struct pci_dev *pdev) | |||
6793 | rtl8168_driver_stop(tp); | 6795 | rtl8168_driver_stop(tp); |
6794 | } | 6796 | } |
6795 | 6797 | ||
6796 | cancel_work_sync(&tp->wk.work); | ||
6797 | |||
6798 | netif_napi_del(&tp->napi); | 6798 | netif_napi_del(&tp->napi); |
6799 | 6799 | ||
6800 | unregister_netdev(dev); | 6800 | unregister_netdev(dev); |
diff --git a/drivers/net/ethernet/sfc/filter.c b/drivers/net/ethernet/sfc/filter.c index b74a60ab9ac7..2a469b27a506 100644 --- a/drivers/net/ethernet/sfc/filter.c +++ b/drivers/net/ethernet/sfc/filter.c | |||
@@ -1209,7 +1209,9 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, | |||
1209 | EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + 4 * ip->ihl + 4); | 1209 | EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + 4 * ip->ihl + 4); |
1210 | ports = (const __be16 *)(skb->data + nhoff + 4 * ip->ihl); | 1210 | ports = (const __be16 *)(skb->data + nhoff + 4 * ip->ihl); |
1211 | 1211 | ||
1212 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_HINT, 0, rxq_index); | 1212 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_HINT, |
1213 | efx->rx_scatter ? EFX_FILTER_FLAG_RX_SCATTER : 0, | ||
1214 | rxq_index); | ||
1213 | rc = efx_filter_set_ipv4_full(&spec, ip->protocol, | 1215 | rc = efx_filter_set_ipv4_full(&spec, ip->protocol, |
1214 | ip->daddr, ports[1], ip->saddr, ports[0]); | 1216 | ip->daddr, ports[1], ip->saddr, ports[0]); |
1215 | if (rc) | 1217 | if (rc) |
diff --git a/drivers/net/ethernet/sis/sis900.c b/drivers/net/ethernet/sis/sis900.c index eb4aea3fe793..f5d7ad75e479 100644 --- a/drivers/net/ethernet/sis/sis900.c +++ b/drivers/net/ethernet/sis/sis900.c | |||
@@ -1318,7 +1318,7 @@ static void sis900_timer(unsigned long data) | |||
1318 | if (duplex){ | 1318 | if (duplex){ |
1319 | sis900_set_mode(sis_priv, speed, duplex); | 1319 | sis900_set_mode(sis_priv, speed, duplex); |
1320 | sis630_set_eq(net_dev, sis_priv->chipset_rev); | 1320 | sis630_set_eq(net_dev, sis_priv->chipset_rev); |
1321 | netif_start_queue(net_dev); | 1321 | netif_carrier_on(net_dev); |
1322 | } | 1322 | } |
1323 | 1323 | ||
1324 | sis_priv->timer.expires = jiffies + HZ; | 1324 | sis_priv->timer.expires = jiffies + HZ; |
@@ -1336,10 +1336,8 @@ static void sis900_timer(unsigned long data) | |||
1336 | status = sis900_default_phy(net_dev); | 1336 | status = sis900_default_phy(net_dev); |
1337 | mii_phy = sis_priv->mii; | 1337 | mii_phy = sis_priv->mii; |
1338 | 1338 | ||
1339 | if (status & MII_STAT_LINK){ | 1339 | if (status & MII_STAT_LINK) |
1340 | sis900_check_mode(net_dev, mii_phy); | 1340 | sis900_check_mode(net_dev, mii_phy); |
1341 | netif_carrier_on(net_dev); | ||
1342 | } | ||
1343 | } else { | 1341 | } else { |
1344 | /* Link ON -> OFF */ | 1342 | /* Link ON -> OFF */ |
1345 | if (!(status & MII_STAT_LINK)){ | 1343 | if (!(status & MII_STAT_LINK)){ |
@@ -1612,12 +1610,6 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev) | |||
1612 | unsigned int index_cur_tx, index_dirty_tx; | 1610 | unsigned int index_cur_tx, index_dirty_tx; |
1613 | unsigned int count_dirty_tx; | 1611 | unsigned int count_dirty_tx; |
1614 | 1612 | ||
1615 | /* Don't transmit data before the complete of auto-negotiation */ | ||
1616 | if(!sis_priv->autong_complete){ | ||
1617 | netif_stop_queue(net_dev); | ||
1618 | return NETDEV_TX_BUSY; | ||
1619 | } | ||
1620 | |||
1621 | spin_lock_irqsave(&sis_priv->lock, flags); | 1613 | spin_lock_irqsave(&sis_priv->lock, flags); |
1622 | 1614 | ||
1623 | /* Calculate the next Tx descriptor entry. */ | 1615 | /* Calculate the next Tx descriptor entry. */ |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 05a1674e204f..22a7a4336211 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -1867,7 +1867,7 @@ static int cpsw_probe(struct platform_device *pdev) | |||
1867 | 1867 | ||
1868 | while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) { | 1868 | while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) { |
1869 | for (i = res->start; i <= res->end; i++) { | 1869 | for (i = res->start; i <= res->end; i++) { |
1870 | if (request_irq(i, cpsw_interrupt, IRQF_DISABLED, | 1870 | if (request_irq(i, cpsw_interrupt, 0, |
1871 | dev_name(&pdev->dev), priv)) { | 1871 | dev_name(&pdev->dev), priv)) { |
1872 | dev_err(priv->dev, "error attaching irq\n"); | 1872 | dev_err(priv->dev, "error attaching irq\n"); |
1873 | goto clean_ale_ret; | 1873 | goto clean_ale_ret; |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 07b176bcf929..1a222bce4bd7 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -1568,8 +1568,7 @@ static int emac_dev_open(struct net_device *ndev) | |||
1568 | while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) { | 1568 | while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) { |
1569 | for (i = res->start; i <= res->end; i++) { | 1569 | for (i = res->start; i <= res->end; i++) { |
1570 | if (devm_request_irq(&priv->pdev->dev, i, emac_irq, | 1570 | if (devm_request_irq(&priv->pdev->dev, i, emac_irq, |
1571 | IRQF_DISABLED, | 1571 | 0, ndev->name, ndev)) |
1572 | ndev->name, ndev)) | ||
1573 | goto rollback; | 1572 | goto rollback; |
1574 | } | 1573 | } |
1575 | k++; | 1574 | k++; |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 18373b6ae37d..d0f9c2fd1d4f 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -337,8 +337,11 @@ static int macvlan_open(struct net_device *dev) | |||
337 | int err; | 337 | int err; |
338 | 338 | ||
339 | if (vlan->port->passthru) { | 339 | if (vlan->port->passthru) { |
340 | if (!(vlan->flags & MACVLAN_FLAG_NOPROMISC)) | 340 | if (!(vlan->flags & MACVLAN_FLAG_NOPROMISC)) { |
341 | dev_set_promiscuity(lowerdev, 1); | 341 | err = dev_set_promiscuity(lowerdev, 1); |
342 | if (err < 0) | ||
343 | goto out; | ||
344 | } | ||
342 | goto hash_add; | 345 | goto hash_add; |
343 | } | 346 | } |
344 | 347 | ||
@@ -863,6 +866,18 @@ static int macvlan_changelink(struct net_device *dev, | |||
863 | struct nlattr *tb[], struct nlattr *data[]) | 866 | struct nlattr *tb[], struct nlattr *data[]) |
864 | { | 867 | { |
865 | struct macvlan_dev *vlan = netdev_priv(dev); | 868 | struct macvlan_dev *vlan = netdev_priv(dev); |
869 | enum macvlan_mode mode; | ||
870 | bool set_mode = false; | ||
871 | |||
872 | /* Validate mode, but don't set yet: setting flags may fail. */ | ||
873 | if (data && data[IFLA_MACVLAN_MODE]) { | ||
874 | set_mode = true; | ||
875 | mode = nla_get_u32(data[IFLA_MACVLAN_MODE]); | ||
876 | /* Passthrough mode can't be set or cleared dynamically */ | ||
877 | if ((mode == MACVLAN_MODE_PASSTHRU) != | ||
878 | (vlan->mode == MACVLAN_MODE_PASSTHRU)) | ||
879 | return -EINVAL; | ||
880 | } | ||
866 | 881 | ||
867 | if (data && data[IFLA_MACVLAN_FLAGS]) { | 882 | if (data && data[IFLA_MACVLAN_FLAGS]) { |
868 | __u16 flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]); | 883 | __u16 flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]); |
@@ -879,8 +894,8 @@ static int macvlan_changelink(struct net_device *dev, | |||
879 | } | 894 | } |
880 | vlan->flags = flags; | 895 | vlan->flags = flags; |
881 | } | 896 | } |
882 | if (data && data[IFLA_MACVLAN_MODE]) | 897 | if (set_mode) |
883 | vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]); | 898 | vlan->mode = mode; |
884 | return 0; | 899 | return 0; |
885 | } | 900 | } |
886 | 901 | ||
diff --git a/drivers/net/phy/mdio-sun4i.c b/drivers/net/phy/mdio-sun4i.c index 61d3f4ebf52e..7f25e49ae37f 100644 --- a/drivers/net/phy/mdio-sun4i.c +++ b/drivers/net/phy/mdio-sun4i.c | |||
@@ -40,7 +40,7 @@ struct sun4i_mdio_data { | |||
40 | static int sun4i_mdio_read(struct mii_bus *bus, int mii_id, int regnum) | 40 | static int sun4i_mdio_read(struct mii_bus *bus, int mii_id, int regnum) |
41 | { | 41 | { |
42 | struct sun4i_mdio_data *data = bus->priv; | 42 | struct sun4i_mdio_data *data = bus->priv; |
43 | unsigned long start_jiffies; | 43 | unsigned long timeout_jiffies; |
44 | int value; | 44 | int value; |
45 | 45 | ||
46 | /* issue the phy address and reg */ | 46 | /* issue the phy address and reg */ |
@@ -49,10 +49,9 @@ static int sun4i_mdio_read(struct mii_bus *bus, int mii_id, int regnum) | |||
49 | writel(0x1, data->membase + EMAC_MAC_MCMD_REG); | 49 | writel(0x1, data->membase + EMAC_MAC_MCMD_REG); |
50 | 50 | ||
51 | /* Wait read complete */ | 51 | /* Wait read complete */ |
52 | start_jiffies = jiffies; | 52 | timeout_jiffies = jiffies + MDIO_TIMEOUT; |
53 | while (readl(data->membase + EMAC_MAC_MIND_REG) & 0x1) { | 53 | while (readl(data->membase + EMAC_MAC_MIND_REG) & 0x1) { |
54 | if (time_after(start_jiffies, | 54 | if (time_is_before_jiffies(timeout_jiffies)) |
55 | start_jiffies + MDIO_TIMEOUT)) | ||
56 | return -ETIMEDOUT; | 55 | return -ETIMEDOUT; |
57 | msleep(1); | 56 | msleep(1); |
58 | } | 57 | } |
@@ -69,7 +68,7 @@ static int sun4i_mdio_write(struct mii_bus *bus, int mii_id, int regnum, | |||
69 | u16 value) | 68 | u16 value) |
70 | { | 69 | { |
71 | struct sun4i_mdio_data *data = bus->priv; | 70 | struct sun4i_mdio_data *data = bus->priv; |
72 | unsigned long start_jiffies; | 71 | unsigned long timeout_jiffies; |
73 | 72 | ||
74 | /* issue the phy address and reg */ | 73 | /* issue the phy address and reg */ |
75 | writel((mii_id << 8) | regnum, data->membase + EMAC_MAC_MADR_REG); | 74 | writel((mii_id << 8) | regnum, data->membase + EMAC_MAC_MADR_REG); |
@@ -77,10 +76,9 @@ static int sun4i_mdio_write(struct mii_bus *bus, int mii_id, int regnum, | |||
77 | writel(0x1, data->membase + EMAC_MAC_MCMD_REG); | 76 | writel(0x1, data->membase + EMAC_MAC_MCMD_REG); |
78 | 77 | ||
79 | /* Wait read complete */ | 78 | /* Wait read complete */ |
80 | start_jiffies = jiffies; | 79 | timeout_jiffies = jiffies + MDIO_TIMEOUT; |
81 | while (readl(data->membase + EMAC_MAC_MIND_REG) & 0x1) { | 80 | while (readl(data->membase + EMAC_MAC_MIND_REG) & 0x1) { |
82 | if (time_after(start_jiffies, | 81 | if (time_is_before_jiffies(timeout_jiffies)) |
83 | start_jiffies + MDIO_TIMEOUT)) | ||
84 | return -ETIMEDOUT; | 82 | return -ETIMEDOUT; |
85 | msleep(1); | 83 | msleep(1); |
86 | } | 84 | } |
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 1e3c302d94fe..2bc87e3a8141 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c | |||
@@ -1029,10 +1029,10 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1029 | dev->mii.supports_gmii = 1; | 1029 | dev->mii.supports_gmii = 1; |
1030 | 1030 | ||
1031 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 1031 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1032 | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO; | 1032 | NETIF_F_RXCSUM; |
1033 | 1033 | ||
1034 | dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 1034 | dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1035 | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO; | 1035 | NETIF_F_RXCSUM; |
1036 | 1036 | ||
1037 | /* Enable checksum offload */ | 1037 | /* Enable checksum offload */ |
1038 | *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | | 1038 | *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | |
@@ -1173,7 +1173,6 @@ ax88179_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) | |||
1173 | if (((skb->len + 8) % frame_size) == 0) | 1173 | if (((skb->len + 8) % frame_size) == 0) |
1174 | tx_hdr2 |= 0x80008000; /* Enable padding */ | 1174 | tx_hdr2 |= 0x80008000; /* Enable padding */ |
1175 | 1175 | ||
1176 | skb_linearize(skb); | ||
1177 | headroom = skb_headroom(skb); | 1176 | headroom = skb_headroom(skb); |
1178 | tailroom = skb_tailroom(skb); | 1177 | tailroom = skb_tailroom(skb); |
1179 | 1178 | ||
@@ -1317,10 +1316,10 @@ static int ax88179_reset(struct usbnet *dev) | |||
1317 | 1, 1, tmp); | 1316 | 1, 1, tmp); |
1318 | 1317 | ||
1319 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 1318 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1320 | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO; | 1319 | NETIF_F_RXCSUM; |
1321 | 1320 | ||
1322 | dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 1321 | dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1323 | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO; | 1322 | NETIF_F_RXCSUM; |
1324 | 1323 | ||
1325 | /* Enable checksum offload */ | 1324 | /* Enable checksum offload */ |
1326 | *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | | 1325 | *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index ee13f9eb740c..11c51f275366 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -344,17 +344,41 @@ static const int multicast_filter_limit = 32; | |||
344 | static | 344 | static |
345 | int get_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) | 345 | int get_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) |
346 | { | 346 | { |
347 | return usb_control_msg(tp->udev, usb_rcvctrlpipe(tp->udev, 0), | 347 | int ret; |
348 | void *tmp; | ||
349 | |||
350 | tmp = kmalloc(size, GFP_KERNEL); | ||
351 | if (!tmp) | ||
352 | return -ENOMEM; | ||
353 | |||
354 | ret = usb_control_msg(tp->udev, usb_rcvctrlpipe(tp->udev, 0), | ||
348 | RTL8152_REQ_GET_REGS, RTL8152_REQT_READ, | 355 | RTL8152_REQ_GET_REGS, RTL8152_REQT_READ, |
349 | value, index, data, size, 500); | 356 | value, index, tmp, size, 500); |
357 | |||
358 | memcpy(data, tmp, size); | ||
359 | kfree(tmp); | ||
360 | |||
361 | return ret; | ||
350 | } | 362 | } |
351 | 363 | ||
352 | static | 364 | static |
353 | int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) | 365 | int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) |
354 | { | 366 | { |
355 | return usb_control_msg(tp->udev, usb_sndctrlpipe(tp->udev, 0), | 367 | int ret; |
368 | void *tmp; | ||
369 | |||
370 | tmp = kmalloc(size, GFP_KERNEL); | ||
371 | if (!tmp) | ||
372 | return -ENOMEM; | ||
373 | |||
374 | memcpy(tmp, data, size); | ||
375 | |||
376 | ret = usb_control_msg(tp->udev, usb_sndctrlpipe(tp->udev, 0), | ||
356 | RTL8152_REQ_SET_REGS, RTL8152_REQT_WRITE, | 377 | RTL8152_REQ_SET_REGS, RTL8152_REQT_WRITE, |
357 | value, index, data, size, 500); | 378 | value, index, tmp, size, 500); |
379 | |||
380 | kfree(tmp); | ||
381 | return ret; | ||
358 | } | 382 | } |
359 | 383 | ||
360 | static int generic_ocp_read(struct r8152 *tp, u16 index, u16 size, | 384 | static int generic_ocp_read(struct r8152 *tp, u16 index, u16 size, |
@@ -490,37 +514,31 @@ int usb_ocp_write(struct r8152 *tp, u16 index, u16 byteen, u16 size, void *data) | |||
490 | 514 | ||
491 | static u32 ocp_read_dword(struct r8152 *tp, u16 type, u16 index) | 515 | static u32 ocp_read_dword(struct r8152 *tp, u16 type, u16 index) |
492 | { | 516 | { |
493 | u32 data; | 517 | __le32 data; |
494 | 518 | ||
495 | if (type == MCU_TYPE_PLA) | 519 | generic_ocp_read(tp, index, sizeof(data), &data, type); |
496 | pla_ocp_read(tp, index, sizeof(data), &data); | ||
497 | else | ||
498 | usb_ocp_read(tp, index, sizeof(data), &data); | ||
499 | 520 | ||
500 | return __le32_to_cpu(data); | 521 | return __le32_to_cpu(data); |
501 | } | 522 | } |
502 | 523 | ||
503 | static void ocp_write_dword(struct r8152 *tp, u16 type, u16 index, u32 data) | 524 | static void ocp_write_dword(struct r8152 *tp, u16 type, u16 index, u32 data) |
504 | { | 525 | { |
505 | if (type == MCU_TYPE_PLA) | 526 | __le32 tmp = __cpu_to_le32(data); |
506 | pla_ocp_write(tp, index, BYTE_EN_DWORD, sizeof(data), &data); | 527 | |
507 | else | 528 | generic_ocp_write(tp, index, BYTE_EN_DWORD, sizeof(tmp), &tmp, type); |
508 | usb_ocp_write(tp, index, BYTE_EN_DWORD, sizeof(data), &data); | ||
509 | } | 529 | } |
510 | 530 | ||
511 | static u16 ocp_read_word(struct r8152 *tp, u16 type, u16 index) | 531 | static u16 ocp_read_word(struct r8152 *tp, u16 type, u16 index) |
512 | { | 532 | { |
513 | u32 data; | 533 | u32 data; |
534 | __le32 tmp; | ||
514 | u8 shift = index & 2; | 535 | u8 shift = index & 2; |
515 | 536 | ||
516 | index &= ~3; | 537 | index &= ~3; |
517 | 538 | ||
518 | if (type == MCU_TYPE_PLA) | 539 | generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); |
519 | pla_ocp_read(tp, index, sizeof(data), &data); | ||
520 | else | ||
521 | usb_ocp_read(tp, index, sizeof(data), &data); | ||
522 | 540 | ||
523 | data = __le32_to_cpu(data); | 541 | data = __le32_to_cpu(tmp); |
524 | data >>= (shift * 8); | 542 | data >>= (shift * 8); |
525 | data &= 0xffff; | 543 | data &= 0xffff; |
526 | 544 | ||
@@ -529,7 +547,8 @@ static u16 ocp_read_word(struct r8152 *tp, u16 type, u16 index) | |||
529 | 547 | ||
530 | static void ocp_write_word(struct r8152 *tp, u16 type, u16 index, u32 data) | 548 | static void ocp_write_word(struct r8152 *tp, u16 type, u16 index, u32 data) |
531 | { | 549 | { |
532 | u32 tmp, mask = 0xffff; | 550 | u32 mask = 0xffff; |
551 | __le32 tmp; | ||
533 | u16 byen = BYTE_EN_WORD; | 552 | u16 byen = BYTE_EN_WORD; |
534 | u8 shift = index & 2; | 553 | u8 shift = index & 2; |
535 | 554 | ||
@@ -542,34 +561,25 @@ static void ocp_write_word(struct r8152 *tp, u16 type, u16 index, u32 data) | |||
542 | index &= ~3; | 561 | index &= ~3; |
543 | } | 562 | } |
544 | 563 | ||
545 | if (type == MCU_TYPE_PLA) | 564 | generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); |
546 | pla_ocp_read(tp, index, sizeof(tmp), &tmp); | ||
547 | else | ||
548 | usb_ocp_read(tp, index, sizeof(tmp), &tmp); | ||
549 | 565 | ||
550 | tmp = __le32_to_cpu(tmp) & ~mask; | 566 | data |= __le32_to_cpu(tmp) & ~mask; |
551 | tmp |= data; | 567 | tmp = __cpu_to_le32(data); |
552 | tmp = __cpu_to_le32(tmp); | ||
553 | 568 | ||
554 | if (type == MCU_TYPE_PLA) | 569 | generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type); |
555 | pla_ocp_write(tp, index, byen, sizeof(tmp), &tmp); | ||
556 | else | ||
557 | usb_ocp_write(tp, index, byen, sizeof(tmp), &tmp); | ||
558 | } | 570 | } |
559 | 571 | ||
560 | static u8 ocp_read_byte(struct r8152 *tp, u16 type, u16 index) | 572 | static u8 ocp_read_byte(struct r8152 *tp, u16 type, u16 index) |
561 | { | 573 | { |
562 | u32 data; | 574 | u32 data; |
575 | __le32 tmp; | ||
563 | u8 shift = index & 3; | 576 | u8 shift = index & 3; |
564 | 577 | ||
565 | index &= ~3; | 578 | index &= ~3; |
566 | 579 | ||
567 | if (type == MCU_TYPE_PLA) | 580 | generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); |
568 | pla_ocp_read(tp, index, sizeof(data), &data); | ||
569 | else | ||
570 | usb_ocp_read(tp, index, sizeof(data), &data); | ||
571 | 581 | ||
572 | data = __le32_to_cpu(data); | 582 | data = __le32_to_cpu(tmp); |
573 | data >>= (shift * 8); | 583 | data >>= (shift * 8); |
574 | data &= 0xff; | 584 | data &= 0xff; |
575 | 585 | ||
@@ -578,7 +588,8 @@ static u8 ocp_read_byte(struct r8152 *tp, u16 type, u16 index) | |||
578 | 588 | ||
579 | static void ocp_write_byte(struct r8152 *tp, u16 type, u16 index, u32 data) | 589 | static void ocp_write_byte(struct r8152 *tp, u16 type, u16 index, u32 data) |
580 | { | 590 | { |
581 | u32 tmp, mask = 0xff; | 591 | u32 mask = 0xff; |
592 | __le32 tmp; | ||
582 | u16 byen = BYTE_EN_BYTE; | 593 | u16 byen = BYTE_EN_BYTE; |
583 | u8 shift = index & 3; | 594 | u8 shift = index & 3; |
584 | 595 | ||
@@ -591,19 +602,12 @@ static void ocp_write_byte(struct r8152 *tp, u16 type, u16 index, u32 data) | |||
591 | index &= ~3; | 602 | index &= ~3; |
592 | } | 603 | } |
593 | 604 | ||
594 | if (type == MCU_TYPE_PLA) | 605 | generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); |
595 | pla_ocp_read(tp, index, sizeof(tmp), &tmp); | ||
596 | else | ||
597 | usb_ocp_read(tp, index, sizeof(tmp), &tmp); | ||
598 | 606 | ||
599 | tmp = __le32_to_cpu(tmp) & ~mask; | 607 | data |= __le32_to_cpu(tmp) & ~mask; |
600 | tmp |= data; | 608 | tmp = __cpu_to_le32(data); |
601 | tmp = __cpu_to_le32(tmp); | ||
602 | 609 | ||
603 | if (type == MCU_TYPE_PLA) | 610 | generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type); |
604 | pla_ocp_write(tp, index, byen, sizeof(tmp), &tmp); | ||
605 | else | ||
606 | usb_ocp_write(tp, index, byen, sizeof(tmp), &tmp); | ||
607 | } | 611 | } |
608 | 612 | ||
609 | static void r8152_mdio_write(struct r8152 *tp, u32 reg_addr, u32 value) | 613 | static void r8152_mdio_write(struct r8152 *tp, u32 reg_addr, u32 value) |
@@ -685,21 +689,14 @@ static void ocp_reg_write(struct r8152 *tp, u16 addr, u16 data) | |||
685 | static inline void set_ethernet_addr(struct r8152 *tp) | 689 | static inline void set_ethernet_addr(struct r8152 *tp) |
686 | { | 690 | { |
687 | struct net_device *dev = tp->netdev; | 691 | struct net_device *dev = tp->netdev; |
688 | u8 *node_id; | 692 | u8 node_id[8] = {0}; |
689 | |||
690 | node_id = kmalloc(sizeof(u8) * 8, GFP_KERNEL); | ||
691 | if (!node_id) { | ||
692 | netif_err(tp, probe, dev, "out of memory"); | ||
693 | return; | ||
694 | } | ||
695 | 693 | ||
696 | if (pla_ocp_read(tp, PLA_IDR, sizeof(u8) * 8, node_id) < 0) | 694 | if (pla_ocp_read(tp, PLA_IDR, sizeof(node_id), node_id) < 0) |
697 | netif_notice(tp, probe, dev, "inet addr fail\n"); | 695 | netif_notice(tp, probe, dev, "inet addr fail\n"); |
698 | else { | 696 | else { |
699 | memcpy(dev->dev_addr, node_id, dev->addr_len); | 697 | memcpy(dev->dev_addr, node_id, dev->addr_len); |
700 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | 698 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); |
701 | } | 699 | } |
702 | kfree(node_id); | ||
703 | } | 700 | } |
704 | 701 | ||
705 | static int rtl8152_set_mac_address(struct net_device *netdev, void *p) | 702 | static int rtl8152_set_mac_address(struct net_device *netdev, void *p) |
@@ -882,15 +879,10 @@ static void rtl8152_set_rx_mode(struct net_device *netdev) | |||
882 | static void _rtl8152_set_rx_mode(struct net_device *netdev) | 879 | static void _rtl8152_set_rx_mode(struct net_device *netdev) |
883 | { | 880 | { |
884 | struct r8152 *tp = netdev_priv(netdev); | 881 | struct r8152 *tp = netdev_priv(netdev); |
885 | u32 tmp, *mc_filter; /* Multicast hash filter */ | 882 | u32 mc_filter[2]; /* Multicast hash filter */ |
883 | __le32 tmp[2]; | ||
886 | u32 ocp_data; | 884 | u32 ocp_data; |
887 | 885 | ||
888 | mc_filter = kmalloc(sizeof(u32) * 2, GFP_KERNEL); | ||
889 | if (!mc_filter) { | ||
890 | netif_err(tp, link, netdev, "out of memory"); | ||
891 | return; | ||
892 | } | ||
893 | |||
894 | clear_bit(RTL8152_SET_RX_MODE, &tp->flags); | 886 | clear_bit(RTL8152_SET_RX_MODE, &tp->flags); |
895 | netif_stop_queue(netdev); | 887 | netif_stop_queue(netdev); |
896 | ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); | 888 | ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); |
@@ -918,14 +910,12 @@ static void _rtl8152_set_rx_mode(struct net_device *netdev) | |||
918 | } | 910 | } |
919 | } | 911 | } |
920 | 912 | ||
921 | tmp = mc_filter[0]; | 913 | tmp[0] = __cpu_to_le32(swab32(mc_filter[1])); |
922 | mc_filter[0] = __cpu_to_le32(swab32(mc_filter[1])); | 914 | tmp[1] = __cpu_to_le32(swab32(mc_filter[0])); |
923 | mc_filter[1] = __cpu_to_le32(swab32(tmp)); | ||
924 | 915 | ||
925 | pla_ocp_write(tp, PLA_MAR, BYTE_EN_DWORD, sizeof(u32) * 2, mc_filter); | 916 | pla_ocp_write(tp, PLA_MAR, BYTE_EN_DWORD, sizeof(tmp), tmp); |
926 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); | 917 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); |
927 | netif_wake_queue(netdev); | 918 | netif_wake_queue(netdev); |
928 | kfree(mc_filter); | ||
929 | } | 919 | } |
930 | 920 | ||
931 | static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb, | 921 | static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb, |
diff --git a/drivers/net/usb/r815x.c b/drivers/net/usb/r815x.c index 852392269718..2df2f4fb42a7 100644 --- a/drivers/net/usb/r815x.c +++ b/drivers/net/usb/r815x.c | |||
@@ -24,34 +24,43 @@ | |||
24 | 24 | ||
25 | static int pla_read_word(struct usb_device *udev, u16 index) | 25 | static int pla_read_word(struct usb_device *udev, u16 index) |
26 | { | 26 | { |
27 | int data, ret; | 27 | int ret; |
28 | u8 shift = index & 2; | 28 | u8 shift = index & 2; |
29 | __le32 ocp_data; | 29 | __le32 *tmp; |
30 | |||
31 | tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); | ||
32 | if (!tmp) | ||
33 | return -ENOMEM; | ||
30 | 34 | ||
31 | index &= ~3; | 35 | index &= ~3; |
32 | 36 | ||
33 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 37 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
34 | RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, | 38 | RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, |
35 | index, MCU_TYPE_PLA, &ocp_data, sizeof(ocp_data), | 39 | index, MCU_TYPE_PLA, tmp, sizeof(*tmp), 500); |
36 | 500); | ||
37 | if (ret < 0) | 40 | if (ret < 0) |
38 | return ret; | 41 | goto out2; |
39 | 42 | ||
40 | data = __le32_to_cpu(ocp_data); | 43 | ret = __le32_to_cpu(*tmp); |
41 | data >>= (shift * 8); | 44 | ret >>= (shift * 8); |
42 | data &= 0xffff; | 45 | ret &= 0xffff; |
43 | 46 | ||
44 | return data; | 47 | out2: |
48 | kfree(tmp); | ||
49 | return ret; | ||
45 | } | 50 | } |
46 | 51 | ||
47 | static int pla_write_word(struct usb_device *udev, u16 index, u32 data) | 52 | static int pla_write_word(struct usb_device *udev, u16 index, u32 data) |
48 | { | 53 | { |
49 | __le32 ocp_data; | 54 | __le32 *tmp; |
50 | u32 mask = 0xffff; | 55 | u32 mask = 0xffff; |
51 | u16 byen = BYTE_EN_WORD; | 56 | u16 byen = BYTE_EN_WORD; |
52 | u8 shift = index & 2; | 57 | u8 shift = index & 2; |
53 | int ret; | 58 | int ret; |
54 | 59 | ||
60 | tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); | ||
61 | if (!tmp) | ||
62 | return -ENOMEM; | ||
63 | |||
55 | data &= mask; | 64 | data &= mask; |
56 | 65 | ||
57 | if (shift) { | 66 | if (shift) { |
@@ -63,19 +72,20 @@ static int pla_write_word(struct usb_device *udev, u16 index, u32 data) | |||
63 | 72 | ||
64 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 73 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
65 | RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, | 74 | RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, |
66 | index, MCU_TYPE_PLA, &ocp_data, sizeof(ocp_data), | 75 | index, MCU_TYPE_PLA, tmp, sizeof(*tmp), 500); |
67 | 500); | ||
68 | if (ret < 0) | 76 | if (ret < 0) |
69 | return ret; | 77 | goto out3; |
70 | 78 | ||
71 | data |= __le32_to_cpu(ocp_data) & ~mask; | 79 | data |= __le32_to_cpu(*tmp) & ~mask; |
72 | ocp_data = __cpu_to_le32(data); | 80 | *tmp = __cpu_to_le32(data); |
73 | 81 | ||
74 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 82 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
75 | RTL815x_REQ_SET_REGS, RTL815x_REQT_WRITE, | 83 | RTL815x_REQ_SET_REGS, RTL815x_REQT_WRITE, |
76 | index, MCU_TYPE_PLA | byen, &ocp_data, | 84 | index, MCU_TYPE_PLA | byen, tmp, sizeof(*tmp), |
77 | sizeof(ocp_data), 500); | 85 | 500); |
78 | 86 | ||
87 | out3: | ||
88 | kfree(tmp); | ||
79 | return ret; | 89 | return ret; |
80 | } | 90 | } |
81 | 91 | ||
@@ -116,11 +126,18 @@ out1: | |||
116 | static int r815x_mdio_read(struct net_device *netdev, int phy_id, int reg) | 126 | static int r815x_mdio_read(struct net_device *netdev, int phy_id, int reg) |
117 | { | 127 | { |
118 | struct usbnet *dev = netdev_priv(netdev); | 128 | struct usbnet *dev = netdev_priv(netdev); |
129 | int ret; | ||
119 | 130 | ||
120 | if (phy_id != R815x_PHY_ID) | 131 | if (phy_id != R815x_PHY_ID) |
121 | return -EINVAL; | 132 | return -EINVAL; |
122 | 133 | ||
123 | return ocp_reg_read(dev, BASE_MII + reg * 2); | 134 | if (usb_autopm_get_interface(dev->intf) < 0) |
135 | return -ENODEV; | ||
136 | |||
137 | ret = ocp_reg_read(dev, BASE_MII + reg * 2); | ||
138 | |||
139 | usb_autopm_put_interface(dev->intf); | ||
140 | return ret; | ||
124 | } | 141 | } |
125 | 142 | ||
126 | static | 143 | static |
@@ -131,7 +148,12 @@ void r815x_mdio_write(struct net_device *netdev, int phy_id, int reg, int val) | |||
131 | if (phy_id != R815x_PHY_ID) | 148 | if (phy_id != R815x_PHY_ID) |
132 | return; | 149 | return; |
133 | 150 | ||
151 | if (usb_autopm_get_interface(dev->intf) < 0) | ||
152 | return; | ||
153 | |||
134 | ocp_reg_write(dev, BASE_MII + reg * 2, val); | 154 | ocp_reg_write(dev, BASE_MII + reg * 2, val); |
155 | |||
156 | usb_autopm_put_interface(dev->intf); | ||
135 | } | 157 | } |
136 | 158 | ||
137 | static int r8153_bind(struct usbnet *dev, struct usb_interface *intf) | 159 | static int r8153_bind(struct usbnet *dev, struct usb_interface *intf) |
@@ -150,7 +172,7 @@ static int r8153_bind(struct usbnet *dev, struct usb_interface *intf) | |||
150 | dev->mii.phy_id = R815x_PHY_ID; | 172 | dev->mii.phy_id = R815x_PHY_ID; |
151 | dev->mii.supports_gmii = 1; | 173 | dev->mii.supports_gmii = 1; |
152 | 174 | ||
153 | return 0; | 175 | return status; |
154 | } | 176 | } |
155 | 177 | ||
156 | static int r8152_bind(struct usbnet *dev, struct usb_interface *intf) | 178 | static int r8152_bind(struct usbnet *dev, struct usb_interface *intf) |
@@ -169,7 +191,7 @@ static int r8152_bind(struct usbnet *dev, struct usb_interface *intf) | |||
169 | dev->mii.phy_id = R815x_PHY_ID; | 191 | dev->mii.phy_id = R815x_PHY_ID; |
170 | dev->mii.supports_gmii = 0; | 192 | dev->mii.supports_gmii = 0; |
171 | 193 | ||
172 | return 0; | 194 | return status; |
173 | } | 195 | } |
174 | 196 | ||
175 | static const struct driver_info r8152_info = { | 197 | static const struct driver_info r8152_info = { |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 75409748c774..66ebbacf066f 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #define EEPROM_MAC_OFFSET (0x01) | 45 | #define EEPROM_MAC_OFFSET (0x01) |
46 | #define DEFAULT_TX_CSUM_ENABLE (true) | 46 | #define DEFAULT_TX_CSUM_ENABLE (true) |
47 | #define DEFAULT_RX_CSUM_ENABLE (true) | 47 | #define DEFAULT_RX_CSUM_ENABLE (true) |
48 | #define DEFAULT_TSO_ENABLE (true) | ||
49 | #define SMSC75XX_INTERNAL_PHY_ID (1) | 48 | #define SMSC75XX_INTERNAL_PHY_ID (1) |
50 | #define SMSC75XX_TX_OVERHEAD (8) | 49 | #define SMSC75XX_TX_OVERHEAD (8) |
51 | #define MAX_RX_FIFO_SIZE (20 * 1024) | 50 | #define MAX_RX_FIFO_SIZE (20 * 1024) |
@@ -1410,17 +1409,14 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1410 | 1409 | ||
1411 | INIT_WORK(&pdata->set_multicast, smsc75xx_deferred_multicast_write); | 1410 | INIT_WORK(&pdata->set_multicast, smsc75xx_deferred_multicast_write); |
1412 | 1411 | ||
1413 | if (DEFAULT_TX_CSUM_ENABLE) { | 1412 | if (DEFAULT_TX_CSUM_ENABLE) |
1414 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; | 1413 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; |
1415 | if (DEFAULT_TSO_ENABLE) | 1414 | |
1416 | dev->net->features |= NETIF_F_SG | | ||
1417 | NETIF_F_TSO | NETIF_F_TSO6; | ||
1418 | } | ||
1419 | if (DEFAULT_RX_CSUM_ENABLE) | 1415 | if (DEFAULT_RX_CSUM_ENABLE) |
1420 | dev->net->features |= NETIF_F_RXCSUM; | 1416 | dev->net->features |= NETIF_F_RXCSUM; |
1421 | 1417 | ||
1422 | dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 1418 | dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1423 | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM; | 1419 | NETIF_F_RXCSUM; |
1424 | 1420 | ||
1425 | ret = smsc75xx_wait_ready(dev, 0); | 1421 | ret = smsc75xx_wait_ready(dev, 0); |
1426 | if (ret < 0) { | 1422 | if (ret < 0) { |
@@ -2200,8 +2196,6 @@ static struct sk_buff *smsc75xx_tx_fixup(struct usbnet *dev, | |||
2200 | { | 2196 | { |
2201 | u32 tx_cmd_a, tx_cmd_b; | 2197 | u32 tx_cmd_a, tx_cmd_b; |
2202 | 2198 | ||
2203 | skb_linearize(skb); | ||
2204 | |||
2205 | if (skb_headroom(skb) < SMSC75XX_TX_OVERHEAD) { | 2199 | if (skb_headroom(skb) < SMSC75XX_TX_OVERHEAD) { |
2206 | struct sk_buff *skb2 = | 2200 | struct sk_buff *skb2 = |
2207 | skb_copy_expand(skb, SMSC75XX_TX_OVERHEAD, 0, flags); | 2201 | skb_copy_expand(skb, SMSC75XX_TX_OVERHEAD, 0, flags); |
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index da866523cf20..eee1f19ef1e9 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -269,6 +269,7 @@ static void veth_setup(struct net_device *dev) | |||
269 | dev->ethtool_ops = &veth_ethtool_ops; | 269 | dev->ethtool_ops = &veth_ethtool_ops; |
270 | dev->features |= NETIF_F_LLTX; | 270 | dev->features |= NETIF_F_LLTX; |
271 | dev->features |= VETH_FEATURES; | 271 | dev->features |= VETH_FEATURES; |
272 | dev->vlan_features = dev->features; | ||
272 | dev->destructor = veth_dev_free; | 273 | dev->destructor = veth_dev_free; |
273 | 274 | ||
274 | dev->hw_features = VETH_FEATURES; | 275 | dev->hw_features = VETH_FEATURES; |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index a5ba8dd7e6be..f4c6db419ddb 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -136,7 +136,8 @@ struct vxlan_dev { | |||
136 | u32 flags; /* VXLAN_F_* below */ | 136 | u32 flags; /* VXLAN_F_* below */ |
137 | 137 | ||
138 | struct work_struct sock_work; | 138 | struct work_struct sock_work; |
139 | struct work_struct igmp_work; | 139 | struct work_struct igmp_join; |
140 | struct work_struct igmp_leave; | ||
140 | 141 | ||
141 | unsigned long age_interval; | 142 | unsigned long age_interval; |
142 | struct timer_list age_timer; | 143 | struct timer_list age_timer; |
@@ -736,7 +737,6 @@ static bool vxlan_snoop(struct net_device *dev, | |||
736 | return false; | 737 | return false; |
737 | } | 738 | } |
738 | 739 | ||
739 | |||
740 | /* See if multicast group is already in use by other ID */ | 740 | /* See if multicast group is already in use by other ID */ |
741 | static bool vxlan_group_used(struct vxlan_net *vn, __be32 remote_ip) | 741 | static bool vxlan_group_used(struct vxlan_net *vn, __be32 remote_ip) |
742 | { | 742 | { |
@@ -770,12 +770,13 @@ static void vxlan_sock_release(struct vxlan_net *vn, struct vxlan_sock *vs) | |||
770 | queue_work(vxlan_wq, &vs->del_work); | 770 | queue_work(vxlan_wq, &vs->del_work); |
771 | } | 771 | } |
772 | 772 | ||
773 | /* Callback to update multicast group membership. | 773 | /* Callback to update multicast group membership when first VNI on |
774 | * Scheduled when vxlan goes up/down. | 774 | * multicast asddress is brought up |
775 | * Done as workqueue because ip_mc_join_group acquires RTNL. | ||
775 | */ | 776 | */ |
776 | static void vxlan_igmp_work(struct work_struct *work) | 777 | static void vxlan_igmp_join(struct work_struct *work) |
777 | { | 778 | { |
778 | struct vxlan_dev *vxlan = container_of(work, struct vxlan_dev, igmp_work); | 779 | struct vxlan_dev *vxlan = container_of(work, struct vxlan_dev, igmp_join); |
779 | struct vxlan_net *vn = net_generic(dev_net(vxlan->dev), vxlan_net_id); | 780 | struct vxlan_net *vn = net_generic(dev_net(vxlan->dev), vxlan_net_id); |
780 | struct vxlan_sock *vs = vxlan->vn_sock; | 781 | struct vxlan_sock *vs = vxlan->vn_sock; |
781 | struct sock *sk = vs->sock->sk; | 782 | struct sock *sk = vs->sock->sk; |
@@ -785,10 +786,27 @@ static void vxlan_igmp_work(struct work_struct *work) | |||
785 | }; | 786 | }; |
786 | 787 | ||
787 | lock_sock(sk); | 788 | lock_sock(sk); |
788 | if (vxlan_group_used(vn, vxlan->default_dst.remote_ip)) | 789 | ip_mc_join_group(sk, &mreq); |
789 | ip_mc_join_group(sk, &mreq); | 790 | release_sock(sk); |
790 | else | 791 | |
791 | ip_mc_leave_group(sk, &mreq); | 792 | vxlan_sock_release(vn, vs); |
793 | dev_put(vxlan->dev); | ||
794 | } | ||
795 | |||
796 | /* Inverse of vxlan_igmp_join when last VNI is brought down */ | ||
797 | static void vxlan_igmp_leave(struct work_struct *work) | ||
798 | { | ||
799 | struct vxlan_dev *vxlan = container_of(work, struct vxlan_dev, igmp_leave); | ||
800 | struct vxlan_net *vn = net_generic(dev_net(vxlan->dev), vxlan_net_id); | ||
801 | struct vxlan_sock *vs = vxlan->vn_sock; | ||
802 | struct sock *sk = vs->sock->sk; | ||
803 | struct ip_mreqn mreq = { | ||
804 | .imr_multiaddr.s_addr = vxlan->default_dst.remote_ip, | ||
805 | .imr_ifindex = vxlan->default_dst.remote_ifindex, | ||
806 | }; | ||
807 | |||
808 | lock_sock(sk); | ||
809 | ip_mc_leave_group(sk, &mreq); | ||
792 | release_sock(sk); | 810 | release_sock(sk); |
793 | 811 | ||
794 | vxlan_sock_release(vn, vs); | 812 | vxlan_sock_release(vn, vs); |
@@ -1359,6 +1377,7 @@ static void vxlan_uninit(struct net_device *dev) | |||
1359 | /* Start ageing timer and join group when device is brought up */ | 1377 | /* Start ageing timer and join group when device is brought up */ |
1360 | static int vxlan_open(struct net_device *dev) | 1378 | static int vxlan_open(struct net_device *dev) |
1361 | { | 1379 | { |
1380 | struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); | ||
1362 | struct vxlan_dev *vxlan = netdev_priv(dev); | 1381 | struct vxlan_dev *vxlan = netdev_priv(dev); |
1363 | struct vxlan_sock *vs = vxlan->vn_sock; | 1382 | struct vxlan_sock *vs = vxlan->vn_sock; |
1364 | 1383 | ||
@@ -1366,10 +1385,11 @@ static int vxlan_open(struct net_device *dev) | |||
1366 | if (!vs) | 1385 | if (!vs) |
1367 | return -ENOTCONN; | 1386 | return -ENOTCONN; |
1368 | 1387 | ||
1369 | if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip))) { | 1388 | if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip)) && |
1389 | ! vxlan_group_used(vn, vxlan->default_dst.remote_ip)) { | ||
1370 | vxlan_sock_hold(vs); | 1390 | vxlan_sock_hold(vs); |
1371 | dev_hold(dev); | 1391 | dev_hold(dev); |
1372 | queue_work(vxlan_wq, &vxlan->igmp_work); | 1392 | queue_work(vxlan_wq, &vxlan->igmp_join); |
1373 | } | 1393 | } |
1374 | 1394 | ||
1375 | if (vxlan->age_interval) | 1395 | if (vxlan->age_interval) |
@@ -1400,13 +1420,15 @@ static void vxlan_flush(struct vxlan_dev *vxlan) | |||
1400 | /* Cleanup timer and forwarding table on shutdown */ | 1420 | /* Cleanup timer and forwarding table on shutdown */ |
1401 | static int vxlan_stop(struct net_device *dev) | 1421 | static int vxlan_stop(struct net_device *dev) |
1402 | { | 1422 | { |
1423 | struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); | ||
1403 | struct vxlan_dev *vxlan = netdev_priv(dev); | 1424 | struct vxlan_dev *vxlan = netdev_priv(dev); |
1404 | struct vxlan_sock *vs = vxlan->vn_sock; | 1425 | struct vxlan_sock *vs = vxlan->vn_sock; |
1405 | 1426 | ||
1406 | if (vs && IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip))) { | 1427 | if (vs && IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip)) && |
1428 | ! vxlan_group_used(vn, vxlan->default_dst.remote_ip)) { | ||
1407 | vxlan_sock_hold(vs); | 1429 | vxlan_sock_hold(vs); |
1408 | dev_hold(dev); | 1430 | dev_hold(dev); |
1409 | queue_work(vxlan_wq, &vxlan->igmp_work); | 1431 | queue_work(vxlan_wq, &vxlan->igmp_leave); |
1410 | } | 1432 | } |
1411 | 1433 | ||
1412 | del_timer_sync(&vxlan->age_timer); | 1434 | del_timer_sync(&vxlan->age_timer); |
@@ -1471,7 +1493,8 @@ static void vxlan_setup(struct net_device *dev) | |||
1471 | 1493 | ||
1472 | INIT_LIST_HEAD(&vxlan->next); | 1494 | INIT_LIST_HEAD(&vxlan->next); |
1473 | spin_lock_init(&vxlan->hash_lock); | 1495 | spin_lock_init(&vxlan->hash_lock); |
1474 | INIT_WORK(&vxlan->igmp_work, vxlan_igmp_work); | 1496 | INIT_WORK(&vxlan->igmp_join, vxlan_igmp_join); |
1497 | INIT_WORK(&vxlan->igmp_leave, vxlan_igmp_leave); | ||
1475 | INIT_WORK(&vxlan->sock_work, vxlan_sock_work); | 1498 | INIT_WORK(&vxlan->sock_work, vxlan_sock_work); |
1476 | 1499 | ||
1477 | init_timer_deferrable(&vxlan->age_timer); | 1500 | init_timer_deferrable(&vxlan->age_timer); |
@@ -1878,10 +1901,12 @@ static __net_exit void vxlan_exit_net(struct net *net) | |||
1878 | { | 1901 | { |
1879 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); | 1902 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); |
1880 | struct vxlan_dev *vxlan; | 1903 | struct vxlan_dev *vxlan; |
1904 | LIST_HEAD(list); | ||
1881 | 1905 | ||
1882 | rtnl_lock(); | 1906 | rtnl_lock(); |
1883 | list_for_each_entry(vxlan, &vn->vxlan_list, next) | 1907 | list_for_each_entry(vxlan, &vn->vxlan_list, next) |
1884 | dev_close(vxlan->dev); | 1908 | unregister_netdevice_queue(vxlan->dev, &list); |
1909 | unregister_netdevice_many(&list); | ||
1885 | rtnl_unlock(); | 1910 | rtnl_unlock(); |
1886 | } | 1911 | } |
1887 | 1912 | ||
diff --git a/drivers/net/wireless/ath/ath10k/Kconfig b/drivers/net/wireless/ath/ath10k/Kconfig index cde58fe96254..82e8088ca9b4 100644 --- a/drivers/net/wireless/ath/ath10k/Kconfig +++ b/drivers/net/wireless/ath/ath10k/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config ATH10K | 1 | config ATH10K |
2 | tristate "Atheros 802.11ac wireless cards support" | 2 | tristate "Atheros 802.11ac wireless cards support" |
3 | depends on MAC80211 | 3 | depends on MAC80211 && HAS_DMA |
4 | select ATH_COMMON | 4 | select ATH_COMMON |
5 | ---help--- | 5 | ---help--- |
6 | This module adds support for wireless adapters based on | 6 | This module adds support for wireless adapters based on |
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c index 81b686c6a376..40825d43322e 100644 --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c | |||
@@ -325,7 +325,7 @@ ath5k_prepare_multicast(struct ieee80211_hw *hw, | |||
325 | struct netdev_hw_addr *ha; | 325 | struct netdev_hw_addr *ha; |
326 | 326 | ||
327 | mfilt[0] = 0; | 327 | mfilt[0] = 0; |
328 | mfilt[1] = 1; | 328 | mfilt[1] = 0; |
329 | 329 | ||
330 | netdev_hw_addr_list_for_each(ha, mc_list) { | 330 | netdev_hw_addr_list_for_each(ha, mc_list) { |
331 | /* calculate XOR of eight 6-bit values */ | 331 | /* calculate XOR of eight 6-bit values */ |
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index d1acfe98918a..1576d58291d4 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
@@ -610,7 +610,15 @@ static void ar5008_hw_override_ini(struct ath_hw *ah, | |||
610 | REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); | 610 | REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); |
611 | 611 | ||
612 | if (AR_SREV_9280_20_OR_LATER(ah)) { | 612 | if (AR_SREV_9280_20_OR_LATER(ah)) { |
613 | val = REG_READ(ah, AR_PCU_MISC_MODE2); | 613 | /* |
614 | * For AR9280 and above, there is a new feature that allows | ||
615 | * Multicast search based on both MAC Address and Key ID. | ||
616 | * By default, this feature is enabled. But since the driver | ||
617 | * is not using this feature, we switch it off; otherwise | ||
618 | * multicast search based on MAC addr only will fail. | ||
619 | */ | ||
620 | val = REG_READ(ah, AR_PCU_MISC_MODE2) & | ||
621 | (~AR_ADHOC_MCAST_KEYID_ENABLE); | ||
614 | 622 | ||
615 | if (!AR_SREV_9271(ah)) | 623 | if (!AR_SREV_9271(ah)) |
616 | val &= ~AR_PCU_MISC_MODE2_HWWAR1; | 624 | val &= ~AR_PCU_MISC_MODE2_HWWAR1; |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 9e582e14da74..5205a3625e84 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -1082,7 +1082,7 @@ static void ath9k_hif_usb_firmware_fail(struct hif_device_usb *hif_dev) | |||
1082 | struct device *dev = &hif_dev->udev->dev; | 1082 | struct device *dev = &hif_dev->udev->dev; |
1083 | struct device *parent = dev->parent; | 1083 | struct device *parent = dev->parent; |
1084 | 1084 | ||
1085 | complete(&hif_dev->fw_done); | 1085 | complete_all(&hif_dev->fw_done); |
1086 | 1086 | ||
1087 | if (parent) | 1087 | if (parent) |
1088 | device_lock(parent); | 1088 | device_lock(parent); |
@@ -1131,7 +1131,7 @@ static void ath9k_hif_usb_firmware_cb(const struct firmware *fw, void *context) | |||
1131 | 1131 | ||
1132 | release_firmware(fw); | 1132 | release_firmware(fw); |
1133 | hif_dev->flags |= HIF_USB_READY; | 1133 | hif_dev->flags |= HIF_USB_READY; |
1134 | complete(&hif_dev->fw_done); | 1134 | complete_all(&hif_dev->fw_done); |
1135 | 1135 | ||
1136 | return; | 1136 | return; |
1137 | 1137 | ||
@@ -1295,7 +1295,9 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface) | |||
1295 | 1295 | ||
1296 | usb_set_intfdata(interface, NULL); | 1296 | usb_set_intfdata(interface, NULL); |
1297 | 1297 | ||
1298 | if (!unplugged && (hif_dev->flags & HIF_USB_START)) | 1298 | /* If firmware was loaded we should drop it |
1299 | * go back to first stage bootloader. */ | ||
1300 | if (!unplugged && (hif_dev->flags & HIF_USB_READY)) | ||
1299 | ath9k_hif_usb_reboot(udev); | 1301 | ath9k_hif_usb_reboot(udev); |
1300 | 1302 | ||
1301 | kfree(hif_dev); | 1303 | kfree(hif_dev); |
@@ -1316,7 +1318,10 @@ static int ath9k_hif_usb_suspend(struct usb_interface *interface, | |||
1316 | if (!(hif_dev->flags & HIF_USB_START)) | 1318 | if (!(hif_dev->flags & HIF_USB_START)) |
1317 | ath9k_htc_suspend(hif_dev->htc_handle); | 1319 | ath9k_htc_suspend(hif_dev->htc_handle); |
1318 | 1320 | ||
1319 | ath9k_hif_usb_dealloc_urbs(hif_dev); | 1321 | wait_for_completion(&hif_dev->fw_done); |
1322 | |||
1323 | if (hif_dev->flags & HIF_USB_READY) | ||
1324 | ath9k_hif_usb_dealloc_urbs(hif_dev); | ||
1320 | 1325 | ||
1321 | return 0; | 1326 | return 0; |
1322 | } | 1327 | } |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 71a183ffc77f..c3676bf1d6c4 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | |||
@@ -861,6 +861,7 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv, | |||
861 | if (error != 0) | 861 | if (error != 0) |
862 | goto err_rx; | 862 | goto err_rx; |
863 | 863 | ||
864 | ath9k_hw_disable(priv->ah); | ||
864 | #ifdef CONFIG_MAC80211_LEDS | 865 | #ifdef CONFIG_MAC80211_LEDS |
865 | /* must be initialized before ieee80211_register_hw */ | 866 | /* must be initialized before ieee80211_register_hw */ |
866 | priv->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(priv->hw, | 867 | priv->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(priv->hw, |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index c59ae43b9b35..927992732620 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -146,6 +146,28 @@ static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta, | |||
146 | ARRAY_SIZE(bf->rates)); | 146 | ARRAY_SIZE(bf->rates)); |
147 | } | 147 | } |
148 | 148 | ||
149 | static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq, | ||
150 | struct sk_buff *skb) | ||
151 | { | ||
152 | int q; | ||
153 | |||
154 | q = skb_get_queue_mapping(skb); | ||
155 | if (txq == sc->tx.uapsdq) | ||
156 | txq = sc->tx.txq_map[q]; | ||
157 | |||
158 | if (txq != sc->tx.txq_map[q]) | ||
159 | return; | ||
160 | |||
161 | if (WARN_ON(--txq->pending_frames < 0)) | ||
162 | txq->pending_frames = 0; | ||
163 | |||
164 | if (txq->stopped && | ||
165 | txq->pending_frames < sc->tx.txq_max_pending[q]) { | ||
166 | ieee80211_wake_queue(sc->hw, q); | ||
167 | txq->stopped = false; | ||
168 | } | ||
169 | } | ||
170 | |||
149 | static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) | 171 | static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) |
150 | { | 172 | { |
151 | struct ath_txq *txq = tid->ac->txq; | 173 | struct ath_txq *txq = tid->ac->txq; |
@@ -167,6 +189,7 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) | |||
167 | if (!bf) { | 189 | if (!bf) { |
168 | bf = ath_tx_setup_buffer(sc, txq, tid, skb); | 190 | bf = ath_tx_setup_buffer(sc, txq, tid, skb); |
169 | if (!bf) { | 191 | if (!bf) { |
192 | ath_txq_skb_done(sc, txq, skb); | ||
170 | ieee80211_free_txskb(sc->hw, skb); | 193 | ieee80211_free_txskb(sc->hw, skb); |
171 | continue; | 194 | continue; |
172 | } | 195 | } |
@@ -811,6 +834,7 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq, | |||
811 | 834 | ||
812 | if (!bf) { | 835 | if (!bf) { |
813 | __skb_unlink(skb, &tid->buf_q); | 836 | __skb_unlink(skb, &tid->buf_q); |
837 | ath_txq_skb_done(sc, txq, skb); | ||
814 | ieee80211_free_txskb(sc->hw, skb); | 838 | ieee80211_free_txskb(sc->hw, skb); |
815 | continue; | 839 | continue; |
816 | } | 840 | } |
@@ -1824,6 +1848,7 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_txq *txq, | |||
1824 | 1848 | ||
1825 | bf = ath_tx_setup_buffer(sc, txq, tid, skb); | 1849 | bf = ath_tx_setup_buffer(sc, txq, tid, skb); |
1826 | if (!bf) { | 1850 | if (!bf) { |
1851 | ath_txq_skb_done(sc, txq, skb); | ||
1827 | ieee80211_free_txskb(sc->hw, skb); | 1852 | ieee80211_free_txskb(sc->hw, skb); |
1828 | return; | 1853 | return; |
1829 | } | 1854 | } |
@@ -2090,6 +2115,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
2090 | 2115 | ||
2091 | bf = ath_tx_setup_buffer(sc, txq, tid, skb); | 2116 | bf = ath_tx_setup_buffer(sc, txq, tid, skb); |
2092 | if (!bf) { | 2117 | if (!bf) { |
2118 | ath_txq_skb_done(sc, txq, skb); | ||
2093 | if (txctl->paprd) | 2119 | if (txctl->paprd) |
2094 | dev_kfree_skb_any(skb); | 2120 | dev_kfree_skb_any(skb); |
2095 | else | 2121 | else |
@@ -2189,7 +2215,7 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | |||
2189 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 2215 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
2190 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 2216 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
2191 | struct ieee80211_hdr * hdr = (struct ieee80211_hdr *)skb->data; | 2217 | struct ieee80211_hdr * hdr = (struct ieee80211_hdr *)skb->data; |
2192 | int q, padpos, padsize; | 2218 | int padpos, padsize; |
2193 | unsigned long flags; | 2219 | unsigned long flags; |
2194 | 2220 | ||
2195 | ath_dbg(common, XMIT, "TX complete: skb: %p\n", skb); | 2221 | ath_dbg(common, XMIT, "TX complete: skb: %p\n", skb); |
@@ -2225,21 +2251,7 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | |||
2225 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | 2251 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); |
2226 | 2252 | ||
2227 | __skb_queue_tail(&txq->complete_q, skb); | 2253 | __skb_queue_tail(&txq->complete_q, skb); |
2228 | 2254 | ath_txq_skb_done(sc, txq, skb); | |
2229 | q = skb_get_queue_mapping(skb); | ||
2230 | if (txq == sc->tx.uapsdq) | ||
2231 | txq = sc->tx.txq_map[q]; | ||
2232 | |||
2233 | if (txq == sc->tx.txq_map[q]) { | ||
2234 | if (WARN_ON(--txq->pending_frames < 0)) | ||
2235 | txq->pending_frames = 0; | ||
2236 | |||
2237 | if (txq->stopped && | ||
2238 | txq->pending_frames < sc->tx.txq_max_pending[q]) { | ||
2239 | ieee80211_wake_queue(sc->hw, q); | ||
2240 | txq->stopped = false; | ||
2241 | } | ||
2242 | } | ||
2243 | } | 2255 | } |
2244 | 2256 | ||
2245 | static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, | 2257 | static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, |
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index e8308ec30970..ab636767fbde 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c | |||
@@ -145,7 +145,7 @@ static void wil_print_ring(struct seq_file *s, const char *prefix, | |||
145 | le16_to_cpu(hdr.type), hdr.flags); | 145 | le16_to_cpu(hdr.type), hdr.flags); |
146 | if (len <= MAX_MBOXITEM_SIZE) { | 146 | if (len <= MAX_MBOXITEM_SIZE) { |
147 | int n = 0; | 147 | int n = 0; |
148 | unsigned char printbuf[16 * 3 + 2]; | 148 | char printbuf[16 * 3 + 2]; |
149 | unsigned char databuf[MAX_MBOXITEM_SIZE]; | 149 | unsigned char databuf[MAX_MBOXITEM_SIZE]; |
150 | void __iomem *src = wmi_buffer(wil, d.addr) + | 150 | void __iomem *src = wmi_buffer(wil, d.addr) + |
151 | sizeof(struct wil6210_mbox_hdr); | 151 | sizeof(struct wil6210_mbox_hdr); |
@@ -416,7 +416,7 @@ static int wil_txdesc_debugfs_show(struct seq_file *s, void *data) | |||
416 | seq_printf(s, " SKB = %p\n", skb); | 416 | seq_printf(s, " SKB = %p\n", skb); |
417 | 417 | ||
418 | if (skb) { | 418 | if (skb) { |
419 | unsigned char printbuf[16 * 3 + 2]; | 419 | char printbuf[16 * 3 + 2]; |
420 | int i = 0; | 420 | int i = 0; |
421 | int len = le16_to_cpu(d->dma.length); | 421 | int len = le16_to_cpu(d->dma.length); |
422 | void *p = skb->data; | 422 | void *p = skb->data; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index 8e8975562ec3..80099016d21f 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | |||
@@ -242,7 +242,7 @@ void brcmf_txflowblock_if(struct brcmf_if *ifp, | |||
242 | { | 242 | { |
243 | unsigned long flags; | 243 | unsigned long flags; |
244 | 244 | ||
245 | if (!ifp) | 245 | if (!ifp || !ifp->ndev) |
246 | return; | 246 | return; |
247 | 247 | ||
248 | brcmf_dbg(TRACE, "enter: idx=%d stop=0x%X reason=%d state=%d\n", | 248 | brcmf_dbg(TRACE, "enter: idx=%d stop=0x%X reason=%d state=%d\n", |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c index f0d9f7f6c83d..29b1f24c2d0f 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c | |||
@@ -1744,13 +1744,14 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) | |||
1744 | ulong flags; | 1744 | ulong flags; |
1745 | int fifo = BRCMF_FWS_FIFO_BCMC; | 1745 | int fifo = BRCMF_FWS_FIFO_BCMC; |
1746 | bool multicast = is_multicast_ether_addr(eh->h_dest); | 1746 | bool multicast = is_multicast_ether_addr(eh->h_dest); |
1747 | bool pae = eh->h_proto == htons(ETH_P_PAE); | ||
1747 | 1748 | ||
1748 | /* determine the priority */ | 1749 | /* determine the priority */ |
1749 | if (!skb->priority) | 1750 | if (!skb->priority) |
1750 | skb->priority = cfg80211_classify8021d(skb); | 1751 | skb->priority = cfg80211_classify8021d(skb); |
1751 | 1752 | ||
1752 | drvr->tx_multicast += !!multicast; | 1753 | drvr->tx_multicast += !!multicast; |
1753 | if (ntohs(eh->h_proto) == ETH_P_PAE) | 1754 | if (pae) |
1754 | atomic_inc(&ifp->pend_8021x_cnt); | 1755 | atomic_inc(&ifp->pend_8021x_cnt); |
1755 | 1756 | ||
1756 | if (!brcmf_fws_fc_active(fws)) { | 1757 | if (!brcmf_fws_fc_active(fws)) { |
@@ -1781,6 +1782,11 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) | |||
1781 | brcmf_fws_schedule_deq(fws); | 1782 | brcmf_fws_schedule_deq(fws); |
1782 | } else { | 1783 | } else { |
1783 | brcmf_err("drop skb: no hanger slot\n"); | 1784 | brcmf_err("drop skb: no hanger slot\n"); |
1785 | if (pae) { | ||
1786 | atomic_dec(&ifp->pend_8021x_cnt); | ||
1787 | if (waitqueue_active(&ifp->pend_8021x_wait)) | ||
1788 | wake_up(&ifp->pend_8021x_wait); | ||
1789 | } | ||
1784 | brcmu_pkt_buf_free_skb(skb); | 1790 | brcmu_pkt_buf_free_skb(skb); |
1785 | } | 1791 | } |
1786 | brcmf_fws_unlock(drvr, flags); | 1792 | brcmf_fws_unlock(drvr, flags); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 277b37ae7126..7fa71f73cfe8 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -1093,8 +1093,11 @@ static void brcmf_link_down(struct brcmf_cfg80211_vif *vif) | |||
1093 | brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n "); | 1093 | brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n "); |
1094 | err = brcmf_fil_cmd_data_set(vif->ifp, | 1094 | err = brcmf_fil_cmd_data_set(vif->ifp, |
1095 | BRCMF_C_DISASSOC, NULL, 0); | 1095 | BRCMF_C_DISASSOC, NULL, 0); |
1096 | if (err) | 1096 | if (err) { |
1097 | brcmf_err("WLC_DISASSOC failed (%d)\n", err); | 1097 | brcmf_err("WLC_DISASSOC failed (%d)\n", err); |
1098 | cfg80211_disconnected(vif->wdev.netdev, 0, | ||
1099 | NULL, 0, GFP_KERNEL); | ||
1100 | } | ||
1098 | clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state); | 1101 | clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state); |
1099 | } | 1102 | } |
1100 | clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state); | 1103 | clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state); |
diff --git a/drivers/net/wireless/cw1200/txrx.c b/drivers/net/wireless/cw1200/txrx.c index 5862c373d714..e824d4d4a18d 100644 --- a/drivers/net/wireless/cw1200/txrx.c +++ b/drivers/net/wireless/cw1200/txrx.c | |||
@@ -1165,7 +1165,7 @@ void cw1200_rx_cb(struct cw1200_common *priv, | |||
1165 | if (cw1200_handle_action_rx(priv, skb)) | 1165 | if (cw1200_handle_action_rx(priv, skb)) |
1166 | return; | 1166 | return; |
1167 | } else if (ieee80211_is_beacon(frame->frame_control) && | 1167 | } else if (ieee80211_is_beacon(frame->frame_control) && |
1168 | !arg->status && | 1168 | !arg->status && priv->vif && |
1169 | !memcmp(ieee80211_get_SA(frame), priv->vif->bss_conf.bssid, | 1169 | !memcmp(ieee80211_get_SA(frame), priv->vif->bss_conf.bssid, |
1170 | ETH_ALEN)) { | 1170 | ETH_ALEN)) { |
1171 | const u8 *tim_ie; | 1171 | const u8 *tim_ie; |
diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c index 3952ddf2ddb2..1531a4fc0960 100644 --- a/drivers/net/wireless/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/iwlwifi/dvm/main.c | |||
@@ -758,7 +758,7 @@ int iwl_alive_start(struct iwl_priv *priv) | |||
758 | BT_COEX_PRIO_TBL_EVT_INIT_CALIB2); | 758 | BT_COEX_PRIO_TBL_EVT_INIT_CALIB2); |
759 | if (ret) | 759 | if (ret) |
760 | return ret; | 760 | return ret; |
761 | } else { | 761 | } else if (priv->lib->bt_params) { |
762 | /* | 762 | /* |
763 | * default is 2-wire BT coexexistence support | 763 | * default is 2-wire BT coexexistence support |
764 | */ | 764 | */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index ff8cc75c189d..a70c7b9d9bad 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h | |||
@@ -97,6 +97,8 @@ | |||
97 | 97 | ||
98 | #define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800) | 98 | #define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800) |
99 | 99 | ||
100 | #define APMG_RTC_INT_STT_RFKILL (0x10000000) | ||
101 | |||
100 | /* Device system time */ | 102 | /* Device system time */ |
101 | #define DEVICE_SYSTEM_TIME_REG 0xA0206C | 103 | #define DEVICE_SYSTEM_TIME_REG 0xA0206C |
102 | 104 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c index 7e5e5c2f9f87..83da884cf303 100644 --- a/drivers/net/wireless/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/iwlwifi/mvm/d3.c | |||
@@ -134,7 +134,7 @@ struct wowlan_key_data { | |||
134 | struct iwl_wowlan_rsc_tsc_params_cmd *rsc_tsc; | 134 | struct iwl_wowlan_rsc_tsc_params_cmd *rsc_tsc; |
135 | struct iwl_wowlan_tkip_params_cmd *tkip; | 135 | struct iwl_wowlan_tkip_params_cmd *tkip; |
136 | bool error, use_rsc_tsc, use_tkip; | 136 | bool error, use_rsc_tsc, use_tkip; |
137 | int gtk_key_idx; | 137 | int wep_key_idx; |
138 | }; | 138 | }; |
139 | 139 | ||
140 | static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw, | 140 | static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw, |
@@ -188,8 +188,8 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw, | |||
188 | wkc.wep_key.key_offset = 0; | 188 | wkc.wep_key.key_offset = 0; |
189 | } else { | 189 | } else { |
190 | /* others start at 1 */ | 190 | /* others start at 1 */ |
191 | data->gtk_key_idx++; | 191 | data->wep_key_idx++; |
192 | wkc.wep_key.key_offset = data->gtk_key_idx; | 192 | wkc.wep_key.key_offset = data->wep_key_idx; |
193 | } | 193 | } |
194 | 194 | ||
195 | ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, CMD_SYNC, | 195 | ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, CMD_SYNC, |
@@ -316,8 +316,13 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw, | |||
316 | mvm->ptk_ivlen = key->iv_len; | 316 | mvm->ptk_ivlen = key->iv_len; |
317 | mvm->ptk_icvlen = key->icv_len; | 317 | mvm->ptk_icvlen = key->icv_len; |
318 | } else { | 318 | } else { |
319 | data->gtk_key_idx++; | 319 | /* |
320 | key->hw_key_idx = data->gtk_key_idx; | 320 | * firmware only supports TSC/RSC for a single key, |
321 | * so if there are multiple keep overwriting them | ||
322 | * with new ones -- this relies on mac80211 doing | ||
323 | * list_add_tail(). | ||
324 | */ | ||
325 | key->hw_key_idx = 1; | ||
321 | mvm->gtk_ivlen = key->iv_len; | 326 | mvm->gtk_ivlen = key->iv_len; |
322 | mvm->gtk_icvlen = key->icv_len; | 327 | mvm->gtk_icvlen = key->icv_len; |
323 | } | 328 | } |
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c index e56ed2a84888..c24a744910ac 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c | |||
@@ -988,7 +988,11 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
988 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 988 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
989 | char buf[100]; | 989 | char buf[100]; |
990 | 990 | ||
991 | if (!dbgfs_dir) | 991 | /* |
992 | * Check if debugfs directory already exist before creating it. | ||
993 | * This may happen when, for example, resetting hw or suspend-resume | ||
994 | */ | ||
995 | if (!dbgfs_dir || mvmvif->dbgfs_dir) | ||
992 | return; | 996 | return; |
993 | 997 | ||
994 | mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir); | 998 | mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h index b60d14151721..365095a0c3b3 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h | |||
@@ -69,7 +69,6 @@ | |||
69 | /* Scan Commands, Responses, Notifications */ | 69 | /* Scan Commands, Responses, Notifications */ |
70 | 70 | ||
71 | /* Masks for iwl_scan_channel.type flags */ | 71 | /* Masks for iwl_scan_channel.type flags */ |
72 | #define SCAN_CHANNEL_TYPE_PASSIVE 0 | ||
73 | #define SCAN_CHANNEL_TYPE_ACTIVE BIT(0) | 72 | #define SCAN_CHANNEL_TYPE_ACTIVE BIT(0) |
74 | #define SCAN_CHANNEL_NARROW_BAND BIT(22) | 73 | #define SCAN_CHANNEL_NARROW_BAND BIT(22) |
75 | 74 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index e08683b20531..f19baf0dea6b 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -257,7 +257,11 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
257 | if (ret) | 257 | if (ret) |
258 | return ret; | 258 | return ret; |
259 | 259 | ||
260 | return ieee80211_register_hw(mvm->hw); | 260 | ret = ieee80211_register_hw(mvm->hw); |
261 | if (ret) | ||
262 | iwl_mvm_leds_exit(mvm); | ||
263 | |||
264 | return ret; | ||
261 | } | 265 | } |
262 | 266 | ||
263 | static void iwl_mvm_mac_tx(struct ieee80211_hw *hw, | 267 | static void iwl_mvm_mac_tx(struct ieee80211_hw *hw, |
@@ -385,6 +389,7 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) | |||
385 | ieee80211_wake_queues(mvm->hw); | 389 | ieee80211_wake_queues(mvm->hw); |
386 | 390 | ||
387 | mvm->vif_count = 0; | 391 | mvm->vif_count = 0; |
392 | mvm->rx_ba_sessions = 0; | ||
388 | } | 393 | } |
389 | 394 | ||
390 | static int iwl_mvm_mac_start(struct ieee80211_hw *hw) | 395 | static int iwl_mvm_mac_start(struct ieee80211_hw *hw) |
@@ -507,6 +512,27 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, | |||
507 | goto out_unlock; | 512 | goto out_unlock; |
508 | 513 | ||
509 | /* | 514 | /* |
515 | * TODO: remove this temporary code. | ||
516 | * Currently MVM FW supports power management only on single MAC. | ||
517 | * If new interface added, disable PM on existing interface. | ||
518 | * P2P device is a special case, since it is handled by FW similary to | ||
519 | * scan. If P2P deviced is added, PM remains enabled on existing | ||
520 | * interface. | ||
521 | * Note: the method below does not count the new interface being added | ||
522 | * at this moment. | ||
523 | */ | ||
524 | if (vif->type != NL80211_IFTYPE_P2P_DEVICE) | ||
525 | mvm->vif_count++; | ||
526 | if (mvm->vif_count > 1) { | ||
527 | IWL_DEBUG_MAC80211(mvm, | ||
528 | "Disable power on existing interfaces\n"); | ||
529 | ieee80211_iterate_active_interfaces_atomic( | ||
530 | mvm->hw, | ||
531 | IEEE80211_IFACE_ITER_NORMAL, | ||
532 | iwl_mvm_pm_disable_iterator, mvm); | ||
533 | } | ||
534 | |||
535 | /* | ||
510 | * The AP binding flow can be done only after the beacon | 536 | * The AP binding flow can be done only after the beacon |
511 | * template is configured (which happens only in the mac80211 | 537 | * template is configured (which happens only in the mac80211 |
512 | * start_ap() flow), and adding the broadcast station can happen | 538 | * start_ap() flow), and adding the broadcast station can happen |
@@ -529,27 +555,6 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, | |||
529 | goto out_unlock; | 555 | goto out_unlock; |
530 | } | 556 | } |
531 | 557 | ||
532 | /* | ||
533 | * TODO: remove this temporary code. | ||
534 | * Currently MVM FW supports power management only on single MAC. | ||
535 | * If new interface added, disable PM on existing interface. | ||
536 | * P2P device is a special case, since it is handled by FW similary to | ||
537 | * scan. If P2P deviced is added, PM remains enabled on existing | ||
538 | * interface. | ||
539 | * Note: the method below does not count the new interface being added | ||
540 | * at this moment. | ||
541 | */ | ||
542 | if (vif->type != NL80211_IFTYPE_P2P_DEVICE) | ||
543 | mvm->vif_count++; | ||
544 | if (mvm->vif_count > 1) { | ||
545 | IWL_DEBUG_MAC80211(mvm, | ||
546 | "Disable power on existing interfaces\n"); | ||
547 | ieee80211_iterate_active_interfaces_atomic( | ||
548 | mvm->hw, | ||
549 | IEEE80211_IFACE_ITER_NORMAL, | ||
550 | iwl_mvm_pm_disable_iterator, mvm); | ||
551 | } | ||
552 | |||
553 | ret = iwl_mvm_mac_ctxt_add(mvm, vif); | 558 | ret = iwl_mvm_mac_ctxt_add(mvm, vif); |
554 | if (ret) | 559 | if (ret) |
555 | goto out_release; | 560 | goto out_release; |
@@ -1006,6 +1011,21 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, | |||
1006 | mutex_lock(&mvm->mutex); | 1011 | mutex_lock(&mvm->mutex); |
1007 | if (old_state == IEEE80211_STA_NOTEXIST && | 1012 | if (old_state == IEEE80211_STA_NOTEXIST && |
1008 | new_state == IEEE80211_STA_NONE) { | 1013 | new_state == IEEE80211_STA_NONE) { |
1014 | /* | ||
1015 | * Firmware bug - it'll crash if the beacon interval is less | ||
1016 | * than 16. We can't avoid connecting at all, so refuse the | ||
1017 | * station state change, this will cause mac80211 to abandon | ||
1018 | * attempts to connect to this AP, and eventually wpa_s will | ||
1019 | * blacklist the AP... | ||
1020 | */ | ||
1021 | if (vif->type == NL80211_IFTYPE_STATION && | ||
1022 | vif->bss_conf.beacon_int < 16) { | ||
1023 | IWL_ERR(mvm, | ||
1024 | "AP %pM beacon interval is %d, refusing due to firmware bug!\n", | ||
1025 | sta->addr, vif->bss_conf.beacon_int); | ||
1026 | ret = -EINVAL; | ||
1027 | goto out_unlock; | ||
1028 | } | ||
1009 | ret = iwl_mvm_add_sta(mvm, vif, sta); | 1029 | ret = iwl_mvm_add_sta(mvm, vif, sta); |
1010 | } else if (old_state == IEEE80211_STA_NONE && | 1030 | } else if (old_state == IEEE80211_STA_NONE && |
1011 | new_state == IEEE80211_STA_AUTH) { | 1031 | new_state == IEEE80211_STA_AUTH) { |
@@ -1038,6 +1058,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, | |||
1038 | } else { | 1058 | } else { |
1039 | ret = -EIO; | 1059 | ret = -EIO; |
1040 | } | 1060 | } |
1061 | out_unlock: | ||
1041 | mutex_unlock(&mvm->mutex); | 1062 | mutex_unlock(&mvm->mutex); |
1042 | 1063 | ||
1043 | return ret; | 1064 | return ret; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index d40d7db185d6..420e82d379d9 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -419,6 +419,7 @@ struct iwl_mvm { | |||
419 | struct work_struct sta_drained_wk; | 419 | struct work_struct sta_drained_wk; |
420 | unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)]; | 420 | unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)]; |
421 | atomic_t pending_frames[IWL_MVM_STATION_COUNT]; | 421 | atomic_t pending_frames[IWL_MVM_STATION_COUNT]; |
422 | u8 rx_ba_sessions; | ||
422 | 423 | ||
423 | /* configured by mac80211 */ | 424 | /* configured by mac80211 */ |
424 | u32 rts_threshold; | 425 | u32 rts_threshold; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 2157b0f8ced5..acdff6b67e04 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
@@ -137,8 +137,8 @@ static void iwl_mvm_scan_fill_ssids(struct iwl_scan_cmd *cmd, | |||
137 | { | 137 | { |
138 | int fw_idx, req_idx; | 138 | int fw_idx, req_idx; |
139 | 139 | ||
140 | fw_idx = 0; | 140 | for (req_idx = req->n_ssids - 1, fw_idx = 0; req_idx > 0; |
141 | for (req_idx = req->n_ssids - 1; req_idx > 0; req_idx--) { | 141 | req_idx--, fw_idx++) { |
142 | cmd->direct_scan[fw_idx].id = WLAN_EID_SSID; | 142 | cmd->direct_scan[fw_idx].id = WLAN_EID_SSID; |
143 | cmd->direct_scan[fw_idx].len = req->ssids[req_idx].ssid_len; | 143 | cmd->direct_scan[fw_idx].len = req->ssids[req_idx].ssid_len; |
144 | memcpy(cmd->direct_scan[fw_idx].ssid, | 144 | memcpy(cmd->direct_scan[fw_idx].ssid, |
@@ -153,7 +153,9 @@ static void iwl_mvm_scan_fill_ssids(struct iwl_scan_cmd *cmd, | |||
153 | * just to notify that this scan is active and not passive. | 153 | * just to notify that this scan is active and not passive. |
154 | * In order to notify the FW of the number of SSIDs we wish to scan (including | 154 | * In order to notify the FW of the number of SSIDs we wish to scan (including |
155 | * the zero-length one), we need to set the corresponding bits in chan->type, | 155 | * the zero-length one), we need to set the corresponding bits in chan->type, |
156 | * one for each SSID, and set the active bit (first). | 156 | * one for each SSID, and set the active bit (first). The first SSID is already |
157 | * included in the probe template, so we need to set only req->n_ssids - 1 bits | ||
158 | * in addition to the first bit. | ||
157 | */ | 159 | */ |
158 | static u16 iwl_mvm_get_active_dwell(enum ieee80211_band band, int n_ssids) | 160 | static u16 iwl_mvm_get_active_dwell(enum ieee80211_band band, int n_ssids) |
159 | { | 161 | { |
@@ -176,19 +178,12 @@ static void iwl_mvm_scan_fill_channels(struct iwl_scan_cmd *cmd, | |||
176 | struct iwl_scan_channel *chan = (struct iwl_scan_channel *) | 178 | struct iwl_scan_channel *chan = (struct iwl_scan_channel *) |
177 | (cmd->data + le16_to_cpu(cmd->tx_cmd.len)); | 179 | (cmd->data + le16_to_cpu(cmd->tx_cmd.len)); |
178 | int i; | 180 | int i; |
179 | __le32 chan_type_value; | ||
180 | |||
181 | if (req->n_ssids > 0) | ||
182 | chan_type_value = cpu_to_le32(BIT(req->n_ssids + 1) - 1); | ||
183 | else | ||
184 | chan_type_value = SCAN_CHANNEL_TYPE_PASSIVE; | ||
185 | 181 | ||
186 | for (i = 0; i < cmd->channel_count; i++) { | 182 | for (i = 0; i < cmd->channel_count; i++) { |
187 | chan->channel = cpu_to_le16(req->channels[i]->hw_value); | 183 | chan->channel = cpu_to_le16(req->channels[i]->hw_value); |
184 | chan->type = cpu_to_le32(BIT(req->n_ssids) - 1); | ||
188 | if (req->channels[i]->flags & IEEE80211_CHAN_PASSIVE_SCAN) | 185 | if (req->channels[i]->flags & IEEE80211_CHAN_PASSIVE_SCAN) |
189 | chan->type = SCAN_CHANNEL_TYPE_PASSIVE; | 186 | chan->type &= cpu_to_le32(~SCAN_CHANNEL_TYPE_ACTIVE); |
190 | else | ||
191 | chan->type = chan_type_value; | ||
192 | chan->active_dwell = cpu_to_le16(active_dwell); | 187 | chan->active_dwell = cpu_to_le16(active_dwell); |
193 | chan->passive_dwell = cpu_to_le16(passive_dwell); | 188 | chan->passive_dwell = cpu_to_le16(passive_dwell); |
194 | chan->iteration_count = cpu_to_le16(1); | 189 | chan->iteration_count = cpu_to_le16(1); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c index 62fe5209093b..563f559b902d 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/iwlwifi/mvm/sta.c | |||
@@ -608,6 +608,8 @@ int iwl_mvm_rm_bcast_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *bsta) | |||
608 | return ret; | 608 | return ret; |
609 | } | 609 | } |
610 | 610 | ||
611 | #define IWL_MAX_RX_BA_SESSIONS 16 | ||
612 | |||
611 | int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | 613 | int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
612 | int tid, u16 ssn, bool start) | 614 | int tid, u16 ssn, bool start) |
613 | { | 615 | { |
@@ -618,11 +620,20 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
618 | 620 | ||
619 | lockdep_assert_held(&mvm->mutex); | 621 | lockdep_assert_held(&mvm->mutex); |
620 | 622 | ||
623 | if (start && mvm->rx_ba_sessions >= IWL_MAX_RX_BA_SESSIONS) { | ||
624 | IWL_WARN(mvm, "Not enough RX BA SESSIONS\n"); | ||
625 | return -ENOSPC; | ||
626 | } | ||
627 | |||
621 | cmd.mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color); | 628 | cmd.mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color); |
622 | cmd.sta_id = mvm_sta->sta_id; | 629 | cmd.sta_id = mvm_sta->sta_id; |
623 | cmd.add_modify = STA_MODE_MODIFY; | 630 | cmd.add_modify = STA_MODE_MODIFY; |
624 | cmd.add_immediate_ba_tid = (u8) tid; | 631 | if (start) { |
625 | cmd.add_immediate_ba_ssn = cpu_to_le16(ssn); | 632 | cmd.add_immediate_ba_tid = (u8) tid; |
633 | cmd.add_immediate_ba_ssn = cpu_to_le16(ssn); | ||
634 | } else { | ||
635 | cmd.remove_immediate_ba_tid = (u8) tid; | ||
636 | } | ||
626 | cmd.modify_mask = start ? STA_MODIFY_ADD_BA_TID : | 637 | cmd.modify_mask = start ? STA_MODIFY_ADD_BA_TID : |
627 | STA_MODIFY_REMOVE_BA_TID; | 638 | STA_MODIFY_REMOVE_BA_TID; |
628 | 639 | ||
@@ -648,6 +659,14 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
648 | break; | 659 | break; |
649 | } | 660 | } |
650 | 661 | ||
662 | if (!ret) { | ||
663 | if (start) | ||
664 | mvm->rx_ba_sessions++; | ||
665 | else if (mvm->rx_ba_sessions > 0) | ||
666 | /* check that restart flow didn't zero the counter */ | ||
667 | mvm->rx_ba_sessions--; | ||
668 | } | ||
669 | |||
651 | return ret; | 670 | return ret; |
652 | } | 671 | } |
653 | 672 | ||
@@ -896,6 +915,7 @@ int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
896 | struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; | 915 | struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; |
897 | struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; | 916 | struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; |
898 | u16 txq_id; | 917 | u16 txq_id; |
918 | enum iwl_mvm_agg_state old_state; | ||
899 | 919 | ||
900 | /* | 920 | /* |
901 | * First set the agg state to OFF to avoid calling | 921 | * First set the agg state to OFF to avoid calling |
@@ -905,13 +925,17 @@ int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
905 | txq_id = tid_data->txq_id; | 925 | txq_id = tid_data->txq_id; |
906 | IWL_DEBUG_TX_QUEUES(mvm, "Flush AGG: sta %d tid %d q %d state %d\n", | 926 | IWL_DEBUG_TX_QUEUES(mvm, "Flush AGG: sta %d tid %d q %d state %d\n", |
907 | mvmsta->sta_id, tid, txq_id, tid_data->state); | 927 | mvmsta->sta_id, tid, txq_id, tid_data->state); |
928 | old_state = tid_data->state; | ||
908 | tid_data->state = IWL_AGG_OFF; | 929 | tid_data->state = IWL_AGG_OFF; |
909 | spin_unlock_bh(&mvmsta->lock); | 930 | spin_unlock_bh(&mvmsta->lock); |
910 | 931 | ||
911 | if (iwl_mvm_flush_tx_path(mvm, BIT(txq_id), true)) | 932 | if (old_state >= IWL_AGG_ON) { |
912 | IWL_ERR(mvm, "Couldn't flush the AGG queue\n"); | 933 | if (iwl_mvm_flush_tx_path(mvm, BIT(txq_id), true)) |
934 | IWL_ERR(mvm, "Couldn't flush the AGG queue\n"); | ||
935 | |||
936 | iwl_trans_txq_disable(mvm->trans, tid_data->txq_id); | ||
937 | } | ||
913 | 938 | ||
914 | iwl_trans_txq_disable(mvm->trans, tid_data->txq_id); | ||
915 | mvm->queue_to_mac80211[tid_data->txq_id] = | 939 | mvm->queue_to_mac80211[tid_data->txq_id] = |
916 | IWL_INVALID_MAC80211_QUEUE; | 940 | IWL_INVALID_MAC80211_QUEUE; |
917 | 941 | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index 81f3ea5b09a4..ff13458efc27 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
@@ -130,6 +130,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | |||
130 | {IWL_PCI_DEVICE(0x423C, 0x1306, iwl5150_abg_cfg)}, /* Half Mini Card */ | 130 | {IWL_PCI_DEVICE(0x423C, 0x1306, iwl5150_abg_cfg)}, /* Half Mini Card */ |
131 | {IWL_PCI_DEVICE(0x423C, 0x1221, iwl5150_agn_cfg)}, /* Mini Card */ | 131 | {IWL_PCI_DEVICE(0x423C, 0x1221, iwl5150_agn_cfg)}, /* Mini Card */ |
132 | {IWL_PCI_DEVICE(0x423C, 0x1321, iwl5150_agn_cfg)}, /* Half Mini Card */ | 132 | {IWL_PCI_DEVICE(0x423C, 0x1321, iwl5150_agn_cfg)}, /* Half Mini Card */ |
133 | {IWL_PCI_DEVICE(0x423C, 0x1326, iwl5150_abg_cfg)}, /* Half Mini Card */ | ||
133 | 134 | ||
134 | {IWL_PCI_DEVICE(0x423D, 0x1211, iwl5150_agn_cfg)}, /* Mini Card */ | 135 | {IWL_PCI_DEVICE(0x423D, 0x1211, iwl5150_agn_cfg)}, /* Mini Card */ |
135 | {IWL_PCI_DEVICE(0x423D, 0x1311, iwl5150_agn_cfg)}, /* Half Mini Card */ | 136 | {IWL_PCI_DEVICE(0x423D, 0x1311, iwl5150_agn_cfg)}, /* Half Mini Card */ |
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c index fd848cd1583e..f600e68a410a 100644 --- a/drivers/net/wireless/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/iwlwifi/pcie/rx.c | |||
@@ -888,6 +888,14 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) | |||
888 | 888 | ||
889 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 889 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); |
890 | if (hw_rfkill) { | 890 | if (hw_rfkill) { |
891 | /* | ||
892 | * Clear the interrupt in APMG if the NIC is going down. | ||
893 | * Note that when the NIC exits RFkill (else branch), we | ||
894 | * can't access prph and the NIC will be reset in | ||
895 | * start_hw anyway. | ||
896 | */ | ||
897 | iwl_write_prph(trans, APMG_RTC_INT_STT_REG, | ||
898 | APMG_RTC_INT_STT_RFKILL); | ||
891 | set_bit(STATUS_RFKILL, &trans_pcie->status); | 899 | set_bit(STATUS_RFKILL, &trans_pcie->status); |
892 | if (test_and_clear_bit(STATUS_HCMD_ACTIVE, | 900 | if (test_and_clear_bit(STATUS_HCMD_ACTIVE, |
893 | &trans_pcie->status)) | 901 | &trans_pcie->status)) |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 826c15602c46..96cfcdd39079 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -670,6 +670,11 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) | |||
670 | return err; | 670 | return err; |
671 | } | 671 | } |
672 | 672 | ||
673 | /* Reset the entire device */ | ||
674 | iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); | ||
675 | |||
676 | usleep_range(10, 15); | ||
677 | |||
673 | iwl_pcie_apm_init(trans); | 678 | iwl_pcie_apm_init(trans); |
674 | 679 | ||
675 | /* From now on, the op_mode will be kept updated about RF kill state */ | 680 | /* From now on, the op_mode will be kept updated about RF kill state */ |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index ef5fa890a286..89459db4c53b 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -1716,9 +1716,9 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, | |||
1716 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 1716 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
1717 | int ret; | 1717 | int ret; |
1718 | 1718 | ||
1719 | if (priv->bss_mode != NL80211_IFTYPE_STATION) { | 1719 | if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) { |
1720 | wiphy_err(wiphy, | 1720 | wiphy_err(wiphy, |
1721 | "%s: reject infra assoc request in non-STA mode\n", | 1721 | "%s: reject infra assoc request in non-STA role\n", |
1722 | dev->name); | 1722 | dev->name); |
1723 | return -EINVAL; | 1723 | return -EINVAL; |
1724 | } | 1724 | } |
diff --git a/drivers/net/wireless/mwifiex/cfp.c b/drivers/net/wireless/mwifiex/cfp.c index 988552dece75..5178c4630d89 100644 --- a/drivers/net/wireless/mwifiex/cfp.c +++ b/drivers/net/wireless/mwifiex/cfp.c | |||
@@ -415,7 +415,8 @@ u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates) | |||
415 | u32 k = 0; | 415 | u32 k = 0; |
416 | struct mwifiex_adapter *adapter = priv->adapter; | 416 | struct mwifiex_adapter *adapter = priv->adapter; |
417 | 417 | ||
418 | if (priv->bss_mode == NL80211_IFTYPE_STATION) { | 418 | if (priv->bss_mode == NL80211_IFTYPE_STATION || |
419 | priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) { | ||
419 | switch (adapter->config_bands) { | 420 | switch (adapter->config_bands) { |
420 | case BAND_B: | 421 | case BAND_B: |
421 | dev_dbg(adapter->dev, "info: infra band=%d " | 422 | dev_dbg(adapter->dev, "info: infra band=%d " |
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index caaf4bd56b30..2cf8b964e966 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c | |||
@@ -693,7 +693,7 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, | |||
693 | if (!ret) { | 693 | if (!ret) { |
694 | dev_notice(adapter->dev, | 694 | dev_notice(adapter->dev, |
695 | "WLAN FW already running! Skip FW dnld\n"); | 695 | "WLAN FW already running! Skip FW dnld\n"); |
696 | goto done; | 696 | return 0; |
697 | } | 697 | } |
698 | 698 | ||
699 | poll_num = MAX_FIRMWARE_POLL_TRIES; | 699 | poll_num = MAX_FIRMWARE_POLL_TRIES; |
@@ -719,14 +719,8 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, | |||
719 | poll_fw: | 719 | poll_fw: |
720 | /* Check if the firmware is downloaded successfully or not */ | 720 | /* Check if the firmware is downloaded successfully or not */ |
721 | ret = adapter->if_ops.check_fw_status(adapter, poll_num); | 721 | ret = adapter->if_ops.check_fw_status(adapter, poll_num); |
722 | if (ret) { | 722 | if (ret) |
723 | dev_err(adapter->dev, "FW failed to be active in time\n"); | 723 | dev_err(adapter->dev, "FW failed to be active in time\n"); |
724 | return -1; | ||
725 | } | ||
726 | done: | ||
727 | /* re-enable host interrupt for mwifiex after fw dnld is successful */ | ||
728 | if (adapter->if_ops.enable_int) | ||
729 | adapter->if_ops.enable_int(adapter); | ||
730 | 724 | ||
731 | return ret; | 725 | return ret; |
732 | } | 726 | } |
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c index 1c8a771e8e81..12e778159ec5 100644 --- a/drivers/net/wireless/mwifiex/join.c +++ b/drivers/net/wireless/mwifiex/join.c | |||
@@ -1291,8 +1291,10 @@ int mwifiex_associate(struct mwifiex_private *priv, | |||
1291 | { | 1291 | { |
1292 | u8 current_bssid[ETH_ALEN]; | 1292 | u8 current_bssid[ETH_ALEN]; |
1293 | 1293 | ||
1294 | /* Return error if the adapter or table entry is not marked as infra */ | 1294 | /* Return error if the adapter is not STA role or table entry |
1295 | if ((priv->bss_mode != NL80211_IFTYPE_STATION) || | 1295 | * is not marked as infra. |
1296 | */ | ||
1297 | if ((GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) || | ||
1296 | (bss_desc->bss_mode != NL80211_IFTYPE_STATION)) | 1298 | (bss_desc->bss_mode != NL80211_IFTYPE_STATION)) |
1297 | return -1; | 1299 | return -1; |
1298 | 1300 | ||
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index e15ab72fb03d..1753431de361 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -427,6 +427,10 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context) | |||
427 | "Cal data request_firmware() failed\n"); | 427 | "Cal data request_firmware() failed\n"); |
428 | } | 428 | } |
429 | 429 | ||
430 | /* enable host interrupt after fw dnld is successful */ | ||
431 | if (adapter->if_ops.enable_int) | ||
432 | adapter->if_ops.enable_int(adapter); | ||
433 | |||
430 | adapter->init_wait_q_woken = false; | 434 | adapter->init_wait_q_woken = false; |
431 | ret = mwifiex_init_fw(adapter); | 435 | ret = mwifiex_init_fw(adapter); |
432 | if (ret == -1) { | 436 | if (ret == -1) { |
@@ -478,6 +482,8 @@ err_add_intf: | |||
478 | mwifiex_del_virtual_intf(adapter->wiphy, priv->wdev); | 482 | mwifiex_del_virtual_intf(adapter->wiphy, priv->wdev); |
479 | rtnl_unlock(); | 483 | rtnl_unlock(); |
480 | err_init_fw: | 484 | err_init_fw: |
485 | if (adapter->if_ops.disable_int) | ||
486 | adapter->if_ops.disable_int(adapter); | ||
481 | pr_debug("info: %s: unregister device\n", __func__); | 487 | pr_debug("info: %s: unregister device\n", __func__); |
482 | adapter->if_ops.unregister_dev(adapter); | 488 | adapter->if_ops.unregister_dev(adapter); |
483 | done: | 489 | done: |
@@ -855,7 +861,7 @@ mwifiex_add_card(void *card, struct semaphore *sem, | |||
855 | INIT_WORK(&adapter->main_work, mwifiex_main_work_queue); | 861 | INIT_WORK(&adapter->main_work, mwifiex_main_work_queue); |
856 | 862 | ||
857 | /* Register the device. Fill up the private data structure with relevant | 863 | /* Register the device. Fill up the private data structure with relevant |
858 | information from the card and request for the required IRQ. */ | 864 | information from the card. */ |
859 | if (adapter->if_ops.register_dev(adapter)) { | 865 | if (adapter->if_ops.register_dev(adapter)) { |
860 | pr_err("%s: failed to register mwifiex device\n", __func__); | 866 | pr_err("%s: failed to register mwifiex device\n", __func__); |
861 | goto err_registerdev; | 867 | goto err_registerdev; |
@@ -919,6 +925,11 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) | |||
919 | if (!adapter) | 925 | if (!adapter) |
920 | goto exit_remove; | 926 | goto exit_remove; |
921 | 927 | ||
928 | /* We can no longer handle interrupts once we start doing the teardown | ||
929 | * below. */ | ||
930 | if (adapter->if_ops.disable_int) | ||
931 | adapter->if_ops.disable_int(adapter); | ||
932 | |||
922 | adapter->surprise_removed = true; | 933 | adapter->surprise_removed = true; |
923 | 934 | ||
924 | /* Stop data */ | 935 | /* Stop data */ |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 3da73d36acdf..253e0bd38e25 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -601,6 +601,7 @@ struct mwifiex_if_ops { | |||
601 | int (*register_dev) (struct mwifiex_adapter *); | 601 | int (*register_dev) (struct mwifiex_adapter *); |
602 | void (*unregister_dev) (struct mwifiex_adapter *); | 602 | void (*unregister_dev) (struct mwifiex_adapter *); |
603 | int (*enable_int) (struct mwifiex_adapter *); | 603 | int (*enable_int) (struct mwifiex_adapter *); |
604 | void (*disable_int) (struct mwifiex_adapter *); | ||
604 | int (*process_int_status) (struct mwifiex_adapter *); | 605 | int (*process_int_status) (struct mwifiex_adapter *); |
605 | int (*host_to_card) (struct mwifiex_adapter *, u8, struct sk_buff *, | 606 | int (*host_to_card) (struct mwifiex_adapter *, u8, struct sk_buff *, |
606 | struct mwifiex_tx_param *); | 607 | struct mwifiex_tx_param *); |
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c index 5ee5ed02eccd..09185c963248 100644 --- a/drivers/net/wireless/mwifiex/sdio.c +++ b/drivers/net/wireless/mwifiex/sdio.c | |||
@@ -51,6 +51,7 @@ static struct mwifiex_if_ops sdio_ops; | |||
51 | static struct semaphore add_remove_card_sem; | 51 | static struct semaphore add_remove_card_sem; |
52 | 52 | ||
53 | static int mwifiex_sdio_resume(struct device *dev); | 53 | static int mwifiex_sdio_resume(struct device *dev); |
54 | static void mwifiex_sdio_interrupt(struct sdio_func *func); | ||
54 | 55 | ||
55 | /* | 56 | /* |
56 | * SDIO probe. | 57 | * SDIO probe. |
@@ -296,6 +297,15 @@ static struct sdio_driver mwifiex_sdio = { | |||
296 | } | 297 | } |
297 | }; | 298 | }; |
298 | 299 | ||
300 | /* Write data into SDIO card register. Caller claims SDIO device. */ | ||
301 | static int | ||
302 | mwifiex_write_reg_locked(struct sdio_func *func, u32 reg, u8 data) | ||
303 | { | ||
304 | int ret = -1; | ||
305 | sdio_writeb(func, data, reg, &ret); | ||
306 | return ret; | ||
307 | } | ||
308 | |||
299 | /* | 309 | /* |
300 | * This function writes data into SDIO card register. | 310 | * This function writes data into SDIO card register. |
301 | */ | 311 | */ |
@@ -303,10 +313,10 @@ static int | |||
303 | mwifiex_write_reg(struct mwifiex_adapter *adapter, u32 reg, u8 data) | 313 | mwifiex_write_reg(struct mwifiex_adapter *adapter, u32 reg, u8 data) |
304 | { | 314 | { |
305 | struct sdio_mmc_card *card = adapter->card; | 315 | struct sdio_mmc_card *card = adapter->card; |
306 | int ret = -1; | 316 | int ret; |
307 | 317 | ||
308 | sdio_claim_host(card->func); | 318 | sdio_claim_host(card->func); |
309 | sdio_writeb(card->func, data, reg, &ret); | 319 | ret = mwifiex_write_reg_locked(card->func, reg, data); |
310 | sdio_release_host(card->func); | 320 | sdio_release_host(card->func); |
311 | 321 | ||
312 | return ret; | 322 | return ret; |
@@ -685,23 +695,15 @@ mwifiex_sdio_read_fw_status(struct mwifiex_adapter *adapter, u16 *dat) | |||
685 | * The host interrupt mask is read, the disable bit is reset and | 695 | * The host interrupt mask is read, the disable bit is reset and |
686 | * written back to the card host interrupt mask register. | 696 | * written back to the card host interrupt mask register. |
687 | */ | 697 | */ |
688 | static int mwifiex_sdio_disable_host_int(struct mwifiex_adapter *adapter) | 698 | static void mwifiex_sdio_disable_host_int(struct mwifiex_adapter *adapter) |
689 | { | 699 | { |
690 | u8 host_int_mask, host_int_disable = HOST_INT_DISABLE; | 700 | struct sdio_mmc_card *card = adapter->card; |
691 | 701 | struct sdio_func *func = card->func; | |
692 | /* Read back the host_int_mask register */ | ||
693 | if (mwifiex_read_reg(adapter, HOST_INT_MASK_REG, &host_int_mask)) | ||
694 | return -1; | ||
695 | |||
696 | /* Update with the mask and write back to the register */ | ||
697 | host_int_mask &= ~host_int_disable; | ||
698 | |||
699 | if (mwifiex_write_reg(adapter, HOST_INT_MASK_REG, host_int_mask)) { | ||
700 | dev_err(adapter->dev, "disable host interrupt failed\n"); | ||
701 | return -1; | ||
702 | } | ||
703 | 702 | ||
704 | return 0; | 703 | sdio_claim_host(func); |
704 | mwifiex_write_reg_locked(func, HOST_INT_MASK_REG, 0); | ||
705 | sdio_release_irq(func); | ||
706 | sdio_release_host(func); | ||
705 | } | 707 | } |
706 | 708 | ||
707 | /* | 709 | /* |
@@ -713,14 +715,29 @@ static int mwifiex_sdio_disable_host_int(struct mwifiex_adapter *adapter) | |||
713 | static int mwifiex_sdio_enable_host_int(struct mwifiex_adapter *adapter) | 715 | static int mwifiex_sdio_enable_host_int(struct mwifiex_adapter *adapter) |
714 | { | 716 | { |
715 | struct sdio_mmc_card *card = adapter->card; | 717 | struct sdio_mmc_card *card = adapter->card; |
718 | struct sdio_func *func = card->func; | ||
719 | int ret; | ||
720 | |||
721 | sdio_claim_host(func); | ||
722 | |||
723 | /* Request the SDIO IRQ */ | ||
724 | ret = sdio_claim_irq(func, mwifiex_sdio_interrupt); | ||
725 | if (ret) { | ||
726 | dev_err(adapter->dev, "claim irq failed: ret=%d\n", ret); | ||
727 | goto out; | ||
728 | } | ||
716 | 729 | ||
717 | /* Simply write the mask to the register */ | 730 | /* Simply write the mask to the register */ |
718 | if (mwifiex_write_reg(adapter, HOST_INT_MASK_REG, | 731 | ret = mwifiex_write_reg_locked(func, HOST_INT_MASK_REG, |
719 | card->reg->host_int_enable)) { | 732 | card->reg->host_int_enable); |
733 | if (ret) { | ||
720 | dev_err(adapter->dev, "enable host interrupt failed\n"); | 734 | dev_err(adapter->dev, "enable host interrupt failed\n"); |
721 | return -1; | 735 | sdio_release_irq(func); |
722 | } | 736 | } |
723 | return 0; | 737 | |
738 | out: | ||
739 | sdio_release_host(func); | ||
740 | return ret; | ||
724 | } | 741 | } |
725 | 742 | ||
726 | /* | 743 | /* |
@@ -997,9 +1014,6 @@ mwifiex_sdio_interrupt(struct sdio_func *func) | |||
997 | } | 1014 | } |
998 | adapter = card->adapter; | 1015 | adapter = card->adapter; |
999 | 1016 | ||
1000 | if (adapter->surprise_removed) | ||
1001 | return; | ||
1002 | |||
1003 | if (!adapter->pps_uapsd_mode && adapter->ps_state == PS_STATE_SLEEP) | 1017 | if (!adapter->pps_uapsd_mode && adapter->ps_state == PS_STATE_SLEEP) |
1004 | adapter->ps_state = PS_STATE_AWAKE; | 1018 | adapter->ps_state = PS_STATE_AWAKE; |
1005 | 1019 | ||
@@ -1625,8 +1639,8 @@ static int mwifiex_sdio_host_to_card(struct mwifiex_adapter *adapter, | |||
1625 | /* Allocate buffer and copy payload */ | 1639 | /* Allocate buffer and copy payload */ |
1626 | blk_size = MWIFIEX_SDIO_BLOCK_SIZE; | 1640 | blk_size = MWIFIEX_SDIO_BLOCK_SIZE; |
1627 | buf_block_len = (pkt_len + blk_size - 1) / blk_size; | 1641 | buf_block_len = (pkt_len + blk_size - 1) / blk_size; |
1628 | *(u16 *) &payload[0] = (u16) pkt_len; | 1642 | *(__le16 *)&payload[0] = cpu_to_le16((u16)pkt_len); |
1629 | *(u16 *) &payload[2] = type; | 1643 | *(__le16 *)&payload[2] = cpu_to_le16(type); |
1630 | 1644 | ||
1631 | /* | 1645 | /* |
1632 | * This is SDIO specific header | 1646 | * This is SDIO specific header |
@@ -1728,9 +1742,7 @@ mwifiex_unregister_dev(struct mwifiex_adapter *adapter) | |||
1728 | struct sdio_mmc_card *card = adapter->card; | 1742 | struct sdio_mmc_card *card = adapter->card; |
1729 | 1743 | ||
1730 | if (adapter->card) { | 1744 | if (adapter->card) { |
1731 | /* Release the SDIO IRQ */ | ||
1732 | sdio_claim_host(card->func); | 1745 | sdio_claim_host(card->func); |
1733 | sdio_release_irq(card->func); | ||
1734 | sdio_disable_func(card->func); | 1746 | sdio_disable_func(card->func); |
1735 | sdio_release_host(card->func); | 1747 | sdio_release_host(card->func); |
1736 | sdio_set_drvdata(card->func, NULL); | 1748 | sdio_set_drvdata(card->func, NULL); |
@@ -1744,7 +1756,7 @@ mwifiex_unregister_dev(struct mwifiex_adapter *adapter) | |||
1744 | */ | 1756 | */ |
1745 | static int mwifiex_register_dev(struct mwifiex_adapter *adapter) | 1757 | static int mwifiex_register_dev(struct mwifiex_adapter *adapter) |
1746 | { | 1758 | { |
1747 | int ret = 0; | 1759 | int ret; |
1748 | struct sdio_mmc_card *card = adapter->card; | 1760 | struct sdio_mmc_card *card = adapter->card; |
1749 | struct sdio_func *func = card->func; | 1761 | struct sdio_func *func = card->func; |
1750 | 1762 | ||
@@ -1753,22 +1765,14 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) | |||
1753 | 1765 | ||
1754 | sdio_claim_host(func); | 1766 | sdio_claim_host(func); |
1755 | 1767 | ||
1756 | /* Request the SDIO IRQ */ | ||
1757 | ret = sdio_claim_irq(func, mwifiex_sdio_interrupt); | ||
1758 | if (ret) { | ||
1759 | pr_err("claim irq failed: ret=%d\n", ret); | ||
1760 | goto disable_func; | ||
1761 | } | ||
1762 | |||
1763 | /* Set block size */ | 1768 | /* Set block size */ |
1764 | ret = sdio_set_block_size(card->func, MWIFIEX_SDIO_BLOCK_SIZE); | 1769 | ret = sdio_set_block_size(card->func, MWIFIEX_SDIO_BLOCK_SIZE); |
1770 | sdio_release_host(func); | ||
1765 | if (ret) { | 1771 | if (ret) { |
1766 | pr_err("cannot set SDIO block size\n"); | 1772 | pr_err("cannot set SDIO block size\n"); |
1767 | ret = -1; | 1773 | return ret; |
1768 | goto release_irq; | ||
1769 | } | 1774 | } |
1770 | 1775 | ||
1771 | sdio_release_host(func); | ||
1772 | sdio_set_drvdata(func, card); | 1776 | sdio_set_drvdata(func, card); |
1773 | 1777 | ||
1774 | adapter->dev = &func->dev; | 1778 | adapter->dev = &func->dev; |
@@ -1776,15 +1780,6 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) | |||
1776 | strcpy(adapter->fw_name, card->firmware); | 1780 | strcpy(adapter->fw_name, card->firmware); |
1777 | 1781 | ||
1778 | return 0; | 1782 | return 0; |
1779 | |||
1780 | release_irq: | ||
1781 | sdio_release_irq(func); | ||
1782 | disable_func: | ||
1783 | sdio_disable_func(func); | ||
1784 | sdio_release_host(func); | ||
1785 | adapter->card = NULL; | ||
1786 | |||
1787 | return -1; | ||
1788 | } | 1783 | } |
1789 | 1784 | ||
1790 | /* | 1785 | /* |
@@ -1813,9 +1808,6 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter) | |||
1813 | */ | 1808 | */ |
1814 | mwifiex_read_reg(adapter, HOST_INTSTATUS_REG, &sdio_ireg); | 1809 | mwifiex_read_reg(adapter, HOST_INTSTATUS_REG, &sdio_ireg); |
1815 | 1810 | ||
1816 | /* Disable host interrupt mask register for SDIO */ | ||
1817 | mwifiex_sdio_disable_host_int(adapter); | ||
1818 | |||
1819 | /* Get SDIO ioport */ | 1811 | /* Get SDIO ioport */ |
1820 | mwifiex_init_sdio_ioport(adapter); | 1812 | mwifiex_init_sdio_ioport(adapter); |
1821 | 1813 | ||
@@ -1957,6 +1949,7 @@ static struct mwifiex_if_ops sdio_ops = { | |||
1957 | .register_dev = mwifiex_register_dev, | 1949 | .register_dev = mwifiex_register_dev, |
1958 | .unregister_dev = mwifiex_unregister_dev, | 1950 | .unregister_dev = mwifiex_unregister_dev, |
1959 | .enable_int = mwifiex_sdio_enable_host_int, | 1951 | .enable_int = mwifiex_sdio_enable_host_int, |
1952 | .disable_int = mwifiex_sdio_disable_host_int, | ||
1960 | .process_int_status = mwifiex_process_int_status, | 1953 | .process_int_status = mwifiex_process_int_status, |
1961 | .host_to_card = mwifiex_sdio_host_to_card, | 1954 | .host_to_card = mwifiex_sdio_host_to_card, |
1962 | .wakeup = mwifiex_pm_wakeup_card, | 1955 | .wakeup = mwifiex_pm_wakeup_card, |
diff --git a/drivers/net/wireless/mwifiex/sdio.h b/drivers/net/wireless/mwifiex/sdio.h index 6d51dfdd8251..532ae0ac4dfb 100644 --- a/drivers/net/wireless/mwifiex/sdio.h +++ b/drivers/net/wireless/mwifiex/sdio.h | |||
@@ -92,9 +92,6 @@ | |||
92 | /* Host Control Registers : Download host interrupt mask */ | 92 | /* Host Control Registers : Download host interrupt mask */ |
93 | #define DN_LD_HOST_INT_MASK (0x2U) | 93 | #define DN_LD_HOST_INT_MASK (0x2U) |
94 | 94 | ||
95 | /* Disable Host interrupt mask */ | ||
96 | #define HOST_INT_DISABLE 0xff | ||
97 | |||
98 | /* Host Control Registers : Host interrupt status */ | 95 | /* Host Control Registers : Host interrupt status */ |
99 | #define HOST_INTSTATUS_REG 0x03 | 96 | #define HOST_INTSTATUS_REG 0x03 |
100 | /* Host Control Registers : Upload host interrupt status */ | 97 | /* Host Control Registers : Upload host interrupt status */ |
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 206c3e038072..8af97abf7108 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -257,10 +257,10 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, | |||
257 | goto done; | 257 | goto done; |
258 | } | 258 | } |
259 | 259 | ||
260 | if (priv->bss_mode == NL80211_IFTYPE_STATION) { | 260 | if (priv->bss_mode == NL80211_IFTYPE_STATION || |
261 | priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) { | ||
261 | u8 config_bands; | 262 | u8 config_bands; |
262 | 263 | ||
263 | /* Infra mode */ | ||
264 | ret = mwifiex_deauthenticate(priv, NULL); | 264 | ret = mwifiex_deauthenticate(priv, NULL); |
265 | if (ret) | 265 | if (ret) |
266 | goto done; | 266 | goto done; |
diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig index 9b915d3a44be..3e60a31582f8 100644 --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | menuconfig RT2X00 | 1 | menuconfig RT2X00 |
2 | tristate "Ralink driver support" | 2 | tristate "Ralink driver support" |
3 | depends on MAC80211 | 3 | depends on MAC80211 && HAS_DMA |
4 | ---help--- | 4 | ---help--- |
5 | This will enable the support for the Ralink drivers, | 5 | This will enable the support for the Ralink drivers, |
6 | developed in the rt2x00 project <http://rt2x00.serialmonkey.com>. | 6 | developed in the rt2x00 project <http://rt2x00.serialmonkey.com>. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 6c0a91ff963c..aa95c6cf3545 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -936,13 +936,8 @@ void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index) | |||
936 | spin_unlock_irqrestore(&queue->index_lock, irqflags); | 936 | spin_unlock_irqrestore(&queue->index_lock, irqflags); |
937 | } | 937 | } |
938 | 938 | ||
939 | void rt2x00queue_pause_queue(struct data_queue *queue) | 939 | void rt2x00queue_pause_queue_nocheck(struct data_queue *queue) |
940 | { | 940 | { |
941 | if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) || | ||
942 | !test_bit(QUEUE_STARTED, &queue->flags) || | ||
943 | test_and_set_bit(QUEUE_PAUSED, &queue->flags)) | ||
944 | return; | ||
945 | |||
946 | switch (queue->qid) { | 941 | switch (queue->qid) { |
947 | case QID_AC_VO: | 942 | case QID_AC_VO: |
948 | case QID_AC_VI: | 943 | case QID_AC_VI: |
@@ -958,6 +953,15 @@ void rt2x00queue_pause_queue(struct data_queue *queue) | |||
958 | break; | 953 | break; |
959 | } | 954 | } |
960 | } | 955 | } |
956 | void rt2x00queue_pause_queue(struct data_queue *queue) | ||
957 | { | ||
958 | if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) || | ||
959 | !test_bit(QUEUE_STARTED, &queue->flags) || | ||
960 | test_and_set_bit(QUEUE_PAUSED, &queue->flags)) | ||
961 | return; | ||
962 | |||
963 | rt2x00queue_pause_queue_nocheck(queue); | ||
964 | } | ||
961 | EXPORT_SYMBOL_GPL(rt2x00queue_pause_queue); | 965 | EXPORT_SYMBOL_GPL(rt2x00queue_pause_queue); |
962 | 966 | ||
963 | void rt2x00queue_unpause_queue(struct data_queue *queue) | 967 | void rt2x00queue_unpause_queue(struct data_queue *queue) |
@@ -1019,7 +1023,7 @@ void rt2x00queue_stop_queue(struct data_queue *queue) | |||
1019 | return; | 1023 | return; |
1020 | } | 1024 | } |
1021 | 1025 | ||
1022 | rt2x00queue_pause_queue(queue); | 1026 | rt2x00queue_pause_queue_nocheck(queue); |
1023 | 1027 | ||
1024 | queue->rt2x00dev->ops->lib->stop_queue(queue); | 1028 | queue->rt2x00dev->ops->lib->stop_queue(queue); |
1025 | 1029 | ||
diff --git a/drivers/net/wireless/rtlwifi/Kconfig b/drivers/net/wireless/rtlwifi/Kconfig index 7253de3d8c66..c2ffce7a907c 100644 --- a/drivers/net/wireless/rtlwifi/Kconfig +++ b/drivers/net/wireless/rtlwifi/Kconfig | |||
@@ -1,27 +1,20 @@ | |||
1 | config RTLWIFI | 1 | menuconfig RTL_CARDS |
2 | tristate "Realtek wireless card support" | 2 | tristate "Realtek rtlwifi family of devices" |
3 | depends on MAC80211 | 3 | depends on MAC80211 && (PCI || USB) |
4 | select FW_LOADER | ||
5 | ---help--- | ||
6 | This is common code for RTL8192CE/RTL8192CU/RTL8192SE/RTL8723AE | ||
7 | drivers. This module does nothing by itself - the various front-end | ||
8 | drivers need to be enabled to support any desired devices. | ||
9 | |||
10 | If you choose to build as a module, it'll be called rtlwifi. | ||
11 | |||
12 | config RTLWIFI_DEBUG | ||
13 | bool "Debugging output for rtlwifi driver family" | ||
14 | depends on RTLWIFI | ||
15 | default y | 4 | default y |
16 | ---help--- | 5 | ---help--- |
17 | To use the module option that sets the dynamic-debugging level for, | 6 | This option will enable support for the Realtek mac80211-based |
18 | the front-end driver, this parameter must be "Y". For memory-limited | 7 | wireless drivers. Drivers rtl8192ce, rtl8192cu, rtl8192se, rtl8192de, |
19 | systems, choose "N". If in doubt, choose "Y". | 8 | rtl8723eu, and rtl8188eu share some common code. |
9 | |||
10 | if RTL_CARDS | ||
20 | 11 | ||
21 | config RTL8192CE | 12 | config RTL8192CE |
22 | tristate "Realtek RTL8192CE/RTL8188CE Wireless Network Adapter" | 13 | tristate "Realtek RTL8192CE/RTL8188CE Wireless Network Adapter" |
23 | depends on RTLWIFI && PCI | 14 | depends on PCI |
24 | select RTL8192C_COMMON | 15 | select RTL8192C_COMMON |
16 | select RTLWIFI | ||
17 | select RTLWIFI_PCI | ||
25 | ---help--- | 18 | ---help--- |
26 | This is the driver for Realtek RTL8192CE/RTL8188CE 802.11n PCIe | 19 | This is the driver for Realtek RTL8192CE/RTL8188CE 802.11n PCIe |
27 | wireless network adapters. | 20 | wireless network adapters. |
@@ -30,7 +23,9 @@ config RTL8192CE | |||
30 | 23 | ||
31 | config RTL8192SE | 24 | config RTL8192SE |
32 | tristate "Realtek RTL8192SE/RTL8191SE PCIe Wireless Network Adapter" | 25 | tristate "Realtek RTL8192SE/RTL8191SE PCIe Wireless Network Adapter" |
33 | depends on RTLWIFI && PCI | 26 | depends on PCI |
27 | select RTLWIFI | ||
28 | select RTLWIFI_PCI | ||
34 | ---help--- | 29 | ---help--- |
35 | This is the driver for Realtek RTL8192SE/RTL8191SE 802.11n PCIe | 30 | This is the driver for Realtek RTL8192SE/RTL8191SE 802.11n PCIe |
36 | wireless network adapters. | 31 | wireless network adapters. |
@@ -39,7 +34,9 @@ config RTL8192SE | |||
39 | 34 | ||
40 | config RTL8192DE | 35 | config RTL8192DE |
41 | tristate "Realtek RTL8192DE/RTL8188DE PCIe Wireless Network Adapter" | 36 | tristate "Realtek RTL8192DE/RTL8188DE PCIe Wireless Network Adapter" |
42 | depends on RTLWIFI && PCI | 37 | depends on PCI |
38 | select RTLWIFI | ||
39 | select RTLWIFI_PCI | ||
43 | ---help--- | 40 | ---help--- |
44 | This is the driver for Realtek RTL8192DE/RTL8188DE 802.11n PCIe | 41 | This is the driver for Realtek RTL8192DE/RTL8188DE 802.11n PCIe |
45 | wireless network adapters. | 42 | wireless network adapters. |
@@ -48,7 +45,9 @@ config RTL8192DE | |||
48 | 45 | ||
49 | config RTL8723AE | 46 | config RTL8723AE |
50 | tristate "Realtek RTL8723AE PCIe Wireless Network Adapter" | 47 | tristate "Realtek RTL8723AE PCIe Wireless Network Adapter" |
51 | depends on RTLWIFI && PCI | 48 | depends on PCI |
49 | select RTLWIFI | ||
50 | select RTLWIFI_PCI | ||
52 | ---help--- | 51 | ---help--- |
53 | This is the driver for Realtek RTL8723AE 802.11n PCIe | 52 | This is the driver for Realtek RTL8723AE 802.11n PCIe |
54 | wireless network adapters. | 53 | wireless network adapters. |
@@ -57,7 +56,9 @@ config RTL8723AE | |||
57 | 56 | ||
58 | config RTL8188EE | 57 | config RTL8188EE |
59 | tristate "Realtek RTL8188EE Wireless Network Adapter" | 58 | tristate "Realtek RTL8188EE Wireless Network Adapter" |
60 | depends on RTLWIFI && PCI | 59 | depends on PCI |
60 | select RTLWIFI | ||
61 | select RTLWIFI_PCI | ||
61 | ---help--- | 62 | ---help--- |
62 | This is the driver for Realtek RTL8188EE 802.11n PCIe | 63 | This is the driver for Realtek RTL8188EE 802.11n PCIe |
63 | wireless network adapters. | 64 | wireless network adapters. |
@@ -66,7 +67,9 @@ config RTL8188EE | |||
66 | 67 | ||
67 | config RTL8192CU | 68 | config RTL8192CU |
68 | tristate "Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter" | 69 | tristate "Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter" |
69 | depends on RTLWIFI && USB | 70 | depends on USB |
71 | select RTLWIFI | ||
72 | select RTLWIFI_USB | ||
70 | select RTL8192C_COMMON | 73 | select RTL8192C_COMMON |
71 | ---help--- | 74 | ---help--- |
72 | This is the driver for Realtek RTL8192CU/RTL8188CU 802.11n USB | 75 | This is the driver for Realtek RTL8192CU/RTL8188CU 802.11n USB |
@@ -74,7 +77,28 @@ config RTL8192CU | |||
74 | 77 | ||
75 | If you choose to build it as a module, it will be called rtl8192cu | 78 | If you choose to build it as a module, it will be called rtl8192cu |
76 | 79 | ||
80 | config RTLWIFI | ||
81 | tristate | ||
82 | select FW_LOADER | ||
83 | |||
84 | config RTLWIFI_PCI | ||
85 | tristate | ||
86 | |||
87 | config RTLWIFI_USB | ||
88 | tristate | ||
89 | |||
90 | config RTLWIFI_DEBUG | ||
91 | bool "Debugging output for rtlwifi driver family" | ||
92 | depends on RTLWIFI | ||
93 | default y | ||
94 | ---help--- | ||
95 | To use the module option that sets the dynamic-debugging level for, | ||
96 | the front-end driver, this parameter must be "Y". For memory-limited | ||
97 | systems, choose "N". If in doubt, choose "Y". | ||
98 | |||
77 | config RTL8192C_COMMON | 99 | config RTL8192C_COMMON |
78 | tristate | 100 | tristate |
79 | depends on RTL8192CE || RTL8192CU | 101 | depends on RTL8192CE || RTL8192CU |
80 | default m | 102 | default y |
103 | |||
104 | endif | ||
diff --git a/drivers/net/wireless/rtlwifi/Makefile b/drivers/net/wireless/rtlwifi/Makefile index ff02b874f8d8..d56f023a4b90 100644 --- a/drivers/net/wireless/rtlwifi/Makefile +++ b/drivers/net/wireless/rtlwifi/Makefile | |||
@@ -12,13 +12,11 @@ rtlwifi-objs := \ | |||
12 | 12 | ||
13 | rtl8192c_common-objs += \ | 13 | rtl8192c_common-objs += \ |
14 | 14 | ||
15 | ifneq ($(CONFIG_PCI),) | 15 | obj-$(CONFIG_RTLWIFI_PCI) += rtl_pci.o |
16 | rtlwifi-objs += pci.o | 16 | rtl_pci-objs := pci.o |
17 | endif | ||
18 | 17 | ||
19 | ifneq ($(CONFIG_USB),) | 18 | obj-$(CONFIG_RTLWIFI_USB) += rtl_usb.o |
20 | rtlwifi-objs += usb.o | 19 | rtl_usb-objs := usb.o |
21 | endif | ||
22 | 20 | ||
23 | obj-$(CONFIG_RTL8192C_COMMON) += rtl8192c/ | 21 | obj-$(CONFIG_RTL8192C_COMMON) += rtl8192c/ |
24 | obj-$(CONFIG_RTL8192CE) += rtl8192ce/ | 22 | obj-$(CONFIG_RTL8192CE) += rtl8192ce/ |
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index 9d558ac77b0c..7651f5acc14b 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c | |||
@@ -172,6 +172,7 @@ u8 rtl_tid_to_ac(u8 tid) | |||
172 | { | 172 | { |
173 | return tid_to_ac[tid]; | 173 | return tid_to_ac[tid]; |
174 | } | 174 | } |
175 | EXPORT_SYMBOL_GPL(rtl_tid_to_ac); | ||
175 | 176 | ||
176 | static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw, | 177 | static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw, |
177 | struct ieee80211_sta_ht_cap *ht_cap) | 178 | struct ieee80211_sta_ht_cap *ht_cap) |
@@ -406,6 +407,7 @@ void rtl_deinit_deferred_work(struct ieee80211_hw *hw) | |||
406 | cancel_delayed_work(&rtlpriv->works.ps_rfon_wq); | 407 | cancel_delayed_work(&rtlpriv->works.ps_rfon_wq); |
407 | cancel_delayed_work(&rtlpriv->works.fwevt_wq); | 408 | cancel_delayed_work(&rtlpriv->works.fwevt_wq); |
408 | } | 409 | } |
410 | EXPORT_SYMBOL_GPL(rtl_deinit_deferred_work); | ||
409 | 411 | ||
410 | void rtl_init_rfkill(struct ieee80211_hw *hw) | 412 | void rtl_init_rfkill(struct ieee80211_hw *hw) |
411 | { | 413 | { |
@@ -439,6 +441,7 @@ void rtl_deinit_rfkill(struct ieee80211_hw *hw) | |||
439 | { | 441 | { |
440 | wiphy_rfkill_stop_polling(hw->wiphy); | 442 | wiphy_rfkill_stop_polling(hw->wiphy); |
441 | } | 443 | } |
444 | EXPORT_SYMBOL_GPL(rtl_deinit_rfkill); | ||
442 | 445 | ||
443 | int rtl_init_core(struct ieee80211_hw *hw) | 446 | int rtl_init_core(struct ieee80211_hw *hw) |
444 | { | 447 | { |
@@ -489,10 +492,12 @@ int rtl_init_core(struct ieee80211_hw *hw) | |||
489 | 492 | ||
490 | return 0; | 493 | return 0; |
491 | } | 494 | } |
495 | EXPORT_SYMBOL_GPL(rtl_init_core); | ||
492 | 496 | ||
493 | void rtl_deinit_core(struct ieee80211_hw *hw) | 497 | void rtl_deinit_core(struct ieee80211_hw *hw) |
494 | { | 498 | { |
495 | } | 499 | } |
500 | EXPORT_SYMBOL_GPL(rtl_deinit_core); | ||
496 | 501 | ||
497 | void rtl_init_rx_config(struct ieee80211_hw *hw) | 502 | void rtl_init_rx_config(struct ieee80211_hw *hw) |
498 | { | 503 | { |
@@ -501,6 +506,7 @@ void rtl_init_rx_config(struct ieee80211_hw *hw) | |||
501 | 506 | ||
502 | rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RCR, (u8 *) (&mac->rx_conf)); | 507 | rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RCR, (u8 *) (&mac->rx_conf)); |
503 | } | 508 | } |
509 | EXPORT_SYMBOL_GPL(rtl_init_rx_config); | ||
504 | 510 | ||
505 | /********************************************************* | 511 | /********************************************************* |
506 | * | 512 | * |
@@ -879,6 +885,7 @@ bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
879 | 885 | ||
880 | return true; | 886 | return true; |
881 | } | 887 | } |
888 | EXPORT_SYMBOL_GPL(rtl_tx_mgmt_proc); | ||
882 | 889 | ||
883 | void rtl_get_tcb_desc(struct ieee80211_hw *hw, | 890 | void rtl_get_tcb_desc(struct ieee80211_hw *hw, |
884 | struct ieee80211_tx_info *info, | 891 | struct ieee80211_tx_info *info, |
@@ -1052,6 +1059,7 @@ bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) | |||
1052 | 1059 | ||
1053 | return true; | 1060 | return true; |
1054 | } | 1061 | } |
1062 | EXPORT_SYMBOL_GPL(rtl_action_proc); | ||
1055 | 1063 | ||
1056 | /*should call before software enc*/ | 1064 | /*should call before software enc*/ |
1057 | u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) | 1065 | u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) |
@@ -1125,6 +1133,7 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) | |||
1125 | 1133 | ||
1126 | return false; | 1134 | return false; |
1127 | } | 1135 | } |
1136 | EXPORT_SYMBOL_GPL(rtl_is_special_data); | ||
1128 | 1137 | ||
1129 | /********************************************************* | 1138 | /********************************************************* |
1130 | * | 1139 | * |
@@ -1300,6 +1309,7 @@ void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1300 | 1309 | ||
1301 | rtlpriv->link_info.bcn_rx_inperiod++; | 1310 | rtlpriv->link_info.bcn_rx_inperiod++; |
1302 | } | 1311 | } |
1312 | EXPORT_SYMBOL_GPL(rtl_beacon_statistic); | ||
1303 | 1313 | ||
1304 | void rtl_watchdog_wq_callback(void *data) | 1314 | void rtl_watchdog_wq_callback(void *data) |
1305 | { | 1315 | { |
@@ -1793,6 +1803,7 @@ void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len) | |||
1793 | 1803 | ||
1794 | mac->vendor = vendor; | 1804 | mac->vendor = vendor; |
1795 | } | 1805 | } |
1806 | EXPORT_SYMBOL_GPL(rtl_recognize_peer); | ||
1796 | 1807 | ||
1797 | /********************************************************* | 1808 | /********************************************************* |
1798 | * | 1809 | * |
@@ -1849,6 +1860,7 @@ struct attribute_group rtl_attribute_group = { | |||
1849 | .name = "rtlsysfs", | 1860 | .name = "rtlsysfs", |
1850 | .attrs = rtl_sysfs_entries, | 1861 | .attrs = rtl_sysfs_entries, |
1851 | }; | 1862 | }; |
1863 | EXPORT_SYMBOL_GPL(rtl_attribute_group); | ||
1852 | 1864 | ||
1853 | MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>"); | 1865 | MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>"); |
1854 | MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>"); | 1866 | MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>"); |
@@ -1856,7 +1868,8 @@ MODULE_AUTHOR("Larry Finger <Larry.FInger@lwfinger.net>"); | |||
1856 | MODULE_LICENSE("GPL"); | 1868 | MODULE_LICENSE("GPL"); |
1857 | MODULE_DESCRIPTION("Realtek 802.11n PCI wireless core"); | 1869 | MODULE_DESCRIPTION("Realtek 802.11n PCI wireless core"); |
1858 | 1870 | ||
1859 | struct rtl_global_var global_var = {}; | 1871 | struct rtl_global_var rtl_global_var = {}; |
1872 | EXPORT_SYMBOL_GPL(rtl_global_var); | ||
1860 | 1873 | ||
1861 | static int __init rtl_core_module_init(void) | 1874 | static int __init rtl_core_module_init(void) |
1862 | { | 1875 | { |
@@ -1864,8 +1877,8 @@ static int __init rtl_core_module_init(void) | |||
1864 | pr_err("Unable to register rtl_rc, use default RC !!\n"); | 1877 | pr_err("Unable to register rtl_rc, use default RC !!\n"); |
1865 | 1878 | ||
1866 | /* init some global vars */ | 1879 | /* init some global vars */ |
1867 | INIT_LIST_HEAD(&global_var.glb_priv_list); | 1880 | INIT_LIST_HEAD(&rtl_global_var.glb_priv_list); |
1868 | spin_lock_init(&global_var.glb_list_lock); | 1881 | spin_lock_init(&rtl_global_var.glb_list_lock); |
1869 | 1882 | ||
1870 | return 0; | 1883 | return 0; |
1871 | } | 1884 | } |
diff --git a/drivers/net/wireless/rtlwifi/base.h b/drivers/net/wireless/rtlwifi/base.h index 8576bc34b032..0e5fe0902daf 100644 --- a/drivers/net/wireless/rtlwifi/base.h +++ b/drivers/net/wireless/rtlwifi/base.h | |||
@@ -147,7 +147,7 @@ void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len); | |||
147 | u8 rtl_tid_to_ac(u8 tid); | 147 | u8 rtl_tid_to_ac(u8 tid); |
148 | extern struct attribute_group rtl_attribute_group; | 148 | extern struct attribute_group rtl_attribute_group; |
149 | void rtl_easy_concurrent_retrytimer_callback(unsigned long data); | 149 | void rtl_easy_concurrent_retrytimer_callback(unsigned long data); |
150 | extern struct rtl_global_var global_var; | 150 | extern struct rtl_global_var rtl_global_var; |
151 | int rtlwifi_rate_mapping(struct ieee80211_hw *hw, | 151 | int rtlwifi_rate_mapping(struct ieee80211_hw *hw, |
152 | bool isht, u8 desc_rate, bool first_ampdu); | 152 | bool isht, u8 desc_rate, bool first_ampdu); |
153 | bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb); | 153 | bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb); |
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c index ee84844be008..733b7ce7f0e2 100644 --- a/drivers/net/wireless/rtlwifi/core.c +++ b/drivers/net/wireless/rtlwifi/core.c | |||
@@ -1330,3 +1330,4 @@ const struct ieee80211_ops rtl_ops = { | |||
1330 | .rfkill_poll = rtl_op_rfkill_poll, | 1330 | .rfkill_poll = rtl_op_rfkill_poll, |
1331 | .flush = rtl_op_flush, | 1331 | .flush = rtl_op_flush, |
1332 | }; | 1332 | }; |
1333 | EXPORT_SYMBOL_GPL(rtl_ops); | ||
diff --git a/drivers/net/wireless/rtlwifi/debug.c b/drivers/net/wireless/rtlwifi/debug.c index 7d52d3d7769f..76e2086e137e 100644 --- a/drivers/net/wireless/rtlwifi/debug.c +++ b/drivers/net/wireless/rtlwifi/debug.c | |||
@@ -51,3 +51,4 @@ void rtl_dbgp_flag_init(struct ieee80211_hw *hw) | |||
51 | 51 | ||
52 | /*Init Debug flag enable condition */ | 52 | /*Init Debug flag enable condition */ |
53 | } | 53 | } |
54 | EXPORT_SYMBOL_GPL(rtl_dbgp_flag_init); | ||
diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c index 9e3894178e77..838a1ed3f194 100644 --- a/drivers/net/wireless/rtlwifi/efuse.c +++ b/drivers/net/wireless/rtlwifi/efuse.c | |||
@@ -229,6 +229,7 @@ void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf) | |||
229 | 229 | ||
230 | *pbuf = (u8) (value32 & 0xff); | 230 | *pbuf = (u8) (value32 & 0xff); |
231 | } | 231 | } |
232 | EXPORT_SYMBOL_GPL(read_efuse_byte); | ||
232 | 233 | ||
233 | void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf) | 234 | void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf) |
234 | { | 235 | { |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index c97e9d327331..703f839af6ca 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -35,6 +35,13 @@ | |||
35 | #include "efuse.h" | 35 | #include "efuse.h" |
36 | #include <linux/export.h> | 36 | #include <linux/export.h> |
37 | #include <linux/kmemleak.h> | 37 | #include <linux/kmemleak.h> |
38 | #include <linux/module.h> | ||
39 | |||
40 | MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>"); | ||
41 | MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>"); | ||
42 | MODULE_AUTHOR("Larry Finger <Larry.FInger@lwfinger.net>"); | ||
43 | MODULE_LICENSE("GPL"); | ||
44 | MODULE_DESCRIPTION("PCI basic driver for rtlwifi"); | ||
38 | 45 | ||
39 | static const u16 pcibridge_vendors[PCI_BRIDGE_VENDOR_MAX] = { | 46 | static const u16 pcibridge_vendors[PCI_BRIDGE_VENDOR_MAX] = { |
40 | PCI_VENDOR_ID_INTEL, | 47 | PCI_VENDOR_ID_INTEL, |
@@ -1008,19 +1015,6 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) | |||
1008 | return; | 1015 | return; |
1009 | } | 1016 | } |
1010 | 1017 | ||
1011 | static void rtl_lps_change_work_callback(struct work_struct *work) | ||
1012 | { | ||
1013 | struct rtl_works *rtlworks = | ||
1014 | container_of(work, struct rtl_works, lps_change_work); | ||
1015 | struct ieee80211_hw *hw = rtlworks->hw; | ||
1016 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
1017 | |||
1018 | if (rtlpriv->enter_ps) | ||
1019 | rtl_lps_enter(hw); | ||
1020 | else | ||
1021 | rtl_lps_leave(hw); | ||
1022 | } | ||
1023 | |||
1024 | static void _rtl_pci_init_trx_var(struct ieee80211_hw *hw) | 1018 | static void _rtl_pci_init_trx_var(struct ieee80211_hw *hw) |
1025 | { | 1019 | { |
1026 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 1020 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
@@ -1899,7 +1893,7 @@ int rtl_pci_probe(struct pci_dev *pdev, | |||
1899 | rtlpriv->rtlhal.interface = INTF_PCI; | 1893 | rtlpriv->rtlhal.interface = INTF_PCI; |
1900 | rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_data); | 1894 | rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_data); |
1901 | rtlpriv->intf_ops = &rtl_pci_ops; | 1895 | rtlpriv->intf_ops = &rtl_pci_ops; |
1902 | rtlpriv->glb_var = &global_var; | 1896 | rtlpriv->glb_var = &rtl_global_var; |
1903 | 1897 | ||
1904 | /* | 1898 | /* |
1905 | *init dbgp flags before all | 1899 | *init dbgp flags before all |
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c index 884bceae38a9..298b615964e8 100644 --- a/drivers/net/wireless/rtlwifi/ps.c +++ b/drivers/net/wireless/rtlwifi/ps.c | |||
@@ -269,6 +269,7 @@ void rtl_ips_nic_on(struct ieee80211_hw *hw) | |||
269 | 269 | ||
270 | spin_unlock_irqrestore(&rtlpriv->locks.ips_lock, flags); | 270 | spin_unlock_irqrestore(&rtlpriv->locks.ips_lock, flags); |
271 | } | 271 | } |
272 | EXPORT_SYMBOL_GPL(rtl_ips_nic_on); | ||
272 | 273 | ||
273 | /*for FW LPS*/ | 274 | /*for FW LPS*/ |
274 | 275 | ||
@@ -518,6 +519,7 @@ void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len) | |||
518 | "u_bufferd: %x, m_buffered: %x\n", u_buffed, m_buffed); | 519 | "u_bufferd: %x, m_buffered: %x\n", u_buffed, m_buffed); |
519 | } | 520 | } |
520 | } | 521 | } |
522 | EXPORT_SYMBOL_GPL(rtl_swlps_beacon); | ||
521 | 523 | ||
522 | void rtl_swlps_rf_awake(struct ieee80211_hw *hw) | 524 | void rtl_swlps_rf_awake(struct ieee80211_hw *hw) |
523 | { | 525 | { |
@@ -611,6 +613,19 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw) | |||
611 | MSECS(sleep_intv * mac->vif->bss_conf.beacon_int - 40)); | 613 | MSECS(sleep_intv * mac->vif->bss_conf.beacon_int - 40)); |
612 | } | 614 | } |
613 | 615 | ||
616 | void rtl_lps_change_work_callback(struct work_struct *work) | ||
617 | { | ||
618 | struct rtl_works *rtlworks = | ||
619 | container_of(work, struct rtl_works, lps_change_work); | ||
620 | struct ieee80211_hw *hw = rtlworks->hw; | ||
621 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
622 | |||
623 | if (rtlpriv->enter_ps) | ||
624 | rtl_lps_enter(hw); | ||
625 | else | ||
626 | rtl_lps_leave(hw); | ||
627 | } | ||
628 | EXPORT_SYMBOL_GPL(rtl_lps_change_work_callback); | ||
614 | 629 | ||
615 | void rtl_swlps_wq_callback(void *data) | 630 | void rtl_swlps_wq_callback(void *data) |
616 | { | 631 | { |
@@ -922,3 +937,4 @@ void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len) | |||
922 | else | 937 | else |
923 | rtl_p2p_noa_ie(hw, data, len - FCS_LEN); | 938 | rtl_p2p_noa_ie(hw, data, len - FCS_LEN); |
924 | } | 939 | } |
940 | EXPORT_SYMBOL_GPL(rtl_p2p_info); | ||
diff --git a/drivers/net/wireless/rtlwifi/ps.h b/drivers/net/wireless/rtlwifi/ps.h index 4d682b753f50..88bd76ea88f7 100644 --- a/drivers/net/wireless/rtlwifi/ps.h +++ b/drivers/net/wireless/rtlwifi/ps.h | |||
@@ -49,5 +49,6 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw); | |||
49 | void rtl_swlps_rf_sleep(struct ieee80211_hw *hw); | 49 | void rtl_swlps_rf_sleep(struct ieee80211_hw *hw); |
50 | void rtl_p2p_ps_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); | 50 | void rtl_p2p_ps_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); |
51 | void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len); | 51 | void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len); |
52 | void rtl_lps_change_work_callback(struct work_struct *work); | ||
52 | 53 | ||
53 | #endif | 54 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index a3532e077871..e56778cac9bf 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -32,6 +32,13 @@ | |||
32 | #include "ps.h" | 32 | #include "ps.h" |
33 | #include "rtl8192c/fw_common.h" | 33 | #include "rtl8192c/fw_common.h" |
34 | #include <linux/export.h> | 34 | #include <linux/export.h> |
35 | #include <linux/module.h> | ||
36 | |||
37 | MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>"); | ||
38 | MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>"); | ||
39 | MODULE_AUTHOR("Larry Finger <Larry.FInger@lwfinger.net>"); | ||
40 | MODULE_LICENSE("GPL"); | ||
41 | MODULE_DESCRIPTION("USB basic driver for rtlwifi"); | ||
35 | 42 | ||
36 | #define REALTEK_USB_VENQT_READ 0xC0 | 43 | #define REALTEK_USB_VENQT_READ 0xC0 |
37 | #define REALTEK_USB_VENQT_WRITE 0x40 | 44 | #define REALTEK_USB_VENQT_WRITE 0x40 |
@@ -1070,6 +1077,8 @@ int rtl_usb_probe(struct usb_interface *intf, | |||
1070 | spin_lock_init(&rtlpriv->locks.usb_lock); | 1077 | spin_lock_init(&rtlpriv->locks.usb_lock); |
1071 | INIT_WORK(&rtlpriv->works.fill_h2c_cmd, | 1078 | INIT_WORK(&rtlpriv->works.fill_h2c_cmd, |
1072 | rtl_fill_h2c_cmd_work_callback); | 1079 | rtl_fill_h2c_cmd_work_callback); |
1080 | INIT_WORK(&rtlpriv->works.lps_change_work, | ||
1081 | rtl_lps_change_work_callback); | ||
1073 | 1082 | ||
1074 | rtlpriv->usb_data_index = 0; | 1083 | rtlpriv->usb_data_index = 0; |
1075 | init_completion(&rtlpriv->firmware_loading_complete); | 1084 | init_completion(&rtlpriv->firmware_loading_complete); |
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index e79e006eb9ab..9ee04b4b68bf 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c | |||
@@ -811,18 +811,28 @@ int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev) | |||
811 | return pcidev->irq; | 811 | return pcidev->irq; |
812 | } | 812 | } |
813 | 813 | ||
814 | static struct iosapic_info *first_isi = NULL; | 814 | static struct iosapic_info *iosapic_list; |
815 | 815 | ||
816 | #ifdef CONFIG_64BIT | 816 | #ifdef CONFIG_64BIT |
817 | int iosapic_serial_irq(int num) | 817 | int iosapic_serial_irq(struct parisc_device *dev) |
818 | { | 818 | { |
819 | struct iosapic_info *isi = first_isi; | 819 | struct iosapic_info *isi; |
820 | struct irt_entry *irte = NULL; /* only used if PAT PDC */ | 820 | struct irt_entry *irte; |
821 | struct vector_info *vi; | 821 | struct vector_info *vi; |
822 | int isi_line; /* line used by device */ | 822 | int cnt; |
823 | int intin; | ||
824 | |||
825 | intin = (dev->mod_info >> 24) & 15; | ||
823 | 826 | ||
824 | /* lookup IRT entry for isi/slot/pin set */ | 827 | /* lookup IRT entry for isi/slot/pin set */ |
825 | irte = &irt_cell[num]; | 828 | for (cnt = 0; cnt < irt_num_entry; cnt++) { |
829 | irte = &irt_cell[cnt]; | ||
830 | if (COMPARE_IRTE_ADDR(irte, dev->mod0) && | ||
831 | irte->dest_iosapic_intin == intin) | ||
832 | break; | ||
833 | } | ||
834 | if (cnt >= irt_num_entry) | ||
835 | return 0; /* no irq found, force polling */ | ||
826 | 836 | ||
827 | DBG_IRT("iosapic_serial_irq(): irte %p %x %x %x %x %x %x %x %x\n", | 837 | DBG_IRT("iosapic_serial_irq(): irte %p %x %x %x %x %x %x %x %x\n", |
828 | irte, | 838 | irte, |
@@ -834,11 +844,17 @@ int iosapic_serial_irq(int num) | |||
834 | irte->src_seg_id, | 844 | irte->src_seg_id, |
835 | irte->dest_iosapic_intin, | 845 | irte->dest_iosapic_intin, |
836 | (u32) irte->dest_iosapic_addr); | 846 | (u32) irte->dest_iosapic_addr); |
837 | isi_line = irte->dest_iosapic_intin; | 847 | |
848 | /* search for iosapic */ | ||
849 | for (isi = iosapic_list; isi; isi = isi->isi_next) | ||
850 | if (isi->isi_hpa == dev->mod0) | ||
851 | break; | ||
852 | if (!isi) | ||
853 | return 0; /* no iosapic found, force polling */ | ||
838 | 854 | ||
839 | /* get vector info for this input line */ | 855 | /* get vector info for this input line */ |
840 | vi = isi->isi_vector + isi_line; | 856 | vi = isi->isi_vector + intin; |
841 | DBG_IRT("iosapic_serial_irq: line %d vi 0x%p\n", isi_line, vi); | 857 | DBG_IRT("iosapic_serial_irq: line %d vi 0x%p\n", iosapic_intin, vi); |
842 | 858 | ||
843 | /* If this IRQ line has already been setup, skip it */ | 859 | /* If this IRQ line has already been setup, skip it */ |
844 | if (vi->irte) | 860 | if (vi->irte) |
@@ -941,8 +957,8 @@ void *iosapic_register(unsigned long hpa) | |||
941 | vip->irqline = (unsigned char) cnt; | 957 | vip->irqline = (unsigned char) cnt; |
942 | vip->iosapic = isi; | 958 | vip->iosapic = isi; |
943 | } | 959 | } |
944 | if (!first_isi) | 960 | isi->isi_next = iosapic_list; |
945 | first_isi = isi; | 961 | iosapic_list = isi; |
946 | return isi; | 962 | return isi; |
947 | } | 963 | } |
948 | 964 | ||
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index 13a633b1612e..7bf3926aecc0 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c | |||
@@ -86,10 +86,6 @@ struct mvebu_sw_pci_bridge { | |||
86 | u16 secondary_status; | 86 | u16 secondary_status; |
87 | u16 membase; | 87 | u16 membase; |
88 | u16 memlimit; | 88 | u16 memlimit; |
89 | u16 prefmembase; | ||
90 | u16 prefmemlimit; | ||
91 | u32 prefbaseupper; | ||
92 | u32 preflimitupper; | ||
93 | u16 iobaseupper; | 89 | u16 iobaseupper; |
94 | u16 iolimitupper; | 90 | u16 iolimitupper; |
95 | u8 cappointer; | 91 | u8 cappointer; |
@@ -419,15 +415,7 @@ static int mvebu_sw_pci_bridge_read(struct mvebu_pcie_port *port, | |||
419 | break; | 415 | break; |
420 | 416 | ||
421 | case PCI_PREF_MEMORY_BASE: | 417 | case PCI_PREF_MEMORY_BASE: |
422 | *value = (bridge->prefmemlimit << 16 | bridge->prefmembase); | 418 | *value = 0; |
423 | break; | ||
424 | |||
425 | case PCI_PREF_BASE_UPPER32: | ||
426 | *value = bridge->prefbaseupper; | ||
427 | break; | ||
428 | |||
429 | case PCI_PREF_LIMIT_UPPER32: | ||
430 | *value = bridge->preflimitupper; | ||
431 | break; | 419 | break; |
432 | 420 | ||
433 | case PCI_IO_BASE_UPPER16: | 421 | case PCI_IO_BASE_UPPER16: |
@@ -501,19 +489,6 @@ static int mvebu_sw_pci_bridge_write(struct mvebu_pcie_port *port, | |||
501 | mvebu_pcie_handle_membase_change(port); | 489 | mvebu_pcie_handle_membase_change(port); |
502 | break; | 490 | break; |
503 | 491 | ||
504 | case PCI_PREF_MEMORY_BASE: | ||
505 | bridge->prefmembase = value & 0xffff; | ||
506 | bridge->prefmemlimit = value >> 16; | ||
507 | break; | ||
508 | |||
509 | case PCI_PREF_BASE_UPPER32: | ||
510 | bridge->prefbaseupper = value; | ||
511 | break; | ||
512 | |||
513 | case PCI_PREF_LIMIT_UPPER32: | ||
514 | bridge->preflimitupper = value; | ||
515 | break; | ||
516 | |||
517 | case PCI_IO_BASE_UPPER16: | 492 | case PCI_IO_BASE_UPPER16: |
518 | bridge->iobaseupper = value & 0xffff; | 493 | bridge->iobaseupper = value & 0xffff; |
519 | bridge->iolimitupper = value >> 16; | 494 | bridge->iolimitupper = value >> 16; |
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig index bb7ebb22db01..d85009de713d 100644 --- a/drivers/pci/hotplug/Kconfig +++ b/drivers/pci/hotplug/Kconfig | |||
@@ -3,16 +3,13 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | menuconfig HOTPLUG_PCI | 5 | menuconfig HOTPLUG_PCI |
6 | tristate "Support for PCI Hotplug" | 6 | bool "Support for PCI Hotplug" |
7 | depends on PCI && SYSFS | 7 | depends on PCI && SYSFS |
8 | ---help--- | 8 | ---help--- |
9 | Say Y here if you have a motherboard with a PCI Hotplug controller. | 9 | Say Y here if you have a motherboard with a PCI Hotplug controller. |
10 | This allows you to add and remove PCI cards while the machine is | 10 | This allows you to add and remove PCI cards while the machine is |
11 | powered up and running. | 11 | powered up and running. |
12 | 12 | ||
13 | To compile this driver as a module, choose M here: the | ||
14 | module will be called pci_hotplug. | ||
15 | |||
16 | When in doubt, say N. | 13 | When in doubt, say N. |
17 | 14 | ||
18 | if HOTPLUG_PCI | 15 | if HOTPLUG_PCI |
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index aac7a40e4a4a..0e0d0f7f63fd 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c | |||
@@ -92,7 +92,14 @@ int pciehp_unconfigure_device(struct slot *p_slot) | |||
92 | if (ret) | 92 | if (ret) |
93 | presence = 0; | 93 | presence = 0; |
94 | 94 | ||
95 | list_for_each_entry_safe(dev, temp, &parent->devices, bus_list) { | 95 | /* |
96 | * Stopping an SR-IOV PF device removes all the associated VFs, | ||
97 | * which will update the bus->devices list and confuse the | ||
98 | * iterator. Therefore, iterate in reverse so we remove the VFs | ||
99 | * first, then the PF. We do the same in pci_stop_bus_device(). | ||
100 | */ | ||
101 | list_for_each_entry_safe_reverse(dev, temp, &parent->devices, | ||
102 | bus_list) { | ||
96 | pci_dev_get(dev); | 103 | pci_dev_get(dev); |
97 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && presence) { | 104 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && presence) { |
98 | pci_read_config_byte(dev, PCI_BRIDGE_CONTROL, &bctl); | 105 | pci_read_config_byte(dev, PCI_BRIDGE_CONTROL, &bctl); |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index dbdc5f7e2b29..01e264fb50e0 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -317,13 +317,20 @@ void acpi_pci_remove_bus(struct pci_bus *bus) | |||
317 | /* ACPI bus type */ | 317 | /* ACPI bus type */ |
318 | static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) | 318 | static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) |
319 | { | 319 | { |
320 | struct pci_dev * pci_dev; | 320 | struct pci_dev *pci_dev = to_pci_dev(dev); |
321 | u64 addr; | 321 | bool is_bridge; |
322 | u64 addr; | ||
322 | 323 | ||
323 | pci_dev = to_pci_dev(dev); | 324 | /* |
325 | * pci_is_bridge() is not suitable here, because pci_dev->subordinate | ||
326 | * is set only after acpi_pci_find_device() has been called for the | ||
327 | * given device. | ||
328 | */ | ||
329 | is_bridge = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE | ||
330 | || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS; | ||
324 | /* Please ref to ACPI spec for the syntax of _ADR */ | 331 | /* Please ref to ACPI spec for the syntax of _ADR */ |
325 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); | 332 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); |
326 | *handle = acpi_get_child(DEVICE_ACPI_HANDLE(dev->parent), addr); | 333 | *handle = acpi_find_child(ACPI_HANDLE(dev->parent), addr, is_bridge); |
327 | if (!*handle) | 334 | if (!*handle) |
328 | return -ENODEV; | 335 | return -ENODEV; |
329 | return 0; | 336 | return 0; |
diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig index 569f82fc9e22..3b94cfcfa03b 100644 --- a/drivers/pci/pcie/Kconfig +++ b/drivers/pci/pcie/Kconfig | |||
@@ -14,15 +14,12 @@ config PCIEPORTBUS | |||
14 | # Include service Kconfig here | 14 | # Include service Kconfig here |
15 | # | 15 | # |
16 | config HOTPLUG_PCI_PCIE | 16 | config HOTPLUG_PCI_PCIE |
17 | tristate "PCI Express Hotplug driver" | 17 | bool "PCI Express Hotplug driver" |
18 | depends on HOTPLUG_PCI && PCIEPORTBUS | 18 | depends on HOTPLUG_PCI && PCIEPORTBUS |
19 | help | 19 | help |
20 | Say Y here if you have a motherboard that supports PCI Express Native | 20 | Say Y here if you have a motherboard that supports PCI Express Native |
21 | Hotplug | 21 | Hotplug |
22 | 22 | ||
23 | To compile this driver as a module, choose M here: the | ||
24 | module will be called pciehp. | ||
25 | |||
26 | When in doubt, say N. | 23 | When in doubt, say N. |
27 | 24 | ||
28 | source "drivers/pci/pcie/aer/Kconfig" | 25 | source "drivers/pci/pcie/aer/Kconfig" |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index d254e2379533..64a7de22d9af 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -300,6 +300,47 @@ static void assign_requested_resources_sorted(struct list_head *head, | |||
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
303 | static unsigned long pci_fail_res_type_mask(struct list_head *fail_head) | ||
304 | { | ||
305 | struct pci_dev_resource *fail_res; | ||
306 | unsigned long mask = 0; | ||
307 | |||
308 | /* check failed type */ | ||
309 | list_for_each_entry(fail_res, fail_head, list) | ||
310 | mask |= fail_res->flags; | ||
311 | |||
312 | /* | ||
313 | * one pref failed resource will set IORESOURCE_MEM, | ||
314 | * as we can allocate pref in non-pref range. | ||
315 | * Will release all assigned non-pref sibling resources | ||
316 | * according to that bit. | ||
317 | */ | ||
318 | return mask & (IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH); | ||
319 | } | ||
320 | |||
321 | static bool pci_need_to_release(unsigned long mask, struct resource *res) | ||
322 | { | ||
323 | if (res->flags & IORESOURCE_IO) | ||
324 | return !!(mask & IORESOURCE_IO); | ||
325 | |||
326 | /* check pref at first */ | ||
327 | if (res->flags & IORESOURCE_PREFETCH) { | ||
328 | if (mask & IORESOURCE_PREFETCH) | ||
329 | return true; | ||
330 | /* count pref if its parent is non-pref */ | ||
331 | else if ((mask & IORESOURCE_MEM) && | ||
332 | !(res->parent->flags & IORESOURCE_PREFETCH)) | ||
333 | return true; | ||
334 | else | ||
335 | return false; | ||
336 | } | ||
337 | |||
338 | if (res->flags & IORESOURCE_MEM) | ||
339 | return !!(mask & IORESOURCE_MEM); | ||
340 | |||
341 | return false; /* should not get here */ | ||
342 | } | ||
343 | |||
303 | static void __assign_resources_sorted(struct list_head *head, | 344 | static void __assign_resources_sorted(struct list_head *head, |
304 | struct list_head *realloc_head, | 345 | struct list_head *realloc_head, |
305 | struct list_head *fail_head) | 346 | struct list_head *fail_head) |
@@ -312,11 +353,24 @@ static void __assign_resources_sorted(struct list_head *head, | |||
312 | * if could do that, could get out early. | 353 | * if could do that, could get out early. |
313 | * if could not do that, we still try to assign requested at first, | 354 | * if could not do that, we still try to assign requested at first, |
314 | * then try to reassign add_size for some resources. | 355 | * then try to reassign add_size for some resources. |
356 | * | ||
357 | * Separate three resource type checking if we need to release | ||
358 | * assigned resource after requested + add_size try. | ||
359 | * 1. if there is io port assign fail, will release assigned | ||
360 | * io port. | ||
361 | * 2. if there is pref mmio assign fail, release assigned | ||
362 | * pref mmio. | ||
363 | * if assigned pref mmio's parent is non-pref mmio and there | ||
364 | * is non-pref mmio assign fail, will release that assigned | ||
365 | * pref mmio. | ||
366 | * 3. if there is non-pref mmio assign fail or pref mmio | ||
367 | * assigned fail, will release assigned non-pref mmio. | ||
315 | */ | 368 | */ |
316 | LIST_HEAD(save_head); | 369 | LIST_HEAD(save_head); |
317 | LIST_HEAD(local_fail_head); | 370 | LIST_HEAD(local_fail_head); |
318 | struct pci_dev_resource *save_res; | 371 | struct pci_dev_resource *save_res; |
319 | struct pci_dev_resource *dev_res; | 372 | struct pci_dev_resource *dev_res, *tmp_res; |
373 | unsigned long fail_type; | ||
320 | 374 | ||
321 | /* Check if optional add_size is there */ | 375 | /* Check if optional add_size is there */ |
322 | if (!realloc_head || list_empty(realloc_head)) | 376 | if (!realloc_head || list_empty(realloc_head)) |
@@ -348,6 +402,19 @@ static void __assign_resources_sorted(struct list_head *head, | |||
348 | return; | 402 | return; |
349 | } | 403 | } |
350 | 404 | ||
405 | /* check failed type */ | ||
406 | fail_type = pci_fail_res_type_mask(&local_fail_head); | ||
407 | /* remove not need to be released assigned res from head list etc */ | ||
408 | list_for_each_entry_safe(dev_res, tmp_res, head, list) | ||
409 | if (dev_res->res->parent && | ||
410 | !pci_need_to_release(fail_type, dev_res->res)) { | ||
411 | /* remove it from realloc_head list */ | ||
412 | remove_from_list(realloc_head, dev_res->res); | ||
413 | remove_from_list(&save_head, dev_res->res); | ||
414 | list_del(&dev_res->list); | ||
415 | kfree(dev_res); | ||
416 | } | ||
417 | |||
351 | free_list(&local_fail_head); | 418 | free_list(&local_fail_head); |
352 | /* Release assigned resource */ | 419 | /* Release assigned resource */ |
353 | list_for_each_entry(dev_res, head, list) | 420 | list_for_each_entry(dev_res, head, list) |
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index f4f30af2df68..2e8a20cac588 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c | |||
@@ -1715,11 +1715,13 @@ int rio_unregister_scan(int mport_id, struct rio_scan *scan_ops) | |||
1715 | (mport_id == RIO_MPORT_ANY && port->nscan == scan_ops)) | 1715 | (mport_id == RIO_MPORT_ANY && port->nscan == scan_ops)) |
1716 | port->nscan = NULL; | 1716 | port->nscan = NULL; |
1717 | 1717 | ||
1718 | list_for_each_entry(scan, &rio_scans, node) | 1718 | list_for_each_entry(scan, &rio_scans, node) { |
1719 | if (scan->mport_id == mport_id) { | 1719 | if (scan->mport_id == mport_id) { |
1720 | list_del(&scan->node); | 1720 | list_del(&scan->node); |
1721 | kfree(scan); | 1721 | kfree(scan); |
1722 | break; | ||
1722 | } | 1723 | } |
1724 | } | ||
1723 | 1725 | ||
1724 | mutex_unlock(&rio_mport_list_lock); | 1726 | mutex_unlock(&rio_mport_list_lock); |
1725 | 1727 | ||
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 02faf3c4e0d5..c2e80d7ca5e2 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
@@ -524,6 +524,8 @@ static int twl_rtc_probe(struct platform_device *pdev) | |||
524 | if (ret < 0) | 524 | if (ret < 0) |
525 | goto out1; | 525 | goto out1; |
526 | 526 | ||
527 | device_init_wakeup(&pdev->dev, 1); | ||
528 | |||
527 | rtc = rtc_device_register(pdev->name, | 529 | rtc = rtc_device_register(pdev->name, |
528 | &pdev->dev, &twl_rtc_ops, THIS_MODULE); | 530 | &pdev->dev, &twl_rtc_ops, THIS_MODULE); |
529 | if (IS_ERR(rtc)) { | 531 | if (IS_ERR(rtc)) { |
@@ -542,7 +544,6 @@ static int twl_rtc_probe(struct platform_device *pdev) | |||
542 | } | 544 | } |
543 | 545 | ||
544 | platform_set_drvdata(pdev, rtc); | 546 | platform_set_drvdata(pdev, rtc); |
545 | device_init_wakeup(&pdev->dev, 1); | ||
546 | return 0; | 547 | return 0; |
547 | 548 | ||
548 | out2: | 549 | out2: |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 17150a778984..451bf99582ff 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -2392,6 +2392,12 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr) | |||
2392 | rc = cqr->intrc; | 2392 | rc = cqr->intrc; |
2393 | else | 2393 | else |
2394 | rc = -EIO; | 2394 | rc = -EIO; |
2395 | |||
2396 | /* kick tasklets */ | ||
2397 | dasd_schedule_device_bh(device); | ||
2398 | if (device->block) | ||
2399 | dasd_schedule_block_bh(device->block); | ||
2400 | |||
2395 | return rc; | 2401 | return rc; |
2396 | } | 2402 | } |
2397 | 2403 | ||
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 2168258fb2c3..74b88efde6ad 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
@@ -751,7 +751,7 @@ static void __virtscsi_set_affinity(struct virtio_scsi *vscsi, bool affinity) | |||
751 | 751 | ||
752 | vscsi->affinity_hint_set = true; | 752 | vscsi->affinity_hint_set = true; |
753 | } else { | 753 | } else { |
754 | for (i = 0; i < vscsi->num_queues - VIRTIO_SCSI_VQ_BASE; i++) | 754 | for (i = 0; i < vscsi->num_queues; i++) |
755 | virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1); | 755 | virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1); |
756 | 756 | ||
757 | vscsi->affinity_hint_set = false; | 757 | vscsi->affinity_hint_set = false; |
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 222d3e37fc28..707966bd5610 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -609,7 +609,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
609 | else | 609 | else |
610 | buf = (void *)t->tx_buf; | 610 | buf = (void *)t->tx_buf; |
611 | t->tx_dma = dma_map_single(&spi->dev, buf, | 611 | t->tx_dma = dma_map_single(&spi->dev, buf, |
612 | t->len, DMA_FROM_DEVICE); | 612 | t->len, DMA_TO_DEVICE); |
613 | if (!t->tx_dma) { | 613 | if (!t->tx_dma) { |
614 | ret = -EFAULT; | 614 | ret = -EFAULT; |
615 | goto err_tx_map; | 615 | goto err_tx_map; |
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index dcceed29d31a..81972fa47beb 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c | |||
@@ -1811,10 +1811,12 @@ static int zcache_comp_init(void) | |||
1811 | #else | 1811 | #else |
1812 | if (*zcache_comp_name != '\0') { | 1812 | if (*zcache_comp_name != '\0') { |
1813 | ret = crypto_has_comp(zcache_comp_name, 0, 0); | 1813 | ret = crypto_has_comp(zcache_comp_name, 0, 0); |
1814 | if (!ret) | 1814 | if (!ret) { |
1815 | pr_info("zcache: %s not supported\n", | 1815 | pr_info("zcache: %s not supported\n", |
1816 | zcache_comp_name); | 1816 | zcache_comp_name); |
1817 | goto out; | 1817 | ret = 1; |
1818 | goto out; | ||
1819 | } | ||
1818 | } | 1820 | } |
1819 | if (!ret) | 1821 | if (!ret) |
1820 | strcpy(zcache_comp_name, "lzo"); | 1822 | strcpy(zcache_comp_name, "lzo"); |
diff --git a/drivers/tty/serial/8250/8250_gsc.c b/drivers/tty/serial/8250/8250_gsc.c index bb91b4713ebd..2e3ea1a70d7b 100644 --- a/drivers/tty/serial/8250/8250_gsc.c +++ b/drivers/tty/serial/8250/8250_gsc.c | |||
@@ -31,9 +31,8 @@ static int __init serial_init_chip(struct parisc_device *dev) | |||
31 | int err; | 31 | int err; |
32 | 32 | ||
33 | #ifdef CONFIG_64BIT | 33 | #ifdef CONFIG_64BIT |
34 | extern int iosapic_serial_irq(int cellnum); | ||
35 | if (!dev->irq && (dev->id.sversion == 0xad)) | 34 | if (!dev->irq && (dev->id.sversion == 0xad)) |
36 | dev->irq = iosapic_serial_irq(dev->mod_index-1); | 35 | dev->irq = iosapic_serial_irq(dev); |
37 | #endif | 36 | #endif |
38 | 37 | ||
39 | if (!dev->irq) { | 38 | if (!dev->irq) { |
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c index cbf1d155b7b2..22f280aa4f2c 100644 --- a/drivers/tty/serial/arc_uart.c +++ b/drivers/tty/serial/arc_uart.c | |||
@@ -773,6 +773,6 @@ module_init(arc_serial_init); | |||
773 | module_exit(arc_serial_exit); | 773 | module_exit(arc_serial_exit); |
774 | 774 | ||
775 | MODULE_LICENSE("GPL"); | 775 | MODULE_LICENSE("GPL"); |
776 | MODULE_ALIAS("plat-arcfpga/uart"); | 776 | MODULE_ALIAS("platform:" DRIVER_NAME); |
777 | MODULE_AUTHOR("Vineet Gupta"); | 777 | MODULE_AUTHOR("Vineet Gupta"); |
778 | MODULE_DESCRIPTION("ARC(Synopsys) On-Chip(fpga) serial driver"); | 778 | MODULE_DESCRIPTION("ARC(Synopsys) On-Chip(fpga) serial driver"); |
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 4f5f161896a1..f85b8e6d0346 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c | |||
@@ -678,11 +678,18 @@ static void mxs_auart_settermios(struct uart_port *u, | |||
678 | 678 | ||
679 | static irqreturn_t mxs_auart_irq_handle(int irq, void *context) | 679 | static irqreturn_t mxs_auart_irq_handle(int irq, void *context) |
680 | { | 680 | { |
681 | u32 istatus, istat; | 681 | u32 istat; |
682 | struct mxs_auart_port *s = context; | 682 | struct mxs_auart_port *s = context; |
683 | u32 stat = readl(s->port.membase + AUART_STAT); | 683 | u32 stat = readl(s->port.membase + AUART_STAT); |
684 | 684 | ||
685 | istatus = istat = readl(s->port.membase + AUART_INTR); | 685 | istat = readl(s->port.membase + AUART_INTR); |
686 | |||
687 | /* ack irq */ | ||
688 | writel(istat & (AUART_INTR_RTIS | ||
689 | | AUART_INTR_TXIS | ||
690 | | AUART_INTR_RXIS | ||
691 | | AUART_INTR_CTSMIS), | ||
692 | s->port.membase + AUART_INTR_CLR); | ||
686 | 693 | ||
687 | if (istat & AUART_INTR_CTSMIS) { | 694 | if (istat & AUART_INTR_CTSMIS) { |
688 | uart_handle_cts_change(&s->port, stat & AUART_STAT_CTS); | 695 | uart_handle_cts_change(&s->port, stat & AUART_STAT_CTS); |
@@ -702,12 +709,6 @@ static irqreturn_t mxs_auart_irq_handle(int irq, void *context) | |||
702 | istat &= ~AUART_INTR_TXIS; | 709 | istat &= ~AUART_INTR_TXIS; |
703 | } | 710 | } |
704 | 711 | ||
705 | writel(istatus & (AUART_INTR_RTIS | ||
706 | | AUART_INTR_TXIS | ||
707 | | AUART_INTR_RXIS | ||
708 | | AUART_INTR_CTSMIS), | ||
709 | s->port.membase + AUART_INTR_CLR); | ||
710 | |||
711 | return IRQ_HANDLED; | 712 | return IRQ_HANDLED; |
712 | } | 713 | } |
713 | 714 | ||
@@ -850,7 +851,7 @@ auart_console_write(struct console *co, const char *str, unsigned int count) | |||
850 | struct mxs_auart_port *s; | 851 | struct mxs_auart_port *s; |
851 | struct uart_port *port; | 852 | struct uart_port *port; |
852 | unsigned int old_ctrl0, old_ctrl2; | 853 | unsigned int old_ctrl0, old_ctrl2; |
853 | unsigned int to = 1000; | 854 | unsigned int to = 20000; |
854 | 855 | ||
855 | if (co->index >= MXS_AUART_PORTS || co->index < 0) | 856 | if (co->index >= MXS_AUART_PORTS || co->index < 0) |
856 | return; | 857 | return; |
@@ -871,18 +872,23 @@ auart_console_write(struct console *co, const char *str, unsigned int count) | |||
871 | 872 | ||
872 | uart_console_write(port, str, count, mxs_auart_console_putchar); | 873 | uart_console_write(port, str, count, mxs_auart_console_putchar); |
873 | 874 | ||
874 | /* | 875 | /* Finally, wait for transmitter to become empty ... */ |
875 | * Finally, wait for transmitter to become empty | ||
876 | * and restore the TCR | ||
877 | */ | ||
878 | while (readl(port->membase + AUART_STAT) & AUART_STAT_BUSY) { | 876 | while (readl(port->membase + AUART_STAT) & AUART_STAT_BUSY) { |
877 | udelay(1); | ||
879 | if (!to--) | 878 | if (!to--) |
880 | break; | 879 | break; |
881 | udelay(1); | ||
882 | } | 880 | } |
883 | 881 | ||
884 | writel(old_ctrl0, port->membase + AUART_CTRL0); | 882 | /* |
885 | writel(old_ctrl2, port->membase + AUART_CTRL2); | 883 | * ... and restore the TCR if we waited long enough for the transmitter |
884 | * to be idle. This might keep the transmitter enabled although it is | ||
885 | * unused, but that is better than to disable it while it is still | ||
886 | * transmitting. | ||
887 | */ | ||
888 | if (!(readl(port->membase + AUART_STAT) & AUART_STAT_BUSY)) { | ||
889 | writel(old_ctrl0, port->membase + AUART_CTRL0); | ||
890 | writel(old_ctrl2, port->membase + AUART_CTRL2); | ||
891 | } | ||
886 | 892 | ||
887 | clk_disable(s->clk); | 893 | clk_disable(s->clk); |
888 | } | 894 | } |
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 121aeb9393e1..f597e88a705d 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c | |||
@@ -256,10 +256,9 @@ void tty_port_tty_hangup(struct tty_port *port, bool check_clocal) | |||
256 | { | 256 | { |
257 | struct tty_struct *tty = tty_port_tty_get(port); | 257 | struct tty_struct *tty = tty_port_tty_get(port); |
258 | 258 | ||
259 | if (tty && (!check_clocal || !C_CLOCAL(tty))) { | 259 | if (tty && (!check_clocal || !C_CLOCAL(tty))) |
260 | tty_hangup(tty); | 260 | tty_hangup(tty); |
261 | tty_kref_put(tty); | 261 | tty_kref_put(tty); |
262 | } | ||
263 | } | 262 | } |
264 | EXPORT_SYMBOL_GPL(tty_port_tty_hangup); | 263 | EXPORT_SYMBOL_GPL(tty_port_tty_hangup); |
265 | 264 | ||
diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig index eb2aa2e5a842..d1bd8ef1f9c1 100644 --- a/drivers/usb/chipidea/Kconfig +++ b/drivers/usb/chipidea/Kconfig | |||
@@ -12,7 +12,7 @@ if USB_CHIPIDEA | |||
12 | 12 | ||
13 | config USB_CHIPIDEA_UDC | 13 | config USB_CHIPIDEA_UDC |
14 | bool "ChipIdea device controller" | 14 | bool "ChipIdea device controller" |
15 | depends on USB_GADGET=y || USB_CHIPIDEA=m | 15 | depends on USB_GADGET=y || (USB_CHIPIDEA=m && USB_GADGET=m) |
16 | help | 16 | help |
17 | Say Y here to enable device controller functionality of the | 17 | Say Y here to enable device controller functionality of the |
18 | ChipIdea driver. | 18 | ChipIdea driver. |
@@ -20,7 +20,7 @@ config USB_CHIPIDEA_UDC | |||
20 | config USB_CHIPIDEA_HOST | 20 | config USB_CHIPIDEA_HOST |
21 | bool "ChipIdea host controller" | 21 | bool "ChipIdea host controller" |
22 | depends on USB=y | 22 | depends on USB=y |
23 | depends on USB_EHCI_HCD=y || USB_CHIPIDEA=m | 23 | depends on USB_EHCI_HCD=y || (USB_CHIPIDEA=m && USB_EHCI_HCD=m) |
24 | select USB_EHCI_ROOT_HUB_TT | 24 | select USB_EHCI_ROOT_HUB_TT |
25 | help | 25 | help |
26 | Say Y here to enable host controller functionality of the | 26 | Say Y here to enable host controller functionality of the |
diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index aefa0261220c..1b23e354f9fb 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h | |||
@@ -50,7 +50,7 @@ | |||
50 | #define PORTSC_PTC (0x0FUL << 16) | 50 | #define PORTSC_PTC (0x0FUL << 16) |
51 | /* PTS and PTW for non lpm version only */ | 51 | /* PTS and PTW for non lpm version only */ |
52 | #define PORTSC_PTS(d) \ | 52 | #define PORTSC_PTS(d) \ |
53 | ((((d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 0)) | 53 | (u32)((((d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 0)) |
54 | #define PORTSC_PTW BIT(28) | 54 | #define PORTSC_PTW BIT(28) |
55 | #define PORTSC_STS BIT(29) | 55 | #define PORTSC_STS BIT(29) |
56 | 56 | ||
@@ -59,7 +59,7 @@ | |||
59 | #define DEVLC_PSPD_HS (0x02UL << 25) | 59 | #define DEVLC_PSPD_HS (0x02UL << 25) |
60 | #define DEVLC_PTW BIT(27) | 60 | #define DEVLC_PTW BIT(27) |
61 | #define DEVLC_STS BIT(28) | 61 | #define DEVLC_STS BIT(28) |
62 | #define DEVLC_PTS(d) (((d) & 0x7) << 29) | 62 | #define DEVLC_PTS(d) (u32)(((d) & 0x7) << 29) |
63 | 63 | ||
64 | /* Encoding for DEVLC_PTS and PORTSC_PTS */ | 64 | /* Encoding for DEVLC_PTS and PORTSC_PTS */ |
65 | #define PTS_UTMI 0 | 65 | #define PTS_UTMI 0 |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 4a8a1d68002c..558313de4911 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -4798,7 +4798,8 @@ static void hub_events(void) | |||
4798 | hub->ports[i - 1]->child; | 4798 | hub->ports[i - 1]->child; |
4799 | 4799 | ||
4800 | dev_dbg(hub_dev, "warm reset port %d\n", i); | 4800 | dev_dbg(hub_dev, "warm reset port %d\n", i); |
4801 | if (!udev) { | 4801 | if (!udev || !(portstatus & |
4802 | USB_PORT_STAT_CONNECTION)) { | ||
4802 | status = hub_port_reset(hub, i, | 4803 | status = hub_port_reset(hub, i, |
4803 | NULL, HUB_BH_RESET_TIME, | 4804 | NULL, HUB_BH_RESET_TIME, |
4804 | true); | 4805 | true); |
@@ -4808,8 +4809,8 @@ static void hub_events(void) | |||
4808 | usb_lock_device(udev); | 4809 | usb_lock_device(udev); |
4809 | status = usb_reset_device(udev); | 4810 | status = usb_reset_device(udev); |
4810 | usb_unlock_device(udev); | 4811 | usb_unlock_device(udev); |
4812 | connect_change = 0; | ||
4811 | } | 4813 | } |
4812 | connect_change = 0; | ||
4813 | } | 4814 | } |
4814 | 4815 | ||
4815 | if (connect_change) | 4816 | if (connect_change) |
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index f48712ffe261..c1c113ef950c 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -449,14 +449,20 @@ fail: | |||
449 | 449 | ||
450 | static int __exit eth_unbind(struct usb_composite_dev *cdev) | 450 | static int __exit eth_unbind(struct usb_composite_dev *cdev) |
451 | { | 451 | { |
452 | if (has_rndis()) | 452 | if (has_rndis()) { |
453 | usb_put_function(f_rndis); | ||
453 | usb_put_function_instance(fi_rndis); | 454 | usb_put_function_instance(fi_rndis); |
454 | if (use_eem) | 455 | } |
456 | if (use_eem) { | ||
457 | usb_put_function(f_eem); | ||
455 | usb_put_function_instance(fi_eem); | 458 | usb_put_function_instance(fi_eem); |
456 | else if (can_support_ecm(cdev->gadget)) | 459 | } else if (can_support_ecm(cdev->gadget)) { |
460 | usb_put_function(f_ecm); | ||
457 | usb_put_function_instance(fi_ecm); | 461 | usb_put_function_instance(fi_ecm); |
458 | else | 462 | } else { |
463 | usb_put_function(f_geth); | ||
459 | usb_put_function_instance(fi_geth); | 464 | usb_put_function_instance(fi_geth); |
465 | } | ||
460 | return 0; | 466 | return 0; |
461 | } | 467 | } |
462 | 468 | ||
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c index 1bf26e9f38cd..eb3aa817a662 100644 --- a/drivers/usb/gadget/f_phonet.c +++ b/drivers/usb/gadget/f_phonet.c | |||
@@ -488,7 +488,6 @@ static int pn_bind(struct usb_configuration *c, struct usb_function *f) | |||
488 | struct usb_ep *ep; | 488 | struct usb_ep *ep; |
489 | int status, i; | 489 | int status, i; |
490 | 490 | ||
491 | #ifndef USBF_PHONET_INCLUDED | ||
492 | struct f_phonet_opts *phonet_opts; | 491 | struct f_phonet_opts *phonet_opts; |
493 | 492 | ||
494 | phonet_opts = container_of(f->fi, struct f_phonet_opts, func_inst); | 493 | phonet_opts = container_of(f->fi, struct f_phonet_opts, func_inst); |
@@ -507,7 +506,6 @@ static int pn_bind(struct usb_configuration *c, struct usb_function *f) | |||
507 | return status; | 506 | return status; |
508 | phonet_opts->bound = true; | 507 | phonet_opts->bound = true; |
509 | } | 508 | } |
510 | #endif | ||
511 | 509 | ||
512 | /* Reserve interface IDs */ | 510 | /* Reserve interface IDs */ |
513 | status = usb_interface_id(c, f); | 511 | status = usb_interface_id(c, f); |
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c index 032b96a51ce4..2a1ebefd8f9e 100644 --- a/drivers/usb/gadget/multi.c +++ b/drivers/usb/gadget/multi.c | |||
@@ -160,10 +160,8 @@ static __init int rndis_do_config(struct usb_configuration *c) | |||
160 | return ret; | 160 | return ret; |
161 | 161 | ||
162 | f_acm_rndis = usb_get_function(fi_acm); | 162 | f_acm_rndis = usb_get_function(fi_acm); |
163 | if (IS_ERR(f_acm_rndis)) { | 163 | if (IS_ERR(f_acm_rndis)) |
164 | ret = PTR_ERR(f_acm_rndis); | 164 | return PTR_ERR(f_acm_rndis); |
165 | goto err_func_acm; | ||
166 | } | ||
167 | 165 | ||
168 | ret = usb_add_function(c, f_acm_rndis); | 166 | ret = usb_add_function(c, f_acm_rndis); |
169 | if (ret) | 167 | if (ret) |
@@ -178,7 +176,6 @@ err_fsg: | |||
178 | usb_remove_function(c, f_acm_rndis); | 176 | usb_remove_function(c, f_acm_rndis); |
179 | err_conf: | 177 | err_conf: |
180 | usb_put_function(f_acm_rndis); | 178 | usb_put_function(f_acm_rndis); |
181 | err_func_acm: | ||
182 | return ret; | 179 | return ret; |
183 | } | 180 | } |
184 | 181 | ||
@@ -226,7 +223,7 @@ static __init int cdc_do_config(struct usb_configuration *c) | |||
226 | /* implicit port_num is zero */ | 223 | /* implicit port_num is zero */ |
227 | f_acm_multi = usb_get_function(fi_acm); | 224 | f_acm_multi = usb_get_function(fi_acm); |
228 | if (IS_ERR(f_acm_multi)) | 225 | if (IS_ERR(f_acm_multi)) |
229 | goto err_func_acm; | 226 | return PTR_ERR(f_acm_multi); |
230 | 227 | ||
231 | ret = usb_add_function(c, f_acm_multi); | 228 | ret = usb_add_function(c, f_acm_multi); |
232 | if (ret) | 229 | if (ret) |
@@ -241,7 +238,6 @@ err_fsg: | |||
241 | usb_remove_function(c, f_acm_multi); | 238 | usb_remove_function(c, f_acm_multi); |
242 | err_conf: | 239 | err_conf: |
243 | usb_put_function(f_acm_multi); | 240 | usb_put_function(f_acm_multi); |
244 | err_func_acm: | ||
245 | return ret; | 241 | return ret; |
246 | } | 242 | } |
247 | 243 | ||
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index c28ac9872030..13e25f80fc20 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c | |||
@@ -109,7 +109,7 @@ void usb_gadget_set_state(struct usb_gadget *gadget, | |||
109 | enum usb_device_state state) | 109 | enum usb_device_state state) |
110 | { | 110 | { |
111 | gadget->state = state; | 111 | gadget->state = state; |
112 | sysfs_notify(&gadget->dev.kobj, NULL, "status"); | 112 | sysfs_notify(&gadget->dev.kobj, NULL, "state"); |
113 | } | 113 | } |
114 | EXPORT_SYMBOL_GPL(usb_gadget_set_state); | 114 | EXPORT_SYMBOL_GPL(usb_gadget_set_state); |
115 | 115 | ||
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index df6978abd7e6..6f8c2fd47675 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/dmapool.h> | 26 | #include <linux/dmapool.h> |
27 | #include <linux/dma-mapping.h> | ||
27 | 28 | ||
28 | #include "xhci.h" | 29 | #include "xhci.h" |
29 | 30 | ||
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 41eb4fc33453..9478caa2f71f 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/dmi.h> | 29 | #include <linux/dmi.h> |
30 | #include <linux/dma-mapping.h> | ||
30 | 31 | ||
31 | #include "xhci.h" | 32 | #include "xhci.h" |
32 | 33 | ||
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 6708a3b78ad8..f44e8b5e00c9 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -481,7 +481,7 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32); | |||
481 | 481 | ||
482 | static int omap2430_probe(struct platform_device *pdev) | 482 | static int omap2430_probe(struct platform_device *pdev) |
483 | { | 483 | { |
484 | struct resource musb_resources[2]; | 484 | struct resource musb_resources[3]; |
485 | struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; | 485 | struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; |
486 | struct omap_musb_board_data *data; | 486 | struct omap_musb_board_data *data; |
487 | struct platform_device *musb; | 487 | struct platform_device *musb; |
@@ -581,6 +581,11 @@ static int omap2430_probe(struct platform_device *pdev) | |||
581 | musb_resources[1].end = pdev->resource[1].end; | 581 | musb_resources[1].end = pdev->resource[1].end; |
582 | musb_resources[1].flags = pdev->resource[1].flags; | 582 | musb_resources[1].flags = pdev->resource[1].flags; |
583 | 583 | ||
584 | musb_resources[2].name = pdev->resource[2].name; | ||
585 | musb_resources[2].start = pdev->resource[2].start; | ||
586 | musb_resources[2].end = pdev->resource[2].end; | ||
587 | musb_resources[2].flags = pdev->resource[2].flags; | ||
588 | |||
584 | ret = platform_device_add_resources(musb, musb_resources, | 589 | ret = platform_device_add_resources(musb, musb_resources, |
585 | ARRAY_SIZE(musb_resources)); | 590 | ARRAY_SIZE(musb_resources)); |
586 | if (ret) { | 591 | if (ret) { |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 2c06a8969a9f..6f8a9ca96ae7 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -1156,7 +1156,7 @@ static u64 tusb_dmamask = DMA_BIT_MASK(32); | |||
1156 | 1156 | ||
1157 | static int tusb_probe(struct platform_device *pdev) | 1157 | static int tusb_probe(struct platform_device *pdev) |
1158 | { | 1158 | { |
1159 | struct resource musb_resources[2]; | 1159 | struct resource musb_resources[3]; |
1160 | struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; | 1160 | struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; |
1161 | struct platform_device *musb; | 1161 | struct platform_device *musb; |
1162 | struct tusb6010_glue *glue; | 1162 | struct tusb6010_glue *glue; |
@@ -1199,6 +1199,11 @@ static int tusb_probe(struct platform_device *pdev) | |||
1199 | musb_resources[1].end = pdev->resource[1].end; | 1199 | musb_resources[1].end = pdev->resource[1].end; |
1200 | musb_resources[1].flags = pdev->resource[1].flags; | 1200 | musb_resources[1].flags = pdev->resource[1].flags; |
1201 | 1201 | ||
1202 | musb_resources[2].name = pdev->resource[2].name; | ||
1203 | musb_resources[2].start = pdev->resource[2].start; | ||
1204 | musb_resources[2].end = pdev->resource[2].end; | ||
1205 | musb_resources[2].flags = pdev->resource[2].flags; | ||
1206 | |||
1202 | ret = platform_device_add_resources(musb, musb_resources, | 1207 | ret = platform_device_add_resources(musb, musb_resources, |
1203 | ARRAY_SIZE(musb_resources)); | 1208 | ARRAY_SIZE(musb_resources)); |
1204 | if (ret) { | 1209 | if (ret) { |
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index 8c3a42ea910c..7eef9b33fde6 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig | |||
@@ -719,6 +719,13 @@ config USB_SERIAL_FLASHLOADER | |||
719 | To compile this driver as a module, choose M here: the | 719 | To compile this driver as a module, choose M here: the |
720 | module will be called flashloader. | 720 | module will be called flashloader. |
721 | 721 | ||
722 | config USB_SERIAL_SUUNTO | ||
723 | tristate "USB Suunto ANT+ driver" | ||
724 | help | ||
725 | Say Y here if you want to use the Suunto ANT+ USB device. | ||
726 | |||
727 | To compile this driver as a module, choose M here: the | ||
728 | module will be called suunto. | ||
722 | 729 | ||
723 | config USB_SERIAL_DEBUG | 730 | config USB_SERIAL_DEBUG |
724 | tristate "USB Debugging Device" | 731 | tristate "USB Debugging Device" |
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index f7130114488f..a14a870d993f 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile | |||
@@ -54,6 +54,7 @@ obj-$(CONFIG_USB_SERIAL_SIEMENS_MPI) += siemens_mpi.o | |||
54 | obj-$(CONFIG_USB_SERIAL_SIERRAWIRELESS) += sierra.o | 54 | obj-$(CONFIG_USB_SERIAL_SIERRAWIRELESS) += sierra.o |
55 | obj-$(CONFIG_USB_SERIAL_SPCP8X5) += spcp8x5.o | 55 | obj-$(CONFIG_USB_SERIAL_SPCP8X5) += spcp8x5.o |
56 | obj-$(CONFIG_USB_SERIAL_SSU100) += ssu100.o | 56 | obj-$(CONFIG_USB_SERIAL_SSU100) += ssu100.o |
57 | obj-$(CONFIG_USB_SERIAL_SUUNTO) += suunto.o | ||
57 | obj-$(CONFIG_USB_SERIAL_SYMBOL) += symbolserial.o | 58 | obj-$(CONFIG_USB_SERIAL_SYMBOL) += symbolserial.o |
58 | obj-$(CONFIG_USB_SERIAL_WWAN) += usb_wwan.o | 59 | obj-$(CONFIG_USB_SERIAL_WWAN) += usb_wwan.o |
59 | obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o | 60 | obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 7260ec660347..b65e657c641d 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -735,9 +735,34 @@ static struct usb_device_id id_table_combined [] = { | |||
735 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), | 735 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), |
736 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | 736 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, |
737 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, | 737 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
738 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, | 738 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, |
739 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) }, | 739 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, |
740 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_RTS01_PID) }, | 740 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) }, |
741 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57B_PID) }, | ||
742 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29A_PID) }, | ||
743 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29B_PID) }, | ||
744 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29F_PID) }, | ||
745 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_62B_PID) }, | ||
746 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S01_PID) }, | ||
747 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_63_PID) }, | ||
748 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29C_PID) }, | ||
749 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_81B_PID) }, | ||
750 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_82B_PID) }, | ||
751 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K5D_PID) }, | ||
752 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K4Y_PID) }, | ||
753 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K5G_PID) }, | ||
754 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S05_PID) }, | ||
755 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_60_PID) }, | ||
756 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_61_PID) }, | ||
757 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_62_PID) }, | ||
758 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_63B_PID) }, | ||
759 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_64_PID) }, | ||
760 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_65_PID) }, | ||
761 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_92_PID) }, | ||
762 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_92D_PID) }, | ||
763 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_W5R_PID) }, | ||
764 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_A5R_PID) }, | ||
765 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_PW1_PID) }, | ||
741 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, | 766 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, |
742 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, | 767 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, |
743 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, | 768 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 6dd79253205d..1b8af461b522 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -815,11 +815,35 @@ | |||
815 | /* | 815 | /* |
816 | * RT Systems programming cables for various ham radios | 816 | * RT Systems programming cables for various ham radios |
817 | */ | 817 | */ |
818 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ | 818 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ |
819 | #define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ | 819 | #define RTSYSTEMS_USB_S03_PID 0x9001 /* RTS-03 USB to Serial Adapter */ |
820 | #define RTSYSTEMS_CT29B_PID 0x9e54 /* CT29B Radio Cable */ | 820 | #define RTSYSTEMS_USB_59_PID 0x9e50 /* USB-59 USB to 8 pin plug */ |
821 | #define RTSYSTEMS_RTS01_PID 0x9e57 /* USB-RTS01 Radio Cable */ | 821 | #define RTSYSTEMS_USB_57A_PID 0x9e51 /* USB-57A USB to 4pin 3.5mm plug */ |
822 | 822 | #define RTSYSTEMS_USB_57B_PID 0x9e52 /* USB-57B USB to extended 4pin 3.5mm plug */ | |
823 | #define RTSYSTEMS_USB_29A_PID 0x9e53 /* USB-29A USB to 3.5mm stereo plug */ | ||
824 | #define RTSYSTEMS_USB_29B_PID 0x9e54 /* USB-29B USB to 6 pin mini din */ | ||
825 | #define RTSYSTEMS_USB_29F_PID 0x9e55 /* USB-29F USB to 6 pin modular plug */ | ||
826 | #define RTSYSTEMS_USB_62B_PID 0x9e56 /* USB-62B USB to 8 pin mini din plug*/ | ||
827 | #define RTSYSTEMS_USB_S01_PID 0x9e57 /* USB-RTS01 USB to 3.5 mm stereo plug*/ | ||
828 | #define RTSYSTEMS_USB_63_PID 0x9e58 /* USB-63 USB to 9 pin female*/ | ||
829 | #define RTSYSTEMS_USB_29C_PID 0x9e59 /* USB-29C USB to 4 pin modular plug*/ | ||
830 | #define RTSYSTEMS_USB_81B_PID 0x9e5A /* USB-81 USB to 8 pin mini din plug*/ | ||
831 | #define RTSYSTEMS_USB_82B_PID 0x9e5B /* USB-82 USB to 2.5 mm stereo plug*/ | ||
832 | #define RTSYSTEMS_USB_K5D_PID 0x9e5C /* USB-K5D USB to 8 pin modular plug*/ | ||
833 | #define RTSYSTEMS_USB_K4Y_PID 0x9e5D /* USB-K4Y USB to 2.5/3.5 mm plugs*/ | ||
834 | #define RTSYSTEMS_USB_K5G_PID 0x9e5E /* USB-K5G USB to 8 pin modular plug*/ | ||
835 | #define RTSYSTEMS_USB_S05_PID 0x9e5F /* USB-RTS05 USB to 2.5 mm stereo plug*/ | ||
836 | #define RTSYSTEMS_USB_60_PID 0x9e60 /* USB-60 USB to 6 pin din*/ | ||
837 | #define RTSYSTEMS_USB_61_PID 0x9e61 /* USB-61 USB to 6 pin mini din*/ | ||
838 | #define RTSYSTEMS_USB_62_PID 0x9e62 /* USB-62 USB to 8 pin mini din*/ | ||
839 | #define RTSYSTEMS_USB_63B_PID 0x9e63 /* USB-63 USB to 9 pin female*/ | ||
840 | #define RTSYSTEMS_USB_64_PID 0x9e64 /* USB-64 USB to 9 pin male*/ | ||
841 | #define RTSYSTEMS_USB_65_PID 0x9e65 /* USB-65 USB to 9 pin female null modem*/ | ||
842 | #define RTSYSTEMS_USB_92_PID 0x9e66 /* USB-92 USB to 12 pin plug*/ | ||
843 | #define RTSYSTEMS_USB_92D_PID 0x9e67 /* USB-92D USB to 12 pin plug data*/ | ||
844 | #define RTSYSTEMS_USB_W5R_PID 0x9e68 /* USB-W5R USB to 8 pin modular plug*/ | ||
845 | #define RTSYSTEMS_USB_A5R_PID 0x9e69 /* USB-A5R USB to 8 pin modular plug*/ | ||
846 | #define RTSYSTEMS_USB_PW1_PID 0x9e6A /* USB-PW1 USB to 8 pin modular plug*/ | ||
823 | 847 | ||
824 | /* | 848 | /* |
825 | * Physik Instrumente | 849 | * Physik Instrumente |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 603fb70dde80..d953d674f222 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -183,7 +183,10 @@ | |||
183 | #define LED_ON_MS 500 | 183 | #define LED_ON_MS 500 |
184 | #define LED_OFF_MS 500 | 184 | #define LED_OFF_MS 500 |
185 | 185 | ||
186 | static int device_type; | 186 | enum mos7840_flag { |
187 | MOS7840_FLAG_CTRL_BUSY, | ||
188 | MOS7840_FLAG_LED_BUSY, | ||
189 | }; | ||
187 | 190 | ||
188 | static const struct usb_device_id id_table[] = { | 191 | static const struct usb_device_id id_table[] = { |
189 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, | 192 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, |
@@ -238,9 +241,12 @@ struct moschip_port { | |||
238 | 241 | ||
239 | /* For device(s) with LED indicator */ | 242 | /* For device(s) with LED indicator */ |
240 | bool has_led; | 243 | bool has_led; |
241 | bool led_flag; | ||
242 | struct timer_list led_timer1; /* Timer for LED on */ | 244 | struct timer_list led_timer1; /* Timer for LED on */ |
243 | struct timer_list led_timer2; /* Timer for LED off */ | 245 | struct timer_list led_timer2; /* Timer for LED off */ |
246 | struct urb *led_urb; | ||
247 | struct usb_ctrlrequest *led_dr; | ||
248 | |||
249 | unsigned long flags; | ||
244 | }; | 250 | }; |
245 | 251 | ||
246 | /* | 252 | /* |
@@ -460,10 +466,10 @@ static void mos7840_control_callback(struct urb *urb) | |||
460 | case -ESHUTDOWN: | 466 | case -ESHUTDOWN: |
461 | /* this urb is terminated, clean up */ | 467 | /* this urb is terminated, clean up */ |
462 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status); | 468 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status); |
463 | return; | 469 | goto out; |
464 | default: | 470 | default: |
465 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); | 471 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); |
466 | return; | 472 | goto out; |
467 | } | 473 | } |
468 | 474 | ||
469 | dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length); | 475 | dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length); |
@@ -476,6 +482,8 @@ static void mos7840_control_callback(struct urb *urb) | |||
476 | mos7840_handle_new_msr(mos7840_port, regval); | 482 | mos7840_handle_new_msr(mos7840_port, regval); |
477 | else if (mos7840_port->MsrLsr == 1) | 483 | else if (mos7840_port->MsrLsr == 1) |
478 | mos7840_handle_new_lsr(mos7840_port, regval); | 484 | mos7840_handle_new_lsr(mos7840_port, regval); |
485 | out: | ||
486 | clear_bit_unlock(MOS7840_FLAG_CTRL_BUSY, &mos7840_port->flags); | ||
479 | } | 487 | } |
480 | 488 | ||
481 | static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, | 489 | static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, |
@@ -486,6 +494,9 @@ static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, | |||
486 | unsigned char *buffer = mcs->ctrl_buf; | 494 | unsigned char *buffer = mcs->ctrl_buf; |
487 | int ret; | 495 | int ret; |
488 | 496 | ||
497 | if (test_and_set_bit_lock(MOS7840_FLAG_CTRL_BUSY, &mcs->flags)) | ||
498 | return -EBUSY; | ||
499 | |||
489 | dr->bRequestType = MCS_RD_RTYPE; | 500 | dr->bRequestType = MCS_RD_RTYPE; |
490 | dr->bRequest = MCS_RDREQ; | 501 | dr->bRequest = MCS_RDREQ; |
491 | dr->wValue = cpu_to_le16(Wval); /* 0 */ | 502 | dr->wValue = cpu_to_le16(Wval); /* 0 */ |
@@ -497,6 +508,9 @@ static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, | |||
497 | mos7840_control_callback, mcs); | 508 | mos7840_control_callback, mcs); |
498 | mcs->control_urb->transfer_buffer_length = 2; | 509 | mcs->control_urb->transfer_buffer_length = 2; |
499 | ret = usb_submit_urb(mcs->control_urb, GFP_ATOMIC); | 510 | ret = usb_submit_urb(mcs->control_urb, GFP_ATOMIC); |
511 | if (ret) | ||
512 | clear_bit_unlock(MOS7840_FLAG_CTRL_BUSY, &mcs->flags); | ||
513 | |||
500 | return ret; | 514 | return ret; |
501 | } | 515 | } |
502 | 516 | ||
@@ -523,7 +537,7 @@ static void mos7840_set_led_async(struct moschip_port *mcs, __u16 wval, | |||
523 | __u16 reg) | 537 | __u16 reg) |
524 | { | 538 | { |
525 | struct usb_device *dev = mcs->port->serial->dev; | 539 | struct usb_device *dev = mcs->port->serial->dev; |
526 | struct usb_ctrlrequest *dr = mcs->dr; | 540 | struct usb_ctrlrequest *dr = mcs->led_dr; |
527 | 541 | ||
528 | dr->bRequestType = MCS_WR_RTYPE; | 542 | dr->bRequestType = MCS_WR_RTYPE; |
529 | dr->bRequest = MCS_WRREQ; | 543 | dr->bRequest = MCS_WRREQ; |
@@ -531,10 +545,10 @@ static void mos7840_set_led_async(struct moschip_port *mcs, __u16 wval, | |||
531 | dr->wIndex = cpu_to_le16(reg); | 545 | dr->wIndex = cpu_to_le16(reg); |
532 | dr->wLength = cpu_to_le16(0); | 546 | dr->wLength = cpu_to_le16(0); |
533 | 547 | ||
534 | usb_fill_control_urb(mcs->control_urb, dev, usb_sndctrlpipe(dev, 0), | 548 | usb_fill_control_urb(mcs->led_urb, dev, usb_sndctrlpipe(dev, 0), |
535 | (unsigned char *)dr, NULL, 0, mos7840_set_led_callback, NULL); | 549 | (unsigned char *)dr, NULL, 0, mos7840_set_led_callback, NULL); |
536 | 550 | ||
537 | usb_submit_urb(mcs->control_urb, GFP_ATOMIC); | 551 | usb_submit_urb(mcs->led_urb, GFP_ATOMIC); |
538 | } | 552 | } |
539 | 553 | ||
540 | static void mos7840_set_led_sync(struct usb_serial_port *port, __u16 reg, | 554 | static void mos7840_set_led_sync(struct usb_serial_port *port, __u16 reg, |
@@ -560,7 +574,19 @@ static void mos7840_led_flag_off(unsigned long arg) | |||
560 | { | 574 | { |
561 | struct moschip_port *mcs = (struct moschip_port *) arg; | 575 | struct moschip_port *mcs = (struct moschip_port *) arg; |
562 | 576 | ||
563 | mcs->led_flag = false; | 577 | clear_bit_unlock(MOS7840_FLAG_LED_BUSY, &mcs->flags); |
578 | } | ||
579 | |||
580 | static void mos7840_led_activity(struct usb_serial_port *port) | ||
581 | { | ||
582 | struct moschip_port *mos7840_port = usb_get_serial_port_data(port); | ||
583 | |||
584 | if (test_and_set_bit_lock(MOS7840_FLAG_LED_BUSY, &mos7840_port->flags)) | ||
585 | return; | ||
586 | |||
587 | mos7840_set_led_async(mos7840_port, 0x0301, MODEM_CONTROL_REGISTER); | ||
588 | mod_timer(&mos7840_port->led_timer1, | ||
589 | jiffies + msecs_to_jiffies(LED_ON_MS)); | ||
564 | } | 590 | } |
565 | 591 | ||
566 | /***************************************************************************** | 592 | /***************************************************************************** |
@@ -758,14 +784,8 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
758 | return; | 784 | return; |
759 | } | 785 | } |
760 | 786 | ||
761 | /* Turn on LED */ | 787 | if (mos7840_port->has_led) |
762 | if (mos7840_port->has_led && !mos7840_port->led_flag) { | 788 | mos7840_led_activity(port); |
763 | mos7840_port->led_flag = true; | ||
764 | mos7840_set_led_async(mos7840_port, 0x0301, | ||
765 | MODEM_CONTROL_REGISTER); | ||
766 | mod_timer(&mos7840_port->led_timer1, | ||
767 | jiffies + msecs_to_jiffies(LED_ON_MS)); | ||
768 | } | ||
769 | 789 | ||
770 | mos7840_port->read_urb_busy = true; | 790 | mos7840_port->read_urb_busy = true; |
771 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 791 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
@@ -816,18 +836,6 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) | |||
816 | /************************************************************************/ | 836 | /************************************************************************/ |
817 | /* D R I V E R T T Y I N T E R F A C E F U N C T I O N S */ | 837 | /* D R I V E R T T Y I N T E R F A C E F U N C T I O N S */ |
818 | /************************************************************************/ | 838 | /************************************************************************/ |
819 | #ifdef MCSSerialProbe | ||
820 | static int mos7840_serial_probe(struct usb_serial *serial, | ||
821 | const struct usb_device_id *id) | ||
822 | { | ||
823 | |||
824 | /*need to implement the mode_reg reading and updating\ | ||
825 | structures usb_serial_ device_type\ | ||
826 | (i.e num_ports, num_bulkin,bulkout etc) */ | ||
827 | /* Also we can update the changes attach */ | ||
828 | return 1; | ||
829 | } | ||
830 | #endif | ||
831 | 839 | ||
832 | /***************************************************************************** | 840 | /***************************************************************************** |
833 | * mos7840_open | 841 | * mos7840_open |
@@ -1454,13 +1462,8 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1454 | data1 = urb->transfer_buffer; | 1462 | data1 = urb->transfer_buffer; |
1455 | dev_dbg(&port->dev, "bulkout endpoint is %d\n", port->bulk_out_endpointAddress); | 1463 | dev_dbg(&port->dev, "bulkout endpoint is %d\n", port->bulk_out_endpointAddress); |
1456 | 1464 | ||
1457 | /* Turn on LED */ | 1465 | if (mos7840_port->has_led) |
1458 | if (mos7840_port->has_led && !mos7840_port->led_flag) { | 1466 | mos7840_led_activity(port); |
1459 | mos7840_port->led_flag = true; | ||
1460 | mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0301); | ||
1461 | mod_timer(&mos7840_port->led_timer1, | ||
1462 | jiffies + msecs_to_jiffies(LED_ON_MS)); | ||
1463 | } | ||
1464 | 1467 | ||
1465 | /* send it down the pipe */ | 1468 | /* send it down the pipe */ |
1466 | status = usb_submit_urb(urb, GFP_ATOMIC); | 1469 | status = usb_submit_urb(urb, GFP_ATOMIC); |
@@ -2187,38 +2190,48 @@ static int mos7810_check(struct usb_serial *serial) | |||
2187 | return 0; | 2190 | return 0; |
2188 | } | 2191 | } |
2189 | 2192 | ||
2190 | static int mos7840_calc_num_ports(struct usb_serial *serial) | 2193 | static int mos7840_probe(struct usb_serial *serial, |
2194 | const struct usb_device_id *id) | ||
2191 | { | 2195 | { |
2192 | __u16 data = 0x00; | 2196 | u16 product = serial->dev->descriptor.idProduct; |
2193 | u8 *buf; | 2197 | u8 *buf; |
2194 | int mos7840_num_ports; | 2198 | int device_type; |
2199 | |||
2200 | if (product == MOSCHIP_DEVICE_ID_7810 || | ||
2201 | product == MOSCHIP_DEVICE_ID_7820) { | ||
2202 | device_type = product; | ||
2203 | goto out; | ||
2204 | } | ||
2195 | 2205 | ||
2196 | buf = kzalloc(VENDOR_READ_LENGTH, GFP_KERNEL); | 2206 | buf = kzalloc(VENDOR_READ_LENGTH, GFP_KERNEL); |
2197 | if (buf) { | 2207 | if (!buf) |
2198 | usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 2208 | return -ENOMEM; |
2209 | |||
2210 | usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | ||
2199 | MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, buf, | 2211 | MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, buf, |
2200 | VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); | 2212 | VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); |
2201 | data = *buf; | ||
2202 | kfree(buf); | ||
2203 | } | ||
2204 | 2213 | ||
2205 | if (serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 || | 2214 | /* For a MCS7840 device GPIO0 must be set to 1 */ |
2206 | serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) { | 2215 | if (buf[0] & 0x01) |
2207 | device_type = serial->dev->descriptor.idProduct; | 2216 | device_type = MOSCHIP_DEVICE_ID_7840; |
2208 | } else { | 2217 | else if (mos7810_check(serial)) |
2209 | /* For a MCS7840 device GPIO0 must be set to 1 */ | 2218 | device_type = MOSCHIP_DEVICE_ID_7810; |
2210 | if ((data & 0x01) == 1) | 2219 | else |
2211 | device_type = MOSCHIP_DEVICE_ID_7840; | 2220 | device_type = MOSCHIP_DEVICE_ID_7820; |
2212 | else if (mos7810_check(serial)) | 2221 | |
2213 | device_type = MOSCHIP_DEVICE_ID_7810; | 2222 | kfree(buf); |
2214 | else | 2223 | out: |
2215 | device_type = MOSCHIP_DEVICE_ID_7820; | 2224 | usb_set_serial_data(serial, (void *)(unsigned long)device_type); |
2216 | } | 2225 | |
2226 | return 0; | ||
2227 | } | ||
2228 | |||
2229 | static int mos7840_calc_num_ports(struct usb_serial *serial) | ||
2230 | { | ||
2231 | int device_type = (unsigned long)usb_get_serial_data(serial); | ||
2232 | int mos7840_num_ports; | ||
2217 | 2233 | ||
2218 | mos7840_num_ports = (device_type >> 4) & 0x000F; | 2234 | mos7840_num_ports = (device_type >> 4) & 0x000F; |
2219 | serial->num_bulk_in = mos7840_num_ports; | ||
2220 | serial->num_bulk_out = mos7840_num_ports; | ||
2221 | serial->num_ports = mos7840_num_ports; | ||
2222 | 2235 | ||
2223 | return mos7840_num_ports; | 2236 | return mos7840_num_ports; |
2224 | } | 2237 | } |
@@ -2226,6 +2239,7 @@ static int mos7840_calc_num_ports(struct usb_serial *serial) | |||
2226 | static int mos7840_port_probe(struct usb_serial_port *port) | 2239 | static int mos7840_port_probe(struct usb_serial_port *port) |
2227 | { | 2240 | { |
2228 | struct usb_serial *serial = port->serial; | 2241 | struct usb_serial *serial = port->serial; |
2242 | int device_type = (unsigned long)usb_get_serial_data(serial); | ||
2229 | struct moschip_port *mos7840_port; | 2243 | struct moschip_port *mos7840_port; |
2230 | int status; | 2244 | int status; |
2231 | int pnum; | 2245 | int pnum; |
@@ -2401,6 +2415,14 @@ static int mos7840_port_probe(struct usb_serial_port *port) | |||
2401 | if (device_type == MOSCHIP_DEVICE_ID_7810) { | 2415 | if (device_type == MOSCHIP_DEVICE_ID_7810) { |
2402 | mos7840_port->has_led = true; | 2416 | mos7840_port->has_led = true; |
2403 | 2417 | ||
2418 | mos7840_port->led_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
2419 | mos7840_port->led_dr = kmalloc(sizeof(*mos7840_port->led_dr), | ||
2420 | GFP_KERNEL); | ||
2421 | if (!mos7840_port->led_urb || !mos7840_port->led_dr) { | ||
2422 | status = -ENOMEM; | ||
2423 | goto error; | ||
2424 | } | ||
2425 | |||
2404 | init_timer(&mos7840_port->led_timer1); | 2426 | init_timer(&mos7840_port->led_timer1); |
2405 | mos7840_port->led_timer1.function = mos7840_led_off; | 2427 | mos7840_port->led_timer1.function = mos7840_led_off; |
2406 | mos7840_port->led_timer1.expires = | 2428 | mos7840_port->led_timer1.expires = |
@@ -2413,8 +2435,6 @@ static int mos7840_port_probe(struct usb_serial_port *port) | |||
2413 | jiffies + msecs_to_jiffies(LED_OFF_MS); | 2435 | jiffies + msecs_to_jiffies(LED_OFF_MS); |
2414 | mos7840_port->led_timer2.data = (unsigned long)mos7840_port; | 2436 | mos7840_port->led_timer2.data = (unsigned long)mos7840_port; |
2415 | 2437 | ||
2416 | mos7840_port->led_flag = false; | ||
2417 | |||
2418 | /* Turn off LED */ | 2438 | /* Turn off LED */ |
2419 | mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0300); | 2439 | mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0300); |
2420 | } | 2440 | } |
@@ -2436,6 +2456,8 @@ out: | |||
2436 | } | 2456 | } |
2437 | return 0; | 2457 | return 0; |
2438 | error: | 2458 | error: |
2459 | kfree(mos7840_port->led_dr); | ||
2460 | usb_free_urb(mos7840_port->led_urb); | ||
2439 | kfree(mos7840_port->dr); | 2461 | kfree(mos7840_port->dr); |
2440 | kfree(mos7840_port->ctrl_buf); | 2462 | kfree(mos7840_port->ctrl_buf); |
2441 | usb_free_urb(mos7840_port->control_urb); | 2463 | usb_free_urb(mos7840_port->control_urb); |
@@ -2456,6 +2478,10 @@ static int mos7840_port_remove(struct usb_serial_port *port) | |||
2456 | 2478 | ||
2457 | del_timer_sync(&mos7840_port->led_timer1); | 2479 | del_timer_sync(&mos7840_port->led_timer1); |
2458 | del_timer_sync(&mos7840_port->led_timer2); | 2480 | del_timer_sync(&mos7840_port->led_timer2); |
2481 | |||
2482 | usb_kill_urb(mos7840_port->led_urb); | ||
2483 | usb_free_urb(mos7840_port->led_urb); | ||
2484 | kfree(mos7840_port->led_dr); | ||
2459 | } | 2485 | } |
2460 | usb_kill_urb(mos7840_port->control_urb); | 2486 | usb_kill_urb(mos7840_port->control_urb); |
2461 | usb_free_urb(mos7840_port->control_urb); | 2487 | usb_free_urb(mos7840_port->control_urb); |
@@ -2482,9 +2508,7 @@ static struct usb_serial_driver moschip7840_4port_device = { | |||
2482 | .throttle = mos7840_throttle, | 2508 | .throttle = mos7840_throttle, |
2483 | .unthrottle = mos7840_unthrottle, | 2509 | .unthrottle = mos7840_unthrottle, |
2484 | .calc_num_ports = mos7840_calc_num_ports, | 2510 | .calc_num_ports = mos7840_calc_num_ports, |
2485 | #ifdef MCSSerialProbe | 2511 | .probe = mos7840_probe, |
2486 | .probe = mos7840_serial_probe, | ||
2487 | #endif | ||
2488 | .ioctl = mos7840_ioctl, | 2512 | .ioctl = mos7840_ioctl, |
2489 | .set_termios = mos7840_set_termios, | 2513 | .set_termios = mos7840_set_termios, |
2490 | .break_ctl = mos7840_break, | 2514 | .break_ctl = mos7840_break, |
diff --git a/drivers/usb/serial/suunto.c b/drivers/usb/serial/suunto.c new file mode 100644 index 000000000000..2248e7a7d5ad --- /dev/null +++ b/drivers/usb/serial/suunto.c | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * Suunto ANT+ USB Driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> | ||
5 | * Copyright (C) 2013 Linux Foundation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation only. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/tty.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/usb.h> | ||
17 | #include <linux/usb/serial.h> | ||
18 | #include <linux/uaccess.h> | ||
19 | |||
20 | static const struct usb_device_id id_table[] = { | ||
21 | { USB_DEVICE(0x0fcf, 0x1008) }, | ||
22 | { }, | ||
23 | }; | ||
24 | MODULE_DEVICE_TABLE(usb, id_table); | ||
25 | |||
26 | static struct usb_serial_driver suunto_device = { | ||
27 | .driver = { | ||
28 | .owner = THIS_MODULE, | ||
29 | .name = KBUILD_MODNAME, | ||
30 | }, | ||
31 | .id_table = id_table, | ||
32 | .num_ports = 1, | ||
33 | }; | ||
34 | |||
35 | static struct usb_serial_driver * const serial_drivers[] = { | ||
36 | &suunto_device, | ||
37 | NULL, | ||
38 | }; | ||
39 | |||
40 | module_usb_serial_driver(serial_drivers, id_table); | ||
41 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index c5179e269df6..cef6002acbd4 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c | |||
@@ -137,8 +137,27 @@ static void vfio_pci_disable(struct vfio_pci_device *vdev) | |||
137 | */ | 137 | */ |
138 | pci_write_config_word(pdev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE); | 138 | pci_write_config_word(pdev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE); |
139 | 139 | ||
140 | if (vdev->reset_works) | 140 | /* |
141 | __pci_reset_function(pdev); | 141 | * Careful, device_lock may already be held. This is the case if |
142 | * a driver unbind is blocked. Try to get the locks ourselves to | ||
143 | * prevent a deadlock. | ||
144 | */ | ||
145 | if (vdev->reset_works) { | ||
146 | bool reset_done = false; | ||
147 | |||
148 | if (pci_cfg_access_trylock(pdev)) { | ||
149 | if (device_trylock(&pdev->dev)) { | ||
150 | __pci_reset_function_locked(pdev); | ||
151 | reset_done = true; | ||
152 | device_unlock(&pdev->dev); | ||
153 | } | ||
154 | pci_cfg_access_unlock(pdev); | ||
155 | } | ||
156 | |||
157 | if (!reset_done) | ||
158 | pr_warn("%s: Unable to acquire locks for reset of %s\n", | ||
159 | __func__, dev_name(&pdev->dev)); | ||
160 | } | ||
142 | 161 | ||
143 | pci_restore_state(pdev); | 162 | pci_restore_state(pdev); |
144 | } | 163 | } |
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index c488da5db7c7..842f4507883e 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c | |||
@@ -494,27 +494,6 @@ static int vfio_group_nb_add_dev(struct vfio_group *group, struct device *dev) | |||
494 | return 0; | 494 | return 0; |
495 | } | 495 | } |
496 | 496 | ||
497 | static int vfio_group_nb_del_dev(struct vfio_group *group, struct device *dev) | ||
498 | { | ||
499 | struct vfio_device *device; | ||
500 | |||
501 | /* | ||
502 | * Expect to fall out here. If a device was in use, it would | ||
503 | * have been bound to a vfio sub-driver, which would have blocked | ||
504 | * in .remove at vfio_del_group_dev. Sanity check that we no | ||
505 | * longer track the device, so it's safe to remove. | ||
506 | */ | ||
507 | device = vfio_group_get_device(group, dev); | ||
508 | if (likely(!device)) | ||
509 | return 0; | ||
510 | |||
511 | WARN("Device %s removed from live group %d!\n", dev_name(dev), | ||
512 | iommu_group_id(group->iommu_group)); | ||
513 | |||
514 | vfio_device_put(device); | ||
515 | return 0; | ||
516 | } | ||
517 | |||
518 | static int vfio_group_nb_verify(struct vfio_group *group, struct device *dev) | 497 | static int vfio_group_nb_verify(struct vfio_group *group, struct device *dev) |
519 | { | 498 | { |
520 | /* We don't care what happens when the group isn't in use */ | 499 | /* We don't care what happens when the group isn't in use */ |
@@ -531,13 +510,11 @@ static int vfio_iommu_group_notifier(struct notifier_block *nb, | |||
531 | struct device *dev = data; | 510 | struct device *dev = data; |
532 | 511 | ||
533 | /* | 512 | /* |
534 | * Need to go through a group_lock lookup to get a reference or | 513 | * Need to go through a group_lock lookup to get a reference or we |
535 | * we risk racing a group being removed. Leave a WARN_ON for | 514 | * risk racing a group being removed. Ignore spurious notifies. |
536 | * debuging, but if the group no longer exists, a spurious notify | ||
537 | * is harmless. | ||
538 | */ | 515 | */ |
539 | group = vfio_group_try_get(group); | 516 | group = vfio_group_try_get(group); |
540 | if (WARN_ON(!group)) | 517 | if (!group) |
541 | return NOTIFY_OK; | 518 | return NOTIFY_OK; |
542 | 519 | ||
543 | switch (action) { | 520 | switch (action) { |
@@ -545,7 +522,13 @@ static int vfio_iommu_group_notifier(struct notifier_block *nb, | |||
545 | vfio_group_nb_add_dev(group, dev); | 522 | vfio_group_nb_add_dev(group, dev); |
546 | break; | 523 | break; |
547 | case IOMMU_GROUP_NOTIFY_DEL_DEVICE: | 524 | case IOMMU_GROUP_NOTIFY_DEL_DEVICE: |
548 | vfio_group_nb_del_dev(group, dev); | 525 | /* |
526 | * Nothing to do here. If the device is in use, then the | ||
527 | * vfio sub-driver should block the remove callback until | ||
528 | * it is unused. If the device is unused or attached to a | ||
529 | * stub driver, then it should be released and we don't | ||
530 | * care that it will be going away. | ||
531 | */ | ||
549 | break; | 532 | break; |
550 | case IOMMU_GROUP_NOTIFY_BIND_DRIVER: | 533 | case IOMMU_GROUP_NOTIFY_BIND_DRIVER: |
551 | pr_debug("%s: Device %s, group %d binding to driver\n", | 534 | pr_debug("%s: Device %s, group %d binding to driver\n", |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index a89c15de9f45..9b0f12c5c284 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -435,8 +435,8 @@ static int correct_chipset(struct atyfb_par *par) | |||
435 | const char *name; | 435 | const char *name; |
436 | int i; | 436 | int i; |
437 | 437 | ||
438 | for (i = ARRAY_SIZE(aty_chips); i > 0; i--) | 438 | for (i = (int)ARRAY_SIZE(aty_chips) - 1; i >= 0; i--) |
439 | if (par->pci_id == aty_chips[i - 1].pci_id) | 439 | if (par->pci_id == aty_chips[i].pci_id) |
440 | break; | 440 | break; |
441 | 441 | ||
442 | if (i < 0) | 442 | if (i < 0) |
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 3ba37713b1f9..dc09ebe4aba5 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c | |||
@@ -239,24 +239,6 @@ static const struct fb_bitfield def_rgb565[] = { | |||
239 | } | 239 | } |
240 | }; | 240 | }; |
241 | 241 | ||
242 | static const struct fb_bitfield def_rgb666[] = { | ||
243 | [RED] = { | ||
244 | .offset = 16, | ||
245 | .length = 6, | ||
246 | }, | ||
247 | [GREEN] = { | ||
248 | .offset = 8, | ||
249 | .length = 6, | ||
250 | }, | ||
251 | [BLUE] = { | ||
252 | .offset = 0, | ||
253 | .length = 6, | ||
254 | }, | ||
255 | [TRANSP] = { /* no support for transparency */ | ||
256 | .length = 0, | ||
257 | } | ||
258 | }; | ||
259 | |||
260 | static const struct fb_bitfield def_rgb888[] = { | 242 | static const struct fb_bitfield def_rgb888[] = { |
261 | [RED] = { | 243 | [RED] = { |
262 | .offset = 16, | 244 | .offset = 16, |
@@ -309,9 +291,6 @@ static int mxsfb_check_var(struct fb_var_screeninfo *var, | |||
309 | break; | 291 | break; |
310 | case STMLCDIF_16BIT: | 292 | case STMLCDIF_16BIT: |
311 | case STMLCDIF_18BIT: | 293 | case STMLCDIF_18BIT: |
312 | /* 24 bit to 18 bit mapping */ | ||
313 | rgb = def_rgb666; | ||
314 | break; | ||
315 | case STMLCDIF_24BIT: | 294 | case STMLCDIF_24BIT: |
316 | /* real 24 bit */ | 295 | /* real 24 bit */ |
317 | rgb = def_rgb888; | 296 | rgb = def_rgb888; |
@@ -453,11 +432,6 @@ static int mxsfb_set_par(struct fb_info *fb_info) | |||
453 | return -EINVAL; | 432 | return -EINVAL; |
454 | case STMLCDIF_16BIT: | 433 | case STMLCDIF_16BIT: |
455 | case STMLCDIF_18BIT: | 434 | case STMLCDIF_18BIT: |
456 | /* 24 bit to 18 bit mapping */ | ||
457 | ctrl |= CTRL_DF24; /* ignore the upper 2 bits in | ||
458 | * each colour component | ||
459 | */ | ||
460 | break; | ||
461 | case STMLCDIF_24BIT: | 435 | case STMLCDIF_24BIT: |
462 | /* real 24 bit */ | 436 | /* real 24 bit */ |
463 | break; | 437 | break; |
diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c index 8c527e5b293c..796e5112ceee 100644 --- a/drivers/video/nuc900fb.c +++ b/drivers/video/nuc900fb.c | |||
@@ -587,8 +587,7 @@ static int nuc900fb_probe(struct platform_device *pdev) | |||
587 | fbinfo->flags = FBINFO_FLAG_DEFAULT; | 587 | fbinfo->flags = FBINFO_FLAG_DEFAULT; |
588 | fbinfo->pseudo_palette = &fbi->pseudo_pal; | 588 | fbinfo->pseudo_palette = &fbi->pseudo_pal; |
589 | 589 | ||
590 | ret = request_irq(irq, nuc900fb_irqhandler, 0, | 590 | ret = request_irq(irq, nuc900fb_irqhandler, 0, pdev->name, fbi); |
591 | pdev->name, fbinfo); | ||
592 | if (ret) { | 591 | if (ret) { |
593 | dev_err(&pdev->dev, "cannot register irq handler %d -err %d\n", | 592 | dev_err(&pdev->dev, "cannot register irq handler %d -err %d\n", |
594 | irq, ret); | 593 | irq, ret); |
diff --git a/drivers/video/omap2/displays-new/connector-analog-tv.c b/drivers/video/omap2/displays-new/connector-analog-tv.c index 5338f362293b..1b60698f141e 100644 --- a/drivers/video/omap2/displays-new/connector-analog-tv.c +++ b/drivers/video/omap2/displays-new/connector-analog-tv.c | |||
@@ -28,6 +28,20 @@ struct panel_drv_data { | |||
28 | bool invert_polarity; | 28 | bool invert_polarity; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | static const struct omap_video_timings tvc_pal_timings = { | ||
32 | .x_res = 720, | ||
33 | .y_res = 574, | ||
34 | .pixel_clock = 13500, | ||
35 | .hsw = 64, | ||
36 | .hfp = 12, | ||
37 | .hbp = 68, | ||
38 | .vsw = 5, | ||
39 | .vfp = 5, | ||
40 | .vbp = 41, | ||
41 | |||
42 | .interlace = true, | ||
43 | }; | ||
44 | |||
31 | #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) | 45 | #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) |
32 | 46 | ||
33 | static int tvc_connect(struct omap_dss_device *dssdev) | 47 | static int tvc_connect(struct omap_dss_device *dssdev) |
@@ -212,14 +226,14 @@ static int tvc_probe(struct platform_device *pdev) | |||
212 | return -ENODEV; | 226 | return -ENODEV; |
213 | } | 227 | } |
214 | 228 | ||
215 | ddata->timings = omap_dss_pal_timings; | 229 | ddata->timings = tvc_pal_timings; |
216 | 230 | ||
217 | dssdev = &ddata->dssdev; | 231 | dssdev = &ddata->dssdev; |
218 | dssdev->driver = &tvc_driver; | 232 | dssdev->driver = &tvc_driver; |
219 | dssdev->dev = &pdev->dev; | 233 | dssdev->dev = &pdev->dev; |
220 | dssdev->type = OMAP_DISPLAY_TYPE_VENC; | 234 | dssdev->type = OMAP_DISPLAY_TYPE_VENC; |
221 | dssdev->owner = THIS_MODULE; | 235 | dssdev->owner = THIS_MODULE; |
222 | dssdev->panel.timings = omap_dss_pal_timings; | 236 | dssdev->panel.timings = tvc_pal_timings; |
223 | 237 | ||
224 | r = omapdss_register_display(dssdev); | 238 | r = omapdss_register_display(dssdev); |
225 | if (r) { | 239 | if (r) { |
diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c index b2a8912f6435..a9ac3ce2d0e9 100644 --- a/drivers/video/sgivwfb.c +++ b/drivers/video/sgivwfb.c | |||
@@ -713,7 +713,7 @@ static int sgivwfb_mmap(struct fb_info *info, | |||
713 | r = vm_iomap_memory(vma, sgivwfb_mem_phys, sgivwfb_mem_size); | 713 | r = vm_iomap_memory(vma, sgivwfb_mem_phys, sgivwfb_mem_size); |
714 | 714 | ||
715 | printk(KERN_DEBUG "sgivwfb: mmap framebuffer P(%lx)->V(%lx)\n", | 715 | printk(KERN_DEBUG "sgivwfb: mmap framebuffer P(%lx)->V(%lx)\n", |
716 | offset, vma->vm_start); | 716 | sgivwfb_mem_phys + (vma->vm_pgoff << PAGE_SHIFT), vma->vm_start); |
717 | 717 | ||
718 | return r; | 718 | return r; |
719 | } | 719 | } |
diff --git a/drivers/video/sh7760fb.c b/drivers/video/sh7760fb.c index a8c6c43a4658..1265b25f9f99 100644 --- a/drivers/video/sh7760fb.c +++ b/drivers/video/sh7760fb.c | |||
@@ -567,7 +567,7 @@ static int sh7760fb_remove(struct platform_device *dev) | |||
567 | fb_dealloc_cmap(&info->cmap); | 567 | fb_dealloc_cmap(&info->cmap); |
568 | sh7760fb_free_mem(info); | 568 | sh7760fb_free_mem(info); |
569 | if (par->irq >= 0) | 569 | if (par->irq >= 0) |
570 | free_irq(par->irq, par); | 570 | free_irq(par->irq, &par->vsync); |
571 | iounmap(par->base); | 571 | iounmap(par->base); |
572 | release_mem_region(par->ioarea->start, resource_size(par->ioarea)); | 572 | release_mem_region(par->ioarea->start, resource_size(par->ioarea)); |
573 | framebuffer_release(info); | 573 | framebuffer_release(info); |
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index 830ded45fd47..2827333703d9 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c | |||
@@ -1265,7 +1265,6 @@ static void vga16fb_imageblit(struct fb_info *info, const struct fb_image *image | |||
1265 | 1265 | ||
1266 | static void vga16fb_destroy(struct fb_info *info) | 1266 | static void vga16fb_destroy(struct fb_info *info) |
1267 | { | 1267 | { |
1268 | struct platform_device *dev = container_of(info->device, struct platform_device, dev); | ||
1269 | iounmap(info->screen_base); | 1268 | iounmap(info->screen_base); |
1270 | fb_dealloc_cmap(&info->cmap); | 1269 | fb_dealloc_cmap(&info->cmap); |
1271 | /* XXX unshare VGA regions */ | 1270 | /* XXX unshare VGA regions */ |
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index f3d4a69e1e4e..6629b29a8202 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c | |||
@@ -341,8 +341,8 @@ static int xilinxfb_assign(struct platform_device *pdev, | |||
341 | 341 | ||
342 | if (drvdata->flags & BUS_ACCESS_FLAG) { | 342 | if (drvdata->flags & BUS_ACCESS_FLAG) { |
343 | /* Put a banner in the log (for DEBUG) */ | 343 | /* Put a banner in the log (for DEBUG) */ |
344 | dev_dbg(dev, "regs: phys=%x, virt=%p\n", drvdata->regs_phys, | 344 | dev_dbg(dev, "regs: phys=%pa, virt=%p\n", |
345 | drvdata->regs); | 345 | &drvdata->regs_phys, drvdata->regs); |
346 | } | 346 | } |
347 | /* Put a banner in the log (for DEBUG) */ | 347 | /* Put a banner in the log (for DEBUG) */ |
348 | dev_dbg(dev, "fb: phys=%llx, virt=%p, size=%x\n", | 348 | dev_dbg(dev, "fb: phys=%llx, virt=%p, size=%x\n", |
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 9e02d60a364b..23eae5cb69c2 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
@@ -145,7 +145,7 @@ config SWIOTLB_XEN | |||
145 | 145 | ||
146 | config XEN_TMEM | 146 | config XEN_TMEM |
147 | tristate | 147 | tristate |
148 | depends on !ARM | 148 | depends on !ARM && !ARM64 |
149 | default m if (CLEANCACHE || FRONTSWAP) | 149 | default m if (CLEANCACHE || FRONTSWAP) |
150 | help | 150 | help |
151 | Shim to interface in-kernel Transcendent Memory hooks | 151 | Shim to interface in-kernel Transcendent Memory hooks |
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index eabd0ee1c2bc..14fe79d8634a 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile | |||
@@ -1,9 +1,8 @@ | |||
1 | ifneq ($(CONFIG_ARM),y) | 1 | ifeq ($(filter y, $(CONFIG_ARM) $(CONFIG_ARM64)),) |
2 | obj-y += manage.o | ||
3 | obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o | 2 | obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o |
4 | endif | 3 | endif |
5 | obj-$(CONFIG_X86) += fallback.o | 4 | obj-$(CONFIG_X86) += fallback.o |
6 | obj-y += grant-table.o features.o events.o balloon.o | 5 | obj-y += grant-table.o features.o events.o balloon.o manage.o |
7 | obj-y += xenbus/ | 6 | obj-y += xenbus/ |
8 | 7 | ||
9 | nostackp := $(call cc-option, -fno-stack-protector) | 8 | nostackp := $(call cc-option, -fno-stack-protector) |
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index 8feecf01d55c..b6165e047f48 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c | |||
@@ -379,18 +379,12 @@ static long evtchn_ioctl(struct file *file, | |||
379 | if (unbind.port >= NR_EVENT_CHANNELS) | 379 | if (unbind.port >= NR_EVENT_CHANNELS) |
380 | break; | 380 | break; |
381 | 381 | ||
382 | spin_lock_irq(&port_user_lock); | ||
383 | |||
384 | rc = -ENOTCONN; | 382 | rc = -ENOTCONN; |
385 | if (get_port_user(unbind.port) != u) { | 383 | if (get_port_user(unbind.port) != u) |
386 | spin_unlock_irq(&port_user_lock); | ||
387 | break; | 384 | break; |
388 | } | ||
389 | 385 | ||
390 | disable_irq(irq_from_evtchn(unbind.port)); | 386 | disable_irq(irq_from_evtchn(unbind.port)); |
391 | 387 | ||
392 | spin_unlock_irq(&port_user_lock); | ||
393 | |||
394 | evtchn_unbind_from_user(u, unbind.port); | 388 | evtchn_unbind_from_user(u, unbind.port); |
395 | 389 | ||
396 | rc = 0; | 390 | rc = 0; |
@@ -490,26 +484,15 @@ static int evtchn_release(struct inode *inode, struct file *filp) | |||
490 | int i; | 484 | int i; |
491 | struct per_user_data *u = filp->private_data; | 485 | struct per_user_data *u = filp->private_data; |
492 | 486 | ||
493 | spin_lock_irq(&port_user_lock); | ||
494 | |||
495 | free_page((unsigned long)u->ring); | ||
496 | |||
497 | for (i = 0; i < NR_EVENT_CHANNELS; i++) { | 487 | for (i = 0; i < NR_EVENT_CHANNELS; i++) { |
498 | if (get_port_user(i) != u) | 488 | if (get_port_user(i) != u) |
499 | continue; | 489 | continue; |
500 | 490 | ||
501 | disable_irq(irq_from_evtchn(i)); | 491 | disable_irq(irq_from_evtchn(i)); |
502 | } | ||
503 | |||
504 | spin_unlock_irq(&port_user_lock); | ||
505 | |||
506 | for (i = 0; i < NR_EVENT_CHANNELS; i++) { | ||
507 | if (get_port_user(i) != u) | ||
508 | continue; | ||
509 | |||
510 | evtchn_unbind_from_user(get_port_user(i), i); | 492 | evtchn_unbind_from_user(get_port_user(i), i); |
511 | } | 493 | } |
512 | 494 | ||
495 | free_page((unsigned long)u->ring); | ||
513 | kfree(u->name); | 496 | kfree(u->name); |
514 | kfree(u); | 497 | kfree(u); |
515 | 498 | ||
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index 6ed8a9df4472..34b20bfa4e8c 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c | |||
@@ -115,7 +115,6 @@ static int xenbus_frontend_dev_resume(struct device *dev) | |||
115 | return -EFAULT; | 115 | return -EFAULT; |
116 | } | 116 | } |
117 | 117 | ||
118 | INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume); | ||
119 | queue_work(xenbus_frontend_wq, &xdev->work); | 118 | queue_work(xenbus_frontend_wq, &xdev->work); |
120 | 119 | ||
121 | return 0; | 120 | return 0; |
@@ -124,6 +123,16 @@ static int xenbus_frontend_dev_resume(struct device *dev) | |||
124 | return xenbus_dev_resume(dev); | 123 | return xenbus_dev_resume(dev); |
125 | } | 124 | } |
126 | 125 | ||
126 | static int xenbus_frontend_dev_probe(struct device *dev) | ||
127 | { | ||
128 | if (xen_store_domain_type == XS_LOCAL) { | ||
129 | struct xenbus_device *xdev = to_xenbus_device(dev); | ||
130 | INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume); | ||
131 | } | ||
132 | |||
133 | return xenbus_dev_probe(dev); | ||
134 | } | ||
135 | |||
127 | static const struct dev_pm_ops xenbus_pm_ops = { | 136 | static const struct dev_pm_ops xenbus_pm_ops = { |
128 | .suspend = xenbus_dev_suspend, | 137 | .suspend = xenbus_dev_suspend, |
129 | .resume = xenbus_frontend_dev_resume, | 138 | .resume = xenbus_frontend_dev_resume, |
@@ -142,7 +151,7 @@ static struct xen_bus_type xenbus_frontend = { | |||
142 | .name = "xen", | 151 | .name = "xen", |
143 | .match = xenbus_match, | 152 | .match = xenbus_match, |
144 | .uevent = xenbus_uevent_frontend, | 153 | .uevent = xenbus_uevent_frontend, |
145 | .probe = xenbus_dev_probe, | 154 | .probe = xenbus_frontend_dev_probe, |
146 | .remove = xenbus_dev_remove, | 155 | .remove = xenbus_dev_remove, |
147 | .shutdown = xenbus_dev_shutdown, | 156 | .shutdown = xenbus_dev_shutdown, |
148 | .dev_attrs = xenbus_dev_attrs, | 157 | .dev_attrs = xenbus_dev_attrs, |
@@ -474,7 +483,11 @@ static int __init xenbus_probe_frontend_init(void) | |||
474 | 483 | ||
475 | register_xenstore_notifier(&xenstore_notifier); | 484 | register_xenstore_notifier(&xenstore_notifier); |
476 | 485 | ||
477 | xenbus_frontend_wq = create_workqueue("xenbus_frontend"); | 486 | if (xen_store_domain_type == XS_LOCAL) { |
487 | xenbus_frontend_wq = create_workqueue("xenbus_frontend"); | ||
488 | if (!xenbus_frontend_wq) | ||
489 | pr_warn("create xenbus frontend workqueue failed, S3 resume is likely to fail\n"); | ||
490 | } | ||
478 | 491 | ||
479 | return 0; | 492 | return 0; |
480 | } | 493 | } |
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index eaf133384a8f..8bc5e8ccb091 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
@@ -36,16 +36,23 @@ static int check_extent_in_eb(struct btrfs_key *key, struct extent_buffer *eb, | |||
36 | u64 extent_item_pos, | 36 | u64 extent_item_pos, |
37 | struct extent_inode_elem **eie) | 37 | struct extent_inode_elem **eie) |
38 | { | 38 | { |
39 | u64 data_offset; | 39 | u64 offset = 0; |
40 | u64 data_len; | ||
41 | struct extent_inode_elem *e; | 40 | struct extent_inode_elem *e; |
42 | 41 | ||
43 | data_offset = btrfs_file_extent_offset(eb, fi); | 42 | if (!btrfs_file_extent_compression(eb, fi) && |
44 | data_len = btrfs_file_extent_num_bytes(eb, fi); | 43 | !btrfs_file_extent_encryption(eb, fi) && |
44 | !btrfs_file_extent_other_encoding(eb, fi)) { | ||
45 | u64 data_offset; | ||
46 | u64 data_len; | ||
45 | 47 | ||
46 | if (extent_item_pos < data_offset || | 48 | data_offset = btrfs_file_extent_offset(eb, fi); |
47 | extent_item_pos >= data_offset + data_len) | 49 | data_len = btrfs_file_extent_num_bytes(eb, fi); |
48 | return 1; | 50 | |
51 | if (extent_item_pos < data_offset || | ||
52 | extent_item_pos >= data_offset + data_len) | ||
53 | return 1; | ||
54 | offset = extent_item_pos - data_offset; | ||
55 | } | ||
49 | 56 | ||
50 | e = kmalloc(sizeof(*e), GFP_NOFS); | 57 | e = kmalloc(sizeof(*e), GFP_NOFS); |
51 | if (!e) | 58 | if (!e) |
@@ -53,7 +60,7 @@ static int check_extent_in_eb(struct btrfs_key *key, struct extent_buffer *eb, | |||
53 | 60 | ||
54 | e->next = *eie; | 61 | e->next = *eie; |
55 | e->inum = key->objectid; | 62 | e->inum = key->objectid; |
56 | e->offset = key->offset + (extent_item_pos - data_offset); | 63 | e->offset = key->offset + offset; |
57 | *eie = e; | 64 | *eie = e; |
58 | 65 | ||
59 | return 0; | 66 | return 0; |
@@ -189,7 +196,7 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path, | |||
189 | struct extent_buffer *eb; | 196 | struct extent_buffer *eb; |
190 | struct btrfs_key key; | 197 | struct btrfs_key key; |
191 | struct btrfs_file_extent_item *fi; | 198 | struct btrfs_file_extent_item *fi; |
192 | struct extent_inode_elem *eie = NULL; | 199 | struct extent_inode_elem *eie = NULL, *old = NULL; |
193 | u64 disk_byte; | 200 | u64 disk_byte; |
194 | 201 | ||
195 | if (level != 0) { | 202 | if (level != 0) { |
@@ -223,6 +230,7 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path, | |||
223 | 230 | ||
224 | if (disk_byte == wanted_disk_byte) { | 231 | if (disk_byte == wanted_disk_byte) { |
225 | eie = NULL; | 232 | eie = NULL; |
233 | old = NULL; | ||
226 | if (extent_item_pos) { | 234 | if (extent_item_pos) { |
227 | ret = check_extent_in_eb(&key, eb, fi, | 235 | ret = check_extent_in_eb(&key, eb, fi, |
228 | *extent_item_pos, | 236 | *extent_item_pos, |
@@ -230,18 +238,20 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path, | |||
230 | if (ret < 0) | 238 | if (ret < 0) |
231 | break; | 239 | break; |
232 | } | 240 | } |
233 | if (!ret) { | 241 | if (ret > 0) |
234 | ret = ulist_add(parents, eb->start, | 242 | goto next; |
235 | (uintptr_t)eie, GFP_NOFS); | 243 | ret = ulist_add_merge(parents, eb->start, |
236 | if (ret < 0) | 244 | (uintptr_t)eie, |
237 | break; | 245 | (u64 *)&old, GFP_NOFS); |
238 | if (!extent_item_pos) { | 246 | if (ret < 0) |
239 | ret = btrfs_next_old_leaf(root, path, | 247 | break; |
240 | time_seq); | 248 | if (!ret && extent_item_pos) { |
241 | continue; | 249 | while (old->next) |
242 | } | 250 | old = old->next; |
251 | old->next = eie; | ||
243 | } | 252 | } |
244 | } | 253 | } |
254 | next: | ||
245 | ret = btrfs_next_old_item(root, path, time_seq); | 255 | ret = btrfs_next_old_item(root, path, time_seq); |
246 | } | 256 | } |
247 | 257 | ||
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 5bf4c39e2ad6..ed504607d8ec 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -1271,7 +1271,6 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb, | |||
1271 | BUG_ON(!eb_rewin); | 1271 | BUG_ON(!eb_rewin); |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | extent_buffer_get(eb_rewin); | ||
1275 | btrfs_tree_read_unlock(eb); | 1274 | btrfs_tree_read_unlock(eb); |
1276 | free_extent_buffer(eb); | 1275 | free_extent_buffer(eb); |
1277 | 1276 | ||
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 583d98bd065e..fe443fece851 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -4048,7 +4048,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
4048 | } | 4048 | } |
4049 | 4049 | ||
4050 | while (!end) { | 4050 | while (!end) { |
4051 | u64 offset_in_extent; | 4051 | u64 offset_in_extent = 0; |
4052 | 4052 | ||
4053 | /* break if the extent we found is outside the range */ | 4053 | /* break if the extent we found is outside the range */ |
4054 | if (em->start >= max || extent_map_end(em) < off) | 4054 | if (em->start >= max || extent_map_end(em) < off) |
@@ -4064,9 +4064,12 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
4064 | 4064 | ||
4065 | /* | 4065 | /* |
4066 | * record the offset from the start of the extent | 4066 | * record the offset from the start of the extent |
4067 | * for adjusting the disk offset below | 4067 | * for adjusting the disk offset below. Only do this if the |
4068 | * extent isn't compressed since our in ram offset may be past | ||
4069 | * what we have actually allocated on disk. | ||
4068 | */ | 4070 | */ |
4069 | offset_in_extent = em_start - em->start; | 4071 | if (!test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) |
4072 | offset_in_extent = em_start - em->start; | ||
4070 | em_end = extent_map_end(em); | 4073 | em_end = extent_map_end(em); |
4071 | em_len = em_end - em_start; | 4074 | em_len = em_end - em_start; |
4072 | emflags = em->flags; | 4075 | emflags = em->flags; |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index a005fe2c072a..8e686a427ce2 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -596,20 +596,29 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, | |||
596 | if (no_splits) | 596 | if (no_splits) |
597 | goto next; | 597 | goto next; |
598 | 598 | ||
599 | if (em->block_start < EXTENT_MAP_LAST_BYTE && | 599 | if (em->start < start) { |
600 | em->start < start) { | ||
601 | split->start = em->start; | 600 | split->start = em->start; |
602 | split->len = start - em->start; | 601 | split->len = start - em->start; |
603 | split->orig_start = em->orig_start; | ||
604 | split->block_start = em->block_start; | ||
605 | 602 | ||
606 | if (compressed) | 603 | if (em->block_start < EXTENT_MAP_LAST_BYTE) { |
607 | split->block_len = em->block_len; | 604 | split->orig_start = em->orig_start; |
608 | else | 605 | split->block_start = em->block_start; |
609 | split->block_len = split->len; | 606 | |
610 | split->ram_bytes = em->ram_bytes; | 607 | if (compressed) |
611 | split->orig_block_len = max(split->block_len, | 608 | split->block_len = em->block_len; |
612 | em->orig_block_len); | 609 | else |
610 | split->block_len = split->len; | ||
611 | split->orig_block_len = max(split->block_len, | ||
612 | em->orig_block_len); | ||
613 | split->ram_bytes = em->ram_bytes; | ||
614 | } else { | ||
615 | split->orig_start = split->start; | ||
616 | split->block_len = 0; | ||
617 | split->block_start = em->block_start; | ||
618 | split->orig_block_len = 0; | ||
619 | split->ram_bytes = split->len; | ||
620 | } | ||
621 | |||
613 | split->generation = gen; | 622 | split->generation = gen; |
614 | split->bdev = em->bdev; | 623 | split->bdev = em->bdev; |
615 | split->flags = flags; | 624 | split->flags = flags; |
@@ -620,8 +629,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, | |||
620 | split = split2; | 629 | split = split2; |
621 | split2 = NULL; | 630 | split2 = NULL; |
622 | } | 631 | } |
623 | if (em->block_start < EXTENT_MAP_LAST_BYTE && | 632 | if (testend && em->start + em->len > start + len) { |
624 | testend && em->start + em->len > start + len) { | ||
625 | u64 diff = start + len - em->start; | 633 | u64 diff = start + len - em->start; |
626 | 634 | ||
627 | split->start = start + len; | 635 | split->start = start + len; |
@@ -630,18 +638,28 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, | |||
630 | split->flags = flags; | 638 | split->flags = flags; |
631 | split->compress_type = em->compress_type; | 639 | split->compress_type = em->compress_type; |
632 | split->generation = gen; | 640 | split->generation = gen; |
633 | split->orig_block_len = max(em->block_len, | 641 | |
642 | if (em->block_start < EXTENT_MAP_LAST_BYTE) { | ||
643 | split->orig_block_len = max(em->block_len, | ||
634 | em->orig_block_len); | 644 | em->orig_block_len); |
635 | split->ram_bytes = em->ram_bytes; | ||
636 | 645 | ||
637 | if (compressed) { | 646 | split->ram_bytes = em->ram_bytes; |
638 | split->block_len = em->block_len; | 647 | if (compressed) { |
639 | split->block_start = em->block_start; | 648 | split->block_len = em->block_len; |
640 | split->orig_start = em->orig_start; | 649 | split->block_start = em->block_start; |
650 | split->orig_start = em->orig_start; | ||
651 | } else { | ||
652 | split->block_len = split->len; | ||
653 | split->block_start = em->block_start | ||
654 | + diff; | ||
655 | split->orig_start = em->orig_start; | ||
656 | } | ||
641 | } else { | 657 | } else { |
642 | split->block_len = split->len; | 658 | split->ram_bytes = split->len; |
643 | split->block_start = em->block_start + diff; | 659 | split->orig_start = split->start; |
644 | split->orig_start = em->orig_start; | 660 | split->block_len = 0; |
661 | split->block_start = em->block_start; | ||
662 | split->orig_block_len = 0; | ||
645 | } | 663 | } |
646 | 664 | ||
647 | ret = add_extent_mapping(em_tree, split, modified); | 665 | ret = add_extent_mapping(em_tree, split, modified); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 6d1b93c8aafb..021694c08181 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -2166,16 +2166,23 @@ static noinline int record_one_backref(u64 inum, u64 offset, u64 root_id, | |||
2166 | if (btrfs_file_extent_disk_bytenr(leaf, extent) != old->bytenr) | 2166 | if (btrfs_file_extent_disk_bytenr(leaf, extent) != old->bytenr) |
2167 | continue; | 2167 | continue; |
2168 | 2168 | ||
2169 | extent_offset = btrfs_file_extent_offset(leaf, extent); | 2169 | /* |
2170 | if (key.offset - extent_offset != offset) | 2170 | * 'offset' refers to the exact key.offset, |
2171 | * NOT the 'offset' field in btrfs_extent_data_ref, ie. | ||
2172 | * (key.offset - extent_offset). | ||
2173 | */ | ||
2174 | if (key.offset != offset) | ||
2171 | continue; | 2175 | continue; |
2172 | 2176 | ||
2177 | extent_offset = btrfs_file_extent_offset(leaf, extent); | ||
2173 | num_bytes = btrfs_file_extent_num_bytes(leaf, extent); | 2178 | num_bytes = btrfs_file_extent_num_bytes(leaf, extent); |
2179 | |||
2174 | if (extent_offset >= old->extent_offset + old->offset + | 2180 | if (extent_offset >= old->extent_offset + old->offset + |
2175 | old->len || extent_offset + num_bytes <= | 2181 | old->len || extent_offset + num_bytes <= |
2176 | old->extent_offset + old->offset) | 2182 | old->extent_offset + old->offset) |
2177 | continue; | 2183 | continue; |
2178 | 2184 | ||
2185 | ret = 0; | ||
2179 | break; | 2186 | break; |
2180 | } | 2187 | } |
2181 | 2188 | ||
@@ -2187,7 +2194,7 @@ static noinline int record_one_backref(u64 inum, u64 offset, u64 root_id, | |||
2187 | 2194 | ||
2188 | backref->root_id = root_id; | 2195 | backref->root_id = root_id; |
2189 | backref->inum = inum; | 2196 | backref->inum = inum; |
2190 | backref->file_pos = offset + extent_offset; | 2197 | backref->file_pos = offset; |
2191 | backref->num_bytes = num_bytes; | 2198 | backref->num_bytes = num_bytes; |
2192 | backref->extent_offset = extent_offset; | 2199 | backref->extent_offset = extent_offset; |
2193 | backref->generation = btrfs_file_extent_generation(leaf, extent); | 2200 | backref->generation = btrfs_file_extent_generation(leaf, extent); |
@@ -2210,7 +2217,8 @@ static noinline bool record_extent_backrefs(struct btrfs_path *path, | |||
2210 | new->path = path; | 2217 | new->path = path; |
2211 | 2218 | ||
2212 | list_for_each_entry_safe(old, tmp, &new->head, list) { | 2219 | list_for_each_entry_safe(old, tmp, &new->head, list) { |
2213 | ret = iterate_inodes_from_logical(old->bytenr, fs_info, | 2220 | ret = iterate_inodes_from_logical(old->bytenr + |
2221 | old->extent_offset, fs_info, | ||
2214 | path, record_one_backref, | 2222 | path, record_one_backref, |
2215 | old); | 2223 | old); |
2216 | BUG_ON(ret < 0 && ret != -ENOENT); | 2224 | BUG_ON(ret < 0 && ret != -ENOENT); |
@@ -4391,9 +4399,6 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr) | |||
4391 | int mask = attr->ia_valid; | 4399 | int mask = attr->ia_valid; |
4392 | int ret; | 4400 | int ret; |
4393 | 4401 | ||
4394 | if (newsize == oldsize) | ||
4395 | return 0; | ||
4396 | |||
4397 | /* | 4402 | /* |
4398 | * The regular truncate() case without ATTR_CTIME and ATTR_MTIME is a | 4403 | * The regular truncate() case without ATTR_CTIME and ATTR_MTIME is a |
4399 | * special case where we need to update the times despite not having | 4404 | * special case where we need to update the times despite not having |
@@ -5165,14 +5170,31 @@ next: | |||
5165 | } | 5170 | } |
5166 | 5171 | ||
5167 | /* Reached end of directory/root. Bump pos past the last item. */ | 5172 | /* Reached end of directory/root. Bump pos past the last item. */ |
5168 | if (key_type == BTRFS_DIR_INDEX_KEY) | 5173 | ctx->pos++; |
5169 | /* | 5174 | |
5170 | * 32-bit glibc will use getdents64, but then strtol - | 5175 | /* |
5171 | * so the last number we can serve is this. | 5176 | * Stop new entries from being returned after we return the last |
5172 | */ | 5177 | * entry. |
5173 | ctx->pos = 0x7fffffff; | 5178 | * |
5174 | else | 5179 | * New directory entries are assigned a strictly increasing |
5175 | ctx->pos++; | 5180 | * offset. This means that new entries created during readdir |
5181 | * are *guaranteed* to be seen in the future by that readdir. | ||
5182 | * This has broken buggy programs which operate on names as | ||
5183 | * they're returned by readdir. Until we re-use freed offsets | ||
5184 | * we have this hack to stop new entries from being returned | ||
5185 | * under the assumption that they'll never reach this huge | ||
5186 | * offset. | ||
5187 | * | ||
5188 | * This is being careful not to overflow 32bit loff_t unless the | ||
5189 | * last entry requires it because doing so has broken 32bit apps | ||
5190 | * in the past. | ||
5191 | */ | ||
5192 | if (key_type == BTRFS_DIR_INDEX_KEY) { | ||
5193 | if (ctx->pos >= INT_MAX) | ||
5194 | ctx->pos = LLONG_MAX; | ||
5195 | else | ||
5196 | ctx->pos = INT_MAX; | ||
5197 | } | ||
5176 | nopos: | 5198 | nopos: |
5177 | ret = 0; | 5199 | ret = 0; |
5178 | err: | 5200 | err: |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index d58cce77fc6c..af1931a5960d 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -983,12 +983,12 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans, | |||
983 | * a dirty root struct and adds it into the list of dead roots that need to | 983 | * a dirty root struct and adds it into the list of dead roots that need to |
984 | * be deleted | 984 | * be deleted |
985 | */ | 985 | */ |
986 | int btrfs_add_dead_root(struct btrfs_root *root) | 986 | void btrfs_add_dead_root(struct btrfs_root *root) |
987 | { | 987 | { |
988 | spin_lock(&root->fs_info->trans_lock); | 988 | spin_lock(&root->fs_info->trans_lock); |
989 | list_add_tail(&root->root_list, &root->fs_info->dead_roots); | 989 | if (list_empty(&root->root_list)) |
990 | list_add_tail(&root->root_list, &root->fs_info->dead_roots); | ||
990 | spin_unlock(&root->fs_info->trans_lock); | 991 | spin_unlock(&root->fs_info->trans_lock); |
991 | return 0; | ||
992 | } | 992 | } |
993 | 993 | ||
994 | /* | 994 | /* |
@@ -1925,7 +1925,7 @@ int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root) | |||
1925 | } | 1925 | } |
1926 | root = list_first_entry(&fs_info->dead_roots, | 1926 | root = list_first_entry(&fs_info->dead_roots, |
1927 | struct btrfs_root, root_list); | 1927 | struct btrfs_root, root_list); |
1928 | list_del(&root->root_list); | 1928 | list_del_init(&root->root_list); |
1929 | spin_unlock(&fs_info->trans_lock); | 1929 | spin_unlock(&fs_info->trans_lock); |
1930 | 1930 | ||
1931 | pr_debug("btrfs: cleaner removing %llu\n", | 1931 | pr_debug("btrfs: cleaner removing %llu\n", |
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h index 005b0375d18c..defbc4269897 100644 --- a/fs/btrfs/transaction.h +++ b/fs/btrfs/transaction.h | |||
@@ -143,7 +143,7 @@ int btrfs_wait_for_commit(struct btrfs_root *root, u64 transid); | |||
143 | int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, | 143 | int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, |
144 | struct btrfs_root *root); | 144 | struct btrfs_root *root); |
145 | 145 | ||
146 | int btrfs_add_dead_root(struct btrfs_root *root); | 146 | void btrfs_add_dead_root(struct btrfs_root *root); |
147 | int btrfs_defrag_root(struct btrfs_root *root); | 147 | int btrfs_defrag_root(struct btrfs_root *root); |
148 | int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root); | 148 | int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root); |
149 | int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | 149 | int btrfs_commit_transaction(struct btrfs_trans_handle *trans, |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 2c6791493637..ff60d8978ae2 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -3746,8 +3746,9 @@ next_slot: | |||
3746 | } | 3746 | } |
3747 | 3747 | ||
3748 | log_extents: | 3748 | log_extents: |
3749 | btrfs_release_path(path); | ||
3750 | btrfs_release_path(dst_path); | ||
3749 | if (fast_search) { | 3751 | if (fast_search) { |
3750 | btrfs_release_path(dst_path); | ||
3751 | ret = btrfs_log_changed_extents(trans, root, inode, dst_path); | 3752 | ret = btrfs_log_changed_extents(trans, root, inode, dst_path); |
3752 | if (ret) { | 3753 | if (ret) { |
3753 | err = ret; | 3754 | err = ret; |
@@ -3764,8 +3765,6 @@ log_extents: | |||
3764 | } | 3765 | } |
3765 | 3766 | ||
3766 | if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) { | 3767 | if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) { |
3767 | btrfs_release_path(path); | ||
3768 | btrfs_release_path(dst_path); | ||
3769 | ret = log_directory_changes(trans, root, inode, path, dst_path); | 3768 | ret = log_directory_changes(trans, root, inode, path, dst_path); |
3770 | if (ret) { | 3769 | if (ret) { |
3771 | err = ret; | 3770 | err = ret; |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 4888cb3fdef7..c7c83ff0f752 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -533,8 +533,7 @@ EXPORT_SYMBOL_GPL(debugfs_remove); | |||
533 | */ | 533 | */ |
534 | void debugfs_remove_recursive(struct dentry *dentry) | 534 | void debugfs_remove_recursive(struct dentry *dentry) |
535 | { | 535 | { |
536 | struct dentry *child; | 536 | struct dentry *child, *next, *parent; |
537 | struct dentry *parent; | ||
538 | 537 | ||
539 | if (IS_ERR_OR_NULL(dentry)) | 538 | if (IS_ERR_OR_NULL(dentry)) |
540 | return; | 539 | return; |
@@ -544,61 +543,37 @@ void debugfs_remove_recursive(struct dentry *dentry) | |||
544 | return; | 543 | return; |
545 | 544 | ||
546 | parent = dentry; | 545 | parent = dentry; |
546 | down: | ||
547 | mutex_lock(&parent->d_inode->i_mutex); | 547 | mutex_lock(&parent->d_inode->i_mutex); |
548 | list_for_each_entry_safe(child, next, &parent->d_subdirs, d_u.d_child) { | ||
549 | if (!debugfs_positive(child)) | ||
550 | continue; | ||
548 | 551 | ||
549 | while (1) { | 552 | /* perhaps simple_empty(child) makes more sense */ |
550 | /* | ||
551 | * When all dentries under "parent" has been removed, | ||
552 | * walk up the tree until we reach our starting point. | ||
553 | */ | ||
554 | if (list_empty(&parent->d_subdirs)) { | ||
555 | mutex_unlock(&parent->d_inode->i_mutex); | ||
556 | if (parent == dentry) | ||
557 | break; | ||
558 | parent = parent->d_parent; | ||
559 | mutex_lock(&parent->d_inode->i_mutex); | ||
560 | } | ||
561 | child = list_entry(parent->d_subdirs.next, struct dentry, | ||
562 | d_u.d_child); | ||
563 | next_sibling: | ||
564 | |||
565 | /* | ||
566 | * If "child" isn't empty, walk down the tree and | ||
567 | * remove all its descendants first. | ||
568 | */ | ||
569 | if (!list_empty(&child->d_subdirs)) { | 553 | if (!list_empty(&child->d_subdirs)) { |
570 | mutex_unlock(&parent->d_inode->i_mutex); | 554 | mutex_unlock(&parent->d_inode->i_mutex); |
571 | parent = child; | 555 | parent = child; |
572 | mutex_lock(&parent->d_inode->i_mutex); | 556 | goto down; |
573 | continue; | ||
574 | } | 557 | } |
575 | __debugfs_remove(child, parent); | 558 | up: |
576 | if (parent->d_subdirs.next == &child->d_u.d_child) { | 559 | if (!__debugfs_remove(child, parent)) |
577 | /* | 560 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); |
578 | * Try the next sibling. | ||
579 | */ | ||
580 | if (child->d_u.d_child.next != &parent->d_subdirs) { | ||
581 | child = list_entry(child->d_u.d_child.next, | ||
582 | struct dentry, | ||
583 | d_u.d_child); | ||
584 | goto next_sibling; | ||
585 | } | ||
586 | |||
587 | /* | ||
588 | * Avoid infinite loop if we fail to remove | ||
589 | * one dentry. | ||
590 | */ | ||
591 | mutex_unlock(&parent->d_inode->i_mutex); | ||
592 | break; | ||
593 | } | ||
594 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | ||
595 | } | 561 | } |
596 | 562 | ||
597 | parent = dentry->d_parent; | 563 | mutex_unlock(&parent->d_inode->i_mutex); |
564 | child = parent; | ||
565 | parent = parent->d_parent; | ||
598 | mutex_lock(&parent->d_inode->i_mutex); | 566 | mutex_lock(&parent->d_inode->i_mutex); |
599 | __debugfs_remove(dentry, parent); | 567 | |
568 | if (child != dentry) { | ||
569 | next = list_entry(child->d_u.d_child.next, struct dentry, | ||
570 | d_u.d_child); | ||
571 | goto up; | ||
572 | } | ||
573 | |||
574 | if (!__debugfs_remove(child, parent)) | ||
575 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | ||
600 | mutex_unlock(&parent->d_inode->i_mutex); | 576 | mutex_unlock(&parent->d_inode->i_mutex); |
601 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | ||
602 | } | 577 | } |
603 | EXPORT_SYMBOL_GPL(debugfs_remove_recursive); | 578 | EXPORT_SYMBOL_GPL(debugfs_remove_recursive); |
604 | 579 | ||
diff --git a/fs/dlm/user.c b/fs/dlm/user.c index 911649a47dd5..812149119fa3 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c | |||
@@ -686,7 +686,6 @@ static int device_close(struct inode *inode, struct file *file) | |||
686 | device_remove_lockspace() */ | 686 | device_remove_lockspace() */ |
687 | 687 | ||
688 | sigprocmask(SIG_SETMASK, &tmpsig, NULL); | 688 | sigprocmask(SIG_SETMASK, &tmpsig, NULL); |
689 | recalc_sigpending(); | ||
690 | 689 | ||
691 | return 0; | 690 | return 0; |
692 | } | 691 | } |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index a61873808f76..72ba4705d4fa 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -4412,7 +4412,7 @@ void ext4_ext_truncate(handle_t *handle, struct inode *inode) | |||
4412 | retry: | 4412 | retry: |
4413 | err = ext4_es_remove_extent(inode, last_block, | 4413 | err = ext4_es_remove_extent(inode, last_block, |
4414 | EXT_MAX_BLOCKS - last_block); | 4414 | EXT_MAX_BLOCKS - last_block); |
4415 | if (err == ENOMEM) { | 4415 | if (err == -ENOMEM) { |
4416 | cond_resched(); | 4416 | cond_resched(); |
4417 | congestion_wait(BLK_RW_ASYNC, HZ/50); | 4417 | congestion_wait(BLK_RW_ASYNC, HZ/50); |
4418 | goto retry; | 4418 | goto retry; |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index f03598c6ffd3..8bf5999875ee 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -734,11 +734,8 @@ repeat_in_this_group: | |||
734 | ino = ext4_find_next_zero_bit((unsigned long *) | 734 | ino = ext4_find_next_zero_bit((unsigned long *) |
735 | inode_bitmap_bh->b_data, | 735 | inode_bitmap_bh->b_data, |
736 | EXT4_INODES_PER_GROUP(sb), ino); | 736 | EXT4_INODES_PER_GROUP(sb), ino); |
737 | if (ino >= EXT4_INODES_PER_GROUP(sb)) { | 737 | if (ino >= EXT4_INODES_PER_GROUP(sb)) |
738 | if (++group == ngroups) | 738 | goto next_group; |
739 | group = 0; | ||
740 | continue; | ||
741 | } | ||
742 | if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) { | 739 | if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) { |
743 | ext4_error(sb, "reserved inode found cleared - " | 740 | ext4_error(sb, "reserved inode found cleared - " |
744 | "inode=%lu", ino + 1); | 741 | "inode=%lu", ino + 1); |
@@ -769,6 +766,9 @@ repeat_in_this_group: | |||
769 | goto got; /* we grabbed the inode! */ | 766 | goto got; /* we grabbed the inode! */ |
770 | if (ino < EXT4_INODES_PER_GROUP(sb)) | 767 | if (ino < EXT4_INODES_PER_GROUP(sb)) |
771 | goto repeat_in_this_group; | 768 | goto repeat_in_this_group; |
769 | next_group: | ||
770 | if (++group == ngroups) | ||
771 | group = 0; | ||
772 | } | 772 | } |
773 | err = -ENOSPC; | 773 | err = -ENOSPC; |
774 | goto out; | 774 | goto out; |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index ba33c67d6e48..dd32a2eacd0d 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -555,14 +555,13 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, | |||
555 | int ret; | 555 | int ret; |
556 | unsigned long long status; | 556 | unsigned long long status; |
557 | 557 | ||
558 | #ifdef ES_AGGRESSIVE_TEST | 558 | if (unlikely(retval != map->m_len)) { |
559 | if (retval != map->m_len) { | 559 | ext4_warning(inode->i_sb, |
560 | printk("ES len assertion failed for inode: %lu " | 560 | "ES len assertion failed for inode " |
561 | "retval %d != map->m_len %d " | 561 | "%lu: retval %d != map->m_len %d", |
562 | "in %s (lookup)\n", inode->i_ino, retval, | 562 | inode->i_ino, retval, map->m_len); |
563 | map->m_len, __func__); | 563 | WARN_ON(1); |
564 | } | 564 | } |
565 | #endif | ||
566 | 565 | ||
567 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? | 566 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? |
568 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; | 567 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; |
@@ -656,14 +655,13 @@ found: | |||
656 | int ret; | 655 | int ret; |
657 | unsigned long long status; | 656 | unsigned long long status; |
658 | 657 | ||
659 | #ifdef ES_AGGRESSIVE_TEST | 658 | if (unlikely(retval != map->m_len)) { |
660 | if (retval != map->m_len) { | 659 | ext4_warning(inode->i_sb, |
661 | printk("ES len assertion failed for inode: %lu " | 660 | "ES len assertion failed for inode " |
662 | "retval %d != map->m_len %d " | 661 | "%lu: retval %d != map->m_len %d", |
663 | "in %s (allocation)\n", inode->i_ino, retval, | 662 | inode->i_ino, retval, map->m_len); |
664 | map->m_len, __func__); | 663 | WARN_ON(1); |
665 | } | 664 | } |
666 | #endif | ||
667 | 665 | ||
668 | /* | 666 | /* |
669 | * If the extent has been zeroed out, we don't need to update | 667 | * If the extent has been zeroed out, we don't need to update |
@@ -1637,14 +1635,13 @@ add_delayed: | |||
1637 | int ret; | 1635 | int ret; |
1638 | unsigned long long status; | 1636 | unsigned long long status; |
1639 | 1637 | ||
1640 | #ifdef ES_AGGRESSIVE_TEST | 1638 | if (unlikely(retval != map->m_len)) { |
1641 | if (retval != map->m_len) { | 1639 | ext4_warning(inode->i_sb, |
1642 | printk("ES len assertion failed for inode: %lu " | 1640 | "ES len assertion failed for inode " |
1643 | "retval %d != map->m_len %d " | 1641 | "%lu: retval %d != map->m_len %d", |
1644 | "in %s (lookup)\n", inode->i_ino, retval, | 1642 | inode->i_ino, retval, map->m_len); |
1645 | map->m_len, __func__); | 1643 | WARN_ON(1); |
1646 | } | 1644 | } |
1647 | #endif | ||
1648 | 1645 | ||
1649 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? | 1646 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? |
1650 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; | 1647 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index bca26f34edf4..36b141e420b7 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -5481,6 +5481,7 @@ static void __exit ext4_exit_fs(void) | |||
5481 | kset_unregister(ext4_kset); | 5481 | kset_unregister(ext4_kset); |
5482 | ext4_exit_system_zone(); | 5482 | ext4_exit_system_zone(); |
5483 | ext4_exit_pageio(); | 5483 | ext4_exit_pageio(); |
5484 | ext4_exit_es(); | ||
5484 | } | 5485 | } |
5485 | 5486 | ||
5486 | MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others"); | 5487 | MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others"); |
diff --git a/fs/fcntl.c b/fs/fcntl.c index 6599222536eb..65343c3741ff 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
@@ -730,14 +730,14 @@ static int __init fcntl_init(void) | |||
730 | * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY | 730 | * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY |
731 | * is defined as O_NONBLOCK on some platforms and not on others. | 731 | * is defined as O_NONBLOCK on some platforms and not on others. |
732 | */ | 732 | */ |
733 | BUILD_BUG_ON(19 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( | 733 | BUILD_BUG_ON(20 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( |
734 | O_RDONLY | O_WRONLY | O_RDWR | | 734 | O_RDONLY | O_WRONLY | O_RDWR | |
735 | O_CREAT | O_EXCL | O_NOCTTY | | 735 | O_CREAT | O_EXCL | O_NOCTTY | |
736 | O_TRUNC | O_APPEND | /* O_NONBLOCK | */ | 736 | O_TRUNC | O_APPEND | /* O_NONBLOCK | */ |
737 | __O_SYNC | O_DSYNC | FASYNC | | 737 | __O_SYNC | O_DSYNC | FASYNC | |
738 | O_DIRECT | O_LARGEFILE | O_DIRECTORY | | 738 | O_DIRECT | O_LARGEFILE | O_DIRECTORY | |
739 | O_NOFOLLOW | O_NOATIME | O_CLOEXEC | | 739 | O_NOFOLLOW | O_NOATIME | O_CLOEXEC | |
740 | __FMODE_EXEC | O_PATH | 740 | __FMODE_EXEC | O_PATH | __O_TMPFILE |
741 | )); | 741 | )); |
742 | 742 | ||
743 | fasync_cache = kmem_cache_create("fasync_cache", | 743 | fasync_cache = kmem_cache_create("fasync_cache", |
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index 01bfe7662751..41e491b8e5d7 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c | |||
@@ -64,12 +64,17 @@ struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init) | |||
64 | nlm_init->protocol, nlm_version, | 64 | nlm_init->protocol, nlm_version, |
65 | nlm_init->hostname, nlm_init->noresvport, | 65 | nlm_init->hostname, nlm_init->noresvport, |
66 | nlm_init->net); | 66 | nlm_init->net); |
67 | if (host == NULL) { | 67 | if (host == NULL) |
68 | lockd_down(nlm_init->net); | 68 | goto out_nohost; |
69 | return ERR_PTR(-ENOLCK); | 69 | if (host->h_rpcclnt == NULL && nlm_bind_host(host) == NULL) |
70 | } | 70 | goto out_nobind; |
71 | 71 | ||
72 | return host; | 72 | return host; |
73 | out_nobind: | ||
74 | nlmclnt_release_host(host); | ||
75 | out_nohost: | ||
76 | lockd_down(nlm_init->net); | ||
77 | return ERR_PTR(-ENOLCK); | ||
73 | } | 78 | } |
74 | EXPORT_SYMBOL_GPL(nlmclnt_init); | 79 | EXPORT_SYMBOL_GPL(nlmclnt_init); |
75 | 80 | ||
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 9760ecb9b60f..acd394716349 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -125,14 +125,15 @@ static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl) | |||
125 | { | 125 | { |
126 | struct nlm_args *argp = &req->a_args; | 126 | struct nlm_args *argp = &req->a_args; |
127 | struct nlm_lock *lock = &argp->lock; | 127 | struct nlm_lock *lock = &argp->lock; |
128 | char *nodename = req->a_host->h_rpcclnt->cl_nodename; | ||
128 | 129 | ||
129 | nlmclnt_next_cookie(&argp->cookie); | 130 | nlmclnt_next_cookie(&argp->cookie); |
130 | memcpy(&lock->fh, NFS_FH(file_inode(fl->fl_file)), sizeof(struct nfs_fh)); | 131 | memcpy(&lock->fh, NFS_FH(file_inode(fl->fl_file)), sizeof(struct nfs_fh)); |
131 | lock->caller = utsname()->nodename; | 132 | lock->caller = nodename; |
132 | lock->oh.data = req->a_owner; | 133 | lock->oh.data = req->a_owner; |
133 | lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s", | 134 | lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s", |
134 | (unsigned int)fl->fl_u.nfs_fl.owner->pid, | 135 | (unsigned int)fl->fl_u.nfs_fl.owner->pid, |
135 | utsname()->nodename); | 136 | nodename); |
136 | lock->svid = fl->fl_u.nfs_fl.owner->pid; | 137 | lock->svid = fl->fl_u.nfs_fl.owner->pid; |
137 | lock->fl.fl_start = fl->fl_start; | 138 | lock->fl.fl_start = fl->fl_start; |
138 | lock->fl.fl_end = fl->fl_end; | 139 | lock->fl.fl_end = fl->fl_end; |
diff --git a/fs/namei.c b/fs/namei.c index 8b61d103a8a7..89a612e392eb 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -3671,15 +3671,11 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname, | |||
3671 | if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0) | 3671 | if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0) |
3672 | return -EINVAL; | 3672 | return -EINVAL; |
3673 | /* | 3673 | /* |
3674 | * To use null names we require CAP_DAC_READ_SEARCH | 3674 | * Using empty names is equivalent to using AT_SYMLINK_FOLLOW |
3675 | * This ensures that not everyone will be able to create | 3675 | * on /proc/self/fd/<fd>. |
3676 | * handlink using the passed filedescriptor. | ||
3677 | */ | 3676 | */ |
3678 | if (flags & AT_EMPTY_PATH) { | 3677 | if (flags & AT_EMPTY_PATH) |
3679 | if (!capable(CAP_DAC_READ_SEARCH)) | ||
3680 | return -ENOENT; | ||
3681 | how = LOOKUP_EMPTY; | 3678 | how = LOOKUP_EMPTY; |
3682 | } | ||
3683 | 3679 | ||
3684 | if (flags & AT_SYMLINK_FOLLOW) | 3680 | if (flags & AT_SYMLINK_FOLLOW) |
3685 | how |= LOOKUP_FOLLOW; | 3681 | how |= LOOKUP_FOLLOW; |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index af6e806044d7..941246f2b43d 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -463,7 +463,6 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st | |||
463 | unlock_new_inode(inode); | 463 | unlock_new_inode(inode); |
464 | } else | 464 | } else |
465 | nfs_refresh_inode(inode, fattr); | 465 | nfs_refresh_inode(inode, fattr); |
466 | nfs_setsecurity(inode, fattr, label); | ||
467 | dprintk("NFS: nfs_fhget(%s/%Ld fh_crc=0x%08x ct=%d)\n", | 466 | dprintk("NFS: nfs_fhget(%s/%Ld fh_crc=0x%08x ct=%d)\n", |
468 | inode->i_sb->s_id, | 467 | inode->i_sb->s_id, |
469 | (long long)NFS_FILEID(inode), | 468 | (long long)NFS_FILEID(inode), |
@@ -963,9 +962,15 @@ EXPORT_SYMBOL_GPL(nfs_revalidate_inode); | |||
963 | static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping) | 962 | static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping) |
964 | { | 963 | { |
965 | struct nfs_inode *nfsi = NFS_I(inode); | 964 | struct nfs_inode *nfsi = NFS_I(inode); |
966 | 965 | int ret; | |
966 | |||
967 | if (mapping->nrpages != 0) { | 967 | if (mapping->nrpages != 0) { |
968 | int ret = invalidate_inode_pages2(mapping); | 968 | if (S_ISREG(inode->i_mode)) { |
969 | ret = nfs_sync_mapping(mapping); | ||
970 | if (ret < 0) | ||
971 | return ret; | ||
972 | } | ||
973 | ret = invalidate_inode_pages2(mapping); | ||
969 | if (ret < 0) | 974 | if (ret < 0) |
970 | return ret; | 975 | return ret; |
971 | } | 976 | } |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index cf11799297c4..108a774095f7 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -3071,15 +3071,13 @@ struct rpc_clnt * | |||
3071 | nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name, | 3071 | nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name, |
3072 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) | 3072 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) |
3073 | { | 3073 | { |
3074 | struct rpc_clnt *client = NFS_CLIENT(dir); | ||
3074 | int status; | 3075 | int status; |
3075 | struct rpc_clnt *client = rpc_clone_client(NFS_CLIENT(dir)); | ||
3076 | 3076 | ||
3077 | status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, NULL); | 3077 | status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, NULL); |
3078 | if (status < 0) { | 3078 | if (status < 0) |
3079 | rpc_shutdown_client(client); | ||
3080 | return ERR_PTR(status); | 3079 | return ERR_PTR(status); |
3081 | } | 3080 | return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client; |
3082 | return client; | ||
3083 | } | 3081 | } |
3084 | 3082 | ||
3085 | static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) | 3083 | static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 71fdc0dfa0d2..f6db66d8f647 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -2478,6 +2478,10 @@ struct dentry *nfs_fs_mount_common(struct nfs_server *server, | |||
2478 | if (server->flags & NFS_MOUNT_NOAC) | 2478 | if (server->flags & NFS_MOUNT_NOAC) |
2479 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; | 2479 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; |
2480 | 2480 | ||
2481 | if (mount_info->cloned != NULL && mount_info->cloned->sb != NULL) | ||
2482 | if (mount_info->cloned->sb->s_flags & MS_SYNCHRONOUS) | ||
2483 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; | ||
2484 | |||
2481 | /* Get a superblock - note that we may end up sharing one that already exists */ | 2485 | /* Get a superblock - note that we may end up sharing one that already exists */ |
2482 | s = sget(nfs_mod->nfs_fs, compare_super, nfs_set_super, flags, &sb_mntdata); | 2486 | s = sget(nfs_mod->nfs_fs, compare_super, nfs_set_super, flags, &sb_mntdata); |
2483 | if (IS_ERR(s)) { | 2487 | if (IS_ERR(s)) { |
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 0d4c410e4589..419572f33b72 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -1524,7 +1524,7 @@ static inline u32 nfsd4_write_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) | |||
1524 | static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) | 1524 | static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) |
1525 | { | 1525 | { |
1526 | return (op_encode_hdr_size + 2 + 1 + /* eir_clientid, eir_sequenceid */\ | 1526 | return (op_encode_hdr_size + 2 + 1 + /* eir_clientid, eir_sequenceid */\ |
1527 | 1 + 1 + 0 + /* eir_flags, spr_how, SP4_NONE (for now) */\ | 1527 | 1 + 1 + 2 + /* eir_flags, spr_how, spo_must_enforce & _allow */\ |
1528 | 2 + /*eir_server_owner.so_minor_id */\ | 1528 | 2 + /*eir_server_owner.so_minor_id */\ |
1529 | /* eir_server_owner.so_major_id<> */\ | 1529 | /* eir_server_owner.so_major_id<> */\ |
1530 | XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + 1 +\ | 1530 | XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + 1 +\ |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 280acef6f0dc..43f42290e5df 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1264,6 +1264,8 @@ static bool svc_rqst_integrity_protected(struct svc_rqst *rqstp) | |||
1264 | struct svc_cred *cr = &rqstp->rq_cred; | 1264 | struct svc_cred *cr = &rqstp->rq_cred; |
1265 | u32 service; | 1265 | u32 service; |
1266 | 1266 | ||
1267 | if (!cr->cr_gss_mech) | ||
1268 | return false; | ||
1267 | service = gss_pseudoflavor_to_service(cr->cr_gss_mech, cr->cr_flavor); | 1269 | service = gss_pseudoflavor_to_service(cr->cr_gss_mech, cr->cr_flavor); |
1268 | return service == RPC_GSS_SVC_INTEGRITY || | 1270 | return service == RPC_GSS_SVC_INTEGRITY || |
1269 | service == RPC_GSS_SVC_PRIVACY; | 1271 | service == RPC_GSS_SVC_PRIVACY; |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 0c0f3ea90de5..c2a4701d7286 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -3360,7 +3360,8 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr, | |||
3360 | 8 /* eir_clientid */ + | 3360 | 8 /* eir_clientid */ + |
3361 | 4 /* eir_sequenceid */ + | 3361 | 4 /* eir_sequenceid */ + |
3362 | 4 /* eir_flags */ + | 3362 | 4 /* eir_flags */ + |
3363 | 4 /* spr_how (SP4_NONE) */ + | 3363 | 4 /* spr_how */ + |
3364 | 8 /* spo_must_enforce, spo_must_allow */ + | ||
3364 | 8 /* so_minor_id */ + | 3365 | 8 /* so_minor_id */ + |
3365 | 4 /* so_major_id.len */ + | 3366 | 4 /* so_major_id.len */ + |
3366 | (XDR_QUADLEN(major_id_sz) * 4) + | 3367 | (XDR_QUADLEN(major_id_sz) * 4) + |
@@ -3372,8 +3373,6 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr, | |||
3372 | WRITE32(exid->seqid); | 3373 | WRITE32(exid->seqid); |
3373 | WRITE32(exid->flags); | 3374 | WRITE32(exid->flags); |
3374 | 3375 | ||
3375 | /* state_protect4_r. Currently only support SP4_NONE */ | ||
3376 | BUG_ON(exid->spa_how != SP4_NONE); | ||
3377 | WRITE32(exid->spa_how); | 3376 | WRITE32(exid->spa_how); |
3378 | switch (exid->spa_how) { | 3377 | switch (exid->spa_how) { |
3379 | case SP4_NONE: | 3378 | case SP4_NONE: |
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 998b17eda09d..9f6b96a09615 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -2965,6 +2965,11 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle, | |||
2965 | to = map_end & (PAGE_CACHE_SIZE - 1); | 2965 | to = map_end & (PAGE_CACHE_SIZE - 1); |
2966 | 2966 | ||
2967 | page = find_or_create_page(mapping, page_index, GFP_NOFS); | 2967 | page = find_or_create_page(mapping, page_index, GFP_NOFS); |
2968 | if (!page) { | ||
2969 | ret = -ENOMEM; | ||
2970 | mlog_errno(ret); | ||
2971 | break; | ||
2972 | } | ||
2968 | 2973 | ||
2969 | /* | 2974 | /* |
2970 | * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page | 2975 | * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page |
@@ -823,7 +823,7 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o | |||
823 | int lookup_flags = 0; | 823 | int lookup_flags = 0; |
824 | int acc_mode; | 824 | int acc_mode; |
825 | 825 | ||
826 | if (flags & O_CREAT) | 826 | if (flags & (O_CREAT | __O_TMPFILE)) |
827 | op->mode = (mode & S_IALLUGO) | S_IFREG; | 827 | op->mode = (mode & S_IALLUGO) | S_IFREG; |
828 | else | 828 | else |
829 | op->mode = 0; | 829 | op->mode = 0; |
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c index 33532f79b4f7..a958444a75fc 100644 --- a/fs/reiserfs/procfs.c +++ b/fs/reiserfs/procfs.c | |||
@@ -19,12 +19,13 @@ | |||
19 | /* | 19 | /* |
20 | * LOCKING: | 20 | * LOCKING: |
21 | * | 21 | * |
22 | * We rely on new Alexander Viro's super-block locking. | 22 | * These guys are evicted from procfs as the very first step in ->kill_sb(). |
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | 25 | ||
26 | static int show_version(struct seq_file *m, struct super_block *sb) | 26 | static int show_version(struct seq_file *m, void *unused) |
27 | { | 27 | { |
28 | struct super_block *sb = m->private; | ||
28 | char *format; | 29 | char *format; |
29 | 30 | ||
30 | if (REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_6)) { | 31 | if (REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_6)) { |
@@ -66,8 +67,9 @@ static int show_version(struct seq_file *m, struct super_block *sb) | |||
66 | #define DJP( x ) le32_to_cpu( jp -> x ) | 67 | #define DJP( x ) le32_to_cpu( jp -> x ) |
67 | #define JF( x ) ( r -> s_journal -> x ) | 68 | #define JF( x ) ( r -> s_journal -> x ) |
68 | 69 | ||
69 | static int show_super(struct seq_file *m, struct super_block *sb) | 70 | static int show_super(struct seq_file *m, void *unused) |
70 | { | 71 | { |
72 | struct super_block *sb = m->private; | ||
71 | struct reiserfs_sb_info *r = REISERFS_SB(sb); | 73 | struct reiserfs_sb_info *r = REISERFS_SB(sb); |
72 | 74 | ||
73 | seq_printf(m, "state: \t%s\n" | 75 | seq_printf(m, "state: \t%s\n" |
@@ -128,8 +130,9 @@ static int show_super(struct seq_file *m, struct super_block *sb) | |||
128 | return 0; | 130 | return 0; |
129 | } | 131 | } |
130 | 132 | ||
131 | static int show_per_level(struct seq_file *m, struct super_block *sb) | 133 | static int show_per_level(struct seq_file *m, void *unused) |
132 | { | 134 | { |
135 | struct super_block *sb = m->private; | ||
133 | struct reiserfs_sb_info *r = REISERFS_SB(sb); | 136 | struct reiserfs_sb_info *r = REISERFS_SB(sb); |
134 | int level; | 137 | int level; |
135 | 138 | ||
@@ -186,8 +189,9 @@ static int show_per_level(struct seq_file *m, struct super_block *sb) | |||
186 | return 0; | 189 | return 0; |
187 | } | 190 | } |
188 | 191 | ||
189 | static int show_bitmap(struct seq_file *m, struct super_block *sb) | 192 | static int show_bitmap(struct seq_file *m, void *unused) |
190 | { | 193 | { |
194 | struct super_block *sb = m->private; | ||
191 | struct reiserfs_sb_info *r = REISERFS_SB(sb); | 195 | struct reiserfs_sb_info *r = REISERFS_SB(sb); |
192 | 196 | ||
193 | seq_printf(m, "free_block: %lu\n" | 197 | seq_printf(m, "free_block: %lu\n" |
@@ -218,8 +222,9 @@ static int show_bitmap(struct seq_file *m, struct super_block *sb) | |||
218 | return 0; | 222 | return 0; |
219 | } | 223 | } |
220 | 224 | ||
221 | static int show_on_disk_super(struct seq_file *m, struct super_block *sb) | 225 | static int show_on_disk_super(struct seq_file *m, void *unused) |
222 | { | 226 | { |
227 | struct super_block *sb = m->private; | ||
223 | struct reiserfs_sb_info *sb_info = REISERFS_SB(sb); | 228 | struct reiserfs_sb_info *sb_info = REISERFS_SB(sb); |
224 | struct reiserfs_super_block *rs = sb_info->s_rs; | 229 | struct reiserfs_super_block *rs = sb_info->s_rs; |
225 | int hash_code = DFL(s_hash_function_code); | 230 | int hash_code = DFL(s_hash_function_code); |
@@ -261,8 +266,9 @@ static int show_on_disk_super(struct seq_file *m, struct super_block *sb) | |||
261 | return 0; | 266 | return 0; |
262 | } | 267 | } |
263 | 268 | ||
264 | static int show_oidmap(struct seq_file *m, struct super_block *sb) | 269 | static int show_oidmap(struct seq_file *m, void *unused) |
265 | { | 270 | { |
271 | struct super_block *sb = m->private; | ||
266 | struct reiserfs_sb_info *sb_info = REISERFS_SB(sb); | 272 | struct reiserfs_sb_info *sb_info = REISERFS_SB(sb); |
267 | struct reiserfs_super_block *rs = sb_info->s_rs; | 273 | struct reiserfs_super_block *rs = sb_info->s_rs; |
268 | unsigned int mapsize = le16_to_cpu(rs->s_v1.s_oid_cursize); | 274 | unsigned int mapsize = le16_to_cpu(rs->s_v1.s_oid_cursize); |
@@ -291,8 +297,9 @@ static int show_oidmap(struct seq_file *m, struct super_block *sb) | |||
291 | return 0; | 297 | return 0; |
292 | } | 298 | } |
293 | 299 | ||
294 | static int show_journal(struct seq_file *m, struct super_block *sb) | 300 | static int show_journal(struct seq_file *m, void *unused) |
295 | { | 301 | { |
302 | struct super_block *sb = m->private; | ||
296 | struct reiserfs_sb_info *r = REISERFS_SB(sb); | 303 | struct reiserfs_sb_info *r = REISERFS_SB(sb); |
297 | struct reiserfs_super_block *rs = r->s_rs; | 304 | struct reiserfs_super_block *rs = r->s_rs; |
298 | struct journal_params *jp = &rs->s_v1.s_journal; | 305 | struct journal_params *jp = &rs->s_v1.s_journal; |
@@ -383,92 +390,24 @@ static int show_journal(struct seq_file *m, struct super_block *sb) | |||
383 | return 0; | 390 | return 0; |
384 | } | 391 | } |
385 | 392 | ||
386 | /* iterator */ | ||
387 | static int test_sb(struct super_block *sb, void *data) | ||
388 | { | ||
389 | return data == sb; | ||
390 | } | ||
391 | |||
392 | static int set_sb(struct super_block *sb, void *data) | ||
393 | { | ||
394 | return -ENOENT; | ||
395 | } | ||
396 | |||
397 | struct reiserfs_seq_private { | ||
398 | struct super_block *sb; | ||
399 | int (*show) (struct seq_file *, struct super_block *); | ||
400 | }; | ||
401 | |||
402 | static void *r_start(struct seq_file *m, loff_t * pos) | ||
403 | { | ||
404 | struct reiserfs_seq_private *priv = m->private; | ||
405 | loff_t l = *pos; | ||
406 | |||
407 | if (l) | ||
408 | return NULL; | ||
409 | |||
410 | if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, priv->sb))) | ||
411 | return NULL; | ||
412 | |||
413 | up_write(&priv->sb->s_umount); | ||
414 | return priv->sb; | ||
415 | } | ||
416 | |||
417 | static void *r_next(struct seq_file *m, void *v, loff_t * pos) | ||
418 | { | ||
419 | ++*pos; | ||
420 | if (v) | ||
421 | deactivate_super(v); | ||
422 | return NULL; | ||
423 | } | ||
424 | |||
425 | static void r_stop(struct seq_file *m, void *v) | ||
426 | { | ||
427 | if (v) | ||
428 | deactivate_super(v); | ||
429 | } | ||
430 | |||
431 | static int r_show(struct seq_file *m, void *v) | ||
432 | { | ||
433 | struct reiserfs_seq_private *priv = m->private; | ||
434 | return priv->show(m, v); | ||
435 | } | ||
436 | |||
437 | static const struct seq_operations r_ops = { | ||
438 | .start = r_start, | ||
439 | .next = r_next, | ||
440 | .stop = r_stop, | ||
441 | .show = r_show, | ||
442 | }; | ||
443 | |||
444 | static int r_open(struct inode *inode, struct file *file) | 393 | static int r_open(struct inode *inode, struct file *file) |
445 | { | 394 | { |
446 | struct reiserfs_seq_private *priv; | 395 | return single_open(file, PDE_DATA(inode), |
447 | int ret = seq_open_private(file, &r_ops, | 396 | proc_get_parent_data(inode)); |
448 | sizeof(struct reiserfs_seq_private)); | ||
449 | |||
450 | if (!ret) { | ||
451 | struct seq_file *m = file->private_data; | ||
452 | priv = m->private; | ||
453 | priv->sb = proc_get_parent_data(inode); | ||
454 | priv->show = PDE_DATA(inode); | ||
455 | } | ||
456 | return ret; | ||
457 | } | 397 | } |
458 | 398 | ||
459 | static const struct file_operations r_file_operations = { | 399 | static const struct file_operations r_file_operations = { |
460 | .open = r_open, | 400 | .open = r_open, |
461 | .read = seq_read, | 401 | .read = seq_read, |
462 | .llseek = seq_lseek, | 402 | .llseek = seq_lseek, |
463 | .release = seq_release_private, | 403 | .release = single_release, |
464 | .owner = THIS_MODULE, | ||
465 | }; | 404 | }; |
466 | 405 | ||
467 | static struct proc_dir_entry *proc_info_root = NULL; | 406 | static struct proc_dir_entry *proc_info_root = NULL; |
468 | static const char proc_info_root_name[] = "fs/reiserfs"; | 407 | static const char proc_info_root_name[] = "fs/reiserfs"; |
469 | 408 | ||
470 | static void add_file(struct super_block *sb, char *name, | 409 | static void add_file(struct super_block *sb, char *name, |
471 | int (*func) (struct seq_file *, struct super_block *)) | 410 | int (*func) (struct seq_file *, void *)) |
472 | { | 411 | { |
473 | proc_create_data(name, 0, REISERFS_SB(sb)->procdir, | 412 | proc_create_data(name, 0, REISERFS_SB(sb)->procdir, |
474 | &r_file_operations, func); | 413 | &r_file_operations, func); |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index f8a23c3078f8..e2e202a07b31 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -499,6 +499,7 @@ int remove_save_link(struct inode *inode, int truncate) | |||
499 | static void reiserfs_kill_sb(struct super_block *s) | 499 | static void reiserfs_kill_sb(struct super_block *s) |
500 | { | 500 | { |
501 | if (REISERFS_SB(s)) { | 501 | if (REISERFS_SB(s)) { |
502 | reiserfs_proc_info_done(s); | ||
502 | /* | 503 | /* |
503 | * Force any pending inode evictions to occur now. Any | 504 | * Force any pending inode evictions to occur now. Any |
504 | * inodes to be removed that have extended attributes | 505 | * inodes to be removed that have extended attributes |
@@ -554,8 +555,6 @@ static void reiserfs_put_super(struct super_block *s) | |||
554 | REISERFS_SB(s)->reserved_blocks); | 555 | REISERFS_SB(s)->reserved_blocks); |
555 | } | 556 | } |
556 | 557 | ||
557 | reiserfs_proc_info_done(s); | ||
558 | |||
559 | reiserfs_write_unlock(s); | 558 | reiserfs_write_unlock(s); |
560 | mutex_destroy(&REISERFS_SB(s)->lock); | 559 | mutex_destroy(&REISERFS_SB(s)->lock); |
561 | kfree(s->s_fs_info); | 560 | kfree(s->s_fs_info); |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 56e6b68c8d2f..94383a70c1a3 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -274,15 +274,12 @@ struct acpi_device_wakeup { | |||
274 | }; | 274 | }; |
275 | 275 | ||
276 | struct acpi_device_physical_node { | 276 | struct acpi_device_physical_node { |
277 | u8 node_id; | 277 | unsigned int node_id; |
278 | struct list_head node; | 278 | struct list_head node; |
279 | struct device *dev; | 279 | struct device *dev; |
280 | bool put_online:1; | 280 | bool put_online:1; |
281 | }; | 281 | }; |
282 | 282 | ||
283 | /* set maximum of physical nodes to 32 for expansibility */ | ||
284 | #define ACPI_MAX_PHYSICAL_NODE 32 | ||
285 | |||
286 | /* Device */ | 283 | /* Device */ |
287 | struct acpi_device { | 284 | struct acpi_device { |
288 | int device_type; | 285 | int device_type; |
@@ -302,10 +299,9 @@ struct acpi_device { | |||
302 | struct acpi_driver *driver; | 299 | struct acpi_driver *driver; |
303 | void *driver_data; | 300 | void *driver_data; |
304 | struct device dev; | 301 | struct device dev; |
305 | u8 physical_node_count; | 302 | unsigned int physical_node_count; |
306 | struct list_head physical_node_list; | 303 | struct list_head physical_node_list; |
307 | struct mutex physical_node_lock; | 304 | struct mutex physical_node_lock; |
308 | DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE); | ||
309 | struct list_head power_dependent; | 305 | struct list_head power_dependent; |
310 | void (*remove)(struct acpi_device *); | 306 | void (*remove)(struct acpi_device *); |
311 | }; | 307 | }; |
@@ -445,7 +441,11 @@ struct acpi_pci_root { | |||
445 | }; | 441 | }; |
446 | 442 | ||
447 | /* helper */ | 443 | /* helper */ |
448 | acpi_handle acpi_get_child(acpi_handle, u64); | 444 | acpi_handle acpi_find_child(acpi_handle, u64, bool); |
445 | static inline acpi_handle acpi_get_child(acpi_handle handle, u64 addr) | ||
446 | { | ||
447 | return acpi_find_child(handle, addr, false); | ||
448 | } | ||
449 | int acpi_is_root_bridge(acpi_handle); | 449 | int acpi_is_root_bridge(acpi_handle); |
450 | struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); | 450 | struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); |
451 | #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev)) | 451 | #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev)) |
diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h index f5e1168c7647..d639049a613d 100644 --- a/include/drm/drm_fixed.h +++ b/include/drm/drm_fixed.h | |||
@@ -84,12 +84,12 @@ static inline int drm_fixp2int(int64_t a) | |||
84 | return ((s64)a) >> DRM_FIXED_POINT; | 84 | return ((s64)a) >> DRM_FIXED_POINT; |
85 | } | 85 | } |
86 | 86 | ||
87 | static inline s64 drm_fixp_msbset(int64_t a) | 87 | static inline unsigned drm_fixp_msbset(int64_t a) |
88 | { | 88 | { |
89 | unsigned shift, sign = (a >> 63) & 1; | 89 | unsigned shift, sign = (a >> 63) & 1; |
90 | 90 | ||
91 | for (shift = 62; shift > 0; --shift) | 91 | for (shift = 62; shift > 0; --shift) |
92 | if ((a >> shift) != sign) | 92 | if (((a >> shift) & 1) != sign) |
93 | return shift; | 93 | return shift; |
94 | 94 | ||
95 | return 0; | 95 | return 0; |
@@ -100,9 +100,9 @@ static inline s64 drm_fixp_mul(s64 a, s64 b) | |||
100 | unsigned shift = drm_fixp_msbset(a) + drm_fixp_msbset(b); | 100 | unsigned shift = drm_fixp_msbset(a) + drm_fixp_msbset(b); |
101 | s64 result; | 101 | s64 result; |
102 | 102 | ||
103 | if (shift > 63) { | 103 | if (shift > 61) { |
104 | shift = shift - 63; | 104 | shift = shift - 61; |
105 | a >>= shift >> 1; | 105 | a >>= (shift >> 1) + (shift & 1); |
106 | b >>= shift >> 1; | 106 | b >>= shift >> 1; |
107 | } else | 107 | } else |
108 | shift = 0; | 108 | shift = 0; |
@@ -120,7 +120,7 @@ static inline s64 drm_fixp_mul(s64 a, s64 b) | |||
120 | 120 | ||
121 | static inline s64 drm_fixp_div(s64 a, s64 b) | 121 | static inline s64 drm_fixp_div(s64 a, s64 b) |
122 | { | 122 | { |
123 | unsigned shift = 63 - drm_fixp_msbset(a); | 123 | unsigned shift = 62 - drm_fixp_msbset(a); |
124 | s64 result; | 124 | s64 result; |
125 | 125 | ||
126 | a <<= shift; | 126 | a <<= shift; |
@@ -154,7 +154,7 @@ static inline s64 drm_fixp_exp(s64 x) | |||
154 | } | 154 | } |
155 | 155 | ||
156 | if (x < 0) | 156 | if (x < 0) |
157 | sum = drm_fixp_div(1, sum); | 157 | sum = drm_fixp_div(DRM_FIXED_ONE, sum); |
158 | 158 | ||
159 | return sum; | 159 | return sum; |
160 | } | 160 | } |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 4372658c73ae..120d57a1c3a5 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -78,6 +78,11 @@ struct trace_iterator { | |||
78 | /* trace_seq for __print_flags() and __print_symbolic() etc. */ | 78 | /* trace_seq for __print_flags() and __print_symbolic() etc. */ |
79 | struct trace_seq tmp_seq; | 79 | struct trace_seq tmp_seq; |
80 | 80 | ||
81 | cpumask_var_t started; | ||
82 | |||
83 | /* it's true when current open file is snapshot */ | ||
84 | bool snapshot; | ||
85 | |||
81 | /* The below is zeroed out in pipe_read */ | 86 | /* The below is zeroed out in pipe_read */ |
82 | struct trace_seq seq; | 87 | struct trace_seq seq; |
83 | struct trace_entry *ent; | 88 | struct trace_entry *ent; |
@@ -90,10 +95,7 @@ struct trace_iterator { | |||
90 | loff_t pos; | 95 | loff_t pos; |
91 | long idx; | 96 | long idx; |
92 | 97 | ||
93 | cpumask_var_t started; | 98 | /* All new field here will be zeroed out in pipe_read */ |
94 | |||
95 | /* it's true when current open file is snapshot */ | ||
96 | bool snapshot; | ||
97 | }; | 99 | }; |
98 | 100 | ||
99 | enum trace_iter_flags { | 101 | enum trace_iter_flags { |
@@ -332,7 +334,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type, | |||
332 | const char *name, int offset, int size, | 334 | const char *name, int offset, int size, |
333 | int is_signed, int filter_type); | 335 | int is_signed, int filter_type); |
334 | extern int trace_add_event_call(struct ftrace_event_call *call); | 336 | extern int trace_add_event_call(struct ftrace_event_call *call); |
335 | extern void trace_remove_event_call(struct ftrace_event_call *call); | 337 | extern int trace_remove_event_call(struct ftrace_event_call *call); |
336 | 338 | ||
337 | #define is_signed_type(type) (((type)(-1)) < (type)1) | 339 | #define is_signed_type(type) (((type)(-1)) < (type)1) |
338 | 340 | ||
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h index 3869c525b052..369cf2cd5144 100644 --- a/include/linux/iio/trigger.h +++ b/include/linux/iio/trigger.h | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | #include <linux/irq.h> | 9 | #include <linux/irq.h> |
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/atomic.h> | ||
11 | 12 | ||
12 | #ifndef _IIO_TRIGGER_H_ | 13 | #ifndef _IIO_TRIGGER_H_ |
13 | #define _IIO_TRIGGER_H_ | 14 | #define _IIO_TRIGGER_H_ |
@@ -61,7 +62,7 @@ struct iio_trigger { | |||
61 | 62 | ||
62 | struct list_head list; | 63 | struct list_head list; |
63 | struct list_head alloc_list; | 64 | struct list_head alloc_list; |
64 | int use_count; | 65 | atomic_t use_count; |
65 | 66 | ||
66 | struct irq_chip subirq_chip; | 67 | struct irq_chip subirq_chip; |
67 | int subirq_base; | 68 | int subirq_base; |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 3bef14c6586b..482ad2d84a32 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -629,7 +629,7 @@ extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode); | |||
629 | static inline void tracing_start(void) { } | 629 | static inline void tracing_start(void) { } |
630 | static inline void tracing_stop(void) { } | 630 | static inline void tracing_stop(void) { } |
631 | static inline void ftrace_off_permanent(void) { } | 631 | static inline void ftrace_off_permanent(void) { } |
632 | static inline void trace_dump_stack(void) { } | 632 | static inline void trace_dump_stack(int skip) { } |
633 | 633 | ||
634 | static inline void tracing_on(void) { } | 634 | static inline void tracing_on(void) { } |
635 | static inline void tracing_off(void) { } | 635 | static inline void tracing_off(void) { } |
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h index 8d73fe29796a..db1791bb997a 100644 --- a/include/linux/mfd/ti_am335x_tscadc.h +++ b/include/linux/mfd/ti_am335x_tscadc.h | |||
@@ -113,11 +113,27 @@ | |||
113 | #define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3) | 113 | #define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3) |
114 | #define CNTRLREG_TSCENB BIT(7) | 114 | #define CNTRLREG_TSCENB BIT(7) |
115 | 115 | ||
116 | /* FIFO READ Register */ | ||
117 | #define FIFOREAD_DATA_MASK (0xfff << 0) | ||
118 | #define FIFOREAD_CHNLID_MASK (0xf << 16) | ||
119 | |||
120 | /* Sequencer Status */ | ||
121 | #define SEQ_STATUS BIT(5) | ||
122 | |||
116 | #define ADC_CLK 3000000 | 123 | #define ADC_CLK 3000000 |
117 | #define MAX_CLK_DIV 7 | 124 | #define MAX_CLK_DIV 7 |
118 | #define TOTAL_STEPS 16 | 125 | #define TOTAL_STEPS 16 |
119 | #define TOTAL_CHANNELS 8 | 126 | #define TOTAL_CHANNELS 8 |
120 | 127 | ||
128 | /* | ||
129 | * ADC runs at 3MHz, and it takes | ||
130 | * 15 cycles to latch one data output. | ||
131 | * Hence the idle time for ADC to | ||
132 | * process one sample data would be | ||
133 | * around 5 micro seconds. | ||
134 | */ | ||
135 | #define IDLE_TIMEOUT 5 /* microsec */ | ||
136 | |||
121 | #define TSCADC_CELLS 2 | 137 | #define TSCADC_CELLS 2 |
122 | 138 | ||
123 | struct ti_tscadc_dev { | 139 | struct ti_tscadc_dev { |
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index 8de8d8f22384..737685e9e852 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h | |||
@@ -690,6 +690,26 @@ struct mlx5_query_cq_mbox_out { | |||
690 | __be64 pas[0]; | 690 | __be64 pas[0]; |
691 | }; | 691 | }; |
692 | 692 | ||
693 | struct mlx5_enable_hca_mbox_in { | ||
694 | struct mlx5_inbox_hdr hdr; | ||
695 | u8 rsvd[8]; | ||
696 | }; | ||
697 | |||
698 | struct mlx5_enable_hca_mbox_out { | ||
699 | struct mlx5_outbox_hdr hdr; | ||
700 | u8 rsvd[8]; | ||
701 | }; | ||
702 | |||
703 | struct mlx5_disable_hca_mbox_in { | ||
704 | struct mlx5_inbox_hdr hdr; | ||
705 | u8 rsvd[8]; | ||
706 | }; | ||
707 | |||
708 | struct mlx5_disable_hca_mbox_out { | ||
709 | struct mlx5_outbox_hdr hdr; | ||
710 | u8 rsvd[8]; | ||
711 | }; | ||
712 | |||
693 | struct mlx5_eq_context { | 713 | struct mlx5_eq_context { |
694 | u8 status; | 714 | u8 status; |
695 | u8 ec_oi; | 715 | u8 ec_oi; |
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index f22e4419839b..2aa258b0ced1 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h | |||
@@ -101,6 +101,8 @@ enum { | |||
101 | MLX5_CMD_OP_QUERY_ADAPTER = 0x101, | 101 | MLX5_CMD_OP_QUERY_ADAPTER = 0x101, |
102 | MLX5_CMD_OP_INIT_HCA = 0x102, | 102 | MLX5_CMD_OP_INIT_HCA = 0x102, |
103 | MLX5_CMD_OP_TEARDOWN_HCA = 0x103, | 103 | MLX5_CMD_OP_TEARDOWN_HCA = 0x103, |
104 | MLX5_CMD_OP_ENABLE_HCA = 0x104, | ||
105 | MLX5_CMD_OP_DISABLE_HCA = 0x105, | ||
104 | MLX5_CMD_OP_QUERY_PAGES = 0x107, | 106 | MLX5_CMD_OP_QUERY_PAGES = 0x107, |
105 | MLX5_CMD_OP_MANAGE_PAGES = 0x108, | 107 | MLX5_CMD_OP_MANAGE_PAGES = 0x108, |
106 | MLX5_CMD_OP_SET_HCA_CAP = 0x109, | 108 | MLX5_CMD_OP_SET_HCA_CAP = 0x109, |
@@ -690,7 +692,7 @@ int mlx5_pagealloc_start(struct mlx5_core_dev *dev); | |||
690 | void mlx5_pagealloc_stop(struct mlx5_core_dev *dev); | 692 | void mlx5_pagealloc_stop(struct mlx5_core_dev *dev); |
691 | void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, | 693 | void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, |
692 | s16 npages); | 694 | s16 npages); |
693 | int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev); | 695 | int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot); |
694 | int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev); | 696 | int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev); |
695 | void mlx5_register_debugfs(void); | 697 | void mlx5_register_debugfs(void); |
696 | void mlx5_unregister_debugfs(void); | 698 | void mlx5_unregister_debugfs(void); |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index b62d4af6c667..45e921401b06 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -361,7 +361,8 @@ struct ssb_device_id { | |||
361 | __u16 vendor; | 361 | __u16 vendor; |
362 | __u16 coreid; | 362 | __u16 coreid; |
363 | __u8 revision; | 363 | __u8 revision; |
364 | }; | 364 | __u8 __pad; |
365 | } __attribute__((packed, aligned(2))); | ||
365 | #define SSB_DEVICE(_vendor, _coreid, _revision) \ | 366 | #define SSB_DEVICE(_vendor, _coreid, _revision) \ |
366 | { .vendor = _vendor, .coreid = _coreid, .revision = _revision, } | 367 | { .vendor = _vendor, .coreid = _coreid, .revision = _revision, } |
367 | #define SSB_DEVTABLE_END \ | 368 | #define SSB_DEVTABLE_END \ |
@@ -377,7 +378,7 @@ struct bcma_device_id { | |||
377 | __u16 id; | 378 | __u16 id; |
378 | __u8 rev; | 379 | __u8 rev; |
379 | __u8 class; | 380 | __u8 class; |
380 | }; | 381 | } __attribute__((packed,aligned(2))); |
381 | #define BCMA_CORE(_manuf, _id, _rev, _class) \ | 382 | #define BCMA_CORE(_manuf, _id, _rev, _class) \ |
382 | { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, } | 383 | { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, } |
383 | #define BCMA_CORETABLE_END \ | 384 | #define BCMA_CORETABLE_END \ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 0741a1e919a5..9a4156845e93 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -973,7 +973,7 @@ struct net_device_ops { | |||
973 | gfp_t gfp); | 973 | gfp_t gfp); |
974 | void (*ndo_netpoll_cleanup)(struct net_device *dev); | 974 | void (*ndo_netpoll_cleanup)(struct net_device *dev); |
975 | #endif | 975 | #endif |
976 | #ifdef CONFIG_NET_LL_RX_POLL | 976 | #ifdef CONFIG_NET_RX_BUSY_POLL |
977 | int (*ndo_busy_poll)(struct napi_struct *dev); | 977 | int (*ndo_busy_poll)(struct napi_struct *dev); |
978 | #endif | 978 | #endif |
979 | int (*ndo_set_vf_mac)(struct net_device *dev, | 979 | int (*ndo_set_vf_mac)(struct net_device *dev, |
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 75981d0b57dc..580a5320cc96 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/list.h> | 16 | #include <linux/list.h> |
17 | #include <linux/rbtree.h> | 17 | #include <linux/rbtree.h> |
18 | #include <linux/err.h> | ||
18 | 19 | ||
19 | struct module; | 20 | struct module; |
20 | struct device; | 21 | struct device; |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 50d04b92ceda..d722490da030 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1628,6 +1628,7 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, | |||
1628 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ | 1628 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ |
1629 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ | 1629 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ |
1630 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ | 1630 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ |
1631 | #define PF_SUSPEND_TASK 0x80000000 /* this thread called freeze_processes and should not be frozen */ | ||
1631 | 1632 | ||
1632 | /* | 1633 | /* |
1633 | * Only the _current_ task can read/write to tsk->flags, but other | 1634 | * Only the _current_ task can read/write to tsk->flags, but other |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 5afefa01a13c..3b71a4e83642 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -501,7 +501,7 @@ struct sk_buff { | |||
501 | /* 7/9 bit hole (depending on ndisc_nodetype presence) */ | 501 | /* 7/9 bit hole (depending on ndisc_nodetype presence) */ |
502 | kmemcheck_bitfield_end(flags2); | 502 | kmemcheck_bitfield_end(flags2); |
503 | 503 | ||
504 | #if defined CONFIG_NET_DMA || defined CONFIG_NET_LL_RX_POLL | 504 | #if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL |
505 | union { | 505 | union { |
506 | unsigned int napi_id; | 506 | unsigned int napi_id; |
507 | dma_cookie_t dma_cookie; | 507 | dma_cookie_t dma_cookie; |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 6d870353674a..1821445708d6 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
@@ -121,6 +121,7 @@ struct rpc_task_setup { | |||
121 | #define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */ | 121 | #define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */ |
122 | #define RPC_TASK_SENT 0x0800 /* message was sent */ | 122 | #define RPC_TASK_SENT 0x0800 /* message was sent */ |
123 | #define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ | 123 | #define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ |
124 | #define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */ | ||
124 | 125 | ||
125 | #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) | 126 | #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) |
126 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) | 127 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) |
diff --git a/include/linux/tick.h b/include/linux/tick.h index 9180f4b85e6d..62bd8b72873c 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h | |||
@@ -174,10 +174,4 @@ static inline void tick_nohz_task_switch(struct task_struct *tsk) { } | |||
174 | #endif | 174 | #endif |
175 | 175 | ||
176 | 176 | ||
177 | # ifdef CONFIG_CPU_IDLE_GOV_MENU | ||
178 | extern void menu_hrtimer_cancel(void); | ||
179 | # else | ||
180 | static inline void menu_hrtimer_cancel(void) {} | ||
181 | # endif /* CONFIG_CPU_IDLE_GOV_MENU */ | ||
182 | |||
183 | #endif | 177 | #endif |
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index b6b215f13b45..14105c26a836 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h | |||
@@ -23,6 +23,7 @@ struct user_namespace { | |||
23 | struct uid_gid_map projid_map; | 23 | struct uid_gid_map projid_map; |
24 | atomic_t count; | 24 | atomic_t count; |
25 | struct user_namespace *parent; | 25 | struct user_namespace *parent; |
26 | int level; | ||
26 | kuid_t owner; | 27 | kuid_t owner; |
27 | kgid_t group; | 28 | kgid_t group; |
28 | unsigned int proc_inum; | 29 | unsigned int proc_inum; |
diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h index 76be077340ea..7dc17e2456de 100644 --- a/include/linux/vmpressure.h +++ b/include/linux/vmpressure.h | |||
@@ -12,7 +12,7 @@ struct vmpressure { | |||
12 | unsigned long scanned; | 12 | unsigned long scanned; |
13 | unsigned long reclaimed; | 13 | unsigned long reclaimed; |
14 | /* The lock is used to keep the scanned/reclaimed above in sync. */ | 14 | /* The lock is used to keep the scanned/reclaimed above in sync. */ |
15 | struct mutex sr_lock; | 15 | struct spinlock sr_lock; |
16 | 16 | ||
17 | /* The list of vmpressure_event structs. */ | 17 | /* The list of vmpressure_event structs. */ |
18 | struct list_head events; | 18 | struct list_head events; |
@@ -30,6 +30,7 @@ extern void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, | |||
30 | extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio); | 30 | extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio); |
31 | 31 | ||
32 | extern void vmpressure_init(struct vmpressure *vmpr); | 32 | extern void vmpressure_init(struct vmpressure *vmpr); |
33 | extern void vmpressure_cleanup(struct vmpressure *vmpr); | ||
33 | extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg); | 34 | extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg); |
34 | extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr); | 35 | extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr); |
35 | extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css); | 36 | extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css); |
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 7343a27fe819..47ada23345a1 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #define _V4L2_CTRLS_H | 22 | #define _V4L2_CTRLS_H |
23 | 23 | ||
24 | #include <linux/list.h> | 24 | #include <linux/list.h> |
25 | #include <linux/mutex.h> | ||
25 | #include <linux/videodev2.h> | 26 | #include <linux/videodev2.h> |
26 | 27 | ||
27 | /* forward references */ | 28 | /* forward references */ |
diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h index a14339c2985f..f18b91966d3d 100644 --- a/include/net/busy_poll.h +++ b/include/net/busy_poll.h | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/netdevice.h> | 27 | #include <linux/netdevice.h> |
28 | #include <net/ip.h> | 28 | #include <net/ip.h> |
29 | 29 | ||
30 | #ifdef CONFIG_NET_LL_RX_POLL | 30 | #ifdef CONFIG_NET_RX_BUSY_POLL |
31 | 31 | ||
32 | struct napi_struct; | 32 | struct napi_struct; |
33 | extern unsigned int sysctl_net_busy_read __read_mostly; | 33 | extern unsigned int sysctl_net_busy_read __read_mostly; |
@@ -146,7 +146,7 @@ static inline void sk_mark_napi_id(struct sock *sk, struct sk_buff *skb) | |||
146 | sk->sk_napi_id = skb->napi_id; | 146 | sk->sk_napi_id = skb->napi_id; |
147 | } | 147 | } |
148 | 148 | ||
149 | #else /* CONFIG_NET_LL_RX_POLL */ | 149 | #else /* CONFIG_NET_RX_BUSY_POLL */ |
150 | static inline unsigned long net_busy_loop_on(void) | 150 | static inline unsigned long net_busy_loop_on(void) |
151 | { | 151 | { |
152 | return 0; | 152 | return 0; |
@@ -181,5 +181,10 @@ static inline bool busy_loop_timeout(unsigned long end_time) | |||
181 | return true; | 181 | return true; |
182 | } | 182 | } |
183 | 183 | ||
184 | #endif /* CONFIG_NET_LL_RX_POLL */ | 184 | static inline bool sk_busy_loop(struct sock *sk, int nonblock) |
185 | { | ||
186 | return false; | ||
187 | } | ||
188 | |||
189 | #endif /* CONFIG_NET_RX_BUSY_POLL */ | ||
185 | #endif /* _LINUX_NET_BUSY_POLL_H */ | 190 | #endif /* _LINUX_NET_BUSY_POLL_H */ |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 2a601e7da1bf..48ec25a7fcb6 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -300,7 +300,7 @@ extern void inet6_rt_notify(int event, struct rt6_info *rt, | |||
300 | struct nl_info *info); | 300 | struct nl_info *info); |
301 | 301 | ||
302 | extern void fib6_run_gc(unsigned long expires, | 302 | extern void fib6_run_gc(unsigned long expires, |
303 | struct net *net); | 303 | struct net *net, bool force); |
304 | 304 | ||
305 | extern void fib6_gc_cleanup(void); | 305 | extern void fib6_gc_cleanup(void); |
306 | 306 | ||
diff --git a/include/net/ndisc.h b/include/net/ndisc.h index 949d77528f2f..6fea32340ae8 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h | |||
@@ -119,7 +119,7 @@ extern struct ndisc_options *ndisc_parse_options(u8 *opt, int opt_len, | |||
119 | * if RFC 3831 IPv6-over-Fibre Channel is ever implemented it may | 119 | * if RFC 3831 IPv6-over-Fibre Channel is ever implemented it may |
120 | * also need a pad of 2. | 120 | * also need a pad of 2. |
121 | */ | 121 | */ |
122 | static int ndisc_addr_option_pad(unsigned short type) | 122 | static inline int ndisc_addr_option_pad(unsigned short type) |
123 | { | 123 | { |
124 | switch (type) { | 124 | switch (type) { |
125 | case ARPHRD_INFINIBAND: return 2; | 125 | case ARPHRD_INFINIBAND: return 2; |
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h index 0af851c3b038..b64b7bce4b94 100644 --- a/include/net/nfc/hci.h +++ b/include/net/nfc/hci.h | |||
@@ -59,7 +59,7 @@ struct nfc_hci_ops { | |||
59 | struct nfc_target *target); | 59 | struct nfc_target *target); |
60 | int (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event, | 60 | int (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event, |
61 | struct sk_buff *skb); | 61 | struct sk_buff *skb); |
62 | int (*fw_upload)(struct nfc_hci_dev *hdev, const char *firmware_name); | 62 | int (*fw_download)(struct nfc_hci_dev *hdev, const char *firmware_name); |
63 | int (*discover_se)(struct nfc_hci_dev *dev); | 63 | int (*discover_se)(struct nfc_hci_dev *dev); |
64 | int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx); | 64 | int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx); |
65 | int (*disable_se)(struct nfc_hci_dev *dev, u32 se_idx); | 65 | int (*disable_se)(struct nfc_hci_dev *dev, u32 se_idx); |
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h index 0e353f1658bb..5f286b726bb6 100644 --- a/include/net/nfc/nfc.h +++ b/include/net/nfc/nfc.h | |||
@@ -68,7 +68,7 @@ struct nfc_ops { | |||
68 | void *cb_context); | 68 | void *cb_context); |
69 | int (*tm_send)(struct nfc_dev *dev, struct sk_buff *skb); | 69 | int (*tm_send)(struct nfc_dev *dev, struct sk_buff *skb); |
70 | int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target); | 70 | int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target); |
71 | int (*fw_upload)(struct nfc_dev *dev, const char *firmware_name); | 71 | int (*fw_download)(struct nfc_dev *dev, const char *firmware_name); |
72 | 72 | ||
73 | /* Secure Element API */ | 73 | /* Secure Element API */ |
74 | int (*discover_se)(struct nfc_dev *dev); | 74 | int (*discover_se)(struct nfc_dev *dev); |
@@ -127,7 +127,7 @@ struct nfc_dev { | |||
127 | int targets_generation; | 127 | int targets_generation; |
128 | struct device dev; | 128 | struct device dev; |
129 | bool dev_up; | 129 | bool dev_up; |
130 | bool fw_upload_in_progress; | 130 | bool fw_download_in_progress; |
131 | u8 rf_mode; | 131 | u8 rf_mode; |
132 | bool polling; | 132 | bool polling; |
133 | struct nfc_target *active_target; | 133 | struct nfc_target *active_target; |
diff --git a/include/net/sock.h b/include/net/sock.h index 95a5a2c6925a..31d5cfbb51ec 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -327,7 +327,7 @@ struct sock { | |||
327 | #ifdef CONFIG_RPS | 327 | #ifdef CONFIG_RPS |
328 | __u32 sk_rxhash; | 328 | __u32 sk_rxhash; |
329 | #endif | 329 | #endif |
330 | #ifdef CONFIG_NET_LL_RX_POLL | 330 | #ifdef CONFIG_NET_RX_BUSY_POLL |
331 | unsigned int sk_napi_id; | 331 | unsigned int sk_napi_id; |
332 | unsigned int sk_ll_usec; | 332 | unsigned int sk_ll_usec; |
333 | #endif | 333 | #endif |
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h index caed0f324d5f..8137dd8d2adf 100644 --- a/include/uapi/linux/nfc.h +++ b/include/uapi/linux/nfc.h | |||
@@ -69,8 +69,8 @@ | |||
69 | * starting a poll from a device which has a secure element enabled means | 69 | * starting a poll from a device which has a secure element enabled means |
70 | * we want to do SE based card emulation. | 70 | * we want to do SE based card emulation. |
71 | * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element. | 71 | * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element. |
72 | * @NFC_CMD_FW_UPLOAD: Request to Load/flash firmware, or event to inform that | 72 | * @NFC_CMD_FW_DOWNLOAD: Request to Load/flash firmware, or event to inform |
73 | * some firmware was loaded | 73 | * that some firmware was loaded |
74 | */ | 74 | */ |
75 | enum nfc_commands { | 75 | enum nfc_commands { |
76 | NFC_CMD_UNSPEC, | 76 | NFC_CMD_UNSPEC, |
@@ -94,7 +94,7 @@ enum nfc_commands { | |||
94 | NFC_CMD_DISABLE_SE, | 94 | NFC_CMD_DISABLE_SE, |
95 | NFC_CMD_LLC_SDREQ, | 95 | NFC_CMD_LLC_SDREQ, |
96 | NFC_EVENT_LLC_SDRES, | 96 | NFC_EVENT_LLC_SDRES, |
97 | NFC_CMD_FW_UPLOAD, | 97 | NFC_CMD_FW_DOWNLOAD, |
98 | NFC_EVENT_SE_ADDED, | 98 | NFC_EVENT_SE_ADDED, |
99 | NFC_EVENT_SE_REMOVED, | 99 | NFC_EVENT_SE_REMOVED, |
100 | /* private: internal use only */ | 100 | /* private: internal use only */ |
diff --git a/kernel/Makefile b/kernel/Makefile index 470839d1a30e..35ef1185e359 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y = fork.o exec_domain.o panic.o printk.o \ | 5 | obj-y = fork.o exec_domain.o panic.o \ |
6 | cpu.o exit.o itimer.o time.o softirq.o resource.o \ | 6 | cpu.o exit.o itimer.o time.o softirq.o resource.o \ |
7 | sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \ | 7 | sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \ |
8 | signal.o sys.o kmod.o workqueue.o pid.o task_work.o \ | 8 | signal.o sys.o kmod.o workqueue.o pid.o task_work.o \ |
@@ -24,6 +24,7 @@ endif | |||
24 | 24 | ||
25 | obj-y += sched/ | 25 | obj-y += sched/ |
26 | obj-y += power/ | 26 | obj-y += power/ |
27 | obj-y += printk/ | ||
27 | obj-y += cpu/ | 28 | obj-y += cpu/ |
28 | 29 | ||
29 | obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o | 30 | obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 789ec4683db3..781845a013ab 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -4335,8 +4335,10 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry, | |||
4335 | } | 4335 | } |
4336 | 4336 | ||
4337 | err = percpu_ref_init(&css->refcnt, css_release); | 4337 | err = percpu_ref_init(&css->refcnt, css_release); |
4338 | if (err) | 4338 | if (err) { |
4339 | ss->css_free(cgrp); | ||
4339 | goto err_free_all; | 4340 | goto err_free_all; |
4341 | } | ||
4340 | 4342 | ||
4341 | init_cgroup_css(css, ss, cgrp); | 4343 | init_cgroup_css(css, ss, cgrp); |
4342 | 4344 | ||
diff --git a/kernel/freezer.c b/kernel/freezer.c index 8b2afc1c9df0..b462fa197517 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c | |||
@@ -33,7 +33,7 @@ static DEFINE_SPINLOCK(freezer_lock); | |||
33 | */ | 33 | */ |
34 | bool freezing_slow_path(struct task_struct *p) | 34 | bool freezing_slow_path(struct task_struct *p) |
35 | { | 35 | { |
36 | if (p->flags & PF_NOFREEZE) | 36 | if (p->flags & (PF_NOFREEZE | PF_SUSPEND_TASK)) |
37 | return false; | 37 | return false; |
38 | 38 | ||
39 | if (pm_nosig_freezing || cgroup_freezing(p)) | 39 | if (pm_nosig_freezing || cgroup_freezing(p)) |
diff --git a/kernel/power/process.c b/kernel/power/process.c index fc0df8486449..06ec8869dbf1 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
@@ -109,6 +109,8 @@ static int try_to_freeze_tasks(bool user_only) | |||
109 | 109 | ||
110 | /** | 110 | /** |
111 | * freeze_processes - Signal user space processes to enter the refrigerator. | 111 | * freeze_processes - Signal user space processes to enter the refrigerator. |
112 | * The current thread will not be frozen. The same process that calls | ||
113 | * freeze_processes must later call thaw_processes. | ||
112 | * | 114 | * |
113 | * On success, returns 0. On failure, -errno and system is fully thawed. | 115 | * On success, returns 0. On failure, -errno and system is fully thawed. |
114 | */ | 116 | */ |
@@ -120,6 +122,9 @@ int freeze_processes(void) | |||
120 | if (error) | 122 | if (error) |
121 | return error; | 123 | return error; |
122 | 124 | ||
125 | /* Make sure this task doesn't get frozen */ | ||
126 | current->flags |= PF_SUSPEND_TASK; | ||
127 | |||
123 | if (!pm_freezing) | 128 | if (!pm_freezing) |
124 | atomic_inc(&system_freezing_cnt); | 129 | atomic_inc(&system_freezing_cnt); |
125 | 130 | ||
@@ -168,6 +173,7 @@ int freeze_kernel_threads(void) | |||
168 | void thaw_processes(void) | 173 | void thaw_processes(void) |
169 | { | 174 | { |
170 | struct task_struct *g, *p; | 175 | struct task_struct *g, *p; |
176 | struct task_struct *curr = current; | ||
171 | 177 | ||
172 | if (pm_freezing) | 178 | if (pm_freezing) |
173 | atomic_dec(&system_freezing_cnt); | 179 | atomic_dec(&system_freezing_cnt); |
@@ -182,10 +188,15 @@ void thaw_processes(void) | |||
182 | 188 | ||
183 | read_lock(&tasklist_lock); | 189 | read_lock(&tasklist_lock); |
184 | do_each_thread(g, p) { | 190 | do_each_thread(g, p) { |
191 | /* No other threads should have PF_SUSPEND_TASK set */ | ||
192 | WARN_ON((p != curr) && (p->flags & PF_SUSPEND_TASK)); | ||
185 | __thaw_task(p); | 193 | __thaw_task(p); |
186 | } while_each_thread(g, p); | 194 | } while_each_thread(g, p); |
187 | read_unlock(&tasklist_lock); | 195 | read_unlock(&tasklist_lock); |
188 | 196 | ||
197 | WARN_ON(!(curr->flags & PF_SUSPEND_TASK)); | ||
198 | curr->flags &= ~PF_SUSPEND_TASK; | ||
199 | |||
189 | usermodehelper_enable(); | 200 | usermodehelper_enable(); |
190 | 201 | ||
191 | schedule(); | 202 | schedule(); |
diff --git a/kernel/printk/Makefile b/kernel/printk/Makefile new file mode 100644 index 000000000000..85405bdcf2b3 --- /dev/null +++ b/kernel/printk/Makefile | |||
@@ -0,0 +1,2 @@ | |||
1 | obj-y = printk.o | ||
2 | obj-$(CONFIG_A11Y_BRAILLE_CONSOLE) += braille.o | ||
diff --git a/kernel/printk/braille.c b/kernel/printk/braille.c new file mode 100644 index 000000000000..276762f3a460 --- /dev/null +++ b/kernel/printk/braille.c | |||
@@ -0,0 +1,49 @@ | |||
1 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
2 | |||
3 | #include <linux/kernel.h> | ||
4 | #include <linux/console.h> | ||
5 | #include <linux/string.h> | ||
6 | |||
7 | #include "console_cmdline.h" | ||
8 | #include "braille.h" | ||
9 | |||
10 | char *_braille_console_setup(char **str, char **brl_options) | ||
11 | { | ||
12 | if (!memcmp(*str, "brl,", 4)) { | ||
13 | *brl_options = ""; | ||
14 | *str += 4; | ||
15 | } else if (!memcmp(str, "brl=", 4)) { | ||
16 | *brl_options = *str + 4; | ||
17 | *str = strchr(*brl_options, ','); | ||
18 | if (!*str) | ||
19 | pr_err("need port name after brl=\n"); | ||
20 | else | ||
21 | *((*str)++) = 0; | ||
22 | } else | ||
23 | return NULL; | ||
24 | |||
25 | return *str; | ||
26 | } | ||
27 | |||
28 | int | ||
29 | _braille_register_console(struct console *console, struct console_cmdline *c) | ||
30 | { | ||
31 | int rtn = 0; | ||
32 | |||
33 | if (c->brl_options) { | ||
34 | console->flags |= CON_BRL; | ||
35 | rtn = braille_register_console(console, c->index, c->options, | ||
36 | c->brl_options); | ||
37 | } | ||
38 | |||
39 | return rtn; | ||
40 | } | ||
41 | |||
42 | int | ||
43 | _braille_unregister_console(struct console *console) | ||
44 | { | ||
45 | if (console->flags & CON_BRL) | ||
46 | return braille_unregister_console(console); | ||
47 | |||
48 | return 0; | ||
49 | } | ||
diff --git a/kernel/printk/braille.h b/kernel/printk/braille.h new file mode 100644 index 000000000000..769d771145c8 --- /dev/null +++ b/kernel/printk/braille.h | |||
@@ -0,0 +1,48 @@ | |||
1 | #ifndef _PRINTK_BRAILLE_H | ||
2 | #define _PRINTK_BRAILLE_H | ||
3 | |||
4 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | ||
5 | |||
6 | static inline void | ||
7 | braille_set_options(struct console_cmdline *c, char *brl_options) | ||
8 | { | ||
9 | c->brl_options = brl_options; | ||
10 | } | ||
11 | |||
12 | char * | ||
13 | _braille_console_setup(char **str, char **brl_options); | ||
14 | |||
15 | int | ||
16 | _braille_register_console(struct console *console, struct console_cmdline *c); | ||
17 | |||
18 | int | ||
19 | _braille_unregister_console(struct console *console); | ||
20 | |||
21 | #else | ||
22 | |||
23 | static inline void | ||
24 | braille_set_options(struct console_cmdline *c, char *brl_options) | ||
25 | { | ||
26 | } | ||
27 | |||
28 | static inline char * | ||
29 | _braille_console_setup(char **str, char **brl_options) | ||
30 | { | ||
31 | return NULL; | ||
32 | } | ||
33 | |||
34 | static inline int | ||
35 | _braille_register_console(struct console *console, struct console_cmdline *c) | ||
36 | { | ||
37 | return 0; | ||
38 | } | ||
39 | |||
40 | static inline int | ||
41 | _braille_unregister_console(struct console *console) | ||
42 | { | ||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | #endif | ||
47 | |||
48 | #endif | ||
diff --git a/kernel/printk/console_cmdline.h b/kernel/printk/console_cmdline.h new file mode 100644 index 000000000000..cbd69d842341 --- /dev/null +++ b/kernel/printk/console_cmdline.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef _CONSOLE_CMDLINE_H | ||
2 | #define _CONSOLE_CMDLINE_H | ||
3 | |||
4 | struct console_cmdline | ||
5 | { | ||
6 | char name[8]; /* Name of the driver */ | ||
7 | int index; /* Minor dev. to use */ | ||
8 | char *options; /* Options for the driver */ | ||
9 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | ||
10 | char *brl_options; /* Options for braille driver */ | ||
11 | #endif | ||
12 | }; | ||
13 | |||
14 | #endif | ||
diff --git a/kernel/printk.c b/kernel/printk/printk.c index 69b0890ed7e5..5b5a7080e2a5 100644 --- a/kernel/printk.c +++ b/kernel/printk/printk.c | |||
@@ -51,6 +51,9 @@ | |||
51 | #define CREATE_TRACE_POINTS | 51 | #define CREATE_TRACE_POINTS |
52 | #include <trace/events/printk.h> | 52 | #include <trace/events/printk.h> |
53 | 53 | ||
54 | #include "console_cmdline.h" | ||
55 | #include "braille.h" | ||
56 | |||
54 | /* printk's without a loglevel use this.. */ | 57 | /* printk's without a loglevel use this.. */ |
55 | #define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL | 58 | #define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL |
56 | 59 | ||
@@ -105,19 +108,11 @@ static struct console *exclusive_console; | |||
105 | /* | 108 | /* |
106 | * Array of consoles built from command line options (console=) | 109 | * Array of consoles built from command line options (console=) |
107 | */ | 110 | */ |
108 | struct console_cmdline | ||
109 | { | ||
110 | char name[8]; /* Name of the driver */ | ||
111 | int index; /* Minor dev. to use */ | ||
112 | char *options; /* Options for the driver */ | ||
113 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | ||
114 | char *brl_options; /* Options for braille driver */ | ||
115 | #endif | ||
116 | }; | ||
117 | 111 | ||
118 | #define MAX_CMDLINECONSOLES 8 | 112 | #define MAX_CMDLINECONSOLES 8 |
119 | 113 | ||
120 | static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES]; | 114 | static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES]; |
115 | |||
121 | static int selected_console = -1; | 116 | static int selected_console = -1; |
122 | static int preferred_console = -1; | 117 | static int preferred_console = -1; |
123 | int console_set_on_cmdline; | 118 | int console_set_on_cmdline; |
@@ -178,7 +173,7 @@ static int console_may_schedule; | |||
178 | * 67 "g" | 173 | * 67 "g" |
179 | * 0032 00 00 00 padding to next message header | 174 | * 0032 00 00 00 padding to next message header |
180 | * | 175 | * |
181 | * The 'struct log' buffer header must never be directly exported to | 176 | * The 'struct printk_log' buffer header must never be directly exported to |
182 | * userspace, it is a kernel-private implementation detail that might | 177 | * userspace, it is a kernel-private implementation detail that might |
183 | * need to be changed in the future, when the requirements change. | 178 | * need to be changed in the future, when the requirements change. |
184 | * | 179 | * |
@@ -200,7 +195,7 @@ enum log_flags { | |||
200 | LOG_CONT = 8, /* text is a fragment of a continuation line */ | 195 | LOG_CONT = 8, /* text is a fragment of a continuation line */ |
201 | }; | 196 | }; |
202 | 197 | ||
203 | struct log { | 198 | struct printk_log { |
204 | u64 ts_nsec; /* timestamp in nanoseconds */ | 199 | u64 ts_nsec; /* timestamp in nanoseconds */ |
205 | u16 len; /* length of entire record */ | 200 | u16 len; /* length of entire record */ |
206 | u16 text_len; /* length of text buffer */ | 201 | u16 text_len; /* length of text buffer */ |
@@ -248,7 +243,7 @@ static u32 clear_idx; | |||
248 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | 243 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) |
249 | #define LOG_ALIGN 4 | 244 | #define LOG_ALIGN 4 |
250 | #else | 245 | #else |
251 | #define LOG_ALIGN __alignof__(struct log) | 246 | #define LOG_ALIGN __alignof__(struct printk_log) |
252 | #endif | 247 | #endif |
253 | #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) | 248 | #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) |
254 | static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); | 249 | static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); |
@@ -259,35 +254,35 @@ static u32 log_buf_len = __LOG_BUF_LEN; | |||
259 | static volatile unsigned int logbuf_cpu = UINT_MAX; | 254 | static volatile unsigned int logbuf_cpu = UINT_MAX; |
260 | 255 | ||
261 | /* human readable text of the record */ | 256 | /* human readable text of the record */ |
262 | static char *log_text(const struct log *msg) | 257 | static char *log_text(const struct printk_log *msg) |
263 | { | 258 | { |
264 | return (char *)msg + sizeof(struct log); | 259 | return (char *)msg + sizeof(struct printk_log); |
265 | } | 260 | } |
266 | 261 | ||
267 | /* optional key/value pair dictionary attached to the record */ | 262 | /* optional key/value pair dictionary attached to the record */ |
268 | static char *log_dict(const struct log *msg) | 263 | static char *log_dict(const struct printk_log *msg) |
269 | { | 264 | { |
270 | return (char *)msg + sizeof(struct log) + msg->text_len; | 265 | return (char *)msg + sizeof(struct printk_log) + msg->text_len; |
271 | } | 266 | } |
272 | 267 | ||
273 | /* get record by index; idx must point to valid msg */ | 268 | /* get record by index; idx must point to valid msg */ |
274 | static struct log *log_from_idx(u32 idx) | 269 | static struct printk_log *log_from_idx(u32 idx) |
275 | { | 270 | { |
276 | struct log *msg = (struct log *)(log_buf + idx); | 271 | struct printk_log *msg = (struct printk_log *)(log_buf + idx); |
277 | 272 | ||
278 | /* | 273 | /* |
279 | * A length == 0 record is the end of buffer marker. Wrap around and | 274 | * A length == 0 record is the end of buffer marker. Wrap around and |
280 | * read the message at the start of the buffer. | 275 | * read the message at the start of the buffer. |
281 | */ | 276 | */ |
282 | if (!msg->len) | 277 | if (!msg->len) |
283 | return (struct log *)log_buf; | 278 | return (struct printk_log *)log_buf; |
284 | return msg; | 279 | return msg; |
285 | } | 280 | } |
286 | 281 | ||
287 | /* get next record; idx must point to valid msg */ | 282 | /* get next record; idx must point to valid msg */ |
288 | static u32 log_next(u32 idx) | 283 | static u32 log_next(u32 idx) |
289 | { | 284 | { |
290 | struct log *msg = (struct log *)(log_buf + idx); | 285 | struct printk_log *msg = (struct printk_log *)(log_buf + idx); |
291 | 286 | ||
292 | /* length == 0 indicates the end of the buffer; wrap */ | 287 | /* length == 0 indicates the end of the buffer; wrap */ |
293 | /* | 288 | /* |
@@ -296,7 +291,7 @@ static u32 log_next(u32 idx) | |||
296 | * return the one after that. | 291 | * return the one after that. |
297 | */ | 292 | */ |
298 | if (!msg->len) { | 293 | if (!msg->len) { |
299 | msg = (struct log *)log_buf; | 294 | msg = (struct printk_log *)log_buf; |
300 | return msg->len; | 295 | return msg->len; |
301 | } | 296 | } |
302 | return idx + msg->len; | 297 | return idx + msg->len; |
@@ -308,11 +303,11 @@ static void log_store(int facility, int level, | |||
308 | const char *dict, u16 dict_len, | 303 | const char *dict, u16 dict_len, |
309 | const char *text, u16 text_len) | 304 | const char *text, u16 text_len) |
310 | { | 305 | { |
311 | struct log *msg; | 306 | struct printk_log *msg; |
312 | u32 size, pad_len; | 307 | u32 size, pad_len; |
313 | 308 | ||
314 | /* number of '\0' padding bytes to next message */ | 309 | /* number of '\0' padding bytes to next message */ |
315 | size = sizeof(struct log) + text_len + dict_len; | 310 | size = sizeof(struct printk_log) + text_len + dict_len; |
316 | pad_len = (-size) & (LOG_ALIGN - 1); | 311 | pad_len = (-size) & (LOG_ALIGN - 1); |
317 | size += pad_len; | 312 | size += pad_len; |
318 | 313 | ||
@@ -324,7 +319,7 @@ static void log_store(int facility, int level, | |||
324 | else | 319 | else |
325 | free = log_first_idx - log_next_idx; | 320 | free = log_first_idx - log_next_idx; |
326 | 321 | ||
327 | if (free > size + sizeof(struct log)) | 322 | if (free > size + sizeof(struct printk_log)) |
328 | break; | 323 | break; |
329 | 324 | ||
330 | /* drop old messages until we have enough contiuous space */ | 325 | /* drop old messages until we have enough contiuous space */ |
@@ -332,18 +327,18 @@ static void log_store(int facility, int level, | |||
332 | log_first_seq++; | 327 | log_first_seq++; |
333 | } | 328 | } |
334 | 329 | ||
335 | if (log_next_idx + size + sizeof(struct log) >= log_buf_len) { | 330 | if (log_next_idx + size + sizeof(struct printk_log) >= log_buf_len) { |
336 | /* | 331 | /* |
337 | * This message + an additional empty header does not fit | 332 | * This message + an additional empty header does not fit |
338 | * at the end of the buffer. Add an empty header with len == 0 | 333 | * at the end of the buffer. Add an empty header with len == 0 |
339 | * to signify a wrap around. | 334 | * to signify a wrap around. |
340 | */ | 335 | */ |
341 | memset(log_buf + log_next_idx, 0, sizeof(struct log)); | 336 | memset(log_buf + log_next_idx, 0, sizeof(struct printk_log)); |
342 | log_next_idx = 0; | 337 | log_next_idx = 0; |
343 | } | 338 | } |
344 | 339 | ||
345 | /* fill message */ | 340 | /* fill message */ |
346 | msg = (struct log *)(log_buf + log_next_idx); | 341 | msg = (struct printk_log *)(log_buf + log_next_idx); |
347 | memcpy(log_text(msg), text, text_len); | 342 | memcpy(log_text(msg), text, text_len); |
348 | msg->text_len = text_len; | 343 | msg->text_len = text_len; |
349 | memcpy(log_dict(msg), dict, dict_len); | 344 | memcpy(log_dict(msg), dict, dict_len); |
@@ -356,7 +351,7 @@ static void log_store(int facility, int level, | |||
356 | else | 351 | else |
357 | msg->ts_nsec = local_clock(); | 352 | msg->ts_nsec = local_clock(); |
358 | memset(log_dict(msg) + dict_len, 0, pad_len); | 353 | memset(log_dict(msg) + dict_len, 0, pad_len); |
359 | msg->len = sizeof(struct log) + text_len + dict_len + pad_len; | 354 | msg->len = sizeof(struct printk_log) + text_len + dict_len + pad_len; |
360 | 355 | ||
361 | /* insert message */ | 356 | /* insert message */ |
362 | log_next_idx += msg->len; | 357 | log_next_idx += msg->len; |
@@ -479,7 +474,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, | |||
479 | size_t count, loff_t *ppos) | 474 | size_t count, loff_t *ppos) |
480 | { | 475 | { |
481 | struct devkmsg_user *user = file->private_data; | 476 | struct devkmsg_user *user = file->private_data; |
482 | struct log *msg; | 477 | struct printk_log *msg; |
483 | u64 ts_usec; | 478 | u64 ts_usec; |
484 | size_t i; | 479 | size_t i; |
485 | char cont = '-'; | 480 | char cont = '-'; |
@@ -724,14 +719,14 @@ void log_buf_kexec_setup(void) | |||
724 | VMCOREINFO_SYMBOL(log_first_idx); | 719 | VMCOREINFO_SYMBOL(log_first_idx); |
725 | VMCOREINFO_SYMBOL(log_next_idx); | 720 | VMCOREINFO_SYMBOL(log_next_idx); |
726 | /* | 721 | /* |
727 | * Export struct log size and field offsets. User space tools can | 722 | * Export struct printk_log size and field offsets. User space tools can |
728 | * parse it and detect any changes to structure down the line. | 723 | * parse it and detect any changes to structure down the line. |
729 | */ | 724 | */ |
730 | VMCOREINFO_STRUCT_SIZE(log); | 725 | VMCOREINFO_STRUCT_SIZE(printk_log); |
731 | VMCOREINFO_OFFSET(log, ts_nsec); | 726 | VMCOREINFO_OFFSET(printk_log, ts_nsec); |
732 | VMCOREINFO_OFFSET(log, len); | 727 | VMCOREINFO_OFFSET(printk_log, len); |
733 | VMCOREINFO_OFFSET(log, text_len); | 728 | VMCOREINFO_OFFSET(printk_log, text_len); |
734 | VMCOREINFO_OFFSET(log, dict_len); | 729 | VMCOREINFO_OFFSET(printk_log, dict_len); |
735 | } | 730 | } |
736 | #endif | 731 | #endif |
737 | 732 | ||
@@ -884,7 +879,7 @@ static size_t print_time(u64 ts, char *buf) | |||
884 | (unsigned long)ts, rem_nsec / 1000); | 879 | (unsigned long)ts, rem_nsec / 1000); |
885 | } | 880 | } |
886 | 881 | ||
887 | static size_t print_prefix(const struct log *msg, bool syslog, char *buf) | 882 | static size_t print_prefix(const struct printk_log *msg, bool syslog, char *buf) |
888 | { | 883 | { |
889 | size_t len = 0; | 884 | size_t len = 0; |
890 | unsigned int prefix = (msg->facility << 3) | msg->level; | 885 | unsigned int prefix = (msg->facility << 3) | msg->level; |
@@ -907,7 +902,7 @@ static size_t print_prefix(const struct log *msg, bool syslog, char *buf) | |||
907 | return len; | 902 | return len; |
908 | } | 903 | } |
909 | 904 | ||
910 | static size_t msg_print_text(const struct log *msg, enum log_flags prev, | 905 | static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev, |
911 | bool syslog, char *buf, size_t size) | 906 | bool syslog, char *buf, size_t size) |
912 | { | 907 | { |
913 | const char *text = log_text(msg); | 908 | const char *text = log_text(msg); |
@@ -969,7 +964,7 @@ static size_t msg_print_text(const struct log *msg, enum log_flags prev, | |||
969 | static int syslog_print(char __user *buf, int size) | 964 | static int syslog_print(char __user *buf, int size) |
970 | { | 965 | { |
971 | char *text; | 966 | char *text; |
972 | struct log *msg; | 967 | struct printk_log *msg; |
973 | int len = 0; | 968 | int len = 0; |
974 | 969 | ||
975 | text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL); | 970 | text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL); |
@@ -1060,7 +1055,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear) | |||
1060 | idx = clear_idx; | 1055 | idx = clear_idx; |
1061 | prev = 0; | 1056 | prev = 0; |
1062 | while (seq < log_next_seq) { | 1057 | while (seq < log_next_seq) { |
1063 | struct log *msg = log_from_idx(idx); | 1058 | struct printk_log *msg = log_from_idx(idx); |
1064 | 1059 | ||
1065 | len += msg_print_text(msg, prev, true, NULL, 0); | 1060 | len += msg_print_text(msg, prev, true, NULL, 0); |
1066 | prev = msg->flags; | 1061 | prev = msg->flags; |
@@ -1073,7 +1068,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear) | |||
1073 | idx = clear_idx; | 1068 | idx = clear_idx; |
1074 | prev = 0; | 1069 | prev = 0; |
1075 | while (len > size && seq < log_next_seq) { | 1070 | while (len > size && seq < log_next_seq) { |
1076 | struct log *msg = log_from_idx(idx); | 1071 | struct printk_log *msg = log_from_idx(idx); |
1077 | 1072 | ||
1078 | len -= msg_print_text(msg, prev, true, NULL, 0); | 1073 | len -= msg_print_text(msg, prev, true, NULL, 0); |
1079 | prev = msg->flags; | 1074 | prev = msg->flags; |
@@ -1087,7 +1082,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear) | |||
1087 | len = 0; | 1082 | len = 0; |
1088 | prev = 0; | 1083 | prev = 0; |
1089 | while (len >= 0 && seq < next_seq) { | 1084 | while (len >= 0 && seq < next_seq) { |
1090 | struct log *msg = log_from_idx(idx); | 1085 | struct printk_log *msg = log_from_idx(idx); |
1091 | int textlen; | 1086 | int textlen; |
1092 | 1087 | ||
1093 | textlen = msg_print_text(msg, prev, true, text, | 1088 | textlen = msg_print_text(msg, prev, true, text, |
@@ -1233,7 +1228,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) | |||
1233 | 1228 | ||
1234 | error = 0; | 1229 | error = 0; |
1235 | while (seq < log_next_seq) { | 1230 | while (seq < log_next_seq) { |
1236 | struct log *msg = log_from_idx(idx); | 1231 | struct printk_log *msg = log_from_idx(idx); |
1237 | 1232 | ||
1238 | error += msg_print_text(msg, prev, true, NULL, 0); | 1233 | error += msg_print_text(msg, prev, true, NULL, 0); |
1239 | idx = log_next(idx); | 1234 | idx = log_next(idx); |
@@ -1719,10 +1714,10 @@ static struct cont { | |||
1719 | u8 level; | 1714 | u8 level; |
1720 | bool flushed:1; | 1715 | bool flushed:1; |
1721 | } cont; | 1716 | } cont; |
1722 | static struct log *log_from_idx(u32 idx) { return NULL; } | 1717 | static struct printk_log *log_from_idx(u32 idx) { return NULL; } |
1723 | static u32 log_next(u32 idx) { return 0; } | 1718 | static u32 log_next(u32 idx) { return 0; } |
1724 | static void call_console_drivers(int level, const char *text, size_t len) {} | 1719 | static void call_console_drivers(int level, const char *text, size_t len) {} |
1725 | static size_t msg_print_text(const struct log *msg, enum log_flags prev, | 1720 | static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev, |
1726 | bool syslog, char *buf, size_t size) { return 0; } | 1721 | bool syslog, char *buf, size_t size) { return 0; } |
1727 | static size_t cont_print_text(char *text, size_t size) { return 0; } | 1722 | static size_t cont_print_text(char *text, size_t size) { return 0; } |
1728 | 1723 | ||
@@ -1761,23 +1756,23 @@ static int __add_preferred_console(char *name, int idx, char *options, | |||
1761 | * See if this tty is not yet registered, and | 1756 | * See if this tty is not yet registered, and |
1762 | * if we have a slot free. | 1757 | * if we have a slot free. |
1763 | */ | 1758 | */ |
1764 | for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) | 1759 | for (i = 0, c = console_cmdline; |
1765 | if (strcmp(console_cmdline[i].name, name) == 0 && | 1760 | i < MAX_CMDLINECONSOLES && c->name[0]; |
1766 | console_cmdline[i].index == idx) { | 1761 | i++, c++) { |
1767 | if (!brl_options) | 1762 | if (strcmp(c->name, name) == 0 && c->index == idx) { |
1768 | selected_console = i; | 1763 | if (!brl_options) |
1769 | return 0; | 1764 | selected_console = i; |
1765 | return 0; | ||
1770 | } | 1766 | } |
1767 | } | ||
1771 | if (i == MAX_CMDLINECONSOLES) | 1768 | if (i == MAX_CMDLINECONSOLES) |
1772 | return -E2BIG; | 1769 | return -E2BIG; |
1773 | if (!brl_options) | 1770 | if (!brl_options) |
1774 | selected_console = i; | 1771 | selected_console = i; |
1775 | c = &console_cmdline[i]; | ||
1776 | strlcpy(c->name, name, sizeof(c->name)); | 1772 | strlcpy(c->name, name, sizeof(c->name)); |
1777 | c->options = options; | 1773 | c->options = options; |
1778 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | 1774 | braille_set_options(c, brl_options); |
1779 | c->brl_options = brl_options; | 1775 | |
1780 | #endif | ||
1781 | c->index = idx; | 1776 | c->index = idx; |
1782 | return 0; | 1777 | return 0; |
1783 | } | 1778 | } |
@@ -1790,20 +1785,8 @@ static int __init console_setup(char *str) | |||
1790 | char *s, *options, *brl_options = NULL; | 1785 | char *s, *options, *brl_options = NULL; |
1791 | int idx; | 1786 | int idx; |
1792 | 1787 | ||
1793 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | 1788 | if (_braille_console_setup(&str, &brl_options)) |
1794 | if (!memcmp(str, "brl,", 4)) { | 1789 | return 1; |
1795 | brl_options = ""; | ||
1796 | str += 4; | ||
1797 | } else if (!memcmp(str, "brl=", 4)) { | ||
1798 | brl_options = str + 4; | ||
1799 | str = strchr(brl_options, ','); | ||
1800 | if (!str) { | ||
1801 | printk(KERN_ERR "need port name after brl=\n"); | ||
1802 | return 1; | ||
1803 | } | ||
1804 | *(str++) = 0; | ||
1805 | } | ||
1806 | #endif | ||
1807 | 1790 | ||
1808 | /* | 1791 | /* |
1809 | * Decode str into name, index, options. | 1792 | * Decode str into name, index, options. |
@@ -1858,15 +1841,15 @@ int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, cha | |||
1858 | struct console_cmdline *c; | 1841 | struct console_cmdline *c; |
1859 | int i; | 1842 | int i; |
1860 | 1843 | ||
1861 | for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) | 1844 | for (i = 0, c = console_cmdline; |
1862 | if (strcmp(console_cmdline[i].name, name) == 0 && | 1845 | i < MAX_CMDLINECONSOLES && c->name[0]; |
1863 | console_cmdline[i].index == idx) { | 1846 | i++, c++) |
1864 | c = &console_cmdline[i]; | 1847 | if (strcmp(c->name, name) == 0 && c->index == idx) { |
1865 | strlcpy(c->name, name_new, sizeof(c->name)); | 1848 | strlcpy(c->name, name_new, sizeof(c->name)); |
1866 | c->name[sizeof(c->name) - 1] = 0; | 1849 | c->name[sizeof(c->name) - 1] = 0; |
1867 | c->options = options; | 1850 | c->options = options; |
1868 | c->index = idx_new; | 1851 | c->index = idx_new; |
1869 | return i; | 1852 | return i; |
1870 | } | 1853 | } |
1871 | /* not found */ | 1854 | /* not found */ |
1872 | return -1; | 1855 | return -1; |
@@ -2046,7 +2029,7 @@ void console_unlock(void) | |||
2046 | console_cont_flush(text, sizeof(text)); | 2029 | console_cont_flush(text, sizeof(text)); |
2047 | again: | 2030 | again: |
2048 | for (;;) { | 2031 | for (;;) { |
2049 | struct log *msg; | 2032 | struct printk_log *msg; |
2050 | size_t len; | 2033 | size_t len; |
2051 | int level; | 2034 | int level; |
2052 | 2035 | ||
@@ -2241,6 +2224,7 @@ void register_console(struct console *newcon) | |||
2241 | int i; | 2224 | int i; |
2242 | unsigned long flags; | 2225 | unsigned long flags; |
2243 | struct console *bcon = NULL; | 2226 | struct console *bcon = NULL; |
2227 | struct console_cmdline *c; | ||
2244 | 2228 | ||
2245 | /* | 2229 | /* |
2246 | * before we register a new CON_BOOT console, make sure we don't | 2230 | * before we register a new CON_BOOT console, make sure we don't |
@@ -2288,30 +2272,25 @@ void register_console(struct console *newcon) | |||
2288 | * See if this console matches one we selected on | 2272 | * See if this console matches one we selected on |
2289 | * the command line. | 2273 | * the command line. |
2290 | */ | 2274 | */ |
2291 | for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; | 2275 | for (i = 0, c = console_cmdline; |
2292 | i++) { | 2276 | i < MAX_CMDLINECONSOLES && c->name[0]; |
2293 | if (strcmp(console_cmdline[i].name, newcon->name) != 0) | 2277 | i++, c++) { |
2278 | if (strcmp(c->name, newcon->name) != 0) | ||
2294 | continue; | 2279 | continue; |
2295 | if (newcon->index >= 0 && | 2280 | if (newcon->index >= 0 && |
2296 | newcon->index != console_cmdline[i].index) | 2281 | newcon->index != c->index) |
2297 | continue; | 2282 | continue; |
2298 | if (newcon->index < 0) | 2283 | if (newcon->index < 0) |
2299 | newcon->index = console_cmdline[i].index; | 2284 | newcon->index = c->index; |
2300 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | 2285 | |
2301 | if (console_cmdline[i].brl_options) { | 2286 | if (_braille_register_console(newcon, c)) |
2302 | newcon->flags |= CON_BRL; | ||
2303 | braille_register_console(newcon, | ||
2304 | console_cmdline[i].index, | ||
2305 | console_cmdline[i].options, | ||
2306 | console_cmdline[i].brl_options); | ||
2307 | return; | 2287 | return; |
2308 | } | 2288 | |
2309 | #endif | ||
2310 | if (newcon->setup && | 2289 | if (newcon->setup && |
2311 | newcon->setup(newcon, console_cmdline[i].options) != 0) | 2290 | newcon->setup(newcon, console_cmdline[i].options) != 0) |
2312 | break; | 2291 | break; |
2313 | newcon->flags |= CON_ENABLED; | 2292 | newcon->flags |= CON_ENABLED; |
2314 | newcon->index = console_cmdline[i].index; | 2293 | newcon->index = c->index; |
2315 | if (i == selected_console) { | 2294 | if (i == selected_console) { |
2316 | newcon->flags |= CON_CONSDEV; | 2295 | newcon->flags |= CON_CONSDEV; |
2317 | preferred_console = selected_console; | 2296 | preferred_console = selected_console; |
@@ -2394,13 +2373,13 @@ EXPORT_SYMBOL(register_console); | |||
2394 | int unregister_console(struct console *console) | 2373 | int unregister_console(struct console *console) |
2395 | { | 2374 | { |
2396 | struct console *a, *b; | 2375 | struct console *a, *b; |
2397 | int res = 1; | 2376 | int res; |
2398 | 2377 | ||
2399 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | 2378 | res = _braille_unregister_console(console); |
2400 | if (console->flags & CON_BRL) | 2379 | if (res) |
2401 | return braille_unregister_console(console); | 2380 | return res; |
2402 | #endif | ||
2403 | 2381 | ||
2382 | res = 1; | ||
2404 | console_lock(); | 2383 | console_lock(); |
2405 | if (console_drivers == console) { | 2384 | if (console_drivers == console) { |
2406 | console_drivers=console->next; | 2385 | console_drivers=console->next; |
@@ -2666,7 +2645,7 @@ void kmsg_dump(enum kmsg_dump_reason reason) | |||
2666 | bool kmsg_dump_get_line_nolock(struct kmsg_dumper *dumper, bool syslog, | 2645 | bool kmsg_dump_get_line_nolock(struct kmsg_dumper *dumper, bool syslog, |
2667 | char *line, size_t size, size_t *len) | 2646 | char *line, size_t size, size_t *len) |
2668 | { | 2647 | { |
2669 | struct log *msg; | 2648 | struct printk_log *msg; |
2670 | size_t l = 0; | 2649 | size_t l = 0; |
2671 | bool ret = false; | 2650 | bool ret = false; |
2672 | 2651 | ||
@@ -2778,7 +2757,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, | |||
2778 | idx = dumper->cur_idx; | 2757 | idx = dumper->cur_idx; |
2779 | prev = 0; | 2758 | prev = 0; |
2780 | while (seq < dumper->next_seq) { | 2759 | while (seq < dumper->next_seq) { |
2781 | struct log *msg = log_from_idx(idx); | 2760 | struct printk_log *msg = log_from_idx(idx); |
2782 | 2761 | ||
2783 | l += msg_print_text(msg, prev, true, NULL, 0); | 2762 | l += msg_print_text(msg, prev, true, NULL, 0); |
2784 | idx = log_next(idx); | 2763 | idx = log_next(idx); |
@@ -2791,7 +2770,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, | |||
2791 | idx = dumper->cur_idx; | 2770 | idx = dumper->cur_idx; |
2792 | prev = 0; | 2771 | prev = 0; |
2793 | while (l > size && seq < dumper->next_seq) { | 2772 | while (l > size && seq < dumper->next_seq) { |
2794 | struct log *msg = log_from_idx(idx); | 2773 | struct printk_log *msg = log_from_idx(idx); |
2795 | 2774 | ||
2796 | l -= msg_print_text(msg, prev, true, NULL, 0); | 2775 | l -= msg_print_text(msg, prev, true, NULL, 0); |
2797 | idx = log_next(idx); | 2776 | idx = log_next(idx); |
@@ -2806,7 +2785,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, | |||
2806 | l = 0; | 2785 | l = 0; |
2807 | prev = 0; | 2786 | prev = 0; |
2808 | while (seq < dumper->next_seq) { | 2787 | while (seq < dumper->next_seq) { |
2809 | struct log *msg = log_from_idx(idx); | 2788 | struct printk_log *msg = log_from_idx(idx); |
2810 | 2789 | ||
2811 | l += msg_print_text(msg, prev, syslog, buf + l, size - l); | 2790 | l += msg_print_text(msg, prev, syslog, buf + l, size - l); |
2812 | idx = log_next(idx); | 2791 | idx = log_next(idx); |
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 4041f5747e73..a146ee327f6a 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -469,7 +469,6 @@ static int ptrace_detach(struct task_struct *child, unsigned int data) | |||
469 | /* Architecture-specific hardware disable .. */ | 469 | /* Architecture-specific hardware disable .. */ |
470 | ptrace_disable(child); | 470 | ptrace_disable(child); |
471 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 471 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
472 | flush_ptrace_hw_breakpoint(child); | ||
473 | 472 | ||
474 | write_lock_irq(&tasklist_lock); | 473 | write_lock_irq(&tasklist_lock); |
475 | /* | 474 | /* |
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index bb456f44b7b1..9565645e3202 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -851,7 +851,7 @@ void task_numa_fault(int node, int pages, bool migrated) | |||
851 | { | 851 | { |
852 | struct task_struct *p = current; | 852 | struct task_struct *p = current; |
853 | 853 | ||
854 | if (!sched_feat_numa(NUMA)) | 854 | if (!numabalancing_enabled) |
855 | return; | 855 | return; |
856 | 856 | ||
857 | /* FIXME: Allocate task-specific structure for placement policy here */ | 857 | /* FIXME: Allocate task-specific structure for placement policy here */ |
@@ -5786,7 +5786,7 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued) | |||
5786 | entity_tick(cfs_rq, se, queued); | 5786 | entity_tick(cfs_rq, se, queued); |
5787 | } | 5787 | } |
5788 | 5788 | ||
5789 | if (sched_feat_numa(NUMA)) | 5789 | if (numabalancing_enabled) |
5790 | task_tick_numa(rq, curr); | 5790 | task_tick_numa(rq, curr); |
5791 | 5791 | ||
5792 | update_rq_runnable_avg(rq, 1); | 5792 | update_rq_runnable_avg(rq, 1); |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index ac09d98490aa..07f6fc468e17 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -2346,7 +2346,11 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp, | |||
2346 | int write, void *data) | 2346 | int write, void *data) |
2347 | { | 2347 | { |
2348 | if (write) { | 2348 | if (write) { |
2349 | *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp); | 2349 | unsigned long jif = msecs_to_jiffies(*negp ? -*lvalp : *lvalp); |
2350 | |||
2351 | if (jif > INT_MAX) | ||
2352 | return 1; | ||
2353 | *valp = (int)jif; | ||
2350 | } else { | 2354 | } else { |
2351 | int val = *valp; | 2355 | int val = *valp; |
2352 | unsigned long lval; | 2356 | unsigned long lval; |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index e80183f4a6c4..e77edc97e036 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -827,13 +827,10 @@ void tick_nohz_irq_exit(void) | |||
827 | { | 827 | { |
828 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); | 828 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); |
829 | 829 | ||
830 | if (ts->inidle) { | 830 | if (ts->inidle) |
831 | /* Cancel the timer because CPU already waken up from the C-states*/ | ||
832 | menu_hrtimer_cancel(); | ||
833 | __tick_nohz_idle_enter(ts); | 831 | __tick_nohz_idle_enter(ts); |
834 | } else { | 832 | else |
835 | tick_nohz_full_stop_tick(ts); | 833 | tick_nohz_full_stop_tick(ts); |
836 | } | ||
837 | } | 834 | } |
838 | 835 | ||
839 | /** | 836 | /** |
@@ -931,8 +928,6 @@ void tick_nohz_idle_exit(void) | |||
931 | 928 | ||
932 | ts->inidle = 0; | 929 | ts->inidle = 0; |
933 | 930 | ||
934 | /* Cancel the timer because CPU already waken up from the C-states*/ | ||
935 | menu_hrtimer_cancel(); | ||
936 | if (ts->idle_active || ts->tick_stopped) | 931 | if (ts->idle_active || ts->tick_stopped) |
937 | now = ktime_get(); | 932 | now = ktime_get(); |
938 | 933 | ||
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 8ce9eefc5bb4..a6d098c6df3f 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -2169,12 +2169,57 @@ static cycle_t ftrace_update_time; | |||
2169 | static unsigned long ftrace_update_cnt; | 2169 | static unsigned long ftrace_update_cnt; |
2170 | unsigned long ftrace_update_tot_cnt; | 2170 | unsigned long ftrace_update_tot_cnt; |
2171 | 2171 | ||
2172 | static int ops_traces_mod(struct ftrace_ops *ops) | 2172 | static inline int ops_traces_mod(struct ftrace_ops *ops) |
2173 | { | 2173 | { |
2174 | struct ftrace_hash *hash; | 2174 | /* |
2175 | * Filter_hash being empty will default to trace module. | ||
2176 | * But notrace hash requires a test of individual module functions. | ||
2177 | */ | ||
2178 | return ftrace_hash_empty(ops->filter_hash) && | ||
2179 | ftrace_hash_empty(ops->notrace_hash); | ||
2180 | } | ||
2181 | |||
2182 | /* | ||
2183 | * Check if the current ops references the record. | ||
2184 | * | ||
2185 | * If the ops traces all functions, then it was already accounted for. | ||
2186 | * If the ops does not trace the current record function, skip it. | ||
2187 | * If the ops ignores the function via notrace filter, skip it. | ||
2188 | */ | ||
2189 | static inline bool | ||
2190 | ops_references_rec(struct ftrace_ops *ops, struct dyn_ftrace *rec) | ||
2191 | { | ||
2192 | /* If ops isn't enabled, ignore it */ | ||
2193 | if (!(ops->flags & FTRACE_OPS_FL_ENABLED)) | ||
2194 | return 0; | ||
2195 | |||
2196 | /* If ops traces all mods, we already accounted for it */ | ||
2197 | if (ops_traces_mod(ops)) | ||
2198 | return 0; | ||
2199 | |||
2200 | /* The function must be in the filter */ | ||
2201 | if (!ftrace_hash_empty(ops->filter_hash) && | ||
2202 | !ftrace_lookup_ip(ops->filter_hash, rec->ip)) | ||
2203 | return 0; | ||
2204 | |||
2205 | /* If in notrace hash, we ignore it too */ | ||
2206 | if (ftrace_lookup_ip(ops->notrace_hash, rec->ip)) | ||
2207 | return 0; | ||
2208 | |||
2209 | return 1; | ||
2210 | } | ||
2211 | |||
2212 | static int referenced_filters(struct dyn_ftrace *rec) | ||
2213 | { | ||
2214 | struct ftrace_ops *ops; | ||
2215 | int cnt = 0; | ||
2175 | 2216 | ||
2176 | hash = ops->filter_hash; | 2217 | for (ops = ftrace_ops_list; ops != &ftrace_list_end; ops = ops->next) { |
2177 | return ftrace_hash_empty(hash); | 2218 | if (ops_references_rec(ops, rec)) |
2219 | cnt++; | ||
2220 | } | ||
2221 | |||
2222 | return cnt; | ||
2178 | } | 2223 | } |
2179 | 2224 | ||
2180 | static int ftrace_update_code(struct module *mod) | 2225 | static int ftrace_update_code(struct module *mod) |
@@ -2183,6 +2228,7 @@ static int ftrace_update_code(struct module *mod) | |||
2183 | struct dyn_ftrace *p; | 2228 | struct dyn_ftrace *p; |
2184 | cycle_t start, stop; | 2229 | cycle_t start, stop; |
2185 | unsigned long ref = 0; | 2230 | unsigned long ref = 0; |
2231 | bool test = false; | ||
2186 | int i; | 2232 | int i; |
2187 | 2233 | ||
2188 | /* | 2234 | /* |
@@ -2196,9 +2242,12 @@ static int ftrace_update_code(struct module *mod) | |||
2196 | 2242 | ||
2197 | for (ops = ftrace_ops_list; | 2243 | for (ops = ftrace_ops_list; |
2198 | ops != &ftrace_list_end; ops = ops->next) { | 2244 | ops != &ftrace_list_end; ops = ops->next) { |
2199 | if (ops->flags & FTRACE_OPS_FL_ENABLED && | 2245 | if (ops->flags & FTRACE_OPS_FL_ENABLED) { |
2200 | ops_traces_mod(ops)) | 2246 | if (ops_traces_mod(ops)) |
2201 | ref++; | 2247 | ref++; |
2248 | else | ||
2249 | test = true; | ||
2250 | } | ||
2202 | } | 2251 | } |
2203 | } | 2252 | } |
2204 | 2253 | ||
@@ -2208,12 +2257,16 @@ static int ftrace_update_code(struct module *mod) | |||
2208 | for (pg = ftrace_new_pgs; pg; pg = pg->next) { | 2257 | for (pg = ftrace_new_pgs; pg; pg = pg->next) { |
2209 | 2258 | ||
2210 | for (i = 0; i < pg->index; i++) { | 2259 | for (i = 0; i < pg->index; i++) { |
2260 | int cnt = ref; | ||
2261 | |||
2211 | /* If something went wrong, bail without enabling anything */ | 2262 | /* If something went wrong, bail without enabling anything */ |
2212 | if (unlikely(ftrace_disabled)) | 2263 | if (unlikely(ftrace_disabled)) |
2213 | return -1; | 2264 | return -1; |
2214 | 2265 | ||
2215 | p = &pg->records[i]; | 2266 | p = &pg->records[i]; |
2216 | p->flags = ref; | 2267 | if (test) |
2268 | cnt += referenced_filters(p); | ||
2269 | p->flags = cnt; | ||
2217 | 2270 | ||
2218 | /* | 2271 | /* |
2219 | * Do the initial record conversion from mcount jump | 2272 | * Do the initial record conversion from mcount jump |
@@ -2233,7 +2286,7 @@ static int ftrace_update_code(struct module *mod) | |||
2233 | * conversion puts the module to the correct state, thus | 2286 | * conversion puts the module to the correct state, thus |
2234 | * passing the ftrace_make_call check. | 2287 | * passing the ftrace_make_call check. |
2235 | */ | 2288 | */ |
2236 | if (ftrace_start_up && ref) { | 2289 | if (ftrace_start_up && cnt) { |
2237 | int failed = __ftrace_replace_code(p, 1); | 2290 | int failed = __ftrace_replace_code(p, 1); |
2238 | if (failed) | 2291 | if (failed) |
2239 | ftrace_bug(failed, p->ip); | 2292 | ftrace_bug(failed, p->ip); |
@@ -3384,6 +3437,12 @@ ftrace_match_addr(struct ftrace_hash *hash, unsigned long ip, int remove) | |||
3384 | return add_hash_entry(hash, ip); | 3437 | return add_hash_entry(hash, ip); |
3385 | } | 3438 | } |
3386 | 3439 | ||
3440 | static void ftrace_ops_update_code(struct ftrace_ops *ops) | ||
3441 | { | ||
3442 | if (ops->flags & FTRACE_OPS_FL_ENABLED && ftrace_enabled) | ||
3443 | ftrace_run_update_code(FTRACE_UPDATE_CALLS); | ||
3444 | } | ||
3445 | |||
3387 | static int | 3446 | static int |
3388 | ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, | 3447 | ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, |
3389 | unsigned long ip, int remove, int reset, int enable) | 3448 | unsigned long ip, int remove, int reset, int enable) |
@@ -3426,9 +3485,8 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
3426 | 3485 | ||
3427 | mutex_lock(&ftrace_lock); | 3486 | mutex_lock(&ftrace_lock); |
3428 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); | 3487 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); |
3429 | if (!ret && ops->flags & FTRACE_OPS_FL_ENABLED | 3488 | if (!ret) |
3430 | && ftrace_enabled) | 3489 | ftrace_ops_update_code(ops); |
3431 | ftrace_run_update_code(FTRACE_UPDATE_CALLS); | ||
3432 | 3490 | ||
3433 | mutex_unlock(&ftrace_lock); | 3491 | mutex_unlock(&ftrace_lock); |
3434 | 3492 | ||
@@ -3655,9 +3713,8 @@ int ftrace_regex_release(struct inode *inode, struct file *file) | |||
3655 | mutex_lock(&ftrace_lock); | 3713 | mutex_lock(&ftrace_lock); |
3656 | ret = ftrace_hash_move(iter->ops, filter_hash, | 3714 | ret = ftrace_hash_move(iter->ops, filter_hash, |
3657 | orig_hash, iter->hash); | 3715 | orig_hash, iter->hash); |
3658 | if (!ret && (iter->ops->flags & FTRACE_OPS_FL_ENABLED) | 3716 | if (!ret) |
3659 | && ftrace_enabled) | 3717 | ftrace_ops_update_code(iter->ops); |
3660 | ftrace_run_update_code(FTRACE_UPDATE_CALLS); | ||
3661 | 3718 | ||
3662 | mutex_unlock(&ftrace_lock); | 3719 | mutex_unlock(&ftrace_lock); |
3663 | } | 3720 | } |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 882ec1dd1515..496f94d57698 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -243,20 +243,25 @@ int filter_current_check_discard(struct ring_buffer *buffer, | |||
243 | } | 243 | } |
244 | EXPORT_SYMBOL_GPL(filter_current_check_discard); | 244 | EXPORT_SYMBOL_GPL(filter_current_check_discard); |
245 | 245 | ||
246 | cycle_t ftrace_now(int cpu) | 246 | cycle_t buffer_ftrace_now(struct trace_buffer *buf, int cpu) |
247 | { | 247 | { |
248 | u64 ts; | 248 | u64 ts; |
249 | 249 | ||
250 | /* Early boot up does not have a buffer yet */ | 250 | /* Early boot up does not have a buffer yet */ |
251 | if (!global_trace.trace_buffer.buffer) | 251 | if (!buf->buffer) |
252 | return trace_clock_local(); | 252 | return trace_clock_local(); |
253 | 253 | ||
254 | ts = ring_buffer_time_stamp(global_trace.trace_buffer.buffer, cpu); | 254 | ts = ring_buffer_time_stamp(buf->buffer, cpu); |
255 | ring_buffer_normalize_time_stamp(global_trace.trace_buffer.buffer, cpu, &ts); | 255 | ring_buffer_normalize_time_stamp(buf->buffer, cpu, &ts); |
256 | 256 | ||
257 | return ts; | 257 | return ts; |
258 | } | 258 | } |
259 | 259 | ||
260 | cycle_t ftrace_now(int cpu) | ||
261 | { | ||
262 | return buffer_ftrace_now(&global_trace.trace_buffer, cpu); | ||
263 | } | ||
264 | |||
260 | /** | 265 | /** |
261 | * tracing_is_enabled - Show if global_trace has been disabled | 266 | * tracing_is_enabled - Show if global_trace has been disabled |
262 | * | 267 | * |
@@ -1211,7 +1216,7 @@ void tracing_reset_online_cpus(struct trace_buffer *buf) | |||
1211 | /* Make sure all commits have finished */ | 1216 | /* Make sure all commits have finished */ |
1212 | synchronize_sched(); | 1217 | synchronize_sched(); |
1213 | 1218 | ||
1214 | buf->time_start = ftrace_now(buf->cpu); | 1219 | buf->time_start = buffer_ftrace_now(buf, buf->cpu); |
1215 | 1220 | ||
1216 | for_each_online_cpu(cpu) | 1221 | for_each_online_cpu(cpu) |
1217 | ring_buffer_reset_cpu(buffer, cpu); | 1222 | ring_buffer_reset_cpu(buffer, cpu); |
@@ -1219,11 +1224,6 @@ void tracing_reset_online_cpus(struct trace_buffer *buf) | |||
1219 | ring_buffer_record_enable(buffer); | 1224 | ring_buffer_record_enable(buffer); |
1220 | } | 1225 | } |
1221 | 1226 | ||
1222 | void tracing_reset_current(int cpu) | ||
1223 | { | ||
1224 | tracing_reset(&global_trace.trace_buffer, cpu); | ||
1225 | } | ||
1226 | |||
1227 | /* Must have trace_types_lock held */ | 1227 | /* Must have trace_types_lock held */ |
1228 | void tracing_reset_all_online_cpus(void) | 1228 | void tracing_reset_all_online_cpus(void) |
1229 | { | 1229 | { |
@@ -4151,6 +4151,7 @@ waitagain: | |||
4151 | memset(&iter->seq, 0, | 4151 | memset(&iter->seq, 0, |
4152 | sizeof(struct trace_iterator) - | 4152 | sizeof(struct trace_iterator) - |
4153 | offsetof(struct trace_iterator, seq)); | 4153 | offsetof(struct trace_iterator, seq)); |
4154 | cpumask_clear(iter->started); | ||
4154 | iter->pos = -1; | 4155 | iter->pos = -1; |
4155 | 4156 | ||
4156 | trace_event_read_lock(); | 4157 | trace_event_read_lock(); |
@@ -4468,7 +4469,7 @@ tracing_free_buffer_release(struct inode *inode, struct file *filp) | |||
4468 | 4469 | ||
4469 | /* disable tracing ? */ | 4470 | /* disable tracing ? */ |
4470 | if (trace_flags & TRACE_ITER_STOP_ON_FREE) | 4471 | if (trace_flags & TRACE_ITER_STOP_ON_FREE) |
4471 | tracing_off(); | 4472 | tracer_tracing_off(tr); |
4472 | /* resize the ring buffer to 0 */ | 4473 | /* resize the ring buffer to 0 */ |
4473 | tracing_resize_ring_buffer(tr, 0, RING_BUFFER_ALL_CPUS); | 4474 | tracing_resize_ring_buffer(tr, 0, RING_BUFFER_ALL_CPUS); |
4474 | 4475 | ||
@@ -4633,12 +4634,12 @@ static ssize_t tracing_clock_write(struct file *filp, const char __user *ubuf, | |||
4633 | * New clock may not be consistent with the previous clock. | 4634 | * New clock may not be consistent with the previous clock. |
4634 | * Reset the buffer so that it doesn't have incomparable timestamps. | 4635 | * Reset the buffer so that it doesn't have incomparable timestamps. |
4635 | */ | 4636 | */ |
4636 | tracing_reset_online_cpus(&global_trace.trace_buffer); | 4637 | tracing_reset_online_cpus(&tr->trace_buffer); |
4637 | 4638 | ||
4638 | #ifdef CONFIG_TRACER_MAX_TRACE | 4639 | #ifdef CONFIG_TRACER_MAX_TRACE |
4639 | if (tr->flags & TRACE_ARRAY_FL_GLOBAL && tr->max_buffer.buffer) | 4640 | if (tr->flags & TRACE_ARRAY_FL_GLOBAL && tr->max_buffer.buffer) |
4640 | ring_buffer_set_clock(tr->max_buffer.buffer, trace_clocks[i].func); | 4641 | ring_buffer_set_clock(tr->max_buffer.buffer, trace_clocks[i].func); |
4641 | tracing_reset_online_cpus(&global_trace.max_buffer); | 4642 | tracing_reset_online_cpus(&tr->max_buffer); |
4642 | #endif | 4643 | #endif |
4643 | 4644 | ||
4644 | mutex_unlock(&trace_types_lock); | 4645 | mutex_unlock(&trace_types_lock); |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 898f868833f2..29a7ebcfb426 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -409,33 +409,42 @@ static void put_system(struct ftrace_subsystem_dir *dir) | |||
409 | mutex_unlock(&event_mutex); | 409 | mutex_unlock(&event_mutex); |
410 | } | 410 | } |
411 | 411 | ||
412 | /* | 412 | static void remove_subsystem(struct ftrace_subsystem_dir *dir) |
413 | * Open and update trace_array ref count. | ||
414 | * Must have the current trace_array passed to it. | ||
415 | */ | ||
416 | static int tracing_open_generic_file(struct inode *inode, struct file *filp) | ||
417 | { | 413 | { |
418 | struct ftrace_event_file *file = inode->i_private; | 414 | if (!dir) |
419 | struct trace_array *tr = file->tr; | 415 | return; |
420 | int ret; | ||
421 | 416 | ||
422 | if (trace_array_get(tr) < 0) | 417 | if (!--dir->nr_events) { |
423 | return -ENODEV; | 418 | debugfs_remove_recursive(dir->entry); |
419 | list_del(&dir->list); | ||
420 | __put_system_dir(dir); | ||
421 | } | ||
422 | } | ||
424 | 423 | ||
425 | ret = tracing_open_generic(inode, filp); | 424 | static void *event_file_data(struct file *filp) |
426 | if (ret < 0) | 425 | { |
427 | trace_array_put(tr); | 426 | return ACCESS_ONCE(file_inode(filp)->i_private); |
428 | return ret; | ||
429 | } | 427 | } |
430 | 428 | ||
431 | static int tracing_release_generic_file(struct inode *inode, struct file *filp) | 429 | static void remove_event_file_dir(struct ftrace_event_file *file) |
432 | { | 430 | { |
433 | struct ftrace_event_file *file = inode->i_private; | 431 | struct dentry *dir = file->dir; |
434 | struct trace_array *tr = file->tr; | 432 | struct dentry *child; |
435 | 433 | ||
436 | trace_array_put(tr); | 434 | if (dir) { |
435 | spin_lock(&dir->d_lock); /* probably unneeded */ | ||
436 | list_for_each_entry(child, &dir->d_subdirs, d_u.d_child) { | ||
437 | if (child->d_inode) /* probably unneeded */ | ||
438 | child->d_inode->i_private = NULL; | ||
439 | } | ||
440 | spin_unlock(&dir->d_lock); | ||
437 | 441 | ||
438 | return 0; | 442 | debugfs_remove_recursive(dir); |
443 | } | ||
444 | |||
445 | list_del(&file->list); | ||
446 | remove_subsystem(file->system); | ||
447 | kmem_cache_free(file_cachep, file); | ||
439 | } | 448 | } |
440 | 449 | ||
441 | /* | 450 | /* |
@@ -679,15 +688,25 @@ static ssize_t | |||
679 | event_enable_read(struct file *filp, char __user *ubuf, size_t cnt, | 688 | event_enable_read(struct file *filp, char __user *ubuf, size_t cnt, |
680 | loff_t *ppos) | 689 | loff_t *ppos) |
681 | { | 690 | { |
682 | struct ftrace_event_file *file = filp->private_data; | 691 | struct ftrace_event_file *file; |
692 | unsigned long flags; | ||
683 | char buf[4] = "0"; | 693 | char buf[4] = "0"; |
684 | 694 | ||
685 | if (file->flags & FTRACE_EVENT_FL_ENABLED && | 695 | mutex_lock(&event_mutex); |
686 | !(file->flags & FTRACE_EVENT_FL_SOFT_DISABLED)) | 696 | file = event_file_data(filp); |
697 | if (likely(file)) | ||
698 | flags = file->flags; | ||
699 | mutex_unlock(&event_mutex); | ||
700 | |||
701 | if (!file) | ||
702 | return -ENODEV; | ||
703 | |||
704 | if (flags & FTRACE_EVENT_FL_ENABLED && | ||
705 | !(flags & FTRACE_EVENT_FL_SOFT_DISABLED)) | ||
687 | strcpy(buf, "1"); | 706 | strcpy(buf, "1"); |
688 | 707 | ||
689 | if (file->flags & FTRACE_EVENT_FL_SOFT_DISABLED || | 708 | if (flags & FTRACE_EVENT_FL_SOFT_DISABLED || |
690 | file->flags & FTRACE_EVENT_FL_SOFT_MODE) | 709 | flags & FTRACE_EVENT_FL_SOFT_MODE) |
691 | strcat(buf, "*"); | 710 | strcat(buf, "*"); |
692 | 711 | ||
693 | strcat(buf, "\n"); | 712 | strcat(buf, "\n"); |
@@ -699,13 +718,10 @@ static ssize_t | |||
699 | event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, | 718 | event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, |
700 | loff_t *ppos) | 719 | loff_t *ppos) |
701 | { | 720 | { |
702 | struct ftrace_event_file *file = filp->private_data; | 721 | struct ftrace_event_file *file; |
703 | unsigned long val; | 722 | unsigned long val; |
704 | int ret; | 723 | int ret; |
705 | 724 | ||
706 | if (!file) | ||
707 | return -EINVAL; | ||
708 | |||
709 | ret = kstrtoul_from_user(ubuf, cnt, 10, &val); | 725 | ret = kstrtoul_from_user(ubuf, cnt, 10, &val); |
710 | if (ret) | 726 | if (ret) |
711 | return ret; | 727 | return ret; |
@@ -717,8 +733,11 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, | |||
717 | switch (val) { | 733 | switch (val) { |
718 | case 0: | 734 | case 0: |
719 | case 1: | 735 | case 1: |
736 | ret = -ENODEV; | ||
720 | mutex_lock(&event_mutex); | 737 | mutex_lock(&event_mutex); |
721 | ret = ftrace_event_enable_disable(file, val); | 738 | file = event_file_data(filp); |
739 | if (likely(file)) | ||
740 | ret = ftrace_event_enable_disable(file, val); | ||
722 | mutex_unlock(&event_mutex); | 741 | mutex_unlock(&event_mutex); |
723 | break; | 742 | break; |
724 | 743 | ||
@@ -825,7 +844,7 @@ enum { | |||
825 | 844 | ||
826 | static void *f_next(struct seq_file *m, void *v, loff_t *pos) | 845 | static void *f_next(struct seq_file *m, void *v, loff_t *pos) |
827 | { | 846 | { |
828 | struct ftrace_event_call *call = m->private; | 847 | struct ftrace_event_call *call = event_file_data(m->private); |
829 | struct list_head *common_head = &ftrace_common_fields; | 848 | struct list_head *common_head = &ftrace_common_fields; |
830 | struct list_head *head = trace_get_fields(call); | 849 | struct list_head *head = trace_get_fields(call); |
831 | struct list_head *node = v; | 850 | struct list_head *node = v; |
@@ -857,7 +876,7 @@ static void *f_next(struct seq_file *m, void *v, loff_t *pos) | |||
857 | 876 | ||
858 | static int f_show(struct seq_file *m, void *v) | 877 | static int f_show(struct seq_file *m, void *v) |
859 | { | 878 | { |
860 | struct ftrace_event_call *call = m->private; | 879 | struct ftrace_event_call *call = event_file_data(m->private); |
861 | struct ftrace_event_field *field; | 880 | struct ftrace_event_field *field; |
862 | const char *array_descriptor; | 881 | const char *array_descriptor; |
863 | 882 | ||
@@ -910,6 +929,11 @@ static void *f_start(struct seq_file *m, loff_t *pos) | |||
910 | void *p = (void *)FORMAT_HEADER; | 929 | void *p = (void *)FORMAT_HEADER; |
911 | loff_t l = 0; | 930 | loff_t l = 0; |
912 | 931 | ||
932 | /* ->stop() is called even if ->start() fails */ | ||
933 | mutex_lock(&event_mutex); | ||
934 | if (!event_file_data(m->private)) | ||
935 | return ERR_PTR(-ENODEV); | ||
936 | |||
913 | while (l < *pos && p) | 937 | while (l < *pos && p) |
914 | p = f_next(m, p, &l); | 938 | p = f_next(m, p, &l); |
915 | 939 | ||
@@ -918,6 +942,7 @@ static void *f_start(struct seq_file *m, loff_t *pos) | |||
918 | 942 | ||
919 | static void f_stop(struct seq_file *m, void *p) | 943 | static void f_stop(struct seq_file *m, void *p) |
920 | { | 944 | { |
945 | mutex_unlock(&event_mutex); | ||
921 | } | 946 | } |
922 | 947 | ||
923 | static const struct seq_operations trace_format_seq_ops = { | 948 | static const struct seq_operations trace_format_seq_ops = { |
@@ -929,7 +954,6 @@ static const struct seq_operations trace_format_seq_ops = { | |||
929 | 954 | ||
930 | static int trace_format_open(struct inode *inode, struct file *file) | 955 | static int trace_format_open(struct inode *inode, struct file *file) |
931 | { | 956 | { |
932 | struct ftrace_event_call *call = inode->i_private; | ||
933 | struct seq_file *m; | 957 | struct seq_file *m; |
934 | int ret; | 958 | int ret; |
935 | 959 | ||
@@ -938,7 +962,7 @@ static int trace_format_open(struct inode *inode, struct file *file) | |||
938 | return ret; | 962 | return ret; |
939 | 963 | ||
940 | m = file->private_data; | 964 | m = file->private_data; |
941 | m->private = call; | 965 | m->private = file; |
942 | 966 | ||
943 | return 0; | 967 | return 0; |
944 | } | 968 | } |
@@ -946,14 +970,18 @@ static int trace_format_open(struct inode *inode, struct file *file) | |||
946 | static ssize_t | 970 | static ssize_t |
947 | event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) | 971 | event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) |
948 | { | 972 | { |
949 | struct ftrace_event_call *call = filp->private_data; | 973 | int id = (long)event_file_data(filp); |
950 | char buf[32]; | 974 | char buf[32]; |
951 | int len; | 975 | int len; |
952 | 976 | ||
953 | if (*ppos) | 977 | if (*ppos) |
954 | return 0; | 978 | return 0; |
955 | 979 | ||
956 | len = sprintf(buf, "%d\n", call->event.type); | 980 | if (unlikely(!id)) |
981 | return -ENODEV; | ||
982 | |||
983 | len = sprintf(buf, "%d\n", id); | ||
984 | |||
957 | return simple_read_from_buffer(ubuf, cnt, ppos, buf, len); | 985 | return simple_read_from_buffer(ubuf, cnt, ppos, buf, len); |
958 | } | 986 | } |
959 | 987 | ||
@@ -961,21 +989,28 @@ static ssize_t | |||
961 | event_filter_read(struct file *filp, char __user *ubuf, size_t cnt, | 989 | event_filter_read(struct file *filp, char __user *ubuf, size_t cnt, |
962 | loff_t *ppos) | 990 | loff_t *ppos) |
963 | { | 991 | { |
964 | struct ftrace_event_call *call = filp->private_data; | 992 | struct ftrace_event_call *call; |
965 | struct trace_seq *s; | 993 | struct trace_seq *s; |
966 | int r; | 994 | int r = -ENODEV; |
967 | 995 | ||
968 | if (*ppos) | 996 | if (*ppos) |
969 | return 0; | 997 | return 0; |
970 | 998 | ||
971 | s = kmalloc(sizeof(*s), GFP_KERNEL); | 999 | s = kmalloc(sizeof(*s), GFP_KERNEL); |
1000 | |||
972 | if (!s) | 1001 | if (!s) |
973 | return -ENOMEM; | 1002 | return -ENOMEM; |
974 | 1003 | ||
975 | trace_seq_init(s); | 1004 | trace_seq_init(s); |
976 | 1005 | ||
977 | print_event_filter(call, s); | 1006 | mutex_lock(&event_mutex); |
978 | r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len); | 1007 | call = event_file_data(filp); |
1008 | if (call) | ||
1009 | print_event_filter(call, s); | ||
1010 | mutex_unlock(&event_mutex); | ||
1011 | |||
1012 | if (call) | ||
1013 | r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len); | ||
979 | 1014 | ||
980 | kfree(s); | 1015 | kfree(s); |
981 | 1016 | ||
@@ -986,9 +1021,9 @@ static ssize_t | |||
986 | event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt, | 1021 | event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt, |
987 | loff_t *ppos) | 1022 | loff_t *ppos) |
988 | { | 1023 | { |
989 | struct ftrace_event_call *call = filp->private_data; | 1024 | struct ftrace_event_call *call; |
990 | char *buf; | 1025 | char *buf; |
991 | int err; | 1026 | int err = -ENODEV; |
992 | 1027 | ||
993 | if (cnt >= PAGE_SIZE) | 1028 | if (cnt >= PAGE_SIZE) |
994 | return -EINVAL; | 1029 | return -EINVAL; |
@@ -1003,7 +1038,12 @@ event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt, | |||
1003 | } | 1038 | } |
1004 | buf[cnt] = '\0'; | 1039 | buf[cnt] = '\0'; |
1005 | 1040 | ||
1006 | err = apply_event_filter(call, buf); | 1041 | mutex_lock(&event_mutex); |
1042 | call = event_file_data(filp); | ||
1043 | if (call) | ||
1044 | err = apply_event_filter(call, buf); | ||
1045 | mutex_unlock(&event_mutex); | ||
1046 | |||
1007 | free_page((unsigned long) buf); | 1047 | free_page((unsigned long) buf); |
1008 | if (err < 0) | 1048 | if (err < 0) |
1009 | return err; | 1049 | return err; |
@@ -1225,10 +1265,9 @@ static const struct file_operations ftrace_set_event_fops = { | |||
1225 | }; | 1265 | }; |
1226 | 1266 | ||
1227 | static const struct file_operations ftrace_enable_fops = { | 1267 | static const struct file_operations ftrace_enable_fops = { |
1228 | .open = tracing_open_generic_file, | 1268 | .open = tracing_open_generic, |
1229 | .read = event_enable_read, | 1269 | .read = event_enable_read, |
1230 | .write = event_enable_write, | 1270 | .write = event_enable_write, |
1231 | .release = tracing_release_generic_file, | ||
1232 | .llseek = default_llseek, | 1271 | .llseek = default_llseek, |
1233 | }; | 1272 | }; |
1234 | 1273 | ||
@@ -1240,7 +1279,6 @@ static const struct file_operations ftrace_event_format_fops = { | |||
1240 | }; | 1279 | }; |
1241 | 1280 | ||
1242 | static const struct file_operations ftrace_event_id_fops = { | 1281 | static const struct file_operations ftrace_event_id_fops = { |
1243 | .open = tracing_open_generic, | ||
1244 | .read = event_id_read, | 1282 | .read = event_id_read, |
1245 | .llseek = default_llseek, | 1283 | .llseek = default_llseek, |
1246 | }; | 1284 | }; |
@@ -1488,8 +1526,8 @@ event_create_dir(struct dentry *parent, | |||
1488 | 1526 | ||
1489 | #ifdef CONFIG_PERF_EVENTS | 1527 | #ifdef CONFIG_PERF_EVENTS |
1490 | if (call->event.type && call->class->reg) | 1528 | if (call->event.type && call->class->reg) |
1491 | trace_create_file("id", 0444, file->dir, call, | 1529 | trace_create_file("id", 0444, file->dir, |
1492 | id); | 1530 | (void *)(long)call->event.type, id); |
1493 | #endif | 1531 | #endif |
1494 | 1532 | ||
1495 | /* | 1533 | /* |
@@ -1514,33 +1552,16 @@ event_create_dir(struct dentry *parent, | |||
1514 | return 0; | 1552 | return 0; |
1515 | } | 1553 | } |
1516 | 1554 | ||
1517 | static void remove_subsystem(struct ftrace_subsystem_dir *dir) | ||
1518 | { | ||
1519 | if (!dir) | ||
1520 | return; | ||
1521 | |||
1522 | if (!--dir->nr_events) { | ||
1523 | debugfs_remove_recursive(dir->entry); | ||
1524 | list_del(&dir->list); | ||
1525 | __put_system_dir(dir); | ||
1526 | } | ||
1527 | } | ||
1528 | |||
1529 | static void remove_event_from_tracers(struct ftrace_event_call *call) | 1555 | static void remove_event_from_tracers(struct ftrace_event_call *call) |
1530 | { | 1556 | { |
1531 | struct ftrace_event_file *file; | 1557 | struct ftrace_event_file *file; |
1532 | struct trace_array *tr; | 1558 | struct trace_array *tr; |
1533 | 1559 | ||
1534 | do_for_each_event_file_safe(tr, file) { | 1560 | do_for_each_event_file_safe(tr, file) { |
1535 | |||
1536 | if (file->event_call != call) | 1561 | if (file->event_call != call) |
1537 | continue; | 1562 | continue; |
1538 | 1563 | ||
1539 | list_del(&file->list); | 1564 | remove_event_file_dir(file); |
1540 | debugfs_remove_recursive(file->dir); | ||
1541 | remove_subsystem(file->system); | ||
1542 | kmem_cache_free(file_cachep, file); | ||
1543 | |||
1544 | /* | 1565 | /* |
1545 | * The do_for_each_event_file_safe() is | 1566 | * The do_for_each_event_file_safe() is |
1546 | * a double loop. After finding the call for this | 1567 | * a double loop. After finding the call for this |
@@ -1692,16 +1713,53 @@ static void __trace_remove_event_call(struct ftrace_event_call *call) | |||
1692 | destroy_preds(call); | 1713 | destroy_preds(call); |
1693 | } | 1714 | } |
1694 | 1715 | ||
1716 | static int probe_remove_event_call(struct ftrace_event_call *call) | ||
1717 | { | ||
1718 | struct trace_array *tr; | ||
1719 | struct ftrace_event_file *file; | ||
1720 | |||
1721 | #ifdef CONFIG_PERF_EVENTS | ||
1722 | if (call->perf_refcount) | ||
1723 | return -EBUSY; | ||
1724 | #endif | ||
1725 | do_for_each_event_file(tr, file) { | ||
1726 | if (file->event_call != call) | ||
1727 | continue; | ||
1728 | /* | ||
1729 | * We can't rely on ftrace_event_enable_disable(enable => 0) | ||
1730 | * we are going to do, FTRACE_EVENT_FL_SOFT_MODE can suppress | ||
1731 | * TRACE_REG_UNREGISTER. | ||
1732 | */ | ||
1733 | if (file->flags & FTRACE_EVENT_FL_ENABLED) | ||
1734 | return -EBUSY; | ||
1735 | /* | ||
1736 | * The do_for_each_event_file_safe() is | ||
1737 | * a double loop. After finding the call for this | ||
1738 | * trace_array, we use break to jump to the next | ||
1739 | * trace_array. | ||
1740 | */ | ||
1741 | break; | ||
1742 | } while_for_each_event_file(); | ||
1743 | |||
1744 | __trace_remove_event_call(call); | ||
1745 | |||
1746 | return 0; | ||
1747 | } | ||
1748 | |||
1695 | /* Remove an event_call */ | 1749 | /* Remove an event_call */ |
1696 | void trace_remove_event_call(struct ftrace_event_call *call) | 1750 | int trace_remove_event_call(struct ftrace_event_call *call) |
1697 | { | 1751 | { |
1752 | int ret; | ||
1753 | |||
1698 | mutex_lock(&trace_types_lock); | 1754 | mutex_lock(&trace_types_lock); |
1699 | mutex_lock(&event_mutex); | 1755 | mutex_lock(&event_mutex); |
1700 | down_write(&trace_event_sem); | 1756 | down_write(&trace_event_sem); |
1701 | __trace_remove_event_call(call); | 1757 | ret = probe_remove_event_call(call); |
1702 | up_write(&trace_event_sem); | 1758 | up_write(&trace_event_sem); |
1703 | mutex_unlock(&event_mutex); | 1759 | mutex_unlock(&event_mutex); |
1704 | mutex_unlock(&trace_types_lock); | 1760 | mutex_unlock(&trace_types_lock); |
1761 | |||
1762 | return ret; | ||
1705 | } | 1763 | } |
1706 | 1764 | ||
1707 | #define for_each_event(event, start, end) \ | 1765 | #define for_each_event(event, start, end) \ |
@@ -2270,12 +2328,8 @@ __trace_remove_event_dirs(struct trace_array *tr) | |||
2270 | { | 2328 | { |
2271 | struct ftrace_event_file *file, *next; | 2329 | struct ftrace_event_file *file, *next; |
2272 | 2330 | ||
2273 | list_for_each_entry_safe(file, next, &tr->events, list) { | 2331 | list_for_each_entry_safe(file, next, &tr->events, list) |
2274 | list_del(&file->list); | 2332 | remove_event_file_dir(file); |
2275 | debugfs_remove_recursive(file->dir); | ||
2276 | remove_subsystem(file->system); | ||
2277 | kmem_cache_free(file_cachep, file); | ||
2278 | } | ||
2279 | } | 2333 | } |
2280 | 2334 | ||
2281 | static void | 2335 | static void |
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 0c7b75a8acc8..97daa8cf958d 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c | |||
@@ -637,17 +637,15 @@ static void append_filter_err(struct filter_parse_state *ps, | |||
637 | free_page((unsigned long) buf); | 637 | free_page((unsigned long) buf); |
638 | } | 638 | } |
639 | 639 | ||
640 | /* caller must hold event_mutex */ | ||
640 | void print_event_filter(struct ftrace_event_call *call, struct trace_seq *s) | 641 | void print_event_filter(struct ftrace_event_call *call, struct trace_seq *s) |
641 | { | 642 | { |
642 | struct event_filter *filter; | 643 | struct event_filter *filter = call->filter; |
643 | 644 | ||
644 | mutex_lock(&event_mutex); | ||
645 | filter = call->filter; | ||
646 | if (filter && filter->filter_string) | 645 | if (filter && filter->filter_string) |
647 | trace_seq_printf(s, "%s\n", filter->filter_string); | 646 | trace_seq_printf(s, "%s\n", filter->filter_string); |
648 | else | 647 | else |
649 | trace_seq_puts(s, "none\n"); | 648 | trace_seq_puts(s, "none\n"); |
650 | mutex_unlock(&event_mutex); | ||
651 | } | 649 | } |
652 | 650 | ||
653 | void print_subsystem_event_filter(struct event_subsystem *system, | 651 | void print_subsystem_event_filter(struct event_subsystem *system, |
@@ -1841,23 +1839,22 @@ static int create_system_filter(struct event_subsystem *system, | |||
1841 | return err; | 1839 | return err; |
1842 | } | 1840 | } |
1843 | 1841 | ||
1842 | /* caller must hold event_mutex */ | ||
1844 | int apply_event_filter(struct ftrace_event_call *call, char *filter_string) | 1843 | int apply_event_filter(struct ftrace_event_call *call, char *filter_string) |
1845 | { | 1844 | { |
1846 | struct event_filter *filter; | 1845 | struct event_filter *filter; |
1847 | int err = 0; | 1846 | int err; |
1848 | |||
1849 | mutex_lock(&event_mutex); | ||
1850 | 1847 | ||
1851 | if (!strcmp(strstrip(filter_string), "0")) { | 1848 | if (!strcmp(strstrip(filter_string), "0")) { |
1852 | filter_disable(call); | 1849 | filter_disable(call); |
1853 | filter = call->filter; | 1850 | filter = call->filter; |
1854 | if (!filter) | 1851 | if (!filter) |
1855 | goto out_unlock; | 1852 | return 0; |
1856 | RCU_INIT_POINTER(call->filter, NULL); | 1853 | RCU_INIT_POINTER(call->filter, NULL); |
1857 | /* Make sure the filter is not being used */ | 1854 | /* Make sure the filter is not being used */ |
1858 | synchronize_sched(); | 1855 | synchronize_sched(); |
1859 | __free_filter(filter); | 1856 | __free_filter(filter); |
1860 | goto out_unlock; | 1857 | return 0; |
1861 | } | 1858 | } |
1862 | 1859 | ||
1863 | err = create_filter(call, filter_string, true, &filter); | 1860 | err = create_filter(call, filter_string, true, &filter); |
@@ -1884,8 +1881,6 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string) | |||
1884 | __free_filter(tmp); | 1881 | __free_filter(tmp); |
1885 | } | 1882 | } |
1886 | } | 1883 | } |
1887 | out_unlock: | ||
1888 | mutex_unlock(&event_mutex); | ||
1889 | 1884 | ||
1890 | return err; | 1885 | return err; |
1891 | } | 1886 | } |
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 3811487e7a7a..243f6834d026 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c | |||
@@ -95,7 +95,7 @@ static __kprobes bool trace_probe_is_on_module(struct trace_probe *tp) | |||
95 | } | 95 | } |
96 | 96 | ||
97 | static int register_probe_event(struct trace_probe *tp); | 97 | static int register_probe_event(struct trace_probe *tp); |
98 | static void unregister_probe_event(struct trace_probe *tp); | 98 | static int unregister_probe_event(struct trace_probe *tp); |
99 | 99 | ||
100 | static DEFINE_MUTEX(probe_lock); | 100 | static DEFINE_MUTEX(probe_lock); |
101 | static LIST_HEAD(probe_list); | 101 | static LIST_HEAD(probe_list); |
@@ -351,9 +351,12 @@ static int unregister_trace_probe(struct trace_probe *tp) | |||
351 | if (trace_probe_is_enabled(tp)) | 351 | if (trace_probe_is_enabled(tp)) |
352 | return -EBUSY; | 352 | return -EBUSY; |
353 | 353 | ||
354 | /* Will fail if probe is being used by ftrace or perf */ | ||
355 | if (unregister_probe_event(tp)) | ||
356 | return -EBUSY; | ||
357 | |||
354 | __unregister_trace_probe(tp); | 358 | __unregister_trace_probe(tp); |
355 | list_del(&tp->list); | 359 | list_del(&tp->list); |
356 | unregister_probe_event(tp); | ||
357 | 360 | ||
358 | return 0; | 361 | return 0; |
359 | } | 362 | } |
@@ -632,7 +635,9 @@ static int release_all_trace_probes(void) | |||
632 | /* TODO: Use batch unregistration */ | 635 | /* TODO: Use batch unregistration */ |
633 | while (!list_empty(&probe_list)) { | 636 | while (!list_empty(&probe_list)) { |
634 | tp = list_entry(probe_list.next, struct trace_probe, list); | 637 | tp = list_entry(probe_list.next, struct trace_probe, list); |
635 | unregister_trace_probe(tp); | 638 | ret = unregister_trace_probe(tp); |
639 | if (ret) | ||
640 | goto end; | ||
636 | free_trace_probe(tp); | 641 | free_trace_probe(tp); |
637 | } | 642 | } |
638 | 643 | ||
@@ -1247,11 +1252,15 @@ static int register_probe_event(struct trace_probe *tp) | |||
1247 | return ret; | 1252 | return ret; |
1248 | } | 1253 | } |
1249 | 1254 | ||
1250 | static void unregister_probe_event(struct trace_probe *tp) | 1255 | static int unregister_probe_event(struct trace_probe *tp) |
1251 | { | 1256 | { |
1257 | int ret; | ||
1258 | |||
1252 | /* tp->event is unregistered in trace_remove_event_call() */ | 1259 | /* tp->event is unregistered in trace_remove_event_call() */ |
1253 | trace_remove_event_call(&tp->call); | 1260 | ret = trace_remove_event_call(&tp->call); |
1254 | kfree(tp->call.print_fmt); | 1261 | if (!ret) |
1262 | kfree(tp->call.print_fmt); | ||
1263 | return ret; | ||
1255 | } | 1264 | } |
1256 | 1265 | ||
1257 | /* Make a debugfs interface for controlling probe points */ | 1266 | /* Make a debugfs interface for controlling probe points */ |
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index a23d2d71188e..272261b5f94f 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c | |||
@@ -70,7 +70,7 @@ struct trace_uprobe { | |||
70 | (sizeof(struct probe_arg) * (n))) | 70 | (sizeof(struct probe_arg) * (n))) |
71 | 71 | ||
72 | static int register_uprobe_event(struct trace_uprobe *tu); | 72 | static int register_uprobe_event(struct trace_uprobe *tu); |
73 | static void unregister_uprobe_event(struct trace_uprobe *tu); | 73 | static int unregister_uprobe_event(struct trace_uprobe *tu); |
74 | 74 | ||
75 | static DEFINE_MUTEX(uprobe_lock); | 75 | static DEFINE_MUTEX(uprobe_lock); |
76 | static LIST_HEAD(uprobe_list); | 76 | static LIST_HEAD(uprobe_list); |
@@ -164,11 +164,17 @@ static struct trace_uprobe *find_probe_event(const char *event, const char *grou | |||
164 | } | 164 | } |
165 | 165 | ||
166 | /* Unregister a trace_uprobe and probe_event: call with locking uprobe_lock */ | 166 | /* Unregister a trace_uprobe and probe_event: call with locking uprobe_lock */ |
167 | static void unregister_trace_uprobe(struct trace_uprobe *tu) | 167 | static int unregister_trace_uprobe(struct trace_uprobe *tu) |
168 | { | 168 | { |
169 | int ret; | ||
170 | |||
171 | ret = unregister_uprobe_event(tu); | ||
172 | if (ret) | ||
173 | return ret; | ||
174 | |||
169 | list_del(&tu->list); | 175 | list_del(&tu->list); |
170 | unregister_uprobe_event(tu); | ||
171 | free_trace_uprobe(tu); | 176 | free_trace_uprobe(tu); |
177 | return 0; | ||
172 | } | 178 | } |
173 | 179 | ||
174 | /* Register a trace_uprobe and probe_event */ | 180 | /* Register a trace_uprobe and probe_event */ |
@@ -181,9 +187,12 @@ static int register_trace_uprobe(struct trace_uprobe *tu) | |||
181 | 187 | ||
182 | /* register as an event */ | 188 | /* register as an event */ |
183 | old_tp = find_probe_event(tu->call.name, tu->call.class->system); | 189 | old_tp = find_probe_event(tu->call.name, tu->call.class->system); |
184 | if (old_tp) | 190 | if (old_tp) { |
185 | /* delete old event */ | 191 | /* delete old event */ |
186 | unregister_trace_uprobe(old_tp); | 192 | ret = unregister_trace_uprobe(old_tp); |
193 | if (ret) | ||
194 | goto end; | ||
195 | } | ||
187 | 196 | ||
188 | ret = register_uprobe_event(tu); | 197 | ret = register_uprobe_event(tu); |
189 | if (ret) { | 198 | if (ret) { |
@@ -256,6 +265,8 @@ static int create_trace_uprobe(int argc, char **argv) | |||
256 | group = UPROBE_EVENT_SYSTEM; | 265 | group = UPROBE_EVENT_SYSTEM; |
257 | 266 | ||
258 | if (is_delete) { | 267 | if (is_delete) { |
268 | int ret; | ||
269 | |||
259 | if (!event) { | 270 | if (!event) { |
260 | pr_info("Delete command needs an event name.\n"); | 271 | pr_info("Delete command needs an event name.\n"); |
261 | return -EINVAL; | 272 | return -EINVAL; |
@@ -269,9 +280,9 @@ static int create_trace_uprobe(int argc, char **argv) | |||
269 | return -ENOENT; | 280 | return -ENOENT; |
270 | } | 281 | } |
271 | /* delete an event */ | 282 | /* delete an event */ |
272 | unregister_trace_uprobe(tu); | 283 | ret = unregister_trace_uprobe(tu); |
273 | mutex_unlock(&uprobe_lock); | 284 | mutex_unlock(&uprobe_lock); |
274 | return 0; | 285 | return ret; |
275 | } | 286 | } |
276 | 287 | ||
277 | if (argc < 2) { | 288 | if (argc < 2) { |
@@ -408,16 +419,20 @@ fail_address_parse: | |||
408 | return ret; | 419 | return ret; |
409 | } | 420 | } |
410 | 421 | ||
411 | static void cleanup_all_probes(void) | 422 | static int cleanup_all_probes(void) |
412 | { | 423 | { |
413 | struct trace_uprobe *tu; | 424 | struct trace_uprobe *tu; |
425 | int ret = 0; | ||
414 | 426 | ||
415 | mutex_lock(&uprobe_lock); | 427 | mutex_lock(&uprobe_lock); |
416 | while (!list_empty(&uprobe_list)) { | 428 | while (!list_empty(&uprobe_list)) { |
417 | tu = list_entry(uprobe_list.next, struct trace_uprobe, list); | 429 | tu = list_entry(uprobe_list.next, struct trace_uprobe, list); |
418 | unregister_trace_uprobe(tu); | 430 | ret = unregister_trace_uprobe(tu); |
431 | if (ret) | ||
432 | break; | ||
419 | } | 433 | } |
420 | mutex_unlock(&uprobe_lock); | 434 | mutex_unlock(&uprobe_lock); |
435 | return ret; | ||
421 | } | 436 | } |
422 | 437 | ||
423 | /* Probes listing interfaces */ | 438 | /* Probes listing interfaces */ |
@@ -462,8 +477,13 @@ static const struct seq_operations probes_seq_op = { | |||
462 | 477 | ||
463 | static int probes_open(struct inode *inode, struct file *file) | 478 | static int probes_open(struct inode *inode, struct file *file) |
464 | { | 479 | { |
465 | if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) | 480 | int ret; |
466 | cleanup_all_probes(); | 481 | |
482 | if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) { | ||
483 | ret = cleanup_all_probes(); | ||
484 | if (ret) | ||
485 | return ret; | ||
486 | } | ||
467 | 487 | ||
468 | return seq_open(file, &probes_seq_op); | 488 | return seq_open(file, &probes_seq_op); |
469 | } | 489 | } |
@@ -968,12 +988,17 @@ static int register_uprobe_event(struct trace_uprobe *tu) | |||
968 | return ret; | 988 | return ret; |
969 | } | 989 | } |
970 | 990 | ||
971 | static void unregister_uprobe_event(struct trace_uprobe *tu) | 991 | static int unregister_uprobe_event(struct trace_uprobe *tu) |
972 | { | 992 | { |
993 | int ret; | ||
994 | |||
973 | /* tu->event is unregistered in trace_remove_event_call() */ | 995 | /* tu->event is unregistered in trace_remove_event_call() */ |
974 | trace_remove_event_call(&tu->call); | 996 | ret = trace_remove_event_call(&tu->call); |
997 | if (ret) | ||
998 | return ret; | ||
975 | kfree(tu->call.print_fmt); | 999 | kfree(tu->call.print_fmt); |
976 | tu->call.print_fmt = NULL; | 1000 | tu->call.print_fmt = NULL; |
1001 | return 0; | ||
977 | } | 1002 | } |
978 | 1003 | ||
979 | /* Make a trace interface for controling probe points */ | 1004 | /* Make a trace interface for controling probe points */ |
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index d8c30db06c5b..9064b919a406 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c | |||
@@ -62,6 +62,9 @@ int create_user_ns(struct cred *new) | |||
62 | kgid_t group = new->egid; | 62 | kgid_t group = new->egid; |
63 | int ret; | 63 | int ret; |
64 | 64 | ||
65 | if (parent_ns->level > 32) | ||
66 | return -EUSERS; | ||
67 | |||
65 | /* | 68 | /* |
66 | * Verify that we can not violate the policy of which files | 69 | * Verify that we can not violate the policy of which files |
67 | * may be accessed that is specified by the root directory, | 70 | * may be accessed that is specified by the root directory, |
@@ -92,6 +95,7 @@ int create_user_ns(struct cred *new) | |||
92 | atomic_set(&ns->count, 1); | 95 | atomic_set(&ns->count, 1); |
93 | /* Leave the new->user_ns reference with the new user namespace. */ | 96 | /* Leave the new->user_ns reference with the new user namespace. */ |
94 | ns->parent = parent_ns; | 97 | ns->parent = parent_ns; |
98 | ns->level = parent_ns->level + 1; | ||
95 | ns->owner = owner; | 99 | ns->owner = owner; |
96 | ns->group = group; | 100 | ns->group = group; |
97 | 101 | ||
@@ -105,16 +109,21 @@ int create_user_ns(struct cred *new) | |||
105 | int unshare_userns(unsigned long unshare_flags, struct cred **new_cred) | 109 | int unshare_userns(unsigned long unshare_flags, struct cred **new_cred) |
106 | { | 110 | { |
107 | struct cred *cred; | 111 | struct cred *cred; |
112 | int err = -ENOMEM; | ||
108 | 113 | ||
109 | if (!(unshare_flags & CLONE_NEWUSER)) | 114 | if (!(unshare_flags & CLONE_NEWUSER)) |
110 | return 0; | 115 | return 0; |
111 | 116 | ||
112 | cred = prepare_creds(); | 117 | cred = prepare_creds(); |
113 | if (!cred) | 118 | if (cred) { |
114 | return -ENOMEM; | 119 | err = create_user_ns(cred); |
120 | if (err) | ||
121 | put_cred(cred); | ||
122 | else | ||
123 | *new_cred = cred; | ||
124 | } | ||
115 | 125 | ||
116 | *new_cred = cred; | 126 | return err; |
117 | return create_user_ns(cred); | ||
118 | } | 127 | } |
119 | 128 | ||
120 | void free_user_ns(struct user_namespace *ns) | 129 | void free_user_ns(struct user_namespace *ns) |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 0b72e816b8d0..7f5d4be22034 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -2817,6 +2817,19 @@ already_gone: | |||
2817 | return false; | 2817 | return false; |
2818 | } | 2818 | } |
2819 | 2819 | ||
2820 | static bool __flush_work(struct work_struct *work) | ||
2821 | { | ||
2822 | struct wq_barrier barr; | ||
2823 | |||
2824 | if (start_flush_work(work, &barr)) { | ||
2825 | wait_for_completion(&barr.done); | ||
2826 | destroy_work_on_stack(&barr.work); | ||
2827 | return true; | ||
2828 | } else { | ||
2829 | return false; | ||
2830 | } | ||
2831 | } | ||
2832 | |||
2820 | /** | 2833 | /** |
2821 | * flush_work - wait for a work to finish executing the last queueing instance | 2834 | * flush_work - wait for a work to finish executing the last queueing instance |
2822 | * @work: the work to flush | 2835 | * @work: the work to flush |
@@ -2830,18 +2843,10 @@ already_gone: | |||
2830 | */ | 2843 | */ |
2831 | bool flush_work(struct work_struct *work) | 2844 | bool flush_work(struct work_struct *work) |
2832 | { | 2845 | { |
2833 | struct wq_barrier barr; | ||
2834 | |||
2835 | lock_map_acquire(&work->lockdep_map); | 2846 | lock_map_acquire(&work->lockdep_map); |
2836 | lock_map_release(&work->lockdep_map); | 2847 | lock_map_release(&work->lockdep_map); |
2837 | 2848 | ||
2838 | if (start_flush_work(work, &barr)) { | 2849 | return __flush_work(work); |
2839 | wait_for_completion(&barr.done); | ||
2840 | destroy_work_on_stack(&barr.work); | ||
2841 | return true; | ||
2842 | } else { | ||
2843 | return false; | ||
2844 | } | ||
2845 | } | 2850 | } |
2846 | EXPORT_SYMBOL_GPL(flush_work); | 2851 | EXPORT_SYMBOL_GPL(flush_work); |
2847 | 2852 | ||
@@ -3411,6 +3416,12 @@ static void copy_workqueue_attrs(struct workqueue_attrs *to, | |||
3411 | { | 3416 | { |
3412 | to->nice = from->nice; | 3417 | to->nice = from->nice; |
3413 | cpumask_copy(to->cpumask, from->cpumask); | 3418 | cpumask_copy(to->cpumask, from->cpumask); |
3419 | /* | ||
3420 | * Unlike hash and equality test, this function doesn't ignore | ||
3421 | * ->no_numa as it is used for both pool and wq attrs. Instead, | ||
3422 | * get_unbound_pool() explicitly clears ->no_numa after copying. | ||
3423 | */ | ||
3424 | to->no_numa = from->no_numa; | ||
3414 | } | 3425 | } |
3415 | 3426 | ||
3416 | /* hash value of the content of @attr */ | 3427 | /* hash value of the content of @attr */ |
@@ -3578,6 +3589,12 @@ static struct worker_pool *get_unbound_pool(const struct workqueue_attrs *attrs) | |||
3578 | lockdep_set_subclass(&pool->lock, 1); /* see put_pwq() */ | 3589 | lockdep_set_subclass(&pool->lock, 1); /* see put_pwq() */ |
3579 | copy_workqueue_attrs(pool->attrs, attrs); | 3590 | copy_workqueue_attrs(pool->attrs, attrs); |
3580 | 3591 | ||
3592 | /* | ||
3593 | * no_numa isn't a worker_pool attribute, always clear it. See | ||
3594 | * 'struct workqueue_attrs' comments for detail. | ||
3595 | */ | ||
3596 | pool->attrs->no_numa = false; | ||
3597 | |||
3581 | /* if cpumask is contained inside a NUMA node, we belong to that node */ | 3598 | /* if cpumask is contained inside a NUMA node, we belong to that node */ |
3582 | if (wq_numa_enabled) { | 3599 | if (wq_numa_enabled) { |
3583 | for_each_node(node) { | 3600 | for_each_node(node) { |
@@ -4756,7 +4773,14 @@ long work_on_cpu(int cpu, long (*fn)(void *), void *arg) | |||
4756 | 4773 | ||
4757 | INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); | 4774 | INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); |
4758 | schedule_work_on(cpu, &wfc.work); | 4775 | schedule_work_on(cpu, &wfc.work); |
4759 | flush_work(&wfc.work); | 4776 | |
4777 | /* | ||
4778 | * The work item is on-stack and can't lead to deadlock through | ||
4779 | * flushing. Use __flush_work() to avoid spurious lockdep warnings | ||
4780 | * when work_on_cpu()s are nested. | ||
4781 | */ | ||
4782 | __flush_work(&wfc.work); | ||
4783 | |||
4760 | return wfc.ret; | 4784 | return wfc.ret; |
4761 | } | 4785 | } |
4762 | EXPORT_SYMBOL_GPL(work_on_cpu); | 4786 | EXPORT_SYMBOL_GPL(work_on_cpu); |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 243e710c6039..a92012a71702 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1620,7 +1620,9 @@ static void __split_huge_page_refcount(struct page *page, | |||
1620 | ((1L << PG_referenced) | | 1620 | ((1L << PG_referenced) | |
1621 | (1L << PG_swapbacked) | | 1621 | (1L << PG_swapbacked) | |
1622 | (1L << PG_mlocked) | | 1622 | (1L << PG_mlocked) | |
1623 | (1L << PG_uptodate))); | 1623 | (1L << PG_uptodate) | |
1624 | (1L << PG_active) | | ||
1625 | (1L << PG_unevictable))); | ||
1624 | page_tail->flags |= (1L << PG_dirty); | 1626 | page_tail->flags |= (1L << PG_dirty); |
1625 | 1627 | ||
1626 | /* clear PageTail before overwriting first_page */ | 1628 | /* clear PageTail before overwriting first_page */ |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 00a7a664b9c1..c290a1cf3862 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -6335,6 +6335,7 @@ static void mem_cgroup_css_offline(struct cgroup *cont) | |||
6335 | mem_cgroup_invalidate_reclaim_iterators(memcg); | 6335 | mem_cgroup_invalidate_reclaim_iterators(memcg); |
6336 | mem_cgroup_reparent_charges(memcg); | 6336 | mem_cgroup_reparent_charges(memcg); |
6337 | mem_cgroup_destroy_all_caches(memcg); | 6337 | mem_cgroup_destroy_all_caches(memcg); |
6338 | vmpressure_cleanup(&memcg->vmpressure); | ||
6338 | } | 6339 | } |
6339 | 6340 | ||
6340 | static void mem_cgroup_css_free(struct cgroup *cont) | 6341 | static void mem_cgroup_css_free(struct cgroup *cont) |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 74310017296e..4baf12e534d1 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -732,7 +732,10 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, | |||
732 | if (prev) { | 732 | if (prev) { |
733 | vma = prev; | 733 | vma = prev; |
734 | next = vma->vm_next; | 734 | next = vma->vm_next; |
735 | continue; | 735 | if (mpol_equal(vma_policy(vma), new_pol)) |
736 | continue; | ||
737 | /* vma_merge() joined vma && vma->next, case 8 */ | ||
738 | goto replace; | ||
736 | } | 739 | } |
737 | if (vma->vm_start != vmstart) { | 740 | if (vma->vm_start != vmstart) { |
738 | err = split_vma(vma->vm_mm, vma, vmstart, 1); | 741 | err = split_vma(vma->vm_mm, vma, vmstart, 1); |
@@ -744,6 +747,7 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, | |||
744 | if (err) | 747 | if (err) |
745 | goto out; | 748 | goto out; |
746 | } | 749 | } |
750 | replace: | ||
747 | err = vma_replace_policy(vma, new_pol); | 751 | err = vma_replace_policy(vma, new_pol); |
748 | if (err) | 752 | if (err) |
749 | goto out; | 753 | goto out; |
@@ -865,7 +865,7 @@ again: remove_next = 1 + (end > next->vm_end); | |||
865 | if (next->anon_vma) | 865 | if (next->anon_vma) |
866 | anon_vma_merge(vma, next); | 866 | anon_vma_merge(vma, next); |
867 | mm->map_count--; | 867 | mm->map_count--; |
868 | vma_set_policy(vma, vma_policy(next)); | 868 | mpol_put(vma_policy(next)); |
869 | kmem_cache_free(vm_area_cachep, next); | 869 | kmem_cache_free(vm_area_cachep, next); |
870 | /* | 870 | /* |
871 | * In mprotect's case 6 (see comments on vma_merge), | 871 | * In mprotect's case 6 (see comments on vma_merge), |
diff --git a/mm/shmem.c b/mm/shmem.c index a87990cf9f94..8335dbd3fc35 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1798,7 +1798,8 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence) | |||
1798 | } | 1798 | } |
1799 | } | 1799 | } |
1800 | 1800 | ||
1801 | offset = vfs_setpos(file, offset, MAX_LFS_FILESIZE); | 1801 | if (offset >= 0) |
1802 | offset = vfs_setpos(file, offset, MAX_LFS_FILESIZE); | ||
1802 | mutex_unlock(&inode->i_mutex); | 1803 | mutex_unlock(&inode->i_mutex); |
1803 | return offset; | 1804 | return offset; |
1804 | } | 1805 | } |
@@ -1968,9 +1968,6 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain) | |||
1968 | int pages; | 1968 | int pages; |
1969 | int pobjects; | 1969 | int pobjects; |
1970 | 1970 | ||
1971 | if (!s->cpu_partial) | ||
1972 | return; | ||
1973 | |||
1974 | do { | 1971 | do { |
1975 | pages = 0; | 1972 | pages = 0; |
1976 | pobjects = 0; | 1973 | pobjects = 0; |
@@ -512,12 +512,7 @@ EXPORT_SYMBOL(__lru_cache_add); | |||
512 | */ | 512 | */ |
513 | void lru_cache_add(struct page *page) | 513 | void lru_cache_add(struct page *page) |
514 | { | 514 | { |
515 | if (PageActive(page)) { | 515 | VM_BUG_ON(PageActive(page) && PageUnevictable(page)); |
516 | VM_BUG_ON(PageUnevictable(page)); | ||
517 | } else if (PageUnevictable(page)) { | ||
518 | VM_BUG_ON(PageActive(page)); | ||
519 | } | ||
520 | |||
521 | VM_BUG_ON(PageLRU(page)); | 516 | VM_BUG_ON(PageLRU(page)); |
522 | __lru_cache_add(page); | 517 | __lru_cache_add(page); |
523 | } | 518 | } |
@@ -539,6 +534,7 @@ void add_page_to_unevictable_list(struct page *page) | |||
539 | 534 | ||
540 | spin_lock_irq(&zone->lru_lock); | 535 | spin_lock_irq(&zone->lru_lock); |
541 | lruvec = mem_cgroup_page_lruvec(page, zone); | 536 | lruvec = mem_cgroup_page_lruvec(page, zone); |
537 | ClearPageActive(page); | ||
542 | SetPageUnevictable(page); | 538 | SetPageUnevictable(page); |
543 | SetPageLRU(page); | 539 | SetPageLRU(page); |
544 | add_page_to_lru_list(page, lruvec, LRU_UNEVICTABLE); | 540 | add_page_to_lru_list(page, lruvec, LRU_UNEVICTABLE); |
@@ -774,8 +770,6 @@ EXPORT_SYMBOL(__pagevec_release); | |||
774 | void lru_add_page_tail(struct page *page, struct page *page_tail, | 770 | void lru_add_page_tail(struct page *page, struct page *page_tail, |
775 | struct lruvec *lruvec, struct list_head *list) | 771 | struct lruvec *lruvec, struct list_head *list) |
776 | { | 772 | { |
777 | int uninitialized_var(active); | ||
778 | enum lru_list lru; | ||
779 | const int file = 0; | 773 | const int file = 0; |
780 | 774 | ||
781 | VM_BUG_ON(!PageHead(page)); | 775 | VM_BUG_ON(!PageHead(page)); |
@@ -787,20 +781,6 @@ void lru_add_page_tail(struct page *page, struct page *page_tail, | |||
787 | if (!list) | 781 | if (!list) |
788 | SetPageLRU(page_tail); | 782 | SetPageLRU(page_tail); |
789 | 783 | ||
790 | if (page_evictable(page_tail)) { | ||
791 | if (PageActive(page)) { | ||
792 | SetPageActive(page_tail); | ||
793 | active = 1; | ||
794 | lru = LRU_ACTIVE_ANON; | ||
795 | } else { | ||
796 | active = 0; | ||
797 | lru = LRU_INACTIVE_ANON; | ||
798 | } | ||
799 | } else { | ||
800 | SetPageUnevictable(page_tail); | ||
801 | lru = LRU_UNEVICTABLE; | ||
802 | } | ||
803 | |||
804 | if (likely(PageLRU(page))) | 784 | if (likely(PageLRU(page))) |
805 | list_add_tail(&page_tail->lru, &page->lru); | 785 | list_add_tail(&page_tail->lru, &page->lru); |
806 | else if (list) { | 786 | else if (list) { |
@@ -816,13 +796,13 @@ void lru_add_page_tail(struct page *page, struct page *page_tail, | |||
816 | * Use the standard add function to put page_tail on the list, | 796 | * Use the standard add function to put page_tail on the list, |
817 | * but then correct its position so they all end up in order. | 797 | * but then correct its position so they all end up in order. |
818 | */ | 798 | */ |
819 | add_page_to_lru_list(page_tail, lruvec, lru); | 799 | add_page_to_lru_list(page_tail, lruvec, page_lru(page_tail)); |
820 | list_head = page_tail->lru.prev; | 800 | list_head = page_tail->lru.prev; |
821 | list_move_tail(&page_tail->lru, list_head); | 801 | list_move_tail(&page_tail->lru, list_head); |
822 | } | 802 | } |
823 | 803 | ||
824 | if (!PageUnevictable(page)) | 804 | if (!PageUnevictable(page)) |
825 | update_page_reclaim_stat(lruvec, file, active); | 805 | update_page_reclaim_stat(lruvec, file, PageActive(page_tail)); |
826 | } | 806 | } |
827 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | 807 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ |
828 | 808 | ||
@@ -833,7 +813,6 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec, | |||
833 | int active = PageActive(page); | 813 | int active = PageActive(page); |
834 | enum lru_list lru = page_lru(page); | 814 | enum lru_list lru = page_lru(page); |
835 | 815 | ||
836 | VM_BUG_ON(PageUnevictable(page)); | ||
837 | VM_BUG_ON(PageLRU(page)); | 816 | VM_BUG_ON(PageLRU(page)); |
838 | 817 | ||
839 | SetPageLRU(page); | 818 | SetPageLRU(page); |
diff --git a/mm/vmpressure.c b/mm/vmpressure.c index 736a6011c2c8..0c1e37d829fa 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c | |||
@@ -180,12 +180,12 @@ static void vmpressure_work_fn(struct work_struct *work) | |||
180 | if (!vmpr->scanned) | 180 | if (!vmpr->scanned) |
181 | return; | 181 | return; |
182 | 182 | ||
183 | mutex_lock(&vmpr->sr_lock); | 183 | spin_lock(&vmpr->sr_lock); |
184 | scanned = vmpr->scanned; | 184 | scanned = vmpr->scanned; |
185 | reclaimed = vmpr->reclaimed; | 185 | reclaimed = vmpr->reclaimed; |
186 | vmpr->scanned = 0; | 186 | vmpr->scanned = 0; |
187 | vmpr->reclaimed = 0; | 187 | vmpr->reclaimed = 0; |
188 | mutex_unlock(&vmpr->sr_lock); | 188 | spin_unlock(&vmpr->sr_lock); |
189 | 189 | ||
190 | do { | 190 | do { |
191 | if (vmpressure_event(vmpr, scanned, reclaimed)) | 191 | if (vmpressure_event(vmpr, scanned, reclaimed)) |
@@ -240,13 +240,13 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, | |||
240 | if (!scanned) | 240 | if (!scanned) |
241 | return; | 241 | return; |
242 | 242 | ||
243 | mutex_lock(&vmpr->sr_lock); | 243 | spin_lock(&vmpr->sr_lock); |
244 | vmpr->scanned += scanned; | 244 | vmpr->scanned += scanned; |
245 | vmpr->reclaimed += reclaimed; | 245 | vmpr->reclaimed += reclaimed; |
246 | scanned = vmpr->scanned; | 246 | scanned = vmpr->scanned; |
247 | mutex_unlock(&vmpr->sr_lock); | 247 | spin_unlock(&vmpr->sr_lock); |
248 | 248 | ||
249 | if (scanned < vmpressure_win || work_pending(&vmpr->work)) | 249 | if (scanned < vmpressure_win) |
250 | return; | 250 | return; |
251 | schedule_work(&vmpr->work); | 251 | schedule_work(&vmpr->work); |
252 | } | 252 | } |
@@ -367,8 +367,24 @@ void vmpressure_unregister_event(struct cgroup *cg, struct cftype *cft, | |||
367 | */ | 367 | */ |
368 | void vmpressure_init(struct vmpressure *vmpr) | 368 | void vmpressure_init(struct vmpressure *vmpr) |
369 | { | 369 | { |
370 | mutex_init(&vmpr->sr_lock); | 370 | spin_lock_init(&vmpr->sr_lock); |
371 | mutex_init(&vmpr->events_lock); | 371 | mutex_init(&vmpr->events_lock); |
372 | INIT_LIST_HEAD(&vmpr->events); | 372 | INIT_LIST_HEAD(&vmpr->events); |
373 | INIT_WORK(&vmpr->work, vmpressure_work_fn); | 373 | INIT_WORK(&vmpr->work, vmpressure_work_fn); |
374 | } | 374 | } |
375 | |||
376 | /** | ||
377 | * vmpressure_cleanup() - shuts down vmpressure control structure | ||
378 | * @vmpr: Structure to be cleaned up | ||
379 | * | ||
380 | * This function should be called before the structure in which it is | ||
381 | * embedded is cleaned up. | ||
382 | */ | ||
383 | void vmpressure_cleanup(struct vmpressure *vmpr) | ||
384 | { | ||
385 | /* | ||
386 | * Make sure there is no pending work before eventfd infrastructure | ||
387 | * goes away. | ||
388 | */ | ||
389 | flush_work(&vmpr->work); | ||
390 | } | ||
@@ -257,7 +257,7 @@ int zbud_alloc(struct zbud_pool *pool, int size, gfp_t gfp, | |||
257 | 257 | ||
258 | if (size <= 0 || gfp & __GFP_HIGHMEM) | 258 | if (size <= 0 || gfp & __GFP_HIGHMEM) |
259 | return -EINVAL; | 259 | return -EINVAL; |
260 | if (size > PAGE_SIZE - ZHDR_SIZE_ALIGNED) | 260 | if (size > PAGE_SIZE - ZHDR_SIZE_ALIGNED - CHUNK_SIZE) |
261 | return -ENOSPC; | 261 | return -ENOSPC; |
262 | chunks = size_to_chunks(size); | 262 | chunks = size_to_chunks(size); |
263 | spin_lock(&pool->lock); | 263 | spin_lock(&pool->lock); |
diff --git a/net/Kconfig b/net/Kconfig index 37702491abe9..2b406608a1a4 100644 --- a/net/Kconfig +++ b/net/Kconfig | |||
@@ -244,7 +244,7 @@ config NETPRIO_CGROUP | |||
244 | Cgroup subsystem for use in assigning processes to network priorities on | 244 | Cgroup subsystem for use in assigning processes to network priorities on |
245 | a per-interface basis | 245 | a per-interface basis |
246 | 246 | ||
247 | config NET_LL_RX_POLL | 247 | config NET_RX_BUSY_POLL |
248 | boolean | 248 | boolean |
249 | default y | 249 | default y |
250 | 250 | ||
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index e3a349977595..cc27297da5a9 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -513,7 +513,10 @@ static void hci_init2_req(struct hci_request *req, unsigned long opt) | |||
513 | 513 | ||
514 | hci_setup_event_mask(req); | 514 | hci_setup_event_mask(req); |
515 | 515 | ||
516 | if (hdev->hci_ver > BLUETOOTH_VER_1_1) | 516 | /* AVM Berlin (31), aka "BlueFRITZ!", doesn't support the read |
517 | * local supported commands HCI command. | ||
518 | */ | ||
519 | if (hdev->manufacturer != 31 && hdev->hci_ver > BLUETOOTH_VER_1_1) | ||
517 | hci_req_add(req, HCI_OP_READ_LOCAL_COMMANDS, 0, NULL); | 520 | hci_req_add(req, HCI_OP_READ_LOCAL_COMMANDS, 0, NULL); |
518 | 521 | ||
519 | if (lmp_ssp_capable(hdev)) { | 522 | if (lmp_ssp_capable(hdev)) { |
@@ -2165,10 +2168,6 @@ int hci_register_dev(struct hci_dev *hdev) | |||
2165 | 2168 | ||
2166 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); | 2169 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); |
2167 | 2170 | ||
2168 | write_lock(&hci_dev_list_lock); | ||
2169 | list_add(&hdev->list, &hci_dev_list); | ||
2170 | write_unlock(&hci_dev_list_lock); | ||
2171 | |||
2172 | hdev->workqueue = alloc_workqueue("%s", WQ_HIGHPRI | WQ_UNBOUND | | 2171 | hdev->workqueue = alloc_workqueue("%s", WQ_HIGHPRI | WQ_UNBOUND | |
2173 | WQ_MEM_RECLAIM, 1, hdev->name); | 2172 | WQ_MEM_RECLAIM, 1, hdev->name); |
2174 | if (!hdev->workqueue) { | 2173 | if (!hdev->workqueue) { |
@@ -2203,6 +2202,10 @@ int hci_register_dev(struct hci_dev *hdev) | |||
2203 | if (hdev->dev_type != HCI_AMP) | 2202 | if (hdev->dev_type != HCI_AMP) |
2204 | set_bit(HCI_AUTO_OFF, &hdev->dev_flags); | 2203 | set_bit(HCI_AUTO_OFF, &hdev->dev_flags); |
2205 | 2204 | ||
2205 | write_lock(&hci_dev_list_lock); | ||
2206 | list_add(&hdev->list, &hci_dev_list); | ||
2207 | write_unlock(&hci_dev_list_lock); | ||
2208 | |||
2206 | hci_notify(hdev, HCI_DEV_REG); | 2209 | hci_notify(hdev, HCI_DEV_REG); |
2207 | hci_dev_hold(hdev); | 2210 | hci_dev_hold(hdev); |
2208 | 2211 | ||
@@ -2215,9 +2218,6 @@ err_wqueue: | |||
2215 | destroy_workqueue(hdev->req_workqueue); | 2218 | destroy_workqueue(hdev->req_workqueue); |
2216 | err: | 2219 | err: |
2217 | ida_simple_remove(&hci_index_ida, hdev->id); | 2220 | ida_simple_remove(&hci_index_ida, hdev->id); |
2218 | write_lock(&hci_dev_list_lock); | ||
2219 | list_del(&hdev->list); | ||
2220 | write_unlock(&hci_dev_list_lock); | ||
2221 | 2221 | ||
2222 | return error; | 2222 | return error; |
2223 | } | 2223 | } |
@@ -3399,8 +3399,16 @@ void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status) | |||
3399 | */ | 3399 | */ |
3400 | if (hdev->sent_cmd) { | 3400 | if (hdev->sent_cmd) { |
3401 | req_complete = bt_cb(hdev->sent_cmd)->req.complete; | 3401 | req_complete = bt_cb(hdev->sent_cmd)->req.complete; |
3402 | if (req_complete) | 3402 | |
3403 | if (req_complete) { | ||
3404 | /* We must set the complete callback to NULL to | ||
3405 | * avoid calling the callback more than once if | ||
3406 | * this function gets called again. | ||
3407 | */ | ||
3408 | bt_cb(hdev->sent_cmd)->req.complete = NULL; | ||
3409 | |||
3403 | goto call_complete; | 3410 | goto call_complete; |
3411 | } | ||
3404 | } | 3412 | } |
3405 | 3413 | ||
3406 | /* Remove all pending commands belonging to this request */ | 3414 | /* Remove all pending commands belonging to this request */ |
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 2ef66781fedb..69363bd37f64 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c | |||
@@ -70,7 +70,8 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | mdst = br_mdb_get(br, skb, vid); | 72 | mdst = br_mdb_get(br, skb, vid); |
73 | if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) | 73 | if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && |
74 | br_multicast_querier_exists(br)) | ||
74 | br_multicast_deliver(mdst, skb); | 75 | br_multicast_deliver(mdst, skb); |
75 | else | 76 | else |
76 | br_flood_deliver(br, skb, false); | 77 | br_flood_deliver(br, skb, false); |
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index 1b8b8b824cd7..8c561c0aa636 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c | |||
@@ -101,7 +101,8 @@ int br_handle_frame_finish(struct sk_buff *skb) | |||
101 | unicast = false; | 101 | unicast = false; |
102 | } else if (is_multicast_ether_addr(dest)) { | 102 | } else if (is_multicast_ether_addr(dest)) { |
103 | mdst = br_mdb_get(br, skb, vid); | 103 | mdst = br_mdb_get(br, skb, vid); |
104 | if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) { | 104 | if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && |
105 | br_multicast_querier_exists(br)) { | ||
105 | if ((mdst && mdst->mglist) || | 106 | if ((mdst && mdst->mglist) || |
106 | br_multicast_is_router(br)) | 107 | br_multicast_is_router(br)) |
107 | skb2 = skb; | 108 | skb2 = skb; |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 69af490cce44..61c5e819380e 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -619,6 +619,9 @@ rehash: | |||
619 | mp->br = br; | 619 | mp->br = br; |
620 | mp->addr = *group; | 620 | mp->addr = *group; |
621 | 621 | ||
622 | setup_timer(&mp->timer, br_multicast_group_expired, | ||
623 | (unsigned long)mp); | ||
624 | |||
622 | hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]); | 625 | hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]); |
623 | mdb->size++; | 626 | mdb->size++; |
624 | 627 | ||
@@ -1011,6 +1014,16 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, | |||
1011 | } | 1014 | } |
1012 | #endif | 1015 | #endif |
1013 | 1016 | ||
1017 | static void br_multicast_update_querier_timer(struct net_bridge *br, | ||
1018 | unsigned long max_delay) | ||
1019 | { | ||
1020 | if (!timer_pending(&br->multicast_querier_timer)) | ||
1021 | br->multicast_querier_delay_time = jiffies + max_delay; | ||
1022 | |||
1023 | mod_timer(&br->multicast_querier_timer, | ||
1024 | jiffies + br->multicast_querier_interval); | ||
1025 | } | ||
1026 | |||
1014 | /* | 1027 | /* |
1015 | * Add port to router_list | 1028 | * Add port to router_list |
1016 | * list is maintained ordered by pointer value | 1029 | * list is maintained ordered by pointer value |
@@ -1061,11 +1074,11 @@ timer: | |||
1061 | 1074 | ||
1062 | static void br_multicast_query_received(struct net_bridge *br, | 1075 | static void br_multicast_query_received(struct net_bridge *br, |
1063 | struct net_bridge_port *port, | 1076 | struct net_bridge_port *port, |
1064 | int saddr) | 1077 | int saddr, |
1078 | unsigned long max_delay) | ||
1065 | { | 1079 | { |
1066 | if (saddr) | 1080 | if (saddr) |
1067 | mod_timer(&br->multicast_querier_timer, | 1081 | br_multicast_update_querier_timer(br, max_delay); |
1068 | jiffies + br->multicast_querier_interval); | ||
1069 | else if (timer_pending(&br->multicast_querier_timer)) | 1082 | else if (timer_pending(&br->multicast_querier_timer)) |
1070 | return; | 1083 | return; |
1071 | 1084 | ||
@@ -1093,8 +1106,6 @@ static int br_ip4_multicast_query(struct net_bridge *br, | |||
1093 | (port && port->state == BR_STATE_DISABLED)) | 1106 | (port && port->state == BR_STATE_DISABLED)) |
1094 | goto out; | 1107 | goto out; |
1095 | 1108 | ||
1096 | br_multicast_query_received(br, port, !!iph->saddr); | ||
1097 | |||
1098 | group = ih->group; | 1109 | group = ih->group; |
1099 | 1110 | ||
1100 | if (skb->len == sizeof(*ih)) { | 1111 | if (skb->len == sizeof(*ih)) { |
@@ -1118,6 +1129,8 @@ static int br_ip4_multicast_query(struct net_bridge *br, | |||
1118 | IGMPV3_MRC(ih3->code) * (HZ / IGMP_TIMER_SCALE) : 1; | 1129 | IGMPV3_MRC(ih3->code) * (HZ / IGMP_TIMER_SCALE) : 1; |
1119 | } | 1130 | } |
1120 | 1131 | ||
1132 | br_multicast_query_received(br, port, !!iph->saddr, max_delay); | ||
1133 | |||
1121 | if (!group) | 1134 | if (!group) |
1122 | goto out; | 1135 | goto out; |
1123 | 1136 | ||
@@ -1126,7 +1139,6 @@ static int br_ip4_multicast_query(struct net_bridge *br, | |||
1126 | if (!mp) | 1139 | if (!mp) |
1127 | goto out; | 1140 | goto out; |
1128 | 1141 | ||
1129 | setup_timer(&mp->timer, br_multicast_group_expired, (unsigned long)mp); | ||
1130 | mod_timer(&mp->timer, now + br->multicast_membership_interval); | 1142 | mod_timer(&mp->timer, now + br->multicast_membership_interval); |
1131 | mp->timer_armed = true; | 1143 | mp->timer_armed = true; |
1132 | 1144 | ||
@@ -1174,8 +1186,6 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
1174 | (port && port->state == BR_STATE_DISABLED)) | 1186 | (port && port->state == BR_STATE_DISABLED)) |
1175 | goto out; | 1187 | goto out; |
1176 | 1188 | ||
1177 | br_multicast_query_received(br, port, !ipv6_addr_any(&ip6h->saddr)); | ||
1178 | |||
1179 | if (skb->len == sizeof(*mld)) { | 1189 | if (skb->len == sizeof(*mld)) { |
1180 | if (!pskb_may_pull(skb, sizeof(*mld))) { | 1190 | if (!pskb_may_pull(skb, sizeof(*mld))) { |
1181 | err = -EINVAL; | 1191 | err = -EINVAL; |
@@ -1196,6 +1206,9 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
1196 | max_delay = mld2q->mld2q_mrc ? MLDV2_MRC(ntohs(mld2q->mld2q_mrc)) : 1; | 1206 | max_delay = mld2q->mld2q_mrc ? MLDV2_MRC(ntohs(mld2q->mld2q_mrc)) : 1; |
1197 | } | 1207 | } |
1198 | 1208 | ||
1209 | br_multicast_query_received(br, port, !ipv6_addr_any(&ip6h->saddr), | ||
1210 | max_delay); | ||
1211 | |||
1199 | if (!group) | 1212 | if (!group) |
1200 | goto out; | 1213 | goto out; |
1201 | 1214 | ||
@@ -1204,7 +1217,6 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
1204 | if (!mp) | 1217 | if (!mp) |
1205 | goto out; | 1218 | goto out; |
1206 | 1219 | ||
1207 | setup_timer(&mp->timer, br_multicast_group_expired, (unsigned long)mp); | ||
1208 | mod_timer(&mp->timer, now + br->multicast_membership_interval); | 1220 | mod_timer(&mp->timer, now + br->multicast_membership_interval); |
1209 | mp->timer_armed = true; | 1221 | mp->timer_armed = true; |
1210 | 1222 | ||
@@ -1642,6 +1654,8 @@ void br_multicast_init(struct net_bridge *br) | |||
1642 | br->multicast_querier_interval = 255 * HZ; | 1654 | br->multicast_querier_interval = 255 * HZ; |
1643 | br->multicast_membership_interval = 260 * HZ; | 1655 | br->multicast_membership_interval = 260 * HZ; |
1644 | 1656 | ||
1657 | br->multicast_querier_delay_time = 0; | ||
1658 | |||
1645 | spin_lock_init(&br->multicast_lock); | 1659 | spin_lock_init(&br->multicast_lock); |
1646 | setup_timer(&br->multicast_router_timer, | 1660 | setup_timer(&br->multicast_router_timer, |
1647 | br_multicast_local_router_expired, 0); | 1661 | br_multicast_local_router_expired, 0); |
@@ -1830,6 +1844,8 @@ unlock: | |||
1830 | 1844 | ||
1831 | int br_multicast_set_querier(struct net_bridge *br, unsigned long val) | 1845 | int br_multicast_set_querier(struct net_bridge *br, unsigned long val) |
1832 | { | 1846 | { |
1847 | unsigned long max_delay; | ||
1848 | |||
1833 | val = !!val; | 1849 | val = !!val; |
1834 | 1850 | ||
1835 | spin_lock_bh(&br->multicast_lock); | 1851 | spin_lock_bh(&br->multicast_lock); |
@@ -1837,8 +1853,14 @@ int br_multicast_set_querier(struct net_bridge *br, unsigned long val) | |||
1837 | goto unlock; | 1853 | goto unlock; |
1838 | 1854 | ||
1839 | br->multicast_querier = val; | 1855 | br->multicast_querier = val; |
1840 | if (val) | 1856 | if (!val) |
1841 | br_multicast_start_querier(br); | 1857 | goto unlock; |
1858 | |||
1859 | max_delay = br->multicast_query_response_interval; | ||
1860 | if (!timer_pending(&br->multicast_querier_timer)) | ||
1861 | br->multicast_querier_delay_time = jiffies + max_delay; | ||
1862 | |||
1863 | br_multicast_start_querier(br); | ||
1842 | 1864 | ||
1843 | unlock: | 1865 | unlock: |
1844 | spin_unlock_bh(&br->multicast_lock); | 1866 | spin_unlock_bh(&br->multicast_lock); |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 3be89b3ce17b..2f7da41851bf 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -267,6 +267,7 @@ struct net_bridge | |||
267 | unsigned long multicast_query_interval; | 267 | unsigned long multicast_query_interval; |
268 | unsigned long multicast_query_response_interval; | 268 | unsigned long multicast_query_response_interval; |
269 | unsigned long multicast_startup_query_interval; | 269 | unsigned long multicast_startup_query_interval; |
270 | unsigned long multicast_querier_delay_time; | ||
270 | 271 | ||
271 | spinlock_t multicast_lock; | 272 | spinlock_t multicast_lock; |
272 | struct net_bridge_mdb_htable __rcu *mdb; | 273 | struct net_bridge_mdb_htable __rcu *mdb; |
@@ -501,6 +502,13 @@ static inline bool br_multicast_is_router(struct net_bridge *br) | |||
501 | (br->multicast_router == 1 && | 502 | (br->multicast_router == 1 && |
502 | timer_pending(&br->multicast_router_timer)); | 503 | timer_pending(&br->multicast_router_timer)); |
503 | } | 504 | } |
505 | |||
506 | static inline bool br_multicast_querier_exists(struct net_bridge *br) | ||
507 | { | ||
508 | return time_is_before_jiffies(br->multicast_querier_delay_time) && | ||
509 | (br->multicast_querier || | ||
510 | timer_pending(&br->multicast_querier_timer)); | ||
511 | } | ||
504 | #else | 512 | #else |
505 | static inline int br_multicast_rcv(struct net_bridge *br, | 513 | static inline int br_multicast_rcv(struct net_bridge *br, |
506 | struct net_bridge_port *port, | 514 | struct net_bridge_port *port, |
@@ -557,6 +565,10 @@ static inline bool br_multicast_is_router(struct net_bridge *br) | |||
557 | { | 565 | { |
558 | return 0; | 566 | return 0; |
559 | } | 567 | } |
568 | static inline bool br_multicast_querier_exists(struct net_bridge *br) | ||
569 | { | ||
570 | return false; | ||
571 | } | ||
560 | static inline void br_mdb_init(void) | 572 | static inline void br_mdb_init(void) |
561 | { | 573 | { |
562 | } | 574 | } |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index b7de821f98df..9232c68941ab 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -2767,6 +2767,7 @@ EXPORT_SYMBOL(neigh_app_ns); | |||
2767 | 2767 | ||
2768 | #ifdef CONFIG_SYSCTL | 2768 | #ifdef CONFIG_SYSCTL |
2769 | static int zero; | 2769 | static int zero; |
2770 | static int int_max = INT_MAX; | ||
2770 | static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN); | 2771 | static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN); |
2771 | 2772 | ||
2772 | static int proc_unres_qlen(struct ctl_table *ctl, int write, | 2773 | static int proc_unres_qlen(struct ctl_table *ctl, int write, |
@@ -2819,19 +2820,25 @@ static struct neigh_sysctl_table { | |||
2819 | .procname = "mcast_solicit", | 2820 | .procname = "mcast_solicit", |
2820 | .maxlen = sizeof(int), | 2821 | .maxlen = sizeof(int), |
2821 | .mode = 0644, | 2822 | .mode = 0644, |
2822 | .proc_handler = proc_dointvec, | 2823 | .extra1 = &zero, |
2824 | .extra2 = &int_max, | ||
2825 | .proc_handler = proc_dointvec_minmax, | ||
2823 | }, | 2826 | }, |
2824 | [NEIGH_VAR_UCAST_PROBE] = { | 2827 | [NEIGH_VAR_UCAST_PROBE] = { |
2825 | .procname = "ucast_solicit", | 2828 | .procname = "ucast_solicit", |
2826 | .maxlen = sizeof(int), | 2829 | .maxlen = sizeof(int), |
2827 | .mode = 0644, | 2830 | .mode = 0644, |
2828 | .proc_handler = proc_dointvec, | 2831 | .extra1 = &zero, |
2832 | .extra2 = &int_max, | ||
2833 | .proc_handler = proc_dointvec_minmax, | ||
2829 | }, | 2834 | }, |
2830 | [NEIGH_VAR_APP_PROBE] = { | 2835 | [NEIGH_VAR_APP_PROBE] = { |
2831 | .procname = "app_solicit", | 2836 | .procname = "app_solicit", |
2832 | .maxlen = sizeof(int), | 2837 | .maxlen = sizeof(int), |
2833 | .mode = 0644, | 2838 | .mode = 0644, |
2834 | .proc_handler = proc_dointvec, | 2839 | .extra1 = &zero, |
2840 | .extra2 = &int_max, | ||
2841 | .proc_handler = proc_dointvec_minmax, | ||
2835 | }, | 2842 | }, |
2836 | [NEIGH_VAR_RETRANS_TIME] = { | 2843 | [NEIGH_VAR_RETRANS_TIME] = { |
2837 | .procname = "retrans_time", | 2844 | .procname = "retrans_time", |
@@ -2874,7 +2881,9 @@ static struct neigh_sysctl_table { | |||
2874 | .procname = "proxy_qlen", | 2881 | .procname = "proxy_qlen", |
2875 | .maxlen = sizeof(int), | 2882 | .maxlen = sizeof(int), |
2876 | .mode = 0644, | 2883 | .mode = 0644, |
2877 | .proc_handler = proc_dointvec, | 2884 | .extra1 = &zero, |
2885 | .extra2 = &int_max, | ||
2886 | .proc_handler = proc_dointvec_minmax, | ||
2878 | }, | 2887 | }, |
2879 | [NEIGH_VAR_ANYCAST_DELAY] = { | 2888 | [NEIGH_VAR_ANYCAST_DELAY] = { |
2880 | .procname = "anycast_delay", | 2889 | .procname = "anycast_delay", |
@@ -2916,19 +2925,25 @@ static struct neigh_sysctl_table { | |||
2916 | .procname = "gc_thresh1", | 2925 | .procname = "gc_thresh1", |
2917 | .maxlen = sizeof(int), | 2926 | .maxlen = sizeof(int), |
2918 | .mode = 0644, | 2927 | .mode = 0644, |
2919 | .proc_handler = proc_dointvec, | 2928 | .extra1 = &zero, |
2929 | .extra2 = &int_max, | ||
2930 | .proc_handler = proc_dointvec_minmax, | ||
2920 | }, | 2931 | }, |
2921 | [NEIGH_VAR_GC_THRESH2] = { | 2932 | [NEIGH_VAR_GC_THRESH2] = { |
2922 | .procname = "gc_thresh2", | 2933 | .procname = "gc_thresh2", |
2923 | .maxlen = sizeof(int), | 2934 | .maxlen = sizeof(int), |
2924 | .mode = 0644, | 2935 | .mode = 0644, |
2925 | .proc_handler = proc_dointvec, | 2936 | .extra1 = &zero, |
2937 | .extra2 = &int_max, | ||
2938 | .proc_handler = proc_dointvec_minmax, | ||
2926 | }, | 2939 | }, |
2927 | [NEIGH_VAR_GC_THRESH3] = { | 2940 | [NEIGH_VAR_GC_THRESH3] = { |
2928 | .procname = "gc_thresh3", | 2941 | .procname = "gc_thresh3", |
2929 | .maxlen = sizeof(int), | 2942 | .maxlen = sizeof(int), |
2930 | .mode = 0644, | 2943 | .mode = 0644, |
2931 | .proc_handler = proc_dointvec, | 2944 | .extra1 = &zero, |
2945 | .extra2 = &int_max, | ||
2946 | .proc_handler = proc_dointvec_minmax, | ||
2932 | }, | 2947 | }, |
2933 | {}, | 2948 | {}, |
2934 | }, | 2949 | }, |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 20e02d2605ec..2c3d0f53d198 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -309,7 +309,8 @@ EXPORT_SYMBOL(__alloc_skb); | |||
309 | * @frag_size: size of fragment, or 0 if head was kmalloced | 309 | * @frag_size: size of fragment, or 0 if head was kmalloced |
310 | * | 310 | * |
311 | * Allocate a new &sk_buff. Caller provides space holding head and | 311 | * Allocate a new &sk_buff. Caller provides space holding head and |
312 | * skb_shared_info. @data must have been allocated by kmalloc() | 312 | * skb_shared_info. @data must have been allocated by kmalloc() only if |
313 | * @frag_size is 0, otherwise data should come from the page allocator. | ||
313 | * The return is the new skb buffer. | 314 | * The return is the new skb buffer. |
314 | * On a failure the return is %NULL, and @data is not freed. | 315 | * On a failure the return is %NULL, and @data is not freed. |
315 | * Notes : | 316 | * Notes : |
@@ -739,7 +740,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old) | |||
739 | 740 | ||
740 | skb_copy_secmark(new, old); | 741 | skb_copy_secmark(new, old); |
741 | 742 | ||
742 | #ifdef CONFIG_NET_LL_RX_POLL | 743 | #ifdef CONFIG_NET_RX_BUSY_POLL |
743 | new->napi_id = old->napi_id; | 744 | new->napi_id = old->napi_id; |
744 | #endif | 745 | #endif |
745 | } | 746 | } |
diff --git a/net/core/sock.c b/net/core/sock.c index 548d716c5f62..2c097c5a35dd 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -900,7 +900,7 @@ set_rcvbuf: | |||
900 | sock_valbool_flag(sk, SOCK_SELECT_ERR_QUEUE, valbool); | 900 | sock_valbool_flag(sk, SOCK_SELECT_ERR_QUEUE, valbool); |
901 | break; | 901 | break; |
902 | 902 | ||
903 | #ifdef CONFIG_NET_LL_RX_POLL | 903 | #ifdef CONFIG_NET_RX_BUSY_POLL |
904 | case SO_BUSY_POLL: | 904 | case SO_BUSY_POLL: |
905 | /* allow unprivileged users to decrease the value */ | 905 | /* allow unprivileged users to decrease the value */ |
906 | if ((val > sk->sk_ll_usec) && !capable(CAP_NET_ADMIN)) | 906 | if ((val > sk->sk_ll_usec) && !capable(CAP_NET_ADMIN)) |
@@ -1170,7 +1170,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
1170 | v.val = sock_flag(sk, SOCK_SELECT_ERR_QUEUE); | 1170 | v.val = sock_flag(sk, SOCK_SELECT_ERR_QUEUE); |
1171 | break; | 1171 | break; |
1172 | 1172 | ||
1173 | #ifdef CONFIG_NET_LL_RX_POLL | 1173 | #ifdef CONFIG_NET_RX_BUSY_POLL |
1174 | case SO_BUSY_POLL: | 1174 | case SO_BUSY_POLL: |
1175 | v.val = sk->sk_ll_usec; | 1175 | v.val = sk->sk_ll_usec; |
1176 | break; | 1176 | break; |
@@ -2292,7 +2292,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) | |||
2292 | 2292 | ||
2293 | sk->sk_stamp = ktime_set(-1L, 0); | 2293 | sk->sk_stamp = ktime_set(-1L, 0); |
2294 | 2294 | ||
2295 | #ifdef CONFIG_NET_LL_RX_POLL | 2295 | #ifdef CONFIG_NET_RX_BUSY_POLL |
2296 | sk->sk_napi_id = 0; | 2296 | sk->sk_napi_id = 0; |
2297 | sk->sk_ll_usec = sysctl_net_busy_read; | 2297 | sk->sk_ll_usec = sysctl_net_busy_read; |
2298 | #endif | 2298 | #endif |
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index 660968616637..31107abd2783 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c | |||
@@ -21,7 +21,9 @@ | |||
21 | #include <net/net_ratelimit.h> | 21 | #include <net/net_ratelimit.h> |
22 | #include <net/busy_poll.h> | 22 | #include <net/busy_poll.h> |
23 | 23 | ||
24 | static int zero = 0; | ||
24 | static int one = 1; | 25 | static int one = 1; |
26 | static int ushort_max = USHRT_MAX; | ||
25 | 27 | ||
26 | #ifdef CONFIG_RPS | 28 | #ifdef CONFIG_RPS |
27 | static int rps_sock_flow_sysctl(struct ctl_table *table, int write, | 29 | static int rps_sock_flow_sysctl(struct ctl_table *table, int write, |
@@ -298,7 +300,7 @@ static struct ctl_table net_core_table[] = { | |||
298 | .proc_handler = flow_limit_table_len_sysctl | 300 | .proc_handler = flow_limit_table_len_sysctl |
299 | }, | 301 | }, |
300 | #endif /* CONFIG_NET_FLOW_LIMIT */ | 302 | #endif /* CONFIG_NET_FLOW_LIMIT */ |
301 | #ifdef CONFIG_NET_LL_RX_POLL | 303 | #ifdef CONFIG_NET_RX_BUSY_POLL |
302 | { | 304 | { |
303 | .procname = "busy_poll", | 305 | .procname = "busy_poll", |
304 | .data = &sysctl_net_busy_poll, | 306 | .data = &sysctl_net_busy_poll, |
@@ -339,7 +341,9 @@ static struct ctl_table netns_core_table[] = { | |||
339 | .data = &init_net.core.sysctl_somaxconn, | 341 | .data = &init_net.core.sysctl_somaxconn, |
340 | .maxlen = sizeof(int), | 342 | .maxlen = sizeof(int), |
341 | .mode = 0644, | 343 | .mode = 0644, |
342 | .proc_handler = proc_dointvec | 344 | .extra1 = &zero, |
345 | .extra2 = &ushort_max, | ||
346 | .proc_handler = proc_dointvec_minmax | ||
343 | }, | 347 | }, |
344 | { } | 348 | { } |
345 | }; | 349 | }; |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 8d48c392adcc..34ca6d5a3a4b 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -772,7 +772,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh, | |||
772 | ci = nla_data(tb[IFA_CACHEINFO]); | 772 | ci = nla_data(tb[IFA_CACHEINFO]); |
773 | if (!ci->ifa_valid || ci->ifa_prefered > ci->ifa_valid) { | 773 | if (!ci->ifa_valid || ci->ifa_prefered > ci->ifa_valid) { |
774 | err = -EINVAL; | 774 | err = -EINVAL; |
775 | goto errout; | 775 | goto errout_free; |
776 | } | 776 | } |
777 | *pvalid_lft = ci->ifa_valid; | 777 | *pvalid_lft = ci->ifa_valid; |
778 | *pprefered_lft = ci->ifa_prefered; | 778 | *pprefered_lft = ci->ifa_prefered; |
@@ -780,6 +780,8 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh, | |||
780 | 780 | ||
781 | return ifa; | 781 | return ifa; |
782 | 782 | ||
783 | errout_free: | ||
784 | inet_free_ifa(ifa); | ||
783 | errout: | 785 | errout: |
784 | return ERR_PTR(err); | 786 | return ERR_PTR(err); |
785 | } | 787 | } |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 49616fed9340..108a1e9c9eac 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -2133,7 +2133,7 @@ static void trie_show_stats(struct seq_file *seq, struct trie_stat *stat) | |||
2133 | max--; | 2133 | max--; |
2134 | 2134 | ||
2135 | pointers = 0; | 2135 | pointers = 0; |
2136 | for (i = 1; i <= max; i++) | 2136 | for (i = 1; i < max; i++) |
2137 | if (stat->nodesizes[i] != 0) { | 2137 | if (stat->nodesizes[i] != 0) { |
2138 | seq_printf(seq, " %u: %u", i, stat->nodesizes[i]); | 2138 | seq_printf(seq, " %u: %u", i, stat->nodesizes[i]); |
2139 | pointers += (1<<i) * stat->nodesizes[i]; | 2139 | pointers += (1<<i) * stat->nodesizes[i]; |
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index b2c123c44d69..610e324348d1 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
@@ -36,6 +36,8 @@ static int tcp_adv_win_scale_min = -31; | |||
36 | static int tcp_adv_win_scale_max = 31; | 36 | static int tcp_adv_win_scale_max = 31; |
37 | static int ip_ttl_min = 1; | 37 | static int ip_ttl_min = 1; |
38 | static int ip_ttl_max = 255; | 38 | static int ip_ttl_max = 255; |
39 | static int tcp_syn_retries_min = 1; | ||
40 | static int tcp_syn_retries_max = MAX_TCP_SYNCNT; | ||
39 | static int ip_ping_group_range_min[] = { 0, 0 }; | 41 | static int ip_ping_group_range_min[] = { 0, 0 }; |
40 | static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; | 42 | static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; |
41 | 43 | ||
@@ -332,7 +334,9 @@ static struct ctl_table ipv4_table[] = { | |||
332 | .data = &sysctl_tcp_syn_retries, | 334 | .data = &sysctl_tcp_syn_retries, |
333 | .maxlen = sizeof(int), | 335 | .maxlen = sizeof(int), |
334 | .mode = 0644, | 336 | .mode = 0644, |
335 | .proc_handler = proc_dointvec | 337 | .proc_handler = proc_dointvec_minmax, |
338 | .extra1 = &tcp_syn_retries_min, | ||
339 | .extra2 = &tcp_syn_retries_max | ||
336 | }, | 340 | }, |
337 | { | 341 | { |
338 | .procname = "tcp_synack_retries", | 342 | .procname = "tcp_synack_retries", |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index cfdcf7b2daf6..da4241c8c7da 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -813,8 +813,9 @@ static u32 inet6_addr_hash(const struct in6_addr *addr) | |||
813 | /* On success it returns ifp with increased reference count */ | 813 | /* On success it returns ifp with increased reference count */ |
814 | 814 | ||
815 | static struct inet6_ifaddr * | 815 | static struct inet6_ifaddr * |
816 | ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, | 816 | ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, |
817 | int scope, u32 flags) | 817 | const struct in6_addr *peer_addr, int pfxlen, |
818 | int scope, u32 flags, u32 valid_lft, u32 prefered_lft) | ||
818 | { | 819 | { |
819 | struct inet6_ifaddr *ifa = NULL; | 820 | struct inet6_ifaddr *ifa = NULL; |
820 | struct rt6_info *rt; | 821 | struct rt6_info *rt; |
@@ -863,6 +864,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, | |||
863 | } | 864 | } |
864 | 865 | ||
865 | ifa->addr = *addr; | 866 | ifa->addr = *addr; |
867 | if (peer_addr) | ||
868 | ifa->peer_addr = *peer_addr; | ||
866 | 869 | ||
867 | spin_lock_init(&ifa->lock); | 870 | spin_lock_init(&ifa->lock); |
868 | spin_lock_init(&ifa->state_lock); | 871 | spin_lock_init(&ifa->state_lock); |
@@ -872,6 +875,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, | |||
872 | ifa->scope = scope; | 875 | ifa->scope = scope; |
873 | ifa->prefix_len = pfxlen; | 876 | ifa->prefix_len = pfxlen; |
874 | ifa->flags = flags | IFA_F_TENTATIVE; | 877 | ifa->flags = flags | IFA_F_TENTATIVE; |
878 | ifa->valid_lft = valid_lft; | ||
879 | ifa->prefered_lft = prefered_lft; | ||
875 | ifa->cstamp = ifa->tstamp = jiffies; | 880 | ifa->cstamp = ifa->tstamp = jiffies; |
876 | ifa->tokenized = false; | 881 | ifa->tokenized = false; |
877 | 882 | ||
@@ -1123,8 +1128,9 @@ retry: | |||
1123 | 1128 | ||
1124 | ift = !max_addresses || | 1129 | ift = !max_addresses || |
1125 | ipv6_count_addresses(idev) < max_addresses ? | 1130 | ipv6_count_addresses(idev) < max_addresses ? |
1126 | ipv6_add_addr(idev, &addr, tmp_plen, ipv6_addr_scope(&addr), | 1131 | ipv6_add_addr(idev, &addr, NULL, tmp_plen, |
1127 | addr_flags) : NULL; | 1132 | ipv6_addr_scope(&addr), addr_flags, |
1133 | tmp_valid_lft, tmp_prefered_lft) : NULL; | ||
1128 | if (IS_ERR_OR_NULL(ift)) { | 1134 | if (IS_ERR_OR_NULL(ift)) { |
1129 | in6_ifa_put(ifp); | 1135 | in6_ifa_put(ifp); |
1130 | in6_dev_put(idev); | 1136 | in6_dev_put(idev); |
@@ -1136,8 +1142,6 @@ retry: | |||
1136 | 1142 | ||
1137 | spin_lock_bh(&ift->lock); | 1143 | spin_lock_bh(&ift->lock); |
1138 | ift->ifpub = ifp; | 1144 | ift->ifpub = ifp; |
1139 | ift->valid_lft = tmp_valid_lft; | ||
1140 | ift->prefered_lft = tmp_prefered_lft; | ||
1141 | ift->cstamp = now; | 1145 | ift->cstamp = now; |
1142 | ift->tstamp = tmp_tstamp; | 1146 | ift->tstamp = tmp_tstamp; |
1143 | spin_unlock_bh(&ift->lock); | 1147 | spin_unlock_bh(&ift->lock); |
@@ -2179,16 +2183,19 @@ ok: | |||
2179 | */ | 2183 | */ |
2180 | if (!max_addresses || | 2184 | if (!max_addresses || |
2181 | ipv6_count_addresses(in6_dev) < max_addresses) | 2185 | ipv6_count_addresses(in6_dev) < max_addresses) |
2182 | ifp = ipv6_add_addr(in6_dev, &addr, pinfo->prefix_len, | 2186 | ifp = ipv6_add_addr(in6_dev, &addr, NULL, |
2187 | pinfo->prefix_len, | ||
2183 | addr_type&IPV6_ADDR_SCOPE_MASK, | 2188 | addr_type&IPV6_ADDR_SCOPE_MASK, |
2184 | addr_flags); | 2189 | addr_flags, valid_lft, |
2190 | prefered_lft); | ||
2185 | 2191 | ||
2186 | if (IS_ERR_OR_NULL(ifp)) { | 2192 | if (IS_ERR_OR_NULL(ifp)) { |
2187 | in6_dev_put(in6_dev); | 2193 | in6_dev_put(in6_dev); |
2188 | return; | 2194 | return; |
2189 | } | 2195 | } |
2190 | 2196 | ||
2191 | update_lft = create = 1; | 2197 | update_lft = 0; |
2198 | create = 1; | ||
2192 | ifp->cstamp = jiffies; | 2199 | ifp->cstamp = jiffies; |
2193 | ifp->tokenized = tokenized; | 2200 | ifp->tokenized = tokenized; |
2194 | addrconf_dad_start(ifp); | 2201 | addrconf_dad_start(ifp); |
@@ -2209,7 +2216,7 @@ ok: | |||
2209 | stored_lft = ifp->valid_lft - (now - ifp->tstamp) / HZ; | 2216 | stored_lft = ifp->valid_lft - (now - ifp->tstamp) / HZ; |
2210 | else | 2217 | else |
2211 | stored_lft = 0; | 2218 | stored_lft = 0; |
2212 | if (!update_lft && stored_lft) { | 2219 | if (!update_lft && !create && stored_lft) { |
2213 | if (valid_lft > MIN_VALID_LIFETIME || | 2220 | if (valid_lft > MIN_VALID_LIFETIME || |
2214 | valid_lft > stored_lft) | 2221 | valid_lft > stored_lft) |
2215 | update_lft = 1; | 2222 | update_lft = 1; |
@@ -2455,17 +2462,10 @@ static int inet6_addr_add(struct net *net, int ifindex, const struct in6_addr *p | |||
2455 | prefered_lft = timeout; | 2462 | prefered_lft = timeout; |
2456 | } | 2463 | } |
2457 | 2464 | ||
2458 | ifp = ipv6_add_addr(idev, pfx, plen, scope, ifa_flags); | 2465 | ifp = ipv6_add_addr(idev, pfx, peer_pfx, plen, scope, ifa_flags, |
2466 | valid_lft, prefered_lft); | ||
2459 | 2467 | ||
2460 | if (!IS_ERR(ifp)) { | 2468 | if (!IS_ERR(ifp)) { |
2461 | spin_lock_bh(&ifp->lock); | ||
2462 | ifp->valid_lft = valid_lft; | ||
2463 | ifp->prefered_lft = prefered_lft; | ||
2464 | ifp->tstamp = jiffies; | ||
2465 | if (peer_pfx) | ||
2466 | ifp->peer_addr = *peer_pfx; | ||
2467 | spin_unlock_bh(&ifp->lock); | ||
2468 | |||
2469 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, | 2469 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, |
2470 | expires, flags); | 2470 | expires, flags); |
2471 | /* | 2471 | /* |
@@ -2557,7 +2557,8 @@ static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr, | |||
2557 | { | 2557 | { |
2558 | struct inet6_ifaddr *ifp; | 2558 | struct inet6_ifaddr *ifp; |
2559 | 2559 | ||
2560 | ifp = ipv6_add_addr(idev, addr, plen, scope, IFA_F_PERMANENT); | 2560 | ifp = ipv6_add_addr(idev, addr, NULL, plen, |
2561 | scope, IFA_F_PERMANENT, 0, 0); | ||
2561 | if (!IS_ERR(ifp)) { | 2562 | if (!IS_ERR(ifp)) { |
2562 | spin_lock_bh(&ifp->lock); | 2563 | spin_lock_bh(&ifp->lock); |
2563 | ifp->flags &= ~IFA_F_TENTATIVE; | 2564 | ifp->flags &= ~IFA_F_TENTATIVE; |
@@ -2683,7 +2684,7 @@ static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr | |||
2683 | #endif | 2684 | #endif |
2684 | 2685 | ||
2685 | 2686 | ||
2686 | ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, addr_flags); | 2687 | ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags, 0, 0); |
2687 | if (!IS_ERR(ifp)) { | 2688 | if (!IS_ERR(ifp)) { |
2688 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0); | 2689 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0); |
2689 | addrconf_dad_start(ifp); | 2690 | addrconf_dad_start(ifp); |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 5fc9c7a68d8d..bff3d821c7eb 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -1632,27 +1632,28 @@ static int fib6_age(struct rt6_info *rt, void *arg) | |||
1632 | 1632 | ||
1633 | static DEFINE_SPINLOCK(fib6_gc_lock); | 1633 | static DEFINE_SPINLOCK(fib6_gc_lock); |
1634 | 1634 | ||
1635 | void fib6_run_gc(unsigned long expires, struct net *net) | 1635 | void fib6_run_gc(unsigned long expires, struct net *net, bool force) |
1636 | { | 1636 | { |
1637 | if (expires != ~0UL) { | 1637 | unsigned long now; |
1638 | |||
1639 | if (force) { | ||
1638 | spin_lock_bh(&fib6_gc_lock); | 1640 | spin_lock_bh(&fib6_gc_lock); |
1639 | gc_args.timeout = expires ? (int)expires : | 1641 | } else if (!spin_trylock_bh(&fib6_gc_lock)) { |
1640 | net->ipv6.sysctl.ip6_rt_gc_interval; | 1642 | mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); |
1641 | } else { | 1643 | return; |
1642 | if (!spin_trylock_bh(&fib6_gc_lock)) { | ||
1643 | mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); | ||
1644 | return; | ||
1645 | } | ||
1646 | gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval; | ||
1647 | } | 1644 | } |
1645 | gc_args.timeout = expires ? (int)expires : | ||
1646 | net->ipv6.sysctl.ip6_rt_gc_interval; | ||
1648 | 1647 | ||
1649 | gc_args.more = icmp6_dst_gc(); | 1648 | gc_args.more = icmp6_dst_gc(); |
1650 | 1649 | ||
1651 | fib6_clean_all(net, fib6_age, 0, NULL); | 1650 | fib6_clean_all(net, fib6_age, 0, NULL); |
1651 | now = jiffies; | ||
1652 | net->ipv6.ip6_rt_last_gc = now; | ||
1652 | 1653 | ||
1653 | if (gc_args.more) | 1654 | if (gc_args.more) |
1654 | mod_timer(&net->ipv6.ip6_fib_timer, | 1655 | mod_timer(&net->ipv6.ip6_fib_timer, |
1655 | round_jiffies(jiffies | 1656 | round_jiffies(now |
1656 | + net->ipv6.sysctl.ip6_rt_gc_interval)); | 1657 | + net->ipv6.sysctl.ip6_rt_gc_interval)); |
1657 | else | 1658 | else |
1658 | del_timer(&net->ipv6.ip6_fib_timer); | 1659 | del_timer(&net->ipv6.ip6_fib_timer); |
@@ -1661,7 +1662,7 @@ void fib6_run_gc(unsigned long expires, struct net *net) | |||
1661 | 1662 | ||
1662 | static void fib6_gc_timer_cb(unsigned long arg) | 1663 | static void fib6_gc_timer_cb(unsigned long arg) |
1663 | { | 1664 | { |
1664 | fib6_run_gc(0, (struct net *)arg); | 1665 | fib6_run_gc(0, (struct net *)arg, true); |
1665 | } | 1666 | } |
1666 | 1667 | ||
1667 | static int __net_init fib6_net_init(struct net *net) | 1668 | static int __net_init fib6_net_init(struct net *net) |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 583e8d435f9a..03986d31fa41 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -259,10 +259,12 @@ static void __net_exit ip6mr_rules_exit(struct net *net) | |||
259 | { | 259 | { |
260 | struct mr6_table *mrt, *next; | 260 | struct mr6_table *mrt, *next; |
261 | 261 | ||
262 | rtnl_lock(); | ||
262 | list_for_each_entry_safe(mrt, next, &net->ipv6.mr6_tables, list) { | 263 | list_for_each_entry_safe(mrt, next, &net->ipv6.mr6_tables, list) { |
263 | list_del(&mrt->list); | 264 | list_del(&mrt->list); |
264 | ip6mr_free_table(mrt); | 265 | ip6mr_free_table(mrt); |
265 | } | 266 | } |
267 | rtnl_unlock(); | ||
266 | fib_rules_unregister(net->ipv6.mr6_rules_ops); | 268 | fib_rules_unregister(net->ipv6.mr6_rules_ops); |
267 | } | 269 | } |
268 | #else | 270 | #else |
@@ -289,7 +291,10 @@ static int __net_init ip6mr_rules_init(struct net *net) | |||
289 | 291 | ||
290 | static void __net_exit ip6mr_rules_exit(struct net *net) | 292 | static void __net_exit ip6mr_rules_exit(struct net *net) |
291 | { | 293 | { |
294 | rtnl_lock(); | ||
292 | ip6mr_free_table(net->ipv6.mrt6); | 295 | ip6mr_free_table(net->ipv6.mrt6); |
296 | net->ipv6.mrt6 = NULL; | ||
297 | rtnl_unlock(); | ||
293 | } | 298 | } |
294 | #endif | 299 | #endif |
295 | 300 | ||
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 24c03396e008..79aa9652ed86 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1576,7 +1576,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, | |||
1576 | switch (event) { | 1576 | switch (event) { |
1577 | case NETDEV_CHANGEADDR: | 1577 | case NETDEV_CHANGEADDR: |
1578 | neigh_changeaddr(&nd_tbl, dev); | 1578 | neigh_changeaddr(&nd_tbl, dev); |
1579 | fib6_run_gc(~0UL, net); | 1579 | fib6_run_gc(0, net, false); |
1580 | idev = in6_dev_get(dev); | 1580 | idev = in6_dev_get(dev); |
1581 | if (!idev) | 1581 | if (!idev) |
1582 | break; | 1582 | break; |
@@ -1586,7 +1586,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, | |||
1586 | break; | 1586 | break; |
1587 | case NETDEV_DOWN: | 1587 | case NETDEV_DOWN: |
1588 | neigh_ifdown(&nd_tbl, dev); | 1588 | neigh_ifdown(&nd_tbl, dev); |
1589 | fib6_run_gc(~0UL, net); | 1589 | fib6_run_gc(0, net, false); |
1590 | break; | 1590 | break; |
1591 | case NETDEV_NOTIFY_PEERS: | 1591 | case NETDEV_NOTIFY_PEERS: |
1592 | ndisc_send_unsol_na(dev); | 1592 | ndisc_send_unsol_na(dev); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index a8c891aa2464..b70f8979003b 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1311,7 +1311,6 @@ static void icmp6_clean_all(int (*func)(struct rt6_info *rt, void *arg), | |||
1311 | 1311 | ||
1312 | static int ip6_dst_gc(struct dst_ops *ops) | 1312 | static int ip6_dst_gc(struct dst_ops *ops) |
1313 | { | 1313 | { |
1314 | unsigned long now = jiffies; | ||
1315 | struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); | 1314 | struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); |
1316 | int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; | 1315 | int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; |
1317 | int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; | 1316 | int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; |
@@ -1321,13 +1320,12 @@ static int ip6_dst_gc(struct dst_ops *ops) | |||
1321 | int entries; | 1320 | int entries; |
1322 | 1321 | ||
1323 | entries = dst_entries_get_fast(ops); | 1322 | entries = dst_entries_get_fast(ops); |
1324 | if (time_after(rt_last_gc + rt_min_interval, now) && | 1323 | if (time_after(rt_last_gc + rt_min_interval, jiffies) && |
1325 | entries <= rt_max_size) | 1324 | entries <= rt_max_size) |
1326 | goto out; | 1325 | goto out; |
1327 | 1326 | ||
1328 | net->ipv6.ip6_rt_gc_expire++; | 1327 | net->ipv6.ip6_rt_gc_expire++; |
1329 | fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net); | 1328 | fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, entries > rt_max_size); |
1330 | net->ipv6.ip6_rt_last_gc = now; | ||
1331 | entries = dst_entries_get_slow(ops); | 1329 | entries = dst_entries_get_slow(ops); |
1332 | if (entries < ops->gc_thresh) | 1330 | if (entries < ops->gc_thresh) |
1333 | net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1; | 1331 | net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1; |
@@ -2827,7 +2825,7 @@ int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write, | |||
2827 | net = (struct net *)ctl->extra1; | 2825 | net = (struct net *)ctl->extra1; |
2828 | delay = net->ipv6.sysctl.flush_delay; | 2826 | delay = net->ipv6.sysctl.flush_delay; |
2829 | proc_dointvec(ctl, write, buffer, lenp, ppos); | 2827 | proc_dointvec(ctl, write, buffer, lenp, ppos); |
2830 | fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net); | 2828 | fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0); |
2831 | return 0; | 2829 | return 0; |
2832 | } | 2830 | } |
2833 | 2831 | ||
diff --git a/net/key/af_key.c b/net/key/af_key.c index 9da862070dd8..ab8bd2cabfa0 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -2081,6 +2081,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * | |||
2081 | pol->sadb_x_policy_type = IPSEC_POLICY_NONE; | 2081 | pol->sadb_x_policy_type = IPSEC_POLICY_NONE; |
2082 | } | 2082 | } |
2083 | pol->sadb_x_policy_dir = dir+1; | 2083 | pol->sadb_x_policy_dir = dir+1; |
2084 | pol->sadb_x_policy_reserved = 0; | ||
2084 | pol->sadb_x_policy_id = xp->index; | 2085 | pol->sadb_x_policy_id = xp->index; |
2085 | pol->sadb_x_policy_priority = xp->priority; | 2086 | pol->sadb_x_policy_priority = xp->priority; |
2086 | 2087 | ||
@@ -3137,7 +3138,9 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct | |||
3137 | pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; | 3138 | pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; |
3138 | pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; | 3139 | pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; |
3139 | pol->sadb_x_policy_dir = XFRM_POLICY_OUT + 1; | 3140 | pol->sadb_x_policy_dir = XFRM_POLICY_OUT + 1; |
3141 | pol->sadb_x_policy_reserved = 0; | ||
3140 | pol->sadb_x_policy_id = xp->index; | 3142 | pol->sadb_x_policy_id = xp->index; |
3143 | pol->sadb_x_policy_priority = xp->priority; | ||
3141 | 3144 | ||
3142 | /* Set sadb_comb's. */ | 3145 | /* Set sadb_comb's. */ |
3143 | if (x->id.proto == IPPROTO_AH) | 3146 | if (x->id.proto == IPPROTO_AH) |
@@ -3525,6 +3528,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, | |||
3525 | pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; | 3528 | pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; |
3526 | pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; | 3529 | pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; |
3527 | pol->sadb_x_policy_dir = dir + 1; | 3530 | pol->sadb_x_policy_dir = dir + 1; |
3531 | pol->sadb_x_policy_reserved = 0; | ||
3528 | pol->sadb_x_policy_id = 0; | 3532 | pol->sadb_x_policy_id = 0; |
3529 | pol->sadb_x_policy_priority = 0; | 3533 | pol->sadb_x_policy_priority = 0; |
3530 | 3534 | ||
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 8184d121ff09..43dd7525bfcb 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -666,6 +666,8 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy, | |||
666 | if (sta->sdata->dev != dev) | 666 | if (sta->sdata->dev != dev) |
667 | continue; | 667 | continue; |
668 | 668 | ||
669 | sinfo.filled = 0; | ||
670 | sta_set_sinfo(sta, &sinfo); | ||
669 | i = 0; | 671 | i = 0; |
670 | ADD_STA_STATS(sta); | 672 | ADD_STA_STATS(sta); |
671 | } | 673 | } |
diff --git a/net/mac80211/mesh_ps.c b/net/mac80211/mesh_ps.c index 3b7bfc01ee36..22290a929b94 100644 --- a/net/mac80211/mesh_ps.c +++ b/net/mac80211/mesh_ps.c | |||
@@ -229,6 +229,10 @@ void ieee80211_mps_sta_status_update(struct sta_info *sta) | |||
229 | enum nl80211_mesh_power_mode pm; | 229 | enum nl80211_mesh_power_mode pm; |
230 | bool do_buffer; | 230 | bool do_buffer; |
231 | 231 | ||
232 | /* For non-assoc STA, prevent buffering or frame transmission */ | ||
233 | if (sta->sta_state < IEEE80211_STA_ASSOC) | ||
234 | return; | ||
235 | |||
232 | /* | 236 | /* |
233 | * use peer-specific power mode if peering is established and the | 237 | * use peer-specific power mode if peering is established and the |
234 | * peer's power mode is known | 238 | * peer's power mode is known |
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c index 7fc5d0d8149a..340126204343 100644 --- a/net/mac80211/pm.c +++ b/net/mac80211/pm.c | |||
@@ -99,10 +99,13 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) | |||
99 | } | 99 | } |
100 | mutex_unlock(&local->sta_mtx); | 100 | mutex_unlock(&local->sta_mtx); |
101 | 101 | ||
102 | /* remove all interfaces */ | 102 | /* remove all interfaces that were created in the driver */ |
103 | list_for_each_entry(sdata, &local->interfaces, list) { | 103 | list_for_each_entry(sdata, &local->interfaces, list) { |
104 | if (!ieee80211_sdata_running(sdata)) | 104 | if (!ieee80211_sdata_running(sdata) || |
105 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN || | ||
106 | sdata->vif.type == NL80211_IFTYPE_MONITOR) | ||
105 | continue; | 107 | continue; |
108 | |||
106 | drv_remove_interface(local, sdata); | 109 | drv_remove_interface(local, sdata); |
107 | } | 110 | } |
108 | 111 | ||
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index ac7ef5414bde..e6512e2ffd20 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c | |||
@@ -290,7 +290,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta, | |||
290 | struct minstrel_rate *msr, *mr; | 290 | struct minstrel_rate *msr, *mr; |
291 | unsigned int ndx; | 291 | unsigned int ndx; |
292 | bool mrr_capable; | 292 | bool mrr_capable; |
293 | bool prev_sample = mi->prev_sample; | 293 | bool prev_sample; |
294 | int delta; | 294 | int delta; |
295 | int sampling_ratio; | 295 | int sampling_ratio; |
296 | 296 | ||
@@ -314,6 +314,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta, | |||
314 | (mi->sample_count + mi->sample_deferred / 2); | 314 | (mi->sample_count + mi->sample_deferred / 2); |
315 | 315 | ||
316 | /* delta < 0: no sampling required */ | 316 | /* delta < 0: no sampling required */ |
317 | prev_sample = mi->prev_sample; | ||
317 | mi->prev_sample = false; | 318 | mi->prev_sample = false; |
318 | if (delta < 0 || (!mrr_capable && prev_sample)) | 319 | if (delta < 0 || (!mrr_capable && prev_sample)) |
319 | return; | 320 | return; |
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 5b2d3012b983..f5aed963b22e 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c | |||
@@ -804,10 +804,18 @@ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, | |||
804 | 804 | ||
805 | sample_group = &minstrel_mcs_groups[sample_idx / MCS_GROUP_RATES]; | 805 | sample_group = &minstrel_mcs_groups[sample_idx / MCS_GROUP_RATES]; |
806 | info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; | 806 | info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; |
807 | rate->count = 1; | ||
808 | |||
809 | if (sample_idx / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) { | ||
810 | int idx = sample_idx % ARRAY_SIZE(mp->cck_rates); | ||
811 | rate->idx = mp->cck_rates[idx]; | ||
812 | rate->flags = 0; | ||
813 | return; | ||
814 | } | ||
815 | |||
807 | rate->idx = sample_idx % MCS_GROUP_RATES + | 816 | rate->idx = sample_idx % MCS_GROUP_RATES + |
808 | (sample_group->streams - 1) * MCS_GROUP_RATES; | 817 | (sample_group->streams - 1) * MCS_GROUP_RATES; |
809 | rate->flags = IEEE80211_TX_RC_MCS | sample_group->flags; | 818 | rate->flags = IEEE80211_TX_RC_MCS | sample_group->flags; |
810 | rate->count = 1; | ||
811 | } | 819 | } |
812 | 820 | ||
813 | static void | 821 | static void |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 23dbcfc69b3b..2c5a79bd3777 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -936,8 +936,14 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx) | |||
936 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; | 936 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; |
937 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); | 937 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); |
938 | 938 | ||
939 | /* Drop duplicate 802.11 retransmissions (IEEE 802.11 Chap. 9.2.9) */ | 939 | /* |
940 | if (rx->sta && !is_multicast_ether_addr(hdr->addr1)) { | 940 | * Drop duplicate 802.11 retransmissions |
941 | * (IEEE 802.11-2012: 9.3.2.10 "Duplicate detection and recovery") | ||
942 | */ | ||
943 | if (rx->skb->len >= 24 && rx->sta && | ||
944 | !ieee80211_is_ctl(hdr->frame_control) && | ||
945 | !ieee80211_is_qos_nullfunc(hdr->frame_control) && | ||
946 | !is_multicast_ether_addr(hdr->addr1)) { | ||
941 | if (unlikely(ieee80211_has_retry(hdr->frame_control) && | 947 | if (unlikely(ieee80211_has_retry(hdr->frame_control) && |
942 | rx->sta->last_seq_ctrl[rx->seqno_idx] == | 948 | rx->sta->last_seq_ctrl[rx->seqno_idx] == |
943 | hdr->seq_ctrl)) { | 949 | hdr->seq_ctrl)) { |
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c index c63b618cd619..4fd1ca94fd4a 100644 --- a/net/netfilter/nf_conntrack_expect.c +++ b/net/netfilter/nf_conntrack_expect.c | |||
@@ -293,6 +293,11 @@ void nf_ct_expect_init(struct nf_conntrack_expect *exp, unsigned int class, | |||
293 | sizeof(exp->tuple.dst.u3) - len); | 293 | sizeof(exp->tuple.dst.u3) - len); |
294 | 294 | ||
295 | exp->tuple.dst.u.all = *dst; | 295 | exp->tuple.dst.u.all = *dst; |
296 | |||
297 | #ifdef CONFIG_NF_NAT_NEEDED | ||
298 | memset(&exp->saved_addr, 0, sizeof(exp->saved_addr)); | ||
299 | memset(&exp->saved_proto, 0, sizeof(exp->saved_proto)); | ||
300 | #endif | ||
296 | } | 301 | } |
297 | EXPORT_SYMBOL_GPL(nf_ct_expect_init); | 302 | EXPORT_SYMBOL_GPL(nf_ct_expect_init); |
298 | 303 | ||
diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c index f8b71911037a..20b15916f403 100644 --- a/net/netfilter/xt_socket.c +++ b/net/netfilter/xt_socket.c | |||
@@ -172,7 +172,7 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par, | |||
172 | 172 | ||
173 | /* Ignore non-transparent sockets, | 173 | /* Ignore non-transparent sockets, |
174 | if XT_SOCKET_TRANSPARENT is used */ | 174 | if XT_SOCKET_TRANSPARENT is used */ |
175 | if (info && info->flags & XT_SOCKET_TRANSPARENT) | 175 | if (info->flags & XT_SOCKET_TRANSPARENT) |
176 | transparent = ((sk->sk_state != TCP_TIME_WAIT && | 176 | transparent = ((sk->sk_state != TCP_TIME_WAIT && |
177 | inet_sk(sk)->transparent) || | 177 | inet_sk(sk)->transparent) || |
178 | (sk->sk_state == TCP_TIME_WAIT && | 178 | (sk->sk_state == TCP_TIME_WAIT && |
@@ -196,7 +196,11 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par, | |||
196 | static bool | 196 | static bool |
197 | socket_mt4_v0(const struct sk_buff *skb, struct xt_action_param *par) | 197 | socket_mt4_v0(const struct sk_buff *skb, struct xt_action_param *par) |
198 | { | 198 | { |
199 | return socket_match(skb, par, NULL); | 199 | static struct xt_socket_mtinfo1 xt_info_v0 = { |
200 | .flags = 0, | ||
201 | }; | ||
202 | |||
203 | return socket_match(skb, par, &xt_info_v0); | ||
200 | } | 204 | } |
201 | 205 | ||
202 | static bool | 206 | static bool |
@@ -314,7 +318,7 @@ socket_mt6_v1_v2(const struct sk_buff *skb, struct xt_action_param *par) | |||
314 | 318 | ||
315 | /* Ignore non-transparent sockets, | 319 | /* Ignore non-transparent sockets, |
316 | if XT_SOCKET_TRANSPARENT is used */ | 320 | if XT_SOCKET_TRANSPARENT is used */ |
317 | if (info && info->flags & XT_SOCKET_TRANSPARENT) | 321 | if (info->flags & XT_SOCKET_TRANSPARENT) |
318 | transparent = ((sk->sk_state != TCP_TIME_WAIT && | 322 | transparent = ((sk->sk_state != TCP_TIME_WAIT && |
319 | inet_sk(sk)->transparent) || | 323 | inet_sk(sk)->transparent) || |
320 | (sk->sk_state == TCP_TIME_WAIT && | 324 | (sk->sk_state == TCP_TIME_WAIT && |
diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c index c15042f987bd..a1100640495d 100644 --- a/net/netlabel/netlabel_cipso_v4.c +++ b/net/netlabel/netlabel_cipso_v4.c | |||
@@ -691,8 +691,8 @@ static int netlbl_cipsov4_remove_cb(struct netlbl_dom_map *entry, void *arg) | |||
691 | { | 691 | { |
692 | struct netlbl_domhsh_walk_arg *cb_arg = arg; | 692 | struct netlbl_domhsh_walk_arg *cb_arg = arg; |
693 | 693 | ||
694 | if (entry->type == NETLBL_NLTYPE_CIPSOV4 && | 694 | if (entry->def.type == NETLBL_NLTYPE_CIPSOV4 && |
695 | entry->type_def.cipsov4->doi == cb_arg->doi) | 695 | entry->def.cipso->doi == cb_arg->doi) |
696 | return netlbl_domhsh_remove_entry(entry, cb_arg->audit_info); | 696 | return netlbl_domhsh_remove_entry(entry, cb_arg->audit_info); |
697 | 697 | ||
698 | return 0; | 698 | return 0; |
diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c index 6bb1d42f0fac..85d842e6e431 100644 --- a/net/netlabel/netlabel_domainhash.c +++ b/net/netlabel/netlabel_domainhash.c | |||
@@ -84,15 +84,15 @@ static void netlbl_domhsh_free_entry(struct rcu_head *entry) | |||
84 | #endif /* IPv6 */ | 84 | #endif /* IPv6 */ |
85 | 85 | ||
86 | ptr = container_of(entry, struct netlbl_dom_map, rcu); | 86 | ptr = container_of(entry, struct netlbl_dom_map, rcu); |
87 | if (ptr->type == NETLBL_NLTYPE_ADDRSELECT) { | 87 | if (ptr->def.type == NETLBL_NLTYPE_ADDRSELECT) { |
88 | netlbl_af4list_foreach_safe(iter4, tmp4, | 88 | netlbl_af4list_foreach_safe(iter4, tmp4, |
89 | &ptr->type_def.addrsel->list4) { | 89 | &ptr->def.addrsel->list4) { |
90 | netlbl_af4list_remove_entry(iter4); | 90 | netlbl_af4list_remove_entry(iter4); |
91 | kfree(netlbl_domhsh_addr4_entry(iter4)); | 91 | kfree(netlbl_domhsh_addr4_entry(iter4)); |
92 | } | 92 | } |
93 | #if IS_ENABLED(CONFIG_IPV6) | 93 | #if IS_ENABLED(CONFIG_IPV6) |
94 | netlbl_af6list_foreach_safe(iter6, tmp6, | 94 | netlbl_af6list_foreach_safe(iter6, tmp6, |
95 | &ptr->type_def.addrsel->list6) { | 95 | &ptr->def.addrsel->list6) { |
96 | netlbl_af6list_remove_entry(iter6); | 96 | netlbl_af6list_remove_entry(iter6); |
97 | kfree(netlbl_domhsh_addr6_entry(iter6)); | 97 | kfree(netlbl_domhsh_addr6_entry(iter6)); |
98 | } | 98 | } |
@@ -213,21 +213,21 @@ static void netlbl_domhsh_audit_add(struct netlbl_dom_map *entry, | |||
213 | if (addr4 != NULL) { | 213 | if (addr4 != NULL) { |
214 | struct netlbl_domaddr4_map *map4; | 214 | struct netlbl_domaddr4_map *map4; |
215 | map4 = netlbl_domhsh_addr4_entry(addr4); | 215 | map4 = netlbl_domhsh_addr4_entry(addr4); |
216 | type = map4->type; | 216 | type = map4->def.type; |
217 | cipsov4 = map4->type_def.cipsov4; | 217 | cipsov4 = map4->def.cipso; |
218 | netlbl_af4list_audit_addr(audit_buf, 0, NULL, | 218 | netlbl_af4list_audit_addr(audit_buf, 0, NULL, |
219 | addr4->addr, addr4->mask); | 219 | addr4->addr, addr4->mask); |
220 | #if IS_ENABLED(CONFIG_IPV6) | 220 | #if IS_ENABLED(CONFIG_IPV6) |
221 | } else if (addr6 != NULL) { | 221 | } else if (addr6 != NULL) { |
222 | struct netlbl_domaddr6_map *map6; | 222 | struct netlbl_domaddr6_map *map6; |
223 | map6 = netlbl_domhsh_addr6_entry(addr6); | 223 | map6 = netlbl_domhsh_addr6_entry(addr6); |
224 | type = map6->type; | 224 | type = map6->def.type; |
225 | netlbl_af6list_audit_addr(audit_buf, 0, NULL, | 225 | netlbl_af6list_audit_addr(audit_buf, 0, NULL, |
226 | &addr6->addr, &addr6->mask); | 226 | &addr6->addr, &addr6->mask); |
227 | #endif /* IPv6 */ | 227 | #endif /* IPv6 */ |
228 | } else { | 228 | } else { |
229 | type = entry->type; | 229 | type = entry->def.type; |
230 | cipsov4 = entry->type_def.cipsov4; | 230 | cipsov4 = entry->def.cipso; |
231 | } | 231 | } |
232 | switch (type) { | 232 | switch (type) { |
233 | case NETLBL_NLTYPE_UNLABELED: | 233 | case NETLBL_NLTYPE_UNLABELED: |
@@ -265,26 +265,25 @@ static int netlbl_domhsh_validate(const struct netlbl_dom_map *entry) | |||
265 | if (entry == NULL) | 265 | if (entry == NULL) |
266 | return -EINVAL; | 266 | return -EINVAL; |
267 | 267 | ||
268 | switch (entry->type) { | 268 | switch (entry->def.type) { |
269 | case NETLBL_NLTYPE_UNLABELED: | 269 | case NETLBL_NLTYPE_UNLABELED: |
270 | if (entry->type_def.cipsov4 != NULL || | 270 | if (entry->def.cipso != NULL || entry->def.addrsel != NULL) |
271 | entry->type_def.addrsel != NULL) | ||
272 | return -EINVAL; | 271 | return -EINVAL; |
273 | break; | 272 | break; |
274 | case NETLBL_NLTYPE_CIPSOV4: | 273 | case NETLBL_NLTYPE_CIPSOV4: |
275 | if (entry->type_def.cipsov4 == NULL) | 274 | if (entry->def.cipso == NULL) |
276 | return -EINVAL; | 275 | return -EINVAL; |
277 | break; | 276 | break; |
278 | case NETLBL_NLTYPE_ADDRSELECT: | 277 | case NETLBL_NLTYPE_ADDRSELECT: |
279 | netlbl_af4list_foreach(iter4, &entry->type_def.addrsel->list4) { | 278 | netlbl_af4list_foreach(iter4, &entry->def.addrsel->list4) { |
280 | map4 = netlbl_domhsh_addr4_entry(iter4); | 279 | map4 = netlbl_domhsh_addr4_entry(iter4); |
281 | switch (map4->type) { | 280 | switch (map4->def.type) { |
282 | case NETLBL_NLTYPE_UNLABELED: | 281 | case NETLBL_NLTYPE_UNLABELED: |
283 | if (map4->type_def.cipsov4 != NULL) | 282 | if (map4->def.cipso != NULL) |
284 | return -EINVAL; | 283 | return -EINVAL; |
285 | break; | 284 | break; |
286 | case NETLBL_NLTYPE_CIPSOV4: | 285 | case NETLBL_NLTYPE_CIPSOV4: |
287 | if (map4->type_def.cipsov4 == NULL) | 286 | if (map4->def.cipso == NULL) |
288 | return -EINVAL; | 287 | return -EINVAL; |
289 | break; | 288 | break; |
290 | default: | 289 | default: |
@@ -292,9 +291,9 @@ static int netlbl_domhsh_validate(const struct netlbl_dom_map *entry) | |||
292 | } | 291 | } |
293 | } | 292 | } |
294 | #if IS_ENABLED(CONFIG_IPV6) | 293 | #if IS_ENABLED(CONFIG_IPV6) |
295 | netlbl_af6list_foreach(iter6, &entry->type_def.addrsel->list6) { | 294 | netlbl_af6list_foreach(iter6, &entry->def.addrsel->list6) { |
296 | map6 = netlbl_domhsh_addr6_entry(iter6); | 295 | map6 = netlbl_domhsh_addr6_entry(iter6); |
297 | switch (map6->type) { | 296 | switch (map6->def.type) { |
298 | case NETLBL_NLTYPE_UNLABELED: | 297 | case NETLBL_NLTYPE_UNLABELED: |
299 | break; | 298 | break; |
300 | default: | 299 | default: |
@@ -402,32 +401,31 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, | |||
402 | rcu_assign_pointer(netlbl_domhsh_def, entry); | 401 | rcu_assign_pointer(netlbl_domhsh_def, entry); |
403 | } | 402 | } |
404 | 403 | ||
405 | if (entry->type == NETLBL_NLTYPE_ADDRSELECT) { | 404 | if (entry->def.type == NETLBL_NLTYPE_ADDRSELECT) { |
406 | netlbl_af4list_foreach_rcu(iter4, | 405 | netlbl_af4list_foreach_rcu(iter4, |
407 | &entry->type_def.addrsel->list4) | 406 | &entry->def.addrsel->list4) |
408 | netlbl_domhsh_audit_add(entry, iter4, NULL, | 407 | netlbl_domhsh_audit_add(entry, iter4, NULL, |
409 | ret_val, audit_info); | 408 | ret_val, audit_info); |
410 | #if IS_ENABLED(CONFIG_IPV6) | 409 | #if IS_ENABLED(CONFIG_IPV6) |
411 | netlbl_af6list_foreach_rcu(iter6, | 410 | netlbl_af6list_foreach_rcu(iter6, |
412 | &entry->type_def.addrsel->list6) | 411 | &entry->def.addrsel->list6) |
413 | netlbl_domhsh_audit_add(entry, NULL, iter6, | 412 | netlbl_domhsh_audit_add(entry, NULL, iter6, |
414 | ret_val, audit_info); | 413 | ret_val, audit_info); |
415 | #endif /* IPv6 */ | 414 | #endif /* IPv6 */ |
416 | } else | 415 | } else |
417 | netlbl_domhsh_audit_add(entry, NULL, NULL, | 416 | netlbl_domhsh_audit_add(entry, NULL, NULL, |
418 | ret_val, audit_info); | 417 | ret_val, audit_info); |
419 | } else if (entry_old->type == NETLBL_NLTYPE_ADDRSELECT && | 418 | } else if (entry_old->def.type == NETLBL_NLTYPE_ADDRSELECT && |
420 | entry->type == NETLBL_NLTYPE_ADDRSELECT) { | 419 | entry->def.type == NETLBL_NLTYPE_ADDRSELECT) { |
421 | struct list_head *old_list4; | 420 | struct list_head *old_list4; |
422 | struct list_head *old_list6; | 421 | struct list_head *old_list6; |
423 | 422 | ||
424 | old_list4 = &entry_old->type_def.addrsel->list4; | 423 | old_list4 = &entry_old->def.addrsel->list4; |
425 | old_list6 = &entry_old->type_def.addrsel->list6; | 424 | old_list6 = &entry_old->def.addrsel->list6; |
426 | 425 | ||
427 | /* we only allow the addition of address selectors if all of | 426 | /* we only allow the addition of address selectors if all of |
428 | * the selectors do not exist in the existing domain map */ | 427 | * the selectors do not exist in the existing domain map */ |
429 | netlbl_af4list_foreach_rcu(iter4, | 428 | netlbl_af4list_foreach_rcu(iter4, &entry->def.addrsel->list4) |
430 | &entry->type_def.addrsel->list4) | ||
431 | if (netlbl_af4list_search_exact(iter4->addr, | 429 | if (netlbl_af4list_search_exact(iter4->addr, |
432 | iter4->mask, | 430 | iter4->mask, |
433 | old_list4)) { | 431 | old_list4)) { |
@@ -435,8 +433,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, | |||
435 | goto add_return; | 433 | goto add_return; |
436 | } | 434 | } |
437 | #if IS_ENABLED(CONFIG_IPV6) | 435 | #if IS_ENABLED(CONFIG_IPV6) |
438 | netlbl_af6list_foreach_rcu(iter6, | 436 | netlbl_af6list_foreach_rcu(iter6, &entry->def.addrsel->list6) |
439 | &entry->type_def.addrsel->list6) | ||
440 | if (netlbl_af6list_search_exact(&iter6->addr, | 437 | if (netlbl_af6list_search_exact(&iter6->addr, |
441 | &iter6->mask, | 438 | &iter6->mask, |
442 | old_list6)) { | 439 | old_list6)) { |
@@ -446,7 +443,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, | |||
446 | #endif /* IPv6 */ | 443 | #endif /* IPv6 */ |
447 | 444 | ||
448 | netlbl_af4list_foreach_safe(iter4, tmp4, | 445 | netlbl_af4list_foreach_safe(iter4, tmp4, |
449 | &entry->type_def.addrsel->list4) { | 446 | &entry->def.addrsel->list4) { |
450 | netlbl_af4list_remove_entry(iter4); | 447 | netlbl_af4list_remove_entry(iter4); |
451 | iter4->valid = 1; | 448 | iter4->valid = 1; |
452 | ret_val = netlbl_af4list_add(iter4, old_list4); | 449 | ret_val = netlbl_af4list_add(iter4, old_list4); |
@@ -457,7 +454,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, | |||
457 | } | 454 | } |
458 | #if IS_ENABLED(CONFIG_IPV6) | 455 | #if IS_ENABLED(CONFIG_IPV6) |
459 | netlbl_af6list_foreach_safe(iter6, tmp6, | 456 | netlbl_af6list_foreach_safe(iter6, tmp6, |
460 | &entry->type_def.addrsel->list6) { | 457 | &entry->def.addrsel->list6) { |
461 | netlbl_af6list_remove_entry(iter6); | 458 | netlbl_af6list_remove_entry(iter6); |
462 | iter6->valid = 1; | 459 | iter6->valid = 1; |
463 | ret_val = netlbl_af6list_add(iter6, old_list6); | 460 | ret_val = netlbl_af6list_add(iter6, old_list6); |
@@ -538,18 +535,18 @@ int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry, | |||
538 | struct netlbl_af4list *iter4; | 535 | struct netlbl_af4list *iter4; |
539 | struct netlbl_domaddr4_map *map4; | 536 | struct netlbl_domaddr4_map *map4; |
540 | 537 | ||
541 | switch (entry->type) { | 538 | switch (entry->def.type) { |
542 | case NETLBL_NLTYPE_ADDRSELECT: | 539 | case NETLBL_NLTYPE_ADDRSELECT: |
543 | netlbl_af4list_foreach_rcu(iter4, | 540 | netlbl_af4list_foreach_rcu(iter4, |
544 | &entry->type_def.addrsel->list4) { | 541 | &entry->def.addrsel->list4) { |
545 | map4 = netlbl_domhsh_addr4_entry(iter4); | 542 | map4 = netlbl_domhsh_addr4_entry(iter4); |
546 | cipso_v4_doi_putdef(map4->type_def.cipsov4); | 543 | cipso_v4_doi_putdef(map4->def.cipso); |
547 | } | 544 | } |
548 | /* no need to check the IPv6 list since we currently | 545 | /* no need to check the IPv6 list since we currently |
549 | * support only unlabeled protocols for IPv6 */ | 546 | * support only unlabeled protocols for IPv6 */ |
550 | break; | 547 | break; |
551 | case NETLBL_NLTYPE_CIPSOV4: | 548 | case NETLBL_NLTYPE_CIPSOV4: |
552 | cipso_v4_doi_putdef(entry->type_def.cipsov4); | 549 | cipso_v4_doi_putdef(entry->def.cipso); |
553 | break; | 550 | break; |
554 | } | 551 | } |
555 | call_rcu(&entry->rcu, netlbl_domhsh_free_entry); | 552 | call_rcu(&entry->rcu, netlbl_domhsh_free_entry); |
@@ -590,20 +587,21 @@ int netlbl_domhsh_remove_af4(const char *domain, | |||
590 | entry_map = netlbl_domhsh_search(domain); | 587 | entry_map = netlbl_domhsh_search(domain); |
591 | else | 588 | else |
592 | entry_map = netlbl_domhsh_search_def(domain); | 589 | entry_map = netlbl_domhsh_search_def(domain); |
593 | if (entry_map == NULL || entry_map->type != NETLBL_NLTYPE_ADDRSELECT) | 590 | if (entry_map == NULL || |
591 | entry_map->def.type != NETLBL_NLTYPE_ADDRSELECT) | ||
594 | goto remove_af4_failure; | 592 | goto remove_af4_failure; |
595 | 593 | ||
596 | spin_lock(&netlbl_domhsh_lock); | 594 | spin_lock(&netlbl_domhsh_lock); |
597 | entry_addr = netlbl_af4list_remove(addr->s_addr, mask->s_addr, | 595 | entry_addr = netlbl_af4list_remove(addr->s_addr, mask->s_addr, |
598 | &entry_map->type_def.addrsel->list4); | 596 | &entry_map->def.addrsel->list4); |
599 | spin_unlock(&netlbl_domhsh_lock); | 597 | spin_unlock(&netlbl_domhsh_lock); |
600 | 598 | ||
601 | if (entry_addr == NULL) | 599 | if (entry_addr == NULL) |
602 | goto remove_af4_failure; | 600 | goto remove_af4_failure; |
603 | netlbl_af4list_foreach_rcu(iter4, &entry_map->type_def.addrsel->list4) | 601 | netlbl_af4list_foreach_rcu(iter4, &entry_map->def.addrsel->list4) |
604 | goto remove_af4_single_addr; | 602 | goto remove_af4_single_addr; |
605 | #if IS_ENABLED(CONFIG_IPV6) | 603 | #if IS_ENABLED(CONFIG_IPV6) |
606 | netlbl_af6list_foreach_rcu(iter6, &entry_map->type_def.addrsel->list6) | 604 | netlbl_af6list_foreach_rcu(iter6, &entry_map->def.addrsel->list6) |
607 | goto remove_af4_single_addr; | 605 | goto remove_af4_single_addr; |
608 | #endif /* IPv6 */ | 606 | #endif /* IPv6 */ |
609 | /* the domain mapping is empty so remove it from the mapping table */ | 607 | /* the domain mapping is empty so remove it from the mapping table */ |
@@ -616,7 +614,7 @@ remove_af4_single_addr: | |||
616 | * shouldn't be a problem */ | 614 | * shouldn't be a problem */ |
617 | synchronize_rcu(); | 615 | synchronize_rcu(); |
618 | entry = netlbl_domhsh_addr4_entry(entry_addr); | 616 | entry = netlbl_domhsh_addr4_entry(entry_addr); |
619 | cipso_v4_doi_putdef(entry->type_def.cipsov4); | 617 | cipso_v4_doi_putdef(entry->def.cipso); |
620 | kfree(entry); | 618 | kfree(entry); |
621 | return 0; | 619 | return 0; |
622 | 620 | ||
@@ -693,8 +691,8 @@ struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain) | |||
693 | * responsible for ensuring that rcu_read_[un]lock() is called. | 691 | * responsible for ensuring that rcu_read_[un]lock() is called. |
694 | * | 692 | * |
695 | */ | 693 | */ |
696 | struct netlbl_domaddr4_map *netlbl_domhsh_getentry_af4(const char *domain, | 694 | struct netlbl_dommap_def *netlbl_domhsh_getentry_af4(const char *domain, |
697 | __be32 addr) | 695 | __be32 addr) |
698 | { | 696 | { |
699 | struct netlbl_dom_map *dom_iter; | 697 | struct netlbl_dom_map *dom_iter; |
700 | struct netlbl_af4list *addr_iter; | 698 | struct netlbl_af4list *addr_iter; |
@@ -702,15 +700,13 @@ struct netlbl_domaddr4_map *netlbl_domhsh_getentry_af4(const char *domain, | |||
702 | dom_iter = netlbl_domhsh_search_def(domain); | 700 | dom_iter = netlbl_domhsh_search_def(domain); |
703 | if (dom_iter == NULL) | 701 | if (dom_iter == NULL) |
704 | return NULL; | 702 | return NULL; |
705 | if (dom_iter->type != NETLBL_NLTYPE_ADDRSELECT) | ||
706 | return NULL; | ||
707 | 703 | ||
708 | addr_iter = netlbl_af4list_search(addr, | 704 | if (dom_iter->def.type != NETLBL_NLTYPE_ADDRSELECT) |
709 | &dom_iter->type_def.addrsel->list4); | 705 | return &dom_iter->def; |
706 | addr_iter = netlbl_af4list_search(addr, &dom_iter->def.addrsel->list4); | ||
710 | if (addr_iter == NULL) | 707 | if (addr_iter == NULL) |
711 | return NULL; | 708 | return NULL; |
712 | 709 | return &(netlbl_domhsh_addr4_entry(addr_iter)->def); | |
713 | return netlbl_domhsh_addr4_entry(addr_iter); | ||
714 | } | 710 | } |
715 | 711 | ||
716 | #if IS_ENABLED(CONFIG_IPV6) | 712 | #if IS_ENABLED(CONFIG_IPV6) |
@@ -725,7 +721,7 @@ struct netlbl_domaddr4_map *netlbl_domhsh_getentry_af4(const char *domain, | |||
725 | * responsible for ensuring that rcu_read_[un]lock() is called. | 721 | * responsible for ensuring that rcu_read_[un]lock() is called. |
726 | * | 722 | * |
727 | */ | 723 | */ |
728 | struct netlbl_domaddr6_map *netlbl_domhsh_getentry_af6(const char *domain, | 724 | struct netlbl_dommap_def *netlbl_domhsh_getentry_af6(const char *domain, |
729 | const struct in6_addr *addr) | 725 | const struct in6_addr *addr) |
730 | { | 726 | { |
731 | struct netlbl_dom_map *dom_iter; | 727 | struct netlbl_dom_map *dom_iter; |
@@ -734,15 +730,13 @@ struct netlbl_domaddr6_map *netlbl_domhsh_getentry_af6(const char *domain, | |||
734 | dom_iter = netlbl_domhsh_search_def(domain); | 730 | dom_iter = netlbl_domhsh_search_def(domain); |
735 | if (dom_iter == NULL) | 731 | if (dom_iter == NULL) |
736 | return NULL; | 732 | return NULL; |
737 | if (dom_iter->type != NETLBL_NLTYPE_ADDRSELECT) | ||
738 | return NULL; | ||
739 | 733 | ||
740 | addr_iter = netlbl_af6list_search(addr, | 734 | if (dom_iter->def.type != NETLBL_NLTYPE_ADDRSELECT) |
741 | &dom_iter->type_def.addrsel->list6); | 735 | return &dom_iter->def; |
736 | addr_iter = netlbl_af6list_search(addr, &dom_iter->def.addrsel->list6); | ||
742 | if (addr_iter == NULL) | 737 | if (addr_iter == NULL) |
743 | return NULL; | 738 | return NULL; |
744 | 739 | return &(netlbl_domhsh_addr6_entry(addr_iter)->def); | |
745 | return netlbl_domhsh_addr6_entry(addr_iter); | ||
746 | } | 740 | } |
747 | #endif /* IPv6 */ | 741 | #endif /* IPv6 */ |
748 | 742 | ||
diff --git a/net/netlabel/netlabel_domainhash.h b/net/netlabel/netlabel_domainhash.h index 90872c4ca30f..b9be0eed8980 100644 --- a/net/netlabel/netlabel_domainhash.h +++ b/net/netlabel/netlabel_domainhash.h | |||
@@ -43,37 +43,35 @@ | |||
43 | #define NETLBL_DOMHSH_BITSIZE 7 | 43 | #define NETLBL_DOMHSH_BITSIZE 7 |
44 | 44 | ||
45 | /* Domain mapping definition structures */ | 45 | /* Domain mapping definition structures */ |
46 | struct netlbl_domaddr_map { | ||
47 | struct list_head list4; | ||
48 | struct list_head list6; | ||
49 | }; | ||
50 | struct netlbl_dommap_def { | ||
51 | u32 type; | ||
52 | union { | ||
53 | struct netlbl_domaddr_map *addrsel; | ||
54 | struct cipso_v4_doi *cipso; | ||
55 | }; | ||
56 | }; | ||
46 | #define netlbl_domhsh_addr4_entry(iter) \ | 57 | #define netlbl_domhsh_addr4_entry(iter) \ |
47 | container_of(iter, struct netlbl_domaddr4_map, list) | 58 | container_of(iter, struct netlbl_domaddr4_map, list) |
48 | struct netlbl_domaddr4_map { | 59 | struct netlbl_domaddr4_map { |
49 | u32 type; | 60 | struct netlbl_dommap_def def; |
50 | union { | ||
51 | struct cipso_v4_doi *cipsov4; | ||
52 | } type_def; | ||
53 | 61 | ||
54 | struct netlbl_af4list list; | 62 | struct netlbl_af4list list; |
55 | }; | 63 | }; |
56 | #define netlbl_domhsh_addr6_entry(iter) \ | 64 | #define netlbl_domhsh_addr6_entry(iter) \ |
57 | container_of(iter, struct netlbl_domaddr6_map, list) | 65 | container_of(iter, struct netlbl_domaddr6_map, list) |
58 | struct netlbl_domaddr6_map { | 66 | struct netlbl_domaddr6_map { |
59 | u32 type; | 67 | struct netlbl_dommap_def def; |
60 | |||
61 | /* NOTE: no 'type_def' union needed at present since we don't currently | ||
62 | * support any IPv6 labeling protocols */ | ||
63 | 68 | ||
64 | struct netlbl_af6list list; | 69 | struct netlbl_af6list list; |
65 | }; | 70 | }; |
66 | struct netlbl_domaddr_map { | 71 | |
67 | struct list_head list4; | ||
68 | struct list_head list6; | ||
69 | }; | ||
70 | struct netlbl_dom_map { | 72 | struct netlbl_dom_map { |
71 | char *domain; | 73 | char *domain; |
72 | u32 type; | 74 | struct netlbl_dommap_def def; |
73 | union { | ||
74 | struct cipso_v4_doi *cipsov4; | ||
75 | struct netlbl_domaddr_map *addrsel; | ||
76 | } type_def; | ||
77 | 75 | ||
78 | u32 valid; | 76 | u32 valid; |
79 | struct list_head list; | 77 | struct list_head list; |
@@ -97,16 +95,16 @@ int netlbl_domhsh_remove_af4(const char *domain, | |||
97 | int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info); | 95 | int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info); |
98 | int netlbl_domhsh_remove_default(struct netlbl_audit *audit_info); | 96 | int netlbl_domhsh_remove_default(struct netlbl_audit *audit_info); |
99 | struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain); | 97 | struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain); |
100 | struct netlbl_domaddr4_map *netlbl_domhsh_getentry_af4(const char *domain, | 98 | struct netlbl_dommap_def *netlbl_domhsh_getentry_af4(const char *domain, |
101 | __be32 addr); | 99 | __be32 addr); |
100 | #if IS_ENABLED(CONFIG_IPV6) | ||
101 | struct netlbl_dommap_def *netlbl_domhsh_getentry_af6(const char *domain, | ||
102 | const struct in6_addr *addr); | ||
103 | #endif /* IPv6 */ | ||
104 | |||
102 | int netlbl_domhsh_walk(u32 *skip_bkt, | 105 | int netlbl_domhsh_walk(u32 *skip_bkt, |
103 | u32 *skip_chain, | 106 | u32 *skip_chain, |
104 | int (*callback) (struct netlbl_dom_map *entry, void *arg), | 107 | int (*callback) (struct netlbl_dom_map *entry, void *arg), |
105 | void *cb_arg); | 108 | void *cb_arg); |
106 | 109 | ||
107 | #if IS_ENABLED(CONFIG_IPV6) | ||
108 | struct netlbl_domaddr6_map *netlbl_domhsh_getentry_af6(const char *domain, | ||
109 | const struct in6_addr *addr); | ||
110 | #endif /* IPv6 */ | ||
111 | |||
112 | #endif | 110 | #endif |
diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c index 7c94aedd0912..96a458e12f60 100644 --- a/net/netlabel/netlabel_kapi.c +++ b/net/netlabel/netlabel_kapi.c | |||
@@ -122,7 +122,7 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
122 | } | 122 | } |
123 | 123 | ||
124 | if (addr == NULL && mask == NULL) | 124 | if (addr == NULL && mask == NULL) |
125 | entry->type = NETLBL_NLTYPE_UNLABELED; | 125 | entry->def.type = NETLBL_NLTYPE_UNLABELED; |
126 | else if (addr != NULL && mask != NULL) { | 126 | else if (addr != NULL && mask != NULL) { |
127 | addrmap = kzalloc(sizeof(*addrmap), GFP_ATOMIC); | 127 | addrmap = kzalloc(sizeof(*addrmap), GFP_ATOMIC); |
128 | if (addrmap == NULL) | 128 | if (addrmap == NULL) |
@@ -137,7 +137,7 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
137 | map4 = kzalloc(sizeof(*map4), GFP_ATOMIC); | 137 | map4 = kzalloc(sizeof(*map4), GFP_ATOMIC); |
138 | if (map4 == NULL) | 138 | if (map4 == NULL) |
139 | goto cfg_unlbl_map_add_failure; | 139 | goto cfg_unlbl_map_add_failure; |
140 | map4->type = NETLBL_NLTYPE_UNLABELED; | 140 | map4->def.type = NETLBL_NLTYPE_UNLABELED; |
141 | map4->list.addr = addr4->s_addr & mask4->s_addr; | 141 | map4->list.addr = addr4->s_addr & mask4->s_addr; |
142 | map4->list.mask = mask4->s_addr; | 142 | map4->list.mask = mask4->s_addr; |
143 | map4->list.valid = 1; | 143 | map4->list.valid = 1; |
@@ -154,7 +154,7 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
154 | map6 = kzalloc(sizeof(*map6), GFP_ATOMIC); | 154 | map6 = kzalloc(sizeof(*map6), GFP_ATOMIC); |
155 | if (map6 == NULL) | 155 | if (map6 == NULL) |
156 | goto cfg_unlbl_map_add_failure; | 156 | goto cfg_unlbl_map_add_failure; |
157 | map6->type = NETLBL_NLTYPE_UNLABELED; | 157 | map6->def.type = NETLBL_NLTYPE_UNLABELED; |
158 | map6->list.addr = *addr6; | 158 | map6->list.addr = *addr6; |
159 | map6->list.addr.s6_addr32[0] &= mask6->s6_addr32[0]; | 159 | map6->list.addr.s6_addr32[0] &= mask6->s6_addr32[0]; |
160 | map6->list.addr.s6_addr32[1] &= mask6->s6_addr32[1]; | 160 | map6->list.addr.s6_addr32[1] &= mask6->s6_addr32[1]; |
@@ -174,8 +174,8 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
174 | break; | 174 | break; |
175 | } | 175 | } |
176 | 176 | ||
177 | entry->type_def.addrsel = addrmap; | 177 | entry->def.addrsel = addrmap; |
178 | entry->type = NETLBL_NLTYPE_ADDRSELECT; | 178 | entry->def.type = NETLBL_NLTYPE_ADDRSELECT; |
179 | } else { | 179 | } else { |
180 | ret_val = -EINVAL; | 180 | ret_val = -EINVAL; |
181 | goto cfg_unlbl_map_add_failure; | 181 | goto cfg_unlbl_map_add_failure; |
@@ -355,8 +355,8 @@ int netlbl_cfg_cipsov4_map_add(u32 doi, | |||
355 | } | 355 | } |
356 | 356 | ||
357 | if (addr == NULL && mask == NULL) { | 357 | if (addr == NULL && mask == NULL) { |
358 | entry->type_def.cipsov4 = doi_def; | 358 | entry->def.cipso = doi_def; |
359 | entry->type = NETLBL_NLTYPE_CIPSOV4; | 359 | entry->def.type = NETLBL_NLTYPE_CIPSOV4; |
360 | } else if (addr != NULL && mask != NULL) { | 360 | } else if (addr != NULL && mask != NULL) { |
361 | addrmap = kzalloc(sizeof(*addrmap), GFP_ATOMIC); | 361 | addrmap = kzalloc(sizeof(*addrmap), GFP_ATOMIC); |
362 | if (addrmap == NULL) | 362 | if (addrmap == NULL) |
@@ -367,8 +367,8 @@ int netlbl_cfg_cipsov4_map_add(u32 doi, | |||
367 | addrinfo = kzalloc(sizeof(*addrinfo), GFP_ATOMIC); | 367 | addrinfo = kzalloc(sizeof(*addrinfo), GFP_ATOMIC); |
368 | if (addrinfo == NULL) | 368 | if (addrinfo == NULL) |
369 | goto out_addrinfo; | 369 | goto out_addrinfo; |
370 | addrinfo->type_def.cipsov4 = doi_def; | 370 | addrinfo->def.cipso = doi_def; |
371 | addrinfo->type = NETLBL_NLTYPE_CIPSOV4; | 371 | addrinfo->def.type = NETLBL_NLTYPE_CIPSOV4; |
372 | addrinfo->list.addr = addr->s_addr & mask->s_addr; | 372 | addrinfo->list.addr = addr->s_addr & mask->s_addr; |
373 | addrinfo->list.mask = mask->s_addr; | 373 | addrinfo->list.mask = mask->s_addr; |
374 | addrinfo->list.valid = 1; | 374 | addrinfo->list.valid = 1; |
@@ -376,8 +376,8 @@ int netlbl_cfg_cipsov4_map_add(u32 doi, | |||
376 | if (ret_val != 0) | 376 | if (ret_val != 0) |
377 | goto cfg_cipsov4_map_add_failure; | 377 | goto cfg_cipsov4_map_add_failure; |
378 | 378 | ||
379 | entry->type_def.addrsel = addrmap; | 379 | entry->def.addrsel = addrmap; |
380 | entry->type = NETLBL_NLTYPE_ADDRSELECT; | 380 | entry->def.type = NETLBL_NLTYPE_ADDRSELECT; |
381 | } else { | 381 | } else { |
382 | ret_val = -EINVAL; | 382 | ret_val = -EINVAL; |
383 | goto out_addrmap; | 383 | goto out_addrmap; |
@@ -657,14 +657,14 @@ int netlbl_sock_setattr(struct sock *sk, | |||
657 | } | 657 | } |
658 | switch (family) { | 658 | switch (family) { |
659 | case AF_INET: | 659 | case AF_INET: |
660 | switch (dom_entry->type) { | 660 | switch (dom_entry->def.type) { |
661 | case NETLBL_NLTYPE_ADDRSELECT: | 661 | case NETLBL_NLTYPE_ADDRSELECT: |
662 | ret_val = -EDESTADDRREQ; | 662 | ret_val = -EDESTADDRREQ; |
663 | break; | 663 | break; |
664 | case NETLBL_NLTYPE_CIPSOV4: | 664 | case NETLBL_NLTYPE_CIPSOV4: |
665 | ret_val = cipso_v4_sock_setattr(sk, | 665 | ret_val = cipso_v4_sock_setattr(sk, |
666 | dom_entry->type_def.cipsov4, | 666 | dom_entry->def.cipso, |
667 | secattr); | 667 | secattr); |
668 | break; | 668 | break; |
669 | case NETLBL_NLTYPE_UNLABELED: | 669 | case NETLBL_NLTYPE_UNLABELED: |
670 | ret_val = 0; | 670 | ret_val = 0; |
@@ -754,23 +754,22 @@ int netlbl_conn_setattr(struct sock *sk, | |||
754 | { | 754 | { |
755 | int ret_val; | 755 | int ret_val; |
756 | struct sockaddr_in *addr4; | 756 | struct sockaddr_in *addr4; |
757 | struct netlbl_domaddr4_map *af4_entry; | 757 | struct netlbl_dommap_def *entry; |
758 | 758 | ||
759 | rcu_read_lock(); | 759 | rcu_read_lock(); |
760 | switch (addr->sa_family) { | 760 | switch (addr->sa_family) { |
761 | case AF_INET: | 761 | case AF_INET: |
762 | addr4 = (struct sockaddr_in *)addr; | 762 | addr4 = (struct sockaddr_in *)addr; |
763 | af4_entry = netlbl_domhsh_getentry_af4(secattr->domain, | 763 | entry = netlbl_domhsh_getentry_af4(secattr->domain, |
764 | addr4->sin_addr.s_addr); | 764 | addr4->sin_addr.s_addr); |
765 | if (af4_entry == NULL) { | 765 | if (entry == NULL) { |
766 | ret_val = -ENOENT; | 766 | ret_val = -ENOENT; |
767 | goto conn_setattr_return; | 767 | goto conn_setattr_return; |
768 | } | 768 | } |
769 | switch (af4_entry->type) { | 769 | switch (entry->type) { |
770 | case NETLBL_NLTYPE_CIPSOV4: | 770 | case NETLBL_NLTYPE_CIPSOV4: |
771 | ret_val = cipso_v4_sock_setattr(sk, | 771 | ret_val = cipso_v4_sock_setattr(sk, |
772 | af4_entry->type_def.cipsov4, | 772 | entry->cipso, secattr); |
773 | secattr); | ||
774 | break; | 773 | break; |
775 | case NETLBL_NLTYPE_UNLABELED: | 774 | case NETLBL_NLTYPE_UNLABELED: |
776 | /* just delete the protocols we support for right now | 775 | /* just delete the protocols we support for right now |
@@ -812,36 +811,21 @@ int netlbl_req_setattr(struct request_sock *req, | |||
812 | const struct netlbl_lsm_secattr *secattr) | 811 | const struct netlbl_lsm_secattr *secattr) |
813 | { | 812 | { |
814 | int ret_val; | 813 | int ret_val; |
815 | struct netlbl_dom_map *dom_entry; | 814 | struct netlbl_dommap_def *entry; |
816 | struct netlbl_domaddr4_map *af4_entry; | ||
817 | u32 proto_type; | ||
818 | struct cipso_v4_doi *proto_cv4; | ||
819 | 815 | ||
820 | rcu_read_lock(); | 816 | rcu_read_lock(); |
821 | dom_entry = netlbl_domhsh_getentry(secattr->domain); | ||
822 | if (dom_entry == NULL) { | ||
823 | ret_val = -ENOENT; | ||
824 | goto req_setattr_return; | ||
825 | } | ||
826 | switch (req->rsk_ops->family) { | 817 | switch (req->rsk_ops->family) { |
827 | case AF_INET: | 818 | case AF_INET: |
828 | if (dom_entry->type == NETLBL_NLTYPE_ADDRSELECT) { | 819 | entry = netlbl_domhsh_getentry_af4(secattr->domain, |
829 | struct inet_request_sock *req_inet = inet_rsk(req); | 820 | inet_rsk(req)->rmt_addr); |
830 | af4_entry = netlbl_domhsh_getentry_af4(secattr->domain, | 821 | if (entry == NULL) { |
831 | req_inet->rmt_addr); | 822 | ret_val = -ENOENT; |
832 | if (af4_entry == NULL) { | 823 | goto req_setattr_return; |
833 | ret_val = -ENOENT; | ||
834 | goto req_setattr_return; | ||
835 | } | ||
836 | proto_type = af4_entry->type; | ||
837 | proto_cv4 = af4_entry->type_def.cipsov4; | ||
838 | } else { | ||
839 | proto_type = dom_entry->type; | ||
840 | proto_cv4 = dom_entry->type_def.cipsov4; | ||
841 | } | 824 | } |
842 | switch (proto_type) { | 825 | switch (entry->type) { |
843 | case NETLBL_NLTYPE_CIPSOV4: | 826 | case NETLBL_NLTYPE_CIPSOV4: |
844 | ret_val = cipso_v4_req_setattr(req, proto_cv4, secattr); | 827 | ret_val = cipso_v4_req_setattr(req, |
828 | entry->cipso, secattr); | ||
845 | break; | 829 | break; |
846 | case NETLBL_NLTYPE_UNLABELED: | 830 | case NETLBL_NLTYPE_UNLABELED: |
847 | /* just delete the protocols we support for right now | 831 | /* just delete the protocols we support for right now |
@@ -899,23 +883,21 @@ int netlbl_skbuff_setattr(struct sk_buff *skb, | |||
899 | { | 883 | { |
900 | int ret_val; | 884 | int ret_val; |
901 | struct iphdr *hdr4; | 885 | struct iphdr *hdr4; |
902 | struct netlbl_domaddr4_map *af4_entry; | 886 | struct netlbl_dommap_def *entry; |
903 | 887 | ||
904 | rcu_read_lock(); | 888 | rcu_read_lock(); |
905 | switch (family) { | 889 | switch (family) { |
906 | case AF_INET: | 890 | case AF_INET: |
907 | hdr4 = ip_hdr(skb); | 891 | hdr4 = ip_hdr(skb); |
908 | af4_entry = netlbl_domhsh_getentry_af4(secattr->domain, | 892 | entry = netlbl_domhsh_getentry_af4(secattr->domain,hdr4->daddr); |
909 | hdr4->daddr); | 893 | if (entry == NULL) { |
910 | if (af4_entry == NULL) { | ||
911 | ret_val = -ENOENT; | 894 | ret_val = -ENOENT; |
912 | goto skbuff_setattr_return; | 895 | goto skbuff_setattr_return; |
913 | } | 896 | } |
914 | switch (af4_entry->type) { | 897 | switch (entry->type) { |
915 | case NETLBL_NLTYPE_CIPSOV4: | 898 | case NETLBL_NLTYPE_CIPSOV4: |
916 | ret_val = cipso_v4_skbuff_setattr(skb, | 899 | ret_val = cipso_v4_skbuff_setattr(skb, entry->cipso, |
917 | af4_entry->type_def.cipsov4, | 900 | secattr); |
918 | secattr); | ||
919 | break; | 901 | break; |
920 | case NETLBL_NLTYPE_UNLABELED: | 902 | case NETLBL_NLTYPE_UNLABELED: |
921 | /* just delete the protocols we support for right now | 903 | /* just delete the protocols we support for right now |
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c index c5384ffc6146..dd1c37d7acbc 100644 --- a/net/netlabel/netlabel_mgmt.c +++ b/net/netlabel/netlabel_mgmt.c | |||
@@ -104,7 +104,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, | |||
104 | ret_val = -ENOMEM; | 104 | ret_val = -ENOMEM; |
105 | goto add_failure; | 105 | goto add_failure; |
106 | } | 106 | } |
107 | entry->type = nla_get_u32(info->attrs[NLBL_MGMT_A_PROTOCOL]); | 107 | entry->def.type = nla_get_u32(info->attrs[NLBL_MGMT_A_PROTOCOL]); |
108 | if (info->attrs[NLBL_MGMT_A_DOMAIN]) { | 108 | if (info->attrs[NLBL_MGMT_A_DOMAIN]) { |
109 | size_t tmp_size = nla_len(info->attrs[NLBL_MGMT_A_DOMAIN]); | 109 | size_t tmp_size = nla_len(info->attrs[NLBL_MGMT_A_DOMAIN]); |
110 | entry->domain = kmalloc(tmp_size, GFP_KERNEL); | 110 | entry->domain = kmalloc(tmp_size, GFP_KERNEL); |
@@ -116,12 +116,12 @@ static int netlbl_mgmt_add_common(struct genl_info *info, | |||
116 | info->attrs[NLBL_MGMT_A_DOMAIN], tmp_size); | 116 | info->attrs[NLBL_MGMT_A_DOMAIN], tmp_size); |
117 | } | 117 | } |
118 | 118 | ||
119 | /* NOTE: internally we allow/use a entry->type value of | 119 | /* NOTE: internally we allow/use a entry->def.type value of |
120 | * NETLBL_NLTYPE_ADDRSELECT but we don't currently allow users | 120 | * NETLBL_NLTYPE_ADDRSELECT but we don't currently allow users |
121 | * to pass that as a protocol value because we need to know the | 121 | * to pass that as a protocol value because we need to know the |
122 | * "real" protocol */ | 122 | * "real" protocol */ |
123 | 123 | ||
124 | switch (entry->type) { | 124 | switch (entry->def.type) { |
125 | case NETLBL_NLTYPE_UNLABELED: | 125 | case NETLBL_NLTYPE_UNLABELED: |
126 | break; | 126 | break; |
127 | case NETLBL_NLTYPE_CIPSOV4: | 127 | case NETLBL_NLTYPE_CIPSOV4: |
@@ -132,7 +132,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, | |||
132 | cipsov4 = cipso_v4_doi_getdef(tmp_val); | 132 | cipsov4 = cipso_v4_doi_getdef(tmp_val); |
133 | if (cipsov4 == NULL) | 133 | if (cipsov4 == NULL) |
134 | goto add_failure; | 134 | goto add_failure; |
135 | entry->type_def.cipsov4 = cipsov4; | 135 | entry->def.cipso = cipsov4; |
136 | break; | 136 | break; |
137 | default: | 137 | default: |
138 | goto add_failure; | 138 | goto add_failure; |
@@ -172,9 +172,9 @@ static int netlbl_mgmt_add_common(struct genl_info *info, | |||
172 | map->list.addr = addr->s_addr & mask->s_addr; | 172 | map->list.addr = addr->s_addr & mask->s_addr; |
173 | map->list.mask = mask->s_addr; | 173 | map->list.mask = mask->s_addr; |
174 | map->list.valid = 1; | 174 | map->list.valid = 1; |
175 | map->type = entry->type; | 175 | map->def.type = entry->def.type; |
176 | if (cipsov4) | 176 | if (cipsov4) |
177 | map->type_def.cipsov4 = cipsov4; | 177 | map->def.cipso = cipsov4; |
178 | 178 | ||
179 | ret_val = netlbl_af4list_add(&map->list, &addrmap->list4); | 179 | ret_val = netlbl_af4list_add(&map->list, &addrmap->list4); |
180 | if (ret_val != 0) { | 180 | if (ret_val != 0) { |
@@ -182,8 +182,8 @@ static int netlbl_mgmt_add_common(struct genl_info *info, | |||
182 | goto add_failure; | 182 | goto add_failure; |
183 | } | 183 | } |
184 | 184 | ||
185 | entry->type = NETLBL_NLTYPE_ADDRSELECT; | 185 | entry->def.type = NETLBL_NLTYPE_ADDRSELECT; |
186 | entry->type_def.addrsel = addrmap; | 186 | entry->def.addrsel = addrmap; |
187 | #if IS_ENABLED(CONFIG_IPV6) | 187 | #if IS_ENABLED(CONFIG_IPV6) |
188 | } else if (info->attrs[NLBL_MGMT_A_IPV6ADDR]) { | 188 | } else if (info->attrs[NLBL_MGMT_A_IPV6ADDR]) { |
189 | struct in6_addr *addr; | 189 | struct in6_addr *addr; |
@@ -223,7 +223,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, | |||
223 | map->list.addr.s6_addr32[3] &= mask->s6_addr32[3]; | 223 | map->list.addr.s6_addr32[3] &= mask->s6_addr32[3]; |
224 | map->list.mask = *mask; | 224 | map->list.mask = *mask; |
225 | map->list.valid = 1; | 225 | map->list.valid = 1; |
226 | map->type = entry->type; | 226 | map->def.type = entry->def.type; |
227 | 227 | ||
228 | ret_val = netlbl_af6list_add(&map->list, &addrmap->list6); | 228 | ret_val = netlbl_af6list_add(&map->list, &addrmap->list6); |
229 | if (ret_val != 0) { | 229 | if (ret_val != 0) { |
@@ -231,8 +231,8 @@ static int netlbl_mgmt_add_common(struct genl_info *info, | |||
231 | goto add_failure; | 231 | goto add_failure; |
232 | } | 232 | } |
233 | 233 | ||
234 | entry->type = NETLBL_NLTYPE_ADDRSELECT; | 234 | entry->def.type = NETLBL_NLTYPE_ADDRSELECT; |
235 | entry->type_def.addrsel = addrmap; | 235 | entry->def.addrsel = addrmap; |
236 | #endif /* IPv6 */ | 236 | #endif /* IPv6 */ |
237 | } | 237 | } |
238 | 238 | ||
@@ -281,14 +281,13 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, | |||
281 | return ret_val; | 281 | return ret_val; |
282 | } | 282 | } |
283 | 283 | ||
284 | switch (entry->type) { | 284 | switch (entry->def.type) { |
285 | case NETLBL_NLTYPE_ADDRSELECT: | 285 | case NETLBL_NLTYPE_ADDRSELECT: |
286 | nla_a = nla_nest_start(skb, NLBL_MGMT_A_SELECTORLIST); | 286 | nla_a = nla_nest_start(skb, NLBL_MGMT_A_SELECTORLIST); |
287 | if (nla_a == NULL) | 287 | if (nla_a == NULL) |
288 | return -ENOMEM; | 288 | return -ENOMEM; |
289 | 289 | ||
290 | netlbl_af4list_foreach_rcu(iter4, | 290 | netlbl_af4list_foreach_rcu(iter4, &entry->def.addrsel->list4) { |
291 | &entry->type_def.addrsel->list4) { | ||
292 | struct netlbl_domaddr4_map *map4; | 291 | struct netlbl_domaddr4_map *map4; |
293 | struct in_addr addr_struct; | 292 | struct in_addr addr_struct; |
294 | 293 | ||
@@ -310,13 +309,13 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, | |||
310 | return ret_val; | 309 | return ret_val; |
311 | map4 = netlbl_domhsh_addr4_entry(iter4); | 310 | map4 = netlbl_domhsh_addr4_entry(iter4); |
312 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, | 311 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, |
313 | map4->type); | 312 | map4->def.type); |
314 | if (ret_val != 0) | 313 | if (ret_val != 0) |
315 | return ret_val; | 314 | return ret_val; |
316 | switch (map4->type) { | 315 | switch (map4->def.type) { |
317 | case NETLBL_NLTYPE_CIPSOV4: | 316 | case NETLBL_NLTYPE_CIPSOV4: |
318 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_CV4DOI, | 317 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_CV4DOI, |
319 | map4->type_def.cipsov4->doi); | 318 | map4->def.cipso->doi); |
320 | if (ret_val != 0) | 319 | if (ret_val != 0) |
321 | return ret_val; | 320 | return ret_val; |
322 | break; | 321 | break; |
@@ -325,8 +324,7 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, | |||
325 | nla_nest_end(skb, nla_b); | 324 | nla_nest_end(skb, nla_b); |
326 | } | 325 | } |
327 | #if IS_ENABLED(CONFIG_IPV6) | 326 | #if IS_ENABLED(CONFIG_IPV6) |
328 | netlbl_af6list_foreach_rcu(iter6, | 327 | netlbl_af6list_foreach_rcu(iter6, &entry->def.addrsel->list6) { |
329 | &entry->type_def.addrsel->list6) { | ||
330 | struct netlbl_domaddr6_map *map6; | 328 | struct netlbl_domaddr6_map *map6; |
331 | 329 | ||
332 | nla_b = nla_nest_start(skb, NLBL_MGMT_A_ADDRSELECTOR); | 330 | nla_b = nla_nest_start(skb, NLBL_MGMT_A_ADDRSELECTOR); |
@@ -345,7 +343,7 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, | |||
345 | return ret_val; | 343 | return ret_val; |
346 | map6 = netlbl_domhsh_addr6_entry(iter6); | 344 | map6 = netlbl_domhsh_addr6_entry(iter6); |
347 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, | 345 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, |
348 | map6->type); | 346 | map6->def.type); |
349 | if (ret_val != 0) | 347 | if (ret_val != 0) |
350 | return ret_val; | 348 | return ret_val; |
351 | 349 | ||
@@ -356,14 +354,14 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, | |||
356 | nla_nest_end(skb, nla_a); | 354 | nla_nest_end(skb, nla_a); |
357 | break; | 355 | break; |
358 | case NETLBL_NLTYPE_UNLABELED: | 356 | case NETLBL_NLTYPE_UNLABELED: |
359 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, entry->type); | 357 | ret_val = nla_put_u32(skb,NLBL_MGMT_A_PROTOCOL,entry->def.type); |
360 | break; | 358 | break; |
361 | case NETLBL_NLTYPE_CIPSOV4: | 359 | case NETLBL_NLTYPE_CIPSOV4: |
362 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, entry->type); | 360 | ret_val = nla_put_u32(skb,NLBL_MGMT_A_PROTOCOL,entry->def.type); |
363 | if (ret_val != 0) | 361 | if (ret_val != 0) |
364 | return ret_val; | 362 | return ret_val; |
365 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_CV4DOI, | 363 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_CV4DOI, |
366 | entry->type_def.cipsov4->doi); | 364 | entry->def.cipso->doi); |
367 | break; | 365 | break; |
368 | } | 366 | } |
369 | 367 | ||
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index af3531926ee0..8f0897407a2c 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -1541,7 +1541,7 @@ int __init netlbl_unlabel_defconf(void) | |||
1541 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | 1541 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
1542 | if (entry == NULL) | 1542 | if (entry == NULL) |
1543 | return -ENOMEM; | 1543 | return -ENOMEM; |
1544 | entry->type = NETLBL_NLTYPE_UNLABELED; | 1544 | entry->def.type = NETLBL_NLTYPE_UNLABELED; |
1545 | ret_val = netlbl_domhsh_add_default(entry, &audit_info); | 1545 | ret_val = netlbl_domhsh_add_default(entry, &audit_info); |
1546 | if (ret_val != 0) | 1546 | if (ret_val != 0) |
1547 | return ret_val; | 1547 | return ret_val; |
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 2fd6dbea327a..512718adb0d5 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -571,7 +571,7 @@ static int genl_family_rcv_msg(struct genl_family *family, | |||
571 | !capable(CAP_NET_ADMIN)) | 571 | !capable(CAP_NET_ADMIN)) |
572 | return -EPERM; | 572 | return -EPERM; |
573 | 573 | ||
574 | if (nlh->nlmsg_flags & NLM_F_DUMP) { | 574 | if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) { |
575 | struct netlink_dump_control c = { | 575 | struct netlink_dump_control c = { |
576 | .dump = ops->dumpit, | 576 | .dump = ops->dumpit, |
577 | .done = ops->done, | 577 | .done = ops->done, |
@@ -877,8 +877,10 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info) | |||
877 | #ifdef CONFIG_MODULES | 877 | #ifdef CONFIG_MODULES |
878 | if (res == NULL) { | 878 | if (res == NULL) { |
879 | genl_unlock(); | 879 | genl_unlock(); |
880 | up_read(&cb_lock); | ||
880 | request_module("net-pf-%d-proto-%d-family-%s", | 881 | request_module("net-pf-%d-proto-%d-family-%s", |
881 | PF_NETLINK, NETLINK_GENERIC, name); | 882 | PF_NETLINK, NETLINK_GENERIC, name); |
883 | down_read(&cb_lock); | ||
882 | genl_lock(); | 884 | genl_lock(); |
883 | res = genl_family_find_byname(name); | 885 | res = genl_family_find_byname(name); |
884 | } | 886 | } |
diff --git a/net/nfc/core.c b/net/nfc/core.c index dc96a83aa6ab..1d074dd1650f 100644 --- a/net/nfc/core.c +++ b/net/nfc/core.c | |||
@@ -44,7 +44,7 @@ DEFINE_MUTEX(nfc_devlist_mutex); | |||
44 | /* NFC device ID bitmap */ | 44 | /* NFC device ID bitmap */ |
45 | static DEFINE_IDA(nfc_index_ida); | 45 | static DEFINE_IDA(nfc_index_ida); |
46 | 46 | ||
47 | int nfc_fw_upload(struct nfc_dev *dev, const char *firmware_name) | 47 | int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name) |
48 | { | 48 | { |
49 | int rc = 0; | 49 | int rc = 0; |
50 | 50 | ||
@@ -62,28 +62,28 @@ int nfc_fw_upload(struct nfc_dev *dev, const char *firmware_name) | |||
62 | goto error; | 62 | goto error; |
63 | } | 63 | } |
64 | 64 | ||
65 | if (!dev->ops->fw_upload) { | 65 | if (!dev->ops->fw_download) { |
66 | rc = -EOPNOTSUPP; | 66 | rc = -EOPNOTSUPP; |
67 | goto error; | 67 | goto error; |
68 | } | 68 | } |
69 | 69 | ||
70 | dev->fw_upload_in_progress = true; | 70 | dev->fw_download_in_progress = true; |
71 | rc = dev->ops->fw_upload(dev, firmware_name); | 71 | rc = dev->ops->fw_download(dev, firmware_name); |
72 | if (rc) | 72 | if (rc) |
73 | dev->fw_upload_in_progress = false; | 73 | dev->fw_download_in_progress = false; |
74 | 74 | ||
75 | error: | 75 | error: |
76 | device_unlock(&dev->dev); | 76 | device_unlock(&dev->dev); |
77 | return rc; | 77 | return rc; |
78 | } | 78 | } |
79 | 79 | ||
80 | int nfc_fw_upload_done(struct nfc_dev *dev, const char *firmware_name) | 80 | int nfc_fw_download_done(struct nfc_dev *dev, const char *firmware_name) |
81 | { | 81 | { |
82 | dev->fw_upload_in_progress = false; | 82 | dev->fw_download_in_progress = false; |
83 | 83 | ||
84 | return nfc_genl_fw_upload_done(dev, firmware_name); | 84 | return nfc_genl_fw_download_done(dev, firmware_name); |
85 | } | 85 | } |
86 | EXPORT_SYMBOL(nfc_fw_upload_done); | 86 | EXPORT_SYMBOL(nfc_fw_download_done); |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * nfc_dev_up - turn on the NFC device | 89 | * nfc_dev_up - turn on the NFC device |
@@ -110,7 +110,7 @@ int nfc_dev_up(struct nfc_dev *dev) | |||
110 | goto error; | 110 | goto error; |
111 | } | 111 | } |
112 | 112 | ||
113 | if (dev->fw_upload_in_progress) { | 113 | if (dev->fw_download_in_progress) { |
114 | rc = -EBUSY; | 114 | rc = -EBUSY; |
115 | goto error; | 115 | goto error; |
116 | } | 116 | } |
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index 7b1c186736eb..fe66908401f5 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c | |||
@@ -809,14 +809,14 @@ static void nfc_hci_recv_from_llc(struct nfc_hci_dev *hdev, struct sk_buff *skb) | |||
809 | } | 809 | } |
810 | } | 810 | } |
811 | 811 | ||
812 | static int hci_fw_upload(struct nfc_dev *nfc_dev, const char *firmware_name) | 812 | static int hci_fw_download(struct nfc_dev *nfc_dev, const char *firmware_name) |
813 | { | 813 | { |
814 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); | 814 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); |
815 | 815 | ||
816 | if (!hdev->ops->fw_upload) | 816 | if (!hdev->ops->fw_download) |
817 | return -ENOTSUPP; | 817 | return -ENOTSUPP; |
818 | 818 | ||
819 | return hdev->ops->fw_upload(hdev, firmware_name); | 819 | return hdev->ops->fw_download(hdev, firmware_name); |
820 | } | 820 | } |
821 | 821 | ||
822 | static struct nfc_ops hci_nfc_ops = { | 822 | static struct nfc_ops hci_nfc_ops = { |
@@ -831,7 +831,7 @@ static struct nfc_ops hci_nfc_ops = { | |||
831 | .im_transceive = hci_transceive, | 831 | .im_transceive = hci_transceive, |
832 | .tm_send = hci_tm_send, | 832 | .tm_send = hci_tm_send, |
833 | .check_presence = hci_check_presence, | 833 | .check_presence = hci_check_presence, |
834 | .fw_upload = hci_fw_upload, | 834 | .fw_download = hci_fw_download, |
835 | .discover_se = hci_discover_se, | 835 | .discover_se = hci_discover_se, |
836 | .enable_se = hci_enable_se, | 836 | .enable_se = hci_enable_se, |
837 | .disable_se = hci_disable_se, | 837 | .disable_se = hci_disable_se, |
diff --git a/net/nfc/nci/Kconfig b/net/nfc/nci/Kconfig index 2a2416080b4f..a4f1e42e3481 100644 --- a/net/nfc/nci/Kconfig +++ b/net/nfc/nci/Kconfig | |||
@@ -11,6 +11,7 @@ config NFC_NCI | |||
11 | 11 | ||
12 | config NFC_NCI_SPI | 12 | config NFC_NCI_SPI |
13 | depends on NFC_NCI && SPI | 13 | depends on NFC_NCI && SPI |
14 | select CRC_CCITT | ||
14 | bool "NCI over SPI protocol support" | 15 | bool "NCI over SPI protocol support" |
15 | default n | 16 | default n |
16 | help | 17 | help |
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index b05ad909778f..f16fd59d4160 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c | |||
@@ -1089,7 +1089,7 @@ exit: | |||
1089 | return rc; | 1089 | return rc; |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | static int nfc_genl_fw_upload(struct sk_buff *skb, struct genl_info *info) | 1092 | static int nfc_genl_fw_download(struct sk_buff *skb, struct genl_info *info) |
1093 | { | 1093 | { |
1094 | struct nfc_dev *dev; | 1094 | struct nfc_dev *dev; |
1095 | int rc; | 1095 | int rc; |
@@ -1108,13 +1108,13 @@ static int nfc_genl_fw_upload(struct sk_buff *skb, struct genl_info *info) | |||
1108 | nla_strlcpy(firmware_name, info->attrs[NFC_ATTR_FIRMWARE_NAME], | 1108 | nla_strlcpy(firmware_name, info->attrs[NFC_ATTR_FIRMWARE_NAME], |
1109 | sizeof(firmware_name)); | 1109 | sizeof(firmware_name)); |
1110 | 1110 | ||
1111 | rc = nfc_fw_upload(dev, firmware_name); | 1111 | rc = nfc_fw_download(dev, firmware_name); |
1112 | 1112 | ||
1113 | nfc_put_device(dev); | 1113 | nfc_put_device(dev); |
1114 | return rc; | 1114 | return rc; |
1115 | } | 1115 | } |
1116 | 1116 | ||
1117 | int nfc_genl_fw_upload_done(struct nfc_dev *dev, const char *firmware_name) | 1117 | int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name) |
1118 | { | 1118 | { |
1119 | struct sk_buff *msg; | 1119 | struct sk_buff *msg; |
1120 | void *hdr; | 1120 | void *hdr; |
@@ -1124,7 +1124,7 @@ int nfc_genl_fw_upload_done(struct nfc_dev *dev, const char *firmware_name) | |||
1124 | return -ENOMEM; | 1124 | return -ENOMEM; |
1125 | 1125 | ||
1126 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, | 1126 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, |
1127 | NFC_CMD_FW_UPLOAD); | 1127 | NFC_CMD_FW_DOWNLOAD); |
1128 | if (!hdr) | 1128 | if (!hdr) |
1129 | goto free_msg; | 1129 | goto free_msg; |
1130 | 1130 | ||
@@ -1251,8 +1251,8 @@ static struct genl_ops nfc_genl_ops[] = { | |||
1251 | .policy = nfc_genl_policy, | 1251 | .policy = nfc_genl_policy, |
1252 | }, | 1252 | }, |
1253 | { | 1253 | { |
1254 | .cmd = NFC_CMD_FW_UPLOAD, | 1254 | .cmd = NFC_CMD_FW_DOWNLOAD, |
1255 | .doit = nfc_genl_fw_upload, | 1255 | .doit = nfc_genl_fw_download, |
1256 | .policy = nfc_genl_policy, | 1256 | .policy = nfc_genl_policy, |
1257 | }, | 1257 | }, |
1258 | { | 1258 | { |
diff --git a/net/nfc/nfc.h b/net/nfc/nfc.h index ee85a1fc1b24..820a7850c36a 100644 --- a/net/nfc/nfc.h +++ b/net/nfc/nfc.h | |||
@@ -123,10 +123,10 @@ static inline void nfc_device_iter_exit(struct class_dev_iter *iter) | |||
123 | class_dev_iter_exit(iter); | 123 | class_dev_iter_exit(iter); |
124 | } | 124 | } |
125 | 125 | ||
126 | int nfc_fw_upload(struct nfc_dev *dev, const char *firmware_name); | 126 | int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name); |
127 | int nfc_genl_fw_upload_done(struct nfc_dev *dev, const char *firmware_name); | 127 | int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name); |
128 | 128 | ||
129 | int nfc_fw_upload_done(struct nfc_dev *dev, const char *firmware_name); | 129 | int nfc_fw_download_done(struct nfc_dev *dev, const char *firmware_name); |
130 | 130 | ||
131 | int nfc_dev_up(struct nfc_dev *dev); | 131 | int nfc_dev_up(struct nfc_dev *dev); |
132 | 132 | ||
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index ca8e0a57d945..1f9c31411f19 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c | |||
@@ -605,6 +605,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, | |||
605 | struct sockaddr_atmpvc pvc; | 605 | struct sockaddr_atmpvc pvc; |
606 | int state; | 606 | int state; |
607 | 607 | ||
608 | memset(&pvc, 0, sizeof(pvc)); | ||
608 | pvc.sap_family = AF_ATMPVC; | 609 | pvc.sap_family = AF_ATMPVC; |
609 | pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1; | 610 | pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1; |
610 | pvc.sap_addr.vpi = flow->vcc->vpi; | 611 | pvc.sap_addr.vpi = flow->vcc->vpi; |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 71a568862557..7a42c81a19eb 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -1465,6 +1465,7 @@ static int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl) | |||
1465 | unsigned char *b = skb_tail_pointer(skb); | 1465 | unsigned char *b = skb_tail_pointer(skb); |
1466 | struct tc_cbq_wrropt opt; | 1466 | struct tc_cbq_wrropt opt; |
1467 | 1467 | ||
1468 | memset(&opt, 0, sizeof(opt)); | ||
1468 | opt.flags = 0; | 1469 | opt.flags = 0; |
1469 | opt.allot = cl->allot; | 1470 | opt.allot = cl->allot; |
1470 | opt.priority = cl->priority + 1; | 1471 | opt.priority = cl->priority + 1; |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index c2124ea29f45..45e751527dfc 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -100,7 +100,7 @@ struct htb_class { | |||
100 | struct psched_ratecfg ceil; | 100 | struct psched_ratecfg ceil; |
101 | s64 buffer, cbuffer;/* token bucket depth/rate */ | 101 | s64 buffer, cbuffer;/* token bucket depth/rate */ |
102 | s64 mbuffer; /* max wait time */ | 102 | s64 mbuffer; /* max wait time */ |
103 | int prio; /* these two are used only by leaves... */ | 103 | u32 prio; /* these two are used only by leaves... */ |
104 | int quantum; /* but stored for parent-to-leaf return */ | 104 | int quantum; /* but stored for parent-to-leaf return */ |
105 | 105 | ||
106 | struct tcf_proto *filter_list; /* class attached filters */ | 106 | struct tcf_proto *filter_list; /* class attached filters */ |
diff --git a/net/socket.c b/net/socket.c index 829b460acb87..b2d7c629eeb9 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -106,7 +106,7 @@ | |||
106 | #include <linux/atalk.h> | 106 | #include <linux/atalk.h> |
107 | #include <net/busy_poll.h> | 107 | #include <net/busy_poll.h> |
108 | 108 | ||
109 | #ifdef CONFIG_NET_LL_RX_POLL | 109 | #ifdef CONFIG_NET_RX_BUSY_POLL |
110 | unsigned int sysctl_net_busy_read __read_mostly; | 110 | unsigned int sysctl_net_busy_read __read_mostly; |
111 | unsigned int sysctl_net_busy_poll __read_mostly; | 111 | unsigned int sysctl_net_busy_poll __read_mostly; |
112 | #endif | 112 | #endif |
diff --git a/net/sunrpc/auth_gss/gss_rpc_upcall.c b/net/sunrpc/auth_gss/gss_rpc_upcall.c index d304f41260f2..af7ffd447fee 100644 --- a/net/sunrpc/auth_gss/gss_rpc_upcall.c +++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c | |||
@@ -120,7 +120,7 @@ static int gssp_rpc_create(struct net *net, struct rpc_clnt **_clnt) | |||
120 | if (IS_ERR(clnt)) { | 120 | if (IS_ERR(clnt)) { |
121 | dprintk("RPC: failed to create AF_LOCAL gssproxy " | 121 | dprintk("RPC: failed to create AF_LOCAL gssproxy " |
122 | "client (errno %ld).\n", PTR_ERR(clnt)); | 122 | "client (errno %ld).\n", PTR_ERR(clnt)); |
123 | result = -PTR_ERR(clnt); | 123 | result = PTR_ERR(clnt); |
124 | *_clnt = NULL; | 124 | *_clnt = NULL; |
125 | goto out; | 125 | goto out; |
126 | } | 126 | } |
@@ -328,7 +328,6 @@ void gssp_free_upcall_data(struct gssp_upcall_data *data) | |||
328 | kfree(data->in_handle.data); | 328 | kfree(data->in_handle.data); |
329 | kfree(data->out_handle.data); | 329 | kfree(data->out_handle.data); |
330 | kfree(data->out_token.data); | 330 | kfree(data->out_token.data); |
331 | kfree(data->mech_oid.data); | ||
332 | free_svc_cred(&data->creds); | 331 | free_svc_cred(&data->creds); |
333 | } | 332 | } |
334 | 333 | ||
diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.c b/net/sunrpc/auth_gss/gss_rpc_xdr.c index 357f613df7ff..3c85d1c8a028 100644 --- a/net/sunrpc/auth_gss/gss_rpc_xdr.c +++ b/net/sunrpc/auth_gss/gss_rpc_xdr.c | |||
@@ -430,7 +430,7 @@ static int dummy_enc_nameattr_array(struct xdr_stream *xdr, | |||
430 | static int dummy_dec_nameattr_array(struct xdr_stream *xdr, | 430 | static int dummy_dec_nameattr_array(struct xdr_stream *xdr, |
431 | struct gssx_name_attr_array *naa) | 431 | struct gssx_name_attr_array *naa) |
432 | { | 432 | { |
433 | struct gssx_name_attr dummy; | 433 | struct gssx_name_attr dummy = { .attr = {.len = 0} }; |
434 | u32 count, i; | 434 | u32 count, i; |
435 | __be32 *p; | 435 | __be32 *p; |
436 | 436 | ||
@@ -493,12 +493,13 @@ static int gssx_enc_name(struct xdr_stream *xdr, | |||
493 | return err; | 493 | return err; |
494 | } | 494 | } |
495 | 495 | ||
496 | |||
496 | static int gssx_dec_name(struct xdr_stream *xdr, | 497 | static int gssx_dec_name(struct xdr_stream *xdr, |
497 | struct gssx_name *name) | 498 | struct gssx_name *name) |
498 | { | 499 | { |
499 | struct xdr_netobj dummy_netobj; | 500 | struct xdr_netobj dummy_netobj = { .len = 0 }; |
500 | struct gssx_name_attr_array dummy_name_attr_array; | 501 | struct gssx_name_attr_array dummy_name_attr_array = { .count = 0 }; |
501 | struct gssx_option_array dummy_option_array; | 502 | struct gssx_option_array dummy_option_array = { .count = 0 }; |
502 | int err; | 503 | int err; |
503 | 504 | ||
504 | /* name->display_name */ | 505 | /* name->display_name */ |
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index d0347d148b34..09fb638bcaa4 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -1180,6 +1180,7 @@ static int gss_proxy_save_rsc(struct cache_detail *cd, | |||
1180 | gm = gss_mech_get_by_OID(&ud->mech_oid); | 1180 | gm = gss_mech_get_by_OID(&ud->mech_oid); |
1181 | if (!gm) | 1181 | if (!gm) |
1182 | goto out; | 1182 | goto out; |
1183 | rsci.cred.cr_gss_mech = gm; | ||
1183 | 1184 | ||
1184 | status = -EINVAL; | 1185 | status = -EINVAL; |
1185 | /* mech-specific data: */ | 1186 | /* mech-specific data: */ |
@@ -1195,7 +1196,6 @@ static int gss_proxy_save_rsc(struct cache_detail *cd, | |||
1195 | rscp = rsc_update(cd, &rsci, rscp); | 1196 | rscp = rsc_update(cd, &rsci, rscp); |
1196 | status = 0; | 1197 | status = 0; |
1197 | out: | 1198 | out: |
1198 | gss_mech_put(gm); | ||
1199 | rsc_free(&rsci); | 1199 | rsc_free(&rsci); |
1200 | if (rscp) | 1200 | if (rscp) |
1201 | cache_put(&rscp->h, cd); | 1201 | cache_put(&rscp->h, cd); |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 74f6a704e374..ecbc4e3d83ad 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -1660,6 +1660,10 @@ call_connect(struct rpc_task *task) | |||
1660 | task->tk_action = call_connect_status; | 1660 | task->tk_action = call_connect_status; |
1661 | if (task->tk_status < 0) | 1661 | if (task->tk_status < 0) |
1662 | return; | 1662 | return; |
1663 | if (task->tk_flags & RPC_TASK_NOCONNECT) { | ||
1664 | rpc_exit(task, -ENOTCONN); | ||
1665 | return; | ||
1666 | } | ||
1663 | xprt_connect(task); | 1667 | xprt_connect(task); |
1664 | } | 1668 | } |
1665 | } | 1669 | } |
diff --git a/net/sunrpc/netns.h b/net/sunrpc/netns.h index 74d948f5d5a1..779742cfc1ff 100644 --- a/net/sunrpc/netns.h +++ b/net/sunrpc/netns.h | |||
@@ -23,6 +23,7 @@ struct sunrpc_net { | |||
23 | struct rpc_clnt *rpcb_local_clnt4; | 23 | struct rpc_clnt *rpcb_local_clnt4; |
24 | spinlock_t rpcb_clnt_lock; | 24 | spinlock_t rpcb_clnt_lock; |
25 | unsigned int rpcb_users; | 25 | unsigned int rpcb_users; |
26 | unsigned int rpcb_is_af_local : 1; | ||
26 | 27 | ||
27 | struct mutex gssp_lock; | 28 | struct mutex gssp_lock; |
28 | wait_queue_head_t gssp_wq; | 29 | wait_queue_head_t gssp_wq; |
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 3df764dc330c..1891a1022c17 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -204,13 +204,15 @@ void rpcb_put_local(struct net *net) | |||
204 | } | 204 | } |
205 | 205 | ||
206 | static void rpcb_set_local(struct net *net, struct rpc_clnt *clnt, | 206 | static void rpcb_set_local(struct net *net, struct rpc_clnt *clnt, |
207 | struct rpc_clnt *clnt4) | 207 | struct rpc_clnt *clnt4, |
208 | bool is_af_local) | ||
208 | { | 209 | { |
209 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); | 210 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); |
210 | 211 | ||
211 | /* Protected by rpcb_create_local_mutex */ | 212 | /* Protected by rpcb_create_local_mutex */ |
212 | sn->rpcb_local_clnt = clnt; | 213 | sn->rpcb_local_clnt = clnt; |
213 | sn->rpcb_local_clnt4 = clnt4; | 214 | sn->rpcb_local_clnt4 = clnt4; |
215 | sn->rpcb_is_af_local = is_af_local ? 1 : 0; | ||
214 | smp_wmb(); | 216 | smp_wmb(); |
215 | sn->rpcb_users = 1; | 217 | sn->rpcb_users = 1; |
216 | dprintk("RPC: created new rpcb local clients (rpcb_local_clnt: " | 218 | dprintk("RPC: created new rpcb local clients (rpcb_local_clnt: " |
@@ -238,6 +240,14 @@ static int rpcb_create_local_unix(struct net *net) | |||
238 | .program = &rpcb_program, | 240 | .program = &rpcb_program, |
239 | .version = RPCBVERS_2, | 241 | .version = RPCBVERS_2, |
240 | .authflavor = RPC_AUTH_NULL, | 242 | .authflavor = RPC_AUTH_NULL, |
243 | /* | ||
244 | * We turn off the idle timeout to prevent the kernel | ||
245 | * from automatically disconnecting the socket. | ||
246 | * Otherwise, we'd have to cache the mount namespace | ||
247 | * of the caller and somehow pass that to the socket | ||
248 | * reconnect code. | ||
249 | */ | ||
250 | .flags = RPC_CLNT_CREATE_NO_IDLE_TIMEOUT, | ||
241 | }; | 251 | }; |
242 | struct rpc_clnt *clnt, *clnt4; | 252 | struct rpc_clnt *clnt, *clnt4; |
243 | int result = 0; | 253 | int result = 0; |
@@ -263,7 +273,7 @@ static int rpcb_create_local_unix(struct net *net) | |||
263 | clnt4 = NULL; | 273 | clnt4 = NULL; |
264 | } | 274 | } |
265 | 275 | ||
266 | rpcb_set_local(net, clnt, clnt4); | 276 | rpcb_set_local(net, clnt, clnt4, true); |
267 | 277 | ||
268 | out: | 278 | out: |
269 | return result; | 279 | return result; |
@@ -315,7 +325,7 @@ static int rpcb_create_local_net(struct net *net) | |||
315 | clnt4 = NULL; | 325 | clnt4 = NULL; |
316 | } | 326 | } |
317 | 327 | ||
318 | rpcb_set_local(net, clnt, clnt4); | 328 | rpcb_set_local(net, clnt, clnt4, false); |
319 | 329 | ||
320 | out: | 330 | out: |
321 | return result; | 331 | return result; |
@@ -376,13 +386,16 @@ static struct rpc_clnt *rpcb_create(struct net *net, const char *hostname, | |||
376 | return rpc_create(&args); | 386 | return rpc_create(&args); |
377 | } | 387 | } |
378 | 388 | ||
379 | static int rpcb_register_call(struct rpc_clnt *clnt, struct rpc_message *msg) | 389 | static int rpcb_register_call(struct sunrpc_net *sn, struct rpc_clnt *clnt, struct rpc_message *msg, bool is_set) |
380 | { | 390 | { |
381 | int result, error = 0; | 391 | int flags = RPC_TASK_NOCONNECT; |
392 | int error, result = 0; | ||
382 | 393 | ||
394 | if (is_set || !sn->rpcb_is_af_local) | ||
395 | flags = RPC_TASK_SOFTCONN; | ||
383 | msg->rpc_resp = &result; | 396 | msg->rpc_resp = &result; |
384 | 397 | ||
385 | error = rpc_call_sync(clnt, msg, RPC_TASK_SOFTCONN); | 398 | error = rpc_call_sync(clnt, msg, flags); |
386 | if (error < 0) { | 399 | if (error < 0) { |
387 | dprintk("RPC: failed to contact local rpcbind " | 400 | dprintk("RPC: failed to contact local rpcbind " |
388 | "server (errno %d).\n", -error); | 401 | "server (errno %d).\n", -error); |
@@ -439,16 +452,19 @@ int rpcb_register(struct net *net, u32 prog, u32 vers, int prot, unsigned short | |||
439 | .rpc_argp = &map, | 452 | .rpc_argp = &map, |
440 | }; | 453 | }; |
441 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); | 454 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); |
455 | bool is_set = false; | ||
442 | 456 | ||
443 | dprintk("RPC: %sregistering (%u, %u, %d, %u) with local " | 457 | dprintk("RPC: %sregistering (%u, %u, %d, %u) with local " |
444 | "rpcbind\n", (port ? "" : "un"), | 458 | "rpcbind\n", (port ? "" : "un"), |
445 | prog, vers, prot, port); | 459 | prog, vers, prot, port); |
446 | 460 | ||
447 | msg.rpc_proc = &rpcb_procedures2[RPCBPROC_UNSET]; | 461 | msg.rpc_proc = &rpcb_procedures2[RPCBPROC_UNSET]; |
448 | if (port) | 462 | if (port != 0) { |
449 | msg.rpc_proc = &rpcb_procedures2[RPCBPROC_SET]; | 463 | msg.rpc_proc = &rpcb_procedures2[RPCBPROC_SET]; |
464 | is_set = true; | ||
465 | } | ||
450 | 466 | ||
451 | return rpcb_register_call(sn->rpcb_local_clnt, &msg); | 467 | return rpcb_register_call(sn, sn->rpcb_local_clnt, &msg, is_set); |
452 | } | 468 | } |
453 | 469 | ||
454 | /* | 470 | /* |
@@ -461,6 +477,7 @@ static int rpcb_register_inet4(struct sunrpc_net *sn, | |||
461 | const struct sockaddr_in *sin = (const struct sockaddr_in *)sap; | 477 | const struct sockaddr_in *sin = (const struct sockaddr_in *)sap; |
462 | struct rpcbind_args *map = msg->rpc_argp; | 478 | struct rpcbind_args *map = msg->rpc_argp; |
463 | unsigned short port = ntohs(sin->sin_port); | 479 | unsigned short port = ntohs(sin->sin_port); |
480 | bool is_set = false; | ||
464 | int result; | 481 | int result; |
465 | 482 | ||
466 | map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL); | 483 | map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL); |
@@ -471,10 +488,12 @@ static int rpcb_register_inet4(struct sunrpc_net *sn, | |||
471 | map->r_addr, map->r_netid); | 488 | map->r_addr, map->r_netid); |
472 | 489 | ||
473 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; | 490 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; |
474 | if (port) | 491 | if (port != 0) { |
475 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; | 492 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; |
493 | is_set = true; | ||
494 | } | ||
476 | 495 | ||
477 | result = rpcb_register_call(sn->rpcb_local_clnt4, msg); | 496 | result = rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, is_set); |
478 | kfree(map->r_addr); | 497 | kfree(map->r_addr); |
479 | return result; | 498 | return result; |
480 | } | 499 | } |
@@ -489,6 +508,7 @@ static int rpcb_register_inet6(struct sunrpc_net *sn, | |||
489 | const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)sap; | 508 | const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)sap; |
490 | struct rpcbind_args *map = msg->rpc_argp; | 509 | struct rpcbind_args *map = msg->rpc_argp; |
491 | unsigned short port = ntohs(sin6->sin6_port); | 510 | unsigned short port = ntohs(sin6->sin6_port); |
511 | bool is_set = false; | ||
492 | int result; | 512 | int result; |
493 | 513 | ||
494 | map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL); | 514 | map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL); |
@@ -499,10 +519,12 @@ static int rpcb_register_inet6(struct sunrpc_net *sn, | |||
499 | map->r_addr, map->r_netid); | 519 | map->r_addr, map->r_netid); |
500 | 520 | ||
501 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; | 521 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; |
502 | if (port) | 522 | if (port != 0) { |
503 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; | 523 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; |
524 | is_set = true; | ||
525 | } | ||
504 | 526 | ||
505 | result = rpcb_register_call(sn->rpcb_local_clnt4, msg); | 527 | result = rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, is_set); |
506 | kfree(map->r_addr); | 528 | kfree(map->r_addr); |
507 | return result; | 529 | return result; |
508 | } | 530 | } |
@@ -519,7 +541,7 @@ static int rpcb_unregister_all_protofamilies(struct sunrpc_net *sn, | |||
519 | map->r_addr = ""; | 541 | map->r_addr = ""; |
520 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; | 542 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; |
521 | 543 | ||
522 | return rpcb_register_call(sn->rpcb_local_clnt4, msg); | 544 | return rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, false); |
523 | } | 545 | } |
524 | 546 | ||
525 | /** | 547 | /** |
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 305374d4fb98..7762b9f8a8b7 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -1193,7 +1193,9 @@ static int svc_tcp_has_wspace(struct svc_xprt *xprt) | |||
1193 | if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) | 1193 | if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) |
1194 | return 1; | 1194 | return 1; |
1195 | required = atomic_read(&xprt->xpt_reserved) + serv->sv_max_mesg; | 1195 | required = atomic_read(&xprt->xpt_reserved) + serv->sv_max_mesg; |
1196 | if (sk_stream_wspace(svsk->sk_sk) >= required) | 1196 | if (sk_stream_wspace(svsk->sk_sk) >= required || |
1197 | (sk_stream_min_wspace(svsk->sk_sk) == 0 && | ||
1198 | atomic_read(&xprt->xpt_reserved) == 0)) | ||
1197 | return 1; | 1199 | return 1; |
1198 | set_bit(SOCK_NOSPACE, &svsk->sk_sock->flags); | 1200 | set_bit(SOCK_NOSPACE, &svsk->sk_sock->flags); |
1199 | return 0; | 1201 | return 0; |
diff --git a/net/tipc/server.c b/net/tipc/server.c index 19da5abe0fa6..fd3fa57a410e 100644 --- a/net/tipc/server.c +++ b/net/tipc/server.c | |||
@@ -355,8 +355,12 @@ static int tipc_open_listening_sock(struct tipc_server *s) | |||
355 | return PTR_ERR(con); | 355 | return PTR_ERR(con); |
356 | 356 | ||
357 | sock = tipc_create_listen_sock(con); | 357 | sock = tipc_create_listen_sock(con); |
358 | if (!sock) | 358 | if (!sock) { |
359 | idr_remove(&s->conn_idr, con->conid); | ||
360 | s->idr_in_use--; | ||
361 | kfree(con); | ||
359 | return -EINVAL; | 362 | return -EINVAL; |
363 | } | ||
360 | 364 | ||
361 | tipc_register_callbacks(sock, con); | 365 | tipc_register_callbacks(sock, con); |
362 | return 0; | 366 | return 0; |
@@ -563,9 +567,14 @@ int tipc_server_start(struct tipc_server *s) | |||
563 | kmem_cache_destroy(s->rcvbuf_cache); | 567 | kmem_cache_destroy(s->rcvbuf_cache); |
564 | return ret; | 568 | return ret; |
565 | } | 569 | } |
570 | ret = tipc_open_listening_sock(s); | ||
571 | if (ret < 0) { | ||
572 | tipc_work_stop(s); | ||
573 | kmem_cache_destroy(s->rcvbuf_cache); | ||
574 | return ret; | ||
575 | } | ||
566 | s->enabled = 1; | 576 | s->enabled = 1; |
567 | 577 | return ret; | |
568 | return tipc_open_listening_sock(s); | ||
569 | } | 578 | } |
570 | 579 | ||
571 | void tipc_server_stop(struct tipc_server *s) | 580 | void tipc_server_stop(struct tipc_server *s) |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 1cc47aca7f05..25d217d90807 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -4770,9 +4770,9 @@ do { \ | |||
4770 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshForwarding, 0, 1, | 4770 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshForwarding, 0, 1, |
4771 | mask, NL80211_MESHCONF_FORWARDING, | 4771 | mask, NL80211_MESHCONF_FORWARDING, |
4772 | nla_get_u8); | 4772 | nla_get_u8); |
4773 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, 1, 255, | 4773 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, -255, 0, |
4774 | mask, NL80211_MESHCONF_RSSI_THRESHOLD, | 4774 | mask, NL80211_MESHCONF_RSSI_THRESHOLD, |
4775 | nla_get_u32); | 4775 | nla_get_s32); |
4776 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, ht_opmode, 0, 16, | 4776 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, ht_opmode, 0, 16, |
4777 | mask, NL80211_MESHCONF_HT_OPMODE, | 4777 | mask, NL80211_MESHCONF_HT_OPMODE, |
4778 | nla_get_u16); | 4778 | nla_get_u16); |
@@ -6613,12 +6613,14 @@ EXPORT_SYMBOL(cfg80211_testmode_alloc_event_skb); | |||
6613 | 6613 | ||
6614 | void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) | 6614 | void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) |
6615 | { | 6615 | { |
6616 | struct cfg80211_registered_device *rdev = ((void **)skb->cb)[0]; | ||
6616 | void *hdr = ((void **)skb->cb)[1]; | 6617 | void *hdr = ((void **)skb->cb)[1]; |
6617 | struct nlattr *data = ((void **)skb->cb)[2]; | 6618 | struct nlattr *data = ((void **)skb->cb)[2]; |
6618 | 6619 | ||
6619 | nla_nest_end(skb, data); | 6620 | nla_nest_end(skb, data); |
6620 | genlmsg_end(skb, hdr); | 6621 | genlmsg_end(skb, hdr); |
6621 | genlmsg_multicast(skb, 0, nl80211_testmode_mcgrp.id, gfp); | 6622 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), skb, 0, |
6623 | nl80211_testmode_mcgrp.id, gfp); | ||
6622 | } | 6624 | } |
6623 | EXPORT_SYMBOL(cfg80211_testmode_event); | 6625 | EXPORT_SYMBOL(cfg80211_testmode_event); |
6624 | #endif | 6626 | #endif |
@@ -10064,7 +10066,8 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, | |||
10064 | 10066 | ||
10065 | genlmsg_end(msg, hdr); | 10067 | genlmsg_end(msg, hdr); |
10066 | 10068 | ||
10067 | genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, gfp); | 10069 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, |
10070 | nl80211_mlme_mcgrp.id, gfp); | ||
10068 | return; | 10071 | return; |
10069 | 10072 | ||
10070 | nla_put_failure: | 10073 | nla_put_failure: |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 5a24c986f34b..de06d5d1287f 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -2247,10 +2247,13 @@ int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
2247 | 2247 | ||
2248 | void wiphy_regulatory_register(struct wiphy *wiphy) | 2248 | void wiphy_regulatory_register(struct wiphy *wiphy) |
2249 | { | 2249 | { |
2250 | struct regulatory_request *lr; | ||
2251 | |||
2250 | if (!reg_dev_ignore_cell_hint(wiphy)) | 2252 | if (!reg_dev_ignore_cell_hint(wiphy)) |
2251 | reg_num_devs_support_basehint++; | 2253 | reg_num_devs_support_basehint++; |
2252 | 2254 | ||
2253 | wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE); | 2255 | lr = get_last_request(); |
2256 | wiphy_update_regulatory(wiphy, lr->initiator); | ||
2254 | } | 2257 | } |
2255 | 2258 | ||
2256 | void wiphy_regulatory_deregister(struct wiphy *wiphy) | 2259 | void wiphy_regulatory_deregister(struct wiphy *wiphy) |
@@ -2279,7 +2282,9 @@ void wiphy_regulatory_deregister(struct wiphy *wiphy) | |||
2279 | static void reg_timeout_work(struct work_struct *work) | 2282 | static void reg_timeout_work(struct work_struct *work) |
2280 | { | 2283 | { |
2281 | REG_DBG_PRINT("Timeout while waiting for CRDA to reply, restoring regulatory settings\n"); | 2284 | REG_DBG_PRINT("Timeout while waiting for CRDA to reply, restoring regulatory settings\n"); |
2285 | rtnl_lock(); | ||
2282 | restore_regulatory_settings(true); | 2286 | restore_regulatory_settings(true); |
2287 | rtnl_unlock(); | ||
2283 | } | 2288 | } |
2284 | 2289 | ||
2285 | int __init regulatory_init(void) | 2290 | int __init regulatory_init(void) |
diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 1d3cfb1a3f28..81c8a10d743c 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c | |||
@@ -34,8 +34,10 @@ struct cfg80211_conn { | |||
34 | CFG80211_CONN_SCAN_AGAIN, | 34 | CFG80211_CONN_SCAN_AGAIN, |
35 | CFG80211_CONN_AUTHENTICATE_NEXT, | 35 | CFG80211_CONN_AUTHENTICATE_NEXT, |
36 | CFG80211_CONN_AUTHENTICATING, | 36 | CFG80211_CONN_AUTHENTICATING, |
37 | CFG80211_CONN_AUTH_FAILED, | ||
37 | CFG80211_CONN_ASSOCIATE_NEXT, | 38 | CFG80211_CONN_ASSOCIATE_NEXT, |
38 | CFG80211_CONN_ASSOCIATING, | 39 | CFG80211_CONN_ASSOCIATING, |
40 | CFG80211_CONN_ASSOC_FAILED, | ||
39 | CFG80211_CONN_DEAUTH, | 41 | CFG80211_CONN_DEAUTH, |
40 | CFG80211_CONN_CONNECTED, | 42 | CFG80211_CONN_CONNECTED, |
41 | } state; | 43 | } state; |
@@ -164,6 +166,8 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev) | |||
164 | NULL, 0, | 166 | NULL, 0, |
165 | params->key, params->key_len, | 167 | params->key, params->key_len, |
166 | params->key_idx, NULL, 0); | 168 | params->key_idx, NULL, 0); |
169 | case CFG80211_CONN_AUTH_FAILED: | ||
170 | return -ENOTCONN; | ||
167 | case CFG80211_CONN_ASSOCIATE_NEXT: | 171 | case CFG80211_CONN_ASSOCIATE_NEXT: |
168 | BUG_ON(!rdev->ops->assoc); | 172 | BUG_ON(!rdev->ops->assoc); |
169 | wdev->conn->state = CFG80211_CONN_ASSOCIATING; | 173 | wdev->conn->state = CFG80211_CONN_ASSOCIATING; |
@@ -188,10 +192,17 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev) | |||
188 | WLAN_REASON_DEAUTH_LEAVING, | 192 | WLAN_REASON_DEAUTH_LEAVING, |
189 | false); | 193 | false); |
190 | return err; | 194 | return err; |
195 | case CFG80211_CONN_ASSOC_FAILED: | ||
196 | cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid, | ||
197 | NULL, 0, | ||
198 | WLAN_REASON_DEAUTH_LEAVING, false); | ||
199 | return -ENOTCONN; | ||
191 | case CFG80211_CONN_DEAUTH: | 200 | case CFG80211_CONN_DEAUTH: |
192 | cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid, | 201 | cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid, |
193 | NULL, 0, | 202 | NULL, 0, |
194 | WLAN_REASON_DEAUTH_LEAVING, false); | 203 | WLAN_REASON_DEAUTH_LEAVING, false); |
204 | /* free directly, disconnected event already sent */ | ||
205 | cfg80211_sme_free(wdev); | ||
195 | return 0; | 206 | return 0; |
196 | default: | 207 | default: |
197 | return 0; | 208 | return 0; |
@@ -371,7 +382,7 @@ bool cfg80211_sme_rx_assoc_resp(struct wireless_dev *wdev, u16 status) | |||
371 | return true; | 382 | return true; |
372 | } | 383 | } |
373 | 384 | ||
374 | wdev->conn->state = CFG80211_CONN_DEAUTH; | 385 | wdev->conn->state = CFG80211_CONN_ASSOC_FAILED; |
375 | schedule_work(&rdev->conn_work); | 386 | schedule_work(&rdev->conn_work); |
376 | return false; | 387 | return false; |
377 | } | 388 | } |
@@ -383,7 +394,13 @@ void cfg80211_sme_deauth(struct wireless_dev *wdev) | |||
383 | 394 | ||
384 | void cfg80211_sme_auth_timeout(struct wireless_dev *wdev) | 395 | void cfg80211_sme_auth_timeout(struct wireless_dev *wdev) |
385 | { | 396 | { |
386 | cfg80211_sme_free(wdev); | 397 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); |
398 | |||
399 | if (!wdev->conn) | ||
400 | return; | ||
401 | |||
402 | wdev->conn->state = CFG80211_CONN_AUTH_FAILED; | ||
403 | schedule_work(&rdev->conn_work); | ||
387 | } | 404 | } |
388 | 405 | ||
389 | void cfg80211_sme_disassoc(struct wireless_dev *wdev) | 406 | void cfg80211_sme_disassoc(struct wireless_dev *wdev) |
@@ -399,7 +416,13 @@ void cfg80211_sme_disassoc(struct wireless_dev *wdev) | |||
399 | 416 | ||
400 | void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev) | 417 | void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev) |
401 | { | 418 | { |
402 | cfg80211_sme_disassoc(wdev); | 419 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); |
420 | |||
421 | if (!wdev->conn) | ||
422 | return; | ||
423 | |||
424 | wdev->conn->state = CFG80211_CONN_ASSOC_FAILED; | ||
425 | schedule_work(&rdev->conn_work); | ||
403 | } | 426 | } |
404 | 427 | ||
405 | static int cfg80211_sme_connect(struct wireless_dev *wdev, | 428 | static int cfg80211_sme_connect(struct wireless_dev *wdev, |
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 3f7682a387b7..eefbd10e408f 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -1998,12 +1998,11 @@ static void smk_ipv6_port_label(struct socket *sock, struct sockaddr *address) | |||
1998 | * | 1998 | * |
1999 | * Create or update the port list entry | 1999 | * Create or update the port list entry |
2000 | */ | 2000 | */ |
2001 | static int smk_ipv6_port_check(struct sock *sk, struct sockaddr *address, | 2001 | static int smk_ipv6_port_check(struct sock *sk, struct sockaddr_in6 *address, |
2002 | int act) | 2002 | int act) |
2003 | { | 2003 | { |
2004 | __be16 *bep; | 2004 | __be16 *bep; |
2005 | __be32 *be32p; | 2005 | __be32 *be32p; |
2006 | struct sockaddr_in6 *addr6; | ||
2007 | struct smk_port_label *spp; | 2006 | struct smk_port_label *spp; |
2008 | struct socket_smack *ssp = sk->sk_security; | 2007 | struct socket_smack *ssp = sk->sk_security; |
2009 | struct smack_known *skp; | 2008 | struct smack_known *skp; |
@@ -2025,10 +2024,9 @@ static int smk_ipv6_port_check(struct sock *sk, struct sockaddr *address, | |||
2025 | /* | 2024 | /* |
2026 | * Get the IP address and port from the address. | 2025 | * Get the IP address and port from the address. |
2027 | */ | 2026 | */ |
2028 | addr6 = (struct sockaddr_in6 *)address; | 2027 | port = ntohs(address->sin6_port); |
2029 | port = ntohs(addr6->sin6_port); | 2028 | bep = (__be16 *)(&address->sin6_addr); |
2030 | bep = (__be16 *)(&addr6->sin6_addr); | 2029 | be32p = (__be32 *)(&address->sin6_addr); |
2031 | be32p = (__be32 *)(&addr6->sin6_addr); | ||
2032 | 2030 | ||
2033 | /* | 2031 | /* |
2034 | * It's remote, so port lookup does no good. | 2032 | * It's remote, so port lookup does no good. |
@@ -2060,9 +2058,9 @@ auditout: | |||
2060 | ad.a.u.net->family = sk->sk_family; | 2058 | ad.a.u.net->family = sk->sk_family; |
2061 | ad.a.u.net->dport = port; | 2059 | ad.a.u.net->dport = port; |
2062 | if (act == SMK_RECEIVING) | 2060 | if (act == SMK_RECEIVING) |
2063 | ad.a.u.net->v6info.saddr = addr6->sin6_addr; | 2061 | ad.a.u.net->v6info.saddr = address->sin6_addr; |
2064 | else | 2062 | else |
2065 | ad.a.u.net->v6info.daddr = addr6->sin6_addr; | 2063 | ad.a.u.net->v6info.daddr = address->sin6_addr; |
2066 | #endif | 2064 | #endif |
2067 | return smk_access(skp, object, MAY_WRITE, &ad); | 2065 | return smk_access(skp, object, MAY_WRITE, &ad); |
2068 | } | 2066 | } |
@@ -2201,7 +2199,8 @@ static int smack_socket_connect(struct socket *sock, struct sockaddr *sap, | |||
2201 | case PF_INET6: | 2199 | case PF_INET6: |
2202 | if (addrlen < sizeof(struct sockaddr_in6)) | 2200 | if (addrlen < sizeof(struct sockaddr_in6)) |
2203 | return -EINVAL; | 2201 | return -EINVAL; |
2204 | rc = smk_ipv6_port_check(sock->sk, sap, SMK_CONNECTING); | 2202 | rc = smk_ipv6_port_check(sock->sk, (struct sockaddr_in6 *)sap, |
2203 | SMK_CONNECTING); | ||
2205 | break; | 2204 | break; |
2206 | } | 2205 | } |
2207 | return rc; | 2206 | return rc; |
@@ -3034,7 +3033,7 @@ static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg, | |||
3034 | int size) | 3033 | int size) |
3035 | { | 3034 | { |
3036 | struct sockaddr_in *sip = (struct sockaddr_in *) msg->msg_name; | 3035 | struct sockaddr_in *sip = (struct sockaddr_in *) msg->msg_name; |
3037 | struct sockaddr *sap = (struct sockaddr *) msg->msg_name; | 3036 | struct sockaddr_in6 *sap = (struct sockaddr_in6 *) msg->msg_name; |
3038 | int rc = 0; | 3037 | int rc = 0; |
3039 | 3038 | ||
3040 | /* | 3039 | /* |
@@ -3121,9 +3120,8 @@ static struct smack_known *smack_from_secattr(struct netlbl_lsm_secattr *sap, | |||
3121 | return smack_net_ambient; | 3120 | return smack_net_ambient; |
3122 | } | 3121 | } |
3123 | 3122 | ||
3124 | static int smk_skb_to_addr_ipv6(struct sk_buff *skb, struct sockaddr *sap) | 3123 | static int smk_skb_to_addr_ipv6(struct sk_buff *skb, struct sockaddr_in6 *sip) |
3125 | { | 3124 | { |
3126 | struct sockaddr_in6 *sip = (struct sockaddr_in6 *)sap; | ||
3127 | u8 nexthdr; | 3125 | u8 nexthdr; |
3128 | int offset; | 3126 | int offset; |
3129 | int proto = -EINVAL; | 3127 | int proto = -EINVAL; |
@@ -3181,7 +3179,7 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
3181 | struct netlbl_lsm_secattr secattr; | 3179 | struct netlbl_lsm_secattr secattr; |
3182 | struct socket_smack *ssp = sk->sk_security; | 3180 | struct socket_smack *ssp = sk->sk_security; |
3183 | struct smack_known *skp; | 3181 | struct smack_known *skp; |
3184 | struct sockaddr sadd; | 3182 | struct sockaddr_in6 sadd; |
3185 | int rc = 0; | 3183 | int rc = 0; |
3186 | struct smk_audit_info ad; | 3184 | struct smk_audit_info ad; |
3187 | #ifdef CONFIG_AUDIT | 3185 | #ifdef CONFIG_AUDIT |
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index 99db892d7299..98969541cbcc 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c | |||
@@ -743,7 +743,7 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg) | |||
743 | mutex_lock(&stream->device->lock); | 743 | mutex_lock(&stream->device->lock); |
744 | switch (_IOC_NR(cmd)) { | 744 | switch (_IOC_NR(cmd)) { |
745 | case _IOC_NR(SNDRV_COMPRESS_IOCTL_VERSION): | 745 | case _IOC_NR(SNDRV_COMPRESS_IOCTL_VERSION): |
746 | put_user(SNDRV_COMPRESS_VERSION, | 746 | retval = put_user(SNDRV_COMPRESS_VERSION, |
747 | (int __user *)arg) ? -EFAULT : 0; | 747 | (int __user *)arg) ? -EFAULT : 0; |
748 | break; | 748 | break; |
749 | case _IOC_NR(SNDRV_COMPRESS_GET_CAPS): | 749 | case _IOC_NR(SNDRV_COMPRESS_GET_CAPS): |
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c index 7c11d46b84d3..48a9d004d6d9 100644 --- a/sound/pci/hda/hda_auto_parser.c +++ b/sound/pci/hda/hda_auto_parser.c | |||
@@ -860,7 +860,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec, | |||
860 | } | 860 | } |
861 | } | 861 | } |
862 | if (id < 0 && quirk) { | 862 | if (id < 0 && quirk) { |
863 | for (q = quirk; q->subvendor; q++) { | 863 | for (q = quirk; q->subvendor || q->subdevice; q++) { |
864 | unsigned int vendorid = | 864 | unsigned int vendorid = |
865 | q->subdevice | (q->subvendor << 16); | 865 | q->subdevice | (q->subvendor << 16); |
866 | unsigned int mask = 0xffff0000 | q->subdevice_mask; | 866 | unsigned int mask = 0xffff0000 | q->subdevice_mask; |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 92b9b4324372..6d1924c19abf 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -2819,6 +2819,7 @@ static const struct hda_pintbl ecs202_pin_configs[] = { | |||
2819 | 2819 | ||
2820 | /* codec SSIDs for Intel Mac sharing the same PCI SSID 8384:7680 */ | 2820 | /* codec SSIDs for Intel Mac sharing the same PCI SSID 8384:7680 */ |
2821 | static const struct snd_pci_quirk stac922x_intel_mac_fixup_tbl[] = { | 2821 | static const struct snd_pci_quirk stac922x_intel_mac_fixup_tbl[] = { |
2822 | SND_PCI_QUIRK(0x0000, 0x0100, "Mac Mini", STAC_INTEL_MAC_V3), | ||
2822 | SND_PCI_QUIRK(0x106b, 0x0800, "Mac", STAC_INTEL_MAC_V1), | 2823 | SND_PCI_QUIRK(0x106b, 0x0800, "Mac", STAC_INTEL_MAC_V1), |
2823 | SND_PCI_QUIRK(0x106b, 0x0600, "Mac", STAC_INTEL_MAC_V2), | 2824 | SND_PCI_QUIRK(0x106b, 0x0600, "Mac", STAC_INTEL_MAC_V2), |
2824 | SND_PCI_QUIRK(0x106b, 0x0700, "Mac", STAC_INTEL_MAC_V2), | 2825 | SND_PCI_QUIRK(0x106b, 0x0700, "Mac", STAC_INTEL_MAC_V2), |
diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c index d6f7694fcad4..c8a2de103c5f 100644 --- a/sound/soc/au1x/ac97c.c +++ b/sound/soc/au1x/ac97c.c | |||
@@ -341,7 +341,7 @@ static struct platform_driver au1xac97c_driver = { | |||
341 | .remove = au1xac97c_drvremove, | 341 | .remove = au1xac97c_drvremove, |
342 | }; | 342 | }; |
343 | 343 | ||
344 | module_platform_driver(&au1xac97c_driver); | 344 | module_platform_driver(au1xac97c_driver); |
345 | 345 | ||
346 | MODULE_LICENSE("GPL"); | 346 | MODULE_LICENSE("GPL"); |
347 | MODULE_DESCRIPTION("Au1000/1500/1100 AC97C ASoC driver"); | 347 | MODULE_DESCRIPTION("Au1000/1500/1100 AC97C ASoC driver"); |
diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c index efb1daecd0dd..e82eb373a731 100644 --- a/sound/soc/blackfin/bf5xx-ac97.c +++ b/sound/soc/blackfin/bf5xx-ac97.c | |||
@@ -294,11 +294,12 @@ static int asoc_bfin_ac97_probe(struct platform_device *pdev) | |||
294 | /* Request PB3 as reset pin */ | 294 | /* Request PB3 as reset pin */ |
295 | ret = devm_gpio_request_one(&pdev->dev, | 295 | ret = devm_gpio_request_one(&pdev->dev, |
296 | CONFIG_SND_BF5XX_RESET_GPIO_NUM, | 296 | CONFIG_SND_BF5XX_RESET_GPIO_NUM, |
297 | GPIOF_OUT_INIT_HIGH, "SND_AD198x RESET") { | 297 | GPIOF_OUT_INIT_HIGH, "SND_AD198x RESET"); |
298 | if (ret) { | ||
298 | dev_err(&pdev->dev, | 299 | dev_err(&pdev->dev, |
299 | "Failed to request GPIO_%d for reset: %d\n", | 300 | "Failed to request GPIO_%d for reset: %d\n", |
300 | CONFIG_SND_BF5XX_RESET_GPIO_NUM, ret); | 301 | CONFIG_SND_BF5XX_RESET_GPIO_NUM, ret); |
301 | goto gpio_err; | 302 | return ret; |
302 | } | 303 | } |
303 | #endif | 304 | #endif |
304 | 305 | ||
diff --git a/sound/soc/blackfin/bf5xx-ac97.h b/sound/soc/blackfin/bf5xx-ac97.h index 15c635e33f4d..0c3e22d90a8d 100644 --- a/sound/soc/blackfin/bf5xx-ac97.h +++ b/sound/soc/blackfin/bf5xx-ac97.h | |||
@@ -9,7 +9,6 @@ | |||
9 | #ifndef _BF5XX_AC97_H | 9 | #ifndef _BF5XX_AC97_H |
10 | #define _BF5XX_AC97_H | 10 | #define _BF5XX_AC97_H |
11 | 11 | ||
12 | extern struct snd_ac97_bus_ops bf5xx_ac97_ops; | ||
13 | extern struct snd_ac97 *ac97; | 12 | extern struct snd_ac97 *ac97; |
14 | /* Frame format in memory, only support stereo currently */ | 13 | /* Frame format in memory, only support stereo currently */ |
15 | struct ac97_frame { | 14 | struct ac97_frame { |
diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c index f5e835662cdc..10adc4145d46 100644 --- a/sound/soc/codecs/wm0010.c +++ b/sound/soc/codecs/wm0010.c | |||
@@ -410,6 +410,16 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec) | |||
410 | rec->command, rec->length); | 410 | rec->command, rec->length); |
411 | len = rec->length + 8; | 411 | len = rec->length + 8; |
412 | 412 | ||
413 | xfer = kzalloc(sizeof(*xfer), GFP_KERNEL); | ||
414 | if (!xfer) { | ||
415 | dev_err(codec->dev, "Failed to allocate xfer\n"); | ||
416 | ret = -ENOMEM; | ||
417 | goto abort; | ||
418 | } | ||
419 | |||
420 | xfer->codec = codec; | ||
421 | list_add_tail(&xfer->list, &xfer_list); | ||
422 | |||
413 | out = kzalloc(len, GFP_KERNEL); | 423 | out = kzalloc(len, GFP_KERNEL); |
414 | if (!out) { | 424 | if (!out) { |
415 | dev_err(codec->dev, | 425 | dev_err(codec->dev, |
@@ -417,6 +427,7 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec) | |||
417 | ret = -ENOMEM; | 427 | ret = -ENOMEM; |
418 | goto abort1; | 428 | goto abort1; |
419 | } | 429 | } |
430 | xfer->t.rx_buf = out; | ||
420 | 431 | ||
421 | img = kzalloc(len, GFP_KERNEL); | 432 | img = kzalloc(len, GFP_KERNEL); |
422 | if (!img) { | 433 | if (!img) { |
@@ -425,24 +436,13 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec) | |||
425 | ret = -ENOMEM; | 436 | ret = -ENOMEM; |
426 | goto abort1; | 437 | goto abort1; |
427 | } | 438 | } |
439 | xfer->t.tx_buf = img; | ||
428 | 440 | ||
429 | byte_swap_64((u64 *)&rec->command, img, len); | 441 | byte_swap_64((u64 *)&rec->command, img, len); |
430 | 442 | ||
431 | xfer = kzalloc(sizeof(*xfer), GFP_KERNEL); | ||
432 | if (!xfer) { | ||
433 | dev_err(codec->dev, "Failed to allocate xfer\n"); | ||
434 | ret = -ENOMEM; | ||
435 | goto abort1; | ||
436 | } | ||
437 | |||
438 | xfer->codec = codec; | ||
439 | list_add_tail(&xfer->list, &xfer_list); | ||
440 | |||
441 | spi_message_init(&xfer->m); | 443 | spi_message_init(&xfer->m); |
442 | xfer->m.complete = wm0010_boot_xfer_complete; | 444 | xfer->m.complete = wm0010_boot_xfer_complete; |
443 | xfer->m.context = xfer; | 445 | xfer->m.context = xfer; |
444 | xfer->t.tx_buf = img; | ||
445 | xfer->t.rx_buf = out; | ||
446 | xfer->t.len = len; | 446 | xfer->t.len = len; |
447 | xfer->t.bits_per_word = 8; | 447 | xfer->t.bits_per_word = 8; |
448 | 448 | ||
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index b94190820e8c..bd16010441cc 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -2733,7 +2733,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, | |||
2733 | } | 2733 | } |
2734 | 2734 | ||
2735 | mutex_unlock(&card->dapm_mutex); | 2735 | mutex_unlock(&card->dapm_mutex); |
2736 | return 0; | 2736 | return change; |
2737 | } | 2737 | } |
2738 | EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw); | 2738 | EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw); |
2739 | 2739 | ||
@@ -2861,7 +2861,6 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, | |||
2861 | struct soc_enum *e = | 2861 | struct soc_enum *e = |
2862 | (struct soc_enum *)kcontrol->private_value; | 2862 | (struct soc_enum *)kcontrol->private_value; |
2863 | int change; | 2863 | int change; |
2864 | int ret = 0; | ||
2865 | int wi; | 2864 | int wi; |
2866 | 2865 | ||
2867 | if (ucontrol->value.enumerated.item[0] >= e->max) | 2866 | if (ucontrol->value.enumerated.item[0] >= e->max) |
@@ -2881,7 +2880,7 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, | |||
2881 | } | 2880 | } |
2882 | 2881 | ||
2883 | mutex_unlock(&card->dapm_mutex); | 2882 | mutex_unlock(&card->dapm_mutex); |
2884 | return ret; | 2883 | return change; |
2885 | } | 2884 | } |
2886 | EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_virt); | 2885 | EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_virt); |
2887 | 2886 | ||
diff --git a/sound/usb/6fire/comm.c b/sound/usb/6fire/comm.c index 9e6e3ffd86bb..23452ee617e1 100644 --- a/sound/usb/6fire/comm.c +++ b/sound/usb/6fire/comm.c | |||
@@ -110,19 +110,37 @@ static int usb6fire_comm_send_buffer(u8 *buffer, struct usb_device *dev) | |||
110 | static int usb6fire_comm_write8(struct comm_runtime *rt, u8 request, | 110 | static int usb6fire_comm_write8(struct comm_runtime *rt, u8 request, |
111 | u8 reg, u8 value) | 111 | u8 reg, u8 value) |
112 | { | 112 | { |
113 | u8 buffer[13]; /* 13: maximum length of message */ | 113 | u8 *buffer; |
114 | int ret; | ||
115 | |||
116 | /* 13: maximum length of message */ | ||
117 | buffer = kmalloc(13, GFP_KERNEL); | ||
118 | if (!buffer) | ||
119 | return -ENOMEM; | ||
114 | 120 | ||
115 | usb6fire_comm_init_buffer(buffer, 0x00, request, reg, value, 0x00); | 121 | usb6fire_comm_init_buffer(buffer, 0x00, request, reg, value, 0x00); |
116 | return usb6fire_comm_send_buffer(buffer, rt->chip->dev); | 122 | ret = usb6fire_comm_send_buffer(buffer, rt->chip->dev); |
123 | |||
124 | kfree(buffer); | ||
125 | return ret; | ||
117 | } | 126 | } |
118 | 127 | ||
119 | static int usb6fire_comm_write16(struct comm_runtime *rt, u8 request, | 128 | static int usb6fire_comm_write16(struct comm_runtime *rt, u8 request, |
120 | u8 reg, u8 vl, u8 vh) | 129 | u8 reg, u8 vl, u8 vh) |
121 | { | 130 | { |
122 | u8 buffer[13]; /* 13: maximum length of message */ | 131 | u8 *buffer; |
132 | int ret; | ||
133 | |||
134 | /* 13: maximum length of message */ | ||
135 | buffer = kmalloc(13, GFP_KERNEL); | ||
136 | if (!buffer) | ||
137 | return -ENOMEM; | ||
123 | 138 | ||
124 | usb6fire_comm_init_buffer(buffer, 0x00, request, reg, vl, vh); | 139 | usb6fire_comm_init_buffer(buffer, 0x00, request, reg, vl, vh); |
125 | return usb6fire_comm_send_buffer(buffer, rt->chip->dev); | 140 | ret = usb6fire_comm_send_buffer(buffer, rt->chip->dev); |
141 | |||
142 | kfree(buffer); | ||
143 | return ret; | ||
126 | } | 144 | } |
127 | 145 | ||
128 | int usb6fire_comm_init(struct sfire_chip *chip) | 146 | int usb6fire_comm_init(struct sfire_chip *chip) |
@@ -135,6 +153,12 @@ int usb6fire_comm_init(struct sfire_chip *chip) | |||
135 | if (!rt) | 153 | if (!rt) |
136 | return -ENOMEM; | 154 | return -ENOMEM; |
137 | 155 | ||
156 | rt->receiver_buffer = kzalloc(COMM_RECEIVER_BUFSIZE, GFP_KERNEL); | ||
157 | if (!rt->receiver_buffer) { | ||
158 | kfree(rt); | ||
159 | return -ENOMEM; | ||
160 | } | ||
161 | |||
138 | urb = &rt->receiver; | 162 | urb = &rt->receiver; |
139 | rt->serial = 1; | 163 | rt->serial = 1; |
140 | rt->chip = chip; | 164 | rt->chip = chip; |
@@ -153,6 +177,7 @@ int usb6fire_comm_init(struct sfire_chip *chip) | |||
153 | urb->interval = 1; | 177 | urb->interval = 1; |
154 | ret = usb_submit_urb(urb, GFP_KERNEL); | 178 | ret = usb_submit_urb(urb, GFP_KERNEL); |
155 | if (ret < 0) { | 179 | if (ret < 0) { |
180 | kfree(rt->receiver_buffer); | ||
156 | kfree(rt); | 181 | kfree(rt); |
157 | snd_printk(KERN_ERR PREFIX "cannot create comm data receiver."); | 182 | snd_printk(KERN_ERR PREFIX "cannot create comm data receiver."); |
158 | return ret; | 183 | return ret; |
@@ -171,6 +196,9 @@ void usb6fire_comm_abort(struct sfire_chip *chip) | |||
171 | 196 | ||
172 | void usb6fire_comm_destroy(struct sfire_chip *chip) | 197 | void usb6fire_comm_destroy(struct sfire_chip *chip) |
173 | { | 198 | { |
174 | kfree(chip->comm); | 199 | struct comm_runtime *rt = chip->comm; |
200 | |||
201 | kfree(rt->receiver_buffer); | ||
202 | kfree(rt); | ||
175 | chip->comm = NULL; | 203 | chip->comm = NULL; |
176 | } | 204 | } |
diff --git a/sound/usb/6fire/comm.h b/sound/usb/6fire/comm.h index 6a0840b0dcff..780d5ed8e5d8 100644 --- a/sound/usb/6fire/comm.h +++ b/sound/usb/6fire/comm.h | |||
@@ -24,7 +24,7 @@ struct comm_runtime { | |||
24 | struct sfire_chip *chip; | 24 | struct sfire_chip *chip; |
25 | 25 | ||
26 | struct urb receiver; | 26 | struct urb receiver; |
27 | u8 receiver_buffer[COMM_RECEIVER_BUFSIZE]; | 27 | u8 *receiver_buffer; |
28 | 28 | ||
29 | u8 serial; /* urb serial */ | 29 | u8 serial; /* urb serial */ |
30 | 30 | ||
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 7a444b5501d9..659950e5b94f 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
@@ -591,17 +591,16 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep, | |||
591 | ep->stride = frame_bits >> 3; | 591 | ep->stride = frame_bits >> 3; |
592 | ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0; | 592 | ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0; |
593 | 593 | ||
594 | /* calculate max. frequency */ | 594 | /* assume max. frequency is 25% higher than nominal */ |
595 | if (ep->maxpacksize) { | 595 | ep->freqmax = ep->freqn + (ep->freqn >> 2); |
596 | maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3)) | ||
597 | >> (16 - ep->datainterval); | ||
598 | /* but wMaxPacketSize might reduce this */ | ||
599 | if (ep->maxpacksize && ep->maxpacksize < maxsize) { | ||
596 | /* whatever fits into a max. size packet */ | 600 | /* whatever fits into a max. size packet */ |
597 | maxsize = ep->maxpacksize; | 601 | maxsize = ep->maxpacksize; |
598 | ep->freqmax = (maxsize / (frame_bits >> 3)) | 602 | ep->freqmax = (maxsize / (frame_bits >> 3)) |
599 | << (16 - ep->datainterval); | 603 | << (16 - ep->datainterval); |
600 | } else { | ||
601 | /* no max. packet size: just take 25% higher than nominal */ | ||
602 | ep->freqmax = ep->freqn + (ep->freqn >> 2); | ||
603 | maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3)) | ||
604 | >> (16 - ep->datainterval); | ||
605 | } | 604 | } |
606 | 605 | ||
607 | if (ep->fill_max) | 606 | if (ep->fill_max) |